• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- MCAsmParser.cpp - Abstract Asm Parser Interface -------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "llvm/MC/MCParser/MCAsmParser.h"
11 #include "llvm/MC/MCParser/MCAsmLexer.h"
12 #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
13 #include "llvm/MC/MCTargetAsmParser.h"
14 #include "llvm/Support/SourceMgr.h"
15 #include "llvm/Support/raw_ostream.h"
16 #include "llvm/Support/Debug.h"
17 #include "llvm/ADT/Twine.h"
18 using namespace llvm;
19 
MCAsmParser()20 MCAsmParser::MCAsmParser() : TargetParser(0), ShowParsedOperands(0) {
21 }
22 
~MCAsmParser()23 MCAsmParser::~MCAsmParser() {
24 }
25 
setTargetParser(MCTargetAsmParser & P)26 void MCAsmParser::setTargetParser(MCTargetAsmParser &P) {
27   assert(!TargetParser && "Target parser is already initialized!");
28   TargetParser = &P;
29   TargetParser->Initialize(*this);
30 }
31 
getTok()32 const AsmToken &MCAsmParser::getTok() {
33   return getLexer().getTok();
34 }
35 
TokError(const Twine & Msg)36 bool MCAsmParser::TokError(const Twine &Msg) {
37   Error(getLexer().getLoc(), Msg);
38   return true;
39 }
40 
ParseExpression(const MCExpr * & Res)41 bool MCAsmParser::ParseExpression(const MCExpr *&Res) {
42   SMLoc L;
43   return ParseExpression(Res, L);
44 }
45 
dump() const46 void MCParsedAsmOperand::dump() const {
47   dbgs() << "  " << *this;
48 }
49