WIP: NIR: Add a general pass framework
This MR is the revitalization of a very old series of mine from 2015:
The idea is to add a general pass-running framework for NIR to help sort out some of the metadata issues and reduce boilerplate. Bringing this back was largely inspired by the positive feedback from !1319 (merged).
Why do we want a pass managing framework? A number of reasons:
- Remove redundancy. Right now, every NIR pass has a pile of boilerplate which authors of new passes just copy+paste every time.
- Passes need to stop doing their own metadata management. We've had a number of issues with passes not doing metadata management correctly and if the pass runner handles it, we're less likely to get it wrong.
- Allow for a future in which passes can declare certain clean-ups such as constant folding or copy-prop required after that pass is run.
- Allow for a smart runner that can run multiple passes at once to improve caching. The most obvious application of this would be to run constant-folding or copy-prop along side a pass that very sloppily emits piles of builder code.