mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Improve printing during dumps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2311 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
03d33bd264
commit
93240fe6b1
@ -84,6 +84,17 @@ MachineInstr::dump(unsigned int indent) const
|
|||||||
cerr << *this;
|
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)
|
std::ostream &operator<<(std::ostream& os, const MachineInstr& minstr)
|
||||||
{
|
{
|
||||||
os << TargetInstrDescriptors[minstr.opCode].opCodeString;
|
os << TargetInstrDescriptors[minstr.opCode].opCodeString;
|
||||||
@ -94,34 +105,17 @@ std::ostream &operator<<(std::ostream& os, const MachineInstr& minstr)
|
|||||||
os << "*";
|
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
|
// code for printing implict references
|
||||||
|
|
||||||
unsigned NumOfImpRefs = minstr.getNumImplicitRefs();
|
unsigned NumOfImpRefs = minstr.getNumImplicitRefs();
|
||||||
if( NumOfImpRefs > 0 ) {
|
if( NumOfImpRefs > 0 ) {
|
||||||
|
os << "\tImplicit: ";
|
||||||
os << "\tImplicit:";
|
|
||||||
|
|
||||||
for(unsigned z=0; z < NumOfImpRefs; z++) {
|
for(unsigned z=0; z < NumOfImpRefs; z++) {
|
||||||
os << minstr.getImplicitRef(z);
|
OutputValue(os, minstr.getImplicitRef(z));
|
||||||
if( minstr.implicitRefIsDefined(z)) os << "*";
|
if( minstr.implicitRefIsDefined(z)) os << "*";
|
||||||
os << "\t";
|
os << "\t";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
return os << "\n";
|
return os << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,13 +127,7 @@ static inline std::ostream &OutputOperand(std::ostream &os,
|
|||||||
{
|
{
|
||||||
case MachineOperand::MO_CCRegister:
|
case MachineOperand::MO_CCRegister:
|
||||||
case MachineOperand::MO_VirtualRegister:
|
case MachineOperand::MO_VirtualRegister:
|
||||||
val = mop.getVRegValue();
|
return OutputValue(os, mop.getVRegValue());
|
||||||
os << "(val ";
|
|
||||||
if (val && val->hasName())
|
|
||||||
os << val->getName();
|
|
||||||
else
|
|
||||||
os << val;
|
|
||||||
return os << ")";
|
|
||||||
case MachineOperand::MO_MachineRegister:
|
case MachineOperand::MO_MachineRegister:
|
||||||
return os << "(" << mop.getMachineRegNum() << ")";
|
return os << "(" << mop.getMachineRegNum() << ")";
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user