diff options
author | Duncan Sands <baldrick@free.fr> | 2008-09-09 19:56:34 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-09-09 19:56:34 +0000 |
commit | 3ebfa915b18975b0de427e7f93de58ae012cc304 (patch) | |
tree | 03b240c7bd9a597c33a9b2f1ea4e226e1f64c3fa /lib/Analysis | |
parent | 76944bd174830d003869ab80500c89f79e9da05c (diff) | |
download | external_llvm-3ebfa915b18975b0de427e7f93de58ae012cc304.zip external_llvm-3ebfa915b18975b0de427e7f93de58ae012cc304.tar.gz external_llvm-3ebfa915b18975b0de427e7f93de58ae012cc304.tar.bz2 |
Simplify this some more. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56003 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/IPA/CallGraph.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index 1a65179..fba1d00 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -124,26 +124,19 @@ private: } } + // Loop over all of the users of the function, looking for non-call uses. + for (Value::use_iterator I = F->use_begin(), E = F->use_end(); I != E; ++I) + if ((!isa<CallInst>(*I) && !isa<InvokeInst>(*I)) || I.getOperandNo()) { + // Not a call, or being used as a parameter rather than as the callee. + ExternalCallingNode->addCalledFunction(CallSite(), Node); + break; + } + // If this function is not defined in this translation unit, it could call // anything. if (F->isDeclaration() && !F->isIntrinsic()) Node->addCalledFunction(CallSite(), CallsExternalNode); - // Loop over all of the users of the function, looking for non-call uses. - bool isUsedExternally = false; - for (Value::use_iterator I = F->use_begin(), E = F->use_end(); - I != E && !isUsedExternally; ++I) { - if (Instruction *Inst = dyn_cast<Instruction>(*I)) { - CallSite CS = CallSite::get(Inst); - // Not a call? Or F being passed as a parameter not as the callee? - isUsedExternally = !CS.getInstruction() || I.getOperandNo(); - } else { // User is not a direct call! - isUsedExternally = true; - } - } - if (isUsedExternally) - ExternalCallingNode->addCalledFunction(CallSite(), Node); - // Look for calls by this function. for (Function::iterator BB = F->begin(), BBE = F->end(); BB != BBE; ++BB) for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); |