1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-10-21 17:24:39 +00:00
kickc/src/test/ref/asm-clobber.log

700 lines
26 KiB
Plaintext
Raw Normal View History

2017-11-05 08:56:04 +00:00
2018-08-22 22:24:32 +00:00
CONTROL FLOW GRAPH SSA
2017-11-05 08:56:04 +00:00
@begin: scope:[] from
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024
2017-11-05 08:56:04 +00:00
to:@1
main: scope:[main] from @1
2017-12-29 10:21:11 +00:00
(byte*) SCREEN#5 ← phi( @1/(byte*) SCREEN#9 )
(byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
2017-11-05 08:56:04 +00:00
to:main::@1
main::@1: scope:[main] from main main::@5
2017-12-29 10:21:11 +00:00
(byte) main::i#4 ← phi( main/(byte) main::i#0 main::@5/(byte) main::i#1 )
(byte*) SCREEN#3 ← phi( main/(byte*) SCREEN#5 main::@5/(byte*) SCREEN#6 )
(byte) main::j#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
2017-11-05 08:56:04 +00:00
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
2017-12-29 10:21:11 +00:00
(byte) main::i#2 ← phi( main::@1/(byte) main::i#4 main::@2/(byte) main::i#2 )
(byte*) SCREEN#1 ← phi( main::@1/(byte*) SCREEN#3 main::@2/(byte*) SCREEN#1 )
(byte) main::j#2 ← phi( main::@1/(byte) main::j#0 main::@2/(byte) main::j#1 )
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) main::j#2
(byte) main::j#1 ← (byte) main::j#2 + rangenext(0,100)
(bool~) main::$0 ← (byte) main::j#1 != rangelast(0,100)
2018-04-28 06:41:05 +00:00
if((bool~) main::$0) goto main::@2
2017-11-05 08:56:04 +00:00
to:main::@5
main::@5: scope:[main] from main::@2
2017-12-29 10:21:11 +00:00
(byte*) SCREEN#6 ← phi( main::@2/(byte*) SCREEN#1 )
(byte) main::i#3 ← phi( main::@2/(byte) main::i#2 )
(byte) main::i#1 ← (byte) main::i#3 + rangenext(0,100)
(bool~) main::$1 ← (byte) main::i#1 != rangelast(0,100)
2018-04-28 06:41:05 +00:00
if((bool~) main::$1) goto main::@1
2017-12-29 10:21:11 +00:00
to:main::@6
main::@6: scope:[main] from main::@5
(byte*) SCREEN#7 ← phi( main::@5/(byte*) SCREEN#6 )
(byte) main::k#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
2017-11-05 08:56:04 +00:00
to:main::@3
2017-12-29 10:21:11 +00:00
main::@3: scope:[main] from main::@6 main::@7
(byte) main::k#4 ← phi( main::@6/(byte) main::k#0 main::@7/(byte) main::k#1 )
(byte*) SCREEN#4 ← phi( main::@6/(byte*) SCREEN#7 main::@7/(byte*) SCREEN#8 )
(byte) main::l#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
2017-11-05 08:56:04 +00:00
to:main::@4
main::@4: scope:[main] from main::@3 main::@4
2017-12-29 10:21:11 +00:00
(byte) main::k#2 ← phi( main::@3/(byte) main::k#4 main::@4/(byte) main::k#2 )
(byte*) SCREEN#2 ← phi( main::@3/(byte*) SCREEN#4 main::@4/(byte*) SCREEN#2 )
(byte) main::l#2 ← phi( main::@3/(byte) main::l#0 main::@4/(byte) main::l#1 )
asm { eor#$55 tax }
2017-12-29 10:21:11 +00:00
*((byte*) SCREEN#2 + (byte) main::k#2) ← (byte) main::l#2
(byte) main::l#1 ← (byte) main::l#2 + rangenext(0,100)
(bool~) main::$2 ← (byte) main::l#1 != rangelast(0,100)
2018-04-28 06:41:05 +00:00
if((bool~) main::$2) goto main::@4
2017-11-05 08:56:04 +00:00
to:main::@7
main::@7: scope:[main] from main::@4
2017-12-29 10:21:11 +00:00
(byte*) SCREEN#8 ← phi( main::@4/(byte*) SCREEN#2 )
(byte) main::k#3 ← phi( main::@4/(byte) main::k#2 )
(byte) main::k#1 ← (byte) main::k#3 + rangenext(0,100)
(bool~) main::$3 ← (byte) main::k#1 != rangelast(0,100)
2018-04-28 06:41:05 +00:00
if((bool~) main::$3) goto main::@3
2017-11-05 08:56:04 +00:00
to:main::@return
main::@return: scope:[main] from main::@7
return
to:@return
@1: scope:[] from @begin
2017-12-29 10:21:11 +00:00
(byte*) SCREEN#9 ← phi( @begin/(byte*) SCREEN#0 )
call main
2017-12-29 10:21:11 +00:00
to:@2
@2: scope:[] from @1
2017-11-05 08:56:04 +00:00
to:@end
2017-12-29 10:21:11 +00:00
@end: scope:[] from @2
2017-11-05 08:56:04 +00:00
2017-12-29 10:21:11 +00:00
SYMBOL TABLE SSA
2017-11-05 08:56:04 +00:00
(label) @1
2017-12-29 10:21:11 +00:00
(label) @2
2017-11-05 08:56:04 +00:00
(label) @begin
(label) @end
(byte*) SCREEN
2017-12-29 10:21:11 +00:00
(byte*) SCREEN#0
(byte*) SCREEN#1
(byte*) SCREEN#2
(byte*) SCREEN#3
(byte*) SCREEN#4
(byte*) SCREEN#5
(byte*) SCREEN#6
(byte*) SCREEN#7
(byte*) SCREEN#8
(byte*) SCREEN#9
2017-11-05 08:56:04 +00:00
(void()) main()
2018-04-28 06:41:05 +00:00
(bool~) main::$0
(bool~) main::$1
(bool~) main::$2
(bool~) main::$3
2017-11-05 08:56:04 +00:00
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
2017-12-29 10:21:11 +00:00
(label) main::@6
2017-11-05 08:56:04 +00:00
(label) main::@7
(label) main::@return
(byte) main::i
2017-12-29 10:21:11 +00:00
(byte) main::i#0
2017-11-05 08:56:04 +00:00
(byte) main::i#1
2017-12-29 10:21:11 +00:00
(byte) main::i#2
(byte) main::i#3
2017-11-05 08:56:04 +00:00
(byte) main::i#4
(byte) main::j
2017-12-29 10:21:11 +00:00
(byte) main::j#0
2017-11-05 08:56:04 +00:00
(byte) main::j#1
(byte) main::j#2
(byte) main::k
2017-12-29 10:21:11 +00:00
(byte) main::k#0
2017-11-05 08:56:04 +00:00
(byte) main::k#1
2017-12-29 10:21:11 +00:00
(byte) main::k#2
(byte) main::k#3
2017-11-05 08:56:04 +00:00
(byte) main::k#4
(byte) main::l
2017-12-29 10:21:11 +00:00
(byte) main::l#0
2017-11-05 08:56:04 +00:00
(byte) main::l#1
(byte) main::l#2
2017-12-29 10:21:11 +00:00
Culled Empty Block (label) @2
2018-08-22 20:23:42 +00:00
Successful SSA optimization Pass2CullEmptyBlocks
2017-12-29 10:21:11 +00:00
Alias (byte) main::i#2 = (byte) main::i#3
Alias (byte*) SCREEN#1 = (byte*) SCREEN#6 (byte*) SCREEN#7
Alias (byte) main::k#2 = (byte) main::k#3
Alias (byte*) SCREEN#2 = (byte*) SCREEN#8
Alias (byte*) SCREEN#0 = (byte*) SCREEN#9
2018-08-22 20:23:42 +00:00
Successful SSA optimization Pass2AliasElimination
2017-12-29 10:21:11 +00:00
Self Phi Eliminated (byte*) SCREEN#1
Self Phi Eliminated (byte) main::i#2
Self Phi Eliminated (byte*) SCREEN#2
Self Phi Eliminated (byte) main::k#2
2018-08-22 20:23:42 +00:00
Successful SSA optimization Pass2SelfPhiElimination
2017-12-29 10:21:11 +00:00
Redundant Phi (byte*) SCREEN#5 (byte*) SCREEN#0
Redundant Phi (byte*) SCREEN#1 (byte*) SCREEN#3
Redundant Phi (byte) main::i#2 (byte) main::i#4
Redundant Phi (byte*) SCREEN#2 (byte*) SCREEN#4
Redundant Phi (byte) main::k#2 (byte) main::k#4
2018-08-22 20:23:42 +00:00
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) main::$0 [9] if((byte) main::j#1!=rangelast(0,100)) goto main::@2
Simple Condition (bool~) main::$1 [13] if((byte) main::i#1!=rangelast(0,100)) goto main::@1
Simple Condition (bool~) main::$2 [23] if((byte) main::l#1!=rangelast(0,100)) goto main::@4
Simple Condition (bool~) main::$3 [27] if((byte) main::k#1!=rangelast(0,100)) goto main::@3
2018-08-22 20:23:42 +00:00
Successful SSA optimization Pass2ConditionalJumpSimplification
2017-12-29 10:21:11 +00:00
Constant (const byte*) SCREEN#0 = ((byte*))1024
Constant (const byte) main::i#0 = 0
Constant (const byte) main::j#0 = 0
Constant (const byte) main::k#0 = 0
Constant (const byte) main::l#0 = 0
2018-08-22 20:23:42 +00:00
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value main::j#1 ← ++ main::j#2 to ++
Resolved ranged comparison value if(main::j#1!=rangelast(0,100)) goto main::@2 to (byte/signed byte/word/signed word/dword/signed dword) 101
Resolved ranged next value main::i#1 ← ++ main::i#4 to ++
Resolved ranged comparison value if(main::i#1!=rangelast(0,100)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 101
Resolved ranged next value main::l#1 ← ++ main::l#2 to ++
Resolved ranged comparison value if(main::l#1!=rangelast(0,100)) goto main::@4 to (byte/signed byte/word/signed word/dword/signed dword) 101
Resolved ranged next value main::k#1 ← ++ main::k#4 to ++
Resolved ranged comparison value if(main::k#1!=rangelast(0,100)) goto main::@3 to (byte/signed byte/word/signed word/dword/signed dword) 101
2017-12-29 10:21:11 +00:00
Culled Empty Block (label) main::@6
2018-08-22 20:23:42 +00:00
Successful SSA optimization Pass2CullEmptyBlocks
2017-12-29 10:21:11 +00:00
Self Phi Eliminated (byte*) SCREEN#3
Self Phi Eliminated (byte*) SCREEN#4
2018-08-22 20:23:42 +00:00
Successful SSA optimization Pass2SelfPhiElimination
2017-12-29 10:21:11 +00:00
Redundant Phi (byte*) SCREEN#3 (const byte*) SCREEN#0
Redundant Phi (byte*) SCREEN#4 (byte*) SCREEN#3
2018-08-22 20:23:42 +00:00
Successful SSA optimization Pass2RedundantPhiElimination
2017-12-29 10:21:11 +00:00
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte) main::j#0
Inlining constant with var siblings (const byte) main::k#0
Inlining constant with var siblings (const byte) main::l#0
Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined main::k#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined main::j#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined main::l#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
2018-08-22 20:23:42 +00:00
Successful SSA optimization Pass2ConstantInlining
2017-11-05 08:56:04 +00:00
Added new block during phi lifting main::@9(between main::@5 and main::@1)
Added new block during phi lifting main::@10(between main::@2 and main::@2)
Added new block during phi lifting main::@11(between main::@7 and main::@3)
Added new block during phi lifting main::@12(between main::@4 and main::@4)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
2017-11-05 08:56:04 +00:00
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to main:2
2017-11-05 08:56:04 +00:00
Created 4 initial phi equivalence classes
Coalesced [21] main::k#5 ← main::k#1
Coalesced [22] main::l#3 ← main::l#1
Coalesced [23] main::i#5 ← main::i#1
Coalesced [24] main::j#3 ← main::j#1
2017-11-05 08:56:04 +00:00
Coalesced down to 4 phi equivalence classes
Culled Empty Block (label) main::@11
Culled Empty Block (label) main::@12
Culled Empty Block (label) main::@9
Culled Empty Block (label) main::@10
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
2017-11-05 08:56:04 +00:00
Adding NOP phi() at start of main
2017-12-29 10:21:11 +00:00
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
2018-11-11 20:51:36 +00:00
[0] phi()
to:@1
@1: scope:[] from @begin
2018-11-11 20:51:36 +00:00
[1] phi()
[2] call main
to:@end
@end: scope:[] from @1
2018-11-11 20:51:36 +00:00
[3] phi()
main: scope:[main] from @1
2018-11-11 20:51:36 +00:00
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@5
2018-11-11 20:51:36 +00:00
[5] (byte) main::i#4 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@5/(byte) main::i#1 )
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
2018-11-11 20:51:36 +00:00
[6] (byte) main::j#2 ← phi( main::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@2/(byte) main::j#1 )
[7] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::j#2
[8] (byte) main::j#1 ← ++ (byte) main::j#2
[9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@2
to:main::@5
main::@5: scope:[main] from main::@2
2018-11-11 20:51:36 +00:00
[10] (byte) main::i#1 ← ++ (byte) main::i#4
[11] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1
to:main::@3
main::@3: scope:[main] from main::@5 main::@7
2018-11-11 20:51:36 +00:00
[12] (byte) main::k#4 ← phi( main::@5/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@7/(byte) main::k#1 )
to:main::@4
main::@4: scope:[main] from main::@3 main::@4
2018-11-11 20:51:36 +00:00
[13] (byte) main::l#2 ← phi( main::@3/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@4/(byte) main::l#1 )
asm { eor#$55 tax }
2018-11-11 20:51:36 +00:00
[15] *((const byte*) SCREEN#0 + (byte) main::k#4) ← (byte) main::l#2
[16] (byte) main::l#1 ← ++ (byte) main::l#2
[17] if((byte) main::l#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@4
to:main::@7
main::@7: scope:[main] from main::@4
2018-11-11 20:51:36 +00:00
[18] (byte) main::k#1 ← ++ (byte) main::k#4
[19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@3
to:main::@return
main::@return: scope:[main] from main::@7
2018-11-11 20:51:36 +00:00
[20] return
to:@return
2017-11-05 08:56:04 +00:00
VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#4 24.599999999999998
(byte) main::j
(byte) main::j#1 151.5
(byte) main::j#2 151.5
(byte) main::k
(byte) main::k#1 16.5
(byte) main::k#4 20.499999999999996
(byte) main::l
(byte) main::l#1 151.5
(byte) main::l#2 101.0
Initial phi equivalence classes
[ main::i#4 main::i#1 ]
[ main::j#2 main::j#1 ]
[ main::k#4 main::k#1 ]
[ main::l#2 main::l#1 ]
Complete equivalence classes
[ main::i#4 main::i#1 ]
[ main::j#2 main::j#1 ]
[ main::k#4 main::k#1 ]
[ main::l#2 main::l#1 ]
Allocated zp ZP_BYTE:2 [ main::i#4 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::j#2 main::j#1 ]
Allocated zp ZP_BYTE:4 [ main::k#4 main::k#1 ]
Allocated zp ZP_BYTE:5 [ main::l#2 main::l#1 ]
2017-12-29 10:21:11 +00:00
2017-11-05 08:56:04 +00:00
INITIAL ASM
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
2017-11-05 08:56:04 +00:00
.pc = $80d "Program"
//SEG1 Global Constants & labels
.label SCREEN = $400
2017-11-05 08:56:04 +00:00
//SEG2 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
2017-11-05 08:56:04 +00:00
jmp b1
//SEG4 @1
2017-11-05 08:56:04 +00:00
b1:
2018-11-11 20:51:36 +00:00
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
2017-11-05 08:56:04 +00:00
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
2017-11-05 08:56:04 +00:00
jmp bend
//SEG8 @end
2017-11-05 08:56:04 +00:00
bend:
//SEG9 main
2017-11-05 08:56:04 +00:00
main: {
.label j = 3
.label i = 2
.label l = 5
.label k = 4
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
2017-11-05 08:56:04 +00:00
b1_from_main:
//SEG11 [5] phi (byte) main::i#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
2017-11-05 08:56:04 +00:00
lda #0
sta i
jmp b1
//SEG12 [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
2017-11-05 08:56:04 +00:00
b1_from_b5:
//SEG13 [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@5->main::@1#0] -- register_copy
2017-11-05 08:56:04 +00:00
jmp b1
//SEG14 main::@1
2017-11-05 08:56:04 +00:00
b1:
//SEG15 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
2017-11-05 08:56:04 +00:00
b2_from_b1:
//SEG16 [6] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1
2017-11-05 08:56:04 +00:00
lda #0
sta j
jmp b2
//SEG17 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
2017-11-05 08:56:04 +00:00
b2_from_b2:
//SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@2#0] -- register_copy
2017-11-05 08:56:04 +00:00
jmp b2
//SEG19 main::@2
2017-11-05 08:56:04 +00:00
b2:
2018-11-11 20:51:36 +00:00
//SEG20 [7] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::j#2 -- pbuc1_derefidx_vbuz1=vbuz2
2017-11-05 08:56:04 +00:00
lda j
ldy i
sta SCREEN,y
2018-11-11 20:51:36 +00:00
//SEG21 [8] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuz1=_inc_vbuz1
2017-11-05 08:56:04 +00:00
inc j
2018-11-11 20:51:36 +00:00
//SEG22 [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
2017-11-05 08:56:04 +00:00
lda j
cmp #$65
bne b2_from_b2
jmp b5
//SEG23 main::@5
2017-11-05 08:56:04 +00:00
b5:
2018-11-11 20:51:36 +00:00
//SEG24 [10] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuz1=_inc_vbuz1
2017-11-05 08:56:04 +00:00
inc i
2018-11-11 20:51:36 +00:00
//SEG25 [11] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
2017-11-05 08:56:04 +00:00
lda i
cmp #$65
bne b1_from_b5
//SEG26 [12] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
2017-11-05 08:56:04 +00:00
b3_from_b5:
//SEG27 [12] phi (byte) main::k#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@3#0] -- vbuz1=vbuc1
2017-11-05 08:56:04 +00:00
lda #0
sta k
jmp b3
//SEG28 [12] phi from main::@7 to main::@3 [phi:main::@7->main::@3]
2017-11-05 08:56:04 +00:00
b3_from_b7:
//SEG29 [12] phi (byte) main::k#4 = (byte) main::k#1 [phi:main::@7->main::@3#0] -- register_copy
2017-11-05 08:56:04 +00:00
jmp b3
//SEG30 main::@3
2017-11-05 08:56:04 +00:00
b3:
//SEG31 [13] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
2017-11-05 08:56:04 +00:00
b4_from_b3:
//SEG32 [13] phi (byte) main::l#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1
2017-11-05 08:56:04 +00:00
lda #0
sta l
jmp b4
//SEG33 [13] phi from main::@4 to main::@4 [phi:main::@4->main::@4]
2017-11-05 08:56:04 +00:00
b4_from_b4:
//SEG34 [13] phi (byte) main::l#2 = (byte) main::l#1 [phi:main::@4->main::@4#0] -- register_copy
2017-11-05 08:56:04 +00:00
jmp b4
//SEG35 main::@4
2017-11-05 08:56:04 +00:00
b4:
//SEG36 asm { eor#$55 tax }
2017-11-05 08:56:04 +00:00
eor #$55
tax
2018-11-11 20:51:36 +00:00
//SEG37 [15] *((const byte*) SCREEN#0 + (byte) main::k#4) ← (byte) main::l#2 -- pbuc1_derefidx_vbuz1=vbuz2
2017-11-05 08:56:04 +00:00
lda l
ldy k
sta SCREEN,y
2018-11-11 20:51:36 +00:00
//SEG38 [16] (byte) main::l#1 ← ++ (byte) main::l#2 -- vbuz1=_inc_vbuz1
2017-11-05 08:56:04 +00:00
inc l
2018-11-11 20:51:36 +00:00
//SEG39 [17] if((byte) main::l#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@4 -- vbuz1_neq_vbuc1_then_la1
2017-11-05 08:56:04 +00:00
lda l
cmp #$65
bne b4_from_b4
jmp b7
//SEG40 main::@7
2017-11-05 08:56:04 +00:00
b7:
2018-11-11 20:51:36 +00:00
//SEG41 [18] (byte) main::k#1 ← ++ (byte) main::k#4 -- vbuz1=_inc_vbuz1
2017-11-05 08:56:04 +00:00
inc k
2018-11-11 20:51:36 +00:00
//SEG42 [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@3 -- vbuz1_neq_vbuc1_then_la1
2017-11-05 08:56:04 +00:00
lda k
cmp #$65
bne b3_from_b7
jmp breturn
//SEG43 main::@return
2017-11-05 08:56:04 +00:00
breturn:
2018-11-11 20:51:36 +00:00
//SEG44 [20] return
2017-11-05 08:56:04 +00:00
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement asm { eor#$55 tax } always clobbers reg byte a reg byte x
2017-11-05 08:56:04 +00:00
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ main::k#4 main::k#1 ]
Removing always clobbered register reg byte x as potential for zp ZP_BYTE:4 [ main::k#4 main::k#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ main::l#2 main::l#1 ]
Removing always clobbered register reg byte x as potential for zp ZP_BYTE:5 [ main::l#2 main::l#1 ]
Statement [15] *((const byte*) SCREEN#0 + (byte) main::k#4) ← (byte) main::l#2 [ main::k#4 main::l#2 ] ( main:2 [ main::k#4 main::l#2 ] ) always clobbers reg byte a
Statement asm { eor#$55 tax } always clobbers reg byte a reg byte x
Statement [15] *((const byte*) SCREEN#0 + (byte) main::k#4) ← (byte) main::l#2 [ main::k#4 main::l#2 ] ( main:2 [ main::k#4 main::l#2 ] ) always clobbers reg byte a
2017-11-05 08:56:04 +00:00
Potential registers zp ZP_BYTE:2 [ main::i#4 main::i#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::j#2 main::j#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::k#4 main::k#1 ] : zp ZP_BYTE:4 , reg byte y ,
Potential registers zp ZP_BYTE:5 [ main::l#2 main::l#1 ] : zp ZP_BYTE:5 , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 303: zp ZP_BYTE:3 [ main::j#2 main::j#1 ] 252.5: zp ZP_BYTE:5 [ main::l#2 main::l#1 ] 41.1: zp ZP_BYTE:2 [ main::i#4 main::i#1 ] 37: zp ZP_BYTE:4 [ main::k#4 main::k#1 ]
Uplift Scope []
Uplifting [main] best 6638 combination reg byte a [ main::j#2 main::j#1 ] zp ZP_BYTE:5 [ main::l#2 main::l#1 ] reg byte x [ main::i#4 main::i#1 ] reg byte y [ main::k#4 main::k#1 ]
Uplifting [] best 6638 combination
Attempting to uplift remaining variables inzp ZP_BYTE:5 [ main::l#2 main::l#1 ]
Uplifting [main] best 6638 combination zp ZP_BYTE:5 [ main::l#2 main::l#1 ]
Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:2 [ main::l#2 main::l#1 ]
ASSEMBLER BEFORE OPTIMIZATION
2017-11-05 08:56:04 +00:00
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
2017-11-05 08:56:04 +00:00
.pc = $80d "Program"
//SEG1 Global Constants & labels
.label SCREEN = $400
2017-11-05 08:56:04 +00:00
//SEG2 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
2017-11-05 08:56:04 +00:00
b1:
2018-11-11 20:51:36 +00:00
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
2017-11-05 08:56:04 +00:00
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
2017-11-05 08:56:04 +00:00
bend:
//SEG9 main
2017-11-05 08:56:04 +00:00
main: {
.label l = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
2017-11-05 08:56:04 +00:00
b1_from_main:
//SEG11 [5] phi (byte) main::i#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
2017-11-05 08:56:04 +00:00
ldx #0
jmp b1
//SEG12 [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
2017-11-05 08:56:04 +00:00
b1_from_b5:
//SEG13 [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@5->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
2017-11-05 08:56:04 +00:00
b1:
//SEG15 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
2017-11-05 08:56:04 +00:00
b2_from_b1:
//SEG16 [6] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuaa=vbuc1
2017-11-05 08:56:04 +00:00
lda #0
jmp b2
//SEG17 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
2017-11-05 08:56:04 +00:00
b2_from_b2:
//SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@2#0] -- register_copy
jmp b2
//SEG19 main::@2
2017-11-05 08:56:04 +00:00
b2:
2018-11-11 20:51:36 +00:00
//SEG20 [7] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::j#2 -- pbuc1_derefidx_vbuxx=vbuaa
2017-11-05 08:56:04 +00:00
sta SCREEN,x
2018-11-11 20:51:36 +00:00
//SEG21 [8] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuaa=_inc_vbuaa
2017-11-05 08:56:04 +00:00
clc
adc #1
2018-11-11 20:51:36 +00:00
//SEG22 [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@2 -- vbuaa_neq_vbuc1_then_la1
2017-11-05 08:56:04 +00:00
cmp #$65
bne b2_from_b2
jmp b5
//SEG23 main::@5
2017-11-05 08:56:04 +00:00
b5:
2018-11-11 20:51:36 +00:00
//SEG24 [10] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuxx=_inc_vbuxx
2017-11-05 08:56:04 +00:00
inx
2018-11-11 20:51:36 +00:00
//SEG25 [11] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
2017-11-05 08:56:04 +00:00
cpx #$65
bne b1_from_b5
//SEG26 [12] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
2017-11-05 08:56:04 +00:00
b3_from_b5:
//SEG27 [12] phi (byte) main::k#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@3#0] -- vbuyy=vbuc1
ldy #0
2017-11-05 08:56:04 +00:00
jmp b3
//SEG28 [12] phi from main::@7 to main::@3 [phi:main::@7->main::@3]
2017-11-05 08:56:04 +00:00
b3_from_b7:
//SEG29 [12] phi (byte) main::k#4 = (byte) main::k#1 [phi:main::@7->main::@3#0] -- register_copy
jmp b3
//SEG30 main::@3
2017-11-05 08:56:04 +00:00
b3:
//SEG31 [13] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
2017-11-05 08:56:04 +00:00
b4_from_b3:
//SEG32 [13] phi (byte) main::l#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1
lda #0
sta l
2017-11-05 08:56:04 +00:00
jmp b4
//SEG33 [13] phi from main::@4 to main::@4 [phi:main::@4->main::@4]
2017-11-05 08:56:04 +00:00
b4_from_b4:
//SEG34 [13] phi (byte) main::l#2 = (byte) main::l#1 [phi:main::@4->main::@4#0] -- register_copy
jmp b4
//SEG35 main::@4
2017-11-05 08:56:04 +00:00
b4:
//SEG36 asm { eor#$55 tax }
2017-11-05 08:56:04 +00:00
eor #$55
tax
2018-11-11 20:51:36 +00:00
//SEG37 [15] *((const byte*) SCREEN#0 + (byte) main::k#4) ← (byte) main::l#2 -- pbuc1_derefidx_vbuyy=vbuz1
lda l
sta SCREEN,y
2018-11-11 20:51:36 +00:00
//SEG38 [16] (byte) main::l#1 ← ++ (byte) main::l#2 -- vbuz1=_inc_vbuz1
inc l
2018-11-11 20:51:36 +00:00
//SEG39 [17] if((byte) main::l#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@4 -- vbuz1_neq_vbuc1_then_la1
lda l
cmp #$65
2017-11-05 08:56:04 +00:00
bne b4_from_b4
jmp b7
//SEG40 main::@7
2017-11-05 08:56:04 +00:00
b7:
2018-11-11 20:51:36 +00:00
//SEG41 [18] (byte) main::k#1 ← ++ (byte) main::k#4 -- vbuyy=_inc_vbuyy
iny
2018-11-11 20:51:36 +00:00
//SEG42 [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@3 -- vbuyy_neq_vbuc1_then_la1
cpy #$65
2017-11-05 08:56:04 +00:00
bne b3_from_b7
jmp breturn
//SEG43 main::@return
2017-11-05 08:56:04 +00:00
breturn:
2018-11-11 20:51:36 +00:00
//SEG44 [20] return
2017-11-05 08:56:04 +00:00
rts
}
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b5
Removing instruction jmp b3
Removing instruction jmp b4
Removing instruction jmp b7
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
2017-11-05 08:56:04 +00:00
Replacing label b2_from_b2 with b2
Replacing label b1_from_b5 with b1
Replacing label b4_from_b4 with b4
Replacing label b3_from_b7 with b3
Removing instruction b1_from_bbegin:
Removing instruction b1:
2017-11-05 08:56:04 +00:00
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
2017-11-05 08:56:04 +00:00
Removing instruction b1_from_b5:
Removing instruction b2_from_b1:
Removing instruction b2_from_b2:
Removing instruction b3_from_b7:
Removing instruction b4_from_b3:
Removing instruction b4_from_b4:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b5:
Removing instruction b3_from_b5:
Removing instruction b7:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
2017-11-05 08:56:04 +00:00
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp b4
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
2017-11-05 08:56:04 +00:00
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024
2017-11-05 08:56:04 +00:00
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@7
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#4 reg byte x 24.599999999999998
(byte) main::j
(byte) main::j#1 reg byte a 151.5
(byte) main::j#2 reg byte a 151.5
(byte) main::k
(byte) main::k#1 reg byte y 16.5
(byte) main::k#4 reg byte y 20.499999999999996
2017-11-05 08:56:04 +00:00
(byte) main::l
(byte) main::l#1 l zp ZP_BYTE:2 151.5
(byte) main::l#2 l zp ZP_BYTE:2 101.0
2017-11-05 08:56:04 +00:00
reg byte x [ main::i#4 main::i#1 ]
reg byte a [ main::j#2 main::j#1 ]
reg byte y [ main::k#4 main::k#1 ]
zp ZP_BYTE:2 [ main::l#2 main::l#1 ]
2017-11-05 08:56:04 +00:00
2017-12-29 10:21:11 +00:00
FINAL ASSEMBLER
Score: 4676
2017-12-30 12:45:59 +00:00
2017-11-05 08:56:04 +00:00
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
.label SCREEN = $400
2017-11-05 08:56:04 +00:00
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
2018-11-11 20:51:36 +00:00
//SEG5 [2] call main
//SEG6 [4] phi from @1 to main [phi:@1->main]
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
2017-11-05 08:56:04 +00:00
main: {
.label l = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::i#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
2017-11-05 08:56:04 +00:00
ldx #0
//SEG12 [5] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
//SEG13 [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@5->main::@1#0] -- register_copy
//SEG14 main::@1
2017-11-05 08:56:04 +00:00
b1:
//SEG15 [6] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG16 [6] phi (byte) main::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuaa=vbuc1
2017-11-05 08:56:04 +00:00
lda #0
//SEG17 [6] phi from main::@2 to main::@2 [phi:main::@2->main::@2]
//SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@2#0] -- register_copy
//SEG19 main::@2
2017-11-05 08:56:04 +00:00
b2:
2018-11-11 20:51:36 +00:00
//SEG20 [7] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::j#2 -- pbuc1_derefidx_vbuxx=vbuaa
2017-11-05 08:56:04 +00:00
sta SCREEN,x
2018-11-11 20:51:36 +00:00
//SEG21 [8] (byte) main::j#1 ← ++ (byte) main::j#2 -- vbuaa=_inc_vbuaa
2017-11-05 08:56:04 +00:00
clc
adc #1
2018-11-11 20:51:36 +00:00
//SEG22 [9] if((byte) main::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@2 -- vbuaa_neq_vbuc1_then_la1
2017-11-05 08:56:04 +00:00
cmp #$65
bne b2
//SEG23 main::@5
2018-11-11 20:51:36 +00:00
//SEG24 [10] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuxx=_inc_vbuxx
2017-11-05 08:56:04 +00:00
inx
2018-11-11 20:51:36 +00:00
//SEG25 [11] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
2017-11-05 08:56:04 +00:00
cpx #$65
bne b1
//SEG26 [12] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
//SEG27 [12] phi (byte) main::k#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@3#0] -- vbuyy=vbuc1
ldy #0
//SEG28 [12] phi from main::@7 to main::@3 [phi:main::@7->main::@3]
//SEG29 [12] phi (byte) main::k#4 = (byte) main::k#1 [phi:main::@7->main::@3#0] -- register_copy
//SEG30 main::@3
2017-11-05 08:56:04 +00:00
b3:
//SEG31 [13] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
//SEG32 [13] phi (byte) main::l#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1
lda #0
sta l
//SEG33 [13] phi from main::@4 to main::@4 [phi:main::@4->main::@4]
//SEG34 [13] phi (byte) main::l#2 = (byte) main::l#1 [phi:main::@4->main::@4#0] -- register_copy
//SEG35 main::@4
2017-11-05 08:56:04 +00:00
b4:
//SEG36 asm { eor#$55 tax }
2017-11-05 08:56:04 +00:00
eor #$55
tax
2018-11-11 20:51:36 +00:00
//SEG37 [15] *((const byte*) SCREEN#0 + (byte) main::k#4) ← (byte) main::l#2 -- pbuc1_derefidx_vbuyy=vbuz1
lda l
sta SCREEN,y
2018-11-11 20:51:36 +00:00
//SEG38 [16] (byte) main::l#1 ← ++ (byte) main::l#2 -- vbuz1=_inc_vbuz1
inc l
2018-11-11 20:51:36 +00:00
//SEG39 [17] if((byte) main::l#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@4 -- vbuz1_neq_vbuc1_then_la1
lda l
cmp #$65
bne b4
//SEG40 main::@7
2018-11-11 20:51:36 +00:00
//SEG41 [18] (byte) main::k#1 ← ++ (byte) main::k#4 -- vbuyy=_inc_vbuyy
iny
2018-11-11 20:51:36 +00:00
//SEG42 [19] if((byte) main::k#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@3 -- vbuyy_neq_vbuc1_then_la1
cpy #$65
2017-11-05 08:56:04 +00:00
bne b3
//SEG43 main::@return
2018-11-11 20:51:36 +00:00
//SEG44 [20] return
2017-11-05 08:56:04 +00:00
rts
}