tarique anwer
2012-Oct-08 23:44 UTC
[LLVMdev] How can I find the LHS of the function call when traversing the function call
Hi All, I am a new member in the group, have been doing some experiments with LLVM IR. I am facing issue with de-compiling the following instruction once it is read, %var2 = call i8 @myfuncCall (i2 %var1) In after I parse the file (lets say using parseIRFiles ). I can see the instructions,( the function call instruction ), How can I get the %var2 from the instruction/callInstruction ? going thru the llvm installations cpp and .h files, it is not clear how do I get the desired variable. Thanks in Advance. regards Tarique -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121008/844be94e/attachment.html>
Krzysztof Parzyszek
2012-Oct-09 00:10 UTC
[LLVMdev] How can I find the LHS of the function call when traversing the function call
On 10/8/2012 6:44 PM, tarique anwer wrote:> > %var2 = call i8 @myfuncCall (i2 %var1) > > In after I parse the file (lets say using parseIRFiles ). > I can see the instructions,( the function call instruction ), How can I > get the %var2 from the instruction/callInstruction ? > > going thru the llvm installations cpp and .h files, it is not clear how > do I get the desired variable.The member function getName would return "var2" for it, but %var2 in here is a name of the value that is the function call instruction. In general this doesn't have to be the name of the variable from the source code. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Duncan Sands
2012-Oct-09 07:34 UTC
[LLVMdev] How can I find the LHS of the function call when traversing the function call
Hi Tarique,> I am a new member in the group, have been doing some experiments with LLVM IR. > > I am facing issue with de-compiling the following instruction once it is read, > > %var2 = call i8 @myfuncCall (i2 %var1) > > In after I parse the file (lets say using parseIRFiles ). > I can see the instructions,( the function call instruction ), How can I get the > %var2 from the instruction/callInstruction ?%var2 *is* the call instruction. Since LLVM IR is in SSA form, values like %var2 are defined once and can't be redefined. Thus there is no point in trying to make a distinction between %var2 and the instruction defining it, which is why LLVM doesn't even try to make a distinction: there is no variable %var2, there is only the instruction "call i8 @myfuncCall (i2 %var1)", and %var2 is just a name attached to it (use ->getName() on the instruction to see this). Ciao, Duncan.> > going thru the llvm installations cpp and .h files, it is not clear how do I get > the desired variable. > > Thanks in Advance. > > regards > Tarique > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Reasonably Related Threads
- [LLVMdev] How to include IR parser and optimization passes in my project
- [LLVMdev] Clone a function and change signature
- LLVM Alias Analysis Technical Call - Doodle Poll
- [LLVMdev] Clone a function and change signature
- [LLVMdev] Clone a function and change signature