From 37fcde30d65b44d07ce91521593175284f949e60 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 28 Dec 2023 05:28:32 +0100 Subject: [PATCH] constants have p8c_ prefix instead of p8v_ in the asm --- codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt | 3 ++- compilerAst/src/prog8/compiler/CallGraph.kt | 2 +- docs/source/technical.rst | 1 + docs/source/todo.rst | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt index 222cfdee9..d2e542e95 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt @@ -37,7 +37,8 @@ class AsmGen6502(val prefixSymbols: Boolean): ICodeGeneratorBackend { is PtAsmSub, is PtSub -> node.name = "p8s_${node.name}" is PtBlock -> node.name = "p8b_${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}" } } diff --git a/compilerAst/src/prog8/compiler/CallGraph.kt b/compilerAst/src/prog8/compiler/CallGraph.kt index 34ac9f49c..7628ba97a 100644 --- a/compilerAst/src/prog8/compiler/CallGraph.kt +++ b/compilerAst/src/prog8/compiler/CallGraph.kt @@ -167,7 +167,7 @@ class CallGraph(private val program: Program) : IAstVisitor { 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 = emptyList()): Boolean { if(knownAsmPrefixes.isNotEmpty()) return allAssemblyNodes.any { diff --git a/docs/source/technical.rst b/docs/source/technical.rst index 2c35b0787..739d275b4 100644 --- a/docs/source/technical.rst +++ b/docs/source/technical.rst @@ -38,6 +38,7 @@ Element type prefix Block ``p8b_`` Subroutine ``p8s_`` Variable ``p8v_`` +Constant ``p8c_`` Label ``p8l_`` other ``p8_`` ============ ======== diff --git a/docs/source/todo.rst b/docs/source/todo.rst index aadfb571f..9a831f16e 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -2,7 +2,7 @@ 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 switch to enable INFO error messages (default is WARN and up)