[LLVMdev] Set alignment of a structure?

Eli Friedman eli.friedman at gmail.com
Thu May 7 09:02:18 PDT 2009


On Thu, May 7, 2009 at 8:53 AM, Nick Johnson <npjohnso at cs.princeton.edu> wrote:
> Is it possible to set the alignment of a StructType in llvm?

Not directly; structs are either packed or not packed.  You can model
arbitrary alignment, though, by using a packed struct and making sure
the alignment on allocations and loads is set explicitly.

> Especially in the case that it may contain OpaqueTypes?

IIRC, a struct can't directly contain an OpaqueType.

-Eli



More information about the llvm-dev mailing list