[LLVMdev] Target data question

Kenneth Uildriks kennethuil at gmail.com
Tue Oct 20 10:08:19 PDT 2009


On Tue, Oct 20, 2009 at 11:26 AM, Kenneth Uildriks <kennethuil at gmail.com> wrote:
> According to the "LLVM Assembly Language Reference Manual":
>
> When constructing the data layout for a given target, LLVM starts with
> a default set of specifications which are then (possibly) overriden by
> the specifications in the datalayout keyword. The default
> specifications are given in this list:
>
>    * E - big endian
>    * p:32:64:64 - 32-bit pointers with 64-bit alignment
>
>
> Are these the specifications that are assumed by LLVM tools such as
> "opt" when a module doesn't have a target data specification?  And
> does that mean that "opt", when given a module without a target data
> specification, might assume that GEP pointer-to-pointer, 1 should
> increment that pointer by eight bytes?

If anyone else was waiting for the answer...

The answer is yes.  "opt" uses the same default target data layout
regardless of what host machine it's being run on, and it'll trash any
pointer indexing you're trying to do if you're running on a real
machine whose target data layout is different from the universal
default and your module doesn't have a target data layout specified.

I hardcoded the layout by copying-and-pasting one generated by
llvm-gcc.  Now I'm off to dig up how to get the layout string for the
platform you're running on...




More information about the llvm-dev mailing list