LLVM API Documentation
#include <LiveRangeCalc.h>
Classes | |
struct | LiveInBlock |
Public Member Functions | |
LiveRangeCalc () | |
void | reset (const MachineFunction *MF, SlotIndexes *, MachineDominatorTree *, VNInfo::Allocator *) |
void | extend (LiveRange &LR, SlotIndex Kill, unsigned PhysReg=0) |
void | createDeadDefs (LiveRange &LR, unsigned Reg) |
void | createDeadDefs (LiveInterval &LI) |
createDeadDefs - Create a dead def in LI for every def of LI->reg. | |
void | extendToUses (LiveRange &LR, unsigned Reg) |
void | extendToUses (LiveInterval &LI) |
extendToUses - Extend the live range of LI to reach all uses of LI->reg. | |
void | setLiveOutValue (MachineBasicBlock *MBB, VNInfo *VNI) |
void | addLiveInBlock (LiveRange &LR, MachineDomTreeNode *DomNode, SlotIndex Kill=SlotIndex()) |
void | calculateValues () |
Definition at line 36 of file LiveRangeCalc.h.
llvm::LiveRangeCalc::LiveRangeCalc | ( | ) | [inline] |
Definition at line 128 of file LiveRangeCalc.h.
void llvm::LiveRangeCalc::addLiveInBlock | ( | LiveRange & | LR, |
MachineDomTreeNode * | DomNode, | ||
SlotIndex | Kill = SlotIndex() |
||
) | [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 219 of file LiveRangeCalc.h.
References llvm::SmallVectorTemplateBase< T, isPodLike >::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 161 of file LiveRangeCalc.cpp.
Referenced by extend().
void LiveRangeCalc::createDeadDefs | ( | LiveRange & | LR, |
unsigned | Reg | ||
) |
createDeadDefs - Create a dead def in LI for every def operand of Reg. Each instruction defining Reg gets a new VNInfo with a corresponding minimal live range.
Definition at line 40 of file LiveRangeCalc.cpp.
References llvm::LiveRange::createDeadDef(), llvm::MachineRegisterInfo::def_operands(), llvm::SlotIndexes::getInstructionIndex(), llvm::SlotIndexes::getMBBStartIdx(), llvm::MachineInstr::getParent(), llvm::SlotIndex::getRegSlot(), llvm::MachineInstr::isPHI(), and llvm::AArch64CC::MI.
Referenced by createDeadDefs().
void llvm::LiveRangeCalc::createDeadDefs | ( | LiveInterval & | LI | ) | [inline] |
createDeadDefs - Create a dead def in LI for every def of LI->reg.
Definition at line 171 of file LiveRangeCalc.h.
References createDeadDefs(), and llvm::LiveInterval::reg.
void LiveRangeCalc::extend | ( | LiveRange & | LR, |
SlotIndex | Kill, | ||
unsigned | PhysReg = 0 |
||
) |
extend - Extend the live range of LI to reach Kill.
The existing values in LI must be live so they jointly dominate Kill. If Kill is not dominated by a single existing value, PHI-defs are inserted as required to preserve SSA form. If Kill is known to be dominated by a single existing value, Alloc may be null.
PhysReg, when set, is used to verify live-in lists on basic blocks.
Definition at line 134 of file LiveRangeCalc.cpp.
References calculateValues(), llvm::LiveRange::extendInBlock(), llvm::SlotIndexes::getMBBFromIndex(), llvm::SlotIndexes::getMBBStartIdx(), llvm::SlotIndex::getPrevSlot(), llvm::SlotIndex::isValid(), and llvm::RegState::Kill.
Referenced by llvm::LiveIntervals::extendToIndices(), and extendToUses().
void LiveRangeCalc::extendToUses | ( | LiveRange & | LR, |
unsigned | Reg | ||
) |
extendToUses - Extend the live range of LI to reach all uses of Reg.
All uses must be jointly dominated by existing liveness. PHI-defs are inserted as needed to preserve SSA form.
Definition at line 63 of file LiveRangeCalc.cpp.
References extend(), llvm::SlotIndexes::getInstructionIndex(), llvm::MachineOperand::getMBB(), llvm::SlotIndexes::getMBBEndIdx(), llvm::MachineInstr::getOperand(), llvm::SlotIndex::getRegSlot(), llvm::MachineOperand::isEarlyClobber(), llvm::MachineInstr::isPHI(), llvm::MachineInstr::isRegTiedToDefOperand(), llvm::AArch64CC::MI, and llvm::MachineRegisterInfo::reg_nodbg_operands().
Referenced by extendToUses().
void llvm::LiveRangeCalc::extendToUses | ( | LiveInterval & | LI | ) | [inline] |
extendToUses - Extend the live range of LI to reach all uses of LI->reg.
Definition at line 182 of file LiveRangeCalc.h.
References extendToUses(), and llvm::LiveInterval::reg.
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 22 of file LiveRangeCalc.cpp.
References llvm::BitVector::clear(), llvm::SmallVectorImpl< T >::clear(), llvm::MachineFunction::getNumBlockIDs(), llvm::MachineFunction::getRegInfo(), N, llvm::IndexedMap< T, ToIndexT >::resize(), and llvm::BitVector::resize().
Referenced by llvm::LiveIntervals::extendToIndices(), and llvm::SplitEditor::reset().
void llvm::LiveRangeCalc::setLiveOutValue | ( | MachineBasicBlock * | MBB, |
VNInfo * | VNI | ||
) | [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 205 of file LiveRangeCalc.h.
References llvm::MachineBasicBlock::getNumber(), and llvm::BitVector::set().