comments and prepare new version 7.7

This commit is contained in:
Irmen de Jong 2022-01-16 23:03:00 +01:00
parent de7ea04f54
commit 8966d2aa06
5 changed files with 10 additions and 10 deletions

View File

@ -37,7 +37,8 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
SourceStorageKind.ARRAY -> src.array!!
else -> {
// TODO make it so that we can assign efficiently from something else as an expression....namely: register(s)
// but for now, first assign it to a temporary variable
// this is useful in pipe expressions for instance, to skip the use of a temporary variable
// but for now, just assign it to a temporary variable and use that as a source
val tempvar = asmgen.getTempVarName(src.datatype)
val assignTempvar = AsmAssignment(
src,

View File

@ -287,7 +287,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
}
is BinaryExpression -> {
if(value.operator in ComparisonOperators) {
// TODO real optimized code for comparison expressions
// TODO real optimized code for comparison expressions that yield a boolean result value
// for now generate code for this: assign-false; if expr { assign-true }
translateNormalAssignment(
AsmAssignment(

View File

@ -1 +1 @@
7.7-dev
7.7

View File

@ -796,7 +796,7 @@ class TestProg8Parser: FunSpec( {
val ff = start.statements[4] as Assignment
ff.value shouldBe NumericLiteralValue(DataType.UBYTE, 255.0, Position.DUMMY)
val letter = start.statements[6] as Assignment
// TODO characters should not be encoded until code generation, like strings...
// TODO characters should perhaps not be encoded until code generation, like strings... however this will prevent optimizing expressions with characters
val encodedletter = Petscii.encodePetscii("A", true).getOrElse { fail("petscii error") }.single()
letter.value shouldBe NumericLiteralValue(DataType.UBYTE, encodedletter.toDouble(), Position.DUMMY)
}

View File

@ -52,12 +52,11 @@ Future Things and Ideas
More optimization ideas
^^^^^^^^^^^^^^^^^^^^^^^
- translateFunctioncall() in BuiltinFunctionsAsmGen: should be able to assign parameters directly from register(s)
- translateFunctioncall() in BuiltinFunctionsAsmGen: should be able to assign parameters to a builtin function directly from register(s), this will make the use of a builtin function in a pipe expression more efficient without using a temporary variable
- translateNormalAssignment() -> better code gen for assigning boolean comparison expressions
- if a for loop's loopvariable isn't referenced in the body, replace by a repeatloop
- automatically convert if statements that test for multiple values (if X==1 or X==2..) to if X in [1,2,..] statements, instead of just a warning
- byte typed expressions should be evaluated in the accumulator where possible, without (temp)var
for instance value = otherbyte >> 1 --> lda otherbite ; lsr a; sta value
- rewrite expression tree evaluation such that it doesn't use an eval stack but flatten the tree into linear code that uses a fixed number of predetermined value 'variables'
- when a for loop's loopvariable isn't referenced in the body, and the iterations are known, replace the loop by a repeatloop
- automatically convert if statements that test for multiple values (if X==1 or X==2..) to if X in [1,2,..] statements, instead of just a warning.
- rewrite expression tree evaluation such that it doesn't use an eval stack but flatten the tree into linear code that uses a fixed number of predetermined value 'variables'?
- this removes the need for the BinExprSplitter? (which is problematic and very limited now)
and perhaps as well the assignment splitting in BeforeAsmAstChanger too
- introduce byte-index operator to avoid index multiplications in loops over arrays? see github issue #4