<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/3/19 8:01 PM, Juneyoung Lee via
llvm-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAGwnbJT3Y-P7QDHoNJG_zfaO1uttZkOem9s9V6BPE148GJ-mAA@mail.gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<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"
cite="mid:CAGwnbJT3Y-P7QDHoNJG_zfaO1uttZkOem9s9V6BPE148GJ-mAA@mail.gmail.com">
<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 class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>