[LLVMdev] Dereference PointerType?

Duncan Sands baldrick at free.fr
Tue Oct 20 05:20:11 PDT 2009


Hi Daniel,

> It may not be the best way to do what I'm trying to do, but it's not 
> useless and bogus. Consider the following:
> 
> %1 = alloca i32* ; %1 is of type i32**, dereferenced it becomes a type 
> i32* and
>                          ; the size of that is sizeof(void *) bytes

it is useless because getTypeAllocSize will handle any type, including
pointer types.  It is bogus because your code assumes that the LLVM
bitcode is targeting your own machine, i.e. that sizeof(void*) as given
by your machine is correct for the target.  This may or may not be the
case, but it is something best avoided.

Ciao,

Duncan.



More information about the llvm-dev mailing list