<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <br>
    <div class="moz-cite-prefix">On 12/13/19 1:56 AM, Jakub Kuderski
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CABxVP8n=9ksboKs3aH49gB0W3D5AA8oL9y-h_tAVduqxDGmyiw@mail.gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi Juneyoung,<br>
        <br>
        Being able to add these callbacks under the legacy PM would be
        super useful for me.</div>
    </blockquote>
    Well, legacy PM albeit still being default is not something that we
    would gladly be enhancing with new features.<br>
    <br>
    regards,<br>
      Fedor.<br>
    <br>
    <blockquote type="cite"
cite="mid:CABxVP8n=9ksboKs3aH49gB0W3D5AA8oL9y-h_tAVduqxDGmyiw@mail.gmail.com">
      <div dir="ltr"> Currently, I have a set of local patches similar
        to what Neil described. Any less ad hoc solution, such as the
        callback, would be a nice improvement.<br>
        Unfortunately, I don't know enough about the PM to comment on
        your patch.<br>
        <br>
        Thanks,<br>
        Jakub<br>
        <br>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Dec 11, 2019 at 7:50
          PM Juneyoung Lee via llvm-dev <<a
            href="mailto:llvm-dev@lists.llvm.org" target="_blank"
            moz-do-not-send="true">llvm-dev@lists.llvm.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div dir="ltr">
            <div dir="ltr">Hello Fedor.
              <div><br>
              </div>
              <div>Thank you for the information.</div>
              <div>I made a simple patch that exposes
                PassInstrumentationCallback so llvmGetPassPluginInfo can
                use it: <a href="https://reviews.llvm.org/D71086"
                  target="_blank" moz-do-not-send="true">https://reviews.llvm.org/D71086</a>
                . Would this change make sense?</div>
              <div><br>
              </div>
              <div>Thanks,</div>
              <div>Juneyoung Lee</div>
            </div>
          </div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Thu, Dec 12, 2019 at
              12:44 AM Fedor Sergeev <<a
                href="mailto:fedor.sergeev@azul.com" target="_blank"
                moz-do-not-send="true">fedor.sergeev@azul.com</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">
              <div bgcolor="#FFFFFF"> <br>
                <br>
                <div>On 12/3/19 8:01 PM, Juneyoung Lee via llvm-dev
                  wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div>Hello all, </div>
                      <div><br>
                      </div>
                      <div>Is there a way to register callback that runs
                        before/after passes?</div>
                      <div>PassTimingInfo seems to do a similar thing by
                        calling
                        PassInstrumentationCallbacks::registerBeforePassCallback
                        / registerAfterPassCallback, but it is
                        hard-wired with StandardInstrumentations class.</div>
                    </div>
                  </div>
                </blockquote>
                PassInstrumentation framework was introduced to the new
                PassManager specifically in mind with ability<br>
                to register arbitrary callbacks and execute them as pass
                manager traverses through the pass pipeline.<br>
                <br>
                PassInstrumentationCallbacks are indeed the entity to
                register your callbacks into, before passing it to
                PassBuilder;<br>
                You can check how it is being done in
                `llvm/tools/opt/NewPMDriver.cpp`llvm::runPassPipeline.<br>
                <br>
                StandardInstrumentations are just a few "standard"
                callbacks that provide "standard" functionality, like
                -print-after-all or -time-passes.<br>
                StandardInstrumentations registers its individual
                instrumentations the same way you would register your
                own.<br>
                <br>
                Note, that PassInstrumentation is only supported in new
                pass manager (opt -passes=  or clang
                -fexperimental-new-pass-manager).<br>
                <br>
                regards,<br>
                  Fedor.<br>
                  <br>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div>Do we have something similar to
                        RegisterStandardPasses, so custom callbacks can
                        be added from somewhere outside LLVM?</div>
                      <div><br>
                      </div>
                      <div>Thanks,</div>
                      <div>Juneyoung Lee</div>
                      <div dir="ltr"><br>
                      </div>
                      <div dir="ltr"><br>
                      </div>
                    </div>
                  </div>
                  <br>
                  <fieldset></fieldset>
                  <pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" moz-do-not-send="true">llvm-dev@lists.llvm.org</a>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
                </blockquote>
                <br>
              </div>
            </blockquote>
          </div>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div dir="ltr">
            <div dir="ltr">
              <div><br>
              </div>
              <font size="1">Juneyoung Lee</font>
              <div><font size="1">Software Foundation Lab, Seoul
                  National University</font></div>
            </div>
          </div>
          _______________________________________________<br>
          LLVM Developers mailing list<br>
          <a href="mailto:llvm-dev@lists.llvm.org" target="_blank"
            moz-do-not-send="true">llvm-dev@lists.llvm.org</a><br>
          <a
            href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>