[llvm] r294074 - [GlobalISel] Separate matchers with newlines in emitted selector. NFC.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 16:47:03 PST 2017


Author: ab
Date: Fri Feb  3 18:47:02 2017
New Revision: 294074

URL: http://llvm.org/viewvc/llvm-project?rev=294074&view=rev
Log:
[GlobalISel] Separate matchers with newlines in emitted selector. NFC.

We don't try very hard to format the emitted code, but newlines
are an easy way to make it more readable.

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

Modified: llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp?rev=294074&r1=294073&r2=294074&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp Fri Feb  3 18:47:02 2017
@@ -143,7 +143,7 @@ public:
       OS << Separator << "(";
       Predicate->emitCxxPredicateExpr(OS, std::forward<Args>(args)...);
       OS << ")";
-      Separator = " && ";
+      Separator = " &&\n";
     }
   }
 };
@@ -276,7 +276,7 @@ public:
   void emitCxxPredicateExpr(raw_ostream &OS, const StringRef InsnVarName) const {
     emitCxxPredicateListExpr(OS, InsnVarName);
     for (const auto &Operand : Operands) {
-      OS << " && (";
+      OS << " &&\n(";
       Operand.emitCxxPredicateExpr(OS, InsnVarName);
       OS << ")";
     }
@@ -359,7 +359,7 @@ public:
 
     OS << "    constrainSelectedInstRegOperands(I, TII, TRI, RBI);\n";
     OS << "    return true;\n";
-    OS << "  }\n";
+    OS << "  }\n\n";
   }
 };
 
@@ -515,7 +515,7 @@ void GlobalISelEmitter::run(raw_ostream
   OS << "bool " << Target.getName()
      << "InstructionSelector::selectImpl"
         "(MachineInstr &I) const {\n  const MachineRegisterInfo &MRI = "
-        "I.getParent()->getParent()->getRegInfo();\n";
+        "I.getParent()->getParent()->getRegInfo();\n\n";
 
   // Look through the SelectionDAG patterns we found, possibly emitting some.
   for (const PatternToMatch &Pat : CGP.ptms()) {




More information about the llvm-commits mailing list