[PATCH][PM] Add pass run listeners to the pass manager.
Duncan P. N. Exon Smith
dexonsmith at apple.com
Thu May 1 16:42:05 PDT 2014
On 2014-May-01, at 15:07, Juergen Ributzka <juergen at apple.com> wrote:
> Hi @ll,
>
> I incorporated your suggestions into this patch. It extends the pass listener to also work with the new pass manager. There is some additional glue that can be removed
> once we get rid of the legacy pass manager. The C API has been reworked to accommodate future changes and additions to the pass listener.
>
> The callback function signature has changed to incorporate an opaque user defined value and abstracts the current pass and IR behind a pass invocation reference.
> The invocation type specifies when this callback has been called. Currently this supports pre- and post-pass notification callbacks.
>
> void (*LLVMPassListenerCallback)(void *Opaque, LLVMContextRef C, LLVMPassInvocationType T, LLVMPassInvocationRef P);
>
> The pass invocation reference currently only supports one API - the pass name. This could be extended in the future to obtain the pass related IR, more pass related
> information, etc.
>
> Cheers,
> Juergen
>
> <0001-PM-Extend-pass-listener-to-also-work-with-the-new-pa.patch>
I like the PassInvocation design. I wasn't quite sure what you were
planning here, but I think it solves the "what to pass back" problem
quite neatly, giving us flexibility in the future to expand the API.
This LGTM, with the following whitespace nitpick.
> @@ -1618,12 +1618,15 @@ MPPassManager::runOnModule(Module &M) {
>
> initializeAnalysisImpl(MP);
>
> + M.getContext().notifyPassPreRunListeners(MP, &M);
> {
> PassManagerPrettyStackEntry X(MP, M);
> TimeRegion PassTimer(getPassTimer(MP));
>
> LocalChanged |= MP->runOnModule(M);
> }
> + M.getContext().notifyPassPostRunListeners(MP, &M);
> +
You inserted an extra newline here.
>
> Changed |= LocalChanged;
> if (LocalChanged)
>
More information about the llvm-commits
mailing list