LLVM API Documentation
#include <SlotIndexes.h>
Public Member Functions | |
SlotIndexes () | |
virtual void | getAnalysisUsage (AnalysisUsage &au) const |
virtual void | releaseMemory () |
virtual bool | runOnMachineFunction (MachineFunction &fn) |
void | dump () const |
Dump the indexes. More... | |
void | renumberIndexes () |
Renumber the index list, providing space for new instructions. More... | |
void | repairIndexesInRange (MachineBasicBlock *MBB, MachineBasicBlock::iterator Begin, MachineBasicBlock::iterator End) |
Repair indexes after adding and removing instructions. More... | |
SlotIndex | getZeroIndex () |
Returns the zero index for this analysis. More... | |
SlotIndex | getLastIndex () |
Returns the base index of the last slot in this analysis. More... | |
bool | hasIndex (const MachineInstr *instr) const |
SlotIndex | getInstructionIndex (const MachineInstr *MI) const |
Returns the base index for the given instruction. More... | |
MachineInstr * | getInstructionFromIndex (SlotIndex index) const |
SlotIndex | getNextNonNullIndex (SlotIndex Index) |
SlotIndex | getIndexBefore (const MachineInstr *MI) const |
SlotIndex | getIndexAfter (const MachineInstr *MI) const |
const std::pair< SlotIndex, SlotIndex > & | getMBBRange (unsigned Num) const |
Return the (start,end) range of the given basic block number. More... | |
const std::pair< SlotIndex, SlotIndex > & | getMBBRange (const MachineBasicBlock *MBB) const |
Return the (start,end) range of the given basic block. More... | |
SlotIndex | getMBBStartIdx (unsigned Num) const |
Returns the first index in the given basic block number. More... | |
SlotIndex | getMBBStartIdx (const MachineBasicBlock *mbb) const |
Returns the first index in the given basic block. More... | |
SlotIndex | getMBBEndIdx (unsigned Num) const |
Returns the last index in the given basic block number. More... | |
SlotIndex | getMBBEndIdx (const MachineBasicBlock *mbb) const |
Returns the last index in the given basic block. More... | |
MachineBasicBlock * | getMBBFromIndex (SlotIndex index) const |
Returns the basic block which the given index falls in. More... | |
bool | findLiveInMBBs (SlotIndex start, SlotIndex end, SmallVectorImpl< MachineBasicBlock * > &mbbs) const |
MachineBasicBlock * | getMBBCoveringRange (SlotIndex start, SlotIndex end) const |
SlotIndex | insertMachineInstrInMaps (MachineInstr *mi, bool Late=false) |
void | removeMachineInstrFromMaps (MachineInstr *mi) |
Remove the given machine instruction from the mapping. More... | |
void | replaceMachineInstrInMaps (MachineInstr *mi, MachineInstr *newMI) |
void | insertMBBInMaps (MachineBasicBlock *mbb) |
Add the given MachineBasicBlock into the maps. More... | |
void | eraseIndex (SlotIndex index) |
Free the resources that were required to maintain a SlotIndex. More... | |
![]() | |
FunctionPass (char &pid) | |
Pass * | createPrinterPass (raw_ostream &O, const std::string &Banner) const |
createPrinterPass - Get a function printer pass. More... | |
virtual void | assignPassManager (PMStack &PMS, PassManagerType T) |
virtual PassManagerType | getPotentialPassManagerType () const |
Return what kind of Pass Manager can manage this pass. More... | |
![]() | |
Pass (PassKind K, char &pid) | |
virtual | ~Pass () |
PassKind | getPassKind () const |
virtual const char * | getPassName () const |
AnalysisID | getPassID () const |
getPassID - Return the PassID number that corresponds to this pass. More... | |
virtual bool | doInitialization (Module &) |
virtual bool | doFinalization (Module &) |
virtual void | print (raw_ostream &O, const Module *M) const |
void | dump () const |
virtual void | preparePassManager (PMStack &) |
Check if available pass managers are suitable for this pass or not. More... | |
void | setResolver (AnalysisResolver *AR) |
AnalysisResolver * | getResolver () const |
virtual void * | getAdjustedAnalysisPointer (AnalysisID ID) |
virtual ImmutablePass * | getAsImmutablePass () |
virtual PMDataManager * | getAsPMDataManager () |
virtual void | verifyAnalysis () const |
virtual void | dumpPassStructure (unsigned Offset=0) |
template<typename AnalysisType > | |
AnalysisType * | getAnalysisIfAvailable () const |
bool | mustPreserveAnalysisID (char &AID) const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysis () const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysis (Function &F) |
template<typename AnalysisType > | |
AnalysisType & | getAnalysisID (AnalysisID PI) const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysisID (AnalysisID PI, Function &F) |
Static Public Attributes | |
static char | ID = 0 |
Additional Inherited Members | |
![]() | |
static const PassInfo * | lookupPassInfo (const void *TI) |
static const PassInfo * | lookupPassInfo (StringRef Arg) |
static Pass * | createPass (AnalysisID ID) |
![]() | |
MachineFunctionPass (char &ID) | |
SlotIndexes pass.
This pass assigns indexes to each instruction.
Definition at line 334 of file SlotIndexes.h.
|
inline |
Definition at line 376 of file SlotIndexes.h.
References llvm::PassRegistry::getPassRegistry(), and llvm::initializeSlotIndexesPass().
void SlotIndexes::dump | ( | ) | const |
Dump the indexes.
Definition at line 217 of file SlotIndexes.cpp.
References llvm::iplist< NodeTy, Traits >::begin(), llvm::dbgs(), and llvm::iplist< NodeTy, Traits >::end().
|
inline |
Free the resources that were required to maintain a SlotIndex.
Once an index is no longer needed (for instance because the instruction at that index has been moved), the resources required to maintain the index can be relinquished to reduce memory use and improve renumbering performance. Any remaining SlotIndex objects that point to the same index are left 'dangling' (much the same as a dangling pointer to a freed object) and should not be accessed, except to destruct them.
Like dangling pointers, access to dangling SlotIndexes can cause painful-to-track-down bugs, especially if the memory for the index previously pointed to has been re-used. To detect dangling SlotIndex bugs, build with EXPENSIVE_CHECKS=1. This will cause "erased" indexes to be retained in a graveyard instead of being freed. Operations on indexes in the graveyard will trigger an assertion.
Definition at line 689 of file SlotIndexes.h.
References llvm::iplist< NodeTy, Traits >::erase(), and llvm::iplist< NodeTy, Traits >::remove().
|
inline |
Definition at line 522 of file SlotIndexes.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by llvm::LiveIntervals::findLiveInMBBs().
|
virtual |
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
For MachineFunctionPasses, calling AU.preservesCFG() indicates that the pass does not modify the MachineBasicBlock CFG.
Reimplemented from llvm::MachineFunctionPass.
Definition at line 28 of file SlotIndexes.cpp.
References llvm::MachineFunctionPass::getAnalysisUsage().
|
inline |
getIndexAfter - Returns the index of the first indexed instruction after MI, or the end index of its basic block. MI is not required to have an index.
Definition at line 459 of file SlotIndexes.h.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), llvm::MachineBasicBlock::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find(), getMBBEndIdx(), llvm::MachineInstr::getParent(), I, and llvm::A64CC::MI.
Referenced by insertMachineInstrInMaps().
|
inline |
getIndexBefore - Returns the index of the last indexed instruction before MI, or the start index of its basic block. MI is not required to have an index.
Definition at line 442 of file SlotIndexes.h.
References llvm::MachineBasicBlock::begin(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find(), getMBBStartIdx(), llvm::MachineInstr::getParent(), I, and llvm::A64CC::MI.
Referenced by insertMachineInstrInMaps().
|
inline |
Returns the instruction for the given index, or null if the given index has no instruction associated with it.
Definition at line 423 of file SlotIndexes.h.
References llvm::IndexListEntry::getInstr(), and llvm::SlotIndex::isValid().
Referenced by llvm::LiveIntervals::getInstructionFromIndex(), getMBBFromIndex(), and llvm::LiveRange::overlaps().
|
inline |
Returns the base index for the given instruction.
Definition at line 414 of file SlotIndexes.h.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find(), and llvm::getBundleStart().
Referenced by llvm::LiveRangeCalc::createDeadDefs(), llvm::LiveRangeCalc::extendToUses(), llvm::LiveIntervals::getInstructionIndex(), llvm::LiveIntervals::handleMove(), llvm::LiveIntervals::handleMoveIntoBundle(), llvm::MachineBasicBlock::print(), and repairIndexesInRange().
|
inline |
Returns the base index of the last slot in this analysis.
Definition at line 403 of file SlotIndexes.h.
References llvm::iplist< NodeTy, Traits >::back().
Referenced by getNextNonNullIndex().
|
inline |
Returns the MBB covering the given range, or null if the range covers more than one basic block.
Definition at line 540 of file SlotIndexes.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), and llvm::prior().
Returns the last index in the given basic block number.
Definition at line 496 of file SlotIndexes.h.
References getMBBRange().
Referenced by llvm::LiveRangeCalc::extendToUses(), getIndexAfter(), llvm::LiveIntervals::getMBBEndIdx(), getMBBFromIndex(), llvm::LiveIntervals::hasPHIKill(), and repairIndexesInRange().
|
inline |
Returns the last index in the given basic block.
Definition at line 501 of file SlotIndexes.h.
References getMBBRange().
|
inline |
Returns the basic block which the given index falls in.
Definition at line 506 of file SlotIndexes.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), getInstructionFromIndex(), getMBBEndIdx(), I, llvm::A64CC::MI, and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by llvm::LiveRangeCalc::extend(), llvm::LiveIntervals::getMBBFromIndex(), llvm::LiveIntervals::intervalIsInOneMBB(), and llvm::LiveIntervals::pruneValue().
Return the (start,end) range of the given basic block number.
Definition at line 475 of file SlotIndexes.h.
Referenced by getMBBEndIdx(), getMBBRange(), getMBBStartIdx(), llvm::LiveIntervals::pruneValue(), llvm::SplitEditor::splitLiveThroughBlock(), llvm::SplitEditor::splitRegInBlock(), and llvm::SplitEditor::splitRegOutBlock().
|
inline |
Return the (start,end) range of the given basic block.
Definition at line 481 of file SlotIndexes.h.
References getMBBRange(), and llvm::MachineBasicBlock::getNumber().
Returns the first index in the given basic block number.
Definition at line 486 of file SlotIndexes.h.
References getMBBRange().
Referenced by llvm::LiveRangeCalc::createDeadDefs(), llvm::LiveRangeCalc::extend(), getIndexBefore(), llvm::LiveIntervals::getMBBStartIdx(), insertMBBInMaps(), llvm::MachineBasicBlock::print(), and repairIndexesInRange().
|
inline |
Returns the first index in the given basic block.
Definition at line 491 of file SlotIndexes.h.
References getMBBRange().
Returns the next non-null index, if one exists. Otherwise returns getLastIndex().
Definition at line 429 of file SlotIndexes.h.
References llvm::iplist< NodeTy, Traits >::end(), getLastIndex(), and I.
Referenced by llvm::LiveRange::isZeroLength().
|
inline |
Returns the zero index for this analysis.
Definition at line 397 of file SlotIndexes.h.
References llvm::iplist< NodeTy, Traits >::front(), and llvm::IndexListEntry::getIndex().
|
inline |
Returns true if the given machine instr is mapped to an index, otherwise returns false.
Definition at line 409 of file SlotIndexes.h.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::count().
Referenced by llvm::LiveIntervals::isNotInMIMap(), llvm::MachineBasicBlock::print(), repairIndexesInRange(), and llvm::LiveIntervals::repairIntervalsInRange().
|
inline |
Insert the given machine instruction into the mapping. Returns the assigned index. If Late is set and there are null indexes between mi's neighboring instructions, create the new index after the null indexes instead of before them.
Definition at line 569 of file SlotIndexes.h.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find(), getIndexAfter(), getIndexBefore(), llvm::MachineInstr::getParent(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::insert(), llvm::ilist< NodeTy >::insert(), llvm::MachineInstr::isDebugValue(), llvm::MachineInstr::isInsideBundle(), llvm::next(), llvm::prior(), and renumberIndexes().
Referenced by llvm::LiveIntervals::handleMove(), llvm::LiveIntervals::InsertMachineInstrInMaps(), llvm::LiveIntervals::InsertMachineInstrRangeInMaps(), llvm::LiveRangeEdit::rematerializeAt(), and repairIndexesInRange().
|
inline |
Add the given MachineBasicBlock into the maps.
Definition at line 639 of file SlotIndexes.h.
References llvm::iplist< NodeTy, Traits >::back(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::MachineFunction::end(), getMBBStartIdx(), llvm::MachineBasicBlock::getNumber(), llvm::MachineBasicBlock::getParent(), llvm::ilist< NodeTy >::insert(), llvm::iplist< NodeTy, Traits >::insertAfter(), llvm::next(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and renumberIndexes().
Referenced by llvm::LiveIntervals::insertMBBInMaps(), and llvm::MachineBasicBlock::SplitCriticalEdge().
|
virtual |
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.
Reimplemented from llvm::Pass.
Definition at line 33 of file SlotIndexes.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::clear(), llvm::SmallVectorImpl< T >::clear(), llvm::iplist< NodeTy, Traits >::clear(), and llvm::BumpPtrAllocator::Reset().
|
inline |
Remove the given machine instruction from the mapping.
Definition at line 610 of file SlotIndexes.h.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::erase(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find(), and llvm::IndexListEntry::setInstr().
Referenced by llvm::LiveIntervals::handleMove(), llvm::LiveIntervals::RemoveMachineInstrFromMaps(), and repairIndexesInRange().
void SlotIndexes::renumberIndexes | ( | ) |
Renumber the index list, providing space for new instructions.
Definition at line 111 of file SlotIndexes.cpp.
References llvm::iplist< NodeTy, Traits >::begin(), llvm::dbgs(), DEBUG, llvm::iplist< NodeTy, Traits >::end(), I, and llvm::SlotIndex::InstrDist.
Referenced by insertMachineInstrInMaps(), and insertMBBInMaps().
void SlotIndexes::repairIndexesInRange | ( | MachineBasicBlock * | MBB, |
MachineBasicBlock::iterator | Begin, | ||
MachineBasicBlock::iterator | End | ||
) |
Repair indexes after adding and removing instructions.
Definition at line 146 of file SlotIndexes.cpp.
References llvm::MachineBasicBlock::begin(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), llvm::MachineBasicBlock::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find(), getInstructionIndex(), getMBBEndIdx(), getMBBStartIdx(), hasIndex(), I, insertMachineInstrInMaps(), llvm::MachineInstr::isDebugValue(), llvm::A64CC::MI, and removeMachineInstrFromMaps().
Referenced by llvm::LiveIntervals::repairIntervalsInRange().
|
inline |
ReplaceMachineInstrInMaps - Replacing a machine instr with a new one in maps used by register allocator.
Definition at line 625 of file SlotIndexes.h.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::erase(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::insert(), and llvm::IndexListEntry::setInstr().
Referenced by llvm::LiveIntervals::ReplaceMachineInstrInMaps().
|
virtual |
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.
Implements llvm::MachineFunctionPass.
Definition at line 41 of file SlotIndexes.cpp.
References llvm::iplist< NodeTy, Traits >::back(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::MachineBasicBlock::begin(), llvm::MachineFunction::begin(), llvm::dbgs(), DEBUG, llvm::SmallVectorBase::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::empty(), llvm::iplist< NodeTy, Traits >::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::MachineBasicBlock::end(), llvm::MachineFunction::end(), llvm::MachineBasicBlock::getNumber(), llvm::MachineFunction::getNumBlockIDs(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::insert(), llvm::SlotIndex::InstrDist, llvm::MachineInstr::isDebugValue(), llvm::MachineFunction::print(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::ilist< NodeTy >::push_back(), llvm::SmallVectorImpl< T >::reserve(), and llvm::MachineFunction::size().
|
static |
Definition at line 374 of file SlotIndexes.h.