Skip to content

Commit 594d57e

Browse files
committed
[TableGen] New RegUnitSet(Name) constructor. NFC.
1 parent e71369f commit 594d57e

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

llvm/utils/TableGen/CodeGenRegisters.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,11 +1954,12 @@ void CodeGenRegBank::pruneUnitSets() {
19541954
SuperSetIDs.push_back(SubIdx);
19551955
}
19561956
// Populate PrunedUnitSets with each equivalence class's superset.
1957-
std::vector<RegUnitSet> PrunedUnitSets(SuperSetIDs.size());
1957+
std::vector<RegUnitSet> PrunedUnitSets;
1958+
PrunedUnitSets.reserve(SuperSetIDs.size());
19581959
for (unsigned i = 0, e = SuperSetIDs.size(); i != e; ++i) {
19591960
unsigned SuperIdx = SuperSetIDs[i];
1960-
PrunedUnitSets[i].Name = RegUnitSets[SuperIdx].Name;
1961-
PrunedUnitSets[i].Units = std::move(RegUnitSets[SuperIdx].Units);
1961+
PrunedUnitSets.emplace_back(RegUnitSets[SuperIdx].Name);
1962+
PrunedUnitSets.back().Units = std::move(RegUnitSets[SuperIdx].Units);
19621963
}
19631964
RegUnitSets = std::move(PrunedUnitSets);
19641965
}
@@ -1980,8 +1981,7 @@ void CodeGenRegBank::computeRegUnitSets() {
19801981
continue;
19811982

19821983
// Compute a sorted list of units in this class.
1983-
RegUnitSet RUSet;
1984-
RUSet.Name = RC.getName();
1984+
RegUnitSet RUSet(RC.getName());
19851985
RC.buildRegUnitSet(*this, RUSet.Units);
19861986

19871987
// Find an existing RegUnitSet.
@@ -2032,9 +2032,8 @@ void CodeGenRegBank::computeRegUnitSets() {
20322032
if (Intersection.empty())
20332033
continue;
20342034

2035-
RegUnitSet RUSet;
2036-
RUSet.Name =
2037-
RegUnitSets[Idx].Name + "_with_" + RegUnitSets[SearchIdx].Name;
2035+
RegUnitSet RUSet(RegUnitSets[Idx].Name + "_with_" +
2036+
RegUnitSets[SearchIdx].Name);
20382037
std::set_union(RegUnitSets[Idx].Units.begin(),
20392038
RegUnitSets[Idx].Units.end(),
20402039
RegUnitSets[SearchIdx].Units.begin(),

llvm/utils/TableGen/CodeGenRegisters.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ struct RegUnitSet {
546546
unsigned Weight = 0; // Cache the sum of all unit weights.
547547
unsigned Order = 0; // Cache the sort key.
548548

549-
RegUnitSet() = default;
549+
RegUnitSet(std::string Name) : Name(Name) {}
550550
};
551551

552552
// Base vector for identifying TopoSigs. The contents uniquely identify a

0 commit comments

Comments
 (0)