mirror of
https://github.com/irmen/prog8.git
synced 2024-12-23 09:32:43 +00:00
cleanup
This commit is contained in:
parent
fd6eb47e68
commit
ba614801ee
@ -1,7 +1,10 @@
|
|||||||
package prog8.codegen.cpu6502
|
package prog8.codegen.cpu6502
|
||||||
|
|
||||||
import com.github.michaelbull.result.fold
|
import com.github.michaelbull.result.fold
|
||||||
import prog8.ast.*
|
import prog8.ast.IFunctionCall
|
||||||
|
import prog8.ast.Node
|
||||||
|
import prog8.ast.ParentSentinel
|
||||||
|
import prog8.ast.Program
|
||||||
import prog8.ast.base.FatalAstException
|
import prog8.ast.base.FatalAstException
|
||||||
import prog8.ast.expressions.*
|
import prog8.ast.expressions.*
|
||||||
import prog8.ast.statements.*
|
import prog8.ast.statements.*
|
||||||
@ -10,7 +13,6 @@ import prog8.code.core.*
|
|||||||
import prog8.codegen.cpu6502.assignment.*
|
import prog8.codegen.cpu6502.assignment.*
|
||||||
import prog8.compiler.BuiltinFunctions
|
import prog8.compiler.BuiltinFunctions
|
||||||
import prog8.compiler.builtinFunctionReturnType
|
import prog8.compiler.builtinFunctionReturnType
|
||||||
import prog8.code.core.SourceCode
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.io.path.Path
|
import kotlin.io.path.Path
|
||||||
import kotlin.io.path.writeLines
|
import kotlin.io.path.writeLines
|
||||||
|
@ -4,7 +4,6 @@ import com.github.michaelbull.result.Ok
|
|||||||
import com.github.michaelbull.result.Result
|
import com.github.michaelbull.result.Result
|
||||||
import com.github.michaelbull.result.mapError
|
import com.github.michaelbull.result.mapError
|
||||||
import prog8.code.core.*
|
import prog8.code.core.*
|
||||||
import prog8.code.core.SourceCode
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import kotlin.io.path.Path
|
import kotlin.io.path.Path
|
||||||
|
@ -28,11 +28,10 @@ internal class AssignmentGen(private val codeGen: CodeGen, private val expressio
|
|||||||
val address = codeGen.allocations.get(ident.targetName)
|
val address = codeGen.allocations.get(ident.targetName)
|
||||||
assignSelfInMemory(address, assignment.value, assignment)
|
assignSelfInMemory(address, assignment.value, assignment)
|
||||||
} else if(memory != null) {
|
} else if(memory != null) {
|
||||||
if(memory.address is PtNumber) {
|
if(memory.address is PtNumber)
|
||||||
assignSelfInMemory((memory.address as PtNumber).number.toInt(), assignment.value, assignment)
|
assignSelfInMemory((memory.address as PtNumber).number.toInt(), assignment.value, assignment)
|
||||||
} else {
|
else
|
||||||
fallbackAssign(assignment)
|
fallbackAssign(assignment)
|
||||||
}
|
|
||||||
} else if(array!=null) {
|
} else if(array!=null) {
|
||||||
// TODO in-place array element assignment?
|
// TODO in-place array element assignment?
|
||||||
fallbackAssign(assignment)
|
fallbackAssign(assignment)
|
||||||
@ -58,8 +57,8 @@ internal class AssignmentGen(private val codeGen: CodeGen, private val expressio
|
|||||||
code // do nothing, mem=mem null assignment.
|
code // do nothing, mem=mem null assignment.
|
||||||
else {
|
else {
|
||||||
// read and write a (i/o) memory location to itself.
|
// read and write a (i/o) memory location to itself.
|
||||||
code += VmCodeInstruction(Opcode.LOADM, vmDt, reg1 = 0, value = address)
|
code += VmCodeInstruction(Opcode.LOADM, vmDt, reg1 =0, value = address)
|
||||||
code += VmCodeInstruction(Opcode.STOREM, vmDt, reg1 = 0, value = address)
|
code += VmCodeInstruction(Opcode.STOREM, vmDt, reg1=0, value = address)
|
||||||
code
|
code
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ class CodeGen(internal val program: PtProgram,
|
|||||||
// iterate over a zero-terminated string
|
// iterate over a zero-terminated string
|
||||||
code += VmCodeInstruction(Opcode.LOAD, VmDataType.BYTE, reg1=indexReg, value=0)
|
code += VmCodeInstruction(Opcode.LOAD, VmDataType.BYTE, reg1=indexReg, value=0)
|
||||||
code += VmCodeLabel(loopLabel)
|
code += VmCodeLabel(loopLabel)
|
||||||
code += VmCodeInstruction(Opcode.LOADX, VmDataType.BYTE, reg1=0, reg2=indexReg, value = arrayAddress)
|
code += VmCodeInstruction(Opcode.LOADX, VmDataType.BYTE, reg1 = 0, reg2=indexReg, value = arrayAddress)
|
||||||
code += VmCodeInstruction(Opcode.BZ, VmDataType.BYTE, reg1=0, labelSymbol = endLabel)
|
code += VmCodeInstruction(Opcode.BZ, VmDataType.BYTE, reg1=0, labelSymbol = endLabel)
|
||||||
code += VmCodeInstruction(Opcode.STOREM, VmDataType.BYTE, reg1=0, value = loopvarAddress)
|
code += VmCodeInstruction(Opcode.STOREM, VmDataType.BYTE, reg1=0, value = loopvarAddress)
|
||||||
code += translateNode(forLoop.statements)
|
code += translateNode(forLoop.statements)
|
||||||
|
@ -3,7 +3,9 @@ package prog8.optimizer
|
|||||||
import prog8.ast.IStatementContainer
|
import prog8.ast.IStatementContainer
|
||||||
import prog8.ast.Node
|
import prog8.ast.Node
|
||||||
import prog8.ast.Program
|
import prog8.ast.Program
|
||||||
import prog8.ast.expressions.*
|
import prog8.ast.expressions.BinaryExpression
|
||||||
|
import prog8.ast.expressions.IdentifierReference
|
||||||
|
import prog8.ast.expressions.TypecastExpression
|
||||||
import prog8.ast.getTempVar
|
import prog8.ast.getTempVar
|
||||||
import prog8.ast.statements.AssignTarget
|
import prog8.ast.statements.AssignTarget
|
||||||
import prog8.ast.statements.Assignment
|
import prog8.ast.statements.Assignment
|
||||||
|
@ -9,8 +9,8 @@ import prog8.ast.statements.Directive
|
|||||||
import prog8.ast.statements.DirectiveArg
|
import prog8.ast.statements.DirectiveArg
|
||||||
import prog8.code.core.IErrorReporter
|
import prog8.code.core.IErrorReporter
|
||||||
import prog8.code.core.Position
|
import prog8.code.core.Position
|
||||||
import prog8.parser.Prog8Parser
|
|
||||||
import prog8.code.core.SourceCode
|
import prog8.code.core.SourceCode
|
||||||
|
import prog8.parser.Prog8Parser
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import kotlin.io.path.*
|
import kotlin.io.path.*
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package prog8.compiler.astprocessing
|
package prog8.compiler.astprocessing
|
||||||
|
|
||||||
import prog8.ast.*
|
import prog8.ast.IFunctionCall
|
||||||
|
import prog8.ast.IPipe
|
||||||
|
import prog8.ast.Node
|
||||||
|
import prog8.ast.Program
|
||||||
import prog8.ast.base.FatalAstException
|
import prog8.ast.base.FatalAstException
|
||||||
import prog8.ast.expressions.Expression
|
import prog8.ast.expressions.Expression
|
||||||
import prog8.ast.expressions.FunctionCallExpression
|
import prog8.ast.expressions.FunctionCallExpression
|
||||||
|
@ -11,15 +11,11 @@ import io.kotest.matchers.shouldBe
|
|||||||
import io.kotest.matchers.string.shouldContain
|
import io.kotest.matchers.string.shouldContain
|
||||||
import prog8.ast.Program
|
import prog8.ast.Program
|
||||||
import prog8.code.core.IErrorReporter
|
import prog8.code.core.IErrorReporter
|
||||||
import prog8.compiler.ModuleImporter
|
|
||||||
import prog8.parser.ParseError
|
|
||||||
import prog8.code.core.SourceCode
|
import prog8.code.core.SourceCode
|
||||||
import prog8.code.core.internedStringsModuleName
|
import prog8.code.core.internedStringsModuleName
|
||||||
import prog8tests.helpers.Helpers
|
import prog8.compiler.ModuleImporter
|
||||||
import prog8tests.helpers.DummyFunctions
|
import prog8.parser.ParseError
|
||||||
import prog8tests.helpers.DummyMemsizer
|
import prog8tests.helpers.*
|
||||||
import prog8tests.helpers.DummyStringEncoder
|
|
||||||
import prog8tests.helpers.ErrorReporterForTests
|
|
||||||
import kotlin.io.path.*
|
import kotlin.io.path.*
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,10 +9,10 @@ import io.kotest.matchers.string.shouldContain
|
|||||||
import prog8.ast.Program
|
import prog8.ast.Program
|
||||||
import prog8.ast.statements.Block
|
import prog8.ast.statements.Block
|
||||||
import prog8.ast.statements.Subroutine
|
import prog8.ast.statements.Subroutine
|
||||||
|
import prog8.code.core.SourceCode
|
||||||
import prog8.code.target.C64Target
|
import prog8.code.target.C64Target
|
||||||
import prog8.compiler.CallGraph
|
import prog8.compiler.CallGraph
|
||||||
import prog8.parser.Prog8Parser.parseModule
|
import prog8.parser.Prog8Parser.parseModule
|
||||||
import prog8.code.core.SourceCode
|
|
||||||
import prog8tests.helpers.*
|
import prog8tests.helpers.*
|
||||||
|
|
||||||
class TestCallgraph: FunSpec({
|
class TestCallgraph: FunSpec({
|
||||||
|
@ -8,8 +8,8 @@ import prog8.code.target.Cx16Target
|
|||||||
import prog8.compiler.CompilationResult
|
import prog8.compiler.CompilationResult
|
||||||
import prog8.compiler.CompilerArguments
|
import prog8.compiler.CompilerArguments
|
||||||
import prog8.compiler.compileProgram
|
import prog8.compiler.compileProgram
|
||||||
import prog8tests.helpers.Helpers
|
|
||||||
import prog8tests.helpers.Combinations
|
import prog8tests.helpers.Combinations
|
||||||
|
import prog8tests.helpers.Helpers
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import kotlin.io.path.absolute
|
import kotlin.io.path.absolute
|
||||||
import kotlin.io.path.exists
|
import kotlin.io.path.exists
|
||||||
|
@ -10,7 +10,8 @@ import prog8.ast.expressions.StringLiteral
|
|||||||
import prog8.ast.statements.FunctionCallStatement
|
import prog8.ast.statements.FunctionCallStatement
|
||||||
import prog8.ast.statements.Label
|
import prog8.ast.statements.Label
|
||||||
import prog8.code.target.Cx16Target
|
import prog8.code.target.Cx16Target
|
||||||
import prog8tests.helpers.*
|
import prog8tests.helpers.Helpers
|
||||||
|
import prog8tests.helpers.compileFile
|
||||||
import kotlin.io.path.name
|
import kotlin.io.path.name
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ import prog8.code.core.Encoding
|
|||||||
import prog8.code.core.Position
|
import prog8.code.core.Position
|
||||||
import prog8.code.target.C64Target
|
import prog8.code.target.C64Target
|
||||||
import prog8.code.target.Cx16Target
|
import prog8.code.target.Cx16Target
|
||||||
import prog8tests.helpers.ErrorReporterForTests
|
|
||||||
import prog8tests.helpers.Combinations
|
import prog8tests.helpers.Combinations
|
||||||
|
import prog8tests.helpers.ErrorReporterForTests
|
||||||
import prog8tests.helpers.compileText
|
import prog8tests.helpers.compileText
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,10 +12,10 @@ import prog8.ast.expressions.PrefixExpression
|
|||||||
import prog8.ast.statements.*
|
import prog8.ast.statements.*
|
||||||
import prog8.code.core.DataType
|
import prog8.code.core.DataType
|
||||||
import prog8.code.core.Position
|
import prog8.code.core.Position
|
||||||
|
import prog8.code.core.SourceCode
|
||||||
import prog8.code.core.ZeropageWish
|
import prog8.code.core.ZeropageWish
|
||||||
import prog8.code.target.C64Target
|
import prog8.code.target.C64Target
|
||||||
import prog8.compiler.printProgram
|
import prog8.compiler.printProgram
|
||||||
import prog8.code.core.SourceCode
|
|
||||||
import prog8tests.helpers.DummyFunctions
|
import prog8tests.helpers.DummyFunctions
|
||||||
import prog8tests.helpers.DummyMemsizer
|
import prog8tests.helpers.DummyMemsizer
|
||||||
import prog8tests.helpers.DummyStringEncoder
|
import prog8tests.helpers.DummyStringEncoder
|
||||||
|
@ -13,11 +13,11 @@ import prog8.ast.statements.Pipe
|
|||||||
import prog8.ast.statements.VarDecl
|
import prog8.ast.statements.VarDecl
|
||||||
import prog8.code.core.DataType
|
import prog8.code.core.DataType
|
||||||
import prog8.code.core.Position
|
import prog8.code.core.Position
|
||||||
|
import prog8.code.core.SourceCode
|
||||||
import prog8.code.target.C64Target
|
import prog8.code.target.C64Target
|
||||||
|
import prog8.code.target.VMTarget
|
||||||
import prog8.compiler.astprocessing.AstPreprocessor
|
import prog8.compiler.astprocessing.AstPreprocessor
|
||||||
import prog8.parser.Prog8Parser.parseModule
|
import prog8.parser.Prog8Parser.parseModule
|
||||||
import prog8.code.core.SourceCode
|
|
||||||
import prog8.code.target.VMTarget
|
|
||||||
import prog8tests.helpers.*
|
import prog8tests.helpers.*
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@ import io.kotest.matchers.string.shouldContain
|
|||||||
import prog8.ast.AstToSourceTextConverter
|
import prog8.ast.AstToSourceTextConverter
|
||||||
import prog8.ast.Module
|
import prog8.ast.Module
|
||||||
import prog8.ast.Program
|
import prog8.ast.Program
|
||||||
import prog8.parser.ParseError
|
|
||||||
import prog8.parser.Prog8Parser.parseModule
|
|
||||||
import prog8.code.core.SourceCode
|
import prog8.code.core.SourceCode
|
||||||
import prog8.code.core.internedStringsModuleName
|
import prog8.code.core.internedStringsModuleName
|
||||||
|
import prog8.parser.ParseError
|
||||||
|
import prog8.parser.Prog8Parser.parseModule
|
||||||
import prog8tests.helpers.DummyFunctions
|
import prog8tests.helpers.DummyFunctions
|
||||||
import prog8tests.helpers.DummyMemsizer
|
import prog8tests.helpers.DummyMemsizer
|
||||||
import prog8tests.helpers.DummyStringEncoder
|
import prog8tests.helpers.DummyStringEncoder
|
||||||
|
@ -10,8 +10,8 @@ import prog8.ast.expressions.NumericLiteral
|
|||||||
import prog8.ast.expressions.PrefixExpression
|
import prog8.ast.expressions.PrefixExpression
|
||||||
import prog8.ast.statements.*
|
import prog8.ast.statements.*
|
||||||
import prog8.code.core.Position
|
import prog8.code.core.Position
|
||||||
import prog8.parser.Prog8Parser
|
|
||||||
import prog8.code.core.SourceCode
|
import prog8.code.core.SourceCode
|
||||||
|
import prog8.parser.Prog8Parser
|
||||||
import prog8tests.helpers.DummyFunctions
|
import prog8tests.helpers.DummyFunctions
|
||||||
import prog8tests.helpers.DummyMemsizer
|
import prog8tests.helpers.DummyMemsizer
|
||||||
import prog8tests.helpers.DummyStringEncoder
|
import prog8tests.helpers.DummyStringEncoder
|
||||||
|
@ -6,7 +6,6 @@ import io.kotest.matchers.ints.shouldBeGreaterThan
|
|||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
import prog8.code.ast.*
|
import prog8.code.ast.*
|
||||||
import prog8.code.core.DataType
|
import prog8.code.core.DataType
|
||||||
import prog8.code.core.Position
|
|
||||||
import prog8.code.target.C64Target
|
import prog8.code.target.C64Target
|
||||||
import prog8.compiler.IntermediateAstMaker
|
import prog8.compiler.IntermediateAstMaker
|
||||||
import prog8tests.helpers.compileText
|
import prog8tests.helpers.compileText
|
||||||
|
@ -17,15 +17,11 @@ import prog8.ast.Node
|
|||||||
import prog8.ast.Program
|
import prog8.ast.Program
|
||||||
import prog8.ast.expressions.*
|
import prog8.ast.expressions.*
|
||||||
import prog8.ast.statements.*
|
import prog8.ast.statements.*
|
||||||
import prog8.code.core.DataType
|
import prog8.code.core.*
|
||||||
import prog8.code.core.Encoding
|
|
||||||
import prog8.code.core.Position
|
|
||||||
import prog8.code.core.ZeropageWish
|
|
||||||
import prog8.code.target.C64Target
|
import prog8.code.target.C64Target
|
||||||
import prog8.code.target.cbm.PetsciiEncoding
|
import prog8.code.target.cbm.PetsciiEncoding
|
||||||
import prog8.parser.ParseError
|
import prog8.parser.ParseError
|
||||||
import prog8.parser.Prog8Parser.parseModule
|
import prog8.parser.Prog8Parser.parseModule
|
||||||
import prog8.code.core.SourceCode
|
|
||||||
import prog8tests.helpers.*
|
import prog8tests.helpers.*
|
||||||
import kotlin.io.path.Path
|
import kotlin.io.path.Path
|
||||||
import kotlin.io.path.isRegularFile
|
import kotlin.io.path.isRegularFile
|
||||||
|
@ -5,8 +5,8 @@ import io.kotest.matchers.shouldBe
|
|||||||
import prog8.ast.statements.Block
|
import prog8.ast.statements.Block
|
||||||
import prog8.ast.statements.Subroutine
|
import prog8.ast.statements.Subroutine
|
||||||
import prog8.code.core.DataType
|
import prog8.code.core.DataType
|
||||||
import prog8.parser.Prog8Parser.parseModule
|
|
||||||
import prog8.code.core.SourceCode
|
import prog8.code.core.SourceCode
|
||||||
|
import prog8.parser.Prog8Parser.parseModule
|
||||||
|
|
||||||
|
|
||||||
class TestSubroutines: AnnotationSpec() {
|
class TestSubroutines: AnnotationSpec() {
|
||||||
|
@ -6,7 +6,6 @@ import io.kotest.matchers.shouldNotBe
|
|||||||
import prog8.ast.IFunctionCall
|
import prog8.ast.IFunctionCall
|
||||||
import prog8.ast.expressions.IdentifierReference
|
import prog8.ast.expressions.IdentifierReference
|
||||||
import prog8.ast.expressions.StringLiteral
|
import prog8.ast.expressions.StringLiteral
|
||||||
import prog8.ast.statements.Assignment
|
|
||||||
import prog8.ast.statements.InlineAssembly
|
import prog8.ast.statements.InlineAssembly
|
||||||
import prog8.ast.statements.VarDecl
|
import prog8.ast.statements.VarDecl
|
||||||
import prog8.code.core.Position
|
import prog8.code.core.Position
|
||||||
|
@ -13,7 +13,6 @@ import prog8.code.target.C64Target
|
|||||||
import prog8.code.target.c64.C64Zeropage
|
import prog8.code.target.c64.C64Zeropage
|
||||||
import prog8.codegen.cpu6502.AsmGen
|
import prog8.codegen.cpu6502.AsmGen
|
||||||
import prog8.compiler.astprocessing.SymbolTableMaker
|
import prog8.compiler.astprocessing.SymbolTableMaker
|
||||||
import prog8.code.core.SourceCode
|
|
||||||
import prog8tests.helpers.DummyFunctions
|
import prog8tests.helpers.DummyFunctions
|
||||||
import prog8tests.helpers.DummyMemsizer
|
import prog8tests.helpers.DummyMemsizer
|
||||||
import prog8tests.helpers.DummyStringEncoder
|
import prog8tests.helpers.DummyStringEncoder
|
||||||
|
@ -6,7 +6,6 @@ import prog8.ast.expressions.StringLiteral
|
|||||||
import prog8.ast.statements.*
|
import prog8.ast.statements.*
|
||||||
import prog8.ast.walk.IAstVisitor
|
import prog8.ast.walk.IAstVisitor
|
||||||
import prog8.code.core.*
|
import prog8.code.core.*
|
||||||
import prog8.code.core.SourceCode
|
|
||||||
|
|
||||||
/*********** Everything starts from here, the Program; zero or more modules *************/
|
/*********** Everything starts from here, the Program; zero or more modules *************/
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ import prog8.ast.expressions.*
|
|||||||
import prog8.ast.statements.*
|
import prog8.ast.statements.*
|
||||||
import prog8.code.core.*
|
import prog8.code.core.*
|
||||||
import prog8.parser.Prog8ANTLRParser
|
import prog8.parser.Prog8ANTLRParser
|
||||||
import prog8.code.core.SourceCode
|
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import kotlin.io.path.isRegularFile
|
import kotlin.io.path.isRegularFile
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package prog8.ast.expressions
|
package prog8.ast.expressions
|
||||||
|
|
||||||
import prog8.ast.*
|
import prog8.ast.IFunctionCall
|
||||||
|
import prog8.ast.IPipe
|
||||||
|
import prog8.ast.Node
|
||||||
|
import prog8.ast.Program
|
||||||
import prog8.ast.base.ExpressionError
|
import prog8.ast.base.ExpressionError
|
||||||
import prog8.ast.base.FatalAstException
|
import prog8.ast.base.FatalAstException
|
||||||
import prog8.ast.base.UndefinedSymbolError
|
import prog8.ast.base.UndefinedSymbolError
|
||||||
|
@ -7,7 +7,10 @@ import prog8.ast.base.SyntaxError
|
|||||||
import prog8.ast.expressions.*
|
import prog8.ast.expressions.*
|
||||||
import prog8.ast.statements.VarDecl
|
import prog8.ast.statements.VarDecl
|
||||||
import prog8.code.core.*
|
import prog8.code.core.*
|
||||||
import kotlin.math.*
|
import kotlin.math.abs
|
||||||
|
import kotlin.math.floor
|
||||||
|
import kotlin.math.sign
|
||||||
|
import kotlin.math.sqrt
|
||||||
|
|
||||||
|
|
||||||
private typealias ConstExpressionCaller = (args: List<Expression>, position: Position, program: Program) -> NumericLiteral
|
private typealias ConstExpressionCaller = (args: List<Expression>, position: Position, program: Program) -> NumericLiteral
|
||||||
|
@ -3,7 +3,8 @@ TODO
|
|||||||
|
|
||||||
For next release
|
For next release
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
- add McCarthy evaluation to shortcircuit and/or expressions. First do ifs by splitting them up? Then do expressions that compute a value?
|
- vm: don't use register 0/1 "as convenience" where it's not required, just allocate a new register anyway.
|
||||||
|
search for reg.\s?=\s?0
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -19,11 +20,12 @@ Future Things and Ideas
|
|||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
Compiler:
|
Compiler:
|
||||||
|
|
||||||
|
- add McCarthy evaluation to shortcircuit and/or expressions. First do ifs by splitting them up? Then do expressions that compute a value?
|
||||||
- vm: codeGen: various TODOs to tweak code
|
- vm: codeGen: various TODOs to tweak code
|
||||||
- vm: implement remaining sin/cos functions in math.p8
|
- vm: implement remaining sin/cos functions in math.p8
|
||||||
- vm: somehow deal with asmsubs otherwise the vm IR can't fully encode all of prog8
|
- vm: somehow deal with asmsubs otherwise the vm IR can't fully encode all of prog8
|
||||||
- vm: don't store symbol names in instructions to make optimizing the IR easier? but what about jumps to labels. And it's no longer readable by humans.
|
- vm: don't store symbol names in instructions to make optimizing the IR easier? but what about jumps to labels. And it's no longer readable by humans.
|
||||||
- vm: how to remove all unused subroutines? (in the assembly codegen, we let 64tass solve this for us)
|
- vm: how to remove all unused subroutines? (in the 6502 assembly codegen, we let 64tass solve this for us)
|
||||||
- vm: rather than being able to jump to any 'address' (IPTR), use 'blocks' that have entry and exit points -> even better dead code elimination possible too
|
- vm: rather than being able to jump to any 'address' (IPTR), use 'blocks' that have entry and exit points -> even better dead code elimination possible too
|
||||||
- vm: add more assignments to translateInplaceAssign()
|
- vm: add more assignments to translateInplaceAssign()
|
||||||
- Inliner: also inline function call expressions, and remove it from the StatementOptimizer
|
- Inliner: also inline function call expressions, and remove it from the StatementOptimizer
|
||||||
|
@ -17,19 +17,26 @@ other {
|
|||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
|
sub ands(ubyte arg, ubyte b1, ubyte b2, ubyte b3, ubyte b4) -> ubyte {
|
||||||
|
return arg>b1 and arg>b2 and arg>b3 and arg>b4
|
||||||
|
}
|
||||||
|
|
||||||
|
sub ors(ubyte arg, ubyte b1, ubyte b2, ubyte b3, ubyte b4) -> ubyte {
|
||||||
|
return arg==b1 or arg==b2 or arg==b3 or arg==b4
|
||||||
|
}
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
ubyte @shared ix = other.getter()
|
ubyte @shared a
|
||||||
ix = other.getter()
|
ubyte @shared b
|
||||||
ix++
|
|
||||||
ix = other.getter()
|
txt.print_ub(ands(10, 2,3,4,5))
|
||||||
ix++
|
txt.spc()
|
||||||
ix = other.getter()
|
txt.print_ub(ands(10, 20,3,4,5))
|
||||||
ix++
|
txt.spc()
|
||||||
ix = other.getter()
|
txt.print_ub(ors(10, 2,3,40,5))
|
||||||
ix++
|
txt.spc()
|
||||||
ix = other.getter()
|
txt.print_ub(ors(10, 1,10,40,5))
|
||||||
ix++
|
txt.spc()
|
||||||
|
|
||||||
; ; a "pixelshader":
|
; ; a "pixelshader":
|
||||||
; sys.gfx_enable(0) ; enable lo res screen
|
; sys.gfx_enable(0) ; enable lo res screen
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package prog8.vm
|
package prog8.vm
|
||||||
|
|
||||||
import kotlin.math.*
|
import kotlin.math.min
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SYSCALLS:
|
SYSCALLS:
|
||||||
|
Loading…
Reference in New Issue
Block a user