Implement printing of MBB arguments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5053 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-12-15 20:35:25 +00:00
parent 198ab640bb
commit 2109f502d6
2 changed files with 29 additions and 19 deletions

View File

@ -112,8 +112,7 @@ void MachineFunction::print(std::ostream &OS) const {
for (const_iterator BB = begin(); BB != end(); ++BB) {
BasicBlock *LBB = BB->getBasicBlock();
OS << "\n" << LBB->getName() << " ("
<< (const void*)BB->getBasicBlock() << "):\n";
OS << "\n" << LBB->getName() << " (" << (const void*)LBB << "):\n";
for (MachineBasicBlock::const_iterator I = BB->begin(); I != BB->end();++I){
OS << "\t";
(*I)->print(OS, Target);

View File

@ -260,6 +260,12 @@ static void print(const MachineOperand &MO, std::ostream &OS,
OS << ")";
break;
}
case MachineOperand::MO_MachineBasicBlock:
OS << "bb<"
<< ((Value*)MO.getMachineBasicBlock()->getBasicBlock())->getName()
<< "," << (void*)MO.getMachineBasicBlock()->getBasicBlock() << ">";
break;
default:
assert(0 && "Unrecognized operand type");
}
@ -335,47 +341,47 @@ std::ostream &operator<<(std::ostream& os, const MachineInstr& minstr)
return os << "\n";
}
std::ostream &operator<<(std::ostream &os, const MachineOperand &mop)
std::ostream &operator<<(std::ostream &os, const MachineOperand &MO)
{
if (mop.opHiBits32())
if (MO.opHiBits32())
os << "%lm(";
else if (mop.opLoBits32())
else if (MO.opLoBits32())
os << "%lo(";
else if (mop.opHiBits64())
else if (MO.opHiBits64())
os << "%hh(";
else if (mop.opLoBits64())
else if (MO.opLoBits64())
os << "%hm(";
switch (mop.getType())
switch (MO.getType())
{
case MachineOperand::MO_VirtualRegister:
os << "%reg";
OutputValue(os, mop.getVRegValue());
if (mop.hasAllocatedReg()) {
OutputValue(os, MO.getVRegValue());
if (MO.hasAllocatedReg()) {
os << "==";
OutputReg(os, mop.getAllocatedRegNum());
OutputReg(os, MO.getAllocatedRegNum());
}
break;
case MachineOperand::MO_CCRegister:
os << "%ccreg";
OutputValue(os, mop.getVRegValue());
if (mop.hasAllocatedReg()) {
OutputValue(os, MO.getVRegValue());
if (MO.hasAllocatedReg()) {
os << "==";
OutputReg(os, mop.getAllocatedRegNum());
OutputReg(os, MO.getAllocatedRegNum());
}
break;
case MachineOperand::MO_MachineRegister:
OutputReg(os, mop.getMachineRegNum());
OutputReg(os, MO.getMachineRegNum());
break;
case MachineOperand::MO_SignExtendedImmed:
os << (long)mop.getImmedValue();
os << (long)MO.getImmedValue();
break;
case MachineOperand::MO_UnextendedImmed:
os << (long)mop.getImmedValue();
os << (long)MO.getImmedValue();
break;
case MachineOperand::MO_PCRelativeDisp:
{
const Value* opVal = mop.getVRegValue();
const Value* opVal = MO.getVRegValue();
bool isLabel = isa<Function>(opVal) || isa<BasicBlock>(opVal);
os << "%disp(" << (isLabel? "label " : "addr-of-val ");
if (opVal->hasName())
@ -385,12 +391,17 @@ std::ostream &operator<<(std::ostream &os, const MachineOperand &mop)
os << ")";
break;
}
case MachineOperand::MO_MachineBasicBlock:
os << "bb<"
<< ((Value*)MO.getMachineBasicBlock()->getBasicBlock())->getName()
<< "," << (void*)MO.getMachineBasicBlock()->getBasicBlock() << ">";
break;
default:
assert(0 && "Unrecognized operand type");
break;
}
if (mop.flags &
if (MO.flags &
(MachineOperand::HIFLAG32 | MachineOperand::LOFLAG32 |
MachineOperand::HIFLAG64 | MachineOperand::LOFLAG64))
os << ")";