Changes in directory llvm-poolalloc/lib/DSA:
DataStructure.cpp updated: 1.248.2.4.2.3 - 1.248.2.4.2.4
Local.cpp updated: 1.158.2.4.2.3 - 1.158.2.4.2.4
---
Log message:
use nifty new, simpler, smaller, easy to understand metapool inference (yea
yea, theres a memory leak in it
---
Diffs of the changes: (+49 -553)
DataStructure.cpp | 243
Local.cpp | 359 ++
2 files changed, 49 insertions(+), 553 deletions(-)
Index: llvm-poolalloc/lib/DSA/DataStructure.cpp
diff -u llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248.2.4.2.3
llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248.2.4.2.4
--- llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248.2.4.2.3 Wed Mar 7
16:49:43 2007
+++ llvm-poolalloc/lib/DSA/DataStructure.cppFri Mar 9 11:27:51 2007
@@ -98,6 +98,7 @@
DSNodeHandle DSScalarMap::AddGlobal(GlobalValue *GV) {
assert(ValueMap.count(GV) == 0 GV already exists!);
+ assert(isaGlobalValue((Value*)GV) not a global);
// If the node doesn't exist, check to see if it's a global that is
// equated to another global in the program.
@@ -125,7 +126,11 @@
//===--===//
DSNode::DSNode(const Type *T, DSGraph *G)
- : NumReferrers(0), Size(0), ParentGraph(G), Ty(Type::VoidTy), NodeType(0) {
+ : NumReferrers(0), Size(0), ParentGraph(G), Ty(Type::VoidTy), NodeType(0)
+#ifdef LLVA_KERNEL
+ , MP(0)
+#endif
+ {
// Add the type entry if it is specified...
if (T) mergeTypeInfo(T, 0);
if (G) G-addNode(this);
@@ -138,7 +143,11 @@
// DSNode copy constructor... do not copy over the referrers list!
DSNode::DSNode(const DSNode N, DSGraph *G, bool NullLinks)
: NumReferrers(0), Size(N.Size), ParentGraph(G),
-Ty(N.Ty), Globals(N.Globals), NodeType(N.NodeType) {
+Ty(N.Ty), Globals(N.Globals), NodeType(N.NodeType)
+#ifdef LLVA_KERNEL
+ , MP(N.MP.getPool())
+#endif
+ {
if (!NullLinks) {
Links = N.Links;
} else
@@ -153,19 +162,6 @@
DSNode::~DSNode() {
dropAllReferences();
assert(hasNoReferrers() Referrers to dead node exist!);
-
-#ifdef LLVA_KERNEL
- //
- // Remove all references to this node from the Pool Descriptor Map.
- //
-#if JTC
- std::cerr LLVA: Removing this \n;
-#endif
- if (ParentGraph) {
-hash_mapconst DSNode *, MetaPoolHandle*
pdm=ParentGraph-getPoolDescriptorsMap();
-pdm.erase (this);
- }
-#endif
}
/// getTargetData - Get the target data object used to construct this node.
@@ -201,6 +197,13 @@
NodeType = DEAD;
Size = 0;
Ty = Type::VoidTy;
+#ifdef LLVA_KERNEL
+ MetaPool* MP = new MetaPool();
+ MP-merge(getMP());
+ MP-merge(To-getMP());
+ setMP(MP);
+ To-setMP(MP);
+#endif
// Remove this node from the parent graph's Nodes list.
ParentGraph-unlinkNode(this);
@@ -261,21 +264,13 @@
DestNode-Ty = Type::VoidTy;
DestNode-Size = 1;
DestNode-Globals.swap(Globals);
+#ifdef LLVA_KERNEL
+DestNode-setMP(getMP());
+#endif
#if JTC
std::cerr LLVA: foldNode: this becomes DestNode \n;
#endif
-#ifdef LLVA_KERNEL
-//Again we have created a new DSNode, we need to fill in the
-// pool desc map appropriately
-assert(ParentGraph parent graph is not null \n);
-hash_mapconst DSNode *, MetaPoolHandle* pdm =
ParentGraph-getPoolDescriptorsMap();
-if (pdm.count(this) 0) {
- pdm[DestNode] = pdm[this];
-} else {
- //do nothing
-}
-#endif
// Start forwarding to the destination node...
forwardNode(DestNode, 0);
@@ -871,60 +866,11 @@
#endif
}
#ifdef LLVA_KERNEL
- DSNode *currNode = CurNodeH.getNode();
- DSNode *NNode = NH.getNode();
- DSGraph *pGraph = currNode-getParentGraph();
- assert((pGraph == NNode-getParentGraph()) LLVA_KERNEL : merging nodes
in two different graphs?);
- //get the pooldescriptor map
- hash_mapconst DSNode *, MetaPoolHandle* pdm =
pGraph-getPoolDescriptorsMap();
- if (pdm.count(currNode) == 0) {
-if (pdm.count(NNode) == 0) {
- //do nothing (common case)
-} else {
- if (pdm[NNode]) {
-#if JTC
- std::cerr LLVA: 1: currNode ( currNode ) becomes
pdm[NNode]-getName() ( NNode )\n;
-#endif
- pdm[currNode] = pdm[NNode];
- }
-}
- } else {
-if (pdm.count(NNode) == 0) {
-#if 1
- //
- // FIXME:
- // Verify that this is correct. I believe it is; it seems to make sense
- // since either node can be used after the merge.
- //
-#if JTC
-std::cerr LLVA: MergeNodes: currnode has something, newnode has nothing\n;
- std::cerr LLVA: 2: currNode ( currNode ) becomes no name
( NNode )\n;
-#endif
- pdm[NNode] = pdm[currNode];
-#endif
- //do nothing
-} else {
- if (pdm[currNode] != pdm[NNode]) {
- //The following is commented because pdm[..] could be null!
- //std::cerr LLVA: OldPool: pdm[currNode]-getName() (
-//