Shen Liu
2015-Jul-09 20:06 UTC
[LLVMdev] How to use get the memory location of a function argument correctly?
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 <http://llvm.org/docs/doxygen/html/classllvm_1_1MemoryLocation.html> MemoryLocation::getForArgument <http://llvm.org/docs/doxygen/html/classllvm_1_1MemoryLocation.html#a09ad77e77770d1e517466a7345227ccc> (ImmutableCallSite <http://llvm.org/docs/doxygen/html/classllvm_1_1ImmutableCallSite.html> CS, unsigned <http://llvm.org/docs/doxygen/html/classunsigned.html> ArgIdx,const <http://llvm.org/docs/doxygen/html/AArch64PromoteConstant_8cpp.html#a90f8350fecae261c25be85d38b451bff> TargetLibraryInfo <http://llvm.org/docs/doxygen/html/classllvm_1_1TargetLibraryInfo.html> & TLI )[static] Shen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150709/2a38c67d/attachment.html>
Chandler Carruth
2015-Jul-10 01:10 UTC
[LLVMdev] How to use get the memory location of a function argument correctly?
>From your Pass, you cangetAnalysis<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/20150710/648ac5b4/attachment.html>
Shen Liu
2015-Jul-10 01:30 UTC
[LLVMdev] How to use get the memory location of a function argument correctly?
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>
Reasonably Related Threads
- [LLVMdev] Loop Unfolding in LLVM
- [LLVMdev] The use iterator not working...
- GVN / Alias Analysis issue with llvm.masked.scatter/gather intrinsics
- GVN / Alias Analysis issue with llvm.masked.scatter/gather intrinsics
- dingotel - connect Asterisk to 2-way radio?