[LLVMdev] different layout of structs for llc vs. llvm-gcc

Torvald Riegel torvald at se.inf.tu-dresden.de
Wed Jul 14 14:49:24 PDT 2010

On Wednesday 14 July 2010 23:17:57 Reid Kleckner wrote:
> I believe he was asking if adding __attribute__((aligned(NN))) to the
> fields worked.  It's probably a cleaner away of accomplishing
> alignment than padding.

That's what I tried (I should have put the attributes in my example below,,,), 
And it did set up aligment properly but the individual fields do not cover the 
whole cacheline (padding is removed), so other globals could be colocated on 
the same line, I believe. For example, when requiring only the first 
field/global to be aligned, the second field/global had been put just after the 
first one in native code.


> <torvald at se.inf.tu-dresden.de> wrote:
> > I tried this already (in the form of { uint32_t field; uint8_t pad[60];
> > uint32_field2;}). Alignment seems to be properly propagated, but pad[] is
> > still removed, so I believe that other globals without custom alignment
> > constraints could still be located in the same cachelines as field or
> > field2.
> > 
> > Torvald
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list