no need for intermediary returnvalue var for prefix expressions

This commit is contained in:
Irmen de Jong 2021-12-16 21:00:38 +01:00
parent 77c2b2b326
commit 1462c57d0c
4 changed files with 19 additions and 32 deletions

View File

@ -317,8 +317,7 @@ internal class FunctionCallAsmGen(private val program: Program, private val asmg
lda $sourceName
beq +
sec
+ pla
""")
+ pla""")
}
else -> {
asmgen.assignExpressionToRegister(value, RegisterOrPair.A)

View File

@ -466,21 +466,13 @@ class StatementOptimizer(private val program: Program,
return null
}
when(returnStmt.value) {
is PrefixExpression -> {
if(returnStmt.value is BinaryExpression) {
val mod = returnViaIntermediaryVar(returnStmt.value!!)
if(mod!=null)
return mod
}
is BinaryExpression -> {
val mod = returnViaIntermediaryVar(returnStmt.value!!)
if(mod!=null)
return mod
}
else -> {}
}
return super.after(returnStmt, parent)
return noModifications
}
private fun hasBreak(scope: IStatementContainer): Boolean {

View File

@ -3,10 +3,6 @@ TODO
For next compiler release (7.6)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
why does the following use a intermediate return value and not just A?
sub pushing_start() -> ubyte {
return joy_info & 16
}
...