mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-06-29 09:29:31 +00:00
196 lines
5.2 KiB
Plaintext
196 lines
5.2 KiB
Plaintext
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
void main()
|
|
main: scope:[main] from __start
|
|
main::$0 = main::y + 1
|
|
main::p_x#0 = main::x
|
|
main::p_y#0 = main::$0
|
|
main::SCREEN[0] = main::p_x#0
|
|
main::SCREEN[1] = main::p_y#0
|
|
to:main::@return
|
|
main::@return: scope:[main] from main
|
|
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()
|
|
number~ main::$0
|
|
constant byte* const main::SCREEN = (byte*)$400
|
|
byte main::p_x
|
|
byte main::p_x#0
|
|
byte main::p_y
|
|
byte main::p_y#0
|
|
constant byte main::x = 2
|
|
constant byte main::y = 3
|
|
|
|
Adding number conversion cast (unumber) 1 in main::$0 = main::y + 1
|
|
Adding number conversion cast (unumber) main::$0 in main::$0 = main::y + (unumber)1
|
|
Adding number conversion cast (unumber) 0 in main::SCREEN[0] = main::p_x#0
|
|
Adding number conversion cast (unumber) 1 in main::SCREEN[1] = main::p_y#0
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
Simplifying constant pointer cast (byte*) 1024
|
|
Simplifying constant integer cast 1
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast 1
|
|
Successful SSA optimization PassNCastSimplification
|
|
Finalized unsigned number type (byte) 1
|
|
Finalized unsigned number type (byte) 0
|
|
Finalized unsigned number type (byte) 1
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
|
Inferred type updated to byte in main::$0 = main::y + 1
|
|
Alias main::p_y#0 = main::$0
|
|
Successful SSA optimization Pass2AliasElimination
|
|
Constant right-side identified [0] main::p_y#0 = main::y + 1
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::p_y#0 = main::y+1
|
|
Constant main::p_x#0 = main::x
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Simplifying expression containing zero main::SCREEN in [2] main::SCREEN[0] = main::p_x#0
|
|
Successful SSA optimization PassNSimplifyExpressionWithZero
|
|
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::p_x#0 = main::x
|
|
Successful SSA optimization Pass2ConstantInlining
|
|
Consolidated array index constant in *(main::SCREEN+1)
|
|
Successful SSA optimization Pass2ConstantAdditionElimination
|
|
CALL GRAPH
|
|
|
|
Created 0 initial phi equivalence classes
|
|
Coalesced down to 0 phi equivalence classes
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
|
|
|
void main()
|
|
main: scope:[main] from
|
|
[0] *main::SCREEN = main::x
|
|
[1] *(main::SCREEN+1) = main::p_y#0
|
|
to:main::@return
|
|
main::@return: scope:[main] from main
|
|
[2] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
void main()
|
|
byte main::p_x
|
|
byte main::p_y
|
|
|
|
Initial phi equivalence classes
|
|
Complete equivalence classes
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [0] *main::SCREEN = main::x [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [1] *(main::SCREEN+1) = main::p_y#0 [ ] ( [ ] { } ) always clobbers reg byte a
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [Point]
|
|
Uplift Scope [main]
|
|
Uplift Scope []
|
|
|
|
Uplifting [Point] best 21 combination
|
|
Uplifting [main] best 21 combination
|
|
Uplifting [] best 21 combination
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// Minimal struct - initializing using a value list
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="struct-4.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 x = 2
|
|
.const y = 3
|
|
.const p_y = y+1
|
|
.label SCREEN = $400
|
|
// [0] *main::SCREEN = main::x -- _deref_pbuc1=vbuc2
|
|
lda #x
|
|
sta SCREEN
|
|
// [1] *(main::SCREEN+1) = main::p_y#0 -- _deref_pbuc1=vbuc2
|
|
lda #p_y
|
|
sta SCREEN+1
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [2] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
Removing instruction jmp __breturn
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
Removing instruction __breturn:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
FINAL SYMBOL TABLE
|
|
void main()
|
|
constant byte* const main::SCREEN = (byte*) 1024
|
|
byte main::p_x
|
|
byte main::p_y
|
|
constant byte main::p_y#0 p_y = main::y+1
|
|
constant byte main::x = 2
|
|
constant byte main::y = 3
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 18
|
|
|
|
// File Comments
|
|
// Minimal struct - initializing using a value list
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="struct-4.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 x = 2
|
|
.const y = 3
|
|
.const p_y = y+1
|
|
.label SCREEN = $400
|
|
// SCREEN[0] = p.x
|
|
// [0] *main::SCREEN = main::x -- _deref_pbuc1=vbuc2
|
|
lda #x
|
|
sta SCREEN
|
|
// SCREEN[1] = p.y
|
|
// [1] *(main::SCREEN+1) = main::p_y#0 -- _deref_pbuc1=vbuc2
|
|
lda #p_y
|
|
sta SCREEN+1
|
|
// main::@return
|
|
// }
|
|
// [2] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|