[llvm] r204542 - [TableGen] Don't assert, produce an error, when an instruction has too few operands

Duncan P. N. Exon Smith dexonsmith at apple.com
Sat Mar 22 16:55:38 PDT 2014


testcase?

On 2014 Mar 22, at 04:33, Hal Finkel <hfinkel at anl.gov> wrote:

> Author: hfinkel
> Date: Sat Mar 22 06:33:32 2014
> New Revision: 204542
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=204542&view=rev
> Log:
> [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.
> 
> Modified:
>    llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
> 
> Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.cpp?rev=204542&r1=204541&r2=204542&view=diff
> ==============================================================================
> --- llvm/trunk/utils/TableGen/CodeEmitterGen.cpp (original)
> +++ llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Sat Mar 22 06:33:32 2014
> @@ -107,9 +107,20 @@ AddCodeToMergeInOperand(Record *R, BitsI
>     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++;
>   }
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list