mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-09-29 03:56:15 +00:00
227 lines
6.3 KiB
Plaintext
227 lines
6.3 KiB
Plaintext
Inlined call call __init
|
|
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
void main()
|
|
main: scope:[main] from __start::@1
|
|
b[0] = 'c'
|
|
*SCREEN = b[0]
|
|
main::$0 = SCREEN + 1
|
|
*main::$0 = c[1]
|
|
main::$1 = SCREEN + 2
|
|
*main::$1 = d[2]
|
|
to:main::@return
|
|
main::@return: scope:[main] from main
|
|
return
|
|
to:@return
|
|
|
|
void __start()
|
|
__start: scope:[__start] from
|
|
to:__start::__init1
|
|
__start::__init1: scope:[__start] from __start
|
|
to:__start::@1
|
|
__start::@1: scope:[__start] from __start::__init1
|
|
call main
|
|
to:__start::@2
|
|
__start::@2: scope:[__start] from __start::@1
|
|
to:__start::@return
|
|
__start::@return: scope:[__start] from __start::@2
|
|
return
|
|
to:@return
|
|
|
|
SYMBOL TABLE SSA
|
|
constant byte* SCREEN = (byte*)$400
|
|
void __start()
|
|
constant byte* b[3] = { fill( 3, 0) }
|
|
constant byte* c[] = { 'c', 'm', 'l' }
|
|
constant byte* d[] = "cml"z
|
|
void main()
|
|
byte*~ main::$0
|
|
byte*~ main::$1
|
|
|
|
Adding number conversion cast (unumber) 0 in b[0] = 'c'
|
|
Adding number conversion cast (unumber) 0 in *SCREEN = b[0]
|
|
Adding number conversion cast (unumber) 1 in main::$0 = SCREEN + 1
|
|
Adding number conversion cast (unumber) 1 in *main::$0 = c[1]
|
|
Adding number conversion cast (unumber) 2 in main::$1 = SCREEN + 2
|
|
Adding number conversion cast (unumber) 2 in *main::$1 = d[2]
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
Simplifying constant pointer cast (byte*) 1024
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast 1
|
|
Simplifying constant integer cast 1
|
|
Simplifying constant integer cast 2
|
|
Simplifying constant integer cast 2
|
|
Successful SSA optimization PassNCastSimplification
|
|
Finalized unsigned number type (byte) 0
|
|
Finalized unsigned number type (byte) 0
|
|
Finalized unsigned number type (byte) 1
|
|
Finalized unsigned number type (byte) 1
|
|
Finalized unsigned number type (byte) 2
|
|
Finalized unsigned number type (byte) 2
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
|
Constant right-side identified [2] main::$0 = SCREEN + 1
|
|
Constant right-side identified [4] main::$1 = SCREEN + 2
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::$0 = SCREEN+1
|
|
Constant main::$1 = SCREEN+2
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Simplifying expression containing zero b in [0] b[0] = 'c'
|
|
Simplifying expression containing zero b in [1] *SCREEN = b[0]
|
|
Successful SSA optimization PassNSimplifyExpressionWithZero
|
|
Removing unused procedure __start
|
|
Removing unused procedure block __start
|
|
Removing unused procedure block __start::__init1
|
|
Removing unused procedure block __start::@1
|
|
Removing unused procedure block __start::@2
|
|
Removing unused procedure block __start::@return
|
|
Successful SSA optimization PassNEliminateEmptyStart
|
|
Constant inlined main::$1 = SCREEN+2
|
|
Constant inlined main::$0 = SCREEN+1
|
|
Successful SSA optimization Pass2ConstantInlining
|
|
Consolidated array index constant in *(c+1)
|
|
Consolidated array index constant in *(d+2)
|
|
Successful SSA optimization Pass2ConstantAdditionElimination
|
|
Finalized unsigned number type (byte) 3
|
|
Finalized unsigned number type (byte) 3
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
|
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] *b = 'c'
|
|
[1] *SCREEN = *b
|
|
[2] *(SCREEN+1) = *(c+1)
|
|
[3] *(SCREEN+2) = *(d+2)
|
|
to:main::@return
|
|
main::@return: scope:[main] from main
|
|
[4] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
void main()
|
|
|
|
Initial phi equivalence classes
|
|
Complete equivalence classes
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [0] *b = 'c' [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [1] *SCREEN = *b [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [2] *(SCREEN+1) = *(c+1) [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [3] *(SCREEN+2) = *(d+2) [ ] ( [ ] { } ) always clobbers reg byte a
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [main]
|
|
Uplift Scope []
|
|
|
|
Uplifting [main] best 39 combination
|
|
Uplifting [] best 39 combination
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="arrays-init.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
|
|
.label SCREEN = $400
|
|
.segment Code
|
|
// main
|
|
main: {
|
|
// [0] *b = 'c' -- _deref_pbuc1=vbuc2
|
|
lda #'c'
|
|
sta b
|
|
// [1] *SCREEN = *b -- _deref_pbuc1=_deref_pbuc2
|
|
lda b
|
|
sta SCREEN
|
|
// [2] *(SCREEN+1) = *(c+1) -- _deref_pbuc1=_deref_pbuc2
|
|
lda c+1
|
|
sta SCREEN+1
|
|
// [3] *(SCREEN+2) = *(d+2) -- _deref_pbuc1=_deref_pbuc2
|
|
lda d+2
|
|
sta SCREEN+2
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [4] return
|
|
rts
|
|
}
|
|
// File Data
|
|
.segment Data
|
|
b: .fill 3, 0
|
|
c: .byte 'c', 'm', 'l'
|
|
d: .text "cml"
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
Removing instruction jmp __breturn
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
Removing instruction lda b
|
|
Succesful ASM optimization Pass5UnnecesaryLoadElimination
|
|
Removing instruction __breturn:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
FINAL SYMBOL TABLE
|
|
constant byte* SCREEN = (byte*) 1024
|
|
constant byte* b[3] = { fill( 3, 0) }
|
|
constant byte* c[] = { 'c', 'm', 'l' }
|
|
constant byte* d[] = "cml"z
|
|
void main()
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 32
|
|
|
|
// File Comments
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="arrays-init.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
|
|
.label SCREEN = $400
|
|
.segment Code
|
|
// main
|
|
main: {
|
|
// b[0] = 'c'
|
|
// [0] *b = 'c' -- _deref_pbuc1=vbuc2
|
|
lda #'c'
|
|
sta b
|
|
// *SCREEN = b[0]
|
|
// [1] *SCREEN = *b -- _deref_pbuc1=_deref_pbuc2
|
|
sta SCREEN
|
|
// *(SCREEN+1) = c[1]
|
|
// [2] *(SCREEN+1) = *(c+1) -- _deref_pbuc1=_deref_pbuc2
|
|
lda c+1
|
|
sta SCREEN+1
|
|
// *(SCREEN+2) = d[2]
|
|
// [3] *(SCREEN+2) = *(d+2) -- _deref_pbuc1=_deref_pbuc2
|
|
lda d+2
|
|
sta SCREEN+2
|
|
// main::@return
|
|
// }
|
|
// [4] return
|
|
rts
|
|
}
|
|
// File Data
|
|
.segment Data
|
|
b: .fill 3, 0
|
|
c: .byte 'c', 'm', 'l'
|
|
d: .text "cml"
|
|
|