mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-27 04:49:27 +00:00
Renaming.
This commit is contained in:
parent
949917f734
commit
873adf0b26
@ -81,7 +81,7 @@ public class AsmFragmentInstance {
|
||||
Registers.Register register = boundVar.getAllocation();
|
||||
if(register != null && register instanceof Registers.RegisterZp) {
|
||||
return new AsmParameter(AsmFormat.getAsmParamName(boundVar, codeScopeRef), true);
|
||||
} else if(register!=null && register instanceof Registers.RegisterMemory) {
|
||||
} else if(register!=null && register instanceof Registers.RegisterMainMem) {
|
||||
return new AsmParameter(AsmFormat.getAsmParamName(boundVar, codeScopeRef), false);
|
||||
} else {
|
||||
throw new RuntimeException("Register Type not implemented " + register);
|
||||
|
@ -472,13 +472,13 @@ public class AsmFragmentInstanceSpecFactory {
|
||||
zpNameIdx = Integer.toString(nextZpIdx++);
|
||||
}
|
||||
return "z" + zpNameIdx;
|
||||
} else if(Registers.RegisterType.MEMORY.equals(register.getType())) {
|
||||
} else if(Registers.RegisterType.MAIN_MEM.equals(register.getType())) {
|
||||
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 instanceof Registers.RegisterMainMem) {
|
||||
if(boundRegister.equals(register)) {
|
||||
memNameIdx = boundName.substring(boundName.length() - 1);
|
||||
break;
|
||||
|
@ -106,12 +106,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(v1.getRef(), 1));
|
||||
v2.setAllocation(new Registers.RegisterMemory(v2.getRef(), 1));
|
||||
v3.setAllocation(new Registers.RegisterMemory(v3.getRef(), 1));
|
||||
v4.setAllocation(new Registers.RegisterMemory(v4.getRef(), 1));
|
||||
v5.setAllocation(new Registers.RegisterMemory(v5.getRef(), 1));
|
||||
v6.setAllocation(new Registers.RegisterMemory(v6.getRef(), 1));
|
||||
v1.setAllocation(new Registers.RegisterMainMem(v1.getRef(), 1));
|
||||
v2.setAllocation(new Registers.RegisterMainMem(v2.getRef(), 1));
|
||||
v3.setAllocation(new Registers.RegisterMainMem(v3.getRef(), 1));
|
||||
v4.setAllocation(new Registers.RegisterMainMem(v4.getRef(), 1));
|
||||
v5.setAllocation(new Registers.RegisterMainMem(v5.getRef(), 1));
|
||||
v6.setAllocation(new Registers.RegisterMainMem(v6.getRef(), 1));
|
||||
if(signature.contains("m1")) bindings.put("m1", v1);
|
||||
if(signature.contains("m2")) bindings.put("m2", v2);
|
||||
if(signature.contains("m3")) bindings.put("m3", v3);
|
||||
|
@ -48,8 +48,8 @@ public class Registers {
|
||||
REG_ALU,
|
||||
ZP_VAR,
|
||||
ZP_MEM,
|
||||
MAIN_MEM,
|
||||
CONSTANT,
|
||||
MEMORY
|
||||
}
|
||||
|
||||
/** A register used for storing a single variable. */
|
||||
@ -65,13 +65,13 @@ public class Registers {
|
||||
|
||||
}
|
||||
|
||||
public static class RegisterMemory implements Register {
|
||||
public static class RegisterMainMem implements Register {
|
||||
|
||||
private VariableRef variableRef;
|
||||
|
||||
private int bytes;
|
||||
|
||||
public RegisterMemory(VariableRef variableRef, int bytes ) {
|
||||
public RegisterMainMem(VariableRef variableRef, int bytes ) {
|
||||
this.variableRef = variableRef;
|
||||
this.bytes = bytes;
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class Registers {
|
||||
|
||||
@Override
|
||||
public RegisterType getType() {
|
||||
return RegisterType.MEMORY;
|
||||
return RegisterType.MAIN_MEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -114,7 +114,7 @@ public class Registers {
|
||||
public boolean equals(Object o) {
|
||||
if(this == o) return true;
|
||||
if(o == null || getClass() != o.getClass()) return false;
|
||||
RegisterMemory that = (RegisterMemory) o;
|
||||
RegisterMainMem that = (RegisterMainMem) o;
|
||||
return Objects.equals(variableRef, that.variableRef);
|
||||
}
|
||||
|
||||
@ -237,27 +237,13 @@ public class Registers {
|
||||
/** A zero page address used as a register for a declared register allocation. Size is initially unknown and will be resolved when performing allocation by setting the type. */
|
||||
public static class RegisterZpDeclared extends RegisterZp {
|
||||
|
||||
private RegisterType type;
|
||||
|
||||
private int bytes;
|
||||
|
||||
public RegisterZpDeclared(int zp) {
|
||||
super(zp);
|
||||
this.type = RegisterType.ZP_VAR;
|
||||
this.bytes = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegisterType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(RegisterType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setBytes(int bytes) {
|
||||
this.bytes = bytes;
|
||||
return RegisterType.ZP_MEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -267,7 +253,7 @@ public class Registers {
|
||||
|
||||
@Override
|
||||
public int getBytes() {
|
||||
return bytes;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public RegisterZpMem getZpRegister(int bytes) {
|
||||
@ -276,16 +262,12 @@ public class Registers {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if(this == o) return true;
|
||||
if(o == null || getClass() != o.getClass()) return false;
|
||||
if(!super.equals(o)) return false;
|
||||
RegisterZpDeclared that = (RegisterZpDeclared) o;
|
||||
return type == that.type;
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), type);
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -180,7 +180,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(variableRef, variable.getType().getSizeBytes());
|
||||
register = new Registers.RegisterMainMem(variableRef, variable.getType().getSizeBytes());
|
||||
} else {
|
||||
register = allocateNewRegisterZp(variable);
|
||||
}
|
||||
|
@ -93,12 +93,12 @@ SYMBOL TABLE SSA
|
||||
(label) print2::@2
|
||||
(label) print2::@7
|
||||
(label) print2::@return
|
||||
(byte*) print2::at !zp ZP_VAR:250
|
||||
(byte*) print2::at#0 !zp ZP_VAR:250
|
||||
(byte*) print2::at#1 !zp ZP_VAR:250
|
||||
(byte*) print2::at#2 !zp ZP_VAR:250
|
||||
(byte*) print2::at#3 !zp ZP_VAR:250
|
||||
(byte*) print2::at#4 !zp ZP_VAR:250
|
||||
(byte*) print2::at !zp ZP_MEM:250
|
||||
(byte*) print2::at#0 !zp ZP_MEM:250
|
||||
(byte*) print2::at#1 !zp ZP_MEM:250
|
||||
(byte*) print2::at#2 !zp ZP_MEM:250
|
||||
(byte*) print2::at#3 !zp ZP_MEM:250
|
||||
(byte*) print2::at#4 !zp ZP_MEM:250
|
||||
(byte) print2::i
|
||||
(byte) print2::i#0
|
||||
(byte) print2::i#1
|
||||
@ -111,17 +111,17 @@ SYMBOL TABLE SSA
|
||||
(byte) print2::j#2
|
||||
(byte) print2::j#3
|
||||
(byte) print2::j#4
|
||||
(byte*) print2::msg !zp ZP_VAR:252
|
||||
(byte*) print2::msg#0 !zp ZP_VAR:252
|
||||
(byte*) print2::msg#1 !zp ZP_VAR:252
|
||||
(byte*) print2::msg#2 !zp ZP_VAR:252
|
||||
(byte*) print2::msg#3 !zp ZP_VAR:252
|
||||
(byte*) print2::msg#4 !zp ZP_VAR:252
|
||||
(byte*) print2::msg !zp ZP_MEM:252
|
||||
(byte*) print2::msg#0 !zp ZP_MEM:252
|
||||
(byte*) print2::msg#1 !zp ZP_MEM:252
|
||||
(byte*) print2::msg#2 !zp ZP_MEM:252
|
||||
(byte*) print2::msg#3 !zp ZP_MEM:252
|
||||
(byte*) print2::msg#4 !zp ZP_MEM:252
|
||||
(void()) print_char((byte*) print_char::at , (byte) print_char::idx , (byte) print_char::ch)
|
||||
(label) print_char::@return
|
||||
(byte*) print_char::at !zp ZP_VAR:250
|
||||
(byte*) print_char::at#0 !zp ZP_VAR:250
|
||||
(byte*) print_char::at#1 !zp ZP_VAR:250
|
||||
(byte*) print_char::at !zp ZP_MEM:250
|
||||
(byte*) print_char::at#0 !zp ZP_MEM:250
|
||||
(byte*) print_char::at#1 !zp ZP_MEM:250
|
||||
(byte) print_char::ch !reg byte a
|
||||
(byte) print_char::ch#0 !reg byte a
|
||||
(byte) print_char::ch#1 !reg byte a
|
||||
@ -271,20 +271,20 @@ print_char::@return: scope:[print_char] from print_char
|
||||
VARIABLE REGISTER WEIGHTS
|
||||
(void()) main()
|
||||
(void()) print2((byte*) print2::at , (byte*) print2::msg)
|
||||
(byte*) print2::at !zp ZP_VAR:250
|
||||
(byte*) print2::at#1 !zp ZP_VAR:250 4.125
|
||||
(byte*) print2::at !zp ZP_MEM:250
|
||||
(byte*) print2::at#1 !zp ZP_MEM:250 4.125
|
||||
(byte) print2::i
|
||||
(byte) print2::i#1 22.0
|
||||
(byte) print2::i#2 6.285714285714286
|
||||
(byte) print2::j
|
||||
(byte) print2::j#1 11.0
|
||||
(byte) print2::j#2 5.5
|
||||
(byte*) print2::msg !zp ZP_VAR:252
|
||||
(byte*) print2::msg#1 !zp ZP_VAR:252 5.5
|
||||
(byte*) print2::msg !zp ZP_MEM:252
|
||||
(byte*) print2::msg#1 !zp ZP_MEM:252 5.5
|
||||
(void()) print_char((byte*) print_char::at , (byte) print_char::idx , (byte) print_char::ch)
|
||||
(byte*) print_char::at !zp ZP_VAR:250
|
||||
(byte*) print_char::at#0 !zp ZP_VAR:250 7.333333333333333
|
||||
(byte*) print_char::at#1 !zp ZP_VAR:250 13.0
|
||||
(byte*) print_char::at !zp ZP_MEM:250
|
||||
(byte*) print_char::at#0 !zp ZP_MEM:250 7.333333333333333
|
||||
(byte*) print_char::at#1 !zp ZP_MEM:250 13.0
|
||||
(byte) print_char::ch !reg byte a
|
||||
(byte) print_char::ch#0 !reg byte a 22.0
|
||||
(byte) print_char::ch#1 !reg byte a 13.0
|
||||
@ -636,21 +636,21 @@ FINAL SYMBOL TABLE
|
||||
(label) print2::@2
|
||||
(label) print2::@3
|
||||
(label) print2::@return
|
||||
(byte*) print2::at !zp ZP_VAR:250
|
||||
(byte*) print2::at#1 at !zp ZP_VAR:250 zp ZP_WORD:250 4.125
|
||||
(byte*) print2::at !zp ZP_MEM:250
|
||||
(byte*) print2::at#1 at !zp ZP_MEM:250 zp ZP_WORD:250 4.125
|
||||
(byte) print2::i
|
||||
(byte) print2::i#1 i zp ZP_BYTE:2 22.0
|
||||
(byte) print2::i#2 i zp ZP_BYTE:2 6.285714285714286
|
||||
(byte) print2::j
|
||||
(byte) print2::j#1 reg byte x 11.0
|
||||
(byte) print2::j#2 reg byte x 5.5
|
||||
(byte*) print2::msg !zp ZP_VAR:252
|
||||
(byte*) print2::msg#1 msg !zp ZP_VAR:252 zp ZP_WORD:252 5.5
|
||||
(byte*) print2::msg !zp ZP_MEM:252
|
||||
(byte*) print2::msg#1 msg !zp ZP_MEM:252 zp ZP_WORD:252 5.5
|
||||
(void()) print_char((byte*) print_char::at , (byte) print_char::idx , (byte) print_char::ch)
|
||||
(label) print_char::@return
|
||||
(byte*) print_char::at !zp ZP_VAR:250
|
||||
(byte*) print_char::at#0 at !zp ZP_VAR:250 zp ZP_WORD:250 7.333333333333333
|
||||
(byte*) print_char::at#1 at !zp ZP_VAR:250 zp ZP_WORD:250 13.0
|
||||
(byte*) print_char::at !zp ZP_MEM:250
|
||||
(byte*) print_char::at#0 at !zp ZP_MEM:250 zp ZP_WORD:250 7.333333333333333
|
||||
(byte*) print_char::at#1 at !zp ZP_MEM:250 zp ZP_WORD:250 13.0
|
||||
(byte) print_char::ch !reg byte a
|
||||
(byte) print_char::ch#0 !reg byte a 22.0
|
||||
(byte) print_char::ch#1 !reg byte a 13.0
|
||||
|
@ -9,21 +9,21 @@
|
||||
(label) print2::@2
|
||||
(label) print2::@3
|
||||
(label) print2::@return
|
||||
(byte*) print2::at !zp ZP_VAR:250
|
||||
(byte*) print2::at#1 at !zp ZP_VAR:250 zp ZP_WORD:250 4.125
|
||||
(byte*) print2::at !zp ZP_MEM:250
|
||||
(byte*) print2::at#1 at !zp ZP_MEM:250 zp ZP_WORD:250 4.125
|
||||
(byte) print2::i
|
||||
(byte) print2::i#1 i zp ZP_BYTE:2 22.0
|
||||
(byte) print2::i#2 i zp ZP_BYTE:2 6.285714285714286
|
||||
(byte) print2::j
|
||||
(byte) print2::j#1 reg byte x 11.0
|
||||
(byte) print2::j#2 reg byte x 5.5
|
||||
(byte*) print2::msg !zp ZP_VAR:252
|
||||
(byte*) print2::msg#1 msg !zp ZP_VAR:252 zp ZP_WORD:252 5.5
|
||||
(byte*) print2::msg !zp ZP_MEM:252
|
||||
(byte*) print2::msg#1 msg !zp ZP_MEM:252 zp ZP_WORD:252 5.5
|
||||
(void()) print_char((byte*) print_char::at , (byte) print_char::idx , (byte) print_char::ch)
|
||||
(label) print_char::@return
|
||||
(byte*) print_char::at !zp ZP_VAR:250
|
||||
(byte*) print_char::at#0 at !zp ZP_VAR:250 zp ZP_WORD:250 7.333333333333333
|
||||
(byte*) print_char::at#1 at !zp ZP_VAR:250 zp ZP_WORD:250 13.0
|
||||
(byte*) print_char::at !zp ZP_MEM:250
|
||||
(byte*) print_char::at#0 at !zp ZP_MEM:250 zp ZP_WORD:250 7.333333333333333
|
||||
(byte*) print_char::at#1 at !zp ZP_MEM:250 zp ZP_WORD:250 13.0
|
||||
(byte) print_char::ch !reg byte a
|
||||
(byte) print_char::ch#0 !reg byte a 22.0
|
||||
(byte) print_char::ch#1 !reg byte a 13.0
|
||||
|
@ -62,17 +62,17 @@ SYMBOL TABLE SSA
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::i !zp ZP_VAR:2
|
||||
(byte) main::i#0 !zp ZP_VAR:2
|
||||
(byte) main::i#1 !zp ZP_VAR:2
|
||||
(byte) main::i#2 !zp ZP_VAR:2
|
||||
(byte) main::i#3 !zp ZP_VAR:2
|
||||
(byte) main::i#4 !zp ZP_VAR:2
|
||||
(signed word) main::j !zp ZP_VAR:4
|
||||
(signed word) main::j#0 !zp ZP_VAR:4
|
||||
(signed word) main::j#1 !zp ZP_VAR:4
|
||||
(signed word) main::j#2 !zp ZP_VAR:4
|
||||
(signed word) main::j#3 !zp ZP_VAR:4
|
||||
(byte) main::i !zp ZP_MEM:2
|
||||
(byte) main::i#0 !zp ZP_MEM:2
|
||||
(byte) main::i#1 !zp ZP_MEM:2
|
||||
(byte) main::i#2 !zp ZP_MEM:2
|
||||
(byte) main::i#3 !zp ZP_MEM:2
|
||||
(byte) main::i#4 !zp ZP_MEM:2
|
||||
(signed word) main::j !zp ZP_MEM:4
|
||||
(signed word) main::j#0 !zp ZP_MEM:4
|
||||
(signed word) main::j#1 !zp ZP_MEM:4
|
||||
(signed word) main::j#2 !zp ZP_MEM:4
|
||||
(signed word) main::j#3 !zp ZP_MEM:4
|
||||
(signed word) main::k
|
||||
(signed word) main::k#0
|
||||
|
||||
@ -179,13 +179,13 @@ VARIABLE REGISTER WEIGHTS
|
||||
(signed word~) main::$1 22.0
|
||||
(byte~) main::$3 22.0
|
||||
(byte~) main::$4 22.0
|
||||
(byte) main::i !zp ZP_VAR:2
|
||||
(byte) main::i#1 !zp ZP_VAR:2 5.5
|
||||
(byte) main::i#2 !zp ZP_VAR:2 22.0
|
||||
(byte) main::i#3 !zp ZP_VAR:2 11.0
|
||||
(signed word) main::j !zp ZP_VAR:4
|
||||
(signed word) main::j#1 !zp ZP_VAR:4 3.6666666666666665
|
||||
(signed word) main::j#2 !zp ZP_VAR:4 6.6000000000000005
|
||||
(byte) main::i !zp ZP_MEM:2
|
||||
(byte) main::i#1 !zp ZP_MEM:2 5.5
|
||||
(byte) main::i#2 !zp ZP_MEM:2 22.0
|
||||
(byte) main::i#3 !zp ZP_MEM:2 11.0
|
||||
(signed word) main::j !zp ZP_MEM:4
|
||||
(signed word) main::j#1 !zp ZP_MEM:4 3.6666666666666665
|
||||
(signed word) main::j#2 !zp ZP_MEM:4 6.6000000000000005
|
||||
(signed word) main::k
|
||||
(signed word) main::k#0 11.0
|
||||
|
||||
@ -482,13 +482,13 @@ FINAL SYMBOL TABLE
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::i !zp ZP_VAR:2
|
||||
(byte) main::i#1 i !zp ZP_VAR:2 zp ZP_BYTE:2 5.5
|
||||
(byte) main::i#2 i !zp ZP_VAR:2 zp ZP_BYTE:2 22.0
|
||||
(byte) main::i#3 i !zp ZP_VAR:2 zp ZP_BYTE:2 11.0
|
||||
(signed word) main::j !zp ZP_VAR:4
|
||||
(signed word) main::j#1 j !zp ZP_VAR:4 zp ZP_WORD:4 3.6666666666666665
|
||||
(signed word) main::j#2 j !zp ZP_VAR:4 zp ZP_WORD:4 6.6000000000000005
|
||||
(byte) main::i !zp ZP_MEM:2
|
||||
(byte) main::i#1 i !zp ZP_MEM:2 zp ZP_BYTE:2 5.5
|
||||
(byte) main::i#2 i !zp ZP_MEM:2 zp ZP_BYTE:2 22.0
|
||||
(byte) main::i#3 i !zp ZP_MEM:2 zp ZP_BYTE:2 11.0
|
||||
(signed word) main::j !zp ZP_MEM:4
|
||||
(signed word) main::j#1 j !zp ZP_MEM:4 zp ZP_WORD:4 3.6666666666666665
|
||||
(signed word) main::j#2 j !zp ZP_MEM:4 zp ZP_WORD:4 6.6000000000000005
|
||||
(signed word) main::k
|
||||
(signed word) main::k#0 k zp ZP_WORD:6 11.0
|
||||
|
||||
|
@ -9,13 +9,13 @@
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@return
|
||||
(byte) main::i !zp ZP_VAR:2
|
||||
(byte) main::i#1 i !zp ZP_VAR:2 zp ZP_BYTE:2 5.5
|
||||
(byte) main::i#2 i !zp ZP_VAR:2 zp ZP_BYTE:2 22.0
|
||||
(byte) main::i#3 i !zp ZP_VAR:2 zp ZP_BYTE:2 11.0
|
||||
(signed word) main::j !zp ZP_VAR:4
|
||||
(signed word) main::j#1 j !zp ZP_VAR:4 zp ZP_WORD:4 3.6666666666666665
|
||||
(signed word) main::j#2 j !zp ZP_VAR:4 zp ZP_WORD:4 6.6000000000000005
|
||||
(byte) main::i !zp ZP_MEM:2
|
||||
(byte) main::i#1 i !zp ZP_MEM:2 zp ZP_BYTE:2 5.5
|
||||
(byte) main::i#2 i !zp ZP_MEM:2 zp ZP_BYTE:2 22.0
|
||||
(byte) main::i#3 i !zp ZP_MEM:2 zp ZP_BYTE:2 11.0
|
||||
(signed word) main::j !zp ZP_MEM:4
|
||||
(signed word) main::j#1 j !zp ZP_MEM:4 zp ZP_WORD:4 3.6666666666666665
|
||||
(signed word) main::j#2 j !zp ZP_MEM:4 zp ZP_WORD:4 6.6000000000000005
|
||||
(signed word) main::k
|
||||
(signed word) main::k#0 k zp ZP_WORD:6 11.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user