I'm a beginner with LLVM, and I have a simple problem, but I can't find the solution in the documentation.
I'm doing a function pass that computes on instructions, and for this I need all 'data' from the instruction, I mean the operator, all operands, and the result.
My problem is, I can't get the result variable. For example, for the instruction:
%add1 = add nsw i32 %x, %y
I can have x and y name and variable, I can have the opCode, I can have add1 name, but, I can not have add1 variable.
I read all functions from the Instruction page of the documentation, and I can't find anything who looks like what I'm looking for.
So what is the proper API that can solve my problem?
Instruction
inherits from Value
and thus has method getName()
which solves your problem.
But remember that instruction can be unnamed (such as %0
) and getName
probably won't return anything useful in that case
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With