15 #ifndef LLVM_LIB_CODEGEN_INTERFERENCECACHE_H 16 #define LLVM_LIB_CODEGEN_INTERFERENCECACHE_H 30 class MachineFunction;
31 class TargetRegisterInfo;
36 struct BlockInterference {
41 BlockInterference() {}
55 unsigned RefCount = 0;
99 void update(
unsigned MBBNum);
105 assert(!hasRefs() &&
"Cannot clear cache entry with references");
112 unsigned getPhysReg()
const {
return PhysReg; }
114 void addRef(
int Delta) { RefCount += Delta; }
116 bool hasRefs()
const {
return RefCount > 0; }
124 void reset(
unsigned physReg,
130 BlockInterference *
get(
unsigned MBBNum) {
131 if (Blocks[MBBNum].Tag != Tag)
133 return &Blocks[MBBNum];
140 enum { CacheEntries = 32 };
148 unsigned char* PhysRegEntries =
nullptr;
149 size_t PhysRegEntriesCount = 0;
152 unsigned RoundRobin = 0;
155 Entry Entries[CacheEntries];
158 Entry *
get(
unsigned PhysReg);
166 free(PhysRegEntries);
169 void reinitPhysRegEntries();
182 Entry *CacheEntry =
nullptr;
183 const BlockInterference *Current =
nullptr;
184 static const BlockInterference NoInterference;
186 void setEntry(Entry *
E) {
191 CacheEntry->addRef(-1);
194 CacheEntry->addRef(+1);
202 setEntry(O.CacheEntry);
206 setEntry(O.CacheEntry);
218 setEntry(Cache.get(PhysReg));
223 Current = CacheEntry ? CacheEntry->get(MBBNum) : &NoInterference;
228 return Current->First.isValid();
234 return Current->First;
240 return Current->Last;
247 #endif // LLVM_LIB_CODEGEN_INTERFERENCECACHE_H void setPhysReg(InterferenceCache &Cache, unsigned PhysReg)
setPhysReg - Point this cursor to PhysReg's interference.
This class represents lattice values for constants.
Segments::iterator iterator
unsigned const TargetRegisterInfo * TRI
void setMap(const IntervalMap &m)
setMap - Change the map iterated over.
This class represents the liveness of a register, stack slot, etc.
const Map & getMap() const
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.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Union of live intervals that are strong candidates for coalescing into a single register (either phys...
unsigned getTag() const
getTag - Return an opaque tag representing the current state of the union.
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.
static void clear(coro::Shape &Shape)
void moveToBlock(unsigned MBBNum)
moveTo - Move cursor to basic block MBBNum.
Cursor & operator=(const Cursor &O)
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getMaxCursors() const
getMaxCursors - Return the maximum number of concurrent cursors that can be supported.
SlotIndex - An opaque wrapper around machine indexes.
SlotIndex first()
first - Return the starting index of the first interfering range in the current block.