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
targeting an abstract machine. Includes Interpreter to run the abstract machine.
31
31
*[seaofnodes](./seaofnodes/README.md) - WIP compiler that generates Sea of Nodes IR, using SoN backend from [Simple Chapter 21](https://github.com/SeaOfNodes/Simple).
32
-
Generate native code for X86-64, AArch64 and RISC-V.
32
+
Generates native code for X86-64, AArch64 and RISC-V.
Copy file name to clipboardExpand all lines: optvm/README.md
+28-7Lines changed: 28 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ a physical machine. Therefore, all our optimization passes will work on the inst
11
11
12
12
A VM / Interpreter is provided that can run the generated code.
13
13
14
-
## Guide
14
+
## Intermediate Representation
15
15
16
16
*[Register](src/main/java/com/compilerprogramming/ezlang/compiler/Register.java) - implements a virtual register. Virtual registers
17
17
have a name, type, id, frameSlot - the id is unique, but the name is not. Initially the compiler generates unique registers for every local
@@ -28,22 +28,43 @@ A VM / Interpreter is provided that can run the generated code.
28
28
as operands. Instruction can have at most one definition; but an instruction can have multiple use operands. Operands can hold registers or
29
29
constants or pointers to basic blocks.
30
30
*[Instruction](src/main/java/com/compilerprogramming/ezlang/compiler/Instruction.java) - Instructions - sequential instructions reside in
31
-
basic blocks. Some instructions define variables (registers) and some use them.
31
+
basic blocks. Some instructions define variables (registers) and some use them.
32
+
33
+
## Dominators and Liveness Analysis
34
+
32
35
*[DominatorTree](src/main/java/com/compilerprogramming/ezlang/compiler/DominatorTree.java) - Calculates dominator tree and dominance frontiers.
33
36
*[LiveSet](src/main/java/com/compilerprogramming/ezlang/compiler/LiveSet.java) - Bitset used to track liveness of registers. We exploit the fact that
34
37
each register has a unique integer ID and these ids are allocated in a sequential manner.
35
38
*[Liveness](src/main/java/com/compilerprogramming/ezlang/compiler/Liveness.java) - Liveness calculator, works for both SSA and non-SSA forms. Computes
36
39
liveness data per basic block - mainly live-out. Note that the interference graph builder starts here and computes instruction level liveness as necessary.
37
-
*[EnterSSA](src/main/java/com/compilerprogramming/ezlang/compiler/EnterSSA.java) - Transforms into SSA, using [algorithm by Preston Briggs](https://dl.acm.org/doi/10.5555/295545.295551). This is one of available mechanisms to transform the IR into SSA.
38
-
The other alternative is to generate SSA IR directly from the AST, using [Braun's method](https://dl.acm.org/doi/10.1007/978-3-642-37051-9_6) - this option is integrated into the
39
-
[compiler]((src/main/java/com/compilerprogramming/ezlang/compiler/CompiledFunction.java)) and enabled using an option.
40
+
41
+
## Static Single Assignment Form
42
+
43
+
*[EnterSSA](src/main/java/com/compilerprogramming/ezlang/compiler/EnterSSA.java) - Transforms into SSA, using [algorithm by Preston Briggs](https://dl.acm.org/doi/10.5555/295545.295551). This is the traditional method of constructing
44
+
SSA Form using Dominator Trees. The input to this transformation is regular IR, output is SSA IR.
45
+
* Incremental SSA - This method generate SSA IR directly from the AST, using [Braun's algorithm](https://dl.acm.org/doi/10.1007/978-3-642-37051-9_6) - this is integrated into the
46
+
[compiler]((src/main/java/com/compilerprogramming/ezlang/compiler/CompiledFunction.java)) itself and can be enabled using an option.
40
47
*[ExitSSA](src/main/java/com/compilerprogramming/ezlang/compiler/ExitSSA.java) - Exits SSA form, using algorithm by Preston Briggs.
48
+
49
+
## Optimizations on SSA Form
50
+
41
51
*[SparseConditionalConstantPropagation](src/main/java/com/compilerprogramming/ezlang/compiler/SparseConditionalConstantPropagation.java) - Conditional Constant Propagation on SSA form (SCCP)
42
52
*[ConstantComparisonPropagation](src/main/java/com/compilerprogramming/ezlang/compiler/ConstantComparisonPropagation.java) - Detects equals and not equals against constants within conditionals,
43
-
and inserts variables with appropriately specialized type within the dominated blocks, so that a second pass of SCCP can further optimize code.
53
+
and inserts scoped variables with appropriately specialized type within the dominated blocks, so that a second pass of SCCP can further optimize code.
44
54
*[SSAEdges](src/main/java/com/compilerprogramming/ezlang/compiler/SSAEdges.java) - SSAEdges are def-use chains used by SCCP algorithm, and also generated during incremental SSA construction using Braun's method.
55
+
56
+
## Loops
57
+
58
+
These components are not used yet
59
+
45
60
*[LoopFinder](src/main/java/com/compilerprogramming/ezlang/compiler/LoopFinder.java) - Discovers loops. (Not used yet)
46
61
*[LoopNest](src/main/java/com/compilerprogramming/ezlang/compiler/LoopNest.java) - Representation of loop nesting. (Not used yet)
62
+
63
+
## Chaitin Graph Coloring Register Allocation
64
+
65
+
Note that our goal is to target an abstract machine rather than a real CPU, so we optimize for minimum VM registers, but we have
66
+
unlimited amount of those.
67
+
47
68
*[InterferenceGraph](src/main/java/com/compilerprogramming/ezlang/compiler/InterferenceGraph.java) - Representation of an Interference Graph
48
69
required by the register allocator.
49
70
*[InterferenceGraphBuilder](src/main/java/com/compilerprogramming/ezlang/compiler/InterferenceGraphBuilder.java) - Constructs an InterferenceGraph for a set
@@ -63,6 +84,6 @@ A VM / Interpreter is provided that can run the generated code.
63
84
## VM/Interpreter
64
85
65
86
A simple VM / Interpreter is provided that can run the IR, both pre and post optimizations.
66
-
The SSA form is not executable, it must be transformed out of SSA for execuation.
87
+
The SSA form is not executable, hence the IR must be transformed out of SSA for execution.
0 commit comments