mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-04-08 14:37:40 +00:00
VariableBuilder has replaced VariableBuilderContext.
This commit is contained in:
parent
9811e48039
commit
574f21b25a
@ -51,16 +51,7 @@ public class VariableBuilder {
|
||||
* @return The variable
|
||||
*/
|
||||
public Variable build() {
|
||||
Variable variable;
|
||||
if(isConstant()) {
|
||||
variable = Variable.createConstant(varName, type, scope, arraySpec, null, dataSegment);
|
||||
} else if(this.isSingleStaticAssignment()) {
|
||||
// Create single-static-assignment PHI-master variable
|
||||
variable = Variable.createPhiMaster(varName, type, scope, getMemoryArea(), dataSegment);
|
||||
} else {
|
||||
// Create multiple-assignment variable
|
||||
variable = Variable.createLoadStore(varName, type, scope, getMemoryArea(), dataSegment);
|
||||
}
|
||||
Variable variable = new Variable(varName, getKind(), type, scope, getMemoryArea(), dataSegment, arraySpec, null);
|
||||
variable.setDeclaredConst(this.isConstant());
|
||||
variable.setDeclaredVolatile(this.isVolatile());
|
||||
variable.setDeclaredExport(this.isExport());
|
||||
|
@ -117,7 +117,7 @@ public class Variable implements Symbol {
|
||||
* @param arraySpec The array specification of the variable (if it is an array)
|
||||
* @param initValue The constant value of the variable (if it is constant)
|
||||
*/
|
||||
private Variable(String name, Kind kind, SymbolType type, Scope scope, MemoryArea memoryArea, String dataSegment, ArraySpec arraySpec, ConstantValue initValue) {
|
||||
public Variable(String name, Kind kind, SymbolType type, Scope scope, MemoryArea memoryArea, String dataSegment, ArraySpec arraySpec, ConstantValue initValue) {
|
||||
this.name = name;
|
||||
this.kind = kind;
|
||||
if(Kind.PHI_MASTER.equals(kind))
|
||||
@ -225,7 +225,7 @@ public class Variable implements Symbol {
|
||||
* @param constantValue The constant value
|
||||
*/
|
||||
public static Variable createConstant(Variable variable, ConstantValue constantValue) {
|
||||
Variable constVar = createConstant(variable.getName(), variable.getType(), variable.getScope(), variable.getArraySpec(), constantValue, variable.getDataSegment());
|
||||
Variable constVar = new Variable(variable.getName(), Kind.CONSTANT, variable.getType(), variable.getScope(), MemoryArea.MAIN_MEMORY, variable.getDataSegment(), variable.getArraySpec(), constantValue);
|
||||
constVar.setDeclaredAlignment(variable.getDeclaredAlignment());
|
||||
constVar.setDeclaredAsRegister(variable.isDeclaredAsRegister());
|
||||
constVar.setDeclaredConst(variable.isDeclaredConst());
|
||||
|
Loading…
x
Reference in New Issue
Block a user