1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-10-21 17:24:39 +00:00
kickc/src/test/ref/struct-ptr-7.log

464 lines
24 KiB
Plaintext

CONTROL FLOW GRAPH SSA
@begin: scope:[] from
to:@1
(void()) main()
main: scope:[main] from @1
(number~) main::$0 ← (number) 0 * (const byte) SIZEOF_STRUCT_POINT
*((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (number~) main::$0) ← (number) 2
(number~) main::$1 ← (number) 0 * (const byte) SIZEOF_STRUCT_POINT
*((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (number~) main::$1) ← (number) 3
(number~) main::$2 ← (number) 1 * (const byte) SIZEOF_STRUCT_POINT
*((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (number~) main::$2) ← (number) 5
(number~) main::$3 ← (number) 1 * (const byte) SIZEOF_STRUCT_POINT
*((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (number~) main::$3) ← (number) 6
(number~) main::$4 ← (number) 0 * (const byte) SIZEOF_STRUCT_POINT
*((const nomodify byte*) main::SCREEN + (number) 0) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (number~) main::$4)
(number~) main::$5 ← (number) 0 * (const byte) SIZEOF_STRUCT_POINT
*((const nomodify byte*) main::SCREEN + (number) 1) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (number~) main::$5)
(number~) main::$6 ← (number) 1 * (const byte) SIZEOF_STRUCT_POINT
*((const nomodify byte*) main::SCREEN + (number) 3) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (number~) main::$6)
(number~) main::$7 ← (number) 1 * (const byte) SIZEOF_STRUCT_POINT
*((const nomodify byte*) main::SCREEN + (number) 4) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (number~) main::$7)
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_POINT_X = (byte) 0
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(void()) main()
(number~) main::$0
(number~) main::$1
(number~) main::$2
(number~) main::$3
(number~) main::$4
(number~) main::$5
(number~) main::$6
(number~) main::$7
(label) main::@return
(const nomodify byte*) main::SCREEN = (byte*)(number) $400
(const struct Point*) points[(number) 2] = { fill( 2, 0) }
Adding number conversion cast (unumber) 0 in (number~) main::$0 ← (number) 0 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) main::$0 in (number~) main::$0 ← (unumber)(number) 0 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) 2 in *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (unumber~) main::$0) ← (number) 2
Adding number conversion cast (unumber) 0 in (number~) main::$1 ← (number) 0 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) main::$1 in (number~) main::$1 ← (unumber)(number) 0 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) 3 in *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (unumber~) main::$1) ← (number) 3
Adding number conversion cast (unumber) 1 in (number~) main::$2 ← (number) 1 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) main::$2 in (number~) main::$2 ← (unumber)(number) 1 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) 5 in *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (unumber~) main::$2) ← (number) 5
Adding number conversion cast (unumber) 1 in (number~) main::$3 ← (number) 1 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) main::$3 in (number~) main::$3 ← (unumber)(number) 1 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) 6 in *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (unumber~) main::$3) ← (number) 6
Adding number conversion cast (unumber) 0 in (number~) main::$4 ← (number) 0 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) main::$4 in (number~) main::$4 ← (unumber)(number) 0 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) 0 in *((const nomodify byte*) main::SCREEN + (number) 0) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (unumber~) main::$4)
Adding number conversion cast (unumber) 0 in (number~) main::$5 ← (number) 0 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) main::$5 in (number~) main::$5 ← (unumber)(number) 0 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) 1 in *((const nomodify byte*) main::SCREEN + (number) 1) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (unumber~) main::$5)
Adding number conversion cast (unumber) 1 in (number~) main::$6 ← (number) 1 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) main::$6 in (number~) main::$6 ← (unumber)(number) 1 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) 3 in *((const nomodify byte*) main::SCREEN + (number) 3) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (unumber~) main::$6)
Adding number conversion cast (unumber) 1 in (number~) main::$7 ← (number) 1 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) main::$7 in (number~) main::$7 ← (unumber)(number) 1 * (const byte) SIZEOF_STRUCT_POINT
Adding number conversion cast (unumber) 4 in *((const nomodify byte*) main::SCREEN + (number) 4) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (unumber~) main::$7)
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (unumber~) main::$0) ← (unumber)(number) 2
Inlining cast *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (unumber~) main::$1) ← (unumber)(number) 3
Inlining cast *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (unumber~) main::$2) ← (unumber)(number) 5
Inlining cast *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (unumber~) main::$3) ← (unumber)(number) 6
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 2
Simplifying constant integer cast 0
Simplifying constant integer cast 3
Simplifying constant integer cast 1
Simplifying constant integer cast 5
Simplifying constant integer cast 1
Simplifying constant integer cast 6
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 3
Simplifying constant integer cast 1
Simplifying constant integer cast 4
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 2
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 3
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 5
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 6
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 3
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 4
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) main::$0 ← (byte) 0 * (const byte) SIZEOF_STRUCT_POINT
Inferred type updated to byte in (unumber~) main::$1 ← (byte) 0 * (const byte) SIZEOF_STRUCT_POINT
Inferred type updated to byte in (unumber~) main::$2 ← (byte) 1 * (const byte) SIZEOF_STRUCT_POINT
Inferred type updated to byte in (unumber~) main::$3 ← (byte) 1 * (const byte) SIZEOF_STRUCT_POINT
Inferred type updated to byte in (unumber~) main::$4 ← (byte) 0 * (const byte) SIZEOF_STRUCT_POINT
Inferred type updated to byte in (unumber~) main::$5 ← (byte) 0 * (const byte) SIZEOF_STRUCT_POINT
Inferred type updated to byte in (unumber~) main::$6 ← (byte) 1 * (const byte) SIZEOF_STRUCT_POINT
Inferred type updated to byte in (unumber~) main::$7 ← (byte) 1 * (const byte) SIZEOF_STRUCT_POINT
Constant right-side identified [0] (byte~) main::$0 ← (byte) 0 * (const byte) SIZEOF_STRUCT_POINT
Constant right-side identified [2] (byte~) main::$1 ← (byte) 0 * (const byte) SIZEOF_STRUCT_POINT
Constant right-side identified [4] (byte~) main::$2 ← (byte) 1 * (const byte) SIZEOF_STRUCT_POINT
Constant right-side identified [6] (byte~) main::$3 ← (byte) 1 * (const byte) SIZEOF_STRUCT_POINT
Constant right-side identified [8] (byte~) main::$4 ← (byte) 0 * (const byte) SIZEOF_STRUCT_POINT
Constant right-side identified [10] (byte~) main::$5 ← (byte) 0 * (const byte) SIZEOF_STRUCT_POINT
Constant right-side identified [12] (byte~) main::$6 ← (byte) 1 * (const byte) SIZEOF_STRUCT_POINT
Constant right-side identified [14] (byte~) main::$7 ← (byte) 1 * (const byte) SIZEOF_STRUCT_POINT
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::$0 = 0*SIZEOF_STRUCT_POINT
Constant (const byte) main::$1 = 0*SIZEOF_STRUCT_POINT
Constant (const byte) main::$2 = 1*SIZEOF_STRUCT_POINT
Constant (const byte) main::$3 = 1*SIZEOF_STRUCT_POINT
Constant (const byte) main::$4 = 0*SIZEOF_STRUCT_POINT
Constant (const byte) main::$5 = 0*SIZEOF_STRUCT_POINT
Constant (const byte) main::$6 = 1*SIZEOF_STRUCT_POINT
Constant (const byte) main::$7 = 1*SIZEOF_STRUCT_POINT
Successful SSA optimization Pass2ConstantIdentification
Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_STRUCT_POINT in
Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_STRUCT_POINT in
Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_STRUCT_POINT in
Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_STRUCT_POINT in
Successful SSA optimization PassNSimplifyConstantZero
Simplifying expression containing zero (byte*)points+OFFSET_STRUCT_POINT_X in [1] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (const byte) main::$0) ← (byte) 2
Simplifying expression containing zero (byte*)points in [1] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X) ← (byte) 2
Simplifying expression containing zero (byte*)points+OFFSET_STRUCT_POINT_Y in [3] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (const byte) main::$1) ← (byte) 3
Simplifying expression containing zero (byte*)points in [5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (const byte) main::$2) ← (byte) 5
Simplifying expression containing zero (byte*)points+OFFSET_STRUCT_POINT_X in [9] *((const nomodify byte*) main::SCREEN + (byte) 0) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (const byte) main::$4)
Simplifying expression containing zero (byte*)points in [9] *((const nomodify byte*) main::SCREEN + (byte) 0) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X)
Simplifying expression containing zero main::SCREEN in [9] *((const nomodify byte*) main::SCREEN + (byte) 0) ← *((byte*)(const struct Point*) points)
Simplifying expression containing zero (byte*)points+OFFSET_STRUCT_POINT_Y in [11] *((const nomodify byte*) main::SCREEN + (byte) 1) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y + (const byte) main::$5)
Simplifying expression containing zero (byte*)points in [13] *((const nomodify byte*) main::SCREEN + (byte) 3) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_X + (const byte) main::$6)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) main::$0
Eliminating unused constant (const byte) main::$1
Eliminating unused constant (const byte) main::$4
Eliminating unused constant (const byte) main::$5
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
Successful SSA optimization PassNEliminateUnusedVars
Constant inlined main::$6 = (byte) 1*(const byte) SIZEOF_STRUCT_POINT
Constant inlined main::$3 = (byte) 1*(const byte) SIZEOF_STRUCT_POINT
Constant inlined main::$2 = (byte) 1*(const byte) SIZEOF_STRUCT_POINT
Constant inlined main::$7 = (byte) 1*(const byte) SIZEOF_STRUCT_POINT
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *((byte*)points+1*SIZEOF_STRUCT_POINT)
Consolidated array index constant in *((byte*)points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT)
Consolidated array index constant in *(main::SCREEN+1)
Consolidated array index constant in *((byte*)points+1*SIZEOF_STRUCT_POINT)
Consolidated array index constant in *(main::SCREEN+3)
Consolidated array index constant in *((byte*)points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT)
Consolidated array index constant in *(main::SCREEN+4)
Successful SSA optimization Pass2ConstantAdditionElimination
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:2
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @2
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] phi()
[2] call main
to:@end
@end: scope:[] from @1
[3] phi()
(void()) main()
main: scope:[main] from @1
[4] *((byte*)(const struct Point*) points) ← (byte) 2
[5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 3
[6] *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 5
[7] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 6
[8] *((const nomodify byte*) main::SCREEN) ← *((byte*)(const struct Point*) points)
[9] *((const nomodify byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y)
[10] *((const nomodify byte*) main::SCREEN+(byte) 3) ← *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT)
[11] *((const nomodify byte*) main::SCREEN+(byte) 4) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT)
to:main::@return
main::@return: scope:[main] from main
[12] return
to:@return
VARIABLE REGISTER WEIGHTS
(byte) Point::x
(byte) Point::y
(void()) main()
Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
Target platform is c64basic / MOS6502X
// File Comments
// Minimal struct - direct (constant) array access
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1
// @1
__b1:
// [2] call main
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
jmp __bend
// @end
__bend:
// main
main: {
.label SCREEN = $400
// [4] *((byte*)(const struct Point*) points) ← (byte) 2 -- _deref_pbuc1=vbuc2
lda #2
sta points
// [5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 3 -- _deref_pbuc1=vbuc2
lda #3
sta points+OFFSET_STRUCT_POINT_Y
// [6] *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 5 -- _deref_pbuc1=vbuc2
lda #5
sta points+1*SIZEOF_STRUCT_POINT
// [7] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 6 -- _deref_pbuc1=vbuc2
lda #6
sta points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT
// [8] *((const nomodify byte*) main::SCREEN) ← *((byte*)(const struct Point*) points) -- _deref_pbuc1=_deref_pbuc2
lda points
sta SCREEN
// [9] *((const nomodify byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda points+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
// [10] *((const nomodify byte*) main::SCREEN+(byte) 3) ← *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) -- _deref_pbuc1=_deref_pbuc2
lda points+1*SIZEOF_STRUCT_POINT
sta SCREEN+3
// [11] *((const nomodify byte*) main::SCREEN+(byte) 4) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) -- _deref_pbuc1=_deref_pbuc2
lda points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT
sta SCREEN+4
jmp __breturn
// main::@return
__breturn:
// [12] return
rts
}
// File Data
points: .fill 2*2, 0
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((byte*)(const struct Point*) points) ← (byte) 2 [ ] ( main:2 [ ] { } ) always clobbers reg byte a
Statement [5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 3 [ ] ( main:2 [ ] { } ) always clobbers reg byte a
Statement [6] *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 5 [ ] ( main:2 [ ] { } ) always clobbers reg byte a
Statement [7] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 6 [ ] ( main:2 [ ] { } ) always clobbers reg byte a
Statement [8] *((const nomodify byte*) main::SCREEN) ← *((byte*)(const struct Point*) points) [ ] ( main:2 [ ] { } ) always clobbers reg byte a
Statement [9] *((const nomodify byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) [ ] ( main:2 [ ] { } ) always clobbers reg byte a
Statement [10] *((const nomodify byte*) main::SCREEN+(byte) 3) ← *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) [ ] ( main:2 [ ] { } ) always clobbers reg byte a
Statement [11] *((const nomodify byte*) main::SCREEN+(byte) 4) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) [ ] ( main:2 [ ] { } ) always clobbers reg byte a
REGISTER UPLIFT SCOPES
Uplift Scope [Point]
Uplift Scope [main]
Uplift Scope []
Uplifting [Point] best 77 combination
Uplifting [main] best 77 combination
Uplifting [] best 77 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Minimal struct - direct (constant) array access
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1
// @1
__b1:
// [2] call main
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
jmp __bend
// @end
__bend:
// main
main: {
.label SCREEN = $400
// [4] *((byte*)(const struct Point*) points) ← (byte) 2 -- _deref_pbuc1=vbuc2
lda #2
sta points
// [5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 3 -- _deref_pbuc1=vbuc2
lda #3
sta points+OFFSET_STRUCT_POINT_Y
// [6] *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 5 -- _deref_pbuc1=vbuc2
lda #5
sta points+1*SIZEOF_STRUCT_POINT
// [7] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 6 -- _deref_pbuc1=vbuc2
lda #6
sta points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT
// [8] *((const nomodify byte*) main::SCREEN) ← *((byte*)(const struct Point*) points) -- _deref_pbuc1=_deref_pbuc2
lda points
sta SCREEN
// [9] *((const nomodify byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda points+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
// [10] *((const nomodify byte*) main::SCREEN+(byte) 3) ← *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) -- _deref_pbuc1=_deref_pbuc2
lda points+1*SIZEOF_STRUCT_POINT
sta SCREEN+3
// [11] *((const nomodify byte*) main::SCREEN+(byte) 4) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) -- _deref_pbuc1=_deref_pbuc2
lda points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT
sta SCREEN+4
jmp __breturn
// main::@return
__breturn:
// [12] return
rts
}
// File Data
points: .fill 2*2, 0
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1_from___bbegin:
Removing instruction __b1:
Removing instruction __bend_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bbegin:
Removing instruction __bend:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
(byte) Point::x
(byte) Point::y
(const byte) SIZEOF_STRUCT_POINT = (byte) 2
(void()) main()
(label) main::@return
(const nomodify byte*) main::SCREEN = (byte*) 1024
(const struct Point*) points[(number) 2] = { fill( 2, 0) }
FINAL ASSEMBLER
Score: 62
// File Comments
// Minimal struct - direct (constant) array access
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.const SIZEOF_STRUCT_POINT = 2
.const OFFSET_STRUCT_POINT_Y = 1
// @begin
// [1] phi from @begin to @1 [phi:@begin->@1]
// @1
// [2] call main
// [3] phi from @1 to @end [phi:@1->@end]
// @end
// main
main: {
.label SCREEN = $400
// points[0].x = 2
// [4] *((byte*)(const struct Point*) points) ← (byte) 2 -- _deref_pbuc1=vbuc2
lda #2
sta points
// points[0].y = 3
// [5] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 3 -- _deref_pbuc1=vbuc2
lda #3
sta points+OFFSET_STRUCT_POINT_Y
// points[1].x = 5
// [6] *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 5 -- _deref_pbuc1=vbuc2
lda #5
sta points+1*SIZEOF_STRUCT_POINT
// points[1].y = 6
// [7] *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) ← (byte) 6 -- _deref_pbuc1=vbuc2
lda #6
sta points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT
// SCREEN[0] = points[0].x
// [8] *((const nomodify byte*) main::SCREEN) ← *((byte*)(const struct Point*) points) -- _deref_pbuc1=_deref_pbuc2
lda points
sta SCREEN
// SCREEN[1] = points[0].y
// [9] *((const nomodify byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
lda points+OFFSET_STRUCT_POINT_Y
sta SCREEN+1
// SCREEN[3] = points[1].x
// [10] *((const nomodify byte*) main::SCREEN+(byte) 3) ← *((byte*)(const struct Point*) points+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) -- _deref_pbuc1=_deref_pbuc2
lda points+1*SIZEOF_STRUCT_POINT
sta SCREEN+3
// SCREEN[4] = points[1].y
// [11] *((const nomodify byte*) main::SCREEN+(byte) 4) ← *((byte*)(const struct Point*) points+(const byte) OFFSET_STRUCT_POINT_Y+(byte) 1*(const byte) SIZEOF_STRUCT_POINT) -- _deref_pbuc1=_deref_pbuc2
lda points+OFFSET_STRUCT_POINT_Y+1*SIZEOF_STRUCT_POINT
sta SCREEN+4
// main::@return
// }
// [12] return
rts
}
// File Data
points: .fill 2*2, 0