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

Hal Finkel hfinkel at anl.gov
Sat Mar 22 18:27:50 PDT 2014


----- Original Message -----
> From: "Duncan P. N. Exon Smith" <dexonsmith at apple.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: llvm-commits at cs.uiuc.edu
> Sent: Saturday, March 22, 2014 6:55:38 PM
> Subject: Re: [llvm] r204542 - [TableGen] Don't assert, produce an error, when an instruction has too few operands
> 
> testcase?

We currently gave a grand total of zero independent test cases for the encoder generator, and, I believe, zero test cases for TableGen error outputs. This is certainly worth improving, but if all goes well, the entire support for positional operands (including this functionality) will soon disappear, so I did not want to hold up this improvement while I built up a good set of tests for the encoder in general.

The next step, however, is to make the named matching support complex operands, which will allow all targets to switch completely away from positional operand matching. As I do this, I do intend to introduce a reasonable set of independent regression tests.

 -Hal

> 
> 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
> 
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list