[llvm-commits] [llvm] r79825 - in /llvm/trunk: include/llvm/Analysis/ include/llvm/Assembly/ include/llvm/CodeGen/ lib/Analysis/ lib/CodeGen/ lib/Transforms/Scalar/ lib/VMCore/
Chris Lattner
sabre at nondot.org
Sat Aug 22 22:17:37 PDT 2009
Author: lattner
Date: Sun Aug 23 00:17:37 2009
New Revision: 79825
URL: http://llvm.org/viewvc/llvm-project?rev=79825&view=rev
Log:
eliminate the std::ostream form of WriteAsOperand and update clients.
This also updates dominator related stuff.
Modified:
llvm/trunk/include/llvm/Analysis/AliasSetTracker.h
llvm/trunk/include/llvm/Analysis/Dominators.h
llvm/trunk/include/llvm/Analysis/LoopInfo.h
llvm/trunk/include/llvm/Analysis/PostDominators.h
llvm/trunk/include/llvm/Assembly/Writer.h
llvm/trunk/include/llvm/CodeGen/MachineDominators.h
llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp
llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp
llvm/trunk/lib/Analysis/AliasSetTracker.cpp
llvm/trunk/lib/Analysis/LoopInfo.cpp
llvm/trunk/lib/Analysis/PostDominators.cpp
llvm/trunk/lib/CodeGen/MachineDominators.cpp
llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp
llvm/trunk/lib/VMCore/AsmWriter.cpp
llvm/trunk/lib/VMCore/Dominators.cpp
llvm/trunk/lib/VMCore/Verifier.cpp
Modified: llvm/trunk/include/llvm/Analysis/AliasSetTracker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasSetTracker.h?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasSetTracker.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasSetTracker.h Sun Aug 23 00:17:37 2009
@@ -155,8 +155,7 @@
iterator end() const { return iterator(); }
bool empty() const { return PtrList == 0; }
- void print(std::ostream &OS) const;
- void print(std::ostream *OS) const { if (OS) print(*OS); }
+ void print(raw_ostream &OS) const;
void dump() const;
/// Define an iterator for alias sets... this is just a forward iterator.
@@ -245,7 +244,7 @@
bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const;
};
-inline std::ostream& operator<<(std::ostream &OS, const AliasSet &AS) {
+inline raw_ostream& operator<<(raw_ostream &OS, const AliasSet &AS) {
AS.print(OS);
return OS;
}
@@ -374,8 +373,7 @@
iterator begin() { return AliasSets.begin(); }
iterator end() { return AliasSets.end(); }
- void print(std::ostream &OS) const;
- void print(std::ostream *OS) const { if (OS) print(*OS); }
+ void print(raw_ostream &OS) const;
void dump() const;
private:
@@ -403,7 +401,7 @@
AliasSet *findAliasSetForCallSite(CallSite CS);
};
-inline std::ostream& operator<<(std::ostream &OS, const AliasSetTracker &AST) {
+inline raw_ostream& operator<<(raw_ostream &OS, const AliasSetTracker &AST) {
AST.print(OS);
return OS;
}
Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Sun Aug 23 00:17:37 2009
@@ -32,6 +32,7 @@
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <map>
#include <set>
@@ -161,8 +162,8 @@
EXTERN_TEMPLATE_INSTANTIATION(class DomTreeNodeBase<MachineBasicBlock>);
template<class NodeT>
-static std::ostream &operator<<(std::ostream &o,
- const DomTreeNodeBase<NodeT> *Node) {
+static raw_ostream &operator<<(raw_ostream &o,
+ const DomTreeNodeBase<NodeT> *Node) {
if (Node->getBlock())
WriteAsOperand(o, Node->getBlock(), false);
else
@@ -174,9 +175,9 @@
}
template<class NodeT>
-static void PrintDomTree(const DomTreeNodeBase<NodeT> *N, std::ostream &o,
+static void PrintDomTree(const DomTreeNodeBase<NodeT> *N, raw_ostream &o,
unsigned Lev) {
- o << std::string(2*Lev, ' ') << "[" << Lev << "] " << N;
+ o.indent(2*Lev) << "[" << Lev << "] " << N;
for (typename DomTreeNodeBase<NodeT>::const_iterator I = N->begin(),
E = N->end(); I != E; ++I)
PrintDomTree<NodeT>(*I, o, Lev+1);
@@ -534,7 +535,7 @@
/// print - Convert to human readable form
///
- virtual void print(std::ostream &o, const Module* ) const {
+ void print(raw_ostream &o) const {
o << "=============================--------------------------------\n";
if (this->isPostDominator())
o << "Inorder PostDominator Tree: ";
@@ -547,14 +548,6 @@
PrintDomTree<NodeT>(getRootNode(), o, 1);
}
- void print(std::ostream *OS, const Module* M = 0) const {
- if (OS) print(*OS, M);
- }
-
- virtual void dump() {
- print(llvm::cerr);
- }
-
protected:
template<class GraphT>
friend void Compress(DominatorTreeBase<typename GraphT::NodeType>& DT,
@@ -837,9 +830,7 @@
DT->releaseMemory();
}
- virtual void print(std::ostream &OS, const Module* M= 0) const {
- DT->print(OS, M);
- }
+ virtual void print(std::ostream &OS, const Module* M= 0) const;
};
//===-------------------------------------
@@ -988,10 +979,6 @@
/// 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);
- }
- virtual void dump();
};
Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Sun Aug 23 00:17:37 2009
@@ -454,8 +454,8 @@
#endif
}
- void print(std::ostream &OS, unsigned Depth = 0) const {
- OS << std::string(Depth*2, ' ') << "Loop at depth " << getLoopDepth()
+ void print(raw_ostream &OS, unsigned Depth = 0) const {
+ OS.indent(Depth*2) << "Loop at depth " << getLoopDepth()
<< " containing: ";
for (unsigned i = 0; i < getBlocks().size(); ++i) {
@@ -472,12 +472,8 @@
(*I)->print(OS, Depth+2);
}
- void print(std::ostream *O, unsigned Depth = 0) const {
- if (O) print(*O, Depth);
- }
-
void dump() const {
- print(cerr);
+ print(errs());
}
protected:
@@ -878,7 +874,7 @@
// Debugging
- void print(std::ostream &OS, const Module* ) const {
+ void print(raw_ostream &OS) const {
for (unsigned i = 0; i < TopLevelLoops.size(); ++i)
TopLevelLoops[i]->print(OS);
#if 0
@@ -942,10 +938,8 @@
virtual void releaseMemory() { LI.releaseMemory(); }
- virtual void print(std::ostream &O, const Module* M = 0) const {
- LI.print(O, M);
- }
-
+ virtual void print(std::ostream &O, const Module* M = 0) const;
+
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
/// removeLoop - This removes the specified top-level loop from this loop info
Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/PostDominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/PostDominators.h Sun Aug 23 00:17:37 2009
@@ -57,9 +57,7 @@
return DT->properlyDominates(A, B);
}
- virtual void print(std::ostream &OS, const Module* M= 0) const {
- DT->print(OS, M);
- }
+ virtual void print(std::ostream &OS, const Module*) const;
};
FunctionPass* createPostDomTree();
Modified: llvm/trunk/include/llvm/Assembly/Writer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Writer.h?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Assembly/Writer.h (original)
+++ llvm/trunk/include/llvm/Assembly/Writer.h Sun Aug 23 00:17:37 2009
@@ -17,7 +17,6 @@
#ifndef LLVM_ASSEMBLY_WRITER_H
#define LLVM_ASSEMBLY_WRITER_H
-#include <iosfwd>
#include <string>
namespace llvm {
@@ -71,8 +70,6 @@
// then even constants get pretty-printed; for example, the type of a null
// pointer is printed symbolically.
//
-void WriteAsOperand(std::ostream &, const Value *, bool PrintTy = true,
- const Module *Context = 0);
void WriteAsOperand(raw_ostream &, const Value *, bool PrintTy = true,
const Module *Context = 0);
Modified: llvm/trunk/include/llvm/CodeGen/MachineDominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDominators.h?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineDominators.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineDominators.h Sun Aug 23 00:17:37 2009
@@ -23,7 +23,7 @@
namespace llvm {
-inline void WriteAsOperand(std::ostream &, const MachineBasicBlock*, bool t) { }
+inline void WriteAsOperand(raw_ostream &, const MachineBasicBlock*, bool t) { }
template<>
inline void DominatorTreeBase<MachineBasicBlock>::addRoot(MachineBasicBlock* MBB) {
@@ -162,9 +162,7 @@
virtual void releaseMemory();
- virtual void print(std::ostream &OS, const Module* M= 0) const {
- DT->print(OS, M);
- }
+ virtual void print(std::ostream &OS, const Module*) const;
};
//===-------------------------------------
Modified: llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp Sun Aug 23 00:17:37 2009
@@ -42,33 +42,33 @@
}
void printLine(const char *Desc, unsigned Val, unsigned Sum) {
- cerr << " " << Val << " " << Desc << " responses ("
- << Val*100/Sum << "%)\n";
+ errs() << " " << Val << " " << Desc << " responses ("
+ << Val*100/Sum << "%)\n";
}
~AliasAnalysisCounter() {
unsigned AASum = No+May+Must;
unsigned MRSum = NoMR+JustRef+JustMod+MR;
if (AASum + MRSum) { // Print a report if any counted queries occurred...
- cerr << "\n===== Alias Analysis Counter Report =====\n"
- << " Analysis counted: " << Name << "\n"
- << " " << AASum << " Total Alias Queries Performed\n";
+ errs() << "\n===== Alias Analysis Counter Report =====\n"
+ << " Analysis counted: " << Name << "\n"
+ << " " << AASum << " Total Alias Queries Performed\n";
if (AASum) {
printLine("no alias", No, AASum);
printLine("may alias", May, AASum);
printLine("must alias", Must, AASum);
- cerr << " Alias Analysis Counter Summary: " << No*100/AASum << "%/"
- << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n";
+ errs() << " Alias Analysis Counter Summary: " << No*100/AASum << "%/"
+ << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n";
}
- cerr << " " << MRSum << " Total Mod/Ref Queries Performed\n";
+ errs() << " " << MRSum << " Total Mod/Ref Queries Performed\n";
if (MRSum) {
printLine("no mod/ref", NoMR, MRSum);
printLine("ref", JustRef, MRSum);
printLine("mod", JustMod, MRSum);
printLine("mod/ref", MR, MRSum);
- cerr << " Mod/Ref Analysis Counter Summary: " <<NoMR*100/MRSum<< "%/"
- << JustRef*100/MRSum << "%/" << JustMod*100/MRSum << "%/"
- << MR*100/MRSum <<"%\n\n";
+ errs() << " Mod/Ref Analysis Counter Summary: " <<NoMR*100/MRSum
+ << "%/" << JustRef*100/MRSum << "%/" << JustMod*100/MRSum
+ << "%/" << MR*100/MRSum <<"%\n\n";
}
}
}
@@ -139,13 +139,13 @@
}
if (PrintAll || (PrintAllFailures && R == MayAlias)) {
- cerr << AliasString << ":\t";
- cerr << "[" << V1Size << "B] ";
- WriteAsOperand(*cerr.stream(), V1, true, M);
- cerr << ", ";
- cerr << "[" << V2Size << "B] ";
- WriteAsOperand(*cerr.stream(), V2, true, M);
- cerr << "\n";
+ errs() << AliasString << ":\t";
+ errs() << "[" << V1Size << "B] ";
+ WriteAsOperand(errs(), V1, true, M);
+ errs() << ", ";
+ errs() << "[" << V2Size << "B] ";
+ WriteAsOperand(errs(), V2, true, M);
+ errs() << "\n";
}
return R;
Modified: llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp Sun Aug 23 00:17:37 2009
@@ -81,13 +81,16 @@
FunctionPass *llvm::createAAEvalPass() { return new AAEval(); }
-static void PrintResults(const char *Msg, bool P, const Value *V1, const Value *V2,
- const Module *M) {
+static void PrintResults(const char *Msg, bool P, const Value *V1,
+ const Value *V2, const Module *M) {
if (P) {
- std::stringstream s1, s2;
- WriteAsOperand(s1, V1, true, M);
- WriteAsOperand(s2, V2, true, M);
- std::string o1(s1.str()), o2(s2.str());
+ std::string o1, o2;
+ {
+ raw_string_ostream os1(o1), os2(o2);
+ WriteAsOperand(os1, V1, true, M);
+ WriteAsOperand(os2, V2, true, M);
+ }
+
if (o2 < o1)
std::swap(o1, o2);
errs() << " " << Msg << ":\t"
Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Sun Aug 23 00:17:37 2009
@@ -22,7 +22,8 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/InstIterator.h"
-#include "llvm/Support/Streams.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
/// mergeSetIn - Merge the specified alias set into this alias set.
@@ -531,8 +532,8 @@
// AliasSet/AliasSetTracker Printing Support
//===----------------------------------------------------------------------===//
-void AliasSet::print(std::ostream &OS) const {
- OS << " AliasSet[" << (void*)this << "," << RefCount << "] ";
+void AliasSet::print(raw_ostream &OS) const {
+ OS << " AliasSet[" << format("0x%p", (void*)this) << "," << RefCount << "] ";
OS << (AliasTy == MustAlias ? "must" : "may") << " alias, ";
switch (AccessTy) {
case NoModRef: OS << "No access "; break;
@@ -564,7 +565,7 @@
OS << "\n";
}
-void AliasSetTracker::print(std::ostream &OS) const {
+void AliasSetTracker::print(raw_ostream &OS) const {
OS << "Alias Set Tracker: " << AliasSets.size() << " alias sets for "
<< PointerMap.size() << " pointer values.\n";
for (const_iterator I = begin(), E = end(); I != E; ++I)
@@ -572,8 +573,8 @@
OS << "\n";
}
-void AliasSet::dump() const { print (cerr); }
-void AliasSetTracker::dump() const { print(cerr); }
+void AliasSet::dump() const { print(errs()); }
+void AliasSetTracker::dump() const { print(errs()); }
//===----------------------------------------------------------------------===//
// ASTCallbackVH Class Implementation
@@ -614,7 +615,7 @@
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
Tracker->add(&*I);
- Tracker->print(cerr);
+ Tracker->print(errs());
delete Tracker;
return false;
}
Modified: llvm/trunk/lib/Analysis/LoopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopInfo.cpp?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopInfo.cpp Sun Aug 23 00:17:37 2009
@@ -308,3 +308,9 @@
AU.setPreservesAll();
AU.addRequired<DominatorTree>();
}
+
+void LoopInfo::print(std::ostream &OS, const Module*) const {
+ raw_os_ostream OSS(OS);
+ LI.print(OSS);
+}
+
Modified: llvm/trunk/lib/Analysis/PostDominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/PostDominators.cpp (original)
+++ llvm/trunk/lib/Analysis/PostDominators.cpp Sun Aug 23 00:17:37 2009
@@ -33,15 +33,20 @@
bool PostDominatorTree::runOnFunction(Function &F) {
DT->recalculate(F);
- DEBUG(DT->dump());
+ DEBUG(DT->print(errs()));
return false;
}
-PostDominatorTree::~PostDominatorTree()
-{
+PostDominatorTree::~PostDominatorTree() {
delete DT;
}
+void PostDominatorTree::print(std::ostream &OS, const Module *) const {
+ raw_os_ostream OSS(OS);
+ DT->print(OSS);
+}
+
+
FunctionPass* llvm::createPostDomTree() {
return new PostDominatorTree();
}
Modified: llvm/trunk/lib/CodeGen/MachineDominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineDominators.cpp?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineDominators.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineDominators.cpp Sun Aug 23 00:17:37 2009
@@ -51,3 +51,8 @@
void MachineDominatorTree::releaseMemory() {
DT->releaseMemory();
}
+
+void MachineDominatorTree::print(std::ostream &OS, const Module*) const {
+ raw_os_ostream OSS(OS);
+ DT->print(OSS);
+}
Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Sun Aug 23 00:17:37 2009
@@ -425,10 +425,10 @@
#ifndef NDEBUG
virtual ~ValueNumbering() {}
virtual void dump() {
- dump(*cerr.stream());
+ print(errs());
}
- void dump(std::ostream &os) {
+ void print(raw_ostream &os) {
for (unsigned i = 1; i <= Values.size(); ++i) {
os << i << " = ";
WriteAsOperand(os, Values[i-1]);
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sun Aug 23 00:17:37 2009
@@ -1218,16 +1218,6 @@
Out << "<badref>";
}
-/// WriteAsOperand - Write the name of the specified value out to the specified
-/// ostream. This can be useful when you just want to print int %reg126, not
-/// the whole instruction that generated it.
-///
-void llvm::WriteAsOperand(std::ostream &Out, const Value *V, bool PrintType,
- const Module *Context) {
- raw_os_ostream OS(Out);
- WriteAsOperand(OS, V, PrintType, Context);
-}
-
void llvm::WriteAsOperand(raw_ostream &Out, const Value *V,
bool PrintType, const Module *Context) {
@@ -2076,12 +2066,6 @@
}
}
-/*
-void Value::print(std::ostream &O, AssemblyAnnotationWriter *AAW) const {
- raw_os_ostream OS(O);
- print(OS, AAW);
-}*/
-
// Value::dump - allow easy printing of Values from the debugger.
void Value::dump() const { print(errs()); errs() << '\n'; }
Modified: llvm/trunk/lib/VMCore/Dominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Dominators.cpp (original)
+++ llvm/trunk/lib/VMCore/Dominators.cpp Sun Aug 23 00:17:37 2009
@@ -23,23 +23,10 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/DominatorInternals.h"
#include "llvm/Instructions.h"
-#include "llvm/Support/Streams.h"
+#include "llvm/Support/raw_ostream.h"
#include <algorithm>
using namespace llvm;
-namespace llvm {
-static std::ostream &operator<<(std::ostream &o,
- const std::set<BasicBlock*> &BBs) {
- for (std::set<BasicBlock*>::const_iterator I = BBs.begin(), E = BBs.end();
- I != E; ++I)
- if (*I)
- WriteAsOperand(o, *I, false);
- else
- o << " <<exit node>>";
- return o;
-}
-}
-
//===----------------------------------------------------------------------===//
// DominatorTree Implementation
//===----------------------------------------------------------------------===//
@@ -61,6 +48,13 @@
return false;
}
+void DominatorTree::print(std::ostream &OS, const Module *) const {
+ raw_os_ostream OSS(OS);
+ DT->print(OSS);
+}
+
+
+
//===----------------------------------------------------------------------===//
// DominanceFrontier Implementation
//===----------------------------------------------------------------------===//
@@ -270,18 +264,25 @@
return *Result;
}
-void DominanceFrontierBase::print(std::ostream &o, const Module* ) const {
+void DominanceFrontierBase::print(std::ostream &O, const Module* ) const {
+ raw_os_ostream OS(O);
for (const_iterator I = begin(), E = end(); I != E; ++I) {
- o << " DomFrontier for BB";
+ OS << " DomFrontier for BB";
if (I->first)
- WriteAsOperand(o, I->first, false);
+ WriteAsOperand(OS, I->first, false);
else
- o << " <<exit node>>";
- o << " is:\t" << I->second << "\n";
+ OS << " <<exit node>>";
+ OS << " is:\t";
+
+ const std::set<BasicBlock*> &BBs = I->second;
+
+ for (std::set<BasicBlock*>::const_iterator I = BBs.begin(), E = BBs.end();
+ I != E; ++I)
+ if (*I)
+ WriteAsOperand(OS, *I, false);
+ else
+ OS << " <<exit node>>";
+ OS << "\n";
}
}
-void DominanceFrontierBase::dump() {
- print (llvm::cerr);
-}
-
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=79825&r1=79824&r2=79825&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Sun Aug 23 00:17:37 2009
@@ -86,7 +86,7 @@
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
if (I->empty() || !I->back().isTerminator()) {
cerr << "Basic Block does not have terminator!\n";
- WriteAsOperand(*cerr, I, true);
+ WriteAsOperand(errs(), I, true);
cerr << "\n";
Broken = true;
}
More information about the llvm-commits
mailing list