aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/LiveInterval.h8
-rw-r--r--include/llvm/CodeGen/MachineBasicBlock.h9
-rw-r--r--include/llvm/CodeGen/MachineConstantPool.h12
-rw-r--r--include/llvm/CodeGen/MachineInstr.h12
-rw-r--r--include/llvm/CodeGen/SchedGraphCommon.h19
5 files changed, 54 insertions, 6 deletions
diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h
index b4ceb14533..1b3ccadf25 100644
--- a/include/llvm/CodeGen/LiveInterval.h
+++ b/include/llvm/CodeGen/LiveInterval.h
@@ -60,7 +60,12 @@ namespace llvm {
private:
LiveRange(); // DO NOT IMPLEMENT
};
+
std::ostream& operator<<(std::ostream& os, const LiveRange &LR);
+ inline llvm_ostream& operator<<(llvm_ostream& os, const LiveRange &LR) {
+ if (os.stream()) *os.stream() << LR;
+ return os;
+ }
inline bool operator<(unsigned V, const LiveRange &LR) {
return V < LR.start;
@@ -273,8 +278,7 @@ namespace llvm {
}
inline std::ostream &operator<<(std::ostream &OS, const LiveInterval &LI) {
- llvm_ostream L(OS);
- L << LI;
+ LI.print(OS);
return OS;
}
}
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index eec3b3cf3b..f714c735f3 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/include/llvm/CodeGen/MachineBasicBlock.h
@@ -17,6 +17,7 @@
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/ilist"
+#include "llvm/Support/Streams.h"
namespace llvm {
class MachineFunction;
@@ -188,6 +189,9 @@ public:
// Debugging methods.
void dump() const;
+ void print(llvm_ostream &OS) const {
+ if (OS.stream()) print(*OS.stream());
+ }
void print(std::ostream &OS) const;
/// getNumber - MachineBasicBlocks are uniquely numbered at the function
@@ -222,7 +226,10 @@ private: // Methods used to maintain doubly linked list of blocks...
};
std::ostream& operator<<(std::ostream &OS, const MachineBasicBlock &MBB);
-
+inline llvm_ostream& operator<<(llvm_ostream &OS, const MachineBasicBlock &MBB){
+ if (OS.stream()) *OS.stream() << MBB;
+ return OS;
+}
//===--------------------------------------------------------------------===//
// GraphTraits specializations for machine basic block graphs (machine-CFGs)
diff --git a/include/llvm/CodeGen/MachineConstantPool.h b/include/llvm/CodeGen/MachineConstantPool.h
index f45c8a7a8d..6bb2665985 100644
--- a/include/llvm/CodeGen/MachineConstantPool.h
+++ b/include/llvm/CodeGen/MachineConstantPool.h
@@ -17,6 +17,7 @@
#include "llvm/ADT/FoldingSet.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
+#include "llvm/Support/Streams.h"
#include <vector>
#include <iosfwd>
@@ -48,9 +49,17 @@ public:
/// print - Implement operator<<...
///
+ void print(llvm_ostream &O) const {
+ if (O.stream()) print(*O.stream());
+ }
virtual void print(std::ostream &O) const = 0;
};
+inline llvm_ostream &operator<<(llvm_ostream &OS,
+ const MachineConstantPoolValue &V) {
+ V.print(OS);
+ return OS;
+}
inline std::ostream &operator<<(std::ostream &OS,
const MachineConstantPoolValue &V) {
V.print(OS);
@@ -134,6 +143,9 @@ public:
/// print - Used by the MachineFunction printer to print information about
/// constant pool objects. Implemented in MachineFunction.cpp
///
+ void print(llvm_ostream &OS) const {
+ if (OS.stream()) print(*OS.stream());
+ }
void print(std::ostream &OS) const;
/// dump - Call print(std::cerr) to be called from the debugger.
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 1aa8b40e7e..11a769c930 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/iterator"
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/Streams.h"
#include <vector>
#include <cassert>
#include <iosfwd>
@@ -284,6 +285,10 @@ public:
IsDead = false;
}
+ friend llvm_ostream& operator<<(llvm_ostream& os, const MachineOperand& mop) {
+ if (os.stream()) *os.stream() << mop;
+ return os;
+ }
friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop);
friend class MachineInstr;
@@ -400,8 +405,15 @@ public:
//
// Debugging support
//
+ void print(llvm_ostream &OS, const TargetMachine *TM) const {
+ if (OS.stream()) print(*OS.stream(), TM);
+ }
void print(std::ostream &OS, const TargetMachine *TM) const;
void dump() const;
+ friend llvm_ostream& operator<<(llvm_ostream& os, const MachineInstr& minstr){
+ if (os.stream()) *os.stream() << minstr;
+ return os;
+ }
friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr);
//===--------------------------------------------------------------------===//
diff --git a/include/llvm/CodeGen/SchedGraphCommon.h b/include/llvm/CodeGen/SchedGraphCommon.h
index 4f6e2ad32f..b4cee969e1 100644
--- a/include/llvm/CodeGen/SchedGraphCommon.h
+++ b/include/llvm/CodeGen/SchedGraphCommon.h
@@ -17,6 +17,7 @@
#include "llvm/Value.h"
#include "llvm/ADT/iterator"
+#include "llvm/Support/Streams.h"
#include <vector>
namespace llvm {
@@ -69,6 +70,9 @@ public:
void dump(int indent=0) const;
// Debugging support
+ void print(llvm_ostream &os) const {
+ if (os.stream()) print(*os.stream());
+ }
virtual void print(std::ostream &os) const = 0;
protected:
@@ -92,15 +96,17 @@ protected:
};
// ostream << operator for SchedGraphNode class
+inline llvm_ostream &operator<<(llvm_ostream &os,
+ const SchedGraphNodeCommon &node) {
+ node.print(os);
+ return os;
+}
inline std::ostream &operator<<(std::ostream &os,
const SchedGraphNodeCommon &node) {
node.print(os);
return os;
}
-
-
-
//
// SchedGraphEdge - Edge class to represent dependencies
//
@@ -182,6 +188,9 @@ public:
public:
// Debugging support
+ void print(llvm_ostream &os) const {
+ if (os.stream()) print(*os.stream());
+ }
void print(std::ostream &os) const;
void dump(int indent=0) const;
@@ -191,6 +200,10 @@ private:
};
// ostream << operator for SchedGraphNode class
+inline llvm_ostream &operator<<(llvm_ostream &os, const SchedGraphEdge &edge) {
+ edge.print(os);
+ return os;
+}
inline std::ostream &operator<<(std::ostream &os, const SchedGraphEdge &edge) {
edge.print(os);
return os;