mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-06-09 18:29:36 +00:00
211 lines
4.8 KiB
Plaintext
211 lines
4.8 KiB
Plaintext
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
void main()
|
|
main: scope:[main] from __start
|
|
*main::SCREEN = main::state
|
|
call test
|
|
to:main::@1
|
|
main::@1: scope:[main] from main
|
|
to:main::@return
|
|
main::@return: scope:[main] from main::@1
|
|
return
|
|
to:@return
|
|
|
|
void test()
|
|
test: scope:[test] from main
|
|
*test::SCREEN = test::state
|
|
to:test::@return
|
|
test::@return: scope:[test] from test
|
|
return
|
|
to:@return
|
|
|
|
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
|
|
return
|
|
to:@return
|
|
|
|
SYMBOL TABLE SSA
|
|
void __start()
|
|
void main()
|
|
__constant char main::ON = 1
|
|
__constant char * const main::SCREEN = (char *)$400
|
|
__constant char main::state = main::ON
|
|
void test()
|
|
__constant char test::ON = 8
|
|
__constant char * const test::SCREEN = (char *)$428
|
|
__constant char test::state = test::ON
|
|
|
|
Simplifying constant pointer cast (char *) 1024
|
|
Simplifying constant pointer cast (char *) 1064
|
|
Successful SSA optimization PassNCastSimplification
|
|
Removing unused procedure __start
|
|
Removing unused procedure block __start
|
|
Removing unused procedure block __start::@1
|
|
Removing unused procedure block __start::@return
|
|
Successful SSA optimization PassNEliminateEmptyStart
|
|
Constant inlined main::state = main::ON
|
|
Constant inlined test::state = test::ON
|
|
Successful SSA optimization Pass2ConstantInlining
|
|
Adding NOP phi() at start of main::@1
|
|
CALL GRAPH
|
|
Calls in [main] to test:1
|
|
|
|
Created 0 initial phi equivalence classes
|
|
Coalesced down to 0 phi equivalence classes
|
|
Culled Empty Block label main::@1
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
|
|
|
void main()
|
|
main: scope:[main] from
|
|
[0] *main::SCREEN = main::ON
|
|
[1] call test
|
|
to:main::@return
|
|
main::@return: scope:[main] from main
|
|
[2] return
|
|
to:@return
|
|
|
|
void test()
|
|
test: scope:[test] from main
|
|
[3] *test::SCREEN = test::ON
|
|
to:test::@return
|
|
test::@return: scope:[test] from test
|
|
[4] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
void main()
|
|
void test()
|
|
|
|
Initial phi equivalence classes
|
|
Complete equivalence classes
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [0] *main::SCREEN = main::ON [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [3] *test::SCREEN = test::ON [ ] ( test:1 [ ] { } ) always clobbers reg byte a
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [main]
|
|
Uplift Scope [test]
|
|
Uplift Scope []
|
|
|
|
Uplifting [main] best 36 combination
|
|
Uplifting [test] best 36 combination
|
|
Uplifting [] best 36 combination
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// Test of simple enum - multiple inline enum definitions
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="enum-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
|
|
main: {
|
|
.const ON = 1
|
|
.label SCREEN = $400
|
|
// [0] *main::SCREEN = main::ON -- _deref_pbuc1=vbuc2
|
|
lda #ON
|
|
sta SCREEN
|
|
// [1] call test
|
|
jsr test
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [2] return
|
|
rts
|
|
}
|
|
// test
|
|
test: {
|
|
.const ON = 8
|
|
.label SCREEN = $428
|
|
// [3] *test::SCREEN = test::ON -- _deref_pbuc1=vbuc2
|
|
lda #ON
|
|
sta SCREEN
|
|
jmp __breturn
|
|
// test::@return
|
|
__breturn:
|
|
// [4] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __breturn
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
Removing instruction __breturn:
|
|
Removing instruction __breturn:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
FINAL SYMBOL TABLE
|
|
void main()
|
|
__constant char main::ON = 1
|
|
__constant char * const main::SCREEN = (char *) 1024
|
|
void test()
|
|
__constant char test::ON = 8
|
|
__constant char * const test::SCREEN = (char *) 1064
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 30
|
|
|
|
// File Comments
|
|
// Test of simple enum - multiple inline enum definitions
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="enum-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
|
|
main: {
|
|
.const ON = 1
|
|
.label SCREEN = $400
|
|
// *SCREEN = state
|
|
// [0] *main::SCREEN = main::ON -- _deref_pbuc1=vbuc2
|
|
lda #ON
|
|
sta SCREEN
|
|
// test()
|
|
// [1] call test
|
|
jsr test
|
|
// main::@return
|
|
// }
|
|
// [2] return
|
|
rts
|
|
}
|
|
// test
|
|
test: {
|
|
.const ON = 8
|
|
.label SCREEN = $428
|
|
// *SCREEN = state
|
|
// [3] *test::SCREEN = test::ON -- _deref_pbuc1=vbuc2
|
|
lda #ON
|
|
sta SCREEN
|
|
// test::@return
|
|
// }
|
|
// [4] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|