Add special code to make printing SSA form machine instructions nicer
authorChris Lattner <sabre@nondot.org>
Wed, 30 Oct 2002 01:55:38 +0000 (01:55 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 30 Oct 2002 01:55:38 +0000 (01:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4446 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineInstr.cpp

index 961e568f69f2f70c86258ac42b18925a8270f120..5ec5c2ad05a02afa7278e4cae5d428abe4bcf351 100644 (file)
@@ -266,17 +266,28 @@ static void print(const MachineOperand &MO, std::ostream &OS,
 }
 
 void MachineInstr::print(std::ostream &OS, const TargetMachine &TM) {
+  unsigned StartOp = 0;
+
+   // Specialize printing if op#0 is definition
+  if (getNumOperands() && operandIsDefined(0)) {
+    ::print(getOperand(0), OS, TM);
+    OS << " = ";
+    ++StartOp;   // Don't print this operand again!
+  }
   OS << TM.getInstrInfo().getName(getOpcode());
-  for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
-    OS << "\t";
+  
+  for (unsigned i = StartOp, e = getNumOperands(); i != e; ++i) {
+    if (i != StartOp)
+      OS << ",";
+    OS << " ";
     ::print(getOperand(i), OS, TM);
-
+    
     if (operandIsDefinedAndUsed(i))
       OS << "<def&use>";
     else if (operandIsDefined(i))
       OS << "<def>";
   }
-
+    
   // code for printing implict references
   if (getNumImplicitRefs()) {
     OS << "\tImplicitRefs: ";