diff options
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/DataStructure/Local.cpp | 5 | ||||
-rw-r--r-- | lib/Analysis/DataStructure/Printer.cpp | 5 | ||||
-rw-r--r-- | lib/Analysis/DataStructure/Steensgaard.cpp | 7 | ||||
-rw-r--r-- | lib/Analysis/IPA/Andersens.cpp | 49 | ||||
-rw-r--r-- | lib/Analysis/IPA/CallGraph.cpp | 13 | ||||
-rw-r--r-- | lib/Analysis/ScalarEvolutionExpander.cpp | 2 |
6 files changed, 44 insertions, 37 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index 3494737..436218b 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -24,7 +24,6 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Timer.h" -#include <iostream> // FIXME: This should eventually be a FunctionPass that is automatically // aggregated into a Pass. @@ -435,7 +434,7 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) { // Variable index into a node. We must merge all of the elements of the // sequential type here. if (isa<PointerType>(STy)) - std::cerr << "Pointer indexing not handled yet!\n"; + llvm_cerr << "Pointer indexing not handled yet!\n"; else { const ArrayType *ATy = cast<ArrayType>(STy); unsigned ElSize = TD.getTypeSize(CurTy); @@ -1062,7 +1061,7 @@ void GraphBuilder::visitCallSite(CallSite CS) { if (DisableDirectCallOpt || !isa<Function>(Callee)) { CalleeNode = getValueDest(*Callee).getNode(); if (CalleeNode == 0) { - std::cerr << "WARNING: Program is calling through a null pointer?\n"<< *I; + llvm_cerr << "WARNING: Program is calling through a null pointer?\n"<< *I; return; // Calling a null pointer? } } diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp index b425e4e..ef3ed75 100644 --- a/lib/Analysis/DataStructure/Printer.cpp +++ b/lib/Analysis/DataStructure/Printer.cpp @@ -19,9 +19,10 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/GraphWriter.h" +#include "llvm/Support/Streams.h" #include "llvm/ADT/Statistic.h" #include "llvm/Config/config.h" -#include <iostream> +#include <ostream> #include <fstream> #include <sstream> using namespace llvm; @@ -36,7 +37,7 @@ namespace { Statistic<> NumFoldedNodes ("dsa", "Number of folded nodes (in final graph)"); } -void DSNode::dump() const { print(std::cerr, 0); } +void DSNode::dump() const { print(llvm_cerr, 0); } static std::string getCaption(const DSNode *N, const DSGraph *G) { std::stringstream OS; diff --git a/lib/Analysis/DataStructure/Steensgaard.cpp b/lib/Analysis/DataStructure/Steensgaard.cpp index eb5b74c..292dfff 100644 --- a/lib/Analysis/DataStructure/Steensgaard.cpp +++ b/lib/Analysis/DataStructure/Steensgaard.cpp @@ -20,7 +20,7 @@ #include "llvm/Analysis/Passes.h" #include "llvm/Module.h" #include "llvm/Support/Debug.h" -#include <iostream> +#include <ostream> using namespace llvm; namespace { @@ -53,6 +53,9 @@ namespace { } // print - Implement the Pass::print method... + void print(llvm_ostream O, const Module *M) const { + if (O.stream()) print(*O.stream(), M); + } void print(std::ostream &O, const Module *M) const { assert(ResultGraph && "Result graph has not yet been computed!"); ResultGraph->writeGraphToFile(O, "steensgaards"); @@ -188,7 +191,7 @@ bool Steens::runOnModule(Module &M) { // FIXME: We should be able to disable the globals graph for steens! //ResultGraph->removeDeadNodes(DSGraph::KeepUnreachableGlobals); - DEBUG(print(std::cerr, &M)); + print(DOUT, &M); return false; } diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp index 73aa231..54e2944 100644 --- a/lib/Analysis/IPA/Andersens.cpp +++ b/lib/Analysis/IPA/Andersens.cpp @@ -62,7 +62,6 @@ #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" #include <set> -#include <iostream> using namespace llvm; namespace { @@ -534,7 +533,7 @@ Andersens::Node *Andersens::getNodeForConstantPointer(Constant *C) { case Instruction::BitCast: return getNodeForConstantPointer(CE->getOperand(0)); default: - std::cerr << "Constant Expr not yet handled: " << *CE << "\n"; + llvm_cerr << "Constant Expr not yet handled: " << *CE << "\n"; assert(0); } } else { @@ -561,7 +560,7 @@ Andersens::Node *Andersens::getNodeForConstantPointerTarget(Constant *C) { case Instruction::BitCast: return getNodeForConstantPointerTarget(CE->getOperand(0)); default: - std::cerr << "Constant Expr not yet handled: " << *CE << "\n"; + llvm_cerr << "Constant Expr not yet handled: " << *CE << "\n"; assert(0); } } else { @@ -787,7 +786,7 @@ void Andersens::visitInstruction(Instruction &I) { return; default: // Is this something we aren't handling yet? - std::cerr << "Unknown instruction: " << I; + llvm_cerr << "Unknown instruction: " << I; abort(); } } @@ -1105,13 +1104,13 @@ void Andersens::SolveConstraints() { void Andersens::PrintNode(Node *N) { if (N == &GraphNodes[UniversalSet]) { - std::cerr << "<universal>"; + llvm_cerr << "<universal>"; return; } else if (N == &GraphNodes[NullPtr]) { - std::cerr << "<nullptr>"; + llvm_cerr << "<nullptr>"; return; } else if (N == &GraphNodes[NullObject]) { - std::cerr << "<null>"; + llvm_cerr << "<null>"; return; } @@ -1120,56 +1119,56 @@ void Andersens::PrintNode(Node *N) { if (Function *F = dyn_cast<Function>(V)) { if (isa<PointerType>(F->getFunctionType()->getReturnType()) && N == getReturnNode(F)) { - std::cerr << F->getName() << ":retval"; + llvm_cerr << F->getName() << ":retval"; return; } else if (F->getFunctionType()->isVarArg() && N == getVarargNode(F)) { - std::cerr << F->getName() << ":vararg"; + llvm_cerr << F->getName() << ":vararg"; return; } } if (Instruction *I = dyn_cast<Instruction>(V)) - std::cerr << I->getParent()->getParent()->getName() << ":"; + llvm_cerr << I->getParent()->getParent()->getName() << ":"; else if (Argument *Arg = dyn_cast<Argument>(V)) - std::cerr << Arg->getParent()->getName() << ":"; + llvm_cerr << Arg->getParent()->getName() << ":"; if (V->hasName()) - std::cerr << V->getName(); + llvm_cerr << V->getName(); else - std::cerr << "(unnamed)"; + llvm_cerr << "(unnamed)"; if (isa<GlobalValue>(V) || isa<AllocationInst>(V)) if (N == getObject(V)) - std::cerr << "<mem>"; + llvm_cerr << "<mem>"; } void Andersens::PrintConstraints() { - std::cerr << "Constraints:\n"; + llvm_cerr << "Constraints:\n"; for (unsigned i = 0, e = Constraints.size(); i != e; ++i) { - std::cerr << " #" << i << ": "; + llvm_cerr << " #" << i << ": "; Constraint &C = Constraints[i]; if (C.Type == Constraint::Store) - std::cerr << "*"; + llvm_cerr << "*"; PrintNode(C.Dest); - std::cerr << " = "; + llvm_cerr << " = "; if (C.Type == Constraint::Load) - std::cerr << "*"; + llvm_cerr << "*"; PrintNode(C.Src); - std::cerr << "\n"; + llvm_cerr << "\n"; } } void Andersens::PrintPointsToGraph() { - std::cerr << "Points-to graph:\n"; + llvm_cerr << "Points-to graph:\n"; for (unsigned i = 0, e = GraphNodes.size(); i != e; ++i) { Node *N = &GraphNodes[i]; - std::cerr << "[" << (N->end() - N->begin()) << "] "; + llvm_cerr << "[" << (N->end() - N->begin()) << "] "; PrintNode(N); - std::cerr << "\t--> "; + llvm_cerr << "\t--> "; for (Node::iterator I = N->begin(), E = N->end(); I != E; ++I) { - if (I != N->begin()) std::cerr << ", "; + if (I != N->begin()) llvm_cerr << ", "; PrintNode(*I); } - std::cerr << "\n"; + llvm_cerr << "\n"; } } diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index d9e7242..9c22b7c 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -16,7 +16,8 @@ #include "llvm/Module.h" #include "llvm/Instructions.h" #include "llvm/Support/CallSite.h" -#include <iostream> +#include "llvm/Support/Streams.h" +#include <ostream> using namespace llvm; static bool isOnlyADirectCall(Function *F, CallSite CS) { @@ -72,6 +73,10 @@ public: AU.setPreservesAll(); } + 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 { o << "CallGraph Root is: "; if (Function *F = getRoot()->getFunction()) @@ -89,7 +94,7 @@ public: /// dump - Print out this call graph. /// inline void dump() const { - print(std::cerr, Mod); + print(llvm_cerr, Mod); } CallGraphNode* getExternalCallingNode() const { return ExternalCallingNode; } @@ -207,7 +212,7 @@ void CallGraph::print(std::ostream &OS, const Module *M) const { } void CallGraph::dump() const { - print(std::cerr, 0); + print(llvm_cerr, 0); } //===----------------------------------------------------------------------===// @@ -270,7 +275,7 @@ void CallGraphNode::print(std::ostream &OS) const { OS << "\n"; } -void CallGraphNode::dump() const { print(std::cerr); } +void CallGraphNode::dump() const { print(llvm_cerr); } void CallGraphNode::removeCallEdgeTo(CallGraphNode *Callee) { for (unsigned i = CalledFunctions.size(); ; --i) { diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index b6d77b9..3865d5f 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -174,7 +174,7 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) { SCEVHandle IH = SCEVUnknown::get(I); // Get I as a "symbolic" SCEV. SCEVHandle V = S->evaluateAtIteration(IH); - //std::cerr << "Evaluated: " << *this << "\n to: " << *V << "\n"; + //llvm_cerr << "Evaluated: " << *this << "\n to: " << *V << "\n"; return expandInTy(V, Ty); } |