todo related to in-place assignment

This commit is contained in:
Irmen de Jong 2020-07-27 00:32:59 +02:00
parent fdfbb7bdf0
commit 7ac6c8f2d1
2 changed files with 41 additions and 10 deletions

View File

@ -192,7 +192,7 @@ private fun writeAssembly(programAst: Program, errors: ErrorReporter, outputDir:
programAst.processAstBeforeAsmGeneration(errors)
errors.handle()
// printAst(programAst)
printAst(programAst) // TODO
val assembly = CompilationTarget.asmGenerator(
programAst,

View File

@ -4,19 +4,50 @@
%zeropage basicsafe
%option enable_floats
; todo: add these to the Expression Simplifier so that all the below assignments become a simple in-place assignment:
; (A +/- B) +/- C ==> A +/- ( B +/- C)
; (A * / B) * / C ==> A * / ( B * / C)
main {
float[] fa = [1,2,3,4]
sub start() {
wot("asdfasdf")
wot("asdfasdf")
wot("asdfasdf1")
}
sub wot(uword text) {
c64scr.print(4.4, 1)
c64.CHROUT('\n')
ubyte wv
ubyte wv2
wv *= wv2
wv += 10
wv += 20
wv += 30
wv += 1 + wv2
wv += 2 + wv2
wv += 3 + wv2
wv += wv2 + 1
wv += wv2 + 2
wv += wv2 + 3
wv = wv + 1 + wv2
wv = wv + 2 + wv2
wv = wv + 3 + wv2
wv = 1 + wv2 + wv
wv = 2 + wv2 + wv
wv = 3 + wv2 + wv
wv = wv + wv2 + 1
wv = wv + wv2 + 2
wv = wv + wv2 + 3
wv = wv2 + 1 + wv
wv = wv2 + 2 + wv
wv = wv2 + 3 + wv
wv = wv2 + wv + 1
wv = wv2 + wv + 2
wv = wv2 + wv + 3
}
}