llvm.org GIT mirror llvm / f007e85
prune #includes in TargetAsmParser.h Pass in SMLoc of instr opcode into ParseInstruction. Make AsmToken be a class, not a struct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93457 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
6 changed file(s) with 17 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
1919 class Target;
2020
2121 /// AsmToken - Target independent representation for an assembler token.
22 struct AsmToken {
22 class AsmToken {
23 public:
2324 enum TokenKind {
2425 // Markers
2526 Eof, Error,
1717 /// between parsing an asm instruction and recognizing it.
1818 class MCParsedAsmOperand {
1919 public:
20 MCParsedAsmOperand();
21 virtual ~MCParsedAsmOperand() = 0;
20 MCParsedAsmOperand() {}
21 virtual ~MCParsedAsmOperand() {}
2222 // TODO: Out of line vfun.
2323 };
2424
99 #ifndef LLVM_TARGET_TARGETPARSER_H
1010 #define LLVM_TARGET_TARGETPARSER_H
1111
12 #include "llvm/MC/MCAsmLexer.h"
13
1412 namespace llvm {
1513 class MCAsmParser;
1614 class MCInst;
1715 class StringRef;
1816 class Target;
17 class SMLoc;
18 class AsmToken;
1919
2020 /// TargetAsmParser - Generic interface to target specific assembly parsers.
2121 class TargetAsmParser {
4444 /// \param Name - The instruction name.
4545 /// \param Inst [out] - On success, the parsed instruction.
4646 /// \return True on failure.
47 virtual bool ParseInstruction(const StringRef &Name, MCInst &Inst) = 0;
47 virtual bool ParseInstruction(const StringRef &Name, SMLoc NameLoc,
48 MCInst &Inst) = 0;
4849
4950 /// ParseDirective - Parse a target specific assembler directive
5051 ///
9494 ARMAsmParser(const Target &T, MCAsmParser &_Parser)
9595 : TargetAsmParser(T), Parser(_Parser) {}
9696
97 virtual bool ParseInstruction(const StringRef &Name, MCInst &Inst);
97 virtual bool ParseInstruction(const StringRef &Name, SMLoc NameLoc,
98 MCInst &Inst);
9899
99100 virtual bool ParseDirective(AsmToken DirectiveID);
100101 };
578579 }
579580
580581 /// Parse an arm instruction mnemonic followed by its operands.
581 bool ARMAsmParser::ParseInstruction(const StringRef &Name, MCInst &Inst) {
582 bool ARMAsmParser::ParseInstruction(const StringRef &Name, SMLoc NameLoc,
583 MCInst &Inst) {
582584 SmallVector Operands;
583585
584586 Operands.push_back(ARMOperand::CreateToken(Name));
5959 X86ATTAsmParser(const Target &T, MCAsmParser &_Parser)
6060 : TargetAsmParser(T), Parser(_Parser) {}
6161
62 virtual bool ParseInstruction(const StringRef &Name, MCInst &Inst);
62 virtual bool ParseInstruction(const StringRef &Name, SMLoc NameLoc,
63 MCInst &Inst);
6364
6465 virtual bool ParseDirective(AsmToken DirectiveID);
6566 };
400401 return false;
401402 }
402403
403 bool X86ATTAsmParser::ParseInstruction(const StringRef &Name, MCInst &Inst) {
404 bool X86ATTAsmParser::ParseInstruction(const StringRef &Name,
405 SMLoc NameLoc, MCInst &Inst) {
404406 SmallVector Operands;
405407
406408 Operands.push_back(X86Operand::CreateToken(Name));
710710 }
711711
712712 MCInst Inst;
713 if (getTargetParser().ParseInstruction(IDVal, Inst))
713 if (getTargetParser().ParseInstruction(IDVal, IDLoc, Inst))
714714 return true;
715715
716716 if (Lexer.isNot(AsmToken::EndOfStatement))