sunil rathee
2012-Oct-22 07:50 UTC
[LLVMdev] Use information generated by existing passes into new pass
Hi, I want to ask is that can we use the information generated by existing passes into a new pass? If yes, then how ? For example -loops gives the natural loop information, so can we use this information into new pass by calling it. -- Sunil Rathee MTech IIT Delhi Not going along with the crowd can help you stand out in the crowd -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121022/1bbc8a6e/attachment.html>
Duncan Sands
2012-Oct-22 12:37 UTC
[LLVMdev] Use information generated by existing passes into new pass
Hi Sunil,> I want to ask is that can we use the information generated by existing passes > into a new pass? If yes, then how ? > For example -loops gives the natural loop information, so can we use this > information into new pass by calling it.in your pass's getAnalysisUsage method you use addRequired to specify that you need a particular analysis, for example void MyPass::getAnalysisUsage(AnalysisUsage &AU) const { ... AU.addRequired<LoopInfo>(); ... } Then, to get hold of the analysis when your pass is being run, you can use getAnalysis<LoopInfo>() . Ciao, Duncan.