1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-04-05 07:40:39 +00:00

Removed notregister from Variable.

This commit is contained in:
jespergravgaard 2019-11-17 20:05:26 +01:00
parent fa5f96221d
commit 20dcf58eee
21 changed files with 51 additions and 67 deletions

View File

@ -378,7 +378,7 @@ public abstract class Scope implements Symbol, Serializable {
res.append(" " + symVar.getAsmName());
}
if(symVar.isKindLoadStore()) {
res.append(" notregister");
res.append(" loadstore");
}
Registers.Register declRegister = symVar.getDeclaredRegister();
if(declRegister != null) {

View File

@ -75,9 +75,6 @@ public class Variable implements Symbol {
/** Specifies that the variable must live in a register if possible (CPU register or ZP-address). */
private boolean declaredAsRegister;
/** Specifies that the variable must live in memory. TODO: Remove this */
private boolean declaredAsNotRegister;
/** The memory area where the variable lives (if stored in memory). [Only variables] */
private MemoryArea memoryArea;
@ -156,7 +153,6 @@ public class Variable implements Symbol {
this(false, phiMaster.getName() + "#" + version, phiMaster.getScope(), phiMaster.getType(), Kind.PHI_VERSION, phiMaster.getMemoryArea(), phiMaster.getDataSegment());
this.setDeclaredAlignment(phiMaster.getDeclaredAlignment());
this.setDeclaredAsRegister(phiMaster.isDeclaredAsRegister());
this.setDeclaredNotRegister(phiMaster.isDeclaredAsNotRegister());
this.setDeclaredConst(phiMaster.isDeclaredConst());
this.setDeclaredRegister(phiMaster.getDeclaredRegister());
this.setDeclaredVolatile(phiMaster.isDeclaredVolatile());
@ -176,7 +172,6 @@ public class Variable implements Symbol {
this(original.isConstant(), name, scope, original.getType(), original.getKind(), original.getMemoryArea(), original.getDataSegment());
this.setDeclaredAlignment(original.getDeclaredAlignment());
this.setDeclaredAsRegister(original.isDeclaredAsRegister());
this.setDeclaredNotRegister(original.isDeclaredAsNotRegister());
this.setDeclaredConst(original.isDeclaredConst());
this.setDeclaredVolatile(original.isDeclaredVolatile());
this.setDeclaredExport(original.isDeclaredExport());
@ -416,14 +411,6 @@ public class Variable implements Symbol {
this.declaredAsRegister = declaredAsRegister;
}
public boolean isDeclaredAsNotRegister() {
return declaredAsNotRegister;
}
public void setDeclaredNotRegister(boolean declaredAsMemory) {
this.declaredAsNotRegister = declaredAsMemory;
}
public MemoryArea getMemoryArea() {
return memoryArea;
}

View File

@ -1443,7 +1443,6 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
constVar.setDeclaredExport(lValue.isDeclaredExport());
constVar.setDeclaredAlignment(lValue.getDeclaredAlignment());
constVar.setDeclaredVolatile(lValue.isDeclaredVolatile());
constVar.setDeclaredNotRegister(lValue.isDeclaredAsNotRegister());
constVar.setComments(lValue.getComments());
lValue.getComments().addAll(ensureUnusedComments(comments));
} else {

View File

@ -123,7 +123,6 @@ public class Pass1EarlyConstantIdentification extends Pass1Base {
Variable constVar = new Variable(variable.getName(), scope, variable.getType(), variable.getDataSegment(), constantValue);
constVar.setDeclaredAlignment(variable.getDeclaredAlignment());
constVar.setDeclaredAsRegister(variable.isDeclaredAsRegister());
constVar.setDeclaredNotRegister(variable.isDeclaredAsNotRegister());
constVar.setDeclaredConst(variable.isDeclaredConst());
constVar.setDeclaredRegister(variable.getDeclaredRegister());
constVar.setDeclaredVolatile(variable.isDeclaredVolatile());

View File

@ -79,7 +79,6 @@ public class Pass2ConstantIdentification extends Pass2SsaOptimization {
constantVar.setDeclaredAlignment(variable.getDeclaredAlignment());
constantVar.setDeclaredAsRegister(variable.isDeclaredAsRegister());
constantVar.setDeclaredRegister(variable.getDeclaredRegister());
constantVar.setDeclaredNotRegister(variable.isDeclaredAsNotRegister());
constantVar.setDeclaredExport(variable.isDeclaredExport());
if(variable.getComments().size() > 0) {
constantVar.setComments(variable.getComments());

View File

@ -33,7 +33,7 @@ SYMBOL TABLE SSA
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*)(number) $400
(byte) idx notregister
(byte) idx loadstore
(void()) main()
(bool~) main::$0
(label) main::@1
@ -105,7 +105,7 @@ main::@return: scope:[main] from main::@1
VARIABLE REGISTER WEIGHTS
(byte) idx notregister 5.0
(byte) idx loadstore 5.0
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
@ -298,7 +298,7 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(byte) idx notregister mem[1] 5.0
(byte) idx loadstore mem[1] 5.0
(void()) main()
(label) main::@1
(label) main::@return

View File

@ -2,7 +2,7 @@
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(byte) idx notregister mem[1] 5.0
(byte) idx loadstore mem[1] 5.0
(void()) main()
(label) main::@1
(label) main::@return

View File

@ -35,7 +35,7 @@ SYMBOL TABLE SSA
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*)(number) $400
(byte) idx notregister
(byte) idx loadstore
(const byte*) idx_p = &(byte) idx
(void()) main()
(bool~) main::$0
@ -108,7 +108,7 @@ main::@return: scope:[main] from main::@1
VARIABLE REGISTER WEIGHTS
(byte) idx notregister 20.0
(byte) idx loadstore 20.0
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
@ -305,7 +305,7 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(byte) idx notregister mem[1] 20.0
(byte) idx loadstore mem[1] 20.0
(const byte*) idx_p = &(byte) idx
(void()) main()
(label) main::@1

View File

@ -2,7 +2,7 @@
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(byte) idx notregister mem[1] 20.0
(byte) idx loadstore mem[1] 20.0
(const byte*) idx_p = &(byte) idx
(void()) main()
(label) main::@1

View File

@ -33,7 +33,7 @@ SYMBOL TABLE SSA
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*)(number) $400
(byte*) cursor notregister
(byte*) cursor loadstore
(void()) main()
(bool~) main::$0
(label) main::@1
@ -110,7 +110,7 @@ main::@return: scope:[main] from main::@1
VARIABLE REGISTER WEIGHTS
(byte*) cursor notregister 5.0
(byte*) cursor loadstore 5.0
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
@ -323,7 +323,7 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(byte*) cursor notregister mem[2] 5.0
(byte*) cursor loadstore mem[2] 5.0
(void()) main()
(label) main::@1
(label) main::@return

View File

@ -2,7 +2,7 @@
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(byte*) cursor notregister mem[2] 5.0
(byte*) cursor loadstore mem[2] 5.0
(void()) main()
(label) main::@1
(label) main::@return

View File

@ -42,9 +42,9 @@ SYMBOL TABLE SSA
(label) @end
(const byte) OFFSET_STRUCT_FOO_THING1 = (byte) 0
(const byte) OFFSET_STRUCT_FOO_THING2 = (byte) 1
(struct foo) bar notregister
(byte) bar_thing1 notregister
(byte) bar_thing2 notregister
(struct foo) bar loadstore
(byte) bar_thing1 loadstore
(byte) bar_thing2 loadstore
(byte) foo::thing1
(byte) foo::thing2
(void()) main()
@ -133,8 +133,8 @@ main::@return: scope:[main] from main
VARIABLE REGISTER WEIGHTS
(byte) bar_thing1 notregister 20.0
(byte) bar_thing2 notregister 20.0
(byte) bar_thing1 loadstore 20.0
(byte) bar_thing2 loadstore 20.0
(byte) foo::thing1
(byte) foo::thing2
(void()) main()
@ -291,8 +291,8 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_FOO_THING2 = (byte) 1
(byte) bar_thing1 notregister mem[1] 20.0
(byte) bar_thing2 notregister mem[1] 20.0
(byte) bar_thing1 loadstore mem[1] 20.0
(byte) bar_thing2 loadstore mem[1] 20.0
(byte) foo::thing1
(byte) foo::thing2
(void()) main()

View File

@ -2,8 +2,8 @@
(label) @begin
(label) @end
(const byte) OFFSET_STRUCT_FOO_THING2 = (byte) 1
(byte) bar_thing1 notregister mem[1] 20.0
(byte) bar_thing2 notregister mem[1] 20.0
(byte) bar_thing1 loadstore mem[1] 20.0
(byte) bar_thing2 loadstore mem[1] 20.0
(byte) foo::thing1
(byte) foo::thing2
(void()) main()

View File

@ -62,10 +62,10 @@ SYMBOL TABLE SSA
(const byte) OFFSET_STRUCT_FOO_THING1 = (byte) 0
(const byte) OFFSET_STRUCT_FOO_THING2 = (byte) 1
(const byte) OFFSET_STRUCT_FOO_THING3 = (byte) 2
(struct foo) bar notregister
(byte) bar_thing1 notregister
(byte) bar_thing2 notregister
(byte[$c]) bar_thing3 notregister
(struct foo) bar loadstore
(byte) bar_thing1 loadstore
(byte) bar_thing2 loadstore
(byte[$c]) bar_thing3 loadstore
(byte) foo::thing1
(byte) foo::thing2
(byte[$c]) foo::thing3
@ -201,9 +201,9 @@ main::@return: scope:[main] from main::@1
VARIABLE REGISTER WEIGHTS
(byte) bar_thing1 notregister 20.0
(byte) bar_thing2 notregister 20.0
(byte[$c]) bar_thing3 notregister 20.0
(byte) bar_thing1 loadstore 20.0
(byte) bar_thing2 loadstore 20.0
(byte[$c]) bar_thing3 loadstore 20.0
(byte) foo::thing1
(byte) foo::thing2
(byte[$c]) foo::thing3
@ -470,9 +470,9 @@ FINAL SYMBOL TABLE
(label) @end
(const byte) OFFSET_STRUCT_FOO_THING2 = (byte) 1
(const byte) OFFSET_STRUCT_FOO_THING3 = (byte) 2
(byte) bar_thing1 notregister mem[1] 20.0
(byte) bar_thing2 notregister mem[1] 20.0
(byte[$c]) bar_thing3 notregister zp[2]:2 20.0
(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) foo::thing1
(byte) foo::thing2
(byte[$c]) foo::thing3

View File

@ -4,9 +4,9 @@
(label) @end
(const byte) OFFSET_STRUCT_FOO_THING2 = (byte) 1
(const byte) OFFSET_STRUCT_FOO_THING3 = (byte) 2
(byte) bar_thing1 notregister mem[1] 20.0
(byte) bar_thing2 notregister mem[1] 20.0
(byte[$c]) bar_thing3 notregister zp[2]:2 20.0
(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) foo::thing1
(byte) foo::thing2
(byte[$c]) foo::thing3

View File

@ -33,7 +33,7 @@ SYMBOL TABLE SSA
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*)(number) $400
(byte) idx notregister
(byte) idx loadstore
(void()) main()
(bool~) main::$0
(label) main::@1
@ -105,7 +105,7 @@ main::@return: scope:[main] from main::@1
VARIABLE REGISTER WEIGHTS
(byte) idx notregister 5.0
(byte) idx loadstore 5.0
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
@ -301,7 +301,7 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(byte) idx notregister zp[1]:2 5.0
(byte) idx loadstore zp[1]:2 5.0
(void()) main()
(label) main::@1
(label) main::@return

View File

@ -2,7 +2,7 @@
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(byte) idx notregister zp[1]:2 5.0
(byte) idx loadstore zp[1]:2 5.0
(void()) main()
(label) main::@1
(label) main::@return

View File

@ -33,7 +33,7 @@ SYMBOL TABLE SSA
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*)(number) $400
(byte) idx notregister !mem[-1]:4096
(byte) idx loadstore !mem[-1]:4096
(void()) main()
(bool~) main::$0
(label) main::@1
@ -105,7 +105,7 @@ main::@return: scope:[main] from main::@1
VARIABLE REGISTER WEIGHTS
(byte) idx notregister !mem[-1]:4096 5.0
(byte) idx loadstore !mem[-1]:4096 5.0
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
@ -299,7 +299,7 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(byte) idx notregister !mem[-1]:4096 mem[1]:4096 5.0
(byte) idx loadstore !mem[-1]:4096 mem[1]:4096 5.0
(void()) main()
(label) main::@1
(label) main::@return

View File

@ -2,7 +2,7 @@
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(byte) idx notregister !mem[-1]:4096 mem[1]:4096 5.0
(byte) idx loadstore !mem[-1]:4096 mem[1]:4096 5.0
(void()) main()
(label) main::@1
(label) main::@return

View File

@ -109,7 +109,7 @@ SYMBOL TABLE SSA
(const byte*) SCREEN2 = (byte*)(number) $400+(number) $28
(const byte*) SCREEN3 = (byte*)(number) $400+(number) $50
(const byte*) SCREEN4 = (byte*)(number) $400+(number) $78
(byte) idx_nssa_g notregister
(byte) idx_nssa_g loadstore
(byte) idx_ssa_g
(byte) idx_ssa_g#0
(byte) idx_ssa_g#1
@ -159,7 +159,7 @@ SYMBOL TABLE SSA
(byte) main::i3#0
(byte) main::i3#1
(byte) main::i3#2
(byte) main::idx_nssa_l notregister
(byte) main::idx_nssa_l loadstore
(byte) main::idx_ssa_l
(byte) main::idx_ssa_l#0
(byte) main::idx_ssa_l#1
@ -364,7 +364,7 @@ main::@return: scope:[main] from main::@8
VARIABLE REGISTER WEIGHTS
(byte) idx_nssa_g notregister 3.1333333333333333
(byte) idx_nssa_g loadstore 3.1333333333333333
(byte) idx_ssa_g
(byte) idx_ssa_g#2 8.0
(byte) idx_ssa_g#7 16.5
@ -381,7 +381,7 @@ VARIABLE REGISTER WEIGHTS
(byte) main::i3
(byte) main::i3#1 16.5
(byte) main::i3#2 11.0
(byte) main::idx_nssa_l notregister 1.6206896551724135
(byte) main::idx_nssa_l loadstore 1.6206896551724135
(byte) main::idx_ssa_l
(byte) main::idx_ssa_l#2 8.0
(byte) main::idx_ssa_l#5 16.5
@ -906,7 +906,7 @@ FINAL SYMBOL TABLE
(const byte*) SCREEN2 = (byte*)(number) $400+(number) $28
(const byte*) SCREEN3 = (byte*)(number) $400+(number) $50
(const byte*) SCREEN4 = (byte*)(number) $400+(number) $78
(byte) idx_nssa_g notregister zp[1]:2 3.1333333333333333
(byte) idx_nssa_g loadstore zp[1]:2 3.1333333333333333
(byte) idx_ssa_g
(byte) idx_ssa_g#2 reg byte y 8.0
(byte) idx_ssa_g#7 reg byte y 16.5
@ -932,7 +932,7 @@ FINAL SYMBOL TABLE
(byte) main::i3
(byte) main::i3#1 reg byte a 16.5
(byte) main::i3#2 reg byte a 11.0
(byte) main::idx_nssa_l notregister zp[1]:3 1.6206896551724135
(byte) main::idx_nssa_l loadstore zp[1]:3 1.6206896551724135
(byte) main::idx_ssa_l
(byte) main::idx_ssa_l#2 reg byte y 8.0
(byte) main::idx_ssa_l#5 reg byte y 16.5

View File

@ -5,7 +5,7 @@
(const byte*) SCREEN2 = (byte*)(number) $400+(number) $28
(const byte*) SCREEN3 = (byte*)(number) $400+(number) $50
(const byte*) SCREEN4 = (byte*)(number) $400+(number) $78
(byte) idx_nssa_g notregister zp[1]:2 3.1333333333333333
(byte) idx_nssa_g loadstore zp[1]:2 3.1333333333333333
(byte) idx_ssa_g
(byte) idx_ssa_g#2 reg byte y 8.0
(byte) idx_ssa_g#7 reg byte y 16.5
@ -31,7 +31,7 @@
(byte) main::i3
(byte) main::i3#1 reg byte a 16.5
(byte) main::i3#2 reg byte a 11.0
(byte) main::idx_nssa_l notregister zp[1]:3 1.6206896551724135
(byte) main::idx_nssa_l loadstore zp[1]:3 1.6206896551724135
(byte) main::idx_ssa_l
(byte) main::idx_ssa_l#2 reg byte y 8.0
(byte) main::idx_ssa_l#5 reg byte y 16.5