[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp
John Criswell
criswell at cs.uiuc.edu
Mon Dec 19 11:54:44 PST 2005
Changes in directory llvm/lib/Analysis/DataStructure:
Local.cpp updated: 1.136 -> 1.137
---
Log message:
Added an option to specify the names of heap freeing functions.
---
Diffs of the changes: (+20 -0)
Local.cpp | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+)
Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.136 llvm/lib/Analysis/DataStructure/Local.cpp:1.137
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.136 Mon Dec 19 11:38:39 2005
+++ llvm/lib/Analysis/DataStructure/Local.cpp Mon Dec 19 13:54:23 2005
@@ -45,6 +45,12 @@
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 @@
}
}
+ // 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(),
More information about the llvm-commits
mailing list