Jeremy Salwen
2014-Jun-12 20:10 UTC
[LLVMdev] Creating and implementing an analysis group out of tree
Hello all, I'm trying to follow the guide http://llvm.org/docs/WritingAnLLVMPass.html to build an some passes and analysis groups out of tree. However, I'm having some trouble with crashes when I try to follow the guide. The first section provides a very useful example of what the whole .cpp file should look like for the HelloWorld pass. Obviously it's a bit more complex to write the whole setup with an analysis group, an analysis pass, and a transform pass that uses the analysis, but example code would be extremely helpful, and could serve as a good starting point for anyone who wants to do something similar. Is there anywhere i could find such example code, perhaps as part of a project, that demonstrates how to define and use an analysis group out of tree? Thanks, Jeremy -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140612/3e9586b8/attachment.html>
Eli Bendersky
2014-Jun-12 20:20 UTC
[LLVMdev] Creating and implementing an analysis group out of tree
On Thu, Jun 12, 2014 at 1:10 PM, Jeremy Salwen <jeremysalwen at gmail.com> wrote:> Hello all, > > I'm trying to follow the guide http://llvm.org/docs/WritingAnLLVMPass.html > to build an some passes and analysis groups out of tree. However, I'm > having some trouble with crashes when I try to follow the guide. > The first section provides a very useful example of what the whole .cpp > file should look like for the HelloWorld pass. Obviously it's a bit more > complex to write the whole setup with an analysis group, an analysis pass, > and a transform pass that uses the analysis, but example code would be > extremely helpful, and could serve as a good starting point for anyone who > wants to do something similar. Is there anywhere i could find such example > code, perhaps as part of a project, that demonstrates how to define and use > an analysis group out of tree? >It's not entirely clear which part you're having a problem with. If it's creating an analysis group, there should be samples within the LLVM source code. If it's building out-of-tree, take a look at https://github.com/eliben/llvm-clang-samples -- it's a repository with a bunch of LLVM/Clang samples, all built out of tree. It keeps pretty close track to ToT, as well as having branches for prior releases (3.3 and 3.4, for now). Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140612/5f7c9ea4/attachment.html>
Jeremy Salwen
2014-Jun-12 20:46 UTC
[LLVMdev] Creating and implementing an analysis group out of tree
Hi Eli, Thanks for the link! I'm able to compile a standalone pass outside of the source tree, and I'm obviously ably to compile analysis groups inside the source tree. However, the problem comes when I try to do what the tutorial suggests to create an analysis group outside of the source tree. My understanding is that building out of tree requires different methods to register the passes. For example, the class RegisterPass, which the tutorial instructs you to use (and is used by sample repository you linked), never shows up in the source tree. Likewise for RegisterAnalysisGroup. Furthermore I've found that just copying the way it's done in the source tree and not using RegisterPass causes opt to not recognize your command-line arguments. Do you know of any other projects that will demonstrate how to build passes out of tree, only creating an analysis group as well? Thanks Jeremy On Thu, Jun 12, 2014 at 4:20 PM, Eli Bendersky <eliben at google.com> wrote:> > > > On Thu, Jun 12, 2014 at 1:10 PM, Jeremy Salwen <jeremysalwen at gmail.com> > wrote: > >> Hello all, >> >> I'm trying to follow the guide >> http://llvm.org/docs/WritingAnLLVMPass.html to build an some passes and >> analysis groups out of tree. However, I'm having some trouble with crashes >> when I try to follow the guide. >> The first section provides a very useful example of what the whole .cpp >> file should look like for the HelloWorld pass. Obviously it's a bit more >> complex to write the whole setup with an analysis group, an analysis pass, >> and a transform pass that uses the analysis, but example code would be >> extremely helpful, and could serve as a good starting point for anyone who >> wants to do something similar. Is there anywhere i could find such example >> code, perhaps as part of a project, that demonstrates how to define and use >> an analysis group out of tree? >> > > It's not entirely clear which part you're having a problem with. If it's > creating an analysis group, there should be samples within the LLVM source > code. If it's building out-of-tree, take a look at > https://github.com/eliben/llvm-clang-samples -- it's a repository with a > bunch of LLVM/Clang samples, all built out of tree. It keeps pretty close > track to ToT, as well as having branches for prior releases (3.3 and 3.4, > for now). > > Eli > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140612/4d424d7f/attachment.html>