mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
llvm-mc/AsmMatcher: Move emit for register -> enum matcher into a separate routine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78408 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ef80fe1025
commit
2234e5eee6
@ -538,19 +538,14 @@ static void ConstructConversionFunctions(CodeGenTarget &Target,
|
||||
}
|
||||
}
|
||||
|
||||
void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
CodeGenTarget Target;
|
||||
/// EmitMatchRegisterName - Emit the function to match a string to the target
|
||||
/// specific register enum.
|
||||
static void EmitMatchRegisterName(CodeGenTarget &Target, Record *AsmParser,
|
||||
raw_ostream &OS) {
|
||||
const std::vector<CodeGenRegister> &Registers = Target.getRegisters();
|
||||
Record *AsmParser = Target.getAsmParser();
|
||||
std::string ClassName = AsmParser->getValueAsString("AsmParserClassName");
|
||||
|
||||
std::string Namespace = Registers[0].TheDef->getValueAsString("Namespace");
|
||||
|
||||
EmitSourceFileHeader("Assembly Matcher Source Fragment", OS);
|
||||
|
||||
// Emit the function to match a register name to number.
|
||||
|
||||
OS << "bool " << Target.getName() << ClassName
|
||||
OS << "bool " << Target.getName()
|
||||
<< AsmParser->getValueAsString("AsmParserClassName")
|
||||
<< "::MatchRegisterName(const StringRef &Name, unsigned &RegNo) {\n";
|
||||
|
||||
// FIXME: TableGen should have a fast string matcher generator.
|
||||
@ -565,7 +560,19 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
}
|
||||
OS << " return true;\n";
|
||||
OS << "}\n\n";
|
||||
}
|
||||
|
||||
void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
CodeGenTarget Target;
|
||||
Record *AsmParser = Target.getAsmParser();
|
||||
std::string ClassName = AsmParser->getValueAsString("AsmParserClassName");
|
||||
|
||||
EmitSourceFileHeader("Assembly Matcher Source Fragment", OS);
|
||||
|
||||
// Emit the function to match a register name to number.
|
||||
EmitMatchRegisterName(Target, AsmParser, OS);
|
||||
|
||||
// Compute the information on the list of instructions to match.
|
||||
std::vector<InstructionInfo*> Infos;
|
||||
BuildInstructionInfos(Target, Infos);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user