[LLVMdev] How to use get the memory location of a function argument correctly?

Shen Liu shl413 at Lehigh.EDU
Thu Jul 9 18:30:19 PDT 2015


OK, Thanks for your helpful advice!

On Thu, Jul 9, 2015 at 9:10 PM, Chandler Carruth <chandlerc at google.com>
wrote:

> From your Pass, you can
> getAnalysis<TargetLibraryInfoWrapperPass>().getTLI().
>
> Also, you can look at lib/Analysis/AliasAnalysis.cpp in LLVM to find
> places where we call this routine.
>
> On Thu, Jul 9, 2015 at 1:16 PM Shen Liu <shl413 at lehigh.edu> wrote:
>
>> Hi all, i hope to get the MemoryLocation for argument %1 in a CallInst
>> like "call void @function(i32* %1)", and i found an interface
>> "getForArgument()" which seems available for this. However, i don't know
>> how to correcly fill the 3rd argument TargetLibraryInfo in my own code and
>> can't find an example in google. Does anybody know how to do it?  Or some
>> other advice for find the correct memory location more conveniently? Thank
>> you very much!
>>
>>
>> MemoryLocation
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_doxygen_html_classllvm-5F1-5F1MemoryLocation.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=14hCVGSEX_FOJbLT-lrL3_3L10WInzyEjQQuUU5blxs&s=LWHYiOIDiHX4MX1ORt4jQlHYfEFEerka-YVhKyFaK3A&e=>
>>  MemoryLocation::getForArgument
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_doxygen_html_classllvm-5F1-5F1MemoryLocation.html-23a09ad77e77770d1e517466a7345227ccc&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=14hCVGSEX_FOJbLT-lrL3_3L10WInzyEjQQuUU5blxs&s=ImO5-R6QI2ckuWdjOmBRSzmmkMIAJZ80mpVVCrxWOLk&e=>
>> (ImmutableCallSite
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_doxygen_html_classllvm-5F1-5F1ImmutableCallSite.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=14hCVGSEX_FOJbLT-lrL3_3L10WInzyEjQQuUU5blxs&s=Lr-6RTIG7djM107Ys--utTf2xcSUzzrOPWz6cGBcJHo&e=>
>>  CS,unsigned
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_doxygen_html_classunsigned.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=14hCVGSEX_FOJbLT-lrL3_3L10WInzyEjQQuUU5blxs&s=pjmqGXNuIKaY-OKLJxmtFbgRNE00iN7-6dGXO9W90Zg&e=>
>>  ArgIdx,const
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_doxygen_html_AArch64PromoteConstant-5F8cpp.html-23a90f8350fecae261c25be85d38b451bff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=14hCVGSEX_FOJbLT-lrL3_3L10WInzyEjQQuUU5blxs&s=E51fXjSBZ5NPul4Rgg-_AZvCh3zC-r2xggPb6zSOKQE&e=>
>>  TargetLibraryInfo
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_doxygen_html_classllvm-5F1-5F1TargetLibraryInfo.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=14hCVGSEX_FOJbLT-lrL3_3L10WInzyEjQQuUU5blxs&s=M8_iAN9Cs4xxnvd1DZvkSZBFKfHJqk7KNvNv-MUkITE&e=>
>>  & TLI )[static]
>> Shen
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150709/55407c3a/attachment.html>


More information about the llvm-dev mailing list