diff --git a/llvm/utils/TableGen/CallingConvEmitter.cpp b/llvm/utils/TableGen/CallingConvEmitter.cpp index 9e997483d21d..127ae6247bd9 100644 --- a/llvm/utils/TableGen/CallingConvEmitter.cpp +++ b/llvm/utils/TableGen/CallingConvEmitter.cpp @@ -131,10 +131,9 @@ void CallingConvEmitter::EmitAction(Record *Action, O << IndentStr << "static const MCPhysReg RegList" << ++Counter << "[] = {\n"; O << IndentStr << " "; - for (unsigned i = 0, e = RegList->size(); i != e; ++i) { - if (i != 0) O << ", "; - O << getQualifiedName(RegList->getElementAsRecord(i)); - } + ListSeparator LS; + for (unsigned i = 0, e = RegList->size(); i != e; ++i) + O << LS << getQualifiedName(RegList->getElementAsRecord(i)); O << "\n" << IndentStr << "};\n"; O << IndentStr << "if (unsigned Reg = State.AllocateReg(RegList" << Counter << ")) {\n"; @@ -162,19 +161,17 @@ void CallingConvEmitter::EmitAction(Record *Action, O << IndentStr << "static const MCPhysReg RegList" << RegListNumber << "[] = {\n"; O << IndentStr << " "; - for (unsigned i = 0, e = RegList->size(); i != e; ++i) { - if (i != 0) O << ", "; - O << getQualifiedName(RegList->getElementAsRecord(i)); - } + ListSeparator LS; + for (unsigned i = 0, e = RegList->size(); i != e; ++i) + O << LS << getQualifiedName(RegList->getElementAsRecord(i)); O << "\n" << IndentStr << "};\n"; O << IndentStr << "static const MCPhysReg RegList" << ShadowRegListNumber << "[] = {\n"; O << IndentStr << " "; - for (unsigned i = 0, e = ShadowRegList->size(); i != e; ++i) { - if (i != 0) O << ", "; - O << getQualifiedName(ShadowRegList->getElementAsRecord(i)); - } + ListSeparator LSS; + for (unsigned i = 0, e = ShadowRegList->size(); i != e; ++i) + O << LSS << getQualifiedName(ShadowRegList->getElementAsRecord(i)); O << "\n" << IndentStr << "};\n"; O << IndentStr << "if (unsigned Reg = State.AllocateReg(RegList" @@ -220,10 +217,9 @@ void CallingConvEmitter::EmitAction(Record *Action, O << IndentStr << "static const MCPhysReg ShadowRegList" << ShadowRegListNumber << "[] = {\n"; O << IndentStr << " "; - for (unsigned i = 0, e = ShadowRegList->size(); i != e; ++i) { - if (i != 0) O << ", "; - O << getQualifiedName(ShadowRegList->getElementAsRecord(i)); - } + ListSeparator LS; + for (unsigned i = 0, e = ShadowRegList->size(); i != e; ++i) + O << LS << getQualifiedName(ShadowRegList->getElementAsRecord(i)); O << "\n" << IndentStr << "};\n"; O << IndentStr << "unsigned Offset" << ++Counter