mirror of
https://github.com/irmen/prog8.git
synced 2025-01-10 20:30:23 +00:00
tweak ifelse > and <= order
This commit is contained in:
parent
a282b17286
commit
c48012c385
@ -446,8 +446,19 @@ internal class AssignmentAsmGen(private val program: PtProgram,
|
|||||||
ifPart.add(assignTrue)
|
ifPart.add(assignTrue)
|
||||||
elsePart.add(assignFalse)
|
elsePart.add(assignFalse)
|
||||||
val ifelse = PtIfElse(assign.position)
|
val ifelse = PtIfElse(assign.position)
|
||||||
val exprClone = PtBinaryExpression(expr.operator, expr.type, expr.position)
|
val exprClone: PtBinaryExpression
|
||||||
expr.children.forEach { exprClone.children.add(it) } // doesn't seem to need a deep clone
|
if(!asmgen.isTargetCpu(CpuType.VIRTUAL)
|
||||||
|
&& (expr.operator==">" || expr.operator=="<=")
|
||||||
|
&& expr.right.type in WordDatatypes) {
|
||||||
|
// word X>Y -> X<Y, X<=Y -> Y>=X , easier to do in 6502 (codegen also expects these to no longe exist!)
|
||||||
|
exprClone = PtBinaryExpression(if(expr.operator==">") "<" else ">=", expr.type, expr.position)
|
||||||
|
exprClone.children.add(expr.children[1]) // doesn't seem to need a deep clone
|
||||||
|
exprClone.children.add(expr.children[0]) // doesn't seem to need a deep clone
|
||||||
|
} else {
|
||||||
|
exprClone = PtBinaryExpression(expr.operator, expr.type, expr.position)
|
||||||
|
exprClone.children.add(expr.children[0]) // doesn't seem to need a deep clone
|
||||||
|
exprClone.children.add(expr.children[1]) // doesn't seem to need a deep clone
|
||||||
|
}
|
||||||
ifelse.add(exprClone)
|
ifelse.add(exprClone)
|
||||||
ifelse.add(ifPart)
|
ifelse.add(ifPart)
|
||||||
ifelse.add(elsePart)
|
ifelse.add(elsePart)
|
||||||
@ -511,8 +522,19 @@ internal class AssignmentAsmGen(private val program: PtProgram,
|
|||||||
}
|
}
|
||||||
ifPart.add(assignTrue)
|
ifPart.add(assignTrue)
|
||||||
val ifelse = PtIfElse(assign.position)
|
val ifelse = PtIfElse(assign.position)
|
||||||
val exprClone = PtBinaryExpression(expr.operator, expr.type, expr.position)
|
val exprClone: PtBinaryExpression
|
||||||
expr.children.forEach { exprClone.children.add(it) } // doesn't seem to need a deep clone
|
if(!asmgen.isTargetCpu(CpuType.VIRTUAL)
|
||||||
|
&& (expr.operator==">" || expr.operator=="<=")
|
||||||
|
&& expr.right.type in WordDatatypes) {
|
||||||
|
// word X>Y -> X<Y, X<=Y -> Y>=X , easier to do in 6502 (codegen also expects these to no longe exist!)
|
||||||
|
exprClone = PtBinaryExpression(if(expr.operator==">") "<" else ">=", expr.type, expr.position)
|
||||||
|
exprClone.children.add(expr.children[1]) // doesn't seem to need a deep clone
|
||||||
|
exprClone.children.add(expr.children[0]) // doesn't seem to need a deep clone
|
||||||
|
} else {
|
||||||
|
exprClone = PtBinaryExpression(expr.operator, expr.type, expr.position)
|
||||||
|
exprClone.children.add(expr.children[0]) // doesn't seem to need a deep clone
|
||||||
|
exprClone.children.add(expr.children[1]) // doesn't seem to need a deep clone
|
||||||
|
}
|
||||||
ifelse.add(exprClone)
|
ifelse.add(exprClone)
|
||||||
ifelse.add(ifPart)
|
ifelse.add(ifPart)
|
||||||
ifelse.add(PtNodeGroup())
|
ifelse.add(PtNodeGroup())
|
||||||
|
@ -2,6 +2,9 @@ TODO
|
|||||||
====
|
====
|
||||||
|
|
||||||
larger programs:
|
larger programs:
|
||||||
|
dirlist
|
||||||
|
bobs
|
||||||
|
cobramk3-gfx
|
||||||
automatons
|
automatons
|
||||||
mandelbrot (quite a bit larger)
|
mandelbrot (quite a bit larger)
|
||||||
mandelbrot-gfx
|
mandelbrot-gfx
|
||||||
|
Loading…
x
Reference in New Issue
Block a user