[llvm-dev] Adding custom callback function before/after passes
Fedor Sergeev via llvm-dev
llvm-dev at lists.llvm.org
Fri Dec 13 02:29:58 PST 2019
On 12/13/19 1:56 AM, Jakub Kuderski wrote:
> Hi Juneyoung,
>
> Being able to add these callbacks under the legacy PM would be super
> useful for me.
Well, legacy PM albeit still being default is not something that we
would gladly be enhancing with new features.
regards,
Fedor.
> 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.
> Unfortunately, I don't know enough about the PM to comment on your patch.
>
> Thanks,
> Jakub
>
>
> On Wed, Dec 11, 2019 at 7:50 PM Juneyoung Lee via llvm-dev
> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>
> Hello Fedor.
>
> Thank you for the information.
> I made a simple patch that exposes PassInstrumentationCallback so
> llvmGetPassPluginInfo can use it: https://reviews.llvm.org/D71086
> . Would this change make sense?
>
> Thanks,
> Juneyoung Lee
>
> On Thu, Dec 12, 2019 at 12:44 AM Fedor Sergeev
> <fedor.sergeev at azul.com <mailto:fedor.sergeev at azul.com>> wrote:
>
>
>
> On 12/3/19 8:01 PM, Juneyoung Lee via llvm-dev wrote:
>> Hello all,
>>
>> Is there a way to register callback that runs before/after
>> passes?
>> PassTimingInfo seems to do a similar thing by calling
>> PassInstrumentationCallbacks::registerBeforePassCallback /
>> registerAfterPassCallback, but it is hard-wired with
>> StandardInstrumentations class.
> PassInstrumentation framework was introduced to the new
> PassManager specifically in mind with ability
> to register arbitrary callbacks and execute them as pass
> manager traverses through the pass pipeline.
>
> PassInstrumentationCallbacks are indeed the entity to register
> your callbacks into, before passing it to PassBuilder;
> You can check how it is being done in
> `llvm/tools/opt/NewPMDriver.cpp`llvm::runPassPipeline.
>
> StandardInstrumentations are just a few "standard" callbacks
> that provide "standard" functionality, like -print-after-all
> or -time-passes.
> StandardInstrumentations registers its individual
> instrumentations the same way you would register your own.
>
> Note, that PassInstrumentation is only supported in new pass
> manager (opt -passes= or clang -fexperimental-new-pass-manager).
>
> regards,
> Fedor.
>
>> Do we have something similar to RegisterStandardPasses, so
>> custom callbacks can be added from somewhere outside LLVM?
>>
>> Thanks,
>> Juneyoung Lee
>>
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
>
> --
>
> Juneyoung Lee
> Software Foundation Lab, Seoul National University
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191213/9c7e3125/attachment.html>
More information about the llvm-dev
mailing list