1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-16 21:07:56 +00:00
kickc/src/test/ref/address-of-0.log

235 lines
6.6 KiB
Plaintext
Raw Normal View History

2020-10-05 20:58:02 +00:00
Setting inferred volatile on symbol affected by address-of main::bp = &main::b
2018-08-22 22:24:32 +00:00
CONTROL FLOW GRAPH SSA
2020-10-05 20:58:02 +00:00
void main()
main: scope:[main] from __start
2020-10-05 20:58:02 +00:00
main::b = 0
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
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()
__start: scope:[__start] from
call main
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
SYMBOL TABLE SSA
2020-10-05 20:58:02 +00:00
void __start()
void main()
number~ main::$0
bool~ main::$1
constant byte* main::SCREEN = (byte*)$400
2020-10-05 20:58:02 +00:00
volatile byte main::b loadstore
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
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
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
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
Finalized unsigned number type (byte) $b
2019-05-30 20:29:04 +00:00
Successful SSA optimization PassNFinalizeNumberTypeConversions
CALL GRAPH
2020-02-06 17:07:56 +00:00
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
FINAL CONTROL FLOW GRAPH
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
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
to:main::@return
main::@return: scope:[main] from main::@1
2020-06-27 19:18:00 +00:00
[5] return
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
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 ]
Complete equivalence classes
2020-02-06 17:07:56 +00:00
[ main::b ]
[ 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 ]
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 ,
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 ]
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 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test address-of - use the pointer to get the value
// Upstart
// 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
:BasicUpstart(main)
// Global Constants & labels
.segment Code
// main
main: {
.label SCREEN = $400
.label bp = b
.label b = 2
2020-10-05 20:58:02 +00:00
// [0] main::b = 0 -- vbuz1=vbuc1
lda #0
sta.z b
jmp __b1
// main::@1
__b1:
2020-10-05 20:58:02 +00:00
// [1] main::c#0 = *main::bp + 1 -- vbuaa=_deref_pbuc1_plus_1
lda.z bp
clc
adc #1
2020-10-05 20:58:02 +00:00
// [2] main::SCREEN[main::b] = main::c#0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy.z b
sta SCREEN,y
2020-10-05 20:58:02 +00:00
// [3] main::b = ++ main::b -- vbuz1=_inc_vbuz1
inc.z b
2020-10-05 20:58:02 +00:00
// [4] if(main::b!=$b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #$b
cmp.z b
2020-02-06 17:07:56 +00:00
bne __b1
jmp __breturn
// main::@return
__breturn:
2020-06-27 19:18:00 +00:00
// [5] return
rts
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
2020-10-05 20:58:02 +00:00
void main()
constant byte* main::SCREEN = (byte*) 1024
2020-10-05 20:58:02 +00:00
volatile byte main::b loadstore zp[1]:2 9.200000000000001
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
2020-02-06 17:07:56 +00:00
zp[1]:2 [ main::b ]
reg byte a [ main::c#0 ]
FINAL ASSEMBLER
Score: 286
// File Comments
// Test address-of - use the pointer to get the value
// Upstart
// 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
:BasicUpstart(main)
// Global Constants & labels
.segment Code
// main
main: {
.label SCREEN = $400
.label bp = b
.label b = 2
// for( byte b: 0..10)
2020-10-05 20:58:02 +00:00
// [0] main::b = 0 -- vbuz1=vbuc1
lda #0
sta.z b
// main::@1
__b1:
// byte c = *bp +1
2020-10-05 20:58:02 +00:00
// [1] main::c#0 = *main::bp + 1 -- vbuaa=_deref_pbuc1_plus_1
lda.z bp
clc
adc #1
// SCREEN[b] = c
2020-10-05 20:58:02 +00:00
// [2] main::SCREEN[main::b] = main::c#0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy.z b
sta SCREEN,y
// for( byte b: 0..10)
2020-10-05 20:58:02 +00:00
// [3] main::b = ++ main::b -- vbuz1=_inc_vbuz1
inc.z b
2020-10-05 20:58:02 +00:00
// [4] if(main::b!=$b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #$b
cmp.z b
bne __b1
// main::@return
// }
2020-06-27 19:18:00 +00:00
// [5] return
rts
}
// File Data