This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Strange RTL


Hi all,

I'm seeing some confusing (to me :) RTL being generated from a simple
testcase, and was wondering if someone might be able to help me decode it,
and preferably help me stop it from being constructed.  :)

Here's the C code in question:

union X { void *B; };
union X foo() {
        union X A;
        A.B = (void*)123;   /* Interesting part */
        return A;
}

The RTL generated for the assignment is the following (this is from the
.00.rtl dump, Pmode=PDI):

(insn 10 5 15 (set (subreg:PDI (reg/v:DI 107) 0)
        (const_int 123 [0x7b])) -1 (nil)
    (nil))

So, my question is: why does the subreg come into play here?  If I change
the union to 'struct' (which should cause identical output in this case),
then I get this output:

(insn 10 5 15 (set (reg/v:PDI 107)
        (const_int 123 [0x7b])) -1 (nil)
    (nil))

... which makes more sense to me.  Is there any way that I can get the
union case to generate code that doesn't use a subreg like that?

Thanks,

-Chris

http://llvm.cs.uiuc.edu/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]