diff options
author | Jim Grosbach <grosbach@apple.com> | 2011-08-16 20:12:35 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2011-08-16 20:12:35 +0000 |
commit | 578071a08734a4eb76484ba0a8d9f10b6e322184 (patch) | |
tree | 676c02e9e381d3cbed55123f8616944c2366b4fe /utils | |
parent | 1b84cce77f8bccc905b4800927ce9016f76c1c40 (diff) | |
download | external_llvm-578071a08734a4eb76484ba0a8d9f10b6e322184.zip external_llvm-578071a08734a4eb76484ba0a8d9f10b6e322184.tar.gz external_llvm-578071a08734a4eb76484ba0a8d9f10b6e322184.tar.bz2 |
Prefer diagnostics from target predicate in asm matcher.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137742 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/AsmMatcherEmitter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp index da1be26..558db7b 100644 --- a/utils/TableGen/AsmMatcherEmitter.cpp +++ b/utils/TableGen/AsmMatcherEmitter.cpp @@ -2349,6 +2349,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { 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 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { << " Match_Success) {\n" << " Inst.clear();\n" << " RetCode = MatchResult;\n" + << " HadMatchOtherThanPredicate = true;\n" << " continue;\n" << " }\n\n"; @@ -2426,8 +2428,9 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { 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()) |