aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/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
commit5c7e326585f3a543388ba871c3425f7664cd9143 (patch)
tree85de3d1ef8b725fb5db8a5e36c5d312da657cab6 /include/llvm/CodeGen
parent89b0d995d26d9e70b9c8d7fab8b99f1e89ac11bb (diff)
downloadexternal_llvm-5c7e326585f3a543388ba871c3425f7664cd9143.tar.gz
external_llvm-5c7e326585f3a543388ba871c3425f7664cd9143.tar.bz2
external_llvm-5c7e326585f3a543388ba871c3425f7664cd9143.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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/LinkAllCodegenComponents.h1
-rw-r--r--include/llvm/CodeGen/LiveInterval.h16
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h3
-rw-r--r--include/llvm/CodeGen/MachineBasicBlock.h8
-rw-r--r--include/llvm/CodeGen/MachineConstantPool.h13
-rw-r--r--include/llvm/CodeGen/MachineFunction.h1
-rw-r--r--include/llvm/CodeGen/MachineInstr.h14
-rw-r--r--include/llvm/CodeGen/MachineJumpTableInfo.h1
-rw-r--r--include/llvm/CodeGen/SchedGraphCommon.h17
9 files changed, 19 insertions, 55 deletions
diff --git a/include/llvm/CodeGen/LinkAllCodegenComponents.h b/include/llvm/CodeGen/LinkAllCodegenComponents.h
index 5c39b505fe..1cf75bf01f 100644
--- a/include/llvm/CodeGen/LinkAllCodegenComponents.h
+++ b/include/llvm/CodeGen/LinkAllCodegenComponents.h
@@ -31,6 +31,7 @@ namespace {
(void) llvm::createSimpleRegisterAllocator();
(void) llvm::createLocalRegisterAllocator();
(void) llvm::createLinearScanRegisterAllocator();
+ (void) llvm::createGraphColoringRegisterAllocator();
(void) llvm::createBFS_DAGScheduler(NULL, NULL, NULL);
(void) llvm::createSimpleDAGScheduler(NULL, NULL, NULL);
diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h
index b22922c84c..367cefeb36 100644
--- a/include/llvm/CodeGen/LiveInterval.h
+++ b/include/llvm/CodeGen/LiveInterval.h
@@ -57,16 +57,13 @@ namespace llvm {
void dump() const;
void print(std::ostream &os) const;
+ void print(std::ostream *os) const { if (os) print(*os); }
private:
LiveRange(); // DO NOT IMPLEMENT
};
std::ostream& operator<<(std::ostream& os, const LiveRange &LR);
- inline OStream& operator<<(OStream& os, const LiveRange &LR) {
- if (os.stream()) LR.print(*os.stream());
- return os;
- }
inline bool operator<(unsigned V, const LiveRange &LR) {
@@ -260,9 +257,9 @@ namespace llvm {
return beginNumber() < other.beginNumber();
}
- void print(OStream OS, const MRegisterInfo *MRI = 0) const;
- void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const {
- print(OStream(OS), MRI);
+ void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const;
+ void print(std::ostream *OS, const MRegisterInfo *MRI = 0) const {
+ if (OS) print(*OS, MRI);
}
void dump() const;
@@ -273,11 +270,6 @@ namespace llvm {
LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT
};
- inline OStream &operator<<(OStream &OS, const LiveInterval &LI) {
- LI.print(OS);
- return OS;
- }
-
inline std::ostream &operator<<(std::ostream &OS, const LiveInterval &LI) {
LI.print(OS);
return OS;
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index 11f836b99a..e0f60452e3 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -161,6 +161,9 @@ namespace llvm {
/// print - Implement the dump method.
virtual void print(std::ostream &O, const Module* = 0) const;
+ void print(std::ostream *O, const Module* M = 0) const {
+ if (O) print(*O, M);
+ }
private:
/// RemoveMachineInstrFromMaps - This marks the specified machine instr as
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index 896d9efe03..1fd36ed55a 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/include/llvm/CodeGen/MachineBasicBlock.h
@@ -189,10 +189,8 @@ public:
// Debugging methods.
void dump() const;
- void print(OStream &OS) const {
- if (OS.stream()) print(*OS.stream());
- }
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// getNumber - MachineBasicBlocks are uniquely numbered at the function
/// level, unless they're not in a MachineFunction yet, in which case this
@@ -226,10 +224,6 @@ 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()) MBB.print(*OS.stream());
- 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 bc701f6b86..ffd0e55663 100644
--- a/include/llvm/CodeGen/MachineConstantPool.h
+++ b/include/llvm/CodeGen/MachineConstantPool.h
@@ -49,17 +49,10 @@ public:
/// print - Implement operator<<...
///
- void print(OStream &O) const {
- if (O.stream()) print(*O.stream());
- }
virtual void print(std::ostream &O) const = 0;
+ void print(std::ostream *O) const { if (O) print(*O); }
};
-inline OStream &operator<<(OStream &OS,
- const MachineConstantPoolValue &V) {
- V.print(OS);
- return OS;
-}
inline std::ostream &operator<<(std::ostream &OS,
const MachineConstantPoolValue &V) {
V.print(OS);
@@ -143,10 +136,8 @@ public:
/// print - Used by the MachineFunction printer to print information about
/// constant pool objects. Implemented in MachineFunction.cpp
///
- void print(OStream &OS) const {
- if (OS.stream()) print(*OS.stream());
- }
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// dump - Call print(std::cerr) to be called from the debugger.
///
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index f264c91c11..c393b07aaf 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -238,6 +238,7 @@ public:
/// to the specified stream.
///
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// viewCFG - This function is meant for use from the debugger. You can just
/// say 'call F->viewCFG()' and a ghostview window should pop up from the
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 77de83768e..ad2ccdf8ca 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -78,6 +78,7 @@ private:
MachineOperand() {}
void print(std::ostream &os) const;
+ void print(std::ostream *os) const { if (os) print(*os); }
public:
MachineOperand(const MachineOperand &M) {
@@ -288,10 +289,6 @@ public:
IsDead = false;
}
- friend OStream& operator<<(OStream& os, const MachineOperand& mop) {
- if (os.stream()) mop.print(*os.stream());
- return os;
- }
friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop) {
mop.print(os);
return os;
@@ -403,16 +400,13 @@ public:
//
// Debugging support
//
- void print(OStream &OS, const TargetMachine *TM) const {
- if (OS.stream()) print(*OS.stream(), TM);
+ void print(std::ostream *OS, const TargetMachine *TM) const {
+ if (OS) print(*OS, TM);
}
void print(std::ostream &OS, const TargetMachine *TM) const;
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
void dump() const;
- friend OStream& operator<<(OStream& os, const MachineInstr& minstr) {
- if (os.stream()) minstr.print(*os.stream());
- return os;
- }
friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr){
minstr.print(os);
return os;
diff --git a/include/llvm/CodeGen/MachineJumpTableInfo.h b/include/llvm/CodeGen/MachineJumpTableInfo.h
index 8064fa431c..404ed15fd9 100644
--- a/include/llvm/CodeGen/MachineJumpTableInfo.h
+++ b/include/llvm/CodeGen/MachineJumpTableInfo.h
@@ -90,6 +90,7 @@ public:
/// jump tables. Implemented in MachineFunction.cpp
///
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// dump - Call print(std::cerr) to be called from the debugger.
///
diff --git a/include/llvm/CodeGen/SchedGraphCommon.h b/include/llvm/CodeGen/SchedGraphCommon.h
index 7da2f732ba..4fcd9acc0e 100644
--- a/include/llvm/CodeGen/SchedGraphCommon.h
+++ b/include/llvm/CodeGen/SchedGraphCommon.h
@@ -70,10 +70,8 @@ public:
void dump(int indent=0) const;
// Debugging support
- void print(OStream &os) const {
- if (os.stream()) print(*os.stream());
- }
virtual void print(std::ostream &os) const = 0;
+ void print(std::ostream *os) const { if (os) print(*os); }
protected:
friend class SchedGraphCommon;
@@ -96,11 +94,6 @@ protected:
};
// ostream << operator for SchedGraphNode class
-inline OStream &operator<<(OStream &os,
- const SchedGraphNodeCommon &node) {
- node.print(os);
- return os;
-}
inline std::ostream &operator<<(std::ostream &os,
const SchedGraphNodeCommon &node) {
node.print(os);
@@ -188,10 +181,8 @@ public:
public:
// Debugging support
- void print(OStream &os) const {
- if (os.stream()) print(*os.stream());
- }
void print(std::ostream &os) const;
+ void print(std::ostream *os) const { if (os) print(*os); }
void dump(int indent=0) const;
private:
@@ -200,10 +191,6 @@ private:
};
// ostream << operator for SchedGraphNode class
-inline OStream &operator<<(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;