mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-24 08:24:33 +00:00
Track reference count independently from clear().
This allows clear() to be called on a DomainValue with references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144147 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -92,10 +92,10 @@ struct DomainValue {
|
|||||||
return CountTrailingZeros_32(AvailableDomains);
|
return CountTrailingZeros_32(AvailableDomains);
|
||||||
}
|
}
|
||||||
|
|
||||||
DomainValue() { clear(); }
|
DomainValue() : Refs(0) { clear(); }
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
Refs = AvailableDomains = Dist = 0;
|
AvailableDomains = Dist = 0;
|
||||||
Instrs.clear();
|
Instrs.clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -173,6 +173,7 @@ DomainValue *ExeDepsFix::alloc(int domain) {
|
|||||||
dv->Dist = Distance;
|
dv->Dist = Distance;
|
||||||
if (domain >= 0)
|
if (domain >= 0)
|
||||||
dv->addDomain(domain);
|
dv->addDomain(domain);
|
||||||
|
assert(dv->Refs == 0 && "Reference count wasn't cleared");
|
||||||
return dv;
|
return dv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,8 +272,7 @@ bool ExeDepsFix::merge(DomainValue *A, DomainValue *B) {
|
|||||||
A->Instrs.append(B->Instrs.begin(), B->Instrs.end());
|
A->Instrs.append(B->Instrs.begin(), B->Instrs.end());
|
||||||
|
|
||||||
// Clear the old DomainValue so we won't try to swizzle instructions twice.
|
// Clear the old DomainValue so we won't try to swizzle instructions twice.
|
||||||
B->Instrs.clear();
|
B->clear();
|
||||||
B->AvailableDomains = 0;
|
|
||||||
|
|
||||||
for (unsigned rx = 0; rx != NumRegs; ++rx)
|
for (unsigned rx = 0; rx != NumRegs; ++rx)
|
||||||
if (LiveRegs[rx] == B)
|
if (LiveRegs[rx] == B)
|
||||||
|
Reference in New Issue
Block a user