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

Jim Grosbach grosbach at apple.com
Tue Dec 7 14:40:06 PST 2010


On Dec 7, 2010, at 2:36 PM, Chris Lattner wrote:

> 
> On Dec 7, 2010, at 12:27 PM, Jim Grosbach wrote:
> 
>>>> }
>>> 
>>> 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, do you have the record for the Pat pattern?  If you use:
>   throw TGError(TheDef->getLoc(), "message")
> then you'll get a caret pointing to the duplicate def in the error message.


I couldn't find the Record for the Pat. That's definitely what I really wanted. We have have the PatternToMatch entry, and from that we get the source pattern TreePatternNode. Is there a way to go from either of those to the corresponding Record?

-Jim



More information about the llvm-commits mailing list