2020-10-05 20:58:02 +00:00
|
|
|
Setting inferred volatile on symbol affected by address-of main::bp = &main::b
|
2018-02-03 12:20:34 +00:00
|
|
|
|
2018-08-22 22:24:32 +00:00
|
|
|
CONTROL FLOW GRAPH SSA
|
2019-09-18 21:00:30 +00:00
|
|
|
|
2020-10-05 20:58:02 +00:00
|
|
|
void main()
|
2020-06-27 20:36:52 +00:00
|
|
|
main: scope:[main] from __start
|
2020-10-05 20:58:02 +00:00
|
|
|
main::b = 0
|
2018-02-03 12:20:34 +00:00
|
|
|
to:main::@1
|
|
|
|
main::@1: scope:[main] from main main::@1
|
2020-10-05 20:58:02 +00:00
|
|
|
main::$0 = *main::bp + 1
|
|
|
|
main::c#0 = main::$0
|
|
|
|
main::SCREEN[main::b] = main::c#0
|
|
|
|
main::b = main::b + rangenext(0,$a)
|
|
|
|
main::$1 = main::b != rangelast(0,$a)
|
|
|
|
if(main::$1) goto main::@1
|
2018-02-03 12:20:34 +00:00
|
|
|
to:main::@return
|
|
|
|
main::@return: scope:[main] from main::@1
|
|
|
|
return
|
|
|
|
to:@return
|
2020-06-27 19:18:00 +00:00
|
|
|
|
2020-10-05 20:58:02 +00:00
|
|
|
void __start()
|
2020-06-27 20:36:52 +00:00
|
|
|
__start: scope:[__start] from
|
2018-05-01 20:50:59 +00:00
|
|
|
call main
|
2020-06-27 20:36:52 +00:00
|
|
|
to:__start::@1
|
|
|
|
__start::@1: scope:[__start] from __start
|
|
|
|
to:__start::@return
|
|
|
|
__start::@return: scope:[__start] from __start::@1
|
2020-06-27 19:18:00 +00:00
|
|
|
return
|
|
|
|
to:@return
|
2018-02-03 12:20:34 +00:00
|
|
|
|
|
|
|
SYMBOL TABLE SSA
|
2020-10-05 20:58:02 +00:00
|
|
|
void __start()
|
|
|
|
void main()
|
|
|
|
number~ main::$0
|
|
|
|
bool~ main::$1
|
2021-04-30 15:26:46 +00:00
|
|
|
constant byte* main::SCREEN = (byte*)$400
|
2020-10-05 20:58:02 +00:00
|
|
|
volatile byte main::b loadstore
|
2021-04-30 15:26:46 +00:00
|
|
|
constant byte* main::bp = &main::b
|
2020-10-05 20:58:02 +00:00
|
|
|
byte main::c
|
|
|
|
byte main::c#0
|
|
|
|
|
|
|
|
Adding number conversion cast (unumber) 1 in main::$0 = *main::bp + 1
|
|
|
|
Adding number conversion cast (unumber) main::$0 in main::$0 = *main::bp + (unumber)1
|
2019-05-30 20:29:04 +00:00
|
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
|
|
Simplifying constant pointer cast (byte*) 1024
|
|
|
|
Simplifying constant integer cast 1
|
|
|
|
Successful SSA optimization PassNCastSimplification
|
2020-12-11 23:01:15 +00:00
|
|
|
Finalized unsigned number type (byte) 1
|
2019-05-30 20:29:04 +00:00
|
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
2020-10-05 20:58:02 +00:00
|
|
|
Inferred type updated to byte in main::$0 = *main::bp + 1
|
2020-03-22 21:26:39 +00:00
|
|
|
Alias main::c#0 = main::$0
|
2018-08-22 20:23:42 +00:00
|
|
|
Successful SSA optimization Pass2AliasElimination
|
2020-10-05 20:58:02 +00:00
|
|
|
Simple Condition main::$1 [5] if(main::b!=rangelast(0,$a)) goto main::@1
|
2018-08-22 20:23:42 +00:00
|
|
|
Successful SSA optimization Pass2ConditionalJumpSimplification
|
2020-10-05 20:58:02 +00:00
|
|
|
Resolved ranged next value [3] main::b = ++ main::b to ++
|
|
|
|
Resolved ranged comparison value [5] if(main::b!=rangelast(0,$a)) goto main::@1 to $b
|
2020-06-27 20:36:52 +00:00
|
|
|
Removing unused procedure __start
|
|
|
|
Removing unused procedure block __start
|
|
|
|
Removing unused procedure block __start::@1
|
|
|
|
Removing unused procedure block __start::@return
|
2020-06-27 19:18:00 +00:00
|
|
|
Successful SSA optimization PassNEliminateEmptyStart
|
2020-10-05 20:58:02 +00:00
|
|
|
Adding number conversion cast (unumber) $b in [4] if(main::b!=$b) goto main::@1
|
2019-05-30 20:29:04 +00:00
|
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
|
|
Simplifying constant integer cast $b
|
|
|
|
Successful SSA optimization PassNCastSimplification
|
2020-12-11 23:01:15 +00:00
|
|
|
Finalized unsigned number type (byte) $b
|
2019-05-30 20:29:04 +00:00
|
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
2018-02-03 12:20:34 +00:00
|
|
|
CALL GRAPH
|
|
|
|
|
2020-02-06 17:07:56 +00:00
|
|
|
Created 0 initial phi equivalence classes
|
|
|
|
Coalesced down to 0 phi equivalence classes
|
2018-02-03 12:20:34 +00:00
|
|
|
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
2019-09-18 21:00:30 +00:00
|
|
|
|
2020-10-05 20:58:02 +00:00
|
|
|
void main()
|
2020-06-27 19:18:00 +00:00
|
|
|
main: scope:[main] from
|
2020-10-05 20:58:02 +00:00
|
|
|
[0] main::b = 0
|
2018-02-03 12:20:34 +00:00
|
|
|
to:main::@1
|
|
|
|
main::@1: scope:[main] from main main::@1
|
2020-10-05 20:58:02 +00:00
|
|
|
[1] main::c#0 = *main::bp + 1
|
|
|
|
[2] main::SCREEN[main::b] = main::c#0
|
|
|
|
[3] main::b = ++ main::b
|
|
|
|
[4] if(main::b!=$b) goto main::@1
|
2018-02-03 12:20:34 +00:00
|
|
|
to:main::@return
|
|
|
|
main::@return: scope:[main] from main::@1
|
2020-06-27 19:18:00 +00:00
|
|
|
[5] return
|
2018-02-03 12:20:34 +00:00
|
|
|
to:@return
|
|
|
|
|
|
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
2020-10-05 20:58:02 +00:00
|
|
|
void main()
|
|
|
|
volatile byte main::b loadstore 9.200000000000001
|
|
|
|
byte main::c
|
|
|
|
byte main::c#0 22.0
|
2018-02-03 12:20:34 +00:00
|
|
|
|
|
|
|
Initial phi equivalence classes
|
2020-02-06 17:07:56 +00:00
|
|
|
Added variable main::b to live range equivalence class [ main::b ]
|
2019-12-08 15:04:35 +00:00
|
|
|
Added variable main::c#0 to live range equivalence class [ main::c#0 ]
|
2018-02-03 12:20:34 +00:00
|
|
|
Complete equivalence classes
|
2020-02-06 17:07:56 +00:00
|
|
|
[ main::b ]
|
2018-02-03 12:20:34 +00:00
|
|
|
[ main::c#0 ]
|
2020-02-06 17:07:56 +00:00
|
|
|
Allocated zp[1]:2 [ main::b ]
|
2019-10-12 09:40:36 +00:00
|
|
|
Allocated zp[1]:3 [ main::c#0 ]
|
2018-02-03 12:20:34 +00:00
|
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
2020-10-05 20:58:02 +00:00
|
|
|
Statement [0] main::b = 0 [ main::b ] ( [ main::b ] { } ) always clobbers reg byte a
|
|
|
|
Statement [2] main::SCREEN[main::b] = main::c#0 [ main::b ] ( [ main::b ] { } ) always clobbers reg byte y
|
|
|
|
Statement [4] if(main::b!=$b) goto main::@1 [ main::b ] ( [ main::b ] { } ) always clobbers reg byte a
|
2020-02-06 17:07:56 +00:00
|
|
|
Potential registers zp[1]:2 [ main::b ] : zp[1]:2 ,
|
2019-10-12 09:40:36 +00:00
|
|
|
Potential registers zp[1]:3 [ main::c#0 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y ,
|
2018-02-03 12:20:34 +00:00
|
|
|
|
|
|
|
REGISTER UPLIFT SCOPES
|
2020-06-27 19:18:00 +00:00
|
|
|
Uplift Scope [main] 22: zp[1]:3 [ main::c#0 ] 9.2: zp[1]:2 [ main::b ]
|
2018-02-03 12:20:34 +00:00
|
|
|
Uplift Scope []
|
|
|
|
|
2020-06-27 19:18:00 +00:00
|
|
|
Uplifting [main] best 319 combination reg byte a [ main::c#0 ] zp[1]:2 [ main::b ]
|
|
|
|
Uplifting [] best 319 combination
|
2020-02-06 17:07:56 +00:00
|
|
|
Attempting to uplift remaining variables inzp[1]:2 [ main::b ]
|
2020-06-27 19:18:00 +00:00
|
|
|
Uplifting [main] best 319 combination zp[1]:2 [ main::b ]
|
2018-02-03 12:20:34 +00:00
|
|
|
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Comments
|
2019-06-16 13:03:23 +00:00
|
|
|
// Test address-of - use the pointer to get the value
|
2019-07-25 15:06:17 +00:00
|
|
|
// Upstart
|
2020-12-21 07:57:41 +00:00
|
|
|
// Commodore 64 PRG executable file
|
|
|
|
.file [name="address-of-0.prg", type="prg", segments="Program"]
|
|
|
|
.segmentdef Program [segments="Basic, Code, Data"]
|
|
|
|
.segmentdef Basic [start=$0801]
|
|
|
|
.segmentdef Code [start=$80d]
|
|
|
|
.segmentdef Data [startAfter="Code"]
|
|
|
|
.segment Basic
|
2020-05-11 00:36:37 +00:00
|
|
|
:BasicUpstart(main)
|
2019-07-08 14:43:09 +00:00
|
|
|
// Global Constants & labels
|
2020-12-21 07:57:41 +00:00
|
|
|
.segment Code
|
2019-07-08 14:43:09 +00:00
|
|
|
// main
|
2018-02-03 12:20:34 +00:00
|
|
|
main: {
|
|
|
|
.label SCREEN = $400
|
|
|
|
.label bp = b
|
|
|
|
.label b = 2
|
2020-10-05 20:58:02 +00:00
|
|
|
// [0] main::b = 0 -- vbuz1=vbuc1
|
2018-02-03 12:20:34 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z b
|
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:
|
2020-10-05 20:58:02 +00:00
|
|
|
// [1] main::c#0 = *main::bp + 1 -- vbuaa=_deref_pbuc1_plus_1
|
2019-09-01 20:06:32 +00:00
|
|
|
lda.z bp
|
2018-02-03 12:20:34 +00:00
|
|
|
clc
|
|
|
|
adc #1
|
2020-10-05 20:58:02 +00:00
|
|
|
// [2] main::SCREEN[main::b] = main::c#0 -- pbuc1_derefidx_vbuz1=vbuaa
|
2019-08-07 19:00:19 +00:00
|
|
|
ldy.z b
|
2018-02-03 12:20:34 +00:00
|
|
|
sta SCREEN,y
|
2020-10-05 20:58:02 +00:00
|
|
|
// [3] main::b = ++ main::b -- vbuz1=_inc_vbuz1
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z b
|
2020-10-05 20:58:02 +00:00
|
|
|
// [4] if(main::b!=$b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$b
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z b
|
2020-02-06 17:07:56 +00:00
|
|
|
bne __b1
|
2019-09-29 21:13:37 +00:00
|
|
|
jmp __breturn
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@return
|
2019-09-29 21:13:37 +00:00
|
|
|
__breturn:
|
2020-06-27 19:18:00 +00:00
|
|
|
// [5] return
|
2018-02-03 12:20:34 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Data
|
2018-02-03 12:20:34 +00:00
|
|
|
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction jmp __b1
|
|
|
|
Removing instruction jmp __breturn
|
2018-02-03 12:20:34 +00:00
|
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction __breturn:
|
2018-02-03 12:20:34 +00:00
|
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
|
|
|
|
FINAL SYMBOL TABLE
|
2020-10-05 20:58:02 +00:00
|
|
|
void main()
|
2021-04-30 15:26:46 +00:00
|
|
|
constant byte* main::SCREEN = (byte*) 1024
|
2020-10-05 20:58:02 +00:00
|
|
|
volatile byte main::b loadstore zp[1]:2 9.200000000000001
|
2021-04-30 15:26:46 +00:00
|
|
|
constant byte* main::bp = &main::b
|
2020-10-05 20:58:02 +00:00
|
|
|
byte main::c
|
|
|
|
byte main::c#0 reg byte a 22.0
|
2018-02-03 12:20:34 +00:00
|
|
|
|
2020-02-06 17:07:56 +00:00
|
|
|
zp[1]:2 [ main::b ]
|
2018-02-03 12:20:34 +00:00
|
|
|
reg byte a [ main::c#0 ]
|
|
|
|
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
2019-09-01 20:06:32 +00:00
|
|
|
Score: 286
|
2018-02-03 12:20:34 +00:00
|
|
|
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Comments
|
2019-06-16 13:03:23 +00:00
|
|
|
// Test address-of - use the pointer to get the value
|
2019-07-25 15:06:17 +00:00
|
|
|
// Upstart
|
2020-12-21 07:57:41 +00:00
|
|
|
// Commodore 64 PRG executable file
|
|
|
|
.file [name="address-of-0.prg", type="prg", segments="Program"]
|
|
|
|
.segmentdef Program [segments="Basic, Code, Data"]
|
|
|
|
.segmentdef Basic [start=$0801]
|
|
|
|
.segmentdef Code [start=$80d]
|
|
|
|
.segmentdef Data [startAfter="Code"]
|
|
|
|
.segment Basic
|
2018-02-03 12:20:34 +00:00
|
|
|
:BasicUpstart(main)
|
2019-07-08 14:43:09 +00:00
|
|
|
// Global Constants & labels
|
2020-12-21 07:57:41 +00:00
|
|
|
.segment Code
|
2019-07-08 14:43:09 +00:00
|
|
|
// main
|
2018-02-03 12:20:34 +00:00
|
|
|
main: {
|
|
|
|
.label SCREEN = $400
|
|
|
|
.label bp = b
|
|
|
|
.label b = 2
|
2019-07-08 14:43:09 +00:00
|
|
|
// for( byte b: 0..10)
|
2020-10-05 20:58:02 +00:00
|
|
|
// [0] main::b = 0 -- vbuz1=vbuc1
|
2018-02-03 12:20:34 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z b
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@1
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2021-05-02 12:28:03 +00:00
|
|
|
// byte c = *bp +1
|
2020-10-05 20:58:02 +00:00
|
|
|
// [1] main::c#0 = *main::bp + 1 -- vbuaa=_deref_pbuc1_plus_1
|
2019-09-01 20:06:32 +00:00
|
|
|
lda.z bp
|
2018-02-03 12:20:34 +00:00
|
|
|
clc
|
|
|
|
adc #1
|
2019-07-08 14:43:09 +00:00
|
|
|
// SCREEN[b] = c
|
2020-10-05 20:58:02 +00:00
|
|
|
// [2] main::SCREEN[main::b] = main::c#0 -- pbuc1_derefidx_vbuz1=vbuaa
|
2019-08-07 19:00:19 +00:00
|
|
|
ldy.z b
|
2018-02-03 12:20:34 +00:00
|
|
|
sta SCREEN,y
|
2019-07-08 14:43:09 +00:00
|
|
|
// for( byte b: 0..10)
|
2020-10-05 20:58:02 +00:00
|
|
|
// [3] main::b = ++ main::b -- vbuz1=_inc_vbuz1
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z b
|
2020-10-05 20:58:02 +00:00
|
|
|
// [4] if(main::b!=$b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$b
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z b
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b1
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@return
|
|
|
|
// }
|
2020-06-27 19:18:00 +00:00
|
|
|
// [5] return
|
2018-02-03 12:20:34 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Data
|
2018-02-03 12:20:34 +00:00
|
|
|
|