LLVM  3.7.0
Classes | Public Member Functions | List of all members
llvm::LiveRangeCalc Class Reference

#include <LiveRangeCalc.h>

Public Member Functions

 LiveRangeCalc ()
 
void reset (const MachineFunction *MF, SlotIndexes *, MachineDominatorTree *, VNInfo::Allocator *)
 reset - Prepare caches for a new set of non-overlapping live ranges. More...
 
void extend (LiveRange &LR, SlotIndex Use, unsigned PhysReg=0)
 Extend the live range of LR to reach Use. More...
 
void createDeadDefs (LiveRange &LR, unsigned Reg)
 createDeadDefs - Create a dead def in LI for every def operand of Reg. More...
 
void extendToUses (LiveRange &LR, unsigned PhysReg)
 Extend the live range of LR to reach all uses of Reg. More...
 
void calculate (LiveInterval &LI, bool TrackSubRegs)
 Calculates liveness for the register specified in live interval LI. More...
 
void setLiveOutValue (MachineBasicBlock *MBB, VNInfo *VNI)
 setLiveOutValue - Indicate that VNI is live out from MBB. More...
 
void addLiveInBlock (LiveRange &LR, MachineDomTreeNode *DomNode, SlotIndex Kill=SlotIndex())
 addLiveInBlock - Add a block with an unknown live-in value. More...
 
void calculateValues ()
 calculateValues - Calculate the value that will be live-in to each block added with addLiveInBlock. More...
 

Detailed Description

Definition at line 36 of file LiveRangeCalc.h.

Constructor & Destructor Documentation

llvm::LiveRangeCalc::LiveRangeCalc ( )
inline

Definition at line 138 of file LiveRangeCalc.h.

Member Function Documentation

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.

Parameters
LRThe live range that is live-in to the block.
DomNodeThe domtree node for the block.
KillIndex in block where LI is killed. If the value is live-through, set Kill = SLotIndex() and also call setLiveOutValue(MBB, 0).

Definition at line 225 of file LiveRangeCalc.h.

References llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().

void LiveRangeCalc::calculate ( LiveInterval LI,
bool  TrackSubRegs 
)
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 249 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 131 of file LiveRangeCalc.cpp.

References createDeadDef(), and llvm::MachineRegisterInfo::def_operands().

void LiveRangeCalc::extend ( LiveRange LR,
SlotIndex  Use,
unsigned  PhysReg = 0 
)

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 222 of file LiveRangeCalc.cpp.

References calculateValues(), llvm::LiveRange::extendInBlock(), llvm::SlotIndexes::getMBBFromIndex(), llvm::SlotIndexes::getMBBStartIdx(), llvm::SlotIndex::getPrevSlot(), and llvm::SlotIndex::isValid().

Referenced by llvm::LiveIntervals::extendToIndices().

void llvm::LiveRangeCalc::extendToUses ( LiveRange LR,
unsigned  PhysReg 
)
inline

Extend the live range of LR 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 183 of file LiveRangeCalc.h.

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 29 of file LiveRangeCalc.cpp.

References llvm::SmallVectorImpl< T >::clear(), llvm::MachineFunction::getRegInfo(), and llvm::SI.

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 211 of file LiveRangeCalc.h.

References llvm::MachineBasicBlock::getNumber(), and llvm::BitVector::set().


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