I’m still experimenting with the Interpreter class and in this case I would like to know a couple of things if possible. Suppose that “instruction” is a StoreInst & that is part of a function called sum with the following prototype: int sum(int a, int b);. During the execution sum is called passing two integer (e.g. 1,2). When the “instruction” is about to be interpreted how can I get the value of a and b? I access to the first argument using Argument *argument = I.getFunction()->arg_begin(), is it the proper way?
The relevant IR is:
%2 = call i32 @sum(i32 1, i32 2)
%3 = alloca i32, align 4
%4 = alloca i32, align 4
%5 = alloca i32, align 4
store i32 %0, i32* %3, align 4
In addition, if I call instruction.getValueOperand() and on the result I call ->dump() I can see i32 %0 as expected but what kind of instruction is returned by getValueOperand()? In the end I would like to understand how to identify if the %0 is a parameter or not.
Thanks a lot