[LLVMdev] bug in TableGen when generating RegisterInfo?

Alexandru Dura alexdura at gmail.com
Wed Sep 7 00:11:54 PDT 2011


Hello,

Based on TARGETRegisterInfo.td

def V0_q0 : TARGETReg<256, "v0">;
def V0_q1 : TARGETReg<257, "v0">;
def V0_q2 : TARGETReg<258, "v0">;
def V0_q3 : TARGETReg<259, "v0">;

def V0_l : TARGETRegWithSubregs<512, "v0", [V0_q0, V0_q1]>;
def V0_h : TARGETRegWithSubregs<513, "v0",  [V0_q2, V0_q3]>;

def V0 : TARGETRegWithSubregs<640, "v0", [V0_l, V0_h]>;

TableGen infers the following which it writes in TARGETGenRegisterInfo.inc:

 const unsigned V0_q0_Overlaps[] = { TARGET::V0_q0, TARGET::V0_l,
TARGET::V0, 0 };

that means that when V0_q0 gets written, all the registers it overlaps (i.e.
V0_q0, V0_l, V0) get dirty. All this is handled by RegisterInfoEmitter in
TableGen.

Best regards,
Alex


On Wed, Sep 7, 2011 at 3:52 AM, zhangzuyu <hitzzy at gmail.com> wrote:

>
>
> On Tue, Sep 6, 2011 at 9:34 PM, Alexandru Dura <alexdura at gmail.com> wrote:
>
>> Hi everyone,
>>
>> I found some peculiar behavior of TableGen when generating
>> [TARGET]GenRegisterInfo.inc. Some register overlaps are generated twice in
>> this file, leading to a compilation error.
>
>
> Hi,
>
> What do you mean "overlapped register"?
>
>
>
>> I think this is because in RegisterInfoEmitter.cpp, RegisterAliases are
>> declared as "std::map<Record*, std::set<Record*>, LessRecord>"
>>
>> and a requirement for std::map is that the comparison function
>> ("LessRecord") should correspond to a strict weak ordering; in this case
>> this points to :
>>
>>    "StringRef1.compare_numeric(StringRef2) < 0"
>>
>> which does not behave like strict weak ordering predicate on the set of
>> strings. I have attached an example built upon snippets from StringRef.cpp,
>> compiled with gcc version 4.4.5 (Debian 4.4.5-8) (I also saw that there is a
>> workaround for gcc 4.x ...).
>>
>> Please tell me if I am doing something wrong or this is a real bug.
>>
>> Thank you,
>> Alex
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>
>
> --
> Yours truly,
> Zhang Zuyu(张祖羽)
>
> -----------------------------------------------------------
> College of Computer Science and Technology, Harbin Engineering University
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110907/2a7be532/attachment.html>


More information about the llvm-dev mailing list