Improved printing routines.

llvm-svn: 1263
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 50319ca..4e1865d 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -132,11 +132,18 @@
 static inline ostream&
 OutputOperand(ostream &os, const MachineOperand &mop)
 {
+  Value* val;
   switch (mop.getOperandType())
     {
     case MachineOperand::MO_CCRegister:
     case MachineOperand::MO_VirtualRegister:
-      return os << "(val " << mop.getVRegValue() << ")";
+      val = mop.getVRegValue();
+      os << "(val ";
+      if (val && val->hasName())
+        os << val->getName().c_str();
+      else
+        os << val;
+      return os << ")";
     case MachineOperand::MO_MachineRegister:
       return os << "("     << mop.getMachineRegNum() << ")";
     default:
@@ -166,9 +173,12 @@
       {
         const Value* opVal = mop.getVRegValue();
         bool isLabel = isa<Method>(opVal) || isa<BasicBlock>(opVal);
-        return os << "%disp("
-                  << (isLabel? "label " : "addr-of-val ")
-                  << opVal << ")";
+        os << "%disp(" << (isLabel? "label " : "addr-of-val ");
+        if (opVal->hasName())
+          os << opVal->getName().c_str();
+        else
+          os << opVal;
+        return os << ")";
       }
     default:
       assert(0 && "Unrecognized operand type");