<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">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">fedor.sergeev@azul.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color: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">llvm-dev@lists.llvm.org</a>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">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" class="gmail_signature"><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>