LLVM API Documentation
#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 < LiveInterval * > ::const_iterator | iterator |
| Iterator for accessing the new registers added by this edit. | |
Public Member Functions | |
| LiveRangeEdit (LiveInterval *parent, SmallVectorImpl< LiveInterval * > &newRegs, MachineFunction &MF, LiveIntervals &lis, VirtRegMap *vrm, Delegate *delegate=0) | |
| LiveInterval & | getParent () const |
| unsigned | getReg () const |
| iterator | begin () const |
| iterator | end () const |
| unsigned | size () const |
| bool | empty () const |
| LiveInterval * | get (unsigned idx) const |
| ArrayRef< LiveInterval * > | regs () const |
| LiveInterval & | createFrom (unsigned OldReg) |
| createFrom - Create a new virtual register based on OldReg. | |
| LiveInterval & | create () |
| bool | anyRematerializable (AliasAnalysis *) |
| bool | checkRematerializable (VNInfo *VNI, const MachineInstr *DefMI, AliasAnalysis *) |
| bool | canRematerializeAt (Remat &RM, SlotIndex UseIdx, bool cheapAsAMove) |
| SlotIndex | rematerializeAt (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, const Remat &RM, const TargetRegisterInfo &, bool Late=false) |
| void | markRematerialized (const VNInfo *ParentVNI) |
| bool | didRematerialize (const VNInfo *ParentVNI) const |
| didRematerialize - Return true if ParentVNI was rematerialized anywhere. | |
| void | eraseVirtReg (unsigned Reg) |
| void | eliminateDeadDefs (SmallVectorImpl< MachineInstr * > &Dead, ArrayRef< unsigned > RegsBeingSpilled=None) |
| void | calculateRegClassAndHint (MachineFunction &, const MachineLoopInfo &) |
Definition at line 34 of file LiveRangeEdit.h.
| typedef SmallVectorImpl<LiveInterval*>::const_iterator llvm::LiveRangeEdit::iterator |
Iterator for accessing the new registers added by this edit.
Definition at line 122 of file LiveRangeEdit.h.
| llvm::LiveRangeEdit::LiveRangeEdit | ( | LiveInterval * | parent, |
| SmallVectorImpl< LiveInterval * > & | newRegs, | ||
| MachineFunction & | MF, | ||
| LiveIntervals & | lis, | ||
| VirtRegMap * | vrm, | ||
| Delegate * | delegate = 0 |
||
| ) | [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. |
Definition at line 102 of file LiveRangeEdit.h.
| 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 70 of file LiveRangeEdit.cpp.
References llvm::SmallPtrSetImpl::empty().
Referenced by llvm::SplitEditor::reset().
| iterator llvm::LiveRangeEdit::begin | ( | ) | const [inline] |
Definition at line 123 of file LiveRangeEdit.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin().
Referenced by calculateRegClassAndHint(), and llvm::SplitEditor::finish().
| void LiveRangeEdit::calculateRegClassAndHint | ( | MachineFunction & | MF, |
| const MachineLoopInfo & | Loops | ||
| ) |
calculateRegClassAndHint - Recompute register class and hint for each new register.
Definition at line 377 of file LiveRangeEdit.cpp.
References begin(), llvm::VirtRegAuxInfo::CalculateWeightAndHint(), llvm::dbgs(), DEBUG, end(), llvm::TargetRegisterClass::getName(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getTarget(), llvm::ARM_PROC::I, llvm::MachineRegisterInfo::recomputeRegClass(), and llvm::LiveInterval::reg.
Referenced by llvm::SplitEditor::finish().
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 112 of file LiveRangeEdit.cpp.
References llvm::SmallPtrSet< PtrType, SmallSize >::count(), llvm::VNInfo::def, llvm::LiveIntervals::getInstructionFromIndex(), llvm::LiveIntervals::getInstructionIndex(), llvm::MachineInstr::isAsCheapAsAMove(), llvm::LiveRangeEdit::Remat::OrigMI, and llvm::LiveRangeEdit::Remat::ParentVNI.
| 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 45 of file LiveRangeEdit.cpp.
References llvm::SmallPtrSet< PtrType, SmallSize >::insert(), and llvm::TargetInstrInfo::isTriviallyReMaterializable().
| LiveInterval& llvm::LiveRangeEdit::create | ( | ) | [inline] |
create - Create a new register with the same class and original slot as parent.
Definition at line 138 of file LiveRangeEdit.h.
References createFrom(), and getReg().
Referenced by llvm::SplitEditor::finish(), and llvm::SplitEditor::openIntv().
| LiveInterval & LiveRangeEdit::createFrom | ( | unsigned | OldReg | ) |
createFrom - Create a new virtual register based on OldReg.
Definition at line 34 of file LiveRangeEdit.cpp.
References llvm::MachineRegisterInfo::createVirtualRegister(), llvm::LiveIntervals::getOrCreateInterval(), llvm::VirtRegMap::getOriginal(), llvm::MachineRegisterInfo::getRegClass(), llvm::VirtRegMap::grow(), LI, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and llvm::VirtRegMap::setIsSplitFromReg().
Referenced by create(), and eliminateDeadDefs().
didRematerialize - Return true if ParentVNI was rematerialized anywhere.
Definition at line 184 of file LiveRangeEdit.h.
References llvm::SmallPtrSet< PtrType, SmallSize >::count().
Referenced by llvm::SplitEditor::finish().
| void LiveRangeEdit::eliminateDeadDefs | ( | SmallVectorImpl< MachineInstr * > & | Dead, |
| ArrayRef< unsigned > | RegsBeingSpilled = None |
||
| ) |
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 219 of file LiveRangeEdit.cpp.
References llvm::MachineInstr::allDefsAreDead(), llvm::SmallVectorTemplateCommon< T >::back(), llvm::ConnectedVNInfoEqClasses::Classify(), createFrom(), llvm::dbgs(), DEBUG, llvm::ConnectedVNInfoEqClasses::Distribute(), llvm::SmallVectorBase::empty(), llvm::LiveInterval::empty(), llvm::MachineInstr::eraseFromParent(), eraseVirtReg(), llvm::MCInstrInfo::get(), llvm::LiveIntervals::getInstructionIndex(), llvm::LiveIntervals::getInterval(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::VirtRegMap::getOriginal(), llvm::MachineOperand::getReg(), llvm::SlotIndex::getRegSlot(), llvm::LiveInterval::getVNInfoAt(), llvm::LiveIntervals::hasInterval(), llvm::MachineRegisterInfo::hasOneNonDBGUse(), llvm::MachineInstr::isCopy(), llvm::MachineInstr::isInlineAsm(), llvm::TargetRegisterInfo::isPhysicalRegister(), llvm::MachineOperand::isReg(), llvm::MachineRegisterInfo::isReserved(), llvm::MachineInstr::isSafeToMove(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::TargetOpcode::KILL, llvm::LiveInterval::killedAt(), llvm::LiveRangeEdit::Delegate::LRE_DidCloneVirtReg(), llvm::LiveRangeEdit::Delegate::LRE_WillEraseInstruction(), llvm::LiveRangeEdit::Delegate::LRE_WillShrinkVirtReg(), llvm::MachineInstr::operands_begin(), llvm::MachineInstr::operands_end(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::MachineInstr::readsVirtualRegister(), llvm::LiveInterval::reg, llvm::MachineRegisterInfo::reg_nodbg_empty(), llvm::LiveIntervals::RemoveMachineInstrFromMaps(), llvm::MachineInstr::RemoveOperand(), llvm::LiveInterval::removeValNo(), llvm::LiveInterval::RenumberValues(), llvm::MachineInstr::setDesc(), llvm::VirtRegMap::setIsSplitFromReg(), llvm::LiveIntervals::shrinkToUses(), llvm::ArrayRef< T >::size(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
| bool llvm::LiveRangeEdit::empty | ( | ) | const [inline] |
Definition at line 126 of file LiveRangeEdit.h.
References size().
Referenced by llvm::SplitEditor::openIntv().
| iterator llvm::LiveRangeEdit::end | ( | ) | const [inline] |
Definition at line 124 of file LiveRangeEdit.h.
References llvm::SmallVectorTemplateCommon< T, typename >::end().
Referenced by calculateRegClassAndHint(), and llvm::SplitEditor::finish().
| 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 155 of file LiveRangeEdit.cpp.
References llvm::LiveRangeEdit::Delegate::LRE_CanEraseVirtReg(), and llvm::LiveIntervals::removeInterval().
Referenced by eliminateDeadDefs().
| LiveInterval* llvm::LiveRangeEdit::get | ( | unsigned | idx | ) | const [inline] |
Definition at line 127 of file LiveRangeEdit.h.
Referenced by llvm::SplitEditor::finish().
| LiveInterval& llvm::LiveRangeEdit::getParent | ( | ) | const [inline] |
Definition at line 115 of file LiveRangeEdit.h.
Referenced by llvm::SplitEditor::enterIntvAfter(), llvm::SplitEditor::enterIntvAtEnd(), llvm::SplitEditor::enterIntvBefore(), llvm::SplitEditor::finish(), getReg(), llvm::SplitEditor::leaveIntvAfter(), llvm::SplitEditor::leaveIntvAtTop(), llvm::SplitEditor::leaveIntvBefore(), and llvm::SplitEditor::overlapIntv().
| unsigned llvm::LiveRangeEdit::getReg | ( | ) | const [inline] |
Definition at line 119 of file LiveRangeEdit.h.
References getParent(), and llvm::LiveInterval::reg.
Referenced by create(), and llvm::SplitEditor::leaveIntvAfter().
| void llvm::LiveRangeEdit::markRematerialized | ( | const VNInfo * | ParentVNI | ) | [inline] |
markRematerialized - explicitly mark a value as rematerialized after doing it manually.
Definition at line 179 of file LiveRangeEdit.h.
References llvm::SmallPtrSet< PtrType, SmallSize >::insert().
| ArrayRef<LiveInterval*> llvm::LiveRangeEdit::regs | ( | ) | const [inline] |
Definition at line 129 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 142 of file LiveRangeEdit.cpp.
References llvm::SlotIndex::getRegSlot(), llvm::LiveIntervals::getSlotIndexes(), llvm::SmallPtrSet< PtrType, SmallSize >::insert(), llvm::SlotIndexes::insertMachineInstrInMaps(), llvm::LiveRangeEdit::Remat::OrigMI, llvm::LiveRangeEdit::Remat::ParentVNI, and llvm::TargetInstrInfo::reMaterialize().
| unsigned llvm::LiveRangeEdit::size | ( | ) | const [inline] |
Definition at line 125 of file LiveRangeEdit.h.
References llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by empty(), llvm::SplitEditor::finish(), and llvm::SplitEditor::openIntv().