mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
TableGen'd regpressure: register unit set pruning.
The pruning is more complete if it is not done incrementally. The code is also a tad less convluted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154510 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6073b30b05
commit
5c1761d486
@ -1167,8 +1167,7 @@ void CodeGenRegBank::pruneUnitSets() {
|
|||||||
assert(RegClassUnitSets.empty() && "this invalidates RegClassUnitSets");
|
assert(RegClassUnitSets.empty() && "this invalidates RegClassUnitSets");
|
||||||
|
|
||||||
// Form an equivalence class of UnitSets with no significant difference.
|
// Form an equivalence class of UnitSets with no significant difference.
|
||||||
// Populate PrunedUnitSets with each equivalence class's superset.
|
std::vector<unsigned> SuperSetIDs;
|
||||||
std::vector<RegUnitSet> PrunedUnitSets;
|
|
||||||
for (unsigned SubIdx = 0, EndIdx = RegUnitSets.size();
|
for (unsigned SubIdx = 0, EndIdx = RegUnitSets.size();
|
||||||
SubIdx != EndIdx; ++SubIdx) {
|
SubIdx != EndIdx; ++SubIdx) {
|
||||||
const RegUnitSet &SubSet = RegUnitSets[SubIdx];
|
const RegUnitSet &SubSet = RegUnitSets[SubIdx];
|
||||||
@ -1176,25 +1175,22 @@ void CodeGenRegBank::pruneUnitSets() {
|
|||||||
for (; SuperIdx != EndIdx; ++SuperIdx) {
|
for (; SuperIdx != EndIdx; ++SuperIdx) {
|
||||||
if (SuperIdx == SubIdx)
|
if (SuperIdx == SubIdx)
|
||||||
continue;
|
continue;
|
||||||
const RegUnitSet *SuperSet = 0;
|
|
||||||
if (SuperIdx > SubIdx)
|
const RegUnitSet &SuperSet = RegUnitSets[SuperIdx];
|
||||||
SuperSet = &RegUnitSets[SuperIdx];
|
if (isRegUnitSubSet(SubSet.Units, SuperSet.Units)
|
||||||
else {
|
&& (SubSet.Units.size() + 3 > SuperSet.Units.size())) {
|
||||||
// Compare with already-pruned sets.
|
|
||||||
if (SuperIdx >= PrunedUnitSets.size())
|
|
||||||
continue;
|
|
||||||
SuperSet = &PrunedUnitSets[SuperIdx];
|
|
||||||
}
|
|
||||||
if (isRegUnitSubSet(SubSet.Units, SuperSet->Units)
|
|
||||||
&& (SubSet.Units.size() + 3 > SuperSet->Units.size())) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SuperIdx != EndIdx)
|
if (SuperIdx == EndIdx)
|
||||||
continue;
|
SuperSetIDs.push_back(SubIdx);
|
||||||
PrunedUnitSets.resize(PrunedUnitSets.size()+1);
|
}
|
||||||
PrunedUnitSets.back().Name = RegUnitSets[SubIdx].Name;
|
// Populate PrunedUnitSets with each equivalence class's superset.
|
||||||
PrunedUnitSets.back().Units.swap(RegUnitSets[SubIdx].Units);
|
std::vector<RegUnitSet> PrunedUnitSets(SuperSetIDs.size());
|
||||||
|
for (unsigned i = 0, e = SuperSetIDs.size(); i != e; ++i) {
|
||||||
|
unsigned SuperIdx = SuperSetIDs[i];
|
||||||
|
PrunedUnitSets[i].Name = RegUnitSets[SuperIdx].Name;
|
||||||
|
PrunedUnitSets[i].Units.swap(RegUnitSets[SuperIdx].Units);
|
||||||
}
|
}
|
||||||
RegUnitSets.swap(PrunedUnitSets);
|
RegUnitSets.swap(PrunedUnitSets);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user