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 | aa0fed014807506ab00f75ffe3bb22a45e7b6bc1 (patch) | |
tree | 374034e9c3d30dab934a4bd32b69c89e91e1d738 /llvm/lib/Analysis/DataStructure/Local.cpp | |
parent | 9b9688aeb868a6c93c2b4adcb8dcda4f648f1a4a (diff) | |
download | bcm5719-llvm-aa0fed014807506ab00f75ffe3bb22a45e7b6bc1.tar.gz bcm5719-llvm-aa0fed014807506ab00f75ffe3bb22a45e7b6bc1.zip |
Added a command line option that allows the user to specify a list of
functions that allocate memory.
llvm-svn: 24862
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/Local.cpp')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/Local.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Local.cpp b/llvm/lib/Analysis/DataStructure/Local.cpp index 75ad018c149..3e6d424fc09 100644 --- a/llvm/lib/Analysis/DataStructure/Local.cpp +++ b/llvm/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(), |