[llvm-commits] [llvm] r131581 - in /llvm/trunk: include/llvm/DefaultPasses.h include/llvm/Support/StandardPasses.h lib/Support/StandardPasses.cpp

David Chisnall csdavec at swan.ac.uk
Sat May 21 11:09:01 PDT 2011


Hi Chris,

On 21 May 2011, at 18:56, Chris Lattner wrote:

> Hi David,
> 
> What is this used for?  Why is this a good thing?  I'm sorry for missing the initial discussion, but this is adding a bunch of complexity and I don't see what this is doing for us.  Optimizer clients that want to do custom things can set up their own optimizer pipeline.

The main point of this interface is to allow plugins to modify the default optimisation pipeline.  This means that you can write a new LLVM plugin that can be used automatically without modifying front ends.  

The concrete use case that I have is a set of optimisations that are specific to the GNU Objective-C runtimes, and want to be run in the middle of the standard set of optimisations.  LLVM lacked a way of doing this without making invasive changes to the front ends that might use them (Clang, DragonEgg and LanguageKit in this case).  Now, people can relatively easily use them[1].  

One of the design goals of LLVM was to be modular and easily extensible.  This makes it easy for someone to extend (and, with some small changes that I plan on doing before 3.0) completely replace the set of optimisations that is run.  

I'd like to add a config file to LLVM that automatically loads installed plugins, so people can write new passes as plugins, and have them automatically used.

This is also useful when testing optimisations.  I have a release build of LLVM and Clang, but I can trivially write a new optimisation, tell clang (or some other front end) to use it, and check that it works and see what the performance change is, without needing to recompile anything other than the plugin.  Taking this further, it lets people test different default optimisation sets and orderings without a recompile, which makes it easier to pick a good set, because different options can be tried more easily.

David

[1] See: http://etoileos.com/news/archive/2011/05/14/1829/ 



More information about the llvm-commits mailing list