PyQIR's parsing functionality and code generation functionality are currently totally independent; parsed QIR is read-only and can't be edited and re-emitted, and generated QIR is write-only. This precludes use cases like doing simple transforms or optimizations with PyQIR on QIR that came from another source. It's also more complicated to maintain since there is overlap between the two, and we're using a different Rust LLVM wrapper for each.
We want to combine Parser and Generator into one cohesive thing that can do both. The first step was refactoring Generator to use LLVM objects directly in #157. Next we will add parsing functionality to the LLVM-backed Generator types in #174. Finally, the pyqir-parser package will be retired. We will transition to a single pyqir package that has the same functionality as pyqir-parser, pyqir-generator, and pyqir-evaluator (with the first step in #170).
For users of pyqir-generator and pyqir-evaluator, the impact will be minimal. The main breaking change is to how types for external functions are created, which came with #157. pyqir-parser users will need to adapt to a completely rewritten API, although it will support the same functionality.
PyQIR's parsing functionality and code generation functionality are currently totally independent; parsed QIR is read-only and can't be edited and re-emitted, and generated QIR is write-only. This precludes use cases like doing simple transforms or optimizations with PyQIR on QIR that came from another source. It's also more complicated to maintain since there is overlap between the two, and we're using a different Rust LLVM wrapper for each.
We want to combine Parser and Generator into one cohesive thing that can do both. The first step was refactoring Generator to use LLVM objects directly in #157. Next we will add parsing functionality to the LLVM-backed Generator types in #174. Finally, the pyqir-parser package will be retired. We will transition to a single pyqir package that has the same functionality as pyqir-parser, pyqir-generator, and pyqir-evaluator (with the first step in #170).
For users of pyqir-generator and pyqir-evaluator, the impact will be minimal. The main breaking change is to how types for external functions are created, which came with #157. pyqir-parser users will need to adapt to a completely rewritten API, although it will support the same functionality.
A sketch of the proposed API for the combined parsing and generating functionality is here: https://gist.github.com/samarsha/abdfd9fa7b6aee133904935c7b4511a5
The changes to external functions look like this. Before:
After: