[llvm] r348226 - [TableGen] Improve the formatting of the emitted predicates (NFC)

Evandro Menezes via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 3 17:43:22 PST 2018


Author: evandro
Date: Mon Dec  3 17:43:22 2018
New Revision: 348226

URL: http://llvm.org/viewvc/llvm-project?rev=348226&view=rev
Log:
[TableGen] Improve the formatting of the emitted predicates (NFC)

Modified:
    llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp

Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=348226&r1=348225&r2=348226&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Mon Dec  3 17:43:22 2018
@@ -391,10 +391,10 @@ void InstrInfoEmitter::emitMCIIHelperMet
 
     OS.indent(PE.getIndentLevel() * 2);
     PE.expandStatement(OS, Rec->getValueAsDef("Body"));
-    OS << "\n}\n";
+    OS << "\n}\n\n";
   }
 
-  OS << "\n} // end " << TargetName << "_MC namespace\n";
+  OS << "} // end " << TargetName << "_MC namespace\n";
   OS << "} // end llvm namespace\n\n";
 
   OS << "#endif // GET_GENISTRINFO_MC_HELPERS\n";
@@ -409,10 +409,9 @@ void InstrInfoEmitter::emitTIIHelperMeth
 
   PredicateExpander PE(TargetName);
   PE.setExpandForMC(false);
-  PE.setIndentLevel(2);
 
   for (const Record *Rec : TIIPredicates) {
-    OS << "\n  " << (ExpandDefinition ? "" : "static ") << "bool ";
+    OS << (ExpandDefinition ? "" : "static ") << "bool ";
     if (ExpandDefinition)
       OS << TargetName << "InstrInfo::";
     OS << Rec->getValueAsString("FunctionName");
@@ -423,10 +422,9 @@ void InstrInfoEmitter::emitTIIHelperMeth
     }
 
     OS << " {\n";
-
     OS.indent(PE.getIndentLevel() * 2);
     PE.expandStatement(OS, Rec->getValueAsDef("Body"));
-    OS << "\n  }\n";
+    OS << "\n}\n\n";
   }
 }
 
@@ -534,12 +532,13 @@ void InstrInfoEmitter::run(raw_ostream &
   OS << "#endif // GET_INSTRINFO_HEADER\n\n";
 
   OS << "#ifdef GET_INSTRINFO_HELPER_DECLS\n";
-  OS << "#undef GET_INSTRINFO_HELPER_DECLS\n";
+  OS << "#undef GET_INSTRINFO_HELPER_DECLS\n\n";
   emitTIIHelperMethods(OS, TargetName, /* ExpandDefintion = */false);
+  OS << "\n";
   OS << "#endif // GET_INSTRINFO_HELPER_DECLS\n\n";
 
   OS << "#ifdef GET_INSTRINFO_HELPERS\n";
-  OS << "#undef GET_INSTRINFO_HELPERS\n";
+  OS << "#undef GET_INSTRINFO_HELPERS\n\n";
   emitTIIHelperMethods(OS, TargetName, /* ExpandDefintion = */true);
   OS << "#endif // GET_INSTRINFO_HELPERS\n\n";
 




More information about the llvm-commits mailing list