mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-21 19:20:28 +00:00
Add a MnemonicIsValid method to the asm matcher.
Patch by Bill Wendling. llvm-svn: 124328
This commit is contained in:
parent
bd203876fa
commit
e93c1add9e
@ -1897,6 +1897,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
OS << " Match_Success, Match_MnemonicFail, Match_InvalidOperand,\n";
|
||||
OS << " Match_MissingFeature\n";
|
||||
OS << " };\n";
|
||||
OS << " bool MnemonicIsValid(StringRef Mnemonic);\n";
|
||||
OS << " MatchResultTy MatchInstructionImpl(\n";
|
||||
OS << " const SmallVectorImpl<MCParsedAsmOperand*> &Operands,\n";
|
||||
OS << " MCInst &Inst, unsigned &ErrorInfo);\n\n";
|
||||
@ -2013,6 +2014,16 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
||||
|
||||
OS << "};\n\n";
|
||||
|
||||
// A method to determine if a mnemonic is in the list.
|
||||
OS << "bool " << Target.getName() << ClassName << "::\n"
|
||||
<< "MnemonicIsValid(StringRef Mnemonic) {\n";
|
||||
OS << " // Search the table.\n";
|
||||
OS << " std::pair<const MatchEntry*, const MatchEntry*> MnemonicRange =\n";
|
||||
OS << " std::equal_range(MatchTable, MatchTable+"
|
||||
<< Info.Matchables.size() << ", Mnemonic, LessOpcode());\n";
|
||||
OS << " return MnemonicRange.first != MnemonicRange.second;\n";
|
||||
OS << "}\n\n";
|
||||
|
||||
// Finally, build the match function.
|
||||
OS << Target.getName() << ClassName << "::MatchResultTy "
|
||||
<< Target.getName() << ClassName << "::\n"
|
||||
|
Loading…
Reference in New Issue
Block a user