From 535a4efdffdbd62d7c3956644cd6bdecdca7d18f Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 5 Aug 2010 17:53:17 +0000 Subject: Have getDirectCallTarget use CallSite git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@110351 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Core/StatsTracker.cpp | 2 +- lib/Module/ModuleUtil.cpp | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp index 08df3127..1c963bfc 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp @@ -615,7 +615,7 @@ void StatsTracker::computeReachableUncovered() { // (which should be correct anyhow). callTargets.insert(std::make_pair(it, std::vector())); - } else if (Function *target = getDirectCallTarget(it)) { + } else if (Function *target = getDirectCallTarget(cs)) { callTargets[it].push_back(target); } else { callTargets[it] = diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp index df495da8..17c4aa91 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp @@ -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" @@ -45,10 +46,8 @@ Module *klee::linkWithLibrary(Module *module, return linker.releaseModule(); } -Function *klee::getDirectCallTarget(const Instruction *i) { - assert(isa(i) || isa(i)); - - Value *v = i->getOperand(0); +Function *klee::getDirectCallTarget(CallSite cs) { + Value *v = cs.getCalledValue(); if (Function *f = dyn_cast(v)) { return f; } else if (llvm::ConstantExpr *ce = dyn_cast(v)) { -- cgit 1.4.1