[llvm-commits] [llvm-gcc-4.2] r46726 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Thu Feb 7 12:11:37 PST 2008

Hi Devang,

> It is possible that I'm not solving the real problem here.
> struct {
>         char a;
>         char b;
>         int c:8;
>         int d:20;
> } S;
> When this struct is packed and S is aligned at 4 byte, what alignment  
> should be specified on load instruction to load 'd' ?

since the alignment depends the address you choose to load it from, and
several strategies are possible, relying on gcc's expr_align seems like a
bad move.

I think the LValue type should contain alignment info.  That
way the bitfield lvalue code, which knows exactly how it chose
to address the bitfield, can set an appropriate alignment.  This
also concentrates all nastiness in one spot.

[By the way, expr_align contains the following comment:

    /* LLVM local begin */
    /* return correctly the alignment of packed structs */
    /* LLVM local end */

Best wishes,


More information about the llvm-commits mailing list