[llvm-commits] [RFC] ExecutionEngine API for adding custom passes

James Molloy james.molloy at arm.com
Fri Nov 2 01:58:18 PDT 2012


Hi Chris,

The specific use case is that I have a target-independent
MachineFunctionPass which records information about the stack frame
sizes for each function.

You can generalise this to any client of the MCJIT who wants to control
compilation further - for example "lli" with "opt"-like user-defined
additional passes. If any of those additional passes are machine
function passes, we'd have difficulty with the current interface.

I'm writing this pass outside of LLVM's source tree - I'm a client of
LLVM rather than modifying it, so that's why I'm unsure that I'm unable
to add the pass to the target.

James


On Fri, 2012-11-02 at 04:47 +0000, Chris Lattner wrote:
> On Oct 31, 2012, at 10:53 AM, James Molloy <James.Molloy at arm.com> wrote:
> 
> > Hi,
> > 
> > I have a use case where I have written a MachineFunctionPass, which I
> > would like to have run on a Module which I will eventually pass to the
> > MCJIT.
> > 
> > Currently, the only real way I can do this is by compiling the module
> > twice, because MachineFunctionPasses need to be added to PassManagers
> > after ::addPassesToEmit* is called, and the MCJIT creates its own
> > PassManager and calls that locally itself.
> > 
> > It's really inefficient to have to go through the codegen process twice
> > just because I can't add a pass to what the MCJIT runs, so I've attached
> > a proposed addition to the ExecutionEngine interface.
> > 
> > This adds a suite of functions to add "compilation hooks". These would
> > be unimplemented on the Interpreter and old-style JIT. They are function
> > pointers that a user would give, that take a PassManager& argument and
> > allow the user to add passes manually.
> > 
> > Is this something that would be acceptable to have in trunk?
> 
> I don't understand the use case of this.  Is this for a target-independent or target-dependent pass?  If it's target-specific, why not just add it to the target?
> 
> -Chris
> 
> 







More information about the llvm-commits mailing list