I am trying to get the name of the register in which the result of the load insutrction is stored from the LoadInst pointer.
For example, if my loadInst pointer points to this the instruction %0 = load i32* %i, align 4 then how should I get %0 from the instruction?
That %0
is the instruction's name, not a register name - there are no registers in the LLVM intermediate representation.
In any case, all instructions inherit from the Value
class which defines a getName()
method, and that's what you should call. However, keep in mind that typically many instruction will be unnamed and thus getName()
won't return anything useful - names such as %0
are only assigned when emitting the module as text, and do not exist before that.
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