Skip to content

Commit 2c73711

Browse files
[TableGen] Use llvm::append_range (NFC) (#133649)
1 parent 1c8647a commit 2c73711

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

llvm/utils/TableGen/DXILEmitter.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
113113

114114
ParamTypeRecs.push_back(R->getValueAsDef("result"));
115115

116-
for (const Record *ArgTy : R->getValueAsListOfDefs("arguments")) {
117-
ParamTypeRecs.push_back(ArgTy);
118-
}
116+
llvm::append_range(ParamTypeRecs, R->getValueAsListOfDefs("arguments"));
119117
size_t ParamTypeRecsSize = ParamTypeRecs.size();
120118
// Populate OpTypes with return type and parameter types
121119

@@ -148,9 +146,7 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
148146
// Sort records in ascending order of DXIL version
149147
ascendingSortByVersion(Recs);
150148

151-
for (const Record *CR : Recs) {
152-
OverloadRecs.push_back(CR);
153-
}
149+
llvm::append_range(OverloadRecs, Recs);
154150

155151
// Get stage records
156152
Recs = R->getValueAsListOfDefs("stages");
@@ -163,19 +159,15 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
163159
// Sort records in ascending order of DXIL version
164160
ascendingSortByVersion(Recs);
165161

166-
for (const Record *CR : Recs) {
167-
StageRecs.push_back(CR);
168-
}
162+
llvm::append_range(StageRecs, Recs);
169163

170164
// Get attribute records
171165
Recs = R->getValueAsListOfDefs("attributes");
172166

173167
// Sort records in ascending order of DXIL version
174168
ascendingSortByVersion(Recs);
175169

176-
for (const Record *CR : Recs) {
177-
AttrRecs.push_back(CR);
178-
}
170+
llvm::append_range(AttrRecs, Recs);
179171

180172
// Get the operation class
181173
OpClass = R->getValueAsDef("OpClass")->getName();

llvm/utils/TableGen/DecoderEmitter.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,8 +1342,7 @@ void FilterChooser::emitPredicateTableEntry(DecoderTableInfo &TableInfo,
13421342

13431343
TableInfo.Table.push_back(MCD::OPC_CheckPredicate);
13441344
// Predicate index.
1345-
for (const auto PB : PBytes)
1346-
TableInfo.Table.push_back(PB);
1345+
llvm::append_range(TableInfo.Table, PBytes);
13471346
// Push location for NumToSkip backpatching.
13481347
TableInfo.FixupStack.back().push_back(TableInfo.Table.size());
13491348
TableInfo.Table.push_back(0);
@@ -1402,15 +1401,13 @@ void FilterChooser::emitSoftFailTableEntry(DecoderTableInfo &TableInfo,
14021401
raw_svector_ostream S(MaskBytes);
14031402
if (NeedPositiveMask) {
14041403
encodeULEB128(PositiveMask.getZExtValue(), S);
1405-
for (unsigned i = 0, e = MaskBytes.size(); i != e; ++i)
1406-
TableInfo.Table.push_back(MaskBytes[i]);
1404+
llvm::append_range(TableInfo.Table, MaskBytes);
14071405
} else
14081406
TableInfo.Table.push_back(0);
14091407
if (NeedNegativeMask) {
14101408
MaskBytes.clear();
14111409
encodeULEB128(NegativeMask.getZExtValue(), S);
1412-
for (unsigned i = 0, e = MaskBytes.size(); i != e; ++i)
1413-
TableInfo.Table.push_back(MaskBytes[i]);
1410+
llvm::append_range(TableInfo.Table, MaskBytes);
14141411
} else
14151412
TableInfo.Table.push_back(0);
14161413
}
@@ -1483,8 +1480,7 @@ void FilterChooser::emitSingletonTableEntry(DecoderTableInfo &TableInfo,
14831480
encodeULEB128(DIdx, S);
14841481

14851482
// Decoder index.
1486-
for (const auto B : Bytes)
1487-
TableInfo.Table.push_back(B);
1483+
llvm::append_range(TableInfo.Table, Bytes);
14881484

14891485
if (!HasCompleteDecoder) {
14901486
// Push location for NumToSkip backpatching.

llvm/utils/TableGen/X86DisassemblerTables.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,7 @@ void DisassemblerTables::emitModRMDecision(raw_ostream &o1, raw_ostream &o2,
746746
ModRMDecision.push_back(decision.instructionIDs[index]);
747747
break;
748748
case MODRM_FULL:
749-
for (unsigned short InstructionID : decision.instructionIDs)
750-
ModRMDecision.push_back(InstructionID);
749+
llvm::append_range(ModRMDecision, decision.instructionIDs);
751750
break;
752751
}
753752

0 commit comments

Comments
 (0)