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? 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. Thanks! -Dave
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
On Friday 11 January 2008 16:36, Chris Lattner wrote:> 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.Ok.> 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.Exactly what I need. Thanks! This must have gone in fairly recently. -Dave
Reasonably Related Threads
- [LLVMdev] Classifying Operands & Def/Use Chains
- [LLVMdev] Classifying Operands & Def/Use Chains
- [LLVMdev] LiveVariables not updated in MachineBasicBlock::SplitCriticalEdge?
- [LLVMdev] LiveVariables not updated in MachineBasicBlock::SplitCriticalEdge?
- [LLVMdev] LiveIntervals invalidates LiveVariables?