[llvm-commits] [poolalloc] r76084 - in /poolalloc/trunk: include/poolalloc/PoolAllocate.h lib/PoolAllocate/PoolAllocate.cpp
Patrick Simmons
simmon12 at illinois.edu
Thu Jul 16 10:28:27 PDT 2009
Author: psimmons
Date: Thu Jul 16 12:28:22 2009
New Revision: 76084
URL: http://llvm.org/viewvc/llvm-project?rev=76084&view=rev
Log:
add constructor with the ability to toggle which DSA pass to use and what to report for poolalloc's pass preservation independently of other SAFECodeEnabled attributes.
Modified:
poolalloc/trunk/include/poolalloc/PoolAllocate.h
poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=76084&r1=76083&r2=76084&view=diff
==============================================================================
--- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original)
+++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Thu Jul 16 12:28:22 2009
@@ -118,6 +118,11 @@
bool SAFECodeEnabled;
bool BoundsChecksEnabled;
+ enum LIE_TYPE {LIE_NONE, LIE_PRESERVE_DSA, LIE_PRESERVE_ALL, LIE_PRESERVE_DEFAULT};
+ LIE_TYPE lie_preserve_passes;
+ enum PASS_TYPE {PASS_EQTD, PASS_BUEQ, PASS_DEFAULT};
+ PASS_TYPE dsa_pass_to_use;
+
virtual ~PoolAllocateGroup () {return;}
virtual PA::FuncInfo *getFuncInfo(const Function &F) { return 0;}
virtual PA::FuncInfo *getFuncInfoOrClone(const Function &F) {return 0;}
@@ -179,12 +184,40 @@
public:
static char ID;
+
PoolAllocate (bool passAllArguments = false,
bool SAFECode = true,
- intptr_t IDp = (intptr_t) (&ID))
+ intptr_t IDp = (intptr_t) (&ID)) __attribute__((__deprecated__))
: ModulePass((intptr_t)IDp),
PassAllArguments(passAllArguments)
- {SAFECodeEnabled = BoundsChecksEnabled = SAFECode | PA::PA_SAFECODE;}
+ {
+ SAFECodeEnabled = BoundsChecksEnabled = SAFECode | PA::PA_SAFECODE;
+ lie_preserve_passes = SAFECodeEnabled ? LIE_PRESERVE_ALL : LIE_PRESERVE_DSA;
+ dsa_pass_to_use = SAFECodeEnabled ? PASS_EQTD : PASS_BUEQ;
+ }
+
+ /*TODO: finish removing the SAFECode flag*/
+ PoolAllocate (PASS_TYPE dsa_pass_to_use_,
+ LIE_TYPE lie_preserve_passes_ = LIE_PRESERVE_DEFAULT,
+ bool passAllArguments = false,
+ bool SAFECode = false,
+ intptr_t IDp = (intptr_t) (&ID))
+ : ModulePass((intptr_t)IDp),
+ PassAllArguments(passAllArguments)
+ {
+ SAFECodeEnabled = BoundsChecksEnabled = SAFECode | PA::PA_SAFECODE;
+
+ if(lie_preserve_passes_ == LIE_PRESERVE_DEFAULT)
+ lie_preserve_passes = SAFECodeEnabled ? LIE_PRESERVE_ALL : LIE_PRESERVE_DSA;
+ else
+ lie_preserve_passes = lie_preserve_passes_;
+
+ if(dsa_pass_to_use_ == PASS_DEFAULT)
+ dsa_pass_to_use = SAFECodeEnabled ? PASS_EQTD : PASS_BUEQ;
+ else
+ dsa_pass_to_use = dsa_pass_to_use_;
+ }
+
virtual bool runOnModule(Module &M);
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=76084&r1=76083&r2=76084&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Thu Jul 16 12:28:22 2009
@@ -89,16 +89,18 @@
}
void PoolAllocate::getAnalysisUsage(AnalysisUsage &AU) const {
- if (SAFECodeEnabled) {
+ if (dsa_pass_to_use == PASS_EQTD) {
AU.addRequired<EQTDDataStructures>();
- AU.addPreserved<EQTDDataStructures>();
+ if(lie_preserve_passes != LIE_NONE)
+ AU.addPreserved<EQTDDataStructures>();
} else {
AU.addRequired<EquivBUDataStructures>();
- AU.addPreserved<EquivBUDataStructures>();
+ if(lie_preserve_passes != LIE_NONE)
+ AU.addPreserved<EquivBUDataStructures>();
}
// Preserve the pool information across passes
- if (SAFECodeEnabled)
+ if (lie_preserve_passes == LIE_PRESERVE_ALL)
AU.setPreservesAll();
AU.addRequired<TargetData>();
@@ -113,7 +115,7 @@
// DSA. For Automatic Pool Allocation only, we need Bottom-Up DSA. In all
// cases, we need to use the Equivalence-Class version of DSA.
//
- if (SAFECodeEnabled)
+ if (dsa_pass_to_use == PASS_EQTD)
Graphs = &getAnalysis<EQTDDataStructures>();
else
Graphs = &getAnalysis<EquivBUDataStructures>();
More information about the llvm-commits
mailing list