diff options
author | Oliver Stannard <oliver.stannard@arm.com> | 2017-11-21 15:16:50 +0000 |
---|---|---|
committer | Oliver Stannard <oliver.stannard@arm.com> | 2017-11-21 15:16:50 +0000 |
commit | 1e73e95f3c82fcfdd9cd817d0b5989b697e4b05d (patch) | |
tree | 15054eb396a9bc704d84a233c4a066e3c2879abc /llvm/lib | |
parent | 6e94331259069aab6c2d15b4f31fca5bd0b0a1cc (diff) | |
download | bcm5719-llvm-1e73e95f3c82fcfdd9cd817d0b5989b697e4b05d.tar.gz bcm5719-llvm-1e73e95f3c82fcfdd9cd817d0b5989b697e4b05d.zip |
[Asm] Improve "too few operands" errors
- We can still emit this error if the actual instruction has two or more
operands missing compared to the expected one.
- We should only emit this error once per instruction.
Differential revision: https://reviews.llvm.org/D36746
llvm-svn: 318770
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 1d59cd1a745..2690eed45cd 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -10168,6 +10168,7 @@ ARMAsmParser::FilterNearMisses(SmallVectorImpl<NearMissInfo> &NearMissesIn, // to only report the widest one. std::multimap<unsigned, unsigned> OperandMissesSeen; SmallSet<uint64_t, 4> FeatureMissesSeen; + bool ReportedTooFewOperands = false; // Process the near-misses in reverse order, so that we see more general ones // first, and so can avoid emitting more specific ones. @@ -10288,9 +10289,12 @@ ARMAsmParser::FilterNearMisses(SmallVectorImpl<NearMissInfo> &NearMissesIn, break; } case NearMissInfo::NearMissTooFewOperands: { - SMLoc EndLoc = ((ARMOperand &)*Operands.back()).getEndLoc(); - NearMissesOut.emplace_back( - NearMissMessage{ EndLoc, StringRef("too few operands for instruction") }); + if (!ReportedTooFewOperands) { + SMLoc EndLoc = ((ARMOperand &)*Operands.back()).getEndLoc(); + NearMissesOut.emplace_back(NearMissMessage{ + EndLoc, StringRef("too few operands for instruction")}); + ReportedTooFewOperands = true; + } break; } case NearMissInfo::NoNearMiss: |