Merge branch 'master' into c128target

# Conflicts:
#	codeGeneration/src/prog8/codegen/target/C128Target.kt
#	codeGeneration/src/prog8/codegen/target/c128/C128MachineDefinition.kt
#	codeGeneration/src/prog8/codegen/target/c128/C128Zeropage.kt
#	compiler/src/prog8/CompilerMain.kt
#	compiler/src/prog8/compiler/Compiler.kt
This commit is contained in:
Irmen de Jong 2021-12-28 14:30:11 +01:00
commit 30f04962d4
46 changed files with 97 additions and 99 deletions

View File

@ -1,3 +1,3 @@
package prog8.compiler.target
package prog8.codegen.target
class AssemblyError(msg: String) : RuntimeException(msg)

View File

@ -1,14 +1,14 @@
package prog8.compiler.target
package prog8.codegen.target
import com.github.michaelbull.result.fold
import prog8.ast.base.*
import prog8.ast.expressions.Expression
import prog8.ast.statements.RegisterOrStatusflag
import prog8.ast.statements.Subroutine
import prog8.compiler.target.c64.C64MachineDefinition
import prog8.compiler.target.cbm.Petscii
import prog8.compiler.target.cpu6502.codegen.asmsub6502ArgsEvalOrder
import prog8.compiler.target.cpu6502.codegen.asmsub6502ArgsHaveRegisterClobberRisk
import prog8.codegen.target.c64.C64MachineDefinition
import prog8.codegen.target.cbm.Petscii
import prog8.codegen.target.cpu6502.codegen.asmsub6502ArgsEvalOrder
import prog8.codegen.target.cpu6502.codegen.asmsub6502ArgsHaveRegisterClobberRisk
import prog8.compilerinterface.ICompilationTarget

View File

@ -1,4 +1,4 @@
package prog8.compiler.target
package prog8.codegen.target
import com.github.michaelbull.result.fold
import prog8.ast.base.ByteDatatypes
@ -8,10 +8,10 @@ import prog8.ast.base.WordDatatypes
import prog8.ast.expressions.Expression
import prog8.ast.statements.RegisterOrStatusflag
import prog8.ast.statements.Subroutine
import prog8.compiler.target.cbm.Petscii
import prog8.compiler.target.cpu6502.codegen.asmsub6502ArgsEvalOrder
import prog8.compiler.target.cpu6502.codegen.asmsub6502ArgsHaveRegisterClobberRisk
import prog8.compiler.target.cx16.CX16MachineDefinition
import prog8.codegen.target.cbm.Petscii
import prog8.codegen.target.cpu6502.codegen.asmsub6502ArgsEvalOrder
import prog8.codegen.target.cpu6502.codegen.asmsub6502ArgsHaveRegisterClobberRisk
import prog8.codegen.target.cx16.CX16MachineDefinition
import prog8.compilerinterface.ICompilationTarget

View File

@ -1,8 +1,8 @@
package prog8.compiler.target.c64
package prog8.codegen.target.c64
import prog8.ast.base.DataType
import prog8.compiler.target.cbm.Mflpt5
import prog8.compiler.target.cbm.viceMonListPostfix
import prog8.codegen.target.cbm.Mflpt5
import prog8.codegen.target.cbm.viceMonListPostfix
import prog8.compilerinterface.*
import java.io.IOException
import java.nio.file.Path

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.c64
package prog8.codegen.target.c64
import prog8.compilerinterface.CompilationOptions
import prog8.compilerinterface.InternalCompilerException

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.cbm
package prog8.codegen.target.cbm
import com.github.michaelbull.result.Ok
import com.github.michaelbull.result.Result

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.cbm
package prog8.codegen.target.cbm
import prog8.compilerinterface.IMachineFloat
import prog8.compilerinterface.InternalCompilerException

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.cbm
package prog8.codegen.target.cbm
import com.github.michaelbull.result.Err
import com.github.michaelbull.result.Ok

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.cpu6502.codegen
package prog8.codegen.target.cpu6502.codegen
import com.github.michaelbull.result.fold
import prog8.ast.*
@ -6,17 +6,17 @@ import prog8.ast.antlr.escape
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.compiler.target.AssemblyError
import prog8.compiler.target.C64Target
import prog8.compiler.target.Cx16Target
import prog8.compiler.target.cbm.AssemblyProgram
import prog8.compiler.target.cbm.loadAsmIncludeFile
import prog8.compiler.target.cpu6502.codegen.assignment.AsmAssignSource
import prog8.compiler.target.cpu6502.codegen.assignment.AsmAssignTarget
import prog8.compiler.target.cpu6502.codegen.assignment.AsmAssignment
import prog8.compiler.target.cpu6502.codegen.assignment.AssignmentAsmGen
import prog8.compiler.target.cpu6502.codegen.assignment.SourceStorageKind
import prog8.compiler.target.cpu6502.codegen.assignment.TargetStorageKind
import prog8.codegen.target.AssemblyError
import prog8.codegen.target.C64Target
import prog8.codegen.target.Cx16Target
import prog8.codegen.target.cbm.AssemblyProgram
import prog8.codegen.target.cbm.loadAsmIncludeFile
import prog8.codegen.target.cpu6502.codegen.assignment.AsmAssignSource
import prog8.codegen.target.cpu6502.codegen.assignment.AsmAssignTarget
import prog8.codegen.target.cpu6502.codegen.assignment.AsmAssignment
import prog8.codegen.target.cpu6502.codegen.assignment.AssignmentAsmGen
import prog8.codegen.target.cpu6502.codegen.assignment.SourceStorageKind
import prog8.codegen.target.cpu6502.codegen.assignment.TargetStorageKind
import prog8.compilerinterface.*
import prog8.parser.SourceCode
import java.nio.file.Path

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.cpu6502.codegen
package prog8.codegen.target.cpu6502.codegen
import prog8.ast.Program
import prog8.ast.base.VarDeclType

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.cpu6502.codegen
package prog8.codegen.target.cpu6502.codegen
import prog8.ast.base.Cx16VirtualRegisters
import prog8.ast.base.RegisterOrPair

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.cpu6502.codegen
package prog8.codegen.target.cpu6502.codegen
import prog8.ast.IFunctionCall
import prog8.ast.Node
@ -10,9 +10,9 @@ import prog8.ast.statements.DirectMemoryWrite
import prog8.ast.statements.FunctionCallStatement
import prog8.ast.statements.Subroutine
import prog8.ast.toHex
import prog8.compiler.target.AssemblyError
import prog8.compiler.target.Cx16Target
import prog8.compiler.target.cpu6502.codegen.assignment.*
import prog8.codegen.target.AssemblyError
import prog8.codegen.target.Cx16Target
import prog8.codegen.target.cpu6502.codegen.assignment.*
import prog8.compilerinterface.CpuType
import prog8.compilerinterface.FSignature
import prog8.compilerinterface.subroutineFloatEvalResultVar2

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.cpu6502.codegen
package prog8.codegen.target.cpu6502.codegen
import prog8.ast.Program
import prog8.ast.base.*
@ -6,7 +6,7 @@ import prog8.ast.expressions.*
import prog8.ast.statements.BuiltinFunctionPlaceholder
import prog8.ast.statements.Subroutine
import prog8.ast.toHex
import prog8.compiler.target.AssemblyError
import prog8.codegen.target.AssemblyError
import prog8.compilerinterface.BuiltinFunctions
import prog8.compilerinterface.CpuType
import kotlin.math.absoluteValue

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.cpu6502.codegen
package prog8.codegen.target.cpu6502.codegen
import prog8.ast.Program
import prog8.ast.base.ArrayToElementTypes
@ -8,7 +8,7 @@ import prog8.ast.expressions.IdentifierReference
import prog8.ast.expressions.RangeExpr
import prog8.ast.statements.ForLoop
import prog8.ast.toHex
import prog8.compiler.target.AssemblyError
import prog8.codegen.target.AssemblyError
import prog8.compilerinterface.toConstantIntegerRange
import kotlin.math.absoluteValue

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.cpu6502.codegen
package prog8.codegen.target.cpu6502.codegen
import prog8.ast.IFunctionCall
import prog8.ast.Node
@ -6,11 +6,11 @@ import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.compiler.target.AssemblyError
import prog8.compiler.target.cpu6502.codegen.assignment.AsmAssignSource
import prog8.compiler.target.cpu6502.codegen.assignment.AsmAssignTarget
import prog8.compiler.target.cpu6502.codegen.assignment.AsmAssignment
import prog8.compiler.target.cpu6502.codegen.assignment.TargetStorageKind
import prog8.codegen.target.AssemblyError
import prog8.codegen.target.cpu6502.codegen.assignment.AsmAssignSource
import prog8.codegen.target.cpu6502.codegen.assignment.AsmAssignTarget
import prog8.codegen.target.cpu6502.codegen.assignment.AsmAssignment
import prog8.codegen.target.cpu6502.codegen.assignment.TargetStorageKind
import prog8.compilerinterface.CpuType

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.cpu6502.codegen
package prog8.codegen.target.cpu6502.codegen
import prog8.ast.Program
import prog8.ast.base.*
@ -6,7 +6,7 @@ import prog8.ast.expressions.IdentifierReference
import prog8.ast.expressions.NumericLiteralValue
import prog8.ast.statements.PostIncrDecr
import prog8.ast.toHex
import prog8.compiler.target.AssemblyError
import prog8.codegen.target.AssemblyError
internal class PostIncrDecrAsmGen(private val program: Program, private val asmgen: AsmGen) {

View File

@ -1,12 +1,12 @@
package prog8.compiler.target.cpu6502.codegen.assignment
package prog8.codegen.target.cpu6502.codegen.assignment
import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.compilerinterface.IMemSizer
import prog8.compiler.target.AssemblyError
import prog8.compiler.target.cpu6502.codegen.AsmGen
import prog8.codegen.target.AssemblyError
import prog8.codegen.target.cpu6502.codegen.AsmGen
internal enum class TargetStorageKind {

View File

@ -1,12 +1,12 @@
package prog8.compiler.target.cpu6502.codegen.assignment
package prog8.codegen.target.cpu6502.codegen.assignment
import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.ast.toHex
import prog8.compiler.target.AssemblyError
import prog8.compiler.target.cpu6502.codegen.AsmGen
import prog8.codegen.target.AssemblyError
import prog8.codegen.target.cpu6502.codegen.AsmGen
import prog8.compilerinterface.BuiltinFunctions
import prog8.compilerinterface.CpuType
import prog8.compilerinterface.builtinFunctionReturnType

View File

@ -1,12 +1,12 @@
package prog8.compiler.target.cpu6502.codegen.assignment
package prog8.codegen.target.cpu6502.codegen.assignment
import prog8.ast.Program
import prog8.ast.base.*
import prog8.ast.expressions.*
import prog8.ast.statements.Subroutine
import prog8.ast.toHex
import prog8.compiler.target.AssemblyError
import prog8.compiler.target.cpu6502.codegen.AsmGen
import prog8.codegen.target.AssemblyError
import prog8.codegen.target.cpu6502.codegen.AsmGen
import prog8.compilerinterface.CpuType

View File

@ -1,8 +1,8 @@
package prog8.compiler.target.cx16
package prog8.codegen.target.cx16
import prog8.ast.base.DataType
import prog8.compiler.target.cbm.Mflpt5
import prog8.compiler.target.cbm.viceMonListPostfix
import prog8.codegen.target.cbm.Mflpt5
import prog8.codegen.target.cbm.viceMonListPostfix
import prog8.compilerinterface.*
import java.io.IOException
import java.nio.file.Path

View File

@ -1,4 +1,4 @@
package prog8.compiler.target.cx16
package prog8.codegen.target.cx16
import prog8.compilerinterface.CompilationOptions
import prog8.compilerinterface.InternalCompilerException

View File

@ -5,9 +5,8 @@ import prog8.ast.base.AstException
import prog8.compiler.CompilationResult
import prog8.compiler.CompilerArguments
import prog8.compiler.compileProgram
import prog8.compiler.target.C128Target
import prog8.compiler.target.C64Target
import prog8.compiler.target.Cx16Target
import prog8.codegen.target.C64Target
import prog8.codegen.target.Cx16Target
import java.io.File
import java.nio.file.FileSystems
import java.nio.file.Path

View File

@ -11,7 +11,7 @@ import prog8.ast.walk.AstWalker
import prog8.ast.walk.IAstModification
import prog8.ast.walk.IAstVisitor
import prog8.compiler.astprocessing.isSubroutineParameter
import prog8.compiler.target.AssemblyError
import prog8.codegen.target.AssemblyError
import prog8.compilerinterface.*
import prog8.optimizer.getTempVarName

View File

@ -10,10 +10,9 @@ import prog8.ast.expressions.Expression
import prog8.ast.expressions.NumericLiteralValue
import prog8.ast.statements.Directive
import prog8.compiler.astprocessing.*
import prog8.compiler.target.C128Target
import prog8.compiler.target.C64Target
import prog8.compiler.target.Cx16Target
import prog8.compiler.target.cpu6502.codegen.AsmGen
import prog8.codegen.target.C64Target
import prog8.codegen.target.Cx16Target
import prog8.codegen.target.cpu6502.codegen.AsmGen
import prog8.compilerinterface.*
import prog8.optimizer.*
import prog8.parser.ParseError

View File

@ -3,7 +3,7 @@ package prog8tests
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldContain
import prog8.compiler.target.C64Target
import prog8.codegen.target.C64Target
import prog8tests.helpers.ErrorReporterForTests
import prog8tests.helpers.assertSuccess
import prog8tests.helpers.compileText

View File

@ -7,7 +7,7 @@ import io.kotest.matchers.maps.shouldNotContainKey
import io.kotest.matchers.shouldBe
import prog8.ast.statements.Block
import prog8.ast.statements.Subroutine
import prog8.compiler.target.C64Target
import prog8.codegen.target.C64Target
import prog8.compilerinterface.CallGraph
import prog8tests.helpers.assertSuccess
import prog8tests.helpers.compileText

View File

@ -11,7 +11,7 @@ import prog8.ast.base.VarDeclType
import prog8.ast.expressions.IdentifierReference
import prog8.ast.expressions.NumericLiteralValue
import prog8.ast.statements.Assignment
import prog8.compiler.target.Cx16Target
import prog8.codegen.target.Cx16Target
import prog8tests.helpers.assertSuccess
import prog8tests.helpers.compileText

View File

@ -4,8 +4,8 @@ import io.kotest.core.spec.style.FunSpec
import prog8.compiler.CompilationResult
import prog8.compiler.CompilerArguments
import prog8.compiler.compileProgram
import prog8.compiler.target.C64Target
import prog8.compiler.target.Cx16Target
import prog8.codegen.target.C64Target
import prog8.codegen.target.Cx16Target
import prog8.compilerinterface.ICompilationTarget
import prog8tests.helpers.*
import prog8tests.helpers.assertSuccess

View File

@ -9,7 +9,7 @@ import prog8.ast.expressions.IdentifierReference
import prog8.ast.expressions.StringLiteralValue
import prog8.ast.statements.FunctionCallStatement
import prog8.ast.statements.Label
import prog8.compiler.target.Cx16Target
import prog8.codegen.target.Cx16Target
import prog8tests.helpers.*
import prog8tests.helpers.assertFailure
import prog8tests.helpers.assertSuccess

View File

@ -10,8 +10,8 @@ import prog8.ast.base.Position
import prog8.ast.expressions.*
import prog8.ast.statements.ForLoop
import prog8.ast.statements.VarDecl
import prog8.compiler.target.C64Target
import prog8.compiler.target.Cx16Target
import prog8.codegen.target.C64Target
import prog8.codegen.target.Cx16Target
import prog8.compilerinterface.size
import prog8.compilerinterface.toConstantIntegerRange
import prog8tests.helpers.*

View File

@ -4,7 +4,7 @@ import io.kotest.core.spec.style.FunSpec
import prog8.compiler.CompilationResult
import prog8.compiler.CompilerArguments
import prog8.compiler.compileProgram
import prog8.compiler.target.Cx16Target
import prog8.codegen.target.Cx16Target
import prog8tests.helpers.*
import prog8tests.helpers.assertSuccess
import java.nio.file.Path

View File

@ -7,7 +7,7 @@ import io.kotest.matchers.string.shouldStartWith
import prog8.ast.internedStringsModuleName
import prog8.compiler.determineCompilationOptions
import prog8.compiler.parseImports
import prog8.compiler.target.C64Target
import prog8.codegen.target.C64Target
import prog8.compilerinterface.ZeropageType
import prog8tests.helpers.ErrorReporterForTests
import prog8tests.helpers.assertSuccess

View File

@ -13,7 +13,7 @@ import prog8.ast.expressions.NumericLiteralValue
import prog8.ast.expressions.PrefixExpression
import prog8.ast.statements.*
import prog8.compiler.printProgram
import prog8.compiler.target.C64Target
import prog8.codegen.target.C64Target
import prog8.compilerinterface.isIOAddress
import prog8.parser.SourceCode
import prog8tests.helpers.DummyFunctions

View File

@ -6,8 +6,8 @@ import io.kotest.matchers.doubles.plusOrMinus
import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldContain
import prog8.ast.toHex
import prog8.compiler.target.C64Target
import prog8.compiler.target.cbm.Mflpt5
import prog8.codegen.target.C64Target
import prog8.codegen.target.cbm.Mflpt5
import prog8.compilerinterface.InternalCompilerException
import prog8tests.helpers.ErrorReporterForTests
import prog8tests.helpers.assertFailure

View File

@ -16,7 +16,7 @@ import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.compiler.BeforeAsmGenerationAstChanger
import prog8.compiler.printProgram
import prog8.compiler.target.C64Target
import prog8.codegen.target.C64Target
import prog8.compilerinterface.*
import prog8tests.helpers.*
import prog8tests.helpers.DummyFunctions

View File

@ -6,7 +6,7 @@ import com.github.michaelbull.result.getOrElse
import io.kotest.assertions.withClue
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import prog8.compiler.target.cbm.Petscii
import prog8.codegen.target.cbm.Petscii
class TestPetscii: FunSpec({

View File

@ -10,7 +10,7 @@ import prog8.ast.GlobalNamespace
import prog8.ast.base.ParentSentinel
import prog8.ast.expressions.NumericLiteralValue
import prog8.ast.statements.*
import prog8.compiler.target.C64Target
import prog8.codegen.target.C64Target
import prog8tests.helpers.ErrorReporterForTests
import prog8tests.helpers.assertFailure
import prog8tests.helpers.assertSuccess

View File

@ -10,7 +10,7 @@ import prog8.ast.base.DataType
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.compiler.printProgram
import prog8.compiler.target.C64Target
import prog8.codegen.target.C64Target
import prog8tests.helpers.ErrorReporterForTests
import prog8tests.helpers.assertFailure
import prog8tests.helpers.assertSuccess

View File

@ -11,10 +11,10 @@ import prog8.ast.base.DataType
import prog8.ast.expressions.Expression
import prog8.ast.statements.RegisterOrStatusflag
import prog8.ast.statements.Subroutine
import prog8.compiler.target.C64Target
import prog8.compiler.target.Cx16Target
import prog8.compiler.target.c64.C64Zeropage
import prog8.compiler.target.cx16.CX16Zeropage
import prog8.codegen.target.C64Target
import prog8.codegen.target.Cx16Target
import prog8.codegen.target.c64.C64Zeropage
import prog8.codegen.target.cx16.CX16Zeropage
import prog8.compilerinterface.*
import prog8tests.helpers.ErrorReporterForTests

View File

@ -19,8 +19,8 @@ import prog8.ast.base.DataType
import prog8.ast.base.Position
import prog8.ast.expressions.*
import prog8.ast.statements.*
import prog8.compiler.target.C64Target
import prog8.compiler.target.cbm.Petscii
import prog8.codegen.target.C64Target
import prog8.codegen.target.cbm.Petscii
import prog8.parser.ParseError
import prog8.parser.Prog8Parser.parseModule
import prog8.parser.SourceCode

View File

@ -10,9 +10,9 @@ import prog8.ast.expressions.AddressOf
import prog8.ast.expressions.IdentifierReference
import prog8.ast.expressions.NumericLiteralValue
import prog8.ast.statements.*
import prog8.compiler.target.C64Target
import prog8.compiler.target.c64.C64Zeropage
import prog8.compiler.target.cpu6502.codegen.AsmGen
import prog8.codegen.target.C64Target
import prog8.codegen.target.c64.C64Zeropage
import prog8.codegen.target.cpu6502.codegen.AsmGen
import prog8.compilerinterface.*
import prog8.parser.SourceCode
import prog8tests.helpers.DummyFunctions

View File

@ -3,7 +3,7 @@ package prog8tests.codegeneration
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldContain
import prog8.compiler.target.C64Target
import prog8.codegen.target.C64Target
import prog8tests.helpers.ErrorReporterForTests
import prog8tests.helpers.assertSuccess
import prog8tests.helpers.compileText

View File

@ -6,9 +6,9 @@ import prog8.ast.Program
import prog8.compiler.CompilationResult
import prog8.compiler.CompilerArguments
import prog8.compiler.compileProgram
import prog8.compiler.target.C64Target
import prog8.compiler.target.c64.C64Zeropage
import prog8.compiler.target.cpu6502.codegen.AsmGen
import prog8.codegen.target.C64Target
import prog8.codegen.target.c64.C64Zeropage
import prog8.codegen.target.cpu6502.codegen.AsmGen
import prog8.compilerinterface.*
import java.nio.file.Path
import kotlin.io.path.name