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

James Molloy James.Molloy at arm.com
Wed Oct 31 10:53:52 PDT 2012


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?

Cheers,

James

-------------- next part --------------
A non-text attachment was scrubbed...
Name: compilationhooks.patch
Type: text/x-patch
Size: 6140 bytes
Desc: compilationhooks.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121031/7c17d71e/attachment.bin>


More information about the llvm-commits mailing list