llvm.org GIT mirror llvm / 5c1761d
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 Andrew Trick 8 years ago
1 changed file(s) with 14 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
11661166 assert(RegClassUnitSets.empty() && "this invalidates RegClassUnitSets");
11671167
11681168 // Form an equivalence class of UnitSets with no significant difference.
1169 // Populate PrunedUnitSets with each equivalence class's superset.
1170 std::vector<RegUnitSet> PrunedUnitSets;
1169 std::vector<unsigned> SuperSetIDs;
11711170 for (unsigned SubIdx = 0, EndIdx = RegUnitSets.size();
11721171 SubIdx != EndIdx; ++SubIdx) {
11731172 const RegUnitSet &SubSet = RegUnitSets[SubIdx];
11751174 for (; SuperIdx != EndIdx; ++SuperIdx) {
11761175 if (SuperIdx == SubIdx)
11771176 continue;
1178 const RegUnitSet *SuperSet = 0;
1179 if (SuperIdx > SubIdx)
1180 SuperSet = &RegUnitSets[SuperIdx];
1181 else {
1182 // Compare with already-pruned sets.
1183 if (SuperIdx >= PrunedUnitSets.size())
1184 continue;
1185 SuperSet = &PrunedUnitSets[SuperIdx];
1186 }
1187 if (isRegUnitSubSet(SubSet.Units, SuperSet->Units)
1188 && (SubSet.Units.size() + 3 > SuperSet->Units.size())) {
1177
1178 const RegUnitSet &SuperSet = RegUnitSets[SuperIdx];
1179 if (isRegUnitSubSet(SubSet.Units, SuperSet.Units)
1180 && (SubSet.Units.size() + 3 > SuperSet.Units.size())) {
11891181 break;
11901182 }
11911183 }
1192 if (SuperIdx != EndIdx)
1193 continue;
1194 PrunedUnitSets.resize(PrunedUnitSets.size()+1);
1195 PrunedUnitSets.back().Name = RegUnitSets[SubIdx].Name;
1196 PrunedUnitSets.back().Units.swap(RegUnitSets[SubIdx].Units);
1184 if (SuperIdx == EndIdx)
1185 SuperSetIDs.push_back(SubIdx);
1186 }
1187 // Populate PrunedUnitSets with each equivalence class's superset.
1188 std::vector PrunedUnitSets(SuperSetIDs.size());
1189 for (unsigned i = 0, e = SuperSetIDs.size(); i != e; ++i) {
1190 unsigned SuperIdx = SuperSetIDs[i];
1191 PrunedUnitSets[i].Name = RegUnitSets[SuperIdx].Name;
1192 PrunedUnitSets[i].Units.swap(RegUnitSets[SuperIdx].Units);
11971193 }
11981194 RegUnitSets.swap(PrunedUnitSets);
11991195 }