mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
Modified the register matcher function in AsmMatcher to
be static. Also made it possible for clients to get it and no other functions from ...GenAsmMatcher.inc by defining REGISTERS_ONLY before including GenAsmMatcher.inc. This sets the stage for target-specific lexers that can identify registers and return AsmToken::Register as appropriate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94266 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2e369930dc
commit
e9b466d4f0
@ -50,10 +50,6 @@ private:
|
||||
bool MatchInstruction(const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
||||
MCInst &Inst);
|
||||
|
||||
/// MatchRegisterName - Match the given string to a register name, or 0 if
|
||||
/// there is no match.
|
||||
unsigned MatchRegisterName(const StringRef &Name);
|
||||
|
||||
/// }
|
||||
|
||||
public:
|
||||
@ -68,6 +64,12 @@ public:
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
/// @name Auto-generated Match Functions
|
||||
/// {
|
||||
|
||||
static unsigned MatchRegisterName(const StringRef &Name);
|
||||
|
||||
/// }
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -1390,9 +1390,7 @@ static void EmitMatchRegisterName(CodeGenTarget &Target, Record *AsmParser,
|
||||
"return " + utostr(i + 1) + ";"));
|
||||
}
|
||||
|
||||
OS << "unsigned " << Target.getName()
|
||||
<< AsmParser->getValueAsString("AsmParserClassName")
|
||||
<< "::MatchRegisterName(const StringRef &Name) {\n";
|
||||
OS << "static unsigned MatchRegisterName(const StringRef &Name) {\n";
|
||||
|
||||
EmitStringMatcher("Name", Matches, OS);
|
||||
|
||||
@ -1451,6 +1449,8 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
|
||||
// Emit the function to match a register name to number.
|
||||
EmitMatchRegisterName(Target, AsmParser, OS);
|
||||
|
||||
OS << "#ifndef REGISTERS_ONLY\n\n";
|
||||
|
||||
// Generate the unified function to convert operands into an MCInst.
|
||||
EmitConvertToMCInst(Target, Info.Instructions, OS);
|
||||
@ -1550,4 +1550,6 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
|
||||
OS << " return true;\n";
|
||||
OS << "}\n\n";
|
||||
|
||||
OS << "#endif // REGISTERS_ONLY\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user