Skip to content

Commit c28c0ef

Browse files
committed
Review feedback
1 parent b15c616 commit c28c0ef

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

llvm/utils/TableGen/FastISelEmitter.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@ struct OperandsSignature {
158158
OperandsSignature getWithoutImmCodes() const {
159159
OperandsSignature Result;
160160
Result.Operands.resize(Operands.size());
161-
for (auto [RO, O] : zip_equal(Result.Operands, Operands))
162-
RO = O.isImm() ? OpKind::getImm(0) : O;
161+
llvm::transform(Operands, Result.Operands.begin(), [](OpKind Kind) {
162+
return Kind.isImm() ? OpKind::getImm(0) : Kind;
163+
});
163164
return Result;
164165
}
165166

@@ -295,7 +296,7 @@ struct OperandsSignature {
295296

296297
void PrintParameters(raw_ostream &OS) const {
297298
ListSeparator LS;
298-
for (const auto [Idx, Opnd] : enumerate(Operands)) {
299+
for (auto [Idx, Opnd] : enumerate(Operands)) {
299300
OS << LS;
300301
if (Opnd.isReg())
301302
OS << "Register Op" << Idx;
@@ -310,8 +311,8 @@ struct OperandsSignature {
310311

311312
void PrintArguments(raw_ostream &OS, ArrayRef<std::string> PhyRegs) const {
312313
ListSeparator LS;
313-
for (const auto [Idx, Opnd, PhyReg] : enumerate(Operands, PhyRegs)) {
314-
if (PhyReg != "") {
314+
for (auto [Idx, Opnd, PhyReg] : enumerate(Operands, PhyRegs)) {
315+
if (!PhyReg.empty()) {
315316
// Implicit physical register operand.
316317
continue;
317318
}
@@ -330,7 +331,7 @@ struct OperandsSignature {
330331

331332
void PrintArguments(raw_ostream &OS) const {
332333
ListSeparator LS;
333-
for (const auto [Idx, Opnd] : enumerate(Operands)) {
334+
for (auto [Idx, Opnd] : enumerate(Operands)) {
334335
OS << LS;
335336
if (Opnd.isReg())
336337
OS << "Op" << Idx;
@@ -346,8 +347,8 @@ struct OperandsSignature {
346347
void PrintManglingSuffix(raw_ostream &OS, ArrayRef<std::string> PhyRegs,
347348
ImmPredicateSet &ImmPredicates,
348349
bool StripImmCodes = false) const {
349-
for (const auto [PR, Opnd] : zip_equal(PhyRegs, Operands)) {
350-
if (PR != "") {
350+
for (auto [PhyReg, Opnd] : zip_equal(PhyRegs, Operands)) {
351+
if (!PhyReg.empty()) {
351352
// Implicit physical register operand. e.g. Instruction::Mul expect to
352353
// select to a binary op. On x86, mul may take a single operand with
353354
// the other operand being implicit. We must emit something that looks
@@ -361,7 +362,7 @@ struct OperandsSignature {
361362

362363
void PrintManglingSuffix(raw_ostream &OS, ImmPredicateSet &ImmPredicates,
363364
bool StripImmCodes = false) const {
364-
for (const OpKind Opnd : Operands)
365+
for (OpKind Opnd : Operands)
365366
Opnd.printManglingSuffix(OS, ImmPredicates, StripImmCodes);
366367
}
367368
};
@@ -637,8 +638,8 @@ void FastISelMap::emitInstructionCode(raw_ostream &OS,
637638
OS << " ";
638639
}
639640

640-
for (const auto [Idx, PhyReg] : enumerate(Memo.PhysRegs)) {
641-
if (PhyReg != "")
641+
for (auto [Idx, PhyReg] : enumerate(Memo.PhysRegs)) {
642+
if (!PhyReg.empty())
642643
OS << " BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD, "
643644
<< "TII.get(TargetOpcode::COPY), " << PhyReg << ").addReg(Op" << Idx
644645
<< ");\n";

0 commit comments

Comments
 (0)