mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
Tag cached interference with a user-provided tag instead of the virtual register number.
The live range of a virtual register may change which invalidates the cached interference information. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127772 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c46570dc05
commit
2926733240
@ -163,7 +163,7 @@ public:
|
|||||||
bool CheckedFirstInterference;
|
bool CheckedFirstInterference;
|
||||||
bool SeenAllInterferences;
|
bool SeenAllInterferences;
|
||||||
bool SeenUnspillableVReg;
|
bool SeenUnspillableVReg;
|
||||||
unsigned Tag, VTag;
|
unsigned Tag, UserTag;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Query(): LiveUnion(), VirtReg() {}
|
Query(): LiveUnion(), VirtReg() {}
|
||||||
@ -181,12 +181,13 @@ public:
|
|||||||
SeenAllInterferences = false;
|
SeenAllInterferences = false;
|
||||||
SeenUnspillableVReg = false;
|
SeenUnspillableVReg = false;
|
||||||
Tag = 0;
|
Tag = 0;
|
||||||
VTag = 0;
|
UserTag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(LiveInterval *VReg, LiveIntervalUnion *LIU) {
|
void init(unsigned UTag, LiveInterval *VReg, LiveIntervalUnion *LIU) {
|
||||||
assert(VReg && LIU && "Invalid arguments");
|
assert(VReg && LIU && "Invalid arguments");
|
||||||
if (VReg->reg == VTag && LiveUnion == LIU && !LIU->changedSince(Tag)) {
|
if (UserTag == UTag && VirtReg == VReg &&
|
||||||
|
LiveUnion == LIU && !LIU->changedSince(Tag)) {
|
||||||
// Retain cached results, e.g. firstInterference.
|
// Retain cached results, e.g. firstInterference.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -194,7 +195,7 @@ public:
|
|||||||
LiveUnion = LIU;
|
LiveUnion = LIU;
|
||||||
VirtReg = VReg;
|
VirtReg = VReg;
|
||||||
Tag = LIU->getTag();
|
Tag = LIU->getTag();
|
||||||
VTag = VReg->reg;
|
UserTag = UTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
LiveInterval &virtReg() const {
|
LiveInterval &virtReg() const {
|
||||||
|
@ -61,6 +61,11 @@ class LiveVirtRegQueue;
|
|||||||
/// assignment order.
|
/// assignment order.
|
||||||
class RegAllocBase {
|
class RegAllocBase {
|
||||||
LiveIntervalUnion::Allocator UnionAllocator;
|
LiveIntervalUnion::Allocator UnionAllocator;
|
||||||
|
|
||||||
|
// Cache tag for PhysReg2LiveUnion entries. Increment whenever virtual
|
||||||
|
// registers may have changed.
|
||||||
|
unsigned UserTag;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Array of LiveIntervalUnions indexed by physical register.
|
// Array of LiveIntervalUnions indexed by physical register.
|
||||||
class LiveUnionArray {
|
class LiveUnionArray {
|
||||||
@ -92,7 +97,7 @@ protected:
|
|||||||
// query on a new live virtual register.
|
// query on a new live virtual register.
|
||||||
OwningArrayPtr<LiveIntervalUnion::Query> Queries;
|
OwningArrayPtr<LiveIntervalUnion::Query> Queries;
|
||||||
|
|
||||||
RegAllocBase(): TRI(0), MRI(0), VRM(0), LIS(0) {}
|
RegAllocBase(): UserTag(0), TRI(0), MRI(0), VRM(0), LIS(0) {}
|
||||||
|
|
||||||
virtual ~RegAllocBase() {}
|
virtual ~RegAllocBase() {}
|
||||||
|
|
||||||
@ -104,7 +109,7 @@ protected:
|
|||||||
// before querying a new live virtual register. This ties Queries and
|
// before querying a new live virtual register. This ties Queries and
|
||||||
// PhysReg2LiveUnion together.
|
// PhysReg2LiveUnion together.
|
||||||
LiveIntervalUnion::Query &query(LiveInterval &VirtReg, unsigned PhysReg) {
|
LiveIntervalUnion::Query &query(LiveInterval &VirtReg, unsigned PhysReg) {
|
||||||
Queries[PhysReg].init(&VirtReg, &PhysReg2LiveUnion[PhysReg]);
|
Queries[PhysReg].init(UserTag, &VirtReg, &PhysReg2LiveUnion[PhysReg]);
|
||||||
return Queries[PhysReg];
|
return Queries[PhysReg];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,6 +296,9 @@ void RegAllocBase::allocatePhysRegs() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Invalidate all interference queries, live ranges could have changed.
|
||||||
|
++UserTag;
|
||||||
|
|
||||||
// selectOrSplit requests the allocator to return an available physical
|
// selectOrSplit requests the allocator to return an available physical
|
||||||
// register if possible and populate a list of new live intervals that
|
// register if possible and populate a list of new live intervals that
|
||||||
// result from splitting.
|
// result from splitting.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user