Is there a convenient way to access the arguments of an arbitrary instruction? The programmer's manual describes how to iterate over the values a given instruction uses, but that doesn't seem to be exactly the same thing. For instance, given a pointer to a FreeInst, how can I get the pointer that is freed? Or from a SetCondInst pointer, the two values that are compared in the appropriate order? Is iterating over the use-def chain the right way to do it, or am I missing something? Thanks, Scott Mikula
Also sprach Scott Mikula: } Is there a convenient way to access the arguments of an arbitrary } instruction? The programmer's manual describes how to iterate over the } values a given instruction uses, but that doesn't seem to be exactly the } same thing. } } For instance, given a pointer to a FreeInst, how can I get the pointer } that is freed? Or from a SetCondInst pointer, the two values that are } compared in the appropriate order? Is iterating over the use-def chain } the right way to do it, or am I missing something? } Check out llvm/include/llvm/User.h line 25 or so... -- || Bill? Wendling wendling at isanbard.org
> } the right way to do it, or am I missing something? > } > Check out llvm/include/llvm/User.h line 25 or so...Yup, more specifically, you want the getOperand(n) and getNumOperands() methods... -Chris http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/