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

llvm-svn: 31978
This commit is contained in:
Bill Wendling 2006-11-28 22:21:29 +00:00
parent c48fe0fd4d
commit 4157840bd6
14 changed files with 114 additions and 7 deletions

View File

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

View File

@ -18,6 +18,7 @@
#define LLVM_ANALYSIS_ALIASSETTRACKER_H
#include "llvm/Support/CallSite.h"
#include "llvm/Support/Streams.h"
#include "llvm/ADT/iterator"
#include "llvm/ADT/hash_map"
#include "llvm/ADT/ilist"
@ -155,6 +156,9 @@ public:
iterator end() const { return iterator(); }
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 dump() const;
@ -244,6 +248,10 @@ private:
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) {
AS.print(OS);
return OS;
@ -353,6 +361,9 @@ public:
iterator begin() { return AliasSets.begin(); }
iterator end() { return AliasSets.end(); }
void print(llvm_ostream &OS) const {
if (OS.stream()) print(*OS.stream());
}
void print(std::ostream &OS) const;
void dump() const;
@ -379,6 +390,10 @@ private:
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) {
AST.print(OS);
return OS;

View File

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

View File

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

View File

@ -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;
}
}

View File

@ -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)

View File

@ -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.

View File

@ -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);
//===--------------------------------------------------------------------===//

View File

@ -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;

View File

@ -295,8 +295,14 @@ public:
/// @{
public:
/// 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); }
/// 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;
/// Dump the module to std::cerr (for debugging).
void dump() const;

View File

@ -29,6 +29,7 @@
#ifndef LLVM_PASS_H
#define LLVM_PASS_H
#include "llvm/Support/Streams.h"
#include <vector>
#include <map>
#include <iosfwd>
@ -100,6 +101,9 @@ public:
/// provide the Module* in case the analysis doesn't need it it can just be
/// 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;
void dump() const; // dump - call print(std::cerr, 0);

View File

@ -25,6 +25,7 @@
#define LLVM_SUPPORT_CONSTANT_RANGE_H
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Streams.h"
#include <iosfwd>
namespace llvm {
@ -140,6 +141,9 @@ class ConstantRange {
/// 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;
/// dump - Allow printing from a debugger easily...

View File

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

View File

@ -18,6 +18,7 @@
#include "llvm/AbstractTypeUser.h"
#include "llvm/Use.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Streams.h"
#include <string>
namespace llvm {
@ -74,6 +75,9 @@ public:
/// 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;
/// All values are typed, get the type of this value.