Aligning structures/members?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Aligning structures/members?

edA-qa mort-ora-y
Is there a way to set the alignment of structure types and/or their
members?  I noticed that if I use the alignas keyword in c++ that clang
introduces a bunch of [Y x i8] style padding.

--
edA-qa mort-ora-y
Leaf Creator

Leaf - the language we always wanted
http://leaflang.org/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Aligning structures/members?

Caldarale, Charles R
> From: [hidden email] [mailto:[hidden email]]
> On Behalf Of edA-qa mort-ora-y
> Subject: [LLVMdev] Aligning structures/members?

> Is there a way to set the alignment of structure types and/or their members?

Sort of.  You can set a DataLayout string, but it will affect all items of a given type, not just those inside structures.  Look here for details:
http://llvm.org/docs/LangRef.html#data-layout

> I noticed that if I use the alignas keyword in c++ that clang introduces a
> bunch of [Y x i8] style padding.

Pretty much required in order to conform to the semantics of alignas.  The only other option I'm aware of at the IR level is packed structures, where all the padding is eliminated:
http://llvm.org/docs/LangRef.html#structure-type

 - Chuck


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev