class LiveRangeEdit
Declaration
class LiveRangeEdit : private Delegate { /* full declaration omitted */ };
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:43
Inherits from: MachineRegisterInfo::Delegate
Member Variables
- private const llvm::LiveInterval* const Parent
- private SmallVectorImpl<llvm::Register>& NewRegs
- private llvm::MachineRegisterInfo& MRI
- private llvm::LiveIntervals& LIS
- private llvm::VirtRegMap* VRM
- private const llvm::TargetInstrInfo& TII
- private llvm::LiveRangeEdit::Delegate* const TheDelegate
- private const unsigned int FirstNew
- FirstNew - Index of the first register added to NewRegs.
- private bool ScannedRemattable = false
- ScannedRemattable - true when remattable values have been identified.
- private SmallPtrSet<llvm::MachineInstr*, 32>* DeadRemats
- DeadRemats - The saved instructions which have already been dead after rematerialization but not deleted yet -- to be done in postOptimization.
- private SmallPtrSet<const llvm::VNInfo*, 4> Remattable
- Remattable - Values defined by remattable instructions as identified by tii.isTriviallyReMaterializable().
- private SmallPtrSet<const llvm::VNInfo*, 4> Rematted
- Rematted - Values that were actually rematted, and so need to have their live range trimmed or entirely removed.
Method Overview
- public LiveRangeEdit(const llvm::LiveInterval * parent, SmallVectorImpl<llvm::Register> & newRegs, llvm::MachineFunction & MF, llvm::LiveIntervals & lis, llvm::VirtRegMap * vrm, llvm::LiveRangeEdit::Delegate * delegate = nullptr, SmallPtrSet<llvm::MachineInstr *, 32> * deadRemats = nullptr)
- private void MRI_NoteNewVirtualRegister(llvm::Register VReg)
- public bool allUsesAvailableAt(const llvm::MachineInstr * OrigMI, llvm::SlotIndex OrigIdx, llvm::SlotIndex UseIdx) const
- public bool anyRematerializable()
- public llvm::LiveRangeEdit::iterator begin() const
- public void calculateRegClassAndHint(llvm::MachineFunction &, llvm::VirtRegAuxInfo &)
- 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)
- public llvm::Register create()
- public llvm::LiveInterval & createEmptyInterval()
- private llvm::LiveInterval & createEmptyIntervalFrom(llvm::Register OldReg, bool createSubRanges)
- public llvm::Register createFrom(llvm::Register OldReg)
- public bool didRematerialize(const llvm::VNInfo * ParentVNI) const
- private void eliminateDeadDef(llvm::MachineInstr * MI, llvm::LiveRangeEdit::ToShrinkSet & ToShrink)
- public void eliminateDeadDefs(SmallVectorImpl<llvm::MachineInstr *> & Dead, ArrayRef<llvm::Register> RegsBeingSpilled = None)
- public bool empty() const
- public llvm::LiveRangeEdit::iterator end() const
- public void eraseVirtReg(llvm::Register Reg)
- private bool foldAsLoad(llvm::LiveInterval * LI, SmallVectorImpl<llvm::MachineInstr *> & Dead)
- public llvm::Register get(unsigned int idx) const
- public const llvm::LiveInterval & getParent() const
- public llvm::Register getReg() const
- public void markRematerialized(const llvm::VNInfo * ParentVNI)
- public void pop_back()
- public ArrayRef<llvm::Register> 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)
- private void scanRemattable()
- public unsigned int size() const
- private bool useIsKill(const llvm::LiveInterval & LI, const llvm::MachineOperand & MO) const
- public ~LiveRangeEdit()
Methods
¶LiveRangeEdit(
const llvm::LiveInterval* parent,
SmallVectorImpl<llvm::Register>& newRegs,
llvm::MachineFunction& MF,
llvm::LiveIntervals& lis,
llvm::VirtRegMap* vrm,
llvm::LiveRangeEdit::Delegate* delegate =
nullptr,
SmallPtrSet<llvm::MachineInstr*, 32>*
deadRemats = nullptr)
LiveRangeEdit(
const llvm::LiveInterval* parent,
SmallVectorImpl<llvm::Register>& 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:130
Parameters
- const llvm::LiveInterval* parent
- The register being spilled or split.
- SmallVectorImpl<llvm::Register>& 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.
¶void MRI_NoteNewVirtualRegister(
llvm::Register VReg)
void MRI_NoteNewVirtualRegister(
llvm::Register VReg)
Description
MachineRegisterInfo callback to notify when new virtual registers are created.
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:109
Parameters
- llvm::Register VReg
¶bool allUsesAvailableAt(
const llvm::MachineInstr* OrigMI,
llvm::SlotIndex OrigIdx,
llvm::SlotIndex UseIdx) const
bool allUsesAvailableAt(
const llvm::MachineInstr* OrigMI,
llvm::SlotIndex OrigIdx,
llvm::SlotIndex UseIdx) const
Description
allUsesAvailableAt - Return true if all registers used by OrigMI at OrigIdx are also available with the same value at UseIdx.
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:202
Parameters
- const llvm::MachineInstr* OrigMI
- llvm::SlotIndex OrigIdx
- llvm::SlotIndex UseIdx
¶bool anyRematerializable()
bool anyRematerializable()
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:185
¶llvm::LiveRangeEdit::iterator begin() const
llvm::LiveRangeEdit::iterator begin() const
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:151
¶void calculateRegClassAndHint(
llvm::MachineFunction&,
llvm::VirtRegAuxInfo&)
void calculateRegClassAndHint(
llvm::MachineFunction&,
llvm::VirtRegAuxInfo&)
Description
calculateRegClassAndHint - Recompute register class and hint for each new register.
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:246
Parameters
¶bool canRematerializeAt(
llvm::LiveRangeEdit::Remat& RM,
llvm::VNInfo* OrigVNI,
llvm::SlotIndex UseIdx,
bool cheapAsAMove)
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:208
Parameters
- llvm::LiveRangeEdit::Remat& RM
- llvm::VNInfo* OrigVNI
- llvm::SlotIndex UseIdx
- bool cheapAsAMove
¶bool checkRematerializable(
llvm::VNInfo* VNI,
const llvm::MachineInstr* DefMI)
bool checkRematerializable(
llvm::VNInfo* VNI,
const llvm::MachineInstr* DefMI)
Description
checkRematerializable - Manually add VNI to the list of rematerializable values if DefMI may be rematerializable.
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:189
Parameters
- llvm::VNInfo* VNI
- const llvm::MachineInstr* DefMI
¶llvm::Register create()
llvm::Register create()
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:180
¶llvm::LiveInterval& createEmptyInterval()
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:176
¶llvm::LiveInterval& createEmptyIntervalFrom(
llvm::Register OldReg,
bool createSubRanges)
llvm::LiveInterval& createEmptyIntervalFrom(
llvm::Register OldReg,
bool createSubRanges)
Description
Create a new empty interval based on OldReg.
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:116
Parameters
- llvm::Register OldReg
- bool createSubRanges
¶llvm::Register createFrom(llvm::Register OldReg)
llvm::Register createFrom(llvm::Register OldReg)
Description
createFrom - Create a new virtual register based on OldReg.
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:172
Parameters
- llvm::Register OldReg
¶bool didRematerialize(
const llvm::VNInfo* ParentVNI) const
bool didRematerialize(
const llvm::VNInfo* ParentVNI) const
Description
didRematerialize - Return true if ParentVNI was rematerialized anywhere.
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:227
Parameters
- const llvm::VNInfo* ParentVNI
¶void eliminateDeadDef(
llvm::MachineInstr* MI,
llvm::LiveRangeEdit::ToShrinkSet& ToShrink)
void eliminateDeadDef(
llvm::MachineInstr* MI,
llvm::LiveRangeEdit::ToShrinkSet& ToShrink)
Description
Helper for eliminateDeadDefs.
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:105
Parameters
- llvm::MachineInstr* MI
- llvm::LiveRangeEdit::ToShrinkSet& ToShrink
¶void eliminateDeadDefs(
SmallVectorImpl<llvm::MachineInstr*>& Dead,
ArrayRef<llvm::Register> RegsBeingSpilled =
None)
void eliminateDeadDefs(
SmallVectorImpl<llvm::MachineInstr*>& Dead,
ArrayRef<llvm::Register> RegsBeingSpilled =
None)
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:241
Parameters
- SmallVectorImpl<llvm::MachineInstr*>& Dead
- ArrayRef<llvm::Register> RegsBeingSpilled = None
¶bool empty() const
bool empty() const
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:154
¶llvm::LiveRangeEdit::iterator end() const
llvm::LiveRangeEdit::iterator end() const
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:152
¶void eraseVirtReg(llvm::Register Reg)
void eraseVirtReg(llvm::Register 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:233
Parameters
- llvm::Register Reg
¶bool foldAsLoad(
llvm::LiveInterval* LI,
SmallVectorImpl<llvm::MachineInstr*>& Dead)
bool foldAsLoad(
llvm::LiveInterval* LI,
SmallVectorImpl<llvm::MachineInstr*>& Dead)
Description
foldAsLoad - If LI has a single use and a single def that can be folded as a load, eliminate the register by folding the def into the use.
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:99
Parameters
- llvm::LiveInterval* LI
- SmallVectorImpl<llvm::MachineInstr*>& Dead
¶llvm::Register get(unsigned int idx) const
llvm::Register get(unsigned int idx) const
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:155
Parameters
- unsigned int idx
¶const llvm::LiveInterval& getParent() const
const llvm::LiveInterval& getParent() const
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:142
¶llvm::Register getReg() const
llvm::Register getReg() const
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:147
¶void markRematerialized(
const llvm::VNInfo* ParentVNI)
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:222
Parameters
- const llvm::VNInfo* ParentVNI
¶void pop_back()
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:165
¶ArrayRef<llvm::Register> regs() const
ArrayRef<llvm::Register> regs() const
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:167
¶llvm::SlotIndex rematerializeAt(
llvm::MachineBasicBlock& MBB,
MachineBasicBlock::iterator MI,
unsigned int DestReg,
const llvm::LiveRangeEdit::Remat& RM,
const llvm::TargetRegisterInfo&,
bool Late = false)
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:215
Parameters
- llvm::MachineBasicBlock& MBB
- MachineBasicBlock::iterator MI
- unsigned int DestReg
- const llvm::LiveRangeEdit::Remat& RM
- const llvm::TargetRegisterInfo&
- bool Late = false
¶void scanRemattable()
void scanRemattable()
Description
scanRemattable - Identify the Parent values that may rematerialize.
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:95
¶unsigned int size() const
unsigned int size() const
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:153
¶bool useIsKill(
const llvm::LiveInterval& LI,
const llvm::MachineOperand& MO) const
bool useIsKill(
const llvm::LiveInterval& LI,
const llvm::MachineOperand& MO) const
Description
Check if MachineOperand \p MO is a last use/kill either in the main live range of \p LI or in one of the matching subregister ranges.
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:113
Parameters
- const llvm::LiveInterval& LI
- const llvm::MachineOperand& MO
¶~LiveRangeEdit()
~LiveRangeEdit()
Declared at: llvm/include/llvm/CodeGen/LiveRangeEdit.h:140