[LLVMdev] How can I find the LHS of the function call when traversing the function call

Duncan Sands baldrick at free.fr
Tue Oct 9 00:34:41 PDT 2012

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

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

More information about the llvm-dev mailing list