[llvm] edd92e0 - [TableGen] Use ListSeparator (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 19:54:57 PST 2021


Author: Kazu Hirata
Date: 2021-02-25T19:54:36-08:00
New Revision: edd92e018a7ba764f0e217ba8fd155ee1c12cf6a

URL: https://github.com/llvm/llvm-project/commit/edd92e018a7ba764f0e217ba8fd155ee1c12cf6a
DIFF: https://github.com/llvm/llvm-project/commit/edd92e018a7ba764f0e217ba8fd155ee1c12cf6a.diff

LOG: [TableGen] Use ListSeparator (NFC)

Added: 
    

Modified: 
    llvm/utils/TableGen/CallingConvEmitter.cpp

Removed: 
    


################################################################################
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


        


More information about the llvm-commits mailing list