mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-14 01:40:53 +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) {
|
/// EmitMatchRegisterName - Emit the function to match a string to the target
|
||||||
CodeGenTarget Target;
|
/// specific register enum.
|
||||||
|
static void EmitMatchRegisterName(CodeGenTarget &Target, Record *AsmParser,
|
||||||
|
raw_ostream &OS) {
|
||||||
const std::vector<CodeGenRegister> &Registers = Target.getRegisters();
|
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");
|
OS << "bool " << Target.getName()
|
||||||
|
<< AsmParser->getValueAsString("AsmParserClassName")
|
||||||
EmitSourceFileHeader("Assembly Matcher Source Fragment", OS);
|
|
||||||
|
|
||||||
// Emit the function to match a register name to number.
|
|
||||||
|
|
||||||
OS << "bool " << Target.getName() << ClassName
|
|
||||||
<< "::MatchRegisterName(const StringRef &Name, unsigned &RegNo) {\n";
|
<< "::MatchRegisterName(const StringRef &Name, unsigned &RegNo) {\n";
|
||||||
|
|
||||||
// FIXME: TableGen should have a fast string matcher generator.
|
// FIXME: TableGen should have a fast string matcher generator.
|
||||||
@ -565,7 +560,19 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
|||||||
}
|
}
|
||||||
OS << " return true;\n";
|
OS << " return true;\n";
|
||||||
OS << "}\n\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;
|
std::vector<InstructionInfo*> Infos;
|
||||||
BuildInstructionInfos(Target, Infos);
|
BuildInstructionInfos(Target, Infos);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user