[LLVMdev] fields in structure re-arranged for alignment?

Ralph Corderoy ralph at inputplus.co.uk
Mon Jul 16 02:40:28 PDT 2007


Hi Kean,

> One area of the semantics of the Structure type that hasn't been
> discussed is whether fields in the structure get re-arranged to better
> suit the target machine's natural alignment, ala what happens in C.
> 
> For example would this structure on a 32-bit machine:
> 
> { i16, i32, i16 }
> 
> get re-arranged to
> 
> { i16, i16, i32 } or { i32, i16, i16 }

(C doesn't re-order structure members;  it guarantees not to.
Otherwise, various uses of structs wouldn't work.)

Cheers,


Ralph.




More information about the llvm-dev mailing list