1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-25 20:32:25 +00:00

Fixed problem with post increment inside conditions. Closes #486

This commit is contained in:
Jesper Gravgaard 2020-07-06 17:49:41 +02:00
parent fcd41d7390
commit 7384fb5357
5 changed files with 326 additions and 229 deletions

View File

@ -1,5 +1,5 @@
// Tests using integer conditions in while() / for() / do..while
// This should produce 'ba ba ba' at the top of the screen
// This should produce 'ba ba@ ba@' at the top of the screen
byte* const SCREEN = 0x0400;
byte idx = 0;

View File

@ -1,60 +1,73 @@
// Tests using integer conditions in while() / for() / do..while
// This should produce 'ba ba ba' at the top of the screen
// This should produce 'ba ba@ ba@' at the top of the screen
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
main: {
ldy #0
ldx #2
// while()
.label j = 2
ldx #0
lda #2
// for()
__b1:
// for( byte i=2;i;i--)
cpx #0
cmp #0
bne __b2
// SCREEN[idx++] = ' '
lda #' '
sta SCREEN,y
sta SCREEN,x
// SCREEN[idx++] = ' ';
iny
inx
lda #3
sta.z j
__b4:
// while( j-- )
sec
sbc #1
cmp #0
ldy.z j
dey
lda #0
cmp.z j
bne __b5
// SCREEN[idx++] = ' '
lda #' '
sta SCREEN,y
sta SCREEN,x
// SCREEN[idx++] = ' ';
txa
tay
iny
lda #2
ldx #2
__b7:
// SCREEN[idx++] = k
txa
sta SCREEN,y
// SCREEN[idx++] = k;
iny
// while(k--)
txa
sec
sbc #1
cmp #0
bne __b7
cpx #0
bne __b8
// }
rts
__b8:
tax
jmp __b7
__b5:
// SCREEN[idx++] = j
sta SCREEN,y
tya
sta SCREEN,x
// SCREEN[idx++] = j;
iny
inx
sty.z j
jmp __b4
__b2:
// SCREEN[idx++] = i
txa
sta SCREEN,y
sta SCREEN,x
// SCREEN[idx++] = i;
iny
inx
// for( byte i=2;i;i--)
dex
sec
sbc #1
jmp __b1
}

View File

@ -14,31 +14,35 @@ main::@3: scope:[main] from main::@1
to:main::@4
main::@4: scope:[main] from main::@3 main::@5
[5] (byte) idx#11 ← phi( main::@3/(byte) idx#1 main::@5/(byte) idx#2 )
[5] (byte) main::j#2 ← phi( main::@3/(byte) 3 main::@5/(byte) main::j#1 )
[5] (byte) main::j#2 ← phi( main::@3/(byte) 3 main::@5/(byte) main::j#4 )
[6] (byte) main::j#1 ← -- (byte) main::j#2
[7] if((byte) 0!=(byte) main::j#1) goto main::@5
[7] if((byte) 0!=(byte) main::j#2) goto main::@5
to:main::@6
main::@6: scope:[main] from main::@4
[8] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) ' '
[9] (byte) idx#3 ← ++ (byte) idx#11
to:main::@7
main::@7: scope:[main] from main::@6 main::@7
[10] (byte) idx#13 ← phi( main::@6/(byte) idx#3 main::@7/(byte) idx#14 )
[10] (byte) main::k#2 ← phi( main::@6/(byte) 2 main::@7/(byte) main::k#1 )
main::@7: scope:[main] from main::@6 main::@8
[10] (byte) idx#13 ← phi( main::@6/(byte) idx#3 main::@8/(byte) idx#14 )
[10] (byte) main::k#2 ← phi( main::@6/(byte) 2 main::@8/(byte) main::k#3 )
[11] *((const nomodify byte*) SCREEN + (byte) idx#13) ← (byte) main::k#2
[12] (byte) idx#14 ← ++ (byte) idx#13
[13] (byte) main::k#1 ← -- (byte) main::k#2
[14] if((byte) 0!=(byte) main::k#1) goto main::@7
[14] if((byte) 0!=(byte) main::k#2) goto main::@8
to:main::@return
main::@return: scope:[main] from main::@7
[15] return
to:@return
main::@8: scope:[main] from main::@7
[16] (byte) main::k#3 ← (byte) main::k#1
to:main::@7
main::@5: scope:[main] from main::@4
[16] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) main::j#1
[17] (byte) idx#2 ← ++ (byte) idx#11
[17] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) main::j#1
[18] (byte) idx#2 ← ++ (byte) idx#11
[19] (byte) main::j#4 ← (byte) main::j#1
to:main::@4
main::@2: scope:[main] from main::@1
[18] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) main::i#2
[19] (byte) idx#0 ← ++ (byte) idx#10
[20] (byte) main::i#1 ← -- (byte) main::i#2
[20] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) main::i#2
[21] (byte) idx#0 ← ++ (byte) idx#10
[22] (byte) main::i#1 ← -- (byte) main::i#2
to:main::@1

View File

@ -10,8 +10,8 @@ main: scope:[main] from __start::@1
main::@1: scope:[main] from main main::@2
(byte) idx#17 ← phi( main/(byte) idx#20 main::@2/(byte) idx#0 )
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@2/(byte) main::i#1 )
(bool~) main::$0 ← (number) 0 != (byte) main::i#2
if((bool~) main::$0) goto main::@2
(bool~) main::$2 ← (number) 0 != (byte) main::i#2
if((bool~) main::$2) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1
(byte) idx#9 ← phi( main::@1/(byte) idx#17 )
@ -29,9 +29,10 @@ main::@3: scope:[main] from main::@1
main::@4: scope:[main] from main::@3 main::@5
(byte) idx#18 ← phi( main::@3/(byte) idx#1 main::@5/(byte) idx#2 )
(byte) main::j#2 ← phi( main::@3/(byte) main::j#0 main::@5/(byte) main::j#3 )
(byte~) main::$0 ← (byte) main::j#2
(byte) main::j#1 ← -- (byte) main::j#2
(bool~) main::$1 ← (number) 0 != (byte) main::j#1
if((bool~) main::$1) goto main::@5
(bool~) main::$3 ← (number) 0 != (byte~) main::$0
if((bool~) main::$3) goto main::@5
to:main::@6
main::@5: scope:[main] from main::@4
(byte) idx#11 ← phi( main::@4/(byte) idx#18 )
@ -50,9 +51,10 @@ main::@7: scope:[main] from main::@6 main::@7
(byte) main::k#2 ← phi( main::@6/(byte) main::k#0 main::@7/(byte) main::k#1 )
*((const nomodify byte*) SCREEN + (byte) idx#13) ← (byte) main::k#2
(byte) idx#4 ← ++ (byte) idx#13
(byte~) main::$1 ← (byte) main::k#2
(byte) main::k#1 ← -- (byte) main::k#2
(bool~) main::$2 ← (number) 0 != (byte) main::k#1
if((bool~) main::$2) goto main::@7
(bool~) main::$4 ← (number) 0 != (byte~) main::$1
if((bool~) main::$4) goto main::@7
to:main::@return
main::@return: scope:[main] from main::@7
(byte) idx#14 ← phi( main::@7/(byte) idx#4 )
@ -110,9 +112,11 @@ SYMBOL TABLE SSA
(byte) idx#8
(byte) idx#9
(void()) main()
(bool~) main::$0
(bool~) main::$1
(byte~) main::$0
(byte~) main::$1
(bool~) main::$2
(bool~) main::$3
(bool~) main::$4
(label) main::@1
(label) main::@2
(label) main::@3
@ -136,9 +140,9 @@ SYMBOL TABLE SSA
(byte) main::k#1
(byte) main::k#2
Adding number conversion cast (unumber) 0 in (bool~) main::$0 ← (number) 0 != (byte) main::i#2
Adding number conversion cast (unumber) 0 in (bool~) main::$1 ← (number) 0 != (byte) main::j#1
Adding number conversion cast (unumber) 0 in (bool~) main::$2 ← (number) 0 != (byte) main::k#1
Adding number conversion cast (unumber) 0 in (bool~) main::$2 ← (number) 0 != (byte) main::i#2
Adding number conversion cast (unumber) 0 in (bool~) main::$3 ← (number) 0 != (byte~) main::$0
Adding number conversion cast (unumber) 0 in (bool~) main::$4 ← (number) 0 != (byte~) main::$1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
@ -151,8 +155,10 @@ Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias main::i#2 = main::i#3
Alias idx#10 = idx#9 idx#17
Alias main::j#2 = main::$0
Alias main::j#1 = main::j#3
Alias idx#11 = idx#18 idx#12
Alias main::k#2 = main::$1
Alias idx#14 = idx#4 idx#5
Alias idx#19 = idx#6
Alias idx#15 = idx#7 idx#16 idx#8
@ -160,9 +166,9 @@ Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) idx#20 (byte) idx#19
Identical Phi Values (byte) idx#15 (byte) idx#14
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$0 [4] if((byte) 0!=(byte) main::i#2) goto main::@2
Simple Condition (bool~) main::$1 [14] if((byte) 0!=(byte) main::j#1) goto main::@5
Simple Condition (bool~) main::$2 [25] if((byte) 0!=(byte) main::k#1) goto main::@7
Simple Condition (bool~) main::$2 [4] if((byte) 0!=(byte) main::i#2) goto main::@2
Simple Condition (bool~) main::$3 [14] if((byte) 0!=(byte) main::j#2) goto main::@5
Simple Condition (bool~) main::$4 [25] if((byte) 0!=(byte) main::k#2) goto main::@7
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte) main::i#0 = 2
Constant (const byte) main::j#0 = 3
@ -192,14 +198,13 @@ CALL GRAPH
Created 6 initial phi equivalence classes
Coalesced [5] idx#22 ← idx#1
Coalesced [11] idx#24 ← idx#3
Coalesced [18] main::k#3 ← main::k#1
Not coalescing [18] main::k#3 ← main::k#1
Coalesced [19] idx#25 ← idx#14
Coalesced [22] main::j#4 ← main::j#1
Not coalescing [22] main::j#4 ← main::j#1
Coalesced [23] idx#23 ← idx#2
Coalesced [27] main::i#4 ← main::i#1
Coalesced [28] idx#21 ← idx#0
Coalesced down to 6 phi equivalence classes
Culled Empty Block (label) main::@8
Coalesced down to 8 phi equivalence classes
Adding NOP phi() at start of main
FINAL CONTROL FLOW GRAPH
@ -219,33 +224,37 @@ main::@3: scope:[main] from main::@1
to:main::@4
main::@4: scope:[main] from main::@3 main::@5
[5] (byte) idx#11 ← phi( main::@3/(byte) idx#1 main::@5/(byte) idx#2 )
[5] (byte) main::j#2 ← phi( main::@3/(byte) 3 main::@5/(byte) main::j#1 )
[5] (byte) main::j#2 ← phi( main::@3/(byte) 3 main::@5/(byte) main::j#4 )
[6] (byte) main::j#1 ← -- (byte) main::j#2
[7] if((byte) 0!=(byte) main::j#1) goto main::@5
[7] if((byte) 0!=(byte) main::j#2) goto main::@5
to:main::@6
main::@6: scope:[main] from main::@4
[8] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) ' '
[9] (byte) idx#3 ← ++ (byte) idx#11
to:main::@7
main::@7: scope:[main] from main::@6 main::@7
[10] (byte) idx#13 ← phi( main::@6/(byte) idx#3 main::@7/(byte) idx#14 )
[10] (byte) main::k#2 ← phi( main::@6/(byte) 2 main::@7/(byte) main::k#1 )
main::@7: scope:[main] from main::@6 main::@8
[10] (byte) idx#13 ← phi( main::@6/(byte) idx#3 main::@8/(byte) idx#14 )
[10] (byte) main::k#2 ← phi( main::@6/(byte) 2 main::@8/(byte) main::k#3 )
[11] *((const nomodify byte*) SCREEN + (byte) idx#13) ← (byte) main::k#2
[12] (byte) idx#14 ← ++ (byte) idx#13
[13] (byte) main::k#1 ← -- (byte) main::k#2
[14] if((byte) 0!=(byte) main::k#1) goto main::@7
[14] if((byte) 0!=(byte) main::k#2) goto main::@8
to:main::@return
main::@return: scope:[main] from main::@7
[15] return
to:@return
main::@8: scope:[main] from main::@7
[16] (byte) main::k#3 ← (byte) main::k#1
to:main::@7
main::@5: scope:[main] from main::@4
[16] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) main::j#1
[17] (byte) idx#2 ← ++ (byte) idx#11
[17] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) main::j#1
[18] (byte) idx#2 ← ++ (byte) idx#11
[19] (byte) main::j#4 ← (byte) main::j#1
to:main::@4
main::@2: scope:[main] from main::@1
[18] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) main::i#2
[19] (byte) idx#0 ← ++ (byte) idx#10
[20] (byte) main::i#1 ← -- (byte) main::i#2
[20] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) main::i#2
[21] (byte) idx#0 ← ++ (byte) idx#10
[22] (byte) main::i#1 ← -- (byte) main::i#2
to:main::@1
@ -256,46 +265,54 @@ VARIABLE REGISTER WEIGHTS
(byte) idx#10 9.25
(byte) idx#11 7.8
(byte) idx#13 17.5
(byte) idx#14 7.333333333333333
(byte) idx#2 22.0
(byte) idx#14 5.5
(byte) idx#2 11.0
(byte) idx#3 4.0
(void()) main()
(byte) main::i
(byte) main::i#1 22.0
(byte) main::i#2 11.0
(byte) main::j
(byte) main::j#1 11.0
(byte) main::j#2 22.0
(byte) main::j#1 8.25
(byte) main::j#2 16.5
(byte) main::j#4 22.0
(byte) main::k
(byte) main::k#1 16.5
(byte) main::k#1 11.0
(byte) main::k#2 11.0
(byte) main::k#3 22.0
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ idx#10 idx#0 ]
[ main::j#2 main::j#1 ]
[ main::j#2 main::j#4 ]
[ idx#11 idx#1 idx#2 ]
[ main::k#2 main::k#1 ]
[ main::k#2 main::k#3 ]
[ idx#13 idx#3 idx#14 ]
Added variable main::j#1 to live range equivalence class [ main::j#1 ]
Added variable main::k#1 to live range equivalence class [ main::k#1 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ idx#10 idx#0 ]
[ main::j#2 main::j#1 ]
[ main::j#2 main::j#4 ]
[ idx#11 idx#1 idx#2 ]
[ main::k#2 main::k#1 ]
[ main::k#2 main::k#3 ]
[ idx#13 idx#3 idx#14 ]
[ main::j#1 ]
[ main::k#1 ]
Allocated zp[1]:2 [ main::i#2 main::i#1 ]
Allocated zp[1]:3 [ idx#10 idx#0 ]
Allocated zp[1]:4 [ main::j#2 main::j#1 ]
Allocated zp[1]:4 [ main::j#2 main::j#4 ]
Allocated zp[1]:5 [ idx#11 idx#1 idx#2 ]
Allocated zp[1]:6 [ main::k#2 main::k#1 ]
Allocated zp[1]:6 [ main::k#2 main::k#3 ]
Allocated zp[1]:7 [ idx#13 idx#3 idx#14 ]
Allocated zp[1]:8 [ main::j#1 ]
Allocated zp[1]:9 [ main::k#1 ]
INITIAL ASM
Target platform is c64basic / MOS6502X
// File Comments
// Tests using integer conditions in while() / for() / do..while
// This should produce 'ba ba ba' at the top of the screen
// This should produce 'ba ba@ ba@' at the top of the screen
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
@ -309,9 +326,13 @@ Target platform is c64basic / MOS6502X
main: {
.label i = 2
// while()
.label j = 4
.label j = 8
// do...while()
.label k = 6
.label k = 9
// while()
.label j_1 = 4
// do...while()
.label k_1 = 6
// [1] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [1] phi (byte) idx#10 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
@ -344,15 +365,17 @@ main: {
// [5] phi (byte) idx#11 = (byte) idx#1 [phi:main::@3->main::@4#0] -- register_copy
// [5] phi (byte) main::j#2 = (byte) 3 [phi:main::@3->main::@4#1] -- vbuz1=vbuc1
lda #3
sta.z j
sta.z j_1
jmp __b4
// main::@4
__b4:
// [6] (byte) main::j#1 ← -- (byte) main::j#2 -- vbuz1=_dec_vbuz1
dec.z j
// [7] if((byte) 0!=(byte) main::j#1) goto main::@5 -- vbuc1_neq_vbuz1_then_la1
// [6] (byte) main::j#1 ← -- (byte) main::j#2 -- vbuz1=_dec_vbuz2
ldy.z j_1
dey
sty.z j
// [7] if((byte) 0!=(byte) main::j#2) goto main::@5 -- vbuc1_neq_vbuz1_then_la1
lda #0
cmp.z j
cmp.z j_1
bne __b5
jmp __b6
// main::@6
@ -370,54 +393,64 @@ main: {
// [10] phi (byte) idx#13 = (byte) idx#3 [phi:main::@6->main::@7#0] -- register_copy
// [10] phi (byte) main::k#2 = (byte) 2 [phi:main::@6->main::@7#1] -- vbuz1=vbuc1
lda #2
sta.z k
jmp __b7
// [10] phi from main::@7 to main::@7 [phi:main::@7->main::@7]
__b7_from___b7:
// [10] phi (byte) idx#13 = (byte) idx#14 [phi:main::@7->main::@7#0] -- register_copy
// [10] phi (byte) main::k#2 = (byte) main::k#1 [phi:main::@7->main::@7#1] -- register_copy
sta.z k_1
jmp __b7
// main::@7
__b7:
// [11] *((const nomodify byte*) SCREEN + (byte) idx#13) ← (byte) main::k#2 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z k
lda.z k_1
ldy.z idx_2
sta SCREEN,y
// [12] (byte) idx#14 ← ++ (byte) idx#13 -- vbuz1=_inc_vbuz1
inc.z idx_2
// [13] (byte) main::k#1 ← -- (byte) main::k#2 -- vbuz1=_dec_vbuz1
dec.z k
// [14] if((byte) 0!=(byte) main::k#1) goto main::@7 -- vbuc1_neq_vbuz1_then_la1
// [13] (byte) main::k#1 ← -- (byte) main::k#2 -- vbuz1=_dec_vbuz2
ldy.z k_1
dey
sty.z k
// [14] if((byte) 0!=(byte) main::k#2) goto main::@8 -- vbuc1_neq_vbuz1_then_la1
lda #0
cmp.z k
bne __b7_from___b7
cmp.z k_1
bne __b8
jmp __breturn
// main::@return
__breturn:
// [15] return
rts
// main::@8
__b8:
// [16] (byte) main::k#3 ← (byte) main::k#1 -- vbuz1=vbuz2
lda.z k
sta.z k_1
// [10] phi from main::@8 to main::@7 [phi:main::@8->main::@7]
__b7_from___b8:
// [10] phi (byte) idx#13 = (byte) idx#14 [phi:main::@8->main::@7#0] -- register_copy
// [10] phi (byte) main::k#2 = (byte) main::k#3 [phi:main::@8->main::@7#1] -- register_copy
jmp __b7
// main::@5
__b5:
// [16] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) main::j#1 -- pbuc1_derefidx_vbuz1=vbuz2
// [17] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) main::j#1 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z j
ldy.z idx_1
sta SCREEN,y
// [17] (byte) idx#2 ← ++ (byte) idx#11 -- vbuz1=_inc_vbuz1
// [18] (byte) idx#2 ← ++ (byte) idx#11 -- vbuz1=_inc_vbuz1
inc.z idx_1
// [19] (byte) main::j#4 ← (byte) main::j#1 -- vbuz1=vbuz2
lda.z j
sta.z j_1
// [5] phi from main::@5 to main::@4 [phi:main::@5->main::@4]
__b4_from___b5:
// [5] phi (byte) idx#11 = (byte) idx#2 [phi:main::@5->main::@4#0] -- register_copy
// [5] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@5->main::@4#1] -- register_copy
// [5] phi (byte) main::j#2 = (byte) main::j#4 [phi:main::@5->main::@4#1] -- register_copy
jmp __b4
// main::@2
__b2:
// [18] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) main::i#2 -- pbuc1_derefidx_vbuz1=vbuz2
// [20] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) main::i#2 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z i
ldy.z idx
sta SCREEN,y
// [19] (byte) idx#0 ← ++ (byte) idx#10 -- vbuz1=_inc_vbuz1
// [21] (byte) idx#0 ← ++ (byte) idx#10 -- vbuz1=_inc_vbuz1
inc.z idx
// [20] (byte) main::i#1 ← -- (byte) main::i#2 -- vbuz1=_dec_vbuz1
// [22] (byte) main::i#1 ← -- (byte) main::i#2 -- vbuz1=_dec_vbuz1
dec.z i
// [1] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
__b1_from___b2:
@ -436,22 +469,32 @@ Statement [3] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) ' ' [
Statement [8] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) ' ' [ idx#11 ] ( [ idx#11 ] { } ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:3 [ idx#10 idx#0 ] : zp[1]:3 , reg byte x , reg byte y ,
Potential registers zp[1]:4 [ main::j#2 main::j#1 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:4 [ main::j#2 main::j#4 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:5 [ idx#11 idx#1 idx#2 ] : zp[1]:5 , reg byte x , reg byte y ,
Potential registers zp[1]:6 [ main::k#2 main::k#1 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:6 [ main::k#2 main::k#3 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:7 [ idx#13 idx#3 idx#14 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:8 [ main::j#1 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:9 [ main::k#1 ] : zp[1]:9 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 33: zp[1]:2 [ main::i#2 main::i#1 ] 33: zp[1]:4 [ main::j#2 main::j#1 ] 27.5: zp[1]:6 [ main::k#2 main::k#1 ]
Uplift Scope [] 33.8: zp[1]:5 [ idx#11 idx#1 idx#2 ] 28.83: zp[1]:7 [ idx#13 idx#3 idx#14 ] 20.25: zp[1]:3 [ idx#10 idx#0 ]
Uplift Scope [main] 38.5: zp[1]:4 [ main::j#2 main::j#4 ] 33: zp[1]:2 [ main::i#2 main::i#1 ] 33: zp[1]:6 [ main::k#2 main::k#3 ] 11: zp[1]:9 [ main::k#1 ] 8.25: zp[1]:8 [ main::j#1 ]
Uplift Scope [] 27: zp[1]:7 [ idx#13 idx#3 idx#14 ] 22.8: zp[1]:5 [ idx#11 idx#1 idx#2 ] 20.25: zp[1]:3 [ idx#10 idx#0 ]
Uplifting [main] best 1067 combination reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::j#2 main::j#1 ] reg byte a [ main::k#2 main::k#1 ]
Uplifting [] best 839 combination reg byte y [ idx#11 idx#1 idx#2 ] reg byte y [ idx#13 idx#3 idx#14 ] reg byte y [ idx#10 idx#0 ]
Uplifting [main] best 1417 combination zp[1]:4 [ main::j#2 main::j#4 ] zp[1]:2 [ main::i#2 main::i#1 ] reg byte x [ main::k#2 main::k#3 ] reg byte a [ main::k#1 ] zp[1]:8 [ main::j#1 ]
Limited combination testing to 100 combinations of 1024 possible.
Uplifting [] best 1193 combination reg byte y [ idx#13 idx#3 idx#14 ] reg byte x [ idx#11 idx#1 idx#2 ] reg byte x [ idx#10 idx#0 ]
Attempting to uplift remaining variables inzp[1]:4 [ main::j#2 main::j#4 ]
Uplifting [main] best 1193 combination zp[1]:4 [ main::j#2 main::j#4 ]
Attempting to uplift remaining variables inzp[1]:2 [ main::i#2 main::i#1 ]
Uplifting [main] best 1093 combination reg byte a [ main::i#2 main::i#1 ]
Attempting to uplift remaining variables inzp[1]:8 [ main::j#1 ]
Uplifting [main] best 1023 combination reg byte y [ main::j#1 ]
Allocated (was zp[1]:4) zp[1]:2 [ main::j#2 main::j#4 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Tests using integer conditions in while() / for() / do..while
// This should produce 'ba ba ba' at the top of the screen
// This should produce 'ba ba@ ba@' at the top of the screen
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
@ -460,97 +503,112 @@ ASSEMBLER BEFORE OPTIMIZATION
.label SCREEN = $400
// main
main: {
// while()
.label j = 2
// [1] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [1] phi (byte) idx#10 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1
ldy #0
// [1] phi (byte) main::i#2 = (byte) 2 [phi:main->main::@1#1] -- vbuxx=vbuc1
ldx #2
// [1] phi (byte) idx#10 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
// [1] phi (byte) main::i#2 = (byte) 2 [phi:main->main::@1#1] -- vbuaa=vbuc1
lda #2
jmp __b1
// for()
// main::@1
__b1:
// [2] if((byte) 0!=(byte) main::i#2) goto main::@2 -- vbuc1_neq_vbuxx_then_la1
cpx #0
// [2] if((byte) 0!=(byte) main::i#2) goto main::@2 -- vbuc1_neq_vbuaa_then_la1
cmp #0
bne __b2
jmp __b3
// main::@3
__b3:
// [3] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) ' ' -- pbuc1_derefidx_vbuyy=vbuc2
// [3] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) ' ' -- pbuc1_derefidx_vbuxx=vbuc2
lda #' '
sta SCREEN,y
// [4] (byte) idx#1 ← ++ (byte) idx#10 -- vbuyy=_inc_vbuyy
iny
sta SCREEN,x
// [4] (byte) idx#1 ← ++ (byte) idx#10 -- vbuxx=_inc_vbuxx
inx
// [5] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
__b4_from___b3:
// [5] phi (byte) idx#11 = (byte) idx#1 [phi:main::@3->main::@4#0] -- register_copy
// [5] phi (byte) main::j#2 = (byte) 3 [phi:main::@3->main::@4#1] -- vbuaa=vbuc1
// [5] phi (byte) main::j#2 = (byte) 3 [phi:main::@3->main::@4#1] -- vbuz1=vbuc1
lda #3
sta.z j
jmp __b4
// main::@4
__b4:
// [6] (byte) main::j#1 ← -- (byte) main::j#2 -- vbuaa=_dec_vbuaa
sec
sbc #1
// [7] if((byte) 0!=(byte) main::j#1) goto main::@5 -- vbuc1_neq_vbuaa_then_la1
cmp #0
// [6] (byte) main::j#1 ← -- (byte) main::j#2 -- vbuyy=_dec_vbuz1
ldy.z j
dey
// [7] if((byte) 0!=(byte) main::j#2) goto main::@5 -- vbuc1_neq_vbuz1_then_la1
lda #0
cmp.z j
bne __b5
jmp __b6
// main::@6
__b6:
// [8] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) ' ' -- pbuc1_derefidx_vbuyy=vbuc2
// [8] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) ' ' -- pbuc1_derefidx_vbuxx=vbuc2
lda #' '
sta SCREEN,y
// [9] (byte) idx#3 ← ++ (byte) idx#11 -- vbuyy=_inc_vbuyy
sta SCREEN,x
// [9] (byte) idx#3 ← ++ (byte) idx#11 -- vbuyy=_inc_vbuxx
txa
tay
iny
// [10] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
__b7_from___b6:
// [10] phi (byte) idx#13 = (byte) idx#3 [phi:main::@6->main::@7#0] -- register_copy
// [10] phi (byte) main::k#2 = (byte) 2 [phi:main::@6->main::@7#1] -- vbuaa=vbuc1
lda #2
jmp __b7
// [10] phi from main::@7 to main::@7 [phi:main::@7->main::@7]
__b7_from___b7:
// [10] phi (byte) idx#13 = (byte) idx#14 [phi:main::@7->main::@7#0] -- register_copy
// [10] phi (byte) main::k#2 = (byte) main::k#1 [phi:main::@7->main::@7#1] -- register_copy
// [10] phi (byte) main::k#2 = (byte) 2 [phi:main::@6->main::@7#1] -- vbuxx=vbuc1
ldx #2
jmp __b7
// main::@7
__b7:
// [11] *((const nomodify byte*) SCREEN + (byte) idx#13) ← (byte) main::k#2 -- pbuc1_derefidx_vbuyy=vbuaa
// [11] *((const nomodify byte*) SCREEN + (byte) idx#13) ← (byte) main::k#2 -- pbuc1_derefidx_vbuyy=vbuxx
txa
sta SCREEN,y
// [12] (byte) idx#14 ← ++ (byte) idx#13 -- vbuyy=_inc_vbuyy
iny
// [13] (byte) main::k#1 ← -- (byte) main::k#2 -- vbuaa=_dec_vbuaa
// [13] (byte) main::k#1 ← -- (byte) main::k#2 -- vbuaa=_dec_vbuxx
txa
sec
sbc #1
// [14] if((byte) 0!=(byte) main::k#1) goto main::@7 -- vbuc1_neq_vbuaa_then_la1
cmp #0
bne __b7_from___b7
// [14] if((byte) 0!=(byte) main::k#2) goto main::@8 -- vbuc1_neq_vbuxx_then_la1
cpx #0
bne __b8
jmp __breturn
// main::@return
__breturn:
// [15] return
rts
// main::@8
__b8:
// [16] (byte) main::k#3 ← (byte) main::k#1 -- vbuxx=vbuaa
tax
// [10] phi from main::@8 to main::@7 [phi:main::@8->main::@7]
__b7_from___b8:
// [10] phi (byte) idx#13 = (byte) idx#14 [phi:main::@8->main::@7#0] -- register_copy
// [10] phi (byte) main::k#2 = (byte) main::k#3 [phi:main::@8->main::@7#1] -- register_copy
jmp __b7
// main::@5
__b5:
// [16] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) main::j#1 -- pbuc1_derefidx_vbuyy=vbuaa
sta SCREEN,y
// [17] (byte) idx#2 ← ++ (byte) idx#11 -- vbuyy=_inc_vbuyy
iny
// [17] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) main::j#1 -- pbuc1_derefidx_vbuxx=vbuyy
tya
sta SCREEN,x
// [18] (byte) idx#2 ← ++ (byte) idx#11 -- vbuxx=_inc_vbuxx
inx
// [19] (byte) main::j#4 ← (byte) main::j#1 -- vbuz1=vbuyy
sty.z j
// [5] phi from main::@5 to main::@4 [phi:main::@5->main::@4]
__b4_from___b5:
// [5] phi (byte) idx#11 = (byte) idx#2 [phi:main::@5->main::@4#0] -- register_copy
// [5] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@5->main::@4#1] -- register_copy
// [5] phi (byte) main::j#2 = (byte) main::j#4 [phi:main::@5->main::@4#1] -- register_copy
jmp __b4
// main::@2
__b2:
// [18] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) main::i#2 -- pbuc1_derefidx_vbuyy=vbuxx
txa
sta SCREEN,y
// [19] (byte) idx#0 ← ++ (byte) idx#10 -- vbuyy=_inc_vbuyy
iny
// [20] (byte) main::i#1 ← -- (byte) main::i#2 -- vbuxx=_dec_vbuxx
dex
// [20] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) main::i#2 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
// [21] (byte) idx#0 ← ++ (byte) idx#10 -- vbuxx=_inc_vbuxx
inx
// [22] (byte) main::i#1 ← -- (byte) main::i#2 -- vbuaa=_dec_vbuaa
sec
sbc #1
// [1] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
__b1_from___b2:
// [1] phi (byte) idx#10 = (byte) idx#0 [phi:main::@2->main::@1#0] -- register_copy
@ -567,31 +625,27 @@ Removing instruction jmp __b6
Removing instruction jmp __b7
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b7_from___b7 with __b7
Removing instruction __b7_from___b7:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1_from_main:
Removing instruction __b3:
Removing instruction __b4_from___b3:
Removing instruction __b6:
Removing instruction __b7_from___b6:
Removing instruction __breturn:
Removing instruction __b7_from___b8:
Removing instruction __b4_from___b5:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jmp __b7
Succesful ASM optimization Pass5NextJumpElimination
FINAL SYMBOL TABLE
(const nomodify byte*) SCREEN = (byte*) 1024
(byte) idx
(byte) idx#0 reg byte y 11.0
(byte) idx#1 reg byte y 4.0
(byte) idx#10 reg byte y 9.25
(byte) idx#11 reg byte y 7.8
(byte) idx#0 reg byte x 11.0
(byte) idx#1 reg byte x 4.0
(byte) idx#10 reg byte x 9.25
(byte) idx#11 reg byte x 7.8
(byte) idx#13 reg byte y 17.5
(byte) idx#14 reg byte y 7.333333333333333
(byte) idx#2 reg byte y 22.0
(byte) idx#14 reg byte y 5.5
(byte) idx#2 reg byte x 11.0
(byte) idx#3 reg byte y 4.0
(void()) main()
(label) main::@1
@ -601,31 +655,36 @@ FINAL SYMBOL TABLE
(label) main::@5
(label) main::@6
(label) main::@7
(label) main::@8
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 22.0
(byte) main::i#2 reg byte x 11.0
(byte) main::i#1 reg byte a 22.0
(byte) main::i#2 reg byte a 11.0
(byte) main::j
(byte) main::j#1 reg byte a 11.0
(byte) main::j#2 reg byte a 22.0
(byte) main::j#1 reg byte y 8.25
(byte) main::j#2 j zp[1]:2 16.5
(byte) main::j#4 j zp[1]:2 22.0
(byte) main::k
(byte) main::k#1 reg byte a 16.5
(byte) main::k#2 reg byte a 11.0
(byte) main::k#1 reg byte a 11.0
(byte) main::k#2 reg byte x 11.0
(byte) main::k#3 reg byte x 22.0
reg byte x [ main::i#2 main::i#1 ]
reg byte y [ idx#10 idx#0 ]
reg byte a [ main::j#2 main::j#1 ]
reg byte y [ idx#11 idx#1 idx#2 ]
reg byte a [ main::k#2 main::k#1 ]
reg byte a [ main::i#2 main::i#1 ]
reg byte x [ idx#10 idx#0 ]
zp[1]:2 [ main::j#2 main::j#4 ]
reg byte x [ idx#11 idx#1 idx#2 ]
reg byte x [ main::k#2 main::k#3 ]
reg byte y [ idx#13 idx#3 idx#14 ]
reg byte y [ main::j#1 ]
reg byte a [ main::k#1 ]
FINAL ASSEMBLER
Score: 629
Score: 843
// File Comments
// Tests using integer conditions in while() / for() / do..while
// This should produce 'ba ba ba' at the top of the screen
// This should produce 'ba ba@ ba@' at the top of the screen
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
@ -634,97 +693,113 @@ Score: 629
.label SCREEN = $400
// main
main: {
// while()
.label j = 2
// [1] phi from main to main::@1 [phi:main->main::@1]
// [1] phi (byte) idx#10 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1
ldy #0
// [1] phi (byte) main::i#2 = (byte) 2 [phi:main->main::@1#1] -- vbuxx=vbuc1
ldx #2
// [1] phi (byte) idx#10 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
// [1] phi (byte) main::i#2 = (byte) 2 [phi:main->main::@1#1] -- vbuaa=vbuc1
lda #2
// for()
// main::@1
__b1:
// for( byte i=2;i;i--)
// [2] if((byte) 0!=(byte) main::i#2) goto main::@2 -- vbuc1_neq_vbuxx_then_la1
cpx #0
// [2] if((byte) 0!=(byte) main::i#2) goto main::@2 -- vbuc1_neq_vbuaa_then_la1
cmp #0
bne __b2
// main::@3
// SCREEN[idx++] = ' '
// [3] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) ' ' -- pbuc1_derefidx_vbuyy=vbuc2
// [3] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) ' ' -- pbuc1_derefidx_vbuxx=vbuc2
lda #' '
sta SCREEN,y
sta SCREEN,x
// SCREEN[idx++] = ' ';
// [4] (byte) idx#1 ← ++ (byte) idx#10 -- vbuyy=_inc_vbuyy
iny
// [4] (byte) idx#1 ← ++ (byte) idx#10 -- vbuxx=_inc_vbuxx
inx
// [5] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
// [5] phi (byte) idx#11 = (byte) idx#1 [phi:main::@3->main::@4#0] -- register_copy
// [5] phi (byte) main::j#2 = (byte) 3 [phi:main::@3->main::@4#1] -- vbuaa=vbuc1
// [5] phi (byte) main::j#2 = (byte) 3 [phi:main::@3->main::@4#1] -- vbuz1=vbuc1
lda #3
sta.z j
// main::@4
__b4:
// while( j-- )
// [6] (byte) main::j#1 ← -- (byte) main::j#2 -- vbuaa=_dec_vbuaa
sec
sbc #1
// [7] if((byte) 0!=(byte) main::j#1) goto main::@5 -- vbuc1_neq_vbuaa_then_la1
cmp #0
// [6] (byte) main::j#1 ← -- (byte) main::j#2 -- vbuyy=_dec_vbuz1
ldy.z j
dey
// [7] if((byte) 0!=(byte) main::j#2) goto main::@5 -- vbuc1_neq_vbuz1_then_la1
lda #0
cmp.z j
bne __b5
// main::@6
// SCREEN[idx++] = ' '
// [8] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) ' ' -- pbuc1_derefidx_vbuyy=vbuc2
// [8] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) ' ' -- pbuc1_derefidx_vbuxx=vbuc2
lda #' '
sta SCREEN,y
sta SCREEN,x
// SCREEN[idx++] = ' ';
// [9] (byte) idx#3 ← ++ (byte) idx#11 -- vbuyy=_inc_vbuyy
// [9] (byte) idx#3 ← ++ (byte) idx#11 -- vbuyy=_inc_vbuxx
txa
tay
iny
// [10] phi from main::@6 to main::@7 [phi:main::@6->main::@7]
// [10] phi (byte) idx#13 = (byte) idx#3 [phi:main::@6->main::@7#0] -- register_copy
// [10] phi (byte) main::k#2 = (byte) 2 [phi:main::@6->main::@7#1] -- vbuaa=vbuc1
lda #2
// [10] phi from main::@7 to main::@7 [phi:main::@7->main::@7]
// [10] phi (byte) idx#13 = (byte) idx#14 [phi:main::@7->main::@7#0] -- register_copy
// [10] phi (byte) main::k#2 = (byte) main::k#1 [phi:main::@7->main::@7#1] -- register_copy
// [10] phi (byte) main::k#2 = (byte) 2 [phi:main::@6->main::@7#1] -- vbuxx=vbuc1
ldx #2
// main::@7
__b7:
// SCREEN[idx++] = k
// [11] *((const nomodify byte*) SCREEN + (byte) idx#13) ← (byte) main::k#2 -- pbuc1_derefidx_vbuyy=vbuaa
// [11] *((const nomodify byte*) SCREEN + (byte) idx#13) ← (byte) main::k#2 -- pbuc1_derefidx_vbuyy=vbuxx
txa
sta SCREEN,y
// SCREEN[idx++] = k;
// [12] (byte) idx#14 ← ++ (byte) idx#13 -- vbuyy=_inc_vbuyy
iny
// while(k--)
// [13] (byte) main::k#1 ← -- (byte) main::k#2 -- vbuaa=_dec_vbuaa
// [13] (byte) main::k#1 ← -- (byte) main::k#2 -- vbuaa=_dec_vbuxx
txa
sec
sbc #1
// [14] if((byte) 0!=(byte) main::k#1) goto main::@7 -- vbuc1_neq_vbuaa_then_la1
cmp #0
bne __b7
// [14] if((byte) 0!=(byte) main::k#2) goto main::@8 -- vbuc1_neq_vbuxx_then_la1
cpx #0
bne __b8
// main::@return
// }
// [15] return
rts
// main::@8
__b8:
// [16] (byte) main::k#3 ← (byte) main::k#1 -- vbuxx=vbuaa
tax
// [10] phi from main::@8 to main::@7 [phi:main::@8->main::@7]
// [10] phi (byte) idx#13 = (byte) idx#14 [phi:main::@8->main::@7#0] -- register_copy
// [10] phi (byte) main::k#2 = (byte) main::k#3 [phi:main::@8->main::@7#1] -- register_copy
jmp __b7
// main::@5
__b5:
// SCREEN[idx++] = j
// [16] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) main::j#1 -- pbuc1_derefidx_vbuyy=vbuaa
sta SCREEN,y
// [17] *((const nomodify byte*) SCREEN + (byte) idx#11) ← (byte) main::j#1 -- pbuc1_derefidx_vbuxx=vbuyy
tya
sta SCREEN,x
// SCREEN[idx++] = j;
// [17] (byte) idx#2 ← ++ (byte) idx#11 -- vbuyy=_inc_vbuyy
iny
// [18] (byte) idx#2 ← ++ (byte) idx#11 -- vbuxx=_inc_vbuxx
inx
// [19] (byte) main::j#4 ← (byte) main::j#1 -- vbuz1=vbuyy
sty.z j
// [5] phi from main::@5 to main::@4 [phi:main::@5->main::@4]
// [5] phi (byte) idx#11 = (byte) idx#2 [phi:main::@5->main::@4#0] -- register_copy
// [5] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@5->main::@4#1] -- register_copy
// [5] phi (byte) main::j#2 = (byte) main::j#4 [phi:main::@5->main::@4#1] -- register_copy
jmp __b4
// main::@2
__b2:
// SCREEN[idx++] = i
// [18] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) main::i#2 -- pbuc1_derefidx_vbuyy=vbuxx
txa
sta SCREEN,y
// [20] *((const nomodify byte*) SCREEN + (byte) idx#10) ← (byte) main::i#2 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
// SCREEN[idx++] = i;
// [19] (byte) idx#0 ← ++ (byte) idx#10 -- vbuyy=_inc_vbuyy
iny
// [21] (byte) idx#0 ← ++ (byte) idx#10 -- vbuxx=_inc_vbuxx
inx
// for( byte i=2;i;i--)
// [20] (byte) main::i#1 ← -- (byte) main::i#2 -- vbuxx=_dec_vbuxx
dex
// [22] (byte) main::i#1 ← -- (byte) main::i#2 -- vbuaa=_dec_vbuaa
sec
sbc #1
// [1] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
// [1] phi (byte) idx#10 = (byte) idx#0 [phi:main::@2->main::@1#0] -- register_copy
// [1] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy

View File

@ -1,12 +1,12 @@
(const nomodify byte*) SCREEN = (byte*) 1024
(byte) idx
(byte) idx#0 reg byte y 11.0
(byte) idx#1 reg byte y 4.0
(byte) idx#10 reg byte y 9.25
(byte) idx#11 reg byte y 7.8
(byte) idx#0 reg byte x 11.0
(byte) idx#1 reg byte x 4.0
(byte) idx#10 reg byte x 9.25
(byte) idx#11 reg byte x 7.8
(byte) idx#13 reg byte y 17.5
(byte) idx#14 reg byte y 7.333333333333333
(byte) idx#2 reg byte y 22.0
(byte) idx#14 reg byte y 5.5
(byte) idx#2 reg byte x 11.0
(byte) idx#3 reg byte y 4.0
(void()) main()
(label) main::@1
@ -16,20 +16,25 @@
(label) main::@5
(label) main::@6
(label) main::@7
(label) main::@8
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 22.0
(byte) main::i#2 reg byte x 11.0
(byte) main::i#1 reg byte a 22.0
(byte) main::i#2 reg byte a 11.0
(byte) main::j
(byte) main::j#1 reg byte a 11.0
(byte) main::j#2 reg byte a 22.0
(byte) main::j#1 reg byte y 8.25
(byte) main::j#2 j zp[1]:2 16.5
(byte) main::j#4 j zp[1]:2 22.0
(byte) main::k
(byte) main::k#1 reg byte a 16.5
(byte) main::k#2 reg byte a 11.0
(byte) main::k#1 reg byte a 11.0
(byte) main::k#2 reg byte x 11.0
(byte) main::k#3 reg byte x 22.0
reg byte x [ main::i#2 main::i#1 ]
reg byte y [ idx#10 idx#0 ]
reg byte a [ main::j#2 main::j#1 ]
reg byte y [ idx#11 idx#1 idx#2 ]
reg byte a [ main::k#2 main::k#1 ]
reg byte a [ main::i#2 main::i#1 ]
reg byte x [ idx#10 idx#0 ]
zp[1]:2 [ main::j#2 main::j#4 ]
reg byte x [ idx#11 idx#1 idx#2 ]
reg byte x [ main::k#2 main::k#3 ]
reg byte y [ idx#13 idx#3 idx#14 ]
reg byte y [ main::j#1 ]
reg byte a [ main::k#1 ]