[llvm-dev] How to get the function's parameters value at runtime? (original) (raw)
Alberto Barbaro via llvm-dev llvm-dev at lists.llvm.org
Sat Dec 29 01:27:22 PST 2018
- Previous message: [llvm-dev] support for nvidia Turing GPU
- Next message: [llvm-dev] Branch folding optimisation on the AVR platform produces out of order code
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all, 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 Alberto -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181229/87f8920a/attachment.html>
- Previous message: [llvm-dev] support for nvidia Turing GPU
- Next message: [llvm-dev] Branch folding optimisation on the AVR platform produces out of order code
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]