[LLVMdev] question about code in FixedLenDecoderEmitter.cpp

Akira Hatanaka ahatanak at gmail.com
Tue Nov 27 15:02:34 PST 2012


I have a question about the code in
utils/TableGen/FixedLenDecoderEmitter.cpp (line 1150).

bool FilterChooser::emitPredicateMatch(raw_ostream &o, unsigned
&Indentation,
                                       unsigned Opc) const {
  ListInit *Predicates =
    AllInstructions[Opc]->TheDef->getValueAsListInit("Predicates");
  for (unsigned i = 0; i < Predicates->getSize(); ++i) {
    Record *Pred = Predicates->getElementAsRecord(i);
    if (!Pred->getValue("AssemblerMatcherPredicate"))
      continue;

The code above seems to be checking whether there exists a field named
"AssemblerMatcherPredicate" in record "Pred", but It seems to me that it
should be checking whether the field AssemblerMatcherPredicate's value is 1
or 0. class "Predicate" in Target.td has a field AssemblerMatcherPredicate,
so this will always return a non-null value.

I think this line should be:

if (!Pred->getValue("AssemblerMatcherPredicate")->getValue())

Pred->getValue returns a RecordVal object.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121127/55c08be4/attachment.html>


More information about the llvm-dev mailing list