4 ms·
What's HIR/MIR?
by heinrich5991 11y ago
What's HIR/MIR?
- nercury 11y agoDifferent AST representations in Rust compiler - high level and middle level.
- steveklabnik 11y agoTo build on the other answer, right now, the compiler does AST -> LLVM IR Which works, but you have to do all of the compilation passes and static checks on the AST. After this work is done, we'll have AST -> HIR -> MIR -> LLVM IR These two intermediate representations will make it easier to write frontends and backends to Rust, as well as making it easier to implement various optimization and analysis passes, and making them faster. Also, in today's world, for example, we can't stabilize syntax extensions because we'd have to stabilize the AST. But we _can_ stabilize {H,M}IR, much more easily. On the backside, we're very coupled to LLVM right now, and while that probably won't change, if someone wanted to write a backend, they could write their own codegen based off of MIR.