[llvm-commits] [llvm] r45456 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp
Chris Lattner
sabre at nondot.org
Sun Dec 30 13:01:28 PST 2007
Author: lattner
Date: Sun Dec 30 15:01:27 2007
New Revision: 45456
URL: http://llvm.org/viewvc/llvm-project?rev=45456&view=rev
Log:
Simplify and clean up some machine operand/instr printing/dumping stuff.
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=45456&r1=45455&r2=45456&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Sun Dec 30 15:01:27 2007
@@ -267,15 +267,16 @@
cerr << " " << *this;
}
-static inline void OutputReg(std::ostream &os, unsigned RegNo,
- const MRegisterInfo *MRI = 0) {
- if (!RegNo || MRegisterInfo::isPhysicalRegister(RegNo)) {
+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 << "%mreg" << RegNo;
+ } else {
os << "%reg" << RegNo;
+ }
}
static void print(const MachineOperand &MO, std::ostream &OS,
@@ -287,6 +288,7 @@
switch (MO.getType()) {
case MachineOperand::MO_Register:
OutputReg(OS, MO.getReg(), MRI);
+ if (MO.isDef()) OS << "<d>";
break;
case MachineOperand::MO_Immediate:
OS << MO.getImm();
@@ -384,11 +386,8 @@
// and such.
os << getInstrDescriptor()->Name;
- for (unsigned i = 0, N = getNumOperands(); i < N; i++) {
+ for (unsigned i = 0, N = getNumOperands(); i < N; i++)
os << "\t" << getOperand(i);
- if (getOperand(i).isRegister() && getOperand(i).isDef())
- os << "<d>";
- }
os << "\n";
}
@@ -397,6 +396,7 @@
switch (getType()) {
case MO_Register:
OutputReg(OS, getReg());
+ if (isDef()) OS << "<d>";
break;
case MO_Immediate:
OS << getImm();
More information about the llvm-commits
mailing list