[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
This commit is contained in:
Hal Finkel 2014-03-22 11:33:32 +00:00
parent 4e669c9278
commit f20a2199de

View File

@ -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++;
}