diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 7e778c6efd7..0dfb7c72b3a 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -267,26 +267,16 @@ void MachineInstr::dump() const { cerr << " " << *this; } -static void OutputReg(std::ostream &os, unsigned RegNo, - const MRegisterInfo *MRI = 0) { - if (MRegisterInfo::isPhysicalRegister(RegNo)) { - if (MRI) - os << "%" << MRI->get(RegNo).Name; - else - os << "%mreg" << RegNo; - } else { - os << "%reg" << RegNo; - } -} - static void print(const MachineOperand &MO, std::ostream &OS, const TargetMachine *TM) { - const MRegisterInfo *MRI = 0; - if (TM) MRI = TM->getRegisterInfo(); - switch (MO.getType()) { case MachineOperand::MO_Register: - OutputReg(OS, MO.getReg(), MRI); + if (MO.getReg() == 0 || MRegisterInfo::isVirtualRegister(MO.getReg())) + OS << "%reg" << MO.getReg(); + else if (TM) + OS << "%" << TM->getRegisterInfo()->get(MO.getReg()).Name; + else + OS << "%mreg" << MO.getReg(); if (MO.isDef()) OS << ""; break; case MachineOperand::MO_Immediate: