LLVM 22.0.0git
|
SlotIndex - An opaque wrapper around machine indexes. More...
#include "llvm/CodeGen/SlotIndexes.h"
Public Types | |
enum | { InstrDist = 4 * Slot_Count } |
Public Member Functions | |
SlotIndex ()=default | |
Construct an invalid index. | |
SlotIndex (IndexListEntry *entry, unsigned slot) | |
SlotIndex (const SlotIndex &li, Slot s) | |
bool | isValid () const |
Returns true if this is a valid index. | |
operator bool () const | |
Return true for a valid index. | |
LLVM_ABI void | print (raw_ostream &os) const |
Print this index to the given raw_ostream. | |
LLVM_ABI void | dump () const |
Dump this index to stderr. | |
bool | operator== (SlotIndex other) const |
Compare two SlotIndex objects for equality. | |
bool | operator!= (SlotIndex other) const |
Compare two SlotIndex objects for inequality. | |
bool | operator< (SlotIndex other) const |
Compare two SlotIndex objects. | |
bool | operator<= (SlotIndex other) const |
Compare two SlotIndex objects. | |
bool | operator> (SlotIndex other) const |
Compare two SlotIndex objects. | |
bool | operator>= (SlotIndex other) const |
Compare two SlotIndex objects. | |
int | distance (SlotIndex other) const |
Return the distance from this index to the given one. | |
int | getApproxInstrDistance (SlotIndex other) const |
Return the scaled distance from this index to the given one, where all slots on the same instruction have zero distance, assuming that the slot indices are packed as densely as possible. | |
bool | isBlock () const |
isBlock - Returns true if this is a block boundary slot. | |
bool | isEarlyClobber () const |
isEarlyClobber - Returns true if this is an early-clobber slot. | |
bool | isRegister () const |
isRegister - Returns true if this is a normal register use/def slot. | |
bool | isDead () const |
isDead - Returns true if this is a dead def kill slot. | |
SlotIndex | getBaseIndex () const |
Returns the base index for associated with this index. | |
SlotIndex | getBoundaryIndex () const |
Returns the boundary index for associated with this index. | |
SlotIndex | getRegSlot (bool EC=false) const |
Returns the register use/def slot in the current instruction for a normal or early-clobber def. | |
SlotIndex | getDeadSlot () const |
Returns the dead def kill slot for the current instruction. | |
SlotIndex | getNextSlot () const |
Returns the next slot in the index list. | |
SlotIndex | getNextIndex () const |
Returns the next index. | |
SlotIndex | getPrevSlot () const |
Returns the previous slot in the index list. | |
SlotIndex | getPrevIndex () const |
Returns the previous index. |
Static Public Member Functions | |
static bool | isSameInstr (SlotIndex A, SlotIndex B) |
isSameInstr - Return true if A and B refer to the same instruction. | |
static bool | isEarlierInstr (SlotIndex A, SlotIndex B) |
isEarlierInstr - Return true if A refers to an instruction earlier than B. | |
static bool | isEarlierEqualInstr (SlotIndex A, SlotIndex B) |
Return true if A refers to the same instruction as B or an earlier one. |
Friends | |
class | SlotIndexes |
SlotIndex - An opaque wrapper around machine indexes.
Definition at line 66 of file SlotIndexes.h.
anonymous enum |
Enumerator | |
---|---|
InstrDist | The default distance between instructions as returned by distance(). This may vary as instructions are inserted and removed. |
Definition at line 110 of file SlotIndexes.h.
|
default |
Construct an invalid index.
Referenced by distance(), getApproxInstrDistance(), getBaseIndex(), getBoundaryIndex(), getDeadSlot(), getNextIndex(), getNextSlot(), getPrevIndex(), getPrevSlot(), getRegSlot(), isEarlierEqualInstr(), isEarlierInstr(), isSameInstr(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), and SlotIndex().
|
inline |
Definition at line 122 of file SlotIndexes.h.
Definition at line 125 of file SlotIndexes.h.
References assert(), isValid(), and SlotIndex().
|
inline |
Return the distance from this index to the given one.
Definition at line 194 of file SlotIndexes.h.
References SlotIndex().
LLVM_DUMP_METHOD void SlotIndex::dump | ( | ) | const |
Dump this index to stderr.
Definition at line 295 of file SlotIndexes.cpp.
References llvm::dbgs(), LLVM_DUMP_METHOD, and print().
|
inline |
Return the scaled distance from this index to the given one, where all slots on the same instruction have zero distance, assuming that the slot indices are packed as densely as possible.
There are normally gaps between instructions, so this assumption often doesn't hold. This results in this function often returning a value greater than the actual instruction distance.
Definition at line 204 of file SlotIndexes.h.
References llvm::IndexListEntry::getIndex(), and SlotIndex().
|
inline |
Returns the base index for associated with this index.
The base index is the one associated with the Slot_Block slot for the instruction pointed to by this index.
Definition at line 225 of file SlotIndexes.h.
References SlotIndex().
Referenced by llvm::RegisterOperands::adjustLaneLiveness(), llvm::X86InstrInfo::classifyLEAReg(), llvm::SplitEditor::enterIntvBefore(), findInsertLocation(), llvm::GCNRPTracker::getLastUsedLanes(), llvm::RegPressureTracker::getLastUsedLanes(), llvm::getLiveRegsBefore(), llvm::LiveRange::isZeroLength(), llvm::SplitEditor::leaveIntvBefore(), llvm::LiveRange::Query(), llvm::LiveIntervals::removeVRegDefAt(), llvm::SplitEditor::splitLiveThroughBlock(), and llvm::SplitEditor::splitRegOutBlock().
|
inline |
Returns the boundary index for associated with this index.
The boundary index is the one associated with the Slot_Block slot for the instruction pointed to by this index.
Definition at line 232 of file SlotIndexes.h.
References SlotIndex().
Referenced by llvm::SplitEditor::enterIntvAfter(), llvm::LiveRange::isLocal(), llvm::SplitEditor::leaveIntvAfter(), llvm::SplitEditor::splitLiveThroughBlock(), and llvm::SplitEditor::splitRegInBlock().
|
inline |
Returns the dead def kill slot for the current instruction.
Definition at line 243 of file SlotIndexes.h.
References SlotIndex().
Referenced by llvm::RegisterOperands::adjustLaneLiveness(), llvm::getLiveRegsAfter(), llvm::RegPressureTracker::getLiveThroughAt(), rematerializeCheapDef(), replaceDominatedUses(), and llvm::LiveIntervals::shrinkToUses().
|
inline |
Returns the next index.
This is the index corresponding to the this index's slot, but for the next instruction.
Definition at line 263 of file SlotIndexes.h.
References SlotIndex().
Referenced by llvm::extractInstructionFeatures().
|
inline |
Returns the next slot in the index list.
This could be either the next slot for the instruction pointed to by this index or, if this index is a STORE, the first slot for the next instruction. WARNING: This method is considerably more expensive than the methods that return specific slots (getUseIndex(), etc). If you can - please use one of those methods.
Definition at line 253 of file SlotIndexes.h.
References SlotIndex().
Referenced by llvm::SplitEditor::leaveIntvAfter(), and llvm::SplitEditor::leaveIntvBefore().
|
inline |
Returns the previous index.
This is the index corresponding to this index's slot, but for the previous instruction.
Definition at line 283 of file SlotIndexes.h.
References SlotIndex().
Referenced by findInsertLocation().
|
inline |
Returns the previous slot in the index list.
This could be either the previous slot for the instruction pointed to by this index or, if this index is a Slot_Block, the last slot for the previous instruction. WARNING: This method is considerably more expensive than the methods that return specific slots (getUseIndex(), etc). If you can - please use one of those methods.
Definition at line 273 of file SlotIndexes.h.
References SlotIndex().
Referenced by llvm::SplitEditor::enterIntvAtEnd(), llvm::LiveRange::getVNInfoBefore(), llvm::LiveIntervals::repairIntervalsInRange(), and llvm::MachineBasicBlock::SplitCriticalEdge().
Returns the register use/def slot in the current instruction for a normal or early-clobber def.
Definition at line 238 of file SlotIndexes.h.
References SlotIndex().
Referenced by llvm::LiveRangeEdit::allUsesAvailableAt(), llvm::RegPressureTracker::bumpDownwardPressure(), llvm::RegPressureTracker::bumpUpwardPressure(), llvm::X86InstrInfo::classifyLEAReg(), llvm::LiveInterval::computeSubRangeUndefs(), llvm::RISCVInstrInfo::convertToThreeAddress(), llvm::SIInstrInfo::convertToThreeAddress(), createDeadDef(), dumpMachineInstrRangeWithSlotIndex(), findUseBetween(), findUseBetween(), llvm::SystemZInstrInfo::foldMemoryOperandImpl(), llvm::RegPressureTracker::getLiveThroughAt(), hasSingleUse(), isDefBetween(), isDefBetween(), moveAndTeeForMultiUse(), moveForSingleUse(), llvm::RegPressureTracker::recede(), llvm::RegPressureTracker::recede(), llvm::RegPressureTracker::recedeSkipDebugValues(), rematerializeCheapDef(), replaceDominatedUses(), llvm::LiveIntervals::shrinkToUses(), and llvm::LiveIntervals::shrinkToUses().
|
inline |
isBlock - Returns true if this is a block boundary slot.
Definition at line 210 of file SlotIndexes.h.
Referenced by llvm::LiveIntervals::intervalIsInOneMBB().
|
inline |
isDead - Returns true if this is a dead def kill slot.
Definition at line 220 of file SlotIndexes.h.
Referenced by addSegmentsWithValNo().
Return true if A refers to the same instruction as B or an earlier one.
This is equivalent to !isEarlierInstr(B, A).
Definition at line 189 of file SlotIndexes.h.
References A(), B(), isEarlierInstr(), and SlotIndex().
Referenced by findNextInsertLocation().
isEarlierInstr - Return true if A refers to an instruction earlier than B.
This is equivalent to A < B && !isSameInstr(A, B).
Definition at line 183 of file SlotIndexes.h.
References A(), B(), and SlotIndex().
Referenced by isEarlierEqualInstr(), and llvm::LiveRange::Query().
|
inline |
isEarlyClobber - Returns true if this is an early-clobber slot.
Definition at line 213 of file SlotIndexes.h.
|
inline |
isRegister - Returns true if this is a normal register use/def slot.
Note that early-clobber slots may also be used for uses and defs.
Definition at line 217 of file SlotIndexes.h.
isSameInstr - Return true if A and B refer to the same instruction.
Definition at line 177 of file SlotIndexes.h.
References A(), B(), and SlotIndex().
Referenced by llvm::LiveRangeEdit::allUsesAvailableAt(), llvm::SplitAnalysis::BlockInfo::isOneInstr(), llvm::SplitEditor::leaveIntvAfter(), and llvm::LiveRange::Query().
|
inline |
Returns true if this is a valid index.
Invalid indices do not point into an index table, and cannot be compared.
Definition at line 131 of file SlotIndexes.h.
Referenced by llvm::SIRegisterInfo::findReachingDef(), operator bool(), print(), and SlotIndex().
|
inlineexplicit |
Compare two SlotIndex objects for inequality.
Definition at line 149 of file SlotIndexes.h.
References SlotIndex().
Compare two SlotIndex objects.
Return true if the first index is strictly lower than the second.
Definition at line 155 of file SlotIndexes.h.
References SlotIndex().
Compare two SlotIndex objects.
Return true if the first index is lower than, or equal to, the second.
Definition at line 160 of file SlotIndexes.h.
References SlotIndex().
Compare two SlotIndex objects for equality.
Definition at line 145 of file SlotIndexes.h.
References SlotIndex().
Compare two SlotIndex objects.
Return true if the first index is greater than the second.
Definition at line 166 of file SlotIndexes.h.
References SlotIndex().
Compare two SlotIndex objects.
Return true if the first index is greater than, or equal to, the second.
Definition at line 172 of file SlotIndexes.h.
References SlotIndex().
void SlotIndex::print | ( | raw_ostream & | os | ) | const |
Print this index to the given raw_ostream.
Definition at line 286 of file SlotIndexes.cpp.
References isValid().
Referenced by dump(), and llvm::operator<<().
|
friend |