From 7ee162d98b20a9149d8229025edb2946749f8c44 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sat, 3 Jun 2023 23:36:15 +0200 Subject: [PATCH] preparing version 9.0 --- compiler/res/version.txt | 2 +- docs/source/todo.rst | 3 ++- .../src/prog8/intermediate/IRFileWriter.kt | 2 +- .../src/prog8/intermediate/IRInstructions.kt | 24 +++++++++---------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/compiler/res/version.txt b/compiler/res/version.txt index 6920989a1..dd98ee6cb 100644 --- a/compiler/res/version.txt +++ b/compiler/res/version.txt @@ -1 +1 @@ -9.0-dev +9.0 diff --git a/docs/source/todo.rst b/docs/source/todo.rst index a842d6814..7e04dc0cf 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -26,6 +26,7 @@ Compiler: global initialization values are simply a list of LOAD instructions. Variables replaced include all subroutine parameters! So the only variables that remain as variables are arrays and strings. - ir: add more optimizations in IRPeepholeOptimizer +- ir: the @split arrays are also split in _lsb/_msb arrays in the IR, and operations take multiple (byte) instructions that may lead to verbose and slow operation and machine code generation down the line. - ir: for expressions with array indexes that occur multiple times, can we avoid loading them into new virtualregs everytime and just reuse a single virtualreg as indexer? (simple form of common subexpression elimination) - PtAst/IR: more complex common subexpression eliminations - generate WASM to eventually run prog8 on a browser canvas? Use binaryen toolkit or my binaryen kotlin library? @@ -35,7 +36,7 @@ Compiler: But all library code written in asm uses .proc already..... (textual search/replace when writing the actual asm?) Once new codegen is written that is based on the IR, this point is mostly moot anyway as that will have its own dead code removal on the IR level. - Zig-like try-based error handling where the V flag could indicate error condition? and/or BRK to jump into monitor on failure? (has to set BRK vector for that) But the V flag is also set on certain normal instructions -- For c128 target; put floating point variables in bank 1 to make the FP routines work (is this even worth it? very few people will use fp) + Libraries: diff --git a/intermediate/src/prog8/intermediate/IRFileWriter.kt b/intermediate/src/prog8/intermediate/IRFileWriter.kt index e58f9f050..58f4abf05 100644 --- a/intermediate/src/prog8/intermediate/IRFileWriter.kt +++ b/intermediate/src/prog8/intermediate/IRFileWriter.kt @@ -126,7 +126,7 @@ class IRFileWriter(private val irProgram: IRProgram, outfileOverride: Path?) { private fun writeCodeChunk(chunk: IRCodeChunk) { xml.writeStartElement("CODE") chunk.label?.let { xml.writeAttribute("LABEL", chunk.label) } - xml.writeAttribute("used-registers", chunk.usedRegisters().toString()) + // xml.writeAttribute("used-registers", chunk.usedRegisters().toString()) xml.writeCharacters("\n") chunk.instructions.forEach { instr -> numInstr++ diff --git a/intermediate/src/prog8/intermediate/IRInstructions.kt b/intermediate/src/prog8/intermediate/IRInstructions.kt index 46325f87b..0bcae7733 100644 --- a/intermediate/src/prog8/intermediate/IRInstructions.kt +++ b/intermediate/src/prog8/intermediate/IRInstructions.kt @@ -97,18 +97,18 @@ bgesr reg1, reg2, address - jump to location in program given by l ble reg1, value, address - jump to location in program given by location, if reg1 <= immediate value (unsigned) bles reg1, value, address - jump to location in program given by location, if reg1 <= immediate value (signed) ( NOTE: there are no bltr/bler instructions because these are equivalent to bgtr/bger with the register operands swapped around.) -sz reg1, reg2 - set reg1=1.b if reg2==0, otherwise set reg1=0.b -snz reg1, reg2 - set reg1=1.b if reg2!=0, otherwise set reg1=0.b -seq reg1, reg2 - set reg1=1.b if reg1 == reg2, otherwise set reg1=0.b -sne reg1, reg2 - set reg1=1.b if reg1 != reg2, otherwise set reg1=0.b -slt reg1, reg2 - set reg1=1.b if reg1 < reg2 (unsigned), otherwise set reg1=0.b -slts reg1, reg2 - set reg1=1.b if reg1 < reg2 (signed), otherwise set reg1=0.b -sle reg1, reg2 - set reg1=1.b if reg1 <= reg2 (unsigned), otherwise set reg1=0.b -sles reg1, reg2 - set reg1=1.b if reg1 <= reg2 (signed), otherwise set reg1=0.b -sgt reg1, reg2 - set reg1=1.b if reg1 > reg2 (unsigned), otherwise set reg1=0.b -sgts reg1, reg2 - set reg1=1.b if reg1 > reg2 (signed), otherwise set reg1=0.b -sge reg1, reg2 - set reg1=1.b if reg1 >= reg2 (unsigned), otherwise set reg1=0.b -sges reg1, reg2 - set reg1=1.b if reg1 >= reg2 (signed), otherwise set reg1=0.b +sz reg1, reg2 - set reg1=1.b if reg2==0, else 0.b +snz reg1, reg2 - set reg1=1.b if reg2!=0, else 0.b +seq reg1, reg2 - set reg1=1.b if reg1 == reg2, else 0.b +sne reg1, reg2 - set reg1=1.b if reg1 != reg2, else 0.b +slt reg1, reg2 - set reg1=1.b if reg1 < reg2 (unsigned), else 0.b +slts reg1, reg2 - set reg1=1.b if reg1 < reg2 (signed), else 0.b +sle reg1, reg2 - set reg1=1.b if reg1 <= reg2 (unsigned), else 0.b +sles reg1, reg2 - set reg1=1.b if reg1 <= reg2 (signed), else 0.b +sgt reg1, reg2 - set reg1=1.b if reg1 > reg2 (unsigned), else 0.b +sgts reg1, reg2 - set reg1=1.b if reg1 > reg2 (signed), else 0.b +sge reg1, reg2 - set reg1=1.b if reg1 >= reg2 (unsigned), else 0.b +sges reg1, reg2 - set reg1=1.b if reg1 >= reg2 (signed), else 0.b ARITHMETIC