[LLVMdev] how to get TargetData?

Victor Zverovich victor.zverovich at googlemail.com
Fri May 28 08:42:28 PDT 2010


Thanks, John.
I am writing not an LLVM pass but a compiler backend, so this doesn't work
for me.

Victor

On 28 May 2010 17:35, John Criswell <criswell at illinois.edu> wrote:

> Victor Zverovich wrote:
>
>> Dear all
>>
>> I am trying to get the size of an LLVM pointer type.
>> getPrimitiveSizeInBits() returns 0 for it and the documentation for
>> isSized() suggest to use TargetData.
>> I figured out from Kaleidoscope example that one can get a pointer to
>> TagetData object through the execution engine but it seems to be an
>> overkill.
>> What is the right way to do it?
>>
> TargetData is an LLVM pass.  If you're writing an LLVM pass, just make
> TargetData one of its prerequisite analysis passes in the getAnalysisUsage()
> method and use the getAnalysis<TargetData>() function to get a reference to
> the TargetData pass within your pass.
>
> -- John T.
>
>
>> Best regards,
>> Victor
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100528/57d4d280/attachment.html>


More information about the llvm-dev mailing list