chore(ssa refactor) : Research on region labelling [DO NOT MERGE] #1428
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In this PR I was attempting to add region labelling to the ACIR code, which would allow us to print the GeneratedACIR and it will tell us what SSA instruction created it.
The main problem seems to be that opcodes are laid down lazilly so an add instruction won't necessarilly create an ACIR opcode. See #1427 for more detail.
Here is an example program:
The code will output:
You can ignore the fact that we are not printing the ssa IR instructions properly. Due to not every SSA IR instruction mapping to an opcode, the region start of each instruction is grouped together unfortunately.
The region_end lines map more closely to what is actually happening, ie:
This is the region for add and sub, two ssa ir instructions produced one ACIR opcode.
This is the region for div, one ssa div instruction produced five acir opcodes