1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-09-29 03:56:15 +00:00
kickc/src/test/ref/inline-asm-refout.log

171 lines
4.3 KiB
Plaintext

CONTROL FLOW GRAPH SSA
void main()
main: scope:[main] from __start
*(main::SCREEN+$28) = table[0]
asm { ldx#0 !: ldatable,x staSCREEN+1,x inx cpx#4 bne!- }
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()
const nomodify byte* main::SCREEN = (byte*)$400
const byte* table[] = "cml!"z
Adding number conversion cast (unumber) 0 in *(main::SCREEN+$28) = table[0]
Adding number conversion cast (unumber) $28 in *(main::SCREEN+$28) = table[(unumber)0]
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast $28
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) $28
Successful SSA optimization PassNFinalizeNumberTypeConversions
Simplifying expression containing zero table in [0] *(main::SCREEN+$28) = table[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
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+$28) = *table
asm { ldx#0 !: ldatable,x staSCREEN+1,x inx cpx#4 bne!- }
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] *(main::SCREEN+$28) = *table [ ] ( [ ] { } ) always clobbers reg byte a
Statement asm { ldx#0 !: ldatable,x staSCREEN+1,x inx cpx#4 bne!- } always clobbers reg byte a reg byte x
REGISTER UPLIFT SCOPES
Uplift Scope [main]
Uplift Scope []
Uplifting [main] best 35 combination
Uplifting [] best 35 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Illustrates how inline assembler can reference data from the outside program
// Upstart
// Commodore 64 PRG executable file
.file [name="inline-asm-refout.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: {
.label SCREEN = $400
// [0] *(main::SCREEN+$28) = *table -- _deref_pbuc1=_deref_pbuc2
lda table
sta SCREEN+$28
// asm { ldx#0 !: ldatable,x staSCREEN+1,x inx cpx#4 bne!- }
ldx #0
!:
lda table,x
sta SCREEN+1,x
inx
cpx #4
bne !-
jmp __breturn
// main::@return
__breturn:
// [2] return
rts
}
// File Data
.segment Data
table: .text "cml!"
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
void main()
const nomodify byte* main::SCREEN = (byte*) 1024
const byte* table[] = "cml!"z
FINAL ASSEMBLER
Score: 32
// File Comments
// Illustrates how inline assembler can reference data from the outside program
// Upstart
// Commodore 64 PRG executable file
.file [name="inline-asm-refout.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: {
.label SCREEN = $400
// *(SCREEN+40) = table[0]
// [0] *(main::SCREEN+$28) = *table -- _deref_pbuc1=_deref_pbuc2
lda table
sta SCREEN+$28
// asm
// asm { ldx#0 !: ldatable,x staSCREEN+1,x inx cpx#4 bne!- }
ldx #0
!:
lda table,x
sta SCREEN+1,x
inx
cpx #4
bne !-
// main::@return
// }
// [2] return
rts
}
// File Data
.segment Data
table: .text "cml!"