Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ The project is under development and subject to change. At this point in time, w
* [semantic](./semantic/README.md) - semantic analyzer
* [stackvm](./stackvm/README.md) - a compiler that generates IR for a stack based virtual machine
* [registervm](./registervm/README.md) - a compiler that generates a so called three-address IR and an interpreter that can execute the IR
* [optvm](./optvm/README.md) - an optimizing compiler (WIP) that supports SSA.
* [seaofnodes](./seaofnodes/README.md) - a compiler that will generate Sea of Nodes IR, using SoN backend from [Simple](https://github.com/SeaOfNodes/Simple).
* [optvm](./optvm/README.md) - WIP optimizing compiler with SSA transformation, constant propagation, graph coloring register allocation
targeting an abstract machine.
* [seaofnodes](./seaofnodes/README.md) - WIP compiler that generates Sea of Nodes IR, using SoN backend from [Simple](https://github.com/SeaOfNodes/Simple).

## How can you contribute?

Expand Down
8 changes: 6 additions & 2 deletions optvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ a physical machine. Therefore, all our optimization passes will work on the inst
each register has a unique integer ID and these ids are allocated in a sequential manner.
* [Liveness](src/main/java/com/compilerprogramming/ezlang/compiler/Liveness.java) - Liveness calculator, works for both SSA and non-SSA forms. Computes
liveness data per basic block - mainly live-out. Note that the interference graph builder starts here and computes instruction level liveness as necessary.
* [EnterSSA](src/main/java/com/compilerprogramming/ezlang/compiler/EnterSSA.java) - Transforms into SSA, using algorithm by Preston Briggs.
* [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.
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
[compiler]((src/main/java/com/compilerprogramming/ezlang/compiler/CompiledFunction.java)) and enabled using an option.
* [ExitSSA](src/main/java/com/compilerprogramming/ezlang/compiler/ExitSSA.java) - Exits SSA form, using algorithm by Preston Briggs.
* [SparseConditionalConstantPropagation](src/main/java/com/compilerprogramming/ezlang/compiler/SparseConditionalConstantPropagation.java) - Conditional Constant Propagation on SSA form (SCCP)
* [SSAEdges](src/main/java/com/compilerprogramming/ezlang/compiler/SSAEdges.java) - SSAEdges are def-use chains used by SCCP algorithm
* [ConstantComparisonPropagation](src/main/java/com/compilerprogramming/ezlang/compiler/ConstantComparisonPropagation.java) - Detects equals and not equals against constants within conditionals,
and inserts variables with appropriately specialized type within the dominated blocks, so that a second pass of SCCP can further optimize code.
* [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.
* [LoopFinder](src/main/java/com/compilerprogramming/ezlang/compiler/LoopFinder.java) - Discovers loops. (Not used yet)
* [LoopNest](src/main/java/com/compilerprogramming/ezlang/compiler/LoopNest.java) - Representation of loop nesting. (Not used yet)
* [InterferenceGraph](src/main/java/com/compilerprogramming/ezlang/compiler/InterferenceGraph.java) - Representation of an Interference Graph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ public void testMergeSort() {
String src = """
// based on the top-down version from https://en.wikipedia.org/wiki/Merge_sort
// via https://github.com/SeaOfNodes/Simple
func merge_sort(a: [Int], b: [int], n: Int)
func merge_sort(a: [Int], b: [Int], n: Int)
{
copy_array(a, 0, n, b)
split_merge(a, 0, n, b)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public void testMergeSort() {
String src = """
// based on the top-down version from https://en.wikipedia.org/wiki/Merge_sort
// via https://github.com/SeaOfNodes/Simple
func merge_sort(a: [Int], b: [int], n: Int)
func merge_sort(a: [Int], b: [Int], n: Int)
{
copy_array(a, 0, n, b)
split_merge(a, 0, n, b)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,11 @@ private Node compileLet(AST.VarStmt letStmt) {
}

private Node compileReturn(AST.ReturnStmt returnStmt) {
var expr = compileExpr(returnStmt.expr);
Node expr;
if (returnStmt.expr != null)
expr = compileExpr(returnStmt.expr);
else
expr = ZERO;
// Need default memory, since it can be lazy, need to force
// a non-lazy Phi
_fun.addReturn(ctrl(), _scope.mem().merge(), expr);
Expand Down