aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/IPA/CallGraph.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-06-25 16:13:24 +0000
committerChris Lattner <sabre@nondot.org>2002-06-25 16:13:24 +0000
commit7e70829632f82de15db187845666aaca6e04b792 (patch)
tree48dd2d804e7ebec9a3cbd8bf229cb2a2aa20dce5 /lib/Analysis/IPA/CallGraph.cpp
parent0b12b5f50ec77a8bd01b92d287c52d748619bb4b (diff)
MEGAPATCH checkin.
For details, See: docs/2002-06-25-MegaPatchInfo.txt git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/IPA/CallGraph.cpp')
-rw-r--r--lib/Analysis/IPA/CallGraph.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp
index c84719fd6a..1c61ff3d8b 100644
--- a/lib/Analysis/IPA/CallGraph.cpp
+++ b/lib/Analysis/IPA/CallGraph.cpp
@@ -95,31 +95,30 @@ void CallGraph::addToCallGraph(Function *M) {
}
// Look for an indirect method call...
- for (Function::iterator BBI = M->begin(), BBE = M->end(); BBI != BBE; ++BBI) {
- BasicBlock *BB = *BBI;
+ for (Function::iterator BB = M->begin(), BBE = M->end(); BB != BBE; ++BB)
for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE; ++II){
- Instruction *I = *II;
+ Instruction &I = *II;
- if (CallInst *CI = dyn_cast<CallInst>(I)) {
+ if (CallInst *CI = dyn_cast<CallInst>(&I)) {
if (CI->getCalledFunction() == 0)
Node->addCalledMethod(ExternalNode);
- } else if (InvokeInst *II = dyn_cast<InvokeInst>(I)) {
+ } else if (InvokeInst *II = dyn_cast<InvokeInst>(&I)) {
if (II->getCalledFunction() == 0)
Node->addCalledMethod(ExternalNode);
}
}
- }
}
-bool CallGraph::run(Module *TheModule) {
+bool CallGraph::run(Module &M) {
destroy();
- Mod = TheModule;
+ Mod = &M;
ExternalNode = getNodeFor(0);
Root = 0;
// Add every method to the call graph...
- for_each(Mod->begin(), Mod->end(), bind_obj(this,&CallGraph::addToCallGraph));
+ for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
+ addToCallGraph(I);
// If we didn't find a main method, use the external call graph node
if (Root == 0) Root = ExternalNode;