[llvm-dev] Adding custom callback function before/after passes
Neil Henning via llvm-dev
llvm-dev at lists.llvm.org
Tue Dec 3 09:20:11 PST 2019
If you are using the legacy PassManager and control when the PassManager is
created, you can do this with a little hack like:
struct MyPassManager final : llvm::legacy::PassManager
void add(llvm::Pass* const pass) override
// Add your own pass which does a before callback
// Add the originally requested pass
// Add your own pass which does an after callback
} passManager; // add new passes to this pass manager!
I've used this hack in the past (it is also something similar to how opt
lets you bail out on a certain pass).
On Tue, Dec 3, 2019 at 5:02 PM Juneyoung Lee via llvm-dev <
llvm-dev at lists.llvm.org> 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.
> Do we have something similar to RegisterStandardPasses, so custom
> callbacks can be added from somewhere outside LLVM?
> Juneyoung Lee
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
Senior Software Engineer Compiler
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev