Currently Rust supports inline assembly, which is great for micro-optimization for specific architectures. Thanks to #[cfg] you can write both a pure rust version of a function, and then for important architectures you can also write hand-optimized assembly versions. This enables people to write code bases that are both generally portable, and also highly optimized for specific platforms.
I’m thinking it could be useful to add another option into the mix: inline IR.
Inline IR would get passed through without optimization passes. This would allow a programmer to write a version of a function that sits somewhere between pure rust and hand-coded assembly in terms of portability and level of control. It would allow for finer control than pure rust, but unlike assembly still be somewhat portable. Of course, IR is not 100% architecture agnostic (e.g. little vs big endian, pointer type sizes, etc.), but it abstracts a lot of things away while still providing something reasonably close to per-instruction control.
So am I just crazy, or do other people also think this could be useful?