mirror of
https://github.com/irmen/prog8.git
synced 2024-11-29 17:50:35 +00:00
fix asm optimizer bug where it erroneously discarded rts
with a label
This commit is contained in:
parent
1d1d6b3d98
commit
d3e4481112
@ -516,6 +516,8 @@ private fun optimizeJsrRtsAndOtherCombinations(linesByFour: Sequence<List<Indexe
|
|||||||
val first = lines[0].value
|
val first = lines[0].value
|
||||||
val second = lines[1].value
|
val second = lines[1].value
|
||||||
val third = lines[2].value
|
val third = lines[2].value
|
||||||
|
|
||||||
|
if(!haslabel(second)) {
|
||||||
if ((" jsr" in first || "\tjsr" in first ) && (" rts" in second || "\trts" in second)) {
|
if ((" jsr" in first || "\tjsr" in first ) && (" rts" in second || "\trts" in second)) {
|
||||||
mods += Modification(lines[0].index, false, lines[0].value.replace("jsr", "jmp"))
|
mods += Modification(lines[0].index, false, lines[0].value.replace("jsr", "jmp"))
|
||||||
mods += Modification(lines[1].index, true, null)
|
mods += Modification(lines[1].index, true, null)
|
||||||
@ -543,7 +545,6 @@ private fun optimizeJsrRtsAndOtherCombinations(linesByFour: Sequence<List<Indexe
|
|||||||
mods += Modification(lines[1].index, true, null)
|
mods += Modification(lines[1].index, true, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!haslabel(second)) {
|
|
||||||
if ((" lda" in first || "\tlda" in first) && (" cmp #0" in second || "\tcmp #0" in second) ||
|
if ((" lda" in first || "\tlda" in first) && (" cmp #0" in second || "\tcmp #0" in second) ||
|
||||||
(" ldx" in first || "\tldx" in first) && (" cpx #0" in second || "\tcpx #0" in second) ||
|
(" ldx" in first || "\tldx" in first) && (" cpx #0" in second || "\tcpx #0" in second) ||
|
||||||
(" ldy" in first || "\tldy" in first) && (" cpy #0" in second || "\tcpy #0" in second)
|
(" ldy" in first || "\tldy" in first) && (" cpy #0" in second || "\tcpy #0" in second)
|
||||||
|
@ -469,9 +469,6 @@ cx16 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIBRARY MODULE NAME: shared_cbm_textio_functions
|
|
||||||
------------------------------------------------
|
|
||||||
|
|
||||||
LIBRARY MODULE NAME: diskio
|
LIBRARY MODULE NAME: diskio
|
||||||
---------------------------
|
---------------------------
|
||||||
diskio {
|
diskio {
|
||||||
@ -550,9 +547,6 @@ string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIBRARY MODULE NAME: shared_string_functions
|
|
||||||
--------------------------------------------
|
|
||||||
|
|
||||||
LIBRARY MODULE NAME: floats
|
LIBRARY MODULE NAME: floats
|
||||||
---------------------------
|
---------------------------
|
||||||
floats {
|
floats {
|
||||||
@ -712,5 +706,3 @@ test_stack {
|
|||||||
test ()
|
test ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
|
%import textio
|
||||||
|
%import floats
|
||||||
|
%zeropage basicsafe
|
||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
ubyte i
|
float fl = 5.23
|
||||||
i++
|
fl = floats.ceil(fl)
|
||||||
|
floats.print(fl)
|
||||||
ubyte i, j ; redefinition
|
txt.nl()
|
||||||
i++
|
fl = 5.23
|
||||||
j++
|
fl = floats.floor(fl)
|
||||||
|
floats.print(fl)
|
||||||
|
txt.nl()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user