[LLVMdev] About the result of getPointerSizeInBits();

Duncan Sands baldrick at free.fr
Thu May 24 01:56:42 PDT 2012


Hi 空明流转,

> Does getPointerSizeInBits need to return sizeof(void*) in Platform?

yes.

> I found that getPointerSizeInBits return 8 in x86-32 on win7-64, MSVC 2010.

It should be 32 when targetting x86-32.  Something is wrong.  Do you have a
datalayout line in your bitcode?  If so, what is in it?

> And if I have a struct { i32, i32* }; the structLayout->getElementOffset(1)
> return 8, but I think 4 is right.

On x86-32 it should be 4.

Ciao, Duncan.

PS: I mean something like this:

target datalayout = 
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"



More information about the llvm-dev mailing list