15 #ifndef LLVM_LIB_CODEGEN_INTERFERENCECACHE_H
16 #define LLVM_LIB_CODEGEN_INTERFERENCECACHE_H
31 struct BlockInterference {
32 BlockInterference() :
Tag(0) {}
81 : VirtTag(LIU.
getTag()), Fixed(
nullptr) {
82 VirtI.setMap(LIU.
getMap());
94 void update(
unsigned MBBNum);
97 Entry() : PhysReg(0),
Tag(0), RefCount(0), Indexes(
nullptr), LIS(
nullptr) {}
100 assert(!hasRefs() &&
"Cannot clear cache entry with references");
107 unsigned getPhysReg()
const {
return PhysReg; }
109 void addRef(
int Delta) { RefCount += Delta; }
111 bool hasRefs()
const {
return RefCount > 0; }
119 void reset(
unsigned physReg,
125 BlockInterference *
get(
unsigned MBBNum) {
126 if (Blocks[MBBNum].
Tag !=
Tag)
128 return &Blocks[MBBNum];
135 enum { CacheEntries = 32 };
139 unsigned char* PhysRegEntries;
140 size_t PhysRegEntriesCount;
146 Entry Entries[CacheEntries];
149 Entry *
get(
unsigned PhysReg);
153 : TRI(nullptr), LIUArray(nullptr), MF(nullptr), PhysRegEntries(nullptr),
154 PhysRegEntriesCount(0), RoundRobin(0) {}
157 free(PhysRegEntries);
160 void reinitPhysRegEntries();
173 const BlockInterference *Current;
174 static const BlockInterference NoInterference;
176 void setEntry(Entry *E) {
181 CacheEntry->addRef(-1);
184 CacheEntry->addRef(+1);
189 Cursor() : CacheEntry(nullptr), Current(nullptr) {}
193 setEntry(O.CacheEntry);
197 setEntry(O.CacheEntry);
207 setEntry(Cache.get(PhysReg));
212 Current = CacheEntry ? CacheEntry->get(MBBNum) : &NoInterference;
217 return Current->First.isValid();
223 return Current->First;
229 return Current->Last;
void setPhysReg(InterferenceCache &Cache, unsigned PhysReg)
setPhysReg - Point this cursor to PhysReg's interference.
Cursor()
Cursor - Create a dangling cursor.
This class represents the liveness of a register, stack slot, etc.
SlotIndex last()
last - Return the ending index of the last interfering range in the current block.
initializer< Ty > init(const Ty &Val)
Cursor - The primary query interface for the block interference cache.
unsigned getTag() const
getTag - Return an opaque tag representing the current state of the union.
Union of live intervals that are strong candidates for coalescing into a single register (either phys...
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
unsigned getMaxCursors() const
getMaxCursors - Return the maximum number of concurrent cursors that can be supported.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
bool hasInterference()
hasInterference - Return true if the current block has any interference.
LiveSegments::iterator SegmentIter
void moveToBlock(unsigned MBBNum)
moveTo - Move cursor to basic block MBBNum.
Cursor & operator=(const Cursor &O)
SlotIndex - An opaque wrapper around machine indexes.
SlotIndex first()
first - Return the starting index of the first interfering range in the current block.