[LLVMdev] Matching struct layouts.
Duncan Sands
baldrick at free.fr
Fri May 16 04:47:04 PDT 2008
> > But can I assume that both gcc and LLVM will layout the structure
> > in the same way (member alignment, padding)?
>
> llvm-gcc and gcc follows the same platform C ABI. So the answer to your
> question is "yes".
That's not entirely true. For example it assumes the user is not
using attributes to create types with unusual alignments or sizes.
Most of the gcc -> llvm struct type conversion is straightforward
but don't forget that gcc already did C -> gcc type conversion
(which is also mostly straightforward). As long as you stay in
the land of simple types doing the obvious thing should be fine.
Ciao,
Duncan.
PS: Try using llvm-gcc -emit-llvm to see how llvm-gcc is converting
things, and to validate your implementation.
More information about the llvm-dev
mailing list