Leonard Chan via llvm-dev
2018-Sep-24 23:54 UTC
[llvm-dev] Porting Pass to New PassManager
Hi all, I'm attempting to move the AddressSanitizer pass from the legacy PassManager to the new one because the new one has various benefits over legacy and wanted to clarify on something. Does creating the static RegisterPass struct register the pass with the new PassManager? It seems that RegisterPass does the same things that the INITIALIZE_PASS_* macros do but it registers the pass with PassRegistry::getPassRegistry(). What I'm not sure of is if this uses the new PassManager infrastructure. Exploring the code doesn't seem to show that this PassRegistry touches anything in the legacy namespace, but I wanted double confirmation on this. Thanks, Leonard
Fedor Sergeev via llvm-dev
2018-Sep-25 06:26 UTC
[llvm-dev] Porting Pass to New PassManager
Leonard, nope, the PassRegistry stuff is all about legacy pass manager. legacy namespace has not been extensively used to mark all the legacy-related stuff (say, even Pass class which is a base for legacy passes is not under legacy namespace). Registration for new-pass-manager passes happens in lib/Passes/PassRegistry.def. Usually, when porting from legacy to new the main difference is analysis handling, so people factor out the worker code into a method that takes analyses and call this function both in legacy and new-pm passes. In many cases it takes just a handful lines of code. Feel free to ask questions, if any. regards, Fedor. On 09/25/2018 02:54 AM, Leonard Chan via llvm-dev wrote: > Hi all, > > I'm attempting to move the AddressSanitizer pass from the legacy > PassManager to the new one because the new one has various benefits > over legacy and wanted to clarify on something. Does creating the > static RegisterPass struct register the pass with the new PassManager? > > It seems that RegisterPass does the same things that the > INITIALIZE_PASS_* macros do but it registers the pass with > PassRegistry::getPassRegistry(). What I'm not sure of is if this uses > the new PassManager infrastructure. Exploring the code doesn't seem to > show that this PassRegistry touches anything in the legacy namespace, > but I wanted double confirmation on this. > > Thanks, > Leonard > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Philip Pfaffe via llvm-dev
2018-Sep-25 09:43 UTC
[llvm-dev] Porting Pass to New PassManager
Hi Leonard, Fedor, while it's true that RegisterPass is not applicable for new-pm passes, PassRegistry.def is not the whole story. Passes in PassRegistry are available for the opt tool. The sanitizers are passes that usually get added to the pipeline by the frontend. There, you need to use PassBuilder's callbacks mechanism to hook the sanitizer into the optimizer. Assuming you're willing to contribute your changes, please share your progress! Thank you for making a move on this! Cheers, Philip On Tue, Sep 25, 2018 at 8:27 AM Fedor Sergeev via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Leonard, > > nope, the PassRegistry stuff is all about legacy pass manager. > legacy namespace has not been extensively used to mark all the > legacy-related stuff > (say, even Pass class which is a base for legacy passes is not under > legacy namespace). > > Registration for new-pass-manager passes happens in > lib/Passes/PassRegistry.def. > > Usually, when porting from legacy to new the main difference is analysis > handling, > so people factor out the worker code into a method that takes analyses > and call > this function both in legacy and new-pm passes. > In many cases it takes just a handful lines of code. > > Feel free to ask questions, if any. > > regards, > Fedor. > > On 09/25/2018 02:54 AM, Leonard Chan via llvm-dev wrote: > > Hi all, > > > > I'm attempting to move the AddressSanitizer pass from the legacy > > PassManager to the new one because the new one has various benefits > > over legacy and wanted to clarify on something. Does creating the > > static RegisterPass struct register the pass with the new PassManager? > > > > It seems that RegisterPass does the same things that the > > INITIALIZE_PASS_* macros do but it registers the pass with > > PassRegistry::getPassRegistry(). What I'm not sure of is if this uses > > the new PassManager infrastructure. Exploring the code doesn't seem to > > show that this PassRegistry touches anything in the legacy namespace, > > but I wanted double confirmation on this. > > > > Thanks, > > Leonard > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://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/20180925/46265882/attachment.html>
Leonard Chan via llvm-dev
2018-Sep-25 18:34 UTC
[llvm-dev] Porting Pass to New PassManager
Hi Fedor, Thanks for the starting point of looking through PassRegistry.def. Do you happen to have any specific examples or knowledge of previous patches of passes that were part of the legacy PM but moved to the new PM? I'm not sure if historically when the new PM was proposed, people actually did move passes from legacy or people just add new passes onto the new one. Thanks, Leonard On Mon, Sep 24, 2018 at 11:27 PM Fedor Sergeev <fedor.sergeev at azul.com> wrote:> > Leonard, > > nope, the PassRegistry stuff is all about legacy pass manager. > legacy namespace has not been extensively used to mark all the > legacy-related stuff > (say, even Pass class which is a base for legacy passes is not under > legacy namespace). > > Registration for new-pass-manager passes happens in > lib/Passes/PassRegistry.def. > > Usually, when porting from legacy to new the main difference is analysis > handling, > so people factor out the worker code into a method that takes analyses > and call > this function both in legacy and new-pm passes. > In many cases it takes just a handful lines of code. > > Feel free to ask questions, if any. > > regards, > Fedor. > > On 09/25/2018 02:54 AM, Leonard Chan via llvm-dev wrote: > > Hi all, > > > > I'm attempting to move the AddressSanitizer pass from the legacy > > PassManager to the new one because the new one has various benefits > > over legacy and wanted to clarify on something. Does creating the > > static RegisterPass struct register the pass with the new PassManager? > > > > It seems that RegisterPass does the same things that the > > INITIALIZE_PASS_* macros do but it registers the pass with > > PassRegistry::getPassRegistry(). What I'm not sure of is if this uses > > the new PassManager infrastructure. Exploring the code doesn't seem to > > show that this PassRegistry touches anything in the legacy namespace, > > but I wanted double confirmation on this. > > > > Thanks, > > Leonard > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >