Hi, I am finding it difficult to see how I can run an IR instrumentation pass after "all" IR passes. I previously used opt to run my pass after linking all the llvm bitcode files and then ran llc. I found out that llc runs some other Function passes which depend on the target. For example, tail calls are only supported in x86 under some circumstances. Then I tried lto and link time optimization. But I found it difficult to specify a flag option for my instrumentation pass. Is there any way in llvm to run an IR pass after all IR passes? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140329/1c3aede0/attachment.html>
Dear Rahman, I think your best option is to modify the code in libLTO so that it runs your pass when you want it to run. I believe the file you want to modify is LTOCodeGenerator.cpp. This does mean that passing options to your pass will be difficult or impossible. However, you can either hard-code the options you need or read them from an environment variable if there is no easy way to pass options to the libLTO. If you want to go the llc route, then you'll need to modify the llc code so that it runs your pass instead of opt; sadly, I don't know off-hand where the code is that you would need to modify (it is either in llc or in some LLVM library somewhere). The only reason I discourage the llc route is because it is difficult to get whole-program bitcode files for large programs (e.g., Apache). Regards, John Criswell On 3/29/14, 12:47 AM, Rahman Lavaee wrote:> Hi, > I am finding it difficult to see how I can run an IR instrumentation > pass after "all" IR passes. > I previously used opt to run my pass after linking all the llvm > bitcode files and then ran llc. > I found out that llc runs some other Function passes which depend on > the target. > For example, tail calls are only supported in x86 under some > circumstances. > > Then I tried lto and link time optimization. But I found it difficult > to specify a flag option for my instrumentation pass. > > Is there any way in llvm to run an IR pass after all IR passes? > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140330/60868bd4/attachment.html>
Thank you very much John. With an environment variable I need to take some special care, but it looks like the only way to go. On Sun, Mar 30, 2014 at 11:07 AM, John Criswell <criswell at illinois.edu>wrote:> Dear Rahman, > > I think your best option is to modify the code in libLTO so that it runs > your pass when you want it to run. I believe the file you want to modify > is LTOCodeGenerator.cpp. > > This does mean that passing options to your pass will be difficult or > impossible. However, you can either hard-code the options you need or read > them from an environment variable if there is no easy way to pass options > to the libLTO. > > If you want to go the llc route, then you'll need to modify the llc code > so that it runs your pass instead of opt; sadly, I don't know off-hand > where the code is that you would need to modify (it is either in llc or in > some LLVM library somewhere). The only reason I discourage the llc route > is because it is difficult to get whole-program bitcode files for large > programs (e.g., Apache). > > Regards, > > John Criswell > > > On 3/29/14, 12:47 AM, Rahman Lavaee wrote: > > Hi, > I am finding it difficult to see how I can run an IR instrumentation pass > after "all" IR passes. > I previously used opt to run my pass after linking all the llvm bitcode > files and then ran llc. > I found out that llc runs some other Function passes which depend on the > target. > For example, tail calls are only supported in x86 under some > circumstances. > > Then I tried lto and link time optimization. But I found it difficult to > specify a flag option for my instrumentation pass. > > Is there any way in llvm to run an IR pass after all IR passes? > > > _______________________________________________ > LLVM Developers mailing listLLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140330/41f73ef0/attachment.html>