1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-20 02:32:36 +00:00

Moving Variable properties towards semantic names (nomodify, volatile, optimize, ...).

This commit is contained in:
jespergravgaard 2019-12-22 23:05:59 +01:00
parent be3dc4a45e
commit 3abd8bed01
2 changed files with 30 additions and 31 deletions

View File

@ -86,7 +86,6 @@ public class Initializers {
return initValue;
}
/**
* Add casts to a value based on the declared type of the symbol. Recurses to all sub-values.
*
@ -249,7 +248,7 @@ public class Initializers {
throw new CompileError("Initializer element " + constantValue.toString(program) + " does not match needed type "+SymbolType.BYTE, source);
return new ConstantBinary(new ConstantBinary(constantValues.get(0), Operators.MULTIPLY, new ConstantInteger(0x100L, SymbolType.WORD)), Operators.PLUS, constantValues.get(1));
} else if(declaredType.equals(SymbolType.DWORD) && constantValues.size()==2){
// An inline word
// An inline dword
for(ConstantValue constantValue : constantValues)
if(!SymbolTypeConversion.assignmentTypeMatch(SymbolType.WORD, constantValue.getType(program.getScope())))
throw new CompileError("Initializer element " + constantValue.toString(program) + " does not match needed type "+SymbolType.WORD, source);

View File

@ -299,7 +299,7 @@ public class Variable implements Symbol {
return getScope().getVariable(versionOfName);
}
public Kind getKind() {
private Kind getKind() {
return kind;
}
@ -468,22 +468,6 @@ public class Variable implements Symbol {
this.noModify = noModify;
}
public Integer getMemoryAlignment() {
return memoryAlignment;
}
public void setMemoryAlignment(Integer memoryAlignment) {
this.memoryAlignment = memoryAlignment;
}
public Registers.Register getRegister() {
return register;
}
public void setRegister(Registers.Register register) {
this.register = register;
}
public boolean isVolatile() {
return isVolatile;
}
@ -492,18 +476,6 @@ public class Variable implements Symbol {
this.isVolatile = aVolatile;
}
public void setInferredVolatile(boolean inferredVolatile) {
this.inferredVolatile = inferredVolatile;
}
public boolean isInferredVolatile() {
return inferredVolatile;
}
public boolean isAnyVolatile() {
return isVolatile || inferredVolatile;
}
public boolean isExport() {
return export;
}
@ -520,6 +492,14 @@ public class Variable implements Symbol {
this.optimize = optimize;
}
public Registers.Register getRegister() {
return register;
}
public void setRegister(Registers.Register register) {
this.register = register;
}
public MemoryArea getMemoryArea() {
return memoryArea;
}
@ -536,6 +516,26 @@ public class Variable implements Symbol {
return MemoryArea.MAIN_MEMORY.equals(getMemoryArea());
}
public Integer getMemoryAlignment() {
return memoryAlignment;
}
public void setMemoryAlignment(Integer memoryAlignment) {
this.memoryAlignment = memoryAlignment;
}
public void setInferredVolatile(boolean inferredVolatile) {
this.inferredVolatile = inferredVolatile;
}
public boolean isInferredVolatile() {
return inferredVolatile;
}
public boolean isAnyVolatile() {
return isVolatile || inferredVolatile;
}
public List<Comment> getComments() {
return comments;
}