mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-06-03 07:29:37 +00:00
189 lines
3.8 KiB
Plaintext
189 lines
3.8 KiB
Plaintext
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
void main()
|
|
main: scope:[main] from __start
|
|
asm { lda#'c' stasub.ll+1 }
|
|
call sub
|
|
to:main::@1
|
|
main::@1: scope:[main] from main
|
|
to:main::@return
|
|
main::@return: scope:[main] from main::@1
|
|
return
|
|
to:@return
|
|
|
|
void sub()
|
|
sub: scope:[sub] from main
|
|
asm { ll: lda#0 sta$400 }
|
|
to:sub::@return
|
|
sub::@return: scope:[sub] from sub
|
|
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()
|
|
void sub()
|
|
|
|
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
|
|
Adding NOP phi() at start of main::@1
|
|
CALL GRAPH
|
|
Calls in [main] to sub: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
|
|
asm { lda#'c' stasub.ll+1 }
|
|
[1] call sub
|
|
to:main::@return
|
|
main::@return: scope:[main] from main
|
|
[2] return
|
|
to:@return
|
|
|
|
void sub()
|
|
sub: scope:[sub] from main
|
|
asm { ll: lda#0 sta$400 }
|
|
to:sub::@return
|
|
sub::@return: scope:[sub] from sub
|
|
[4] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
void main()
|
|
void sub()
|
|
|
|
Initial phi equivalence classes
|
|
Complete equivalence classes
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement asm { lda#'c' stasub.ll+1 } always clobbers reg byte a
|
|
Statement asm { ll: lda#0 sta$400 } always clobbers reg byte a
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [main]
|
|
Uplift Scope [sub]
|
|
Uplift Scope []
|
|
|
|
Uplifting [main] best 36 combination
|
|
Uplifting [sub] best 36 combination
|
|
Uplifting [] best 36 combination
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// Tests that references to labels in other scopes is possible from inline ASM
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="inline-asm-ref-scoped.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: {
|
|
// asm { lda#'c' stasub.ll+1 }
|
|
lda #'c'
|
|
sta sub.ll+1
|
|
// [1] call sub
|
|
jsr sub
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [2] return
|
|
rts
|
|
}
|
|
// sub
|
|
sub: {
|
|
// asm { ll: lda#0 sta$400 }
|
|
ll:
|
|
lda #0
|
|
sta $400
|
|
jmp __breturn
|
|
// sub::@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()
|
|
void sub()
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 30
|
|
|
|
// File Comments
|
|
// Tests that references to labels in other scopes is possible from inline ASM
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="inline-asm-ref-scoped.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: {
|
|
// asm
|
|
// asm { lda#'c' stasub.ll+1 }
|
|
lda #'c'
|
|
sta sub.ll+1
|
|
// sub()
|
|
// [1] call sub
|
|
jsr sub
|
|
// main::@return
|
|
// }
|
|
// [2] return
|
|
rts
|
|
}
|
|
// sub
|
|
sub: {
|
|
// asm
|
|
// asm { ll: lda#0 sta$400 }
|
|
ll:
|
|
lda #0
|
|
sta $400
|
|
// sub::@return
|
|
// }
|
|
// [4] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|