Added a temporary hack to get the llvm-streams to work for future checkins.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31978 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2006-11-28 22:21:29 +00:00
parent d4d9ab80b7
commit b5ebf15b2b
14 changed files with 114 additions and 7 deletions

View File

@ -25,6 +25,7 @@
#ifndef LLVM_ADT_BITSETVECTOR_H #ifndef LLVM_ADT_BITSETVECTOR_H
#define LLVM_ADT_BITSETVECTOR_H #define LLVM_ADT_BITSETVECTOR_H
#include "llvm/Support/Streams.h"
#include <bitset> #include <bitset>
#include <vector> #include <vector>
#include <functional> #include <functional>
@ -173,6 +174,9 @@ public:
/// ///
/// Printing and debugging support /// Printing and debugging support
/// ///
void print(llvm_ostream &O) const {
if (O.stream()) print(*O.stream());
}
void print(std::ostream &O) const; void print(std::ostream &O) const;
void dump() const { print(std::cerr); } void dump() const { print(std::cerr); }
@ -248,6 +252,10 @@ inline void BitSetVector::print(std::ostream& O) const
O << "<" << (*I) << ">" << (I+1 == E? "\n" : ", "); O << "<" << (*I) << ">" << (I+1 == E? "\n" : ", ");
} }
inline llvm_ostream& operator<< (llvm_ostream& O, const BitSetVector& bset) {
bset.print(O);
return O;
}
inline std::ostream& operator<< (std::ostream& O, const BitSetVector& bset) inline std::ostream& operator<< (std::ostream& O, const BitSetVector& bset)
{ {
bset.print(O); bset.print(O);

View File

@ -18,6 +18,7 @@
#define LLVM_ANALYSIS_ALIASSETTRACKER_H #define LLVM_ANALYSIS_ALIASSETTRACKER_H
#include "llvm/Support/CallSite.h" #include "llvm/Support/CallSite.h"
#include "llvm/Support/Streams.h"
#include "llvm/ADT/iterator" #include "llvm/ADT/iterator"
#include "llvm/ADT/hash_map" #include "llvm/ADT/hash_map"
#include "llvm/ADT/ilist" #include "llvm/ADT/ilist"
@ -155,6 +156,9 @@ public:
iterator end() const { return iterator(); } iterator end() const { return iterator(); }
bool empty() const { return PtrList == 0; } bool empty() const { return PtrList == 0; }
void print(llvm_ostream &OS) const {
if (OS.stream()) print(*OS.stream());
}
void print(std::ostream &OS) const; void print(std::ostream &OS) const;
void dump() const; void dump() const;
@ -244,6 +248,10 @@ private:
bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const; bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const;
}; };
inline llvm_ostream& operator<<(llvm_ostream &OS, const AliasSet &AS) {
AS.print(OS);
return OS;
}
inline std::ostream& operator<<(std::ostream &OS, const AliasSet &AS) { inline std::ostream& operator<<(std::ostream &OS, const AliasSet &AS) {
AS.print(OS); AS.print(OS);
return OS; return OS;
@ -353,6 +361,9 @@ public:
iterator begin() { return AliasSets.begin(); } iterator begin() { return AliasSets.begin(); }
iterator end() { return AliasSets.end(); } iterator end() { return AliasSets.end(); }
void print(llvm_ostream &OS) const {
if (OS.stream()) print(*OS.stream());
}
void print(std::ostream &OS) const; void print(std::ostream &OS) const;
void dump() const; void dump() const;
@ -379,6 +390,10 @@ private:
AliasSet *findAliasSetForCallSite(CallSite CS); AliasSet *findAliasSetForCallSite(CallSite CS);
}; };
inline llvm_ostream& operator<<(llvm_ostream &OS, const AliasSetTracker &AST) {
AST.print(OS);
return OS;
}
inline std::ostream& operator<<(std::ostream &OS, const AliasSetTracker &AST) { inline std::ostream& operator<<(std::ostream &OS, const AliasSetTracker &AST) {
AST.print(OS); AST.print(OS);
return OS; return OS;

View File

@ -22,6 +22,7 @@
#define LLVM_ANALYSIS_SCALAREVOLUTION_H #define LLVM_ANALYSIS_SCALAREVOLUTION_H
#include "llvm/Pass.h" #include "llvm/Pass.h"
#include "llvm/Support/Streams.h"
#include <set> #include <set>
namespace llvm { namespace llvm {
@ -96,6 +97,9 @@ namespace llvm {
/// print - Print out the internal representation of this scalar to the /// print - Print out the internal representation of this scalar to the
/// specified stream. This should really only be used for debugging /// specified stream. This should really only be used for debugging
/// purposes. /// purposes.
void print(llvm_ostream &OS) const {
if (OS.stream()) print(*OS.stream());
}
virtual void print(std::ostream &OS) const = 0; virtual void print(std::ostream &OS) const = 0;
/// dump - This method is used for debugging. /// dump - This method is used for debugging.
@ -103,6 +107,10 @@ namespace llvm {
void dump() const; void dump() const;
}; };
inline llvm_ostream &operator<<(llvm_ostream &OS, const SCEV &S) {
S.print(OS);
return OS;
}
inline std::ostream &operator<<(std::ostream &OS, const SCEV &S) { inline std::ostream &operator<<(std::ostream &OS, const SCEV &S) {
S.print(OS); S.print(OS);
return OS; return OS;
@ -120,6 +128,9 @@ namespace llvm {
virtual bool isLoopInvariant(const Loop *L) const; virtual bool isLoopInvariant(const Loop *L) const;
virtual const Type *getType() const; virtual const Type *getType() const;
virtual bool hasComputableLoopEvolution(const Loop *L) const; virtual bool hasComputableLoopEvolution(const Loop *L) const;
void print(llvm_ostream &OS) const {
if (OS.stream()) print(*OS.stream());
}
virtual void print(std::ostream &OS) const; virtual void print(std::ostream &OS) const;
virtual SCEVHandle virtual SCEVHandle
replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym, replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
@ -231,6 +242,9 @@ namespace llvm {
virtual bool runOnFunction(Function &F); virtual bool runOnFunction(Function &F);
virtual void releaseMemory(); virtual void releaseMemory();
virtual void getAnalysisUsage(AnalysisUsage &AU) const; virtual void getAnalysisUsage(AnalysisUsage &AU) const;
void print(llvm_ostream &OS, const Module* = 0) const {
if (OS.stream()) print(*OS.stream());
}
virtual void print(std::ostream &OS, const Module* = 0) const; virtual void print(std::ostream &OS, const Module* = 0) const;
}; };
} }

View File

@ -22,7 +22,7 @@
#include "llvm/Bytecode/Format.h" #include "llvm/Bytecode/Format.h"
#include <string> #include <string>
#include <map> #include <map>
#include <iostream> #include <ostream>
namespace llvm { namespace llvm {

View File

@ -60,7 +60,12 @@ namespace llvm {
private: private:
LiveRange(); // DO NOT IMPLEMENT LiveRange(); // DO NOT IMPLEMENT
}; };
std::ostream& operator<<(std::ostream& os, const LiveRange &LR); 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) { inline bool operator<(unsigned V, const LiveRange &LR) {
return V < LR.start; return V < LR.start;
@ -273,8 +278,7 @@ namespace llvm {
} }
inline std::ostream &operator<<(std::ostream &OS, const LiveInterval &LI) { inline std::ostream &operator<<(std::ostream &OS, const LiveInterval &LI) {
llvm_ostream L(OS); LI.print(OS);
L << LI;
return OS; return OS;
} }
} }

View File

@ -17,6 +17,7 @@
#include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstr.h"
#include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/ilist" #include "llvm/ADT/ilist"
#include "llvm/Support/Streams.h"
namespace llvm { namespace llvm {
class MachineFunction; class MachineFunction;
@ -188,6 +189,9 @@ public:
// Debugging methods. // Debugging methods.
void dump() const; void dump() const;
void print(llvm_ostream &OS) const {
if (OS.stream()) print(*OS.stream());
}
void print(std::ostream &OS) const; void print(std::ostream &OS) const;
/// getNumber - MachineBasicBlocks are uniquely numbered at the function /// 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); 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) // GraphTraits specializations for machine basic block graphs (machine-CFGs)

View File

@ -17,6 +17,7 @@
#include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/FoldingSet.h"
#include "llvm/CodeGen/SelectionDAGNodes.h" #include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/Support/Streams.h"
#include <vector> #include <vector>
#include <iosfwd> #include <iosfwd>
@ -48,9 +49,17 @@ public:
/// print - Implement operator<<... /// print - Implement operator<<...
/// ///
void print(llvm_ostream &O) const {
if (O.stream()) print(*O.stream());
}
virtual void print(std::ostream &O) const = 0; 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, inline std::ostream &operator<<(std::ostream &OS,
const MachineConstantPoolValue &V) { const MachineConstantPoolValue &V) {
V.print(OS); V.print(OS);
@ -134,6 +143,9 @@ public:
/// print - Used by the MachineFunction printer to print information about /// print - Used by the MachineFunction printer to print information about
/// constant pool objects. Implemented in MachineFunction.cpp /// 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; void print(std::ostream &OS) const;
/// dump - Call print(std::cerr) to be called from the debugger. /// dump - Call print(std::cerr) to be called from the debugger.

View File

@ -18,6 +18,7 @@
#include "llvm/ADT/iterator" #include "llvm/ADT/iterator"
#include "llvm/Support/DataTypes.h" #include "llvm/Support/DataTypes.h"
#include "llvm/Support/Streams.h"
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include <iosfwd> #include <iosfwd>
@ -284,6 +285,10 @@ public:
IsDead = false; 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 std::ostream& operator<<(std::ostream& os, const MachineOperand& mop);
friend class MachineInstr; friend class MachineInstr;
@ -400,8 +405,15 @@ public:
// //
// Debugging support // 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 print(std::ostream &OS, const TargetMachine *TM) const;
void dump() 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); friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr);
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//

View File

@ -17,6 +17,7 @@
#include "llvm/Value.h" #include "llvm/Value.h"
#include "llvm/ADT/iterator" #include "llvm/ADT/iterator"
#include "llvm/Support/Streams.h"
#include <vector> #include <vector>
namespace llvm { namespace llvm {
@ -69,6 +70,9 @@ public:
void dump(int indent=0) const; void dump(int indent=0) const;
// Debugging support // Debugging support
void print(llvm_ostream &os) const {
if (os.stream()) print(*os.stream());
}
virtual void print(std::ostream &os) const = 0; virtual void print(std::ostream &os) const = 0;
protected: protected:
@ -92,15 +96,17 @@ protected:
}; };
// ostream << operator for SchedGraphNode class // 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, inline std::ostream &operator<<(std::ostream &os,
const SchedGraphNodeCommon &node) { const SchedGraphNodeCommon &node) {
node.print(os); node.print(os);
return os; return os;
} }
// //
// SchedGraphEdge - Edge class to represent dependencies // SchedGraphEdge - Edge class to represent dependencies
// //
@ -182,6 +188,9 @@ public:
public: public:
// Debugging support // Debugging support
void print(llvm_ostream &os) const {
if (os.stream()) print(*os.stream());
}
void print(std::ostream &os) const; void print(std::ostream &os) const;
void dump(int indent=0) const; void dump(int indent=0) const;
@ -191,6 +200,10 @@ private:
}; };
// ostream << operator for SchedGraphNode class // 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) { inline std::ostream &operator<<(std::ostream &os, const SchedGraphEdge &edge) {
edge.print(os); edge.print(os);
return os; return os;

View File

@ -295,8 +295,14 @@ public:
/// @{ /// @{
public: public:
/// Print the module to an output stream /// Print the module to an output stream
void print(llvm_ostream &OS) const {
if (OS.stream()) print(*OS.stream(), 0);
}
void print(std::ostream &OS) const { print(OS, 0); } void print(std::ostream &OS) const { print(OS, 0); }
/// Print the module to an output stream with AssemblyAnnotationWriter. /// Print the module to an output stream with AssemblyAnnotationWriter.
void print(llvm_ostream &OS, AssemblyAnnotationWriter *AAW) const {
if (OS.stream()) print(*OS.stream(), AAW);
}
void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
/// Dump the module to std::cerr (for debugging). /// Dump the module to std::cerr (for debugging).
void dump() const; void dump() const;

View File

@ -29,6 +29,7 @@
#ifndef LLVM_PASS_H #ifndef LLVM_PASS_H
#define LLVM_PASS_H #define LLVM_PASS_H
#include "llvm/Support/Streams.h"
#include <vector> #include <vector>
#include <map> #include <map>
#include <iosfwd> #include <iosfwd>
@ -100,6 +101,9 @@ public:
/// provide the Module* in case the analysis doesn't need it it can just be /// provide the Module* in case the analysis doesn't need it it can just be
/// ignored. /// ignored.
/// ///
void print(llvm_ostream &O, const Module *M) const {
if (O.stream()) print(*O.stream(), M);
}
virtual void print(std::ostream &O, const Module *M) const; virtual void print(std::ostream &O, const Module *M) const;
void dump() const; // dump - call print(std::cerr, 0); void dump() const; // dump - call print(std::cerr, 0);

View File

@ -25,6 +25,7 @@
#define LLVM_SUPPORT_CONSTANT_RANGE_H #define LLVM_SUPPORT_CONSTANT_RANGE_H
#include "llvm/Support/DataTypes.h" #include "llvm/Support/DataTypes.h"
#include "llvm/Support/Streams.h"
#include <iosfwd> #include <iosfwd>
namespace llvm { namespace llvm {
@ -140,6 +141,9 @@ class ConstantRange {
/// print - Print out the bounds to a stream... /// print - Print out the bounds to a stream...
/// ///
void print(llvm_ostream &OS) const {
if (OS.stream()) print(*OS.stream());
}
void print(std::ostream &OS) const; void print(std::ostream &OS) const;
/// dump - Allow printing from a debugger easily... /// dump - Allow printing from a debugger easily...

View File

@ -14,6 +14,7 @@
#include "llvm/AbstractTypeUser.h" #include "llvm/AbstractTypeUser.h"
#include "llvm/Support/Casting.h" #include "llvm/Support/Casting.h"
#include "llvm/Support/DataTypes.h" #include "llvm/Support/DataTypes.h"
#include "llvm/Support/Streams.h"
#include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/iterator" #include "llvm/ADT/iterator"
#include <string> #include <string>
@ -135,6 +136,9 @@ protected:
/// ///
mutable std::vector<AbstractTypeUser *> AbstractTypeUsers; mutable std::vector<AbstractTypeUser *> AbstractTypeUsers;
public: public:
void print(llvm_ostream &O) const {
if (O.stream()) print(*O.stream());
}
void print(std::ostream &O) const; void print(std::ostream &O) const;
/// @brief Debugging support: print to stderr /// @brief Debugging support: print to stderr

View File

@ -18,6 +18,7 @@
#include "llvm/AbstractTypeUser.h" #include "llvm/AbstractTypeUser.h"
#include "llvm/Use.h" #include "llvm/Use.h"
#include "llvm/Support/Casting.h" #include "llvm/Support/Casting.h"
#include "llvm/Support/Streams.h"
#include <string> #include <string>
namespace llvm { namespace llvm {
@ -74,6 +75,9 @@ public:
/// print - Implement operator<< on Value... /// print - Implement operator<< on Value...
/// ///
void print(llvm_ostream &O) const {
if (O.stream()) print(*O.stream());
}
virtual void print(std::ostream &O) const = 0; virtual void print(std::ostream &O) const = 0;
/// All values are typed, get the type of this value. /// All values are typed, get the type of this value.