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

Chris Lattner clattner at apple.com
Fri Jan 30 09:20:27 PST 2009


On Jan 30, 2009, at 4:32 AM, Duncan Sands wrote:

> Hi Chris,
>
>> If a FIELD_DECL says its alignment is 16 bytes, and the base pointer
>> is only known to be 8-byte aligned, round up to 16 bytes.  I believe
>> that this is always safe.  Duncan, I would appreciate the review.
>
> how can this possibly be safe?  My understanding is that the alignment
> of a FIELD_DECL gives it's alignment within the surrounding struct.
> It does not force anything on how objects of the struct type are  
> aligned.
> If an object of that struct type has alignment 1 (examples of this are
> easy to create) then in general the field will also have alignment 1
> no matter what the field alignment says.  For example, if the  
> numerical
> value of the pointer is 7 then the first field will have alignment 1
> no matter what the alignment of it's FIELD_DECL says.  I could be  
> wrong
> of course (I often am!) but I don't think so :)

Hey Duncan,

I completely believe you that this is possible. One random question: I  
don't understand or see the code (which should theoretically be in  
expr.c?) to determine this stuff for the RTL backend, do you know  
where it is?

-Chris



More information about the llvm-commits mailing list