This is approach tries different angle towards plugin pass registration.
Through the HookManager API, out-of-tree callers may register callbacks with the various stages at which passes are added into pass managers, including parsing of a pass pipeline as well as at extension points within the default -O pipelines.
Registering utilities like require<> and invalidate<> needs to be handled manually by the caller, but I've provided a helper for that.
I've marked this patch WIP because there is one key element missing currently, which is automatically detecting the type of a pipeline given just a pass name. I've yet to come up with a nice solution here. Obvious options are either adding another callback insertion point here, or registering the set of available names (with their IRUnit type); neither of which I don't like to much. I'm happy about suggestions.