Skip to content

Commit dc5965c

Browse files
committed
Review feedback
1 parent b15c616 commit dc5965c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

llvm/utils/TableGen/FastISelEmitter.cpp

Lines changed: 8 additions & 7 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

@@ -311,7 +312,7 @@ struct OperandsSignature {
311312
void PrintArguments(raw_ostream &OS, ArrayRef<std::string> PhyRegs) const {
312313
ListSeparator LS;
313314
for (const auto [Idx, Opnd, PhyReg] : enumerate(Operands, PhyRegs)) {
314-
if (PhyReg != "") {
315+
if (!PhyReg.empty()) {
315316
// Implicit physical register operand.
316317
continue;
317318
}
@@ -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 (const 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
};
@@ -638,7 +639,7 @@ void FastISelMap::emitInstructionCode(raw_ostream &OS,
638639
}
639640

640641
for (const auto [Idx, PhyReg] : enumerate(Memo.PhysRegs)) {
641-
if (PhyReg != "")
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)