Skip to content

Commit f6d58a9

Browse files
Update README
1 parent f9be158 commit f6d58a9

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The project is under development and subject to change. At this point in time, w
2929
* [optvm](./optvm/README.md) - WIP optimizing compiler with SSA transformation, constant propagation, graph coloring register allocation
3030
targeting an abstract machine. Includes Interpreter to run the abstract machine.
3131
* [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.
3333

3434
## How can you contribute?
3535

optvm/README.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ a physical machine. Therefore, all our optimization passes will work on the inst
1111

1212
A VM / Interpreter is provided that can run the generated code.
1313

14-
## Guide
14+
## Intermediate Representation
1515

1616
* [Register](src/main/java/com/compilerprogramming/ezlang/compiler/Register.java) - implements a virtual register. Virtual registers
1717
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.
2828
as operands. Instruction can have at most one definition; but an instruction can have multiple use operands. Operands can hold registers or
2929
constants or pointers to basic blocks.
3030
* [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+
3235
* [DominatorTree](src/main/java/com/compilerprogramming/ezlang/compiler/DominatorTree.java) - Calculates dominator tree and dominance frontiers.
3336
* [LiveSet](src/main/java/com/compilerprogramming/ezlang/compiler/LiveSet.java) - Bitset used to track liveness of registers. We exploit the fact that
3437
each register has a unique integer ID and these ids are allocated in a sequential manner.
3538
* [Liveness](src/main/java/com/compilerprogramming/ezlang/compiler/Liveness.java) - Liveness calculator, works for both SSA and non-SSA forms. Computes
3639
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.
4047
* [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+
4151
* [SparseConditionalConstantPropagation](src/main/java/com/compilerprogramming/ezlang/compiler/SparseConditionalConstantPropagation.java) - Conditional Constant Propagation on SSA form (SCCP)
4252
* [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.
4454
* [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+
4560
* [LoopFinder](src/main/java/com/compilerprogramming/ezlang/compiler/LoopFinder.java) - Discovers loops. (Not used yet)
4661
* [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+
4768
* [InterferenceGraph](src/main/java/com/compilerprogramming/ezlang/compiler/InterferenceGraph.java) - Representation of an Interference Graph
4869
required by the register allocator.
4970
* [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.
6384
## VM/Interpreter
6485

6586
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.
6788

6889
* [VM/Interpreter](src/main/java/com/compilerprogramming/ezlang/interpreter)

0 commit comments

Comments
 (0)