forked from OSchip/llvm-project
tblgen/AsmMatcher: Always emit the match function as 'MatchInstructionImpl',
target specific parsers can adapt the TargetAsmParser to this. llvm-svn: 110888
This commit is contained in:
parent
48595bf2bc
commit
167b9d7f30
|
@ -511,10 +511,6 @@ class AsmParser {
|
||||||
// perform target specific instruction post-processing.
|
// perform target specific instruction post-processing.
|
||||||
string AsmParserInstCleanup = "";
|
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
|
// 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.
|
// assembly language.
|
||||||
|
|
|
@ -80,13 +80,19 @@ private:
|
||||||
|
|
||||||
bool ParseDirectiveSyntax(SMLoc L);
|
bool ParseDirectiveSyntax(SMLoc L);
|
||||||
|
|
||||||
|
bool MatchInstruction(const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
||||||
|
MCInst &Inst) {
|
||||||
|
return MatchInstructionImpl(Operands, Inst);
|
||||||
|
}
|
||||||
|
|
||||||
/// @name Auto-generated Match Functions
|
/// @name Auto-generated Match Functions
|
||||||
/// {
|
/// {
|
||||||
|
|
||||||
unsigned ComputeAvailableFeatures(const ARMSubtarget *Subtarget) const;
|
unsigned ComputeAvailableFeatures(const ARMSubtarget *Subtarget) const;
|
||||||
|
|
||||||
bool MatchInstruction(const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
bool MatchInstructionImpl(const SmallVectorImpl<MCParsedAsmOperand*>
|
||||||
MCInst &Inst);
|
&Operands,
|
||||||
|
MCInst &Inst);
|
||||||
|
|
||||||
/// }
|
/// }
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,6 @@ include "X86CallingConv.td"
|
||||||
// Currently the X86 assembly parser only supports ATT syntax.
|
// Currently the X86 assembly parser only supports ATT syntax.
|
||||||
def ATTAsmParser : AsmParser {
|
def ATTAsmParser : AsmParser {
|
||||||
string AsmParserClassName = "ATTAsmParser";
|
string AsmParserClassName = "ATTAsmParser";
|
||||||
string MatchInstructionName = "MatchInstructionImpl";
|
|
||||||
int Variant = 0;
|
int Variant = 0;
|
||||||
|
|
||||||
// Discard comments in assembly strings.
|
// Discard comments in assembly strings.
|
||||||
|
|
|
@ -1699,13 +1699,10 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||||
it != ie; ++it)
|
it != ie; ++it)
|
||||||
MaxNumOperands = std::max(MaxNumOperands, (*it)->Operands.size());
|
MaxNumOperands = std::max(MaxNumOperands, (*it)->Operands.size());
|
||||||
|
|
||||||
const std::string &MatchName =
|
|
||||||
AsmParser->getValueAsString("MatchInstructionName");
|
|
||||||
OS << "bool " << Target.getName() << ClassName << "::\n"
|
OS << "bool " << Target.getName() << ClassName << "::\n"
|
||||||
<< MatchName
|
<< "MatchInstructionImpl(const SmallVectorImpl<MCParsedAsmOperand*>"
|
||||||
<< "(const SmallVectorImpl<MCParsedAsmOperand*> &Operands,\n";
|
<< " &Operands,\n";
|
||||||
OS.indent(MatchName.size() + 1);
|
OS << " MCInst &Inst) {\n";
|
||||||
OS << "MCInst &Inst) {\n";
|
|
||||||
|
|
||||||
// Emit the static match table; unused classes get initalized to 0 which is
|
// Emit the static match table; unused classes get initalized to 0 which is
|
||||||
// guaranteed to be InvalidMatchClass.
|
// guaranteed to be InvalidMatchClass.
|
||||||
|
|
Loading…
Reference in New Issue