mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-09-29 03:56:15 +00:00
174 lines
4.3 KiB
Plaintext
174 lines
4.3 KiB
Plaintext
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
void main()
|
|
main: scope:[main] from __start
|
|
*BODY1 = '*'
|
|
*BODY2 = '*'
|
|
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
|
|
constant byte* const BODY1 = SCREEN+MARGIN_TOP*LINE_LEN+MARGIN_LEFT
|
|
constant byte* const BODY2 = SCREEN+OFFSET
|
|
constant const byte LINE_LEN = $28
|
|
constant const byte MARGIN_LEFT = 4
|
|
constant const byte MARGIN_TOP = 4
|
|
constant const word OFFSET = (word)$28*5+5
|
|
constant byte* const SCREEN = (byte*)$400
|
|
void __start()
|
|
void main()
|
|
|
|
Simplifying constant pointer cast (byte*) 1024
|
|
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
|
|
Finalized unsigned number type (byte) $28
|
|
Finalized unsigned number type (byte) 5
|
|
Finalized unsigned number type (byte) 5
|
|
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] *BODY1 = '*'
|
|
[1] *BODY2 = '*'
|
|
to:main::@return
|
|
main::@return: scope:[main] from main
|
|
[2] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
void main()
|
|
|
|
Initial phi equivalence classes
|
|
Complete equivalence classes
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [0] *BODY1 = '*' [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [1] *BODY2 = '*' [ ] ( [ ] { } ) always clobbers reg byte a
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [main]
|
|
Uplift Scope []
|
|
|
|
Uplifting [main] best 21 combination
|
|
Uplifting [] best 21 combination
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// Tests a number of constant declarations
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="const-declaration.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
|
|
.const LINE_LEN = $28
|
|
.const MARGIN_TOP = 4
|
|
.const MARGIN_LEFT = 4
|
|
.const OFFSET = $28*5+5
|
|
.label SCREEN = $400
|
|
.label BODY1 = SCREEN+MARGIN_TOP*LINE_LEN+MARGIN_LEFT
|
|
.label BODY2 = SCREEN+OFFSET
|
|
.segment Code
|
|
// main
|
|
main: {
|
|
// [0] *BODY1 = '*' -- _deref_pbuc1=vbuc2
|
|
lda #'*'
|
|
sta BODY1
|
|
// [1] *BODY2 = '*' -- _deref_pbuc1=vbuc2
|
|
lda #'*'
|
|
sta BODY2
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [2] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
Removing instruction jmp __breturn
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
Removing instruction lda #'*'
|
|
Succesful ASM optimization Pass5UnnecesaryLoadElimination
|
|
Removing instruction __breturn:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
FINAL SYMBOL TABLE
|
|
constant byte* const BODY1 = SCREEN+MARGIN_TOP*LINE_LEN+MARGIN_LEFT
|
|
constant byte* const BODY2 = SCREEN+OFFSET
|
|
constant const byte LINE_LEN = $28
|
|
constant const byte MARGIN_LEFT = 4
|
|
constant const byte MARGIN_TOP = 4
|
|
constant const word OFFSET = (word)$28*5+5
|
|
constant byte* const SCREEN = (byte*) 1024
|
|
void main()
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 16
|
|
|
|
// File Comments
|
|
// Tests a number of constant declarations
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="const-declaration.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
|
|
.const LINE_LEN = $28
|
|
.const MARGIN_TOP = 4
|
|
.const MARGIN_LEFT = 4
|
|
.const OFFSET = $28*5+5
|
|
.label SCREEN = $400
|
|
.label BODY1 = SCREEN+MARGIN_TOP*LINE_LEN+MARGIN_LEFT
|
|
.label BODY2 = SCREEN+OFFSET
|
|
.segment Code
|
|
// main
|
|
main: {
|
|
// *BODY1 = '*'
|
|
// [0] *BODY1 = '*' -- _deref_pbuc1=vbuc2
|
|
lda #'*'
|
|
sta BODY1
|
|
// *BODY2 = '*'
|
|
// [1] *BODY2 = '*' -- _deref_pbuc1=vbuc2
|
|
sta BODY2
|
|
// main::@return
|
|
// }
|
|
// [2] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|