[llvm-dev] Porting Pass to New PassManager

Fedor Sergeev via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 25 11:58:06 PDT 2018


Leonard,

pretty much every single IR (not MachineIR) pass right now has a port 
from legacy to new
(bar a very few passes that were specifically written for new-pm, like 
SimpleLoopUnswitch or Inliner).

Take any Module/Function pass and it will definitely be a port.

regards,
   Fedor.

On 09/25/2018 09:34 PM, Leonard Chan wrote:
> 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 passeschi
> 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
>>



More information about the llvm-dev mailing list