[llvm-commits] [llvm] r121166 - /llvm/trunk/utils/TableGen/FastISelEmitter.cpp

Eric Christopher echristo at apple.com
Tue Dec 7 13:44:51 PST 2010


On Dec 7, 2010, at 12:27 PM, Jim Grosbach wrote:

> 
> On Dec 7, 2010, at 11:53 AM, Eric Christopher wrote:
> 
>> 
>> On Dec 7, 2010, at 11:35 AM, Jim Grosbach wrote:
>> 
>>> Author: grosbach
>>> Date: Tue Dec  7 13:35:36 2010
>>> New Revision: 121166
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=121166&view=rev
>>> Log:
>>> Change assert to diagnostic. Message still needs work, but it's better than
>>> an assert, at least.
>>> 
>>>    };
>>> -    assert(!SimplePatterns[Operands][OpcodeName][VT][RetVT]
>>> -            .count(PredicateCheck) &&
>>> -           "Duplicate pattern!");
>>> +    // FIXME: Source location information for the diagnostic.
>>> +    if (SimplePatterns[Operands][OpcodeName][VT][RetVT]
>>> +            .count(PredicateCheck)) {
>>> +      SmallString<128> PatText;
>>> +      raw_svector_ostream OS(PatText);
>>> +      Pattern.SrcPattern->print(OS);
>>> +      throw "Duplicate record: " + OS.str().str();
>>> +    }
>>>    SimplePatterns[Operands][OpcodeName][VT][RetVT][PredicateCheck] = Memo;
>>>  }
>>> }
>> 
>> Hmm? What's going on here?
> 
> 
> If two tblgen records have the same pattern, they hit this. copy/paste errors or somesuch, usually. E.g.,
> 
> def Pat<(add GPR:$Rd, GPR:$Rn, GPR:$Rm)
> 		(ADD GPR:$Rd, GPR:$Rn, GPR:$Rm)>;
> def Pat<(add GPR:$Rd, GPR:$Rn, GPR:$Rm)
> 		(SUB GPR:$Rd, GPR:$Rn, GPR:$Rm)>;
> 
> These patterns have the same source pattern, and so will trigger this condition. The assert was only marginally helpful and darned ugly. The diagnostic is slightly more helpful, though still not what we really want (see FIXME), and a lot less ugly.

OK I guess. The assert meant such things wouldn't be missed, but seeing the message for each duplicate pattern may outweigh that :)

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101207/ca6abe10/attachment.html>


More information about the llvm-commits mailing list