The PassBuilder used for creating pass pipelines for the new pass manager currently doesn't support out-of-tree passes or passes in plugins. This patch adds a mechanism for registering such passes, enabling them inside the PassBuilder.
Registration is done by installing Hooks, managed in a name -> hook map. Such a hook is a callable which, when invoked, gets passed an AnalysisManager or PassManager instance which the external pass can insert itself into. When parsing a pass pipeline, PassBuilder will first consult the list of installed hooks before it looks at the builtin passes. This way, external passes are able to steal the name of a builtin pass.
The HookManager, which manages the name->hook mapping, offers interfaces for registering, querying and invoking installed hooks. I maintain three global instances of it (one for each IRUnit type), accessible through a getGlobalHookManager() function. Moreover, the patch contains convenience types which abbreviate the default way to register passes a bit.
Unittest attached.