1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-03 07:29:37 +00:00
kickc/src/test/ref/struct-5.log

310 lines
8.5 KiB
Plaintext
Raw Normal View History

2020-10-05 20:58:02 +00:00
Eliminating unused variable with no statement main::$0
Unwinding list assignment { main::$0_x, main::$0_y } = { point::return_x, point::return_y }
2021-07-26 10:15:15 +00:00
Unwinding list assignment { point::return_x#0, point::return_y#0 } = { point::return_x#3, point::return_y#3 }
2019-05-30 20:29:04 +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::q_x#0 = 0
main::q_y#0 = 0
call point
2021-07-26 10:15:15 +00:00
point::return_x#0 = point::return_x#3
point::return_y#0 = point::return_y#3
2019-05-30 20:29:04 +00:00
to:main::@1
2019-06-09 23:01:36 +00:00
main::@1: scope:[main] from main
2021-07-26 10:15:15 +00:00
point::return_y#2 = phi( main/point::return_y#0 )
point::return_x#2 = phi( main/point::return_x#0 )
main::$0_x = point::return_x#2
main::$0_y = point::return_y#2
2020-10-05 20:58:02 +00:00
main::q_x#1 = main::$0_x
main::q_y#1 = main::$0_y
main::SCREEN[0] = main::q_x#1
main::SCREEN[1] = main::q_y#1
2019-05-30 20:29:04 +00:00
to:main::@return
2019-06-09 23:01:36 +00:00
main::@return: scope:[main] from main::@1
2019-05-30 20:29:04 +00:00
return
to:@return
2020-10-05 20:58:02 +00:00
struct Point point()
2019-06-09 23:01:36 +00:00
point: scope:[point] from main
2020-10-05 20:58:02 +00:00
point::return_x#1 = point::p_x
point::return_y#1 = point::p_y
point::return#0 = struct-unwound {point::return_x#1, point::return_y#1}
2019-06-09 23:01:36 +00:00
to:point::@return
point::@return: scope:[point] from point
2021-07-26 10:15:15 +00:00
point::return_y#3 = phi( point/point::return_y#1 )
point::return_x#3 = phi( point/point::return_x#1 )
point::return#1 = struct-unwound {}
2019-06-09 23:01:36 +00:00
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
2019-05-30 20:29:04 +00:00
SYMBOL TABLE SSA
2020-10-05 20:58:02 +00:00
void __start()
void main()
char main::$0_x
char main::$0_y
__constant char * const main::SCREEN = (char *)$400
char main::q_x
char main::q_x#0
char main::q_x#1
char main::q_y
char main::q_y#0
char main::q_y#1
2020-10-05 20:58:02 +00:00
struct Point point()
__constant char point::p_x = 2
__constant char point::p_y = 3
2020-10-05 20:58:02 +00:00
struct Point point::return
struct Point point::return#0
struct Point point::return#1
char point::return_x
char point::return_x#0
char point::return_x#1
char point::return_x#2
char point::return_x#3
char point::return_y
char point::return_y#0
char point::return_y#1
char point::return_y#2
char point::return_y#3
2019-05-30 20:29:04 +00:00
2020-10-05 20:58:02 +00:00
Adding number conversion cast (unumber) 0 in main::SCREEN[0] = main::q_x#1
Adding number conversion cast (unumber) 1 in main::SCREEN[1] = main::q_y#1
2019-05-30 20:29:04 +00:00
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (char *) 1024
2019-05-30 20:29:04 +00:00
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 1
2019-05-30 20:29:04 +00:00
Successful SSA optimization PassNFinalizeNumberTypeConversions
2021-07-26 10:15:15 +00:00
Alias point::return_x#0 = point::return_x#2
Alias point::return_y#0 = point::return_y#2
Alias main::q_x#1 = main::$0_x
Alias main::q_y#1 = main::$0_y
2021-07-26 10:15:15 +00:00
Alias point::return_x#1 = point::return_x#3
Alias point::return_y#1 = point::return_y#3
2019-05-30 20:29:04 +00:00
Successful SSA optimization Pass2AliasElimination
2020-10-05 20:58:02 +00:00
Constant main::q_x#0 = 0
Constant main::q_y#0 = 0
Constant point::return_x#1 = point::p_x
Constant point::return_y#1 = point::p_y
2019-05-30 20:29:04 +00:00
Successful SSA optimization Pass2ConstantIdentification
2020-10-05 20:58:02 +00:00
Constant point::return_x#0 = point::return_x#1
Constant point::return_y#0 = point::return_y#1
2019-05-30 20:29:04 +00:00
Successful SSA optimization Pass2ConstantIdentification
2020-10-05 20:58:02 +00:00
Constant main::q_x#1 = point::return_x#0
Constant main::q_y#1 = point::return_y#0
2019-06-09 23:01:36 +00:00
Successful SSA optimization Pass2ConstantIdentification
2020-10-05 20:58:02 +00:00
Simplifying expression containing zero main::SCREEN in [7] main::SCREEN[0] = main::q_x#1
2019-06-09 23:01:36 +00:00
Successful SSA optimization PassNSimplifyExpressionWithZero
2020-10-05 20:58:02 +00:00
Eliminating unused variable point::return#0 and assignment [4] point::return#0 = struct-unwound {point::return_x#1, point::return_y#1}
2021-07-26 10:15:15 +00:00
Eliminating unused variable point::return#1 and assignment [5] point::return#1 = struct-unwound {}
2020-10-05 20:58:02 +00:00
Eliminating unused constant main::q_x#0
Eliminating unused constant main::q_y#0
2019-05-30 20:29:04 +00:00
Successful SSA optimization PassNEliminateUnusedVars
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
Constant inlined main::q_x#1 = point::p_x
Constant inlined point::return_y#1 = point::p_y
2020-10-05 20:58:02 +00:00
Constant inlined point::return_x#1 = point::p_x
Constant inlined point::return_y#0 = point::p_y
Constant inlined point::return_x#0 = point::p_x
Constant inlined main::q_y#1 = point::p_y
2019-05-30 20:29:04 +00:00
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(main::SCREEN+1)
2019-06-09 23:01:36 +00:00
Successful SSA optimization Pass2ConstantAdditionElimination
2019-05-30 20:29:04 +00:00
Adding NOP phi() at start of main
2019-06-09 23:01:36 +00:00
Adding NOP phi() at start of point
2019-05-30 20:29:04 +00:00
CALL GRAPH
2020-06-27 19:18:00 +00:00
Calls in [main] to point:1
2019-05-30 20:29:04 +00:00
2019-06-09 23:01:36 +00:00
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
2019-05-30 20:29:04 +00:00
Adding NOP phi() at start of main
2019-06-09 23:01:36 +00:00
Adding NOP phi() at start of point
2019-05-30 20:29:04 +00:00
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
[0] phi()
[1] call point
2019-05-30 20:29:04 +00:00
to:main::@1
2019-06-09 23:01:36 +00:00
main::@1: scope:[main] from main
2020-10-05 20:58:02 +00:00
[2] *main::SCREEN = point::p_x
[3] *(main::SCREEN+1) = point::p_y
2019-05-30 20:29:04 +00:00
to:main::@return
2019-06-09 23:01:36 +00:00
main::@return: scope:[main] from main::@1
2020-06-27 19:18:00 +00:00
[4] return
2019-06-09 23:01:36 +00:00
to:@return
2020-10-05 20:58:02 +00:00
struct Point point()
2019-06-09 23:01:36 +00:00
point: scope:[point] from main
2020-06-27 19:18:00 +00:00
[5] phi()
2019-06-09 23:01:36 +00:00
to:point::@return
point::@return: scope:[point] from point
2020-06-27 19:18:00 +00:00
[6] return
2019-05-30 20:29:04 +00:00
to:@return
VARIABLE REGISTER WEIGHTS
2020-10-05 20:58:02 +00:00
void main()
char main::q_x
char main::q_y
2020-10-05 20:58:02 +00:00
struct Point point()
struct Point point::return
char point::return_x
char point::return_y
2019-05-30 20:29:04 +00:00
Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
2020-10-05 20:58:02 +00:00
Statement [2] *main::SCREEN = point::p_x [ ] ( [ ] { } ) always clobbers reg byte a
Statement [3] *(main::SCREEN+1) = point::p_y [ ] ( [ ] { } ) always clobbers reg byte a
2019-05-30 20:29:04 +00:00
REGISTER UPLIFT SCOPES
Uplift Scope [Point]
2019-06-09 23:01:36 +00:00
Uplift Scope [main]
Uplift Scope [point]
2019-05-30 20:29:04 +00:00
Uplift Scope []
2020-06-27 19:18:00 +00:00
Uplifting [Point] best 66 combination
Uplifting [main] best 66 combination
Uplifting [point] best 66 combination
Uplifting [] best 66 combination
2019-05-30 20:29:04 +00:00
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
2019-06-09 23:01:36 +00:00
// Minimal struct - struct return value
// Upstart
// Commodore 64 PRG executable file
.file [name="struct-5.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
2019-05-30 20:29:04 +00:00
main: {
.label SCREEN = $400
// [1] call point
2020-06-27 19:18:00 +00:00
// [5] phi from main to point [phi:main->point]
2019-06-09 23:01:36 +00:00
point_from_main:
jsr point
jmp __b1
// main::@1
__b1:
2020-10-05 20:58:02 +00:00
// [2] *main::SCREEN = point::p_x -- _deref_pbuc1=vbuc2
2019-06-09 23:01:36 +00:00
lda #point.p_x
sta SCREEN
2020-10-05 20:58:02 +00:00
// [3] *(main::SCREEN+1) = point::p_y -- _deref_pbuc1=vbuc2
2019-06-09 23:01:36 +00:00
lda #point.p_y
sta SCREEN+1
jmp __breturn
// main::@return
__breturn:
2020-06-27 19:18:00 +00:00
// [4] return
2019-06-09 23:01:36 +00:00
rts
}
// point
2019-06-09 23:01:36 +00:00
point: {
.label p_x = 2
.label p_y = 3
jmp __breturn
// point::@return
__breturn:
2020-06-27 19:18:00 +00:00
// [6] return
2019-05-30 20:29:04 +00:00
rts
}
// File Data
2019-05-30 20:29:04 +00:00
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __breturn
2019-05-30 20:29:04 +00:00
Succesful ASM optimization Pass5NextJumpElimination
2019-06-09 23:01:36 +00:00
Removing instruction point_from_main:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __breturn:
2019-05-30 20:29:04 +00:00
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
2020-10-05 20:58:02 +00:00
void main()
__constant char * const main::SCREEN = (char *) 1024
char main::q_x
char main::q_y
2020-10-05 20:58:02 +00:00
struct Point point()
__constant char point::p_x = 2
__constant char point::p_y = 3
2020-10-05 20:58:02 +00:00
struct Point point::return
char point::return_x
char point::return_y
2019-05-30 20:29:04 +00:00
FINAL ASSEMBLER
2019-06-09 23:01:36 +00:00
Score: 30
2019-05-30 20:29:04 +00:00
// File Comments
2019-06-09 23:01:36 +00:00
// Minimal struct - struct return value
// Upstart
// Commodore 64 PRG executable file
.file [name="struct-5.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
2019-05-30 20:29:04 +00:00
:BasicUpstart(main)
// Global Constants & labels
.segment Code
// main
2019-05-30 20:29:04 +00:00
main: {
.label SCREEN = $400
// point()
// [1] call point
2020-06-27 19:18:00 +00:00
// [5] phi from main to point [phi:main->point]
2019-06-09 23:01:36 +00:00
jsr point
// main::@1
// SCREEN[0] = q.x
2020-10-05 20:58:02 +00:00
// [2] *main::SCREEN = point::p_x -- _deref_pbuc1=vbuc2
2019-06-09 23:01:36 +00:00
lda #point.p_x
sta SCREEN
// SCREEN[1] = q.y
2020-10-05 20:58:02 +00:00
// [3] *(main::SCREEN+1) = point::p_y -- _deref_pbuc1=vbuc2
2019-06-09 23:01:36 +00:00
lda #point.p_y
sta SCREEN+1
// main::@return
// }
2020-06-27 19:18:00 +00:00
// [4] return
2019-06-09 23:01:36 +00:00
rts
}
// point
2019-06-09 23:01:36 +00:00
point: {
.label p_x = 2
.label p_y = 3
// point::@return
2020-06-27 19:18:00 +00:00
// [6] return
2019-05-30 20:29:04 +00:00
rts
}
// File Data
2019-05-30 20:29:04 +00:00