Ejjeh, Adel via llvm-dev
2020-Dec-03 17:21 UTC
[llvm-dev] Creating an instance of new pass manager in tool
Hello I am writing a tool within an external project, and I need to use an instance of the new pass manager to invoke LLVM analyses. It used to be possible to create an initialized instance of the legacy::FunctionPassManager by providing the Module to the constructor. I was unable to find a corresponding way to initialize an instance of the new FunctionAnalysisManager. When I tried to construct an instance of FunctionAnalysisManager and use it, none of the passes were registered and I found myself having to register every single LLVM pass, even if it is not directly invoked by my tool (which is not feasible). What is the correct way to do this? Thanks -Adel Ejjeh -- Adel Ejjeh PhD Candidate | Computer Science University of Illinois at Urbana Champaign Email: aejjeh at illinois.edu<mailto:aejjeh at illinois.edu> | adel.ejjeh at gmail.com<mailto:adel.ejjeh at gmail.com> Zoom: https://illinois.zoom.us/my/aejjeh -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201203/a4dd7328/attachment.html>
Arthur Eubanks via llvm-dev
2020-Dec-03 17:30 UTC
[llvm-dev] Creating an instance of new pass manager in tool
Looking at the existing users of the new pass manager may be useful. See BackendUtil.cpp for how Clang sets up the new pass manager, and NewPMDriver.cpp for how opt sets it up. There should be no need to initialize individual passes, although you can inject your own analyses (e.g. alias analysis). On Thu, Dec 3, 2020 at 9:21 AM Ejjeh, Adel via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello > > > > I am writing a tool within an external project, and I need to use an > instance of the new pass manager to invoke LLVM analyses. It used to be > possible to create an initialized instance of the > legacy::FunctionPassManager by providing the Module to the constructor. I > was unable to find a corresponding way to initialize an instance of the new > FunctionAnalysisManager. When I tried to construct an instance of > FunctionAnalysisManager and use it, none of the passes were registered and > I found myself having to register every single LLVM pass, even if it is not > directly invoked by my tool (which is not feasible). What is the correct > way to do this? > > > > Thanks > > -Adel Ejjeh > > -- > > Adel Ejjeh > > PhD Candidate | Computer Science > > University of Illinois at Urbana Champaign > > Email: aejjeh at illinois.edu | adel.ejjeh at gmail.com > > Zoom: https://illinois.zoom.us/my/aejjeh > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201203/5e482262/attachment.html>
Andrzej Warzynski via llvm-dev
2020-Dec-03 17:47 UTC
[llvm-dev] Creating an instance of new pass manager in tool
This example of a stand-alone tool in llvm-tutor might be helpful: https://github.com/banach-space/llvm-tutor/blob/master/tools/StaticMain.cpp#L52-L57 I've not played with it much myself, so you may discover that it's too basic :) -Andrzej On 03/12/2020 17:21, Ejjeh, Adel via llvm-dev wrote:> Hello > > I am writing a tool within an external project, and I need to use an > instance of the new pass manager to invoke LLVM analyses. It used to be > possible to create an initialized instance of the > legacy::FunctionPassManager by providing the Module to the constructor. > I was unable to find a corresponding way to initialize an instance of > the new FunctionAnalysisManager. When I tried to construct an instance > of FunctionAnalysisManager and use it, none of the passes were > registered and I found myself having to register every single LLVM pass, > even if it is not directly invoked by my tool (which is not feasible). > What is the correct way to do this? > > Thanks > > -Adel Ejjeh > > -- > > Adel Ejjeh > > PhD Candidate | Computer Science > > University of Illinois at Urbana Champaign > > Email: aejjeh at illinois.edu <mailto:aejjeh at illinois.edu>�| > adel.ejjeh at gmail.com <mailto:adel.ejjeh at gmail.com> > > Zoom: https://illinois.zoom.us/my/aejjeh > <https://illinois.zoom.us/my/aejjeh> > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >