diff options
author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-04-25 04:31:18 +0000 |
---|---|---|
committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-04-25 04:31:18 +0000 |
commit | 93240fe6b1f79e9ccb271a214a01141f8c2c123a (patch) | |
tree | 90daee3516de2c949476921bd17496c10ec1174d /lib/CodeGen/MachineInstr.cpp | |
parent | 03d33bd2640806ce8e661acf7bcfa3726a14d606 (diff) | |
download | external_llvm-93240fe6b1f79e9ccb271a214a01141f8c2c123a.zip external_llvm-93240fe6b1f79e9ccb271a214a01141f8c2c123a.tar.gz external_llvm-93240fe6b1f79e9ccb271a214a01141f8c2c123a.tar.bz2 |
Improve printing during dumps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2311 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 6a51f97..b113c60 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -84,6 +84,17 @@ MachineInstr::dump(unsigned int indent) const cerr << *this; } +static inline std::ostream &OutputValue(std::ostream &os, + const Value* val) +{ + os << "(val "; + if (val && val->hasName()) + return os << val->getName(); + else + return os << (void*) val; // print address only + os << ")"; +} + std::ostream &operator<<(std::ostream& os, const MachineInstr& minstr) { os << TargetInstrDescriptors[minstr.opCode].opCodeString; @@ -94,34 +105,17 @@ std::ostream &operator<<(std::ostream& os, const MachineInstr& minstr) os << "*"; } -#undef DEBUG_VAL_OP_ITERATOR -#ifdef DEBUG_VAL_OP_ITERATOR - os << "\n\tValue operands are: "; - for (MachineInstr::val_const_op_iterator vo(&minstr); ! vo.done(); ++vo) - { - const Value* val = *vo; - os << val << (vo.isDef()? "(def), " : ", "); - } -#endif - - - -#if 1 // code for printing implict references - unsigned NumOfImpRefs = minstr.getNumImplicitRefs(); if( NumOfImpRefs > 0 ) { - - os << "\tImplicit:"; - + os << "\tImplicit: "; for(unsigned z=0; z < NumOfImpRefs; z++) { - os << minstr.getImplicitRef(z); + OutputValue(os, minstr.getImplicitRef(z)); if( minstr.implicitRefIsDefined(z)) os << "*"; os << "\t"; } } - -#endif + return os << "\n"; } @@ -133,15 +127,9 @@ static inline std::ostream &OutputOperand(std::ostream &os, { case MachineOperand::MO_CCRegister: case MachineOperand::MO_VirtualRegister: - val = mop.getVRegValue(); - os << "(val "; - if (val && val->hasName()) - os << val->getName(); - else - os << val; - return os << ")"; + return OutputValue(os, mop.getVRegValue()); case MachineOperand::MO_MachineRegister: - return os << "(" << mop.getMachineRegNum() << ")"; + return os << "(" << mop.getMachineRegNum() << ")"; default: assert(0 && "Unknown operand type"); return os; |