summaryrefslogtreecommitdiff
path: root/tools/opt
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-23 06:03:38 +0000
committerChris Lattner <sabre@nondot.org>2009-08-23 06:03:38 +0000
commit45cfe545ec8177262dabc70580ce05feaa1c3880 (patch)
treed7e42a138f6f8b54e1a831aff3c73c653ee77784 /tools/opt
parentcb3e3d30054edfc7481bf323b315da4edc63bc44 (diff)
downloadllvm-45cfe545ec8177262dabc70580ce05feaa1c3880.tar.gz
llvm-45cfe545ec8177262dabc70580ce05feaa1c3880.tar.bz2
llvm-45cfe545ec8177262dabc70580ce05feaa1c3880.tar.xz
Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79830 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt')
-rw-r--r--tools/opt/AnalysisWrappers.cpp44
-rw-r--r--tools/opt/GraphPrinters.cpp3
-rw-r--r--tools/opt/PrintSCC.cpp4
-rw-r--r--tools/opt/opt.cpp10
4 files changed, 32 insertions, 29 deletions
diff --git a/tools/opt/AnalysisWrappers.cpp b/tools/opt/AnalysisWrappers.cpp
index 2ab69ea61e..18360f837e 100644
--- a/tools/opt/AnalysisWrappers.cpp
+++ b/tools/opt/AnalysisWrappers.cpp
@@ -34,27 +34,31 @@ namespace {
static char ID; // Pass ID, replacement for typeid
ExternalFunctionsPassedConstants() : ModulePass(&ID) {}
virtual bool runOnModule(Module &M) {
- for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
- if (I->isDeclaration()) {
- bool PrintedFn = false;
- for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
- UI != E; ++UI)
- if (Instruction *User = dyn_cast<Instruction>(*UI)) {
- CallSite CS = CallSite::get(User);
- if (CS.getInstruction()) {
- for (CallSite::arg_iterator AI = CS.arg_begin(),
- E = CS.arg_end(); AI != E; ++AI)
- if (isa<Constant>(*AI)) {
- if (!PrintedFn) {
- errs() << "Function '" << I->getName() << "':\n";
- PrintedFn = true;
- }
- errs() << *User;
- break;
- }
- }
+ for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
+ if (!I->isDeclaration()) continue;
+
+ bool PrintedFn = false;
+ for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
+ UI != E; ++UI) {
+ Instruction *User = dyn_cast<Instruction>(*UI);
+ if (!User) continue;
+
+ CallSite CS = CallSite::get(User);
+ if (!CS.getInstruction()) continue;
+
+ for (CallSite::arg_iterator AI = CS.arg_begin(),
+ E = CS.arg_end(); AI != E; ++AI) {
+ if (!isa<Constant>(*AI)) continue;
+
+ if (!PrintedFn) {
+ errs() << "Function '" << I->getName() << "':\n";
+ PrintedFn = true;
}
+ errs() << *User;
+ break;
+ }
}
+ }
return false;
}
@@ -78,7 +82,7 @@ namespace {
AU.addRequiredTransitive<CallGraph>();
}
virtual bool runOnModule(Module &M) {
- getAnalysis<CallGraph>().print(std::cerr, &M);
+ getAnalysis<CallGraph>().print(errs(), &M);
return false;
}
};
diff --git a/tools/opt/GraphPrinters.cpp b/tools/opt/GraphPrinters.cpp
index 5d581e4af0..6bd0a6e9f7 100644
--- a/tools/opt/GraphPrinters.cpp
+++ b/tools/opt/GraphPrinters.cpp
@@ -70,8 +70,7 @@ namespace {
return false;
}
- void print(std::ostream &OS) const {}
- void print(std::ostream &OS, const llvm::Module*) const {}
+ void print(raw_ostream &OS, const llvm::Module*) const {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<CallGraph>();
diff --git a/tools/opt/PrintSCC.cpp b/tools/opt/PrintSCC.cpp
index a0aa4e90e7..66709ffa19 100644
--- a/tools/opt/PrintSCC.cpp
+++ b/tools/opt/PrintSCC.cpp
@@ -39,7 +39,7 @@ namespace {
CFGSCC() : FunctionPass(&ID) {}
bool runOnFunction(Function& func);
- void print(std::ostream &O, const Module* = 0) const { }
+ void print(raw_ostream &O, const Module* = 0) const { }
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
@@ -53,7 +53,7 @@ namespace {
// run - Print out SCCs in the call graph for the specified module.
bool runOnModule(Module &M);
- void print(std::ostream &O, const Module* = 0) const { }
+ void print(raw_ostream &O, const Module* = 0) const { }
// getAnalysisUsage - This pass requires the CallGraph.
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 4f24198640..f41b202349 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -140,7 +140,7 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass {
Function *F = SCC[i]->getFunction();
if (F) {
outs().flush();
- getAnalysisID<Pass>(PassToPrint).print(cout, F->getParent());
+ getAnalysisID<Pass>(PassToPrint).print(outs(), F->getParent());
cout << std::flush;
}
}
@@ -169,7 +169,7 @@ struct ModulePassPrinter : public ModulePass {
if (!Quiet) {
outs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
outs().flush();
- getAnalysisID<Pass>(PassToPrint).print(cout, &M);
+ getAnalysisID<Pass>(PassToPrint).print(outs(), &M);
cout << std::flush;
}
@@ -199,7 +199,7 @@ struct FunctionPassPrinter : public FunctionPass {
}
// Get and print pass...
outs().flush();
- getAnalysisID<Pass>(PassToPrint).print(cout, F.getParent());
+ getAnalysisID<Pass>(PassToPrint).print(outs(), F.getParent());
cout << std::flush;
return false;
}
@@ -224,7 +224,7 @@ struct LoopPassPrinter : public LoopPass {
if (!Quiet) {
outs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
outs().flush();
- getAnalysisID<Pass>(PassToPrint).print(cout,
+ getAnalysisID<Pass>(PassToPrint).print(outs(),
L->getHeader()->getParent()->getParent());
cout << std::flush;
}
@@ -256,7 +256,7 @@ struct BasicBlockPassPrinter : public BasicBlockPass {
// Get and print pass...
outs().flush();
- getAnalysisID<Pass>(PassToPrint).print(cout, BB.getParent()->getParent());
+ getAnalysisID<Pass>(PassToPrint).print(outs(), BB.getParent()->getParent());
cout << std::flush;
return false;
}