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

Chris Lattner clattner at apple.com
Thu Nov 1 21:47:43 PDT 2012


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