LLVM  8.0.1
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::SlotIndex Class Reference

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. More...
 
 SlotIndex (const SlotIndex &li, Slot s)
 
bool isValid () const
 Returns true if this is a valid index. More...
 
 operator bool () const
 Return true for a valid index. More...
 
void print (raw_ostream &os) const
 Print this index to the given raw_ostream. More...
 
void dump () const
 Dump this index to stderr. More...
 
bool operator== (SlotIndex other) const
 Compare two SlotIndex objects for equality. More...
 
bool operator!= (SlotIndex other) const
 Compare two SlotIndex objects for inequality. More...
 
bool operator< (SlotIndex other) const
 Compare two SlotIndex objects. More...
 
bool operator<= (SlotIndex other) const
 Compare two SlotIndex objects. More...
 
bool operator> (SlotIndex other) const
 Compare two SlotIndex objects. More...
 
bool operator>= (SlotIndex other) const
 Compare two SlotIndex objects. More...
 
int distance (SlotIndex other) const
 Return the distance from this index to the given one. More...
 
int getInstrDistance (SlotIndex other) const
 Return the scaled distance from this index to the given one, where all slots on the same instruction have zero distance. More...
 
bool isBlock () const
 isBlock - Returns true if this is a block boundary slot. More...
 
bool isEarlyClobber () const
 isEarlyClobber - Returns true if this is an early-clobber slot. More...
 
bool isRegister () const
 isRegister - Returns true if this is a normal register use/def slot. More...
 
bool isDead () const
 isDead - Returns true if this is a dead def kill slot. More...
 
SlotIndex getBaseIndex () const
 Returns the base index for associated with this index. More...
 
SlotIndex getBoundaryIndex () const
 Returns the boundary index for associated with this index. More...
 
SlotIndex getRegSlot (bool EC=false) const
 Returns the register use/def slot in the current instruction for a normal or early-clobber def. More...
 
SlotIndex getDeadSlot () const
 Returns the dead def kill slot for the current instruction. More...
 
SlotIndex getNextSlot () const
 Returns the next slot in the index list. More...
 
SlotIndex getNextIndex () const
 Returns the next index. More...
 
SlotIndex getPrevSlot () const
 Returns the previous slot in the index list. More...
 
SlotIndex getPrevIndex () const
 Returns the previous index. More...
 

Static Public Member Functions

static bool isSameInstr (SlotIndex A, SlotIndex B)
 isSameInstr - Return true if A and B refer to the same instruction. More...
 
static bool isEarlierInstr (SlotIndex A, SlotIndex B)
 isEarlierInstr - Return true if A refers to an instruction earlier than B. More...
 
static bool isEarlierEqualInstr (SlotIndex A, SlotIndex B)
 Return true if A refers to the same instruction as B or an earlier one. More...
 

Friends

class SlotIndexes
 

Detailed Description

SlotIndex - An opaque wrapper around machine indexes.

Definition at line 84 of file SlotIndexes.h.

Member Enumeration Documentation

◆ anonymous enum

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 135 of file SlotIndexes.h.

Constructor & Destructor Documentation

◆ SlotIndex() [1/2]

llvm::SlotIndex::SlotIndex ( )
default

Construct an invalid index.

◆ SlotIndex() [2/2]

llvm::SlotIndex::SlotIndex ( const SlotIndex li,
Slot  s 
)
inline

Member Function Documentation

◆ distance()

int llvm::SlotIndex::distance ( SlotIndex  other) const
inline

Return the distance from this index to the given one.

Definition at line 215 of file SlotIndexes.h.

References llvm::IndexListEntry::getIndex().

Referenced by llvm::VirtRegAuxInfo::weightCalcHelper().

◆ dump()

LLVM_DUMP_METHOD void SlotIndex::dump ( ) const

Dump this index to stderr.

Definition at line 282 of file SlotIndexes.cpp.

References llvm::dbgs(), and llvm::Pass::print().

◆ getBaseIndex()

SlotIndex llvm::SlotIndex::getBaseIndex ( ) const
inline

◆ getBoundaryIndex()

SlotIndex llvm::SlotIndex::getBoundaryIndex ( ) const
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 249 of file SlotIndexes.h.

Referenced by llvm::SplitEditor::enterIntvAfter(), getNumAllocatableRegsForConstraints(), llvm::LiveRange::isLocal(), and llvm::SplitEditor::leaveIntvAfter().

◆ getDeadSlot()

SlotIndex llvm::SlotIndex::getDeadSlot ( ) const
inline

◆ getInstrDistance()

int llvm::SlotIndex::getInstrDistance ( SlotIndex  other) const
inline

Return the scaled distance from this index to the given one, where all slots on the same instruction have zero distance.

Definition at line 221 of file SlotIndexes.h.

References llvm::IndexListEntry::getIndex().

Referenced by llvm::createGreedyRegisterAllocator().

◆ getNextIndex()

SlotIndex llvm::SlotIndex::getNextIndex ( ) const
inline

Returns the next index.

This is the index corresponding to the this index's slot, but for the next instruction.

Definition at line 280 of file SlotIndexes.h.

References llvm::ilist_node_impl< ilist_detail::compute_node_options< IndexListEntry, Options... >::type >::getIterator().

Referenced by llvm::createSIWholeQuadModePass().

◆ getNextSlot()

SlotIndex llvm::SlotIndex::getNextSlot ( ) const
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 270 of file SlotIndexes.h.

References llvm::ilist_node_impl< ilist_detail::compute_node_options< IndexListEntry, Options... >::type >::getIterator().

Referenced by llvm::SplitEditor::leaveIntvAfter(), and llvm::SplitEditor::leaveIntvBefore().

◆ getPrevIndex()

SlotIndex llvm::SlotIndex::getPrevIndex ( ) const
inline

Returns the previous index.

This is the index corresponding to this index's slot, but for the previous instruction.

Definition at line 300 of file SlotIndexes.h.

References llvm::ilist_node_impl< ilist_detail::compute_node_options< IndexListEntry, Options... >::type >::getIterator().

◆ getPrevSlot()

SlotIndex llvm::SlotIndex::getPrevSlot ( ) const
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 290 of file SlotIndexes.h.

References llvm::ilist_node_impl< ilist_detail::compute_node_options< IndexListEntry, Options... >::type >::getIterator().

Referenced by createSegmentsForValues(), llvm::LiveRangeCalc::extend(), llvm::LiveRange::getVNInfoBefore(), llvm::CoalescerPair::isCoalescable(), isFullUndefDef(), matchPair(), regOverlapsSet(), llvm::LiveIntervals::repairIntervalsInRange(), llvm::MachineBasicBlock::SplitCriticalEdge(), and subRangeLiveAt().

◆ getRegSlot()

SlotIndex llvm::SlotIndex::getRegSlot ( bool  EC = false) const
inline

◆ isBlock()

bool llvm::SlotIndex::isBlock ( ) const
inline

isBlock - Returns true if this is a block boundary slot.

Definition at line 227 of file SlotIndexes.h.

Referenced by llvm::VNInfo::isPHIDef(), matchPair(), and llvm::LiveRange::overlaps().

◆ isDead()

bool llvm::SlotIndex::isDead ( ) const
inline

isDead - Returns true if this is a dead def kill slot.

Definition at line 237 of file SlotIndexes.h.

Referenced by addSegmentsWithValNo(), allPhiOperandsUndefined(), llvm::LiveQueryResult::isDeadDef(), and matchPair().

◆ isEarlierEqualInstr()

static bool llvm::SlotIndex::isEarlierEqualInstr ( SlotIndex  A,
SlotIndex  B 
)
inlinestatic

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 210 of file SlotIndexes.h.

Referenced by findNextInsertLocation(), and llvm::LiveIntervals::HMEditor::updateAllRanges().

◆ isEarlierInstr()

static bool llvm::SlotIndex::isEarlierInstr ( SlotIndex  A,
SlotIndex  B 
)
inlinestatic

isEarlierInstr - Return true if A refers to an instruction earlier than B.

This is equivalent to A < B && !isSameInstr(A, B).

Definition at line 204 of file SlotIndexes.h.

References llvm::IndexListEntry::getIndex().

Referenced by getNumAllocatableRegsForConstraints(), llvm::InsertPointAnalysis::InsertPointAnalysis(), llvm::LiveRange::Query(), and llvm::LiveIntervals::HMEditor::updateAllRanges().

◆ isEarlyClobber()

bool llvm::SlotIndex::isEarlyClobber ( ) const
inline

isEarlyClobber - Returns true if this is an early-clobber slot.

Definition at line 230 of file SlotIndexes.h.

Referenced by matchPair().

◆ isRegister()

bool llvm::SlotIndex::isRegister ( ) const
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 234 of file SlotIndexes.h.

Referenced by matchPair().

◆ isSameInstr()

static bool llvm::SlotIndex::isSameInstr ( SlotIndex  A,
SlotIndex  B 
)
inlinestatic

◆ isValid()

bool llvm::SlotIndex::isValid ( ) const
inline

◆ operator bool()

llvm::SlotIndex::operator bool ( ) const
inlineexplicit

Return true for a valid index.

Definition at line 157 of file SlotIndexes.h.

References llvm::dump(), and print().

◆ operator!=()

bool llvm::SlotIndex::operator!= ( SlotIndex  other) const
inline

Compare two SlotIndex objects for inequality.

Definition at line 170 of file SlotIndexes.h.

◆ operator<()

bool llvm::SlotIndex::operator< ( SlotIndex  other) const
inline

Compare two SlotIndex objects.

Return true if the first index is strictly lower than the second.

Definition at line 176 of file SlotIndexes.h.

References llvm::IndexListEntry::getIndex().

◆ operator<=()

bool llvm::SlotIndex::operator<= ( SlotIndex  other) const
inline

Compare two SlotIndex objects.

Return true if the first index is lower than, or equal to, the second.

Definition at line 181 of file SlotIndexes.h.

References llvm::IndexListEntry::getIndex().

◆ operator==()

bool llvm::SlotIndex::operator== ( SlotIndex  other) const
inline

Compare two SlotIndex objects for equality.

Definition at line 166 of file SlotIndexes.h.

◆ operator>()

bool llvm::SlotIndex::operator> ( SlotIndex  other) const
inline

Compare two SlotIndex objects.

Return true if the first index is greater than the second.

Definition at line 187 of file SlotIndexes.h.

References llvm::IndexListEntry::getIndex().

◆ operator>=()

bool llvm::SlotIndex::operator>= ( SlotIndex  other) const
inline

Compare two SlotIndex objects.

Return true if the first index is greater than, or equal to, the second.

Definition at line 193 of file SlotIndexes.h.

References llvm::IndexListEntry::getIndex().

◆ print()

void SlotIndex::print ( raw_ostream os) const

Print this index to the given raw_ostream.

Definition at line 273 of file SlotIndexes.cpp.

Referenced by getStartOrEndSlot(), and llvm::operator<<().

Friends And Related Function Documentation

◆ SlotIndexes

friend class SlotIndexes
friend

Definition at line 85 of file SlotIndexes.h.


The documentation for this class was generated from the following files: