class LiveRegMatrix

Declaration

class LiveRegMatrix : 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/LiveRegMatrix.h:40

Inherits from: MachineFunctionPass

Member Variables

private const llvm::TargetRegisterInfo* TRI
private llvm::LiveIntervals* LIS
private llvm::VirtRegMap* VRM
private unsigned int UserTag = 0
private LiveIntervalUnion::Allocator LIUAlloc
private LiveIntervalUnion::Array Matrix
private std::unique_ptr<LiveIntervalUnion::Query[]> Queries
private unsigned int RegMaskTag = 0
private unsigned int RegMaskVirtReg = 0
private llvm::BitVector RegMaskUsable
public static char ID

Method Overview

Inherited from MachineFunctionPass:

Inherited from FunctionPass:

Inherited from Pass:

Methods

LiveRegMatrix()

Declared at: llvm/include/llvm/CodeGen/LiveRegMatrix.h:68

void assign(const llvm::LiveInterval& VirtReg,
            llvm::MCRegister PhysReg)

Description

Assign VirtReg to PhysReg. This will mark VirtReg's live range as occupied in the LiveRegMatrix and update VirtRegMap. The live range is expected to be available in PhysReg.

Declared at: llvm/include/llvm/CodeGen/LiveRegMatrix.h:120

Parameters

const llvm::LiveInterval& VirtReg
llvm::MCRegister PhysReg

llvm::LiveRegMatrix::InterferenceKind
checkInterference(
    const llvm::LiveInterval& VirtReg,
    llvm::MCRegister PhysReg)

Description

Check for interference before assigning VirtReg to PhysReg. If this function returns IK_Free, it is legal to assign(VirtReg, PhysReg). When there is more than one kind of interference, the InterferenceKind with the highest enum value is returned.

Declared at: llvm/include/llvm/CodeGen/LiveRegMatrix.h:107

Parameters

const llvm::LiveInterval& VirtReg
llvm::MCRegister PhysReg

bool checkInterference(llvm::SlotIndex Start,
                       llvm::SlotIndex End,
                       llvm::MCRegister PhysReg)

Description

Check for interference in the segment [Start, End) that may prevent assignment to PhysReg. If this function returns true, there is interference in the segment [Start, End) of some other interval already assigned to PhysReg. If this function returns false, PhysReg is free at the segment [Start, End).

Declared at: llvm/include/llvm/CodeGen/LiveRegMatrix.h:115

Parameters

llvm::SlotIndex Start
llvm::SlotIndex End
llvm::MCRegister PhysReg

bool checkRegMaskInterference(
    const llvm::LiveInterval& VirtReg,
    llvm::MCRegister PhysReg =
        MCRegister::NoRegister)

Description

Check for regmask interference only. Return true if VirtReg crosses a regmask operand that clobbers PhysReg. If PhysReg is null, check if VirtReg crosses any regmask operands.

Declared at: llvm/include/llvm/CodeGen/LiveRegMatrix.h:140

Parameters

const llvm::LiveInterval& VirtReg
llvm::MCRegister PhysReg = MCRegister::NoRegister

bool checkRegUnitInterference(
    const llvm::LiveInterval& VirtReg,
    llvm::MCRegister PhysReg)

Description

Check for regunit interference only. Return true if VirtReg overlaps a fixed assignment of one of PhysRegs's register units.

Declared at: llvm/include/llvm/CodeGen/LiveRegMatrix.h:146

Parameters

const llvm::LiveInterval& VirtReg
llvm::MCRegister PhysReg

void getAnalysisUsage(llvm::AnalysisUsage&) 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/LiveRegMatrix.h:61

Parameters

llvm::AnalysisUsage&

llvm::LiveIntervalUnion* getLiveUnions()

Description

Directly access the live interval unions per regunit. This returns an array indexed by the regunit number.

Declared at: llvm/include/llvm/CodeGen/LiveRegMatrix.h:157

llvm::Register getOneVReg(
    unsigned int PhysReg) const

Declared at: llvm/include/llvm/CodeGen/LiveRegMatrix.h:159

Parameters

unsigned int PhysReg

void invalidateVirtRegs()

Description

Invalidate cached interference queries after modifying virtual register live ranges. Interference checks may return stale information unless caches are invalidated.

Declared at: llvm/include/llvm/CodeGen/LiveRegMatrix.h:81

bool isPhysRegUsed(llvm::MCRegister PhysReg) const

Description

Returns true if the given \p PhysReg has any live intervals assigned.

Declared at: llvm/include/llvm/CodeGen/LiveRegMatrix.h:128

Parameters

llvm::MCRegister PhysReg

LiveIntervalUnion::Query& query(
    const llvm::LiveRange& LR,
    llvm::MCRegister RegUnit)

Description

Query a line of the assigned virtual register matrix directly. Use MCRegUnitIterator to enumerate all regunits in the desired PhysReg. This returns a reference to an internal Query data structure that is only valid until the next query() call.

Declared at: llvm/include/llvm/CodeGen/LiveRegMatrix.h:153

Parameters

const llvm::LiveRange& LR
llvm::MCRegister RegUnit

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/LiveRegMatrix.h:63

bool runOnMachineFunction(llvm::MachineFunction&)

Description

runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.

Declared at: llvm/include/llvm/CodeGen/LiveRegMatrix.h:62

Parameters

llvm::MachineFunction&

void unassign(const llvm::LiveInterval& VirtReg)

Description

Unassign VirtReg from its PhysReg. Assuming that VirtReg was previously assigned to a PhysReg, this undoes the assignment and updates VirtRegMap accordingly.

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

Parameters

const llvm::LiveInterval& VirtReg