[llvm-commits] [llvm] r45457 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp
Chris Lattner
sabre at nondot.org
Sun Dec 30 13:03:31 PST 2007
Author: lattner
Date: Sun Dec 30 15:03:30 2007
New Revision: 45457
URL: http://llvm.org/viewvc/llvm-project?rev=45457&view=rev
Log:
eliminate a copy of the machineoperand printing stuff. Keep the copy that
knows how to print offsets.
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=45457&r1=45456&r2=45457&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Sun Dec 30 15:03:30 2007
@@ -282,7 +282,6 @@
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 @@
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 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);
}
More information about the llvm-commits
mailing list