[llvm-dev] registering passes at the beginning/end of opt passes (new pass manager)

Min-Yih Hsu via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 3 21:57:39 PST 2020


I’m not sure what’s your context. I think  `-passes` is only used for specify the entire pipeline instead of inserting callbacks into an existing pipeline.

You can either directly modify PassBuilder’s code to run Passes before/after a Pass.
Or writing a new PassManager PassPlugin and use the PassBuilder instance in there (see the comments in include/llvm/Passes/PassPlugin.h [1]) to call registerPipelineStartEPCallback. Then load that plugin using opt.

[1] https://github.com/llvm/llvm-project/blob/master/llvm/include/llvm/Passes/PassPlugin.h#L96 <https://github.com/llvm/llvm-project/blob/master/llvm/include/llvm/Passes/PassPlugin.h#L96> 

Best
-Min

> On Dec 3, 2020, at 8:28 PM, Juneyoung Lee via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hello all,
> 
> Can I register passes at the beginning/end of opt passes (new pass manager)?
> 
> I found that registerPipelineStartEPCallback/registerOptimizerLastEPCallback work successfully for clang, but they don't fire when opt -passes="" is used.
> 
> Thanks,
> Juneyoung
> 
> _______________________________________________
> LLVM Developers mailing list
> 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/20201203/1e865f35/attachment.html>


More information about the llvm-dev mailing list