[llvm-dev] Registering passes on a module

Philip Pfaffe via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 24 02:28:52 PDT 2018


You can also look at how opt sets up the pipeline:
https://github.com/llvm-mirror/llvm/blob/master/tools/opt/NewPMDriver.cpp#L257

Cheers,
Philip

On Tue, Jul 24, 2018 at 9:02 AM Matthieu Brucher <matthieu.brucher at gmail.com>
wrote:

> Thanks a lot!
> It seems that there is only one piece of code describing this online, and
> it's part of clang!
>
> Cheers,
>
> Matthieu
>
> Le lun. 23 juil. 2018 à 09:34, Philip Pfaffe <philip.pfaffe at gmail.com> a
> écrit :
>
>> Hi Matthieu,
>>
>> You need to set up the different types of AnalysisManagers as well, just
>> as you did with ModuleAM. Then, you need to cross register them with each
>> other by calling `passBuilder.crossRegisterProxies`.
>>
>> Cheers,
>> Philip
>>
>> On Sat, Jul 21, 2018 at 9:13 PM Matthieu Brucher via llvm-dev <
>> llvm-dev at lists.llvm.org> wrote:
>>
>>> Hi all,
>>>
>>> I'm trying to build passes with the PassBuilder to optimize the result
>>> of MCJIT (I assume, this is a requirement for performance).
>>>
>>> So I do this:
>>>     llvm::PassBuilder passBuilder;
>>>     llvm::ModulePassManager modulePassManager =
>>> passBuilder.buildPerModuleDefaultPipeline(llvm::PassBuilder::OptimizationLevel::O3);
>>>     llvm::ModuleAnalysisManager moduleAnalysisManager;
>>>     passBuilder.registerModuleAnalyses(moduleAnalysisManager);
>>>     modulePassManager.run(*module, moduleAnalysisManager);
>>>
>>> with module being a pointer to an LLVM module.
>>> Unfortunately, the moduleAnalysisManager has only the module passes, but
>>> not the function ones that are wrapped with the proxy class. Is there
>>> anything I missed or a up-to-date tutorial on this?
>>> I couldn't find an answer on Stackoverflow (where a similar question was
>>> asked).
>>>
>>> Cheers,
>>>
>>> Matthieu
>>> --
>>> Quantitative analyst, Ph.D.
>>> Blog: http://blog.audio-tk.com/
>>> LinkedIn: http://www.linkedin.com/in/matthieubrucher
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> llvm-dev at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>
>>
>
> --
> Quantitative analyst, Ph.D.
> Blog: http://blog.audio-tk.com/
> LinkedIn: http://www.linkedin.com/in/matthieubrucher
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180724/1d744d37/attachment.html>


More information about the llvm-dev mailing list