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 | 45bb70d8f9d0364123534e6100147c8a0e68dc7e (patch) | |
tree | c7864072f387aa4467f39d8508b0e25ac524bcea /llvm/lib/Analysis/DataStructure/Local.cpp | |
parent | aa0fed014807506ab00f75ffe3bb22a45e7b6bc1 (diff) | |
download | bcm5719-llvm-45bb70d8f9d0364123534e6100147c8a0e68dc7e.tar.gz bcm5719-llvm-45bb70d8f9d0364123534e6100147c8a0e68dc7e.zip |
Added an option to specify the names of heap freeing functions.
llvm-svn: 24863
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/Local.cpp')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/Local.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Local.cpp b/llvm/lib/Analysis/DataStructure/Local.cpp index 3e6d424fc09..461b1a281bc 100644 --- a/llvm/lib/Analysis/DataStructure/Local.cpp +++ b/llvm/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(), |