don't stript unused asmsub definitions

This commit is contained in:
Irmen de Jong 2021-03-21 19:55:21 +01:00
parent 2e928bd3c2
commit 0991131fa8
3 changed files with 5 additions and 5 deletions

View File

@ -56,9 +56,10 @@ internal class StatementOptimizer(private val program: Program,
}
if(subroutine !in callgraph.usedSymbols && !forceOutput) {
if(!subroutine.isAsmSubroutine)
if(!subroutine.isAsmSubroutine) {
errors.warn("removing unused subroutine '${subroutine.name}'", subroutine.position)
return listOf(IAstModification.Remove(subroutine, subroutine.definingScope()))
return listOf(IAstModification.Remove(subroutine, subroutine.definingScope()))
}
}
return noModifications

View File

@ -25,6 +25,7 @@ internal class UnusedCodeRemover(private val program: Program,
val removals = mutableListOf<IAstModification>()
// remove all subroutines that aren't called, or are empty
// NOTE: part of this is also done already in the StatementOptimizer
val entrypoint = program.entrypoint()
program.modules.forEach {
callgraph.forAllSubroutines(it) { sub ->

View File

@ -2,8 +2,6 @@
TODO
====
- add cx16.vsave() to be able to make screenshots? (there's no kernal routine for this)
- optimize several inner loops in gfx2
- hoist all variable declarations up to the subroutine scope *before* even the constant folding takes place (to avoid undefined symbol errors when referring to a variable from another nested scope in the subroutine)
- optimize swap of two memread values with index, using the same pointer expression/variable, like swap(@(ptr+1), @(ptr+2))
@ -13,7 +11,7 @@ TODO
- refactor the asmgen into their own submodule?
- refactor the compiler optimizers into their own submodule?
- optimizer: detect variables that are written but never read - mark those as unused too and remove them, such as uword unused = memory("unused222", 20) - also remove the memory slab allocation
- add a compiler option to not remove unused subroutines. this allows for building library programs
- add a compiler option to not remove unused subroutines. this allows for building library programs. But this won't work with 64tass's .proc ...
- make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as ``v_``
- option to load the built-in library files from a directory instead of the embedded ones (for easier library development/debugging)
- c64: make the graphics.BITMAP_ADDRESS configurable (VIC banking)