LLVM: llvm::ReachingDefInfo Class Reference (original) (raw)

This class provides the reaching def analysis. More...

#include "[llvm/CodeGen/ReachingDefAnalysis.h](ReachingDefAnalysis%5F8h%5Fsource.html)"

Public Member Functions
ReachingDefInfo ()
ReachingDefInfo (ReachingDefInfo &&)
~ReachingDefInfo ()
bool invalidate (MachineFunction &F, const PreservedAnalyses &PA, MachineFunctionAnalysisManager::Invalidator &)
Handle invalidation explicitly.
void run (MachineFunction &mf)
void print (raw_ostream &OS)
void releaseMemory ()
void reset ()
Re-run the analysis.
void init ()
Initialize data structures.
void traverse ()
Traverse the machine function, mapping definitions.
int getReachingDef (MachineInstr *MI, Register Reg) const
Provides the instruction id of the closest reaching def instruction of Reg that reaches MI, relative to the begining of MI's basic block.
bool hasSameReachingDef (MachineInstr *A, MachineInstr *B, Register Reg) const
Return whether A and B use the same def of Reg.
bool isReachingDefLiveOut (MachineInstr *MI, Register Reg) const
Return whether the reaching def for MI also is live out of its parent block.
MachineInstr * getLocalLiveOutMIDef (MachineBasicBlock *MBB, Register Reg) const
Return the local MI that produces the live out value for Reg, or nullptr for a non-live out or non-local def.
MachineInstr * getUniqueReachingMIDef (MachineInstr *MI, Register Reg) const
If a single MachineInstr creates the reaching definition, then return it.
MachineInstr * getMIOperand (MachineInstr *MI, unsigned Idx) const
If a single MachineInstr creates the reaching definition, for MIs operand at Idx, then return it.
MachineInstr * getMIOperand (MachineInstr *MI, MachineOperand &MO) const
If a single MachineInstr creates the reaching definition, for MIs MO, then return it.
bool hasLocalDefBefore (MachineInstr *MI, Register Reg) const
Provide whether the register has been defined in the same basic block as, and before, MI.
bool isRegUsedAfter (MachineInstr *MI, Register Reg) const
Return whether the given register is used after MI, whether it's a local use or a live out.
bool isRegDefinedAfter (MachineInstr *MI, Register Reg) const
Return whether the given register is defined after MI.
int getClearance (MachineInstr *MI, Register Reg) const
Provides the clearance - the number of instructions since the closest reaching def instuction of Reg that reaches MI.
void getReachingLocalUses (MachineInstr *MI, Register Reg, InstSet &Uses) const
Provides the uses, in the same block as MI, of register that MI defines.
void getLiveOuts (MachineBasicBlock *MBB, Register Reg, InstSet &Defs, BlockSet &VisitedBBs) const
Search MBB for a definition of Reg and insert it into Defs.
void getLiveOuts (MachineBasicBlock *MBB, Register Reg, InstSet &Defs) const
bool getLiveInUses (MachineBasicBlock *MBB, Register Reg, InstSet &Uses) const
For the given block, collect the instructions that use the live-in value of the provided register.
void getGlobalUses (MachineInstr *MI, Register Reg, InstSet &Uses) const
Collect the users of the value stored in Reg, which is defined by MI.
void getGlobalReachingDefs (MachineInstr *MI, Register Reg, InstSet &Defs) const
Collect all possible definitions of the value stored in Reg, which is used by MI.
bool isSafeToMoveForwards (MachineInstr *From, MachineInstr *To) const
Return whether From can be moved forwards to just before To.
bool isSafeToMoveBackwards (MachineInstr *From, MachineInstr *To) const
Return whether From can be moved backwards to just after To.
void collectKilledOperands (MachineInstr *MI, InstSet &Dead) const
Assuming MI is dead, recursively search the incoming operands which are killed by MI and collect those that would become dead.
bool isSafeToRemove (MachineInstr *MI, InstSet &ToRemove) const
Return whether removing this instruction will have no effect on the program, returning the redundant use-def chain.
bool isSafeToRemove (MachineInstr *MI, InstSet &ToRemove, InstSet &Ignore) const
Return whether removing this instruction will have no effect on the program, ignoring the possible effects on some instructions, returning the redundant use-def chain.
bool isSafeToDefRegAt (MachineInstr *MI, Register Reg) const
Return whether a MachineInstr could be inserted at MI and safely define the given register without affecting the program.
bool isSafeToDefRegAt (MachineInstr *MI, Register Reg, InstSet &Ignore) const
Return whether a MachineInstr could be inserted at MI and safely define the given register without affecting the program, ignoring any effects on the provided instructions.

This class provides the reaching def analysis.

Definition at line 114 of file ReachingDefAnalysis.h.

ReachingDefInfo::ReachingDefInfo ( ) default

Referenced by ReachingDefInfo().

ReachingDefInfo() [2/2]

References ReachingDefInfo().

~ReachingDefInfo()

ReachingDefInfo::~ReachingDefInfo ( ) default

collectKilledOperands()

Assuming MI is dead, recursively search the incoming operands which are killed by MI and collect those that would become dead.

Definition at line 781 of file ReachingDefAnalysis.cpp.

References collectKilledOperands(), getGlobalUses(), getMIOperand(), IsDead, isValidRegDef(), isValidRegUse(), mayHaveSideEffects(), MI, llvm::set_is_subset(), and Uses.

Referenced by collectKilledOperands().

getClearance()

getGlobalReachingDefs()

getGlobalUses()

Collect the users of the value stored in Reg, which is defined by MI.

Definition at line 509 of file ReachingDefAnalysis.cpp.

References llvm::append_range(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), getLiveInUses(), getLocalLiveOutMIDef(), getReachingLocalUses(), llvm::SmallPtrSetImpl< PtrType >::insert(), MBB, MI, llvm::SmallVectorImpl< T >::pop_back_val(), and Uses.

Referenced by collectKilledOperands(), and isSafeToDefRegAt().

getLiveInUses()

getLiveOuts() [1/2]

getLiveOuts() [2/2]

getLocalLiveOutMIDef()

getMIOperand() [1/2]

getMIOperand() [2/2]

getReachingDef()

getReachingLocalUses()

getUniqueReachingMIDef()

hasLocalDefBefore()

hasSameReachingDef()

init()

void ReachingDefInfo::init ( )

invalidate()

isReachingDefLiveOut()

isRegDefinedAfter()

isRegUsedAfter()

isSafeToDefRegAt() [1/2]

isSafeToDefRegAt() [2/2]

Return whether a MachineInstr could be inserted at MI and safely define the given register without affecting the program, ignoring any effects on the provided instructions.

Definition at line 818 of file ReachingDefAnalysis.cpp.

References getGlobalUses(), I, Ignore, isRegDefinedAfter(), isRegUsedAfter(), isValidRegDefOf(), MBB, MI, llvm::set_is_subset(), and Uses.

isSafeToMoveBackwards()

isSafeToMoveForwards()

isSafeToRemove() [1/2]

isSafeToRemove() [2/2]

print()

releaseMemory()

void ReachingDefInfo::releaseMemory ( )

reset()

void ReachingDefInfo::reset ( )

run()

traverse()

void ReachingDefInfo::traverse ( )

The documentation for this class was generated from the following files: