summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2006-12-17 05:15:13 +0000
committerBill Wendling <isanbard@gmail.com>2006-12-17 05:15:13 +0000
commita77f14265b2f6286743d97ab1a59ba32ac0603b3 (patch)
treedbe9a1b4969c93258f96f3f3d8a6da9c0de9f3f9 /llvm/lib/CodeGen
parent05a1fe5bf59f0cf9b63bc2370cb4a21752c73b12 (diff)
downloadbcm5719-llvm-a77f14265b2f6286743d97ab1a59ba32ac0603b3.tar.gz
bcm5719-llvm-a77f14265b2f6286743d97ab1a59ba32ac0603b3.zip
Added an automatic cast to "std::ostream*" etc. from OStream. We then can
rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. llvm-svn: 32636
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/DwarfWriter.cpp16
-rw-r--r--llvm/lib/CodeGen/LiveInterval.cpp2
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp24
-rw-r--r--llvm/lib/CodeGen/VirtRegMap.cpp8
-rw-r--r--llvm/lib/CodeGen/VirtRegMap.h6
5 files changed, 28 insertions, 28 deletions
diff --git a/llvm/lib/CodeGen/DwarfWriter.cpp b/llvm/lib/CodeGen/DwarfWriter.cpp
index 8f623962188..2500d58fdf0 100644
--- a/llvm/lib/CodeGen/DwarfWriter.cpp
+++ b/llvm/lib/CodeGen/DwarfWriter.cpp
@@ -137,8 +137,8 @@ public:
}
#ifndef NDEBUG
- void print(OStream &O) const {
- if (O.stream()) print(*O.stream());
+ void print(std::ostream *O) const {
+ if (O) print(*O);
}
void print(std::ostream &O) const {
O << ".debug_" << Tag;
@@ -245,8 +245,8 @@ public:
void Emit(const Dwarf &DW) const;
#ifndef NDEBUG
- void print(OStream &O) {
- if (O.stream()) print(*O.stream());
+ void print(std::ostream *O) {
+ if (O) print(*O);
}
void print(std::ostream &O);
void dump();
@@ -335,8 +335,8 @@ public:
void Profile(FoldingSetNodeID &ID) ;
#ifndef NDEBUG
- void print(OStream &O, unsigned IncIndent = 0) {
- if (O.stream()) print(*O.stream(), IncIndent);
+ void print(std::ostream *O, unsigned IncIndent = 0) {
+ if (O) print(*O, IncIndent);
}
void print(std::ostream &O, unsigned IncIndent = 0);
void dump();
@@ -386,8 +386,8 @@ public:
virtual void Profile(FoldingSetNodeID &ID) = 0;
#ifndef NDEBUG
- void print(OStream &O) {
- if (O.stream()) print(*O.stream());
+ void print(std::ostream *O) {
+ if (O) print(*O);
}
virtual void print(std::ostream &O) = 0;
void dump();
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp
index 63a80fd16ea..0ca16007b2d 100644
--- a/llvm/lib/CodeGen/LiveInterval.cpp
+++ b/llvm/lib/CodeGen/LiveInterval.cpp
@@ -475,7 +475,7 @@ void LiveRange::dump() const {
cerr << *this << "\n";
}
-void LiveInterval::print(OStream OS, const MRegisterInfo *MRI) const {
+void LiveInterval::print(std::ostream &OS, const MRegisterInfo *MRI) const {
if (MRI && MRegisterInfo::isPhysicalRegister(reg))
OS << MRI->getName(reg);
else
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp
index 65da788961b..0b10a22fc44 100644
--- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp
@@ -473,7 +473,8 @@ private:
/// print - Print ordering to specified output stream.
///
- void print(OStream &O) const;
+ void print(std::ostream &O) const;
+ void print(std::ostream *O) const { if (O) print(*O); }
void dump(const char *tag) const;
@@ -485,7 +486,8 @@ private:
/// printNI - Print node info.
///
- void printNI(OStream &O, NodeInfo *NI) const;
+ void printNI(std::ostream &O, NodeInfo *NI) const;
+ void printNI(std::ostream *O, NodeInfo *NI) const { if (O) printNI(O, NI); }
/// printChanges - Hilight changes in order caused by scheduling.
///
@@ -636,7 +638,7 @@ void ScheduleDAGSimple::AddToGroup(NodeInfo *D, NodeInfo *U) {
/// print - Print ordering to specified output stream.
///
-void ScheduleDAGSimple::print(OStream &O) const {
+void ScheduleDAGSimple::print(std::ostream &O) const {
#ifndef NDEBUG
O << "Ordering\n";
for (unsigned i = 0, N = Ordering.size(); i < N; i++) {
@@ -710,16 +712,16 @@ static bool isFlagUser(SDNode *A) {
/// printNI - Print node info.
///
-void ScheduleDAGSimple::printNI(OStream &O, NodeInfo *NI) const {
+void ScheduleDAGSimple::printNI(std::ostream &O, NodeInfo *NI) const {
#ifndef NDEBUG
SDNode *Node = NI->Node;
- *(O.stream()) << " "
- << std::hex << Node << std::dec
- << ", Lat=" << NI->Latency
- << ", Slot=" << NI->Slot
- << ", ARITY=(" << Node->getNumOperands() << ","
- << Node->getNumValues() << ")"
- << " " << Node->getOperationName(&DAG);
+ O << " "
+ << std::hex << Node << std::dec
+ << ", Lat=" << NI->Latency
+ << ", Slot=" << NI->Slot
+ << ", ARITY=(" << Node->getNumOperands() << ","
+ << Node->getNumValues() << ")"
+ << " " << Node->getOperationName(&DAG);
if (isFlagDefiner(Node)) O << "<#";
if (isFlagUser(Node)) O << ">#";
#endif
diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp
index 82c88edb7e2..26b6eebf429 100644
--- a/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/llvm/lib/CodeGen/VirtRegMap.cpp
@@ -113,11 +113,6 @@ void VirtRegMap::virtFolded(unsigned VirtReg, MachineInstr *OldMI,
}
void VirtRegMap::print(std::ostream &OS) const {
- OStream LOS(OS);
- print(LOS);
-}
-
-void VirtRegMap::print(OStream &OS) const {
const MRegisterInfo* MRI = MF.getTarget().getRegisterInfo();
OS << "********** REGISTER MAP **********\n";
@@ -136,8 +131,7 @@ void VirtRegMap::print(OStream &OS) const {
}
void VirtRegMap::dump() const {
- OStream OS = DOUT;
- print(OS);
+ print(DOUT);
}
diff --git a/llvm/lib/CodeGen/VirtRegMap.h b/llvm/lib/CodeGen/VirtRegMap.h
index 342d800242c..84cf2380350 100644
--- a/llvm/lib/CodeGen/VirtRegMap.h
+++ b/llvm/lib/CodeGen/VirtRegMap.h
@@ -145,10 +145,14 @@ namespace llvm {
}
void print(std::ostream &OS) const;
- void print(OStream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
void dump() const;
};
+ inline std::ostream *operator<<(std::ostream *OS, const VirtRegMap &VRM) {
+ VRM.print(OS);
+ return OS;
+ }
inline std::ostream &operator<<(std::ostream &OS, const VirtRegMap &VRM) {
VRM.print(OS);
return OS;
OpenPOWER on IntegriCloud