diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-23 05:17:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-23 05:17:37 +0000 |
commit | 791102fb1192ac9483274e54cbc42480c9b1af10 (patch) | |
tree | 4729b1da9b9c946fb83bc177dd3d00bffcf85390 /lib/VMCore | |
parent | 79c5d3f9717756dc3ff56cfcaa3ae1a5930c457a (diff) | |
download | llvm-791102fb1192ac9483274e54cbc42480c9b1af10.tar.gz llvm-791102fb1192ac9483274e54cbc42480c9b1af10.tar.bz2 llvm-791102fb1192ac9483274e54cbc42480c9b1af10.tar.xz |
eliminate the std::ostream form of WriteAsOperand and update clients.
This also updates dominator related stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79825 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 16 | ||||
-rw-r--r-- | lib/VMCore/Dominators.cpp | 47 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 2 |
3 files changed, 25 insertions, 40 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index dc72031482..5062075a46 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -1218,16 +1218,6 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Value *V, 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(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const { } } -/* -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'; } diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index 9b6f5c2c94..e3bcbb7542 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -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 @@ bool DominatorTree::runOnFunction(Function &F) { 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 @@ DominanceFrontier::calculate(const DominatorTree &DT, 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); -} - diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 05ccc631e5..ddea84d52c 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -86,7 +86,7 @@ namespace { // Anonymous namespace for class 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; } |