Skip to content

Commit f723260

Browse files
authored
[TableGen] Stop using make_pair and make_tuple. NFC. (llvm#81730)
These are unnecessary since C++17.
1 parent 0323235 commit f723260

34 files changed

+144
-151
lines changed

llvm/utils/TableGen/AsmMatcherEmitter.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ void AsmMatcherInfo::buildRegisterClasses(
12771277

12781278
if (!ContainingSet.empty()) {
12791279
RegisterSets.insert(ContainingSet);
1280-
RegisterMap.insert(std::make_pair(CGR.TheDef, ContainingSet));
1280+
RegisterMap.insert(std::pair(CGR.TheDef, ContainingSet));
12811281
}
12821282
}
12831283

@@ -1298,7 +1298,7 @@ void AsmMatcherInfo::buildRegisterClasses(
12981298
CI->DiagnosticType = "";
12991299
CI->IsOptional = false;
13001300
CI->DefaultMethod = ""; // unused
1301-
RegisterSetClasses.insert(std::make_pair(RS, CI));
1301+
RegisterSetClasses.insert(std::pair(RS, CI));
13021302
++Index;
13031303
}
13041304

@@ -1340,7 +1340,7 @@ void AsmMatcherInfo::buildRegisterClasses(
13401340
if (!CI->DiagnosticString.empty() && CI->DiagnosticType.empty())
13411341
CI->DiagnosticType = RC.getName();
13421342

1343-
RegisterClassClasses.insert(std::make_pair(Def, CI));
1343+
RegisterClassClasses.insert(std::pair(Def, CI));
13441344
}
13451345

13461346
// Populate the map for individual registers.
@@ -2193,7 +2193,7 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName,
21932193
ConversionRow.push_back(SrcOp2);
21942194

21952195
// Also create an 'enum' for this combination of tied operands.
2196-
auto Key = std::make_tuple(TiedOp, SrcOp1, SrcOp2);
2196+
auto Key = std::tuple(TiedOp, SrcOp1, SrcOp2);
21972197
TiedOperandsEnumMap.emplace(Key, TiedTupleName);
21982198
break;
21992199
}
@@ -2342,9 +2342,9 @@ emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName,
23422342
// For a tied operand, emit a reference to the TiedAsmOperandTable
23432343
// that contains the operand to copy, and the parsed operands to
23442344
// check for their tied constraints.
2345-
auto Key = std::make_tuple((uint8_t)ConversionTable[Row][i + 1],
2346-
(uint8_t)ConversionTable[Row][i + 2],
2347-
(uint8_t)ConversionTable[Row][i + 3]);
2345+
auto Key = std::tuple((uint8_t)ConversionTable[Row][i + 1],
2346+
(uint8_t)ConversionTable[Row][i + 2],
2347+
(uint8_t)ConversionTable[Row][i + 3]);
23482348
auto TiedOpndEnum = TiedOperandsEnumMap.find(Key);
23492349
assert(TiedOpndEnum != TiedOperandsEnumMap.end() &&
23502350
"No record for tied operand pair");
@@ -2812,7 +2812,7 @@ emitMnemonicAliasVariant(raw_ostream &OS, const AsmMatcherInfo &Info,
28122812

28132813
MatchCode += "return;";
28142814

2815-
Cases.push_back(std::make_pair(AliasEntry.first, MatchCode));
2815+
Cases.push_back(std::pair(AliasEntry.first, MatchCode));
28162816
}
28172817
StringMatcher("Mnemonic", Cases, OS).Emit(Indent);
28182818
}
@@ -2979,7 +2979,7 @@ emitCustomOperandParsing(raw_ostream &OS, CodeGenTarget &Target,
29792979
"std::end(OperandMatchTable),\n";
29802980
OS << " Mnemonic, LessOpcodeOperand());\n\n";
29812981
} else {
2982-
OS << " auto MnemonicRange = std::make_pair(std::begin(OperandMatchTable),"
2982+
OS << " auto MnemonicRange = std::pair(std::begin(OperandMatchTable),"
29832983
" std::end(OperandMatchTable));\n";
29842984
OS << " if (!Mnemonic.empty())\n";
29852985
OS << " MnemonicRange =\n";
@@ -3154,7 +3154,7 @@ static void emitMnemonicChecker(raw_ostream &OS, CodeGenTarget &Target,
31543154
OS << " auto MnemonicRange = "
31553155
"std::equal_range(Start, End, Mnemonic, LessOpcode());\n\n";
31563156
} else {
3157-
OS << " auto MnemonicRange = std::make_pair(Start, End);\n";
3157+
OS << " auto MnemonicRange = std::pair(Start, End);\n";
31583158
OS << " unsigned SIndex = Mnemonic.empty() ? 0 : 1;\n";
31593159
OS << " if (!Mnemonic.empty())\n";
31603160
OS << " MnemonicRange = "
@@ -3629,7 +3629,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
36293629
OS << " auto MnemonicRange = "
36303630
"std::equal_range(Start, End, Mnemonic, LessOpcode());\n\n";
36313631
} else {
3632-
OS << " auto MnemonicRange = std::make_pair(Start, End);\n";
3632+
OS << " auto MnemonicRange = std::pair(Start, End);\n";
36333633
OS << " unsigned SIndex = Mnemonic.empty() ? 0 : 1;\n";
36343634
OS << " if (!Mnemonic.empty())\n";
36353635
OS << " MnemonicRange = "

llvm/utils/TableGen/AsmWriterEmitter.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,12 @@ static void EmitInstructions(std::vector<AsmWriterInst> &Insts, raw_ostream &O,
144144
O << " switch (MI->getOpcode()) {\n";
145145
O << " default: llvm_unreachable(\"Unexpected opcode.\");\n";
146146
std::vector<std::pair<std::string, AsmWriterOperand>> OpsToPrint;
147-
OpsToPrint.push_back(
148-
std::make_pair(FirstInst.CGI->Namespace.str() +
149-
"::" + FirstInst.CGI->TheDef->getName().str(),
150-
FirstInst.Operands[i]));
147+
OpsToPrint.push_back(std::pair(FirstInst.CGI->Namespace.str() + "::" +
148+
FirstInst.CGI->TheDef->getName().str(),
149+
FirstInst.Operands[i]));
151150

152151
for (const AsmWriterInst &AWI : SimilarInsts) {
153-
OpsToPrint.push_back(std::make_pair(
152+
OpsToPrint.push_back(std::pair(
154153
AWI.CGI->Namespace.str() + "::" + AWI.CGI->TheDef->getName().str(),
155154
AWI.Operands[i]));
156155
}
@@ -722,7 +721,7 @@ class IAPrinter {
722721
void addOperand(StringRef Op, int OpIdx, int PrintMethodIdx = -1) {
723722
assert(OpIdx >= 0 && OpIdx < 0xFE && "Idx out of range");
724723
assert(PrintMethodIdx >= -1 && PrintMethodIdx < 0xFF && "Idx out of range");
725-
OpMap[Op] = std::make_pair(OpIdx, PrintMethodIdx);
724+
OpMap[Op] = std::pair(OpIdx, PrintMethodIdx);
726725
}
727726

728727
unsigned getNumMIOps() { return NumMIOps; }
@@ -753,7 +752,7 @@ class IAPrinter {
753752
Next = I;
754753
}
755754

756-
return std::make_pair(StringRef(Start, I - Start), Next);
755+
return std::pair(StringRef(Start, I - Start), Next);
757756
}
758757

759758
std::string formatAliasString(uint32_t &UnescapedSize) {
@@ -858,7 +857,7 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
858857

859858
const DagInit *DI = R->getValueAsDag("ResultInst");
860859
AliasMap[getQualifiedName(DI->getOperatorAsDef(R->getLoc()))].insert(
861-
std::make_pair(CodeGenInstAlias(R, Target), Priority));
860+
std::pair(CodeGenInstAlias(R, Target), Priority));
862861
}
863862

864863
// A map of which conditions need to be met for each instruction operand

llvm/utils/TableGen/CTagsEmitter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class Tag {
4040
Line = LineAndColumn.first;
4141
}
4242
int operator<(const Tag &B) const {
43-
return std::make_tuple(Id, BufferIdentifier, Line) <
44-
std::make_tuple(B.Id, B.BufferIdentifier, B.Line);
43+
return std::tuple(Id, BufferIdentifier, Line) <
44+
std::tuple(B.Id, B.BufferIdentifier, B.Line);
4545
}
4646
void emit(raw_ostream &OS) const {
4747
OS << Id << "\t" << BufferIdentifier << "\t" << Line << "\n";

llvm/utils/TableGen/CodeEmitterGen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,11 @@ CodeEmitterGen::getInstructionCases(Record *R, CodeGenTarget &Target) {
300300
append(" }\n");
301301
}
302302
append(" }\n");
303-
return std::make_pair(std::move(Case), std::move(BitOffsetCase));
303+
return std::pair(std::move(Case), std::move(BitOffsetCase));
304304
}
305305
}
306306
addInstructionCasesForEncoding(R, R, Target, Case, BitOffsetCase);
307-
return std::make_pair(std::move(Case), std::move(BitOffsetCase));
307+
return std::pair(std::move(Case), std::move(BitOffsetCase));
308308
}
309309

310310
void CodeEmitterGen::addInstructionCasesForEncoding(

llvm/utils/TableGen/CodeGenDAGPatterns.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -530,24 +530,24 @@ bool TypeInfer::EnforceSmallerThan(TypeSetByHwMode &Small, TypeSetByHwMode &Big,
530530
auto LT = [](MVT A, MVT B) -> bool {
531531
// Always treat non-scalable MVTs as smaller than scalable MVTs for the
532532
// purposes of ordering.
533-
auto ASize = std::make_tuple(A.isScalableVector(), A.getScalarSizeInBits(),
534-
A.getSizeInBits().getKnownMinValue());
535-
auto BSize = std::make_tuple(B.isScalableVector(), B.getScalarSizeInBits(),
536-
B.getSizeInBits().getKnownMinValue());
533+
auto ASize = std::tuple(A.isScalableVector(), A.getScalarSizeInBits(),
534+
A.getSizeInBits().getKnownMinValue());
535+
auto BSize = std::tuple(B.isScalableVector(), B.getScalarSizeInBits(),
536+
B.getSizeInBits().getKnownMinValue());
537537
return ASize < BSize;
538538
};
539539
auto SameKindLE = [](MVT A, MVT B) -> bool {
540540
// This function is used when removing elements: when a vector is compared
541541
// to a non-vector or a scalable vector to any non-scalable MVT, it should
542542
// return false (to avoid removal).
543-
if (std::make_tuple(A.isVector(), A.isScalableVector()) !=
544-
std::make_tuple(B.isVector(), B.isScalableVector()))
543+
if (std::tuple(A.isVector(), A.isScalableVector()) !=
544+
std::tuple(B.isVector(), B.isScalableVector()))
545545
return false;
546546

547-
return std::make_tuple(A.getScalarSizeInBits(),
548-
A.getSizeInBits().getKnownMinValue()) <=
549-
std::make_tuple(B.getScalarSizeInBits(),
550-
B.getSizeInBits().getKnownMinValue());
547+
return std::tuple(A.getScalarSizeInBits(),
548+
A.getSizeInBits().getKnownMinValue()) <=
549+
std::tuple(B.getScalarSizeInBits(),
550+
B.getSizeInBits().getKnownMinValue());
551551
};
552552

553553
for (unsigned M : Modes) {
@@ -751,8 +751,8 @@ bool TypeInfer::EnforceSameNumElts(TypeSetByHwMode &V, TypeSetByHwMode &W) {
751751
namespace {
752752
struct TypeSizeComparator {
753753
bool operator()(const TypeSize &LHS, const TypeSize &RHS) const {
754-
return std::make_tuple(LHS.isScalable(), LHS.getKnownMinValue()) <
755-
std::make_tuple(RHS.isScalable(), RHS.getKnownMinValue());
754+
return std::tuple(LHS.isScalable(), LHS.getKnownMinValue()) <
755+
std::tuple(RHS.isScalable(), RHS.getKnownMinValue());
756756
}
757757
};
758758
} // end anonymous namespace
@@ -2988,7 +2988,7 @@ TreePatternNodePtr TreePattern::ParseTreePattern(Init *TheInit,
29882988
// Check that the ComplexPattern uses are consistent: "(MY_PAT $a, $b)"
29892989
// and "(MY_PAT $b, $a)" should not be allowed in the same pattern;
29902990
// neither should "(MY_PAT_1 $a, $b)" and "(MY_PAT_2 $a, $b)".
2991-
auto OperandId = std::make_pair(Operator, i);
2991+
auto OperandId = std::pair(Operator, i);
29922992
auto PrevOp = ComplexPatternOperands.find(Child->getName());
29932993
if (PrevOp != ComplexPatternOperands.end()) {
29942994
if (PrevOp->getValue() != OperandId)
@@ -3197,7 +3197,7 @@ void CodeGenDAGPatterns::ParseNodeInfo() {
31973197

31983198
while (!Nodes.empty()) {
31993199
Record *R = Nodes.back();
3200-
SDNodes.insert(std::make_pair(R, SDNodeInfo(R, CGH)));
3200+
SDNodes.insert(std::pair(R, SDNodeInfo(R, CGH)));
32013201
Nodes.pop_back();
32023202
}
32033203

@@ -3217,7 +3217,7 @@ void CodeGenDAGPatterns::ParseNodeTransforms() {
32173217
Record *SDNode = XFormNode->getValueAsDef("Opcode");
32183218
StringRef Code = XFormNode->getValueAsString("XFormFunction");
32193219
SDNodeXForms.insert(
3220-
std::make_pair(XFormNode, NodeXForm(SDNode, std::string(Code))));
3220+
std::pair(XFormNode, NodeXForm(SDNode, std::string(Code))));
32213221

32223222
Xforms.pop_back();
32233223
}
@@ -3227,7 +3227,7 @@ void CodeGenDAGPatterns::ParseComplexPatterns() {
32273227
std::vector<Record *> AMs =
32283228
Records.getAllDerivedDefinitions("ComplexPattern");
32293229
while (!AMs.empty()) {
3230-
ComplexPatterns.insert(std::make_pair(AMs.back(), AMs.back()));
3230+
ComplexPatterns.insert(std::pair(AMs.back(), AMs.back()));
32313231
AMs.pop_back();
32323232
}
32333233
}
@@ -3340,7 +3340,7 @@ void CodeGenDAGPatterns::ParseDefaultOperands() {
33403340
std::vector<std::pair<Init *, StringInit *>> Ops;
33413341
for (unsigned op = 0, e = DefaultInfo->getNumArgs(); op != e; ++op)
33423342
Ops.push_back(
3343-
std::make_pair(DefaultInfo->getArg(op), DefaultInfo->getArgName(op)));
3343+
std::pair(DefaultInfo->getArg(op), DefaultInfo->getArgName(op)));
33443344
DagInit *DI = DagInit::get(SomeSDNode, nullptr, Ops);
33453345

33463346
// Create a TreePattern to parse this.

llvm/utils/TableGen/CodeGenHwModes.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ HwModeSelect::HwModeSelect(Record *R, CodeGenHwModes &CGH) {
5252
}
5353
for (unsigned i = 0, e = Modes.size(); i != e; ++i) {
5454
unsigned ModeId = CGH.getHwModeId(Modes[i]);
55-
Items.push_back(std::make_pair(ModeId, Objects[i]));
55+
Items.push_back(std::pair(ModeId, Objects[i]));
5656
}
5757
}
5858

@@ -71,11 +71,11 @@ CodeGenHwModes::CodeGenHwModes(RecordKeeper &RK) : Records(RK) {
7171
if (R->getName() == DefaultModeName)
7272
continue;
7373
Modes.emplace_back(R);
74-
ModeIds.insert(std::make_pair(R, Modes.size()));
74+
ModeIds.insert(std::pair(R, Modes.size()));
7575
}
7676

7777
for (Record *R : Records.getAllDerivedDefinitions("HwModeSelect")) {
78-
auto P = ModeSelects.emplace(std::make_pair(R, HwModeSelect(R, *this)));
78+
auto P = ModeSelects.emplace(std::pair(R, HwModeSelect(R, *this)));
7979
assert(P.second);
8080
(void)P;
8181
}

llvm/utils/TableGen/CodeGenInstAlias.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ CodeGenInstAlias::CodeGenInstAlias(Record *R, CodeGenTarget &T) : TheDef(R) {
227227
InstOpRec->getValueAsDef("ParserMatchClass")
228228
->getValueAsString("Name") != "Imm")) {
229229
ResultOperands.push_back(ResOp);
230-
ResultInstOperandIndex.push_back(std::make_pair(i, -1));
230+
ResultInstOperandIndex.push_back(std::pair(i, -1));
231231
++AliasOpNo;
232232

233233
// Otherwise, we need to match each of the suboperands individually.
@@ -242,7 +242,7 @@ CodeGenInstAlias::CodeGenInstAlias(Record *R, CodeGenTarget &T) : TheDef(R) {
242242
Result->getArgName(AliasOpNo)->getAsUnquotedString() + "." +
243243
MIOI->getArgName(SubOp)->getAsUnquotedString(),
244244
SubRec);
245-
ResultInstOperandIndex.push_back(std::make_pair(i, SubOp));
245+
ResultInstOperandIndex.push_back(std::pair(i, SubOp));
246246
}
247247
++AliasOpNo;
248248
}
@@ -260,7 +260,7 @@ CodeGenInstAlias::CodeGenInstAlias(Record *R, CodeGenTarget &T) : TheDef(R) {
260260
if (tryAliasOpMatch(Result, AliasOpNo, SubRec, false, R->getLoc(), T,
261261
ResOp)) {
262262
ResultOperands.push_back(ResOp);
263-
ResultInstOperandIndex.push_back(std::make_pair(i, SubOp));
263+
ResultInstOperandIndex.push_back(std::pair(i, SubOp));
264264
++AliasOpNo;
265265
} else {
266266
PrintFatalError(

llvm/utils/TableGen/CodeGenInstruction.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
175175
}
176176

177177
OpInfo.SubOpNames[j] = SubArgName;
178-
SubOpAliases[SubArgName] = std::make_pair(i, j);
178+
SubOpAliases[SubArgName] = std::pair(i, j);
179179
}
180180
} else if (!EncoderMethod.empty()) {
181181
// If we have no explicit sub-op dag, but have an top-level encoder
@@ -276,7 +276,7 @@ CGIOperandList::ParseOperandName(StringRef Op, bool AllowWholeOp) {
276276
Op + "'");
277277

278278
// Otherwise, return the operand.
279-
return std::make_pair(OpIdx, 0U);
279+
return std::pair(OpIdx, 0U);
280280
}
281281

282282
// Find the suboperand number involved.
@@ -289,13 +289,13 @@ CGIOperandList::ParseOperandName(StringRef Op, bool AllowWholeOp) {
289289
// Find the operand with the right name.
290290
for (unsigned i = 0, e = MIOpInfo->getNumArgs(); i != e; ++i)
291291
if (MIOpInfo->getArgNameStr(i) == SubOpName)
292-
return std::make_pair(OpIdx, i);
292+
return std::pair(OpIdx, i);
293293

294294
// Otherwise, didn't find it!
295295
PrintFatalError(TheDef->getLoc(), TheDef->getName() +
296296
": unknown suboperand name in '" + Op +
297297
"'");
298-
return std::make_pair(0U, 0U);
298+
return std::pair(0U, 0U);
299299
}
300300

301301
static void ParseConstraint(StringRef CStr, CGIOperandList &Ops, Record *Rec) {

llvm/utils/TableGen/CodeGenInstruction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class CGIOperandList {
205205
for (unsigned i = 0;; ++i) {
206206
assert(i < OperandList.size() && "Invalid flat operand #");
207207
if (OperandList[i].MIOperandNo + OperandList[i].MINumOperands > Op)
208-
return std::make_pair(i, Op - OperandList[i].MIOperandNo);
208+
return std::pair(i, Op - OperandList[i].MIOperandNo);
209209
}
210210
}
211211

0 commit comments

Comments
 (0)