Stefanos Baziotis via llvm-dev
2020-Jul-31 13:44 UTC
[llvm-dev] What is the "correct" way to add a print pass in the NPM ?
Hi, I'm interested in the sort of pass where you write `-passes=print<pass-name>` and it calls the `print()` function of the pass. I have seen some other passes that can invoke `-passes=print<>` but the implementation seems to be in the wrapper pass for the old pass manager. Thanks, Stefanos Baziotis -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200731/8387a5bd/attachment.html>
Jonathan Smith via llvm-dev
2020-Jul-31 14:59 UTC
[llvm-dev] What is the "correct" way to add a print pass in the NPM ?
On Fri, Jul 31, 2020 at 9:45 AM Stefanos Baziotis via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hi, > > I'm interested in the sort of pass where you write `-passes=print<pass-name>` and it calls the `print()` function of the pass. > > I have seen some other passes that can invoke `-passes=print<>` but the implementation > seems to be in the wrapper pass for the old pass manager. > > Thanks, > Stefanos Baziotis > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-devPrinting passes in the new pass manager are no different from any other pass: the 'run()' function is called. Unlike the legacy pass manager, there is no 'print()' function to be called specifically by printing passes. You would implement all your printing logic in the run() function of your pass class. As an example, see https://www.youtube.com/watch?v=MagR2KY8MQI&t=44m40s (full disclosure: this is my video). The "print<pass-name>" string in the --passes=... argument is simply a token registered in PassRegistry.def that maps that string to a particular pass -- in this case, a printing pass. Respectfully, Jon (jvstech)
Stefanos Baziotis via llvm-dev
2020-Jul-31 17:29 UTC
[llvm-dev] What is the "correct" way to add a print pass in the NPM ?
Ok, got it, thank you! - Stefanos Στις Παρ, 31 Ιουλ 2020 στις 5:59 μ.μ., ο/η Jonathan Smith < jvstech+llvm at gmail.com> έγραψε:> On Fri, Jul 31, 2020 at 9:45 AM Stefanos Baziotis via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > > > Hi, > > > > I'm interested in the sort of pass where you write > `-passes=print<pass-name>` and it calls the `print()` function of the pass. > > > > I have seen some other passes that can invoke `-passes=print<>` but the > implementation > > seems to be in the wrapper pass for the old pass manager. > > > > Thanks, > > Stefanos Baziotis > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > Printing passes in the new pass manager are no different from any > other pass: the 'run()' function is called. Unlike the legacy pass > manager, there is no 'print()' function to be called specifically by > printing passes. You would implement all your printing logic in the > run() function of your pass class. As an example, see > https://www.youtube.com/watch?v=MagR2KY8MQI&t=44m40s (full disclosure: > this is my video). The "print<pass-name>" string in the --passes=... > argument is simply a token registered in PassRegistry.def that maps > that string to a particular pass -- in this case, a printing pass. > > Respectfully, > Jon (jvstech) >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200731/40ad6466/attachment.html>