mirror of
https://github.com/irmen/prog8.git
synced 2024-11-25 19:31:36 +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 second = lines[1].value
|
||||
val third = lines[2].value
|
||||
|
||||
if(!haslabel(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[1].index, true, null)
|
||||
@ -543,7 +545,6 @@ private fun optimizeJsrRtsAndOtherCombinations(linesByFour: Sequence<List<Indexe
|
||||
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) ||
|
||||
(" 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)
|
||||
|
@ -469,9 +469,6 @@ cx16 {
|
||||
}
|
||||
|
||||
|
||||
LIBRARY MODULE NAME: shared_cbm_textio_functions
|
||||
------------------------------------------------
|
||||
|
||||
LIBRARY MODULE NAME: diskio
|
||||
---------------------------
|
||||
diskio {
|
||||
@ -550,9 +547,6 @@ string {
|
||||
}
|
||||
|
||||
|
||||
LIBRARY MODULE NAME: shared_string_functions
|
||||
--------------------------------------------
|
||||
|
||||
LIBRARY MODULE NAME: floats
|
||||
---------------------------
|
||||
floats {
|
||||
@ -712,5 +706,3 @@ test_stack {
|
||||
test ()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,10 +1,16 @@
|
||||
%import textio
|
||||
%import floats
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
ubyte i
|
||||
i++
|
||||
|
||||
ubyte i, j ; redefinition
|
||||
i++
|
||||
j++
|
||||
float fl = 5.23
|
||||
fl = floats.ceil(fl)
|
||||
floats.print(fl)
|
||||
txt.nl()
|
||||
fl = 5.23
|
||||
fl = floats.floor(fl)
|
||||
floats.print(fl)
|
||||
txt.nl()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user