[llvm-commits] [RFC] ExecutionEngine API for adding custom passes
Kaylor, Andrew
andrew.kaylor at intel.com
Fri Nov 2 11:56:09 PDT 2012
It seems like you should be able to do what you want by creating a custom TargetMachine that implements addPassesToEmitMC but otherwise defers to the a an aggregated TargetMachine instance returned from EngineBuilder::selectTarget().
-Andy
-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of James Molloy
Sent: Friday, November 02, 2012 1:58 AM
To: Chris Lattner
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] [RFC] ExecutionEngine API for adding custom passes
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
>
>
_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list