Skip to content

Commit

Permalink
add --opt-math optimization flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Aug 24, 2023
1 parent fb6b52a commit 3eaee74
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/compiler/compiler-optimizations.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ Enable special optimizations for built-in `append` function.

- It prevents the allocating and destruction of a new slice by adding slice literals element-by-element if append used at single assignment statement.

---

`--opt-math` \
Enable optimizations for mathematical operations.

- Skip the divide-by-zero check for division when operand is constant.
- Skip the divide-by-zero check for modulo when operand is constant.

## Optimization Levels

It can be a hassle to pass all flags one by one to send most optimizations to the compiler.
Expand All @@ -58,4 +66,4 @@ Set optimization level to `<level>`.
The optimization levels are as follows:

- `L0`: disable all compiler optimizations (default value of JuleC)
- `L1`: passes `--opt-copy`, `--opt-deadcode`, and `--opt-append`
- `L1`: passes `--opt-copy`, `--opt-deadcode`, `--opt-append`, and `--opt-math`

0 comments on commit 3eaee74

Please sign in to comment.