From fc859e8a03d4640bb6832a83bbfd1fea394f3180 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Sat, 12 Aug 2017 00:15:59 +0200 Subject: [PATCH] Implemented ability of procedures to modify globals --- .../java/dk/camelot64/kickc/Compiler.java | 6 +- src/main/java/dk/camelot64/kickc/TODO.txt | 8 +- .../dk/camelot64/kickc/icl/CallGraph.java | 5 +- .../camelot64/kickc/icl/ControlFlowBlock.java | 5 + .../camelot64/kickc/icl/ControlFlowGraph.java | 15 + .../icl/ControlFlowGraphCopyVisitor.java | 4 + .../kickc/icl/ProcedureModifiedVars.java | 30 + .../java/dk/camelot64/kickc/icl/Program.java | 12 + .../java/dk/camelot64/kickc/icl/Scope.java | 10 + .../dk/camelot64/kickc/icl/SymbolRef.java | 9 + .../passes/Pass1ModifiedVarsAnalysis.java | 57 + .../passes/Pass1ProcedureCallParameters.java | 45 +- .../Pass1ProcedureCallsReturnValue.java | 64 +- .../kickc/passes/Pass3CallGraphAnalysis.java | 2 - .../kickc/passes/Pass3LiveRangesAnalysis.java | 42 +- .../kickc/passes/Pass3PhiLifting.java | 4 +- .../Pass3RegisterUpliftCombinations.java | 9 +- .../passes/Pass3RegisterUpliftRemains.java | 19 +- .../kickc/test/TestCompilationOutput.java | 4 + .../java/dk/camelot64/kickc/test/modglobal.kc | 20 + .../dk/camelot64/kickc/test/ref/bresenham.log | 2 + .../dk/camelot64/kickc/test/ref/fibmem.log | 2 + .../camelot64/kickc/test/ref/flipper-rex2.log | 2 + .../dk/camelot64/kickc/test/ref/loopmin.log | 2 + .../dk/camelot64/kickc/test/ref/loopnest.log | 3 + .../dk/camelot64/kickc/test/ref/loopnest2.log | 9 + .../dk/camelot64/kickc/test/ref/loopsplit.log | 2 + .../dk/camelot64/kickc/test/ref/minus.log | 2 + .../dk/camelot64/kickc/test/ref/modglobal.asm | 23 + .../dk/camelot64/kickc/test/ref/modglobal.cfg | 30 + .../dk/camelot64/kickc/test/ref/modglobal.log | 955 ++++++++++++ .../dk/camelot64/kickc/test/ref/modglobal.sym | 27 + .../dk/camelot64/kickc/test/ref/ptrtest.log | 2 + .../camelot64/kickc/test/ref/ptrtestmin.log | 2 + .../dk/camelot64/kickc/test/ref/summin.cfg | 4 +- .../dk/camelot64/kickc/test/ref/summin.log | 34 +- .../dk/camelot64/kickc/test/ref/summin.sym | 4 +- .../dk/camelot64/kickc/test/ref/useglobal.log | 2 + .../dk/camelot64/kickc/test/ref/voronoi.asm | 101 +- .../dk/camelot64/kickc/test/ref/voronoi.cfg | 160 +- .../dk/camelot64/kickc/test/ref/voronoi.log | 1382 ++++++++--------- .../dk/camelot64/kickc/test/ref/voronoi.sym | 41 +- 42 files changed, 2217 insertions(+), 944 deletions(-) create mode 100644 src/main/java/dk/camelot64/kickc/icl/ProcedureModifiedVars.java create mode 100644 src/main/java/dk/camelot64/kickc/passes/Pass1ModifiedVarsAnalysis.java create mode 100644 src/main/java/dk/camelot64/kickc/test/modglobal.kc create mode 100644 src/main/java/dk/camelot64/kickc/test/ref/modglobal.asm create mode 100644 src/main/java/dk/camelot64/kickc/test/ref/modglobal.cfg create mode 100644 src/main/java/dk/camelot64/kickc/test/ref/modglobal.log create mode 100644 src/main/java/dk/camelot64/kickc/test/ref/modglobal.sym diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index a0cc5a532..1be48252b 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -217,9 +217,13 @@ public class Compiler { log.append(program.getGraph().toString(program)); } + (new Pass1ModifiedVarsAnalysis(program)).findModifiedVars(); + log.append("PROCEDURE MODIFY VARIABLE ANALYSIS"); + log.append(program.getProcedureModifiedVars().toString(program)); + Pass1ProcedureCallParameters pass1ProcedureCallParameters = new Pass1ProcedureCallParameters(program); - program.setGraph(pass1ProcedureCallParameters.generate()); + pass1ProcedureCallParameters.generate(); log.append("CONTROL FLOW GRAPH WITH ASSIGNMENT CALL"); log.append(program.getGraph().toString(program)); diff --git a/src/main/java/dk/camelot64/kickc/TODO.txt b/src/main/java/dk/camelot64/kickc/TODO.txt index d0e371f86..6c74a61d7 100644 --- a/src/main/java/dk/camelot64/kickc/TODO.txt +++ b/src/main/java/dk/camelot64/kickc/TODO.txt @@ -31,20 +31,20 @@ Assembler Improvements - Optimize by allowing resequencing of ASM (statements and phi assignments) in a final phase. Known Problems -- Procedures that modify variables outside their scope doew not work. Outer vars must be transfered in/out like parameters/return values to get it working. +- Procedures that modify variables outside their scope does not work. Outer vars must be transfered in/out like parameters/return values to get it working. - Alive vars are propagated backward through procedures (correctly). However they are then propagated back through ALL calls to the procedure incorrectly. They should only be alive at calls where they are alive after the call. In summin.kc s1#0 is incirrectly backpropagated through the first call, where it is not alive. Register Allocation -- Limit number of combinations tested -- Equivalences not tested through combinaitons should be tested individually afterwards. - Allow user to limit number of combinations tested - Safe-Copy based SSA deconstruction - Reuse phi-transitions that are identical - Optimize phi transitions by ensuring that identical phi-transitions with regards to register allocation are collected into a single transition. - Optimize by finding optimal sequence for multiple phi assignments in entry-segments. - Avoid clobbering alive vars -- Maybe support several fragements for the same operation with different cost and clobbering profiles. +- Maybe support several fragments for the same operation with different cost and clobbering profiles. - Add memory registers (if we need to free some ZP) ++ Limit number of combinations tested ++ Equivalences not tested through combinaitons should be tested individually afterwards. + Matrix Phi operation (instead of separate statements) + Phi Lifting + PhiLifting & PhiMemCoalesce (http://compilers.cs.ucla.edu/fernando/projects/soc/reports/short_tech.pdf) diff --git a/src/main/java/dk/camelot64/kickc/icl/CallGraph.java b/src/main/java/dk/camelot64/kickc/icl/CallGraph.java index 1299a9464..a4f93df4e 100644 --- a/src/main/java/dk/camelot64/kickc/icl/CallGraph.java +++ b/src/main/java/dk/camelot64/kickc/icl/CallGraph.java @@ -191,7 +191,10 @@ public class CallGraph { @Override public String toString() { StringBuilder out = new StringBuilder(); - out.append(callStatementIdx).append(":").append(procedure); + if(callStatementIdx!=null) { + out.append(callStatementIdx).append(":"); + } + out.append(procedure); return out.toString(); } diff --git a/src/main/java/dk/camelot64/kickc/icl/ControlFlowBlock.java b/src/main/java/dk/camelot64/kickc/icl/ControlFlowBlock.java index 97aa0ea38..5b7683bd7 100644 --- a/src/main/java/dk/camelot64/kickc/icl/ControlFlowBlock.java +++ b/src/main/java/dk/camelot64/kickc/icl/ControlFlowBlock.java @@ -52,6 +52,10 @@ public class ControlFlowBlock { this.statements.add(statement); } + public void addStatementBeforeLast(Statement statement) { + this.statements.add(statements.size()-1, statement); + } + public void setDefaultSuccessor(LabelRef defaultSuccessor) { this.defaultSuccessor = defaultSuccessor; } @@ -178,4 +182,5 @@ public class ControlFlowBlock { } return successors; } + } diff --git a/src/main/java/dk/camelot64/kickc/icl/ControlFlowGraph.java b/src/main/java/dk/camelot64/kickc/icl/ControlFlowGraph.java index fec2c990e..32226bab9 100644 --- a/src/main/java/dk/camelot64/kickc/icl/ControlFlowGraph.java +++ b/src/main/java/dk/camelot64/kickc/icl/ControlFlowGraph.java @@ -208,4 +208,19 @@ public class ControlFlowGraph { return null; } + /** + * Get all blocks stat are part of the execution of a specific scope. (mostly a procedure) + * @param scopeLabel The label of the scope to find blocks for + * @return All blocks that are part of the execution of the scope + */ + public List getScopeBlocks(LabelRef scopeLabel) { + ArrayList scopeBlocks = new ArrayList<>(); + for (ControlFlowBlock block : getAllBlocks()) { + + if(block.getLabel().getFullName().equals(scopeLabel.getFullName()) || block.getLabel().getScopeNames().equals(scopeLabel.getFullName())) { + scopeBlocks.add(block); + } + } + return scopeBlocks; + } } diff --git a/src/main/java/dk/camelot64/kickc/icl/ControlFlowGraphCopyVisitor.java b/src/main/java/dk/camelot64/kickc/icl/ControlFlowGraphCopyVisitor.java index d72870b6f..43fcc112f 100644 --- a/src/main/java/dk/camelot64/kickc/icl/ControlFlowGraphCopyVisitor.java +++ b/src/main/java/dk/camelot64/kickc/icl/ControlFlowGraphCopyVisitor.java @@ -108,6 +108,10 @@ public class ControlFlowGraphCopyVisitor extends ControlFlowGraphBaseVisitor> modified; + + public ProcedureModifiedVars(Map> modified) { + this.modified = modified; + } + + public Set getModifiedVars(ProcedureRef procedure) { + return modified.get(procedure); + } + + + public String toString(Program program) { + StringBuilder out = new StringBuilder(); + for (ProcedureRef procedureRef : modified.keySet()) { + for (VariableRef variableRef : getModifiedVars(procedureRef)) { + out.append(procedureRef.getFullName()).append(" modifies "+variableRef.getFullName()).append("\n"); + } + } + return out.toString(); + } +} diff --git a/src/main/java/dk/camelot64/kickc/icl/Program.java b/src/main/java/dk/camelot64/kickc/icl/Program.java index 5858e9964..ab66f0bce 100644 --- a/src/main/java/dk/camelot64/kickc/icl/Program.java +++ b/src/main/java/dk/camelot64/kickc/icl/Program.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import dk.camelot64.kickc.CompileLog; import dk.camelot64.kickc.asm.AsmProgram; +import dk.camelot64.kickc.passes.Pass1ModifiedVarsAnalysis; /** A KickC Intermediate Compiler Language (ICL) Program */ public class Program { @@ -18,6 +19,8 @@ public class Program { /** The log containing information about the compilation process. */ private CompileLog log; + /** Variables modified inside procedures. */ + private ProcedureModifiedVars procedureModifiedVars; /** Information about calls. */ private CallGraph callGraph; /** Information about dominators of all blocks*/ @@ -69,6 +72,15 @@ public class Program { this.graph = graph; } + public void setProcedureModifiedVars(ProcedureModifiedVars procedureModifiedVars) { + this.procedureModifiedVars = procedureModifiedVars; + } + + public ProcedureModifiedVars getProcedureModifiedVars() { + return procedureModifiedVars; + } + + public AsmProgram getAsm() { return asm; } diff --git a/src/main/java/dk/camelot64/kickc/icl/Scope.java b/src/main/java/dk/camelot64/kickc/icl/Scope.java index fe754a195..c6a83231e 100644 --- a/src/main/java/dk/camelot64/kickc/icl/Scope.java +++ b/src/main/java/dk/camelot64/kickc/icl/Scope.java @@ -191,6 +191,16 @@ public abstract class Scope implements Symbol { return scopes; } + public Collection getAllProcedures(boolean includeSubScopes) { + Collection procedures = new ArrayList<>(); + for (Scope scope : getAllScopes(includeSubScopes)) { + if(scope instanceof Procedure) { + procedures.add((Procedure) scope); + } + } + return procedures; + } + public Label addLabel(String name) { Label symbol = new Label(name, this, false); diff --git a/src/main/java/dk/camelot64/kickc/icl/SymbolRef.java b/src/main/java/dk/camelot64/kickc/icl/SymbolRef.java index 2d8b4e3f9..ecbda7d99 100644 --- a/src/main/java/dk/camelot64/kickc/icl/SymbolRef.java +++ b/src/main/java/dk/camelot64/kickc/icl/SymbolRef.java @@ -93,4 +93,13 @@ public class SymbolRef implements Value { public String toString() { return getFullName(); } + + public String getFullNameUnversioned() { + if(isVersion()) { + return fullName.substring(0, fullName.indexOf("#")); + } else { + return fullName; + } + + } } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1ModifiedVarsAnalysis.java b/src/main/java/dk/camelot64/kickc/passes/Pass1ModifiedVarsAnalysis.java new file mode 100644 index 000000000..53ee4451b --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/passes/Pass1ModifiedVarsAnalysis.java @@ -0,0 +1,57 @@ +package dk.camelot64.kickc.passes; + +import dk.camelot64.kickc.icl.*; + +import java.util.*; + +/** Find all variables from an outer scope modified in an inner scope (ie. a procedure) */ +public class Pass1ModifiedVarsAnalysis { + + private Program program; + + public Pass1ModifiedVarsAnalysis(Program program) { + this.program = program; + } + + public void findModifiedVars() { + Map> modified = new LinkedHashMap<>(); + Collection allProcedures = program.getScope().getAllProcedures(true); + for (Procedure procedure : allProcedures) { + Set modifiedVars = getModifiedVars(procedure); + modified.put(procedure.getRef(), modifiedVars); + } + program.setProcedureModifiedVars(new ProcedureModifiedVars(modified)); + } + + /** Get all outside variables modified by a procedure (or any sub-procedure called by the procedure). + * + * @param procedure The procedure to examine + * @return All variables declared outside the procedure modified inside the procedure. + */ + public Set getModifiedVars(Procedure procedure) { + Set modified = new LinkedHashSet<>(); + LabelRef procScope = procedure.getScopeLabelRef(); + List procBlocks = program.getGraph().getScopeBlocks(procScope); + for (ControlFlowBlock block : procBlocks) { + for (Statement statement : block.getStatements()) { + if(statement instanceof StatementLValue) { + LValue lValue = ((StatementLValue) statement).getlValue(); + if(lValue instanceof VariableRef) { + VariableRef var = (VariableRef) lValue; + if(!var.getScopeNames().equals(procScope.getFullName())) { + modified.add(var); + } + } + if(statement instanceof StatementCall) { + ProcedureRef called = ((StatementCall) statement).getProcedure(); + Procedure calledProc = program.getScope().getProcedure(called); + modified.addAll(getModifiedVars(calledProc)); + } + } + } + } + return modified; + } + + +} diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1ProcedureCallParameters.java b/src/main/java/dk/camelot64/kickc/passes/Pass1ProcedureCallParameters.java index 32ba5a408..05eb77d86 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass1ProcedureCallParameters.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass1ProcedureCallParameters.java @@ -2,22 +2,27 @@ package dk.camelot64.kickc.passes; import dk.camelot64.kickc.icl.*; +import java.util.ArrayList; +import java.util.LinkedHashSet; import java.util.List; +import java.util.Set; /** Pass that modifies a control flow graph to call procedures by passing parameters through registers */ public class Pass1ProcedureCallParameters extends ControlFlowGraphCopyVisitor { - private ProgramScope scope; - private ControlFlowGraph graph; + private Program program; public Pass1ProcedureCallParameters(Program program) { - this.scope = program.getScope(); - this.graph = program.getGraph(); + this.program = program; } - public ControlFlowGraph generate() { - ControlFlowGraph generated = visitGraph(graph); - return generated; + public void generate() { + ControlFlowGraph generated = visitGraph(program.getGraph()); + program.setGraph(generated); + } + + private ProgramScope getScope() { + return program.getScope(); } @Override @@ -25,7 +30,7 @@ public class Pass1ProcedureCallParameters extends ControlFlowGraphCopyVisitor { // Procedure strategy implemented is currently variable-based transfer of parameters/return values // Generate parameter passing assignments ProcedureRef procedureRef = origCall.getProcedure(); - Procedure procedure = scope.getProcedure(procedureRef); + Procedure procedure = getScope().getProcedure(procedureRef); List parameterDecls = procedure.getParameters(); List parameterValues = origCall.getParameters(); for (int i = 0; i < parameterDecls.size(); i++) { @@ -44,7 +49,7 @@ public class Pass1ProcedureCallParameters extends ControlFlowGraphCopyVisitor { copyCall.setProcedure(procedureRef); addStatementToCurrentBlock(copyCall); getCurrentBlock().setCallSuccessor(procedure.getLabel().getRef()); - Symbol currentBlockSymbol = scope.getSymbol(getCurrentBlock().getLabel()); + Symbol currentBlockSymbol = getScope().getSymbol(getCurrentBlock().getLabel()); Scope currentBlockScope; if(currentBlockSymbol instanceof Procedure) { currentBlockScope = (Scope) currentBlockSymbol; @@ -59,13 +64,31 @@ public class Pass1ProcedureCallParameters extends ControlFlowGraphCopyVisitor { LValue lValue = origCall.getlValue(); if(lValue instanceof VariableRef) { VariableRef lValueRef = (VariableRef) lValue; - Variable lValueVar = scope.getVariable(lValueRef); + Variable lValueVar = getScope().getVariable(lValueRef); lValueVar.getScope().remove(lValueVar); } } - + // Add self-assignments for all variables modified in the procedure + Set modifiedVars = program.getProcedureModifiedVars().getModifiedVars(procedure.getRef()); + for (VariableRef modifiedVar : modifiedVars) { + addStatementToCurrentBlock(new StatementAssignment(modifiedVar, modifiedVar)); + } return null; } + @Override + public StatementReturn visitReturn(StatementReturn origReturn) { + ControlFlowBlock currentBlock = getCurrentBlock(); + String currentProcName = currentBlock.getLabel().getScopeNames(); + Procedure procedure = program.getScope().getProcedure(currentProcName); + // Add self-assignments for all variables modified in the procedure + Set modifiedVars = program.getProcedureModifiedVars().getModifiedVars(procedure.getRef()); + for (VariableRef modifiedVar : modifiedVars) { + addStatementToCurrentBlock(new StatementAssignment(modifiedVar, modifiedVar)); + } + return super.visitReturn(origReturn); + } + + } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1ProcedureCallsReturnValue.java b/src/main/java/dk/camelot64/kickc/passes/Pass1ProcedureCallsReturnValue.java index 8e7c85a4e..a9ae09901 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass1ProcedureCallsReturnValue.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass1ProcedureCallsReturnValue.java @@ -2,19 +2,24 @@ package dk.camelot64.kickc.passes; import dk.camelot64.kickc.icl.*; -/** Pass that modifies a control flow graph to call procedures by passing return value through registers */ +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +/** + * Pass that modifies a control flow graph to call procedures by passing return value through registers + */ public class Pass1ProcedureCallsReturnValue extends ControlFlowGraphCopyVisitor { - private ProgramScope scope; - private ControlFlowGraph graph; + private Program program; public Pass1ProcedureCallsReturnValue(Program program) { - this.scope = program.getScope(); - this.graph = program.getGraph(); + this.program = program; } public ControlFlowGraph generate() { - ControlFlowGraph generated = visitGraph(graph); + ControlFlowGraph generated = visitGraph(program.getGraph()); return generated; } @@ -23,17 +28,17 @@ public class Pass1ProcedureCallsReturnValue extends ControlFlowGraphCopyVisitor // Procedure strategy implemented is currently variable-based transfer of parameters/return values // Generate return value assignment ProcedureRef procedureRef = origCall.getProcedure(); - Procedure procedure = scope.getProcedure(procedureRef); + Procedure procedure = program.getScope().getProcedure(procedureRef); String procedureName = origCall.getProcedureName(); StatementCall copyCall = new StatementCall(null, procedureName, null); copyCall.setParametersByAssignment(true); copyCall.setProcedure(procedureRef); addStatementToCurrentBlock(copyCall); getCurrentBlock().setCallSuccessor(procedure.getLabel().getRef()); - if(!SymbolTypeBasic.VOID.equals(procedure.getReturnType())) { + if (!SymbolTypeBasic.VOID.equals(procedure.getReturnType())) { // Find return variable final version Label returnBlockLabel = procedure.getLabel("@return"); - ControlFlowBlock returnBlock = graph.getBlock(returnBlockLabel.getRef()); + ControlFlowBlock returnBlock = program.getGraph().getBlock(returnBlockLabel.getRef()); VariableRef returnVarFinal = null; for (Statement statement : returnBlock.getStatements()) { if (statement instanceof StatementReturn) { @@ -50,9 +55,50 @@ public class Pass1ProcedureCallsReturnValue extends ControlFlowGraphCopyVisitor StatementAssignment returnAssignment = new StatementAssignment(origCall.getlValue(), returnVarFinal); addStatementToCurrentBlock(returnAssignment); } + + // Patch versions of rValues in assignments for vars modified in the call + LabelRef successor = getOrigBlock().getDefaultSuccessor(); + ControlFlowBlock successorBlock = program.getGraph().getBlock(successor); + Set modifiedVars = program.getProcedureModifiedVars().getModifiedVars(procedure.getRef()); + for (Statement statement : successorBlock.getStatements()) { + if (statement instanceof StatementPhiBlock) { + StatementPhiBlock phiBlock = (StatementPhiBlock) statement; + for (StatementPhiBlock.PhiVariable phiVariable : phiBlock.getPhiVariables()) { + VariableRef phiVar = phiVariable.getVariable(); + VariableRef unversionedVar = new VariableRef(phiVar.getFullNameUnversioned()); + if (modifiedVars.contains(unversionedVar)) { + for (StatementPhiBlock.PhiRValue phiRValue : phiVariable.getValues()) { + if (phiRValue.getPredecessor().equals(getOrigBlock().getLabel())) { + VariableRef procReturnVersion = findReturnVersion(procedure, unversionedVar); + phiRValue.setrValue(procReturnVersion); + } + } + } + } + } + } + return null; } + private VariableRef findReturnVersion(Procedure procedure, VariableRef assignedVar) { + String unversionedName = assignedVar.getFullNameUnversioned(); + LabelRef returnBlock = new LabelRef(procedure.getScopeLabelRef().getFullName() + "::@return"); + ControlFlowBlock block = program.getGraph().getBlock(returnBlock); + for (Statement statement : block.getStatements()) { + if (statement instanceof StatementAssignment) { + StatementAssignment assignment = (StatementAssignment) statement; + if (assignment.getlValue() instanceof VariableRef) { + VariableRef lValue = (VariableRef) assignment.getlValue(); + if (lValue.getFullNameUnversioned().equals(unversionedName)) { + return lValue; + } + } + } + } + throw new RuntimeException("Variable " + assignedVar + "modified by procedure " + procedure + " not found in @return block " + block.getLabel()); + } + @Override public StatementReturn visitReturn(StatementReturn origReturn) { addStatementToCurrentBlock(new StatementReturn(null)); diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3CallGraphAnalysis.java b/src/main/java/dk/camelot64/kickc/passes/Pass3CallGraphAnalysis.java index ced91a775..4a76a141b 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass3CallGraphAnalysis.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3CallGraphAnalysis.java @@ -1,6 +1,5 @@ package dk.camelot64.kickc.passes; -import dk.camelot64.kickc.CompileLog; import dk.camelot64.kickc.icl.*; /** Finds the call graph for the control flow graph - identifies all calls in all scopes and creates a graph from these. */ @@ -13,7 +12,6 @@ public class Pass3CallGraphAnalysis extends Pass2Base { public void findCallGraph() { CallGraph callGraph = new CallGraph(); - for (ControlFlowBlock block : getGraph().getAllBlocks()) { LabelRef scopeRef = getScopeRef(block, getProgram()); for (Statement statement : block.getStatements()) { diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3LiveRangesAnalysis.java b/src/main/java/dk/camelot64/kickc/passes/Pass3LiveRangesAnalysis.java index 2120a9ff9..33d8d30b4 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass3LiveRangesAnalysis.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3LiveRangesAnalysis.java @@ -22,16 +22,16 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { LiveRangeVariables liveRanges = initializeLiveRanges(); getProgram().setLiveRangeVariables(liveRanges); - //log.append("CONTROL FLOW GRAPH - LIVE RANGES"); - //log.append(program.getGraph().toString(program.getScope())); + //getLog().append("CONTROL FLOW GRAPH - LIVE RANGES"); + //getLog().append(getProgram().getGraph().toString(getProgram())); boolean propagating; do { propagating = propagateLiveRanges(liveRanges); getProgram().setLiveRangeVariables(liveRanges); getLog().append("Propagating live ranges..."); - //log.append("CONTROL FLOW GRAPH - LIVE RANGES"); - //log.append(program.getGraph().toString(program.getScope())); + //getLog().append("CONTROL FLOW GRAPH - LIVE RANGES"); + //getLog().append(getProgram().getGraph().toString(getProgram())); } while (propagating); getProgram().setLiveRangeVariables(liveRanges); @@ -137,8 +137,17 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { LabelRef predecessorRef = phiRValue.getPredecessor(); ControlFlowBlock predecessor = program.getGraph().getBlock(predecessorRef); List predecessorStatements = predecessor.getStatements(); - Statement predecessorLastStatement = predecessorStatements.get(predecessorStatements.size() - 1); - liveRanges.addAlive((VariableRef) phiRValue.getrValue(), predecessorLastStatement); + // Is this block a procedure called from the predecessor? + if(currentBlock.getLabel().equals(predecessor.getCallSuccessor())) { + // Add to last statement before call in predecessor + StatementCall callStatement = (StatementCall) predecessorStatements.get(predecessorStatements.size() - 1); + Statement predecessorLastStatementBeforeCall = predecessorStatements.get(predecessorStatements.size() - 2); + liveRanges.addAlive((VariableRef) phiRValue.getrValue(), predecessorLastStatementBeforeCall); + } else { + // Add to last statement of predecessor + Statement predecessorLastStatement = predecessorStatements.get(predecessorStatements.size() - 1); + liveRanges.addAlive((VariableRef) phiRValue.getrValue(), predecessorLastStatement); + } } } } @@ -315,10 +324,18 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { ArrayList statements = new ArrayList<>(); List predecessors = program.getGraph().getPredecessors(block); for (ControlFlowBlock predecessor : predecessors) { - ArrayList lastStatements = getLastStatements(predecessor); - - - statements.addAll(lastStatements); + // If this block is a procedure called from the predecessor - the last statement is the one before the call + if(block.getLabel().equals(predecessor.getCallSuccessor())) { + List predecessorStatements = predecessor.getStatements(); + StatementCall call = (StatementCall) predecessorStatements.get(predecessorStatements.size() - 1); + if(predecessorStatements.size()>1) { + Statement lastBeforeCall = predecessorStatements.get(predecessorStatements.size() - 2); + statements.add(lastBeforeCall); + } + } else { + ArrayList lastStatements = getLastStatements(predecessor); + statements.addAll(lastStatements); + } } return statements; } @@ -356,8 +373,9 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { @Override public Void visitCall(StatementCall call) { - propagate(call, getPreviousStatements(), null); - // Also propagate back through all statements of the procedure + // Do not propagate directly to previous statement + //propagate(call, getPreviousStatements(), null); + // Instead propagate back through all statements of the procedure ProcedureRef procedure = call.getProcedure(); LabelRef procedureReturnBlock = procedure.getReturnBlock(); ControlFlowBlock returnBlock = program.getGraph().getBlock(procedureReturnBlock); diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3PhiLifting.java b/src/main/java/dk/camelot64/kickc/passes/Pass3PhiLifting.java index b2ec33a7f..0cd490f50 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass3PhiLifting.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3PhiLifting.java @@ -1,6 +1,5 @@ package dk.camelot64.kickc.passes; -import dk.camelot64.kickc.CompileLog; import dk.camelot64.kickc.icl.*; import java.util.Collection; @@ -85,6 +84,9 @@ public class Pass3PhiLifting { newBlockStatements.add(newAssignment); phiRValue.setrValue(newVar.getRef()); phiRValue.setPredecessor(newBlock.getLabel()); + } else if(block.getLabel().equals(predecessorBlock.getCallSuccessor())) { + predecessorBlock.addStatementBeforeLast(newAssignment); + phiRValue.setrValue(newVar.getRef()); } else { predecessorBlock.addStatement(newAssignment); phiRValue.setrValue(newVar.getRef()); diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftCombinations.java b/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftCombinations.java index bffb19f29..29d0486fc 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftCombinations.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftCombinations.java @@ -94,7 +94,7 @@ public class Pass3RegisterUpliftCombinations extends Pass2Base { } - private int getAsmScore(Program program) { + public static int getAsmScore(Program program) { int score = 0; AsmProgram asm = program.getAsm(); ControlFlowGraph graph = program.getGraph(); @@ -103,8 +103,11 @@ public class Pass3RegisterUpliftCombinations extends Pass2Base { double asmSegmentCycles = asmSegment.getCycles(); if (asmSegmentCycles > 0) { Integer statementIdx = asmSegment.getStatementIdx(); - ControlFlowBlock block = graph.getBlockFromStatementIdx(statementIdx); - int maxLoopDepth = loopSet.getMaxLoopDepth(block.getLabel()); + int maxLoopDepth=1; + if(statementIdx!=null) { + ControlFlowBlock block = graph.getBlockFromStatementIdx(statementIdx); + maxLoopDepth = loopSet.getMaxLoopDepth(block.getLabel()); + } score += asmSegmentCycles * Math.pow(10, maxLoopDepth); } } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftRemains.java b/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftRemains.java index 7c9f06ec2..218c59c6e 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftRemains.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftRemains.java @@ -61,7 +61,7 @@ public class Pass3RegisterUpliftRemains extends Pass2Base { } // If no clobber - Find value of the resulting allocation boolean hasClobberProblem = new Pass3AssertNoCpuClobber(getProgram()).hasClobberProblem(false); - int combinationScore = getAsmScore(getProgram()); + int combinationScore = Pass3RegisterUpliftCombinations.getAsmScore(getProgram()); //StringBuilder msg = new StringBuilder(); //msg.append("Uplift remains attempt [" + equivalenceClass + "] "); //if (hasClobberProblem) { @@ -97,21 +97,4 @@ public class Pass3RegisterUpliftRemains extends Pass2Base { } - private int getAsmScore(Program program) { - int score = 0; - AsmProgram asm = program.getAsm(); - ControlFlowGraph graph = program.getGraph(); - NaturalLoopSet loopSet = program.getLoopSet(); - for (AsmSegment asmSegment : asm.getSegments()) { - double asmSegmentCycles = asmSegment.getCycles(); - if (asmSegmentCycles > 0) { - Integer statementIdx = asmSegment.getStatementIdx(); - ControlFlowBlock block = graph.getBlockFromStatementIdx(statementIdx); - int maxLoopDepth = loopSet.getMaxLoopDepth(block.getLabel()); - score += asmSegmentCycles * Math.pow(10, maxLoopDepth); - } - } - return score; - } - } diff --git a/src/main/java/dk/camelot64/kickc/test/TestCompilationOutput.java b/src/main/java/dk/camelot64/kickc/test/TestCompilationOutput.java index c46b628b4..e052af0f3 100644 --- a/src/main/java/dk/camelot64/kickc/test/TestCompilationOutput.java +++ b/src/main/java/dk/camelot64/kickc/test/TestCompilationOutput.java @@ -76,6 +76,10 @@ public class TestCompilationOutput extends TestCase { compileAndCompare("useglobal"); } + public void testModGlobal() throws IOException, URISyntaxException { + compileAndCompare("modglobal"); + } + public void testUseUninitialized() throws IOException, URISyntaxException { String filename = "useuninitialized"; compileAndCompare(filename); diff --git a/src/main/java/dk/camelot64/kickc/test/modglobal.kc b/src/main/java/dk/camelot64/kickc/test/modglobal.kc new file mode 100644 index 000000000..38b84055e --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/modglobal.kc @@ -0,0 +1,20 @@ +byte cnt = 0; +byte cnt2 = 0; +byte[256] SCREEN=$0400; + +main(); + +void main() { + SCREEN[0]=inccnt(); + cnt++; + SCREEN[1]=inccnt(); +} + +byte inccnt() { + ++cnt; + ++cnt2; + return cnt; +} + + + 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 dc533df87..e54ea40ea 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log @@ -199,6 +199,8 @@ CONTROL FLOW GRAPH to:@END @END: from @3 +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from (byte) STAR ← (byte) 81 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log index 78288011e..ebfdb8542 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log @@ -81,6 +81,8 @@ CONTROL FLOW GRAPH to:@END @END: from @1 +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from (byte[15]) fibs ← (word) 4352 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 43d84f6da..90184497a 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 @@ -484,6 +484,8 @@ plot::@return: from plot::@3 to:@RETURN @END: from @BEGIN +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from (byte[1000]) SCREEN ← (word) 1024 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 ef098dc74..52b5df46c 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopmin.log @@ -81,6 +81,8 @@ CONTROL FLOW GRAPH to:@END @END: from @3 +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from (byte) i ← (byte) 10 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 876c23656..15fd4c9fe 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest.log @@ -131,6 +131,8 @@ nest::@return: from nest::@1 to:@RETURN @END: from @BEGIN +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from (byte*) SCREEN ← (word) 1024 @@ -646,6 +648,7 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... +Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @BEGIN: from [0] call main param-assignment [ ] 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 f0356f622..8baee0b99 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.log @@ -269,6 +269,8 @@ nest2::@return: from nest2::@3 to:@RETURN @END: from @BEGIN +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from (byte*) SCREEN ← (word) 1024 @@ -1550,6 +1552,9 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... CONTROL FLOW GRAPH - LIVE RANGES @BEGIN: from [0] call main param-assignment [ ] @@ -1662,6 +1667,10 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @BEGIN: from [0] call main param-assignment [ ] 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 a9266ed1b..1f1ff53fa 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log @@ -139,6 +139,8 @@ main::@return: from main::@1 to:@RETURN @END: from @BEGIN +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from call main param-assignment 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 f815fe8e0..efb92f3b5 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/minus.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/minus.log @@ -61,6 +61,8 @@ CONTROL FLOW GRAPH to:@END @END: from @1 +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from (byte[16]) p ← (word) 4352 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/modglobal.asm b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.asm new file mode 100644 index 000000000..f8532c4e0 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.asm @@ -0,0 +1,23 @@ +BBEGIN: + jsr main +BEND: +main: +inccnt_from_main: + ldy #0 + ldx #0 + jsr inccnt +main__B1: + sta 1024 + inx +inccnt_from_B1: + jsr inccnt +main__B2: + sta 1025 +main__Breturn: + rts +inccnt: + inx + iny + txa +inccnt__Breturn: + rts diff --git a/src/main/java/dk/camelot64/kickc/test/ref/modglobal.cfg b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.cfg new file mode 100644 index 000000000..284ed57c4 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.cfg @@ -0,0 +1,30 @@ +@BEGIN: from + [0] call main param-assignment [ ] + to:@END +@END: from @BEGIN +main: from @BEGIN + [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 ] + to:main::@1 +main::@1: from main + [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 ] + [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 ] + [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 ] + [5] call inccnt param-assignment [ inccnt::return#0 ] + to:main::@2 +main::@2: from main::@1 + [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] + [7] *((word) 1025) ← (byte~) main::$1 [ ] + to:main::@return +main::@return: from main::@2 + [8] return [ ] + to:@RETURN +inccnt: from main main::@1 + [9] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) [ cnt#12 cnt2#11 ] + [9] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#12 cnt2#11 ] + [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 ] + [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 ] + [12] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 ] + to:inccnt::@return +inccnt::@return: from inccnt + [13] return [ inccnt::return#0 cnt#1 cnt2#1 ] + to:@RETURN diff --git a/src/main/java/dk/camelot64/kickc/test/ref/modglobal.log b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.log new file mode 100644 index 000000000..92a626f48 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.log @@ -0,0 +1,955 @@ +byte cnt = 0; +byte cnt2 = 0; +byte[256] SCREEN=$0400; + +main(); + +void main() { + SCREEN[0]=inccnt(); + cnt++; + SCREEN[1]=inccnt(); +} + +byte inccnt() { + ++cnt; + ++cnt2; + return cnt; +} + + + + +Adding pre/post-modifier (byte) cnt ← ++ (byte) cnt +Adding pre/post-modifier (byte) cnt ← ++ (byte) cnt +Adding pre/post-modifier (byte) cnt2 ← ++ (byte) cnt2 +PROGRAM + (byte) cnt ← (byte) 0 + (byte) cnt2 ← (byte) 0 + (byte[256]) SCREEN ← (word) 1024 + (void~) $0 ← call main + proc (void()) main() + (byte~) main::$0 ← call inccnt + *((byte[256]) SCREEN + (byte) 0) ← (byte~) main::$0 + (byte) cnt ← ++ (byte) cnt + (byte~) main::$1 ← call inccnt + *((byte[256]) SCREEN + (byte) 1) ← (byte~) main::$1 +main::@return: + return + endproc // main() + proc (byte()) inccnt() + (byte) cnt ← ++ (byte) cnt + (byte) cnt2 ← ++ (byte) cnt2 + (byte) inccnt::return ← (byte) cnt + goto inccnt::@return +inccnt::@return: + (byte) inccnt::return ← (byte) inccnt::return + return (byte) inccnt::return + endproc // inccnt() + +SYMBOLS +(void~) $0 +(byte[256]) SCREEN +(byte) cnt +(byte) cnt2 +(byte()) inccnt() +(label) inccnt::@return +(byte) inccnt::return +(void()) main() +(byte~) main::$0 +(byte~) main::$1 +(label) main::@return + +INITIAL CONTROL FLOW GRAPH +@BEGIN: from + (byte) cnt ← (byte) 0 + (byte) cnt2 ← (byte) 0 + (byte[256]) SCREEN ← (word) 1024 + (void~) $0 ← call main + to:@1 +main: from + (byte~) main::$0 ← call inccnt + *((byte[256]) SCREEN + (byte) 0) ← (byte~) main::$0 + (byte) cnt ← ++ (byte) cnt + (byte~) main::$1 ← call inccnt + *((byte[256]) SCREEN + (byte) 1) ← (byte~) main::$1 + to:main::@return +main::@return: from main + return + to:@RETURN +@1: from @BEGIN + to:@2 +inccnt: from + (byte) cnt ← ++ (byte) cnt + (byte) cnt2 ← ++ (byte) cnt2 + (byte) inccnt::return ← (byte) cnt + to:inccnt::@return +inccnt::@return: from inccnt inccnt::@1 + (byte) inccnt::return ← (byte) inccnt::return + return (byte) inccnt::return + to:@RETURN +inccnt::@1: from + to:inccnt::@return +@2: from @1 + to:@END +@END: from @2 + +Removing empty block @1 +Removing empty block inccnt::@1 +Removing empty block @2 +CONTROL FLOW GRAPH +@BEGIN: from + (byte) cnt ← (byte) 0 + (byte) cnt2 ← (byte) 0 + (byte[256]) SCREEN ← (word) 1024 + (void~) $0 ← call main + to:@END +main: from + (byte~) main::$0 ← call inccnt + *((byte[256]) SCREEN + (byte) 0) ← (byte~) main::$0 + (byte) cnt ← ++ (byte) cnt + (byte~) main::$1 ← call inccnt + *((byte[256]) SCREEN + (byte) 1) ← (byte~) main::$1 + to:main::@return +main::@return: from main + return + to:@RETURN +inccnt: from + (byte) cnt ← ++ (byte) cnt + (byte) cnt2 ← ++ (byte) cnt2 + (byte) inccnt::return ← (byte) cnt + to:inccnt::@return +inccnt::@return: from inccnt + (byte) inccnt::return ← (byte) inccnt::return + return (byte) inccnt::return + to:@RETURN +@END: from @BEGIN + +PROCEDURE MODIFY VARIABLE ANALYSIS +main modifies cnt +main modifies cnt2 +inccnt modifies cnt +inccnt modifies cnt2 + +CONTROL FLOW GRAPH WITH ASSIGNMENT CALL +@BEGIN: from + (byte) cnt ← (byte) 0 + (byte) cnt2 ← (byte) 0 + (byte[256]) SCREEN ← (word) 1024 + call main param-assignment + to:@3 +@3: from @BEGIN + (byte) cnt ← (byte) cnt + (byte) cnt2 ← (byte) cnt2 + to:@END +main: from @BEGIN + (byte) inccnt::return ← call inccnt param-assignment + to:main::@1 +main::@1: from main + (byte~) main::$0 ← (byte) inccnt::return + (byte) cnt ← (byte) cnt + (byte) cnt2 ← (byte) cnt2 + *((byte[256]) SCREEN + (byte) 0) ← (byte~) main::$0 + (byte) cnt ← ++ (byte) cnt + (byte) inccnt::return ← call inccnt param-assignment + to:main::@2 +main::@2: from main::@1 + (byte~) main::$1 ← (byte) inccnt::return + (byte) cnt ← (byte) cnt + (byte) cnt2 ← (byte) cnt2 + *((byte[256]) SCREEN + (byte) 1) ← (byte~) main::$1 + to:main::@return +main::@return: from main::@2 + (byte) cnt ← (byte) cnt + (byte) cnt2 ← (byte) cnt2 + return + to:@RETURN +inccnt: from main main::@1 + (byte) cnt ← ++ (byte) cnt + (byte) cnt2 ← ++ (byte) cnt2 + (byte) inccnt::return ← (byte) cnt + to:inccnt::@return +inccnt::@return: from inccnt + (byte) inccnt::return ← (byte) inccnt::return + (byte) cnt ← (byte) cnt + (byte) cnt2 ← (byte) cnt2 + return (byte) inccnt::return + to:@RETURN +@END: from @3 + +Completing Phi functions... +Completing Phi functions... +CONTROL FLOW GRAPH SSA +@BEGIN: from + (byte) cnt#0 ← (byte) 0 + (byte) cnt2#0 ← (byte) 0 + (byte[256]) SCREEN#0 ← (word) 1024 + call main param-assignment + to:@3 +@3: from @BEGIN + (byte) cnt2#7 ← phi( @BEGIN/(byte) cnt2#0 ) + (byte) cnt#8 ← phi( @BEGIN/(byte) cnt#0 ) + (byte) cnt#1 ← (byte) cnt#8 + (byte) cnt2#1 ← (byte) cnt2#7 + to:@END +main: from @BEGIN + (byte[256]) SCREEN#3 ← phi( @BEGIN/(byte[256]) SCREEN#0 ) + (byte) cnt2#13 ← phi( @BEGIN/(byte) cnt2#0 ) + (byte) cnt#14 ← phi( @BEGIN/(byte) cnt#0 ) + (byte) inccnt::return#0 ← call inccnt param-assignment + to:main::@1 +main::@1: from main + (byte[256]) SCREEN#1 ← phi( main/(byte[256]) SCREEN#3 ) + (byte) cnt2#8 ← phi( main/(byte) cnt2#13 ) + (byte) cnt#9 ← phi( main/(byte) cnt#14 ) + (byte) inccnt::return#4 ← phi( main/(byte) inccnt::return#0 ) + (byte~) main::$0 ← (byte) inccnt::return#4 + (byte) cnt#2 ← (byte) cnt#9 + (byte) cnt2#2 ← (byte) cnt2#8 + *((byte[256]) SCREEN#1 + (byte) 0) ← (byte~) main::$0 + (byte) cnt#3 ← ++ (byte) cnt#2 + (byte) inccnt::return#1 ← call inccnt param-assignment + to:main::@2 +main::@2: from main::@1 + (byte[256]) SCREEN#2 ← phi( main::@1/(byte[256]) SCREEN#1 ) + (byte) cnt2#9 ← phi( main::@1/(byte) cnt2#2 ) + (byte) cnt#10 ← phi( main::@1/(byte) cnt#3 ) + (byte) inccnt::return#5 ← phi( main::@1/(byte) inccnt::return#1 ) + (byte~) main::$1 ← (byte) inccnt::return#5 + (byte) cnt#4 ← (byte) cnt#10 + (byte) cnt2#3 ← (byte) cnt2#9 + *((byte[256]) SCREEN#2 + (byte) 1) ← (byte~) main::$1 + to:main::@return +main::@return: from main::@2 + (byte) cnt2#10 ← phi( main::@2/(byte) cnt2#3 ) + (byte) cnt#11 ← phi( main::@2/(byte) cnt#4 ) + (byte) cnt#5 ← (byte) cnt#11 + (byte) cnt2#4 ← (byte) cnt2#10 + return + to:@RETURN +inccnt: from main main::@1 + (byte) cnt2#11 ← phi( main/(byte) cnt2#13 main::@1/(byte) cnt2#2 ) + (byte) cnt#12 ← phi( main/(byte) cnt#14 main::@1/(byte) cnt#3 ) + (byte) cnt#6 ← ++ (byte) cnt#12 + (byte) cnt2#5 ← ++ (byte) cnt2#11 + (byte) inccnt::return#2 ← (byte) cnt#6 + to:inccnt::@return +inccnt::@return: from inccnt + (byte) cnt2#12 ← phi( inccnt/(byte) cnt2#5 ) + (byte) cnt#13 ← phi( inccnt/(byte) cnt#6 ) + (byte) inccnt::return#6 ← phi( inccnt/(byte) inccnt::return#2 ) + (byte) inccnt::return#3 ← (byte) inccnt::return#6 + (byte) cnt#7 ← (byte) cnt#13 + (byte) cnt2#6 ← (byte) cnt2#12 + return (byte) inccnt::return#3 + to:@RETURN +@END: from @3 + +CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN +@BEGIN: from + (byte) cnt#0 ← (byte) 0 + (byte) cnt2#0 ← (byte) 0 + (byte[256]) SCREEN#0 ← (word) 1024 + call main param-assignment + to:@3 +@3: from @BEGIN + (byte) cnt2#7 ← phi( @BEGIN/(byte) cnt2#4 ) + (byte) cnt#8 ← phi( @BEGIN/(byte) cnt#5 ) + (byte) cnt#1 ← (byte) cnt#8 + (byte) cnt2#1 ← (byte) cnt2#7 + to:@END +main: from @BEGIN + (byte[256]) SCREEN#3 ← phi( @BEGIN/(byte[256]) SCREEN#0 ) + (byte) cnt2#13 ← phi( @BEGIN/(byte) cnt2#0 ) + (byte) cnt#14 ← phi( @BEGIN/(byte) cnt#0 ) + call inccnt param-assignment + (byte) inccnt::return#0 ← (byte) inccnt::return#3 + to:main::@1 +main::@1: from main + (byte[256]) SCREEN#1 ← phi( main/(byte[256]) SCREEN#3 ) + (byte) cnt2#8 ← phi( main/(byte) cnt2#6 ) + (byte) cnt#9 ← phi( main/(byte) cnt#7 ) + (byte) inccnt::return#4 ← phi( main/(byte) inccnt::return#0 ) + (byte~) main::$0 ← (byte) inccnt::return#4 + (byte) cnt#2 ← (byte) cnt#9 + (byte) cnt2#2 ← (byte) cnt2#8 + *((byte[256]) SCREEN#1 + (byte) 0) ← (byte~) main::$0 + (byte) cnt#3 ← ++ (byte) cnt#2 + call inccnt param-assignment + (byte) inccnt::return#1 ← (byte) inccnt::return#3 + to:main::@2 +main::@2: from main::@1 + (byte[256]) SCREEN#2 ← phi( main::@1/(byte[256]) SCREEN#1 ) + (byte) cnt2#9 ← phi( main::@1/(byte) cnt2#6 ) + (byte) cnt#10 ← phi( main::@1/(byte) cnt#7 ) + (byte) inccnt::return#5 ← phi( main::@1/(byte) inccnt::return#1 ) + (byte~) main::$1 ← (byte) inccnt::return#5 + (byte) cnt#4 ← (byte) cnt#10 + (byte) cnt2#3 ← (byte) cnt2#9 + *((byte[256]) SCREEN#2 + (byte) 1) ← (byte~) main::$1 + to:main::@return +main::@return: from main::@2 + (byte) cnt2#10 ← phi( main::@2/(byte) cnt2#3 ) + (byte) cnt#11 ← phi( main::@2/(byte) cnt#4 ) + (byte) cnt#5 ← (byte) cnt#11 + (byte) cnt2#4 ← (byte) cnt2#10 + return + to:@RETURN +inccnt: from main main::@1 + (byte) cnt2#11 ← phi( main/(byte) cnt2#13 main::@1/(byte) cnt2#2 ) + (byte) cnt#12 ← phi( main/(byte) cnt#14 main::@1/(byte) cnt#3 ) + (byte) cnt#6 ← ++ (byte) cnt#12 + (byte) cnt2#5 ← ++ (byte) cnt2#11 + (byte) inccnt::return#2 ← (byte) cnt#6 + to:inccnt::@return +inccnt::@return: from inccnt + (byte) cnt2#12 ← phi( inccnt/(byte) cnt2#5 ) + (byte) cnt#13 ← phi( inccnt/(byte) cnt#6 ) + (byte) inccnt::return#6 ← phi( inccnt/(byte) inccnt::return#2 ) + (byte) inccnt::return#3 ← (byte) inccnt::return#6 + (byte) cnt#7 ← (byte) cnt#13 + (byte) cnt2#6 ← (byte) cnt2#12 + return + to:@RETURN +@END: from @3 + +Constant (byte) cnt#0 (byte) 0 +Constant (byte) cnt2#0 (byte) 0 +Constant (byte[256]) SCREEN#0 (word) 1024 +Succesful SSA optimization Pass2ConstantPropagation +CONTROL FLOW GRAPH +@BEGIN: from + call main param-assignment + to:@3 +@3: from @BEGIN + (byte) cnt2#7 ← phi( @BEGIN/(byte) cnt2#4 ) + (byte) cnt#8 ← phi( @BEGIN/(byte) cnt#5 ) + (byte) cnt#1 ← (byte) cnt#8 + (byte) cnt2#1 ← (byte) cnt2#7 + to:@END +main: from @BEGIN + (byte[256]) SCREEN#3 ← phi( @BEGIN/(word) 1024 ) + (byte) cnt2#13 ← phi( @BEGIN/(byte) 0 ) + (byte) cnt#14 ← phi( @BEGIN/(byte) 0 ) + call inccnt param-assignment + (byte) inccnt::return#0 ← (byte) inccnt::return#3 + to:main::@1 +main::@1: from main + (byte[256]) SCREEN#1 ← phi( main/(byte[256]) SCREEN#3 ) + (byte) cnt2#8 ← phi( main/(byte) cnt2#6 ) + (byte) cnt#9 ← phi( main/(byte) cnt#7 ) + (byte) inccnt::return#4 ← phi( main/(byte) inccnt::return#0 ) + (byte~) main::$0 ← (byte) inccnt::return#4 + (byte) cnt#2 ← (byte) cnt#9 + (byte) cnt2#2 ← (byte) cnt2#8 + *((byte[256]) SCREEN#1 + (byte) 0) ← (byte~) main::$0 + (byte) cnt#3 ← ++ (byte) cnt#2 + call inccnt param-assignment + (byte) inccnt::return#1 ← (byte) inccnt::return#3 + to:main::@2 +main::@2: from main::@1 + (byte[256]) SCREEN#2 ← phi( main::@1/(byte[256]) SCREEN#1 ) + (byte) cnt2#9 ← phi( main::@1/(byte) cnt2#6 ) + (byte) cnt#10 ← phi( main::@1/(byte) cnt#7 ) + (byte) inccnt::return#5 ← phi( main::@1/(byte) inccnt::return#1 ) + (byte~) main::$1 ← (byte) inccnt::return#5 + (byte) cnt#4 ← (byte) cnt#10 + (byte) cnt2#3 ← (byte) cnt2#9 + *((byte[256]) SCREEN#2 + (byte) 1) ← (byte~) main::$1 + to:main::@return +main::@return: from main::@2 + (byte) cnt2#10 ← phi( main::@2/(byte) cnt2#3 ) + (byte) cnt#11 ← phi( main::@2/(byte) cnt#4 ) + (byte) cnt#5 ← (byte) cnt#11 + (byte) cnt2#4 ← (byte) cnt2#10 + return + to:@RETURN +inccnt: from main main::@1 + (byte) cnt2#11 ← phi( main/(byte) cnt2#13 main::@1/(byte) cnt2#2 ) + (byte) cnt#12 ← phi( main/(byte) cnt#14 main::@1/(byte) cnt#3 ) + (byte) cnt#6 ← ++ (byte) cnt#12 + (byte) cnt2#5 ← ++ (byte) cnt2#11 + (byte) inccnt::return#2 ← (byte) cnt#6 + to:inccnt::@return +inccnt::@return: from inccnt + (byte) cnt2#12 ← phi( inccnt/(byte) cnt2#5 ) + (byte) cnt#13 ← phi( inccnt/(byte) cnt#6 ) + (byte) inccnt::return#6 ← phi( inccnt/(byte) inccnt::return#2 ) + (byte) inccnt::return#3 ← (byte) inccnt::return#6 + (byte) cnt#7 ← (byte) cnt#13 + (byte) cnt2#6 ← (byte) cnt2#12 + return + to:@RETURN +@END: from @3 + +Not aliassing across scopes: main::$0 inccnt::return#4 +Not aliassing across scopes: main::$1 inccnt::return#5 +Not aliassing across scopes: inccnt::return#2 cnt#6 +Alias (byte) cnt#1 = (byte) cnt#8 (byte) cnt#5 (byte) cnt#9 (byte) cnt#7 (byte) cnt#2 (byte) cnt#10 (byte) cnt#4 (byte) cnt#11 (byte) cnt#13 (byte) cnt#6 +Alias (byte) cnt2#1 = (byte) cnt2#7 (byte) cnt2#4 (byte) cnt2#8 (byte) cnt2#6 (byte) cnt2#2 (byte) cnt2#9 (byte) cnt2#3 (byte) cnt2#10 (byte) cnt2#12 (byte) cnt2#5 +Alias (byte) inccnt::return#0 = (byte) inccnt::return#3 (byte) inccnt::return#4 (byte) inccnt::return#1 (byte) inccnt::return#5 (byte) inccnt::return#6 (byte) inccnt::return#2 +Alias (byte[256]) SCREEN#1 = (byte[256]) SCREEN#3 (byte[256]) SCREEN#2 +Succesful SSA optimization Pass2AliasElimination +CONTROL FLOW GRAPH +@BEGIN: from + call main param-assignment + to:@3 +@3: from @BEGIN + to:@END +main: from @BEGIN + (byte[256]) SCREEN#1 ← phi( @BEGIN/(word) 1024 ) + (byte) cnt2#13 ← phi( @BEGIN/(byte) 0 ) + (byte) cnt#14 ← phi( @BEGIN/(byte) 0 ) + call inccnt param-assignment + to:main::@1 +main::@1: from main + (byte~) main::$0 ← (byte) inccnt::return#0 + *((byte[256]) SCREEN#1 + (byte) 0) ← (byte~) main::$0 + (byte) cnt#3 ← ++ (byte) cnt#1 + call inccnt param-assignment + to:main::@2 +main::@2: from main::@1 + (byte~) main::$1 ← (byte) inccnt::return#0 + *((byte[256]) SCREEN#1 + (byte) 1) ← (byte~) main::$1 + to:main::@return +main::@return: from main::@2 + return + to:@RETURN +inccnt: from main main::@1 + (byte) cnt2#11 ← phi( main/(byte) cnt2#13 main::@1/(byte) cnt2#1 ) + (byte) cnt#12 ← phi( main/(byte) cnt#14 main::@1/(byte) cnt#3 ) + (byte) cnt#1 ← ++ (byte) cnt#12 + (byte) cnt2#1 ← ++ (byte) cnt2#11 + (byte) inccnt::return#0 ← (byte) cnt#1 + to:inccnt::@return +inccnt::@return: from inccnt + return + to:@RETURN +@END: from @3 + +Redundant Phi (byte) cnt#14 (byte) 0 +Redundant Phi (byte) cnt2#13 (byte) 0 +Redundant Phi (byte[256]) SCREEN#1 (word) 1024 +Succesful SSA optimization Pass2RedundantPhiElimination +CONTROL FLOW GRAPH +@BEGIN: from + call main param-assignment + to:@3 +@3: from @BEGIN + to:@END +main: from @BEGIN + call inccnt param-assignment + to:main::@1 +main::@1: from main + (byte~) main::$0 ← (byte) inccnt::return#0 + *((word) 1024 + (byte) 0) ← (byte~) main::$0 + (byte) cnt#3 ← ++ (byte) cnt#1 + call inccnt param-assignment + to:main::@2 +main::@2: from main::@1 + (byte~) main::$1 ← (byte) inccnt::return#0 + *((word) 1024 + (byte) 1) ← (byte~) main::$1 + to:main::@return +main::@return: from main::@2 + return + to:@RETURN +inccnt: from main main::@1 + (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) + (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) + (byte) cnt#1 ← ++ (byte) cnt#12 + (byte) cnt2#1 ← ++ (byte) cnt2#11 + (byte) inccnt::return#0 ← (byte) cnt#1 + to:inccnt::@return +inccnt::@return: from inccnt + return + to:@RETURN +@END: from @3 + +Culled Empty Block (label) @3 +Succesful SSA optimization Pass2CullEmptyBlocks +CONTROL FLOW GRAPH +@BEGIN: from + call main param-assignment + to:@END +main: from @BEGIN + call inccnt param-assignment + to:main::@1 +main::@1: from main + (byte~) main::$0 ← (byte) inccnt::return#0 + *((word) 1024 + (byte) 0) ← (byte~) main::$0 + (byte) cnt#3 ← ++ (byte) cnt#1 + call inccnt param-assignment + to:main::@2 +main::@2: from main::@1 + (byte~) main::$1 ← (byte) inccnt::return#0 + *((word) 1024 + (byte) 1) ← (byte~) main::$1 + to:main::@return +main::@return: from main::@2 + return + to:@RETURN +inccnt: from main main::@1 + (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) + (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) + (byte) cnt#1 ← ++ (byte) cnt#12 + (byte) cnt2#1 ← ++ (byte) cnt2#11 + (byte) inccnt::return#0 ← (byte) cnt#1 + to:inccnt::@return +inccnt::@return: from inccnt + return + to:@RETURN +@END: from @BEGIN + +Consolidated assigned array index constant in assignment *(1024) +Consolidated assigned array index constant in assignment *(1025) +Succesful SSA optimization Pass2ConstantAdditionElimination +CONTROL FLOW GRAPH +@BEGIN: from + call main param-assignment + to:@END +main: from @BEGIN + call inccnt param-assignment + to:main::@1 +main::@1: from main + (byte~) main::$0 ← (byte) inccnt::return#0 + *((word) 1024) ← (byte~) main::$0 + (byte) cnt#3 ← ++ (byte) cnt#1 + call inccnt param-assignment + to:main::@2 +main::@2: from main::@1 + (byte~) main::$1 ← (byte) inccnt::return#0 + *((word) 1025) ← (byte~) main::$1 + to:main::@return +main::@return: from main::@2 + return + to:@RETURN +inccnt: from main main::@1 + (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) + (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) + (byte) cnt#1 ← ++ (byte) cnt#12 + (byte) cnt2#1 ← ++ (byte) cnt2#11 + (byte) inccnt::return#0 ← (byte) cnt#1 + to:inccnt::@return +inccnt::@return: from inccnt + return + to:@RETURN +@END: from @BEGIN + +Not aliassing across scopes: main::$0 inccnt::return#0 +Not aliassing across scopes: main::$1 inccnt::return#0 +Not aliassing across scopes: inccnt::return#0 cnt#1 +Not aliassing across scopes: main::$0 inccnt::return#0 +Not aliassing across scopes: main::$1 inccnt::return#0 +Not aliassing across scopes: inccnt::return#0 cnt#1 +Block Sequence Planned @BEGIN @END main main::@1 main::@2 main::@return inccnt inccnt::@return +Block Sequence Planned @BEGIN @END main main::@1 main::@2 main::@return inccnt inccnt::@return +CONTROL FLOW GRAPH - PHI LIFTED +@BEGIN: from + call main param-assignment + to:@END +@END: from @BEGIN +main: from @BEGIN + call inccnt param-assignment + to:main::@1 +main::@1: from main + (byte~) main::$0 ← (byte) inccnt::return#0 + *((word) 1024) ← (byte~) main::$0 + (byte) cnt#3 ← ++ (byte) cnt#1 + (byte~) cnt#15 ← (byte) cnt#3 + (byte~) cnt2#14 ← (byte) cnt2#1 + call inccnt param-assignment + to:main::@2 +main::@2: from main::@1 + (byte~) main::$1 ← (byte) inccnt::return#0 + *((word) 1025) ← (byte~) main::$1 + to:main::@return +main::@return: from main::@2 + return + to:@RETURN +inccnt: from main main::@1 + (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte~) cnt2#14 ) + (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte~) cnt#15 ) + (byte) cnt#1 ← ++ (byte) cnt#12 + (byte) cnt2#1 ← ++ (byte) cnt2#11 + (byte) inccnt::return#0 ← (byte) cnt#1 + to:inccnt::@return +inccnt::@return: from inccnt + return + to:@RETURN + +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES +@BEGIN: from + [0] call main param-assignment [ ] + to:@END +@END: from @BEGIN +main: from @BEGIN + [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 ] + to:main::@1 +main::@1: from main + [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 ] + [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 ] + [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 ] + [5] (byte~) cnt#15 ← (byte) cnt#3 [ cnt2#1 cnt#15 ] + [6] (byte~) cnt2#14 ← (byte) cnt2#1 [ cnt#15 cnt2#14 ] + [7] call inccnt param-assignment [ inccnt::return#0 ] + to:main::@2 +main::@2: from main::@1 + [8] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] + [9] *((word) 1025) ← (byte~) main::$1 [ ] + to:main::@return +main::@return: from main::@2 + [10] return [ ] + to:@RETURN +inccnt: from main main::@1 + [11] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte~) cnt2#14 ) [ cnt#12 cnt2#11 ] + [11] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte~) cnt#15 ) [ cnt#12 cnt2#11 ] + [12] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 ] + [13] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 ] + [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 ] + to:inccnt::@return +inccnt::@return: from inccnt + [15] return [ inccnt::return#0 cnt#1 cnt2#1 ] + to:@RETURN + +Created 2 initial phi equivalence classes +Coalesced [5] cnt#15 ← cnt#3 +Coalesced [6] cnt2#14 ← cnt2#1 +Coalesced down to 2 phi equivalence classes +Block Sequence Planned @BEGIN @END main main::@1 main::@2 main::@return inccnt inccnt::@return +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +CONTROL FLOW GRAPH - PHI MEM COALESCED +@BEGIN: from + [0] call main param-assignment [ ] + to:@END +@END: from @BEGIN +main: from @BEGIN + [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 ] + to:main::@1 +main::@1: from main + [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 ] + [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 ] + [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 ] + [5] call inccnt param-assignment [ inccnt::return#0 ] + to:main::@2 +main::@2: from main::@1 + [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] + [7] *((word) 1025) ← (byte~) main::$1 [ ] + to:main::@return +main::@return: from main::@2 + [8] return [ ] + to:@RETURN +inccnt: from main main::@1 + [9] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) [ cnt#12 cnt2#11 ] + [9] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#12 cnt2#11 ] + [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 ] + [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 ] + [12] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 ] + to:inccnt::@return +inccnt::@return: from inccnt + [13] return [ inccnt::return#0 cnt#1 cnt2#1 ] + to:@RETURN + +CALL GRAPH +Calls in [] to 0:main +Calls in [main] to 1:inccnt 5:inccnt + +DOMINATORS +@BEGIN dominated by @BEGIN +@END dominated by @BEGIN @END +main dominated by @BEGIN main +main::@1 dominated by @BEGIN main::@1 main +main::@2 dominated by @BEGIN main::@2 main::@1 main +main::@return dominated by @BEGIN main::@return main::@2 main::@1 main +inccnt dominated by @BEGIN inccnt main +inccnt::@return dominated by inccnt::@return @BEGIN inccnt main + +NATURAL LOOPS + +Found 0 loops in scope [] +Found 0 loops in scope [main] +Found 0 loops in scope [inccnt] +NATURAL LOOPS WITH DEPTH + + +VARIABLE REGISTER WEIGHTS +(byte[256]) SCREEN +(byte) cnt +(byte) cnt#1 0.8571428571428571 +(byte) cnt#12 4.0 +(byte) cnt#3 4.0 +(byte) cnt2 +(byte) cnt2#1 0.5714285714285714 +(byte) cnt2#11 2.0 +(byte()) inccnt() +(byte) inccnt::return +(byte) inccnt::return#0 1.5 +(void()) main() +(byte~) main::$0 4.0 +(byte~) main::$1 4.0 + +Initial phi equivalence classes +[ cnt#12 cnt#3 ] +[ cnt2#11 cnt2#1 ] +Added variable main::$0 to zero page equivalence class [ main::$0 ] +Added variable main::$1 to zero page equivalence class [ main::$1 ] +Added variable cnt#1 to zero page equivalence class [ cnt#1 ] +Added variable inccnt::return#0 to zero page equivalence class [ inccnt::return#0 ] +Complete equivalence classes +[ cnt#12 cnt#3 ] +[ cnt2#11 cnt2#1 ] +[ main::$0 ] +[ main::$1 ] +[ cnt#1 ] +[ inccnt::return#0 ] +Allocated zp byte:2 to zp byte:2 [ cnt#12 cnt#3 ] +Allocated zp byte:3 to zp byte:3 [ cnt2#11 cnt2#1 ] +Allocated zp byte:4 to zp byte:4 [ main::$0 ] +Allocated zp byte:5 to zp byte:5 [ main::$1 ] +Allocated zp byte:6 to zp byte:6 [ cnt#1 ] +Allocated zp byte:7 to zp byte:7 [ inccnt::return#0 ] +INITIAL ASM +//SEG0 @BEGIN +BBEGIN: +//SEG1 [0] call main param-assignment [ ] + jsr main + jmp BEND +//SEG2 @END +BEND: +//SEG3 main +main: +//SEG4 [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 ] +//SEG5 [9] phi from main to inccnt +inccnt_from_main: +//SEG6 [9] phi (byte) cnt2#11 = (byte) 0 -- zpby1=coby1 + lda #0 + sta 3 +//SEG7 [9] phi (byte) cnt#12 = (byte) 0 -- zpby1=coby1 + lda #0 + sta 2 + jsr inccnt + jmp main__B1 +//SEG8 main::@1 +main__B1: +//SEG9 [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 ] -- zpby1=zpby2 + lda 7 + sta 4 +//SEG10 [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 ] -- _star_cowo1=zpby1 + lda 4 + sta 1024 +//SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 ] -- zpby1=_inc_zpby2 + lda 6 + sta 2 + inc 2 +//SEG12 [5] call inccnt param-assignment [ inccnt::return#0 ] +//SEG13 [9] phi from main::@1 to inccnt +inccnt_from_B1: +//SEG14 [9] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy +//SEG15 [9] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy + jsr inccnt + jmp main__B2 +//SEG16 main::@2 +main__B2: +//SEG17 [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] -- zpby1=zpby2 + lda 7 + sta 5 +//SEG18 [7] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=zpby1 + lda 5 + sta 1025 + jmp main__Breturn +//SEG19 main::@return +main__Breturn: +//SEG20 [8] return [ ] + rts +//SEG21 inccnt +inccnt: +//SEG22 [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 ] -- zpby1=_inc_zpby2 + lda 2 + sta 6 + inc 6 +//SEG23 [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 ] -- zpby1=_inc_zpby1 + inc 3 +//SEG24 [12] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 ] -- zpby1=zpby2 + lda 6 + sta 7 + jmp inccnt__Breturn +//SEG25 inccnt::@return +inccnt__Breturn: +//SEG26 [13] return [ inccnt::return#0 cnt#1 cnt2#1 ] + rts + +REGISTER UPLIFT POTENTIAL REGISTERS +Potential registers zp byte:2 [ cnt#12 cnt#3 ] : zp byte:2 , reg byte a , reg byte x , reg byte y , +Potential registers zp byte:3 [ cnt2#11 cnt2#1 ] : zp byte:3 , reg byte a , reg byte x , reg byte y , +Potential registers zp byte:4 [ main::$0 ] : zp byte:4 , reg byte a , reg byte x , reg byte y , +Potential registers zp byte:5 [ main::$1 ] : zp byte:5 , reg byte a , reg byte x , reg byte y , +Potential registers zp byte:6 [ cnt#1 ] : zp byte:6 , reg byte a , reg byte x , reg byte y , +Potential registers zp byte:7 [ inccnt::return#0 ] : zp byte:7 , reg byte a , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [] 8: zp byte:2 [ cnt#12 cnt#3 ] 2.57: zp byte:3 [ cnt2#11 cnt2#1 ] 0.86: zp byte:6 [ cnt#1 ] +Uplift Scope [main] 4: zp byte:4 [ main::$0 ] 4: zp byte:5 [ main::$1 ] +Uplift Scope [inccnt] 1.5: zp byte:7 [ inccnt::return#0 ] + +Uplifting [] best 84 combination reg byte x [ cnt#12 cnt#3 ] reg byte y [ cnt2#11 cnt2#1 ] reg byte x [ cnt#1 ] +Uplifting [main] best 72 combination reg byte a [ main::$0 ] reg byte a [ main::$1 ] +Uplifting [inccnt] best 65 combination reg byte a [ inccnt::return#0 ] +MISSING FRAGMENTS + zpby1=_inc_xby + zpby1=_inc_yby + aby=_inc_xby + aby=_inc_yby + yby=_inc_xby + xby=_inc_yby +Removing instruction jmp BEND +Removing instruction jmp main__B1 +Removing instruction jmp main__B2 +Removing instruction jmp main__Breturn +Removing instruction jmp inccnt__Breturn +Succesful ASM optimization Pass5NextJumpElimination +ASSEMBLER +//SEG0 @BEGIN +BBEGIN: +//SEG1 [0] call main param-assignment [ ] + jsr main +//SEG2 @END +BEND: +//SEG3 main +main: +//SEG4 [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 ] +//SEG5 [9] phi from main to inccnt +inccnt_from_main: +//SEG6 [9] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1 + ldy #0 +//SEG7 [9] phi (byte) cnt#12 = (byte) 0 -- xby=coby1 + ldx #0 + jsr inccnt +//SEG8 main::@1 +main__B1: +//SEG9 [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 ] + // (byte~) main::$0 = (byte) inccnt::return#0 // register copy reg byte a +//SEG10 [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 ] -- _star_cowo1=aby + sta 1024 +//SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 ] -- xby=_inc_xby + inx +//SEG12 [5] call inccnt param-assignment [ inccnt::return#0 ] +//SEG13 [9] phi from main::@1 to inccnt +inccnt_from_B1: +//SEG14 [9] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy +//SEG15 [9] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy + jsr inccnt +//SEG16 main::@2 +main__B2: +//SEG17 [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] + // (byte~) main::$1 = (byte) inccnt::return#0 // register copy reg byte a +//SEG18 [7] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby + sta 1025 +//SEG19 main::@return +main__Breturn: +//SEG20 [8] return [ ] + rts +//SEG21 inccnt +inccnt: +//SEG22 [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 ] -- xby=_inc_xby + inx +//SEG23 [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 ] -- yby=_inc_yby + iny +//SEG24 [12] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 ] -- aby=xby + txa +//SEG25 inccnt::@return +inccnt__Breturn: +//SEG26 [13] return [ inccnt::return#0 cnt#1 cnt2#1 ] + rts + +FINAL SYMBOL TABLE +(label) @BEGIN +(label) @END +(byte[256]) SCREEN +(byte) cnt +(byte) cnt#1 reg byte x 0.8571428571428571 +(byte) cnt#12 reg byte x 4.0 +(byte) cnt#3 reg byte x 4.0 +(byte) cnt2 +(byte) cnt2#1 reg byte y 0.5714285714285714 +(byte) cnt2#11 reg byte y 2.0 +(byte()) inccnt() +(label) inccnt::@return +(byte) inccnt::return +(byte) inccnt::return#0 reg byte a 1.5 +(void()) main() +(byte~) main::$0 reg byte a 4.0 +(byte~) main::$1 reg byte a 4.0 +(label) main::@1 +(label) main::@2 +(label) main::@return + +reg byte x [ cnt#12 cnt#3 ] +reg byte y [ cnt2#11 cnt2#1 ] +reg byte a [ main::$0 ] +reg byte a [ main::$1 ] +reg byte x [ cnt#1 ] +reg byte a [ inccnt::return#0 ] + +FINAL CODE +//SEG0 @BEGIN +BBEGIN: +//SEG1 [0] call main param-assignment [ ] + jsr main +//SEG2 @END +BEND: +//SEG3 main +main: +//SEG4 [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 ] +//SEG5 [9] phi from main to inccnt +inccnt_from_main: +//SEG6 [9] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1 + ldy #0 +//SEG7 [9] phi (byte) cnt#12 = (byte) 0 -- xby=coby1 + ldx #0 + jsr inccnt +//SEG8 main::@1 +main__B1: +//SEG9 [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 ] + // (byte~) main::$0 = (byte) inccnt::return#0 // register copy reg byte a +//SEG10 [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 ] -- _star_cowo1=aby + sta 1024 +//SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 ] -- xby=_inc_xby + inx +//SEG12 [5] call inccnt param-assignment [ inccnt::return#0 ] +//SEG13 [9] phi from main::@1 to inccnt +inccnt_from_B1: +//SEG14 [9] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy +//SEG15 [9] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy + jsr inccnt +//SEG16 main::@2 +main__B2: +//SEG17 [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] + // (byte~) main::$1 = (byte) inccnt::return#0 // register copy reg byte a +//SEG18 [7] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby + sta 1025 +//SEG19 main::@return +main__Breturn: +//SEG20 [8] return [ ] + rts +//SEG21 inccnt +inccnt: +//SEG22 [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 ] -- xby=_inc_xby + inx +//SEG23 [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 ] -- yby=_inc_yby + iny +//SEG24 [12] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 ] -- aby=xby + txa +//SEG25 inccnt::@return +inccnt__Breturn: +//SEG26 [13] return [ inccnt::return#0 cnt#1 cnt2#1 ] + rts + diff --git a/src/main/java/dk/camelot64/kickc/test/ref/modglobal.sym b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.sym new file mode 100644 index 000000000..05188cb40 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.sym @@ -0,0 +1,27 @@ +(label) @BEGIN +(label) @END +(byte[256]) SCREEN +(byte) cnt +(byte) cnt#1 reg byte x 0.8571428571428571 +(byte) cnt#12 reg byte x 4.0 +(byte) cnt#3 reg byte x 4.0 +(byte) cnt2 +(byte) cnt2#1 reg byte y 0.5714285714285714 +(byte) cnt2#11 reg byte y 2.0 +(byte()) inccnt() +(label) inccnt::@return +(byte) inccnt::return +(byte) inccnt::return#0 reg byte a 1.5 +(void()) main() +(byte~) main::$0 reg byte a 4.0 +(byte~) main::$1 reg byte a 4.0 +(label) main::@1 +(label) main::@2 +(label) main::@return + +reg byte x [ cnt#12 cnt#3 ] +reg byte y [ cnt2#11 cnt2#1 ] +reg byte a [ main::$0 ] +reg byte a [ main::$1 ] +reg byte x [ cnt#1 ] +reg byte a [ inccnt::return#0 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log index 2b467b7ab..449e3ccc9 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log @@ -445,6 +445,8 @@ rvaluevar::@return: from rvaluevar::@1 to:@RETURN @END: from @BEGIN +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from call main param-assignment diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.log b/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.log index 13ec73766..2f3bac2e2 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.log @@ -109,6 +109,8 @@ main::@return: from main::@1 to:@RETURN @END: from @BEGIN +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from call main param-assignment diff --git a/src/main/java/dk/camelot64/kickc/test/ref/summin.cfg b/src/main/java/dk/camelot64/kickc/test/ref/summin.cfg index 30b408fa7..fe5fd7d2a 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/summin.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/summin.cfg @@ -1,8 +1,8 @@ @BEGIN: from - [0] call sum param-assignment [ sum::return#0 s1#0 ] + [0] call sum param-assignment [ sum::return#0 ] to:@2 @2: from @BEGIN - [1] (byte) s1#0 ← (byte) sum::return#0 [ sum::return#0 s1#0 ] + [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] [2] call sum param-assignment [ sum::return#0 s1#0 ] to:@3 @3: from @2 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 1bec6bfcb..4bd64eea1 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/summin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/summin.log @@ -79,6 +79,8 @@ sum::@return: from sum to:@RETURN @END: from @BEGIN +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from (byte) sum::a ← (byte) 1 @@ -282,10 +284,10 @@ Propagating live ranges... Propagating live ranges... CONTROL FLOW GRAPH - LIVE RANGES @BEGIN: from - [0] call sum param-assignment [ sum::return#0 s1#0 ] + [0] call sum param-assignment [ sum::return#0 ] to:@2 @2: from @BEGIN - [1] (byte) s1#0 ← (byte) sum::return#0 [ sum::return#0 s1#0 ] + [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] [2] call sum param-assignment [ sum::return#0 s1#0 ] to:@3 @3: from @2 @@ -313,10 +315,10 @@ Propagating live ranges... Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @BEGIN: from - [0] call sum param-assignment [ sum::return#0 s1#0 ] + [0] call sum param-assignment [ sum::return#0 ] to:@2 @2: from @BEGIN - [1] (byte) s1#0 ← (byte) sum::return#0 [ sum::return#0 s1#0 ] + [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] [2] call sum param-assignment [ sum::return#0 s1#0 ] to:@3 @3: from @2 @@ -353,7 +355,7 @@ NATURAL LOOPS WITH DEPTH VARIABLE REGISTER WEIGHTS (byte) s1 -(byte) s1#0 0.5714285714285714 +(byte) s1#0 0.6666666666666666 (byte) s2 (byte) s2#0 4.0 (byte) s3 @@ -364,7 +366,7 @@ VARIABLE REGISTER WEIGHTS (byte) sum::b (byte) sum::b#2 2.0 (byte) sum::return -(byte) sum::return#0 1.2000000000000002 +(byte) sum::return#0 1.5 Initial phi equivalence classes [ sum::a#2 ] @@ -389,7 +391,7 @@ Allocated zp byte:7 to zp byte:7 [ sum::return#0 ] INITIAL ASM //SEG0 @BEGIN BBEGIN: -//SEG1 [0] call sum param-assignment [ sum::return#0 s1#0 ] +//SEG1 [0] call sum param-assignment [ sum::return#0 ] //SEG2 [5] phi from @BEGIN to sum sum_from_BBEGIN: //SEG3 [5] phi (byte) sum::b#2 = (byte) 2 -- zpby1=coby1 @@ -402,7 +404,7 @@ sum_from_BBEGIN: jmp B2 //SEG5 @2 B2: -//SEG6 [1] (byte) s1#0 ← (byte) sum::return#0 [ sum::return#0 s1#0 ] -- zpby1=zpby2 +//SEG6 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=zpby2 lda 7 sta 4 //SEG7 [2] call sum param-assignment [ sum::return#0 s1#0 ] @@ -451,8 +453,8 @@ Potential registers zp byte:6 [ s3#0 ] : zp byte:6 , reg byte a , reg byte x , r Potential registers zp byte:7 [ sum::return#0 ] : zp byte:7 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -Uplift Scope [] ∞: zp byte:6 [ s3#0 ] 4: zp byte:5 [ s2#0 ] 0.57: zp byte:4 [ s1#0 ] -Uplift Scope [sum] 2: zp byte:2 [ sum::a#2 ] 2: zp byte:3 [ sum::b#2 ] 1.2: zp byte:7 [ sum::return#0 ] +Uplift Scope [] ∞: zp byte:6 [ s3#0 ] 4: zp byte:5 [ s2#0 ] 0.67: zp byte:4 [ s1#0 ] +Uplift Scope [sum] 2: zp byte:2 [ sum::a#2 ] 2: zp byte:3 [ sum::b#2 ] 1.5: zp byte:7 [ sum::return#0 ] Uplifting [] best 75 combination reg byte a [ s3#0 ] reg byte a [ s2#0 ] zp byte:4 [ s1#0 ] Uplifting [sum] best 54 combination reg byte x [ sum::a#2 ] reg byte a [ sum::b#2 ] reg byte a [ sum::return#0 ] @@ -465,7 +467,7 @@ Succesful ASM optimization Pass5NextJumpElimination ASSEMBLER //SEG0 @BEGIN BBEGIN: -//SEG1 [0] call sum param-assignment [ sum::return#0 s1#0 ] +//SEG1 [0] call sum param-assignment [ sum::return#0 ] //SEG2 [5] phi from @BEGIN to sum sum_from_BBEGIN: //SEG3 [5] phi (byte) sum::b#2 = (byte) 2 -- aby=coby1 @@ -475,7 +477,7 @@ sum_from_BBEGIN: jsr sum //SEG5 @2 B2: -//SEG6 [1] (byte) s1#0 ← (byte) sum::return#0 [ sum::return#0 s1#0 ] -- zpby1=aby +//SEG6 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=aby sta 2 //SEG7 [2] call sum param-assignment [ sum::return#0 s1#0 ] //SEG8 [5] phi from @2 to sum @@ -511,7 +513,7 @@ FINAL SYMBOL TABLE (label) @BEGIN (label) @END (byte) s1 -(byte) s1#0 zp byte:2 0.5714285714285714 +(byte) s1#0 zp byte:2 0.6666666666666666 (byte) s2 (byte) s2#0 reg byte a 4.0 (byte) s3 @@ -523,7 +525,7 @@ FINAL SYMBOL TABLE (byte) sum::b (byte) sum::b#2 reg byte a 2.0 (byte) sum::return -(byte) sum::return#0 reg byte a 1.2000000000000002 +(byte) sum::return#0 reg byte a 1.5 reg byte x [ sum::a#2 ] reg byte a [ sum::b#2 ] @@ -535,7 +537,7 @@ reg byte a [ sum::return#0 ] FINAL CODE //SEG0 @BEGIN BBEGIN: -//SEG1 [0] call sum param-assignment [ sum::return#0 s1#0 ] +//SEG1 [0] call sum param-assignment [ sum::return#0 ] //SEG2 [5] phi from @BEGIN to sum sum_from_BBEGIN: //SEG3 [5] phi (byte) sum::b#2 = (byte) 2 -- aby=coby1 @@ -545,7 +547,7 @@ sum_from_BBEGIN: jsr sum //SEG5 @2 B2: -//SEG6 [1] (byte) s1#0 ← (byte) sum::return#0 [ sum::return#0 s1#0 ] -- zpby1=aby +//SEG6 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=aby sta 2 //SEG7 [2] call sum param-assignment [ sum::return#0 s1#0 ] //SEG8 [5] phi from @2 to sum 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 a12a8489e..d2304d56d 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/summin.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/summin.sym @@ -3,7 +3,7 @@ (label) @BEGIN (label) @END (byte) s1 -(byte) s1#0 zp byte:2 0.5714285714285714 +(byte) s1#0 zp byte:2 0.6666666666666666 (byte) s2 (byte) s2#0 reg byte a 4.0 (byte) s3 @@ -15,7 +15,7 @@ (byte) sum::b (byte) sum::b#2 reg byte a 2.0 (byte) sum::return -(byte) sum::return#0 reg byte a 1.2000000000000002 +(byte) sum::return#0 reg byte a 1.5 reg byte x [ sum::a#2 ] reg byte a [ sum::b#2 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log b/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log index a323ac42e..dfe668355 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log @@ -48,6 +48,8 @@ main::@return: from main to:@RETURN @END: from @BEGIN +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from (byte*) SCREEN ← (word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.asm b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.asm index dce837f65..9e76829e6 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.asm +++ b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.asm @@ -148,12 +148,12 @@ render__B2_from_B1: render__B2_from_B5: render__B2: lda 5 - sta 9 + sta 8 lda 2 - sta 10 + sta 9 jsr findcol render__B5: - lda 8 + tya ldy 5 sta (3),y inc 5 @@ -176,80 +176,77 @@ render__Breturn: rts findcol: findcol__B1_from_findcol: - lda #0 - sta 8 + ldy #0 lda #255 sta 6 - ldy #0 + ldx #0 findcol__B1_from_B13: findcol__B1: - ldx 4096,y - lda 4352,y - sta 11 - cpx 9 + lda 4096,x + sta 7 + lda 4352,x + sta 10 + lda 8 + cmp 7 beq findcol__B2 findcol__B3: - cpx 9 - bcs findcol__B6 + lda 8 + cmp 7 + bcc findcol__B6 findcol__B7: - stx 255 - lda 9 + lda 8 sec - sbc 255 + sbc 7 sta 7 findcol__B8_from_B7: findcol__B8: - lda 10 - cmp 11 + lda 9 + cmp 10 bcc findcol__B9 findcol__B10: - lda 10 - sec - sbc 11 - clc - adc 7 - tax -findcol__B11_from_B10: -findcol__B11: - cpx 6 - bcc findcol__B12 -findcol__B13_from_B11: -findcol__B13: - iny - cpy #6 - bcc findcol__B1_from_B13 -findcol__Breturn_from_B13: - jmp findcol__Breturn -findcol__Breturn_from_B2: - lda #0 - sta 8 -findcol__Breturn: - rts -findcol__B12: - lda 4608,y - sta 8 - stx 6 -findcol__B13_from_B12: - jmp findcol__B13 -findcol__B9: - lda 11 + lda 9 sec sbc 10 clc adc 7 - tax +findcol__B11_from_B10: +findcol__B11: + cmp 6 + bcc findcol__B12 +findcol__B13_from_B11: +findcol__B13: + inx + cpx #6 + bcc findcol__B1_from_B13 +findcol__Breturn_from_B13: + jmp findcol__Breturn +findcol__Breturn_from_B2: + ldy #0 +findcol__Breturn: + rts +findcol__B12: + ldy 4608,x + sta 6 +findcol__B13_from_B12: + jmp findcol__B13 +findcol__B9: + lda 10 + sec + sbc 9 + clc + adc 7 findcol__B11_from_B9: jmp findcol__B11 findcol__B6: - txa + lda 7 sec - sbc 9 + sbc 8 sta 7 findcol__B8_from_B6: jmp findcol__B8 findcol__B2: - lda 10 - cmp 11 + lda 9 + cmp 10 beq findcol__Breturn_from_B2 jmp findcol__B3 initscreen: diff --git a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.cfg b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.cfg index 3b05115a6..6f306f2bc 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.cfg @@ -1,128 +1,128 @@ @BEGIN: from - [0] call main param-assignment [ findcol::return#0 ] + [0] call main param-assignment [ ] to:@END @END: from @BEGIN main: from @BEGIN - [1] call addpoint param-assignment [ findcol::return#0 ] + [1] call addpoint param-assignment [ ] to:main::@3 main::@3: from main - [2] call addpoint param-assignment [ findcol::return#0 ] + [2] call addpoint param-assignment [ ] to:main::@4 main::@4: from main::@3 - [3] call addpoint param-assignment [ findcol::return#0 ] + [3] call addpoint param-assignment [ ] to:main::@5 main::@5: from main::@4 - [4] call addpoint param-assignment [ findcol::return#0 ] + [4] call addpoint param-assignment [ ] to:main::@6 main::@6: from main::@5 - [5] call addpoint param-assignment [ findcol::return#0 ] + [5] call addpoint param-assignment [ ] to:main::@7 main::@7: from main::@6 - [6] call addpoint param-assignment [ findcol::return#0 ] + [6] call addpoint param-assignment [ ] to:main::@8 main::@8: from main::@7 - [7] call initscreen param-assignment [ findcol::return#0 ] + [7] call initscreen param-assignment [ ] to:main::@1 main::@1: from main::@11 main::@8 - [8] call render param-assignment [ findcol::return#0 ] + [8] call render param-assignment [ ] to:main::@10 main::@10: from main::@1 - [9] call animate param-assignment [ findcol::return#0 ] + [9] call animate param-assignment [ ] to:main::@11 main::@11: from main::@10 - [10] if(true) goto main::@1 [ findcol::return#0 ] + [10] if(true) goto main::@1 [ ] to:main::@return main::@return: from main::@11 - [11] return [ findcol::return#0 ] + [11] return [ ] to:@RETURN animate: from main::@10 - [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 findcol::return#0 ] - [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 findcol::return#0 ] - [14] *((word) 4096) ← (byte~) animate::$1 [ findcol::return#0 ] - [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 findcol::return#0 ] - [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ findcol::return#0 ] + [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] + [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] + [14] *((word) 4096) ← (byte~) animate::$1 [ ] + [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] + [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ ] to:animate::@2 animate::@2: from animate animate::@1 - [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 findcol::return#0 ] - [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 findcol::return#0 ] - [19] *((word) 4352) ← (byte~) animate::$5 [ findcol::return#0 ] - [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 findcol::return#0 ] - [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ findcol::return#0 ] + [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 ] + [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 ] + [19] *((word) 4352) ← (byte~) animate::$5 [ ] + [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 ] + [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ ] to:animate::@4 animate::@4: from animate::@2 animate::@3 - [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 findcol::return#0 ] - [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 findcol::return#0 ] - [24] *((word) 4097) ← (byte~) animate::$9 [ findcol::return#0 ] - [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 findcol::return#0 ] - [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ findcol::return#0 ] + [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 ] + [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 ] + [24] *((word) 4097) ← (byte~) animate::$9 [ ] + [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] + [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ ] to:animate::@6 animate::@6: from animate::@4 animate::@5 - [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 findcol::return#0 ] - [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 findcol::return#0 ] - [29] *((word) 4354) ← (byte~) animate::$13 [ findcol::return#0 ] - [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 findcol::return#0 ] - [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ findcol::return#0 ] + [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 ] + [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 ] + [29] *((word) 4354) ← (byte~) animate::$13 [ ] + [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 ] + [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ ] to:animate::@8 animate::@8: from animate::@6 animate::@7 - [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 findcol::return#0 ] - [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 findcol::return#0 ] - [34] *((word) 4355) ← (byte~) animate::$17 [ findcol::return#0 ] - [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 findcol::return#0 ] - [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ findcol::return#0 ] + [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 ] + [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 ] + [34] *((word) 4355) ← (byte~) animate::$17 [ ] + [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 ] + [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ ] to:animate::@return animate::@return: from animate::@11 animate::@8 animate::@9 - [37] return [ findcol::return#0 ] + [37] return [ ] to:@RETURN animate::@9: from animate::@8 - [38] *((word) 4355) ← (byte) 25 [ findcol::return#0 ] - [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 findcol::return#0 ] - [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 findcol::return#0 ] - [41] *((word) 4099) ← (byte~) animate::$21 [ findcol::return#0 ] - [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 findcol::return#0 ] - [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ findcol::return#0 ] + [38] *((word) 4355) ← (byte) 25 [ ] + [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 ] + [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 ] + [41] *((word) 4099) ← (byte~) animate::$21 [ ] + [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 ] + [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ ] to:animate::@return animate::@11: from animate::@9 - [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 findcol::return#0 ] - [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 findcol::return#0 ] - [46] *((word) 4099) ← (byte~) animate::$25 [ findcol::return#0 ] + [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 ] + [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 ] + [46] *((word) 4099) ← (byte~) animate::$25 [ ] to:animate::@return animate::@7: from animate::@6 - [47] *((word) 4354) ← (byte) 0 [ findcol::return#0 ] + [47] *((word) 4354) ← (byte) 0 [ ] to:animate::@8 animate::@5: from animate::@4 - [48] *((word) 4097) ← (byte) 40 [ findcol::return#0 ] + [48] *((word) 4097) ← (byte) 40 [ ] to:animate::@6 animate::@3: from animate::@2 - [49] *((word) 4352) ← (byte) 0 [ findcol::return#0 ] + [49] *((word) 4352) ← (byte) 0 [ ] to:animate::@4 animate::@1: from animate - [50] *((word) 4096) ← (byte) 0 [ findcol::return#0 ] + [50] *((word) 4096) ← (byte) 0 [ ] to:animate::@2 render: from main::@1 to:render::@1 render::@1: from render render::@3 - [51] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@3/(byte*) render::colline#1 ) [ render::y#2 findcol::return#0 render::colline#2 ] - [51] (byte) render::y#2 ← phi( render/(byte) 0 render::@3/(byte) render::y#1 ) [ render::y#2 findcol::return#0 render::colline#2 ] + [51] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@3/(byte*) render::colline#1 ) [ render::y#2 render::colline#2 ] + [51] (byte) render::y#2 ← phi( render/(byte) 0 render::@3/(byte) render::y#1 ) [ render::y#2 render::colline#2 ] to:render::@2 render::@2: from render::@1 render::@5 - [52] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@5/(byte) render::x#1 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] - [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 ] - [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] - [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] + [52] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@5/(byte) render::x#1 ) [ render::x#2 render::y#2 render::colline#2 ] + [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 ] + [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 ] + [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] to:render::@5 render::@5: from render::@2 - [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 render::col#0 ] - [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] - [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 findcol::return#0 render::colline#2 ] - [59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 findcol::return#0 render::colline#2 ] + [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] + [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 render::colline#2 ] + [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ] + [59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ] to:render::@3 render::@3: from render::@5 - [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 findcol::return#0 ] - [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 findcol::return#0 ] - [62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 findcol::return#0 ] + [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] + [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] + [62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ] to:render::@return render::@return: from render::@3 - [63] return [ findcol::return#0 ] + [63] return [ ] to:@RETURN findcol: from render::@2 to:findcol::@1 @@ -159,8 +159,8 @@ findcol::@13: from findcol::@11 findcol::@12 [78] if((byte) findcol::i#1<(byte) 6) goto findcol::@1 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] to:findcol::@return findcol::@return: from findcol::@13 findcol::@2 - [79] (byte) findcol::return#0 ← phi( findcol::@13/(byte) findcol::mincol#2 findcol::@2/(byte) 0 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] - [80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] + [79] (byte) findcol::return#0 ← phi( findcol::@13/(byte) findcol::mincol#2 findcol::@2/(byte) 0 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + [80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] to:@RETURN findcol::@12: from findcol::@11 [81] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 ] @@ -179,23 +179,23 @@ findcol::@2: from findcol::@1 initscreen: from main::@8 to:initscreen::@1 initscreen::@1: from initscreen initscreen::@1 - [87] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@1/(byte*) initscreen::screen#1 ) [ findcol::return#0 initscreen::screen#2 ] - [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ findcol::return#0 initscreen::screen#2 ] - [89] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ findcol::return#0 initscreen::screen#1 ] - [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ findcol::return#0 initscreen::screen#1 ] + [87] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@1/(byte*) initscreen::screen#1 ) [ initscreen::screen#2 ] + [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] + [89] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] + [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ initscreen::screen#1 ] to:initscreen::@return initscreen::@return: from initscreen::@1 - [91] return [ findcol::return#0 ] + [91] return [ ] to:@RETURN addpoint: from main main::@3 main::@4 main::@5 main::@6 main::@7 - [92] (byte) addpoint::c#6 ← phi( main/(byte) 1 main::@3/(byte) 2 main::@4/(byte) 3 main::@5/(byte) 4 main::@6/(byte) 5 main::@7/(byte) 7 ) [ findcol::return#0 addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [92] (byte) addpoint::y#6 ← phi( main/(byte) 5 main::@3/(byte) 8 main::@4/(byte) 14 main::@5/(byte) 2 main::@6/(byte) 17 main::@7/(byte) 22 ) [ findcol::return#0 addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [92] (byte) addpoint::idx#6 ← phi( main/(byte) 0 main::@3/(byte) 1 main::@4/(byte) 2 main::@5/(byte) 3 main::@6/(byte) 4 main::@7/(byte) 5 ) [ findcol::return#0 addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [92] (byte) addpoint::x#6 ← phi( main/(byte) 5 main::@3/(byte) 15 main::@4/(byte) 6 main::@5/(byte) 34 main::@6/(byte) 21 main::@7/(byte) 31 ) [ findcol::return#0 addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ findcol::return#0 addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] - [94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ findcol::return#0 addpoint::idx#6 addpoint::c#6 ] - [95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ findcol::return#0 ] + [92] (byte) addpoint::c#6 ← phi( main/(byte) 1 main::@3/(byte) 2 main::@4/(byte) 3 main::@5/(byte) 4 main::@6/(byte) 5 main::@7/(byte) 7 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] + [92] (byte) addpoint::y#6 ← phi( main/(byte) 5 main::@3/(byte) 8 main::@4/(byte) 14 main::@5/(byte) 2 main::@6/(byte) 17 main::@7/(byte) 22 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] + [92] (byte) addpoint::idx#6 ← phi( main/(byte) 0 main::@3/(byte) 1 main::@4/(byte) 2 main::@5/(byte) 3 main::@6/(byte) 4 main::@7/(byte) 5 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] + [92] (byte) addpoint::x#6 ← phi( main/(byte) 5 main::@3/(byte) 15 main::@4/(byte) 6 main::@5/(byte) 34 main::@6/(byte) 21 main::@7/(byte) 31 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] + [93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] + [94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ addpoint::idx#6 addpoint::c#6 ] + [95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ ] to:addpoint::@return addpoint::@return: from addpoint - [96] return [ findcol::return#0 ] + [96] return [ ] to:@RETURN diff --git a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log index ed1d40b76..91a6e4387 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log @@ -968,6 +968,8 @@ findcol::@27: from findcol::@13 to:findcol::@return @END: from @BEGIN +PROCEDURE MODIFY VARIABLE ANALYSIS + CONTROL FLOW GRAPH WITH ASSIGNMENT CALL @BEGIN: from (byte*) SCREEN ← (word) 1024 @@ -6122,150 +6124,139 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... CONTROL FLOW GRAPH - LIVE RANGES @BEGIN: from - [0] call main param-assignment [ findcol::return#0 ] + [0] call main param-assignment [ ] to:@END @END: from @BEGIN main: from @BEGIN - [1] call addpoint param-assignment [ findcol::return#0 ] + [1] call addpoint param-assignment [ ] to:main::@3 main::@3: from main - [2] call addpoint param-assignment [ findcol::return#0 ] + [2] call addpoint param-assignment [ ] to:main::@4 main::@4: from main::@3 - [3] call addpoint param-assignment [ findcol::return#0 ] + [3] call addpoint param-assignment [ ] to:main::@5 main::@5: from main::@4 - [4] call addpoint param-assignment [ findcol::return#0 ] + [4] call addpoint param-assignment [ ] to:main::@6 main::@6: from main::@5 - [5] call addpoint param-assignment [ findcol::return#0 ] + [5] call addpoint param-assignment [ ] to:main::@7 main::@7: from main::@6 - [6] call addpoint param-assignment [ findcol::return#0 ] + [6] call addpoint param-assignment [ ] to:main::@8 main::@8: from main::@7 - [7] call initscreen param-assignment [ findcol::return#0 ] + [7] call initscreen param-assignment [ ] to:main::@1 main::@1: from main::@11 main::@8 - [8] call render param-assignment [ findcol::return#0 ] + [8] call render param-assignment [ ] to:main::@10 main::@10: from main::@1 - [9] call animate param-assignment [ findcol::return#0 ] + [9] call animate param-assignment [ ] to:main::@11 main::@11: from main::@10 - [10] if(true) goto main::@1 [ findcol::return#0 ] + [10] if(true) goto main::@1 [ ] to:main::@return main::@return: from main::@11 - [11] return [ findcol::return#0 ] + [11] return [ ] to:@RETURN animate: from main::@10 - [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 findcol::return#0 ] - [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 findcol::return#0 ] - [14] *((word) 4096) ← (byte~) animate::$1 [ findcol::return#0 ] - [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 findcol::return#0 ] - [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ findcol::return#0 ] + [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] + [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] + [14] *((word) 4096) ← (byte~) animate::$1 [ ] + [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] + [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ ] to:animate::@2 animate::@2: from animate animate::@1 - [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 findcol::return#0 ] - [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 findcol::return#0 ] - [19] *((word) 4352) ← (byte~) animate::$5 [ findcol::return#0 ] - [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 findcol::return#0 ] - [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ findcol::return#0 ] + [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 ] + [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 ] + [19] *((word) 4352) ← (byte~) animate::$5 [ ] + [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 ] + [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ ] to:animate::@4 animate::@4: from animate::@2 animate::@3 - [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 findcol::return#0 ] - [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 findcol::return#0 ] - [24] *((word) 4097) ← (byte~) animate::$9 [ findcol::return#0 ] - [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 findcol::return#0 ] - [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ findcol::return#0 ] + [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 ] + [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 ] + [24] *((word) 4097) ← (byte~) animate::$9 [ ] + [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] + [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ ] to:animate::@6 animate::@6: from animate::@4 animate::@5 - [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 findcol::return#0 ] - [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 findcol::return#0 ] - [29] *((word) 4354) ← (byte~) animate::$13 [ findcol::return#0 ] - [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 findcol::return#0 ] - [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ findcol::return#0 ] + [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 ] + [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 ] + [29] *((word) 4354) ← (byte~) animate::$13 [ ] + [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 ] + [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ ] to:animate::@8 animate::@8: from animate::@6 animate::@7 - [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 findcol::return#0 ] - [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 findcol::return#0 ] - [34] *((word) 4355) ← (byte~) animate::$17 [ findcol::return#0 ] - [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 findcol::return#0 ] - [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ findcol::return#0 ] + [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 ] + [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 ] + [34] *((word) 4355) ← (byte~) animate::$17 [ ] + [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 ] + [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ ] to:animate::@return animate::@return: from animate::@11 animate::@8 animate::@9 - [37] return [ findcol::return#0 ] + [37] return [ ] to:@RETURN animate::@9: from animate::@8 - [38] *((word) 4355) ← (byte) 25 [ findcol::return#0 ] - [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 findcol::return#0 ] - [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 findcol::return#0 ] - [41] *((word) 4099) ← (byte~) animate::$21 [ findcol::return#0 ] - [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 findcol::return#0 ] - [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ findcol::return#0 ] + [38] *((word) 4355) ← (byte) 25 [ ] + [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 ] + [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 ] + [41] *((word) 4099) ← (byte~) animate::$21 [ ] + [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 ] + [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ ] to:animate::@return animate::@11: from animate::@9 - [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 findcol::return#0 ] - [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 findcol::return#0 ] - [46] *((word) 4099) ← (byte~) animate::$25 [ findcol::return#0 ] + [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 ] + [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 ] + [46] *((word) 4099) ← (byte~) animate::$25 [ ] to:animate::@return animate::@7: from animate::@6 - [47] *((word) 4354) ← (byte) 0 [ findcol::return#0 ] + [47] *((word) 4354) ← (byte) 0 [ ] to:animate::@8 animate::@5: from animate::@4 - [48] *((word) 4097) ← (byte) 40 [ findcol::return#0 ] + [48] *((word) 4097) ← (byte) 40 [ ] to:animate::@6 animate::@3: from animate::@2 - [49] *((word) 4352) ← (byte) 0 [ findcol::return#0 ] + [49] *((word) 4352) ← (byte) 0 [ ] to:animate::@4 animate::@1: from animate - [50] *((word) 4096) ← (byte) 0 [ findcol::return#0 ] + [50] *((word) 4096) ← (byte) 0 [ ] to:animate::@2 render: from main::@1 to:render::@1 render::@1: from render render::@6 - [51] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@6/(byte*~) render::colline#6 ) [ render::y#2 findcol::return#0 render::colline#2 ] - [51] (byte) render::y#2 ← phi( render/(byte) 0 render::@6/(byte~) render::y#6 ) [ render::y#2 findcol::return#0 render::colline#2 ] + [51] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@6/(byte*~) render::colline#6 ) [ render::y#2 render::colline#2 ] + [51] (byte) render::y#2 ← phi( render/(byte) 0 render::@6/(byte~) render::y#6 ) [ render::y#2 render::colline#2 ] to:render::@2 render::@2: from render::@1 render::@7 - [52] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@7/(byte~) render::x#4 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] - [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 ] - [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] - [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] + [52] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@7/(byte~) render::x#4 ) [ render::x#2 render::y#2 render::colline#2 ] + [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 ] + [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 ] + [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] to:render::@5 render::@5: from render::@2 - [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 render::col#0 ] - [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] - [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::y#2 findcol::return#0 render::colline#2 render::x#1 ] - [59] if((byte) render::x#1<(byte) 40) goto render::@7 [ render::y#2 findcol::return#0 render::colline#2 render::x#1 ] + [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] + [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 render::colline#2 ] + [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::y#2 render::colline#2 render::x#1 ] + [59] if((byte) render::x#1<(byte) 40) goto render::@7 [ render::y#2 render::colline#2 render::x#1 ] to:render::@3 render::@3: from render::@5 - [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 findcol::return#0 render::colline#1 ] - [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ findcol::return#0 render::y#1 render::colline#1 ] - [62] if((byte) render::y#1<(byte) 25) goto render::@6 [ findcol::return#0 render::y#1 render::colline#1 ] + [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 render::colline#1 ] + [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] + [62] if((byte) render::y#1<(byte) 25) goto render::@6 [ render::y#1 render::colline#1 ] to:render::@return render::@return: from render::@3 - [63] return [ findcol::return#0 ] + [63] return [ ] to:@RETURN render::@6: from render::@3 - [64] (byte~) render::y#6 ← (byte) render::y#1 [ render::y#6 findcol::return#0 render::colline#1 ] - [65] (byte*~) render::colline#6 ← (byte*) render::colline#1 [ render::y#6 render::colline#6 findcol::return#0 ] + [64] (byte~) render::y#6 ← (byte) render::y#1 [ render::y#6 render::colline#1 ] + [65] (byte*~) render::colline#6 ← (byte*) render::colline#1 [ render::y#6 render::colline#6 ] to:render::@1 render::@7: from render::@5 - [66] (byte~) render::x#4 ← (byte) render::x#1 [ render::x#4 render::y#2 findcol::return#0 render::colline#2 ] + [66] (byte~) render::x#4 ← (byte) render::x#1 [ render::x#4 render::y#2 render::colline#2 ] to:render::@2 findcol: from render::@2 to:findcol::@1 @@ -6308,11 +6299,11 @@ findcol::@13: from findcol::@12 findcol::@30 [85] if((byte) findcol::i#1<(byte) 6) goto findcol::@29 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] to:findcol::@31 findcol::@31: from findcol::@13 - [86] (byte~) findcol::mincol#16 ← (byte) findcol::mincol#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 findcol::mincol#16 ] + [86] (byte~) findcol::mincol#16 ← (byte) findcol::mincol#2 [ render::x#2 render::y#2 render::colline#2 findcol::mincol#16 ] to:findcol::@return findcol::@return: from findcol::@2 findcol::@31 - [87] (byte) findcol::return#0 ← phi( findcol::@31/(byte~) findcol::mincol#16 findcol::@2/(byte) 0 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] - [88] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] + [87] (byte) findcol::return#0 ← phi( findcol::@31/(byte~) findcol::mincol#16 findcol::@2/(byte) 0 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + [88] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] to:@RETURN findcol::@29: from findcol::@13 [89] (byte~) findcol::i#13 ← (byte) findcol::i#1 [ render::x#2 render::y#2 render::colline#2 findcol::i#13 findcol::x#0 findcol::y#0 findcol::mincol#2 findcol::mindiff#11 ] @@ -6339,28 +6330,28 @@ findcol::@2: from findcol::@1 initscreen: from main::@8 to:initscreen::@1 initscreen::@1: from initscreen initscreen::@3 - [101] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@3/(byte*~) initscreen::screen#3 ) [ findcol::return#0 initscreen::screen#2 ] - [102] *((byte*) initscreen::screen#2) ← (byte) 230 [ findcol::return#0 initscreen::screen#2 ] - [103] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ findcol::return#0 initscreen::screen#1 ] - [104] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@3 [ findcol::return#0 initscreen::screen#1 ] + [101] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@3/(byte*~) initscreen::screen#3 ) [ initscreen::screen#2 ] + [102] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] + [103] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] + [104] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@3 [ initscreen::screen#1 ] to:initscreen::@return initscreen::@return: from initscreen::@1 - [105] return [ findcol::return#0 ] + [105] return [ ] to:@RETURN initscreen::@3: from initscreen::@1 - [106] (byte*~) initscreen::screen#3 ← (byte*) initscreen::screen#1 [ findcol::return#0 initscreen::screen#3 ] + [106] (byte*~) initscreen::screen#3 ← (byte*) initscreen::screen#1 [ initscreen::screen#3 ] to:initscreen::@1 addpoint: from main main::@3 main::@4 main::@5 main::@6 main::@7 - [107] (byte) addpoint::c#6 ← phi( main/(byte) 1 main::@3/(byte) 2 main::@4/(byte) 3 main::@5/(byte) 4 main::@6/(byte) 5 main::@7/(byte) 7 ) [ findcol::return#0 addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [107] (byte) addpoint::y#6 ← phi( main/(byte) 5 main::@3/(byte) 8 main::@4/(byte) 14 main::@5/(byte) 2 main::@6/(byte) 17 main::@7/(byte) 22 ) [ findcol::return#0 addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [107] (byte) addpoint::idx#6 ← phi( main/(byte) 0 main::@3/(byte) 1 main::@4/(byte) 2 main::@5/(byte) 3 main::@6/(byte) 4 main::@7/(byte) 5 ) [ findcol::return#0 addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [107] (byte) addpoint::x#6 ← phi( main/(byte) 5 main::@3/(byte) 15 main::@4/(byte) 6 main::@5/(byte) 34 main::@6/(byte) 21 main::@7/(byte) 31 ) [ findcol::return#0 addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [108] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ findcol::return#0 addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] - [109] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ findcol::return#0 addpoint::idx#6 addpoint::c#6 ] - [110] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ findcol::return#0 ] + [107] (byte) addpoint::c#6 ← phi( main/(byte) 1 main::@3/(byte) 2 main::@4/(byte) 3 main::@5/(byte) 4 main::@6/(byte) 5 main::@7/(byte) 7 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] + [107] (byte) addpoint::y#6 ← phi( main/(byte) 5 main::@3/(byte) 8 main::@4/(byte) 14 main::@5/(byte) 2 main::@6/(byte) 17 main::@7/(byte) 22 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] + [107] (byte) addpoint::idx#6 ← phi( main/(byte) 0 main::@3/(byte) 1 main::@4/(byte) 2 main::@5/(byte) 3 main::@6/(byte) 4 main::@7/(byte) 5 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] + [107] (byte) addpoint::x#6 ← phi( main/(byte) 5 main::@3/(byte) 15 main::@4/(byte) 6 main::@5/(byte) 34 main::@6/(byte) 21 main::@7/(byte) 31 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] + [108] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] + [109] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ addpoint::idx#6 addpoint::c#6 ] + [110] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ ] to:addpoint::@return addpoint::@return: from addpoint - [111] return [ findcol::return#0 ] + [111] return [ ] to:@RETURN Created 16 initial phi equivalence classes @@ -6404,148 +6395,132 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... -Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @BEGIN: from - [0] call main param-assignment [ findcol::return#0 ] + [0] call main param-assignment [ ] to:@END @END: from @BEGIN main: from @BEGIN - [1] call addpoint param-assignment [ findcol::return#0 ] + [1] call addpoint param-assignment [ ] to:main::@3 main::@3: from main - [2] call addpoint param-assignment [ findcol::return#0 ] + [2] call addpoint param-assignment [ ] to:main::@4 main::@4: from main::@3 - [3] call addpoint param-assignment [ findcol::return#0 ] + [3] call addpoint param-assignment [ ] to:main::@5 main::@5: from main::@4 - [4] call addpoint param-assignment [ findcol::return#0 ] + [4] call addpoint param-assignment [ ] to:main::@6 main::@6: from main::@5 - [5] call addpoint param-assignment [ findcol::return#0 ] + [5] call addpoint param-assignment [ ] to:main::@7 main::@7: from main::@6 - [6] call addpoint param-assignment [ findcol::return#0 ] + [6] call addpoint param-assignment [ ] to:main::@8 main::@8: from main::@7 - [7] call initscreen param-assignment [ findcol::return#0 ] + [7] call initscreen param-assignment [ ] to:main::@1 main::@1: from main::@11 main::@8 - [8] call render param-assignment [ findcol::return#0 ] + [8] call render param-assignment [ ] to:main::@10 main::@10: from main::@1 - [9] call animate param-assignment [ findcol::return#0 ] + [9] call animate param-assignment [ ] to:main::@11 main::@11: from main::@10 - [10] if(true) goto main::@1 [ findcol::return#0 ] + [10] if(true) goto main::@1 [ ] to:main::@return main::@return: from main::@11 - [11] return [ findcol::return#0 ] + [11] return [ ] to:@RETURN animate: from main::@10 - [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 findcol::return#0 ] - [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 findcol::return#0 ] - [14] *((word) 4096) ← (byte~) animate::$1 [ findcol::return#0 ] - [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 findcol::return#0 ] - [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ findcol::return#0 ] + [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] + [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] + [14] *((word) 4096) ← (byte~) animate::$1 [ ] + [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] + [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ ] to:animate::@2 animate::@2: from animate animate::@1 - [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 findcol::return#0 ] - [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 findcol::return#0 ] - [19] *((word) 4352) ← (byte~) animate::$5 [ findcol::return#0 ] - [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 findcol::return#0 ] - [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ findcol::return#0 ] + [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 ] + [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 ] + [19] *((word) 4352) ← (byte~) animate::$5 [ ] + [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 ] + [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ ] to:animate::@4 animate::@4: from animate::@2 animate::@3 - [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 findcol::return#0 ] - [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 findcol::return#0 ] - [24] *((word) 4097) ← (byte~) animate::$9 [ findcol::return#0 ] - [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 findcol::return#0 ] - [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ findcol::return#0 ] + [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 ] + [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 ] + [24] *((word) 4097) ← (byte~) animate::$9 [ ] + [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] + [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ ] to:animate::@6 animate::@6: from animate::@4 animate::@5 - [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 findcol::return#0 ] - [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 findcol::return#0 ] - [29] *((word) 4354) ← (byte~) animate::$13 [ findcol::return#0 ] - [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 findcol::return#0 ] - [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ findcol::return#0 ] + [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 ] + [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 ] + [29] *((word) 4354) ← (byte~) animate::$13 [ ] + [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 ] + [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ ] to:animate::@8 animate::@8: from animate::@6 animate::@7 - [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 findcol::return#0 ] - [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 findcol::return#0 ] - [34] *((word) 4355) ← (byte~) animate::$17 [ findcol::return#0 ] - [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 findcol::return#0 ] - [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ findcol::return#0 ] + [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 ] + [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 ] + [34] *((word) 4355) ← (byte~) animate::$17 [ ] + [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 ] + [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ ] to:animate::@return animate::@return: from animate::@11 animate::@8 animate::@9 - [37] return [ findcol::return#0 ] + [37] return [ ] to:@RETURN animate::@9: from animate::@8 - [38] *((word) 4355) ← (byte) 25 [ findcol::return#0 ] - [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 findcol::return#0 ] - [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 findcol::return#0 ] - [41] *((word) 4099) ← (byte~) animate::$21 [ findcol::return#0 ] - [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 findcol::return#0 ] - [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ findcol::return#0 ] + [38] *((word) 4355) ← (byte) 25 [ ] + [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 ] + [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 ] + [41] *((word) 4099) ← (byte~) animate::$21 [ ] + [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 ] + [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ ] to:animate::@return animate::@11: from animate::@9 - [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 findcol::return#0 ] - [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 findcol::return#0 ] - [46] *((word) 4099) ← (byte~) animate::$25 [ findcol::return#0 ] + [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 ] + [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 ] + [46] *((word) 4099) ← (byte~) animate::$25 [ ] to:animate::@return animate::@7: from animate::@6 - [47] *((word) 4354) ← (byte) 0 [ findcol::return#0 ] + [47] *((word) 4354) ← (byte) 0 [ ] to:animate::@8 animate::@5: from animate::@4 - [48] *((word) 4097) ← (byte) 40 [ findcol::return#0 ] + [48] *((word) 4097) ← (byte) 40 [ ] to:animate::@6 animate::@3: from animate::@2 - [49] *((word) 4352) ← (byte) 0 [ findcol::return#0 ] + [49] *((word) 4352) ← (byte) 0 [ ] to:animate::@4 animate::@1: from animate - [50] *((word) 4096) ← (byte) 0 [ findcol::return#0 ] + [50] *((word) 4096) ← (byte) 0 [ ] to:animate::@2 render: from main::@1 to:render::@1 render::@1: from render render::@3 - [51] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@3/(byte*) render::colline#1 ) [ render::y#2 findcol::return#0 render::colline#2 ] - [51] (byte) render::y#2 ← phi( render/(byte) 0 render::@3/(byte) render::y#1 ) [ render::y#2 findcol::return#0 render::colline#2 ] + [51] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@3/(byte*) render::colline#1 ) [ render::y#2 render::colline#2 ] + [51] (byte) render::y#2 ← phi( render/(byte) 0 render::@3/(byte) render::y#1 ) [ render::y#2 render::colline#2 ] to:render::@2 render::@2: from render::@1 render::@5 - [52] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@5/(byte) render::x#1 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] - [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 ] - [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] - [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] + [52] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@5/(byte) render::x#1 ) [ render::x#2 render::y#2 render::colline#2 ] + [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 ] + [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 ] + [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] to:render::@5 render::@5: from render::@2 - [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 render::col#0 ] - [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] - [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 findcol::return#0 render::colline#2 ] - [59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 findcol::return#0 render::colline#2 ] + [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] + [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 render::colline#2 ] + [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ] + [59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ] to:render::@3 render::@3: from render::@5 - [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 findcol::return#0 ] - [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 findcol::return#0 ] - [62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 findcol::return#0 ] + [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] + [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] + [62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ] to:render::@return render::@return: from render::@3 - [63] return [ findcol::return#0 ] + [63] return [ ] to:@RETURN findcol: from render::@2 to:findcol::@1 @@ -6582,8 +6557,8 @@ findcol::@13: from findcol::@11 findcol::@12 [78] if((byte) findcol::i#1<(byte) 6) goto findcol::@1 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] to:findcol::@return findcol::@return: from findcol::@13 findcol::@2 - [79] (byte) findcol::return#0 ← phi( findcol::@13/(byte) findcol::mincol#2 findcol::@2/(byte) 0 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] - [80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] + [79] (byte) findcol::return#0 ← phi( findcol::@13/(byte) findcol::mincol#2 findcol::@2/(byte) 0 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + [80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] to:@RETURN findcol::@12: from findcol::@11 [81] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 ] @@ -6602,25 +6577,25 @@ findcol::@2: from findcol::@1 initscreen: from main::@8 to:initscreen::@1 initscreen::@1: from initscreen initscreen::@1 - [87] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@1/(byte*) initscreen::screen#1 ) [ findcol::return#0 initscreen::screen#2 ] - [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ findcol::return#0 initscreen::screen#2 ] - [89] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ findcol::return#0 initscreen::screen#1 ] - [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ findcol::return#0 initscreen::screen#1 ] + [87] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@1/(byte*) initscreen::screen#1 ) [ initscreen::screen#2 ] + [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] + [89] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] + [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ initscreen::screen#1 ] to:initscreen::@return initscreen::@return: from initscreen::@1 - [91] return [ findcol::return#0 ] + [91] return [ ] to:@RETURN addpoint: from main main::@3 main::@4 main::@5 main::@6 main::@7 - [92] (byte) addpoint::c#6 ← phi( main/(byte) 1 main::@3/(byte) 2 main::@4/(byte) 3 main::@5/(byte) 4 main::@6/(byte) 5 main::@7/(byte) 7 ) [ findcol::return#0 addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [92] (byte) addpoint::y#6 ← phi( main/(byte) 5 main::@3/(byte) 8 main::@4/(byte) 14 main::@5/(byte) 2 main::@6/(byte) 17 main::@7/(byte) 22 ) [ findcol::return#0 addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [92] (byte) addpoint::idx#6 ← phi( main/(byte) 0 main::@3/(byte) 1 main::@4/(byte) 2 main::@5/(byte) 3 main::@6/(byte) 4 main::@7/(byte) 5 ) [ findcol::return#0 addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [92] (byte) addpoint::x#6 ← phi( main/(byte) 5 main::@3/(byte) 15 main::@4/(byte) 6 main::@5/(byte) 34 main::@6/(byte) 21 main::@7/(byte) 31 ) [ findcol::return#0 addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ findcol::return#0 addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] - [94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ findcol::return#0 addpoint::idx#6 addpoint::c#6 ] - [95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ findcol::return#0 ] + [92] (byte) addpoint::c#6 ← phi( main/(byte) 1 main::@3/(byte) 2 main::@4/(byte) 3 main::@5/(byte) 4 main::@6/(byte) 5 main::@7/(byte) 7 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] + [92] (byte) addpoint::y#6 ← phi( main/(byte) 5 main::@3/(byte) 8 main::@4/(byte) 14 main::@5/(byte) 2 main::@6/(byte) 17 main::@7/(byte) 22 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] + [92] (byte) addpoint::idx#6 ← phi( main/(byte) 0 main::@3/(byte) 1 main::@4/(byte) 2 main::@5/(byte) 3 main::@6/(byte) 4 main::@7/(byte) 5 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] + [92] (byte) addpoint::x#6 ← phi( main/(byte) 5 main::@3/(byte) 15 main::@4/(byte) 6 main::@5/(byte) 34 main::@6/(byte) 21 main::@7/(byte) 31 ) [ addpoint::idx#6 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] + [93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] + [94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ addpoint::idx#6 addpoint::c#6 ] + [95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ ] to:addpoint::@return addpoint::@return: from addpoint - [96] return [ findcol::return#0 ] + [96] return [ ] to:@RETURN CALL GRAPH @@ -6775,13 +6750,13 @@ VARIABLE REGISTER WEIGHTS (byte) findcol::mindiff#10 1875.1875 (byte) findcol::mindiff#11 10001.0 (byte) findcol::return -(byte) findcol::return#0 144.76315789473685 +(byte) findcol::return#0 3667.333333333333 (byte) findcol::x -(byte) findcol::x#0 1577.1153846153845 +(byte) findcol::x#0 1782.8260869565217 (byte) findcol::xp (byte) findcol::xp#0 10001.0 (byte) findcol::y -(byte) findcol::y#0 1640.2 +(byte) findcol::y#0 1863.8636363636363 (byte) findcol::yp (byte) findcol::yp#0 6250.625 (void()) initscreen() @@ -6928,14 +6903,14 @@ Allocated zp byte:43 to zp byte:43 [ findcol::$8 ] INITIAL ASM //SEG0 @BEGIN BBEGIN: -//SEG1 [0] call main param-assignment [ findcol::return#0 ] +//SEG1 [0] call main param-assignment [ ] jsr main jmp BEND //SEG2 @END BEND: //SEG3 main main: -//SEG4 [1] call addpoint param-assignment [ findcol::return#0 ] +//SEG4 [1] call addpoint param-assignment [ ] //SEG5 [92] phi from main to addpoint addpoint_from_main: //SEG6 [92] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 @@ -6954,7 +6929,7 @@ addpoint_from_main: jmp main__B3 //SEG10 main::@3 main__B3: -//SEG11 [2] call addpoint param-assignment [ findcol::return#0 ] +//SEG11 [2] call addpoint param-assignment [ ] //SEG12 [92] phi from main::@3 to addpoint addpoint_from_B3: //SEG13 [92] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 @@ -6973,7 +6948,7 @@ addpoint_from_B3: jmp main__B4 //SEG17 main::@4 main__B4: -//SEG18 [3] call addpoint param-assignment [ findcol::return#0 ] +//SEG18 [3] call addpoint param-assignment [ ] //SEG19 [92] phi from main::@4 to addpoint addpoint_from_B4: //SEG20 [92] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 @@ -6992,7 +6967,7 @@ addpoint_from_B4: jmp main__B5 //SEG24 main::@5 main__B5: -//SEG25 [4] call addpoint param-assignment [ findcol::return#0 ] +//SEG25 [4] call addpoint param-assignment [ ] //SEG26 [92] phi from main::@5 to addpoint addpoint_from_B5: //SEG27 [92] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 @@ -7011,7 +6986,7 @@ addpoint_from_B5: jmp main__B6 //SEG31 main::@6 main__B6: -//SEG32 [5] call addpoint param-assignment [ findcol::return#0 ] +//SEG32 [5] call addpoint param-assignment [ ] //SEG33 [92] phi from main::@6 to addpoint addpoint_from_B6: //SEG34 [92] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 @@ -7030,7 +7005,7 @@ addpoint_from_B6: jmp main__B7 //SEG38 main::@7 main__B7: -//SEG39 [6] call addpoint param-assignment [ findcol::return#0 ] +//SEG39 [6] call addpoint param-assignment [ ] //SEG40 [92] phi from main::@7 to addpoint addpoint_from_B7: //SEG41 [92] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 @@ -7049,196 +7024,196 @@ addpoint_from_B7: jmp main__B8 //SEG45 main::@8 main__B8: -//SEG46 [7] call initscreen param-assignment [ findcol::return#0 ] +//SEG46 [7] call initscreen param-assignment [ ] jsr initscreen jmp main__B1 //SEG47 main::@1 main__B1: -//SEG48 [8] call render param-assignment [ findcol::return#0 ] +//SEG48 [8] call render param-assignment [ ] jsr render jmp main__B10 //SEG49 main::@10 main__B10: -//SEG50 [9] call animate param-assignment [ findcol::return#0 ] +//SEG50 [9] call animate param-assignment [ ] jsr animate jmp main__B11 //SEG51 main::@11 main__B11: -//SEG52 [10] if(true) goto main::@1 [ findcol::return#0 ] -- true_then_la1 +//SEG52 [10] if(true) goto main::@1 [ ] -- true_then_la1 jmp main__B1 jmp main__Breturn //SEG53 main::@return main__Breturn: -//SEG54 [11] return [ findcol::return#0 ] +//SEG54 [11] return [ ] rts //SEG55 animate animate: -//SEG56 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG56 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- zpby1=_star_cowo1 lda 4096 sta 17 -//SEG57 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 findcol::return#0 ] -- zpby1=zpby2_plus_1 +//SEG57 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- zpby1=zpby2_plus_1 lda 17 clc adc #1 sta 18 -//SEG58 [14] *((word) 4096) ← (byte~) animate::$1 [ findcol::return#0 ] -- _star_cowo1=zpby1 +//SEG58 [14] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=zpby1 lda 18 sta 4096 -//SEG59 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG59 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- zpby1=_star_cowo1 lda 4096 sta 19 -//SEG60 [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ findcol::return#0 ] -- zpby1_eq_coby1_then_la1 +//SEG60 [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ ] -- zpby1_eq_coby1_then_la1 lda 19 cmp #40 beq animate__B1 jmp animate__B2 //SEG61 animate::@2 animate__B2: -//SEG62 [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG62 [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 ] -- zpby1=_star_cowo1 lda 4352 sta 20 -//SEG63 [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 findcol::return#0 ] -- zpby1=zpby2_plus_1 +//SEG63 [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 ] -- zpby1=zpby2_plus_1 lda 20 clc adc #1 sta 21 -//SEG64 [19] *((word) 4352) ← (byte~) animate::$5 [ findcol::return#0 ] -- _star_cowo1=zpby1 +//SEG64 [19] *((word) 4352) ← (byte~) animate::$5 [ ] -- _star_cowo1=zpby1 lda 21 sta 4352 -//SEG65 [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG65 [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 ] -- zpby1=_star_cowo1 lda 4352 sta 22 -//SEG66 [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ findcol::return#0 ] -- zpby1_eq_coby1_then_la1 +//SEG66 [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ ] -- zpby1_eq_coby1_then_la1 lda 22 cmp #25 beq animate__B3 jmp animate__B4 //SEG67 animate::@4 animate__B4: -//SEG68 [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG68 [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 ] -- zpby1=_star_cowo1 lda 4097 sta 23 -//SEG69 [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 findcol::return#0 ] -- zpby1=zpby2_minus_1 +//SEG69 [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 ] -- zpby1=zpby2_minus_1 lda 23 sec sbc #1 sta 24 -//SEG70 [24] *((word) 4097) ← (byte~) animate::$9 [ findcol::return#0 ] -- _star_cowo1=zpby1 +//SEG70 [24] *((word) 4097) ← (byte~) animate::$9 [ ] -- _star_cowo1=zpby1 lda 24 sta 4097 -//SEG71 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG71 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- zpby1=_star_cowo1 lda 4097 sta 25 -//SEG72 [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ findcol::return#0 ] -- zpby1_eq_coby1_then_la1 +//SEG72 [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ ] -- zpby1_eq_coby1_then_la1 lda 25 cmp #255 beq animate__B5 jmp animate__B6 //SEG73 animate::@6 animate__B6: -//SEG74 [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG74 [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 ] -- zpby1=_star_cowo1 lda 4354 sta 26 -//SEG75 [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 findcol::return#0 ] -- zpby1=zpby2_plus_1 +//SEG75 [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 ] -- zpby1=zpby2_plus_1 lda 26 clc adc #1 sta 27 -//SEG76 [29] *((word) 4354) ← (byte~) animate::$13 [ findcol::return#0 ] -- _star_cowo1=zpby1 +//SEG76 [29] *((word) 4354) ← (byte~) animate::$13 [ ] -- _star_cowo1=zpby1 lda 27 sta 4354 -//SEG77 [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG77 [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 ] -- zpby1=_star_cowo1 lda 4354 sta 28 -//SEG78 [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ findcol::return#0 ] -- zpby1_eq_coby1_then_la1 +//SEG78 [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ ] -- zpby1_eq_coby1_then_la1 lda 28 cmp #25 beq animate__B7 jmp animate__B8 //SEG79 animate::@8 animate__B8: -//SEG80 [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG80 [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 ] -- zpby1=_star_cowo1 lda 4355 sta 29 -//SEG81 [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 findcol::return#0 ] -- zpby1=zpby2_minus_1 +//SEG81 [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 ] -- zpby1=zpby2_minus_1 lda 29 sec sbc #1 sta 30 -//SEG82 [34] *((word) 4355) ← (byte~) animate::$17 [ findcol::return#0 ] -- _star_cowo1=zpby1 +//SEG82 [34] *((word) 4355) ← (byte~) animate::$17 [ ] -- _star_cowo1=zpby1 lda 30 sta 4355 -//SEG83 [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG83 [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 ] -- zpby1=_star_cowo1 lda 4355 sta 31 -//SEG84 [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ findcol::return#0 ] -- zpby1_eq_coby1_then_la1 +//SEG84 [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ ] -- zpby1_eq_coby1_then_la1 lda 31 cmp #255 beq animate__B9 jmp animate__Breturn //SEG85 animate::@return animate__Breturn: -//SEG86 [37] return [ findcol::return#0 ] +//SEG86 [37] return [ ] rts //SEG87 animate::@9 animate__B9: -//SEG88 [38] *((word) 4355) ← (byte) 25 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG88 [38] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 lda #25 sta 4355 -//SEG89 [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG89 [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 ] -- zpby1=_star_cowo1 lda 4099 sta 32 -//SEG90 [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 findcol::return#0 ] -- zpby1=zpby2_plus_coby1 +//SEG90 [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 ] -- zpby1=zpby2_plus_coby1 lda 32 clc adc #7 sta 33 -//SEG91 [41] *((word) 4099) ← (byte~) animate::$21 [ findcol::return#0 ] -- _star_cowo1=zpby1 +//SEG91 [41] *((word) 4099) ← (byte~) animate::$21 [ ] -- _star_cowo1=zpby1 lda 33 sta 4099 -//SEG92 [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG92 [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 ] -- zpby1=_star_cowo1 lda 4099 sta 34 -//SEG93 [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ findcol::return#0 ] -- zpby1_ge_coby1_then_la1 +//SEG93 [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ ] -- zpby1_ge_coby1_then_la1 lda 34 cmp #40 bcs animate__B11 jmp animate__Breturn //SEG94 animate::@11 animate__B11: -//SEG95 [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 findcol::return#0 ] -- zpby1=_star_cowo1 +//SEG95 [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 ] -- zpby1=_star_cowo1 lda 4099 sta 35 -//SEG96 [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 findcol::return#0 ] -- zpby1=zpby2_minus_coby1 +//SEG96 [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 ] -- zpby1=zpby2_minus_coby1 lda 35 sec sbc #40 sta 36 -//SEG97 [46] *((word) 4099) ← (byte~) animate::$25 [ findcol::return#0 ] -- _star_cowo1=zpby1 +//SEG97 [46] *((word) 4099) ← (byte~) animate::$25 [ ] -- _star_cowo1=zpby1 lda 36 sta 4099 jmp animate__Breturn //SEG98 animate::@7 animate__B7: -//SEG99 [47] *((word) 4354) ← (byte) 0 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG99 [47] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #0 sta 4354 jmp animate__B8 //SEG100 animate::@5 animate__B5: -//SEG101 [48] *((word) 4097) ← (byte) 40 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG101 [48] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 lda #40 sta 4097 jmp animate__B6 //SEG102 animate::@3 animate__B3: -//SEG103 [49] *((word) 4352) ← (byte) 0 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG103 [49] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #0 sta 4352 jmp animate__B4 //SEG104 animate::@1 animate__B1: -//SEG105 [50] *((word) 4096) ← (byte) 0 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG105 [50] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #0 sta 4096 jmp animate__B2 @@ -7274,34 +7249,34 @@ render__B2_from_B5: jmp render__B2 //SEG118 render::@2 render__B2: -//SEG119 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 ] -- zpby1=zpby2 +//SEG119 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 ] -- zpby1=zpby2 lda 5 sta 37 -//SEG120 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] -- zpby1=zpby2 +//SEG120 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 ] -- zpby1=zpby2 lda 2 sta 38 -//SEG121 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] +//SEG121 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] jsr findcol jmp render__B5 //SEG122 render::@5 render__B5: -//SEG123 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 render::col#0 ] -- zpby1=zpby2 +//SEG123 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] -- zpby1=zpby2 lda 10 sta 39 -//SEG124 [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] -- zpptrby1_staridx_zpby1=zpby2 +//SEG124 [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 render::colline#2 ] -- zpptrby1_staridx_zpby1=zpby2 lda 39 ldy 5 sta (3),y -//SEG125 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 findcol::return#0 render::colline#2 ] -- zpby1=_inc_zpby1 +//SEG125 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1=_inc_zpby1 inc 5 -//SEG126 [59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 findcol::return#0 render::colline#2 ] -- zpby1_lt_coby1_then_la1 +//SEG126 [59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1_lt_coby1_then_la1 lda 5 cmp #40 bcc render__B2_from_B5 jmp render__B3 //SEG127 render::@3 render__B3: -//SEG128 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 findcol::return#0 ] -- zpptrby1=zpptrby1_plus_coby1 +//SEG128 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 lda 3 clc adc #40 @@ -7309,16 +7284,16 @@ render__B3: bcc !+ inc 3+1 !: -//SEG129 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 findcol::return#0 ] -- zpby1=_inc_zpby1 +//SEG129 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] -- zpby1=_inc_zpby1 inc 2 -//SEG130 [62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 findcol::return#0 ] -- zpby1_lt_coby1_then_la1 +//SEG130 [62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ] -- zpby1_lt_coby1_then_la1 lda 2 cmp #25 bcc render__B1_from_B3 jmp render__Breturn //SEG131 render::@return render__Breturn: -//SEG132 [63] return [ findcol::return#0 ] +//SEG132 [63] return [ ] rts //SEG133 findcol findcol: @@ -7427,7 +7402,7 @@ findcol__Breturn_from_B2: jmp findcol__Breturn //SEG171 findcol::@return findcol__Breturn: -//SEG172 [80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] +//SEG172 [80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] rts //SEG173 findcol::@12 findcol__B12: @@ -7493,16 +7468,16 @@ initscreen__B1_from_B1: jmp initscreen__B1 //SEG195 initscreen::@1 initscreen__B1: -//SEG196 [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ findcol::return#0 initscreen::screen#2 ] -- _star_zpptrby1=coby1 +//SEG196 [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #0 lda #230 sta (11),y -//SEG197 [89] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ findcol::return#0 initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 +//SEG197 [89] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc 11 bne !+ inc 11+1 !: -//SEG198 [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ findcol::return#0 initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 +//SEG198 [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda 11+1 cmp #>2048 bcc initscreen__B1_from_B1 @@ -7514,37 +7489,36 @@ initscreen__B1: jmp initscreen__Breturn //SEG199 initscreen::@return initscreen__Breturn: -//SEG200 [91] return [ findcol::return#0 ] +//SEG200 [91] return [ ] rts //SEG201 addpoint addpoint: -//SEG202 [93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ findcol::return#0 addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=zpby2 +//SEG202 [93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=zpby2 lda 13 ldx 14 sta 4096,x -//SEG203 [94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ findcol::return#0 addpoint::idx#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=zpby2 +//SEG203 [94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ addpoint::idx#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=zpby2 lda 15 ldx 14 sta 4352,x -//SEG204 [95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ findcol::return#0 ] -- cowo1_staridx_zpby1=zpby2 +//SEG204 [95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ ] -- cowo1_staridx_zpby1=zpby2 lda 16 ldx 14 sta 4608,x jmp addpoint__Breturn //SEG205 addpoint::@return addpoint__Breturn: -//SEG206 [96] return [ findcol::return#0 ] +//SEG206 [96] return [ ] rts -Statement [38] *((word) 4355) ← (byte) 25 [ findcol::return#0 ] always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp byte:10 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] -Statement [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 findcol::return#0 ] always clobbers reg byte a -Statement [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 findcol::return#0 ] always clobbers reg byte a -Statement [47] *((word) 4354) ← (byte) 0 [ findcol::return#0 ] always clobbers reg byte a -Statement [48] *((word) 4097) ← (byte) 40 [ findcol::return#0 ] always clobbers reg byte a -Statement [49] *((word) 4352) ← (byte) 0 [ findcol::return#0 ] always clobbers reg byte a -Statement [50] *((word) 4096) ← (byte) 0 [ findcol::return#0 ] always clobbers reg byte a -Statement [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 findcol::return#0 ] always clobbers reg byte a +Statement [38] *((word) 4355) ← (byte) 25 [ ] always clobbers reg byte a +Statement [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 ] always clobbers reg byte a +Statement [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 ] always clobbers reg byte a +Statement [47] *((word) 4354) ← (byte) 0 [ ] always clobbers reg byte a +Statement [48] *((word) 4097) ← (byte) 40 [ ] always clobbers reg byte a +Statement [49] *((word) 4352) ← (byte) 0 [ ] always clobbers reg byte a +Statement [50] *((word) 4096) ← (byte) 0 [ ] always clobbers reg byte a +Statement [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp byte:2 [ render::y#2 render::y#1 ] Statement [69] (byte) findcol::diff#1 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#1 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp byte:5 [ render::x#2 render::x#1 ] @@ -7553,27 +7527,27 @@ Removing always clobbered register reg byte a as potential for zp byte:37 [ find Removing always clobbered register reg byte a as potential for zp byte:38 [ findcol::y#0 ] Removing always clobbered register reg byte a as potential for zp byte:41 [ findcol::yp#0 ] Removing always clobbered register reg byte a as potential for zp byte:7 [ findcol::mindiff#10 findcol::mindiff#11 findcol::diff#13 ] +Removing always clobbered register reg byte a as potential for zp byte:10 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] Statement [72] (byte~) findcol::$10 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::$10 findcol::mindiff#10 findcol::mincol#11 ] always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp byte:8 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 ] Statement [83] (byte~) findcol::$8 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 findcol::$8 ] always clobbers reg byte a Statement [85] (byte) findcol::diff#0 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] always clobbers reg byte a -Statement [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ findcol::return#0 initscreen::screen#2 ] always clobbers reg byte a reg byte y -Removing always clobbered register reg byte y as potential for zp byte:10 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] -Statement [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ findcol::return#0 initscreen::screen#1 ] always clobbers reg byte a -Statement [38] *((word) 4355) ← (byte) 25 [ findcol::return#0 ] always clobbers reg byte a -Statement [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 findcol::return#0 ] always clobbers reg byte a -Statement [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 findcol::return#0 ] always clobbers reg byte a -Statement [47] *((word) 4354) ← (byte) 0 [ findcol::return#0 ] always clobbers reg byte a -Statement [48] *((word) 4097) ← (byte) 40 [ findcol::return#0 ] always clobbers reg byte a -Statement [49] *((word) 4352) ← (byte) 0 [ findcol::return#0 ] always clobbers reg byte a -Statement [50] *((word) 4096) ← (byte) 0 [ findcol::return#0 ] always clobbers reg byte a -Statement [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 findcol::return#0 ] always clobbers reg byte a +Statement [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] always clobbers reg byte a reg byte y +Statement [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ initscreen::screen#1 ] always clobbers reg byte a +Statement [38] *((word) 4355) ← (byte) 25 [ ] always clobbers reg byte a +Statement [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 ] always clobbers reg byte a +Statement [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 ] always clobbers reg byte a +Statement [47] *((word) 4354) ← (byte) 0 [ ] always clobbers reg byte a +Statement [48] *((word) 4097) ← (byte) 40 [ ] always clobbers reg byte a +Statement [49] *((word) 4352) ← (byte) 0 [ ] always clobbers reg byte a +Statement [50] *((word) 4096) ← (byte) 0 [ ] always clobbers reg byte a +Statement [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] always clobbers reg byte a Statement [69] (byte) findcol::diff#1 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#1 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] always clobbers reg byte a Statement [72] (byte~) findcol::$10 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::$10 findcol::mindiff#10 findcol::mincol#11 ] always clobbers reg byte a Statement [83] (byte~) findcol::$8 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 findcol::$8 ] always clobbers reg byte a Statement [85] (byte) findcol::diff#0 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] always clobbers reg byte a -Statement [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ findcol::return#0 initscreen::screen#2 ] always clobbers reg byte a reg byte y -Statement [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ findcol::return#0 initscreen::screen#1 ] always clobbers reg byte a +Statement [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] always clobbers reg byte a reg byte y +Statement [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ initscreen::screen#1 ] always clobbers reg byte a Equivalence Class zp byte:17 [ animate::$0 ] has ALU potential. Equivalence Class zp byte:20 [ animate::$4 ] has ALU potential. Equivalence Class zp byte:26 [ animate::$12 ] has ALU potential. @@ -7586,7 +7560,7 @@ Potential registers zp byte:6 [ findcol::i#12 findcol::i#1 ] : zp byte:6 , reg b Potential registers zp byte:7 [ findcol::mindiff#10 findcol::mindiff#11 findcol::diff#13 ] : zp byte:7 , reg byte x , reg byte y , Potential registers zp byte:8 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 ] : zp byte:8 , reg byte x , reg byte y , Potential registers zp byte:9 [ findcol::diff#6 findcol::diff#3 findcol::diff#2 ] : zp byte:9 , reg byte a , reg byte x , reg byte y , -Potential registers zp byte:10 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] : zp byte:10 , reg byte x , +Potential registers zp byte:10 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] : zp byte:10 , reg byte x , reg byte y , Potential registers zp ptr byte:11 [ initscreen::screen#2 initscreen::screen#1 ] : zp ptr byte:11 , Potential registers zp byte:13 [ addpoint::x#6 ] : zp byte:13 , reg byte a , reg byte x , reg byte y , Potential registers zp byte:14 [ addpoint::idx#6 ] : zp byte:14 , reg byte a , reg byte x , reg byte y , @@ -7621,7 +7595,7 @@ Potential registers zp byte:42 [ findcol::$10 ] : zp byte:42 , reg byte a , reg Potential registers zp byte:43 [ findcol::$8 ] : zp byte:43 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -Uplift Scope [findcol] 53,338.67: zp byte:9 [ findcol::diff#6 findcol::diff#3 findcol::diff#2 ] 50,005: zp byte:8 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 ] 31,878.19: zp byte:7 [ findcol::mindiff#10 findcol::mindiff#11 findcol::diff#13 ] 24,730.55: zp byte:10 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] 20,002: zp byte:42 [ findcol::$10 ] 20,002: zp byte:43 [ findcol::$8 ] 17,633.34: zp byte:6 [ findcol::i#12 findcol::i#1 ] 10,001: zp byte:40 [ findcol::xp#0 ] 6,250.62: zp byte:41 [ findcol::yp#0 ] 1,640.2: zp byte:38 [ findcol::y#0 ] 1,577.12: zp byte:37 [ findcol::x#0 ] +Uplift Scope [findcol] 53,338.67: zp byte:9 [ findcol::diff#6 findcol::diff#3 findcol::diff#2 ] 50,005: zp byte:8 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 ] 31,878.19: zp byte:7 [ findcol::mindiff#10 findcol::mindiff#11 findcol::diff#13 ] 28,253.12: zp byte:10 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] 20,002: zp byte:42 [ findcol::$10 ] 20,002: zp byte:43 [ findcol::$8 ] 17,633.34: zp byte:6 [ findcol::i#12 findcol::i#1 ] 10,001: zp byte:40 [ findcol::xp#0 ] 6,250.62: zp byte:41 [ findcol::yp#0 ] 1,863.86: zp byte:38 [ findcol::y#0 ] 1,782.83: zp byte:37 [ findcol::x#0 ] Uplift Scope [render] 2,002: zp byte:39 [ render::col#0 ] 1,639.57: zp byte:5 [ render::x#2 render::x#1 ] 187.95: zp byte:2 [ render::y#2 render::y#1 ] 104.93: zp ptr byte:3 [ render::colline#2 render::colline#1 ] Uplift Scope [animate] 4: zp byte:17 [ animate::$0 ] 4: zp byte:18 [ animate::$1 ] 4: zp byte:19 [ animate::$2 ] 4: zp byte:20 [ animate::$4 ] 4: zp byte:21 [ animate::$5 ] 4: zp byte:22 [ animate::$6 ] 4: zp byte:23 [ animate::$8 ] 4: zp byte:24 [ animate::$9 ] 4: zp byte:25 [ animate::$10 ] 4: zp byte:26 [ animate::$12 ] 4: zp byte:27 [ animate::$13 ] 4: zp byte:28 [ animate::$14 ] 4: zp byte:29 [ animate::$16 ] 4: zp byte:30 [ animate::$17 ] 4: zp byte:31 [ animate::$18 ] 4: zp byte:32 [ animate::$20 ] 4: zp byte:33 [ animate::$21 ] 4: zp byte:34 [ animate::$22 ] 4: zp byte:35 [ animate::$24 ] 4: zp byte:36 [ animate::$25 ] Uplift Scope [initscreen] 33: zp ptr byte:11 [ initscreen::screen#2 initscreen::screen#1 ] @@ -7629,42 +7603,42 @@ Uplift Scope [addpoint] 2: zp byte:13 [ addpoint::x#6 ] 2: zp byte:14 [ addpoint Uplift Scope [main] Uplift Scope [] -Uplift attempts [findcol] 10000/373248 (limiting to 10000) -Uplifting [findcol] best 1717550 combination reg byte x [ findcol::diff#6 findcol::diff#3 findcol::diff#2 ] zp byte:8 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 ] zp byte:7 [ findcol::mindiff#10 findcol::mindiff#11 findcol::diff#13 ] zp byte:10 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] reg byte a [ findcol::$10 ] reg byte a [ findcol::$8 ] reg byte y [ findcol::i#12 findcol::i#1 ] reg byte x [ findcol::xp#0 ] zp byte:41 [ findcol::yp#0 ] zp byte:38 [ findcol::y#0 ] zp byte:37 [ findcol::x#0 ] -Limited combination testing to 10000 combinations of 373248 possible. -Uplifting [render] best 1711550 combination reg byte a [ render::col#0 ] zp byte:5 [ render::x#2 render::x#1 ] zp byte:2 [ render::y#2 render::y#1 ] zp ptr byte:3 [ render::colline#2 render::colline#1 ] -Uplifting [initscreen] best 1711550 combination zp ptr byte:11 [ initscreen::screen#2 initscreen::screen#1 ] -Uplifting [addpoint] best 1711483 combination reg byte a [ addpoint::x#6 ] reg byte y [ addpoint::idx#6 ] reg byte x [ addpoint::y#6 ] zp byte:16 [ addpoint::c#6 ] -Uplifting [main] best 1711483 combination -Uplifting [] best 1711483 combination -Uplifting remains [reg byte a [ animate::$0 ]] best 1711477 combination reg byte a [ animate::$0 ] -Uplifting remains [reg byte a [ animate::$1 ]] best 1711471 combination reg byte a [ animate::$1 ] -Uplifting remains [reg byte a [ animate::$2 ]] best 1711465 combination reg byte a [ animate::$2 ] -Uplifting remains [reg byte a [ animate::$4 ]] best 1711459 combination reg byte a [ animate::$4 ] -Uplifting remains [reg byte a [ animate::$5 ]] best 1711453 combination reg byte a [ animate::$5 ] -Uplifting remains [reg byte a [ animate::$6 ]] best 1711447 combination reg byte a [ animate::$6 ] -Uplifting remains [reg byte x [ animate::$8 ]] best 1711441 combination reg byte x [ animate::$8 ] -Uplifting remains [reg byte x [ animate::$9 ]] best 1711433 combination reg byte x [ animate::$9 ] -Uplifting remains [reg byte a [ animate::$10 ]] best 1711427 combination reg byte a [ animate::$10 ] -Uplifting remains [reg byte a [ animate::$12 ]] best 1711421 combination reg byte a [ animate::$12 ] -Uplifting remains [reg byte a [ animate::$13 ]] best 1711415 combination reg byte a [ animate::$13 ] -Uplifting remains [reg byte a [ animate::$14 ]] best 1711409 combination reg byte a [ animate::$14 ] -Uplifting remains [reg byte x [ animate::$16 ]] best 1711403 combination reg byte x [ animate::$16 ] -Uplifting remains [reg byte x [ animate::$17 ]] best 1711395 combination reg byte x [ animate::$17 ] -Uplifting remains [reg byte a [ animate::$18 ]] best 1711389 combination reg byte a [ animate::$18 ] -Uplifting remains [reg byte a [ animate::$20 ]] best 1711383 combination reg byte a [ animate::$20 ] -Uplifting remains [reg byte a [ animate::$21 ]] best 1711377 combination reg byte a [ animate::$21 ] -Uplifting remains [reg byte a [ animate::$22 ]] best 1711371 combination reg byte a [ animate::$22 ] -Uplifting remains [reg byte a [ animate::$24 ]] best 1711365 combination reg byte a [ animate::$24 ] -Uplifting remains [reg byte a [ animate::$25 ]] best 1711359 combination reg byte a [ animate::$25 ] +Uplift attempts [findcol] 10000/559872 (limiting to 10000) +Uplifting [findcol] best 1684547 combination reg byte a [ findcol::diff#6 findcol::diff#3 findcol::diff#2 ] zp byte:8 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 ] zp byte:7 [ findcol::mindiff#10 findcol::mindiff#11 findcol::diff#13 ] reg byte y [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] reg byte a [ findcol::$10 ] reg byte a [ findcol::$8 ] reg byte x [ findcol::i#12 findcol::i#1 ] zp byte:40 [ findcol::xp#0 ] zp byte:41 [ findcol::yp#0 ] zp byte:38 [ findcol::y#0 ] zp byte:37 [ findcol::x#0 ] +Limited combination testing to 10000 combinations of 559872 possible. +Uplifting [render] best 1680547 combination reg byte a [ render::col#0 ] zp byte:5 [ render::x#2 render::x#1 ] zp byte:2 [ render::y#2 render::y#1 ] zp ptr byte:3 [ render::colline#2 render::colline#1 ] +Uplifting [initscreen] best 1680547 combination zp ptr byte:11 [ initscreen::screen#2 initscreen::screen#1 ] +Uplifting [addpoint] best 1680480 combination reg byte a [ addpoint::x#6 ] reg byte y [ addpoint::idx#6 ] reg byte x [ addpoint::y#6 ] zp byte:16 [ addpoint::c#6 ] +Uplifting [main] best 1680480 combination +Uplifting [] best 1680480 combination +Uplifting remains [reg byte a [ animate::$0 ]] best 1680474 combination reg byte a [ animate::$0 ] +Uplifting remains [reg byte a [ animate::$1 ]] best 1680468 combination reg byte a [ animate::$1 ] +Uplifting remains [reg byte a [ animate::$2 ]] best 1680462 combination reg byte a [ animate::$2 ] +Uplifting remains [reg byte a [ animate::$4 ]] best 1680456 combination reg byte a [ animate::$4 ] +Uplifting remains [reg byte a [ animate::$5 ]] best 1680450 combination reg byte a [ animate::$5 ] +Uplifting remains [reg byte a [ animate::$6 ]] best 1680444 combination reg byte a [ animate::$6 ] +Uplifting remains [reg byte x [ animate::$8 ]] best 1680438 combination reg byte x [ animate::$8 ] +Uplifting remains [reg byte x [ animate::$9 ]] best 1680430 combination reg byte x [ animate::$9 ] +Uplifting remains [reg byte a [ animate::$10 ]] best 1680424 combination reg byte a [ animate::$10 ] +Uplifting remains [reg byte a [ animate::$12 ]] best 1680418 combination reg byte a [ animate::$12 ] +Uplifting remains [reg byte a [ animate::$13 ]] best 1680412 combination reg byte a [ animate::$13 ] +Uplifting remains [reg byte a [ animate::$14 ]] best 1680406 combination reg byte a [ animate::$14 ] +Uplifting remains [reg byte x [ animate::$16 ]] best 1680400 combination reg byte x [ animate::$16 ] +Uplifting remains [reg byte x [ animate::$17 ]] best 1680392 combination reg byte x [ animate::$17 ] +Uplifting remains [reg byte a [ animate::$18 ]] best 1680386 combination reg byte a [ animate::$18 ] +Uplifting remains [reg byte a [ animate::$20 ]] best 1680380 combination reg byte a [ animate::$20 ] +Uplifting remains [reg byte a [ animate::$21 ]] best 1680374 combination reg byte a [ animate::$21 ] +Uplifting remains [reg byte a [ animate::$22 ]] best 1680368 combination reg byte a [ animate::$22 ] +Uplifting remains [reg byte a [ animate::$24 ]] best 1680362 combination reg byte a [ animate::$24 ] +Uplifting remains [reg byte a [ animate::$25 ]] best 1680356 combination reg byte a [ animate::$25 ] Coalescing zero page register [ zp byte:2 [ render::y#2 render::y#1 ] ] with [ zp byte:16 [ addpoint::c#6 ] ] Coalescing zero page register [ zp ptr byte:3 [ render::colline#2 render::colline#1 ] ] with [ zp ptr byte:11 [ initscreen::screen#2 initscreen::screen#1 ] ] +Coalescing zero page register [ zp byte:8 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 ] ] with [ zp byte:40 [ findcol::xp#0 ] ] Re-allocated ZP register from zp byte:7 to zp byte:6 Re-allocated ZP register from zp byte:8 to zp byte:7 -Re-allocated ZP register from zp byte:10 to zp byte:8 -Re-allocated ZP register from zp byte:37 to zp byte:9 -Re-allocated ZP register from zp byte:38 to zp byte:10 -Re-allocated ZP register from zp byte:41 to zp byte:11 +Re-allocated ZP register from zp byte:37 to zp byte:8 +Re-allocated ZP register from zp byte:38 to zp byte:9 +Re-allocated ZP register from zp byte:41 to zp byte:10 Removing instruction jmp BEND Removing instruction jmp main__B3 Removing instruction jmp main__B4 @@ -7701,13 +7675,13 @@ Succesful ASM optimization Pass5NextJumpElimination ASSEMBLER //SEG0 @BEGIN BBEGIN: -//SEG1 [0] call main param-assignment [ findcol::return#0 ] +//SEG1 [0] call main param-assignment [ ] jsr main //SEG2 @END BEND: //SEG3 main main: -//SEG4 [1] call addpoint param-assignment [ findcol::return#0 ] +//SEG4 [1] call addpoint param-assignment [ ] //SEG5 [92] phi from main to addpoint addpoint_from_main: //SEG6 [92] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 @@ -7722,7 +7696,7 @@ addpoint_from_main: jsr addpoint //SEG10 main::@3 main__B3: -//SEG11 [2] call addpoint param-assignment [ findcol::return#0 ] +//SEG11 [2] call addpoint param-assignment [ ] //SEG12 [92] phi from main::@3 to addpoint addpoint_from_B3: //SEG13 [92] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 @@ -7737,7 +7711,7 @@ addpoint_from_B3: jsr addpoint //SEG17 main::@4 main__B4: -//SEG18 [3] call addpoint param-assignment [ findcol::return#0 ] +//SEG18 [3] call addpoint param-assignment [ ] //SEG19 [92] phi from main::@4 to addpoint addpoint_from_B4: //SEG20 [92] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 @@ -7752,7 +7726,7 @@ addpoint_from_B4: jsr addpoint //SEG24 main::@5 main__B5: -//SEG25 [4] call addpoint param-assignment [ findcol::return#0 ] +//SEG25 [4] call addpoint param-assignment [ ] //SEG26 [92] phi from main::@5 to addpoint addpoint_from_B5: //SEG27 [92] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 @@ -7767,7 +7741,7 @@ addpoint_from_B5: jsr addpoint //SEG31 main::@6 main__B6: -//SEG32 [5] call addpoint param-assignment [ findcol::return#0 ] +//SEG32 [5] call addpoint param-assignment [ ] //SEG33 [92] phi from main::@6 to addpoint addpoint_from_B6: //SEG34 [92] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 @@ -7782,7 +7756,7 @@ addpoint_from_B6: jsr addpoint //SEG38 main::@7 main__B7: -//SEG39 [6] call addpoint param-assignment [ findcol::return#0 ] +//SEG39 [6] call addpoint param-assignment [ ] //SEG40 [92] phi from main::@7 to addpoint addpoint_from_B7: //SEG41 [92] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 @@ -7797,145 +7771,145 @@ addpoint_from_B7: jsr addpoint //SEG45 main::@8 main__B8: -//SEG46 [7] call initscreen param-assignment [ findcol::return#0 ] +//SEG46 [7] call initscreen param-assignment [ ] jsr initscreen //SEG47 main::@1 main__B1: -//SEG48 [8] call render param-assignment [ findcol::return#0 ] +//SEG48 [8] call render param-assignment [ ] jsr render //SEG49 main::@10 main__B10: -//SEG50 [9] call animate param-assignment [ findcol::return#0 ] +//SEG50 [9] call animate param-assignment [ ] jsr animate //SEG51 main::@11 main__B11: -//SEG52 [10] if(true) goto main::@1 [ findcol::return#0 ] -- true_then_la1 +//SEG52 [10] if(true) goto main::@1 [ ] -- true_then_la1 jmp main__B1 //SEG53 main::@return main__Breturn: -//SEG54 [11] return [ findcol::return#0 ] +//SEG54 [11] return [ ] rts //SEG55 animate animate: -//SEG56 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 findcol::return#0 ] -- aby=_star_cowo1 +//SEG56 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- aby=_star_cowo1 lda 4096 -//SEG57 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 findcol::return#0 ] -- aby=aby_plus_1 +//SEG57 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- aby=aby_plus_1 clc adc #1 -//SEG58 [14] *((word) 4096) ← (byte~) animate::$1 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG58 [14] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=aby sta 4096 -//SEG59 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 findcol::return#0 ] -- aby=_star_cowo1 +//SEG59 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- aby=_star_cowo1 lda 4096 -//SEG60 [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG60 [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ ] -- aby_eq_coby1_then_la1 cmp #40 beq animate__B1 //SEG61 animate::@2 animate__B2: -//SEG62 [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 findcol::return#0 ] -- aby=_star_cowo1 +//SEG62 [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 ] -- aby=_star_cowo1 lda 4352 -//SEG63 [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 findcol::return#0 ] -- aby=aby_plus_1 +//SEG63 [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 ] -- aby=aby_plus_1 clc adc #1 -//SEG64 [19] *((word) 4352) ← (byte~) animate::$5 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG64 [19] *((word) 4352) ← (byte~) animate::$5 [ ] -- _star_cowo1=aby sta 4352 -//SEG65 [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 findcol::return#0 ] -- aby=_star_cowo1 +//SEG65 [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 ] -- aby=_star_cowo1 lda 4352 -//SEG66 [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG66 [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ ] -- aby_eq_coby1_then_la1 cmp #25 beq animate__B3 //SEG67 animate::@4 animate__B4: -//SEG68 [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 findcol::return#0 ] -- xby=_star_cowo1 +//SEG68 [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 ] -- xby=_star_cowo1 ldx 4097 -//SEG69 [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 findcol::return#0 ] -- xby=xby_minus_1 +//SEG69 [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 ] -- xby=xby_minus_1 dex -//SEG70 [24] *((word) 4097) ← (byte~) animate::$9 [ findcol::return#0 ] -- _star_cowo1=xby +//SEG70 [24] *((word) 4097) ← (byte~) animate::$9 [ ] -- _star_cowo1=xby stx 4097 -//SEG71 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 findcol::return#0 ] -- aby=_star_cowo1 +//SEG71 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- aby=_star_cowo1 lda 4097 -//SEG72 [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG72 [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ ] -- aby_eq_coby1_then_la1 cmp #255 beq animate__B5 //SEG73 animate::@6 animate__B6: -//SEG74 [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 findcol::return#0 ] -- aby=_star_cowo1 +//SEG74 [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 ] -- aby=_star_cowo1 lda 4354 -//SEG75 [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 findcol::return#0 ] -- aby=aby_plus_1 +//SEG75 [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 ] -- aby=aby_plus_1 clc adc #1 -//SEG76 [29] *((word) 4354) ← (byte~) animate::$13 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG76 [29] *((word) 4354) ← (byte~) animate::$13 [ ] -- _star_cowo1=aby sta 4354 -//SEG77 [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 findcol::return#0 ] -- aby=_star_cowo1 +//SEG77 [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 ] -- aby=_star_cowo1 lda 4354 -//SEG78 [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG78 [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ ] -- aby_eq_coby1_then_la1 cmp #25 beq animate__B7 //SEG79 animate::@8 animate__B8: -//SEG80 [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 findcol::return#0 ] -- xby=_star_cowo1 +//SEG80 [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 ] -- xby=_star_cowo1 ldx 4355 -//SEG81 [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 findcol::return#0 ] -- xby=xby_minus_1 +//SEG81 [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 ] -- xby=xby_minus_1 dex -//SEG82 [34] *((word) 4355) ← (byte~) animate::$17 [ findcol::return#0 ] -- _star_cowo1=xby +//SEG82 [34] *((word) 4355) ← (byte~) animate::$17 [ ] -- _star_cowo1=xby stx 4355 -//SEG83 [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 findcol::return#0 ] -- aby=_star_cowo1 +//SEG83 [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 ] -- aby=_star_cowo1 lda 4355 -//SEG84 [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG84 [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ ] -- aby_eq_coby1_then_la1 cmp #255 beq animate__B9 //SEG85 animate::@return animate__Breturn: -//SEG86 [37] return [ findcol::return#0 ] +//SEG86 [37] return [ ] rts //SEG87 animate::@9 animate__B9: -//SEG88 [38] *((word) 4355) ← (byte) 25 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG88 [38] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 lda #25 sta 4355 -//SEG89 [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 findcol::return#0 ] -- aby=_star_cowo1 +//SEG89 [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 ] -- aby=_star_cowo1 lda 4099 -//SEG90 [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 findcol::return#0 ] -- aby=aby_plus_coby1 +//SEG90 [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 ] -- aby=aby_plus_coby1 clc adc #7 -//SEG91 [41] *((word) 4099) ← (byte~) animate::$21 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG91 [41] *((word) 4099) ← (byte~) animate::$21 [ ] -- _star_cowo1=aby sta 4099 -//SEG92 [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 findcol::return#0 ] -- aby=_star_cowo1 +//SEG92 [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 ] -- aby=_star_cowo1 lda 4099 -//SEG93 [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ findcol::return#0 ] -- aby_ge_coby1_then_la1 +//SEG93 [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ ] -- aby_ge_coby1_then_la1 cmp #40 bcs animate__B11 jmp animate__Breturn //SEG94 animate::@11 animate__B11: -//SEG95 [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 findcol::return#0 ] -- aby=_star_cowo1 +//SEG95 [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 ] -- aby=_star_cowo1 lda 4099 -//SEG96 [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 findcol::return#0 ] -- aby=aby_minus_coby1 +//SEG96 [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 ] -- aby=aby_minus_coby1 sec sbc #40 -//SEG97 [46] *((word) 4099) ← (byte~) animate::$25 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG97 [46] *((word) 4099) ← (byte~) animate::$25 [ ] -- _star_cowo1=aby sta 4099 jmp animate__Breturn //SEG98 animate::@7 animate__B7: -//SEG99 [47] *((word) 4354) ← (byte) 0 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG99 [47] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #0 sta 4354 jmp animate__B8 //SEG100 animate::@5 animate__B5: -//SEG101 [48] *((word) 4097) ← (byte) 40 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG101 [48] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 lda #40 sta 4097 jmp animate__B6 //SEG102 animate::@3 animate__B3: -//SEG103 [49] *((word) 4352) ← (byte) 0 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG103 [49] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #0 sta 4352 jmp animate__B4 //SEG104 animate::@1 animate__B1: -//SEG105 [50] *((word) 4096) ← (byte) 0 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG105 [50] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #0 sta 4096 jmp animate__B2 @@ -7969,30 +7943,30 @@ render__B2_from_B5: //SEG117 [52] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy //SEG118 render::@2 render__B2: -//SEG119 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 ] -- zpby1=zpby2 +//SEG119 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 ] -- zpby1=zpby2 lda 5 - sta 9 -//SEG120 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] -- zpby1=zpby2 + sta 8 +//SEG120 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 ] -- zpby1=zpby2 lda 2 - sta 10 -//SEG121 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] + sta 9 +//SEG121 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] jsr findcol //SEG122 render::@5 render__B5: -//SEG123 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 render::col#0 ] -- aby=zpby1 - lda 8 -//SEG124 [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] -- zpptrby1_staridx_zpby1=aby +//SEG123 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] -- aby=yby + tya +//SEG124 [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 render::colline#2 ] -- zpptrby1_staridx_zpby1=aby ldy 5 sta (3),y -//SEG125 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 findcol::return#0 render::colline#2 ] -- zpby1=_inc_zpby1 +//SEG125 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1=_inc_zpby1 inc 5 -//SEG126 [59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 findcol::return#0 render::colline#2 ] -- zpby1_lt_coby1_then_la1 +//SEG126 [59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1_lt_coby1_then_la1 lda 5 cmp #40 bcc render__B2_from_B5 //SEG127 render::@3 render__B3: -//SEG128 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 findcol::return#0 ] -- zpptrby1=zpptrby1_plus_coby1 +//SEG128 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 lda 3 clc adc #40 @@ -8000,28 +7974,27 @@ render__B3: bcc !+ inc 3+1 !: -//SEG129 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 findcol::return#0 ] -- zpby1=_inc_zpby1 +//SEG129 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] -- zpby1=_inc_zpby1 inc 2 -//SEG130 [62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 findcol::return#0 ] -- zpby1_lt_coby1_then_la1 +//SEG130 [62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ] -- zpby1_lt_coby1_then_la1 lda 2 cmp #25 bcc render__B1_from_B3 //SEG131 render::@return render__Breturn: -//SEG132 [63] return [ findcol::return#0 ] +//SEG132 [63] return [ ] rts //SEG133 findcol findcol: //SEG134 [64] phi from findcol to findcol::@1 findcol__B1_from_findcol: -//SEG135 [64] phi (byte) findcol::mincol#11 = (byte) 0 -- zpby1=coby1 - lda #0 - sta 8 +//SEG135 [64] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 + ldy #0 //SEG136 [64] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 lda #255 sta 6 -//SEG137 [64] phi (byte) findcol::i#12 = (byte) 0 -- yby=coby1 - ldy #0 +//SEG137 [64] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 + ldx #0 jmp findcol__B1 //SEG138 [64] phi from findcol::@13 to findcol::@1 findcol__B1_from_B13: @@ -8030,26 +8003,28 @@ findcol__B1_from_B13: //SEG141 [64] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy //SEG142 findcol::@1 findcol__B1: -//SEG143 [65] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ] -- xby=cowo1_staridx_yby - ldx 4096,y -//SEG144 [66] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=cowo1_staridx_yby - lda 4352,y - sta 11 -//SEG145 [67] if((byte) findcol::x#0==(byte) findcol::xp#0) goto findcol::@2 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_eq_xby_then_la1 - cpx 9 +//SEG143 [65] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=cowo1_staridx_xby + lda 4096,x + sta 7 +//SEG144 [66] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=cowo1_staridx_xby + lda 4352,x + sta 10 +//SEG145 [67] if((byte) findcol::x#0==(byte) findcol::xp#0) goto findcol::@2 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_eq_zpby2_then_la1 + lda 8 + cmp 7 beq findcol__B2 //SEG146 findcol::@3 findcol__B3: -//SEG147 [68] if((byte) findcol::x#0<(byte) findcol::xp#0) goto findcol::@6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_lt_xby_then_la1 - cpx 9 - bcs findcol__B6 +//SEG147 [68] if((byte) findcol::x#0<(byte) findcol::xp#0) goto findcol::@6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_lt_zpby2_then_la1 + lda 8 + cmp 7 + bcc findcol__B6 //SEG148 findcol::@7 findcol__B7: -//SEG149 [69] (byte) findcol::diff#1 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#1 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=zpby2_minus_xby - stx 255 - lda 9 +//SEG149 [69] (byte) findcol::diff#1 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#1 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=zpby2_minus_zpby1 + lda 8 sec - sbc 255 + sbc 7 sta 7 //SEG150 [70] phi from findcol::@7 to findcol::@8 findcol__B8_from_B7: @@ -8057,26 +8032,25 @@ findcol__B8_from_B7: //SEG152 findcol::@8 findcol__B8: //SEG153 [71] if((byte) findcol::y#0<(byte) findcol::yp#0) goto findcol::@9 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_lt_zpby2_then_la1 - lda 10 - cmp 11 + lda 9 + cmp 10 bcc findcol__B9 //SEG154 findcol::@10 findcol__B10: //SEG155 [72] (byte~) findcol::$10 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::$10 findcol::mindiff#10 findcol::mincol#11 ] -- aby=zpby1_minus_zpby2 - lda 10 + lda 9 sec - sbc 11 -//SEG156 [73] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 ] -- xby=zpby1_plus_aby + sbc 10 +//SEG156 [73] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 ] -- aby=zpby1_plus_aby clc adc 7 - tax //SEG157 [74] phi from findcol::@10 to findcol::@11 findcol__B11_from_B10: //SEG158 [74] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy //SEG159 findcol::@11 findcol__B11: -//SEG160 [75] if((byte) findcol::diff#6<(byte) findcol::mindiff#10) goto findcol::@12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mindiff#10 findcol::mincol#11 ] -- xby_lt_zpby1_then_la1 - cpx 6 +//SEG160 [75] if((byte) findcol::diff#6<(byte) findcol::mindiff#10) goto findcol::@12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mindiff#10 findcol::mincol#11 ] -- aby_lt_zpby1_then_la1 + cmp 6 bcc findcol__B12 //SEG161 [76] phi from findcol::@11 to findcol::@13 findcol__B13_from_B11: @@ -8084,10 +8058,10 @@ findcol__B13_from_B11: //SEG163 [76] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#11 -- register_copy //SEG164 findcol::@13 findcol__B13: -//SEG165 [77] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] -- yby=_inc_yby - iny -//SEG166 [78] if((byte) findcol::i#1<(byte) 6) goto findcol::@1 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] -- yby_lt_coby1_then_la1 - cpy #6 +//SEG165 [77] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] -- xby=_inc_xby + inx +//SEG166 [78] if((byte) findcol::i#1<(byte) 6) goto findcol::@1 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] -- xby_lt_coby1_then_la1 + cpx #6 bcc findcol__B1_from_B13 //SEG167 [79] phi from findcol::@13 to findcol::@return findcol__Breturn_from_B13: @@ -8095,20 +8069,18 @@ findcol__Breturn_from_B13: jmp findcol__Breturn //SEG169 [79] phi from findcol::@2 to findcol::@return findcol__Breturn_from_B2: -//SEG170 [79] phi (byte) findcol::return#0 = (byte) 0 -- zpby1=coby1 - lda #0 - sta 8 +//SEG170 [79] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 + ldy #0 //SEG171 findcol::@return findcol__Breturn: -//SEG172 [80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] +//SEG172 [80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] rts //SEG173 findcol::@12 findcol__B12: -//SEG174 [81] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 ] -- zpby1=cowo1_staridx_yby - lda 4608,y - sta 8 -//SEG175 [82] (byte~) findcol::diff#13 ← (byte) findcol::diff#6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#1 findcol::diff#13 ] -- zpby1=xby - stx 6 +//SEG174 [81] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 ] -- yby=cowo1_staridx_xby + ldy 4608,x +//SEG175 [82] (byte~) findcol::diff#13 ← (byte) findcol::diff#6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#1 findcol::diff#13 ] -- zpby1=aby + sta 6 //SEG176 [76] phi from findcol::@12 to findcol::@13 findcol__B13_from_B12: //SEG177 [76] phi (byte) findcol::mindiff#11 = (byte~) findcol::diff#13 -- register_copy @@ -8117,23 +8089,22 @@ findcol__B13_from_B12: //SEG179 findcol::@9 findcol__B9: //SEG180 [83] (byte~) findcol::$8 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 findcol::$8 ] -- aby=zpby1_minus_zpby2 - lda 11 + lda 10 sec - sbc 10 -//SEG181 [84] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$8 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 ] -- xby=zpby1_plus_aby + sbc 9 +//SEG181 [84] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$8 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 ] -- aby=zpby1_plus_aby clc adc 7 - tax //SEG182 [74] phi from findcol::@9 to findcol::@11 findcol__B11_from_B9: //SEG183 [74] phi (byte) findcol::diff#6 = (byte) findcol::diff#2 -- register_copy jmp findcol__B11 //SEG184 findcol::@6 findcol__B6: -//SEG185 [85] (byte) findcol::diff#0 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=xby_minus_zpby2 - txa +//SEG185 [85] (byte) findcol::diff#0 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=zpby1_minus_zpby2 + lda 7 sec - sbc 9 + sbc 8 sta 7 //SEG186 [70] phi from findcol::@6 to findcol::@8 findcol__B8_from_B6: @@ -8142,8 +8113,8 @@ findcol__B8_from_B6: //SEG188 findcol::@2 findcol__B2: //SEG189 [86] if((byte) findcol::y#0==(byte) findcol::yp#0) goto findcol::@return [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_eq_zpby2_then_la1 - lda 10 - cmp 11 + lda 9 + cmp 10 beq findcol__Breturn_from_B2 jmp findcol__B3 //SEG190 initscreen @@ -8161,16 +8132,16 @@ initscreen__B1_from_B1: //SEG194 [87] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy //SEG195 initscreen::@1 initscreen__B1: -//SEG196 [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ findcol::return#0 initscreen::screen#2 ] -- _star_zpptrby1=coby1 +//SEG196 [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #0 lda #230 sta (3),y -//SEG197 [89] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ findcol::return#0 initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 +//SEG197 [89] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc 3 bne !+ inc 3+1 !: -//SEG198 [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ findcol::return#0 initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 +//SEG198 [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda 3+1 cmp #>2048 bcc initscreen__B1_from_B1 @@ -8181,21 +8152,21 @@ initscreen__B1: !: //SEG199 initscreen::@return initscreen__Breturn: -//SEG200 [91] return [ findcol::return#0 ] +//SEG200 [91] return [ ] rts //SEG201 addpoint addpoint: -//SEG202 [93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ findcol::return#0 addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_yby=aby +//SEG202 [93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_yby=aby sta 4096,y -//SEG203 [94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ findcol::return#0 addpoint::idx#6 addpoint::c#6 ] -- cowo1_staridx_yby=xby +//SEG203 [94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ addpoint::idx#6 addpoint::c#6 ] -- cowo1_staridx_yby=xby txa sta 4352,y -//SEG204 [95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ findcol::return#0 ] -- cowo1_staridx_yby=zpby1 +//SEG204 [95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ ] -- cowo1_staridx_yby=zpby1 lda 2 sta 4608,y //SEG205 addpoint::@return addpoint__Breturn: -//SEG206 [96] return [ findcol::return#0 ] +//SEG206 [96] return [ ] rts Removing instruction jmp render__B1 @@ -8206,13 +8177,13 @@ Succesful ASM optimization Pass5NextJumpElimination ASSEMBLER //SEG0 @BEGIN BBEGIN: -//SEG1 [0] call main param-assignment [ findcol::return#0 ] +//SEG1 [0] call main param-assignment [ ] jsr main //SEG2 @END BEND: //SEG3 main main: -//SEG4 [1] call addpoint param-assignment [ findcol::return#0 ] +//SEG4 [1] call addpoint param-assignment [ ] //SEG5 [92] phi from main to addpoint addpoint_from_main: //SEG6 [92] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 @@ -8227,7 +8198,7 @@ addpoint_from_main: jsr addpoint //SEG10 main::@3 main__B3: -//SEG11 [2] call addpoint param-assignment [ findcol::return#0 ] +//SEG11 [2] call addpoint param-assignment [ ] //SEG12 [92] phi from main::@3 to addpoint addpoint_from_B3: //SEG13 [92] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 @@ -8242,7 +8213,7 @@ addpoint_from_B3: jsr addpoint //SEG17 main::@4 main__B4: -//SEG18 [3] call addpoint param-assignment [ findcol::return#0 ] +//SEG18 [3] call addpoint param-assignment [ ] //SEG19 [92] phi from main::@4 to addpoint addpoint_from_B4: //SEG20 [92] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 @@ -8257,7 +8228,7 @@ addpoint_from_B4: jsr addpoint //SEG24 main::@5 main__B5: -//SEG25 [4] call addpoint param-assignment [ findcol::return#0 ] +//SEG25 [4] call addpoint param-assignment [ ] //SEG26 [92] phi from main::@5 to addpoint addpoint_from_B5: //SEG27 [92] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 @@ -8272,7 +8243,7 @@ addpoint_from_B5: jsr addpoint //SEG31 main::@6 main__B6: -//SEG32 [5] call addpoint param-assignment [ findcol::return#0 ] +//SEG32 [5] call addpoint param-assignment [ ] //SEG33 [92] phi from main::@6 to addpoint addpoint_from_B6: //SEG34 [92] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 @@ -8287,7 +8258,7 @@ addpoint_from_B6: jsr addpoint //SEG38 main::@7 main__B7: -//SEG39 [6] call addpoint param-assignment [ findcol::return#0 ] +//SEG39 [6] call addpoint param-assignment [ ] //SEG40 [92] phi from main::@7 to addpoint addpoint_from_B7: //SEG41 [92] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 @@ -8302,145 +8273,145 @@ addpoint_from_B7: jsr addpoint //SEG45 main::@8 main__B8: -//SEG46 [7] call initscreen param-assignment [ findcol::return#0 ] +//SEG46 [7] call initscreen param-assignment [ ] jsr initscreen //SEG47 main::@1 main__B1: -//SEG48 [8] call render param-assignment [ findcol::return#0 ] +//SEG48 [8] call render param-assignment [ ] jsr render //SEG49 main::@10 main__B10: -//SEG50 [9] call animate param-assignment [ findcol::return#0 ] +//SEG50 [9] call animate param-assignment [ ] jsr animate //SEG51 main::@11 main__B11: -//SEG52 [10] if(true) goto main::@1 [ findcol::return#0 ] -- true_then_la1 +//SEG52 [10] if(true) goto main::@1 [ ] -- true_then_la1 jmp main__B1 //SEG53 main::@return main__Breturn: -//SEG54 [11] return [ findcol::return#0 ] +//SEG54 [11] return [ ] rts //SEG55 animate animate: -//SEG56 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 findcol::return#0 ] -- aby=_star_cowo1 +//SEG56 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- aby=_star_cowo1 lda 4096 -//SEG57 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 findcol::return#0 ] -- aby=aby_plus_1 +//SEG57 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- aby=aby_plus_1 clc adc #1 -//SEG58 [14] *((word) 4096) ← (byte~) animate::$1 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG58 [14] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=aby sta 4096 -//SEG59 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 findcol::return#0 ] -- aby=_star_cowo1 +//SEG59 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- aby=_star_cowo1 lda 4096 -//SEG60 [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG60 [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ ] -- aby_eq_coby1_then_la1 cmp #40 beq animate__B1 //SEG61 animate::@2 animate__B2: -//SEG62 [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 findcol::return#0 ] -- aby=_star_cowo1 +//SEG62 [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 ] -- aby=_star_cowo1 lda 4352 -//SEG63 [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 findcol::return#0 ] -- aby=aby_plus_1 +//SEG63 [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 ] -- aby=aby_plus_1 clc adc #1 -//SEG64 [19] *((word) 4352) ← (byte~) animate::$5 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG64 [19] *((word) 4352) ← (byte~) animate::$5 [ ] -- _star_cowo1=aby sta 4352 -//SEG65 [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 findcol::return#0 ] -- aby=_star_cowo1 +//SEG65 [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 ] -- aby=_star_cowo1 lda 4352 -//SEG66 [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG66 [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ ] -- aby_eq_coby1_then_la1 cmp #25 beq animate__B3 //SEG67 animate::@4 animate__B4: -//SEG68 [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 findcol::return#0 ] -- xby=_star_cowo1 +//SEG68 [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 ] -- xby=_star_cowo1 ldx 4097 -//SEG69 [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 findcol::return#0 ] -- xby=xby_minus_1 +//SEG69 [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 ] -- xby=xby_minus_1 dex -//SEG70 [24] *((word) 4097) ← (byte~) animate::$9 [ findcol::return#0 ] -- _star_cowo1=xby +//SEG70 [24] *((word) 4097) ← (byte~) animate::$9 [ ] -- _star_cowo1=xby stx 4097 -//SEG71 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 findcol::return#0 ] -- aby=_star_cowo1 +//SEG71 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- aby=_star_cowo1 lda 4097 -//SEG72 [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG72 [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ ] -- aby_eq_coby1_then_la1 cmp #255 beq animate__B5 //SEG73 animate::@6 animate__B6: -//SEG74 [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 findcol::return#0 ] -- aby=_star_cowo1 +//SEG74 [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 ] -- aby=_star_cowo1 lda 4354 -//SEG75 [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 findcol::return#0 ] -- aby=aby_plus_1 +//SEG75 [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 ] -- aby=aby_plus_1 clc adc #1 -//SEG76 [29] *((word) 4354) ← (byte~) animate::$13 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG76 [29] *((word) 4354) ← (byte~) animate::$13 [ ] -- _star_cowo1=aby sta 4354 -//SEG77 [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 findcol::return#0 ] -- aby=_star_cowo1 +//SEG77 [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 ] -- aby=_star_cowo1 lda 4354 -//SEG78 [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG78 [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ ] -- aby_eq_coby1_then_la1 cmp #25 beq animate__B7 //SEG79 animate::@8 animate__B8: -//SEG80 [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 findcol::return#0 ] -- xby=_star_cowo1 +//SEG80 [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 ] -- xby=_star_cowo1 ldx 4355 -//SEG81 [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 findcol::return#0 ] -- xby=xby_minus_1 +//SEG81 [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 ] -- xby=xby_minus_1 dex -//SEG82 [34] *((word) 4355) ← (byte~) animate::$17 [ findcol::return#0 ] -- _star_cowo1=xby +//SEG82 [34] *((word) 4355) ← (byte~) animate::$17 [ ] -- _star_cowo1=xby stx 4355 -//SEG83 [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 findcol::return#0 ] -- aby=_star_cowo1 +//SEG83 [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 ] -- aby=_star_cowo1 lda 4355 -//SEG84 [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG84 [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ ] -- aby_eq_coby1_then_la1 cmp #255 beq animate__B9 //SEG85 animate::@return animate__Breturn: -//SEG86 [37] return [ findcol::return#0 ] +//SEG86 [37] return [ ] rts //SEG87 animate::@9 animate__B9: -//SEG88 [38] *((word) 4355) ← (byte) 25 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG88 [38] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 lda #25 sta 4355 -//SEG89 [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 findcol::return#0 ] -- aby=_star_cowo1 +//SEG89 [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 ] -- aby=_star_cowo1 lda 4099 -//SEG90 [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 findcol::return#0 ] -- aby=aby_plus_coby1 +//SEG90 [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 ] -- aby=aby_plus_coby1 clc adc #7 -//SEG91 [41] *((word) 4099) ← (byte~) animate::$21 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG91 [41] *((word) 4099) ← (byte~) animate::$21 [ ] -- _star_cowo1=aby sta 4099 -//SEG92 [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 findcol::return#0 ] -- aby=_star_cowo1 +//SEG92 [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 ] -- aby=_star_cowo1 lda 4099 -//SEG93 [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ findcol::return#0 ] -- aby_ge_coby1_then_la1 +//SEG93 [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ ] -- aby_ge_coby1_then_la1 cmp #40 bcs animate__B11 jmp animate__Breturn //SEG94 animate::@11 animate__B11: -//SEG95 [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 findcol::return#0 ] -- aby=_star_cowo1 +//SEG95 [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 ] -- aby=_star_cowo1 lda 4099 -//SEG96 [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 findcol::return#0 ] -- aby=aby_minus_coby1 +//SEG96 [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 ] -- aby=aby_minus_coby1 sec sbc #40 -//SEG97 [46] *((word) 4099) ← (byte~) animate::$25 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG97 [46] *((word) 4099) ← (byte~) animate::$25 [ ] -- _star_cowo1=aby sta 4099 jmp animate__Breturn //SEG98 animate::@7 animate__B7: -//SEG99 [47] *((word) 4354) ← (byte) 0 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG99 [47] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #0 sta 4354 jmp animate__B8 //SEG100 animate::@5 animate__B5: -//SEG101 [48] *((word) 4097) ← (byte) 40 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG101 [48] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 lda #40 sta 4097 jmp animate__B6 //SEG102 animate::@3 animate__B3: -//SEG103 [49] *((word) 4352) ← (byte) 0 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG103 [49] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #0 sta 4352 jmp animate__B4 //SEG104 animate::@1 animate__B1: -//SEG105 [50] *((word) 4096) ← (byte) 0 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG105 [50] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #0 sta 4096 jmp animate__B2 @@ -8472,30 +8443,30 @@ render__B2_from_B5: //SEG117 [52] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy //SEG118 render::@2 render__B2: -//SEG119 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 ] -- zpby1=zpby2 +//SEG119 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 ] -- zpby1=zpby2 lda 5 - sta 9 -//SEG120 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] -- zpby1=zpby2 + sta 8 +//SEG120 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 ] -- zpby1=zpby2 lda 2 - sta 10 -//SEG121 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] + sta 9 +//SEG121 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] jsr findcol //SEG122 render::@5 render__B5: -//SEG123 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 render::col#0 ] -- aby=zpby1 - lda 8 -//SEG124 [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] -- zpptrby1_staridx_zpby1=aby +//SEG123 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] -- aby=yby + tya +//SEG124 [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 render::colline#2 ] -- zpptrby1_staridx_zpby1=aby ldy 5 sta (3),y -//SEG125 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 findcol::return#0 render::colline#2 ] -- zpby1=_inc_zpby1 +//SEG125 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1=_inc_zpby1 inc 5 -//SEG126 [59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 findcol::return#0 render::colline#2 ] -- zpby1_lt_coby1_then_la1 +//SEG126 [59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1_lt_coby1_then_la1 lda 5 cmp #40 bcc render__B2_from_B5 //SEG127 render::@3 render__B3: -//SEG128 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 findcol::return#0 ] -- zpptrby1=zpptrby1_plus_coby1 +//SEG128 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 lda 3 clc adc #40 @@ -8503,28 +8474,27 @@ render__B3: bcc !+ inc 3+1 !: -//SEG129 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 findcol::return#0 ] -- zpby1=_inc_zpby1 +//SEG129 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] -- zpby1=_inc_zpby1 inc 2 -//SEG130 [62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 findcol::return#0 ] -- zpby1_lt_coby1_then_la1 +//SEG130 [62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ] -- zpby1_lt_coby1_then_la1 lda 2 cmp #25 bcc render__B1_from_B3 //SEG131 render::@return render__Breturn: -//SEG132 [63] return [ findcol::return#0 ] +//SEG132 [63] return [ ] rts //SEG133 findcol findcol: //SEG134 [64] phi from findcol to findcol::@1 findcol__B1_from_findcol: -//SEG135 [64] phi (byte) findcol::mincol#11 = (byte) 0 -- zpby1=coby1 - lda #0 - sta 8 +//SEG135 [64] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 + ldy #0 //SEG136 [64] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 lda #255 sta 6 -//SEG137 [64] phi (byte) findcol::i#12 = (byte) 0 -- yby=coby1 - ldy #0 +//SEG137 [64] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 + ldx #0 //SEG138 [64] phi from findcol::@13 to findcol::@1 findcol__B1_from_B13: //SEG139 [64] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy @@ -8532,26 +8502,28 @@ findcol__B1_from_B13: //SEG141 [64] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy //SEG142 findcol::@1 findcol__B1: -//SEG143 [65] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ] -- xby=cowo1_staridx_yby - ldx 4096,y -//SEG144 [66] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=cowo1_staridx_yby - lda 4352,y - sta 11 -//SEG145 [67] if((byte) findcol::x#0==(byte) findcol::xp#0) goto findcol::@2 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_eq_xby_then_la1 - cpx 9 +//SEG143 [65] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=cowo1_staridx_xby + lda 4096,x + sta 7 +//SEG144 [66] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=cowo1_staridx_xby + lda 4352,x + sta 10 +//SEG145 [67] if((byte) findcol::x#0==(byte) findcol::xp#0) goto findcol::@2 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_eq_zpby2_then_la1 + lda 8 + cmp 7 beq findcol__B2 //SEG146 findcol::@3 findcol__B3: -//SEG147 [68] if((byte) findcol::x#0<(byte) findcol::xp#0) goto findcol::@6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_lt_xby_then_la1 - cpx 9 - bcs findcol__B6 +//SEG147 [68] if((byte) findcol::x#0<(byte) findcol::xp#0) goto findcol::@6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_lt_zpby2_then_la1 + lda 8 + cmp 7 + bcc findcol__B6 //SEG148 findcol::@7 findcol__B7: -//SEG149 [69] (byte) findcol::diff#1 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#1 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=zpby2_minus_xby - stx 255 - lda 9 +//SEG149 [69] (byte) findcol::diff#1 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#1 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=zpby2_minus_zpby1 + lda 8 sec - sbc 255 + sbc 7 sta 7 //SEG150 [70] phi from findcol::@7 to findcol::@8 findcol__B8_from_B7: @@ -8559,26 +8531,25 @@ findcol__B8_from_B7: //SEG152 findcol::@8 findcol__B8: //SEG153 [71] if((byte) findcol::y#0<(byte) findcol::yp#0) goto findcol::@9 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_lt_zpby2_then_la1 - lda 10 - cmp 11 + lda 9 + cmp 10 bcc findcol__B9 //SEG154 findcol::@10 findcol__B10: //SEG155 [72] (byte~) findcol::$10 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::$10 findcol::mindiff#10 findcol::mincol#11 ] -- aby=zpby1_minus_zpby2 - lda 10 + lda 9 sec - sbc 11 -//SEG156 [73] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 ] -- xby=zpby1_plus_aby + sbc 10 +//SEG156 [73] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 ] -- aby=zpby1_plus_aby clc adc 7 - tax //SEG157 [74] phi from findcol::@10 to findcol::@11 findcol__B11_from_B10: //SEG158 [74] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy //SEG159 findcol::@11 findcol__B11: -//SEG160 [75] if((byte) findcol::diff#6<(byte) findcol::mindiff#10) goto findcol::@12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mindiff#10 findcol::mincol#11 ] -- xby_lt_zpby1_then_la1 - cpx 6 +//SEG160 [75] if((byte) findcol::diff#6<(byte) findcol::mindiff#10) goto findcol::@12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mindiff#10 findcol::mincol#11 ] -- aby_lt_zpby1_then_la1 + cmp 6 bcc findcol__B12 //SEG161 [76] phi from findcol::@11 to findcol::@13 findcol__B13_from_B11: @@ -8586,10 +8557,10 @@ findcol__B13_from_B11: //SEG163 [76] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#11 -- register_copy //SEG164 findcol::@13 findcol__B13: -//SEG165 [77] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] -- yby=_inc_yby - iny -//SEG166 [78] if((byte) findcol::i#1<(byte) 6) goto findcol::@1 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] -- yby_lt_coby1_then_la1 - cpy #6 +//SEG165 [77] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] -- xby=_inc_xby + inx +//SEG166 [78] if((byte) findcol::i#1<(byte) 6) goto findcol::@1 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] -- xby_lt_coby1_then_la1 + cpx #6 bcc findcol__B1_from_B13 //SEG167 [79] phi from findcol::@13 to findcol::@return findcol__Breturn_from_B13: @@ -8597,20 +8568,18 @@ findcol__Breturn_from_B13: jmp findcol__Breturn //SEG169 [79] phi from findcol::@2 to findcol::@return findcol__Breturn_from_B2: -//SEG170 [79] phi (byte) findcol::return#0 = (byte) 0 -- zpby1=coby1 - lda #0 - sta 8 +//SEG170 [79] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 + ldy #0 //SEG171 findcol::@return findcol__Breturn: -//SEG172 [80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] +//SEG172 [80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] rts //SEG173 findcol::@12 findcol__B12: -//SEG174 [81] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 ] -- zpby1=cowo1_staridx_yby - lda 4608,y - sta 8 -//SEG175 [82] (byte~) findcol::diff#13 ← (byte) findcol::diff#6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#1 findcol::diff#13 ] -- zpby1=xby - stx 6 +//SEG174 [81] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 ] -- yby=cowo1_staridx_xby + ldy 4608,x +//SEG175 [82] (byte~) findcol::diff#13 ← (byte) findcol::diff#6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#1 findcol::diff#13 ] -- zpby1=aby + sta 6 //SEG176 [76] phi from findcol::@12 to findcol::@13 findcol__B13_from_B12: //SEG177 [76] phi (byte) findcol::mindiff#11 = (byte~) findcol::diff#13 -- register_copy @@ -8619,23 +8588,22 @@ findcol__B13_from_B12: //SEG179 findcol::@9 findcol__B9: //SEG180 [83] (byte~) findcol::$8 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 findcol::$8 ] -- aby=zpby1_minus_zpby2 - lda 11 + lda 10 sec - sbc 10 -//SEG181 [84] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$8 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 ] -- xby=zpby1_plus_aby + sbc 9 +//SEG181 [84] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$8 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 ] -- aby=zpby1_plus_aby clc adc 7 - tax //SEG182 [74] phi from findcol::@9 to findcol::@11 findcol__B11_from_B9: //SEG183 [74] phi (byte) findcol::diff#6 = (byte) findcol::diff#2 -- register_copy jmp findcol__B11 //SEG184 findcol::@6 findcol__B6: -//SEG185 [85] (byte) findcol::diff#0 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=xby_minus_zpby2 - txa +//SEG185 [85] (byte) findcol::diff#0 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=zpby1_minus_zpby2 + lda 7 sec - sbc 9 + sbc 8 sta 7 //SEG186 [70] phi from findcol::@6 to findcol::@8 findcol__B8_from_B6: @@ -8644,8 +8612,8 @@ findcol__B8_from_B6: //SEG188 findcol::@2 findcol__B2: //SEG189 [86] if((byte) findcol::y#0==(byte) findcol::yp#0) goto findcol::@return [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_eq_zpby2_then_la1 - lda 10 - cmp 11 + lda 9 + cmp 10 beq findcol__Breturn_from_B2 jmp findcol__B3 //SEG190 initscreen @@ -8662,16 +8630,16 @@ initscreen__B1_from_B1: //SEG194 [87] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy //SEG195 initscreen::@1 initscreen__B1: -//SEG196 [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ findcol::return#0 initscreen::screen#2 ] -- _star_zpptrby1=coby1 +//SEG196 [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #0 lda #230 sta (3),y -//SEG197 [89] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ findcol::return#0 initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 +//SEG197 [89] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc 3 bne !+ inc 3+1 !: -//SEG198 [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ findcol::return#0 initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 +//SEG198 [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda 3+1 cmp #>2048 bcc initscreen__B1_from_B1 @@ -8682,21 +8650,21 @@ initscreen__B1: !: //SEG199 initscreen::@return initscreen__Breturn: -//SEG200 [91] return [ findcol::return#0 ] +//SEG200 [91] return [ ] rts //SEG201 addpoint addpoint: -//SEG202 [93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ findcol::return#0 addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_yby=aby +//SEG202 [93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_yby=aby sta 4096,y -//SEG203 [94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ findcol::return#0 addpoint::idx#6 addpoint::c#6 ] -- cowo1_staridx_yby=xby +//SEG203 [94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ addpoint::idx#6 addpoint::c#6 ] -- cowo1_staridx_yby=xby txa sta 4352,y -//SEG204 [95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ findcol::return#0 ] -- cowo1_staridx_yby=zpby1 +//SEG204 [95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ ] -- cowo1_staridx_yby=zpby1 lda 2 sta 4608,y //SEG205 addpoint::@return addpoint__Breturn: -//SEG206 [96] return [ findcol::return#0 ] +//SEG206 [96] return [ ] rts FINAL SYMBOL TABLE @@ -8769,30 +8737,30 @@ FINAL SYMBOL TABLE (byte) findcol::diff#0 zp byte:7 20002.0 (byte) findcol::diff#1 zp byte:7 20002.0 (byte~) findcol::diff#13 zp byte:6 20002.0 -(byte) findcol::diff#2 reg byte x 20002.0 -(byte) findcol::diff#3 reg byte x 20002.0 +(byte) findcol::diff#2 reg byte a 20002.0 +(byte) findcol::diff#3 reg byte a 20002.0 (byte) findcol::diff#4 zp byte:7 10001.0 -(byte) findcol::diff#6 reg byte x 13334.666666666666 +(byte) findcol::diff#6 reg byte a 13334.666666666666 (byte) findcol::i -(byte) findcol::i#1 reg byte y 15001.5 -(byte) findcol::i#12 reg byte y 2631.842105263158 +(byte) findcol::i#1 reg byte x 15001.5 +(byte) findcol::i#12 reg byte x 2631.842105263158 (byte) findcol::mincol -(byte) findcol::mincol#1 zp byte:8 10001.0 -(byte) findcol::mincol#11 zp byte:8 1250.125 -(byte) findcol::mincol#2 zp byte:8 13334.666666666666 +(byte) findcol::mincol#1 reg byte y 10001.0 +(byte) findcol::mincol#11 reg byte y 1250.125 +(byte) findcol::mincol#2 reg byte y 13334.666666666666 (byte) findcol::mindiff (byte) findcol::mindiff#10 zp byte:6 1875.1875 (byte) findcol::mindiff#11 zp byte:6 10001.0 (byte) findcol::return -(byte) findcol::return#0 zp byte:8 144.76315789473685 +(byte) findcol::return#0 reg byte y 3667.333333333333 (byte) findcol::x -(byte) findcol::x#0 zp byte:9 1577.1153846153845 +(byte) findcol::x#0 zp byte:8 1782.8260869565217 (byte) findcol::xp -(byte) findcol::xp#0 reg byte x 10001.0 +(byte) findcol::xp#0 zp byte:7 10001.0 (byte) findcol::y -(byte) findcol::y#0 zp byte:10 1640.2 +(byte) findcol::y#0 zp byte:9 1863.8636363636363 (byte) findcol::yp -(byte) findcol::yp#0 zp byte:11 6250.625 +(byte) findcol::yp#0 zp byte:10 6250.625 (void()) initscreen() (label) initscreen::@1 (label) initscreen::@return @@ -8832,11 +8800,11 @@ FINAL SYMBOL TABLE zp byte:2 [ render::y#2 render::y#1 addpoint::c#6 ] zp ptr byte:3 [ render::colline#2 render::colline#1 initscreen::screen#2 initscreen::screen#1 ] zp byte:5 [ render::x#2 render::x#1 ] -reg byte y [ findcol::i#12 findcol::i#1 ] +reg byte x [ findcol::i#12 findcol::i#1 ] zp byte:6 [ findcol::mindiff#10 findcol::mindiff#11 findcol::diff#13 ] -zp byte:7 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 ] -reg byte x [ findcol::diff#6 findcol::diff#3 findcol::diff#2 ] -zp byte:8 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] +zp byte:7 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 findcol::xp#0 ] +reg byte a [ findcol::diff#6 findcol::diff#3 findcol::diff#2 ] +reg byte y [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] reg byte a [ addpoint::x#6 ] reg byte y [ addpoint::idx#6 ] reg byte x [ addpoint::y#6 ] @@ -8860,24 +8828,23 @@ reg byte a [ animate::$21 ] reg byte a [ animate::$22 ] reg byte a [ animate::$24 ] reg byte a [ animate::$25 ] -zp byte:9 [ findcol::x#0 ] -zp byte:10 [ findcol::y#0 ] +zp byte:8 [ findcol::x#0 ] +zp byte:9 [ findcol::y#0 ] reg byte a [ render::col#0 ] -reg byte x [ findcol::xp#0 ] -zp byte:11 [ findcol::yp#0 ] +zp byte:10 [ findcol::yp#0 ] reg byte a [ findcol::$10 ] reg byte a [ findcol::$8 ] FINAL CODE //SEG0 @BEGIN BBEGIN: -//SEG1 [0] call main param-assignment [ findcol::return#0 ] +//SEG1 [0] call main param-assignment [ ] jsr main //SEG2 @END BEND: //SEG3 main main: -//SEG4 [1] call addpoint param-assignment [ findcol::return#0 ] +//SEG4 [1] call addpoint param-assignment [ ] //SEG5 [92] phi from main to addpoint addpoint_from_main: //SEG6 [92] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 @@ -8892,7 +8859,7 @@ addpoint_from_main: jsr addpoint //SEG10 main::@3 main__B3: -//SEG11 [2] call addpoint param-assignment [ findcol::return#0 ] +//SEG11 [2] call addpoint param-assignment [ ] //SEG12 [92] phi from main::@3 to addpoint addpoint_from_B3: //SEG13 [92] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 @@ -8907,7 +8874,7 @@ addpoint_from_B3: jsr addpoint //SEG17 main::@4 main__B4: -//SEG18 [3] call addpoint param-assignment [ findcol::return#0 ] +//SEG18 [3] call addpoint param-assignment [ ] //SEG19 [92] phi from main::@4 to addpoint addpoint_from_B4: //SEG20 [92] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 @@ -8922,7 +8889,7 @@ addpoint_from_B4: jsr addpoint //SEG24 main::@5 main__B5: -//SEG25 [4] call addpoint param-assignment [ findcol::return#0 ] +//SEG25 [4] call addpoint param-assignment [ ] //SEG26 [92] phi from main::@5 to addpoint addpoint_from_B5: //SEG27 [92] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 @@ -8937,7 +8904,7 @@ addpoint_from_B5: jsr addpoint //SEG31 main::@6 main__B6: -//SEG32 [5] call addpoint param-assignment [ findcol::return#0 ] +//SEG32 [5] call addpoint param-assignment [ ] //SEG33 [92] phi from main::@6 to addpoint addpoint_from_B6: //SEG34 [92] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 @@ -8952,7 +8919,7 @@ addpoint_from_B6: jsr addpoint //SEG38 main::@7 main__B7: -//SEG39 [6] call addpoint param-assignment [ findcol::return#0 ] +//SEG39 [6] call addpoint param-assignment [ ] //SEG40 [92] phi from main::@7 to addpoint addpoint_from_B7: //SEG41 [92] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 @@ -8967,145 +8934,145 @@ addpoint_from_B7: jsr addpoint //SEG45 main::@8 main__B8: -//SEG46 [7] call initscreen param-assignment [ findcol::return#0 ] +//SEG46 [7] call initscreen param-assignment [ ] jsr initscreen //SEG47 main::@1 main__B1: -//SEG48 [8] call render param-assignment [ findcol::return#0 ] +//SEG48 [8] call render param-assignment [ ] jsr render //SEG49 main::@10 main__B10: -//SEG50 [9] call animate param-assignment [ findcol::return#0 ] +//SEG50 [9] call animate param-assignment [ ] jsr animate //SEG51 main::@11 main__B11: -//SEG52 [10] if(true) goto main::@1 [ findcol::return#0 ] -- true_then_la1 +//SEG52 [10] if(true) goto main::@1 [ ] -- true_then_la1 jmp main__B1 //SEG53 main::@return main__Breturn: -//SEG54 [11] return [ findcol::return#0 ] +//SEG54 [11] return [ ] rts //SEG55 animate animate: -//SEG56 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 findcol::return#0 ] -- aby=_star_cowo1 +//SEG56 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- aby=_star_cowo1 lda 4096 -//SEG57 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 findcol::return#0 ] -- aby=aby_plus_1 +//SEG57 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- aby=aby_plus_1 clc adc #1 -//SEG58 [14] *((word) 4096) ← (byte~) animate::$1 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG58 [14] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=aby sta 4096 -//SEG59 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 findcol::return#0 ] -- aby=_star_cowo1 +//SEG59 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- aby=_star_cowo1 lda 4096 -//SEG60 [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG60 [16] if((byte~) animate::$2==(byte) 40) goto animate::@1 [ ] -- aby_eq_coby1_then_la1 cmp #40 beq animate__B1 //SEG61 animate::@2 animate__B2: -//SEG62 [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 findcol::return#0 ] -- aby=_star_cowo1 +//SEG62 [17] (byte~) animate::$4 ← * (word) 4352 [ animate::$4 ] -- aby=_star_cowo1 lda 4352 -//SEG63 [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 findcol::return#0 ] -- aby=aby_plus_1 +//SEG63 [18] (byte~) animate::$5 ← (byte~) animate::$4 + (byte) 1 [ animate::$5 ] -- aby=aby_plus_1 clc adc #1 -//SEG64 [19] *((word) 4352) ← (byte~) animate::$5 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG64 [19] *((word) 4352) ← (byte~) animate::$5 [ ] -- _star_cowo1=aby sta 4352 -//SEG65 [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 findcol::return#0 ] -- aby=_star_cowo1 +//SEG65 [20] (byte~) animate::$6 ← * (word) 4352 [ animate::$6 ] -- aby=_star_cowo1 lda 4352 -//SEG66 [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG66 [21] if((byte~) animate::$6==(byte) 25) goto animate::@3 [ ] -- aby_eq_coby1_then_la1 cmp #25 beq animate__B3 //SEG67 animate::@4 animate__B4: -//SEG68 [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 findcol::return#0 ] -- xby=_star_cowo1 +//SEG68 [22] (byte~) animate::$8 ← * (word) 4097 [ animate::$8 ] -- xby=_star_cowo1 ldx 4097 -//SEG69 [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 findcol::return#0 ] -- xby=xby_minus_1 +//SEG69 [23] (byte~) animate::$9 ← (byte~) animate::$8 - (byte) 1 [ animate::$9 ] -- xby=xby_minus_1 dex -//SEG70 [24] *((word) 4097) ← (byte~) animate::$9 [ findcol::return#0 ] -- _star_cowo1=xby +//SEG70 [24] *((word) 4097) ← (byte~) animate::$9 [ ] -- _star_cowo1=xby stx 4097 -//SEG71 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 findcol::return#0 ] -- aby=_star_cowo1 +//SEG71 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- aby=_star_cowo1 lda 4097 -//SEG72 [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG72 [26] if((byte~) animate::$10==(byte) 255) goto animate::@5 [ ] -- aby_eq_coby1_then_la1 cmp #255 beq animate__B5 //SEG73 animate::@6 animate__B6: -//SEG74 [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 findcol::return#0 ] -- aby=_star_cowo1 +//SEG74 [27] (byte~) animate::$12 ← * (word) 4354 [ animate::$12 ] -- aby=_star_cowo1 lda 4354 -//SEG75 [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 findcol::return#0 ] -- aby=aby_plus_1 +//SEG75 [28] (byte~) animate::$13 ← (byte~) animate::$12 + (byte) 1 [ animate::$13 ] -- aby=aby_plus_1 clc adc #1 -//SEG76 [29] *((word) 4354) ← (byte~) animate::$13 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG76 [29] *((word) 4354) ← (byte~) animate::$13 [ ] -- _star_cowo1=aby sta 4354 -//SEG77 [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 findcol::return#0 ] -- aby=_star_cowo1 +//SEG77 [30] (byte~) animate::$14 ← * (word) 4354 [ animate::$14 ] -- aby=_star_cowo1 lda 4354 -//SEG78 [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG78 [31] if((byte~) animate::$14==(byte) 25) goto animate::@7 [ ] -- aby_eq_coby1_then_la1 cmp #25 beq animate__B7 //SEG79 animate::@8 animate__B8: -//SEG80 [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 findcol::return#0 ] -- xby=_star_cowo1 +//SEG80 [32] (byte~) animate::$16 ← * (word) 4355 [ animate::$16 ] -- xby=_star_cowo1 ldx 4355 -//SEG81 [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 findcol::return#0 ] -- xby=xby_minus_1 +//SEG81 [33] (byte~) animate::$17 ← (byte~) animate::$16 - (byte) 1 [ animate::$17 ] -- xby=xby_minus_1 dex -//SEG82 [34] *((word) 4355) ← (byte~) animate::$17 [ findcol::return#0 ] -- _star_cowo1=xby +//SEG82 [34] *((word) 4355) ← (byte~) animate::$17 [ ] -- _star_cowo1=xby stx 4355 -//SEG83 [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 findcol::return#0 ] -- aby=_star_cowo1 +//SEG83 [35] (byte~) animate::$18 ← * (word) 4355 [ animate::$18 ] -- aby=_star_cowo1 lda 4355 -//SEG84 [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ findcol::return#0 ] -- aby_eq_coby1_then_la1 +//SEG84 [36] if((byte~) animate::$18==(byte) 255) goto animate::@9 [ ] -- aby_eq_coby1_then_la1 cmp #255 beq animate__B9 //SEG85 animate::@return animate__Breturn: -//SEG86 [37] return [ findcol::return#0 ] +//SEG86 [37] return [ ] rts //SEG87 animate::@9 animate__B9: -//SEG88 [38] *((word) 4355) ← (byte) 25 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG88 [38] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 lda #25 sta 4355 -//SEG89 [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 findcol::return#0 ] -- aby=_star_cowo1 +//SEG89 [39] (byte~) animate::$20 ← * (word) 4099 [ animate::$20 ] -- aby=_star_cowo1 lda 4099 -//SEG90 [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 findcol::return#0 ] -- aby=aby_plus_coby1 +//SEG90 [40] (byte~) animate::$21 ← (byte~) animate::$20 + (byte) 7 [ animate::$21 ] -- aby=aby_plus_coby1 clc adc #7 -//SEG91 [41] *((word) 4099) ← (byte~) animate::$21 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG91 [41] *((word) 4099) ← (byte~) animate::$21 [ ] -- _star_cowo1=aby sta 4099 -//SEG92 [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 findcol::return#0 ] -- aby=_star_cowo1 +//SEG92 [42] (byte~) animate::$22 ← * (word) 4099 [ animate::$22 ] -- aby=_star_cowo1 lda 4099 -//SEG93 [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ findcol::return#0 ] -- aby_ge_coby1_then_la1 +//SEG93 [43] if((byte~) animate::$22>=(byte) 40) goto animate::@11 [ ] -- aby_ge_coby1_then_la1 cmp #40 bcs animate__B11 jmp animate__Breturn //SEG94 animate::@11 animate__B11: -//SEG95 [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 findcol::return#0 ] -- aby=_star_cowo1 +//SEG95 [44] (byte~) animate::$24 ← * (word) 4099 [ animate::$24 ] -- aby=_star_cowo1 lda 4099 -//SEG96 [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 findcol::return#0 ] -- aby=aby_minus_coby1 +//SEG96 [45] (byte~) animate::$25 ← (byte~) animate::$24 - (byte) 40 [ animate::$25 ] -- aby=aby_minus_coby1 sec sbc #40 -//SEG97 [46] *((word) 4099) ← (byte~) animate::$25 [ findcol::return#0 ] -- _star_cowo1=aby +//SEG97 [46] *((word) 4099) ← (byte~) animate::$25 [ ] -- _star_cowo1=aby sta 4099 jmp animate__Breturn //SEG98 animate::@7 animate__B7: -//SEG99 [47] *((word) 4354) ← (byte) 0 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG99 [47] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #0 sta 4354 jmp animate__B8 //SEG100 animate::@5 animate__B5: -//SEG101 [48] *((word) 4097) ← (byte) 40 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG101 [48] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 lda #40 sta 4097 jmp animate__B6 //SEG102 animate::@3 animate__B3: -//SEG103 [49] *((word) 4352) ← (byte) 0 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG103 [49] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #0 sta 4352 jmp animate__B4 //SEG104 animate::@1 animate__B1: -//SEG105 [50] *((word) 4096) ← (byte) 0 [ findcol::return#0 ] -- _star_cowo1=coby2 +//SEG105 [50] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #0 sta 4096 jmp animate__B2 @@ -9137,30 +9104,30 @@ render__B2_from_B5: //SEG117 [52] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy //SEG118 render::@2 render__B2: -//SEG119 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 ] -- zpby1=zpby2 +//SEG119 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 ] -- zpby1=zpby2 lda 5 - sta 9 -//SEG120 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] -- zpby1=zpby2 + sta 8 +//SEG120 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 ] -- zpby1=zpby2 lda 2 - sta 10 -//SEG121 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] + sta 9 +//SEG121 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] jsr findcol //SEG122 render::@5 render__B5: -//SEG123 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 render::col#0 ] -- aby=zpby1 - lda 8 -//SEG124 [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] -- zpptrby1_staridx_zpby1=aby +//SEG123 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] -- aby=yby + tya +//SEG124 [57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 render::colline#2 ] -- zpptrby1_staridx_zpby1=aby ldy 5 sta (3),y -//SEG125 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 findcol::return#0 render::colline#2 ] -- zpby1=_inc_zpby1 +//SEG125 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1=_inc_zpby1 inc 5 -//SEG126 [59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 findcol::return#0 render::colline#2 ] -- zpby1_lt_coby1_then_la1 +//SEG126 [59] if((byte) render::x#1<(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1_lt_coby1_then_la1 lda 5 cmp #40 bcc render__B2_from_B5 //SEG127 render::@3 render__B3: -//SEG128 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 findcol::return#0 ] -- zpptrby1=zpptrby1_plus_coby1 +//SEG128 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 lda 3 clc adc #40 @@ -9168,28 +9135,27 @@ render__B3: bcc !+ inc 3+1 !: -//SEG129 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 findcol::return#0 ] -- zpby1=_inc_zpby1 +//SEG129 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] -- zpby1=_inc_zpby1 inc 2 -//SEG130 [62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 findcol::return#0 ] -- zpby1_lt_coby1_then_la1 +//SEG130 [62] if((byte) render::y#1<(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ] -- zpby1_lt_coby1_then_la1 lda 2 cmp #25 bcc render__B1_from_B3 //SEG131 render::@return render__Breturn: -//SEG132 [63] return [ findcol::return#0 ] +//SEG132 [63] return [ ] rts //SEG133 findcol findcol: //SEG134 [64] phi from findcol to findcol::@1 findcol__B1_from_findcol: -//SEG135 [64] phi (byte) findcol::mincol#11 = (byte) 0 -- zpby1=coby1 - lda #0 - sta 8 +//SEG135 [64] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 + ldy #0 //SEG136 [64] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 lda #255 sta 6 -//SEG137 [64] phi (byte) findcol::i#12 = (byte) 0 -- yby=coby1 - ldy #0 +//SEG137 [64] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 + ldx #0 //SEG138 [64] phi from findcol::@13 to findcol::@1 findcol__B1_from_B13: //SEG139 [64] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy @@ -9197,26 +9163,28 @@ findcol__B1_from_B13: //SEG141 [64] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy //SEG142 findcol::@1 findcol__B1: -//SEG143 [65] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ] -- xby=cowo1_staridx_yby - ldx 4096,y -//SEG144 [66] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=cowo1_staridx_yby - lda 4352,y - sta 11 -//SEG145 [67] if((byte) findcol::x#0==(byte) findcol::xp#0) goto findcol::@2 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_eq_xby_then_la1 - cpx 9 +//SEG143 [65] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=cowo1_staridx_xby + lda 4096,x + sta 7 +//SEG144 [66] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=cowo1_staridx_xby + lda 4352,x + sta 10 +//SEG145 [67] if((byte) findcol::x#0==(byte) findcol::xp#0) goto findcol::@2 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_eq_zpby2_then_la1 + lda 8 + cmp 7 beq findcol__B2 //SEG146 findcol::@3 findcol__B3: -//SEG147 [68] if((byte) findcol::x#0<(byte) findcol::xp#0) goto findcol::@6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_lt_xby_then_la1 - cpx 9 - bcs findcol__B6 +//SEG147 [68] if((byte) findcol::x#0<(byte) findcol::xp#0) goto findcol::@6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_lt_zpby2_then_la1 + lda 8 + cmp 7 + bcc findcol__B6 //SEG148 findcol::@7 findcol__B7: -//SEG149 [69] (byte) findcol::diff#1 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#1 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=zpby2_minus_xby - stx 255 - lda 9 +//SEG149 [69] (byte) findcol::diff#1 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#1 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=zpby2_minus_zpby1 + lda 8 sec - sbc 255 + sbc 7 sta 7 //SEG150 [70] phi from findcol::@7 to findcol::@8 findcol__B8_from_B7: @@ -9224,26 +9192,25 @@ findcol__B8_from_B7: //SEG152 findcol::@8 findcol__B8: //SEG153 [71] if((byte) findcol::y#0<(byte) findcol::yp#0) goto findcol::@9 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_lt_zpby2_then_la1 - lda 10 - cmp 11 + lda 9 + cmp 10 bcc findcol__B9 //SEG154 findcol::@10 findcol__B10: //SEG155 [72] (byte~) findcol::$10 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::$10 findcol::mindiff#10 findcol::mincol#11 ] -- aby=zpby1_minus_zpby2 - lda 10 + lda 9 sec - sbc 11 -//SEG156 [73] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 ] -- xby=zpby1_plus_aby + sbc 10 +//SEG156 [73] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 ] -- aby=zpby1_plus_aby clc adc 7 - tax //SEG157 [74] phi from findcol::@10 to findcol::@11 findcol__B11_from_B10: //SEG158 [74] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy //SEG159 findcol::@11 findcol__B11: -//SEG160 [75] if((byte) findcol::diff#6<(byte) findcol::mindiff#10) goto findcol::@12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mindiff#10 findcol::mincol#11 ] -- xby_lt_zpby1_then_la1 - cpx 6 +//SEG160 [75] if((byte) findcol::diff#6<(byte) findcol::mindiff#10) goto findcol::@12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mindiff#10 findcol::mincol#11 ] -- aby_lt_zpby1_then_la1 + cmp 6 bcc findcol__B12 //SEG161 [76] phi from findcol::@11 to findcol::@13 findcol__B13_from_B11: @@ -9251,10 +9218,10 @@ findcol__B13_from_B11: //SEG163 [76] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#11 -- register_copy //SEG164 findcol::@13 findcol__B13: -//SEG165 [77] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] -- yby=_inc_yby - iny -//SEG166 [78] if((byte) findcol::i#1<(byte) 6) goto findcol::@1 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] -- yby_lt_coby1_then_la1 - cpy #6 +//SEG165 [77] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] -- xby=_inc_xby + inx +//SEG166 [78] if((byte) findcol::i#1<(byte) 6) goto findcol::@1 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#11 findcol::mincol#2 findcol::x#0 findcol::y#0 ] -- xby_lt_coby1_then_la1 + cpx #6 bcc findcol__B1_from_B13 //SEG167 [79] phi from findcol::@13 to findcol::@return findcol__Breturn_from_B13: @@ -9262,20 +9229,18 @@ findcol__Breturn_from_B13: jmp findcol__Breturn //SEG169 [79] phi from findcol::@2 to findcol::@return findcol__Breturn_from_B2: -//SEG170 [79] phi (byte) findcol::return#0 = (byte) 0 -- zpby1=coby1 - lda #0 - sta 8 +//SEG170 [79] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 + ldy #0 //SEG171 findcol::@return findcol__Breturn: -//SEG172 [80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 findcol::x#0 findcol::y#0 ] +//SEG172 [80] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] rts //SEG173 findcol::@12 findcol__B12: -//SEG174 [81] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 ] -- zpby1=cowo1_staridx_yby - lda 4608,y - sta 8 -//SEG175 [82] (byte~) findcol::diff#13 ← (byte) findcol::diff#6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#1 findcol::diff#13 ] -- zpby1=xby - stx 6 +//SEG174 [81] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 ] -- yby=cowo1_staridx_xby + ldy 4608,x +//SEG175 [82] (byte~) findcol::diff#13 ← (byte) findcol::diff#6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#1 findcol::diff#13 ] -- zpby1=aby + sta 6 //SEG176 [76] phi from findcol::@12 to findcol::@13 findcol__B13_from_B12: //SEG177 [76] phi (byte) findcol::mindiff#11 = (byte~) findcol::diff#13 -- register_copy @@ -9284,23 +9249,22 @@ findcol__B13_from_B12: //SEG179 findcol::@9 findcol__B9: //SEG180 [83] (byte~) findcol::$8 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 findcol::$8 ] -- aby=zpby1_minus_zpby2 - lda 11 + lda 10 sec - sbc 10 -//SEG181 [84] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$8 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 ] -- xby=zpby1_plus_aby + sbc 9 +//SEG181 [84] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$8 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 ] -- aby=zpby1_plus_aby clc adc 7 - tax //SEG182 [74] phi from findcol::@9 to findcol::@11 findcol__B11_from_B9: //SEG183 [74] phi (byte) findcol::diff#6 = (byte) findcol::diff#2 -- register_copy jmp findcol__B11 //SEG184 findcol::@6 findcol__B6: -//SEG185 [85] (byte) findcol::diff#0 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=xby_minus_zpby2 - txa +//SEG185 [85] (byte) findcol::diff#0 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::diff#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1=zpby1_minus_zpby2 + lda 7 sec - sbc 9 + sbc 8 sta 7 //SEG186 [70] phi from findcol::@6 to findcol::@8 findcol__B8_from_B6: @@ -9309,8 +9273,8 @@ findcol__B8_from_B6: //SEG188 findcol::@2 findcol__B2: //SEG189 [86] if((byte) findcol::y#0==(byte) findcol::yp#0) goto findcol::@return [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 ] -- zpby1_eq_zpby2_then_la1 - lda 10 - cmp 11 + lda 9 + cmp 10 beq findcol__Breturn_from_B2 jmp findcol__B3 //SEG190 initscreen @@ -9327,16 +9291,16 @@ initscreen__B1_from_B1: //SEG194 [87] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy //SEG195 initscreen::@1 initscreen__B1: -//SEG196 [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ findcol::return#0 initscreen::screen#2 ] -- _star_zpptrby1=coby1 +//SEG196 [88] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #0 lda #230 sta (3),y -//SEG197 [89] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ findcol::return#0 initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 +//SEG197 [89] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc 3 bne !+ inc 3+1 !: -//SEG198 [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ findcol::return#0 initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 +//SEG198 [90] if((byte*) initscreen::screen#1<(word) 2048) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda 3+1 cmp #>2048 bcc initscreen__B1_from_B1 @@ -9347,20 +9311,20 @@ initscreen__B1: !: //SEG199 initscreen::@return initscreen__Breturn: -//SEG200 [91] return [ findcol::return#0 ] +//SEG200 [91] return [ ] rts //SEG201 addpoint addpoint: -//SEG202 [93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ findcol::return#0 addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_yby=aby +//SEG202 [93] *((word) 4096 + (byte) addpoint::idx#6) ← (byte) addpoint::x#6 [ addpoint::idx#6 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_yby=aby sta 4096,y -//SEG203 [94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ findcol::return#0 addpoint::idx#6 addpoint::c#6 ] -- cowo1_staridx_yby=xby +//SEG203 [94] *((word) 4352 + (byte) addpoint::idx#6) ← (byte) addpoint::y#6 [ addpoint::idx#6 addpoint::c#6 ] -- cowo1_staridx_yby=xby txa sta 4352,y -//SEG204 [95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ findcol::return#0 ] -- cowo1_staridx_yby=zpby1 +//SEG204 [95] *((word) 4608 + (byte) addpoint::idx#6) ← (byte) addpoint::c#6 [ ] -- cowo1_staridx_yby=zpby1 lda 2 sta 4608,y //SEG205 addpoint::@return addpoint__Breturn: -//SEG206 [96] return [ findcol::return#0 ] +//SEG206 [96] return [ ] rts diff --git a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.sym b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.sym index ee097b072..83b7375f3 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.sym @@ -67,30 +67,30 @@ (byte) findcol::diff#0 zp byte:7 20002.0 (byte) findcol::diff#1 zp byte:7 20002.0 (byte~) findcol::diff#13 zp byte:6 20002.0 -(byte) findcol::diff#2 reg byte x 20002.0 -(byte) findcol::diff#3 reg byte x 20002.0 +(byte) findcol::diff#2 reg byte a 20002.0 +(byte) findcol::diff#3 reg byte a 20002.0 (byte) findcol::diff#4 zp byte:7 10001.0 -(byte) findcol::diff#6 reg byte x 13334.666666666666 +(byte) findcol::diff#6 reg byte a 13334.666666666666 (byte) findcol::i -(byte) findcol::i#1 reg byte y 15001.5 -(byte) findcol::i#12 reg byte y 2631.842105263158 +(byte) findcol::i#1 reg byte x 15001.5 +(byte) findcol::i#12 reg byte x 2631.842105263158 (byte) findcol::mincol -(byte) findcol::mincol#1 zp byte:8 10001.0 -(byte) findcol::mincol#11 zp byte:8 1250.125 -(byte) findcol::mincol#2 zp byte:8 13334.666666666666 +(byte) findcol::mincol#1 reg byte y 10001.0 +(byte) findcol::mincol#11 reg byte y 1250.125 +(byte) findcol::mincol#2 reg byte y 13334.666666666666 (byte) findcol::mindiff (byte) findcol::mindiff#10 zp byte:6 1875.1875 (byte) findcol::mindiff#11 zp byte:6 10001.0 (byte) findcol::return -(byte) findcol::return#0 zp byte:8 144.76315789473685 +(byte) findcol::return#0 reg byte y 3667.333333333333 (byte) findcol::x -(byte) findcol::x#0 zp byte:9 1577.1153846153845 +(byte) findcol::x#0 zp byte:8 1782.8260869565217 (byte) findcol::xp -(byte) findcol::xp#0 reg byte x 10001.0 +(byte) findcol::xp#0 zp byte:7 10001.0 (byte) findcol::y -(byte) findcol::y#0 zp byte:10 1640.2 +(byte) findcol::y#0 zp byte:9 1863.8636363636363 (byte) findcol::yp -(byte) findcol::yp#0 zp byte:11 6250.625 +(byte) findcol::yp#0 zp byte:10 6250.625 (void()) initscreen() (label) initscreen::@1 (label) initscreen::@return @@ -130,11 +130,11 @@ zp byte:2 [ render::y#2 render::y#1 addpoint::c#6 ] zp ptr byte:3 [ render::colline#2 render::colline#1 initscreen::screen#2 initscreen::screen#1 ] zp byte:5 [ render::x#2 render::x#1 ] -reg byte y [ findcol::i#12 findcol::i#1 ] +reg byte x [ findcol::i#12 findcol::i#1 ] zp byte:6 [ findcol::mindiff#10 findcol::mindiff#11 findcol::diff#13 ] -zp byte:7 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 ] -reg byte x [ findcol::diff#6 findcol::diff#3 findcol::diff#2 ] -zp byte:8 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] +zp byte:7 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 findcol::xp#0 ] +reg byte a [ findcol::diff#6 findcol::diff#3 findcol::diff#2 ] +reg byte y [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] reg byte a [ addpoint::x#6 ] reg byte y [ addpoint::idx#6 ] reg byte x [ addpoint::y#6 ] @@ -158,10 +158,9 @@ reg byte a [ animate::$21 ] reg byte a [ animate::$22 ] reg byte a [ animate::$24 ] reg byte a [ animate::$25 ] -zp byte:9 [ findcol::x#0 ] -zp byte:10 [ findcol::y#0 ] +zp byte:8 [ findcol::x#0 ] +zp byte:9 [ findcol::y#0 ] reg byte a [ render::col#0 ] -reg byte x [ findcol::xp#0 ] -zp byte:11 [ findcol::yp#0 ] +zp byte:10 [ findcol::yp#0 ] reg byte a [ findcol::$10 ] reg byte a [ findcol::$8 ]