1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

JSSpecCompiler: Add SSA form building pass

This commit is contained in:
Dan Klishch 2023-10-01 23:01:10 -04:00 committed by Andrew Kaster
parent 20aa56891a
commit fbdb1a3d61
5 changed files with 598 additions and 0 deletions

View file

@ -249,3 +249,72 @@ BinaryOperation Assignment
MathematicalConstant 4
ControlFlowJump jump=2
===== AST after ssa-building =====
f():
TreeList
IfElseIfChain
UnresolvedReference cond1
TreeList
BinaryOperation Assignment
Var a@1
MathematicalConstant 1
IfElseIfChain
UnresolvedReference cond2
TreeList
BinaryOperation Assignment
Var b@1
Var a@1
TreeList
BinaryOperation Assignment
Var b@3
MathematicalConstant 3
TreeList
BinaryOperation Assignment
Var b@4
MathematicalConstant 4
ReturnNode
Var b@2
===== CFG after ssa-building =====
f():
0:
ControlFlowBranch true=1 false=6
UnresolvedReference cond1
1:
BinaryOperation Assignment
Var a@1
MathematicalConstant 1
ControlFlowBranch true=2 false=5
UnresolvedReference cond2
2:
BinaryOperation Assignment
Var b@1
Var a@1
ControlFlowJump jump=3
3:
a@2 = phi(2: a@1, 5: a@1, 6: a@0)
b@2 = phi(2: b@1, 5: b@3, 6: b@4)
BinaryOperation Assignment
Var $return@1
Var b@2
ControlFlowJump jump=4
4:
ControlFlowFunctionReturn
Var $return@1
5:
BinaryOperation Assignment
Var b@3
MathematicalConstant 3
ControlFlowJump jump=3
6:
BinaryOperation Assignment
Var b@4
MathematicalConstant 4
ControlFlowJump jump=3