diff options
author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2001-11-12 14:19:47 +0000 |
---|---|---|
committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2001-11-12 14:19:47 +0000 |
commit | d9beb975f20cea2d3e9c3f528068cd25b80a1b72 (patch) | |
tree | ea1ad84eedbd3ce1bc0f8dc67a3ce8972d3b7536 /lib/CodeGen/MachineInstr.cpp | |
parent | af00d485a409983639881b4d34f0cd89e1eb4d38 (diff) |
Improved printing routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1263 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 50319ca1b6..4e1865dff1 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -132,11 +132,18 @@ operator<< (ostream& os, const MachineInstr& minstr) 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 @@ operator<<(ostream &os, const MachineOperand &mop) { 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"); |