1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-02-11 16:30:56 +00:00

Progress on memory variables. Added identification of identical memory registers. #328

This commit is contained in:
jespergravgaard 2019-10-01 22:28:54 +02:00
parent 7b7d7de49d
commit 75dbe31cef
22 changed files with 153 additions and 111 deletions

View File

@ -0,0 +1,6 @@
clc
adc {m1}
sta {m1}
bcc !+
inc {m1}+1
!:

View File

@ -1,6 +1,5 @@
lda {z1}
clc
adc #{c1}
adc {z1}
sta {z1}
bcc !+
inc {z1}+1

View File

@ -0,0 +1,2 @@
clc
adc {m1}

View File

@ -365,7 +365,7 @@ public class AsmFragmentInstanceSpecFactory {
} else if(value instanceof StackPushValue) {
SymbolType type = ((StackPushValue) value).getType();
String typeShortName = Operators.getCastUnary(type).getAsmOperator().replace("_", "");
return "_stackpush" + typeShortName + "_";
return "_stackpush" + typeShortName + "_";
} else if(value instanceof StackPullValue) {
SymbolType type = ((StackPullValue) value).getType();
String typeShortName = Operators.getCastUnary(type).getAsmOperator().replace("_", "");
@ -479,9 +479,23 @@ public class AsmFragmentInstanceSpecFactory {
}
return "z" + zpNameIdx;
} else if(Registers.RegisterType.MEMORY.equals(register.getType())) {
// TODO: Examine of Memory is already bound!
return "m"+(nextMemIdx++);
String memNameIdx = null;
for(String boundName : bindings.keySet()) {
Value boundValue = bindings.get(boundName);
if(boundValue instanceof Variable) {
Registers.Register boundRegister = ((Variable) boundValue).getAllocation();
if(boundRegister instanceof Registers.RegisterMemory) {
if(boundRegister.equals(register)) {
memNameIdx = boundName.substring(boundName.length() - 1);
break;
}
}
}
}
if(memNameIdx == null) {
memNameIdx = Integer.toString(nextMemIdx++);
}
return "m" + memNameIdx;
} else if(Registers.RegisterType.REG_A_BYTE.equals(register.getType())) {
return "aa";
} else if(Registers.RegisterType.REG_X_BYTE.equals(register.getType())) {

View File

@ -108,12 +108,12 @@ public class AsmFragmentTemplate {
Variable v4 = new Variable("m4", scope, SymbolType.BYTE, null, SymbolVariable.StorageStrategy.MEMORY);
Variable v5 = new Variable("m5", scope, SymbolType.BYTE, null, SymbolVariable.StorageStrategy.MEMORY);
Variable v6 = new Variable("m6", scope, SymbolType.BYTE, null, SymbolVariable.StorageStrategy.MEMORY);
v1.setAllocation(new Registers.RegisterMemory());
v2.setAllocation(new Registers.RegisterMemory());
v3.setAllocation(new Registers.RegisterMemory());
v4.setAllocation(new Registers.RegisterMemory());
v5.setAllocation(new Registers.RegisterMemory());
v6.setAllocation(new Registers.RegisterMemory());
v1.setAllocation(new Registers.RegisterMemory(v1.getRef()));
v2.setAllocation(new Registers.RegisterMemory(v2.getRef()));
v3.setAllocation(new Registers.RegisterMemory(v3.getRef()));
v4.setAllocation(new Registers.RegisterMemory(v4.getRef()));
v5.setAllocation(new Registers.RegisterMemory(v5.getRef()));
v6.setAllocation(new Registers.RegisterMemory(v6.getRef()));
if(signature.contains("m1")) bindings.put("m1", v1);
if(signature.contains("m2")) bindings.put("m2", v2);
if(signature.contains("m3")) bindings.put("m3", v3);

View File

@ -481,6 +481,8 @@ class AsmFragmentTemplateSynthesisRule {
synths.add(new AsmFragmentTemplateSynthesisRule("(...aa)=(.*vb.)m1(.*)", rvalAa+"|"+ twoM1, "lda {m1}", "$1=$2aa$3", null, mapM1));
// Replace assigned M1 with AA
synths.add(new AsmFragmentTemplateSynthesisRule("(vb.)m1=(.*)", twoM1, null, "$1aa=$2", "sta {m1}", mapM1));
// Replace assigned M1 with AA
synths.add(new AsmFragmentTemplateSynthesisRule("(vb.)m1=(.*m1.*)", null, null, "$1aa=$2", "sta {m1}", null));
// Correct wrong ordered Z2/Z1

View File

@ -67,6 +67,16 @@ public class Registers {
public static class RegisterMemory implements Register {
private VariableRef variableRef;
public RegisterMemory(VariableRef variableRef) {
this.variableRef = variableRef;
}
public VariableRef getVariableRef() {
return variableRef;
}
@Override
public RegisterType getType() {
return RegisterType.MEMORY;
@ -79,13 +89,26 @@ public class Registers {
@Override
public String toString() {
return "mem";
return "mem "+variableRef.toString();
}
@Override
public String toString(Program program) {
return toString();
}
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
RegisterMemory that = (RegisterMemory) o;
return Objects.equals(variableRef, that.variableRef);
}
@Override
public int hashCode() {
return Objects.hash(variableRef);
}
}
public static abstract class RegisterZp implements Register {

View File

@ -185,7 +185,7 @@ public class Pass4RegistersFinalize extends Pass2Base {
VariableRef variableRef = equivalenceClass.getVariables().get(0);
Variable variable = getProgram().getSymbolInfos().getVariable(variableRef);
if(variable.isStorageMemory()) {
register = new Registers.RegisterMemory();
register = new Registers.RegisterMemory(variableRef);
} else {
register = allocateNewRegisterZp(variable);
}

View File

@ -13,9 +13,9 @@ main: {
__b1:
lda idx
sta SCREEN,x
stx.z $ff
txa
clc
adc.z $ff
adc idx
sta idx
inx
cpx #6

View File

@ -122,7 +122,7 @@ Complete equivalence classes
[ main::i#2 main::i#1 ]
[ idx ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated mem [ idx ]
Allocated mem idx [ idx ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@ -172,7 +172,7 @@ main: {
lda idx
ldy.z i
sta SCREEN,y
// [7] (byte) idx ← (byte) idx + (byte) main::i#2 -- vbum1=vbum2_plus_vbuz1
// [7] (byte) idx ← (byte) idx + (byte) main::i#2 -- vbum1=vbum1_plus_vbuz1
lda idx
clc
adc.z i
@ -201,14 +201,14 @@ Statement [0] (byte) idx ← (byte) 0 [ idx ] ( [ idx ] ) always clobbers reg b
Statement [6] *((const byte*) SCREEN + (byte) main::i#2) ← (byte) idx [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
Statement [7] (byte) idx ← (byte) idx + (byte) main::i#2 [ idx main::i#2 ] ( main:2 [ idx main::i#2 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers mem [ idx ] : mem ,
Potential registers mem idx [ idx ] : mem idx ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 31.17: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope [] 5: mem [ idx ]
Uplift Scope [] 5: mem idx [ idx ]
Uplifting [main] best 449 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 449 combination mem [ idx ]
Uplifting [main] best 409 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 409 combination mem idx [ idx ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -254,11 +254,10 @@ main: {
// [6] *((const byte*) SCREEN + (byte) main::i#2) ← (byte) idx -- pbuc1_derefidx_vbuxx=vbum1
lda idx
sta SCREEN,x
// [7] (byte) idx ← (byte) idx + (byte) main::i#2 -- vbum1=vbum2_plus_vbuxx
lda idx
stx.z $ff
// [7] (byte) idx ← (byte) idx + (byte) main::i#2 -- vbum1=vbum1_plus_vbuxx
txa
clc
adc.z $ff
adc idx
sta idx
// [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
@ -280,8 +279,6 @@ Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda idx
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __b1_from___b1 with __b1
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
@ -303,7 +300,7 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(const byte*) SCREEN SCREEN = (byte*) 1024
(byte) idx memory mem 5.0
(byte) idx memory mem idx 5.0
(void()) main()
(label) main::@1
(label) main::@return
@ -312,7 +309,7 @@ FINAL SYMBOL TABLE
(byte) main::i#2 reg byte x 14.666666666666666
reg byte x [ main::i#2 main::i#1 ]
mem [ idx ]
mem idx [ idx ]
FINAL ASSEMBLER
@ -354,10 +351,10 @@ main: {
lda idx
sta SCREEN,x
// idx +=i
// [7] (byte) idx ← (byte) idx + (byte) main::i#2 -- vbum1=vbum2_plus_vbuxx
stx.z $ff
// [7] (byte) idx ← (byte) idx + (byte) main::i#2 -- vbum1=vbum1_plus_vbuxx
txa
clc
adc.z $ff
adc idx
sta idx
// for( char i: 0..5 )
// [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx

View File

@ -2,7 +2,7 @@
(label) @begin
(label) @end
(const byte*) SCREEN SCREEN = (byte*) 1024
(byte) idx memory mem 5.0
(byte) idx memory mem idx 5.0
(void()) main()
(label) main::@1
(label) main::@return
@ -11,4 +11,4 @@
(byte) main::i#2 reg byte x 14.666666666666666
reg byte x [ main::i#2 main::i#1 ]
mem [ idx ]
mem idx [ idx ]

View File

@ -143,7 +143,7 @@ Complete equivalence classes
[ main::i#2 main::i#1 ]
[ idx ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated mem [ idx ]
Allocated mem idx [ idx ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@ -224,14 +224,14 @@ Statement [0] (byte) idx ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [6] *((const byte*) SCREEN + (byte) main::i#2) ← *((const byte*) idx_p#0) [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
Statement [7] *((const byte*) idx_p#0) ← *((const byte*) idx_p#0) + (byte) main::i#2 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers mem [ idx ] : mem ,
Potential registers mem idx [ idx ] : mem idx ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 31.17: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope [] 20: mem [ idx ]
Uplift Scope [] 20: mem idx [ idx ]
Uplifting [main] best 409 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 409 combination mem [ idx ]
Uplifting [] best 409 combination mem idx [ idx ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -325,7 +325,7 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(const byte*) SCREEN SCREEN = (byte*) 1024
(byte) idx memory mem 20.0
(byte) idx memory mem idx 20.0
(byte*) idx_p
(const byte*) idx_p#0 idx_p = &(byte) idx
(void()) main()
@ -336,7 +336,7 @@ FINAL SYMBOL TABLE
(byte) main::i#2 reg byte x 14.666666666666666
reg byte x [ main::i#2 main::i#1 ]
mem [ idx ]
mem idx [ idx ]
FINAL ASSEMBLER

View File

@ -2,7 +2,7 @@
(label) @begin
(label) @end
(const byte*) SCREEN SCREEN = (byte*) 1024
(byte) idx memory mem 20.0
(byte) idx memory mem idx 20.0
(byte*) idx_p
(const byte*) idx_p#0 idx_p = &(byte) idx
(void()) main()
@ -13,4 +13,4 @@
(byte) main::i#2 reg byte x 14.666666666666666
reg byte x [ main::i#2 main::i#1 ]
mem [ idx ]
mem idx [ idx ]

View File

@ -25,9 +25,9 @@ main: {
clc
adc cursor
sta cursor
tya
adc cursor+1
sta cursor+1
bcc !+
inc cursor+1
!:
inx
cpx #$19
bne __b1

View File

@ -128,7 +128,7 @@ Complete equivalence classes
[ main::i#2 main::i#1 ]
[ cursor ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated mem [ cursor ]
Allocated mem cursor [ cursor ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@ -185,14 +185,14 @@ main: {
sty.z $ff
ldy #0
sta ($fe),y
// [7] (byte*) cursor ← (byte*) cursor + (byte) $29 -- pbum1=pbum2_plus_vbuc1
// [7] (byte*) cursor ← (byte*) cursor + (byte) $29 -- pbum1=pbum1_plus_vbuc1
lda #$29
clc
adc cursor
sta cursor
lda #0
adc cursor+1
sta cursor+1
bcc !+
inc cursor+1
!:
// [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc.z i
// [9] if((byte) main::i#1!=(byte) $19) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
@ -218,14 +218,14 @@ Statement [0] (byte*) cursor ← (const byte*) SCREEN [ cursor ] ( [ cursor ] )
Statement [6] *((byte*) cursor) ← (byte) '*' [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a reg byte y
Statement [7] (byte*) cursor ← (byte*) cursor + (byte) $29 [ cursor main::i#2 ] ( main:2 [ cursor main::i#2 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x ,
Potential registers mem [ cursor ] : mem ,
Potential registers mem cursor [ cursor ] : mem cursor ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 23.83: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope [] 5: mem [ cursor ]
Uplift Scope [] 5: mem cursor [ cursor ]
Uplifting [main] best 665 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 665 combination mem [ cursor ]
Uplifting [main] best 650 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 650 combination mem cursor [ cursor ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -279,14 +279,14 @@ main: {
sty.z $ff
ldy #0
sta ($fe),y
// [7] (byte*) cursor ← (byte*) cursor + (byte) $29 -- pbum1=pbum2_plus_vbuc1
// [7] (byte*) cursor ← (byte*) cursor + (byte) $29 -- pbum1=pbum1_plus_vbuc1
lda #$29
clc
adc cursor
sta cursor
lda #0
adc cursor+1
sta cursor+1
bcc !+
inc cursor+1
!:
// [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
// [9] if((byte) main::i#1!=(byte) $19) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
@ -307,7 +307,6 @@ Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing instruction lda #0 with TYA
Replacing label __b1_from___b1 with __b1
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
@ -329,7 +328,7 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(const byte*) SCREEN SCREEN = (byte*) 1024
(byte*) cursor memory mem 5.0
(byte*) cursor memory mem cursor 5.0
(void()) main()
(label) main::@1
(label) main::@return
@ -338,11 +337,11 @@ FINAL SYMBOL TABLE
(byte) main::i#2 reg byte x 7.333333333333333
reg byte x [ main::i#2 main::i#1 ]
mem [ cursor ]
mem cursor [ cursor ]
FINAL ASSEMBLER
Score: 575
Score: 560
// File Comments
// Test declaring a variable as "memory", meaning it will be stored in memory and accessed through an implicit pointer (using load/store)
@ -388,14 +387,14 @@ main: {
ldy #0
sta ($fe),y
// cursor += 41
// [7] (byte*) cursor ← (byte*) cursor + (byte) $29 -- pbum1=pbum2_plus_vbuc1
// [7] (byte*) cursor ← (byte*) cursor + (byte) $29 -- pbum1=pbum1_plus_vbuc1
lda #$29
clc
adc cursor
sta cursor
tya
adc cursor+1
sta cursor+1
bcc !+
inc cursor+1
!:
// for( char i: 0..24 )
// [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx

View File

@ -2,7 +2,7 @@
(label) @begin
(label) @end
(const byte*) SCREEN SCREEN = (byte*) 1024
(byte*) cursor memory mem 5.0
(byte*) cursor memory mem cursor 5.0
(void()) main()
(label) main::@1
(label) main::@return
@ -11,4 +11,4 @@
(byte) main::i#2 reg byte x 7.333333333333333
reg byte x [ main::i#2 main::i#1 ]
mem [ cursor ]
mem cursor [ cursor ]

View File

@ -159,8 +159,8 @@ Added variable bar_thing2 to zero page equivalence class [ bar_thing2 ]
Complete equivalence classes
[ bar_thing1 ]
[ bar_thing2 ]
Allocated mem [ bar_thing1 ]
Allocated mem [ bar_thing2 ]
Allocated mem bar_thing1 [ bar_thing1 ]
Allocated mem bar_thing2 [ bar_thing2 ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@ -218,15 +218,15 @@ Statement [0] (byte) bar_thing1 ← (byte) 'a' [ ] ( [ ] ) always clobbers reg
Statement [1] (byte) bar_thing2 ← (byte) 'b' [ ] ( [ ] ) always clobbers reg byte a
Statement [5] *((const byte*) main::SCREEN) ← *((byte*)(const struct foo*) main::barp#0) [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [6] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct foo*) main::barp#0+(const byte) OFFSET_STRUCT_FOO_THING2) [ ] ( main:3 [ ] ) always clobbers reg byte a
Potential registers mem [ bar_thing1 ] : mem ,
Potential registers mem [ bar_thing2 ] : mem ,
Potential registers mem bar_thing1 [ bar_thing1 ] : mem bar_thing1 ,
Potential registers mem bar_thing2 [ bar_thing2 ] : mem bar_thing2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 20: mem [ bar_thing1 ] 20: mem [ bar_thing2 ]
Uplift Scope [] 20: mem bar_thing1 [ bar_thing1 ] 20: mem bar_thing2 [ bar_thing2 ]
Uplift Scope [foo]
Uplift Scope [main]
Uplifting [] best 49 combination mem [ bar_thing1 ] mem [ bar_thing2 ]
Uplifting [] best 49 combination mem bar_thing1 [ bar_thing1 ] mem bar_thing2 [ bar_thing2 ]
Uplifting [foo] best 49 combination
Uplifting [main] best 49 combination
@ -300,8 +300,8 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_FOO_THING2 OFFSET_STRUCT_FOO_THING2 = (byte) 1
(byte) bar_thing1 memory mem 20.0
(byte) bar_thing2 memory mem 20.0
(byte) bar_thing1 memory mem bar_thing1 20.0
(byte) bar_thing2 memory mem bar_thing2 20.0
(byte) foo::thing1
(byte) foo::thing2
(void()) main()
@ -311,8 +311,8 @@ FINAL SYMBOL TABLE
(const struct foo*) main::barp#0 barp = (struct foo*)&(byte) bar_thing1
(byte) main::i
mem [ bar_thing1 ]
mem [ bar_thing2 ]
mem bar_thing1 [ bar_thing1 ]
mem bar_thing2 [ bar_thing2 ]
FINAL ASSEMBLER

View File

@ -2,8 +2,8 @@
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_FOO_THING2 OFFSET_STRUCT_FOO_THING2 = (byte) 1
(byte) bar_thing1 memory mem 20.0
(byte) bar_thing2 memory mem 20.0
(byte) bar_thing1 memory mem bar_thing1 20.0
(byte) bar_thing2 memory mem bar_thing2 20.0
(byte) foo::thing1
(byte) foo::thing2
(void()) main()
@ -13,5 +13,5 @@
(const struct foo*) main::barp#0 barp = (struct foo*)&(byte) bar_thing1
(byte) main::i
mem [ bar_thing1 ]
mem [ bar_thing2 ]
mem bar_thing1 [ bar_thing1 ]
mem bar_thing2 [ bar_thing2 ]

View File

@ -249,8 +249,8 @@ Complete equivalence classes
Allocated zp ZP_BYTE:2 [ main::j#2 main::j#1 ]
Allocated zp ZP_BYTE:3 [ main::i#4 main::i#3 ]
Allocated zp ZP_WORD:4 [ bar_thing3#0 ]
Allocated mem [ bar_thing1 ]
Allocated mem [ bar_thing2 ]
Allocated mem bar_thing1 [ bar_thing1 ]
Allocated mem bar_thing2 [ bar_thing2 ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@ -361,15 +361,15 @@ Statement [9] *((const byte*) main::SCREEN + (byte) main::i#4) ← *((byte[$c])(
Potential registers zp ZP_BYTE:2 [ main::j#2 main::j#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::i#4 main::i#3 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
Potential registers zp ZP_WORD:4 [ bar_thing3#0 ] : zp ZP_WORD:4 ,
Potential registers mem [ bar_thing1 ] : mem ,
Potential registers mem [ bar_thing2 ] : mem ,
Potential registers mem bar_thing1 [ bar_thing1 ] : mem bar_thing1 ,
Potential registers mem bar_thing2 [ bar_thing2 ] : mem bar_thing2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 20: zp ZP_WORD:4 [ bar_thing3#0 ] 20: mem [ bar_thing1 ] 20: mem [ bar_thing2 ]
Uplift Scope [] 20: zp ZP_WORD:4 [ bar_thing3#0 ] 20: mem bar_thing1 [ bar_thing1 ] 20: mem bar_thing2 [ bar_thing2 ]
Uplift Scope [main] 27.5: zp ZP_BYTE:2 [ main::j#2 main::j#1 ] 23.83: zp ZP_BYTE:3 [ main::i#4 main::i#3 ]
Uplift Scope [foo]
Uplifting [] best 576 combination zp ZP_WORD:4 [ bar_thing3#0 ] mem [ bar_thing1 ] mem [ bar_thing2 ]
Uplifting [] best 576 combination zp ZP_WORD:4 [ bar_thing3#0 ] mem bar_thing1 [ bar_thing1 ] mem bar_thing2 [ bar_thing2 ]
Uplifting [main] best 366 combination reg byte y [ main::j#2 main::j#1 ] reg byte x [ main::i#4 main::i#3 ]
Uplifting [foo] best 366 combination
Allocated (was zp ZP_WORD:4) zp ZP_WORD:2 [ bar_thing3#0 ]
@ -485,8 +485,8 @@ FINAL SYMBOL TABLE
(label) @end
(const byte) OFFSET_STRUCT_FOO_THING2 OFFSET_STRUCT_FOO_THING2 = (byte) 1
(const byte) OFFSET_STRUCT_FOO_THING3 OFFSET_STRUCT_FOO_THING3 = (byte) 2
(byte) bar_thing1 memory mem 20.0
(byte) bar_thing2 memory mem 20.0
(byte) bar_thing1 memory mem bar_thing1 20.0
(byte) bar_thing2 memory mem bar_thing2 20.0
(byte[$c]) bar_thing3
(byte[$c]) bar_thing3#0 bar_thing3 zp ZP_WORD:2 20.0
(byte) foo::thing1
@ -508,8 +508,8 @@ FINAL SYMBOL TABLE
reg byte y [ main::j#2 main::j#1 ]
reg byte x [ main::i#4 main::i#3 ]
zp ZP_WORD:2 [ bar_thing3#0 ]
mem [ bar_thing1 ]
mem [ bar_thing2 ]
mem bar_thing1 [ bar_thing1 ]
mem bar_thing2 [ bar_thing2 ]
FINAL ASSEMBLER

View File

@ -4,8 +4,8 @@
(label) @end
(const byte) OFFSET_STRUCT_FOO_THING2 OFFSET_STRUCT_FOO_THING2 = (byte) 1
(const byte) OFFSET_STRUCT_FOO_THING3 OFFSET_STRUCT_FOO_THING3 = (byte) 2
(byte) bar_thing1 memory mem 20.0
(byte) bar_thing2 memory mem 20.0
(byte) bar_thing1 memory mem bar_thing1 20.0
(byte) bar_thing2 memory mem bar_thing2 20.0
(byte[$c]) bar_thing3
(byte[$c]) bar_thing3#0 bar_thing3 zp ZP_WORD:2 20.0
(byte) foo::thing1
@ -27,5 +27,5 @@
reg byte y [ main::j#2 main::j#1 ]
reg byte x [ main::i#4 main::i#3 ]
zp ZP_WORD:2 [ bar_thing3#0 ]
mem [ bar_thing1 ]
mem [ bar_thing2 ]
mem bar_thing1 [ bar_thing1 ]
mem bar_thing2 [ bar_thing2 ]

View File

@ -126,8 +126,8 @@ Added variable bar_thing2 to zero page equivalence class [ bar_thing2 ]
Complete equivalence classes
[ bar_thing1 ]
[ bar_thing2 ]
Allocated mem [ bar_thing1 ]
Allocated mem [ bar_thing2 ]
Allocated mem bar_thing1 [ bar_thing1 ]
Allocated mem bar_thing2 [ bar_thing2 ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@ -183,15 +183,15 @@ Statement [0] (byte) bar_thing1 ← (byte) 'a' [ bar_thing1 ] ( [ bar_thing1 ]
Statement [1] (byte) bar_thing2 ← (byte) 'b' [ bar_thing1 bar_thing2 ] ( [ bar_thing1 bar_thing2 ] ) always clobbers reg byte a
Statement [5] *((const byte*) main::SCREEN) ← (byte) bar_thing1 [ bar_thing2 ] ( main:3 [ bar_thing2 ] ) always clobbers reg byte a
Statement [6] *((const byte*) main::SCREEN+(byte) 1) ← (byte) bar_thing2 [ ] ( main:3 [ ] ) always clobbers reg byte a
Potential registers mem [ bar_thing1 ] : mem ,
Potential registers mem [ bar_thing2 ] : mem ,
Potential registers mem bar_thing1 [ bar_thing1 ] : mem bar_thing1 ,
Potential registers mem bar_thing2 [ bar_thing2 ] : mem bar_thing2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 1.33: mem [ bar_thing1 ] 1.33: mem [ bar_thing2 ]
Uplift Scope [] 1.33: mem bar_thing1 [ bar_thing1 ] 1.33: mem bar_thing2 [ bar_thing2 ]
Uplift Scope [foo]
Uplift Scope [main]
Uplifting [] best 49 combination mem [ bar_thing1 ] mem [ bar_thing2 ]
Uplifting [] best 49 combination mem bar_thing1 [ bar_thing1 ] mem bar_thing2 [ bar_thing2 ]
Uplifting [foo] best 49 combination
Uplifting [main] best 49 combination
@ -262,8 +262,8 @@ FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(byte) bar_thing1 memory mem 1.3333333333333333
(byte) bar_thing2 memory mem 1.3333333333333333
(byte) bar_thing1 memory mem bar_thing1 1.3333333333333333
(byte) bar_thing2 memory mem bar_thing2 1.3333333333333333
(byte) foo::thing1
(byte) foo::thing2
(void()) main()
@ -271,8 +271,8 @@ FINAL SYMBOL TABLE
(const byte*) main::SCREEN SCREEN = (byte*) 1024
(byte) main::i
mem [ bar_thing1 ]
mem [ bar_thing2 ]
mem bar_thing1 [ bar_thing1 ]
mem bar_thing2 [ bar_thing2 ]
FINAL ASSEMBLER

View File

@ -1,8 +1,8 @@
(label) @1
(label) @begin
(label) @end
(byte) bar_thing1 memory mem 1.3333333333333333
(byte) bar_thing2 memory mem 1.3333333333333333
(byte) bar_thing1 memory mem bar_thing1 1.3333333333333333
(byte) bar_thing2 memory mem bar_thing2 1.3333333333333333
(byte) foo::thing1
(byte) foo::thing2
(void()) main()
@ -10,5 +10,5 @@
(const byte*) main::SCREEN SCREEN = (byte*) 1024
(byte) main::i
mem [ bar_thing1 ]
mem [ bar_thing2 ]
mem bar_thing1 [ bar_thing1 ]
mem bar_thing2 [ bar_thing2 ]