summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-10-31 20:19:03 +0000
committerDan Gohman <gohman@apple.com>2009-10-31 20:19:03 +0000
commit34341e69c4fc65122904d4a60e2659518a7c9442 (patch)
treea01efa4a00ff38d77eca4563dd83fd1f7872e757 /llvm/lib/CodeGen/MachineBasicBlock.cpp
parent18dc1c5c9e93ffa7c848c6e242529987de081e41 (diff)
downloadbcm5719-llvm-34341e69c4fc65122904d4a60e2659518a7c9442.tar.gz
bcm5719-llvm-34341e69c4fc65122904d4a60e2659518a7c9442.zip
Make -print-machineinstrs more readable.
- Be consistent when referring to MachineBasicBlocks: BB#0. - Be consistent when referring to virtual registers: %reg1024. - Be consistent when referring to unknown physical registers: %physreg10. - Be consistent when referring to known physical registers: %RAX - Be consistent when referring to register 0: %reg0 - Be consistent when printing alignments: align=16 - Print jump table contents. - Don't print host addresses, in general. - and various other cleanups. llvm-svn: 85682
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 4d1370aed98..7fbdb128fd4 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -20,6 +20,7 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/LeakDetector.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Assembly/Writer.h"
#include <algorithm>
using namespace llvm;
@@ -161,11 +162,11 @@ void MachineBasicBlock::dump() const {
static inline void OutputReg(raw_ostream &os, unsigned RegNo,
const TargetRegisterInfo *TRI = 0) {
- if (!RegNo || TargetRegisterInfo::isPhysicalRegister(RegNo)) {
+ if (RegNo != 0 && TargetRegisterInfo::isPhysicalRegister(RegNo)) {
if (TRI)
os << " %" << TRI->get(RegNo).Name;
else
- os << " %mreg(" << RegNo << ")";
+ os << " %physreg" << RegNo;
} else
os << " %reg" << RegNo;
}
@@ -178,19 +179,23 @@ void MachineBasicBlock::print(raw_ostream &OS) const {
return;
}
- const BasicBlock *LBB = getBasicBlock();
+ if (Alignment) { OS << "Alignment " << Alignment << "\n"; }
+
+ OS << "BB#" << getNumber() << ": ";
+
+ const char *Comma = "";
+ if (const BasicBlock *LBB = getBasicBlock()) {
+ OS << Comma << "derived from LLVM BB ";
+ WriteAsOperand(OS, LBB, /*PrintType=*/false);
+ Comma = ", ";
+ }
+ if (isLandingPad()) { OS << Comma << "EH LANDING PAD"; Comma = ", "; }
+ if (hasAddressTaken()) { OS << Comma << "ADDRESS TAKEN"; Comma = ", "; }
OS << '\n';
- if (LBB) OS << LBB->getName() << ": ";
- OS << (const void*)this
- << ", LLVM BB @" << (const void*) LBB << ", ID#" << getNumber();
- if (Alignment) OS << ", Alignment " << Alignment;
- if (isLandingPad()) OS << ", EH LANDING PAD";
- if (hasAddressTaken()) OS << ", ADDRESS TAKEN";
- OS << ":\n";
const TargetRegisterInfo *TRI = MF->getTarget().getRegisterInfo();
if (!livein_empty()) {
- OS << "Live Ins:";
+ OS << " Live Ins:";
for (const_livein_iterator I = livein_begin(),E = livein_end(); I != E; ++I)
OutputReg(OS, *I, TRI);
OS << '\n';
@@ -199,7 +204,7 @@ void MachineBasicBlock::print(raw_ostream &OS) const {
if (!pred_empty()) {
OS << " Predecessors according to CFG:";
for (const_pred_iterator PI = pred_begin(), E = pred_end(); PI != E; ++PI)
- OS << ' ' << *PI << " (#" << (*PI)->getNumber() << ')';
+ OS << " BB#" << (*PI)->getNumber();
OS << '\n';
}
@@ -212,7 +217,7 @@ void MachineBasicBlock::print(raw_ostream &OS) const {
if (!succ_empty()) {
OS << " Successors according to CFG:";
for (const_succ_iterator SI = succ_begin(), E = succ_end(); SI != E; ++SI)
- OS << ' ' << *SI << " (#" << (*SI)->getNumber() << ')';
+ OS << " BB#" << (*SI)->getNumber();
OS << '\n';
}
}
OpenPOWER on IntegriCloud