diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index 6e92446e1..d17d2a593 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -141,7 +141,8 @@ public class Compiler { new Pass3ZeroPageAllocation(program, log).allocate(); new Pass3VariableRegisterWeightAnalysis(program, log).findWeights(); - + log.append("\nVARIABLE REGISTER WEIGHTS"); + log.append(program.getScope().getSymbolTableContents(Variable.class)); new Pass3ZeroPageCoalesce(program, log).allocate(); new Pass3RegistersFinalize(program, log).allocate(); diff --git a/src/main/java/dk/camelot64/kickc/icl/LiveRange.java b/src/main/java/dk/camelot64/kickc/icl/LiveRange.java index 4c2bd8685..c8adf3656 100644 --- a/src/main/java/dk/camelot64/kickc/icl/LiveRange.java +++ b/src/main/java/dk/camelot64/kickc/icl/LiveRange.java @@ -47,6 +47,15 @@ public class LiveRange { public int getLastStatementIdx() { return lastStatementIdx; } + + /** Get the number of statements in the live interval. + * + * @return The number of statements in the live interval. + */ + public int size() { + return lastStatementIdx-firstStatementIdx+1; + } + } public LiveRange() { @@ -71,6 +80,19 @@ public class LiveRange { return index; } + /** Get the number of statements in the live range. + * + * @return The number of statements in the live range. + */ + public int size() { + int s = 0; + for (LiveInterval interval : intervals) { + s += interval.size(); + } + return s; + } + + /** * Add an index to the live range * @param index The index to add diff --git a/src/main/java/dk/camelot64/kickc/icl/NaturalLoopSet.java b/src/main/java/dk/camelot64/kickc/icl/NaturalLoopSet.java index bf13bc77d..503a36978 100644 --- a/src/main/java/dk/camelot64/kickc/icl/NaturalLoopSet.java +++ b/src/main/java/dk/camelot64/kickc/icl/NaturalLoopSet.java @@ -96,4 +96,13 @@ public class NaturalLoopSet { this.loops.remove(loop); } + public int getMaxLoopDepth(LabelRef block) { + int maxDepth = 0; + for (NaturalLoop loop : getLoopsContainingBlock(block)) { + if(loop.getDepth()>maxDepth) { + maxDepth = loop.getDepth(); + } + } + return maxDepth; + } } diff --git a/src/main/java/dk/camelot64/kickc/icl/Procedure.java b/src/main/java/dk/camelot64/kickc/icl/Procedure.java index 9470ce9b8..2c3eb2202 100644 --- a/src/main/java/dk/camelot64/kickc/icl/Procedure.java +++ b/src/main/java/dk/camelot64/kickc/icl/Procedure.java @@ -71,11 +71,11 @@ public class Procedure extends Scope { return super.getFullName(); } - public String getSymbolTableContents(ProgramScope scope) { + public String getSymbolTableContents(ProgramScope scope, Class symbolClass) { StringBuilder res = new StringBuilder(); res.append(toString(scope)); res.append("\n"); - res.append(super.getSymbolTableContents(scope)); + res.append(super.getSymbolTableContents(scope, symbolClass)); return res.toString(); } @@ -85,7 +85,8 @@ public class Procedure extends Scope { } @Override - RegisterAllocation getAllocation() { + @JsonIgnore + public RegisterAllocation getAllocation() { if(getScope()!=null) { return getScope().getAllocation(); } else { @@ -93,6 +94,16 @@ public class Procedure extends Scope { } } + @Override + @JsonIgnore + public VariableRegisterWeights getVariableRegisterWeights() { + if(getScope()!=null) { + return getScope().getVariableRegisterWeights(); + } else { + return null; + } + } + @Override public String toString() { return toString(null); diff --git a/src/main/java/dk/camelot64/kickc/icl/ProgramScope.java b/src/main/java/dk/camelot64/kickc/icl/ProgramScope.java index bd43f0721..e3606b264 100644 --- a/src/main/java/dk/camelot64/kickc/icl/ProgramScope.java +++ b/src/main/java/dk/camelot64/kickc/icl/ProgramScope.java @@ -10,10 +10,9 @@ import java.util.HashMap; public class ProgramScope extends Scope { private RegisterAllocation allocation; - private LiveRangeVariables liveRangeVariables; - private LiveRangeEquivalenceClassSet liveRangeEquivalenceClassSet; + private VariableRegisterWeights variableRegisterWeights; public ProgramScope() { super("", null); @@ -42,13 +41,13 @@ public class ProgramScope extends Scope { public RegisterAllocation.Register getRegister(Variable variable) { RegisterAllocation.Register register = null; if (allocation != null) { - register = allocation.getRegister(variable); + register = allocation.getRegister(variable.getRef()); } return register; } @Override - RegisterAllocation getAllocation() { + public RegisterAllocation getAllocation() { return allocation; } @@ -94,13 +93,18 @@ public class ProgramScope extends Scope { @JsonIgnore public String getSymbolTableContents() { - return getSymbolTableContents(this); + return getSymbolTableContents(this, null); + } + + @JsonIgnore + public String getSymbolTableContents(Class symbolClass) { + return getSymbolTableContents(this, symbolClass); } @Override - public String getSymbolTableContents(ProgramScope scope) { + public String getSymbolTableContents(ProgramScope scope, Class symbolClass) { StringBuilder out = new StringBuilder(); - out.append(super.getSymbolTableContents(scope)); + out.append(super.getSymbolTableContents(scope, symbolClass)); if(liveRangeEquivalenceClassSet!=null) { out.append("\n"); for (LiveRangeEquivalenceClass liveRangeEquivalenceClass : liveRangeEquivalenceClassSet.getEquivalenceClasses()) { @@ -116,4 +120,11 @@ public class ProgramScope extends Scope { return "program"; } + public void setVariableRegisterWeights(VariableRegisterWeights variableRegisterWeights) { + this.variableRegisterWeights = variableRegisterWeights; + } + + public VariableRegisterWeights getVariableRegisterWeights() { + return variableRegisterWeights; + } } diff --git a/src/main/java/dk/camelot64/kickc/icl/RegisterAllocation.java b/src/main/java/dk/camelot64/kickc/icl/RegisterAllocation.java index 09679de90..450a1bd4b 100644 --- a/src/main/java/dk/camelot64/kickc/icl/RegisterAllocation.java +++ b/src/main/java/dk/camelot64/kickc/icl/RegisterAllocation.java @@ -19,10 +19,6 @@ public class RegisterAllocation { * @param variable The variable * @return The allocated register. */ - public Register getRegister(Variable variable) { - return allocation.get(variable.getRef()); - } - public Register getRegister(VariableRef ref) { return allocation.get(ref); } diff --git a/src/main/java/dk/camelot64/kickc/icl/Scope.java b/src/main/java/dk/camelot64/kickc/icl/Scope.java index 60e1e7342..f9aaf587a 100644 --- a/src/main/java/dk/camelot64/kickc/icl/Scope.java +++ b/src/main/java/dk/camelot64/kickc/icl/Scope.java @@ -205,29 +205,40 @@ public abstract class Scope implements Symbol { return (Procedure) getSymbol(ref); } - abstract RegisterAllocation getAllocation(); + public abstract RegisterAllocation getAllocation(); + + public abstract VariableRegisterWeights getVariableRegisterWeights(); @JsonIgnore - public String getSymbolTableContents(ProgramScope scope) { + public String getSymbolTableContents(ProgramScope scope, Class symbolClass) { StringBuilder res = new StringBuilder(); Set names = symbols.keySet(); List sortedNames = new ArrayList<>(names); Collections.sort(sortedNames); RegisterAllocation allocation = getAllocation(); + VariableRegisterWeights registerWeights = getVariableRegisterWeights(); for (String name : sortedNames) { Symbol symbol = symbols.get(name); if (symbol instanceof Scope) { - res.append(((Scope) symbol).getSymbolTableContents(scope)); + res.append(((Scope) symbol).getSymbolTableContents(scope, symbolClass)); } else { - res.append(symbol.toString(scope)); - } - if (symbol instanceof Variable && allocation!=null) { - RegisterAllocation.Register register = allocation.getRegister((Variable) symbol); - if (register != null) { - res.append(" " + register); + if (symbolClass == null || symbolClass.isInstance(symbol)) { + res.append(symbol.toString(scope)); + if (symbol instanceof Variable && allocation != null) { + RegisterAllocation.Register register = allocation.getRegister(((Variable) symbol).getRef()); + if (register != null) { + res.append(" " + register); + } + } + if (symbol instanceof Variable && registerWeights != null) { + Double weight = registerWeights.getWeight(((Variable) symbol).getRef()); + if (weight != null) { + res.append(" " + weight); + } + } + res.append("\n"); } } - res.append("\n"); } return res.toString(); } diff --git a/src/main/java/dk/camelot64/kickc/icl/VariableRegisterWeights.java b/src/main/java/dk/camelot64/kickc/icl/VariableRegisterWeights.java new file mode 100644 index 000000000..d4c5d4ab7 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/icl/VariableRegisterWeights.java @@ -0,0 +1,36 @@ +package dk.camelot64.kickc.icl; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The register weights for each variable. + * The register weight signifies how beneficial it would be for the variable to assigned to a register (instead of zero page). + */ +public class VariableRegisterWeights { + + private Map registerWeights; + + public VariableRegisterWeights() { + this.registerWeights = new LinkedHashMap<>(); + } + + /** + * Add to the weight of a variable + * + * @param variableRef The variable + * @param w The amount to add to the weight + */ + public void addWeight(VariableRef variableRef, double w) { + Double weight = this.registerWeights.get(variableRef); + if (weight == null) { + weight = 0.0; + } + weight = weight + w; + this.registerWeights.put(variableRef, weight); + } + + public Double getWeight(VariableRef variable) { + return registerWeights.get(variable); + } +} diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3VariableRegisterWeightAnalysis.java b/src/main/java/dk/camelot64/kickc/passes/Pass3VariableRegisterWeightAnalysis.java index f9f2397c3..c0edc983b 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass3VariableRegisterWeightAnalysis.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3VariableRegisterWeightAnalysis.java @@ -1,15 +1,13 @@ package dk.camelot64.kickc.passes; import dk.camelot64.kickc.CompileLog; -import dk.camelot64.kickc.icl.ControlFlowBlock; -import dk.camelot64.kickc.icl.Program; -import dk.camelot64.kickc.icl.Statement; +import dk.camelot64.kickc.icl.*; /** * Finds register weights for all variables. - * + *

* The register weight signifies how beneficial it would be for the variable to assigned to a register (instead of zero page). - * + *

* Uses Loop Depth and Live Ranges plus the statements of the control flow graph. *

* Based on ComputeWeight from http://compilers.cs.ucla.edu/fernando/projects/soc/reports/short_tech.pdf @@ -18,6 +16,9 @@ public class Pass3VariableRegisterWeightAnalysis { private Program program; private CompileLog log; + private NaturalLoopSet loopSet; + private VariableRegisterWeights variableRegisterWeights; + private LiveRangeVariables liveRangeVariables; public Pass3VariableRegisterWeightAnalysis(Program program, CompileLog log) { this.program = program; @@ -32,20 +33,76 @@ public class Pass3VariableRegisterWeightAnalysis { return log; } - /** Find register weights for all variables */ + /** + * Find register weights for all variables + */ public void findWeights() { + variableRegisterWeights = new VariableRegisterWeights(); + loopSet = program.getGraph().getLoopSet(); + liveRangeVariables = program.getScope().getLiveRangeVariables(); + for (ControlFlowBlock block : program.getGraph().getAllBlocks()) { for (Statement statement : block.getStatements()) { - - - - + if (statement instanceof StatementPhiBlock) { + for (StatementPhiBlock.PhiVariable phiVariable : ((StatementPhiBlock) statement).getPhiVariables()) { + // Add weights for the definition of the phi variable + VariableRef philVariable = phiVariable.getVariable(); + for (StatementPhiBlock.PhiRValue phiRValue : phiVariable.getValues()) { + if (phiRValue.getrValue() instanceof VariableRef) { + double w = addWeight(philVariable, phiRValue.getPredecessor()); + //log.append("Definition of " + philVariable + " w+:" + w + " - [" + statement.getIndex()+"]"); + } + } + // Add weights for each usage of a variable + for (StatementPhiBlock.PhiRValue phiRValue : phiVariable.getValues()) { + addUsageWeightRValue(phiRValue.getrValue(), statement, phiRValue.getPredecessor()); + } + } + } else if (statement instanceof StatementAssignment) { + // Add weights for the definition of the variable + LValue lValue = ((StatementAssignment) statement).getlValue(); + if (lValue instanceof VariableRef) { + double w = addWeight((VariableRef) lValue, block.getLabel()); + //log.append("Definition of " + lValue + " w+:" + w + " - [" + statement.getIndex()+"]"); + } + // Also add weight to used pointers + if(lValue instanceof PointerDereferenceSimple) { + addUsageWeightRValue(((PointerDereference) lValue).getPointer(), statement, block.getLabel()); + } else if(lValue instanceof PointerDereferenceIndexed) { + addUsageWeightRValue(((PointerDereference) lValue).getPointer(), statement, block.getLabel()); + addUsageWeightRValue(((PointerDereferenceIndexed) lValue).getIndex(), statement, block.getLabel()); + } + // Add weights for each usage of variables + addUsageWeightRValue(((StatementAssignment) statement).getrValue1(), statement, block.getLabel()); + addUsageWeightRValue(((StatementAssignment) statement).getrValue2(), statement, block.getLabel()); + } else if (statement instanceof StatementConditionalJump) { + // Add weights for each usage of variables + addUsageWeightRValue(((StatementConditionalJump) statement).getrValue1(), statement, block.getLabel()); + addUsageWeightRValue(((StatementConditionalJump) statement).getrValue2(), statement, block.getLabel()); + } } } + program.getScope().setVariableRegisterWeights(variableRegisterWeights); } + private void addUsageWeightRValue(Value rValue, Statement statement, LabelRef block) { + if (rValue instanceof VariableRef) { + double w = addWeight((VariableRef) rValue, block); + //log.append("Usage of " + rValue + " w+:" + w + " - [" + statement.getIndex()+"]"); + } + } + + private double addWeight(VariableRef variable, LabelRef block) { + int depth = loopSet.getMaxLoopDepth(block); + double w = 1.0 + Math.pow(10.0, depth); + LiveRange liveRange = liveRangeVariables.getLiveRange(variable); + int s = liveRange.size(); + variableRegisterWeights.addWeight(variable, w/s); + return w/s; + } + } diff --git a/src/main/java/dk/camelot64/kickc/test/TestIclJson.java b/src/main/java/dk/camelot64/kickc/test/TestIclJson.java index ba3d40890..e2e9f33df 100644 --- a/src/main/java/dk/camelot64/kickc/test/TestIclJson.java +++ b/src/main/java/dk/camelot64/kickc/test/TestIclJson.java @@ -32,7 +32,7 @@ public class TestIclJson extends TestCase { scope.addVariable("v3", new SymbolTypeArray(SymbolTypeBasic.WORD, 4)); scope.addLabel("main"); scope.addLabelIntermediate(); - String json = "{\"@type\":\"program\",\"name\":\"\",\"symbols\":{\"v1\":{\"@type\":\"variable_unversioned\",\"name\":\"v1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":1,\"inferredType\":false},\"v1#0\":{\"@type\":\"variable_versioned\",\"name\":\"v1#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"v1\",\"inferredType\":false},\"$0\":{\"@type\":\"variable_intermediate\",\"name\":\"$0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"var\"},\"inferredType\":false},\"v2\":{\"@type\":\"variable_unversioned\",\"name\":\"v2\",\"type\":{\"@type\":\"pointer\",\"elementType\":{\"@type\":\"basic\",\"typeName\":\"byte\"}},\"nextVersionNumber\":0,\"inferredType\":false},\"v3\":{\"@type\":\"variable_unversioned\",\"name\":\"v3\",\"type\":{\"@type\":\"array\",\"elementType\":{\"@type\":\"basic\",\"typeName\":\"word\"},\"size\":4},\"nextVersionNumber\":0,\"inferredType\":false},\"main\":{\"@type\":\"label\",\"name\":\"main\",\"intermediate\":false},\"@1\":{\"@type\":\"label\",\"name\":\"@1\",\"intermediate\":true}},\"intermediateVarCount\":1,\"intermediateLabelCount\":2,\"allocation\":null,\"liveRangeVariables\":null,\"liveRangeEquivalenceClassSet\":null}"; + String json = "{\"@type\":\"program\",\"name\":\"\",\"symbols\":{\"v1\":{\"@type\":\"variable_unversioned\",\"name\":\"v1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":1,\"inferredType\":false},\"v1#0\":{\"@type\":\"variable_versioned\",\"name\":\"v1#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"v1\",\"inferredType\":false},\"$0\":{\"@type\":\"variable_intermediate\",\"name\":\"$0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"var\"},\"inferredType\":false},\"v2\":{\"@type\":\"variable_unversioned\",\"name\":\"v2\",\"type\":{\"@type\":\"pointer\",\"elementType\":{\"@type\":\"basic\",\"typeName\":\"byte\"}},\"nextVersionNumber\":0,\"inferredType\":false},\"v3\":{\"@type\":\"variable_unversioned\",\"name\":\"v3\",\"type\":{\"@type\":\"array\",\"elementType\":{\"@type\":\"basic\",\"typeName\":\"word\"},\"size\":4},\"nextVersionNumber\":0,\"inferredType\":false},\"main\":{\"@type\":\"label\",\"name\":\"main\",\"intermediate\":false},\"@1\":{\"@type\":\"label\",\"name\":\"@1\",\"intermediate\":true}},\"intermediateVarCount\":1,\"intermediateLabelCount\":2,\"allocation\":null,\"liveRangeVariables\":null,\"liveRangeEquivalenceClassSet\":null,\"variableRegisterWeights\":null}"; assertJsonSerialization(scope, json, Scope.class); } @@ -44,7 +44,7 @@ public class TestIclJson extends TestCase { parameters.add(new VariableUnversioned("p1", procedure, SymbolTypeBasic.BYTE)); parameters.add(new VariableUnversioned("p2", procedure, SymbolTypeBasic.BOOLEAN)); procedure.setParameters(parameters); - String json = "{\"@type\":\"program\",\"name\":\"\",\"symbols\":{\"main\":{\"@type\":\"procedure\",\"name\":\"main\",\"parameterNames\":[\"p1\",\"p2\"],\"symbols\":{\"v2\":{\"@type\":\"variable_unversioned\",\"name\":\"v2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":0,\"inferredType\":false},\"p1\":{\"@type\":\"variable_unversioned\",\"name\":\"p1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":0,\"inferredType\":false},\"p2\":{\"@type\":\"variable_unversioned\",\"name\":\"p2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"boolean\"},\"nextVersionNumber\":0,\"inferredType\":false}},\"intermediateVarCount\":0,\"intermediateLabelCount\":1,\"returnType\":{\"@type\":\"basic\",\"typeName\":\"void\"}}},\"intermediateVarCount\":0,\"intermediateLabelCount\":1,\"allocation\":null,\"liveRangeVariables\":null,\"liveRangeEquivalenceClassSet\":null}"; + String json = "{\"@type\":\"program\",\"name\":\"\",\"symbols\":{\"main\":{\"@type\":\"procedure\",\"name\":\"main\",\"parameterNames\":[\"p1\",\"p2\"],\"symbols\":{\"v2\":{\"@type\":\"variable_unversioned\",\"name\":\"v2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":0,\"inferredType\":false},\"p1\":{\"@type\":\"variable_unversioned\",\"name\":\"p1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":0,\"inferredType\":false},\"p2\":{\"@type\":\"variable_unversioned\",\"name\":\"p2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"boolean\"},\"nextVersionNumber\":0,\"inferredType\":false}},\"intermediateVarCount\":0,\"intermediateLabelCount\":1,\"returnType\":{\"@type\":\"basic\",\"typeName\":\"void\"}}},\"intermediateVarCount\":0,\"intermediateLabelCount\":1,\"allocation\":null,\"liveRangeVariables\":null,\"liveRangeEquivalenceClassSet\":null,\"variableRegisterWeights\":null}"; assertJsonSerialization(scope, json, Scope.class); } @@ -87,7 +87,7 @@ public class TestIclJson extends TestCase { CompileLog log = new CompileLog(); KickCParser.FileContext file = compiler.pass0ParseInput(new ANTLRInputStream(minProgram), log); Program program = compiler.pass1GenerateSSA(file, log); - String json = "{\"scope\":{\"@type\":\"program\",\"name\":\"\",\"symbols\":{\"b\":{\"@type\":\"variable_unversioned\",\"name\":\"b\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":1,\"inferredType\":false},\"c\":{\"@type\":\"variable_unversioned\",\"name\":\"c\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":1,\"inferredType\":false},\"@BEGIN\":{\"@type\":\"label\",\"name\":\"@BEGIN\",\"intermediate\":false},\"@END\":{\"@type\":\"label\",\"name\":\"@END\",\"intermediate\":false},\"b#0\":{\"@type\":\"variable_versioned\",\"name\":\"b#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"b\",\"inferredType\":false},\"c#0\":{\"@type\":\"variable_versioned\",\"name\":\"c#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"c\",\"inferredType\":false}},\"intermediateVarCount\":0,\"intermediateLabelCount\":1,\"allocation\":null,\"liveRangeVariables\":null,\"liveRangeEquivalenceClassSet\":null},\"graph\":{\"blocks\":{\"@BEGIN\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"statements\":[{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"b#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":0},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"c#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"b#0\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@END\"},\"conditionalSuccessor\":null,\"callSuccessor\":null},\"@END\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@END\"},\"statements\":[],\"defaultSuccessor\":null,\"conditionalSuccessor\":null,\"callSuccessor\":null}},\"firstBlockRef\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"sequence\":null,\"dominators\":null,\"loopSet\":null,\"callGraph\":null}}"; + String json = "{\"scope\":{\"@type\":\"program\",\"name\":\"\",\"symbols\":{\"b\":{\"@type\":\"variable_unversioned\",\"name\":\"b\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":1,\"inferredType\":false},\"c\":{\"@type\":\"variable_unversioned\",\"name\":\"c\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":1,\"inferredType\":false},\"@BEGIN\":{\"@type\":\"label\",\"name\":\"@BEGIN\",\"intermediate\":false},\"@END\":{\"@type\":\"label\",\"name\":\"@END\",\"intermediate\":false},\"b#0\":{\"@type\":\"variable_versioned\",\"name\":\"b#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"b\",\"inferredType\":false},\"c#0\":{\"@type\":\"variable_versioned\",\"name\":\"c#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"c\",\"inferredType\":false}},\"intermediateVarCount\":0,\"intermediateLabelCount\":1,\"allocation\":null,\"liveRangeVariables\":null,\"liveRangeEquivalenceClassSet\":null,\"variableRegisterWeights\":null},\"graph\":{\"blocks\":{\"@BEGIN\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"statements\":[{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"b#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":0},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"c#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"b#0\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@END\"},\"conditionalSuccessor\":null,\"callSuccessor\":null},\"@END\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@END\"},\"statements\":[],\"defaultSuccessor\":null,\"conditionalSuccessor\":null,\"callSuccessor\":null}},\"firstBlockRef\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"sequence\":null,\"dominators\":null,\"loopSet\":null,\"callGraph\":null}}"; assertJsonSerialization(program, json, Program.class); } @@ -101,7 +101,7 @@ public class TestIclJson extends TestCase { CompileLog log = new CompileLog(); KickCParser.FileContext file = compiler.pass0ParseInput(new ANTLRInputStream(minProgram), log); Program program = compiler.pass1GenerateSSA(file, log); - String json = "{\"scope\":{\"@type\":\"program\",\"name\":\"\",\"symbols\":{\"s1\":{\"@type\":\"variable_unversioned\",\"name\":\"s1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":1,\"inferredType\":false},\"$0\":{\"@type\":\"variable_intermediate\",\"name\":\"$0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"inferredType\":true},\"s2\":{\"@type\":\"variable_unversioned\",\"name\":\"s2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":1,\"inferredType\":false},\"$1\":{\"@type\":\"variable_intermediate\",\"name\":\"$1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"inferredType\":true},\"sum\":{\"@type\":\"procedure\",\"name\":\"sum\",\"parameterNames\":[\"a\",\"b\"],\"symbols\":{\"@return\":{\"@type\":\"label\",\"name\":\"@return\",\"intermediate\":false},\"return\":{\"@type\":\"variable_unversioned\",\"name\":\"return\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":7,\"inferredType\":false},\"a\":{\"@type\":\"variable_unversioned\",\"name\":\"a\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":3,\"inferredType\":false},\"b\":{\"@type\":\"variable_unversioned\",\"name\":\"b\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":3,\"inferredType\":false},\"$0\":{\"@type\":\"variable_intermediate\",\"name\":\"$0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"inferredType\":true},\"a#0\":{\"@type\":\"variable_versioned\",\"name\":\"a#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"a\",\"inferredType\":false},\"b#0\":{\"@type\":\"variable_versioned\",\"name\":\"b#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"b\",\"inferredType\":false},\"return#0\":{\"@type\":\"variable_versioned\",\"name\":\"return#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false},\"a#1\":{\"@type\":\"variable_versioned\",\"name\":\"a#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"a\",\"inferredType\":false},\"b#1\":{\"@type\":\"variable_versioned\",\"name\":\"b#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"b\",\"inferredType\":false},\"return#1\":{\"@type\":\"variable_versioned\",\"name\":\"return#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false},\"return#2\":{\"@type\":\"variable_versioned\",\"name\":\"return#2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false},\"return#3\":{\"@type\":\"variable_versioned\",\"name\":\"return#3\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false},\"return#4\":{\"@type\":\"variable_versioned\",\"name\":\"return#4\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false},\"return#5\":{\"@type\":\"variable_versioned\",\"name\":\"return#5\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false},\"a#2\":{\"@type\":\"variable_versioned\",\"name\":\"a#2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"a\",\"inferredType\":false},\"b#2\":{\"@type\":\"variable_versioned\",\"name\":\"b#2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"b\",\"inferredType\":false},\"return#6\":{\"@type\":\"variable_versioned\",\"name\":\"return#6\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false}},\"intermediateVarCount\":1,\"intermediateLabelCount\":2,\"returnType\":{\"@type\":\"basic\",\"typeName\":\"byte\"}},\"@BEGIN\":{\"@type\":\"label\",\"name\":\"@BEGIN\",\"intermediate\":false},\"@END\":{\"@type\":\"label\",\"name\":\"@END\",\"intermediate\":false},\"@2\":{\"@type\":\"label\",\"name\":\"@2\",\"intermediate\":true},\"@3\":{\"@type\":\"label\",\"name\":\"@3\",\"intermediate\":true},\"s1#0\":{\"@type\":\"variable_versioned\",\"name\":\"s1#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"s1\",\"inferredType\":false},\"s2#0\":{\"@type\":\"variable_versioned\",\"name\":\"s2#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"s2\",\"inferredType\":false}},\"intermediateVarCount\":2,\"intermediateLabelCount\":4,\"allocation\":null,\"liveRangeVariables\":null,\"liveRangeEquivalenceClassSet\":null},\"graph\":{\"blocks\":{\"@BEGIN\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"statements\":[{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::a#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":1},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::b#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":2},\"index\":null},{\"@type\":\"call\",\"lValue\":null,\"procedureName\":\"sum\",\"procedure\":{\"@type\":\"procref\",\"fullName\":\"sum\"},\"parameters\":null,\"parametersByAssignment\":true,\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::return#3\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"conditionalSuccessor\":null,\"callSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"sum\"}},\"@2\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"statements\":[{\"@type\":\"phiblock\",\"phiVariables\":[{\"variable\":{\"@type\":\"varref\",\"fullName\":\"sum::return#4\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#0\"}}]}],\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"$0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::return#4\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"s1#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"$0\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::a#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":9},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::b#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":13},\"index\":null},{\"@type\":\"call\",\"lValue\":null,\"procedureName\":\"sum\",\"procedure\":{\"@type\":\"procref\",\"fullName\":\"sum\"},\"parameters\":null,\"parametersByAssignment\":true,\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::return#3\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@3\"},\"conditionalSuccessor\":null,\"callSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"sum\"}},\"@3\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@3\"},\"statements\":[{\"@type\":\"phiblock\",\"phiVariables\":[{\"variable\":{\"@type\":\"varref\",\"fullName\":\"sum::return#5\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#1\"}}]}],\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"$1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::return#5\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"s2#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"$1\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@END\"},\"conditionalSuccessor\":null,\"callSuccessor\":null},\"sum\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"sum\"},\"statements\":[{\"@type\":\"phiblock\",\"phiVariables\":[{\"variable\":{\"@type\":\"varref\",\"fullName\":\"sum::a#2\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::a#1\"}},{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::a#0\"}}]},{\"variable\":{\"@type\":\"varref\",\"fullName\":\"sum::b#2\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::b#1\"}},{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::b#0\"}}]}],\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::$0\"},\"rValue1\":{\"@type\":\"varref\",\"fullName\":\"sum::a#2\"},\"operator\":{\"operator\":\"+\"},\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::b#2\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#2\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::$0\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"sum::@return\"},\"conditionalSuccessor\":null,\"callSuccessor\":null},\"sum::@return\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"sum::@return\"},\"statements\":[{\"@type\":\"phiblock\",\"phiVariables\":[{\"variable\":{\"@type\":\"varref\",\"fullName\":\"sum::return#6\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"sum\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#2\"}}]}],\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#3\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::return#6\"},\"index\":null},{\"@type\":\"return\",\"value\":null,\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@RETURN\"},\"conditionalSuccessor\":null,\"callSuccessor\":null},\"@END\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@END\"},\"statements\":[],\"defaultSuccessor\":null,\"conditionalSuccessor\":null,\"callSuccessor\":null}},\"firstBlockRef\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"sequence\":null,\"dominators\":null,\"loopSet\":null,\"callGraph\":null}}"; + String json = "{\"scope\":{\"@type\":\"program\",\"name\":\"\",\"symbols\":{\"s1\":{\"@type\":\"variable_unversioned\",\"name\":\"s1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":1,\"inferredType\":false},\"$0\":{\"@type\":\"variable_intermediate\",\"name\":\"$0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"inferredType\":true},\"s2\":{\"@type\":\"variable_unversioned\",\"name\":\"s2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":1,\"inferredType\":false},\"$1\":{\"@type\":\"variable_intermediate\",\"name\":\"$1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"inferredType\":true},\"sum\":{\"@type\":\"procedure\",\"name\":\"sum\",\"parameterNames\":[\"a\",\"b\"],\"symbols\":{\"@return\":{\"@type\":\"label\",\"name\":\"@return\",\"intermediate\":false},\"return\":{\"@type\":\"variable_unversioned\",\"name\":\"return\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":7,\"inferredType\":false},\"a\":{\"@type\":\"variable_unversioned\",\"name\":\"a\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":3,\"inferredType\":false},\"b\":{\"@type\":\"variable_unversioned\",\"name\":\"b\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":3,\"inferredType\":false},\"$0\":{\"@type\":\"variable_intermediate\",\"name\":\"$0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"inferredType\":true},\"a#0\":{\"@type\":\"variable_versioned\",\"name\":\"a#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"a\",\"inferredType\":false},\"b#0\":{\"@type\":\"variable_versioned\",\"name\":\"b#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"b\",\"inferredType\":false},\"return#0\":{\"@type\":\"variable_versioned\",\"name\":\"return#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false},\"a#1\":{\"@type\":\"variable_versioned\",\"name\":\"a#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"a\",\"inferredType\":false},\"b#1\":{\"@type\":\"variable_versioned\",\"name\":\"b#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"b\",\"inferredType\":false},\"return#1\":{\"@type\":\"variable_versioned\",\"name\":\"return#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false},\"return#2\":{\"@type\":\"variable_versioned\",\"name\":\"return#2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false},\"return#3\":{\"@type\":\"variable_versioned\",\"name\":\"return#3\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false},\"return#4\":{\"@type\":\"variable_versioned\",\"name\":\"return#4\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false},\"return#5\":{\"@type\":\"variable_versioned\",\"name\":\"return#5\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false},\"a#2\":{\"@type\":\"variable_versioned\",\"name\":\"a#2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"a\",\"inferredType\":false},\"b#2\":{\"@type\":\"variable_versioned\",\"name\":\"b#2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"b\",\"inferredType\":false},\"return#6\":{\"@type\":\"variable_versioned\",\"name\":\"return#6\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"return\",\"inferredType\":false}},\"intermediateVarCount\":1,\"intermediateLabelCount\":2,\"returnType\":{\"@type\":\"basic\",\"typeName\":\"byte\"}},\"@BEGIN\":{\"@type\":\"label\",\"name\":\"@BEGIN\",\"intermediate\":false},\"@END\":{\"@type\":\"label\",\"name\":\"@END\",\"intermediate\":false},\"@2\":{\"@type\":\"label\",\"name\":\"@2\",\"intermediate\":true},\"@3\":{\"@type\":\"label\",\"name\":\"@3\",\"intermediate\":true},\"s1#0\":{\"@type\":\"variable_versioned\",\"name\":\"s1#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"s1\",\"inferredType\":false},\"s2#0\":{\"@type\":\"variable_versioned\",\"name\":\"s2#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"s2\",\"inferredType\":false}},\"intermediateVarCount\":2,\"intermediateLabelCount\":4,\"allocation\":null,\"liveRangeVariables\":null,\"liveRangeEquivalenceClassSet\":null,\"variableRegisterWeights\":null},\"graph\":{\"blocks\":{\"@BEGIN\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"statements\":[{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::a#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":1},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::b#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":2},\"index\":null},{\"@type\":\"call\",\"lValue\":null,\"procedureName\":\"sum\",\"procedure\":{\"@type\":\"procref\",\"fullName\":\"sum\"},\"parameters\":null,\"parametersByAssignment\":true,\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::return#3\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"conditionalSuccessor\":null,\"callSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"sum\"}},\"@2\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"statements\":[{\"@type\":\"phiblock\",\"phiVariables\":[{\"variable\":{\"@type\":\"varref\",\"fullName\":\"sum::return#4\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#0\"}}]}],\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"$0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::return#4\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"s1#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"$0\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::a#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":9},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::b#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":13},\"index\":null},{\"@type\":\"call\",\"lValue\":null,\"procedureName\":\"sum\",\"procedure\":{\"@type\":\"procref\",\"fullName\":\"sum\"},\"parameters\":null,\"parametersByAssignment\":true,\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::return#3\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@3\"},\"conditionalSuccessor\":null,\"callSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"sum\"}},\"@3\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@3\"},\"statements\":[{\"@type\":\"phiblock\",\"phiVariables\":[{\"variable\":{\"@type\":\"varref\",\"fullName\":\"sum::return#5\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#1\"}}]}],\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"$1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::return#5\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"s2#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"$1\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@END\"},\"conditionalSuccessor\":null,\"callSuccessor\":null},\"sum\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"sum\"},\"statements\":[{\"@type\":\"phiblock\",\"phiVariables\":[{\"variable\":{\"@type\":\"varref\",\"fullName\":\"sum::a#2\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::a#1\"}},{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::a#0\"}}]},{\"variable\":{\"@type\":\"varref\",\"fullName\":\"sum::b#2\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::b#1\"}},{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::b#0\"}}]}],\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::$0\"},\"rValue1\":{\"@type\":\"varref\",\"fullName\":\"sum::a#2\"},\"operator\":{\"operator\":\"+\"},\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::b#2\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#2\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::$0\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"sum::@return\"},\"conditionalSuccessor\":null,\"callSuccessor\":null},\"sum::@return\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"sum::@return\"},\"statements\":[{\"@type\":\"phiblock\",\"phiVariables\":[{\"variable\":{\"@type\":\"varref\",\"fullName\":\"sum::return#6\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"sum\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#2\"}}]}],\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"sum::return#3\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"sum::return#6\"},\"index\":null},{\"@type\":\"return\",\"value\":null,\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@RETURN\"},\"conditionalSuccessor\":null,\"callSuccessor\":null},\"@END\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@END\"},\"statements\":[],\"defaultSuccessor\":null,\"conditionalSuccessor\":null,\"callSuccessor\":null}},\"firstBlockRef\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"sequence\":null,\"dominators\":null,\"loopSet\":null,\"callGraph\":null}}"; assertJsonSerialization(program, json, Program.class); } @@ -112,7 +112,7 @@ public class TestIclJson extends TestCase { CompileLog log = new CompileLog(); KickCParser.FileContext file = compiler.pass0ParseInput(new ANTLRInputStream(minProgram), log); Program program = compiler.pass1GenerateSSA(file, log); - String json = "{\"scope\":{\"@type\":\"program\",\"name\":\"\",\"symbols\":{\"n1\":{\"@type\":\"variable_unversioned\",\"name\":\"n1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":4,\"inferredType\":false},\"n2\":{\"@type\":\"variable_unversioned\",\"name\":\"n2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":4,\"inferredType\":false},\"i\":{\"@type\":\"variable_unversioned\",\"name\":\"i\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":4,\"inferredType\":false},\"fib\":{\"@type\":\"variable_unversioned\",\"name\":\"fib\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":2,\"inferredType\":false},\"@1\":{\"@type\":\"label\",\"name\":\"@1\",\"intermediate\":true},\"@2\":{\"@type\":\"label\",\"name\":\"@2\",\"intermediate\":true},\"$0\":{\"@type\":\"variable_intermediate\",\"name\":\"$0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"boolean\"},\"inferredType\":true},\"$1\":{\"@type\":\"variable_intermediate\",\"name\":\"$1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"inferredType\":true},\"$2\":{\"@type\":\"variable_intermediate\",\"name\":\"$2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"inferredType\":true},\"@BEGIN\":{\"@type\":\"label\",\"name\":\"@BEGIN\",\"intermediate\":false},\"@END\":{\"@type\":\"label\",\"name\":\"@END\",\"intermediate\":false},\"n1#0\":{\"@type\":\"variable_versioned\",\"name\":\"n1#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n1\",\"inferredType\":false},\"n2#0\":{\"@type\":\"variable_versioned\",\"name\":\"n2#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n2\",\"inferredType\":false},\"i#0\":{\"@type\":\"variable_versioned\",\"name\":\"i#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"i\",\"inferredType\":false},\"fib#0\":{\"@type\":\"variable_versioned\",\"name\":\"fib#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"fib\",\"inferredType\":false},\"fib#1\":{\"@type\":\"variable_versioned\",\"name\":\"fib#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"fib\",\"inferredType\":false},\"n1#1\":{\"@type\":\"variable_versioned\",\"name\":\"n1#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n1\",\"inferredType\":false},\"n2#1\":{\"@type\":\"variable_versioned\",\"name\":\"n2#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n2\",\"inferredType\":false},\"i#1\":{\"@type\":\"variable_versioned\",\"name\":\"i#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"i\",\"inferredType\":false},\"i#2\":{\"@type\":\"variable_versioned\",\"name\":\"i#2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"i\",\"inferredType\":false},\"n1#2\":{\"@type\":\"variable_versioned\",\"name\":\"n1#2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n1\",\"inferredType\":false},\"n2#2\":{\"@type\":\"variable_versioned\",\"name\":\"n2#2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n2\",\"inferredType\":false},\"i#3\":{\"@type\":\"variable_versioned\",\"name\":\"i#3\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"i\",\"inferredType\":false},\"n1#3\":{\"@type\":\"variable_versioned\",\"name\":\"n1#3\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n1\",\"inferredType\":false},\"n2#3\":{\"@type\":\"variable_versioned\",\"name\":\"n2#3\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n2\",\"inferredType\":false}},\"intermediateVarCount\":3,\"intermediateLabelCount\":7,\"allocation\":null,\"liveRangeVariables\":null,\"liveRangeEquivalenceClassSet\":null},\"graph\":{\"blocks\":{\"@BEGIN\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"statements\":[{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"n1#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":0},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"n2#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":1},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"i#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":12},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"fib#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":0},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@1\"},\"conditionalSuccessor\":null,\"callSuccessor\":null},\"@1\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@1\"},\"statements\":[{\"@type\":\"phiblock\",\"phiVariables\":[{\"variable\":{\"@type\":\"varref\",\"fullName\":\"i#2\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"i#1\"}},{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"i#0\"}}]},{\"variable\":{\"@type\":\"varref\",\"fullName\":\"n1#3\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"n1#1\"}},{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"n1#0\"}}]},{\"variable\":{\"@type\":\"varref\",\"fullName\":\"n2#3\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"n2#1\"}},{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"n2#0\"}}]}],\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"$0\"},\"rValue1\":{\"@type\":\"varref\",\"fullName\":\"i#2\"},\"operator\":{\"operator\":\">\"},\"rValue2\":{\"@type\":\"integer\",\"number\":0},\"index\":null},{\"@type\":\"cond\",\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"$0\"},\"destination\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@END\"},\"conditionalSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"callSuccessor\":null},\"@2\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"statements\":[{\"@type\":\"phiblock\",\"phiVariables\":[{\"variable\":{\"@type\":\"varref\",\"fullName\":\"n1#2\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@1\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"n1#3\"}}]},{\"variable\":{\"@type\":\"varref\",\"fullName\":\"n2#2\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@1\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"n2#3\"}}]},{\"variable\":{\"@type\":\"varref\",\"fullName\":\"i#3\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@1\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"i#2\"}}]}],\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"$1\"},\"rValue1\":{\"@type\":\"varref\",\"fullName\":\"n1#2\"},\"operator\":{\"operator\":\"+\"},\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"n2#2\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"fib#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"$1\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"n1#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"n2#2\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"n2#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"fib#1\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"$2\"},\"rValue1\":{\"@type\":\"varref\",\"fullName\":\"i#3\"},\"operator\":{\"operator\":\"-\"},\"rValue2\":{\"@type\":\"integer\",\"number\":1},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"i#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"$2\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@1\"},\"conditionalSuccessor\":null,\"callSuccessor\":null},\"@END\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@END\"},\"statements\":[],\"defaultSuccessor\":null,\"conditionalSuccessor\":null,\"callSuccessor\":null}},\"firstBlockRef\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"sequence\":null,\"dominators\":null,\"loopSet\":null,\"callGraph\":null}}"; + String json = "{\"scope\":{\"@type\":\"program\",\"name\":\"\",\"symbols\":{\"n1\":{\"@type\":\"variable_unversioned\",\"name\":\"n1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":4,\"inferredType\":false},\"n2\":{\"@type\":\"variable_unversioned\",\"name\":\"n2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":4,\"inferredType\":false},\"i\":{\"@type\":\"variable_unversioned\",\"name\":\"i\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":4,\"inferredType\":false},\"fib\":{\"@type\":\"variable_unversioned\",\"name\":\"fib\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"nextVersionNumber\":2,\"inferredType\":false},\"@1\":{\"@type\":\"label\",\"name\":\"@1\",\"intermediate\":true},\"@2\":{\"@type\":\"label\",\"name\":\"@2\",\"intermediate\":true},\"$0\":{\"@type\":\"variable_intermediate\",\"name\":\"$0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"boolean\"},\"inferredType\":true},\"$1\":{\"@type\":\"variable_intermediate\",\"name\":\"$1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"inferredType\":true},\"$2\":{\"@type\":\"variable_intermediate\",\"name\":\"$2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"inferredType\":true},\"@BEGIN\":{\"@type\":\"label\",\"name\":\"@BEGIN\",\"intermediate\":false},\"@END\":{\"@type\":\"label\",\"name\":\"@END\",\"intermediate\":false},\"n1#0\":{\"@type\":\"variable_versioned\",\"name\":\"n1#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n1\",\"inferredType\":false},\"n2#0\":{\"@type\":\"variable_versioned\",\"name\":\"n2#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n2\",\"inferredType\":false},\"i#0\":{\"@type\":\"variable_versioned\",\"name\":\"i#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"i\",\"inferredType\":false},\"fib#0\":{\"@type\":\"variable_versioned\",\"name\":\"fib#0\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"fib\",\"inferredType\":false},\"fib#1\":{\"@type\":\"variable_versioned\",\"name\":\"fib#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"fib\",\"inferredType\":false},\"n1#1\":{\"@type\":\"variable_versioned\",\"name\":\"n1#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n1\",\"inferredType\":false},\"n2#1\":{\"@type\":\"variable_versioned\",\"name\":\"n2#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n2\",\"inferredType\":false},\"i#1\":{\"@type\":\"variable_versioned\",\"name\":\"i#1\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"i\",\"inferredType\":false},\"i#2\":{\"@type\":\"variable_versioned\",\"name\":\"i#2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"i\",\"inferredType\":false},\"n1#2\":{\"@type\":\"variable_versioned\",\"name\":\"n1#2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n1\",\"inferredType\":false},\"n2#2\":{\"@type\":\"variable_versioned\",\"name\":\"n2#2\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n2\",\"inferredType\":false},\"i#3\":{\"@type\":\"variable_versioned\",\"name\":\"i#3\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"i\",\"inferredType\":false},\"n1#3\":{\"@type\":\"variable_versioned\",\"name\":\"n1#3\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n1\",\"inferredType\":false},\"n2#3\":{\"@type\":\"variable_versioned\",\"name\":\"n2#3\",\"type\":{\"@type\":\"basic\",\"typeName\":\"byte\"},\"versionOfName\":\"n2\",\"inferredType\":false}},\"intermediateVarCount\":3,\"intermediateLabelCount\":7,\"allocation\":null,\"liveRangeVariables\":null,\"liveRangeEquivalenceClassSet\":null,\"variableRegisterWeights\":null},\"graph\":{\"blocks\":{\"@BEGIN\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"statements\":[{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"n1#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":0},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"n2#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":1},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"i#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":12},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"fib#0\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"integer\",\"number\":0},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@1\"},\"conditionalSuccessor\":null,\"callSuccessor\":null},\"@1\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@1\"},\"statements\":[{\"@type\":\"phiblock\",\"phiVariables\":[{\"variable\":{\"@type\":\"varref\",\"fullName\":\"i#2\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"i#1\"}},{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"i#0\"}}]},{\"variable\":{\"@type\":\"varref\",\"fullName\":\"n1#3\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"n1#1\"}},{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"n1#0\"}}]},{\"variable\":{\"@type\":\"varref\",\"fullName\":\"n2#3\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"n2#1\"}},{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"n2#0\"}}]}],\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"$0\"},\"rValue1\":{\"@type\":\"varref\",\"fullName\":\"i#2\"},\"operator\":{\"operator\":\">\"},\"rValue2\":{\"@type\":\"integer\",\"number\":0},\"index\":null},{\"@type\":\"cond\",\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"$0\"},\"destination\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@END\"},\"conditionalSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"callSuccessor\":null},\"@2\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@2\"},\"statements\":[{\"@type\":\"phiblock\",\"phiVariables\":[{\"variable\":{\"@type\":\"varref\",\"fullName\":\"n1#2\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@1\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"n1#3\"}}]},{\"variable\":{\"@type\":\"varref\",\"fullName\":\"n2#2\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@1\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"n2#3\"}}]},{\"variable\":{\"@type\":\"varref\",\"fullName\":\"i#3\"},\"values\":[{\"predecessor\":{\"@type\":\"labelref\",\"fullName\":\"@1\"},\"rValue\":{\"@type\":\"varref\",\"fullName\":\"i#2\"}}]}],\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"$1\"},\"rValue1\":{\"@type\":\"varref\",\"fullName\":\"n1#2\"},\"operator\":{\"operator\":\"+\"},\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"n2#2\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"fib#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"$1\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"n1#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"n2#2\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"n2#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"fib#1\"},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"$2\"},\"rValue1\":{\"@type\":\"varref\",\"fullName\":\"i#3\"},\"operator\":{\"operator\":\"-\"},\"rValue2\":{\"@type\":\"integer\",\"number\":1},\"index\":null},{\"@type\":\"assign\",\"lValue\":{\"@type\":\"varref\",\"fullName\":\"i#1\"},\"rValue1\":null,\"operator\":null,\"rValue2\":{\"@type\":\"varref\",\"fullName\":\"$2\"},\"index\":null}],\"defaultSuccessor\":{\"@type\":\"labelref\",\"fullName\":\"@1\"},\"conditionalSuccessor\":null,\"callSuccessor\":null},\"@END\":{\"label\":{\"@type\":\"labelref\",\"fullName\":\"@END\"},\"statements\":[],\"defaultSuccessor\":null,\"conditionalSuccessor\":null,\"callSuccessor\":null}},\"firstBlockRef\":{\"@type\":\"labelref\",\"fullName\":\"@BEGIN\"},\"sequence\":null,\"dominators\":null,\"loopSet\":null,\"callGraph\":null}}"; assertJsonSerialization(program, json, Program.class); } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log index 18381203d..00ab253ef 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log @@ -1023,6 +1023,39 @@ Allocated zp ptr byte:2 to zp ptr byte:2 [ cursor#3 cursor#5 cursor#1 cursor#2 ] Allocated zp byte:4 to zp byte:4 [ x#2 x#1 ] Allocated zp byte:5 to zp byte:5 [ e#3 e#5 e#1 e#2 ] Allocated zp byte:6 to zp byte:6 [ y#2 y#4 y#1 ] + +VARIABLE REGISTER WEIGHTS +(byte[1000]) SCREEN +(byte) STAR +(byte*) cursor +(byte*) cursor#1 8.25 +(byte*) cursor#2 11.0 +(byte*) cursor#3 11.0 +(byte*) cursor#5 16.5 +(byte) e +(byte) e#1 11.0 +(byte) e#2 22.0 +(byte) e#3 5.5 +(byte) e#5 16.5 +(byte) x +(byte) x#1 3.666666666666667 +(byte) x#2 11.0 +(byte) x0 +(byte) x1 +(byte) xd +(byte) y +(byte) y#1 7.333333333333333 +(byte) y#2 5.5 +(byte) y#4 16.5 +(byte) y0 +(byte) y1 +(byte) yd + +zp ptr byte:2 [ cursor#3 cursor#5 cursor#1 cursor#2 ] +zp byte:4 [ x#2 x#1 ] +zp byte:5 [ e#3 e#5 e#1 e#2 ] +zp byte:6 [ y#2 y#4 y#1 ] + Re-allocated ZP register from zp ptr byte:2 to zp ptr byte:2 Re-allocated ZP register from zp byte:4 to zp byte:4 Re-allocated ZP register from zp byte:5 to zp byte:5 @@ -1272,25 +1305,25 @@ FINAL SYMBOL TABLE (byte[1000]) SCREEN (byte) STAR (byte*) cursor -(byte*) cursor#1 zp ptr byte:2 -(byte*) cursor#2 zp ptr byte:2 -(byte*) cursor#3 zp ptr byte:2 -(byte*) cursor#5 zp ptr byte:2 +(byte*) cursor#1 zp ptr byte:2 8.25 +(byte*) cursor#2 zp ptr byte:2 11.0 +(byte*) cursor#3 zp ptr byte:2 11.0 +(byte*) cursor#5 zp ptr byte:2 16.5 (byte) e -(byte) e#1 zp byte:5 -(byte) e#2 zp byte:5 -(byte) e#3 zp byte:5 -(byte) e#5 zp byte:5 +(byte) e#1 zp byte:5 11.0 +(byte) e#2 zp byte:5 22.0 +(byte) e#3 zp byte:5 5.5 +(byte) e#5 zp byte:5 16.5 (byte) x -(byte) x#1 zp byte:4 -(byte) x#2 zp byte:4 +(byte) x#1 zp byte:4 3.666666666666667 +(byte) x#2 zp byte:4 11.0 (byte) x0 (byte) x1 (byte) xd (byte) y -(byte) y#1 zp byte:6 -(byte) y#2 zp byte:6 -(byte) y#4 zp byte:6 +(byte) y#1 zp byte:6 7.333333333333333 +(byte) y#2 zp byte:6 5.5 +(byte) y#4 zp byte:6 16.5 (byte) y0 (byte) y1 (byte) yd diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.sym b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.sym index 63adf5e23..b97506144 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.sym @@ -6,25 +6,30 @@ (byte[1000]) SCREEN (byte) STAR (byte*) cursor -(byte*) cursor#1 zp ptr byte:2 -(byte*) cursor#2 zp ptr byte:2 -(byte*) cursor#3 zp ptr byte:2 -(byte*) cursor#5 zp ptr byte:2 +(byte*) cursor#1 zp ptr byte:2 8.25 +(byte*) cursor#2 zp ptr byte:2 11.0 +(byte*) cursor#3 zp ptr byte:2 11.0 +(byte*) cursor#5 zp ptr byte:2 16.5 (byte) e -(byte) e#1 zp byte:5 -(byte) e#2 zp byte:5 -(byte) e#3 zp byte:5 -(byte) e#5 zp byte:5 +(byte) e#1 zp byte:5 11.0 +(byte) e#2 zp byte:5 22.0 +(byte) e#3 zp byte:5 5.5 +(byte) e#5 zp byte:5 16.5 (byte) x -(byte) x#1 zp byte:4 -(byte) x#2 zp byte:4 +(byte) x#1 zp byte:4 3.666666666666667 +(byte) x#2 zp byte:4 11.0 (byte) x0 (byte) x1 (byte) xd (byte) y -(byte) y#1 zp byte:6 -(byte) y#2 zp byte:6 -(byte) y#4 zp byte:6 +(byte) y#1 zp byte:6 7.333333333333333 +(byte) y#2 zp byte:6 5.5 +(byte) y#4 zp byte:6 16.5 (byte) y0 (byte) y1 (byte) yd + +zp ptr byte:2 [ cursor#3 cursor#5 cursor#1 cursor#2 ] +zp byte:4 [ x#2 x#1 ] +zp byte:5 [ e#3 e#5 e#1 e#2 ] +zp byte:6 [ y#2 y#4 y#1 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.log b/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.log index 7e70d7028..9ecb42a29 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.log @@ -183,7 +183,6 @@ SYMBOLS (byte) flip::i (byte) flip::r (byte) flip::srcIdx - (void()) main() (void~) main::$0 (byte~) main::$1 @@ -199,7 +198,6 @@ SYMBOLS (label) main::@4 (label) main::@return (byte) main::c - (void()) plot() (byte~) plot::$0 (byte*~) plot::$1 @@ -215,14 +213,12 @@ SYMBOLS (byte*) plot::line (byte) plot::x (byte) plot::y - (void()) prepare() (boolean~) prepare::$0 (label) prepare::@1 (label) prepare::@return (byte) prepare::i - INITIAL CONTROL FLOW GRAPH @BEGIN: from (byte[1000]) SCREEN ← (word) 1024 @@ -3884,6 +3880,76 @@ Allocated zp byte:15 to zp byte:15 [ main::$3 ] Allocated zp byte:16 to zp byte:16 [ plot::$3 ] Allocated zp byte:17 to zp byte:17 [ flip::$0 ] Allocated zp byte:18 to zp byte:18 [ flip::$4 ] + +VARIABLE REGISTER WEIGHTS +(byte*) RASTER +(byte[1000]) SCREEN +(byte[256]) buffer1 +(byte[256]) buffer2 +(void()) flip() +(byte~) flip::$0 2002.0 +(byte~) flip::$4 202.0 +(byte) flip::c +(byte) flip::c#1 1501.5 +(byte) flip::c#2 400.4 +(byte) flip::dstIdx +(byte) flip::dstIdx#1 701.0 +(byte) flip::dstIdx#2 67.33333333333333 +(byte) flip::dstIdx#3 776.0 +(byte) flip::dstIdx#5 202.0 +(byte) flip::i +(byte) flip::i#1 151.5 +(byte) flip::i#2 134.66666666666666 +(byte) flip::r +(byte) flip::r#1 151.5 +(byte) flip::r#2 22.444444444444443 +(byte) flip::srcIdx +(byte) flip::srcIdx#1 300.42857142857144 +(byte) flip::srcIdx#2 1034.6666666666667 +(byte) flip::srcIdx#3 202.0 +(void()) main() +(byte~) main::$1 2002.0 +(byte~) main::$3 2002.0 +(byte) main::c +(byte) main::c#1 151.5 +(byte) main::c#2 40.4 +(void()) plot() +(byte~) plot::$3 2002.0 +(byte) plot::i +(byte) plot::i#1 350.5 +(byte) plot::i#2 1034.6666666666667 +(byte) plot::i#3 202.0 +(byte*) plot::line +(byte*) plot::line#1 67.33333333333333 +(byte*) plot::line#2 171.85714285714283 +(byte) plot::x +(byte) plot::x#1 1501.5 +(byte) plot::x#2 750.75 +(byte) plot::y +(byte) plot::y#1 151.5 +(byte) plot::y#2 25.25 +(void()) prepare() +(byte) prepare::i +(byte) prepare::i#1 16.5 +(byte) prepare::i#2 22.0 + +zp byte:2 [ main::c#2 main::c#1 ] +zp ptr byte:3 [ plot::line#2 plot::line#1 ] +zp byte:5 [ plot::y#2 plot::y#1 ] +zp byte:6 [ plot::i#2 plot::i#3 plot::i#1 ] +zp byte:7 [ plot::x#2 plot::x#1 ] +zp byte:8 [ flip::r#2 flip::r#1 ] +zp byte:9 [ flip::srcIdx#2 flip::srcIdx#3 flip::srcIdx#1 ] +zp byte:10 [ flip::dstIdx#3 flip::dstIdx#5 flip::dstIdx#2 flip::dstIdx#1 ] +zp byte:11 [ flip::c#2 flip::c#1 ] +zp byte:12 [ flip::i#2 flip::i#1 ] +zp byte:13 [ prepare::i#2 prepare::i#1 ] +zp byte:14 [ main::$1 ] +zp byte:15 [ main::$3 ] +zp byte:16 [ plot::$3 ] +zp byte:17 [ flip::$0 ] +zp byte:18 [ flip::$4 ] + Coalescing zero page register [ zp byte:2 [ main::c#2 main::c#1 ] ] with [ zp byte:5 [ plot::y#2 plot::y#1 ] ] Coalescing zero page register [ zp byte:2 [ main::c#2 main::c#1 plot::y#2 plot::y#1 ] ] with [ zp byte:8 [ flip::r#2 flip::r#1 ] ] Coalescing zero page register [ zp byte:2 [ main::c#2 main::c#1 plot::y#2 plot::y#1 flip::r#2 flip::r#1 ] ] with [ zp byte:12 [ flip::i#2 flip::i#1 ] ] @@ -4794,35 +4860,34 @@ FINAL SYMBOL TABLE (byte[256]) buffer1 (byte[256]) buffer2 (void()) flip() -(byte~) flip::$0 zp byte:8 -(byte~) flip::$4 zp byte:5 +(byte~) flip::$0 zp byte:8 2002.0 +(byte~) flip::$4 zp byte:5 202.0 (label) flip::@1 (label) flip::@2 (label) flip::@3 (label) flip::@4 (label) flip::@return (byte) flip::c -(byte) flip::c#1 zp byte:7 -(byte) flip::c#2 zp byte:7 +(byte) flip::c#1 zp byte:7 1501.5 +(byte) flip::c#2 zp byte:7 400.4 (byte) flip::dstIdx -(byte) flip::dstIdx#1 zp byte:6 -(byte) flip::dstIdx#2 zp byte:6 -(byte) flip::dstIdx#3 zp byte:6 -(byte) flip::dstIdx#5 zp byte:6 +(byte) flip::dstIdx#1 zp byte:6 701.0 +(byte) flip::dstIdx#2 zp byte:6 67.33333333333333 +(byte) flip::dstIdx#3 zp byte:6 776.0 +(byte) flip::dstIdx#5 zp byte:6 202.0 (byte) flip::i -(byte) flip::i#1 zp byte:2 -(byte) flip::i#2 zp byte:2 +(byte) flip::i#1 zp byte:2 151.5 +(byte) flip::i#2 zp byte:2 134.66666666666666 (byte) flip::r -(byte) flip::r#1 zp byte:2 -(byte) flip::r#2 zp byte:2 +(byte) flip::r#1 zp byte:2 151.5 +(byte) flip::r#2 zp byte:2 22.444444444444443 (byte) flip::srcIdx -(byte) flip::srcIdx#1 zp byte:5 -(byte) flip::srcIdx#2 zp byte:5 -(byte) flip::srcIdx#3 zp byte:5 - +(byte) flip::srcIdx#1 zp byte:5 300.42857142857144 +(byte) flip::srcIdx#2 zp byte:5 1034.6666666666667 +(byte) flip::srcIdx#3 zp byte:5 202.0 (void()) main() -(byte~) main::$1 zp byte:5 -(byte~) main::$3 zp byte:5 +(byte~) main::$1 zp byte:5 2002.0 +(byte~) main::$3 zp byte:5 2002.0 (label) main::@10 (label) main::@11 (label) main::@3 @@ -4831,36 +4896,33 @@ FINAL SYMBOL TABLE (label) main::@7 (label) main::@return (byte) main::c -(byte) main::c#1 zp byte:2 -(byte) main::c#2 zp byte:2 - +(byte) main::c#1 zp byte:2 151.5 +(byte) main::c#2 zp byte:2 40.4 (void()) plot() -(byte~) plot::$3 zp byte:7 +(byte~) plot::$3 zp byte:7 2002.0 (label) plot::@1 (label) plot::@2 (label) plot::@3 (label) plot::@return (byte) plot::i -(byte) plot::i#1 zp byte:5 -(byte) plot::i#2 zp byte:5 -(byte) plot::i#3 zp byte:5 +(byte) plot::i#1 zp byte:5 350.5 +(byte) plot::i#2 zp byte:5 1034.6666666666667 +(byte) plot::i#3 zp byte:5 202.0 (byte*) plot::line -(byte*) plot::line#1 zp ptr byte:3 -(byte*) plot::line#2 zp ptr byte:3 +(byte*) plot::line#1 zp ptr byte:3 67.33333333333333 +(byte*) plot::line#2 zp ptr byte:3 171.85714285714283 (byte) plot::x -(byte) plot::x#1 zp byte:6 -(byte) plot::x#2 zp byte:6 +(byte) plot::x#1 zp byte:6 1501.5 +(byte) plot::x#2 zp byte:6 750.75 (byte) plot::y -(byte) plot::y#1 zp byte:2 -(byte) plot::y#2 zp byte:2 - +(byte) plot::y#1 zp byte:2 151.5 +(byte) plot::y#2 zp byte:2 25.25 (void()) prepare() (label) prepare::@1 (label) prepare::@return (byte) prepare::i -(byte) prepare::i#1 zp byte:2 -(byte) prepare::i#2 zp byte:2 - +(byte) prepare::i#1 zp byte:2 16.5 +(byte) prepare::i#2 zp byte:2 22.0 zp byte:2 [ main::c#2 main::c#1 plot::y#2 plot::y#1 flip::r#2 flip::r#1 flip::i#2 flip::i#1 prepare::i#2 prepare::i#1 ] zp ptr byte:3 [ plot::line#2 plot::line#1 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.sym b/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.sym index 6d6b4a58f..7c4581657 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.sym @@ -5,35 +5,34 @@ (byte[256]) buffer1 (byte[256]) buffer2 (void()) flip() -(byte~) flip::$0 zp byte:8 -(byte~) flip::$4 zp byte:5 +(byte~) flip::$0 zp byte:8 2002.0 +(byte~) flip::$4 zp byte:5 202.0 (label) flip::@1 (label) flip::@2 (label) flip::@3 (label) flip::@4 (label) flip::@return (byte) flip::c -(byte) flip::c#1 zp byte:7 -(byte) flip::c#2 zp byte:7 +(byte) flip::c#1 zp byte:7 1501.5 +(byte) flip::c#2 zp byte:7 400.4 (byte) flip::dstIdx -(byte) flip::dstIdx#1 zp byte:6 -(byte) flip::dstIdx#2 zp byte:6 -(byte) flip::dstIdx#3 zp byte:6 -(byte) flip::dstIdx#5 zp byte:6 +(byte) flip::dstIdx#1 zp byte:6 701.0 +(byte) flip::dstIdx#2 zp byte:6 67.33333333333333 +(byte) flip::dstIdx#3 zp byte:6 776.0 +(byte) flip::dstIdx#5 zp byte:6 202.0 (byte) flip::i -(byte) flip::i#1 zp byte:2 -(byte) flip::i#2 zp byte:2 +(byte) flip::i#1 zp byte:2 151.5 +(byte) flip::i#2 zp byte:2 134.66666666666666 (byte) flip::r -(byte) flip::r#1 zp byte:2 -(byte) flip::r#2 zp byte:2 +(byte) flip::r#1 zp byte:2 151.5 +(byte) flip::r#2 zp byte:2 22.444444444444443 (byte) flip::srcIdx -(byte) flip::srcIdx#1 zp byte:5 -(byte) flip::srcIdx#2 zp byte:5 -(byte) flip::srcIdx#3 zp byte:5 - +(byte) flip::srcIdx#1 zp byte:5 300.42857142857144 +(byte) flip::srcIdx#2 zp byte:5 1034.6666666666667 +(byte) flip::srcIdx#3 zp byte:5 202.0 (void()) main() -(byte~) main::$1 zp byte:5 -(byte~) main::$3 zp byte:5 +(byte~) main::$1 zp byte:5 2002.0 +(byte~) main::$3 zp byte:5 2002.0 (label) main::@10 (label) main::@11 (label) main::@3 @@ -42,33 +41,37 @@ (label) main::@7 (label) main::@return (byte) main::c -(byte) main::c#1 zp byte:2 -(byte) main::c#2 zp byte:2 - +(byte) main::c#1 zp byte:2 151.5 +(byte) main::c#2 zp byte:2 40.4 (void()) plot() -(byte~) plot::$3 zp byte:7 +(byte~) plot::$3 zp byte:7 2002.0 (label) plot::@1 (label) plot::@2 (label) plot::@3 (label) plot::@return (byte) plot::i -(byte) plot::i#1 zp byte:5 -(byte) plot::i#2 zp byte:5 -(byte) plot::i#3 zp byte:5 +(byte) plot::i#1 zp byte:5 350.5 +(byte) plot::i#2 zp byte:5 1034.6666666666667 +(byte) plot::i#3 zp byte:5 202.0 (byte*) plot::line -(byte*) plot::line#1 zp ptr byte:3 -(byte*) plot::line#2 zp ptr byte:3 +(byte*) plot::line#1 zp ptr byte:3 67.33333333333333 +(byte*) plot::line#2 zp ptr byte:3 171.85714285714283 (byte) plot::x -(byte) plot::x#1 zp byte:6 -(byte) plot::x#2 zp byte:6 +(byte) plot::x#1 zp byte:6 1501.5 +(byte) plot::x#2 zp byte:6 750.75 (byte) plot::y -(byte) plot::y#1 zp byte:2 -(byte) plot::y#2 zp byte:2 - +(byte) plot::y#1 zp byte:2 151.5 +(byte) plot::y#2 zp byte:2 25.25 (void()) prepare() (label) prepare::@1 (label) prepare::@return (byte) prepare::i -(byte) prepare::i#1 zp byte:2 -(byte) prepare::i#2 zp byte:2 +(byte) prepare::i#1 zp byte:2 16.5 +(byte) prepare::i#2 zp byte:2 22.0 +zp byte:2 [ main::c#2 main::c#1 plot::y#2 plot::y#1 flip::r#2 flip::r#1 flip::i#2 flip::i#1 prepare::i#2 prepare::i#1 ] +zp ptr byte:3 [ plot::line#2 plot::line#1 ] +zp byte:6 [ plot::i#2 plot::i#3 plot::i#1 flip::srcIdx#2 flip::srcIdx#3 flip::srcIdx#1 main::$1 main::$3 flip::$4 ] +zp byte:7 [ plot::x#2 plot::x#1 flip::dstIdx#3 flip::dstIdx#5 flip::dstIdx#2 flip::dstIdx#1 ] +zp byte:11 [ flip::c#2 flip::c#1 plot::$3 ] +zp byte:17 [ flip::$0 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopmin.log b/src/main/java/dk/camelot64/kickc/test/ref/loopmin.log index 4e18ca810..daafcb6b4 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopmin.log @@ -371,6 +371,19 @@ Complete equivalence classes [ s#2 s#4 s#1 ] Allocated zp byte:2 to zp byte:2 [ i#2 i#1 ] Allocated zp byte:3 to zp byte:3 [ s#2 s#4 s#1 ] + +VARIABLE REGISTER WEIGHTS +(byte) i +(byte) i#1 16.5 +(byte) i#2 11.0 +(byte) s +(byte) s#1 22.0 +(byte) s#2 16.5 +(byte) s#4 11.0 + +zp byte:2 [ i#2 i#1 ] +zp byte:3 [ s#2 s#4 s#1 ] + Re-allocated ZP register from zp byte:2 to zp byte:2 Re-allocated ZP register from zp byte:3 to zp byte:3 INITIAL ASM @@ -505,12 +518,12 @@ FINAL SYMBOL TABLE (label) @BEGIN (label) @END (byte) i -(byte) i#1 zp byte:2 -(byte) i#2 zp byte:2 +(byte) i#1 zp byte:2 16.5 +(byte) i#2 zp byte:2 11.0 (byte) s -(byte) s#1 zp byte:3 -(byte) s#2 zp byte:3 -(byte) s#4 zp byte:3 +(byte) s#1 zp byte:3 22.0 +(byte) s#2 zp byte:3 16.5 +(byte) s#4 zp byte:3 11.0 zp byte:2 [ i#2 i#1 ] zp byte:3 [ s#2 s#4 s#1 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopmin.sym b/src/main/java/dk/camelot64/kickc/test/ref/loopmin.sym index 14fb7ea78..278cd587b 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopmin.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopmin.sym @@ -4,9 +4,12 @@ (label) @BEGIN (label) @END (byte) i -(byte) i#1 zp byte:2 -(byte) i#2 zp byte:2 +(byte) i#1 zp byte:2 16.5 +(byte) i#2 zp byte:2 11.0 (byte) s -(byte) s#1 zp byte:3 -(byte) s#2 zp byte:3 -(byte) s#4 zp byte:3 +(byte) s#1 zp byte:3 22.0 +(byte) s#2 zp byte:3 16.5 +(byte) s#4 zp byte:3 11.0 + +zp byte:2 [ i#2 i#1 ] +zp byte:3 [ s#2 s#4 s#1 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopnest.log b/src/main/java/dk/camelot64/kickc/test/ref/loopnest.log index 48e9debe7..9d6ccbe78 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest.log @@ -51,14 +51,12 @@ SYMBOLS (label) main::@1 (label) main::@return (byte) main::i - (void()) nest() (boolean~) nest::$0 (label) nest::@1 (label) nest::@return (byte) nest::j - INITIAL CONTROL FLOW GRAPH @BEGIN: from (byte*) SCREEN ← (word) 1024 @@ -721,6 +719,21 @@ Complete equivalence classes [ nest::j#2 nest::j#1 ] Allocated zp byte:2 to zp byte:2 [ main::i#2 main::i#1 ] Allocated zp byte:3 to zp byte:3 [ nest::j#2 nest::j#1 ] + +VARIABLE REGISTER WEIGHTS +(byte*) SCREEN +(void()) main() +(byte) main::i +(byte) main::i#1 16.5 +(byte) main::i#2 3.142857142857143 +(void()) nest() +(byte) nest::j +(byte) nest::j#1 151.5 +(byte) nest::j#2 151.5 + +zp byte:2 [ main::i#2 main::i#1 ] +zp byte:3 [ nest::j#2 nest::j#1 ] + Re-allocated ZP register from zp byte:2 to zp byte:2 Re-allocated ZP register from zp byte:3 to zp byte:3 INITIAL ASM @@ -872,16 +885,14 @@ FINAL SYMBOL TABLE (label) main::@3 (label) main::@return (byte) main::i -(byte) main::i#1 zp byte:2 -(byte) main::i#2 zp byte:2 - +(byte) main::i#1 zp byte:2 16.5 +(byte) main::i#2 zp byte:2 3.142857142857143 (void()) nest() (label) nest::@1 (label) nest::@return (byte) nest::j -(byte) nest::j#1 zp byte:3 -(byte) nest::j#2 zp byte:3 - +(byte) nest::j#1 zp byte:3 151.5 +(byte) nest::j#2 zp byte:3 151.5 zp byte:2 [ main::i#2 main::i#1 ] zp byte:3 [ nest::j#2 nest::j#1 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopnest.sym b/src/main/java/dk/camelot64/kickc/test/ref/loopnest.sym index 509de3ff5..717de8585 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest.sym @@ -6,16 +6,14 @@ (label) main::@3 (label) main::@return (byte) main::i -(byte) main::i#1 zp byte:2 -(byte) main::i#2 zp byte:2 - +(byte) main::i#1 zp byte:2 16.5 +(byte) main::i#2 zp byte:2 3.142857142857143 (void()) nest() (label) nest::@1 (label) nest::@return (byte) nest::j -(byte) nest::j#1 zp byte:3 -(byte) nest::j#2 zp byte:3 - +(byte) nest::j#1 zp byte:3 151.5 +(byte) nest::j#2 zp byte:3 151.5 zp byte:2 [ main::i#2 main::i#1 ] zp byte:3 [ nest::j#2 nest::j#1 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.log b/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.log index 60c0a464b..7715dc210 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.log @@ -99,7 +99,6 @@ SYMBOLS (label) main::@return (byte) main::i (byte) main::j - (void()) nest1() (void~) nest1::$0 (boolean~) nest1::$1 @@ -109,7 +108,6 @@ SYMBOLS (label) nest1::@return (byte) nest1::i (byte) nest1::j - (void()) nest2() (boolean~) nest2::$0 (boolean~) nest2::$1 @@ -119,7 +117,6 @@ SYMBOLS (byte) nest2::i (byte) nest2::j - INITIAL CONTROL FLOW GRAPH @BEGIN: from (byte*) SCREEN ← (word) 1024 @@ -1820,6 +1817,38 @@ Allocated zp byte:4 to zp byte:4 [ nest1::i#2 nest1::i#1 ] Allocated zp byte:5 to zp byte:5 [ nest1::j#2 nest1::j#1 ] Allocated zp byte:6 to zp byte:6 [ nest2::i#2 nest2::i#1 ] Allocated zp byte:7 to zp byte:7 [ nest2::j#2 nest2::j#1 ] + +VARIABLE REGISTER WEIGHTS +(byte*) SCREEN +(void()) main() +(byte) main::i +(byte) main::i#1 16.5 +(byte) main::i#2 1.0476190476190477 +(byte) main::j +(byte) main::j#1 151.5 +(byte) main::j#2 11.222222222222221 +(void()) nest1() +(byte) nest1::i +(byte) nest1::i#1 1501.5 +(byte) nest1::i#2 154.0 +(byte) nest1::j +(byte) nest1::j#1 15001.5 +(byte) nest1::j#2 2000.2 +(void()) nest2() +(byte) nest2::i +(byte) nest2::i#1 150001.5 +(byte) nest2::i#2 40000.4 +(byte) nest2::j +(byte) nest2::j#1 1500001.5 +(byte) nest2::j#2 1500001.5 + +zp byte:2 [ main::i#2 main::i#1 ] +zp byte:3 [ main::j#2 main::j#1 ] +zp byte:4 [ nest1::i#2 nest1::i#1 ] +zp byte:5 [ nest1::j#2 nest1::j#1 ] +zp byte:6 [ nest2::i#2 nest2::i#1 ] +zp byte:7 [ nest2::j#2 nest2::j#1 ] + Re-allocated ZP register from zp byte:2 to zp byte:2 Re-allocated ZP register from zp byte:3 to zp byte:3 Re-allocated ZP register from zp byte:4 to zp byte:4 @@ -2175,12 +2204,11 @@ FINAL SYMBOL TABLE (label) main::@5 (label) main::@return (byte) main::i -(byte) main::i#1 zp byte:2 -(byte) main::i#2 zp byte:2 +(byte) main::i#1 zp byte:2 16.5 +(byte) main::i#2 zp byte:2 1.0476190476190477 (byte) main::j -(byte) main::j#1 zp byte:3 -(byte) main::j#2 zp byte:3 - +(byte) main::j#1 zp byte:3 151.5 +(byte) main::j#2 zp byte:3 11.222222222222221 (void()) nest1() (label) nest1::@1 (label) nest1::@2 @@ -2188,24 +2216,22 @@ FINAL SYMBOL TABLE (label) nest1::@5 (label) nest1::@return (byte) nest1::i -(byte) nest1::i#1 zp byte:4 -(byte) nest1::i#2 zp byte:4 +(byte) nest1::i#1 zp byte:4 1501.5 +(byte) nest1::i#2 zp byte:4 154.0 (byte) nest1::j -(byte) nest1::j#1 zp byte:5 -(byte) nest1::j#2 zp byte:5 - +(byte) nest1::j#1 zp byte:5 15001.5 +(byte) nest1::j#2 zp byte:5 2000.2 (void()) nest2() (label) nest2::@1 (label) nest2::@2 (label) nest2::@3 (label) nest2::@return (byte) nest2::i -(byte) nest2::i#1 zp byte:6 -(byte) nest2::i#2 zp byte:6 +(byte) nest2::i#1 zp byte:6 150001.5 +(byte) nest2::i#2 zp byte:6 40000.4 (byte) nest2::j -(byte) nest2::j#1 zp byte:7 -(byte) nest2::j#2 zp byte:7 - +(byte) nest2::j#1 zp byte:7 1500001.5 +(byte) nest2::j#2 zp byte:7 1500001.5 zp byte:2 [ main::i#2 main::i#1 ] zp byte:3 [ main::j#2 main::j#1 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.sym b/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.sym index eba923f71..56df4f4ab 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.sym @@ -8,12 +8,11 @@ (label) main::@5 (label) main::@return (byte) main::i -(byte) main::i#1 zp byte:2 -(byte) main::i#2 zp byte:2 +(byte) main::i#1 zp byte:2 16.5 +(byte) main::i#2 zp byte:2 1.0476190476190477 (byte) main::j -(byte) main::j#1 zp byte:3 -(byte) main::j#2 zp byte:3 - +(byte) main::j#1 zp byte:3 151.5 +(byte) main::j#2 zp byte:3 11.222222222222221 (void()) nest1() (label) nest1::@1 (label) nest1::@2 @@ -21,24 +20,22 @@ (label) nest1::@5 (label) nest1::@return (byte) nest1::i -(byte) nest1::i#1 zp byte:4 -(byte) nest1::i#2 zp byte:4 +(byte) nest1::i#1 zp byte:4 1501.5 +(byte) nest1::i#2 zp byte:4 154.0 (byte) nest1::j -(byte) nest1::j#1 zp byte:5 -(byte) nest1::j#2 zp byte:5 - +(byte) nest1::j#1 zp byte:5 15001.5 +(byte) nest1::j#2 zp byte:5 2000.2 (void()) nest2() (label) nest2::@1 (label) nest2::@2 (label) nest2::@3 (label) nest2::@return (byte) nest2::i -(byte) nest2::i#1 zp byte:6 -(byte) nest2::i#2 zp byte:6 +(byte) nest2::i#1 zp byte:6 150001.5 +(byte) nest2::i#2 zp byte:6 40000.4 (byte) nest2::j -(byte) nest2::j#1 zp byte:7 -(byte) nest2::j#2 zp byte:7 - +(byte) nest2::j#1 zp byte:7 1500001.5 +(byte) nest2::j#2 zp byte:7 1500001.5 zp byte:2 [ main::i#2 main::i#1 ] zp byte:3 [ main::j#2 main::j#1 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log index f2ae74b04..f5eeaa298 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log @@ -395,6 +395,19 @@ Complete equivalence classes [ s#3 s#1 s#2 ] Allocated zp byte:2 to zp byte:2 [ i#2 i#1 ] Allocated zp byte:3 to zp byte:3 [ s#3 s#1 s#2 ] + +VARIABLE REGISTER WEIGHTS +(byte) i +(byte) i#1 11.0 +(byte) i#2 33.0 +(byte) s +(byte) s#1 22.0 +(byte) s#2 22.0 +(byte) s#3 11.0 + +zp byte:2 [ i#2 i#1 ] +zp byte:3 [ s#3 s#1 s#2 ] + Re-allocated ZP register from zp byte:2 to zp byte:2 Re-allocated ZP register from zp byte:3 to zp byte:3 INITIAL ASM @@ -527,12 +540,12 @@ FINAL SYMBOL TABLE (label) @BEGIN (label) @END (byte) i -(byte) i#1 zp byte:2 -(byte) i#2 zp byte:2 +(byte) i#1 zp byte:2 11.0 +(byte) i#2 zp byte:2 33.0 (byte) s -(byte) s#1 zp byte:3 -(byte) s#2 zp byte:3 -(byte) s#3 zp byte:3 +(byte) s#1 zp byte:3 22.0 +(byte) s#2 zp byte:3 22.0 +(byte) s#3 zp byte:3 11.0 zp byte:2 [ i#2 i#1 ] zp byte:3 [ s#3 s#1 s#2 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.sym b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.sym index e5ab7c897..ed3c73fd0 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.sym @@ -5,9 +5,12 @@ (label) @BEGIN (label) @END (byte) i -(byte) i#1 zp byte:2 -(byte) i#2 zp byte:2 +(byte) i#1 zp byte:2 11.0 +(byte) i#2 zp byte:2 33.0 (byte) s -(byte) s#1 zp byte:3 -(byte) s#2 zp byte:3 -(byte) s#3 zp byte:3 +(byte) s#1 zp byte:3 22.0 +(byte) s#2 zp byte:3 22.0 +(byte) s#3 zp byte:3 11.0 + +zp byte:2 [ i#2 i#1 ] +zp byte:3 [ s#3 s#1 s#2 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/minus.log b/src/main/java/dk/camelot64/kickc/test/ref/minus.log index ca8a295b5..06545be0e 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/minus.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/minus.log @@ -291,6 +291,18 @@ Complete equivalence classes [ $0 $1 ] Allocated zp byte:2 to zp byte:2 [ i#2 i#1 ] Allocated zp byte:3 to zp byte:3 [ $0 $1 ] + +VARIABLE REGISTER WEIGHTS +(byte~) $0 22.0 +(byte~) $1 22.0 +(byte) i +(byte) i#1 16.5 +(byte) i#2 11.0 +(byte[16]) p + +zp byte:2 [ i#2 i#1 ] +zp byte:3 [ $0 $1 ] + Re-allocated ZP register from zp byte:2 to zp byte:2 Re-allocated ZP register from zp byte:3 to zp byte:3 INITIAL ASM @@ -396,14 +408,14 @@ B1: BEND: FINAL SYMBOL TABLE -(byte~) $0 zp byte:3 -(byte~) $1 zp byte:3 +(byte~) $0 zp byte:3 22.0 +(byte~) $1 zp byte:3 22.0 (label) @1 (label) @BEGIN (label) @END (byte) i -(byte) i#1 zp byte:2 -(byte) i#2 zp byte:2 +(byte) i#1 zp byte:2 16.5 +(byte) i#2 zp byte:2 11.0 (byte[16]) p zp byte:2 [ i#2 i#1 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/minus.sym b/src/main/java/dk/camelot64/kickc/test/ref/minus.sym index 25f3a616a..672e79f14 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/minus.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/minus.sym @@ -1,9 +1,12 @@ -(byte~) $0 zp byte:3 -(byte~) $1 zp byte:3 +(byte~) $0 zp byte:3 22.0 +(byte~) $1 zp byte:3 22.0 (label) @1 (label) @BEGIN (label) @END (byte) i -(byte) i#1 zp byte:2 -(byte) i#2 zp byte:2 +(byte) i#1 zp byte:2 16.5 +(byte) i#2 zp byte:2 11.0 (byte[16]) p + +zp byte:2 [ i#2 i#1 ] +zp byte:3 [ $0 $1 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/summin.log b/src/main/java/dk/camelot64/kickc/test/ref/summin.log index 1686ca0c9..88a4e7dc4 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/summin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/summin.log @@ -35,7 +35,6 @@ SYMBOLS (byte) sum::b (byte) sum::return - INITIAL CONTROL FLOW GRAPH @BEGIN: from (byte~) $0 ← call sum (byte) 1 (byte) 2 @@ -370,6 +369,27 @@ Allocated zp byte:2 to zp byte:2 [ sum::a#2 sum::return#0 ] Allocated zp byte:3 to zp byte:3 [ sum::b#2 ] Allocated zp byte:4 to zp byte:4 [ s1#0 s3#0 ] Allocated zp byte:5 to zp byte:5 [ s2#0 ] + +VARIABLE REGISTER WEIGHTS +(byte) s1 +(byte) s1#0 0.5714285714285714 +(byte) s2 +(byte) s2#0 4.0 +(byte) s3 +(byte) s3#0 Infinity +(byte()) sum((byte) sum::a , (byte) sum::b) +(byte) sum::a +(byte) sum::a#2 2.0 +(byte) sum::b +(byte) sum::b#2 2.0 +(byte) sum::return +(byte) sum::return#0 1.2000000000000002 + +zp byte:2 [ sum::a#2 sum::return#0 ] +zp byte:3 [ sum::b#2 ] +zp byte:4 [ s1#0 s3#0 ] +zp byte:5 [ s2#0 ] + Coalescing zero page register [ zp byte:2 [ sum::a#2 sum::return#0 ] ] with [ zp byte:5 [ s2#0 ] ] Re-allocated ZP register from zp byte:2 to zp byte:2 Re-allocated ZP register from zp byte:3 to zp byte:3 @@ -467,20 +487,19 @@ FINAL SYMBOL TABLE (label) @BEGIN (label) @END (byte) s1 -(byte) s1#0 zp byte:4 +(byte) s1#0 zp byte:4 0.5714285714285714 (byte) s2 -(byte) s2#0 zp byte:2 +(byte) s2#0 zp byte:2 4.0 (byte) s3 -(byte) s3#0 zp byte:4 +(byte) s3#0 zp byte:4 Infinity (byte()) sum((byte) sum::a , (byte) sum::b) (label) sum::@return (byte) sum::a -(byte) sum::a#2 zp byte:2 +(byte) sum::a#2 zp byte:2 2.0 (byte) sum::b -(byte) sum::b#2 zp byte:3 +(byte) sum::b#2 zp byte:3 2.0 (byte) sum::return -(byte) sum::return#0 zp byte:2 - +(byte) sum::return#0 zp byte:2 1.2000000000000002 zp byte:2 [ sum::a#2 sum::return#0 s2#0 ] zp byte:3 [ sum::b#2 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/summin.sym b/src/main/java/dk/camelot64/kickc/test/ref/summin.sym index 2168befff..7d4aba91d 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/summin.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/summin.sym @@ -3,20 +3,19 @@ (label) @BEGIN (label) @END (byte) s1 -(byte) s1#0 zp byte:4 +(byte) s1#0 zp byte:4 0.5714285714285714 (byte) s2 -(byte) s2#0 zp byte:2 +(byte) s2#0 zp byte:2 4.0 (byte) s3 -(byte) s3#0 zp byte:4 +(byte) s3#0 zp byte:4 Infinity (byte()) sum((byte) sum::a , (byte) sum::b) (label) sum::@return (byte) sum::a -(byte) sum::a#2 zp byte:2 +(byte) sum::a#2 zp byte:2 2.0 (byte) sum::b -(byte) sum::b#2 zp byte:3 +(byte) sum::b#2 zp byte:3 2.0 (byte) sum::return -(byte) sum::return#0 zp byte:2 - +(byte) sum::return#0 zp byte:2 1.2000000000000002 zp byte:2 [ sum::a#2 sum::return#0 s2#0 ] zp byte:3 [ sum::b#2 ]