[LLVMdev] Dereference PointerType?

Daniel Waterworth da.waterworth at googlemail.com
Tue Oct 20 05:31:50 PDT 2009


I'm writing a function pass that is run before an ExecutionEngine Jit's the
code. Therefore I can assume that my machine is the correct target. It is
never the case that the pass would be run and then stored.

Daniel

2009/10/20 Duncan Sands <baldrick at free.fr>

> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091020/06609793/attachment.html>


More information about the llvm-dev mailing list