diff options
author | John Criswell <criswell@uiuc.edu> | 2005-12-19 19:54:23 +0000 |
---|---|---|
committer | John Criswell <criswell@uiuc.edu> | 2005-12-19 19:54:23 +0000 |
commit | 30751606643e36981e776e431b42daa8446a32f2 (patch) | |
tree | 3509f1fcca8a047dde5cbd4de5a7ae3c1abe1183 /lib/Analysis | |
parent | fa70052063dfb926bc8a486ac0c4430dcd54d28e (diff) | |
download | llvm-30751606643e36981e776e431b42daa8446a32f2.tar.gz llvm-30751606643e36981e776e431b42daa8446a32f2.tar.bz2 llvm-30751606643e36981e776e431b42daa8446a32f2.tar.xz |
Added an option to specify the names of heap freeing functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24863 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/DataStructure/Local.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index 3e6d424fc0..461b1a281b 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -45,6 +45,12 @@ AllocList("alloc-list", cl::desc("List of functions that allocate memory from the heap"), cl::CommaSeparated); +static cl::list<std::string> +FreeList("free-list", + cl::value_desc("list"), + cl::desc("List of functions that free memory from the heap"), + cl::CommaSeparated); + namespace llvm { namespace DS { // isPointerType - Return true if this type is big enough to hold a pointer. @@ -567,6 +573,20 @@ void GraphBuilder::visitCallSite(CallSite CS) { } } + // Determine if the called function is one of the specified heap + // free functions + for (cl::list<std::string>::iterator FreeFunc = FreeList.begin(), + LastFreeFunc = FreeList.end(); + FreeFunc != LastFreeFunc; + ++FreeFunc) { + if (F->getName() == *(FreeFunc)) { + // Mark that the node is written to... + if (DSNode *N = getValueDest(*(CS.getArgument(0))).getNode()) + N->setModifiedMarker()->setHeapNodeMarker(); + return; + } + } + if (F->getName() == "calloc" || F->getName() == "posix_memalign" || F->getName() == "memalign" || F->getName() == "valloc") { setDestTo(*CS.getInstruction(), |