[LLVMdev] AnalysisUsage: addRequired vs. addRequiredTransitive
Trevor Harmon
Trevor.W.Harmon at nasa.gov
Wed Mar 31 14:53:53 PDT 2010
Hi,
I'm a bit confused about the distinction between addRequired and
addRequiredTransitive in AnalysisUsage. From PassAnalysisSupport.h:
"REQUIRES (must be available when the pass runs), REQUIRES TRANSITIVE
(must be available throughout the lifetime of the pass)."
The part that's confusing me is "must be available when the pass
runs". I don't see how that's any different from "must be available
throughout the lifetime of the pass". For example, if a pass is
"available" when my pass runs, then I should be able to use it when my
pass is running, correct? For instance:
void MyPass::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<UnifyFunctionExitNodes>();
}
bool MyPass::runOnFunction(Function &function) {
UnifyFunctionExitNodes &pass =
getAnalysis<UnifyFunctionExitNodes>();
// ... use the pass ...
}
But if the above is okay, then why would addRequiredTransitive be
necessary?
I suspect that the REQUIRES definition is simply not worded well.
Perhaps it should say, "(must have run before the pass runs)". Any
thoughts?
Trevor
More information about the llvm-dev
mailing list