diff options
author | John Criswell <criswell@uiuc.edu> | 2005-12-19 17:38:39 +0000 |
---|---|---|
committer | John Criswell <criswell@uiuc.edu> | 2005-12-19 17:38:39 +0000 |
commit | fa70052063dfb926bc8a486ac0c4430dcd54d28e (patch) | |
tree | 7e9edc375e7e6e21eb04a3669e18d5bcf5f39bb5 /lib/Analysis | |
parent | d845582d4a4b866513f6e3b656dc80d59dc9c05b (diff) | |
download | external_llvm-fa70052063dfb926bc8a486ac0c4430dcd54d28e.zip external_llvm-fa70052063dfb926bc8a486ac0c4430dcd54d28e.tar.gz external_llvm-fa70052063dfb926bc8a486ac0c4430dcd54d28e.tar.bz2 |
Added a command line option that allows the user to specify a list of
functions that allocate memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24862 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/DataStructure/Local.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index 75ad018..3e6d424 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -39,6 +39,12 @@ static cl::opt<bool> TrackIntegersAsPointers("dsa-track-integers", cl::Hidden, cl::desc("If this is set, track integers as potential pointers")); +static cl::list<std::string> +AllocList("alloc-list", + cl::value_desc("list"), + cl::desc("List of functions that allocate memory from the heap"), + cl::CommaSeparated); + namespace llvm { namespace DS { // isPointerType - Return true if this type is big enough to hold a pointer. @@ -548,6 +554,19 @@ void GraphBuilder::visitCallSite(CallSite CS) { N->setModifiedMarker(); return; default: + // Determine if the called function is one of the specified heap + // allocation functions + for (cl::list<std::string>::iterator AllocFunc = AllocList.begin(), + LastAllocFunc = AllocList.end(); + AllocFunc != LastAllocFunc; + ++AllocFunc) { + if (F->getName() == *(AllocFunc)) { + setDestTo(*CS.getInstruction(), + createNode()->setHeapNodeMarker()->setModifiedMarker()); + return; + } + } + if (F->getName() == "calloc" || F->getName() == "posix_memalign" || F->getName() == "memalign" || F->getName() == "valloc") { setDestTo(*CS.getInstruction(), |