2019-05-30 20:29:04 +00:00
|
|
|
Culled Empty Block (label) main::@2
|
2018-07-12 12:42:45 +00:00
|
|
|
|
2018-08-22 22:24:32 +00:00
|
|
|
CONTROL FLOW GRAPH SSA
|
2018-07-12 12:42:45 +00:00
|
|
|
@begin: scope:[] from
|
|
|
|
to:@1
|
2019-09-18 21:00:30 +00:00
|
|
|
|
|
|
|
(void()) main()
|
2018-07-12 12:42:45 +00:00
|
|
|
main: scope:[main] from @1
|
2020-03-29 19:00:25 +00:00
|
|
|
(byte*) main::b#0 ← (const nomodify byte*) main::BITMAP+(number) $1fff
|
2018-07-12 12:42:45 +00:00
|
|
|
to:main::@1
|
|
|
|
main::@1: scope:[main] from main main::@1
|
|
|
|
(byte*) main::b#2 ← phi( main/(byte*) main::b#0 main::@1/(byte*) main::b#1 )
|
2019-05-30 20:29:04 +00:00
|
|
|
*((byte*) main::b#2) ← (number) $5a
|
2019-11-03 16:05:55 +00:00
|
|
|
(byte*) main::b#1 ← (byte*) main::b#2 + rangenext(main::BITMAP+$1fff,main::BITMAP)
|
|
|
|
(bool~) main::$0 ← (byte*) main::b#1 != rangelast(main::BITMAP+$1fff,main::BITMAP)
|
|
|
|
if((bool~) main::$0) goto main::@1
|
2018-07-12 12:42:45 +00:00
|
|
|
to:main::@return
|
|
|
|
main::@return: scope:[main] from main::@1
|
|
|
|
return
|
|
|
|
to:@return
|
|
|
|
@1: scope:[] from @begin
|
|
|
|
call main
|
|
|
|
to:@2
|
|
|
|
@2: scope:[] from @1
|
|
|
|
to:@end
|
|
|
|
@end: scope:[] from @2
|
|
|
|
|
|
|
|
SYMBOL TABLE SSA
|
|
|
|
(label) @1
|
|
|
|
(label) @2
|
|
|
|
(label) @begin
|
|
|
|
(label) @end
|
|
|
|
(void()) main()
|
2019-11-03 16:05:55 +00:00
|
|
|
(bool~) main::$0
|
2018-07-12 12:42:45 +00:00
|
|
|
(label) main::@1
|
|
|
|
(label) main::@return
|
2020-03-29 19:00:25 +00:00
|
|
|
(const nomodify byte*) main::BITMAP = (byte*)(number) $2000
|
2018-07-12 12:42:45 +00:00
|
|
|
(byte*) main::b
|
|
|
|
(byte*) main::b#0
|
|
|
|
(byte*) main::b#1
|
|
|
|
(byte*) main::b#2
|
|
|
|
|
2020-03-29 19:00:25 +00:00
|
|
|
Adding number conversion cast (unumber) $1fff in (byte*) main::b#0 ← (const nomodify byte*) main::BITMAP+(number) $1fff
|
2019-05-30 20:29:04 +00:00
|
|
|
Adding number conversion cast (unumber) $5a in *((byte*) main::b#2) ← (number) $5a
|
|
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
|
|
Inlining cast *((byte*) main::b#2) ← (unumber)(number) $5a
|
|
|
|
Successful SSA optimization Pass2InlineCast
|
|
|
|
Simplifying constant pointer cast (byte*) 8192
|
|
|
|
Simplifying constant integer cast $1fff
|
|
|
|
Simplifying constant integer cast $5a
|
|
|
|
Successful SSA optimization PassNCastSimplification
|
|
|
|
Finalized unsigned number type (word) $1fff
|
|
|
|
Finalized unsigned number type (byte) $5a
|
|
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
2019-11-03 16:05:55 +00:00
|
|
|
Simple Condition (bool~) main::$0 [5] if((byte*) main::b#1!=rangelast(main::BITMAP+$1fff,main::BITMAP)) goto main::@1
|
2018-08-22 20:23:42 +00:00
|
|
|
Successful SSA optimization Pass2ConditionalJumpSimplification
|
2019-09-29 18:57:23 +00:00
|
|
|
Constant (const byte*) main::b#0 = main::BITMAP+$1fff
|
2018-08-22 20:23:42 +00:00
|
|
|
Successful SSA optimization Pass2ConstantIdentification
|
2019-05-30 20:29:04 +00:00
|
|
|
Resolved ranged next value [3] main::b#1 ← -- main::b#2 to --
|
2020-03-29 19:00:25 +00:00
|
|
|
Resolved ranged comparison value [5] if(main::b#1!=rangelast(main::BITMAP+$1fff,main::BITMAP)) goto main::@1 to (byte*)(const nomodify byte*) main::BITMAP-(number) 1
|
|
|
|
Adding number conversion cast (unumber) 1 in if((byte*) main::b#1!=(byte*)(const nomodify byte*) main::BITMAP-(number) 1) goto main::@1
|
2019-05-30 20:29:04 +00:00
|
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
2020-03-29 19:00:25 +00:00
|
|
|
Simplifying constant integer cast (const nomodify byte*) main::BITMAP-(unumber)(number) 1
|
2019-05-30 20:29:04 +00:00
|
|
|
Simplifying constant integer cast 1
|
|
|
|
Successful SSA optimization PassNCastSimplification
|
|
|
|
Finalized unsigned number type (byte) 1
|
|
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
2018-07-12 12:42:45 +00:00
|
|
|
Inlining constant with var siblings (const byte*) main::b#0
|
2020-03-29 19:00:25 +00:00
|
|
|
Constant inlined main::b#0 = (const nomodify byte*) main::BITMAP+(word) $1fff
|
2018-08-22 20:23:42 +00:00
|
|
|
Successful SSA optimization Pass2ConstantInlining
|
2018-07-12 12:42:45 +00:00
|
|
|
Added new block during phi lifting main::@3(between main::@1 and main::@1)
|
|
|
|
Adding NOP phi() at start of @begin
|
|
|
|
Adding NOP phi() at start of @1
|
2019-05-30 20:29:04 +00:00
|
|
|
Adding NOP phi() at start of @2
|
2018-07-12 12:42:45 +00:00
|
|
|
Adding NOP phi() at start of @end
|
|
|
|
Adding NOP phi() at start of main
|
|
|
|
CALL GRAPH
|
|
|
|
Calls in [] to main:2
|
|
|
|
|
|
|
|
Created 1 initial phi equivalence classes
|
2019-05-30 20:29:04 +00:00
|
|
|
Coalesced [11] main::b#3 ← main::b#1
|
2018-07-12 12:42:45 +00:00
|
|
|
Coalesced down to 1 phi equivalence classes
|
2019-05-30 20:29:04 +00:00
|
|
|
Culled Empty Block (label) @2
|
2018-07-12 12:42:45 +00:00
|
|
|
Culled Empty Block (label) main::@3
|
|
|
|
Adding NOP phi() at start of @begin
|
|
|
|
Adding NOP phi() at start of @1
|
|
|
|
Adding NOP phi() at start of @end
|
|
|
|
Adding NOP phi() at start of main
|
|
|
|
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
|
|
|
@begin: scope:[] from
|
2018-11-11 20:51:36 +00:00
|
|
|
[0] phi()
|
2018-07-12 12:42:45 +00:00
|
|
|
to:@1
|
|
|
|
@1: scope:[] from @begin
|
2018-11-11 20:51:36 +00:00
|
|
|
[1] phi()
|
|
|
|
[2] call main
|
2018-07-12 12:42:45 +00:00
|
|
|
to:@end
|
|
|
|
@end: scope:[] from @1
|
2018-11-11 20:51:36 +00:00
|
|
|
[3] phi()
|
2019-09-18 21:00:30 +00:00
|
|
|
|
|
|
|
(void()) main()
|
2018-07-12 12:42:45 +00:00
|
|
|
main: scope:[main] from @1
|
2018-11-11 20:51:36 +00:00
|
|
|
[4] phi()
|
2018-07-12 12:42:45 +00:00
|
|
|
to:main::@1
|
|
|
|
main::@1: scope:[main] from main main::@1
|
2020-03-29 19:00:25 +00:00
|
|
|
[5] (byte*) main::b#2 ← phi( main/(const nomodify byte*) main::BITMAP+(word) $1fff main::@1/(byte*) main::b#1 )
|
2019-05-30 20:29:04 +00:00
|
|
|
[6] *((byte*) main::b#2) ← (byte) $5a
|
2018-11-11 20:51:36 +00:00
|
|
|
[7] (byte*) main::b#1 ← -- (byte*) main::b#2
|
2020-03-29 19:00:25 +00:00
|
|
|
[8] if((byte*) main::b#1!=(const nomodify byte*) main::BITMAP-(byte) 1) goto main::@1
|
2018-07-12 12:42:45 +00:00
|
|
|
to:main::@return
|
|
|
|
main::@return: scope:[main] from main::@1
|
2018-11-11 20:51:36 +00:00
|
|
|
[9] return
|
2018-07-12 12:42:45 +00:00
|
|
|
to:@return
|
|
|
|
|
|
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
|
|
(void()) main()
|
|
|
|
(byte*) main::b
|
2020-03-22 21:26:39 +00:00
|
|
|
(byte*) main::b#1 151.5
|
|
|
|
(byte*) main::b#2 151.5
|
2018-07-12 12:42:45 +00:00
|
|
|
|
|
|
|
Initial phi equivalence classes
|
|
|
|
[ main::b#2 main::b#1 ]
|
|
|
|
Complete equivalence classes
|
|
|
|
[ main::b#2 main::b#1 ]
|
2019-10-12 09:40:36 +00:00
|
|
|
Allocated zp[2]:2 [ main::b#2 main::b#1 ]
|
2018-07-12 12:42:45 +00:00
|
|
|
|
|
|
|
INITIAL ASM
|
2019-09-08 00:29:17 +00:00
|
|
|
Target platform is c64basic / MOS6502X
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Comments
|
2019-02-17 23:12:29 +00:00
|
|
|
// Range-based for does not recognize symbolic constants.
|
|
|
|
// The following should work but gives a not-constant exception
|
2019-07-25 15:06:17 +00:00
|
|
|
// Upstart
|
2018-07-12 12:42:45 +00:00
|
|
|
.pc = $801 "Basic"
|
2019-09-29 21:13:37 +00:00
|
|
|
:BasicUpstart(__bbegin)
|
2018-07-12 12:42:45 +00:00
|
|
|
.pc = $80d "Program"
|
2019-07-08 14:43:09 +00:00
|
|
|
// Global Constants & labels
|
|
|
|
// @begin
|
2019-09-29 21:13:37 +00:00
|
|
|
__bbegin:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [1] phi from @begin to @1 [phi:@begin->@1]
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1_from___bbegin:
|
|
|
|
jmp __b1
|
2019-07-08 14:43:09 +00:00
|
|
|
// @1
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [2] call main
|
|
|
|
// [4] phi from @1 to main [phi:@1->main]
|
2019-09-29 21:13:37 +00:00
|
|
|
main_from___b1:
|
2018-07-12 12:42:45 +00:00
|
|
|
jsr main
|
2019-07-08 14:43:09 +00:00
|
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
2019-09-29 21:13:37 +00:00
|
|
|
__bend_from___b1:
|
|
|
|
jmp __bend
|
2019-07-08 14:43:09 +00:00
|
|
|
// @end
|
2019-09-29 21:13:37 +00:00
|
|
|
__bend:
|
2019-07-08 14:43:09 +00:00
|
|
|
// main
|
2018-07-12 12:42:45 +00:00
|
|
|
main: {
|
|
|
|
.label BITMAP = $2000
|
|
|
|
.label b = 2
|
2019-07-08 14:43:09 +00:00
|
|
|
// [5] phi from main to main::@1 [phi:main->main::@1]
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1_from_main:
|
2020-03-29 19:00:25 +00:00
|
|
|
// [5] phi (byte*) main::b#2 = (const nomodify byte*) main::BITMAP+(word) $1fff [phi:main->main::@1#0] -- pbuz1=pbuc1
|
2018-07-12 12:42:45 +00:00
|
|
|
lda #<BITMAP+$1fff
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z b
|
2018-07-12 12:42:45 +00:00
|
|
|
lda #>BITMAP+$1fff
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z b+1
|
2019-09-29 21:13:37 +00:00
|
|
|
jmp __b1
|
2019-07-08 14:43:09 +00:00
|
|
|
// [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1_from___b1:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [5] phi (byte*) main::b#2 = (byte*) main::b#1 [phi:main::@1->main::@1#0] -- register_copy
|
2019-09-29 21:13:37 +00:00
|
|
|
jmp __b1
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@1
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [6] *((byte*) main::b#2) ← (byte) $5a -- _deref_pbuz1=vbuc1
|
2018-07-12 12:42:45 +00:00
|
|
|
lda #$5a
|
|
|
|
ldy #0
|
|
|
|
sta (b),y
|
2019-07-08 14:43:09 +00:00
|
|
|
// [7] (byte*) main::b#1 ← -- (byte*) main::b#2 -- pbuz1=_dec_pbuz1
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z b
|
2018-07-12 12:42:45 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
dec.z b+1
|
2018-07-12 12:42:45 +00:00
|
|
|
!:
|
2019-08-07 19:00:19 +00:00
|
|
|
dec.z b
|
2020-03-29 19:00:25 +00:00
|
|
|
// [8] if((byte*) main::b#1!=(const nomodify byte*) main::BITMAP-(byte) 1) goto main::@1 -- pbuz1_neq_pbuc1_then_la1
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z b+1
|
2018-07-12 12:42:45 +00:00
|
|
|
cmp #>BITMAP-1
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b1_from___b1
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z b
|
2018-07-12 12:42:45 +00:00
|
|
|
cmp #<BITMAP-1
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b1_from___b1
|
|
|
|
jmp __breturn
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@return
|
2019-09-29 21:13:37 +00:00
|
|
|
__breturn:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [9] return
|
2018-07-12 12:42:45 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Data
|
2018-07-12 12:42:45 +00:00
|
|
|
|
|
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
2020-03-22 23:10:07 +00:00
|
|
|
Statement [6] *((byte*) main::b#2) ← (byte) $5a [ main::b#2 ] ( main:2 [ main::b#2 ] { } ) always clobbers reg byte a reg byte y
|
|
|
|
Statement [7] (byte*) main::b#1 ← -- (byte*) main::b#2 [ main::b#1 ] ( main:2 [ main::b#1 ] { } ) always clobbers reg byte a
|
2020-03-29 19:00:25 +00:00
|
|
|
Statement [8] if((byte*) main::b#1!=(const nomodify byte*) main::BITMAP-(byte) 1) goto main::@1 [ main::b#1 ] ( main:2 [ main::b#1 ] { } ) always clobbers reg byte a
|
2019-10-12 09:40:36 +00:00
|
|
|
Potential registers zp[2]:2 [ main::b#2 main::b#1 ] : zp[2]:2 ,
|
2018-07-12 12:42:45 +00:00
|
|
|
|
|
|
|
REGISTER UPLIFT SCOPES
|
2020-03-22 21:26:39 +00:00
|
|
|
Uplift Scope [main] 303: zp[2]:2 [ main::b#2 main::b#1 ]
|
2018-07-12 12:42:45 +00:00
|
|
|
Uplift Scope []
|
|
|
|
|
2019-10-12 09:40:36 +00:00
|
|
|
Uplifting [main] best 613 combination zp[2]:2 [ main::b#2 main::b#1 ]
|
2018-07-12 12:42:45 +00:00
|
|
|
Uplifting [] best 613 combination
|
|
|
|
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Comments
|
2019-02-17 23:12:29 +00:00
|
|
|
// Range-based for does not recognize symbolic constants.
|
|
|
|
// The following should work but gives a not-constant exception
|
2019-07-25 15:06:17 +00:00
|
|
|
// Upstart
|
2018-07-12 12:42:45 +00:00
|
|
|
.pc = $801 "Basic"
|
2019-09-29 21:13:37 +00:00
|
|
|
:BasicUpstart(__bbegin)
|
2018-07-12 12:42:45 +00:00
|
|
|
.pc = $80d "Program"
|
2019-07-08 14:43:09 +00:00
|
|
|
// Global Constants & labels
|
|
|
|
// @begin
|
2019-09-29 21:13:37 +00:00
|
|
|
__bbegin:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [1] phi from @begin to @1 [phi:@begin->@1]
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1_from___bbegin:
|
|
|
|
jmp __b1
|
2019-07-08 14:43:09 +00:00
|
|
|
// @1
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [2] call main
|
|
|
|
// [4] phi from @1 to main [phi:@1->main]
|
2019-09-29 21:13:37 +00:00
|
|
|
main_from___b1:
|
2018-07-12 12:42:45 +00:00
|
|
|
jsr main
|
2019-07-08 14:43:09 +00:00
|
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
2019-09-29 21:13:37 +00:00
|
|
|
__bend_from___b1:
|
|
|
|
jmp __bend
|
2019-07-08 14:43:09 +00:00
|
|
|
// @end
|
2019-09-29 21:13:37 +00:00
|
|
|
__bend:
|
2019-07-08 14:43:09 +00:00
|
|
|
// main
|
2018-07-12 12:42:45 +00:00
|
|
|
main: {
|
|
|
|
.label BITMAP = $2000
|
|
|
|
.label b = 2
|
2019-07-08 14:43:09 +00:00
|
|
|
// [5] phi from main to main::@1 [phi:main->main::@1]
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1_from_main:
|
2020-03-29 19:00:25 +00:00
|
|
|
// [5] phi (byte*) main::b#2 = (const nomodify byte*) main::BITMAP+(word) $1fff [phi:main->main::@1#0] -- pbuz1=pbuc1
|
2018-07-12 12:42:45 +00:00
|
|
|
lda #<BITMAP+$1fff
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z b
|
2018-07-12 12:42:45 +00:00
|
|
|
lda #>BITMAP+$1fff
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z b+1
|
2019-09-29 21:13:37 +00:00
|
|
|
jmp __b1
|
2019-07-08 14:43:09 +00:00
|
|
|
// [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1_from___b1:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [5] phi (byte*) main::b#2 = (byte*) main::b#1 [phi:main::@1->main::@1#0] -- register_copy
|
2019-09-29 21:13:37 +00:00
|
|
|
jmp __b1
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@1
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [6] *((byte*) main::b#2) ← (byte) $5a -- _deref_pbuz1=vbuc1
|
2018-07-12 12:42:45 +00:00
|
|
|
lda #$5a
|
|
|
|
ldy #0
|
|
|
|
sta (b),y
|
2019-07-08 14:43:09 +00:00
|
|
|
// [7] (byte*) main::b#1 ← -- (byte*) main::b#2 -- pbuz1=_dec_pbuz1
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z b
|
2018-07-12 12:42:45 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
dec.z b+1
|
2018-07-12 12:42:45 +00:00
|
|
|
!:
|
2019-08-07 19:00:19 +00:00
|
|
|
dec.z b
|
2020-03-29 19:00:25 +00:00
|
|
|
// [8] if((byte*) main::b#1!=(const nomodify byte*) main::BITMAP-(byte) 1) goto main::@1 -- pbuz1_neq_pbuc1_then_la1
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z b+1
|
2018-07-12 12:42:45 +00:00
|
|
|
cmp #>BITMAP-1
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b1_from___b1
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z b
|
2018-07-12 12:42:45 +00:00
|
|
|
cmp #<BITMAP-1
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b1_from___b1
|
|
|
|
jmp __breturn
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@return
|
2019-09-29 21:13:37 +00:00
|
|
|
__breturn:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [9] return
|
2018-07-12 12:42:45 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Data
|
2018-07-12 12:42:45 +00:00
|
|
|
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction jmp __b1
|
|
|
|
Removing instruction jmp __bend
|
|
|
|
Removing instruction jmp __b1
|
|
|
|
Removing instruction jmp __breturn
|
2018-07-12 12:42:45 +00:00
|
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
2019-09-29 21:13:37 +00:00
|
|
|
Replacing label __b1_from___b1 with __b1
|
|
|
|
Replacing label __b1_from___b1 with __b1
|
|
|
|
Removing instruction __b1_from___bbegin:
|
2020-03-03 07:58:31 +00:00
|
|
|
Removing instruction __b1:
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction main_from___b1:
|
|
|
|
Removing instruction __bend_from___b1:
|
|
|
|
Removing instruction __b1_from___b1:
|
2018-07-12 12:42:45 +00:00
|
|
|
Succesful ASM optimization Pass5RedundantLabelElimination
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction __bend:
|
|
|
|
Removing instruction __b1_from_main:
|
|
|
|
Removing instruction __breturn:
|
2018-07-12 12:42:45 +00:00
|
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
2018-12-25 16:04:50 +00:00
|
|
|
Updating BasicUpstart to call main directly
|
|
|
|
Removing instruction jsr main
|
|
|
|
Succesful ASM optimization Pass5SkipBegin
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction jmp __b1
|
2018-07-12 12:42:45 +00:00
|
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
2020-03-03 07:58:31 +00:00
|
|
|
Removing instruction __bbegin:
|
2018-12-25 16:04:50 +00:00
|
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
2018-07-12 12:42:45 +00:00
|
|
|
|
|
|
|
FINAL SYMBOL TABLE
|
|
|
|
(label) @1
|
|
|
|
(label) @begin
|
|
|
|
(label) @end
|
|
|
|
(void()) main()
|
|
|
|
(label) main::@1
|
|
|
|
(label) main::@return
|
2020-03-29 19:00:25 +00:00
|
|
|
(const nomodify byte*) main::BITMAP = (byte*) 8192
|
2018-07-12 12:42:45 +00:00
|
|
|
(byte*) main::b
|
2020-03-22 21:26:39 +00:00
|
|
|
(byte*) main::b#1 b zp[2]:2 151.5
|
|
|
|
(byte*) main::b#2 b zp[2]:2 151.5
|
2018-07-12 12:42:45 +00:00
|
|
|
|
2019-10-12 09:40:36 +00:00
|
|
|
zp[2]:2 [ main::b#2 main::b#1 ]
|
2018-07-12 12:42:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
2018-12-25 16:04:50 +00:00
|
|
|
Score: 511
|
2018-07-12 12:42:45 +00:00
|
|
|
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Comments
|
2019-02-17 23:12:29 +00:00
|
|
|
// Range-based for does not recognize symbolic constants.
|
|
|
|
// The following should work but gives a not-constant exception
|
2019-07-25 15:06:17 +00:00
|
|
|
// Upstart
|
2018-07-12 12:42:45 +00:00
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
2019-07-08 14:43:09 +00:00
|
|
|
// Global Constants & labels
|
|
|
|
// @begin
|
|
|
|
// [1] phi from @begin to @1 [phi:@begin->@1]
|
|
|
|
// @1
|
|
|
|
// [2] call main
|
|
|
|
// [4] phi from @1 to main [phi:@1->main]
|
|
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
|
|
|
// @end
|
|
|
|
// main
|
2018-07-12 12:42:45 +00:00
|
|
|
main: {
|
|
|
|
.label BITMAP = $2000
|
|
|
|
.label b = 2
|
2019-07-08 14:43:09 +00:00
|
|
|
// [5] phi from main to main::@1 [phi:main->main::@1]
|
2020-03-29 19:00:25 +00:00
|
|
|
// [5] phi (byte*) main::b#2 = (const nomodify byte*) main::BITMAP+(word) $1fff [phi:main->main::@1#0] -- pbuz1=pbuc1
|
2018-07-12 12:42:45 +00:00
|
|
|
lda #<BITMAP+$1fff
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z b
|
2018-07-12 12:42:45 +00:00
|
|
|
lda #>BITMAP+$1fff
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z b+1
|
2019-07-08 14:43:09 +00:00
|
|
|
// [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
|
|
|
|
// [5] phi (byte*) main::b#2 = (byte*) main::b#1 [phi:main::@1->main::@1#0] -- register_copy
|
|
|
|
// main::@1
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2019-07-08 14:43:09 +00:00
|
|
|
// *b = $5a
|
|
|
|
// [6] *((byte*) main::b#2) ← (byte) $5a -- _deref_pbuz1=vbuc1
|
2018-07-12 12:42:45 +00:00
|
|
|
lda #$5a
|
|
|
|
ldy #0
|
|
|
|
sta (b),y
|
2019-07-08 14:43:09 +00:00
|
|
|
// for(byte* b : BITMAP+$1fff..BITMAP)
|
|
|
|
// [7] (byte*) main::b#1 ← -- (byte*) main::b#2 -- pbuz1=_dec_pbuz1
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z b
|
2018-07-12 12:42:45 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
dec.z b+1
|
2018-07-12 12:42:45 +00:00
|
|
|
!:
|
2019-08-07 19:00:19 +00:00
|
|
|
dec.z b
|
2020-03-29 19:00:25 +00:00
|
|
|
// [8] if((byte*) main::b#1!=(const nomodify byte*) main::BITMAP-(byte) 1) goto main::@1 -- pbuz1_neq_pbuc1_then_la1
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z b+1
|
2018-07-12 12:42:45 +00:00
|
|
|
cmp #>BITMAP-1
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b1
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z b
|
2018-07-12 12:42:45 +00:00
|
|
|
cmp #<BITMAP-1
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b1
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@return
|
|
|
|
// }
|
|
|
|
// [9] return
|
2018-07-12 12:42:45 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Data
|
2018-07-12 12:42:45 +00:00
|
|
|
|