1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-05 10:04:48 +00:00

Moving array properties from type to variable. A few tests still failing.

This commit is contained in:
jespergravgaard 2019-11-18 22:50:06 +01:00
parent 37f5d833c9
commit 8656cc4785
4 changed files with 148 additions and 154 deletions

View File

@ -21,7 +21,7 @@ public class Pass1StructTypeSizeFix extends Pass2SsaOptimization {
@Override
public boolean step() {
AtomicBoolean modified = new AtomicBoolean(false);
for(Variable variable : getScope().getAllVariables(true)) {
for(Variable variable : getScope().getAllVars(true)) {
modified.set(fixStructSize(variable.getType()));
}
return modified.get();

View File

@ -10,14 +10,14 @@
(void()) main()
main: scope:[main] from @1
[4] *((byte*)(const struct Person[2]) persons) ← (byte) 7
[5] *((byte*)(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) 9
[6] *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'a'
[7] *((byte[$d])(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'b'
[8] *((word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE) ← (word) $141
[9] *((word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) $7b
[10] *((const byte*) main::SCREEN) ← *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8)
[11] *((const byte*) main::SCREEN+(byte) 1) ← *((byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8)
[4] *((byte*)(const struct Person*) persons) ← (byte) 7
[5] *((byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) 9
[6] *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'a'
[7] *((byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'b'
[8] *((word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE) ← (word) $141
[9] *((word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) $7b
[10] *((const byte*) main::SCREEN) ← *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8)
[11] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8)
to:main::@return
main::@return: scope:[main] from main
[12] return

View File

@ -1,54 +1,53 @@
Fixing struct type size struct Person to 16
Fixing struct type size struct Person to 16
Fixing pointer increment (struct Person*) main::person ← ++ (struct Person*) main::person
Fixing pointer array-indexing *((struct Person[2]) persons + (number) 0)
Fixing pointer array-indexing *((struct Person[2]) persons + (number) 1)
Fixing pointer array-indexing *((struct Person[2]) persons + (number) 0)
Fixing pointer array-indexing *((struct Person[2]) persons + (number) 1)
Fixing pointer array-indexing *((struct Person[2]) persons + (number) 0)
Fixing pointer array-indexing *((struct Person[2]) persons + (number) 1)
Rewriting struct pointer member access *((struct Person[2]) persons + (number~) main::$0).id
Rewriting struct pointer member access *((struct Person[2]) persons + (number~) main::$1).id
Rewriting struct pointer member access *((struct Person[2]) persons + (number~) main::$2).name
Rewriting struct pointer member access *((struct Person[2]) persons + (number~) main::$3).name
Rewriting struct pointer member access *((struct Person[2]) persons + (number~) main::$4).age
Rewriting struct pointer member access *((struct Person[2]) persons + (number~) main::$5).age
Fixing pointer array-indexing *((const struct Person*) persons + (number) 0)
Fixing pointer array-indexing *((const struct Person*) persons + (number) 1)
Fixing pointer array-indexing *((const struct Person*) persons + (number) 0)
Fixing pointer array-indexing *((const struct Person*) persons + (number) 1)
Fixing pointer array-indexing *((const struct Person*) persons + (number) 0)
Fixing pointer array-indexing *((const struct Person*) persons + (number) 1)
Rewriting struct pointer member access *((const struct Person*) persons + (number~) main::$0).id
Rewriting struct pointer member access *((const struct Person*) persons + (number~) main::$1).id
Rewriting struct pointer member access *((const struct Person*) persons + (number~) main::$2).name
Rewriting struct pointer member access *((const struct Person*) persons + (number~) main::$3).name
Rewriting struct pointer member access *((const struct Person*) persons + (number~) main::$4).age
Rewriting struct pointer member access *((const struct Person*) persons + (number~) main::$5).age
Rewriting struct pointer member access *((struct Person*) main::person).name
Rewriting struct pointer member access *((struct Person*) main::person).name
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(struct Person[2]) persons ← { fill( 2, 0) }
to:@1
(void()) main()
main: scope:[main] from @1
(number~) main::$0 ← (number) 0 * (const byte) SIZEOF_STRUCT_PERSON
(byte*~) main::$6 ← (byte*)(struct Person[2]) persons + (const byte) OFFSET_STRUCT_PERSON_ID
(byte*~) main::$6 ← (byte*)(const struct Person*) persons + (const byte) OFFSET_STRUCT_PERSON_ID
*((byte*~) main::$6 + (number~) main::$0) ← (number) 7
(number~) main::$1 ← (number) 1 * (const byte) SIZEOF_STRUCT_PERSON
(byte*~) main::$7 ← (byte*)(struct Person[2]) persons + (const byte) OFFSET_STRUCT_PERSON_ID
(byte*~) main::$7 ← (byte*)(const struct Person*) persons + (const byte) OFFSET_STRUCT_PERSON_ID
*((byte*~) main::$7 + (number~) main::$1) ← (number) 9
(number~) main::$2 ← (number) 0 * (const byte) SIZEOF_STRUCT_PERSON
(byte[$d]~) main::$8 ← (byte[$d])(struct Person[2]) persons + (number~) main::$2
(byte[$d]~) main::$9 ← (byte[$d]~) main::$8 + (const byte) OFFSET_STRUCT_PERSON_NAME
*((byte[$d]~) main::$9 + (number) 8) ← (byte) 'a'
(byte*~) main::$8 ← (byte*)(const struct Person*) persons + (number~) main::$2
(byte*~) main::$9 ← (byte*~) main::$8 + (const byte) OFFSET_STRUCT_PERSON_NAME
*((byte*~) main::$9 + (number) 8) ← (byte) 'a'
(number~) main::$3 ← (number) 1 * (const byte) SIZEOF_STRUCT_PERSON
(byte[$d]~) main::$10 ← (byte[$d])(struct Person[2]) persons + (number~) main::$3
(byte[$d]~) main::$11 ← (byte[$d]~) main::$10 + (const byte) OFFSET_STRUCT_PERSON_NAME
*((byte[$d]~) main::$11 + (number) 8) ← (byte) 'b'
(byte*~) main::$10 ← (byte*)(const struct Person*) persons + (number~) main::$3
(byte*~) main::$11 ← (byte*~) main::$10 + (const byte) OFFSET_STRUCT_PERSON_NAME
*((byte*~) main::$11 + (number) 8) ← (byte) 'b'
(number~) main::$4 ← (number) 0 * (const byte) SIZEOF_STRUCT_PERSON
(word*~) main::$12 ← (word*)(struct Person[2]) persons + (const byte) OFFSET_STRUCT_PERSON_AGE
(word*~) main::$12 ← (word*)(const struct Person*) persons + (const byte) OFFSET_STRUCT_PERSON_AGE
*((word*~) main::$12 + (number~) main::$4) ← (number) $141
(number~) main::$5 ← (number) 1 * (const byte) SIZEOF_STRUCT_PERSON
(word*~) main::$13 ← (word*)(struct Person[2]) persons + (const byte) OFFSET_STRUCT_PERSON_AGE
(word*~) main::$13 ← (word*)(const struct Person*) persons + (const byte) OFFSET_STRUCT_PERSON_AGE
*((word*~) main::$13 + (number~) main::$5) ← (number) $7b
(struct Person*) main::person#0 ← (struct Person[2]) persons
(byte[$d]~) main::$14 ← (byte[$d])(struct Person*) main::person#0 + (const byte) OFFSET_STRUCT_PERSON_NAME
*((const byte*) main::SCREEN + (number) 0) ← *((byte[$d]~) main::$14 + (number) 8)
(struct Person*) main::person#0 ← (const struct Person*) persons
(byte*~) main::$14 ← (byte*)(struct Person*) main::person#0 + (const byte) OFFSET_STRUCT_PERSON_NAME
*((const byte*) main::SCREEN + (number) 0) ← *((byte*~) main::$14 + (number) 8)
(struct Person*) main::person#1 ← (struct Person*) main::person#0 + (const byte) SIZEOF_STRUCT_PERSON
(byte[$d]~) main::$15 ← (byte[$d])(struct Person*) main::person#1 + (const byte) OFFSET_STRUCT_PERSON_NAME
*((const byte*) main::SCREEN + (number) 1) ← *((byte[$d]~) main::$15 + (number) 8)
(byte*~) main::$15 ← (byte*)(struct Person*) main::person#1 + (const byte) OFFSET_STRUCT_PERSON_NAME
*((const byte*) main::SCREEN + (number) 1) ← *((byte*~) main::$15 + (number) 8)
to:main::@return
main::@return: scope:[main] from main
return
@ -70,31 +69,31 @@ SYMBOL TABLE SSA
(const byte) OFFSET_STRUCT_PERSON_NAME = (byte) 1
(word) Person::age
(byte) Person::id
(byte[$d]) Person::name
(byte*) Person::name
(const byte) SIZEOF_STRUCT_PERSON = (byte) $10
(void()) main()
(number~) main::$0
(number~) main::$1
(byte[$d]~) main::$10
(byte[$d]~) main::$11
(byte*~) main::$10
(byte*~) main::$11
(word*~) main::$12
(word*~) main::$13
(byte[$d]~) main::$14
(byte[$d]~) main::$15
(byte*~) main::$14
(byte*~) main::$15
(number~) main::$2
(number~) main::$3
(number~) main::$4
(number~) main::$5
(byte*~) main::$6
(byte*~) main::$7
(byte[$d]~) main::$8
(byte[$d]~) main::$9
(byte*~) main::$8
(byte*~) main::$9
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
(struct Person*) main::person
(struct Person*) main::person#0
(struct Person*) main::person#1
(struct Person[2]) persons
(const struct Person*) persons = { fill( 2, 0) }
Adding number conversion cast (unumber) 0 in (number~) main::$0 ← (number) 0 * (const byte) SIZEOF_STRUCT_PERSON
Adding number conversion cast (unumber) main::$0 in (number~) main::$0 ← (unumber)(number) 0 * (const byte) SIZEOF_STRUCT_PERSON
@ -104,20 +103,20 @@ Adding number conversion cast (unumber) main::$1 in (number~) main::$1 ← (unum
Adding number conversion cast (unumber) 9 in *((byte*~) main::$7 + (unumber~) main::$1) ← (number) 9
Adding number conversion cast (unumber) 0 in (number~) main::$2 ← (number) 0 * (const byte) SIZEOF_STRUCT_PERSON
Adding number conversion cast (unumber) main::$2 in (number~) main::$2 ← (unumber)(number) 0 * (const byte) SIZEOF_STRUCT_PERSON
Adding number conversion cast (unumber) 8 in *((byte[$d]~) main::$9 + (number) 8) ← (byte) 'a'
Adding number conversion cast (unumber) 8 in *((byte*~) main::$9 + (number) 8) ← (byte) 'a'
Adding number conversion cast (unumber) 1 in (number~) main::$3 ← (number) 1 * (const byte) SIZEOF_STRUCT_PERSON
Adding number conversion cast (unumber) main::$3 in (number~) main::$3 ← (unumber)(number) 1 * (const byte) SIZEOF_STRUCT_PERSON
Adding number conversion cast (unumber) 8 in *((byte[$d]~) main::$11 + (number) 8) ← (byte) 'b'
Adding number conversion cast (unumber) 8 in *((byte*~) main::$11 + (number) 8) ← (byte) 'b'
Adding number conversion cast (unumber) 0 in (number~) main::$4 ← (number) 0 * (const byte) SIZEOF_STRUCT_PERSON
Adding number conversion cast (unumber) main::$4 in (number~) main::$4 ← (unumber)(number) 0 * (const byte) SIZEOF_STRUCT_PERSON
Adding number conversion cast (unumber) $141 in *((word*~) main::$12 + (unumber~) main::$4) ← (number) $141
Adding number conversion cast (unumber) 1 in (number~) main::$5 ← (number) 1 * (const byte) SIZEOF_STRUCT_PERSON
Adding number conversion cast (unumber) main::$5 in (number~) main::$5 ← (unumber)(number) 1 * (const byte) SIZEOF_STRUCT_PERSON
Adding number conversion cast (unumber) $7b in *((word*~) main::$13 + (unumber~) main::$5) ← (number) $7b
Adding number conversion cast (unumber) 8 in *((const byte*) main::SCREEN + (number) 0) ← *((byte[$d]~) main::$14 + (number) 8)
Adding number conversion cast (unumber) 0 in *((const byte*) main::SCREEN + (number) 0) ← *((byte[$d]~) main::$14 + (unumber)(number) 8)
Adding number conversion cast (unumber) 8 in *((const byte*) main::SCREEN + (number) 1) ← *((byte[$d]~) main::$15 + (number) 8)
Adding number conversion cast (unumber) 1 in *((const byte*) main::SCREEN + (number) 1) ← *((byte[$d]~) main::$15 + (unumber)(number) 8)
Adding number conversion cast (unumber) 8 in *((const byte*) main::SCREEN + (number) 0) ← *((byte*~) main::$14 + (number) 8)
Adding number conversion cast (unumber) 0 in *((const byte*) main::SCREEN + (number) 0) ← *((byte*~) main::$14 + (unumber)(number) 8)
Adding number conversion cast (unumber) 8 in *((const byte*) main::SCREEN + (number) 1) ← *((byte*~) main::$15 + (number) 8)
Adding number conversion cast (unumber) 1 in *((const byte*) main::SCREEN + (number) 1) ← *((byte*~) main::$15 + (unumber)(number) 8)
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *((byte*~) main::$6 + (unumber~) main::$0) ← (unumber)(number) 7
Inlining cast *((byte*~) main::$7 + (unumber~) main::$1) ← (unumber)(number) 9
@ -165,95 +164,90 @@ Inferred type updated to byte in (unumber~) main::$2 ← (byte) 0 * (const byte)
Inferred type updated to byte in (unumber~) main::$3 ← (byte) 1 * (const byte) SIZEOF_STRUCT_PERSON
Inferred type updated to byte in (unumber~) main::$4 ← (byte) 0 * (const byte) SIZEOF_STRUCT_PERSON
Inferred type updated to byte in (unumber~) main::$5 ← (byte) 1 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [0] (struct Person[2]) persons ← { fill( 2, 0) }
Constant right-side identified [1] (byte~) main::$0 ← (byte) 0 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [4] (byte~) main::$1 ← (byte) 1 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [7] (byte~) main::$2 ← (byte) 0 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [11] (byte~) main::$3 ← (byte) 1 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [15] (byte~) main::$4 ← (byte) 0 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [18] (byte~) main::$5 ← (byte) 1 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [0] (byte~) main::$0 ← (byte) 0 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [1] (byte*~) main::$6 ← (byte*)(const struct Person*) persons + (const byte) OFFSET_STRUCT_PERSON_ID
Constant right-side identified [3] (byte~) main::$1 ← (byte) 1 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [4] (byte*~) main::$7 ← (byte*)(const struct Person*) persons + (const byte) OFFSET_STRUCT_PERSON_ID
Constant right-side identified [6] (byte~) main::$2 ← (byte) 0 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [10] (byte~) main::$3 ← (byte) 1 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [14] (byte~) main::$4 ← (byte) 0 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [15] (word*~) main::$12 ← (word*)(const struct Person*) persons + (const byte) OFFSET_STRUCT_PERSON_AGE
Constant right-side identified [17] (byte~) main::$5 ← (byte) 1 * (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [18] (word*~) main::$13 ← (word*)(const struct Person*) persons + (const byte) OFFSET_STRUCT_PERSON_AGE
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const struct Person[2]) persons = { fill( 2, 0) }
Constant (const byte) main::$0 = 0*SIZEOF_STRUCT_PERSON
Constant (const byte*) main::$6 = (byte*)persons+OFFSET_STRUCT_PERSON_ID
Constant (const byte) main::$1 = 1*SIZEOF_STRUCT_PERSON
Constant (const byte*) main::$7 = (byte*)persons+OFFSET_STRUCT_PERSON_ID
Constant (const byte) main::$2 = 0*SIZEOF_STRUCT_PERSON
Constant (const byte) main::$3 = 1*SIZEOF_STRUCT_PERSON
Constant (const byte) main::$4 = 0*SIZEOF_STRUCT_PERSON
Constant (const word*) main::$12 = (word*)persons+OFFSET_STRUCT_PERSON_AGE
Constant (const byte) main::$5 = 1*SIZEOF_STRUCT_PERSON
Successful SSA optimization Pass2ConstantIdentification
Constant (const word*) main::$13 = (word*)persons+OFFSET_STRUCT_PERSON_AGE
Constant (const struct Person*) main::person#0 = persons
Successful SSA optimization Pass2ConstantIdentification
Constant value identified (byte*)persons in [2] (byte*~) main::$6 ← (byte*)(const struct Person[2]) persons + (const byte) OFFSET_STRUCT_PERSON_ID
Constant value identified (byte*)persons in [5] (byte*~) main::$7 ← (byte*)(const struct Person[2]) persons + (const byte) OFFSET_STRUCT_PERSON_ID
Constant value identified (byte[$d])persons in [8] (byte[$d]~) main::$8 ← (byte[$d])(const struct Person[2]) persons + (const byte) main::$2
Constant value identified (byte[$d])persons in [12] (byte[$d]~) main::$10 ← (byte[$d])(const struct Person[2]) persons + (const byte) main::$3
Constant value identified (word*)persons in [16] (word*~) main::$12 ← (word*)(const struct Person[2]) persons + (const byte) OFFSET_STRUCT_PERSON_AGE
Constant value identified (word*)persons in [19] (word*~) main::$13 ← (word*)(const struct Person[2]) persons + (const byte) OFFSET_STRUCT_PERSON_AGE
Constant value identified (byte[$d])main::person#0 in [22] (byte[$d]~) main::$14 ← (byte[$d])(const struct Person*) main::person#0 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant value identified (byte*)persons in [7] (byte*~) main::$8 ← (byte*)(const struct Person*) persons + (const byte) main::$2
Constant value identified (byte*)persons in [11] (byte*~) main::$10 ← (byte*)(const struct Person*) persons + (const byte) main::$3
Constant value identified (byte*)main::person#0 in [21] (byte*~) main::$14 ← (byte*)(const struct Person*) main::person#0 + (const byte) OFFSET_STRUCT_PERSON_NAME
Successful SSA optimization Pass2ConstantValues
Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_STRUCT_PERSON in
Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_STRUCT_PERSON in
Simplifying constant evaluating to zero (byte) 0*(const byte) SIZEOF_STRUCT_PERSON in
Successful SSA optimization PassNSimplifyConstantZero
Simplifying expression containing zero (byte*)persons in [2] (byte*~) main::$6 ← (byte*)(const struct Person[2]) persons + (const byte) OFFSET_STRUCT_PERSON_ID
Simplifying expression containing zero main::$6 in [3] *((byte*~) main::$6 + (const byte) main::$0) ← (byte) 7
Simplifying expression containing zero (byte*)persons in [5] (byte*~) main::$7 ← (byte*)(const struct Person[2]) persons + (const byte) OFFSET_STRUCT_PERSON_ID
Simplifying expression containing zero (byte[$d])persons in [8] (byte[$d]~) main::$8 ← (byte[$d])(const struct Person[2]) persons + (const byte) main::$2
Simplifying expression containing zero main::$12 in [17] *((word*~) main::$12 + (const byte) main::$4) ← (word) $141
Simplifying expression containing zero main::SCREEN in [23] *((const byte*) main::SCREEN + (byte) 0) ← *((byte[$d]~) main::$14 + (byte) 8)
Simplifying expression containing zero (byte*)persons in
Simplifying expression containing zero (byte*)persons in
Simplifying expression containing zero main::$6 in [2] *((const byte*) main::$6 + (const byte) main::$0) ← (byte) 7
Simplifying expression containing zero (byte*)persons in [7] (byte*~) main::$8 ← (byte*)(const struct Person*) persons + (const byte) main::$2
Simplifying expression containing zero main::$12 in [16] *((const word*) main::$12 + (const byte) main::$4) ← (word) $141
Simplifying expression containing zero main::SCREEN in [22] *((const byte*) main::SCREEN + (byte) 0) ← *((byte*~) main::$14 + (byte) 8)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused constant (const byte) main::$0
Eliminating unused constant (const byte) main::$2
Eliminating unused constant (const byte) main::$4
Eliminating unused constant (const byte) OFFSET_STRUCT_PERSON_ID
Successful SSA optimization PassNEliminateUnusedVars
Constant right-side identified [7] (byte[$d]~) main::$10 ← (byte[$d])(const struct Person[2]) persons + (const byte) main::$3
Constant right-side identified [10] (word*~) main::$12 ← (word*)(const struct Person[2]) persons + (const byte) OFFSET_STRUCT_PERSON_AGE
Constant right-side identified [12] (word*~) main::$13 ← (word*)(const struct Person[2]) persons + (const byte) OFFSET_STRUCT_PERSON_AGE
Constant right-side identified [14] (byte[$d]~) main::$14 ← (byte[$d])(const struct Person*) main::person#0 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant right-side identified [16] (struct Person*) main::person#1 ← (const struct Person*) main::person#0 + (const byte) SIZEOF_STRUCT_PERSON
Constant right-side identified [5] (byte*~) main::$10 ← (byte*)(const struct Person*) persons + (const byte) main::$3
Constant right-side identified [10] (byte*~) main::$14 ← (byte*)(const struct Person*) main::person#0 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant right-side identified [12] (struct Person*) main::person#1 ← (const struct Person*) main::person#0 + (const byte) SIZEOF_STRUCT_PERSON
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) main::$6 = (byte*)persons
Constant (const byte*) main::$7 = (byte*)persons
Constant (const byte[$d]) main::$8 = (byte[$d])persons
Constant (const byte[$d]) main::$10 = (byte[$d])persons+main::$3
Constant (const word*) main::$12 = (word*)persons+OFFSET_STRUCT_PERSON_AGE
Constant (const word*) main::$13 = (word*)persons+OFFSET_STRUCT_PERSON_AGE
Constant (const byte[$d]) main::$14 = (byte[$d])main::person#0+OFFSET_STRUCT_PERSON_NAME
Constant (const byte*) main::$8 = (byte*)persons
Constant (const byte*) main::$10 = (byte*)persons+main::$3
Constant (const byte*) main::$14 = (byte*)main::person#0+OFFSET_STRUCT_PERSON_NAME
Constant (const struct Person*) main::person#1 = main::person#0+SIZEOF_STRUCT_PERSON
Successful SSA optimization Pass2ConstantIdentification
Constant value identified (byte[$d])main::person#1 in [17] (byte[$d]~) main::$15 ← (byte[$d])(const struct Person*) main::person#1 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant value identified (byte*)main::person#1 in [13] (byte*~) main::$15 ← (byte*)(const struct Person*) main::person#1 + (const byte) OFFSET_STRUCT_PERSON_NAME
Successful SSA optimization Pass2ConstantValues
Constant right-side identified [2] (byte[$d]~) main::$9 ← (const byte[$d]) main::$8 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant right-side identified [4] (byte[$d]~) main::$11 ← (const byte[$d]) main::$10 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant right-side identified [9] (byte[$d]~) main::$15 ← (byte[$d])(const struct Person*) main::person#1 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant right-side identified [2] (byte*~) main::$9 ← (const byte*) main::$8 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant right-side identified [4] (byte*~) main::$11 ← (const byte*) main::$10 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant right-side identified [9] (byte*~) main::$15 ← (byte*)(const struct Person*) main::person#1 + (const byte) OFFSET_STRUCT_PERSON_NAME
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte[$d]) main::$9 = main::$8+OFFSET_STRUCT_PERSON_NAME
Constant (const byte[$d]) main::$11 = main::$10+OFFSET_STRUCT_PERSON_NAME
Constant (const byte[$d]) main::$15 = (byte[$d])main::person#1+OFFSET_STRUCT_PERSON_NAME
Constant (const byte*) main::$9 = main::$8+OFFSET_STRUCT_PERSON_NAME
Constant (const byte*) main::$11 = main::$10+OFFSET_STRUCT_PERSON_NAME
Constant (const byte*) main::$15 = (byte*)main::person#1+OFFSET_STRUCT_PERSON_NAME
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with different constant siblings (const struct Person*) main::person#0
Constant inlined main::$12 = (word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE
Constant inlined main::$13 = (word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE
Constant inlined main::$14 = (byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME
Constant inlined main::$15 = (byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME
Constant inlined main::$10 = (byte[$d])(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON
Constant inlined main::$11 = (byte[$d])(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME
Constant inlined main::$12 = (word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE
Constant inlined main::$13 = (word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE
Constant inlined main::$14 = (byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME
Constant inlined main::$15 = (byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME
Constant inlined main::$10 = (byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON
Constant inlined main::$11 = (byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME
Constant inlined main::$1 = (byte) 1*(const byte) SIZEOF_STRUCT_PERSON
Constant inlined main::$5 = (byte) 1*(const byte) SIZEOF_STRUCT_PERSON
Constant inlined main::$6 = (byte*)(const struct Person[2]) persons
Constant inlined main::$6 = (byte*)(const struct Person*) persons
Constant inlined main::$3 = (byte) 1*(const byte) SIZEOF_STRUCT_PERSON
Constant inlined main::$9 = (byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME
Constant inlined main::$7 = (byte*)(const struct Person[2]) persons
Constant inlined main::person#0 = (const struct Person[2]) persons
Constant inlined main::$8 = (byte[$d])(const struct Person[2]) persons
Constant inlined main::$9 = (byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME
Constant inlined main::$7 = (byte*)(const struct Person*) persons
Constant inlined main::person#0 = (const struct Person*) persons
Constant inlined main::$8 = (byte*)(const struct Person*) persons
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *((byte*)persons+1*SIZEOF_STRUCT_PERSON)
Consolidated array index constant in *((byte[$d])persons+OFFSET_STRUCT_PERSON_NAME+8)
Consolidated array index constant in *((byte[$d])persons+1*SIZEOF_STRUCT_PERSON+OFFSET_STRUCT_PERSON_NAME+8)
Consolidated array index constant in *((byte*)persons+OFFSET_STRUCT_PERSON_NAME+8)
Consolidated array index constant in *((byte*)persons+1*SIZEOF_STRUCT_PERSON+OFFSET_STRUCT_PERSON_NAME+8)
Consolidated array index constant in *((word*)persons+OFFSET_STRUCT_PERSON_AGE+1*SIZEOF_STRUCT_PERSON)
Consolidated array index constant in *((byte[$d])persons+OFFSET_STRUCT_PERSON_NAME+8)
Consolidated array index constant in *((byte[$d])main::person#1+OFFSET_STRUCT_PERSON_NAME+8)
Consolidated array index constant in *((byte*)persons+OFFSET_STRUCT_PERSON_NAME+8)
Consolidated array index constant in *((byte*)main::person#1+OFFSET_STRUCT_PERSON_NAME+8)
Consolidated array index constant in *(main::SCREEN+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Adding NOP phi() at start of @begin
@ -283,14 +277,14 @@ FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from @1
[4] *((byte*)(const struct Person[2]) persons) ← (byte) 7
[5] *((byte*)(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) 9
[6] *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'a'
[7] *((byte[$d])(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'b'
[8] *((word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE) ← (word) $141
[9] *((word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) $7b
[10] *((const byte*) main::SCREEN) ← *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8)
[11] *((const byte*) main::SCREEN+(byte) 1) ← *((byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8)
[4] *((byte*)(const struct Person*) persons) ← (byte) 7
[5] *((byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) 9
[6] *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'a'
[7] *((byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'b'
[8] *((word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE) ← (word) $141
[9] *((word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) $7b
[10] *((const byte*) main::SCREEN) ← *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8)
[11] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8)
to:main::@return
main::@return: scope:[main] from main
[12] return
@ -300,7 +294,7 @@ main::@return: scope:[main] from main
VARIABLE REGISTER WEIGHTS
(word) Person::age
(byte) Person::id
(byte[$d]) Person::name
(byte*) Person::name
(void()) main()
(struct Person*) main::person
@ -337,32 +331,32 @@ __bend:
main: {
.label SCREEN = $400
.label person = persons+SIZEOF_STRUCT_PERSON
// [4] *((byte*)(const struct Person[2]) persons) ← (byte) 7 -- _deref_pbuc1=vbuc2
// [4] *((byte*)(const struct Person*) persons) ← (byte) 7 -- _deref_pbuc1=vbuc2
lda #7
sta persons
// [5] *((byte*)(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) 9 -- _deref_pbuc1=vbuc2
// [5] *((byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) 9 -- _deref_pbuc1=vbuc2
lda #9
sta persons+1*SIZEOF_STRUCT_PERSON
// [6] *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'a' -- _deref_pbuc1=vbuc2
// [6] *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'a' -- _deref_pbuc1=vbuc2
lda #'a'
sta persons+OFFSET_STRUCT_PERSON_NAME+8
// [7] *((byte[$d])(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'b' -- _deref_pbuc1=vbuc2
// [7] *((byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'b' -- _deref_pbuc1=vbuc2
lda #'b'
sta persons+1*SIZEOF_STRUCT_PERSON+OFFSET_STRUCT_PERSON_NAME+8
// [8] *((word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE) ← (word) $141 -- _deref_pwuc1=vwuc2
// [8] *((word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE) ← (word) $141 -- _deref_pwuc1=vwuc2
lda #<$141
sta persons+OFFSET_STRUCT_PERSON_AGE
lda #>$141
sta persons+OFFSET_STRUCT_PERSON_AGE+1
// [9] *((word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) $7b -- _deref_pwuc1=vbuc2
// [9] *((word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) $7b -- _deref_pwuc1=vbuc2
lda #0
sta persons+OFFSET_STRUCT_PERSON_AGE+1*SIZEOF_STRUCT_PERSON+1
lda #<$7b
sta persons+OFFSET_STRUCT_PERSON_AGE+1*SIZEOF_STRUCT_PERSON
// [10] *((const byte*) main::SCREEN) ← *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) -- _deref_pbuc1=_deref_pbuc2
// [10] *((const byte*) main::SCREEN) ← *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) -- _deref_pbuc1=_deref_pbuc2
lda persons+OFFSET_STRUCT_PERSON_NAME+8
sta SCREEN
// [11] *((const byte*) main::SCREEN+(byte) 1) ← *((byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) -- _deref_pbuc1=_deref_pbuc2
// [11] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) -- _deref_pbuc1=_deref_pbuc2
lda person+OFFSET_STRUCT_PERSON_NAME+8
sta SCREEN+1
jmp __breturn
@ -375,14 +369,14 @@ main: {
persons: .fill $10*2, 0
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((byte*)(const struct Person[2]) persons) ← (byte) 7 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [5] *((byte*)(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) 9 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [6] *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'a' [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [7] *((byte[$d])(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'b' [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [8] *((word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE) ← (word) $141 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [9] *((word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) $7b [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [10] *((const byte*) main::SCREEN) ← *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [11] *((const byte*) main::SCREEN+(byte) 1) ← *((byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [4] *((byte*)(const struct Person*) persons) ← (byte) 7 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [5] *((byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) 9 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [6] *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'a' [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [7] *((byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'b' [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [8] *((word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE) ← (word) $141 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [9] *((word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) $7b [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [10] *((const byte*) main::SCREEN) ← *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [11] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) [ ] ( main:2 [ ] ) always clobbers reg byte a
REGISTER UPLIFT SCOPES
Uplift Scope [Person]
@ -422,32 +416,32 @@ __bend:
main: {
.label SCREEN = $400
.label person = persons+SIZEOF_STRUCT_PERSON
// [4] *((byte*)(const struct Person[2]) persons) ← (byte) 7 -- _deref_pbuc1=vbuc2
// [4] *((byte*)(const struct Person*) persons) ← (byte) 7 -- _deref_pbuc1=vbuc2
lda #7
sta persons
// [5] *((byte*)(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) 9 -- _deref_pbuc1=vbuc2
// [5] *((byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) 9 -- _deref_pbuc1=vbuc2
lda #9
sta persons+1*SIZEOF_STRUCT_PERSON
// [6] *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'a' -- _deref_pbuc1=vbuc2
// [6] *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'a' -- _deref_pbuc1=vbuc2
lda #'a'
sta persons+OFFSET_STRUCT_PERSON_NAME+8
// [7] *((byte[$d])(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'b' -- _deref_pbuc1=vbuc2
// [7] *((byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'b' -- _deref_pbuc1=vbuc2
lda #'b'
sta persons+1*SIZEOF_STRUCT_PERSON+OFFSET_STRUCT_PERSON_NAME+8
// [8] *((word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE) ← (word) $141 -- _deref_pwuc1=vwuc2
// [8] *((word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE) ← (word) $141 -- _deref_pwuc1=vwuc2
lda #<$141
sta persons+OFFSET_STRUCT_PERSON_AGE
lda #>$141
sta persons+OFFSET_STRUCT_PERSON_AGE+1
// [9] *((word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) $7b -- _deref_pwuc1=vbuc2
// [9] *((word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) $7b -- _deref_pwuc1=vbuc2
lda #0
sta persons+OFFSET_STRUCT_PERSON_AGE+1*SIZEOF_STRUCT_PERSON+1
lda #<$7b
sta persons+OFFSET_STRUCT_PERSON_AGE+1*SIZEOF_STRUCT_PERSON
// [10] *((const byte*) main::SCREEN) ← *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) -- _deref_pbuc1=_deref_pbuc2
// [10] *((const byte*) main::SCREEN) ← *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) -- _deref_pbuc1=_deref_pbuc2
lda persons+OFFSET_STRUCT_PERSON_NAME+8
sta SCREEN
// [11] *((const byte*) main::SCREEN+(byte) 1) ← *((byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) -- _deref_pbuc1=_deref_pbuc2
// [11] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) -- _deref_pbuc1=_deref_pbuc2
lda person+OFFSET_STRUCT_PERSON_NAME+8
sta SCREEN+1
jmp __breturn
@ -486,14 +480,14 @@ FINAL SYMBOL TABLE
(const byte) OFFSET_STRUCT_PERSON_NAME = (byte) 1
(word) Person::age
(byte) Person::id
(byte[$d]) Person::name
(byte*) Person::name
(const byte) SIZEOF_STRUCT_PERSON = (byte) $10
(void()) main()
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(struct Person*) main::person
(const struct Person*) main::person#1 person = (const struct Person[2]) persons+(const byte) SIZEOF_STRUCT_PERSON
(const struct Person[2]) persons = { fill( 2, 0) }
(const struct Person*) main::person#1 person = (const struct Person*) persons+(const byte) SIZEOF_STRUCT_PERSON
(const struct Person*) persons = { fill( 2, 0) }
@ -521,39 +515,39 @@ main: {
.label SCREEN = $400
.label person = persons+SIZEOF_STRUCT_PERSON
// persons[0].id = 7
// [4] *((byte*)(const struct Person[2]) persons) ← (byte) 7 -- _deref_pbuc1=vbuc2
// [4] *((byte*)(const struct Person*) persons) ← (byte) 7 -- _deref_pbuc1=vbuc2
lda #7
sta persons
// persons[1].id = 9
// [5] *((byte*)(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) 9 -- _deref_pbuc1=vbuc2
// [5] *((byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) 9 -- _deref_pbuc1=vbuc2
lda #9
sta persons+1*SIZEOF_STRUCT_PERSON
// persons[0].name[8] = 'a'
// [6] *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'a' -- _deref_pbuc1=vbuc2
// [6] *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'a' -- _deref_pbuc1=vbuc2
lda #'a'
sta persons+OFFSET_STRUCT_PERSON_NAME+8
// persons[1].name[8] = 'b'
// [7] *((byte[$d])(const struct Person[2]) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'b' -- _deref_pbuc1=vbuc2
// [7] *((byte*)(const struct Person*) persons+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) ← (byte) 'b' -- _deref_pbuc1=vbuc2
lda #'b'
sta persons+1*SIZEOF_STRUCT_PERSON+OFFSET_STRUCT_PERSON_NAME+8
// persons[0].age = 321
// [8] *((word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE) ← (word) $141 -- _deref_pwuc1=vwuc2
// [8] *((word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE) ← (word) $141 -- _deref_pwuc1=vwuc2
lda #<$141
sta persons+OFFSET_STRUCT_PERSON_AGE
lda #>$141
sta persons+OFFSET_STRUCT_PERSON_AGE+1
// persons[1].age = 123
// [9] *((word*)(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_AGE+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) $7b -- _deref_pwuc1=vbuc2
// [9] *((word*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_AGE+(byte) 1*(const byte) SIZEOF_STRUCT_PERSON) ← (byte) $7b -- _deref_pwuc1=vbuc2
lda #0
sta persons+OFFSET_STRUCT_PERSON_AGE+1*SIZEOF_STRUCT_PERSON+1
lda #<$7b
sta persons+OFFSET_STRUCT_PERSON_AGE+1*SIZEOF_STRUCT_PERSON
// SCREEN[0] = person->name[8]
// [10] *((const byte*) main::SCREEN) ← *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) -- _deref_pbuc1=_deref_pbuc2
// [10] *((const byte*) main::SCREEN) ← *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) -- _deref_pbuc1=_deref_pbuc2
lda persons+OFFSET_STRUCT_PERSON_NAME+8
sta SCREEN
// SCREEN[1] = person->name[8]
// [11] *((const byte*) main::SCREEN+(byte) 1) ← *((byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) -- _deref_pbuc1=_deref_pbuc2
// [11] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 8) -- _deref_pbuc1=_deref_pbuc2
lda person+OFFSET_STRUCT_PERSON_NAME+8
sta SCREEN+1
// main::@return

View File

@ -5,12 +5,12 @@
(const byte) OFFSET_STRUCT_PERSON_NAME = (byte) 1
(word) Person::age
(byte) Person::id
(byte[$d]) Person::name
(byte*) Person::name
(const byte) SIZEOF_STRUCT_PERSON = (byte) $10
(void()) main()
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(struct Person*) main::person
(const struct Person*) main::person#1 person = (const struct Person[2]) persons+(const byte) SIZEOF_STRUCT_PERSON
(const struct Person[2]) persons = { fill( 2, 0) }
(const struct Person*) main::person#1 person = (const struct Person*) persons+(const byte) SIZEOF_STRUCT_PERSON
(const struct Person*) persons = { fill( 2, 0) }