[LLVMdev] pass visibility question
Gordon Haak
gordon.haak at googlemail.com
Mon Nov 22 08:15:35 PST 2010
Hi developers,
I have some problems using a non-default alias analysis. I wrote a
modulepass which needs a functionpass. The functionpass needs a type
bases alias analysis instead of the basicaa. I added the command line
parameter for this analysis to the opt invocation as follows:
opt -tbaa -global-live-values test.bc
The 'global-live-values' pass preserves all and requires a
functionpass 'LocalLiveValue'. The latter requires a
'MemoryDependenceAnalysis' pass which needs an alias analysis (see
below).
class GlobalLiveValues : public ModulePass {
void GlobalLiveValues::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<CallGraph>();
AU.addRequired<LocalLiveValue>();
AU.setPreservesAll();
}
};
class LocalLiveValue : public FunctionPass {
void LocalLiveValue::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<UnifyFunctionExitNodes>();
AU.addRequired<MemoryDependenceAnalysis>();
AU.setPreservesAll();
}
};
void MemoryDependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequiredTransitive<AliasAnalysis>();
}
The passmanager structure looks as follows:
Target Data Layout
Basic Alias Analysis (default AA impl)
Type-Based Alias Analysis
ModulePass Manager
Basic CallGraph Construction
Global Value Liveness Analysis
Unnamed pass: implement Pass::getPassName()
FunctionPass Manager
Preliminary module verification
Dominator Tree Construction
Module Verifier
Pass Arguments: -mergereturn -memdep -local-live-values
Basic Alias Analysis (default AA impl)
FunctionPass Manager
Unify function exit nodes
Memory Dependence Analysis
LocalLiveValue
I would expect, that when the "Memory Dependence Analysis" calls "AA =
&getAnalysis<AliasAnalysis>();" it would get the alias analysis I
specified in the command line (-tbaa). Could you please help me? Is
the creation of the Passmanager OK when the dependency between
GlobalLiveValues and LocalLiveValue is dealt with? This Passmanager
seems not to be aware of the 'Type-Based Alias Analysis' created
earlier.
Thank you for your help,
Gordon Haak
More information about the llvm-dev
mailing list