aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-30 21:03:30 +0000
committerChris Lattner <sabre@nondot.org>2007-12-30 21:03:30 +0000
commit7da5313d3f20ff4bf491a828726c8b11d88bfa7c (patch)
tree62c5b8fc86f4d1c4372dd451656d33358361f875 /lib/CodeGen/MachineInstr.cpp
parentfde5f801be6bb75fad4e7a39b5bc62c04857ac0c (diff)
eliminate a copy of the machineoperand printing stuff. Keep the copy that
knows how to print offsets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45457 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r--lib/CodeGen/MachineInstr.cpp38
1 files changed, 4 insertions, 34 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index 49ceab7041..7e778c6efd 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -282,7 +282,6 @@ static void OutputReg(std::ostream &os, unsigned 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()) {
@@ -302,7 +301,9 @@ static void print(const MachineOperand &MO, std::ostream &OS,
OS << "<fi#" << MO.getFrameIndex() << ">";
break;
case MachineOperand::MO_ConstantPoolIndex:
- OS << "<cp#" << MO.getConstantPoolIndex() << ">";
+ OS << "<cp#" << MO.getConstantPoolIndex();
+ if (MO.getOffset()) OS << "+" << MO.getOffset();
+ OS << ">";
break;
case MachineOperand::MO_JumpTableIndex:
OS << "<jt#" << MO.getJumpTableIndex() << ">";
@@ -393,37 +394,6 @@ void MachineInstr::print(std::ostream &os) const {
}
void MachineOperand::print(std::ostream &OS) const {
- switch (getType()) {
- case MO_Register:
- OutputReg(OS, getReg());
- if (isDef()) OS << "<d>";
- break;
- case MO_Immediate:
- OS << getImm();
- break;
- case MO_MachineBasicBlock:
- OS << "<mbb:"
- << ((Value*)getMachineBasicBlock()->getBasicBlock())->getName()
- << "@" << (void*)getMachineBasicBlock() << ">";
- break;
- case MO_FrameIndex:
- OS << "<fi#" << getFrameIndex() << ">";
- break;
- case MO_ConstantPoolIndex:
- OS << "<cp#" << getConstantPoolIndex() << ">";
- break;
- case MO_JumpTableIndex:
- OS << "<jt#" << getJumpTableIndex() << ">";
- break;
- case MO_GlobalAddress:
- OS << "<ga:" << ((Value*)getGlobal())->getName() << ">";
- break;
- case MO_ExternalSymbol:
- OS << "<es:" << getSymbolName() << ">";
- break;
- default:
- assert(0 && "Unrecognized operand type");
- break;
- }
+ ::print(*this, OS, 0);
}