Closed lausek closed 3 years ago
And
Or
break
continue
1 + 2
10: Pushc(0) 11: Pushc(1) 12: Add
Branch
Jt
10: ... 11: Not 12: Jf 13: ...
LIR
25: ... 26: Jmp(27) 27: ....
func: 11: Pushc(0) 12: Ret 13: Pushc(1) 14: ...
HIR
HirUnit
module_builder.entry()
module_builder.add(ENTRY_POINT)
Label
LirElement
LoweringRuntime
HirLoweringRuntime
emit
LirLoweringRuntime
Bytecode
Constructs that require labels
And
,Or
)break
,continue
)Optimization cases
1 + 2
are not optimized:Branch
conditions intoJt
:Branch
(doesn't happen anymore after introduction ofLIR
?):Steps for implementation
HIR
is a confusing name. change it toHirUnit
(?)module_builder.entry()
instead ofmodule_builder.add(ENTRY_POINT)
Label
LirElement
LoweringRuntime
toHirLoweringRuntime
that transformsHIR
->LIR
emit
try to optimize the last instructions (depending on instruction)LirLoweringRuntime
that transformsLIR
->Bytecode