Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor output of OpenQASM 3 exporter to use fewer aliases (#10249)
* Refactor output of OpenQASM 3 exporter to use fewer aliases This removes spurious `_loose_bit` "registers" from the OpenQASM 3 output, and instead emits loose bits with individual `bit` and `qubit` declarations. Non-overlapping registers are emitted using regular `bit[n]` and `qubit[n]` definitions when possible, and we only resort to aliasing if we must to describe the structure. This avoids introducing structure to the definitions that does not exist in the original program, making round-trips and interactions with other OQ3 consumers more straightforwards. It's better not to use advanced features that don't map to hardware particularly well when it's not necessary. On the technical side, all bits are now properly tracked in the symbol table. Previously, there was a lot of code duplication, internal state tracking and magic inferences that attempted to "guess" how a qubit/clbit should be referred to. Instead, we just properly add them as variables to the symbol table, which also drastically reduces the number of objects that effectively reserve names that the user may not use. * Remove unnecessary empty init * Fix typo Co-authored-by: Ian Hincks <ian.hincks@ibm.com> * Add explicit test of old option --------- Co-authored-by: Ian Hincks <ian.hincks@ibm.com>
- Loading branch information