[llvm-dev] Retrieving numeric value of instruction operand
Ammar Naqvi via llvm-dev
llvm-dev at lists.llvm.org
Sat Apr 23 23:27:27 PDT 2016
Hello Everyone,
I need some help in retrieving the numeric value of an instruction operand
from LLVM IR.
this is what the IR looks like for a simple add function that adds two i32
integers
define i32 @summ(i32 %a, i32 %b) #0 {
entry:
%add = add nsw i32 %b, %a
ret i32 %add
}
i would like to know the integer value of %a and %b.
I've tried
-i->getOpcodeName() which gives me the string add
-i->getOperand(0) which gives me the string i32 %b
-i->getOperand(0)->getName() which gives me the string a
what method exists to get the actual integer value of the operands?
for example we called summ(1,2), how to retrieve the values 1 and 2 held in
the operands?
Any help and guidance is greatly appreciated! :)
Best,
Ammar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160423/6930d809/attachment.html>
More information about the llvm-dev
mailing list