This patch add the possibilities to create out-of-tree MIR passes. This is based on how IR out-of-tree passes work.
If this is something that could be upstreamed, I could factorize the code between the two system, as they are very similar!
As a side remark, I have tested this with an out of tree MIR pass that dump MIR, and it works well. Should I add this test within the test suite? I didn't find such test for the current out-of-tree IR system (but chances are I missed it!).
Why don't you always build it?
based on ../lib/Transforms/Hello/CMakeLists.txt, you could pass BUILDTREE_ONLY as an extra flag
This code is very similar to the legacy pass manager machinery, which is very different from the new PM one.
Adding the feature here totally makes sense to me, but I'm unsure if the MIR passes management is going to be reworked just like IR passes was, @chandlerc ?
Because I test them as out-of-tree passes. My understanding is that, if LLVM isn't built with shared libraries, or with "LINK_LLVM_DYLIB", I won't be able to build a shared library for the passes that llc would load.