[LLVMdev] Set alignment of a structure?

Chris Lattner clattner at apple.com
Thu May 7 19:52:36 PDT 2009


On May 7, 2009, at 5:58 PM, Nick Johnson wrote:

> Chris,
>
> On Thu, May 7, 2009 at 7:20 PM, Chris Lattner <clattner at apple.com>  
> wrote:
>> nd what you're saying.  LLVM can and does already
>> express this, just in a different form.  Why does this need to be in
>> the type?
>
> I misunderstood your earlier email.  Now I understand.  Setting
> alignment on a global variable will work for many of my needs.
>
> However, say I need to construct an array of OpaqueTypes; can I set an
> alignment on the elements of that array?  For instance, is it possible
> to have an array where each element is forced to be a multiple of the
> cacheline size?

I'm not sure what you mean: do you have a pointer to these, or do you  
have an array of pointers?  Do you know the size of the elements?  The  
compiler can't lay out a structure or array without knowing the size  
(not just the alignment) of the elements.

-Chris



More information about the llvm-dev mailing list