mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 17:24:48 +00:00
RegPressure: Order the "pressure sets" by number of regunits per set.
This lets heuristics easily pick the most important set to follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187108 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -956,7 +956,7 @@ CodeGenRegBank::CodeGenRegBank(RecordKeeper &Records) {
|
||||
std::sort(TupRegsCopy.begin(), TupRegsCopy.end(), LessRecordRegister());
|
||||
for (unsigned j = 0, je = TupRegsCopy.size(); j != je; ++j)
|
||||
getReg((TupRegsCopy)[j]);
|
||||
TupRegsCopy.clear();
|
||||
TupRegsCopy.clear();
|
||||
}
|
||||
|
||||
// Now all the registers are known. Build the object graph of explicit
|
||||
@ -1620,6 +1620,16 @@ void CodeGenRegBank::computeRegUnitSets() {
|
||||
}
|
||||
}
|
||||
|
||||
struct LessUnits {
|
||||
const CodeGenRegBank &RegBank;
|
||||
LessUnits(const CodeGenRegBank &RB): RegBank(RB) {}
|
||||
|
||||
bool operator()(unsigned ID1, unsigned ID2) {
|
||||
return RegBank.getRegPressureSet(ID1).Units.size()
|
||||
< RegBank.getRegPressureSet(ID2).Units.size();
|
||||
}
|
||||
};
|
||||
|
||||
void CodeGenRegBank::computeDerivedInfo() {
|
||||
computeComposites();
|
||||
computeSubRegIndexLaneMasks();
|
||||
@ -1631,6 +1641,21 @@ void CodeGenRegBank::computeDerivedInfo() {
|
||||
// Compute a unique set of RegUnitSets. One for each RegClass and inferred
|
||||
// supersets for the union of overlapping sets.
|
||||
computeRegUnitSets();
|
||||
|
||||
// Get the weight of each set.
|
||||
for (unsigned Idx = 0, EndIdx = RegUnitSets.size(); Idx != EndIdx; ++Idx)
|
||||
RegUnitSets[Idx].Weight = getRegUnitSetWeight(RegUnitSets[Idx].Units);
|
||||
|
||||
// Find the order of each set.
|
||||
RegUnitSetOrder.reserve(RegUnitSets.size());
|
||||
for (unsigned Idx = 0, EndIdx = RegUnitSets.size(); Idx != EndIdx; ++Idx)
|
||||
RegUnitSetOrder.push_back(Idx);
|
||||
|
||||
std::stable_sort(RegUnitSetOrder.begin(), RegUnitSetOrder.end(),
|
||||
LessUnits(*this));
|
||||
for (unsigned Idx = 0, EndIdx = RegUnitSets.size(); Idx != EndIdx; ++Idx) {
|
||||
RegUnitSets[RegUnitSetOrder[Idx]].Order = Idx;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user