[llvm-commits] [release_19] CVS: llvm-poolalloc/lib/DSA/BottomUpClosure.cpp CallTargets.cpp CompleteBottomUp.cpp DataStructure.cpp DataStructureAA.cpp DataStructureOpt.cpp DataStructureStats.cpp EquivClassGraphs.cpp GraphChecker.cpp Local.cpp Makefile Printer.cpp Steensgaard.cpp TopDownClosure.cpp
John Criswell
criswell at cs.uiuc.edu
Tue Dec 12 14:43:06 PST 2006
Changes in directory llvm-poolalloc/lib/DSA:
BottomUpClosure.cpp updated: 1.123 -> 1.123.2.1
CallTargets.cpp updated: 1.4 -> 1.4.2.1
CompleteBottomUp.cpp updated: 1.37 -> 1.37.2.1
DataStructure.cpp updated: 1.248 -> 1.248.2.1
DataStructureAA.cpp updated: 1.40 -> 1.40.2.1
DataStructureOpt.cpp updated: 1.13 -> 1.13.2.1
DataStructureStats.cpp updated: 1.21 -> 1.21.2.1
EquivClassGraphs.cpp updated: 1.49 -> 1.49.2.1
GraphChecker.cpp updated: 1.21 -> 1.21.2.1
Local.cpp updated: 1.158 -> 1.158.2.1
Makefile updated: 1.5 -> 1.5.2.1
Printer.cpp updated: 1.86 -> 1.86.2.1
Steensgaard.cpp updated: 1.65 -> 1.65.2.1
TopDownClosure.cpp updated: 1.92 -> 1.92.2.1
---
Log message:
Adjusted DSA to build within the llvm-poolalloc project.
Merged in the pool inference code.
---
Diffs of the changes: (+701 -61)
BottomUpClosure.cpp | 12 -
CallTargets.cpp | 6
CompleteBottomUp.cpp | 4
DataStructure.cpp | 247 ++++++++++++++++++++++++++
DataStructureAA.cpp | 4
DataStructureOpt.cpp | 4
DataStructureStats.cpp | 4
EquivClassGraphs.cpp | 4
GraphChecker.cpp | 4
Local.cpp | 453 ++++++++++++++++++++++++++++++++++++++++++++++---
Makefile | 4
Printer.cpp | 6
Steensgaard.cpp | 5
TopDownClosure.cpp | 5
14 files changed, 701 insertions(+), 61 deletions(-)
Index: llvm-poolalloc/lib/DSA/BottomUpClosure.cpp
diff -u llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.123 llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.123.2.1
--- llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.123 Mon Oct 23 14:55:24 2006
+++ llvm-poolalloc/lib/DSA/BottomUpClosure.cpp Tue Dec 12 16:42:41 2006
@@ -14,8 +14,8 @@
//
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "bu_dsa"
-#include "llvm/Analysis/DataStructure/DataStructure.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
+#include "dsa/DataStructure.h"
+#include "dsa/DSGraph.h"
#include "llvm/Module.h"
#include "llvm/DerivedTypes.h"
#include "llvm/ADT/Statistic.h"
@@ -590,11 +590,11 @@
++NumBUInlines;
} else {
if (!Printed)
- std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n";
- std::cerr << " calls " << CalledFuncs.size()
+ DEBUG(std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n");
+ DEBUG(std::cerr << " calls " << CalledFuncs.size()
<< " fns from site: " << CS.getCallSite().getInstruction()
- << " " << *CS.getCallSite().getInstruction();
- std::cerr << " Fns =";
+ << " " << *CS.getCallSite().getInstruction());
+ DEBUG(std::cerr << " Fns =");
unsigned NumPrinted = 0;
for (std::vector<Function*>::iterator I = CalledFuncs.begin(),
Index: llvm-poolalloc/lib/DSA/CallTargets.cpp
diff -u llvm-poolalloc/lib/DSA/CallTargets.cpp:1.4 llvm-poolalloc/lib/DSA/CallTargets.cpp:1.4.2.1
--- llvm-poolalloc/lib/DSA/CallTargets.cpp:1.4 Sun Aug 27 17:31:12 2006
+++ llvm-poolalloc/lib/DSA/CallTargets.cpp Tue Dec 12 16:42:41 2006
@@ -19,9 +19,9 @@
#include "llvm/Module.h"
#include "llvm/Instructions.h"
-#include "llvm/Analysis/DataStructure/DataStructure.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
-#include "llvm/Analysis/DataStructure/CallTargets.h"
+#include "dsa/DataStructure.h"
+#include "dsa/DSGraph.h"
+#include "dsa/CallTargets.h"
#include "llvm/ADT/Statistic.h"
#include <iostream>
#include "llvm/Constants.h"
Index: llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp
diff -u llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp:1.37 llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp:1.37.2.1
--- llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp:1.37 Fri Oct 13 12:38:22 2006
+++ llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp Tue Dec 12 16:42:41 2006
@@ -14,9 +14,9 @@
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "cbudatastructure"
-#include "llvm/Analysis/DataStructure/DataStructure.h"
+#include "dsa/DataStructure.h"
#include "llvm/Module.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
+#include "dsa/DSGraph.h"
#include "llvm/Support/Debug.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/Statistic.h"
Index: llvm-poolalloc/lib/DSA/DataStructure.cpp
diff -u llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248 llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248.2.1
--- llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248 Thu Nov 2 14:25:49 2006
+++ llvm-poolalloc/lib/DSA/DataStructure.cpp Tue Dec 12 16:42:42 2006
@@ -1,3 +1,4 @@
+#define JTC 0
//===- DataStructure.cpp - Implement the core data structure analysis -----===//
//
// The LLVM Compiler Infrastructure
@@ -11,7 +12,9 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Analysis/DataStructure/DSGraphTraits.h"
+#include "dsa/DSGraphTraits.h"
+#include "dsa/DataStructure.h"
+#include "dsa/DSGraph.h"
#include "llvm/Constants.h"
#include "llvm/Function.h"
#include "llvm/GlobalVariable.h"
@@ -26,12 +29,13 @@
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Timer.h"
+#include "llvm/ADT/hash_map"
#include <iostream>
#include <algorithm>
using namespace llvm;
#define COLLAPSE_ARRAYS_AGGRESSIVELY 0
-
+#define LLVA_KERNEL 1
namespace {
Statistic<> NumFolds ("dsa", "Number of nodes completely folded");
Statistic<> NumCallNodesMerged("dsa", "Number of call nodes merged");
@@ -39,6 +43,9 @@
Statistic<> NumDNE ("dsa", "Number of nodes removed by reachability");
Statistic<> NumTrivialDNE ("dsa", "Number of nodes trivially removed");
Statistic<> NumTrivialGlobalDNE("dsa", "Number of globals trivially removed");
+#ifdef LLVA_KERNEL
+ Statistic<> LostPools ("dsa", "Number of pools lost to DSNode Merge");
+#endif
static cl::opt<unsigned>
DSAFieldLimit("dsa-field-limit", cl::Hidden,
cl::desc("Number of fields to track before collapsing a node"),
@@ -119,6 +126,9 @@
if (T) mergeTypeInfo(T, 0);
if (G) G->addNode(this);
++NumNodeAllocated;
+#if JTC
+std::cerr << "LLVA: Creating (1) DSNode " << this << "\n";
+#endif
}
// DSNode copy constructor... do not copy over the referrers list!
@@ -131,6 +141,27 @@
Links.resize(N.Links.size()); // Create the appropriate number of null links
G->addNode(this);
++NumNodeAllocated;
+#if JTC
+std::cerr << "LLVA: Creating (2) DSNode " << this << "\n";
+#endif
+}
+
+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_map<const DSNode *, MetaPoolHandle*> &pdm=ParentGraph->getPoolDescriptorsMap();
+ pdm.erase (this);
+ }
+#endif
}
/// getTargetData - Get the target data object used to construct this node.
@@ -226,10 +257,26 @@
DestNode->Ty = Type::VoidTy;
DestNode->Size = 1;
DestNode->Globals.swap(Globals);
+
+#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_map<const 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);
+
if (!Links.empty()) {
DestNode->Links.reserve(1);
@@ -819,7 +866,62 @@
}
#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_map<const 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() << "("
+ // << pdm[currNode] << ") "
+ // << " NewPool: " << pdm[NNode]->getName() << "("
+ // << pdm[NNode] << ")" << std::endl;
+ pdm[NNode]->merge(pdm[currNode]);
+ /*
+ Value *currN = pdm[currNode]->getMetaPoolValue();
+ Value *NN = pdm[NNode]->getMetaPoolValue();
+ if (currN != NN) {
+ std::cerr << "LLVA: Two Pools for one DSNode\n";
+ currN->replaceAllUsesWith(NN);
+ pdm[currNode]->merge(pdm[NNode]);
+ } else {
+ //The nodes are same
+ }
+ */
+ }
+ }
+ }
+#endif
// Merge the type entries of the two nodes together...
if (NH.getNode()->Ty != Type::VoidTy)
CurNodeH.getNode()->mergeTypeInfo(NH.getNode()->Ty, NOffset);
@@ -898,6 +1000,9 @@
/// point to this node).
///
void DSNode::mergeWith(const DSNodeHandle &NH, unsigned Offset) {
+#if JTC
+std::cerr << "LLVA: mergeWith: " << this << " becomes " << NH.getNode() << "\n";
+#endif
DSNode *N = NH.getNode();
if (N == this && NH.getOffset() == Offset)
return; // Noop
@@ -978,6 +1083,21 @@
DSNode *DN = new DSNode(*SN, &Dest, true /* Null out all links */);
DN->maskNodeTypes(BitsToKeep);
NH = DN;
+#if JTC
+std::cerr << "LLVA: getClonedNH: " << SN << " becomes " << DN << "\n";
+#endif
+#if 1
+#ifdef LLVA_KERNEL
+ //Again we have created a new DSNode, we need to fill in the
+ // pool desc map appropriately
+ hash_map<const DSNode *, MetaPoolHandle*> &pdm = Dest.getPoolDescriptorsMap();
+ if (pdm.count(SN) > 0) {
+ pdm[DN] = pdm[SN];
+ } else {
+ //do nothing
+ }
+#endif
+#endif
// Next, recursively clone all outgoing links as necessary. Note that
// adding these links can cause the node to collapse itself at any time, and
@@ -1136,7 +1256,58 @@
}
}
+#if JTC
+std::cerr << "LLVA: mergeWith: " << SN << " becomes " << DN << "\n";
+#endif
+#ifdef LLVA_KERNEL
+ //Here some merge is going on just like in DSNode::merge
+ //I think because of the inplace merging we don't update the pool desc maps
+ //This is modification from DSNode::MergeNodes
+ //Here DN and SN may belong to different graphs
+ DN = NH.getNode();
+#if 0
+ DSGraph *destGraph = DN->getParentGraph();
+ DSGraph *srcGraph = SN->getParentGraph();
+#else
+ DSGraph *destGraph = NH.getNode()->getParentGraph();
+ DSGraph *srcGraph = SN->getParentGraph();
+#endif
+ if (destGraph && srcGraph) {
+ //get the pooldescriptor map
+ hash_map<const DSNode *, MetaPoolHandle*> &destpdm = destGraph->getPoolDescriptorsMap();
+ hash_map<const DSNode *, MetaPoolHandle*> &srcpdm = srcGraph->getPoolDescriptorsMap();
+ if (destpdm.count(DN) == 0) {
+ if (srcpdm.count(SN) == 0) {
+ //do nothing (common case)
+ } else {
+ if (srcpdm[SN]) {
+#if JTC
+ std::cerr << "LLVA: DN becomes " << srcpdm[SN]->getName() << std::endl;
+#endif
+ destpdm[DN] = srcpdm[SN];
+ }
+ }
+ } else {
+ if (srcpdm.count(SN) == 0) {
+ srcpdm[SN] = destpdm[DN];
+ } else {
+ if (destpdm[DN] != srcpdm[SN]) {
+ srcpdm[SN]->merge(destpdm[DN]);
+ /*
+ Value *dnv = destpdm[DN]->getMetaPoolValue();
+ Value *snv = srcpdm[SN]->getMetaPoolValue();
+ if (dnv != snv) {
+ DEBUG(std::cerr << "LLVA: Two Pools for one DSNode\n");
+ dnv->replaceAllUsesWith(snv);
+ destpdm[DN]->setMetaPoolValue(snv);
+ }
+ */
+ }
+ }
+ }
+ }
+#endif
// Next, recursively merge all outgoing links as necessary. Note that
// adding these links can cause the destination node to collapse itself at
// any time, and the current node may be merged with arbitrary other nodes.
@@ -1205,6 +1376,53 @@
NH = RC.getClonedNH(Src);
}
+#ifdef LLVA_KERNEL
+// MetaPoolHandle Implementation
+ //The following should go in a cpp file later
+ MetaPoolHandle::MetaPoolHandle(MetaPool *mp, Instruction * Maker) {
+ Rep = mp;
+ Rep->insert(this);
+ Creator = Maker;
+ }
+ const std::string& MetaPoolHandle::getName() {
+ assert(Rep != 0 && "Null meta pool ??\n");
+ return Rep->getName();
+ }
+ Value *MetaPoolHandle::getMetaPoolValue() {
+ assert(Rep != 0 && "Null meta pool ??\n");
+ return Rep->getMetaPoolValue();
+ }
+ void MetaPoolHandle::merge(MetaPoolHandle *other) {
+ //after this operation other points to what this points to .
+ //first replace all uses
+ Value *dest = getMetaPoolValue();
+ Value *curr = other->getMetaPoolValue();
+ if (dest != curr) {
+ std::cerr << "LLVA: Merging metapools: " << this->Creator->getParent()->getParent()->getName() << " : " << other->Creator->getParent()->getParent()->getName() << "\n"
+ << "LLVA: " << *(this->Creator) << "\n"
+ << "LLVA: " << *(other->Creator) << "\n";
+ curr->replaceAllUsesWith(dest);
+ }
+
+ //merge the hash sets in to other
+ hash_set<MetaPoolHandle *> &otherHandleSet = other->getMetaPool()->getHandleSet();
+ hash_set<MetaPoolHandle *>::iterator ohsI = otherHandleSet.begin(), ohsE = otherHandleSet.end();
+ for (; ohsI != ohsE; ++ohsI) {
+ MetaPoolHandle *omph = *ohsI;
+ //now make sure that this omph points to what we point to
+ omph->setMetaPool(Rep);
+ Rep->insert(omph);
+ }
+
+ //now delete others MetaPool
+ //gd delete other->getMetaPool();
+
+ //Assign our metapool to other
+ other->setMetaPool(Rep);
+}
+
+#endif
+
//===----------------------------------------------------------------------===//
// DSGraph Implementation
//===----------------------------------------------------------------------===//
@@ -1226,7 +1444,7 @@
}
-DSGraph::DSGraph(const DSGraph &G, EquivalenceClasses<GlobalValue*> &ECs,
+DSGraph::DSGraph(DSGraph &G, EquivalenceClasses<GlobalValue*> &ECs,
unsigned CloneFlags)
: GlobalsGraph(0), ScalarMap(ECs), TD(G.TD) {
PrintAuxCalls = false;
@@ -1238,7 +1456,9 @@
AuxFunctionCalls.clear();
ScalarMap.clear();
ReturnNodes.clear();
-
+#ifdef LLVA_KERNEL
+ PoolDescriptors.clear();
+#endif
// Drop all intra-node references, so that assertions don't fail...
for (node_iterator NI = node_begin(), E = node_end(); NI != E; ++NI)
NI->dropAllReferences();
@@ -1296,7 +1516,7 @@
///
/// The CloneFlags member controls various aspects of the cloning process.
///
-void DSGraph::cloneInto(const DSGraph &G, unsigned CloneFlags) {
+void DSGraph::cloneInto( DSGraph &G, unsigned CloneFlags) {
TIME_REGION(X, "cloneInto");
assert(&G != this && "Cannot clone graph into itself!");
@@ -1314,6 +1534,10 @@
DSNode *New = new DSNode(*I, this);
New->maskNodeTypes(~BitsToClear);
OldNodeMap[I] = New;
+#ifdef LLVA_KERNEL
+ if (G.getPoolForNode(&*I))
+ PoolDescriptors[New] = G.getPoolForNode(&*I);
+#endif
}
#ifndef NDEBUG
@@ -1391,6 +1615,17 @@
// Merge the scalar map in.
ScalarMap.spliceFrom(RHS.ScalarMap);
+
+#ifdef LLVA_KERNEL
+ //Take all from the pooldescriptor map
+#if 0
+ PoolDescriptors.swap(RHS.getPoolDescriptorsMap());
+#else
+ hash_map<const DSNode *, MetaPoolHandle*>& rhsmap = RHS.getPoolDescriptorsMap();
+ PoolDescriptors.insert(rhsmap.begin(), rhsmap.end());
+#endif
+ RHS.getPoolDescriptorsMap().clear();
+#endif
}
/// spliceFrom - Copy all entries from RHS, then clear RHS.
Index: llvm-poolalloc/lib/DSA/DataStructureAA.cpp
diff -u llvm-poolalloc/lib/DSA/DataStructureAA.cpp:1.40 llvm-poolalloc/lib/DSA/DataStructureAA.cpp:1.40.2.1
--- llvm-poolalloc/lib/DSA/DataStructureAA.cpp:1.40 Sun Aug 27 19:42:29 2006
+++ llvm-poolalloc/lib/DSA/DataStructureAA.cpp Tue Dec 12 16:42:42 2006
@@ -17,8 +17,8 @@
#include "llvm/Module.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Analysis/DataStructure/DataStructure.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
+#include "dsa/DataStructure.h"
+#include "dsa/DSGraph.h"
using namespace llvm;
namespace {
Index: llvm-poolalloc/lib/DSA/DataStructureOpt.cpp
diff -u llvm-poolalloc/lib/DSA/DataStructureOpt.cpp:1.13 llvm-poolalloc/lib/DSA/DataStructureOpt.cpp:1.13.2.1
--- llvm-poolalloc/lib/DSA/DataStructureOpt.cpp:1.13 Sun Aug 27 17:42:51 2006
+++ llvm-poolalloc/lib/DSA/DataStructureOpt.cpp Tue Dec 12 16:42:42 2006
@@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Analysis/DataStructure/DataStructure.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
+#include "dsa/DataStructure.h"
+#include "dsa/DSGraph.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/Module.h"
#include "llvm/Constant.h"
Index: llvm-poolalloc/lib/DSA/DataStructureStats.cpp
diff -u llvm-poolalloc/lib/DSA/DataStructureStats.cpp:1.21 llvm-poolalloc/lib/DSA/DataStructureStats.cpp:1.21.2.1
--- llvm-poolalloc/lib/DSA/DataStructureStats.cpp:1.21 Sun Aug 27 17:30:17 2006
+++ llvm-poolalloc/lib/DSA/DataStructureStats.cpp Tue Dec 12 16:42:42 2006
@@ -11,8 +11,8 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Analysis/DataStructure/DataStructure.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
+#include "dsa/DataStructure.h"
+#include "dsa/DSGraph.h"
#include "llvm/Function.h"
#include "llvm/Instructions.h"
#include "llvm/Pass.h"
Index: llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp
diff -u llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp:1.49 llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp:1.49.2.1
--- llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp:1.49 Thu Nov 2 14:25:49 2006
+++ llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp Tue Dec 12 16:42:42 2006
@@ -15,11 +15,11 @@
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "ECGraphs"
-#include "llvm/Analysis/DataStructure/DataStructure.h"
+#include "dsa/DataStructure.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
+#include "dsa/DSGraph.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/Debug.h"
#include "llvm/ADT/SCCIterator.h"
Index: llvm-poolalloc/lib/DSA/GraphChecker.cpp
diff -u llvm-poolalloc/lib/DSA/GraphChecker.cpp:1.21 llvm-poolalloc/lib/DSA/GraphChecker.cpp:1.21.2.1
--- llvm-poolalloc/lib/DSA/GraphChecker.cpp:1.21 Sun Aug 27 17:30:17 2006
+++ llvm-poolalloc/lib/DSA/GraphChecker.cpp Tue Dec 12 16:42:42 2006
@@ -23,8 +23,8 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Analysis/DataStructure/DataStructure.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
+#include "dsa/DataStructure.h"
+#include "dsa/DSGraph.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Value.h"
#include <iostream>
Index: llvm-poolalloc/lib/DSA/Local.cpp
diff -u llvm-poolalloc/lib/DSA/Local.cpp:1.158 llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.1
--- llvm-poolalloc/lib/DSA/Local.cpp:1.158 Fri Nov 3 11:43:19 2006
+++ llvm-poolalloc/lib/DSA/Local.cpp Tue Dec 12 16:42:42 2006
@@ -1,3 +1,4 @@
+#define JTC 0
//===- Local.cpp - Compute a local data structure graph for a function ----===//
//
// The LLVM Compiler Infrastructure
@@ -12,8 +13,10 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Analysis/DataStructure/DataStructure.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
+#define LLVA_KERNEL 1
+#include "llvm/ADT/Statistic.h"
+#include "dsa/DataStructure.h"
+#include "dsa/DSGraph.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Instructions.h"
@@ -33,6 +36,12 @@
using namespace llvm;
+#ifdef LLVA_KERNEL
+static Statistic<> CacheAllocs ("dsa", "Number of kmem_cache_alloc calls");
+static Statistic<> KMallocs ("dsa", "Number of kmalloc calls");
+static Statistic<> GlobalPools ("dsa", "Number of global pools");
+#endif
+
static RegisterPass<LocalDataStructures>
X("datastructure", "Local Data Structure Analysis");
@@ -87,27 +96,59 @@
DSNodeHandle *RetNode; // Node that gets returned...
DSScalarMap &ScalarMap;
std::list<DSCallSite> *FunctionCalls;
-
+ Value * KMallocPool;
public:
GraphBuilder(Function &f, DSGraph &g, DSNodeHandle &retNode,
std::list<DSCallSite> &fc)
: G(g), RetNode(&retNode), ScalarMap(G.getScalarMap()),
FunctionCalls(&fc) {
-
+ // Find the type unsafe pool in the program
+ KMallocPool = f.getParent()->getNamedGlobal ("KmallocPool");
+
+#if 1
+ //
+ // Determine if the function somehow escapes
+ //
+ bool escapes = false;
+ if (!(f.hasInternalLinkage())) {
+ escapes = true;
+ }
+ Value::use_iterator U;
+ for (U=f.use_begin(); U != f.use_end(); ++U) {
+ if (isa<GlobalValue>(U)) {
+ std::cerr << "LLVA: isa: " << f.getName() << " " << *U << std::endl;
+ escapes = true;
+ break;
+ }
+ }
+#endif
// Create scalar nodes for all pointer arguments...
for (Function::arg_iterator I = f.arg_begin(), E = f.arg_end();
- I != E; ++I)
- if (isPointerType(I->getType()))
- getValueDest(*I);
+ I != E; ++I) {
+ if (isPointerType(I->getType())) {
+ DSNode * Node = getValueDest(*I).getNode();
+ if (!(f.hasInternalLinkage())) {
+ Node->setExternalMarker();
+ }
+ }
+ }
visit(f); // Single pass over the function
+#if JTC
+std::cerr << "LLVA: Function " << f.getName() << "\n";
+ for (DSScalarMap::iterator I = ScalarMap.begin(), E=ScalarMap.end();
+ I != E;
+ ++I)
+ {
+ std::cerr << "LLVA:\t" << I->first->getName() << ": " << (void *)(I->second.getNode()) << "\n";
+ }
+#endif
}
// GraphBuilder ctor for working on the globals graph
GraphBuilder(DSGraph &g)
: G(g), RetNode(0), ScalarMap(G.getScalarMap()), FunctionCalls(0) {
}
-
void mergeInGlobalInitializer(GlobalVariable *GV);
private:
@@ -341,6 +382,24 @@
void GraphBuilder::visitGetElementPtrInst(User &GEP) {
+
+#if 1
+ int debug = 0;
+ if (isa<Instruction>(GEP)) {
+ Instruction * IGEP = (Instruction *)(&GEP);
+ if (IGEP->getParent()->getParent()->getName() == "alloc_vfsmnt")
+ {
+#if 0
+ if (G.getPoolDescriptorsMap().count(N) != 0)
+ if (G.getPoolDescriptorsMap()[N])
+ std::cerr << "LLVA: GEP[" << count << "]: Pool for " << GEP.getName() << " is " << G.getPoolDescriptorsMap()[N]->getMetaPoolValue()->getName() << "\n";
+#else
+ debug = 1;
+#endif
+ }
+ }
+#endif
+
DSNodeHandle Value = getValueDest(*GEP.getOperand(0));
if (Value.isNull())
Value = createNode();
@@ -360,6 +419,11 @@
if (AllZeros || (!Value.isNull() &&
Value.getNode()->isNodeCompletelyFolded())) {
setDestTo(GEP, Value);
+#if 0
+if (debug) std::cerr << "LLVA: GEP: All Zeros\n";
+ if (G.getPoolDescriptorsMap()[Value.getNode()])
+ std::cerr << "LLVA: GEP: Pool for " << GEP.getName() << " is " << G.getPoolDescriptorsMap()[Value.getNode()]->getName() << "\n";
+#endif
return;
}
@@ -370,6 +434,8 @@
if (Value.getNode()->mergeTypeInfo(CurTy, Value.getOffset())) {
// If the node had to be folded... exit quickly
setDestTo(GEP, Value); // GEP result points to folded node
+
+if (debug) std::cerr << "LLVA: GEP: Funny Return\n";
return;
}
@@ -468,9 +534,23 @@
N->foldNodeCompletely();
}
}
-
+
// Value is now the pointer we want to GEP to be...
setDestTo(GEP, Value);
+#if 0
+ if (debug && (isa<Instruction>(GEP))) {
+ Instruction * IGEP = (Instruction *)(&GEP);
+ DSNode * N = Value.getNode();
+ if (IGEP->getParent()->getParent()->getName() == "alloc_vfsmnt")
+ {
+ if (G.getPoolDescriptorsMap().count(N) != 0)
+ if (G.getPoolDescriptorsMap()[N])
+ std::cerr << "LLVA: GEP[" << 0 << "]: Pool for " << GEP.getName() << " is " << G.getPoolDescriptorsMap()[N]->getName() << "\n";
+ }
+ }
+#endif
+
+if (debug) std::cerr << "LLVA: GEP: Normal Return\n";
}
void GraphBuilder::visitLoadInst(LoadInst &LI) {
@@ -486,6 +566,10 @@
if (isPointerType(LI.getType()))
setDestTo(LI, getLink(Ptr));
+#if 0
+ if (G.getPoolDescriptorsMap()[getLink(Ptr).getNode()])
+ std::cerr << "LLVA: Load: Pool for " << LI.getName() << " is " << G.getPoolDescriptorsMap()[getLink(Ptr).getNode()]->getName() << "\n";
+#endif
}
void GraphBuilder::visitStoreInst(StoreInst &SI) {
@@ -502,6 +586,16 @@
// Avoid adding edges from null, or processing non-"pointer" stores
if (isPointerType(StoredTy))
Dest.addEdgeTo(getValueDest(*SI.getOperand(0)));
+#if 1
+ {
+ if (SI.getParent()->getParent()->getName() == "alloc_vfsmnt") {
+ DSNode * N = getValueDest(*SI.getOperand(1)).getNode();
+ if (G.getPoolDescriptorsMap().count(N) != 0)
+ if (G.getPoolDescriptorsMap()[N])
+ std::cerr << "LLVA: Store: Pool for " << SI.getName() << " is " << G.getPoolDescriptorsMap()[N]->getName() << "\n";
+ }
+ }
+#endif
}
void GraphBuilder::visitReturnInst(ReturnInst &RI) {
@@ -1000,7 +1094,155 @@
if (DSNode *N = getValueDest(**(CS.arg_begin() + 1)).getNode())
N->setReadMarker();
return true;
+#ifdef LLVA_KERNEL_0
+ } else if (F->getName() == "kmem_cache_alloc") {
+ DEBUG(std::cerr << "LLVA: kmem_cache_alloc" << std::endl);
+ // Update the statistics count
+ ++CacheAllocs;
+
+ // Create a new DSNode for this memory allocation
+ DSNode *N = createNode();
+ N->setHeapNodeMarker();
+ setDestTo(*CS.getInstruction(), N);
+
+ // Get the pool handle
+ if (CS.arg_begin() == CS.arg_end()) {
+ abort(); //Hanlde this later
+ // Treat it as a kmalloc
+ N->foldNodeCompletely();
+ //This becomes a kmalloc pool
+ MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(KMallocPool));
+ G.getPoolDescriptorsMap()[N] = tmpvh;
+ } else {
+ Value *actualPD = *(CS.arg_begin());
+ if (!isa<GlobalValue>(actualPD)) {
+ std::cerr << "WARNING: Pool is not global. Function = " << CS.getCaller()->getName() << "\n";
+ } else {
+ ++GlobalPools;
+ }
+ Value *TheMetaPool = actualPD;
+ if (G.getPoolDescriptorsMap().count(N)== 0) {
+ //Here we insert a global meta pool
+ //Get the Module first
+ Module * M = F->getParent();
+ //Now create a meta pool for this value, DSN Node
+ const Type * VoidPtrType = PointerType::get(Type::SByteTy);
+ TheMetaPool = new GlobalVariable(
+ /*type=*/ VoidPtrType,
+ /*isConstant=*/ false,
+ /*Linkage=*/ GlobalValue::InternalLinkage,
+ /*initializer=*/ Constant::getNullValue(VoidPtrType),
+ /*name=*/ "_metaPool_",
+ /*parent=*/ M );
+ //Inserted a global meta pool
+ }
+ //Now insert a function call that takes care of adding this pool to the global pool
+
+ //First get the Insert point
+ Instruction *InsertPoint = CS.getInstruction();
+
+ //Assumes AddPoolDescToMetaPool is in the module
+ CastInst *CastMetaPool =
+ new CastInst(TheMetaPool,
+ PointerType::get(Type::SByteTy), "metapool.casted", InsertPoint);
+ CastInst *CastActualPD =
+ new CastInst(actualPD,
+ PointerType::get(Type::SByteTy), "poolhandle.lscasted", InsertPoint);
+
+ // Create the call to AddPoolDescToMetaPool
+ std::vector<Value *> args(1,CastMetaPool);
+ args.push_back(CastActualPD);
+ new CallInst(AddPoolDescToMetaPool,args,"", InsertPoint);
+ MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool));
+ G.getPoolDescriptorsMap()[N] = tmpvh;
+ }
+ } else if (F->getName() == "poolalloc") {
+ if (CS.getCaller()->getName() == "kmem_cache_alloc")
+ return;
+ // Update the statistics
+ ++KMallocs;
+
+ // Create a DSNode for the memory allocated by this function call
+ DSNode *N = createNode();
+ N->setHeapNodeMarker();
+ setDestTo(*CS.getInstruction(), N);
+
+ // Get the pool handle, if possible
+ if (CS.arg_begin() == CS.arg_end()) {
+ abort(); //handle later
+ // Treat it as kmalloc
+ N->foldNodeCompletely();
+ //This becomes a kmalloc pool
+ //So get the kmalloc pool
+ MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(KMallocPool));
+ G.getPoolDescriptorsMap()[N] = tmpvh;
+ } else {
+ Value *actualPD = *(CS.arg_begin());
+ if (!isa<GlobalValue>(actualPD)) {
+ std::cerr << "WARNING: Pool is not global. Function = " << CS.getCaller()->getName() << "\n";
+ } else {
+ ++GlobalPools;
+ }
+ Value *TheMetaPool = actualPD;
+ if (G.getPoolDescriptorsMap().count(N)== 0) {
+ //Here we insert a global meta pool
+ //Get the Module first
+ Module * M = F->getParent();
+ //Now create a meta pool for this value, DSN Node
+ const Type * VoidPtrType = PointerType::get(Type::SByteTy);
+ TheMetaPool = new GlobalVariable(
+ /*type=*/ VoidPtrType,
+ /*isConstant=*/ false,
+ /*Linkage=*/ GlobalValue::InternalLinkage,
+ /*initializer=*/ Constant::getNullValue(VoidPtrType),
+ /*name=*/ "_metaPool_",
+ /*parent=*/ M );
+ //Inserted a global meta pool
+ }
+ //Now insert a function call that takes care of adding this pool to the global pool
+ //First get the Insert point
+ Instruction *InsertPoint = CS.getInstruction();
+
+ //Assumes AddPoolDescToMetaPool is in the module
+ CastInst *CastMetaPool =
+ new CastInst(TheMetaPool,
+ PointerType::get(Type::SByteTy), "metapool.casted", InsertPoint);
+ CastInst *CastActualPD =
+ new CastInst(actualPD,
+ PointerType::get(Type::SByteTy), "poolhandle.lscasted", InsertPoint);
+
+ // Create the call to AddPoolDescToMetaPool
+ std::vector<Value *> args(1,CastMetaPool);
+ args.push_back(CastActualPD);
+ new CallInst(AddPoolDescToMetaPool,args,"", InsertPoint);
+ MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool));
+ G.getPoolDescriptorsMap()[N] = tmpvh;
+ }
+#endif
+#ifdef LLVA_KERNEL
+ } else if (F->getName() == "llva_memcpy") {
+ if (CS.getCaller()->getName() == "kmem_cache_alloc")
+ return false;
+ // Merge the first & second arguments, and mark the memory read and
+ // modified.
+ DSNodeHandle RetNH = getValueDest(**CS.arg_begin());
+ RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1)));
+ if (DSNode *N = RetNH.getNode())
+ N->setModifiedMarker()->setReadMarker();
+ return true;
+ } else if (F->getName() == "__generic_copy_from_user") {
+ if (CS.getCaller()->getName() == "kmem_cache_alloc")
+ return false;
+ // Merge the first & second arguments, and mark the memory read and
+ // modified.
+ DSNodeHandle RetNH = getValueDest(**CS.arg_begin());
+ RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1)));
+ if (DSNode *N = RetNH.getNode())
+ N->setModifiedMarker()->setReadMarker();
+ return true;
+#endif
}
+
return false;
}
@@ -1008,29 +1250,192 @@
Value *Callee = CS.getCalledValue();
// Special case handling of certain libc allocation functions here.
- if (Function *F = dyn_cast<Function>(Callee))
+ if (Function *F = dyn_cast<Function>(Callee)) {
+#ifdef LLVA_KERNEL
+ if (F->getName() == "kmem_cache_alloc") {
+ DEBUG(std::cerr << "LLVA: kmem_cache_alloc" << std::endl);
+ // Update the statistics count
+ ++CacheAllocs;
+
+ // Create a new DSNode for this memory allocation
+ DSNode *N = createNode();
+ N->setHeapNodeMarker();
+ setDestTo(*CS.getInstruction(), N);
+
+ // Get the pool handle
+ if (CS.arg_begin() == CS.arg_end()) {
+ abort(); //Handle this later
+ // Treat it as a kmalloc
+ N->foldNodeCompletely();
+ //This becomes a kmalloc pool
+ MetaPoolHandle* mpvh = new MetaPoolHandle(new MetaPool(KMallocPool));
+ G.getPoolDescriptorsMap()[N] = mpvh;
+ } else {
+ Value *actualPD = *(CS.arg_begin());
+ if (!isa<GlobalValue>(actualPD)) {
+ std::cerr << "WARNING: Pool is not global. Function = " << CS.getCaller()->getName() << "\n";
+ } else {
+ ++GlobalPools;
+ }
+ Value *TheMetaPool = actualPD;
+ //Get the Module first
+ Module * M = F->getParent();
+ if (G.getPoolDescriptorsMap().count(N)== 0) {
+ //Here we insert a global meta pool
+ //Now create a meta pool for this value, DSN Node
+ const Type * VoidPtrType = PointerType::get(Type::SByteTy);
+ TheMetaPool = new GlobalVariable(
+ /*type=*/ VoidPtrType,
+ /*isConstant=*/ false,
+ /*Linkage=*/ GlobalValue::InternalLinkage,
+ /*initializer=*/ Constant::getNullValue(VoidPtrType),
+ /*name=*/ "_metaPool_",
+ /*parent=*/ M );
+ //Inserted a global meta pool
+ }
+#if 1
+ else {
+ // Lookup the meta pool
+ TheMetaPool = G.getPoolForNode(N)->getMetaPoolValue();
+ }
+#endif
+ //Now insert a function call that takes care of adding this pool to the global pool
+
+ //First get the Insert point
+ Instruction *InsertPoint = CS.getInstruction();
+
+ //Assumes AddPoolDescToMetaPool is in the module
+ const Type * VoidPtrType = PointerType::get(Type::SByteTy);
+ const Type * VoidPtrPtrType = PointerType::get(VoidPtrType);
+ CastInst *CastMetaPool =
+ new CastInst(TheMetaPool,
+ VoidPtrPtrType, "metapool.casted", InsertPoint);
+ CastInst *CastActualPD =
+ new CastInst(actualPD,
+ PointerType::get(Type::SByteTy), "poolhandle.lscasted", InsertPoint);
+
+ // Create the call to AddPoolDescToMetaPool
+ std::vector<Value *> args(1,CastMetaPool);
+ args.push_back(CastActualPD);
+
+ //Get the AddPoolDescToMetaPool function from the module
+ //FIXME optimize it by getting it once per module
+ std::vector<const Type *> Arg(1, VoidPtrPtrType);
+ Arg.push_back(VoidPtrType);
+ FunctionType *AddPoolDescToMetaPoolTy =
+ FunctionType::get(Type::VoidTy,Arg, false);
+ Function *AddPoolDescToMetaPool = M->getOrInsertFunction("AddPoolDescToMetaPool", AddPoolDescToMetaPoolTy);
+
+
+ new CallInst(AddPoolDescToMetaPool,args,"", InsertPoint);
+#if 0
+ MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool));
+#else
+ MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool), CS.getInstruction());
+#endif
+ G.getPoolDescriptorsMap()[N] = tmpvh;
+ }
+ return;
+ } else if (F->getName() == "poolalloc") {
+ if (CS.getCaller()->getName() == "kmem_cache_alloc")
+ return;
+ // Update the statistics
+ ++KMallocs;
+
+ // Create a DSNode for the memory allocated by this function call
+ DSNode *N = createNode();
+ N->setHeapNodeMarker();
+ setDestTo(*CS.getInstruction(), N);
+
+ // Get the pool handle, if possible
+ if (CS.arg_begin() == CS.arg_end()) {
+ abort() ; //Handle this later
+ // Treat it as kmalloc
+ N->foldNodeCompletely();
+ //This becomes a kmalloc pool
+ //So get the kmalloc pool
+ MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(KMallocPool));
+ G.getPoolDescriptorsMap()[N] = tmpvh;
+ } else {
+ Value *actualPD = *(CS.arg_begin());
+ if (!isa<GlobalValue>(actualPD)) {
+ std::cerr << "WARNING: Pool is not global. Function = " << CS.getCaller()->getName() << "\n";
+ } else {
+ ++GlobalPools;
+ }
+ Value *TheMetaPool = actualPD;
+ Module * M = F->getParent();
+ if (G.getPoolDescriptorsMap().count(N)== 0) {
+ //Here we insert a global meta pool
+ //Get the Module first
+ //Now create a meta pool for this value, DSN Node
+ const Type * VoidPtrType = PointerType::get(Type::SByteTy);
+ TheMetaPool = new GlobalVariable(
+ /*type=*/ VoidPtrType,
+ /*isConstant=*/ false,
+ /*Linkage=*/ GlobalValue::InternalLinkage,
+ /*initializer=*/ Constant::getNullValue(VoidPtrType),
+ /*name=*/ "_metaPool_",
+ /*parent=*/ M );
+ //Inserted a global meta pool
+ }
+ //Now insert a function call that takes care of adding this pool to the global pool
+ //First get the Insert point
+ Instruction *InsertPoint = CS.getInstruction();
+
+ //Assumes AddPoolDescToMetaPool is in the module
+ const Type * VoidPtrType = PointerType::get(Type::SByteTy);
+ const Type * VoidPtrPtrType = PointerType::get(VoidPtrType);
+ CastInst *CastMetaPool =
+ new CastInst(TheMetaPool,
+ VoidPtrPtrType, "metapool.casted", InsertPoint);
+ CastInst *CastActualPD =
+ new CastInst(actualPD,
+ PointerType::get(Type::SByteTy), "poolhandle.lscasted", InsertPoint);
+
+ // Create the call to AddPoolDescToMetaPool
+ std::vector<Value *> args(1,CastMetaPool);
+ args.push_back(CastActualPD);
+
+ //FIXME optimize it by getting it once per module
+ std::vector<const Type *> Arg(1, VoidPtrPtrType);
+ Arg.push_back(VoidPtrType);
+ FunctionType *AddPoolDescToMetaPoolTy =
+ FunctionType::get(Type::VoidTy,Arg, false);
+ Function *AddPoolDescToMetaPool = M->getOrInsertFunction("AddPoolDescToMetaPool", AddPoolDescToMetaPoolTy);
+
+ new CallInst(AddPoolDescToMetaPool,args,"", InsertPoint);
+ MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool));
+ G.getPoolDescriptorsMap()[N] = tmpvh;
+ }
+ return;
+ }
+#endif
if (F->isExternal())
if (F->isIntrinsic() && visitIntrinsic(CS, F))
return;
else {
// Determine if the called function is one of the specified heap
// allocation functions
- if (AllocList.end() != std::find(AllocList.begin(), AllocList.end(), F->getName())) {
- setDestTo(*CS.getInstruction(),
- createNode()->setHeapNodeMarker()->setModifiedMarker());
- return;
- }
+ if (AllocList.end() != std::find(AllocList.begin(), AllocList.end(), F->getName())) {
+ setDestTo(*CS.getInstruction(),
+ createNode()->setHeapNodeMarker()->setModifiedMarker());
+ return;
+ }
// Determine if the called function is one of the specified heap
// free functions
- if (FreeList.end() != std::find(FreeList.begin(), FreeList.end(), F->getName())) {
- // Mark that the node is written to...
- if (DSNode *N = getValueDest(*(CS.getArgument(0))).getNode())
- N->setModifiedMarker()->setHeapNodeMarker();
- return;
- }
- if (visitExternal(CS,F))
- return;
+ if (FreeList.end() != std::find(FreeList.begin(), FreeList.end(),
+ F->getName())) {
+ // Mark that the node is written to...
+ if (DSNode *N = getValueDest(*(CS.getArgument(0))).getNode())
+ N->setModifiedMarker()->setHeapNodeMarker();
+ return;
+ }
+
+ if (visitExternal(CS,F))
+ return;
+
// Unknown function, warn if it returns a pointer type or takes a
// pointer argument.
bool Warn = isPointerType(CS.getInstruction()->getType());
@@ -1046,6 +1451,7 @@
<< F->getName() << "' will cause pessimistic results!\n");
}
}
+ }
// Set up the return value...
DSNodeHandle RetVal;
@@ -1283,7 +1689,6 @@
if (!I->isExternal())
DSInfo.insert(std::make_pair(I, new DSGraph(GlobalECs, TD, *I,
GlobalsGraph)));
-
GlobalsGraph->removeTriviallyDeadNodes();
GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs);
Index: llvm-poolalloc/lib/DSA/Makefile
diff -u llvm-poolalloc/lib/DSA/Makefile:1.5 llvm-poolalloc/lib/DSA/Makefile:1.5.2.1
--- llvm-poolalloc/lib/DSA/Makefile:1.5 Sun Oct 23 20:08:20 2005
+++ llvm-poolalloc/lib/DSA/Makefile Tue Dec 12 16:42:42 2006
@@ -1,4 +1,4 @@
-##===- lib/Analysis/DataStructure/Makefile -----------------*- Makefile -*-===##
+##===- lib/DSA/Makefile ------------------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
@@ -7,7 +7,7 @@
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../..
+LEVEL = ../..
LIBRARYNAME = LLVMDataStructure
include $(LEVEL)/Makefile.common
Index: llvm-poolalloc/lib/DSA/Printer.cpp
diff -u llvm-poolalloc/lib/DSA/Printer.cpp:1.86 llvm-poolalloc/lib/DSA/Printer.cpp:1.86.2.1
--- llvm-poolalloc/lib/DSA/Printer.cpp:1.86 Mon Oct 2 07:26:53 2006
+++ llvm-poolalloc/lib/DSA/Printer.cpp Tue Dec 12 16:42:42 2006
@@ -11,9 +11,9 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Analysis/DataStructure/DataStructure.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
-#include "llvm/Analysis/DataStructure/DSGraphTraits.h"
+#include "dsa/DataStructure.h"
+#include "dsa/DSGraph.h"
+#include "dsa/DSGraphTraits.h"
#include "llvm/Module.h"
#include "llvm/Constants.h"
#include "llvm/Assembly/Writer.h"
Index: llvm-poolalloc/lib/DSA/Steensgaard.cpp
diff -u llvm-poolalloc/lib/DSA/Steensgaard.cpp:1.65 llvm-poolalloc/lib/DSA/Steensgaard.cpp:1.65.2.1
--- llvm-poolalloc/lib/DSA/Steensgaard.cpp:1.65 Sun Aug 27 20:02:49 2006
+++ llvm-poolalloc/lib/DSA/Steensgaard.cpp Tue Dec 12 16:42:42 2006
@@ -14,8 +14,8 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Analysis/DataStructure/DataStructure.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
+#include "dsa/DataStructure.h"
+#include "dsa/DSGraph.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/Module.h"
@@ -28,6 +28,7 @@
DSGraph *ResultGraph;
EquivalenceClasses<GlobalValue*> GlobalECs; // Always empty
+ PoolDescriptorMapType PoolDescriptors;
public:
Steens() : ResultGraph(0) {}
~Steens() {
Index: llvm-poolalloc/lib/DSA/TopDownClosure.cpp
diff -u llvm-poolalloc/lib/DSA/TopDownClosure.cpp:1.92 llvm-poolalloc/lib/DSA/TopDownClosure.cpp:1.92.2.1
--- llvm-poolalloc/lib/DSA/TopDownClosure.cpp:1.92 Fri Oct 13 12:38:22 2006
+++ llvm-poolalloc/lib/DSA/TopDownClosure.cpp Tue Dec 12 16:42:42 2006
@@ -14,10 +14,10 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Analysis/DataStructure/DataStructure.h"
+#include "dsa/DataStructure.h"
#include "llvm/Module.h"
#include "llvm/DerivedTypes.h"
-#include "llvm/Analysis/DataStructure/DSGraph.h"
+#include "dsa/DSGraph.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Timer.h"
#include "llvm/ADT/Statistic.h"
@@ -377,7 +377,6 @@
} else {
// Otherwise, create a new DSGraph to represent this.
IndCallGraph = new DSGraph(DSG.getGlobalECs(), DSG.getTargetData());
-
// Make a nullary dummy call site, which will eventually get some content
// merged into it. The actual callee function doesn't matter here, so we
// just pass it something to keep the ctor happy.
More information about the llvm-commits
mailing list