mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-09 10:29:21 +00:00
MC/Matcher: Add support for over-riding the default MatchInstruction function
name (for example, to allow targets to interpose the actual MatchInstruction function). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102987 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
31e8e1d085
commit
4f83e73a6d
@ -485,10 +485,10 @@ def REG_SEQUENCE : Instruction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// 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.
|
// .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).
|
// syntax on X86 for example).
|
||||||
//
|
//
|
||||||
class AsmParser {
|
class AsmParser {
|
||||||
@ -501,9 +501,13 @@ class AsmParser {
|
|||||||
// AsmParser class to call on every matched instruction. This can be used to
|
// AsmParser class to call on every matched instruction. This can be used to
|
||||||
// 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.
|
||||||
int Variant = 0;
|
int Variant = 0;
|
||||||
|
|
||||||
|
@ -1564,10 +1564,14 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
|||||||
Info.Instructions.begin(), ie = Info.Instructions.end();
|
Info.Instructions.begin(), ie = Info.Instructions.end();
|
||||||
it != ie; ++it)
|
it != ie; ++it)
|
||||||
MaxNumOperands = std::max(MaxNumOperands, (*it)->Operands.size());
|
MaxNumOperands = std::max(MaxNumOperands, (*it)->Operands.size());
|
||||||
|
|
||||||
OS << "bool " << Target.getName() << ClassName
|
const std::string &MatchName =
|
||||||
<< "::\nMatchInstruction(const SmallVectorImpl<MCParsedAsmOperand*> "
|
AsmParser->getValueAsString("MatchInstructionName");
|
||||||
"&Operands,\n MCInst &Inst) {\n";
|
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
|
// 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
Block a user