[llvm-commits] [llvm] r137742 - /llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Jim Grosbach
grosbach at apple.com
Tue Aug 16 13:12:36 PDT 2011
Author: grosbach
Date: Tue Aug 16 15:12:35 2011
New Revision: 137742
URL: http://llvm.org/viewvc/llvm-project?rev=137742&view=rev
Log:
Prefer diagnostics from target predicate in asm matcher.
Modified:
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=137742&r1=137741&r2=137742&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Tue Aug 16 15:12:35 2011
@@ -2349,6 +2349,7 @@
OS << " // Some state to try to produce better error messages.\n";
OS << " bool HadMatchOtherThanFeatures = false;\n";
+ OS << " bool HadMatchOtherThanPredicate = false;\n";
OS << " unsigned RetCode = Match_InvalidOperand;\n";
OS << " // Set ErrorInfo to the operand that mismatches if it is\n";
OS << " // wrong for all instances of the instruction.\n";
@@ -2413,6 +2414,7 @@
<< " Match_Success) {\n"
<< " Inst.clear();\n"
<< " RetCode = MatchResult;\n"
+ << " HadMatchOtherThanPredicate = true;\n"
<< " continue;\n"
<< " }\n\n";
@@ -2426,8 +2428,9 @@
OS << " }\n\n";
OS << " // Okay, we had no match. Try to return a useful error code.\n";
- OS << " if (HadMatchOtherThanFeatures) return Match_MissingFeature;\n";
- OS << " return RetCode;\n";
+ OS << " if (HadMatchOtherThanPredicate || !HadMatchOtherThanFeatures)";
+ OS << " return RetCode;\n";
+ OS << " return Match_MissingFeature;\n";
OS << "}\n\n";
if (Info.OperandMatchInfo.size())
More information about the llvm-commits
mailing list