[RFC] JSIR: A High-Level IR for JavaScript

This RFC introduces JSIR, a high-level IR for JavaScript: JSIR preserves all information from the AST and supports high-fidelity round-trip between source ↔ AST ↔ JSIR; JSIR uses MLIR regions to represent control flow structures; JSIR supports dataflow analysis. JSIR is developed and deployed in production at Google for code analysis and transform use cases. JSIR is open source here: GitHub - google/jsir: Next-generation JavaScript analysis tooling · GitHub. Motivation Industry trend of bui...

LLVM Discussion Forums

This is exciting stuff!

My interpretation:
If the JSIR project can successfully prove bi-directional source to MLIR transformation, it could lead to a new crop of source to source compilers across different languages (as long as they can be lowered to MLIR and back).

Imagine transmorphing Rust to Swift and back. Of course you’d still need to implement or shim any libraries used in the source language. This might help a little bit with C++ to Rust conversions - as more optimizations and analysis would now be possible at the MLIR level. Though I won’t expect unsafe code to magically become safe without some manual intervention.