mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-16 21:07:56 +00:00
584 lines
20 KiB
Plaintext
584 lines
20 KiB
Plaintext
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
void main()
|
|
main: scope:[main] from __start
|
|
main::idx#0 = 0
|
|
main::v2_p_x#0 = main::v1_p_x
|
|
main::v2_p_y#0 = main::v1_p_y
|
|
main::v2_q_x#0 = main::v1_q_x
|
|
main::v2_q_y#0 = main::v1_q_y
|
|
main::v3_p_x#0 = main::v1_p_x
|
|
main::v3_p_y#0 = main::v1_p_y
|
|
main::v4_p_x#0 = main::v1_p_x
|
|
main::v4_p_y#0 = main::v1_p_y
|
|
SCREEN[main::idx#0] = main::v1_p_x
|
|
main::idx#1 = ++ main::idx#0
|
|
SCREEN[main::idx#1] = main::v1_p_y
|
|
main::idx#2 = ++ main::idx#1
|
|
SCREEN[main::idx#2] = main::v1_q_x
|
|
main::idx#3 = ++ main::idx#2
|
|
SCREEN[main::idx#3] = main::v1_q_y
|
|
main::idx#4 = ++ main::idx#3
|
|
SCREEN[main::idx#4] = main::v2_p_x#0
|
|
main::idx#5 = ++ main::idx#4
|
|
SCREEN[main::idx#5] = main::v2_p_y#0
|
|
main::idx#6 = ++ main::idx#5
|
|
SCREEN[main::idx#6] = main::v2_q_x#0
|
|
main::idx#7 = ++ main::idx#6
|
|
SCREEN[main::idx#7] = main::v2_q_y#0
|
|
main::idx#8 = ++ main::idx#7
|
|
SCREEN[main::idx#8] = main::v3_p_x#0
|
|
main::idx#9 = ++ main::idx#8
|
|
SCREEN[main::idx#9] = main::v3_p_y#0
|
|
main::idx#10 = ++ main::idx#9
|
|
SCREEN[main::idx#10] = main::v3_q_x
|
|
main::idx#11 = ++ main::idx#10
|
|
SCREEN[main::idx#11] = main::v3_q_y
|
|
main::idx#12 = ++ main::idx#11
|
|
SCREEN[main::idx#12] = main::v4_p_x#0
|
|
main::idx#13 = ++ main::idx#12
|
|
SCREEN[main::idx#13] = main::v4_p_y#0
|
|
main::idx#14 = ++ main::idx#13
|
|
SCREEN[main::idx#14] = main::v4_q_x
|
|
main::idx#15 = ++ main::idx#14
|
|
SCREEN[main::idx#15] = main::v4_q_y
|
|
main::idx#16 = ++ main::idx#15
|
|
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
|
|
const nomodify byte* SCREEN = (byte*)$400
|
|
void __start()
|
|
void main()
|
|
byte main::idx
|
|
byte main::idx#0
|
|
byte main::idx#1
|
|
byte main::idx#10
|
|
byte main::idx#11
|
|
byte main::idx#12
|
|
byte main::idx#13
|
|
byte main::idx#14
|
|
byte main::idx#15
|
|
byte main::idx#16
|
|
byte main::idx#2
|
|
byte main::idx#3
|
|
byte main::idx#4
|
|
byte main::idx#5
|
|
byte main::idx#6
|
|
byte main::idx#7
|
|
byte main::idx#8
|
|
byte main::idx#9
|
|
struct Point main::v1_p
|
|
const byte main::v1_p_x = 2
|
|
const byte main::v1_p_y = 3
|
|
struct Point main::v1_q
|
|
const byte main::v1_q_x = 4
|
|
const byte main::v1_q_y = 5
|
|
struct Point main::v2_p
|
|
byte main::v2_p_x
|
|
byte main::v2_p_x#0
|
|
byte main::v2_p_y
|
|
byte main::v2_p_y#0
|
|
struct Point main::v2_q
|
|
byte main::v2_q_x
|
|
byte main::v2_q_x#0
|
|
byte main::v2_q_y
|
|
byte main::v2_q_y#0
|
|
struct Point main::v3_p
|
|
byte main::v3_p_x
|
|
byte main::v3_p_x#0
|
|
byte main::v3_p_y
|
|
byte main::v3_p_y#0
|
|
struct Point main::v3_q
|
|
const byte main::v3_q_x = 6
|
|
const byte main::v3_q_y = 7
|
|
struct Point main::v4_p
|
|
byte main::v4_p_x
|
|
byte main::v4_p_x#0
|
|
byte main::v4_p_y
|
|
byte main::v4_p_y#0
|
|
struct Point main::v4_q
|
|
const byte main::v4_q_x = 8
|
|
const byte main::v4_q_y = 9
|
|
|
|
Simplifying constant pointer cast (byte*) 1024
|
|
Successful SSA optimization PassNCastSimplification
|
|
Constant main::idx#0 = 0
|
|
Constant main::v2_p_x#0 = main::v1_p_x
|
|
Constant main::v2_p_y#0 = main::v1_p_y
|
|
Constant main::v2_q_x#0 = main::v1_q_x
|
|
Constant main::v2_q_y#0 = main::v1_q_y
|
|
Constant main::v3_p_x#0 = main::v1_p_x
|
|
Constant main::v3_p_y#0 = main::v1_p_y
|
|
Constant main::v4_p_x#0 = main::v1_p_x
|
|
Constant main::v4_p_y#0 = main::v1_p_y
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Simplifying expression containing zero SCREEN in [9] SCREEN[main::idx#0] = main::v1_p_x
|
|
Successful SSA optimization PassNSimplifyExpressionWithZero
|
|
Eliminating unused variable main::idx#16 and assignment [31] main::idx#16 = ++ main::idx#15
|
|
Successful SSA optimization PassNEliminateUnusedVars
|
|
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
|
|
Constant right-side identified [1] main::idx#1 = ++ main::idx#0
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#1 = ++main::idx#0
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [2] main::idx#2 = ++ main::idx#1
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#2 = ++main::idx#1
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [3] main::idx#3 = ++ main::idx#2
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#3 = ++main::idx#2
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [4] main::idx#4 = ++ main::idx#3
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#4 = ++main::idx#3
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [5] main::idx#5 = ++ main::idx#4
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#5 = ++main::idx#4
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [6] main::idx#6 = ++ main::idx#5
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#6 = ++main::idx#5
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [7] main::idx#7 = ++ main::idx#6
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#7 = ++main::idx#6
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [8] main::idx#8 = ++ main::idx#7
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#8 = ++main::idx#7
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [9] main::idx#9 = ++ main::idx#8
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#9 = ++main::idx#8
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [10] main::idx#10 = ++ main::idx#9
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#10 = ++main::idx#9
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [11] main::idx#11 = ++ main::idx#10
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#11 = ++main::idx#10
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [12] main::idx#12 = ++ main::idx#11
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#12 = ++main::idx#11
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [13] main::idx#13 = ++ main::idx#12
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#13 = ++main::idx#12
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [14] main::idx#14 = ++ main::idx#13
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#14 = ++main::idx#13
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Constant right-side identified [15] main::idx#15 = ++ main::idx#14
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
Constant main::idx#15 = ++main::idx#14
|
|
Successful SSA optimization Pass2ConstantIdentification
|
|
Inlining constant with different constant siblings main::idx#0
|
|
Inlining constant with different constant siblings main::idx#1
|
|
Inlining constant with different constant siblings main::idx#2
|
|
Inlining constant with different constant siblings main::idx#3
|
|
Inlining constant with different constant siblings main::idx#4
|
|
Inlining constant with different constant siblings main::idx#5
|
|
Inlining constant with different constant siblings main::idx#6
|
|
Inlining constant with different constant siblings main::idx#7
|
|
Inlining constant with different constant siblings main::idx#8
|
|
Inlining constant with different constant siblings main::idx#9
|
|
Inlining constant with different constant siblings main::idx#10
|
|
Inlining constant with different constant siblings main::idx#11
|
|
Inlining constant with different constant siblings main::idx#12
|
|
Inlining constant with different constant siblings main::idx#13
|
|
Inlining constant with different constant siblings main::idx#14
|
|
Inlining constant with different constant siblings main::idx#15
|
|
Constant inlined main::idx#12 = ++++++++++++++++++++++++0
|
|
Constant inlined main::idx#13 = ++++++++++++++++++++++++++0
|
|
Constant inlined main::idx#14 = ++++++++++++++++++++++++++++0
|
|
Constant inlined main::idx#15 = ++++++++++++++++++++++++++++++0
|
|
Constant inlined main::v2_q_y#0 = main::v1_q_y
|
|
Constant inlined main::idx#0 = 0
|
|
Constant inlined main::v4_p_y#0 = main::v1_p_y
|
|
Constant inlined main::idx#1 = ++0
|
|
Constant inlined main::v2_q_x#0 = main::v1_q_x
|
|
Constant inlined main::v4_p_x#0 = main::v1_p_x
|
|
Constant inlined main::idx#2 = ++++0
|
|
Constant inlined main::idx#3 = ++++++0
|
|
Constant inlined main::idx#4 = ++++++++0
|
|
Constant inlined main::idx#5 = ++++++++++0
|
|
Constant inlined main::idx#6 = ++++++++++++0
|
|
Constant inlined main::v3_p_y#0 = main::v1_p_y
|
|
Constant inlined main::idx#7 = ++++++++++++++0
|
|
Constant inlined main::idx#8 = ++++++++++++++++0
|
|
Constant inlined main::idx#9 = ++++++++++++++++++0
|
|
Constant inlined main::idx#10 = ++++++++++++++++++++0
|
|
Constant inlined main::v3_p_x#0 = main::v1_p_x
|
|
Constant inlined main::idx#11 = ++++++++++++++++++++++0
|
|
Constant inlined main::v2_p_x#0 = main::v1_p_x
|
|
Constant inlined main::v2_p_y#0 = main::v1_p_y
|
|
Successful SSA optimization Pass2ConstantInlining
|
|
Consolidated array index constant in *(SCREEN+++0)
|
|
Consolidated array index constant in *(SCREEN+++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++++++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++++++++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++++++++++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++++++++++++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++++++++++++++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++++++++++++++++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++++++++++++++++++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++++++++++++++++++++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++++++++++++++++++++++++0)
|
|
Consolidated array index constant in *(SCREEN+++++++++++++++++++++++++++++++0)
|
|
Successful SSA optimization Pass2ConstantAdditionElimination
|
|
Simplifying constant integer increment ++0
|
|
Simplifying constant integer increment ++0
|
|
Simplifying constant integer increment ++1
|
|
Simplifying constant integer increment ++2
|
|
Simplifying constant integer increment ++3
|
|
Simplifying constant integer increment ++4
|
|
Simplifying constant integer increment ++5
|
|
Simplifying constant integer increment ++6
|
|
Simplifying constant integer increment ++7
|
|
Simplifying constant integer increment ++8
|
|
Simplifying constant integer increment ++9
|
|
Simplifying constant integer increment ++$a
|
|
Simplifying constant integer increment ++$b
|
|
Simplifying constant integer increment ++$c
|
|
Simplifying constant integer increment ++$d
|
|
Successful SSA optimization Pass2ConstantSimplification
|
|
Simplifying constant integer increment ++1
|
|
Simplifying constant integer increment ++2
|
|
Simplifying constant integer increment ++3
|
|
Simplifying constant integer increment ++4
|
|
Simplifying constant integer increment ++5
|
|
Simplifying constant integer increment ++6
|
|
Simplifying constant integer increment ++7
|
|
Simplifying constant integer increment ++8
|
|
Simplifying constant integer increment ++9
|
|
Simplifying constant integer increment ++$a
|
|
Simplifying constant integer increment ++$b
|
|
Simplifying constant integer increment ++$c
|
|
Simplifying constant integer increment ++$d
|
|
Simplifying constant integer increment ++$e
|
|
Successful SSA optimization Pass2ConstantSimplification
|
|
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] *SCREEN = main::v1_p_x
|
|
[1] *(SCREEN+1) = main::v1_p_y
|
|
[2] *(SCREEN+2) = main::v1_q_x
|
|
[3] *(SCREEN+3) = main::v1_q_y
|
|
[4] *(SCREEN+4) = main::v1_p_x
|
|
[5] *(SCREEN+5) = main::v1_p_y
|
|
[6] *(SCREEN+6) = main::v1_q_x
|
|
[7] *(SCREEN+7) = main::v1_q_y
|
|
[8] *(SCREEN+8) = main::v1_p_x
|
|
[9] *(SCREEN+9) = main::v1_p_y
|
|
[10] *(SCREEN+$a) = main::v3_q_x
|
|
[11] *(SCREEN+$b) = main::v3_q_y
|
|
[12] *(SCREEN+$c) = main::v1_p_x
|
|
[13] *(SCREEN+$d) = main::v1_p_y
|
|
[14] *(SCREEN+$e) = main::v4_q_x
|
|
[15] *(SCREEN+$f) = main::v4_q_y
|
|
to:main::@return
|
|
main::@return: scope:[main] from main
|
|
[16] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
void main()
|
|
byte main::idx
|
|
struct Point main::v1_p
|
|
struct Point main::v1_q
|
|
struct Point main::v2_p
|
|
byte main::v2_p_x
|
|
byte main::v2_p_y
|
|
struct Point main::v2_q
|
|
byte main::v2_q_x
|
|
byte main::v2_q_y
|
|
struct Point main::v3_p
|
|
byte main::v3_p_x
|
|
byte main::v3_p_y
|
|
struct Point main::v3_q
|
|
struct Point main::v4_p
|
|
byte main::v4_p_x
|
|
byte main::v4_p_y
|
|
struct Point main::v4_q
|
|
|
|
Initial phi equivalence classes
|
|
Complete equivalence classes
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [0] *SCREEN = main::v1_p_x [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [1] *(SCREEN+1) = main::v1_p_y [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [2] *(SCREEN+2) = main::v1_q_x [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [3] *(SCREEN+3) = main::v1_q_y [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [4] *(SCREEN+4) = main::v1_p_x [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [5] *(SCREEN+5) = main::v1_p_y [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [6] *(SCREEN+6) = main::v1_q_x [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [7] *(SCREEN+7) = main::v1_q_y [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [8] *(SCREEN+8) = main::v1_p_x [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [9] *(SCREEN+9) = main::v1_p_y [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [10] *(SCREEN+$a) = main::v3_q_x [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [11] *(SCREEN+$b) = main::v3_q_y [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [12] *(SCREEN+$c) = main::v1_p_x [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [13] *(SCREEN+$d) = main::v1_p_y [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [14] *(SCREEN+$e) = main::v4_q_x [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [15] *(SCREEN+$f) = main::v4_q_y [ ] ( [ ] { } ) always clobbers reg byte a
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [Point]
|
|
Uplift Scope [Vector]
|
|
Uplift Scope [main]
|
|
Uplift Scope []
|
|
|
|
Uplifting [Point] best 105 combination
|
|
Uplifting [Vector] best 105 combination
|
|
Uplifting [main] best 105 combination
|
|
Uplifting [] best 105 combination
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// Minimal struct with Unwound behavior - struct containing struct copying
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="struct-40.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
|
|
.label SCREEN = $400
|
|
.segment Code
|
|
// main
|
|
main: {
|
|
.const v1_p_x = 2
|
|
.const v1_p_y = 3
|
|
.const v1_q_x = 4
|
|
.const v1_q_y = 5
|
|
.const v3_q_x = 6
|
|
.const v3_q_y = 7
|
|
.const v4_q_x = 8
|
|
.const v4_q_y = 9
|
|
// [0] *SCREEN = main::v1_p_x -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_x
|
|
sta SCREEN
|
|
// [1] *(SCREEN+1) = main::v1_p_y -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_y
|
|
sta SCREEN+1
|
|
// [2] *(SCREEN+2) = main::v1_q_x -- _deref_pbuc1=vbuc2
|
|
lda #v1_q_x
|
|
sta SCREEN+2
|
|
// [3] *(SCREEN+3) = main::v1_q_y -- _deref_pbuc1=vbuc2
|
|
lda #v1_q_y
|
|
sta SCREEN+3
|
|
// [4] *(SCREEN+4) = main::v1_p_x -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_x
|
|
sta SCREEN+4
|
|
// [5] *(SCREEN+5) = main::v1_p_y -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_y
|
|
sta SCREEN+5
|
|
// [6] *(SCREEN+6) = main::v1_q_x -- _deref_pbuc1=vbuc2
|
|
lda #v1_q_x
|
|
sta SCREEN+6
|
|
// [7] *(SCREEN+7) = main::v1_q_y -- _deref_pbuc1=vbuc2
|
|
lda #v1_q_y
|
|
sta SCREEN+7
|
|
// [8] *(SCREEN+8) = main::v1_p_x -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_x
|
|
sta SCREEN+8
|
|
// [9] *(SCREEN+9) = main::v1_p_y -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_y
|
|
sta SCREEN+9
|
|
// [10] *(SCREEN+$a) = main::v3_q_x -- _deref_pbuc1=vbuc2
|
|
lda #v3_q_x
|
|
sta SCREEN+$a
|
|
// [11] *(SCREEN+$b) = main::v3_q_y -- _deref_pbuc1=vbuc2
|
|
lda #v3_q_y
|
|
sta SCREEN+$b
|
|
// [12] *(SCREEN+$c) = main::v1_p_x -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_x
|
|
sta SCREEN+$c
|
|
// [13] *(SCREEN+$d) = main::v1_p_y -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_y
|
|
sta SCREEN+$d
|
|
// [14] *(SCREEN+$e) = main::v4_q_x -- _deref_pbuc1=vbuc2
|
|
lda #v4_q_x
|
|
sta SCREEN+$e
|
|
// [15] *(SCREEN+$f) = main::v4_q_y -- _deref_pbuc1=vbuc2
|
|
lda #v4_q_y
|
|
sta SCREEN+$f
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [16] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
Removing instruction jmp __breturn
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
Removing instruction __breturn:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
FINAL SYMBOL TABLE
|
|
const nomodify byte* SCREEN = (byte*) 1024
|
|
void main()
|
|
byte main::idx
|
|
struct Point main::v1_p
|
|
const byte main::v1_p_x = 2
|
|
const byte main::v1_p_y = 3
|
|
struct Point main::v1_q
|
|
const byte main::v1_q_x = 4
|
|
const byte main::v1_q_y = 5
|
|
struct Point main::v2_p
|
|
byte main::v2_p_x
|
|
byte main::v2_p_y
|
|
struct Point main::v2_q
|
|
byte main::v2_q_x
|
|
byte main::v2_q_y
|
|
struct Point main::v3_p
|
|
byte main::v3_p_x
|
|
byte main::v3_p_y
|
|
struct Point main::v3_q
|
|
const byte main::v3_q_x = 6
|
|
const byte main::v3_q_y = 7
|
|
struct Point main::v4_p
|
|
byte main::v4_p_x
|
|
byte main::v4_p_y
|
|
struct Point main::v4_q
|
|
const byte main::v4_q_x = 8
|
|
const byte main::v4_q_y = 9
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 102
|
|
|
|
// File Comments
|
|
// Minimal struct with Unwound behavior - struct containing struct copying
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="struct-40.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
|
|
.label SCREEN = $400
|
|
.segment Code
|
|
// main
|
|
main: {
|
|
.const v1_p_x = 2
|
|
.const v1_p_y = 3
|
|
.const v1_q_x = 4
|
|
.const v1_q_y = 5
|
|
.const v3_q_x = 6
|
|
.const v3_q_y = 7
|
|
.const v4_q_x = 8
|
|
.const v4_q_y = 9
|
|
// SCREEN[idx++] = v1.p.x
|
|
// [0] *SCREEN = main::v1_p_x -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_x
|
|
sta SCREEN
|
|
// SCREEN[idx++] = v1.p.y
|
|
// [1] *(SCREEN+1) = main::v1_p_y -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_y
|
|
sta SCREEN+1
|
|
// SCREEN[idx++] = v1.q.x
|
|
// [2] *(SCREEN+2) = main::v1_q_x -- _deref_pbuc1=vbuc2
|
|
lda #v1_q_x
|
|
sta SCREEN+2
|
|
// SCREEN[idx++] = v1.q.y
|
|
// [3] *(SCREEN+3) = main::v1_q_y -- _deref_pbuc1=vbuc2
|
|
lda #v1_q_y
|
|
sta SCREEN+3
|
|
// SCREEN[idx++] = v2.p.x
|
|
// [4] *(SCREEN+4) = main::v1_p_x -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_x
|
|
sta SCREEN+4
|
|
// SCREEN[idx++] = v2.p.y
|
|
// [5] *(SCREEN+5) = main::v1_p_y -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_y
|
|
sta SCREEN+5
|
|
// SCREEN[idx++] = v2.q.x
|
|
// [6] *(SCREEN+6) = main::v1_q_x -- _deref_pbuc1=vbuc2
|
|
lda #v1_q_x
|
|
sta SCREEN+6
|
|
// SCREEN[idx++] = v2.q.y
|
|
// [7] *(SCREEN+7) = main::v1_q_y -- _deref_pbuc1=vbuc2
|
|
lda #v1_q_y
|
|
sta SCREEN+7
|
|
// SCREEN[idx++] = v3.p.x
|
|
// [8] *(SCREEN+8) = main::v1_p_x -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_x
|
|
sta SCREEN+8
|
|
// SCREEN[idx++] = v3.p.y
|
|
// [9] *(SCREEN+9) = main::v1_p_y -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_y
|
|
sta SCREEN+9
|
|
// SCREEN[idx++] = v3.q.x
|
|
// [10] *(SCREEN+$a) = main::v3_q_x -- _deref_pbuc1=vbuc2
|
|
lda #v3_q_x
|
|
sta SCREEN+$a
|
|
// SCREEN[idx++] = v3.q.y
|
|
// [11] *(SCREEN+$b) = main::v3_q_y -- _deref_pbuc1=vbuc2
|
|
lda #v3_q_y
|
|
sta SCREEN+$b
|
|
// SCREEN[idx++] = v4.p.x
|
|
// [12] *(SCREEN+$c) = main::v1_p_x -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_x
|
|
sta SCREEN+$c
|
|
// SCREEN[idx++] = v4.p.y
|
|
// [13] *(SCREEN+$d) = main::v1_p_y -- _deref_pbuc1=vbuc2
|
|
lda #v1_p_y
|
|
sta SCREEN+$d
|
|
// SCREEN[idx++] = v4.q.x
|
|
// [14] *(SCREEN+$e) = main::v4_q_x -- _deref_pbuc1=vbuc2
|
|
lda #v4_q_x
|
|
sta SCREEN+$e
|
|
// SCREEN[idx++] = v4.q.y
|
|
// [15] *(SCREEN+$f) = main::v4_q_y -- _deref_pbuc1=vbuc2
|
|
lda #v4_q_y
|
|
sta SCREEN+$f
|
|
// main::@return
|
|
// }
|
|
// [16] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|