From b166576e543181be7975eacdbe463c9f400cff88 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Wed, 17 Jun 2020 23:27:54 +0200 Subject: [PATCH] comments --- compiler/src/prog8/compiler/Main.kt | 2 +- .../prog8/compiler/target/c64/codegen/AssignmentAsmGen.kt | 2 +- .../prog8/compiler/target/c64/codegen/ForLoopsAsmGen.kt | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/src/prog8/compiler/Main.kt b/compiler/src/prog8/compiler/Main.kt index 651399b41..e3622ac6e 100644 --- a/compiler/src/prog8/compiler/Main.kt +++ b/compiler/src/prog8/compiler/Main.kt @@ -42,7 +42,7 @@ fun compileProgram(filepath: Path, optimizeAst(programAst, errors) postprocessAst(programAst, errors, compilationOptions) - // printAst(programAst) // TODO + // printAst(programAst) if(writeAssembly) programName = writeAssembly(programAst, errors, outputDir, optimize, compilationOptions) diff --git a/compiler/src/prog8/compiler/target/c64/codegen/AssignmentAsmGen.kt b/compiler/src/prog8/compiler/target/c64/codegen/AssignmentAsmGen.kt index ab6488b62..c45a1e964 100644 --- a/compiler/src/prog8/compiler/target/c64/codegen/AssignmentAsmGen.kt +++ b/compiler/src/prog8/compiler/target/c64/codegen/AssignmentAsmGen.kt @@ -46,7 +46,7 @@ internal class AssignmentAsmGen(private val program: Program, private val errors } } - // TODO this is the FALLBACK: + // TODO this is the slow FALLBACK, eventually we don't want to have to use it anymore: errors.warn("using suboptimal in-place assignment code (this should still be optimized)", assign.position) val normalAssignment = assign.asDesugaredNonaugmented() return translateNormalAssignment(normalAssignment) diff --git a/compiler/src/prog8/compiler/target/c64/codegen/ForLoopsAsmGen.kt b/compiler/src/prog8/compiler/target/c64/codegen/ForLoopsAsmGen.kt index 7b4e4b0a8..d796aa1b1 100644 --- a/compiler/src/prog8/compiler/target/c64/codegen/ForLoopsAsmGen.kt +++ b/compiler/src/prog8/compiler/target/c64/codegen/ForLoopsAsmGen.kt @@ -16,7 +16,7 @@ import prog8.compiler.toHex import kotlin.math.absoluteValue // todo choose more efficient comparisons to avoid needless lda's -// todo optimize common case step == 2 / -2 +// todo optimize common case when step == 2 or -2 internal class ForLoopsAsmGen(private val program: Program, private val asmgen: AsmGen) { @@ -339,7 +339,7 @@ $continueLabel inc $loopLabel+1 $endLabel""") } DataType.ARRAY_UB, DataType.ARRAY_B -> { - // TODO: optimize loop code when the length of the array is < 256, don't need a separate counter in such cases + // TODO: optimize loop code when the length of the array is < 256, don't need a separate counter var in such cases val length = decl.arraysize!!.size()!! if(stmt.loopRegister!=null && stmt.loopRegister!= Register.A) throw AssemblyError("can only use A") @@ -366,7 +366,7 @@ $counterLabel .byte 0 $endLabel""") } DataType.ARRAY_W, DataType.ARRAY_UW -> { - // TODO: optimize loop code when the length of the array is < 256, don't need a separate counter in such cases + // TODO: optimize loop code when the length of the array is < 256, don't need a separate counter var in such cases val length = decl.arraysize!!.size()!! * 2 if(stmt.loopRegister!=null) throw AssemblyError("can't use register to loop over words") @@ -410,7 +410,7 @@ $endLabel""") } private fun translateForOverConstRange(stmt: ForLoop, iterableDt: DataType, range: IntProgression) { - // TODO: optimize loop code when the range is < 256 iterations, don't need a separate counter in such cases + // TODO: optimize loop code when the range is < 256 iterations, don't need a separate counter var in such cases if (range.isEmpty()) throw AssemblyError("empty range") val loopLabel = asmgen.makeLabel("for_loop")