[LLVMdev] Method to obtain the Variable allocation instruction

Duncan Sands baldrick at free.fr
Mon Apr 19 01:11:06 PDT 2010


Hi Adarsh,

> I am parsing through each instruction and for each value in the
> instruction, I want the instruction that is defining/allocating the
> value being used here (the dominator instruction). Is there a method to
> do that?

I'm not sure what you mean by "each value in the instruction".  Operands
perhaps?  Operands can be instructions or constants (or metadata in some
cases).  You can check whether operand Op is an instruction by doing:
isa<Instruction>(Op).  If so, you can cast it to an instruction using:
cast<Instruction>(Op).

Ciao,

Duncan.



More information about the llvm-dev mailing list