15 #ifndef LLVM_CODEGEN_INTERFERENCECACHE
16 #define LLVM_CODEGEN_INTERFERENCECACHE
31 struct BlockInterference {
32 BlockInterference() : Tag(0) {}
81 VirtI.setMap(LIU.
getMap());
93 void update(
unsigned MBBNum);
96 Entry() : PhysReg(0), Tag(0), RefCount(0), Indexes(0), LIS(0) {}
99 assert(!hasRefs() &&
"Cannot clear cache entry with references");
106 unsigned getPhysReg()
const {
return PhysReg; }
108 void addRef(
int Delta) { RefCount += Delta; }
110 bool hasRefs()
const {
return RefCount > 0; }
118 void reset(
unsigned physReg,
124 BlockInterference *
get(
unsigned MBBNum) {
125 if (Blocks[MBBNum].Tag != Tag)
127 return &Blocks[MBBNum];
134 enum { CacheEntries = 32 };
144 Entry Entries[CacheEntries];
147 Entry *
get(
unsigned PhysReg);
163 BlockInterference *Current;
164 static BlockInterference NoInterference;
166 void setEntry(Entry *E) {
171 CacheEntry->addRef(-1);
174 CacheEntry->addRef(+1);
183 setEntry(O.CacheEntry);
187 setEntry(O.CacheEntry);
197 setEntry(Cache.get(PhysReg));
202 Current = CacheEntry ? CacheEntry->get(MBBNum) : &NoInterference;
207 return Current->First.isValid();
213 return Current->First;
219 return Current->Last;
void setPhysReg(InterferenceCache &Cache, unsigned PhysReg)
setPhysReg - Point this cursor to PhysReg's interference.
Cursor()
Cursor - Create a dangling cursor.
void init(MachineFunction *, LiveIntervalUnion *, SlotIndexes *, LiveIntervals *, const TargetRegisterInfo *)
init - Prepare cache for a new function.
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.
unsigned getMaxCursors() const
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.