constants have p8c_ prefix instead of p8v_ in the asm

This commit is contained in:
Irmen de Jong 2023-12-28 05:28:32 +01:00
parent 09c6cb4d6b
commit 37fcde30d6
4 changed files with 5 additions and 3 deletions

View File

@ -37,7 +37,8 @@ class AsmGen6502(val prefixSymbols: Boolean): ICodeGeneratorBackend {
is PtAsmSub, is PtSub -> node.name = "p8s_${node.name}" is PtAsmSub, is PtSub -> node.name = "p8s_${node.name}"
is PtBlock -> node.name = "p8b_${node.name}" is PtBlock -> node.name = "p8b_${node.name}"
is PtLabel -> node.name = "p8l_${node.name}" is PtLabel -> node.name = "p8l_${node.name}"
is PtVariable, is PtConstant, is PtMemMapped, is PtSubroutineParameter -> node.name = "p8v_${node.name}" is PtConstant -> node.name = "p8c_${node.name}"
is PtVariable, is PtMemMapped, is PtSubroutineParameter -> node.name = "p8v_${node.name}"
else -> node.name = "p8_${node.name}" else -> node.name = "p8_${node.name}"
} }
} }

View File

@ -167,7 +167,7 @@ class CallGraph(private val program: Program) : IAstVisitor {
return allIdentifiersAndTargets.filter { decl===it.value }.map{ it.key } + assemblyBlocks return allIdentifiersAndTargets.filter { decl===it.value }.map{ it.key } + assemblyBlocks
} }
private val prefixes = listOf("p8b_", "p8v_", "p8s_", "p8l_", "p8_", "") private val prefixes = listOf("p8b_", "p8v_", "p8s_", "p8c_", "p8l_", "p8_", "")
private fun nameInAssemblyCode(name: String, knownAsmPrefixes: List<String> = emptyList()): Boolean { private fun nameInAssemblyCode(name: String, knownAsmPrefixes: List<String> = emptyList()): Boolean {
if(knownAsmPrefixes.isNotEmpty()) if(knownAsmPrefixes.isNotEmpty())
return allAssemblyNodes.any { return allAssemblyNodes.any {

View File

@ -38,6 +38,7 @@ Element type prefix
Block ``p8b_`` Block ``p8b_``
Subroutine ``p8s_`` Subroutine ``p8s_``
Variable ``p8v_`` Variable ``p8v_``
Constant ``p8c_``
Label ``p8l_`` Label ``p8l_``
other ``p8_`` other ``p8_``
============ ======== ============ ========

View File

@ -2,7 +2,7 @@
TODO TODO
==== ====
- make constants have p8c_ prefix instead of p8v_ - add unit tests for chained comparisons and for var -> const optimization
- add INFO error level and move some warnings to info - add INFO error level and move some warnings to info
- add switch to enable INFO error messages (default is WARN and up) - add switch to enable INFO error messages (default is WARN and up)