[llvm-commits] CVS: llvm/lib/Analysis/IPA/Andersens.cpp CallGraph.cpp
Bill Wendling
isanbard at gmail.com
Tue Nov 28 16:20:28 PST 2006
Changes in directory llvm/lib/Analysis/IPA:
Andersens.cpp updated: 1.37 -> 1.38
CallGraph.cpp updated: 1.58 -> 1.59
---
Log message:
Replacing std::iostreams with llvm iostreams. Some of these changes involve
adding a temporary wrapper around the ostream to make it friendly to
functions expecting an LLVM stream. This should be fixed in the future.
---
Diffs of the changes: (+33 -29)
Andersens.cpp | 49 ++++++++++++++++++++++++-------------------------
CallGraph.cpp | 13 +++++++++----
2 files changed, 33 insertions(+), 29 deletions(-)
Index: llvm/lib/Analysis/IPA/Andersens.cpp
diff -u llvm/lib/Analysis/IPA/Andersens.cpp:1.37 llvm/lib/Analysis/IPA/Andersens.cpp:1.38
--- llvm/lib/Analysis/IPA/Andersens.cpp:1.37 Sun Nov 26 19:05:09 2006
+++ llvm/lib/Analysis/IPA/Andersens.cpp Tue Nov 28 18:19:40 2006
@@ -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 @@
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 @@
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 @@
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::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 @@
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";
}
}
Index: llvm/lib/Analysis/IPA/CallGraph.cpp
diff -u llvm/lib/Analysis/IPA/CallGraph.cpp:1.58 llvm/lib/Analysis/IPA/CallGraph.cpp:1.59
--- llvm/lib/Analysis/IPA/CallGraph.cpp:1.58 Mon Oct 9 12:28:13 2006
+++ llvm/lib/Analysis/IPA/CallGraph.cpp Tue Nov 28 18:19:40 2006
@@ -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 @@
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 @@
/// 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::dump() const {
- print(std::cerr, 0);
+ print(llvm_cerr, 0);
}
//===----------------------------------------------------------------------===//
@@ -270,7 +275,7 @@
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) {
More information about the llvm-commits
mailing list