diff options
author | Oliver Stannard <oliver.stannard@arm.com> | 2017-12-04 12:02:32 +0000 |
---|---|---|
committer | Oliver Stannard <oliver.stannard@arm.com> | 2017-12-04 12:02:32 +0000 |
commit | a53a7f062724ce041e148dd26df1f2fb5073d8d6 (patch) | |
tree | 9c29f69b7d819ae105efc614123b0bdb404c5b5e /utils | |
parent | 62f11d908ed4e9b576d6769cfdbce3e215c40cd1 (diff) |
[Asm, ARM] Add fallback diag for multiple invalid operands
This adds a "invalid operands for instruction" diagnostic for
instructions where there is an instruction encoding with the correct
mnemonic and which is available for this target, but where multiple
operands do not match those which were provided. This makes it clear
that there is some combination of operands that is valid for the current
target, which the default diagnostic of "invalid instruction" does not.
Since this is a very general error, we only emit it if we don't have a
more specific error.
Differential revision: https://reviews.llvm.org/D36747
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319649 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/AsmMatcherEmitter.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp index 72fb53053fd..7739e4462b4 100644 --- a/utils/TableGen/AsmMatcherEmitter.cpp +++ b/utils/TableGen/AsmMatcherEmitter.cpp @@ -3275,7 +3275,6 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << " NearMissInfo FeaturesNearMiss = NearMissInfo::getSuccess();\n"; OS << " NearMissInfo EarlyPredicateNearMiss = NearMissInfo::getSuccess();\n"; OS << " NearMissInfo LatePredicateNearMiss = NearMissInfo::getSuccess();\n"; - OS << " bool MultipleInvalidOperands = false;\n"; } if (HasMnemonicFirst) { @@ -3314,11 +3313,12 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << " OperandNearMiss =\n"; OS << " NearMissInfo::getTooFewOperands(Formal, it->Opcode);\n"; OS << " } else if (OperandNearMiss.getKind() != NearMissInfo::NearMissTooFewOperands) {\n"; - OS << " // If more than one operand is invalid, give up on this match entry.\n"; + OS << " // An invalid operand plus a missing one at the end are reported the\n"; + OS << " // same way as multiple invalid operands.\n"; OS << " DEBUG_WITH_TYPE(\n"; OS << " \"asm-matcher\",\n"; OS << " dbgs() << \"second invalid operand, giving up on this opcode\\n\");\n"; - OS << " MultipleInvalidOperands = true;\n"; + OS << " OperandNearMiss = NearMissInfo::getMissedMultipleOperands(it->Opcode);\n"; OS << " break;\n"; OS << " }\n"; OS << " } else {\n"; @@ -3387,7 +3387,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << " DEBUG_WITH_TYPE(\n"; OS << " \"asm-matcher\",\n"; OS << " dbgs() << \"second operand mismatch, skipping this opcode\\n\");\n"; - OS << " MultipleInvalidOperands = true;\n"; + OS << " OperandNearMiss = NearMissInfo::getMissedMultipleOperands(it->Opcode);\n"; OS << " break;\n"; OS << " }\n"; OS << " }\n\n"; @@ -3409,15 +3409,14 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { OS << " }\n\n"; } - if (ReportMultipleNearMisses) - OS << " if (MultipleInvalidOperands) {\n"; - else + if (!ReportMultipleNearMisses) { OS << " if (!OperandsValid) {\n"; - OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Opcode result: multiple \"\n"; - OS << " \"operand mismatches, ignoring \"\n"; - OS << " \"this opcode\\n\");\n"; - OS << " continue;\n"; - OS << " }\n"; + OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Opcode result: multiple \"\n"; + OS << " \"operand mismatches, ignoring \"\n"; + OS << " \"this opcode\\n\");\n"; + OS << " continue;\n"; + OS << " }\n"; + } // Emit check that the required features are available. OS << " if ((AvailableFeatures & it->RequiredFeatures) " |