1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-28 01:29:44 +00:00

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

This commit is contained in:
jespergravgaard 2019-11-18 22:40:12 +01:00
parent ecccf55a08
commit 37f5d833c9
10 changed files with 154 additions and 152 deletions

View File

@ -38,8 +38,9 @@ public class PassNStructPointerRewriting extends Pass2SsaOptimization {
StructDefinition structDefinition = ((SymbolTypeStruct) structType).getStructDefinition(getScope());
ConstantRef memberOffsetConstant = getMemberOffsetConstant(getScope(), structDefinition, structMemberRef.getMemberName());
SymbolType memberType = SymbolTypeInference.inferType(getScope(), structMemberRef);
Variable memberVar = structDefinition.getMember(structMemberRef.getMemberName());
getLog().append("Rewriting struct pointer member access " + programValue.get().toString(getProgram()));
if(memberType instanceof SymbolTypeArray && ((SymbolTypeArray) memberType).getSize()!=null) {
if(memberVar.isArray() && memberVar.getArraySize()!=null) {
// Cast struct pointer to the type of the member
CastValue structTypedPointer = new CastValue(memberType, structPointer);
// Create temporary variable to hold pointer to member ($1)
@ -77,8 +78,9 @@ public class PassNStructPointerRewriting extends Pass2SsaOptimization {
StructDefinition structDefinition = ((SymbolTypeStruct) structType).getStructDefinition(getScope());
ConstantRef memberOffsetConstant = getMemberOffsetConstant(getScope(), structDefinition, structMemberRef.getMemberName());
SymbolType memberType = SymbolTypeInference.inferType(getScope(), structMemberRef);
Variable memberVar = structDefinition.getMember(structMemberRef.getMemberName());
getLog().append("Rewriting struct pointer member access " + programValue.get().toString(getProgram()));
if(memberType instanceof SymbolTypeArray && ((SymbolTypeArray) memberType).getSize()!=null) {
if(memberVar.isArray() && memberVar.getArraySize()!=null) {
// Cast struct pointer to the type of the member
CastValue structTypedPointer = new CastValue(memberType, structPointer);
// Create temporary variable to hold pointer to member ($1)

View File

@ -1,7 +1,7 @@
@begin: scope:[] from
[0] (byte) bar_thing1 ← (byte) 'a'
[1] (byte) bar_thing2 ← (byte) 'b'
[2] (byte[$c]) bar_thing3 ← (const string) $0
[2] (byte*) bar_thing3 ← (const string) $0
to:@1
@1: scope:[] from @begin
[3] phi()
@ -18,7 +18,7 @@ main: scope:[main] from @1
main::@1: scope:[main] from main main::@1
[8] (byte) main::i#4 ← phi( main/(byte) 2 main::@1/(byte) main::i#3 )
[8] (byte) main::j#2 ← phi( main/(byte) 0 main::@1/(byte) main::j#1 )
[9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte[$c])(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2)
[9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte*)(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2)
[10] (byte) main::i#3 ← ++ (byte) main::i#4
[11] (byte) main::j#1 ← ++ (byte) main::j#2
[12] if((byte) main::j#1!=(byte) $c) goto main::@1

View File

@ -3,11 +3,11 @@ Fixing struct type size struct foo to 14
Setting inferred volatile on symbol affected by address-of (struct foo*) main::barp ← &(struct foo) bar
Created struct value member variable (byte) bar_thing1
Created struct value member variable (byte) bar_thing2
Created struct value member variable (byte[$c]) bar_thing3
Created struct value member variable (byte*) bar_thing3
Converted struct value to member variables (struct foo) bar
Adding struct value list initializer (byte) bar_thing1 ← (byte) 'a'
Adding struct value list initializer (byte) bar_thing2 ← (byte) 'b'
Adding struct value list initializer (byte[$c]) bar_thing3 ← (string) "qwe"
Adding struct value list initializer (byte*) bar_thing3 ← (string) "qwe"
Rewriting struct pointer member access *((struct foo*) main::barp).thing1
Rewriting struct pointer member access *((struct foo*) main::barp).thing2
Rewriting struct pointer member access *((struct foo*) main::barp).thing3
@ -18,8 +18,8 @@ CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte) bar_thing1 ← (byte) 'a'
(byte) bar_thing2 ← (byte) 'b'
(byte[$c]) bar_thing3 ← (const string) $0
(struct foo) bar ← struct-unwound {(byte) bar_thing1, (byte) bar_thing2, (byte[$c]) bar_thing3}
(byte*) bar_thing3 ← (const string) $0
(struct foo) bar ← struct-unwound {(byte) bar_thing1, (byte) bar_thing2, (byte*) bar_thing3}
to:@1
(void()) main()
@ -36,8 +36,8 @@ main: scope:[main] from @1
main::@1: scope:[main] from main main::@1
(byte) main::i#4 ← phi( main/(byte) main::i#2 main::@1/(byte) main::i#3 )
(byte) main::j#2 ← phi( main/(byte) main::j#0 main::@1/(byte) main::j#1 )
(byte[$c]~) main::$3 ← (byte[$c])(const struct foo*) main::barp + (const byte) OFFSET_STRUCT_FOO_THING3
*((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte[$c]~) main::$3 + (byte) main::j#2)
(byte*~) main::$3 ← (byte*)(const struct foo*) main::barp + (const byte) OFFSET_STRUCT_FOO_THING3
*((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte*~) main::$3 + (byte) main::j#2)
(byte) main::i#3 ← ++ (byte) main::i#4
(byte) main::j#1 ← (byte) main::j#2 + rangenext(0,$b)
(bool~) main::$0 ← (byte) main::j#1 != rangelast(0,$b)
@ -65,15 +65,15 @@ SYMBOL TABLE SSA
(struct foo) bar loadstore
(byte) bar_thing1 loadstore
(byte) bar_thing2 loadstore
(byte[$c]) bar_thing3 loadstore
(byte*) bar_thing3 loadstore
(byte) foo::thing1
(byte) foo::thing2
(byte[$c]) foo::thing3
(byte*) foo::thing3
(void()) main()
(bool~) main::$0
(byte*~) main::$1
(byte*~) main::$2
(byte[$c]~) main::$3
(byte*~) main::$3
(label) main::@1
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
@ -104,20 +104,20 @@ Rewriting struct address-of to first member &(struct foo) bar
Successful SSA optimization PassNStructAddressOfRewriting
Constant right-side identified [5] (byte*~) main::$1 ← (byte*)(const struct foo*) main::barp + (const byte) OFFSET_STRUCT_FOO_THING1
Constant right-side identified [8] (byte*~) main::$2 ← (byte*)(const struct foo*) main::barp + (const byte) OFFSET_STRUCT_FOO_THING2
Constant right-side identified [13] (byte[$c]~) main::$3 ← (byte[$c])(const struct foo*) main::barp + (const byte) OFFSET_STRUCT_FOO_THING3
Constant right-side identified [13] (byte*~) main::$3 ← (byte*)(const struct foo*) main::barp + (const byte) OFFSET_STRUCT_FOO_THING3
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::i#0 = 0
Constant (const byte*) main::$1 = (byte*)main::barp+OFFSET_STRUCT_FOO_THING1
Constant (const byte*) main::$2 = (byte*)main::barp+OFFSET_STRUCT_FOO_THING2
Constant (const byte) main::j#0 = 0
Constant (const byte[$c]) main::$3 = (byte[$c])main::barp+OFFSET_STRUCT_FOO_THING3
Constant (const byte*) main::$3 = (byte*)main::barp+OFFSET_STRUCT_FOO_THING3
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [16] main::j#1 ← ++ main::j#2 to ++
Resolved ranged comparison value [18] if(main::j#1!=rangelast(0,$b)) goto main::@1 to (number) $c
Simplifying expression containing zero (byte*)main::barp in
Simplifying expression containing zero main::SCREEN in [6] *((const byte*) main::SCREEN + (const byte) main::i#0) ← *((const byte*) main::$1)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable (struct foo) bar and assignment [3] (struct foo) bar ← struct-unwound {(byte) bar_thing1, (byte) bar_thing2, (byte[$c]) bar_thing3}
Eliminating unused variable (struct foo) bar and assignment [3] (struct foo) bar ← struct-unwound {(byte) bar_thing1, (byte) bar_thing2, (byte*) bar_thing3}
Eliminating unused constant (const byte) OFFSET_STRUCT_FOO_THING1
Successful SSA optimization PassNEliminateUnusedVars
Adding number conversion cast (unumber) $c in if((byte) main::j#1!=(number) $c) goto main::@1
@ -141,7 +141,7 @@ Inlining constant with var siblings (const byte) main::i#2
Constant inlined main::$1 = (byte*)(const struct foo*) main::barp
Constant inlined main::$2 = (byte*)(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING2
Constant inlined main::i#0 = (byte) 0
Constant inlined main::$3 = (byte[$c])(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3
Constant inlined main::$3 = (byte*)(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3
Constant inlined main::i#2 = ++++(byte) 0
Constant inlined main::j#0 = (byte) 0
Constant inlined main::i#1 = ++(byte) 0
@ -173,7 +173,7 @@ FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] (byte) bar_thing1 ← (byte) 'a'
[1] (byte) bar_thing2 ← (byte) 'b'
[2] (byte[$c]) bar_thing3 ← (const string) $0
[2] (byte*) bar_thing3 ← (const string) $0
to:@1
@1: scope:[] from @begin
[3] phi()
@ -190,7 +190,7 @@ main: scope:[main] from @1
main::@1: scope:[main] from main main::@1
[8] (byte) main::i#4 ← phi( main/(byte) 2 main::@1/(byte) main::i#3 )
[8] (byte) main::j#2 ← phi( main/(byte) 0 main::@1/(byte) main::j#1 )
[9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte[$c])(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2)
[9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte*)(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2)
[10] (byte) main::i#3 ← ++ (byte) main::i#4
[11] (byte) main::j#1 ← ++ (byte) main::j#2
[12] if((byte) main::j#1!=(byte) $c) goto main::@1
@ -203,10 +203,10 @@ main::@return: scope:[main] from main::@1
VARIABLE REGISTER WEIGHTS
(byte) bar_thing1 loadstore 20.0
(byte) bar_thing2 loadstore 20.0
(byte[$c]) bar_thing3 loadstore 20.0
(byte*) bar_thing3 loadstore 20.0
(byte) foo::thing1
(byte) foo::thing2
(byte[$c]) foo::thing3
(byte*) foo::thing3
(void()) main()
(byte) main::i
(byte) main::i#3 7.333333333333333
@ -254,7 +254,7 @@ __bbegin:
// [1] (byte) bar_thing2 ← (byte) 'b' -- vbum1=vbuc1
lda #'b'
sta bar_thing2
// [2] (byte[$c]) bar_thing3 ← (const string) $0 -- pbuz1=pbuc1
// [2] (byte*) bar_thing3 ← (const string) $0 -- pbuz1=pbuc1
lda #<__0
sta.z bar_thing3
lda #>__0
@ -299,7 +299,7 @@ main: {
jmp __b1
// main::@1
__b1:
// [9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte[$c])(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2
// [9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte*)(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2
ldy.z j
lda barp+OFFSET_STRUCT_FOO_THING3,y
ldy.z i
@ -327,18 +327,18 @@ main: {
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte) bar_thing1 ← (byte) 'a' [ ] ( [ ] ) always clobbers reg byte a
Statement [1] (byte) bar_thing2 ← (byte) 'b' [ ] ( [ ] ) always clobbers reg byte a
Statement [2] (byte[$c]) bar_thing3 ← (const string) $0 [ ] ( [ ] ) always clobbers reg byte a
Statement [2] (byte*) bar_thing3 ← (const string) $0 [ ] ( [ ] ) always clobbers reg byte a
Statement [6] *((const byte*) main::SCREEN) ← *((byte*)(const struct foo*) main::barp) [ ] ( main:4 [ ] ) always clobbers reg byte a
Statement [7] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING2) [ ] ( main:4 [ ] ) always clobbers reg byte a
Statement [9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte[$c])(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2) [ main::j#2 main::i#4 ] ( main:4 [ main::j#2 main::i#4 ] ) always clobbers reg byte a
Statement [9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte*)(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2) [ main::j#2 main::i#4 ] ( main:4 [ main::j#2 main::i#4 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::j#2 main::j#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::i#4 main::i#3 ]
Statement [0] (byte) bar_thing1 ← (byte) 'a' [ ] ( [ ] ) always clobbers reg byte a
Statement [1] (byte) bar_thing2 ← (byte) 'b' [ ] ( [ ] ) always clobbers reg byte a
Statement [2] (byte[$c]) bar_thing3 ← (const string) $0 [ ] ( [ ] ) always clobbers reg byte a
Statement [2] (byte*) bar_thing3 ← (const string) $0 [ ] ( [ ] ) always clobbers reg byte a
Statement [6] *((const byte*) main::SCREEN) ← *((byte*)(const struct foo*) main::barp) [ ] ( main:4 [ ] ) always clobbers reg byte a
Statement [7] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING2) [ ] ( main:4 [ ] ) always clobbers reg byte a
Statement [9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte[$c])(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2) [ main::j#2 main::i#4 ] ( main:4 [ main::j#2 main::i#4 ] ) always clobbers reg byte a
Statement [9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte*)(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2) [ main::j#2 main::i#4 ] ( main:4 [ main::j#2 main::i#4 ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::j#2 main::j#1 ] : zp[1]:2 , reg byte x , reg byte y ,
Potential registers zp[1]:3 [ main::i#4 main::i#3 ] : zp[1]:3 , reg byte x , reg byte y ,
Potential registers mem[1] [ bar_thing1 ] : mem[1] ,
@ -379,7 +379,7 @@ __bbegin:
// [1] (byte) bar_thing2 ← (byte) 'b' -- vbum1=vbuc1
lda #'b'
sta bar_thing2
// [2] (byte[$c]) bar_thing3 ← (const string) $0 -- pbuz1=pbuc1
// [2] (byte*) bar_thing3 ← (const string) $0 -- pbuz1=pbuc1
lda #<__0
sta.z bar_thing3
lda #>__0
@ -420,7 +420,7 @@ main: {
jmp __b1
// main::@1
__b1:
// [9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte[$c])(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuyy
// [9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte*)(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuyy
lda barp+OFFSET_STRUCT_FOO_THING3,y
sta SCREEN,x
// [10] (byte) main::i#3 ← ++ (byte) main::i#4 -- vbuxx=_inc_vbuxx
@ -472,10 +472,10 @@ FINAL SYMBOL TABLE
(const byte) OFFSET_STRUCT_FOO_THING3 = (byte) 2
(byte) bar_thing1 loadstore mem[1] 20.0
(byte) bar_thing2 loadstore mem[1] 20.0
(byte[$c]) bar_thing3 loadstore zp[2]:2 20.0
(byte*) bar_thing3 loadstore zp[2]:2 20.0
(byte) foo::thing1
(byte) foo::thing2
(byte[$c]) foo::thing3
(byte*) foo::thing3
(void()) main()
(label) main::@1
(label) main::@return
@ -518,7 +518,7 @@ __bbegin:
// [1] (byte) bar_thing2 ← (byte) 'b' -- vbum1=vbuc1
lda #'b'
sta bar_thing2
// [2] (byte[$c]) bar_thing3 ← (const string) $0 -- pbuz1=pbuc1
// [2] (byte*) bar_thing3 ← (const string) $0 -- pbuz1=pbuc1
lda #<__0
sta.z bar_thing3
lda #>__0
@ -553,7 +553,7 @@ main: {
// main::@1
__b1:
// SCREEN[i++] = barp->thing3[j]
// [9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte[$c])(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuyy
// [9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte*)(const struct foo*) main::barp+(const byte) OFFSET_STRUCT_FOO_THING3 + (byte) main::j#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuyy
lda barp+OFFSET_STRUCT_FOO_THING3,y
sta SCREEN,x
// SCREEN[i++] = barp->thing3[j];

View File

@ -6,10 +6,10 @@
(const byte) OFFSET_STRUCT_FOO_THING3 = (byte) 2
(byte) bar_thing1 loadstore mem[1] 20.0
(byte) bar_thing2 loadstore mem[1] 20.0
(byte[$c]) bar_thing3 loadstore zp[2]:2 20.0
(byte*) bar_thing3 loadstore zp[2]:2 20.0
(byte) foo::thing1
(byte) foo::thing2
(byte[$c]) foo::thing3
(byte*) foo::thing3
(void()) main()
(label) main::@1
(label) main::@return

View File

@ -24,19 +24,19 @@ main::@return: scope:[main] from main::@1
(void()) print_person((struct Person*) print_person::person)
print_person: scope:[print_person] from main main::@1
[9] (byte) idx#15 ← phi( main/(byte) 0 main::@1/(byte) idx#10 )
[9] (struct Person*) print_person::person#2 ← phi( main/(const struct Person[]) persons main::@1/(const struct Person*) main::person#1 )
[9] (struct Person*) print_person::person#2 ← phi( main/(const struct Person*) persons main::@1/(const struct Person*) main::person#1 )
[10] (byte~) print_person::$0 ← (byte) '0' + *((byte*)(struct Person*) print_person::person#2)
[11] *((const byte*) SCREEN + (byte) idx#15) ← (byte~) print_person::$0
[12] (byte) idx#4 ← ++ (byte) idx#15
[13] *((const byte*) SCREEN + (byte) idx#4) ← (byte) ' '
[14] (byte) idx#5 ← ++ (byte) idx#4
[15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS)
[15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS)
[16] (byte) idx#6 ← ++ (byte) idx#5
[17] (byte[4]~) print_person::$3 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
[18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte[4]~) print_person::$3 + (byte) 1)
[17] (byte*~) print_person::$3 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
[18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte*~) print_person::$3 + (byte) 1)
[19] (byte) idx#7 ← ++ (byte) idx#6
[20] (byte[4]~) print_person::$4 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
[21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte[4]~) print_person::$4 + (byte) 2)
[20] (byte*~) print_person::$4 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
[21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte*~) print_person::$4 + (byte) 2)
[22] (byte) idx#8 ← ++ (byte) idx#7
[23] *((const byte*) SCREEN + (byte) idx#8) ← (byte) ' '
[24] (byte) idx#10 ← ++ (byte) idx#8

View File

@ -13,7 +13,7 @@ CONTROL FLOW GRAPH SSA
(void()) main()
main: scope:[main] from @2
(byte) idx#18 ← phi( @2/(byte) idx#19 )
(struct Person*) main::person#0 ← (const struct Person[]) persons
(struct Person*) main::person#0 ← (const struct Person*) persons
(struct Person*) print_person::person#0 ← (struct Person*) main::person#0
call print_person
to:main::@1
@ -48,14 +48,14 @@ print_person: scope:[print_person] from main main::@1
(byte) idx#4 ← ++ (byte) idx#15
*((const byte*) SCREEN + (byte) idx#4) ← (byte) ' '
(byte) idx#5 ← ++ (byte) idx#4
(byte[4]~) print_person::$2 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
*((const byte*) SCREEN + (byte) idx#5) ← *((byte[4]~) print_person::$2 + (number) 0)
(byte*~) print_person::$2 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
*((const byte*) SCREEN + (byte) idx#5) ← *((byte*~) print_person::$2 + (number) 0)
(byte) idx#6 ← ++ (byte) idx#5
(byte[4]~) print_person::$3 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
*((const byte*) SCREEN + (byte) idx#6) ← *((byte[4]~) print_person::$3 + (number) 1)
(byte*~) print_person::$3 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
*((const byte*) SCREEN + (byte) idx#6) ← *((byte*~) print_person::$3 + (number) 1)
(byte) idx#7 ← ++ (byte) idx#6
(byte[4]~) print_person::$4 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
*((const byte*) SCREEN + (byte) idx#7) ← *((byte[4]~) print_person::$4 + (number) 2)
(byte*~) print_person::$4 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
*((const byte*) SCREEN + (byte) idx#7) ← *((byte*~) print_person::$4 + (number) 2)
(byte) idx#8 ← ++ (byte) idx#7
*((const byte*) SCREEN + (byte) idx#8) ← (byte) ' '
(byte) idx#9 ← ++ (byte) idx#8
@ -84,7 +84,7 @@ SYMBOL TABLE SSA
(const byte) OFFSET_STRUCT_PERSON_ID = (byte) 0
(const byte) OFFSET_STRUCT_PERSON_INITIALS = (byte) 1
(byte) Person::id
(byte[4]) Person::initials
(byte*) Person::initials
(const byte*) SCREEN = (byte*)(number) $400
(const byte) SIZEOF_STRUCT_PERSON = (byte) 5
(byte) idx
@ -116,13 +116,13 @@ SYMBOL TABLE SSA
(struct Person*) main::person#0
(struct Person*) main::person#1
(struct Person*) main::person#2
(const struct Person[]) persons = { { id: (byte)(number) 1, initials: (string) "jgr" }, { id: (byte)(number) 8, initials: (string) "hbg" } }
(const struct Person*) persons = { { id: (byte)(number) 1, initials: (string) "jgr" }, { id: (byte)(number) 8, initials: (string) "hbg" } }
(void()) print_person((struct Person*) print_person::person)
(byte~) print_person::$0
(byte*~) print_person::$1
(byte[4]~) print_person::$2
(byte[4]~) print_person::$3
(byte[4]~) print_person::$4
(byte*~) print_person::$2
(byte*~) print_person::$3
(byte*~) print_person::$4
(label) print_person::@return
(struct Person*) print_person::person
(struct Person*) print_person::person#0
@ -130,9 +130,9 @@ SYMBOL TABLE SSA
(struct Person*) print_person::person#2
Adding number conversion cast (unumber) 0 in (byte) idx#3 ← (number) 0
Adding number conversion cast (unumber) 0 in *((const byte*) SCREEN + (byte) idx#5) ← *((byte[4]~) print_person::$2 + (number) 0)
Adding number conversion cast (unumber) 1 in *((const byte*) SCREEN + (byte) idx#6) ← *((byte[4]~) print_person::$3 + (number) 1)
Adding number conversion cast (unumber) 2 in *((const byte*) SCREEN + (byte) idx#7) ← *((byte[4]~) print_person::$4 + (number) 2)
Adding number conversion cast (unumber) 0 in *((const byte*) SCREEN + (byte) idx#5) ← *((byte*~) print_person::$2 + (number) 0)
Adding number conversion cast (unumber) 1 in *((const byte*) SCREEN + (byte) idx#6) ← *((byte*~) print_person::$3 + (number) 1)
Adding number conversion cast (unumber) 2 in *((const byte*) SCREEN + (byte) idx#7) ← *((byte*~) print_person::$4 + (number) 2)
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) idx#3 ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
@ -170,7 +170,7 @@ Converting *(pointer+n) to pointer[n] [17] (byte~) print_person::$0 ← (byte) '
Successful SSA optimization Pass2InlineDerefIdx
Simplifying expression containing zero (byte*)print_person::person#2 in [16] (byte*~) print_person::$1 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_ID
Simplifying expression containing zero (byte*)print_person::person#2 in [17] (byte~) print_person::$0 ← (byte) '0' + *((byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_ID)
Simplifying expression containing zero print_person::$2 in [23] *((const byte*) SCREEN + (byte) idx#5) ← *((byte[4]~) print_person::$2 + (byte) 0)
Simplifying expression containing zero print_person::$2 in [23] *((const byte*) SCREEN + (byte) idx#5) ← *((byte*~) print_person::$2 + (byte) 0)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable (byte*~) print_person::$1 and assignment [6] (byte*~) print_person::$1 ← (byte*)(struct Person*) print_person::person#2
Eliminating unused constant (const byte) OFFSET_STRUCT_PERSON_ID
@ -181,17 +181,17 @@ Constant (const struct Person*) main::person#1 = main::person#0+SIZEOF_STRUCT_PE
Successful SSA optimization Pass2ConstantIdentification
Constant (const struct Person*) print_person::person#1 = main::person#1
Successful SSA optimization Pass2ConstantIdentification
Converting *(pointer+n) to pointer[n] [12] *((const byte*) SCREEN + (byte) idx#5) ← *((byte[4]~) print_person::$2) -- *((byte[4])print_person::person#2 + OFFSET_STRUCT_PERSON_INITIALS)
Converting *(pointer+n) to pointer[n] [12] *((const byte*) SCREEN + (byte) idx#5) ← *((byte*~) print_person::$2) -- *((byte*)print_person::person#2 + OFFSET_STRUCT_PERSON_INITIALS)
Successful SSA optimization Pass2InlineDerefIdx
Eliminating unused variable (byte[4]~) print_person::$2 and assignment [9] (byte[4]~) print_person::$2 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
Eliminating unused variable (byte*~) print_person::$2 and assignment [9] (byte*~) print_person::$2 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with different constant siblings (const struct Person*) main::person#0
Inlining constant with var siblings (const struct Person*) print_person::person#0
Inlining constant with var siblings (const struct Person*) print_person::person#1
Inlining constant with var siblings (const byte) idx#19
Constant inlined idx#19 = (byte) 0
Constant inlined print_person::person#0 = (const struct Person[]) persons
Constant inlined main::person#0 = (const struct Person[]) persons
Constant inlined print_person::person#0 = (const struct Person*) persons
Constant inlined main::person#0 = (const struct Person*) persons
Constant inlined print_person::person#1 = (const struct Person*) main::person#1
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @begin
@ -245,19 +245,19 @@ main::@return: scope:[main] from main::@1
(void()) print_person((struct Person*) print_person::person)
print_person: scope:[print_person] from main main::@1
[9] (byte) idx#15 ← phi( main/(byte) 0 main::@1/(byte) idx#10 )
[9] (struct Person*) print_person::person#2 ← phi( main/(const struct Person[]) persons main::@1/(const struct Person*) main::person#1 )
[9] (struct Person*) print_person::person#2 ← phi( main/(const struct Person*) persons main::@1/(const struct Person*) main::person#1 )
[10] (byte~) print_person::$0 ← (byte) '0' + *((byte*)(struct Person*) print_person::person#2)
[11] *((const byte*) SCREEN + (byte) idx#15) ← (byte~) print_person::$0
[12] (byte) idx#4 ← ++ (byte) idx#15
[13] *((const byte*) SCREEN + (byte) idx#4) ← (byte) ' '
[14] (byte) idx#5 ← ++ (byte) idx#4
[15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS)
[15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS)
[16] (byte) idx#6 ← ++ (byte) idx#5
[17] (byte[4]~) print_person::$3 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
[18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte[4]~) print_person::$3 + (byte) 1)
[17] (byte*~) print_person::$3 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
[18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte*~) print_person::$3 + (byte) 1)
[19] (byte) idx#7 ← ++ (byte) idx#6
[20] (byte[4]~) print_person::$4 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
[21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte[4]~) print_person::$4 + (byte) 2)
[20] (byte*~) print_person::$4 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS
[21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte*~) print_person::$4 + (byte) 2)
[22] (byte) idx#8 ← ++ (byte) idx#7
[23] *((const byte*) SCREEN + (byte) idx#8) ← (byte) ' '
[24] (byte) idx#10 ← ++ (byte) idx#8
@ -269,7 +269,7 @@ print_person::@return: scope:[print_person] from print_person
VARIABLE REGISTER WEIGHTS
(byte) Person::id
(byte[4]) Person::initials
(byte*) Person::initials
(byte) idx
(byte) idx#10 1.0
(byte) idx#15 2.0
@ -282,8 +282,8 @@ VARIABLE REGISTER WEIGHTS
(struct Person*) main::person
(void()) print_person((struct Person*) print_person::person)
(byte~) print_person::$0 4.0
(byte[4]~) print_person::$3 4.0
(byte[4]~) print_person::$4 4.0
(byte*~) print_person::$3 4.0
(byte*~) print_person::$4 4.0
(struct Person*) print_person::person
(struct Person*) print_person::person#2
@ -363,7 +363,7 @@ main: {
// [9] phi (byte) idx#15 = (byte) 0 [phi:main->print_person#0] -- vbuz1=vbuc1
lda #0
sta.z idx_5
// [9] phi (struct Person*) print_person::person#2 = (const struct Person[]) persons [phi:main->print_person#1] -- pssz1=pssc1
// [9] phi (struct Person*) print_person::person#2 = (const struct Person*) persons [phi:main->print_person#1] -- pssz1=pssc1
lda #<persons
sta.z print_person.person
lda #>persons
@ -419,7 +419,7 @@ print_person: {
ldy.z idx
iny
sty.z idx_1
// [15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuc2
// [15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuc2
ldx.z idx_1
ldy #OFFSET_STRUCT_PERSON_INITIALS
lda (person),y
@ -428,7 +428,7 @@ print_person: {
ldy.z idx_1
iny
sty.z idx_2
// [17] (byte[4]~) print_person::$3 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS -- pbuz1=pbuz2_plus_vbuc1
// [17] (byte*~) print_person::$3 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS -- pbuz1=pbuz2_plus_vbuc1
lda #OFFSET_STRUCT_PERSON_INITIALS
clc
adc.z person
@ -436,7 +436,7 @@ print_person: {
lda #0
adc.z person+1
sta.z __3+1
// [18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte[4]~) print_person::$3 + (byte) 1) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuc2
// [18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte*~) print_person::$3 + (byte) 1) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuc2
ldx.z idx_2
ldy #1
lda (__3),y
@ -445,7 +445,7 @@ print_person: {
ldy.z idx_2
iny
sty.z idx_3
// [20] (byte[4]~) print_person::$4 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS -- pbuz1=pbuz2_plus_vbuc1
// [20] (byte*~) print_person::$4 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS -- pbuz1=pbuz2_plus_vbuc1
lda #OFFSET_STRUCT_PERSON_INITIALS
clc
adc.z person
@ -453,7 +453,7 @@ print_person: {
lda #0
adc.z person+1
sta.z __4+1
// [21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte[4]~) print_person::$4 + (byte) 2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuc2
// [21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte*~) print_person::$4 + (byte) 2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuc2
ldx.z idx_3
ldy #2
lda (__4),y
@ -489,26 +489,26 @@ Removing always clobbered register reg byte a as potential for zp[1]:4 [ idx#15
Removing always clobbered register reg byte y as potential for zp[1]:4 [ idx#15 idx#10 ]
Statement [13] *((const byte*) SCREEN + (byte) idx#4) ← (byte) ' ' [ print_person::person#2 idx#4 ] ( main:2::print_person:5 [ print_person::person#2 idx#4 ] main:2::print_person:7 [ print_person::person#2 idx#4 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:6 [ idx#4 ]
Statement [15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS) [ print_person::person#2 idx#5 ] ( main:2::print_person:5 [ print_person::person#2 idx#5 ] main:2::print_person:7 [ print_person::person#2 idx#5 ] ) always clobbers reg byte a reg byte y
Statement [15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS) [ print_person::person#2 idx#5 ] ( main:2::print_person:5 [ print_person::person#2 idx#5 ] main:2::print_person:7 [ print_person::person#2 idx#5 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte a as potential for zp[1]:7 [ idx#5 ]
Removing always clobbered register reg byte y as potential for zp[1]:7 [ idx#5 ]
Statement [17] (byte[4]~) print_person::$3 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS [ print_person::person#2 idx#6 print_person::$3 ] ( main:2::print_person:5 [ print_person::person#2 idx#6 print_person::$3 ] main:2::print_person:7 [ print_person::person#2 idx#6 print_person::$3 ] ) always clobbers reg byte a
Statement [17] (byte*~) print_person::$3 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS [ print_person::person#2 idx#6 print_person::$3 ] ( main:2::print_person:5 [ print_person::person#2 idx#6 print_person::$3 ] main:2::print_person:7 [ print_person::person#2 idx#6 print_person::$3 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:8 [ idx#6 ]
Statement [18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte[4]~) print_person::$3 + (byte) 1) [ print_person::person#2 idx#6 ] ( main:2::print_person:5 [ print_person::person#2 idx#6 ] main:2::print_person:7 [ print_person::person#2 idx#6 ] ) always clobbers reg byte a reg byte y
Statement [18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte*~) print_person::$3 + (byte) 1) [ print_person::person#2 idx#6 ] ( main:2::print_person:5 [ print_person::person#2 idx#6 ] main:2::print_person:7 [ print_person::person#2 idx#6 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte y as potential for zp[1]:8 [ idx#6 ]
Statement [20] (byte[4]~) print_person::$4 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS [ idx#7 print_person::$4 ] ( main:2::print_person:5 [ idx#7 print_person::$4 ] main:2::print_person:7 [ idx#7 print_person::$4 ] ) always clobbers reg byte a
Statement [20] (byte*~) print_person::$4 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS [ idx#7 print_person::$4 ] ( main:2::print_person:5 [ idx#7 print_person::$4 ] main:2::print_person:7 [ idx#7 print_person::$4 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:11 [ idx#7 ]
Statement [21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte[4]~) print_person::$4 + (byte) 2) [ idx#7 ] ( main:2::print_person:5 [ idx#7 ] main:2::print_person:7 [ idx#7 ] ) always clobbers reg byte a reg byte y
Statement [21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte*~) print_person::$4 + (byte) 2) [ idx#7 ] ( main:2::print_person:5 [ idx#7 ] main:2::print_person:7 [ idx#7 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte y as potential for zp[1]:11 [ idx#7 ]
Statement [23] *((const byte*) SCREEN + (byte) idx#8) ← (byte) ' ' [ idx#8 ] ( main:2::print_person:5 [ idx#8 ] main:2::print_person:7 [ idx#8 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:14 [ idx#8 ]
Statement [10] (byte~) print_person::$0 ← (byte) '0' + *((byte*)(struct Person*) print_person::person#2) [ print_person::person#2 idx#15 print_person::$0 ] ( main:2::print_person:5 [ print_person::person#2 idx#15 print_person::$0 ] main:2::print_person:7 [ print_person::person#2 idx#15 print_person::$0 ] ) always clobbers reg byte a reg byte y
Statement [13] *((const byte*) SCREEN + (byte) idx#4) ← (byte) ' ' [ print_person::person#2 idx#4 ] ( main:2::print_person:5 [ print_person::person#2 idx#4 ] main:2::print_person:7 [ print_person::person#2 idx#4 ] ) always clobbers reg byte a
Statement [15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS) [ print_person::person#2 idx#5 ] ( main:2::print_person:5 [ print_person::person#2 idx#5 ] main:2::print_person:7 [ print_person::person#2 idx#5 ] ) always clobbers reg byte a reg byte y
Statement [17] (byte[4]~) print_person::$3 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS [ print_person::person#2 idx#6 print_person::$3 ] ( main:2::print_person:5 [ print_person::person#2 idx#6 print_person::$3 ] main:2::print_person:7 [ print_person::person#2 idx#6 print_person::$3 ] ) always clobbers reg byte a
Statement [18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte[4]~) print_person::$3 + (byte) 1) [ print_person::person#2 idx#6 ] ( main:2::print_person:5 [ print_person::person#2 idx#6 ] main:2::print_person:7 [ print_person::person#2 idx#6 ] ) always clobbers reg byte a reg byte y
Statement [20] (byte[4]~) print_person::$4 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS [ idx#7 print_person::$4 ] ( main:2::print_person:5 [ idx#7 print_person::$4 ] main:2::print_person:7 [ idx#7 print_person::$4 ] ) always clobbers reg byte a
Statement [21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte[4]~) print_person::$4 + (byte) 2) [ idx#7 ] ( main:2::print_person:5 [ idx#7 ] main:2::print_person:7 [ idx#7 ] ) always clobbers reg byte a reg byte y
Statement [15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS) [ print_person::person#2 idx#5 ] ( main:2::print_person:5 [ print_person::person#2 idx#5 ] main:2::print_person:7 [ print_person::person#2 idx#5 ] ) always clobbers reg byte a reg byte y
Statement [17] (byte*~) print_person::$3 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS [ print_person::person#2 idx#6 print_person::$3 ] ( main:2::print_person:5 [ print_person::person#2 idx#6 print_person::$3 ] main:2::print_person:7 [ print_person::person#2 idx#6 print_person::$3 ] ) always clobbers reg byte a
Statement [18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte*~) print_person::$3 + (byte) 1) [ print_person::person#2 idx#6 ] ( main:2::print_person:5 [ print_person::person#2 idx#6 ] main:2::print_person:7 [ print_person::person#2 idx#6 ] ) always clobbers reg byte a reg byte y
Statement [20] (byte*~) print_person::$4 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS [ idx#7 print_person::$4 ] ( main:2::print_person:5 [ idx#7 print_person::$4 ] main:2::print_person:7 [ idx#7 print_person::$4 ] ) always clobbers reg byte a
Statement [21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte*~) print_person::$4 + (byte) 2) [ idx#7 ] ( main:2::print_person:5 [ idx#7 ] main:2::print_person:7 [ idx#7 ] ) always clobbers reg byte a reg byte y
Statement [23] *((const byte*) SCREEN + (byte) idx#8) ← (byte) ' ' [ idx#8 ] ( main:2::print_person:5 [ idx#8 ] main:2::print_person:7 [ idx#8 ] ) always clobbers reg byte a
Potential registers zp[2]:2 [ print_person::person#2 ] : zp[2]:2 ,
Potential registers zp[1]:4 [ idx#15 idx#10 ] : zp[1]:4 , reg byte x ,
@ -572,7 +572,7 @@ main: {
print_person_from_main:
// [9] phi (byte) idx#15 = (byte) 0 [phi:main->print_person#0] -- vbuxx=vbuc1
ldx #0
// [9] phi (struct Person*) print_person::person#2 = (const struct Person[]) persons [phi:main->print_person#1] -- pssz1=pssc1
// [9] phi (struct Person*) print_person::person#2 = (const struct Person*) persons [phi:main->print_person#1] -- pssz1=pssc1
lda #<persons
sta.z print_person.person
lda #>persons
@ -619,13 +619,13 @@ print_person: {
sta SCREEN,x
// [14] (byte) idx#5 ← ++ (byte) idx#4 -- vbuxx=_inc_vbuxx
inx
// [15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
// [15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
ldy #OFFSET_STRUCT_PERSON_INITIALS
lda (person),y
sta SCREEN,x
// [16] (byte) idx#6 ← ++ (byte) idx#5 -- vbuxx=_inc_vbuxx
inx
// [17] (byte[4]~) print_person::$3 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS -- pbuz1=pbuz2_plus_vbuc1
// [17] (byte*~) print_person::$3 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS -- pbuz1=pbuz2_plus_vbuc1
lda #OFFSET_STRUCT_PERSON_INITIALS
clc
adc.z person
@ -633,13 +633,13 @@ print_person: {
lda #0
adc.z person+1
sta.z __3+1
// [18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte[4]~) print_person::$3 + (byte) 1) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
// [18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte*~) print_person::$3 + (byte) 1) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
ldy #1
lda (__3),y
sta SCREEN,x
// [19] (byte) idx#7 ← ++ (byte) idx#6 -- vbuxx=_inc_vbuxx
inx
// [20] (byte[4]~) print_person::$4 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS -- pbuz1=pbuz1_plus_vbuc1
// [20] (byte*~) print_person::$4 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS -- pbuz1=pbuz1_plus_vbuc1
lda #OFFSET_STRUCT_PERSON_INITIALS
clc
adc.z __4
@ -647,7 +647,7 @@ print_person: {
bcc !+
inc.z __4+1
!:
// [21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte[4]~) print_person::$4 + (byte) 2) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
// [21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte*~) print_person::$4 + (byte) 2) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
ldy #2
lda (__4),y
sta SCREEN,x
@ -705,7 +705,7 @@ FINAL SYMBOL TABLE
(label) @end
(const byte) OFFSET_STRUCT_PERSON_INITIALS = (byte) 1
(byte) Person::id
(byte[4]) Person::initials
(byte*) Person::initials
(const byte*) SCREEN = (byte*) 1024
(const byte) SIZEOF_STRUCT_PERSON = (byte) 5
(byte) idx
@ -720,12 +720,12 @@ FINAL SYMBOL TABLE
(label) main::@1
(label) main::@return
(struct Person*) main::person
(const struct Person*) main::person#1 person = (const struct Person[]) persons+(const byte) SIZEOF_STRUCT_PERSON
(const struct Person[]) persons = { { id: (byte) 1, initials: (string) "jgr" }, { id: (byte) 8, initials: (string) "hbg" } }
(const struct Person*) main::person#1 person = (const struct Person*) persons+(const byte) SIZEOF_STRUCT_PERSON
(const struct Person*) persons = { { id: (byte) 1, initials: (string) "jgr" }, { id: (byte) 8, initials: (string) "hbg" } }
(void()) print_person((struct Person*) print_person::person)
(byte~) print_person::$0 reg byte a 4.0
(byte[4]~) print_person::$3 zp[2]:4 4.0
(byte[4]~) print_person::$4 zp[2]:2 4.0
(byte*~) print_person::$3 zp[2]:4 4.0
(byte*~) print_person::$4 zp[2]:2 4.0
(label) print_person::@return
(struct Person*) print_person::person
(struct Person*) print_person::person#2 person zp[2]:2
@ -769,7 +769,7 @@ main: {
// [9] phi from main to print_person [phi:main->print_person]
// [9] phi (byte) idx#15 = (byte) 0 [phi:main->print_person#0] -- vbuxx=vbuc1
ldx #0
// [9] phi (struct Person*) print_person::person#2 = (const struct Person[]) persons [phi:main->print_person#1] -- pssz1=pssc1
// [9] phi (struct Person*) print_person::person#2 = (const struct Person*) persons [phi:main->print_person#1] -- pssz1=pssc1
lda #<persons
sta.z print_person.person
lda #>persons
@ -818,7 +818,7 @@ print_person: {
// [14] (byte) idx#5 ← ++ (byte) idx#4 -- vbuxx=_inc_vbuxx
inx
// SCREEN[idx++] = person->initials[0]
// [15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
// [15] *((const byte*) SCREEN + (byte) idx#5) ← *((byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
ldy #OFFSET_STRUCT_PERSON_INITIALS
lda (person),y
sta SCREEN,x
@ -826,7 +826,7 @@ print_person: {
// [16] (byte) idx#6 ← ++ (byte) idx#5 -- vbuxx=_inc_vbuxx
inx
// SCREEN[idx++] = person->initials[1]
// [17] (byte[4]~) print_person::$3 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS -- pbuz1=pbuz2_plus_vbuc1
// [17] (byte*~) print_person::$3 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS -- pbuz1=pbuz2_plus_vbuc1
tya
clc
adc.z person
@ -834,7 +834,7 @@ print_person: {
lda #0
adc.z person+1
sta.z __3+1
// [18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte[4]~) print_person::$3 + (byte) 1) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
// [18] *((const byte*) SCREEN + (byte) idx#6) ← *((byte*~) print_person::$3 + (byte) 1) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
ldy #1
lda (__3),y
sta SCREEN,x
@ -842,7 +842,7 @@ print_person: {
// [19] (byte) idx#7 ← ++ (byte) idx#6 -- vbuxx=_inc_vbuxx
inx
// SCREEN[idx++] = person->initials[2]
// [20] (byte[4]~) print_person::$4 ← (byte[4])(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS -- pbuz1=pbuz1_plus_vbuc1
// [20] (byte*~) print_person::$4 ← (byte*)(struct Person*) print_person::person#2 + (const byte) OFFSET_STRUCT_PERSON_INITIALS -- pbuz1=pbuz1_plus_vbuc1
lda #OFFSET_STRUCT_PERSON_INITIALS
clc
adc.z __4
@ -850,7 +850,7 @@ print_person: {
bcc !+
inc.z __4+1
!:
// [21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte[4]~) print_person::$4 + (byte) 2) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
// [21] *((const byte*) SCREEN + (byte) idx#7) ← *((byte*~) print_person::$4 + (byte) 2) -- pbuc1_derefidx_vbuxx=pbuz1_derefidx_vbuc2
ldy #2
lda (__4),y
sta SCREEN,x

View File

@ -3,7 +3,7 @@
(label) @end
(const byte) OFFSET_STRUCT_PERSON_INITIALS = (byte) 1
(byte) Person::id
(byte[4]) Person::initials
(byte*) Person::initials
(const byte*) SCREEN = (byte*) 1024
(const byte) SIZEOF_STRUCT_PERSON = (byte) 5
(byte) idx
@ -18,12 +18,12 @@
(label) main::@1
(label) main::@return
(struct Person*) main::person
(const struct Person*) main::person#1 person = (const struct Person[]) persons+(const byte) SIZEOF_STRUCT_PERSON
(const struct Person[]) persons = { { id: (byte) 1, initials: (string) "jgr" }, { id: (byte) 8, initials: (string) "hbg" } }
(const struct Person*) main::person#1 person = (const struct Person*) persons+(const byte) SIZEOF_STRUCT_PERSON
(const struct Person*) persons = { { id: (byte) 1, initials: (string) "jgr" }, { id: (byte) 8, initials: (string) "hbg" } }
(void()) print_person((struct Person*) print_person::person)
(byte~) print_person::$0 reg byte a 4.0
(byte[4]~) print_person::$3 zp[2]:4 4.0
(byte[4]~) print_person::$4 zp[2]:2 4.0
(byte*~) print_person::$3 zp[2]:4 4.0
(byte*~) print_person::$4 zp[2]:2 4.0
(label) print_person::@return
(struct Person*) print_person::person
(struct Person*) print_person::person#2 person zp[2]:2

View File

@ -10,8 +10,8 @@
(void()) main()
main: scope:[main] from @1
[4] *((const byte*) main::SCREEN) ← *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2)
[5] *((const byte*) main::SCREEN+(byte) 1) ← *((byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2)
[4] *((const byte*) main::SCREEN) ← *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2)
[5] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2)
to:main::@return
main::@return: scope:[main] from main
[6] return

View File

@ -9,12 +9,12 @@ CONTROL FLOW GRAPH SSA
(void()) main()
main: scope:[main] from @1
(struct Person*) main::person#0 ← (const struct Person[2]) persons
(byte[$d]~) main::$0 ← (byte[$d])(struct Person*) main::person#0 + (const byte) OFFSET_STRUCT_PERSON_NAME
*((const byte*) main::SCREEN + (number) 0) ← *((byte[$d]~) main::$0 + (number) 2)
(struct Person*) main::person#0 ← (const struct Person*) persons
(byte*~) main::$0 ← (byte*)(struct Person*) main::person#0 + (const byte) OFFSET_STRUCT_PERSON_NAME
*((const byte*) main::SCREEN + (number) 0) ← *((byte*~) main::$0 + (number) 2)
(struct Person*) main::person#1 ← (struct Person*) main::person#0 + (const byte) SIZEOF_STRUCT_PERSON
(byte[$d]~) main::$1 ← (byte[$d])(struct Person*) main::person#1 + (const byte) OFFSET_STRUCT_PERSON_NAME
*((const byte*) main::SCREEN + (number) 1) ← *((byte[$d]~) main::$1 + (number) 2)
(byte*~) main::$1 ← (byte*)(struct Person*) main::person#1 + (const byte) OFFSET_STRUCT_PERSON_NAME
*((const byte*) main::SCREEN + (number) 1) ← *((byte*~) main::$1 + (number) 2)
to:main::@return
main::@return: scope:[main] from main
return
@ -34,22 +34,22 @@ 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()
(byte[$d]~) main::$0
(byte[$d]~) main::$1
(byte*~) main::$0
(byte*~) main::$1
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
(struct Person*) main::person
(struct Person*) main::person#0
(struct Person*) main::person#1
(const struct Person[2]) persons = { { id: (byte)(number) 7, name: (string) "jesper", age: (word)(number) $141 }, { id: (byte)(number) 9, name: (string) "henry", age: (word)(number) $7b } }
(const struct Person*) persons = { { id: (byte)(number) 7, name: (string) "jesper", age: (word)(number) $141 }, { id: (byte)(number) 9, name: (string) "henry", age: (word)(number) $7b } }
Adding number conversion cast (unumber) 2 in *((const byte*) main::SCREEN + (number) 0) ← *((byte[$d]~) main::$0 + (number) 2)
Adding number conversion cast (unumber) 0 in *((const byte*) main::SCREEN + (number) 0) ← *((byte[$d]~) main::$0 + (unumber)(number) 2)
Adding number conversion cast (unumber) 2 in *((const byte*) main::SCREEN + (number) 1) ← *((byte[$d]~) main::$1 + (number) 2)
Adding number conversion cast (unumber) 1 in *((const byte*) main::SCREEN + (number) 1) ← *((byte[$d]~) main::$1 + (unumber)(number) 2)
Adding number conversion cast (unumber) 2 in *((const byte*) main::SCREEN + (number) 0) ← *((byte*~) main::$0 + (number) 2)
Adding number conversion cast (unumber) 0 in *((const byte*) main::SCREEN + (number) 0) ← *((byte*~) main::$0 + (unumber)(number) 2)
Adding number conversion cast (unumber) 2 in *((const byte*) main::SCREEN + (number) 1) ← *((byte*~) main::$1 + (number) 2)
Adding number conversion cast (unumber) 1 in *((const byte*) main::SCREEN + (number) 1) ← *((byte*~) main::$1 + (unumber)(number) 2)
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 7
Simplifying constant integer cast $141
@ -68,29 +68,29 @@ Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant (const struct Person*) main::person#0 = persons
Successful SSA optimization Pass2ConstantIdentification
Constant value identified (byte[$d])main::person#0 in [1] (byte[$d]~) main::$0 ← (byte[$d])(const struct Person*) main::person#0 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant value identified (byte*)main::person#0 in [1] (byte*~) main::$0 ← (byte*)(const struct Person*) main::person#0 + (const byte) OFFSET_STRUCT_PERSON_NAME
Successful SSA optimization Pass2ConstantValues
Simplifying expression containing zero main::SCREEN in [2] *((const byte*) main::SCREEN + (byte) 0) ← *((byte[$d]~) main::$0 + (byte) 2)
Simplifying expression containing zero main::SCREEN in [2] *((const byte*) main::SCREEN + (byte) 0) ← *((byte*~) main::$0 + (byte) 2)
Successful SSA optimization PassNSimplifyExpressionWithZero
Constant right-side identified [0] (byte[$d]~) main::$0 ← (byte[$d])(const struct Person*) main::person#0 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant right-side identified [0] (byte*~) main::$0 ← (byte*)(const struct Person*) main::person#0 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant right-side identified [2] (struct Person*) main::person#1 ← (const struct Person*) main::person#0 + (const byte) SIZEOF_STRUCT_PERSON
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte[$d]) main::$0 = (byte[$d])main::person#0+OFFSET_STRUCT_PERSON_NAME
Constant (const byte*) main::$0 = (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 [3] (byte[$d]~) main::$1 ← (byte[$d])(const struct Person*) main::person#1 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant value identified (byte*)main::person#1 in [3] (byte*~) main::$1 ← (byte*)(const struct Person*) main::person#1 + (const byte) OFFSET_STRUCT_PERSON_NAME
Successful SSA optimization Pass2ConstantValues
Constant right-side identified [1] (byte[$d]~) main::$1 ← (byte[$d])(const struct Person*) main::person#1 + (const byte) OFFSET_STRUCT_PERSON_NAME
Constant right-side identified [1] (byte*~) main::$1 ← (byte*)(const struct Person*) main::person#1 + (const byte) OFFSET_STRUCT_PERSON_NAME
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte[$d]) main::$1 = (byte[$d])main::person#1+OFFSET_STRUCT_PERSON_NAME
Constant (const byte*) main::$1 = (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::$1 = (byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME
Constant inlined main::person#0 = (const struct Person[2]) persons
Constant inlined main::$0 = (byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME
Constant inlined main::$1 = (byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME
Constant inlined main::person#0 = (const struct Person*) persons
Constant inlined main::$0 = (byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *((byte[$d])persons+OFFSET_STRUCT_PERSON_NAME+2)
Consolidated array index constant in *((byte[$d])main::person#1+OFFSET_STRUCT_PERSON_NAME+2)
Consolidated array index constant in *((byte*)persons+OFFSET_STRUCT_PERSON_NAME+2)
Consolidated array index constant in *((byte*)main::person#1+OFFSET_STRUCT_PERSON_NAME+2)
Consolidated array index constant in *(main::SCREEN+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Adding NOP phi() at start of @begin
@ -120,8 +120,8 @@ FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from @1
[4] *((const byte*) main::SCREEN) ← *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2)
[5] *((const byte*) main::SCREEN+(byte) 1) ← *((byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2)
[4] *((const byte*) main::SCREEN) ← *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2)
[5] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2)
to:main::@return
main::@return: scope:[main] from main
[6] return
@ -131,7 +131,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
@ -167,10 +167,10 @@ __bend:
main: {
.label SCREEN = $400
.label person = persons+SIZEOF_STRUCT_PERSON
// [4] *((const byte*) main::SCREEN) ← *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) -- _deref_pbuc1=_deref_pbuc2
// [4] *((const byte*) main::SCREEN) ← *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) -- _deref_pbuc1=_deref_pbuc2
lda persons+OFFSET_STRUCT_PERSON_NAME+2
sta SCREEN
// [5] *((const byte*) main::SCREEN+(byte) 1) ← *((byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) -- _deref_pbuc1=_deref_pbuc2
// [5] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) -- _deref_pbuc1=_deref_pbuc2
lda person+OFFSET_STRUCT_PERSON_NAME+2
sta SCREEN+1
jmp __breturn
@ -192,8 +192,8 @@ main: {
.word $7b
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((const byte*) main::SCREEN) ← *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [5] *((const byte*) main::SCREEN+(byte) 1) ← *((byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [4] *((const byte*) main::SCREEN) ← *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [5] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) [ ] ( main:2 [ ] ) always clobbers reg byte a
REGISTER UPLIFT SCOPES
Uplift Scope [Person]
@ -232,10 +232,10 @@ __bend:
main: {
.label SCREEN = $400
.label person = persons+SIZEOF_STRUCT_PERSON
// [4] *((const byte*) main::SCREEN) ← *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) -- _deref_pbuc1=_deref_pbuc2
// [4] *((const byte*) main::SCREEN) ← *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) -- _deref_pbuc1=_deref_pbuc2
lda persons+OFFSET_STRUCT_PERSON_NAME+2
sta SCREEN
// [5] *((const byte*) main::SCREEN+(byte) 1) ← *((byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) -- _deref_pbuc1=_deref_pbuc2
// [5] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) -- _deref_pbuc1=_deref_pbuc2
lda person+OFFSET_STRUCT_PERSON_NAME+2
sta SCREEN+1
jmp __breturn
@ -282,14 +282,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 = { { id: (byte) 7, name: (string) "jesper", age: (word) $141 }, { id: (byte) 9, name: (string) "henry", age: (word) $7b } }
(const struct Person*) main::person#1 person = (const struct Person*) persons+(const byte) SIZEOF_STRUCT_PERSON
(const struct Person*) persons = { { id: (byte) 7, name: (string) "jesper", age: (word) $141 }, { id: (byte) 9, name: (string) "henry", age: (word) $7b } }
@ -316,11 +316,11 @@ main: {
.label SCREEN = $400
.label person = persons+SIZEOF_STRUCT_PERSON
// SCREEN[0] = person->name[2]
// [4] *((const byte*) main::SCREEN) ← *((byte[$d])(const struct Person[2]) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) -- _deref_pbuc1=_deref_pbuc2
// [4] *((const byte*) main::SCREEN) ← *((byte*)(const struct Person*) persons+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) -- _deref_pbuc1=_deref_pbuc2
lda persons+OFFSET_STRUCT_PERSON_NAME+2
sta SCREEN
// SCREEN[1] = person->name[2]
// [5] *((const byte*) main::SCREEN+(byte) 1) ← *((byte[$d])(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) -- _deref_pbuc1=_deref_pbuc2
// [5] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Person*) main::person#1+(const byte) OFFSET_STRUCT_PERSON_NAME+(byte) 2) -- _deref_pbuc1=_deref_pbuc2
lda person+OFFSET_STRUCT_PERSON_NAME+2
sta SCREEN+1
// main::@return

View File

@ -4,12 +4,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 = { { id: (byte) 7, name: (string) "jesper", age: (word) $141 }, { id: (byte) 9, name: (string) "henry", age: (word) $7b } }
(const struct Person*) main::person#1 person = (const struct Person*) persons+(const byte) SIZEOF_STRUCT_PERSON
(const struct Person*) persons = { { id: (byte) 7, name: (string) "jesper", age: (word) $141 }, { id: (byte) 9, name: (string) "henry", age: (word) $7b } }