Update documentation

This commit is contained in:
Juhani Krekelä 2018-05-25 23:21:29 +03:00
parent d5ff090be6
commit e75a0a085d
3 changed files with 18 additions and 1 deletions

View File

@ -16,6 +16,7 @@ Gir supports following optimizations:
* Turn runs of +- or <> into one command
* Turn [-] or [+] into one command
* Add offsets to commands that modify tape, to reduce moving tape head
* Turn multiply loops into one command
TODO
----

6
ir.md
View File

@ -95,6 +95,12 @@ property | value
type | `clear`
offset | The location of the cell relative to current tape position
### multiply
property | value
---------|------
type | `multiply`
changes | Map of offsets to the number that should be added to those cells multiplies by the current cell
Flattened
---------

View File

@ -1,4 +1,4 @@
Gir has four optimization passes.
Gir has five optimization passes.
joinAdjacentOps
---------------
@ -39,6 +39,16 @@ current tape head location the operations are performed. It also adds an
body ends at the same cell where it began, which is useful for performing
further optimizations.
transformMultiplyLoops
----------------------
* *consumed*: commands with offsets
* *unknown commands*: passed through unmodified
* *acts on*: balanced `loop`s that only have adds and where adds at offset 0 are together 1 or -1
* *other known commands*: `loop` (recurses)
`transformMultiplyLoops` changes loops of the form `[>+>++<<-]` into a
single `multiply` command.
flattenLoops
------------
* *consumes*: commands with offsets