mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-06-03 07:29:37 +00:00
147 lines
3.6 KiB
Plaintext
147 lines
3.6 KiB
Plaintext
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
void main()
|
|
main: scope:[main] from __start
|
|
asm { jmpqwe .byte0,25,51,76,102,128,153,179,204,230 qwe: lda#50 }
|
|
*((char *)$400) = 'c'
|
|
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()
|
|
|
|
Simplifying constant pointer cast (char *) 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
|
|
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
|
|
asm { jmpqwe .byte0,25,51,76,102,128,153,179,204,230 qwe: lda#50 }
|
|
[1] *((char *) 1024) = 'c'
|
|
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 asm { jmpqwe .byte0,25,51,76,102,128,153,179,204,230 qwe: lda#50 } always clobbers reg byte a
|
|
Statement [1] *((char *) 1024) = 'c' [ ] ( [ ] { } ) always clobbers reg byte a
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [main]
|
|
Uplift Scope []
|
|
|
|
Uplifting [main] best 20 combination
|
|
Uplifting [] best 20 combination
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// Example of inline ASM where a JMP is erronously culled during compilation
|
|
// https://gitlab.com/camelot/kickc/issues/302
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="asm-culling-jmp.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 { jmpqwe .byte0,25,51,76,102,128,153,179,204,230 qwe: lda#50 }
|
|
jmp qwe
|
|
.byte 0, $19, $33, $4c, $66, $80, $99, $b3, $cc, $e6
|
|
qwe:
|
|
lda #$32
|
|
// [1] *((char *) 1024) = 'c' -- _deref_pbuc1=vbuc2
|
|
lda #'c'
|
|
sta $400
|
|
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()
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 17
|
|
|
|
// File Comments
|
|
// Example of inline ASM where a JMP is erronously culled during compilation
|
|
// https://gitlab.com/camelot/kickc/issues/302
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="asm-culling-jmp.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 { jmpqwe .byte0,25,51,76,102,128,153,179,204,230 qwe: lda#50 }
|
|
jmp qwe
|
|
.byte 0, $19, $33, $4c, $66, $80, $99, $b3, $cc, $e6
|
|
qwe:
|
|
lda #$32
|
|
// *((char*)0x0400) = 'c'
|
|
// [1] *((char *) 1024) = 'c' -- _deref_pbuc1=vbuc2
|
|
lda #'c'
|
|
sta $400
|
|
// main::@return
|
|
// }
|
|
// [2] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|