LLVM 20.0.0git
|
#include "llvm/CodeGen/LiveRangeCalc.h"
Public Member Functions | |
LiveRangeCalc ()=default | |
void | reset (const MachineFunction *mf, SlotIndexes *SI, MachineDominatorTree *MDT, VNInfo::Allocator *VNIA) |
reset - Prepare caches for a new set of non-overlapping live ranges. | |
void | extend (LiveRange &LR, SlotIndex Use, unsigned PhysReg, ArrayRef< SlotIndex > Undefs) |
Extend the live range of LR to reach Use . | |
void | setLiveOutValue (MachineBasicBlock *MBB, VNInfo *VNI) |
setLiveOutValue - Indicate that VNI is live out from MBB. | |
void | addLiveInBlock (LiveRange &LR, MachineDomTreeNode *DomNode, SlotIndex Kill=SlotIndex()) |
addLiveInBlock - Add a block with an unknown live-in value. | |
void | calculateValues () |
calculateValues - Calculate the value that will be live-in to each block added with addLiveInBlock. | |
Static Public Member Functions | |
static LLVM_ATTRIBUTE_UNUSED bool | isJointlyDominated (const MachineBasicBlock *MBB, ArrayRef< SlotIndex > Defs, const SlotIndexes &Indexes) |
A diagnostic function to check if the end of the block MBB is jointly dominated by the blocks corresponding to the slot indices in Defs . | |
Protected Member Functions | |
const MachineFunction * | getMachineFunction () |
Some getters to expose in a read-only way some private fields to subclasses. | |
const MachineRegisterInfo * | getRegInfo () const |
SlotIndexes * | getIndexes () |
MachineDominatorTree * | getDomTree () |
VNInfo::Allocator * | getVNAlloc () |
void | resetLiveOutMap () |
Reset Map and Seen fields. | |
Definition at line 45 of file LiveRangeCalc.h.
|
default |
|
inline |
addLiveInBlock - Add a block with an unknown live-in value.
This function can only be called once per basic block. Once the live-in value has been determined, calculateValues() will add liveness to LI.
LR | The live range that is live-in to the block. |
DomNode | The domtree node for the block. |
Kill | Index in block where LI is killed. If the value is live-through, set Kill = SLotIndex() and also call setLiveOutValue(MBB, 0). |
Definition at line 243 of file LiveRangeCalc.h.
References llvm::SmallVectorTemplateBase< T, bool >::push_back().
void LiveRangeCalc::calculateValues | ( | ) |
calculateValues - Calculate the value that will be live-in to each block added with addLiveInBlock.
Add PHI-def values as needed to preserve SSA form. Add liveness to all live-in blocks up to the Kill point, or the whole block for live-through blocks.
Every predecessor of a live-in block must have been given a value with setLiveOutValue, the value may be null for live-trough blocks.
Definition at line 115 of file LiveRangeCalc.cpp.
References assert().
Referenced by extend().
void LiveRangeCalc::extend | ( | LiveRange & | LR, |
SlotIndex | Use, | ||
unsigned | PhysReg, | ||
ArrayRef< SlotIndex > | Undefs | ||
) |
Extend the live range of LR
to reach Use
.
The existing values in LR
must be live so they jointly dominate Use
. If Use
is not dominated by a single existing value, PHI-defs are inserted as required to preserve SSA form.
PhysReg, when set, is used to verify live-in lists on basic blocks.
Definition at line 87 of file LiveRangeCalc.cpp.
References assert(), calculateValues(), llvm::LiveRange::extendInBlock(), llvm::SlotIndexes::getMBBFromIndex(), and llvm::SlotIndexes::getMBBStartIdx().
|
inlineprotected |
Definition at line 169 of file LiveRangeCalc.h.
Referenced by llvm::LiveIntervalCalc::calculate().
|
inlineprotected |
Definition at line 168 of file LiveRangeCalc.h.
Referenced by llvm::LiveIntervalCalc::calculate(), and llvm::LiveIntervalCalc::createDeadDefs().
|
inlineprotected |
Some getters to expose in a read-only way some private fields to subclasses.
Definition at line 166 of file LiveRangeCalc.h.
Referenced by llvm::LiveIntervalCalc::calculate().
|
inlineprotected |
Definition at line 167 of file LiveRangeCalc.h.
References MRI.
Referenced by llvm::LiveIntervalCalc::calculate(), and llvm::LiveIntervalCalc::createDeadDefs().
|
inlineprotected |
Definition at line 170 of file LiveRangeCalc.h.
Referenced by llvm::LiveIntervalCalc::calculate(), llvm::LiveIntervalCalc::constructMainRangeFromSubranges(), and llvm::LiveIntervalCalc::createDeadDefs().
|
static |
A diagnostic function to check if the end of the block MBB
is jointly dominated by the blocks corresponding to the slot indices in Defs
.
This function is mainly for use in self-verification checks.
Definition at line 437 of file LiveRangeCalc.cpp.
References B, llvm::MachineFunction::getBlockNumbered(), llvm::SlotIndexes::getMBBFromIndex(), llvm::MachineBasicBlock::getNumber(), llvm::MachineFunction::getNumBlockIDs(), llvm::MachineBasicBlock::getParent(), I, llvm::SetVector< T, Vector, Set, N >::insert(), MBB, P, llvm::BitVector::set(), and llvm::SetVector< T, Vector, Set, N >::size().
void LiveRangeCalc::reset | ( | const MachineFunction * | mf, |
SlotIndexes * | SI, | ||
MachineDominatorTree * | MDT, | ||
VNInfo::Allocator * | VNIA | ||
) |
reset - Prepare caches for a new set of non-overlapping live ranges.
The caches must be reset before attempting calculations with a live range that may overlap a previously computed live range, and before the first live range in a function. If live ranges are not known to be non-overlapping, call reset before each.
Definition at line 49 of file LiveRangeCalc.cpp.
References llvm::SmallVectorImpl< T >::clear(), llvm::MachineFunction::getRegInfo(), and resetLiveOutMap().
Referenced by llvm::LiveIntervalCalc::calculate(), and llvm::SplitEditor::reset().
|
protected |
Reset Map and Seen fields.
Definition at line 41 of file LiveRangeCalc.cpp.
References llvm::BitVector::clear(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear(), llvm::MachineFunction::getNumBlockIDs(), llvm::IndexedMap< T, ToIndexT >::resize(), and llvm::BitVector::resize().
Referenced by llvm::LiveIntervalCalc::calculate(), llvm::LiveIntervalCalc::constructMainRangeFromSubranges(), and reset().
|
inline |
setLiveOutValue - Indicate that VNI is live out from MBB.
The calculateValues() function will not add liveness for MBB, the caller should take care of that.
VNI may be null only if MBB is a live-through block also passed to addLiveInBlock().
Definition at line 229 of file LiveRangeCalc.h.
References MBB, and llvm::BitVector::set().