aboutsummaryrefslogtreecommitdiff
path: root/utils/TableGen/AsmMatcherEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-06 19:22:17 +0000
committerChris Lattner <sabre@nondot.org>2010-09-06 19:22:17 +0000
commit79ed3f77e8b87615b80054ca6e4e3ba5e07445bd (patch)
tree858cfb1799b738f2844e27c78b21d4349def3e86 /utils/TableGen/AsmMatcherEmitter.cpp
parent702f2d42bb136f9f67e4ffaecb5f79b2369340ad (diff)
change MatchInstructionImpl to return an enum instead of bool.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113165 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/AsmMatcherEmitter.cpp')
-rw-r--r--utils/TableGen/AsmMatcherEmitter.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp
index 515916efde..1ecc1327b4 100644
--- a/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/utils/TableGen/AsmMatcherEmitter.cpp
@@ -1544,9 +1544,14 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
// Information for the class declaration.
OS << "\n#ifdef GET_ASSEMBLER_HEADER\n";
OS << "#undef GET_ASSEMBLER_HEADER\n";
+ OS << " // This should be included into the middle of the declaration of \n";
+ OS << " // your subclasses implementation of TargetAsmParser.\n";
OS << " unsigned ComputeAvailableFeatures(const " <<
Target.getName() << "Subtarget *Subtarget) const;\n";
- OS << "bool MatchInstructionImpl(const SmallVectorImpl<MCParsedAsmOperand*>"
+ OS << " enum MatchResultTy {\n";
+ OS << " Match_Success, Match_Fail\n";
+ OS << " };\n";
+ OS << " MatchResultTy MatchInstructionImpl(const SmallVectorImpl<MCParsedAsmOperand*>"
<< " &Operands, MCInst &Inst);\n\n";
OS << "#endif // GET_ASSEMBLER_HEADER_INFO\n\n";
@@ -1594,7 +1599,8 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
it != ie; ++it)
MaxNumOperands = std::max(MaxNumOperands, (*it)->Operands.size());
- OS << "bool " << Target.getName() << ClassName << "::\n"
+ OS << Target.getName() << ClassName << "::MatchResultTy "
+ << Target.getName() << ClassName << "::\n"
<< "MatchInstructionImpl(const SmallVectorImpl<MCParsedAsmOperand*>"
<< " &Operands,\n";
OS << " MCInst &Inst) {\n";
@@ -1653,7 +1659,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
// Emit code to compute the class list for this operand vector.
OS << " // Eliminate obvious mismatches.\n";
OS << " if (Operands.size() > " << MaxNumOperands << ")\n";
- OS << " return true;\n\n";
+ OS << " return Match_Fail;\n\n";
OS << " // Compute the class list for this operand vector.\n";
OS << " MatchClassKind Classes[" << MaxNumOperands << "];\n";
@@ -1662,7 +1668,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
OS << " // Check for invalid operands before matching.\n";
OS << " if (Classes[i] == InvalidMatchClass)\n";
- OS << " return true;\n";
+ OS << " return Match_Fail;\n";
OS << " }\n\n";
OS << " // Mark unused classes.\n";
@@ -1697,10 +1703,10 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
if (!InsnCleanupFn.empty())
OS << " " << InsnCleanupFn << "(Inst);\n";
- OS << " return false;\n";
+ OS << " return Match_Success;\n";
OS << " }\n\n";
- OS << " return true;\n";
+ OS << " return Match_Fail;\n";
OS << "}\n\n";
OS << "#endif // GET_MATCHER_IMPLEMENTATION\n\n";