[llvm-commits] [poolalloc] r56671 - in /poolalloc/trunk: include/poolalloc/PoolAllocate.h lib/PoolAllocate/PASimple.cpp
John Criswell
criswell at uiuc.edu
Fri Sep 26 11:15:13 PDT 2008
Author: criswell
Date: Fri Sep 26 13:15:13 2008
New Revision: 56671
URL: http://llvm.org/viewvc/llvm-project?rev=56671&view=rev
Log:
Make the simple pool allocation pass use the Top-Down DSA results when being
used for SAFECode.
More work is needed to get the regular pool allocator to use Top-Down entirely.
Modified:
poolalloc/trunk/include/poolalloc/PoolAllocate.h
poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=56671&r1=56670&r2=56671&view=diff
==============================================================================
--- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original)
+++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Fri Sep 26 13:15:13 2008
@@ -102,8 +102,9 @@
class PoolAllocateGroup {
-private:
+protected:
EquivClassGraphs *ECGraphs;
+ TDDataStructures *TDGraphs;
public:
static char ID;
@@ -119,11 +120,17 @@
virtual const Type * getPoolType() {return 0;}
virtual DSGraph & getDSGraph (const Function & F) const {
- return ECGraphs->getDSGraph (F);
+ if (SAFECodeEnabled)
+ return TDGraphs->getDSGraph (F);
+ else
+ return ECGraphs->getDSGraph (F);
}
virtual DSGraph & getGlobalsGraph () const {
- return ECGraphs->getGlobalsGraph ();
+ if (SAFECodeEnabled)
+ return TDGraphs->getGlobalsGraph ();
+ else
+ return ECGraphs->getGlobalsGraph ();
}
virtual Value * getPool (const DSNode * N, Function & F) {return 0;}
@@ -165,7 +172,6 @@
protected:
std::map<Function*, PA::FuncInfo> FunctionInfo;
- EquivClassGraphs *ECGraphs;
public:
static char ID;
@@ -180,7 +186,7 @@
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
EquivClassGraphs &getECGraphs() const { return *ECGraphs; }
-
+
/// getOrigFunctionFromClone - Given a pointer to a function that was cloned
/// from another function, return the original function. If the argument
/// function is not a clone, return null.
@@ -236,11 +242,17 @@
}
virtual DSGraph & getDSGraph (const Function & F) const {
- return ECGraphs->getDSGraph (F);
+ if (SAFECodeEnabled)
+ return TDGraphs->getDSGraph (F);
+ else
+ return ECGraphs->getDSGraph (F);
}
virtual DSGraph & getGlobalsGraph () const {
- return ECGraphs->getGlobalsGraph ();
+ if (SAFECodeEnabled)
+ return TDGraphs->getGlobalsGraph ();
+ else
+ return ECGraphs->getGlobalsGraph ();
}
virtual Value * getPool (const DSNode * N, Function & F) {
Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=56671&r1=56670&r2=56671&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Fri Sep 26 13:15:13 2008
@@ -74,7 +74,9 @@
void PoolAllocateSimple::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<TargetData>();
AU.addRequiredTransitive<EquivClassGraphs>();
+ AU.addRequiredTransitive<TDDataStructures>();
AU.addPreserved<EquivClassGraphs>();
+ AU.addPreserved<TDDataStructures>();
AU.setPreservesAll();
}
@@ -101,6 +103,10 @@
// Get the Target Data information and the ECGraphs
ECGraphs = &getAnalysis<EquivClassGraphs>(); // folded inlined CBU graphs
assert (ECGraphs && "No ECGraphs pass available!\n");
+ if (SAFECodeEnabled) {
+ TDGraphs = &getAnalysis<TDDataStructures>(); // folded inlined CBU graphs
+ assert (TDGraphs && "No ECGraphs pass available!\n");
+ }
TargetData & TD = getAnalysis<TargetData>();
// Add the pool* prototypes to the module
More information about the llvm-commits
mailing list