mirror of
https://github.com/irmen/prog8.git
synced 2024-11-26 11:49:22 +00:00
tweak
This commit is contained in:
parent
ac1bd2fb7b
commit
f778f08f76
@ -311,7 +311,7 @@ class AsmGen(internal val program: Program,
|
||||
is Subroutine -> programGen.translateSubroutine(stmt)
|
||||
is InlineAssembly -> translate(stmt)
|
||||
is BuiltinFunctionCallStatement -> builtinFunctionsAsmGen.translateFunctioncallStatement(stmt)
|
||||
is FunctionCallStatement -> functioncallAsmGen.translateFunctionCallStatement(stmt) // TODO try to remove this last usage of FunctionCallStatement node in the codegen.
|
||||
is FunctionCallStatement -> functioncallAsmGen.translateFunctionCallStatement(stmt)
|
||||
is Assignment -> assignmentAsmGen.translate(stmt)
|
||||
is Jump -> {
|
||||
val (asmLabel, indirect) = getJumpTarget(stmt)
|
||||
|
@ -59,7 +59,7 @@ internal fun optimizeAssembly(lines: MutableList<String>, machine: IMachineDefin
|
||||
numberOfOptimizations++
|
||||
}
|
||||
|
||||
// TODO more assembly optimizations
|
||||
// TODO more assembly peephole optimizations
|
||||
|
||||
return numberOfOptimizations
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ internal class ProgramAndVarsGen(
|
||||
val result = mutableListOf<ZpStringWithInitial>()
|
||||
val vars = allocator.zeropageVars.filter { it.value.dt==DataType.STR }
|
||||
for (variable in vars) {
|
||||
val svar = symboltable.lookup(variable.key) as StStaticVariable // TODO faster in flat lookup table
|
||||
val svar = symboltable.flat.getValue(variable.key) as StStaticVariable
|
||||
if(svar.initialStringValue!=null)
|
||||
result.add(ZpStringWithInitial(variable.key, variable.value, svar.initialStringValue!!))
|
||||
}
|
||||
@ -450,7 +450,7 @@ internal class ProgramAndVarsGen(
|
||||
val result = mutableListOf<ZpArrayWithInitial>()
|
||||
val vars = allocator.zeropageVars.filter { it.value.dt in ArrayDatatypes }
|
||||
for (variable in vars) {
|
||||
val svar = symboltable.lookup(variable.key) as StStaticVariable // TODO faster in flat lookup table
|
||||
val svar = symboltable.flat.getValue(variable.key) as StStaticVariable
|
||||
if(svar.initialArrayValue!=null)
|
||||
result.add(ZpArrayWithInitial(variable.key, variable.value, svar.initialArrayValue!!))
|
||||
}
|
||||
|
@ -630,8 +630,6 @@ internal class AssignmentAsmGen(private val program: Program,
|
||||
}
|
||||
|
||||
private fun fallbackToStackEval(assign: AsmAssignment) {
|
||||
// TODO DON'T STACK-EVAL... perhaps by using a temp var? so that it becomes augmentable assignment expression?
|
||||
// or don't try to solve it here in this one case and rather rewrite the whole stack based value evaluation.
|
||||
// this routine is called for assigning a binaryexpression value:
|
||||
// - if it's a boolean comparison expression and the workaround isn't possible (no origTarget ast node)
|
||||
// - for all other binary expressions.
|
||||
|
@ -3,29 +3,11 @@
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
&bool b1 = $0200
|
||||
&uword mu1 = $0300
|
||||
&uword mu2 = $0302
|
||||
str @zp zpstr = "irmen"
|
||||
ubyte[3] @zp zparr = [1,2,3]
|
||||
|
||||
&ubyte[4] marray = $0300
|
||||
&uword[4] mwarray= $0300
|
||||
&float[4] mfarray = $0400
|
||||
|
||||
mu1 = mu2
|
||||
b1 = true
|
||||
bool b2 = true
|
||||
bool b3
|
||||
|
||||
b2 = b2 and b1
|
||||
txt.print_ub(b2)
|
||||
txt.nl()
|
||||
|
||||
ubyte ub1 = 1
|
||||
ubyte ub2 = 2
|
||||
ubyte ub3
|
||||
|
||||
ub2 = ub2 + ub1
|
||||
txt.print_ub(ub2)
|
||||
txt.print(zpstr)
|
||||
txt.print_ub(zparr[2])
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user