|
LLVM
4.0.0
|
#include <LiveRangeEdit.h>
Classes | |
| class | Delegate |
| Callback methods for LiveRangeEdit owners. More... | |
| struct | Remat |
| Remat - Information needed to rematerialize at a specific location. More... | |
Public Types | |
| typedef SmallVectorImpl < unsigned >::const_iterator | iterator |
| Iterator for accessing the new registers added by this edit. More... | |
Public Member Functions | |
| LiveRangeEdit (LiveInterval *parent, SmallVectorImpl< unsigned > &newRegs, MachineFunction &MF, LiveIntervals &lis, VirtRegMap *vrm, Delegate *delegate=nullptr, SmallPtrSet< MachineInstr *, 32 > *deadRemats=nullptr) | |
| Create a LiveRangeEdit for breaking down parent into smaller pieces. More... | |
| ~LiveRangeEdit () override | |
| LiveInterval & | getParent () const |
| unsigned | getReg () const |
| iterator | begin () const |
| iterator | end () const |
| unsigned | size () const |
| bool | empty () const |
| unsigned | get (unsigned idx) const |
| void | pop_back () |
| pop_back - It allows LiveRangeEdit users to drop new registers. More... | |
| ArrayRef< unsigned > | regs () const |
| LiveInterval & | createEmptyIntervalFrom (unsigned OldReg) |
| createEmptyIntervalFrom - Create a new empty interval based on OldReg. More... | |
| unsigned | createFrom (unsigned OldReg) |
| createFrom - Create a new virtual register based on OldReg. More... | |
| LiveInterval & | createEmptyInterval () |
| create - Create a new register with the same class and original slot as parent. More... | |
| unsigned | create () |
| bool | anyRematerializable (AliasAnalysis *) |
| anyRematerializable - Return true if any parent values may be rematerializable. More... | |
| bool | checkRematerializable (VNInfo *VNI, const MachineInstr *DefMI, AliasAnalysis *) |
| checkRematerializable - Manually add VNI to the list of rematerializable values if DefMI may be rematerializable. More... | |
| bool | canRematerializeAt (Remat &RM, VNInfo *OrigVNI, SlotIndex UseIdx, bool cheapAsAMove) |
| canRematerializeAt - Determine if ParentVNI can be rematerialized at UseIdx. More... | |
| SlotIndex | rematerializeAt (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, const Remat &RM, const TargetRegisterInfo &, bool Late=false) |
| rematerializeAt - Rematerialize RM.ParentVNI into DestReg by inserting an instruction into MBB before MI. More... | |
| void | markRematerialized (const VNInfo *ParentVNI) |
| markRematerialized - explicitly mark a value as rematerialized after doing it manually. More... | |
| bool | didRematerialize (const VNInfo *ParentVNI) const |
| didRematerialize - Return true if ParentVNI was rematerialized anywhere. More... | |
| void | markDeadRemat (MachineInstr *inst) |
| void | eraseVirtReg (unsigned Reg) |
| eraseVirtReg - Notify the delegate that Reg is no longer in use, and try to erase it from LIS. More... | |
| void | eliminateDeadDefs (SmallVectorImpl< MachineInstr * > &Dead, ArrayRef< unsigned > RegsBeingSpilled=None, AliasAnalysis *AA=nullptr) |
| eliminateDeadDefs - Try to delete machine instructions that are now dead (allDefsAreDead returns true). More... | |
| void | calculateRegClassAndHint (MachineFunction &, const MachineLoopInfo &, const MachineBlockFrequencyInfo &) |
| calculateRegClassAndHint - Recompute register class and hint for each new register. More... | |
Definition at line 37 of file LiveRangeEdit.h.
| typedef SmallVectorImpl<unsigned>::const_iterator llvm::LiveRangeEdit::iterator |
Iterator for accessing the new registers added by this edit.
Definition at line 146 of file LiveRangeEdit.h.
|
inline |
Create a LiveRangeEdit for breaking down parent into smaller pieces.
| parent | The register being spilled or split. |
| newRegs | List to receive any new registers created. This needn't be empty initially, any existing registers are ignored. |
| MF | The MachineFunction the live range edit is taking place in. |
| lis | The collection of all live intervals in this function. |
| 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. |
| deadRemats | The collection of all the instructions defining an original reg and are dead after remat. |
Definition at line 126 of file LiveRangeEdit.h.
References llvm::MachineRegisterInfo::setDelegate().
|
inlineoverride |
Definition at line 137 of file LiveRangeEdit.h.
References llvm::MachineRegisterInfo::resetDelegate().
| bool LiveRangeEdit::anyRematerializable | ( | AliasAnalysis * | aa | ) |
anyRematerializable - Return true if any parent values may be rematerializable.
This function must be called before any rematerialization is attempted.
Definition at line 86 of file LiveRangeEdit.cpp.
Referenced by llvm::SplitEditor::reset().
|
inline |
Definition at line 147 of file LiveRangeEdit.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin().
| void LiveRangeEdit::calculateRegClassAndHint | ( | MachineFunction & | MF, |
| const MachineLoopInfo & | Loops, | ||
| const MachineBlockFrequencyInfo & | MBFI | ||
| ) |
calculateRegClassAndHint - Recompute register class and hint for each new register.
Definition at line 452 of file LiveRangeEdit.cpp.
References llvm::VirtRegAuxInfo::calculateSpillWeightAndHint(), llvm::dbgs(), DEBUG, llvm::LiveIntervals::getInterval(), llvm::MachineRegisterInfo::getRegClass(), llvm::TargetRegisterInfo::getRegClassName(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), I, llvm::PrintReg(), llvm::MachineRegisterInfo::recomputeRegClass(), llvm::LiveInterval::reg, and size().
| bool LiveRangeEdit::canRematerializeAt | ( | Remat & | RM, |
| VNInfo * | OrigVNI, | ||
| SlotIndex | UseIdx, | ||
| bool | cheapAsAMove | ||
| ) |
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.
Definition at line 128 of file LiveRangeEdit.cpp.
References assert(), llvm::LiveIntervals::getInstructionIndex(), llvm::TargetInstrInfo::isAsCheapAsAMove(), and llvm::LiveRangeEdit::Remat::OrigMI.
| bool LiveRangeEdit::checkRematerializable | ( | VNInfo * | VNI, |
| const MachineInstr * | DefMI, | ||
| AliasAnalysis * | aa | ||
| ) |
checkRematerializable - Manually add VNI to the list of rematerializable values if DefMI may be rematerializable.
Definition at line 58 of file LiveRangeEdit.cpp.
References assert(), and llvm::TargetInstrInfo::isTriviallyReMaterializable().
|
inline |
Definition at line 179 of file LiveRangeEdit.h.
References createFrom(), and getReg().
|
inline |
create - Create a new register with the same class and original slot as parent.
Definition at line 175 of file LiveRangeEdit.h.
References createEmptyIntervalFrom(), and getReg().
Referenced by llvm::SplitEditor::openIntv().
| LiveInterval & LiveRangeEdit::createEmptyIntervalFrom | ( | unsigned | OldReg | ) |
createEmptyIntervalFrom - Create a new empty interval based on OldReg.
Definition at line 34 of file LiveRangeEdit.cpp.
References llvm::LiveIntervals::createEmptyInterval(), llvm::LiveInterval::createSubRange(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::LiveIntervals::getInterval(), llvm::VirtRegMap::getOriginal(), llvm::MachineRegisterInfo::getRegClass(), llvm::LiveIntervals::getVNInfoAllocator(), llvm::VirtRegMap::setIsSplitFromReg(), and llvm::LiveInterval::subranges().
Referenced by createEmptyInterval().
createFrom - Create a new virtual register based on OldReg.
Definition at line 50 of file LiveRangeEdit.cpp.
References llvm::MachineRegisterInfo::createVirtualRegister(), llvm::VirtRegMap::getOriginal(), llvm::MachineRegisterInfo::getRegClass(), and llvm::VirtRegMap::setIsSplitFromReg().
Referenced by create().
didRematerialize - Return true if ParentVNI was rematerialized anywhere.
Definition at line 225 of file LiveRangeEdit.h.
| void LiveRangeEdit::eliminateDeadDefs | ( | SmallVectorImpl< MachineInstr * > & | Dead, |
| ArrayRef< unsigned > | RegsBeingSpilled = None, |
||
| AliasAnalysis * | AA = nullptr |
||
| ) |
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.
Definition at line 379 of file LiveRangeEdit.cpp.
References llvm::SetVector< T, Vector, Set >::back(), llvm::SmallVectorBase::empty(), llvm::SetVector< T, Vector, Set >::empty(), llvm::VirtRegMap::getOriginal(), i, llvm::LiveRangeEdit::Delegate::LRE_DidCloneVirtReg(), llvm::LiveRangeEdit::Delegate::LRE_WillShrinkVirtReg(), llvm::SetVector< T, Vector, Set >::pop_back(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::LiveInterval::reg, llvm::LiveRange::RenumberValues(), llvm::VirtRegMap::setIsSplitFromReg(), llvm::LiveIntervals::shrinkToUses(), llvm::ArrayRef< T >::size(), and llvm::LiveIntervals::splitSeparateComponents().
|
inline |
Definition at line 150 of file LiveRangeEdit.h.
References size().
Referenced by llvm::SplitEditor::openIntv().
|
inline |
Definition at line 148 of file LiveRangeEdit.h.
References llvm::SmallVectorTemplateCommon< T, typename >::end().
| void LiveRangeEdit::eraseVirtReg | ( | unsigned | Reg | ) |
eraseVirtReg - Notify the delegate that Reg is no longer in use, and try to erase it from LIS.
Definition at line 168 of file LiveRangeEdit.cpp.
References llvm::LiveRangeEdit::Delegate::LRE_CanEraseVirtReg(), and llvm::LiveIntervals::removeInterval().
Definition at line 151 of file LiveRangeEdit.h.
|
inline |
Definition at line 139 of file LiveRangeEdit.h.
References assert().
Referenced by llvm::SplitEditor::enterIntvAfter(), llvm::SplitEditor::enterIntvAtEnd(), llvm::SplitEditor::enterIntvBefore(), getReg(), llvm::SplitEditor::leaveIntvAfter(), llvm::SplitEditor::leaveIntvAtTop(), llvm::SplitEditor::leaveIntvBefore(), and llvm::SplitEditor::overlapIntv().
|
inline |
Definition at line 143 of file LiveRangeEdit.h.
References getParent(), and llvm::LiveInterval::reg.
Referenced by create(), createEmptyInterval(), and llvm::SplitEditor::leaveIntvAfter().
|
inline |
Definition at line 229 of file LiveRangeEdit.h.
markRematerialized - explicitly mark a value as rematerialized after doing it manually.
Definition at line 220 of file LiveRangeEdit.h.
|
inline |
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.
Definition at line 161 of file LiveRangeEdit.h.
References llvm::SmallVectorTemplateBase< T, isPodLike >::pop_back().
Definition at line 163 of file LiveRangeEdit.h.
References llvm::makeArrayRef().
| SlotIndex LiveRangeEdit::rematerializeAt | ( | MachineBasicBlock & | MBB, |
| MachineBasicBlock::iterator | MI, | ||
| unsigned | DestReg, | ||
| const Remat & | RM, | ||
| const TargetRegisterInfo & | tri, | ||
| bool | Late = false |
||
| ) |
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.
Definition at line 152 of file LiveRangeEdit.cpp.
References assert(), llvm::SlotIndex::getRegSlot(), llvm::LiveIntervals::getSlotIndexes(), llvm::SlotIndexes::insertMachineInstrInMaps(), MI, llvm::LiveRangeEdit::Remat::OrigMI, llvm::LiveRangeEdit::Remat::ParentVNI, and llvm::TargetInstrInfo::reMaterialize().
|
inline |
Definition at line 149 of file LiveRangeEdit.h.
References llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by calculateRegClassAndHint(), empty(), and llvm::SplitEditor::openIntv().
1.8.6