1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-01-11 04:29:53 +00:00

Merged improved integer type inference by @tfisher98. Closes !2, #594, #334, #199

This commit is contained in:
jespergravgaard 2020-12-12 00:02:55 +01:00
parent 78d961fd19
commit df62ca5c9f
4 changed files with 155 additions and 0 deletions

View File

@ -0,0 +1,13 @@
// Test that bitwise NOT (~) is handled correctly
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
main: {
.const b = $10^$ff
.label screen = $400
// *screen = b
lda #b
sta screen
// }
rts
}

View File

@ -0,0 +1,8 @@
void main()
main: scope:[main] from
[0] *main::screen = main::b
to:main::@return
main::@return: scope:[main] from main
[1] return
to:@return

View File

@ -0,0 +1,130 @@
CONTROL FLOW GRAPH SSA
void main()
main: scope:[main] from __start
*main::screen = main::b
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 byte main::b = (byte)~$10
const nomodify byte* main::screen = (byte*)$400
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) $10
Successful SSA optimization PassNFinalizeNumberTypeConversions
Simplifying constant integer cast ~$10
Successful SSA optimization PassNCastSimplification
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 = main::b
to:main::@return
main::@return: scope:[main] from main
[1] return
to:@return
VARIABLE REGISTER WEIGHTS
void main()
Initial phi equivalence classes
Complete equivalence classes
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *main::screen = main::b [ ] ( [ ] { } ) always clobbers reg byte a
REGISTER UPLIFT SCOPES
Uplift Scope [main]
Uplift Scope []
Uplifting [main] best 15 combination
Uplifting [] best 15 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test that bitwise NOT (~) is handled correctly
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
// main
main: {
.const b = $10^$ff
.label screen = $400
// [0] *main::screen = main::b -- _deref_pbuc1=vbuc2
lda #b
sta screen
jmp __breturn
// main::@return
__breturn:
// [1] 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()
const byte main::b = ~$10
const nomodify byte* main::screen = (byte*) 1024
FINAL ASSEMBLER
Score: 12
// File Comments
// Test that bitwise NOT (~) is handled correctly
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
// main
main: {
.const b = $10^$ff
.label screen = $400
// *screen = b
// [0] *main::screen = main::b -- _deref_pbuc1=vbuc2
lda #b
sta screen
// main::@return
// }
// [1] return
rts
}
// File Data

View File

@ -0,0 +1,4 @@
void main()
const byte main::b = ~$10
const nomodify byte* main::screen = (byte*) 1024