You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement a transformation of JuvixReg into SSA form.
Needed for the translation to Cairo Assembly
Since there are no loops within a single function, SSA can be computed by going forward in the code of a function and keeping a map from old variables to new variables, updating the map at each assignment.
In JuvixReg, variables are divided into two groups (VarGroup in Reg.Language): VarGroupArgs and VarGroupLocal. Within each group the variables are indexed by integers. The indices need to be recomputed so that each variable is assigned at most once. Variables in VarGroupArgs are never assigned, so we need to consider only local variables (VarGroupLocal).
Variables are assigned by instructions which have the _instr*Result field (the field specifies the variable to which the result is assigned).
All branches in InstrBranch and InstrCase must assign consistent variable indices to variables live after the instruction (used afterwards). It can be assumed that the top of the value stack is the only live variable assigned in each branch. Perhaps one needs to store the information about the index of the top of the value stack after a branching instruction when translating from JuvixAsm to JuvixReg.
Remember to update the live variable information stored in instructions.
The text was updated successfully, but these errors were encountered:
* Closes#2560
* Adds a transformation of JuvixReg into SSA form.
* Adds an "output variable" field to branching instructions (`Case`,
`Branch`) which indicates the output variable to which the result is
assigned in both branches. The output variable corresponds to top of
stack in JuvixAsm after executing the branches. In the SSA
transformation, differently renamed output variables are unified by
inserting assignment instructions at the end of branches.
* Adds tests for the SSA transformation.
* Depends on #2641.
* Closes#2560
* Adds a transformation of JuvixReg into SSA form.
* Adds an "output variable" field to branching instructions (`Case`,
`Branch`) which indicates the output variable to which the result is
assigned in both branches. The output variable corresponds to top of
stack in JuvixAsm after executing the branches. In the SSA
transformation, differently renamed output variables are unified by
inserting assignment instructions at the end of branches.
* Adds tests for the SSA transformation.
* Depends on #2641.
VarGroup
inReg.Language
):VarGroupArgs
andVarGroupLocal
. Within each group the variables are indexed by integers. The indices need to be recomputed so that each variable is assigned at most once. Variables inVarGroupArgs
are never assigned, so we need to consider only local variables (VarGroupLocal
)._instr*Result
field (the field specifies the variable to which the result is assigned).InstrBranch
andInstrCase
must assign consistent variable indices to variables live after the instruction (used afterwards). It can be assumed that the top of the value stack is the only live variable assigned in each branch. Perhaps one needs to store the information about the index of the top of the value stack after a branching instruction when translating from JuvixAsm to JuvixReg.The text was updated successfully, but these errors were encountered: