[LLVMdev] Classifying Operands & Def/Use Chains
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
> participates in addressing? That is, if the MachineInst references
> can I tell, given an operand, whether that operand is part of the
> 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.
More information about the llvm-dev