2020-06-27 20:36:52 +00:00
|
|
|
Inlined call call __init
|
2019-12-25 16:37:44 +00:00
|
|
|
|
|
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
|
2020-10-05 20:58:02 +00:00
|
|
|
void main()
|
2020-06-27 20:36:52 +00:00
|
|
|
main: scope:[main] from __start::@1
|
2019-12-25 16:37:44 +00:00
|
|
|
to:main::@1
|
|
|
|
main::@1: scope:[main] from main main::@2
|
2020-10-05 20:58:02 +00:00
|
|
|
main::$0 = i < 7
|
|
|
|
if(main::$0) goto main::@2
|
2019-12-25 16:37:44 +00:00
|
|
|
to:main::@return
|
|
|
|
main::@2: scope:[main] from main::@1
|
2020-10-05 20:58:02 +00:00
|
|
|
SCREEN[i] = i
|
|
|
|
i = ++ i
|
2019-12-25 16:37:44 +00:00
|
|
|
to:main::@1
|
|
|
|
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
|
|
|
|
to:__start::__init1
|
|
|
|
__start::__init1: scope:[__start] from __start
|
2020-10-05 20:58:02 +00:00
|
|
|
i = 3
|
2020-06-27 20:36:52 +00:00
|
|
|
to:__start::@1
|
|
|
|
__start::@1: scope:[__start] from __start::__init1
|
2019-12-25 16:37:44 +00:00
|
|
|
call main
|
2020-06-27 20:36:52 +00:00
|
|
|
to:__start::@2
|
|
|
|
__start::@2: scope:[__start] from __start::@1
|
|
|
|
to:__start::@return
|
|
|
|
__start::@return: scope:[__start] from __start::@2
|
2020-06-27 19:18:00 +00:00
|
|
|
return
|
|
|
|
to:@return
|
2019-12-25 16:37:44 +00:00
|
|
|
|
|
|
|
SYMBOL TABLE SSA
|
2020-10-05 20:58:02 +00:00
|
|
|
const nomodify byte* SCREEN = (byte*)$400
|
|
|
|
void __start()
|
|
|
|
volatile byte i loadstore
|
|
|
|
void main()
|
|
|
|
bool~ main::$0
|
2019-12-25 16:37:44 +00:00
|
|
|
|
2020-10-05 20:58:02 +00:00
|
|
|
Adding number conversion cast (unumber) 7 in main::$0 = i < 7
|
2019-12-25 16:37:44 +00:00
|
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
|
|
Simplifying constant pointer cast (byte*) 1024
|
|
|
|
Simplifying constant integer cast 7
|
|
|
|
Successful SSA optimization PassNCastSimplification
|
2020-10-05 20:58:02 +00:00
|
|
|
Finalized unsigned number type 7
|
2019-12-25 16:37:44 +00:00
|
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
2020-10-05 20:58:02 +00:00
|
|
|
Simple Condition main::$0 [1] if(i<7) goto main::@2
|
2019-12-25 16:37:44 +00:00
|
|
|
Successful SSA optimization Pass2ConditionalJumpSimplification
|
2020-06-27 20:36:52 +00:00
|
|
|
Adding NOP phi() at start of __start
|
|
|
|
Adding NOP phi() at start of __start::@1
|
|
|
|
Adding NOP phi() at start of __start::@2
|
2019-12-25 16:37:44 +00:00
|
|
|
Adding NOP phi() at start of main
|
|
|
|
CALL GRAPH
|
2020-06-27 20:36:52 +00:00
|
|
|
Calls in [__start] to main:3
|
2019-12-25 16:37:44 +00:00
|
|
|
|
|
|
|
Created 0 initial phi equivalence classes
|
|
|
|
Coalesced down to 0 phi equivalence classes
|
2020-10-05 20:58:02 +00:00
|
|
|
Culled Empty Block label __start::@2
|
2020-06-27 20:36:52 +00:00
|
|
|
Adding NOP phi() at start of __start
|
|
|
|
Adding NOP phi() at start of __start::@1
|
2019-12-25 16:37:44 +00:00
|
|
|
Adding NOP phi() at start of main
|
|
|
|
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
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
|
2020-06-27 19:18:00 +00:00
|
|
|
[0] phi()
|
2020-06-27 20:36:52 +00:00
|
|
|
to:__start::__init1
|
|
|
|
__start::__init1: scope:[__start] from __start
|
2020-10-05 20:58:02 +00:00
|
|
|
[1] i = 3
|
2020-06-27 20:36:52 +00:00
|
|
|
to:__start::@1
|
|
|
|
__start::@1: scope:[__start] from __start::__init1
|
2020-06-27 19:18:00 +00:00
|
|
|
[2] phi()
|
|
|
|
[3] call main
|
2020-06-27 20:36:52 +00:00
|
|
|
to:__start::@return
|
|
|
|
__start::@return: scope:[__start] from __start::@1
|
2020-06-27 19:18:00 +00:00
|
|
|
[4] return
|
|
|
|
to:@return
|
2019-12-25 16:37:44 +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::@1
|
2020-06-27 19:18:00 +00:00
|
|
|
[5] phi()
|
2019-12-25 16:37:44 +00:00
|
|
|
to:main::@1
|
|
|
|
main::@1: scope:[main] from main main::@2
|
2020-10-05 20:58:02 +00:00
|
|
|
[6] if(i<7) goto main::@2
|
2019-12-25 16:37:44 +00:00
|
|
|
to:main::@return
|
|
|
|
main::@return: scope:[main] from main::@1
|
2020-06-27 19:18:00 +00:00
|
|
|
[7] return
|
2019-12-25 16:37:44 +00:00
|
|
|
to:@return
|
|
|
|
main::@2: scope:[main] from main::@1
|
2020-10-05 20:58:02 +00:00
|
|
|
[8] SCREEN[i] = i
|
|
|
|
[9] i = ++ i
|
2019-12-25 16:37:44 +00:00
|
|
|
to:main::@1
|
|
|
|
|
|
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
2020-10-05 20:58:02 +00:00
|
|
|
void __start()
|
|
|
|
volatile byte i loadstore 84.49999999999999
|
|
|
|
void main()
|
2019-12-25 16:37:44 +00:00
|
|
|
|
|
|
|
Initial phi equivalence classes
|
|
|
|
Added variable i to live range equivalence class [ i ]
|
|
|
|
Complete equivalence classes
|
|
|
|
[ i ]
|
|
|
|
Allocated zp[1]:2 [ i ]
|
|
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
2020-10-05 20:58:02 +00:00
|
|
|
Statement [1] i = 3 [ i ] ( [ i ] { } ) always clobbers reg byte a
|
|
|
|
Statement [6] if(i<7) goto main::@2 [ i ] ( main:3 [ i ] { } ) always clobbers reg byte a
|
|
|
|
Statement [8] SCREEN[i] = i [ i ] ( main:3 [ i ] { } ) always clobbers reg byte a reg byte y
|
2019-12-25 16:37:44 +00:00
|
|
|
Potential registers zp[1]:2 [ i ] : zp[1]:2 ,
|
|
|
|
|
|
|
|
REGISTER UPLIFT SCOPES
|
2020-03-22 21:26:39 +00:00
|
|
|
Uplift Scope [] 84.5: zp[1]:2 [ i ]
|
2019-12-25 16:37:44 +00:00
|
|
|
Uplift Scope [main]
|
2020-06-27 20:36:52 +00:00
|
|
|
Uplift Scope [__start]
|
2019-12-25 16:37:44 +00:00
|
|
|
|
2020-06-27 19:18:00 +00:00
|
|
|
Uplifting [] best 374 combination zp[1]:2 [ i ]
|
|
|
|
Uplifting [main] best 374 combination
|
2020-06-27 20:36:52 +00:00
|
|
|
Uplifting [__start] best 374 combination
|
2019-12-25 16:37:44 +00:00
|
|
|
Attempting to uplift remaining variables inzp[1]:2 [ i ]
|
2020-06-27 19:18:00 +00:00
|
|
|
Uplifting [] best 374 combination zp[1]:2 [ i ]
|
2019-12-25 16:37:44 +00:00
|
|
|
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
|
|
// File Comments
|
|
|
|
// Test that volatile vars are turned into load/store
|
|
|
|
// Upstart
|
|
|
|
.pc = $801 "Basic"
|
2020-06-27 20:36:52 +00:00
|
|
|
:BasicUpstart(__start)
|
2019-12-25 16:37:44 +00:00
|
|
|
.pc = $80d "Program"
|
|
|
|
// Global Constants & labels
|
|
|
|
.label SCREEN = $400
|
|
|
|
.label i = 2
|
2020-06-27 20:36:52 +00:00
|
|
|
// __start
|
|
|
|
__start: {
|
|
|
|
jmp __init1
|
|
|
|
// __start::__init1
|
|
|
|
__init1:
|
2020-10-05 20:58:02 +00:00
|
|
|
// [1] i = 3 -- vbuz1=vbuc1
|
2020-06-27 19:18:00 +00:00
|
|
|
lda #3
|
|
|
|
sta.z i
|
2020-06-27 20:36:52 +00:00
|
|
|
// [2] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
|
|
|
|
__b1_from___init1:
|
2020-06-27 19:18:00 +00:00
|
|
|
jmp __b1
|
2020-06-27 20:36:52 +00:00
|
|
|
// __start::@1
|
2020-06-27 19:18:00 +00:00
|
|
|
__b1:
|
|
|
|
// [3] call main
|
2020-06-27 20:36:52 +00:00
|
|
|
// [5] phi from __start::@1 to main [phi:__start::@1->main]
|
2020-06-27 19:18:00 +00:00
|
|
|
main_from___b1:
|
|
|
|
jsr main
|
|
|
|
jmp __breturn
|
2020-06-27 20:36:52 +00:00
|
|
|
// __start::@return
|
2020-06-27 19:18:00 +00:00
|
|
|
__breturn:
|
|
|
|
// [4] return
|
|
|
|
rts
|
|
|
|
}
|
2019-12-25 16:37:44 +00:00
|
|
|
// main
|
|
|
|
main: {
|
|
|
|
jmp __b1
|
|
|
|
// main::@1
|
|
|
|
__b1:
|
2020-10-05 20:58:02 +00:00
|
|
|
// [6] if(i<7) goto main::@2 -- vbuz1_lt_vbuc1_then_la1
|
2019-12-25 16:37:44 +00:00
|
|
|
lda.z i
|
|
|
|
cmp #7
|
|
|
|
bcc __b2
|
|
|
|
jmp __breturn
|
|
|
|
// main::@return
|
|
|
|
__breturn:
|
2020-06-27 19:18:00 +00:00
|
|
|
// [7] return
|
2019-12-25 16:37:44 +00:00
|
|
|
rts
|
|
|
|
// main::@2
|
|
|
|
__b2:
|
2020-10-05 20:58:02 +00:00
|
|
|
// [8] SCREEN[i] = i -- pbuc1_derefidx_vbuz1=vbuz1
|
2019-12-25 16:37:44 +00:00
|
|
|
ldy.z i
|
|
|
|
tya
|
|
|
|
sta SCREEN,y
|
2020-10-05 20:58:02 +00:00
|
|
|
// [9] i = ++ i -- vbuz1=_inc_vbuz1
|
2019-12-25 16:37:44 +00:00
|
|
|
inc.z i
|
|
|
|
jmp __b1
|
|
|
|
}
|
|
|
|
// File Data
|
|
|
|
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
2020-06-27 20:36:52 +00:00
|
|
|
Removing instruction jmp __init1
|
2019-12-25 16:37:44 +00:00
|
|
|
Removing instruction jmp __b1
|
2020-06-27 19:18:00 +00:00
|
|
|
Removing instruction jmp __breturn
|
2019-12-25 16:37:44 +00:00
|
|
|
Removing instruction jmp __b1
|
|
|
|
Removing instruction jmp __breturn
|
|
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
2020-06-27 20:36:52 +00:00
|
|
|
Removing instruction __b1_from___init1:
|
2019-12-25 16:37:44 +00:00
|
|
|
Removing instruction main_from___b1:
|
|
|
|
Succesful ASM optimization Pass5RedundantLabelElimination
|
2020-06-27 20:36:52 +00:00
|
|
|
Removing instruction __init1:
|
2019-12-25 16:37:44 +00:00
|
|
|
Removing instruction __b1:
|
2020-06-27 19:18:00 +00:00
|
|
|
Removing instruction __breturn:
|
2019-12-25 16:37:44 +00:00
|
|
|
Removing instruction __breturn:
|
|
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
|
|
|
|
FINAL SYMBOL TABLE
|
2020-10-05 20:58:02 +00:00
|
|
|
const nomodify byte* SCREEN = (byte*) 1024
|
|
|
|
void __start()
|
|
|
|
volatile byte i loadstore zp[1]:2 84.49999999999999
|
|
|
|
void main()
|
2019-12-25 16:37:44 +00:00
|
|
|
|
|
|
|
zp[1]:2 [ i ]
|
|
|
|
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
|
|
Score: 278
|
|
|
|
|
|
|
|
// File Comments
|
|
|
|
// Test that volatile vars are turned into load/store
|
|
|
|
// Upstart
|
|
|
|
.pc = $801 "Basic"
|
2020-06-27 20:36:52 +00:00
|
|
|
:BasicUpstart(__start)
|
2019-12-25 16:37:44 +00:00
|
|
|
.pc = $80d "Program"
|
|
|
|
// Global Constants & labels
|
|
|
|
.label SCREEN = $400
|
|
|
|
.label i = 2
|
2020-06-27 20:36:52 +00:00
|
|
|
// __start
|
|
|
|
__start: {
|
|
|
|
// __start::__init1
|
2020-06-27 19:18:00 +00:00
|
|
|
// i = 3
|
2020-10-05 20:58:02 +00:00
|
|
|
// [1] i = 3 -- vbuz1=vbuc1
|
2020-06-27 19:18:00 +00:00
|
|
|
lda #3
|
|
|
|
sta.z i
|
2020-06-27 20:36:52 +00:00
|
|
|
// [2] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
|
|
|
|
// __start::@1
|
2020-06-27 19:18:00 +00:00
|
|
|
// [3] call main
|
2020-06-27 20:36:52 +00:00
|
|
|
// [5] phi from __start::@1 to main [phi:__start::@1->main]
|
2020-06-27 19:18:00 +00:00
|
|
|
jsr main
|
2020-06-27 20:36:52 +00:00
|
|
|
// __start::@return
|
2020-06-27 19:18:00 +00:00
|
|
|
// [4] return
|
|
|
|
rts
|
|
|
|
}
|
2019-12-25 16:37:44 +00:00
|
|
|
// main
|
|
|
|
main: {
|
|
|
|
// main::@1
|
|
|
|
__b1:
|
|
|
|
// while(i<7)
|
2020-10-05 20:58:02 +00:00
|
|
|
// [6] if(i<7) goto main::@2 -- vbuz1_lt_vbuc1_then_la1
|
2019-12-25 16:37:44 +00:00
|
|
|
lda.z i
|
|
|
|
cmp #7
|
|
|
|
bcc __b2
|
|
|
|
// main::@return
|
|
|
|
// }
|
2020-06-27 19:18:00 +00:00
|
|
|
// [7] return
|
2019-12-25 16:37:44 +00:00
|
|
|
rts
|
|
|
|
// main::@2
|
|
|
|
__b2:
|
|
|
|
// SCREEN[i++] = i
|
2020-10-05 20:58:02 +00:00
|
|
|
// [8] SCREEN[i] = i -- pbuc1_derefidx_vbuz1=vbuz1
|
2019-12-25 16:37:44 +00:00
|
|
|
ldy.z i
|
|
|
|
tya
|
|
|
|
sta SCREEN,y
|
|
|
|
// SCREEN[i++] = i;
|
2020-10-05 20:58:02 +00:00
|
|
|
// [9] i = ++ i -- vbuz1=_inc_vbuz1
|
2019-12-25 16:37:44 +00:00
|
|
|
inc.z i
|
|
|
|
jmp __b1
|
|
|
|
}
|
|
|
|
// File Data
|
|
|
|
|