[llvm-commits] [poolalloc] r48480 - in /poolalloc/branches/SVA: include/dsa/DSNode.h lib/DSA/Local.cpp
John Criswell
criswell at uiuc.edu
Mon Mar 17 19:49:11 PDT 2008
Author: criswell
Date: Mon Mar 17 21:49:11 2008
New Revision: 48480
URL: http://llvm.org/viewvc/llvm-project?rev=48480&view=rev
Log:
Add support for I/O allocations.
Modified:
poolalloc/branches/SVA/include/dsa/DSNode.h
poolalloc/branches/SVA/lib/DSA/Local.cpp
Modified: poolalloc/branches/SVA/include/dsa/DSNode.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/branches/SVA/include/dsa/DSNode.h?rev=48480&r1=48479&r2=48480&view=diff
==============================================================================
--- poolalloc/branches/SVA/include/dsa/DSNode.h (original)
+++ poolalloc/branches/SVA/include/dsa/DSNode.h Mon Mar 17 21:49:11 2008
@@ -158,11 +158,12 @@
Array = 1 << 7, // This node is treated like an array
External = 1 << 8, // This node comes from an external source
+ IONode = 1 << 9, // This node comes from an external source
//#ifndef NDEBUG
- DEAD = 1 << 9, // This node is dead and should not be pointed to
+ DEAD = 1 << 10, // This node is dead and should not be pointed to
//#endif
- Composition = AllocaNode | HeapNode | GlobalNode | UnknownNode
+ Composition = AllocaNode | HeapNode | GlobalNode | IONode | UnknownNode
};
/// NodeType - A union of the above bits. "Shadow" nodes do not add any flags
@@ -419,10 +420,12 @@
bool isComplete() const { return !isIncomplete(); }
bool isDeadNode() const { return NodeType & DEAD; }
bool isExternalNode() const { return NodeType & External; }
+ bool isIONode() const { return IONode & External; }
DSNode *setAllocaNodeMarker() { NodeType |= AllocaNode; return this; }
DSNode *setHeapNodeMarker() { NodeType |= HeapNode; return this; }
DSNode *setGlobalNodeMarker() { NodeType |= GlobalNode; return this; }
+ DSNode *setIONodeMarker() { NodeType |= IONode; return this; }
DSNode *setUnknownNodeMarker(); // { ++stat_unknown; NodeType |= UnknownNode; return this; }
DSNode *setExternalMarker() { NodeType |= External; return this; }
Modified: poolalloc/branches/SVA/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/branches/SVA/lib/DSA/Local.cpp?rev=48480&r1=48479&r2=48480&view=diff
==============================================================================
--- poolalloc/branches/SVA/lib/DSA/Local.cpp (original)
+++ poolalloc/branches/SVA/lib/DSA/Local.cpp Mon Mar 17 21:49:11 2008
@@ -79,6 +79,12 @@
cl::CommaSeparated, cl::Hidden);
static cl::list<std::string>
+IOAllocList("dsa-ioalloc-list",
+ cl::value_desc("list"),
+ cl::desc("List of functions that allocate memory for I/O"),
+ cl::CommaSeparated, cl::Hidden);
+
+static cl::list<std::string>
FreeList("dsa-free-list",
cl::value_desc("list"),
cl::desc("List of functions that free memory from the heap"),
@@ -1513,7 +1519,20 @@
RetNH.getNode()->getMP()->addCallSite(CS);
return;
}
-
+
+#ifdef SVA_IO
+ if (IOAllocList.end() != std::find(IOAllocList.begin(), IOAllocList.end(), F->getName())) {
+ DSNodeHandle RetNH;
+ if (F->getName() == "pseudo_alloc")
+ RetNH = getValueDest(**CS.arg_begin());
+ else
+ RetNH = getValueDest(*CS.getInstruction());
+ RetNH.getNode()->setIONodeMarker()->setModifiedMarker();
+ RetNH.getNode()->getMP()->addCallSite(CS);
+ return;
+ }
+#endif
+
// Determine if the called function is one of the specified heap
// free functions
if (FreeList.end() != std::find(FreeList.begin(), FreeList.end(),
@@ -1804,6 +1823,11 @@
AllocList.push_back("pseudo_alloc");
AllocList.push_back("malloc");
+#ifdef SVA_IO
+ IOAllocList.push_back("ioremap");
+ IOAllocList.push_back("ioremap_nocache");
+#endif
+
#if 0
FreeList.push_back("kfree");
#endif
More information about the llvm-commits
mailing list