class LiveRangeEdit

Declaration

class LiveRangeEdit : private Delegate { /* full declaration omitted */ };

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:45

Inherits from: MachineRegisterInfo::Delegate

Method Overview

  • public LiveRangeEdit(llvm::LiveInterval * parent, SmallVectorImpl<unsigned int> & newRegs, llvm::MachineFunction & MF, llvm::LiveIntervals & lis, llvm::VirtRegMap * vrm, llvm::LiveRangeEdit::Delegate * delegate = nullptr, SmallPtrSet<llvm::MachineInstr *, 32> * deadRemats = nullptr)
  • public bool anyRematerializable(llvm::AliasAnalysis *)
  • public llvm::LiveRangeEdit::iterator begin() const
  • public void calculateRegClassAndHint(llvm::MachineFunction &, const llvm::MachineLoopInfo &, const llvm::MachineBlockFrequencyInfo &)
  • public bool canRematerializeAt(llvm::LiveRangeEdit::Remat & RM, llvm::VNInfo * OrigVNI, llvm::SlotIndex UseIdx, bool cheapAsAMove)
  • public bool checkRematerializable(llvm::VNInfo * VNI, const llvm::MachineInstr * DefMI, llvm::AliasAnalysis *)
  • public unsigned int create()
  • public llvm::LiveInterval & createEmptyInterval()
  • public unsigned int createFrom(unsigned int OldReg)
  • public bool didRematerialize(const llvm::VNInfo * ParentVNI) const
  • public void eliminateDeadDefs(SmallVectorImpl<llvm::MachineInstr *> & Dead, ArrayRef<unsigned int> RegsBeingSpilled = None, llvm::AliasAnalysis * AA = nullptr)
  • public bool empty() const
  • public llvm::LiveRangeEdit::iterator end() const
  • public void eraseVirtReg(unsigned int Reg)
  • public unsigned int get(unsigned int idx) const
  • public llvm::LiveInterval & getParent() const
  • public unsigned int getReg() const
  • public void markRematerialized(const llvm::VNInfo * ParentVNI)
  • public void pop_back()
  • public ArrayRef<unsigned int> regs() const
  • public llvm::SlotIndex rematerializeAt(llvm::MachineBasicBlock & MBB, MachineBasicBlock::iterator MI, unsigned int DestReg, const llvm::LiveRangeEdit::Remat & RM, const llvm::TargetRegisterInfo &, bool Late = false)
  • public unsigned int size() const
  • public ~LiveRangeEdit()

Methods

LiveRangeEdit(
    llvm::LiveInterval* parent,
    SmallVectorImpl<unsigned int>& newRegs,
    llvm::MachineFunction& MF,
    llvm::LiveIntervals& lis,
    llvm::VirtRegMap* vrm,
    llvm::LiveRangeEdit::Delegate* delegate =
        nullptr,
    SmallPtrSet<llvm::MachineInstr*, 32>*
        deadRemats = nullptr)

Description

Create a LiveRangeEdit for breaking down parent into smaller pieces.

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

Parameters

llvm::LiveInterval* parent
The register being spilled or split.
SmallVectorImpl<unsigned int>& newRegs
List to receive any new registers created. This needn't be empty initially, any existing registers are ignored.
llvm::MachineFunction& MF
The MachineFunction the live range edit is taking place in.
llvm::LiveIntervals& lis
The collection of all live intervals in this function.
llvm::VirtRegMap* vrm
Map of virtual registers to physical registers for this function. If NULL, no virtual register map updates will be done. This could be the case if called before Regalloc.
llvm::LiveRangeEdit::Delegate* delegate = nullptr
SmallPtrSet<llvm::MachineInstr*, 32>* deadRemats = nullptr
The collection of all the instructions defining an original reg and are dead after remat.

bool anyRematerializable(llvm::AliasAnalysis*)

Description

anyRematerializable - Return true if any parent values may be rematerializable. This function must be called before any rematerialization is attempted.

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:193

Parameters

llvm::AliasAnalysis*

llvm::LiveRangeEdit::iterator begin() const

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

void calculateRegClassAndHint(
    llvm::MachineFunction&,
    const llvm::MachineLoopInfo&,
    const llvm::MachineBlockFrequencyInfo&)

Description

calculateRegClassAndHint - Recompute register class and hint for each new register.

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:251

Parameters

llvm::MachineFunction&
const llvm::MachineLoopInfo&
const llvm::MachineBlockFrequencyInfo&

bool canRematerializeAt(
    llvm::LiveRangeEdit::Remat& RM,
    llvm::VNInfo* OrigVNI,
    llvm::SlotIndex UseIdx,
    bool cheapAsAMove)

Description

canRematerializeAt - Determine if ParentVNI can be rematerialized at UseIdx. It is assumed that parent_.getVNINfoAt(UseIdx) == ParentVNI. When cheapAsAMove is set, only cheap remats are allowed.

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:212

Parameters

llvm::LiveRangeEdit::Remat& RM
llvm::VNInfo* OrigVNI
llvm::SlotIndex UseIdx
bool cheapAsAMove

bool checkRematerializable(
    llvm::VNInfo* VNI,
    const llvm::MachineInstr* DefMI,
    llvm::AliasAnalysis*)

Description

checkRematerializable - Manually add VNI to the list of rematerializable values if DefMI may be rematerializable.

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:197

Parameters

llvm::VNInfo* VNI
const llvm::MachineInstr* DefMI
llvm::AliasAnalysis*

unsigned int create()

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:188

llvm::LiveInterval& createEmptyInterval()

Description

create - Create a new register with the same class and original slot as parent.

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

unsigned int createFrom(unsigned int OldReg)

Description

createFrom - Create a new virtual register based on OldReg.

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:180

Parameters

unsigned int OldReg

bool didRematerialize(
    const llvm::VNInfo* ParentVNI) const

Description

didRematerialize - Return true if ParentVNI was rematerialized anywhere.

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

Parameters

const llvm::VNInfo* ParentVNI

void eliminateDeadDefs(
    SmallVectorImpl<llvm::MachineInstr*>& Dead,
    ArrayRef<unsigned int> RegsBeingSpilled =
        None,
    llvm::AliasAnalysis* AA = nullptr)

Description

eliminateDeadDefs - Try to delete machine instructions that are now dead (allDefsAreDead returns true). This may cause live intervals to be trimmed and further dead efs to be eliminated. RegsBeingSpilled lists registers currently being spilled by the register allocator. These registers should not be split into new intervals as currently those new intervals are not guaranteed to spill.

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

Parameters

SmallVectorImpl<llvm::MachineInstr*>& Dead
ArrayRef<unsigned int> RegsBeingSpilled = None
llvm::AliasAnalysis* AA = nullptr

bool empty() const

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:162

llvm::LiveRangeEdit::iterator end() const

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:160

void eraseVirtReg(unsigned int Reg)

Description

eraseVirtReg - Notify the delegate that Reg is no longer in use, and try to erase it from LIS.

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:237

Parameters

unsigned int Reg

unsigned int get(unsigned int idx) const

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:163

Parameters

unsigned int idx

llvm::LiveInterval& getParent() const

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:150

unsigned int getReg() const

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:155

void markRematerialized(
    const llvm::VNInfo* ParentVNI)

Description

markRematerialized - explicitly mark a value as rematerialized after doing it manually.

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

Parameters

const llvm::VNInfo* ParentVNI

void pop_back()

Description

pop_back - It allows LiveRangeEdit users to drop new registers. The context is when an original def instruction of a register is dead after rematerialization, we still want to keep it for following rematerializations. We save the def instruction in DeadRemats, and replace the original dst register with a new dummy register so the live range of original dst register can be shrinked normally. We don't want to allocate phys register for the dummy register, so we want to drop it from the NewRegs set.

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:173

ArrayRef<unsigned int> regs() const

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:175

llvm::SlotIndex rematerializeAt(
    llvm::MachineBasicBlock& MBB,
    MachineBasicBlock::iterator MI,
    unsigned int DestReg,
    const llvm::LiveRangeEdit::Remat& RM,
    const llvm::TargetRegisterInfo&,
    bool Late = false)

Description

rematerializeAt - Rematerialize RM.ParentVNI into DestReg by inserting an instruction into MBB before MI. The new instruction is mapped, but liveness is not updated. Return the SlotIndex of the new instruction.

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:219

Parameters

llvm::MachineBasicBlock& MBB
MachineBasicBlock::iterator MI
unsigned int DestReg
const llvm::LiveRangeEdit::Remat& RM
const llvm::TargetRegisterInfo&
bool Late = false

unsigned int size() const

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

~LiveRangeEdit()

Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:148