[LLVMdev] Classifying Operands & Def/Use Chains
Chris Lattner
sabre at nondot.org
Fri Jan 11 14:36:14 PST 2008
On Jan 11, 2008, at 2:00 PM, David Greene wrote:
> Is there any way to discover whether a particular operand of a
> MachineInst
> participates in addressing? That is, if the MachineInst references
> memory,
> can I tell, given an operand, whether that operand is part of the
> address
> calculation for the instruction?
Nope, not that I know of.
> Also, is there any reasonable way to get the set of machine
> instructions to
> which the output(s) of some machine instruction flows? The closest
> I can find
> is LiveVariables::VarInfo, but that only directly captures the kill
> points. I
> would have to iterate over instructions in the rest of the live
> range and see
> if the output of the defining instruction is used.
On mainline, you can use the MachineRegisterInfo class (not
MRegisterInfo) to walk all uses and defs (or just one class of them)
of any register. Use def_iterator (defs) use_iterator (uses) or
reg_iterator (both) to get all uses/defs of a particular register,
physical or virtual.
-Chris
More information about the llvm-dev
mailing list