diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-09-06 19:11:01 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-09-06 19:11:01 +0000 |
| commit | 3e4582ada55dc9d01c668964ad4188efdb487bd5 (patch) | |
| tree | 337a4a38081496343db9006c6e7fa3b615b7b6ef /llvm/lib | |
| parent | db3e9975d0f959cb0d73f17940a716e5593c985b (diff) | |
| download | bcm5719-llvm-3e4582ada55dc9d01c668964ad4188efdb487bd5.tar.gz bcm5719-llvm-3e4582ada55dc9d01c668964ad4188efdb487bd5.zip | |
have AsmMatcherEmitter.cpp produce the hunk of code that gets included
into the middle of the class, and rework how the different sections of
the generated file are conditionally included for simplicity.
llvm-svn: 113163
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 9 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/AsmParser/X86AsmLexer.cpp | 9 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | 18 |
3 files changed, 16 insertions, 20 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 75e2a739bf1..fef8eb08103 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -95,11 +95,8 @@ private: /// @name Auto-generated Match Functions /// { - unsigned ComputeAvailableFeatures(const ARMSubtarget *Subtarget) const; - - bool MatchInstructionImpl(const SmallVectorImpl<MCParsedAsmOperand*> - &Operands, - MCInst &Inst); +#define GET_ASSEMBLER_HEADER +#include "ARMGenAsmMatcher.inc" /// } @@ -869,4 +866,6 @@ extern "C" void LLVMInitializeARMAsmParser() { LLVMInitializeARMAsmLexer(); } +#define GET_REGISTER_MATCHER +#define GET_MATCHER_IMPLEMENTATION #include "ARMGenAsmMatcher.inc" diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmLexer.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmLexer.cpp index 26797ab353b..ec73087a330 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmLexer.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmLexer.cpp @@ -65,9 +65,10 @@ public: } }; -} +} // end anonymous namespace -static unsigned MatchRegisterName(StringRef Name); +#define GET_REGISTER_MATCHER +#include "X86GenAsmMatcher.inc" AsmToken X86AsmLexer::LexTokenATT() { AsmToken lexedToken = lexDefinite(); @@ -162,7 +163,3 @@ extern "C" void LLVMInitializeX86AsmLexer() { RegisterAsmLexer<X86AsmLexer> X(TheX86_32Target); RegisterAsmLexer<X86AsmLexer> Y(TheX86_64Target); } - -#define REGISTERS_ONLY -#include "X86GenAsmMatcher.inc" -#undef REGISTERS_ONLY diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index 6dcb7f554be..7e922ed4f86 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -56,12 +56,10 @@ private: /// @name Auto-generated Matcher Functions /// { - - unsigned ComputeAvailableFeatures(const X86Subtarget *Subtarget) const; - - bool MatchInstructionImpl( - const SmallVectorImpl<MCParsedAsmOperand*> &Operands, MCInst &Inst); - + +#define GET_ASSEMBLER_HEADER +#include "X86GenAsmMatcher.inc" + /// } public: @@ -882,9 +880,6 @@ X86ATTAsmParser::MatchInstruction(SMLoc IDLoc, MCInst &Inst) { assert(!Operands.empty() && "Unexpect empty operand list!"); - X86Operand *Op = static_cast<X86Operand*>(Operands[0]); - assert(Op->isToken() && "Leading operand should always be a mnemonic!"); - // First, try a direct match. if (!MatchInstructionImpl(Operands, Inst)) return false; @@ -894,6 +889,9 @@ X86ATTAsmParser::MatchInstruction(SMLoc IDLoc, // type. However, that requires substantially more matcher support than the // following hack. + X86Operand *Op = static_cast<X86Operand*>(Operands[0]); + assert(Op->isToken() && "Leading operand should always be a mnemonic!"); + // Change the operand to point to a temporary token. StringRef Base = Op->getToken(); SmallString<16> Tmp; @@ -966,4 +964,6 @@ extern "C" void LLVMInitializeX86AsmParser() { LLVMInitializeX86AsmLexer(); } +#define GET_REGISTER_MATCHER +#define GET_MATCHER_IMPLEMENTATION #include "X86GenAsmMatcher.inc" |

