diff options
author | Hal Finkel <hfinkel@anl.gov> | 2014-03-22 11:33:32 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2014-03-22 11:33:32 +0000 |
commit | f20a2199de396f13dae02512944c4f24b7b2b77c (patch) | |
tree | ad7d380f1c32b8b6b314b4b2929cabe9c70a0425 /utils | |
parent | 4e669c9278951b0531edccd2c6f8d45854c2cee7 (diff) | |
download | llvm-f20a2199de396f13dae02512944c4f24b7b2b77c.tar.gz llvm-f20a2199de396f13dae02512944c4f24b7b2b77c.tar.bz2 llvm-f20a2199de396f13dae02512944c4f24b7b2b77c.tar.xz |
[TableGen] Don't assert, produce an error, when an instruction has too few operands
When an instruction's operand list does not have a sufficient number of
operands to match with all of the variables that contribute to its
encoding, instead of asserting inside a call to getSubOperandNumber, produce an
informative error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204542 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/CodeEmitterGen.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp index a7fca06cf0..c28b97e042 100644 --- a/utils/TableGen/CodeEmitterGen.cpp +++ b/utils/TableGen/CodeEmitterGen.cpp @@ -107,9 +107,20 @@ AddCodeToMergeInOperand(Record *R, BitsInit *BI, const std::string &VarName, while (NumberedOp < NumberOps && (CGI.Operands.isFlatOperandNotEmitted(NumberedOp) || (NamedOpIndices.size() && NamedOpIndices.count( - CGI.Operands.getSubOperandNumber(NumberedOp).first)))) + CGI.Operands.getSubOperandNumber(NumberedOp).first)))) { ++NumberedOp; + if (NumberedOp >= CGI.Operands.back().MIOperandNo + + CGI.Operands.back().MINumOperands) { + errs() << "Too few operands in record " << R->getName() << + " (no match for variable " << VarName << "):\n"; + errs() << *R; + errs() << '\n'; + + return; + } + } + OpIdx = NumberedOp++; } |