Skip to content

Commit

Permalink
Have getDirectCallTarget use CallSite
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@110351 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
pcc committed Aug 5, 2010
1 parent 1d98ac4 commit 535a4ef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion include/klee/Internal/Support/ModuleUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace llvm {
class Function;
class Instruction;
class Module;
class CallSite;
}

namespace klee {
Expand All @@ -28,7 +29,7 @@ namespace klee {
/// null if it cannot be determined (should be only for indirect
/// calls, although complicated constant expressions might be
/// another possibility).
llvm::Function *getDirectCallTarget(const llvm::Instruction*);
llvm::Function *getDirectCallTarget(llvm::CallSite);

/// Return true iff the given Function value is used in something
/// other than a direct call (or a constant expression that
Expand Down
2 changes: 1 addition & 1 deletion lib/Core/StatsTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ void StatsTracker::computeReachableUncovered() {
// (which should be correct anyhow).
callTargets.insert(std::make_pair(it,
std::vector<Function*>()));
} else if (Function *target = getDirectCallTarget(it)) {
} else if (Function *target = getDirectCallTarget(cs)) {
callTargets[it].push_back(target);
} else {
callTargets[it] =
Expand Down
7 changes: 3 additions & 4 deletions lib/Module/ModuleUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "llvm/Module.h"
#include "llvm/Assembly/AsmAnnotationWriter.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Analysis/ValueTracking.h"
Expand Down Expand Up @@ -45,10 +46,8 @@ Module *klee::linkWithLibrary(Module *module,
return linker.releaseModule();
}

Function *klee::getDirectCallTarget(const Instruction *i) {
assert(isa<CallInst>(i) || isa<InvokeInst>(i));

Value *v = i->getOperand(0);
Function *klee::getDirectCallTarget(CallSite cs) {
Value *v = cs.getCalledValue();
if (Function *f = dyn_cast<Function>(v)) {
return f;
} else if (llvm::ConstantExpr *ce = dyn_cast<llvm::ConstantExpr>(v)) {
Expand Down

0 comments on commit 535a4ef

Please sign in to comment.