class LiveIntervals

Declaration

class LiveIntervals : public MachineFunctionPass { /* full declaration omitted */ };

Description

MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of passes that operate on the MachineFunction representation. Instead of overriding runOnFunction, subclasses override runOnMachineFunction.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:54

Inherits from: MachineFunctionPass

Member Variables

public static char ID

Method Overview

Inherited from MachineFunctionPass:

Inherited from FunctionPass:

Inherited from Pass:

Methods

llvm::SlotIndex InsertMachineInstrInMaps(
    llvm::MachineInstr& MI)

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:266

Parameters

llvm::MachineInstr& MI

void InsertMachineInstrRangeInMaps(
    MachineBasicBlock::iterator B,
    MachineBasicBlock::iterator E)

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:270

Parameters

MachineBasicBlock::iterator B
MachineBasicBlock::iterator E

LiveIntervals()

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:101

void RemoveMachineInstrFromMaps(
    llvm::MachineInstr& MI)

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:276

Parameters

llvm::MachineInstr& MI

llvm::SlotIndex ReplaceMachineInstrInMaps(
    llvm::MachineInstr& MI,
    llvm::MachineInstr& NewMI)

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:280

Parameters

llvm::MachineInstr& MI
llvm::MachineInstr& NewMI

void addKillFlags(const llvm::VirtRegMap*)

Description

Add kill flags to any instruction that kills a virtual register.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:304

Parameters

const llvm::VirtRegMap*

LiveInterval::Segment addSegmentToEndOfBlock(
    unsigned int reg,
    llvm::MachineInstr& startInst)

Description

Given a register and an instruction, adds a live segment from that instruction to the end of its MBB.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:152

Parameters

unsigned int reg
llvm::MachineInstr& startInst

bool checkRegMaskInterference(
    llvm::LiveInterval& LI,
    llvm::BitVector& UsableRegs)

Description

Test if \p LI is live across any register mask instructions, and compute a bit mask of physical registers that are not clobbered by any of them. Returns false if \p LI doesn't cross any register mask instructions. In that case, the bit vector is not filled in.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:377

Parameters

llvm::LiveInterval& LI
llvm::BitVector& UsableRegs

void constructMainRangeFromSubranges(
    llvm::LiveInterval& LI)

Description

For live interval \p LI with correct SubRanges construct matching information for the main live range. Expects the main live range to not have any segments or value numbers.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:446

Parameters

llvm::LiveInterval& LI

llvm::LiveInterval&
createAndComputeVirtRegInterval(
    llvm::Register Reg)

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:138

Parameters

llvm::Register Reg

llvm::LiveInterval& createEmptyInterval(
    llvm::Register Reg)

Description

Interval creation.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:131

Parameters

llvm::Register Reg

void extendToIndices(
    llvm::LiveRange& LR,
    ArrayRef<llvm::SlotIndex> Indices,
    ArrayRef<llvm::SlotIndex> Undefs)

Description

Extend the live range \p LR to reach all points in \p Indices. The points in the \p Indices array must be jointly dominated by the union of the existing defs in \p LR and points in \p Undefs. PHI-defs are added as needed to maintain SSA form. If a SlotIndex in \p Indices is the end index of a basic block, \p LR will be extended to be live out of the basic block. If a SlotIndex in \p Indices is jointy dominated only by points in\p Undefs, the live range will not be extended to that point. See also LiveRangeCalc::extend().

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:184

Parameters

llvm::LiveRange& LR
ArrayRef<llvm::SlotIndex> Indices
ArrayRef<llvm::SlotIndex> Undefs

void extendToIndices(
    llvm::LiveRange& LR,
    ArrayRef<llvm::SlotIndex> Indices)

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:187

Parameters

llvm::LiveRange& LR
ArrayRef<llvm::SlotIndex> Indices

llvm::AliasAnalysis* getAliasAnalysis() const

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:215

void getAnalysisUsage(
    llvm::AnalysisUsage& AU) const

Description

getAnalysisUsage - Subclasses that override getAnalysisUsage must call this. For MachineFunctionPasses, calling AU.preservesCFG() indicates that the pass does not modify the MachineBasicBlock CFG.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:286

Parameters

llvm::AnalysisUsage& AU

const llvm::LiveRange* getCachedRegUnit(
    unsigned int Unit) const

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:410

Parameters

unsigned int Unit

llvm::LiveRange* getCachedRegUnit(
    unsigned int Unit)

Description

Return the live range for register unit \p Unit if it has already been computed, or nullptr if it hasn't been computed yet.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:406

Parameters

unsigned int Unit

llvm::MachineInstr* getInstructionFromIndex(
    llvm::SlotIndex index) const

Description

Returns the instruction associated with the given index.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:231

Parameters

llvm::SlotIndex index

llvm::SlotIndex getInstructionIndex(
    const llvm::MachineInstr& Instr) const

Description

Returns the base index of the given instruction.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:226

Parameters

const llvm::MachineInstr& Instr

llvm::LiveInterval& getInterval(
    llvm::Register Reg)

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:114

Parameters

llvm::Register Reg

const llvm::LiveInterval& getInterval(
    llvm::Register Reg) const

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:121

Parameters

llvm::Register Reg

llvm::SlotIndex getMBBEndIdx(
    const llvm::MachineBasicBlock* mbb) const

Description

Return the last index in the given basic block.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:241

Parameters

const llvm::MachineBasicBlock* mbb

llvm::MachineBasicBlock* getMBBFromIndex(
    llvm::SlotIndex index) const

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:255

Parameters

llvm::SlotIndex index

llvm::SlotIndex getMBBStartIdx(
    const llvm::MachineBasicBlock* mbb) const

Description

Return the first index in the given basic block.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:236

Parameters

const llvm::MachineBasicBlock* mbb

ArrayRef<const uint32_t*> getRegMaskBits() const

Description

Returns an array of register mask pointers corresponding to getRegMaskSlots().

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:362

ArrayRef<const uint32_t*> getRegMaskBitsInBlock(
    unsigned int MBBNum) const

Description

Returns an array of mask pointers corresponding to getRegMaskSlotsInBlock(MBBNum).

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:366

Parameters

unsigned int MBBNum

ArrayRef<llvm::SlotIndex> getRegMaskSlots() const

Description

Returns a sorted array of slot indices of all instructions with register mask operands.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:351

ArrayRef<llvm::SlotIndex> getRegMaskSlotsInBlock(
    unsigned int MBBNum) const

Description

Returns a sorted array of slot indices of all instructions with register mask operands in the basic block numbered \p MBBNum.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:355

Parameters

unsigned int MBBNum

llvm::LiveRange& getRegUnit(unsigned int Unit)

Description

Return the live range for register unit \p Unit. It will be computed if it doesn't exist.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:393

Parameters

unsigned int Unit

llvm::SlotIndexes* getSlotIndexes() const

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:211

static float getSpillWeight(
    bool isDef,
    bool isUse,
    const llvm::MachineBlockFrequencyInfo* MBFI,
    const llvm::MachineInstr& MI)

Description

Calculate the spill weight to assign to a single instruction.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:105

Parameters

bool isDef
bool isUse
const llvm::MachineBlockFrequencyInfo* MBFI
const llvm::MachineInstr& MI

static float getSpillWeight(
    bool isDef,
    bool isUse,
    const llvm::MachineBlockFrequencyInfo* MBFI,
    const llvm::MachineBasicBlock* MBB)

Description

Calculate the spill weight to assign to a single instruction.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:110

Parameters

bool isDef
bool isUse
const llvm::MachineBlockFrequencyInfo* MBFI
const llvm::MachineBasicBlock* MBB

VNInfo::Allocator& getVNInfoAllocator()

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:284

void handleMove(llvm::MachineInstr& MI,
                bool UpdateFlags = false)

Description

Call this method to notify LiveIntervals that instruction \p MI has been moved within a basic block. This will update the live intervals for all operands of \p MI. Moves between basic blocks are not supported.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:311

Parameters

llvm::MachineInstr& MI
bool UpdateFlags = false
Update live intervals for nonallocatable physregs.

void handleMoveIntoBundle(
    llvm::MachineInstr& MI,
    llvm::MachineInstr& BundleStart,
    bool UpdateFlags = false)

Description

Update intervals for operands of \p MI so that they begin/end on the SlotIndex for \p BundleStart. Requires MI and BundleStart to have SlotIndexes, and assumes existing liveness is accurate. BundleStart should be the first instruction in the Bundle.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:321

Parameters

llvm::MachineInstr& MI
llvm::MachineInstr& BundleStart
bool UpdateFlags = false
Update live intervals for nonallocatable physregs.

bool hasInterval(llvm::Register Reg) const

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:125

Parameters

llvm::Register Reg

bool hasPHIKill(const llvm::LiveInterval& LI,
                const llvm::VNInfo* VNI) const

Description

Returns true if VNI is killed by any PHI-def values in LI. This may conservatively return true to avoid expensive computations.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:301

Parameters

const llvm::LiveInterval& LI
const llvm::VNInfo* VNI

void insertMBBInMaps(llvm::MachineBasicBlock* MBB)

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:259

Parameters

llvm::MachineBasicBlock* MBB

llvm::MachineBasicBlock* intervalIsInOneMBB(
    const llvm::LiveInterval& LI) const

Description

If LI is confined to a single basic block, return a pointer to that block. If LI is live in to or out of any block, return NULL.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:297

Parameters

const llvm::LiveInterval& LI

bool isLiveInToMBB(
    const llvm::LiveRange& LR,
    const llvm::MachineBasicBlock* mbb) const

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:245

Parameters

const llvm::LiveRange& LR
const llvm::MachineBasicBlock* mbb

bool isLiveOutOfMBB(
    const llvm::LiveRange& LR,
    const llvm::MachineBasicBlock* mbb) const

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:250

Parameters

const llvm::LiveRange& LR
const llvm::MachineBasicBlock* mbb

bool isNotInMIMap(
    const llvm::MachineInstr& Instr) const

Description

Returns true if the specified machine instr has been removed or was never entered in the map.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:221

Parameters

const llvm::MachineInstr& Instr

void print(llvm::raw_ostream& O,
           const llvm::Module* = nullptr) const

Description

Implement the dump method.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:293

Parameters

llvm::raw_ostream& O
const llvm::Module* = nullptr

void pruneValue(llvm::LiveInterval&,
                llvm::SlotIndex,
                SmallVectorImpl<llvm::SlotIndex>*)

Description

This function should not be used. Its intent is to tell you that you are doing something wrong if you call pruneValue directly on a LiveInterval. Indeed, you are supposed to call pruneValue on the main LiveRange and all the LiveRanges of the subranges if any.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:205

Parameters

llvm::LiveInterval&
llvm::SlotIndex
SmallVectorImpl<llvm::SlotIndex>*

void pruneValue(
    llvm::LiveRange& LR,
    llvm::SlotIndex Kill,
    SmallVectorImpl<llvm::SlotIndex>* EndPoints)

Description

If \p LR has a live value at \p Kill, prune its live range by removing any liveness reachable from Kill. Add live range end points to EndPoints such that extendToIndices(LI, EndPoints) will reconstruct the value's live range. Calling pruneValue() and extendToIndices() can be used to reconstruct SSA form after adding defs to a virtual register.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:198

Parameters

llvm::LiveRange& LR
llvm::SlotIndex Kill
SmallVectorImpl<llvm::SlotIndex>* EndPoints

void releaseMemory()

Description

releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed. The default behavior of passes is to hold onto memory for the entire duration of their lifetime (which is the entire compile time). For pipelined passes, this is not a big deal because that memory gets recycled every time the pass is invoked on another program unit. For IP passes, it is more important to free memory when it is unused. Optionally implement this function to release pass memory when it is no longer used.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:287

void removeAllRegUnitsForPhysReg(unsigned int Reg)

Description

Remove associated live ranges for the register units associated with \p Reg. Subsequent uses should rely on on-demand recomputation.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:425

Parameters

unsigned int Reg

void removeInterval(unsigned int Reg)

Description

Interval removal.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:145

Parameters

unsigned int Reg

void removePhysRegDefAt(unsigned int Reg,
                        llvm::SlotIndex Pos)

Description

Remove value numbers and related live segments starting at position\p Pos that are part of any liverange of physical register \p Reg or one of its subregisters.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:433

Parameters

unsigned int Reg
llvm::SlotIndex Pos

void removeRegUnit(unsigned int Unit)

Description

Remove computed live range for register unit \p Unit. Subsequent uses should rely on on-demand recomputation.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:416

Parameters

unsigned int Unit

void removeVRegDefAt(llvm::LiveInterval& LI,
                     llvm::SlotIndex Pos)

Description

Remove value number and related live segments of \p LI and its subranges that start at position \p Pos.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:437

Parameters

llvm::LiveInterval& LI
llvm::SlotIndex Pos

void repairIntervalsInRange(
    llvm::MachineBasicBlock* MBB,
    MachineBasicBlock::iterator Begin,
    MachineBasicBlock::iterator End,
    ArrayRef<unsigned int> OrigRegs)

Description

Update live intervals for instructions in a range of iterators. It is intended for use after target hooks that may insert or remove instructions, and is only efficient for a small number of instructions. OrigRegs is a vector of registers that were originally used by the instructions in the range between the two iterators. Currently, the only only changes that are supported are simple removal and addition of uses.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:333

Parameters

llvm::MachineBasicBlock* MBB
MachineBasicBlock::iterator Begin
MachineBasicBlock::iterator End
ArrayRef<unsigned int> OrigRegs

bool runOnMachineFunction(llvm::MachineFunction&)

Description

Pass entry point; Calculates LiveIntervals.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:290

Parameters

llvm::MachineFunction&

bool shrinkToUses(
    llvm::LiveInterval* li,
    SmallVectorImpl<llvm::MachineInstr*>* dead =
        nullptr)

Description

After removing some uses of a register, shrink its live range to just the remaining uses. This method does not compute reaching defs for new uses, and it doesn't remove dead defs. Dead PHIDef values are marked as unused. New dead machine instructions are added to the dead vector. Returns true if the interval may have been separated into multiple connected components.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:161

Parameters

llvm::LiveInterval* li
SmallVectorImpl<llvm::MachineInstr*>* dead = nullptr

void shrinkToUses(LiveInterval::SubRange& SR,
                  unsigned int Reg)

Description

Specialized version of shrinkToUses(LiveInterval *li, SmallVectorImpl <MachineInstr *> *dead) that works on a subregister live range and only looks at uses matching the lane mask of the subregister range. This may leave the subrange empty which needs to be cleaned up with LiveInterval::removeEmptySubranges() afterwards.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:170

Parameters

LiveInterval::SubRange& SR
unsigned int Reg

void splitSeparateComponents(
    llvm::LiveInterval& LI,
    SmallVectorImpl<llvm::LiveInterval*>&
        SplitLIs)

Description

Split separate components in LiveInterval \p LI into separate intervals.

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:440

Parameters

llvm::LiveInterval& LI
SmallVectorImpl<llvm::LiveInterval*>& SplitLIs

~LiveIntervals()

Declared at: llvm/include/llvm/CodeGen/LiveIntervals.h:102