class LiveRangeCalc
Declaration
class LiveRangeCalc { /* full declaration omitted */ };
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:45
Member Variables
- private const llvm::MachineFunction* MF = nullptr
- private const llvm::MachineRegisterInfo* MRI = nullptr
- private llvm::SlotIndexes* Indexes = nullptr
- private llvm::MachineDominatorTree* DomTree = nullptr
- private VNInfo::Allocator* Alloc = nullptr
- private llvm::BitVector Seen
- Bit vector of active entries in LiveOut, also used as a visited set by findReachingDefs. One entry per basic block, indexed by block number. This is kept as a separate bit vector because it can be cleared quickly when switching live ranges.
- private llvm::LiveRangeCalc::EntryInfoMap EntryInfos
- private llvm::LiveRangeCalc::LiveOutMap Map
- The map can be shared by multiple live ranges as long as no two are live-out of the same block.
- private SmallVector<llvm::LiveRangeCalc::LiveInBlock, 16> LiveIn
- LiveIn - Work list of blocks where the live-in value has yet to be determined. This list is typically computed by findReachingDefs() and used as a work list by updateSSA(). The low-level interface may also be used to add entries directly.
Method Overview
- public LiveRangeCalc()
- public void addLiveInBlock(llvm::LiveRange & LR, llvm::MachineDomTreeNode * DomNode, llvm::SlotIndex Kill = llvm::SlotIndex())
- public void calculateValues()
- public void extend(llvm::LiveRange & LR, llvm::SlotIndex Use, unsigned int PhysReg, ArrayRef<llvm::SlotIndex> Undefs)
- private bool findReachingDefs(llvm::LiveRange & LR, llvm::MachineBasicBlock & UseMBB, llvm::SlotIndex Use, unsigned int PhysReg, ArrayRef<llvm::SlotIndex> Undefs)
- protected llvm::MachineDominatorTree * getDomTree()
- protected llvm::SlotIndexes * getIndexes()
- protected const llvm::MachineFunction * getMachineFunction()
- protected const llvm::MachineRegisterInfo * getRegInfo() const
- protected VNInfo::Allocator * getVNAlloc()
- private bool isDefOnEntry(llvm::LiveRange & LR, ArrayRef<llvm::SlotIndex> Undefs, llvm::MachineBasicBlock & MBB, llvm::BitVector & DefOnEntry, llvm::BitVector & UndefOnEntry)
- public static bool isJointlyDominated(const llvm::MachineBasicBlock * MBB, ArrayRef<llvm::SlotIndex> Defs, const llvm::SlotIndexes & Indexes)
- public void reset(const llvm::MachineFunction * mf, llvm::SlotIndexes * SI, llvm::MachineDominatorTree * MDT, VNInfo::Allocator * VNIA)
- protected void resetLiveOutMap()
- public void setLiveOutValue(llvm::MachineBasicBlock * MBB, llvm::VNInfo * VNI)
- private void updateFromLiveIns()
- private void updateSSA()
Methods
¶LiveRangeCalc()
LiveRangeCalc()
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:176
¶void addLiveInBlock(
llvm::LiveRange& LR,
llvm::MachineDomTreeNode* DomNode,
llvm::SlotIndex Kill = llvm::SlotIndex())
void addLiveInBlock(
llvm::LiveRange& LR,
llvm::MachineDomTreeNode* DomNode,
llvm::SlotIndex Kill = llvm::SlotIndex())
Description
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.
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:243
Parameters
- llvm::LiveRange& LR
- The live range that is live-in to the block.
- llvm::MachineDomTreeNode* DomNode
- The domtree node for the block.
- llvm::SlotIndex Kill = llvm::SlotIndex()
- Index in block where LI is killed. If the value is live-through, set Kill = SLotIndex() and also call setLiveOutValue(MBB, 0).
¶void calculateValues()
void calculateValues()
Description
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.
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:255
¶void extend(llvm::LiveRange& LR,
llvm::SlotIndex Use,
unsigned int PhysReg,
ArrayRef<llvm::SlotIndex> Undefs)
void extend(llvm::LiveRange& LR,
llvm::SlotIndex Use,
unsigned int PhysReg,
ArrayRef<llvm::SlotIndex> Undefs)
Description
Extend the live range of @p LR to reach @p Use. The existing values in @p LR must be live so they jointly dominate @p Use. If @p 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.
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:207
Parameters
- llvm::LiveRange& LR
- llvm::SlotIndex Use
- unsigned int PhysReg
- ArrayRef<llvm::SlotIndex> Undefs
¶bool findReachingDefs(
llvm::LiveRange& LR,
llvm::MachineBasicBlock& UseMBB,
llvm::SlotIndex Use,
unsigned int PhysReg,
ArrayRef<llvm::SlotIndex> Undefs)
bool findReachingDefs(
llvm::LiveRange& LR,
llvm::MachineBasicBlock& UseMBB,
llvm::SlotIndex Use,
unsigned int PhysReg,
ArrayRef<llvm::SlotIndex> Undefs)
Description
Find the set of defs that can reach @p Kill. @p Kill must belong to@p UseMBB. If exactly one def can reach @p UseMBB, and the def dominates @p Kill, all paths from the def to @p UseMBB are added to @p LR, and the function returns true. If multiple values can reach @p UseMBB, the blocks that need @p LR to be live in are added to the LiveIn array, and the function returns false. The array @p Undef provides the locations where the range @p LR becomes undefined by <def ,read-undef> operands on other subranges. If @p Undef is non-empty and @p Kill is jointly dominated only by the entries of@p Undef, the function returns false. PhysReg, when set, is used to verify live-in lists on basic blocks.
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:149
Parameters
- llvm::LiveRange& LR
- llvm::MachineBasicBlock& UseMBB
- llvm::SlotIndex Use
- unsigned int PhysReg
- ArrayRef<llvm::SlotIndex> Undefs
¶llvm::MachineDominatorTree* getDomTree()
llvm::MachineDominatorTree* getDomTree()
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:169
¶llvm::SlotIndexes* getIndexes()
llvm::SlotIndexes* getIndexes()
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:168
¶const llvm::MachineFunction* getMachineFunction()
const llvm::MachineFunction* getMachineFunction()
Description
Some getters to expose in a read-only way some private fields to subclasses.
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:166
¶const llvm::MachineRegisterInfo* getRegInfo()
const
const llvm::MachineRegisterInfo* getRegInfo()
const
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:167
¶VNInfo::Allocator* getVNAlloc()
VNInfo::Allocator* getVNAlloc()
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:170
¶bool isDefOnEntry(
llvm::LiveRange& LR,
ArrayRef<llvm::SlotIndex> Undefs,
llvm::MachineBasicBlock& MBB,
llvm::BitVector& DefOnEntry,
llvm::BitVector& UndefOnEntry)
bool isDefOnEntry(
llvm::LiveRange& LR,
ArrayRef<llvm::SlotIndex> Undefs,
llvm::MachineBasicBlock& MBB,
llvm::BitVector& DefOnEntry,
llvm::BitVector& UndefOnEntry)
Description
Check if the entry to block @p MBB can be reached by any of the defs in @p LR. Return true if none of the defs reach the entry to @p MBB.
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:129
Parameters
- llvm::LiveRange& LR
- ArrayRef<llvm::SlotIndex> Undefs
- llvm::MachineBasicBlock& MBB
- llvm::BitVector& DefOnEntry
- llvm::BitVector& UndefOnEntry
¶static bool isJointlyDominated(
const llvm::MachineBasicBlock* MBB,
ArrayRef<llvm::SlotIndex> Defs,
const llvm::SlotIndexes& Indexes)
static bool isJointlyDominated(
const llvm::MachineBasicBlock* MBB,
ArrayRef<llvm::SlotIndex> Defs,
const llvm::SlotIndexes& Indexes)
Description
A diagnostic function to check if the end of the block @p MBB is jointly dominated by the blocks corresponding to the slot indices in @p Defs. This function is mainly for use in self-verification checks.
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:262
Parameters
- const llvm::MachineBasicBlock* MBB
- ArrayRef<llvm::SlotIndex> Defs
- const llvm::SlotIndexes& Indexes
¶void reset(const llvm::MachineFunction* mf,
llvm::SlotIndexes* SI,
llvm::MachineDominatorTree* MDT,
VNInfo::Allocator* VNIA)
void reset(const llvm::MachineFunction* mf,
llvm::SlotIndexes* SI,
llvm::MachineDominatorTree* MDT,
VNInfo::Allocator* VNIA)
Description
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.
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:190
Parameters
- const llvm::MachineFunction* mf
- llvm::SlotIndexes* SI
- llvm::MachineDominatorTree* MDT
- VNInfo::Allocator* VNIA
¶void resetLiveOutMap()
void resetLiveOutMap()
Description
Reset Map and Seen fields.
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:173
¶void setLiveOutValue(llvm::MachineBasicBlock* MBB,
llvm::VNInfo* VNI)
void setLiveOutValue(llvm::MachineBasicBlock* MBB,
llvm::VNInfo* VNI)
Description
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().
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:229
Parameters
- llvm::MachineBasicBlock* MBB
- llvm::VNInfo* VNI
¶void updateFromLiveIns()
void updateFromLiveIns()
Description
Transfer information from the LiveIn vector to the live ranges and update the given @p LiveOuts.
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:161
¶void updateSSA()
void updateSSA()
Description
updateSSA - Compute the values that will be live in to all requested blocks in LiveIn. Create PHI-def values as required to preserve SSA form. Every live-in block must be jointly dominated by the added live-out blocks. No values are read from the live ranges.
Declared at: llvm/include/llvm/CodeGen/LiveRangeCalc.h:157