#include "llvm/Support/Streams.h"
#include <bitset>
-#include <vector>
#include <functional>
namespace llvm {
///
/// Printing and debugging support
///
- void print(OStream &O) const {
- if (O.stream()) print(*O.stream());
- }
void print(std::ostream &O) const;
+ void print(std::ostream *O) const { if (O) print(*O); }
void dump() const { print(cerr); }
public:
};
-inline void BitSetVector::print(std::ostream& O) const
+inline void BitSetVector::print(llvm_ostream& O) const
{
for (std::vector<bitword>::const_iterator
I=bitsetVec.begin(), E=bitsetVec.end(); I != E; ++I)
O << "<" << (*I) << ">" << (I+1 == E? "\n" : ", ");
}
-inline OStream& operator<< (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);
return O;
}
-
///
/// Optimized versions of fundamental comparison operations
///
iterator end() const { return iterator(); }
bool empty() const { return PtrList == 0; }
- 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() const;
/// Define an iterator for alias sets... this is just a forward iterator.
bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const;
};
-inline OStream& operator<<(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;
iterator begin() { return AliasSets.begin(); }
iterator end() { return AliasSets.end(); }
- 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() const;
private:
AliasSet *findAliasSetForCallSite(CallSite CS);
};
-inline OStream& operator<<(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;
///
void initialize(Module &M);
- void print(OStream &o, const Module *M) const {
- if (o.stream()) print(*o.stream(), M);
- }
virtual void print(std::ostream &o, const Module *M) const;
+ void print(std::ostream *o, const Module *M) const { if (o) print(*o, M); }
void dump() const;
// stub - dummy function, just ignore it
/// dump - Print out this call graph node.
///
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); }
//===---------------------------------------------------------------------
// Methods to keep a call graph up to date with a function that has been
/// print - Convert to human readable form
///
virtual void print(std::ostream &OS, const Module* = 0) const;
+ void print(std::ostream *OS, const Module* M = 0) const {
+ if (OS) print(*OS, M);
+ }
};
//===-------------------------------------
/// print - Convert to human readable form
///
virtual void print(std::ostream &OS, const Module* = 0) const;
+ void print(std::ostream *OS, const Module* M = 0) const {
+ if (OS) print(*OS, M);
+ }
/// dominates - Return true if A dominates B. This performs the special
/// checks necessary if A and B are in the same basic block.
/// print - Convert to human readable form
///
virtual void print(std::ostream &OS, const Module* = 0) const;
+ void print(std::ostream *OS, const Module* M = 0) const {
+ if (OS) print(*OS, M);
+ }
};
//===-------------------------------------
/// print - Convert to human readable form
///
virtual void print(std::ostream &OS, const Module* = 0) const;
+ void print(std::ostream *OS, const Module* M = 0) const {
+ if (OS) print(*OS, M);
+ }
protected:
/// getNode - return the (Post)DominatorTree node for the specified basic
/// block. This is the same as using operator[] on this class.
/// print - Convert to human readable form
///
virtual void print(std::ostream &OS, const Module* = 0) const;
+ void print(std::ostream *OS, const Module* M = 0) const {
+ if (OS) print(*OS, M);
+ }
};
/// symbol table from the module.
///
void print(std::ostream &o, const Module *M) const;
+ void print(std::ostream *o, const Module *M) const { if (o) print(*o, M); }
private:
/// IncorporateType - Incorporate one type and all of its subtypes into the
/// print - Show contents in human readable format...
void print(std::ostream &O) const;
+ void print(std::ostream *O) const { if (O) print(*O); }
};
/// succ_begin/succ_end - define methods so that Intervals may be used
// print - Show contents in human readable format...
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);
+ }
// getRootInterval() - Return the root interval that contains the starting
// block of the function.
/// the mapping in the LoopInfo class.
void removeBlockFromLoop(BasicBlock *BB);
- void print(OStream &O, unsigned Depth = 0) const {
- if (O.stream()) print(*O.stream(), Depth);
- }
void print(std::ostream &O, unsigned Depth = 0) const;
+ void print(std::ostream *O, unsigned Depth = 0) const {
+ if (O) print(*O, Depth);
+ }
void dump() const;
private:
friend class LoopInfo;
virtual bool runOnFunction(Function &F);
virtual void releaseMemory();
- void print(OStream &O, const Module* = 0) const {
- if (O.stream()) print(*O.stream());
- }
+
void print(std::ostream &O, const Module* = 0) const;
+ void print(std::ostream *O, const Module* M = 0) const {
+ if (O) print(*O, M);
+ }
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
/// print - Print out the internal representation of this scalar to the
/// specified stream. This should really only be used for debugging
/// purposes.
- 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); }
/// dump - This method is used for debugging.
///
void dump() const;
};
- inline OStream &operator<<(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;
virtual bool isLoopInvariant(const Loop *L) const;
virtual const Type *getType() const;
virtual bool hasComputableLoopEvolution(const Loop *L) const;
- void print(OStream &OS) const {
- if (OS.stream()) print(*OS.stream());
- }
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
virtual SCEVHandle
replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
const SCEVHandle &Conc) const;
virtual bool runOnFunction(Function &F);
virtual void releaseMemory();
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
- void print(OStream &OS, const Module* = 0) const {
- if (OS.stream()) print(*OS.stream());
- }
virtual void print(std::ostream &OS, const Module* = 0) const;
+ void print(std::ostream *OS, const Module* M = 0) const {
+ if (OS) print(*OS, M);
+ }
};
}
}
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVConstant *S) { return true; }
virtual ConstantRange getValueRange() const;
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVTruncateExpr *S) { return true; }
}
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVZeroExtendExpr *S) { return true; }
virtual const Type *getType() const { return getOperand(0)->getType(); }
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVCommutativeExpr *S) { return true; }
virtual const Type *getType() const;
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVSDivExpr *S) { return true; }
const SCEVHandle &Conc) const;
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVAddRecExpr *S) { return true; }
virtual const Type *getType() const;
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVUnknown *S) { return true; }
/// print - Write trace to output stream.
///
- void print (OStream &O) const;
+ void print (std::ostream &O) const;
+ void print (std::ostream *O) const { if (O) print(*O); }
/// dump - Debugger convenience method; writes trace to standard error
/// output stream.
const Argument *getPrev() const { return Prev; }
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const {
+ if (OS) print(*OS);
+ }
/// classof - Methods for support type inquiry through isa, cast, and
/// dyn_cast:
InstListType &getInstList() { return InstList; }
virtual void print(std::ostream &OS) const { print(OS, 0); }
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
(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);
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) {
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;
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;
/// 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
// 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
};
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)
/// 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);
/// 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.
///
/// 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
MachineOperand() {}
void print(std::ostream &os) const;
+ void print(std::ostream *os) const { if (os) print(*os); }
public:
MachineOperand(const MachineOperand &M) {
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;
//
// 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;
/// 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.
///
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;
};
// 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);
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:
};
// 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;
virtual bool isNullValue() const = 0;
virtual void print(std::ostream &O) const;
+ void print(std::ostream *O) const { if (O) print(*O); }
/// canTrap - Return true if evaluation of this constant could trap. This is
/// true for things like constant expressions that could divide by zero.
bool arg_empty() const { return ArgumentList.empty(); }
virtual void print(std::ostream &OS) const { print(OS, 0); }
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
/// viewCFG - This function is meant for use from the debugger. You can just
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
virtual void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const GlobalVariable *) { return true; }
const std::string &getConstraintString() const { return Constraints; }
virtual void print(std::ostream &O) const { print(O, 0); }
+ void print(std::ostream *O) const { if (O) print(*O); }
void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
/// Verify - This static method can be used by the parser to check to see if
static bool isTrapping(unsigned op);
virtual void print(std::ostream &OS) const { print(OS, 0); }
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
/// @{
public:
/// Print the module to an output stream
- void print(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 { if (OS) print(*OS); }
/// Print the module to an output stream with AssemblyAnnotationWriter.
- void print(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 {
+ if (OS) print(*OS, AAW);
+ }
/// Dump the module to std::cerr (for debugging).
void dump() const;
/// This function causes all the subinstructions to "let go" of all references
/// provide the Module* in case the analysis doesn't need it it can just be
/// ignored.
///
- void print(OStream &O, const Module *M) const {
- if (O.stream()) print(*O.stream(), M);
- }
virtual void print(std::ostream &O, const Module *M) const;
+ void print(std::ostream *O, const Module *M) const { if (O) print(*O, M); }
void dump() const; // dump - call print(std::cerr, 0);
// Access AnalysisResolver_New
/// print - Print out the bounds to a stream...
///
- 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 - Allow printing from a debugger easily...
///
/// places the std::c* I/O streams into one .cpp file and relieves the whole
/// program from having to have hundreds of static c'tor/d'tors for them.
///
-OStream getErrorOutputStream(const char *DebugType);
+OStream &getErrorOutputStream(const char *DebugType);
#ifdef NDEBUG
-#define DOUT NullStream
+#define DOUT cnull
#else
#define DOUT getErrorOutputStream(DEBUG_TYPE)
#endif
return *this;
}
+// inline BaseStream &operator << (std::ios &(*Func)(std::ios&)) {
+// if (Stream) *Stream << Func;
+// return *this;
+// }
+
template <typename Ty>
BaseStream &operator << (const Ty &Thing) {
if (Stream) *Stream << Thing;
return *this;
}
+ operator StreamTy* () { return Stream; }
+
bool operator == (const StreamTy &S) { return &S == Stream; }
bool operator != (const StreamTy &S) { return !(*this == S); }
bool operator == (const BaseStream &S) { return S.Stream == Stream; }
typedef BaseStream<std::istream> IStream;
typedef BaseStream<std::stringstream> StringStream;
- extern OStream NullStream;
+ extern OStream cnull;
extern OStream cout;
extern OStream cerr;
extern IStream cin;
/// Print feature string.
void print(std::ostream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
// Dump feature info.
void dump() const;
///
mutable std::vector<AbstractTypeUser *> AbstractTypeUsers;
public:
- void print(OStream &O) const {
- if (O.stream()) print(*O.stream());
- }
void print(std::ostream &O) const;
+ void print(std::ostream *O) const { if (O) print(*O); }
/// @brief Debugging support: print to stderr
void dump() const;
/// print - Implement operator<< on Value...
///
- 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); }
/// All values are typed, get the type of this value.
///
AU.setPreservesAll();
}
- void print(OStream &o, const Module *M) const {
- if (o.stream()) print(*o.stream(), M);
+ void print(std::ostream *o, const Module *M) const {
+ if (o) print(*o, M);
}
virtual void print(std::ostream &o, const Module *M) const {
/// print - Write trace to output stream.
///
-void Trace::print(OStream &O) const {
+void Trace::print(std::ostream &O) const {
Function *F = getFunction ();
O << "; Trace from function " << F->getName() << ", blocks:\n";
for (const_iterator i = begin(), e = end(); i != e; ++i) {
O << "; ";
- if (O.stream())
- WriteAsOperand(*O.stream(), *i, true, getModule());
+ WriteAsOperand(O, *i, true, getModule());
O << "\n";
}
O << "; Trace parent function: \n" << *F;
// make sure it hits disk now
Out.stream()->flush();
+ void * p;
+ Out << std::hex << p << "\n";
}
}
#ifndef NDEBUG
- void print(OStream &O) const {
- if (O.stream()) print(*O.stream());
+ void print(std::ostream *O) const {
+ if (O) print(*O);
}
void print(std::ostream &O) const {
O << ".debug_" << Tag;
void Emit(const Dwarf &DW) const;
#ifndef NDEBUG
- void print(OStream &O) {
- if (O.stream()) print(*O.stream());
+ void print(std::ostream *O) {
+ if (O) print(*O);
}
void print(std::ostream &O);
void dump();
void Profile(FoldingSetNodeID &ID) ;
#ifndef NDEBUG
- void print(OStream &O, unsigned IncIndent = 0) {
- if (O.stream()) print(*O.stream(), IncIndent);
+ void print(std::ostream *O, unsigned IncIndent = 0) {
+ if (O) print(*O, IncIndent);
}
void print(std::ostream &O, unsigned IncIndent = 0);
void dump();
virtual void Profile(FoldingSetNodeID &ID) = 0;
#ifndef NDEBUG
- void print(OStream &O) {
- if (O.stream()) print(*O.stream());
+ void print(std::ostream *O) {
+ if (O) print(*O);
}
virtual void print(std::ostream &O) = 0;
void dump();
cerr << *this << "\n";
}
-void LiveInterval::print(OStream OS, const MRegisterInfo *MRI) const {
+void LiveInterval::print(std::ostream &OS, const MRegisterInfo *MRI) const {
if (MRI && MRegisterInfo::isPhysicalRegister(reg))
OS << MRI->getName(reg);
else
/// print - Print ordering to specified output stream.
///
- void print(OStream &O) const;
+ void print(std::ostream &O) const;
+ void print(std::ostream *O) const { if (O) print(*O); }
void dump(const char *tag) const;
/// printNI - Print node info.
///
- void printNI(OStream &O, NodeInfo *NI) const;
+ void printNI(std::ostream &O, NodeInfo *NI) const;
+ void printNI(std::ostream *O, NodeInfo *NI) const { if (O) printNI(O, NI); }
/// printChanges - Hilight changes in order caused by scheduling.
///
/// print - Print ordering to specified output stream.
///
-void ScheduleDAGSimple::print(OStream &O) const {
+void ScheduleDAGSimple::print(std::ostream &O) const {
#ifndef NDEBUG
O << "Ordering\n";
for (unsigned i = 0, N = Ordering.size(); i < N; i++) {
/// printNI - Print node info.
///
-void ScheduleDAGSimple::printNI(OStream &O, NodeInfo *NI) const {
+void ScheduleDAGSimple::printNI(std::ostream &O, NodeInfo *NI) const {
#ifndef NDEBUG
SDNode *Node = NI->Node;
- *(O.stream()) << " "
- << std::hex << Node << std::dec
- << ", Lat=" << NI->Latency
- << ", Slot=" << NI->Slot
- << ", ARITY=(" << Node->getNumOperands() << ","
- << Node->getNumValues() << ")"
- << " " << Node->getOperationName(&DAG);
+ O << " "
+ << std::hex << Node << std::dec
+ << ", Lat=" << NI->Latency
+ << ", Slot=" << NI->Slot
+ << ", ARITY=(" << Node->getNumOperands() << ","
+ << Node->getNumValues() << ")"
+ << " " << Node->getOperationName(&DAG);
if (isFlagDefiner(Node)) O << "<#";
if (isFlagUser(Node)) O << ">#";
#endif
}
void VirtRegMap::print(std::ostream &OS) const {
- OStream LOS(OS);
- print(LOS);
-}
-
-void VirtRegMap::print(OStream &OS) const {
const MRegisterInfo* MRI = MF.getTarget().getRegisterInfo();
OS << "********** REGISTER MAP **********\n";
}
void VirtRegMap::dump() const {
- OStream OS = DOUT;
- print(OS);
+ print(DOUT);
}
}
void print(std::ostream &OS) const;
- void print(OStream &OS) const;
+ void print(std::ostream *OS) const { if (OS) print(*OS); }
void dump() const;
};
+ inline std::ostream *operator<<(std::ostream *OS, const VirtRegMap &VRM) {
+ VRM.print(OS);
+ return OS;
+ }
inline std::ostream &operator<<(std::ostream &OS, const VirtRegMap &VRM) {
VRM.print(OS);
return OS;
// places the std::c* I/O streams into one .cpp file and relieves the whole
// program from having to have hundreds of static c'tor/d'tors for them.
//
-OStream llvm::getErrorOutputStream(const char *DebugType) {
+OStream &llvm::getErrorOutputStream(const char *DebugType) {
if (DebugFlag && isCurrentDebugType(DebugType))
return cerr;
else
- return NullStream;
+ return cnull;
}
#include <iostream>
using namespace llvm;
-OStream llvm::NullStream;
+OStream llvm::cnull;
OStream llvm::cout(std::cout);
OStream llvm::cerr(std::cerr);
IStream llvm::cin(std::cin);
// operator<< - Used for debugging purposes.
//
-OStream& operator<<(OStream &O, const std::vector<LowerSwitch::Case> &C) {
+std::ostream& operator<<(std::ostream &O,
+ const std::vector<LowerSwitch::Case> &C) {
O << "[";
for (std::vector<LowerSwitch::Case>::const_iterator B = C.begin(),
return O << "]";
}
+OStream& operator<<(OStream &O, const std::vector<LowerSwitch::Case> &C) {
+ if (O.stream()) *O.stream() << C;
+ return O;
+}
// switchConvert - Convert the switch statement into a binary lookup of
// the case values. The function recursively builds this tree.