21 #ifndef LLVM_CODEGEN_LIVEINTERVAL_H
22 #define LLVM_CODEGEN_LIVEINTERVAL_H
35 class MachineRegisterInfo;
36 class TargetRegisterInfo;
38 template <
typename T,
unsigned Small>
class SmallPtrSet;
94 : EarlyVal(EarlyVal), LateVal(LateVal), EndPoint(EndPoint), Kill(Kill)
125 return EarlyVal == LateVal ? 0 : LateVal;
161 assert(S < E &&
"Cannot create empty or backwards segment");
171 assert((S < E) &&
"Backwards interval?");
216 while (I->end <= Pos) ++
I;
315 assert(!
empty() &&
"Call to beginIndex() on empty range.");
322 assert(!
empty() &&
"Call to endIndex() on empty range.");
332 return r !=
end() && r->start <= index;
339 return I ==
end() ? 0 : &*
I;
346 return I ==
end() ? 0 : &*
I;
352 return I ==
end() ? 0 : I->valno;
360 return I ==
end() ? 0 : I->valno;
367 return I !=
end() && I->start <= Idx ? I :
end();
372 return I !=
end() && I->start <= Idx ? I :
end();
416 const int *ValNoAssignments,
417 const int *RHSValNoAssignments,
432 bool RemoveDeadValNo =
false);
497 return thisIndex < otherIndex;
515 void extendSegmentEndTo(
iterator I, SlotIndex NewEnd);
517 void markValNoForDeletion(VNInfo *V);
555 return thisIndex < otherIndex ||
556 (thisIndex == otherIndex &&
reg < other.
reg);
572 raw_ostream &
operator<<(raw_ostream &OS,
const LiveRange::Segment &S);
659 void Connect(
unsigned a,
unsigned b);
void add(LiveRange::Segment)
void push_back(const T &Elt)
const_vni_iterator vni_end() const
const Segment * getSegmentContaining(SlotIndex Idx) const
Segments::iterator iterator
VNInfo(unsigned i, SlotIndex d)
VNInfo constructor.
SlotIndex def
The index of the defining instruction.
bool contains(SlotIndex I) const
Return true if the index is covered by this segment.
SlotIndex getBoundaryIndex() const
SlotIndex getBaseIndex() const
void MergeValueInAsValue(const LiveRange &RHS, const VNInfo *RHSValNo, VNInfo *LHSValNo)
Segment * getSegmentContaining(SlotIndex Idx)
bool isSpillable() const
isSpillable - Can this interval be spilled?
iterator advanceTo(iterator I, SlotIndex Pos)
bool isLocal(SlotIndex Start, SlotIndex End) const
void operator<(const Optional< T > &X, const Optional< U > &Y)
Poison comparison between two Optional objects. Clients needs to explicitly compare the underlying va...
LiveInterval(unsigned Reg, float Weight)
bool containsInterval(SlotIndex S, SlotIndex E) const
Return true if the given interval, [S, E), is covered by this segment.
SlotIndex endPoint() const
bool operator<(const LiveInterval &other) const
void markUnused()
Mark this value as unused.
unsigned getNumValNums() const
VNInfo * getVNInfoAt(SlotIndex Idx) const
getVNInfoAt - Return the VNInfo that is live at Idx, or NULL.
LoopInfoBase< BlockT, LoopT > * LI
static bool isEarlierInstr(SlotIndex A, SlotIndex B)
const_iterator FindSegmentContaining(SlotIndex Idx) const
bool operator<(const LiveRange &other) const
unsigned Classify(const LiveInterval *LI)
bool operator<(const Segment &Other) const
bool isBlock() const
isBlock - Returns true if this is a block boundary slot.
void print(raw_ostream &OS) const
bool isUnused() const
Returns true if this value is unused.
LiveRangeUpdater(LiveRange *lr=0)
void MergeSegmentsInAsValue(const LiveRange &RHS, VNInfo *LHSValNo)
SlotIndex getNextNonNullIndex(SlotIndex Index)
void Distribute(LiveInterval *LIV[], MachineRegisterInfo &MRI)
bool isDead() const
isDead - Returns true if this is a dead def kill slot.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
LiveQueryResult(VNInfo *EarlyVal, VNInfo *LateVal, SlotIndex EndPoint, bool Kill)
VNInfo * MergeValueNumberInto(VNInfo *V1, VNInfo *V2)
iterator addSegment(Segment S)
bool expiredAt(SlotIndex index) const
VNInfoList::const_iterator const_vni_iterator
const VNInfo * getValNumInfo(unsigned ValNo) const
void copyFrom(VNInfo &src)
Copy from the parameter into this VNInfo.
SlotIndex getPrevSlot() const
bool isDeadDef() const
Return true if this instruction has a dead def.
void removeValNo(VNInfo *ValNo)
bool hasAtLeastOneValue() const
LiveQueryResult Query(SlotIndex Idx) const
void removeSegment(Segment S, bool RemoveDeadValNo=false)
void setDest(LiveRange *lr)
Select a different destination live range.
const_iterator begin() const
bool overlaps(const LiveRange &other) const
void add(SlotIndex Start, SlotIndex End, VNInfo *VNI)
VNInfo * valueDefined() const
void verify() const
Walk the range and assert if any invariants fail to hold.
LiveRange * getDest() const
Get the current destination live range.
bool liveAt(SlotIndex index) const
VNInfoList::iterator vni_iterator
VNInfo(unsigned i, const VNInfo &orig)
VNInfo construtor, copies values from orig, except for the value number.
bool containsValue(const VNInfo *VNI) const
containsValue - Returns true if VNI belongs to this range.
bool operator==(const Segment &Other) const
iterator find(SlotIndex Pos)
VNInfo * valueOut() const
unsigned id
The ID number of this value.
void removeSegment(SlotIndex Start, SlotIndex End, bool RemoveDeadValNo=false)
ConnectedVNInfoEqClasses(LiveIntervals &lis)
const_vni_iterator vni_begin() const
Segments::const_iterator const_iterator
static bool isSameInstr(SlotIndex A, SlotIndex B)
isSameInstr - Return true if A and B refer to the same instruction.
BumpPtrAllocator Allocator
void markNotSpillable()
markNotSpillable - Mark interval as not spillable
#define LLVM_DELETED_FUNCTION
bool isZeroLength(SlotIndexes *Indexes) const
VNInfo * getValNumInfo(unsigned ValNo)
bool containsOneValue() const
SlotIndex beginIndex() const
beginIndex - Return the lowest numbered slot covered.
SmallVector< Segment, 4 > Segments
void print(raw_ostream &OS) const
void print(raw_ostream &) const
VNInfo * createDeadDef(SlotIndex Def, VNInfo::Allocator &VNInfoAllocator)
SlotIndex endIndex() const
VNInfo * extendInBlock(SlotIndex StartIdx, SlotIndex Kill)
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
SmallVector< VNInfo *, 4 > VNInfoList
VNInfo * getNextValue(SlotIndex def, VNInfo::Allocator &VNInfoAllocator)
Segment(SlotIndex S, SlotIndex E, VNInfo *V)
void join(LiveRange &Other, const int *ValNoAssignments, const int *RHSValNoAssignments, SmallVectorImpl< VNInfo * > &NewVNInfo)
const MCRegisterInfo & MRI
iterator FindSegmentContaining(SlotIndex Idx)
unsigned getEqClass(const VNInfo *VNI) const
const_iterator find(SlotIndex Pos) const
SlotIndex - An opaque wrapper around machine indexes.
bool overlapsFrom(const LiveRange &Other, const_iterator I) const
static RegisterPass< NVPTXAllocaHoisting > X("alloca-hoisting","Hoisting alloca instructions in non-entry ""blocks to the entry block")
const_iterator end() const
VNInfo * getVNInfoBefore(SlotIndex Idx) const
VNInfo * createValueCopy(const VNInfo *orig, VNInfo::Allocator &VNInfoAllocator)