From c21c5eeb4f56f160e79522df2d3aab5cfe73c05d Mon Sep 17 00:00:00 2001 From: Jeff Cohen Date: Fri, 15 Dec 2006 22:57:14 +0000 Subject: [PATCH] An even better unbreakage... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32617 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/LiveInterval.h | 6 +----- include/llvm/CodeGen/MachineBasicBlock.h | 5 +---- include/llvm/CodeGen/MachineInstr.h | 11 ++--------- lib/CodeGen/LiveInterval.cpp | 7 +++++++ lib/CodeGen/MachineBasicBlock.cpp | 5 +++++ lib/CodeGen/MachineInstr.cpp | 12 ++++++++++++ 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h index 8181a2093d4..a64af87d912 100644 --- a/include/llvm/CodeGen/LiveInterval.h +++ b/include/llvm/CodeGen/LiveInterval.h @@ -26,7 +26,6 @@ #include #include #include -#include namespace llvm { class MRegisterInfo; @@ -63,10 +62,7 @@ namespace llvm { }; std::ostream& operator<<(std::ostream& os, const LiveRange &LR); - inline OStream& operator<<(OStream& os, const LiveRange &LR) { - if (os.stream()) *os.stream() << LR; - return os; - } + OStream& operator<<(OStream& os, const LiveRange &LR); inline bool operator<(unsigned V, const LiveRange &LR) { return V < LR.start; diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h index c848b065b46..4cf6a24e450 100644 --- a/include/llvm/CodeGen/MachineBasicBlock.h +++ b/include/llvm/CodeGen/MachineBasicBlock.h @@ -226,10 +226,7 @@ private: // Methods used to maintain doubly linked list of blocks... }; std::ostream& operator<<(std::ostream &OS, const MachineBasicBlock &MBB); -inline OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB){ - if (OS.stream()) *OS.stream() << MBB; - return OS; -} +OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB); //===--------------------------------------------------------------------===// // GraphTraits specializations for machine basic block graphs (machine-CFGs) diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index 181a6414a61..e19a3ebfbe8 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -22,7 +22,6 @@ #include #include #include -#include namespace llvm { @@ -286,10 +285,7 @@ public: IsDead = false; } - friend OStream& operator<<(OStream& os, const MachineOperand& mop) { - if (os.stream()) *os.stream() << mop; - return os; - } + friend OStream& operator<<(OStream& os, const MachineOperand& mop); friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop); friend class MachineInstr; @@ -403,10 +399,7 @@ public: } void print(std::ostream &OS, const TargetMachine *TM) const; void dump() const; - friend OStream& operator<<(OStream& os, const MachineInstr& minstr){ - if (os.stream()) *os.stream() << minstr; - return os; - } + friend OStream& operator<<(OStream& os, const MachineInstr& minstr); friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr); //===--------------------------------------------------------------------===// diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp index e2a3bbaaf0b..78c874cbb93 100644 --- a/lib/CodeGen/LiveInterval.cpp +++ b/lib/CodeGen/LiveInterval.cpp @@ -24,6 +24,7 @@ #include "llvm/Target/MRegisterInfo.h" #include #include +#include using namespace llvm; // An example for liveAt(): @@ -509,3 +510,9 @@ void LiveInterval::print(OStream OS, const MRegisterInfo *MRI) const { void LiveInterval::dump() const { cerr << *this << "\n"; } + + +OStream& llvm::operator<<(OStream& os, const LiveRange &LR) { + if (os.stream()) *os.stream() << LR; + return os; +} diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp index a626f4fdd15..39b142a2f35 100644 --- a/lib/CodeGen/MachineBasicBlock.cpp +++ b/lib/CodeGen/MachineBasicBlock.cpp @@ -31,6 +31,11 @@ std::ostream& llvm::operator<<(std::ostream &OS, const MachineBasicBlock &MBB) { 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 // gets the next available unique MBB number. If it is removed from a // MachineFunction, it goes back to being #-1. diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 716b40fbf1c..a68442511b4 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -18,6 +18,7 @@ #include "llvm/Target/MRegisterInfo.h" #include "llvm/Support/LeakDetector.h" #include "llvm/Support/Streams.h" +#include using namespace llvm; /// 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; } + +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; +} +