This commit is contained in:
Irmen de Jong 2024-02-10 23:00:21 +01:00
parent 8201408f16
commit a4f697bae1
2 changed files with 5 additions and 5 deletions

View File

@ -443,7 +443,7 @@ class StatementOptimizer(private val program: Program,
}
}
// xx+=3 -> xx++ xx++ xx++
// xx+=2 -> xx++ xx++
// note: ideally this optimization should be done by the code generator, but doing it there
// requires doing it multiple times (because lots of different things can be incremented/decremented)
if(assignment.target.identifier!=null
@ -454,7 +454,7 @@ class StatementOptimizer(private val program: Program,
if(binExpr!=null) {
if(binExpr.operator in "+-") {
val value = binExpr.right.constValue(program)?.number?.toInt()
if(value!=null && value in 2..3) {
if(value!=null && value==2) {
val stmts = mutableListOf<Statement>()
repeat(value) {
val incrdecr = Assignment(assignment.target.copy(),

View File

@ -1,10 +1,10 @@
TODO
====
rockrunner cave load/decode is now broken (even with -noopt)
(after merge in boolean): move all "OperatorXinplace" from expressionGen to AssignmentGen, see if we can get rid of the Result return type.
replace Takes by Http4k in httpCompilerService project. https://github.com/http4k/examples/blob/master/hello-world/README.md
...
@ -12,7 +12,7 @@ Future Things and Ideas
^^^^^^^^^^^^^^^^^^^^^^^
Compiler:
- can we support singed % (remainder) somehow?
- can we support signed % (remainder) somehow?
- instead of copy-pasting inline asmsubs, make them into a 64tass macro and use that instead.
that will allow them to be reused from custom user written assembly code as well.
- Multidimensional arrays and chained indexing, purely as syntactic sugar over regular arrays.