[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp LiveInterval.cpp VirtRegMap.cpp VirtRegMap.h
Bill Wendling
isanbard at gmail.com
Sat Dec 16 21:15:53 PST 2006
Changes in directory llvm/lib/CodeGen:
DwarfWriter.cpp updated: 1.107 -> 1.108
LiveInterval.cpp updated: 1.42 -> 1.43
VirtRegMap.cpp updated: 1.90 -> 1.91
VirtRegMap.h updated: 1.24 -> 1.25
---
Log message:
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.
---
Diffs of the changes: (+15 -17)
DwarfWriter.cpp | 16 ++++++++--------
LiveInterval.cpp | 2 +-
VirtRegMap.cpp | 8 +-------
VirtRegMap.h | 6 +++++-
4 files changed, 15 insertions(+), 17 deletions(-)
Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.107 llvm/lib/CodeGen/DwarfWriter.cpp:1.108
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.107 Wed Dec 6 19:30:31 2006
+++ llvm/lib/CodeGen/DwarfWriter.cpp Sat Dec 16 23:15:12 2006
@@ -137,8 +137,8 @@
}
#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 @@
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 @@
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 @@
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();
Index: llvm/lib/CodeGen/LiveInterval.cpp
diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.42 llvm/lib/CodeGen/LiveInterval.cpp:1.43
--- llvm/lib/CodeGen/LiveInterval.cpp:1.42 Fri Dec 15 20:15:42 2006
+++ llvm/lib/CodeGen/LiveInterval.cpp Sat Dec 16 23:15:13 2006
@@ -475,7 +475,7 @@
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
Index: llvm/lib/CodeGen/VirtRegMap.cpp
diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.90 llvm/lib/CodeGen/VirtRegMap.cpp:1.91
--- llvm/lib/CodeGen/VirtRegMap.cpp:1.90 Fri Dec 15 00:41:01 2006
+++ llvm/lib/CodeGen/VirtRegMap.cpp Sat Dec 16 23:15:13 2006
@@ -113,11 +113,6 @@
}
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::dump() const {
- OStream OS = DOUT;
- print(OS);
+ print(DOUT);
}
Index: llvm/lib/CodeGen/VirtRegMap.h
diff -u llvm/lib/CodeGen/VirtRegMap.h:1.24 llvm/lib/CodeGen/VirtRegMap.h:1.25
--- llvm/lib/CodeGen/VirtRegMap.h:1.24 Wed Dec 6 19:30:31 2006
+++ llvm/lib/CodeGen/VirtRegMap.h Sat Dec 16 23:15:13 2006
@@ -145,10 +145,14 @@
}
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;
More information about the llvm-commits
mailing list