An even better unbreakage...

llvm-svn: 32617
This commit is contained in:
Jeff Cohen 2006-12-15 22:57:14 +00:00
parent 884bc09d10
commit b82309f1ab
6 changed files with 28 additions and 18 deletions

View File

@ -26,7 +26,6 @@
#include <iosfwd> #include <iosfwd>
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include <ostream>
namespace llvm { namespace llvm {
class MRegisterInfo; class MRegisterInfo;
@ -63,10 +62,7 @@ namespace llvm {
}; };
std::ostream& operator<<(std::ostream& os, const LiveRange &LR); std::ostream& operator<<(std::ostream& os, const LiveRange &LR);
inline OStream& operator<<(OStream& os, const LiveRange &LR) { OStream& operator<<(OStream& os, const LiveRange &LR);
if (os.stream()) *os.stream() << LR;
return os;
}
inline bool operator<(unsigned V, const LiveRange &LR) { inline bool operator<(unsigned V, const LiveRange &LR) {
return V < LR.start; return V < LR.start;

View File

@ -226,10 +226,7 @@ private: // Methods used to maintain doubly linked list of blocks...
}; };
std::ostream& operator<<(std::ostream &OS, const MachineBasicBlock &MBB); std::ostream& operator<<(std::ostream &OS, const MachineBasicBlock &MBB);
inline OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB){ OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB);
if (OS.stream()) *OS.stream() << MBB;
return OS;
}
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
// GraphTraits specializations for machine basic block graphs (machine-CFGs) // GraphTraits specializations for machine basic block graphs (machine-CFGs)

View File

@ -22,7 +22,6 @@
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include <iosfwd> #include <iosfwd>
#include <ostream>
namespace llvm { namespace llvm {
@ -286,10 +285,7 @@ public:
IsDead = false; IsDead = false;
} }
friend OStream& operator<<(OStream& os, const MachineOperand& mop) { friend OStream& operator<<(OStream& os, const MachineOperand& mop);
if (os.stream()) *os.stream() << mop;
return os;
}
friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop); friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop);
friend class MachineInstr; friend class MachineInstr;
@ -403,10 +399,7 @@ public:
} }
void print(std::ostream &OS, const TargetMachine *TM) const; void print(std::ostream &OS, const TargetMachine *TM) const;
void dump() const; void dump() const;
friend OStream& operator<<(OStream& os, const MachineInstr& minstr){ friend OStream& operator<<(OStream& os, const MachineInstr& minstr);
if (os.stream()) *os.stream() << minstr;
return os;
}
friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr); friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr);
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//

View File

@ -24,6 +24,7 @@
#include "llvm/Target/MRegisterInfo.h" #include "llvm/Target/MRegisterInfo.h"
#include <algorithm> #include <algorithm>
#include <map> #include <map>
#include <ostream>
using namespace llvm; using namespace llvm;
// An example for liveAt(): // An example for liveAt():
@ -509,3 +510,9 @@ void LiveInterval::print(OStream OS, const MRegisterInfo *MRI) const {
void LiveInterval::dump() const { void LiveInterval::dump() const {
cerr << *this << "\n"; cerr << *this << "\n";
} }
OStream& llvm::operator<<(OStream& os, const LiveRange &LR) {
if (os.stream()) *os.stream() << LR;
return os;
}

View File

@ -31,6 +31,11 @@ std::ostream& llvm::operator<<(std::ostream &OS, const MachineBasicBlock &MBB) {
return OS; return OS;
} }
OStream& llvm::operator<<(OStream &OS, const MachineBasicBlock &MBB) {
if (OS.stream()) *OS.stream() << MBB;
return OS;
}
// MBBs start out as #-1. When a MBB is added to a MachineFunction, it // MBBs start out as #-1. When a MBB is added to a MachineFunction, it
// gets the next available unique MBB number. If it is removed from a // gets the next available unique MBB number. If it is removed from a
// MachineFunction, it goes back to being #-1. // MachineFunction, it goes back to being #-1.

View File

@ -18,6 +18,7 @@
#include "llvm/Target/MRegisterInfo.h" #include "llvm/Target/MRegisterInfo.h"
#include "llvm/Support/LeakDetector.h" #include "llvm/Support/LeakDetector.h"
#include "llvm/Support/Streams.h" #include "llvm/Support/Streams.h"
#include <ostream>
using namespace llvm; using namespace llvm;
/// MachineInstr ctor - This constructor creates a dummy MachineInstr with /// MachineInstr ctor - This constructor creates a dummy MachineInstr with
@ -363,3 +364,14 @@ std::ostream &llvm::operator<<(std::ostream &OS, const MachineOperand &MO) {
return OS; return OS;
} }
OStream& llvm::operator<<(OStream& os, const MachineInstr& minstr) {
if (os.stream()) *os.stream() << minstr;
return os;
}
OStream& llvm::operator<<(OStream& os, const MachineOperand& mop) {
if (os.stream()) *os.stream() << mop;
return os;
}