summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2001-11-12 14:19:47 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2001-11-12 14:19:47 +0000
commit6e004c08181e7502d784ba50edcf9be3d1c6a667 (patch)
tree6b1550adab5d1a0886e987589ccc6025585e0c61 /llvm/lib/CodeGen/MachineInstr.cpp
parentdff0a891c1108aaf335680992f51eafbae65e6fa (diff)
downloadbcm5719-llvm-6e004c08181e7502d784ba50edcf9be3d1c6a667.tar.gz
bcm5719-llvm-6e004c08181e7502d784ba50edcf9be3d1c6a667.zip
Improved printing routines.
llvm-svn: 1263
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 50319ca1b62..4e1865dff19 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/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");
OpenPOWER on IntegriCloud