xDSL
Actively maintained. Last release 7 days ago, commits in 26 of the last 26 weeks. A safe choice.
pip install xdslxDSL: A Python-native SSA Compiler Framework
xDSL is a Python-native framework for building compiler infrastructure. It provides SSA-based intermediate representations (IRs) and Pythonic APIs to define, assemble, and optimize custom IRs—all with seamless compatibility with MLIR from the LLVM project.
Inspired by MLIR, xDSL enables smooth translation of programs and abstractions between frameworks. This lets users prototype compilers entirely in Python, while still accessing MLIR's powerful optimization and code generation pipeline. All IRs in xDSL employ a unified SSA-based data structure, with regions and basic blocks, making it easy to write generic analyses and transformation passes.
xDSL supports assembling compilers from predefined or custom IRs, and organizing transformations across a multi-level IR stack. This layered approach enables abstraction-specific optimization passes, similar to the architecture of projects like Devito, PSyclone, and Firedrake.
In short, xDSL makes it possible to:
- Prototype compilers quickly in Python
- Build DSLs with custom IRs
- Run analyses and transformations with simple scripts