[llvm-commits] [poolalloc] r72399 - in /poolalloc/trunk: include/poolalloc/PoolAllocate.h lib/PoolAllocate/PASimple.cpp
Haohui Mai
mai4 at uiuc.edu
Mon May 25 13:59:22 PDT 2009
Author: mai4
Date: Mon May 25 15:59:22 2009
New Revision: 72399
URL: http://llvm.org/viewvc/llvm-project?rev=72399&view=rev
Log:
Made simple pool allocation work with basic DSA analysis.
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=72399&r1=72398&r2=72399&view=diff
==============================================================================
--- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original)
+++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Mon May 25 15:59:22 2009
@@ -431,9 +431,10 @@
DSGraph * CombinedDSGraph;
EquivalenceClasses<const GlobalValue*> GlobalECs;
TargetData * TD;
+ bool CompleteDSA;
public:
static char ID;
- PoolAllocateSimple(bool passAllArgs=false, bool SAFECode = true)
+ PoolAllocateSimple(bool passAllArgs=false, bool SAFECode = true, bool CompleteDSA = true)
: PoolAllocate (passAllArgs, SAFECode, (intptr_t)&ID) {}
~PoolAllocateSimple() {return;}
void getAnalysisUsage(AnalysisUsage &AU) const;
@@ -458,7 +459,8 @@
virtual Value * getPool (const DSNode * N, Function & F) {
return TheGlobalPool;
}
- };
+};
+
}
#endif
Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=72399&r1=72398&r2=72399&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Mon May 25 15:59:22 2009
@@ -72,9 +72,14 @@
void PoolAllocateSimple::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<TargetData>();
- AU.addRequiredTransitive<EQTDDataStructures>();
-
- AU.addPreserved<EQTDDataStructures>();
+ // Get the Target Data information and the Graphs
+ if (CompleteDSA) {
+ AU.addRequiredTransitive<EQTDDataStructures>();
+ AU.addPreserved<EQTDDataStructures>();
+ } else {
+ AU.addRequiredTransitive<BasicDataStructures>();
+ AU.addPreserved<BasicDataStructures>();
+ }
AU.setPreservesAll();
}
@@ -100,22 +105,17 @@
if (M.begin() == M.end()) return false;
// Get the Target Data information and the Graphs
- Graphs = &getAnalysis<EQTDDataStructures>(); // folded inlined CBU graphs
- assert (Graphs && "No ECGraphs pass available!\n");
+ if (CompleteDSA) {
+ Graphs = &getAnalysis<EQTDDataStructures>();
+ } else {
+ Graphs = &getAnalysis<BasicDataStructures>();
+ }
+ assert (Graphs && "No DSA pass available!\n");
TargetData & TD = getAnalysis<TargetData>();
// Add the pool* prototypes to the module
AddPoolPrototypes(&M);
- // Get the main function to insert the poolinit calls.
- Function *MainFunc = (M.getFunction("main") ? M.getFunction("main")
- : M.getFunction("MAIN__"));
- if (MainFunc == 0 || MainFunc->isDeclaration()) {
- std::cerr << "Cannot pool allocate this program: it has global "
- << "pools but no 'main' function yet!\n";
- return true;
- }
-
//
// Merge all of the DSNodes in the DSGraphs.
//
@@ -370,4 +370,3 @@
ReturnInst::Create(BB);
return GV;
}
-
More information about the llvm-commits
mailing list