[llvm-commits] CVS: llvm/lib/CodeGen/MachineInstr.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Oct 29 19:56:01 PST 2002


Changes in directory llvm/lib/CodeGen:

MachineInstr.cpp updated: 1.61 -> 1.62

---
Log message:

Add special code to make printing SSA form machine instructions nicer


---
Diffs of the changes:

Index: llvm/lib/CodeGen/MachineInstr.cpp
diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.61 llvm/lib/CodeGen/MachineInstr.cpp:1.62
--- llvm/lib/CodeGen/MachineInstr.cpp:1.61	Tue Oct 29 18:58:19 2002
+++ llvm/lib/CodeGen/MachineInstr.cpp	Tue Oct 29 19:55:38 2002
@@ -266,17 +266,28 @@
 }
 
 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: ";





More information about the llvm-commits mailing list