[llvm-commits] [llvm] r102987 - in /llvm/trunk: include/llvm/Target/Target.td utils/TableGen/AsmMatcherEmitter.cpp
Daniel Dunbar
daniel at zuster.org
Mon May 3 17:33:13 PDT 2010
Author: ddunbar
Date: Mon May 3 19:33:13 2010
New Revision: 102987
URL: http://llvm.org/viewvc/llvm-project?rev=102987&view=rev
Log:
MC/Matcher: Add support for over-riding the default MatchInstruction function
name (for example, to allow targets to interpose the actual MatchInstruction
function).
Modified:
llvm/trunk/include/llvm/Target/Target.td
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/trunk/include/llvm/Target/Target.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Target.td?rev=102987&r1=102986&r2=102987&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/Target.td (original)
+++ llvm/trunk/include/llvm/Target/Target.td Mon May 3 19:33:13 2010
@@ -485,10 +485,10 @@
}
//===----------------------------------------------------------------------===//
-// AsmParser - This class can be implemented by targets that wish to implement
+// AsmParser - This class can be implemented by targets that wish to implement
// .s file parsing.
//
-// Subtargets can have multiple different assembly parsers (e.g. AT&T vs Intel
+// Subtargets can have multiple different assembly parsers (e.g. AT&T vs Intel
// syntax on X86 for example).
//
class AsmParser {
@@ -501,9 +501,13 @@
// AsmParser class to call on every matched instruction. This can be used to
// perform target specific instruction post-processing.
string AsmParserInstCleanup = "";
-
+
+ // MatchInstructionName - The name of the instruction matching function to
+ // generate.
+ string MatchInstructionName = "MatchInstruction";
+
// Variant - AsmParsers can be of multiple different variants. Variants are
- // used to support targets that need to parser multiple formats for the
+ // used to support targets that need to parser multiple formats for the
// assembly language.
int Variant = 0;
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=102987&r1=102986&r2=102987&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Mon May 3 19:33:13 2010
@@ -1564,10 +1564,14 @@
Info.Instructions.begin(), ie = Info.Instructions.end();
it != ie; ++it)
MaxNumOperands = std::max(MaxNumOperands, (*it)->Operands.size());
-
- OS << "bool " << Target.getName() << ClassName
- << "::\nMatchInstruction(const SmallVectorImpl<MCParsedAsmOperand*> "
- "&Operands,\n MCInst &Inst) {\n";
+
+ const std::string &MatchName =
+ AsmParser->getValueAsString("MatchInstructionName");
+ OS << "bool " << Target.getName() << ClassName << "::\n"
+ << MatchName
+ << "(const SmallVectorImpl<MCParsedAsmOperand*> &Operands,\n";
+ OS.indent(MatchName.size() + 1);
+ OS << "MCInst &Inst) {\n";
// Emit the static match table; unused classes get initalized to 0 which is
// guaranteed to be InvalidMatchClass.
More information about the llvm-commits
mailing list