[llvm-dev] What is the "correct" way to add a print pass in the NPM ?

Stefanos Baziotis via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 31 10:29:11 PDT 2020


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>


More information about the llvm-dev mailing list