[llvm-commits] [llvm] r45458 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp
Chris Lattner
sabre at nondot.org
Sun Dec 30 13:08:37 PST 2007
Author: lattner
Date: Sun Dec 30 15:08:36 2007
New Revision: 45458
URL: http://llvm.org/viewvc/llvm-project?rev=45458&view=rev
Log:
simpilfy some register printing code.
Modified:
llvm/trunk/lib/CodeGen/MachineInstr.cpp
Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=45458&r1=45457&r2=45458&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Sun Dec 30 15:08:36 2007
@@ -267,26 +267,16 @@
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 << "<d>";
break;
case MachineOperand::MO_Immediate:
More information about the llvm-commits
mailing list