From 616311daf817355308c8a385609b86a0d2eaadb5 Mon Sep 17 00:00:00 2001 From: Jesper Gravgaard Date: Wed, 6 Sep 2017 18:59:53 +0200 Subject: [PATCH] Finally new live ranges are working correctly - including effective live ranges for statements inside methods. --- src/main/java/dk/camelot64/kickc/TODO.txt | 4 +- .../kickc/icl/LiveRangeVariables.java | 47 +- .../kickc/icl/VariableReferenceInfo.java | 199 + .../kickc/passes/Pass3LiveRangesAnalysis.java | 199 +- .../kickc/passes/Pass4AssertNoCpuClobber.java | 3 +- .../Pass4RegisterUpliftCombinations.java | 21 +- ...gisterUpliftPotentialRegisterAnalysis.java | 7 +- .../passes/Pass4RegisterUpliftStatic.java | 11 + .../dk/camelot64/kickc/test/ref/bresenham.cfg | 35 +- .../dk/camelot64/kickc/test/ref/bresenham.log | 511 +-- .../camelot64/kickc/test/ref/bresenhamarr.cfg | 14 +- .../camelot64/kickc/test/ref/bresenhamarr.log | 144 +- .../dk/camelot64/kickc/test/ref/fibmem.log | 47 +- .../camelot64/kickc/test/ref/flipper-rex2.cfg | 108 +- .../camelot64/kickc/test/ref/flipper-rex2.log | 2071 +++++----- .../kickc/test/ref/forclassicmin.cfg | 11 +- .../kickc/test/ref/forclassicmin.log | 191 +- .../camelot64/kickc/test/ref/forrangemin.cfg | 19 +- .../camelot64/kickc/test/ref/forrangemin.log | 307 +- .../dk/camelot64/kickc/test/ref/ifmin.cfg | 13 +- .../dk/camelot64/kickc/test/ref/ifmin.log | 231 +- .../dk/camelot64/kickc/test/ref/liverange.asm | 21 + .../dk/camelot64/kickc/test/ref/liverange.cfg | 28 + .../dk/camelot64/kickc/test/ref/liverange.log | 1044 +++++ .../dk/camelot64/kickc/test/ref/liverange.sym | 25 + .../dk/camelot64/kickc/test/ref/loopmin.cfg | 2 +- .../dk/camelot64/kickc/test/ref/loopmin.log | 13 +- .../dk/camelot64/kickc/test/ref/loopnest.cfg | 22 +- .../dk/camelot64/kickc/test/ref/loopnest.log | 394 +- .../dk/camelot64/kickc/test/ref/loopnest.sym | 2 +- .../dk/camelot64/kickc/test/ref/loopnest2.cfg | 51 +- .../dk/camelot64/kickc/test/ref/loopnest2.log | 1035 +++-- .../dk/camelot64/kickc/test/ref/loopnest2.sym | 8 +- .../dk/camelot64/kickc/test/ref/loopsplit.cfg | 17 +- .../dk/camelot64/kickc/test/ref/loopsplit.log | 260 +- .../dk/camelot64/kickc/test/ref/minus.log | 14 +- .../dk/camelot64/kickc/test/ref/modglobal.cfg | 33 +- .../dk/camelot64/kickc/test/ref/modglobal.log | 407 +- .../camelot64/kickc/test/ref/modglobalmin.cfg | 21 +- .../camelot64/kickc/test/ref/modglobalmin.log | 317 +- .../dk/camelot64/kickc/test/ref/ptrtest.cfg | 69 +- .../dk/camelot64/kickc/test/ref/ptrtest.log | 983 +++-- .../dk/camelot64/kickc/test/ref/ptrtest.sym | 8 +- .../camelot64/kickc/test/ref/ptrtestmin.cfg | 11 +- .../camelot64/kickc/test/ref/ptrtestmin.log | 194 +- .../camelot64/kickc/test/ref/ptrtestmin.sym | 2 +- .../dk/camelot64/kickc/test/ref/summin.cfg | 14 +- .../dk/camelot64/kickc/test/ref/summin.log | 128 +- .../dk/camelot64/kickc/test/ref/summin.sym | 6 +- .../dk/camelot64/kickc/test/ref/useglobal.log | 8 +- .../dk/camelot64/kickc/test/ref/voronoi.cfg | 214 +- .../dk/camelot64/kickc/test/ref/voronoi.log | 3478 +++++++++-------- .../dk/camelot64/kickc/test/ref/voronoi.sym | 12 +- .../camelot64/kickc/test/ref/zpparammin.asm | 14 +- .../camelot64/kickc/test/ref/zpparammin.cfg | 53 +- .../camelot64/kickc/test/ref/zpparammin.log | 852 ++-- .../camelot64/kickc/test/ref/zpparammin.sym | 19 +- 57 files changed, 7876 insertions(+), 6096 deletions(-) create mode 100644 src/main/java/dk/camelot64/kickc/icl/VariableReferenceInfo.java create mode 100644 src/main/java/dk/camelot64/kickc/test/ref/liverange.asm create mode 100644 src/main/java/dk/camelot64/kickc/test/ref/liverange.cfg create mode 100644 src/main/java/dk/camelot64/kickc/test/ref/liverange.log create mode 100644 src/main/java/dk/camelot64/kickc/test/ref/liverange.sym diff --git a/src/main/java/dk/camelot64/kickc/TODO.txt b/src/main/java/dk/camelot64/kickc/TODO.txt index df7332bb2..5d9055ef4 100644 --- a/src/main/java/dk/camelot64/kickc/TODO.txt +++ b/src/main/java/dk/camelot64/kickc/TODO.txt @@ -5,8 +5,8 @@ TODO's for new Constant Solution - Implement constants into the symbol table and support them in code. - Implement new constant consolidation steps. - Look at optimizing liverange.kc's ASM further - atm. there are to many copy-operations into unnecesary registers. -- In summin.asm the result of the 2nd sum() is clobbered twice during call to sum(). jsr sum, txa, lda #$d, ldx #$9, jsr sum - - Fix by introducing "effective alive vars" which includes alive vars at all calls to containing methods and using that during clobber check. ++ In summin.asm the result of the 2nd sum() is clobbered twice during call to sum(). jsr sum, txa, lda #$d, ldx #$9, jsr sum + + Fix by introducing "effective alive vars" which includes alive vars at all calls to containing methods and using that during clobber check. + In loopnest.asm x&y are used in both loops - the outer x&y are clobbered by the inner loop. - In voronoi.asm in render() x is clobbered during call to findcol(). diff --git a/src/main/java/dk/camelot64/kickc/icl/LiveRangeVariables.java b/src/main/java/dk/camelot64/kickc/icl/LiveRangeVariables.java index d08bcc97c..0d057f1d1 100644 --- a/src/main/java/dk/camelot64/kickc/icl/LiveRangeVariables.java +++ b/src/main/java/dk/camelot64/kickc/icl/LiveRangeVariables.java @@ -1,18 +1,19 @@ package dk.camelot64.kickc.icl; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; +import java.util.*; /** Live ranges for all variables. - * Created by * Created by {@link dk.camelot64.kickc.passes.Pass3CallGraphAnalysis} + * Created by {@link dk.camelot64.kickc.passes.Pass3CallGraphAnalysis} */ public class LiveRangeVariables { private LinkedHashMap liveRanges; - public LiveRangeVariables() { + private Program program; + + public LiveRangeVariables(Program program) { this.liveRanges = new LinkedHashMap<>(); + this.program = program; } /** Add a single statement to the live range of a variable. @@ -67,4 +68,40 @@ public class LiveRangeVariables { return liveRanges.get(variable); } + /** + * Get all variables alive at a statement. + * If the statement is inside a method this also includes all variables alive at the exit of the calls. + *

+ * This method requires a number of other analysis to be present and updated in the (global) program - especailly the Call Graph. + *

+ * @param statement The statement to examine + * @return All variables alive at the statement + */ + public Collection getAliveEffective(Statement statement) { + // Get variables alive from live range analysis + Collection effectiveAlive = new LinkedHashSet<>(); + effectiveAlive.addAll(getAlive(statement)); + // If the statement is inside a method recurse back to all calls + // For each call add the variables alive after the call that are not referenced (used/defined) inside the method + ControlFlowBlock block = program.getGraph().getBlockFromStatementIdx(statement.getIndex()); + ScopeRef scopeRef = block.getScope(); + Scope scope = program.getScope().getScope(scopeRef); + if (scope instanceof Procedure) { + Procedure procedure = (Procedure) scope; + Collection callers = + program.getCallGraph().getCallers(procedure.getLabel().getRef()); + VariableReferenceInfo referenceInfo = new VariableReferenceInfo(program); + Collection referencedInProcedure = referenceInfo.getReferenced(procedure.getRef().getLabelRef()); + for (CallGraph.CallBlock.Call caller : callers) { + StatementCall callStatement = + (StatementCall) program.getGraph().getStatementByIndex(caller.getCallStatementIdx()); + Set callAliveEffective = new LinkedHashSet<>(getAliveEffective(callStatement)); + // Clear out any variables referenced in the method + callAliveEffective.removeAll(referencedInProcedure); + effectiveAlive.addAll(callAliveEffective); + } + } + return effectiveAlive; + } + } diff --git a/src/main/java/dk/camelot64/kickc/icl/VariableReferenceInfo.java b/src/main/java/dk/camelot64/kickc/icl/VariableReferenceInfo.java new file mode 100644 index 000000000..27022c934 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/icl/VariableReferenceInfo.java @@ -0,0 +1,199 @@ +package dk.camelot64.kickc.icl; + +import java.util.*; + +/** Information about variable referenced/used/defined in statements/blocks */ +public class VariableReferenceInfo { + + private Program program; + + public VariableReferenceInfo(Program program) { + this.program = program; + } + + public Program getProgram() { + return program; + } + + /** + * Get all variables used or defined inside a block and its successors (including any called method) + * @param labelRef The block to examine + * @return All used variables + */ + public Collection getReferenced(LabelRef labelRef) { + return getReferenced(labelRef, new ArrayList()); + } + + /** + * Get all variables used inside a block and its successors (including any called method) + * @param labelRef The block to examine + * @return All used variables + */ + public Collection getUsed(LabelRef labelRef) { + return getUsed(labelRef, new ArrayList()); + } + + /** + * Get all variables used inside a block and its successors (including any called method) + * @param labelRef The block to examine + * @param visited The blocks already visited during the search. Used to stop infinite recursion + * @return All used variables + */ + private Collection getUsed(LabelRef labelRef, Collection visited) { + if (labelRef == null) { + return new ArrayList<>(); + } + if (visited.contains(labelRef)) { + return new ArrayList<>(); + } + visited.add(labelRef); + ControlFlowBlock block = getProgram().getGraph().getBlock(labelRef); + if (block == null) { + return new ArrayList<>(); + } + LinkedHashSet used = new LinkedHashSet<>(); + for (Statement statement : block.getStatements()) { + used.addAll(getUsed(statement)); + if (statement instanceof StatementCall) { + ProcedureRef procedure = ((StatementCall) statement).getProcedure(); + used.addAll(getUsed(procedure.getLabelRef(), visited)); + } + } + used.addAll(getUsed(block.getDefaultSuccessor(), visited)); + used.addAll(getUsed(block.getConditionalSuccessor(), visited)); + return used; + } + + /** + * Get all variables used or defined inside a block and its successors (including any called method) + * @param labelRef The block to examine + * @param visited The blocks already visited during the search. Used to stop infinite recursion + * @return All used variables + */ + private Collection getReferenced(LabelRef labelRef, Collection visited) { + if (labelRef == null) { + return new ArrayList<>(); + } + if (visited.contains(labelRef)) { + return new ArrayList<>(); + } + visited.add(labelRef); + ControlFlowBlock block = getProgram().getGraph().getBlock(labelRef); + if (block == null) { + return new ArrayList<>(); + } + LinkedHashSet referenced = new LinkedHashSet<>(); + for (Statement statement : block.getStatements()) { + referenced.addAll(getReferenced(statement)); + if (statement instanceof StatementCall) { + ProcedureRef procedure = ((StatementCall) statement).getProcedure(); + referenced.addAll(getReferenced(procedure.getLabelRef(), visited)); + } + } + referenced.addAll(getReferenced(block.getDefaultSuccessor(), visited)); + referenced.addAll(getReferenced(block.getConditionalSuccessor(), visited)); + return referenced; + } + + /** + * Get the variables defined by a statement + * @param stmt The statement + * @return Variables defined by the statement + */ + public Collection getDefined(Statement stmt) { + if (stmt instanceof StatementAssignment) { + StatementAssignment assignment = (StatementAssignment) stmt; + LValue lValue = assignment.getlValue(); + if (lValue instanceof VariableRef) { + return Arrays.asList((VariableRef) lValue); + } + } else if (stmt instanceof StatementPhiBlock) { + List defined = new ArrayList<>(); + StatementPhiBlock phi = (StatementPhiBlock) stmt; + for (StatementPhiBlock.PhiVariable phiVariable : phi.getPhiVariables()) { + defined.add(phiVariable.getVariable()); + } + return defined; + } + return new ArrayList<>(); + } + + /** + * Get the variables used, but not defined, in a statement + * @param statement The statement to examine + * @return The used variables (not including defined variables) + */ + public Collection getUsed(Statement statement) { + LinkedHashSet used = new LinkedHashSet<>(); + used.addAll(getReferenced(statement)); + used.removeAll(getDefined(statement)); + return used; + } + + /** + * Get the variables referenced (used or defined) in a statement + * @param statement The statement to examine + * @return The referenced variables + */ + public Collection getReferenced(Statement statement) { + LinkedHashSet referenced = new LinkedHashSet<>(); + if (statement instanceof StatementPhiBlock) { + StatementPhiBlock phiBlock = (StatementPhiBlock) statement; + for (StatementPhiBlock.PhiVariable phiVariable : phiBlock.getPhiVariables()) { + referenced.add(phiVariable.getVariable()); + for (StatementPhiBlock.PhiRValue phiRValue : phiVariable.getValues()) { + referenced.addAll(getReferenced(phiRValue.getrValue())); + } + } + } else if (statement instanceof StatementAssignment) { + StatementAssignment assignment = (StatementAssignment) statement; + referenced.addAll(getReferenced(assignment.getlValue())); + referenced.addAll(getReferenced(assignment.getrValue1())); + referenced.addAll(getReferenced(assignment.getrValue2())); + } else if (statement instanceof StatementConditionalJump) { + StatementConditionalJump conditionalJump = (StatementConditionalJump) statement; + referenced.addAll(getReferenced(conditionalJump.getrValue1())); + referenced.addAll(getReferenced(conditionalJump.getrValue2())); + } else if (statement instanceof StatementCall) { + StatementCall call = (StatementCall) statement; + referenced.addAll(getReferenced(call.getlValue())); + if (call.getParameters() != null) { + for (RValue param : call.getParameters()) { + referenced.addAll(getReferenced(param)); + } + } + } else if (statement instanceof StatementReturn) { + StatementReturn statementReturn = (StatementReturn) statement; + referenced.addAll(getReferenced(statementReturn.getValue())); + } else { + throw new RuntimeException("Unknown statement type " + statement); + } + return referenced; + } + + /** + * Get all variables referenced in an rValue + * @param rValue The rValue + * @return All referenced variables + */ + private Collection getReferenced(RValue rValue) { + if (rValue == null) { + return new ArrayList<>(); + } else if (rValue instanceof Constant) { + return new ArrayList<>(); + } else if (rValue instanceof PointerDereferenceSimple) { + return getReferenced(((PointerDereferenceSimple) rValue).getPointer()); + } else if (rValue instanceof PointerDereferenceIndexed) { + Collection used = new LinkedHashSet<>(); + used.addAll(getReferenced(((PointerDereferenceIndexed) rValue).getPointer())); + used.addAll(getReferenced(((PointerDereferenceIndexed) rValue).getIndex())); + return used; + } else if (rValue instanceof VariableRef) { + return Arrays.asList((VariableRef) rValue); + } else { + throw new RuntimeException("Unhandled RValue type " + rValue); + } + } + + +} diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3LiveRangesAnalysis.java b/src/main/java/dk/camelot64/kickc/passes/Pass3LiveRangesAnalysis.java index f37594bad..37179d9c6 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass3LiveRangesAnalysis.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3LiveRangesAnalysis.java @@ -15,7 +15,7 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { } public void findLiveRanges() { - LiveRangeVariables liveRanges = new LiveRangeVariables(); + LiveRangeVariables liveRanges = new LiveRangeVariables(getProgram()); boolean propagating; do { propagating = calculateLiveRanges(liveRanges); @@ -51,11 +51,12 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { * @return true if any live ranges was modified. false if no modification was performed (and the propagation is complete) */ private boolean calculateLiveRanges(LiveRangeVariables liveRanges) { + VariableReferenceInfo referenceInfo = new VariableReferenceInfo(getProgram()); boolean modified = false; for (ControlFlowBlock block : getProgram().getGraph().getAllBlocks()) { for (Statement stmt : block.getStatements()) { List aliveNextStmt = liveRanges.getAlive(stmt); - Collection definedNextStmt = getDefined(stmt); + Collection definedNextStmt = referenceInfo.getDefined(stmt); initLiveRange(liveRanges, definedNextStmt); Collection previousStmts = getPreviousStatements(stmt); for (PreviousStatement previousStmt : previousStmts) { @@ -76,7 +77,7 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { // Add all vars that are referenced in the method StatementCall call = (StatementCall) stmt; ProcedureRef procedure = call.getProcedure(); - Collection procUsed = getReferenced(procedure.getLabelRef()); + Collection procUsed = referenceInfo.getReferenced(procedure.getLabelRef()); // The call statement has no used or defined by itself so only work with the alive vars for (VariableRef aliveVar : aliveNextStmt) { // Add all variables to previous that are not used inside the method @@ -92,7 +93,7 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { // Add all vars that the method does not use StatementCall call = (StatementCall) stmt; ProcedureRef procedure = call.getProcedure(); - Collection procUsed = getReferenced(procedure.getLabelRef()); + Collection procUsed = referenceInfo.getReferenced(procedure.getLabelRef()); // The call statement has no used or defined by itself so only work with the alive vars for (VariableRef aliveVar : aliveNextStmt) { // Add all variables to previous that are not used inside the method @@ -110,7 +111,7 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { // Add all alive variables to previous that are used inside the method ControlFlowBlock procBlock = getProgram().getGraph().getBlockFromStatementIdx(stmt.getIndex()); Procedure procedure = (Procedure) getProgram().getScope().getSymbol(procBlock.getLabel()); - Collection procUsed = getUsed(procedure.getRef().getLabelRef()); + Collection procUsed = referenceInfo.getUsed(procedure.getRef().getLabelRef()); // The call statement has no used or defined by itself so only work with the alive vars for (VariableRef aliveVar : aliveNextStmt) { // Add all variables to previous that are used inside the method @@ -146,7 +147,8 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { Statement stmt, PreviousStatement previousStmt) { boolean modified = false; - Collection usedNextStmt = getUsed(stmt); + VariableReferenceInfo referenceInfo = new VariableReferenceInfo(getProgram()); + Collection usedNextStmt = referenceInfo.getUsed(stmt); if (stmt instanceof StatementPhiBlock) { // If current statement is a phi add the used variables to previous based on the phi entries StatementPhiBlock phi = (StatementPhiBlock) stmt; @@ -179,185 +181,6 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { return modified; } - /** - * Get all variables used or defined inside a block and its successors (including any called method) - * @param labelRef The block to examine - * @return All used variables - */ - private Collection getReferenced(LabelRef labelRef) { - return getReferenced(labelRef, new ArrayList()); - } - - /** - * Get all variables used inside a block and its successors (including any called method) - * @param labelRef The block to examine - * @return All used variables - */ - private Collection getUsed(LabelRef labelRef) { - return getUsed(labelRef, new ArrayList()); - } - - /** - * Get all variables used inside a block and its successors (including any called method) - * @param labelRef The block to examine - * @param visited The blocks already visited during the search. Used to stop infinite recursion - * @return All used variables - */ - private Collection getUsed(LabelRef labelRef, Collection visited) { - if (labelRef == null) { - return new ArrayList<>(); - } - if (visited.contains(labelRef)) { - return new ArrayList<>(); - } - visited.add(labelRef); - ControlFlowBlock block = getProgram().getGraph().getBlock(labelRef); - if (block == null) { - return new ArrayList<>(); - } - LinkedHashSet used = new LinkedHashSet<>(); - for (Statement statement : block.getStatements()) { - used.addAll(getUsed(statement)); - if (statement instanceof StatementCall) { - ProcedureRef procedure = ((StatementCall) statement).getProcedure(); - used.addAll(getUsed(procedure.getLabelRef(), visited)); - } - } - used.addAll(getUsed(block.getDefaultSuccessor(), visited)); - used.addAll(getUsed(block.getConditionalSuccessor(), visited)); - return used; - } - - /** - * Get all variables used or defined inside a block and its successors (including any called method) - * @param labelRef The block to examine - * @param visited The blocks already visited during the search. Used to stop infinite recursion - * @return All used variables - */ - private Collection getReferenced(LabelRef labelRef, Collection visited) { - if (labelRef == null) { - return new ArrayList<>(); - } - if (visited.contains(labelRef)) { - return new ArrayList<>(); - } - visited.add(labelRef); - ControlFlowBlock block = getProgram().getGraph().getBlock(labelRef); - if (block == null) { - return new ArrayList<>(); - } - LinkedHashSet referenced = new LinkedHashSet<>(); - for (Statement statement : block.getStatements()) { - referenced.addAll(getReferenced(statement)); - if (statement instanceof StatementCall) { - ProcedureRef procedure = ((StatementCall) statement).getProcedure(); - referenced.addAll(getReferenced(procedure.getLabelRef(), visited)); - } - } - referenced.addAll(getReferenced(block.getDefaultSuccessor(), visited)); - referenced.addAll(getReferenced(block.getConditionalSuccessor(), visited)); - return referenced; - } - - /** - * Get the variables defined by a statement - * @param stmt The statement - * @return Variables defined by the statement - */ - private Collection getDefined(Statement stmt) { - if (stmt instanceof StatementAssignment) { - StatementAssignment assignment = (StatementAssignment) stmt; - LValue lValue = assignment.getlValue(); - if (lValue instanceof VariableRef) { - return Arrays.asList((VariableRef) lValue); - } - } else if (stmt instanceof StatementPhiBlock) { - List defined = new ArrayList<>(); - StatementPhiBlock phi = (StatementPhiBlock) stmt; - for (StatementPhiBlock.PhiVariable phiVariable : phi.getPhiVariables()) { - defined.add(phiVariable.getVariable()); - } - return defined; - } - return new ArrayList<>(); - } - - /** - * Get the variables used, but not defined, in a statement - * @param statement The statement to examine - * @return The used variables (not including defined variables) - */ - private Collection getUsed(Statement statement) { - LinkedHashSet used = new LinkedHashSet<>(); - used.addAll(getReferenced(statement)); - used.removeAll(getDefined(statement)); - return used; - } - - /** - * Get the variables referenced (used or defined) in a statement - * @param statement The statement to examine - * @return The referenced variables - */ - private Collection getReferenced(Statement statement) { - LinkedHashSet referenced = new LinkedHashSet<>(); - if (statement instanceof StatementPhiBlock) { - StatementPhiBlock phiBlock = (StatementPhiBlock) statement; - for (StatementPhiBlock.PhiVariable phiVariable : phiBlock.getPhiVariables()) { - referenced.add(phiVariable.getVariable()); - for (StatementPhiBlock.PhiRValue phiRValue : phiVariable.getValues()) { - referenced.addAll(getReferenced(phiRValue.getrValue())); - } - } - } else if (statement instanceof StatementAssignment) { - StatementAssignment assignment = (StatementAssignment) statement; - referenced.addAll(getReferenced(assignment.getlValue())); - referenced.addAll(getReferenced(assignment.getrValue1())); - referenced.addAll(getReferenced(assignment.getrValue2())); - } else if (statement instanceof StatementConditionalJump) { - StatementConditionalJump conditionalJump = (StatementConditionalJump) statement; - referenced.addAll(getReferenced(conditionalJump.getrValue1())); - referenced.addAll(getReferenced(conditionalJump.getrValue2())); - } else if (statement instanceof StatementCall) { - StatementCall call = (StatementCall) statement; - referenced.addAll(getReferenced(call.getlValue())); - if (call.getParameters() != null) { - for (RValue param : call.getParameters()) { - referenced.addAll(getReferenced(param)); - } - } - } else if (statement instanceof StatementReturn) { - StatementReturn statementReturn = (StatementReturn) statement; - referenced.addAll(getReferenced(statementReturn.getValue())); - } else { - throw new RuntimeException("Unknown statement type " + statement); - } - return referenced; - } - - /** - * Get all variables referenced in an rValue - * @param rValue The rValue - * @return All referenced variables - */ - private Collection getReferenced(RValue rValue) { - if (rValue == null) { - return new ArrayList<>(); - } else if (rValue instanceof Constant) { - return new ArrayList<>(); - } else if (rValue instanceof PointerDereferenceSimple) { - return getReferenced(((PointerDereferenceSimple) rValue).getPointer()); - } else if (rValue instanceof PointerDereferenceIndexed) { - Collection used = new LinkedHashSet<>(); - used.addAll(getReferenced(((PointerDereferenceIndexed) rValue).getPointer())); - used.addAll(getReferenced(((PointerDereferenceIndexed) rValue).getIndex())); - return used; - } else if (rValue instanceof VariableRef) { - return Arrays.asList((VariableRef) rValue); - } else { - throw new RuntimeException("Unhandled RValue type " + rValue); - } - } /** A statement just before the current statement. */ @@ -383,7 +206,7 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { SKIP_METHOD } - public PreviousStatement(Statement statement, Type type) { + PreviousStatement(Statement statement, Type type) { this.statement = statement; this.type = type; } @@ -456,7 +279,9 @@ public class Pass3LiveRangesAnalysis extends Pass2Base { LiveRange lValLiveRange = liveRanges.getLiveRange(variableRef); if (lValLiveRange == null) { liveRanges.addEmptyAlive(variableRef); - getProgram().getLog().append("Adding empty live range for unused variable " + variableRef); + if(getProgram().getLog().isVerboseLiveRanges()) { + getProgram().getLog().append("Adding empty live range for unused variable " + variableRef); + } } } } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4AssertNoCpuClobber.java b/src/main/java/dk/camelot64/kickc/passes/Pass4AssertNoCpuClobber.java index babd7c012..827f2b208 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4AssertNoCpuClobber.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4AssertNoCpuClobber.java @@ -31,7 +31,6 @@ public class Pass4AssertNoCpuClobber extends Pass2Base { * @return true if there is a clobber problem in the program */ public boolean hasClobberProblem(boolean verbose) { - LiveRangeVariables liveRangeVariables = getProgram().getLiveRangeVariables(); AsmProgram asm = getProgram().getAsm(); boolean clobberProblem = false; for (AsmSegment asmSegment : asm.getSegments()) { @@ -65,7 +64,7 @@ public class Pass4AssertNoCpuClobber extends Pass2Base { } // Find alive variables - List aliveVars = new ArrayList<>(liveRangeVariables.getAlive(statement)); + List aliveVars = new ArrayList<>(getProgram().getLiveRangeVariables().getAliveEffective(statement)); // Non-assigned alive variables must not be clobbered for (VariableRef aliveVar : aliveVars) { Registers.Register aliveVarRegister = getProgram().getScope().getVariable(aliveVar).getAllocation(); diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftCombinations.java b/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftCombinations.java index 2283110e9..d2f5c0672 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftCombinations.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftCombinations.java @@ -219,9 +219,8 @@ public class Pass4RegisterUpliftCombinations extends Pass2Base { Program program, Statement statement, LinkedHashMap usedRegisters) { - LiveRangeVariables liveRangeVariables = program.getLiveRangeVariables(); ProgramScope programScope = program.getScope(); - List alive = liveRangeVariables.getAlive(statement); + Collection alive = program.getLiveRangeVariables().getAliveEffective(statement); for (VariableRef varRef : alive) { Variable var = programScope.getVariable(varRef); Registers.Register allocation = var.getAllocation(); @@ -238,23 +237,7 @@ public class Pass4RegisterUpliftCombinations extends Pass2Base { program.getLiveRangeEquivalenceClassSet().getEquivalenceClass(varRef); usedRegisters.put(allocation, varClass); } - - // If the statement is inside a method -also check against all variables alive at the exit of the calls. - ControlFlowBlock block = program.getGraph().getBlockFromStatementIdx(statement.getIndex()); - ScopeRef scopeRef = block.getScope(); - Scope scope = program.getScope().getScope(scopeRef); - if (scope instanceof Procedure) { - Procedure procedure = (Procedure) scope; - Collection callers = - program.getCallGraph().getCallers(procedure.getLabel().getRef()); - for (CallGraph.CallBlock.Call caller : callers) { - StatementCall callStatement = - (StatementCall) program.getGraph().getStatementByIndex(caller.getCallStatementIdx()); - if (isStatementAllocationOverlapping(program, callStatement, usedRegisters)) { - return true; - } - } - } return false; } + } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftPotentialRegisterAnalysis.java b/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftPotentialRegisterAnalysis.java index 4e082fc30..4bf80a57e 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftPotentialRegisterAnalysis.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftPotentialRegisterAnalysis.java @@ -51,12 +51,13 @@ public class Pass4RegisterUpliftPotentialRegisterAnalysis extends Pass2Base { } } + VariableReferenceInfo referenceInfo = new VariableReferenceInfo(getProgram()); for (ControlFlowBlock block : getProgram().getGraph().getAllBlocks()) { for (Statement statement : block.getStatements()) { // Find all variables referenced/assigned in the statement - Set referencedVars = getReferencedVars(statement); - Set assignedVars = getAssignedVars(statement); + Set referencedVars = new HashSet<>(referenceInfo.getReferenced(statement)); + Set assignedVars = new HashSet<>(referenceInfo.getDefined(statement)); // Find referenced/assigned live range equivalence classes Set assignedClasses = new LinkedHashSet<>(); @@ -89,7 +90,7 @@ public class Pass4RegisterUpliftPotentialRegisterAnalysis extends Pass2Base { } // For all non-assigned live variables: remove always clobbered registers from their potential allocation - List aliveVars = getProgram().getLiveRangeVariables().getAlive(statement); + Collection aliveVars = getProgram().getLiveRangeVariables().getAliveEffective(statement); for (VariableRef aliveVar : aliveVars) { LiveRangeEquivalenceClass aliveClass = liveRangeEquivalenceClassSet.getEquivalenceClass(aliveVar); if (assignedClasses.contains(aliveClass)) { diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftStatic.java b/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftStatic.java index 1cb08cec0..9bed6ad11 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftStatic.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftStatic.java @@ -37,6 +37,17 @@ public class Pass4RegisterUpliftStatic extends Pass2Base { setRegister(combination, "inccnt::return#0", Registers.getRegisterA()); */ + // Good combination for liverange.kc + setRegister(combination, "inc::$0", Registers.getRegisterX()); + setRegister(combination, "main::$0", Registers.getRegisterA()); + setRegister(combination, "inc::return#0", Registers.getRegisterA()); + setRegister(combination, "main::a#1", new Registers.RegisterZpByte(2)); + setRegister(combination, "main::$2", Registers.getRegisterA()); + setRegister(combination, "main::a#2", Registers.getRegisterA()); + setRegister(combination, "i#11", Registers.getRegisterX()); + setRegister(combination, "inc::$0", Registers.getRegisterX()); + + boolean success = Pass4RegisterUpliftCombinations.generateCombinationAsm( combination, getProgram(), diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.cfg b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.cfg index a67f2ed11..aab64cdf8 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.cfg @@ -3,29 +3,30 @@ to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@2 - [1] (byte) main::y#2 ← phi( main/(byte) 0 main::@2/(byte) main::y#4 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [1] (byte) main::e#3 ← phi( main/(byte) 12 main::@2/(byte) main::e#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [1] (byte) main::x#2 ← phi( main/(byte) 0 main::@2/(byte) main::x#1 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [1] (byte*) main::cursor#3 ← phi( main/(word) 1024 main::@2/(byte*) main::cursor#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] - [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] - [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] - [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] + [2] (byte) main::y#2 ← phi( main/(byte) 0 main::@2/(byte) main::y#4 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [2] (byte) main::e#3 ← phi( main/(byte) 12 main::@2/(byte) main::e#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [2] (byte) main::x#2 ← phi( main/(byte) 0 main::@2/(byte) main::x#1 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [2] (byte*) main::cursor#3 ← phi( main/(word) 1024 main::@2/(byte*) main::cursor#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] + [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] + [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] + [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] to:main::@3 main::@3: scope:[main] from main::@1 - [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] - [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] - [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] + [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] + [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] + [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] to:main::@2 main::@2: scope:[main] from main::@1 main::@3 - [10] (byte) main::y#4 ← phi( main::@1/(byte) main::y#2 main::@3/(byte) main::y#1 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] - [10] (byte) main::e#5 ← phi( main::@1/(byte) main::e#1 main::@3/(byte) main::e#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] - [10] (byte*) main::cursor#5 ← phi( main::@1/(byte*) main::cursor#1 main::@3/(byte*) main::cursor#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] - [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] + [11] (byte) main::y#4 ← phi( main::@1/(byte) main::y#2 main::@3/(byte) main::y#1 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] + [11] (byte) main::e#5 ← phi( main::@1/(byte) main::e#1 main::@3/(byte) main::e#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] + [11] (byte*) main::cursor#5 ← phi( main::@1/(byte*) main::cursor#1 main::@3/(byte*) main::cursor#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] + [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] to:main::@return main::@return: scope:[main] from main::@2 - [12] return [ ] + [13] return [ ] to:@return 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 56beae5a6..678c0d317 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log @@ -1332,6 +1332,10 @@ main::@6: scope:[main] from main::@1 (byte~) main::y#6 ← (byte) main::y#2 to:main::@2 +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to 0:main + Propagating live ranges... Propagating live ranges... Propagating live ranges... @@ -1339,68 +1343,72 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@5 - [1] (byte) main::y#2 ← phi( main/(byte) 0 main::@5/(byte~) main::y#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [1] (byte) main::e#3 ← phi( main/(byte) 12 main::@5/(byte~) main::e#6 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [1] (byte) main::x#2 ← phi( main/(byte) 0 main::@5/(byte~) main::x#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [1] (byte*) main::cursor#3 ← phi( main/(word) 1024 main::@5/(byte*~) main::cursor#6 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] - [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::cursor#1 main::x#1 ] - [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::e#1 main::y#2 main::cursor#1 main::x#1 ] - [6] if((byte) 39>=(byte) main::e#1) goto main::@6 [ main::e#1 main::y#2 main::cursor#1 main::x#1 ] + [2] (byte) main::y#2 ← phi( main/(byte) 0 main::@5/(byte~) main::y#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [2] (byte) main::e#3 ← phi( main/(byte) 12 main::@5/(byte~) main::e#6 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [2] (byte) main::x#2 ← phi( main/(byte) 0 main::@5/(byte~) main::x#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [2] (byte*) main::cursor#3 ← phi( main/(word) 1024 main::@5/(byte*~) main::cursor#6 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] + [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] + [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] + [7] if((byte) 39>=(byte) main::e#1) goto main::@6 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] to:main::@3 main::@3: scope:[main] from main::@1 - [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::e#1 main::cursor#1 main::y#1 main::x#1 ] - [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::e#1 main::cursor#2 main::y#1 main::x#1 ] - [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::cursor#2 main::e#2 main::y#1 main::x#1 ] - [10] (byte*~) main::cursor#8 ← (byte*) main::cursor#2 [ main::e#2 main::y#1 main::cursor#8 main::x#1 ] - [11] (byte~) main::e#8 ← (byte) main::e#2 [ main::y#1 main::cursor#8 main::e#8 main::x#1 ] - [12] (byte~) main::y#7 ← (byte) main::y#1 [ main::cursor#8 main::e#8 main::y#7 main::x#1 ] + [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] + [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] + [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] + [11] (byte*~) main::cursor#8 ← (byte*) main::cursor#2 [ main::x#1 main::y#1 main::e#2 main::cursor#8 ] + [12] (byte~) main::e#8 ← (byte) main::e#2 [ main::x#1 main::y#1 main::cursor#8 main::e#8 ] + [13] (byte~) main::y#7 ← (byte) main::y#1 [ main::x#1 main::cursor#8 main::e#8 main::y#7 ] to:main::@2 main::@2: scope:[main] from main::@3 main::@6 - [13] (byte) main::y#4 ← phi( main::@6/(byte~) main::y#6 main::@3/(byte~) main::y#7 ) [ main::x#1 main::cursor#5 main::e#5 main::y#4 ] - [13] (byte) main::e#5 ← phi( main::@6/(byte~) main::e#7 main::@3/(byte~) main::e#8 ) [ main::x#1 main::cursor#5 main::e#5 main::y#4 ] - [13] (byte*) main::cursor#5 ← phi( main::@6/(byte*~) main::cursor#7 main::@3/(byte*~) main::cursor#8 ) [ main::x#1 main::cursor#5 main::e#5 main::y#4 ] - [14] if((byte) main::x#1<(byte) 40) goto main::@5 [ main::x#1 main::cursor#5 main::e#5 main::y#4 ] + [14] (byte) main::y#4 ← phi( main::@6/(byte~) main::y#6 main::@3/(byte~) main::y#7 ) [ main::x#1 main::cursor#5 main::e#5 main::y#4 ] + [14] (byte) main::e#5 ← phi( main::@6/(byte~) main::e#7 main::@3/(byte~) main::e#8 ) [ main::x#1 main::cursor#5 main::e#5 main::y#4 ] + [14] (byte*) main::cursor#5 ← phi( main::@6/(byte*~) main::cursor#7 main::@3/(byte*~) main::cursor#8 ) [ main::x#1 main::cursor#5 main::e#5 main::y#4 ] + [15] if((byte) main::x#1<(byte) 40) goto main::@5 [ main::x#1 main::cursor#5 main::e#5 main::y#4 ] to:main::@return main::@return: scope:[main] from main::@2 - [15] return [ ] + [16] return [ ] to:@return main::@5: scope:[main] from main::@2 - [16] (byte*~) main::cursor#6 ← (byte*) main::cursor#5 [ main::cursor#6 main::x#1 main::e#5 main::y#4 ] - [17] (byte~) main::x#5 ← (byte) main::x#1 [ main::cursor#6 main::x#5 main::e#5 main::y#4 ] - [18] (byte~) main::e#6 ← (byte) main::e#5 [ main::cursor#6 main::x#5 main::e#6 main::y#4 ] - [19] (byte~) main::y#5 ← (byte) main::y#4 [ main::cursor#6 main::x#5 main::e#6 main::y#5 ] + [17] (byte*~) main::cursor#6 ← (byte*) main::cursor#5 [ main::cursor#6 main::x#1 main::e#5 main::y#4 ] + [18] (byte~) main::x#5 ← (byte) main::x#1 [ main::cursor#6 main::x#5 main::e#5 main::y#4 ] + [19] (byte~) main::e#6 ← (byte) main::e#5 [ main::cursor#6 main::x#5 main::e#6 main::y#4 ] + [20] (byte~) main::y#5 ← (byte) main::y#4 [ main::cursor#6 main::x#5 main::e#6 main::y#5 ] to:main::@1 main::@6: scope:[main] from main::@1 - [20] (byte*~) main::cursor#7 ← (byte*) main::cursor#1 [ main::e#1 main::y#2 main::cursor#7 main::x#1 ] - [21] (byte~) main::e#7 ← (byte) main::e#1 [ main::y#2 main::cursor#7 main::e#7 main::x#1 ] - [22] (byte~) main::y#6 ← (byte) main::y#2 [ main::cursor#7 main::e#7 main::y#6 main::x#1 ] + [21] (byte*~) main::cursor#7 ← (byte*) main::cursor#1 [ main::y#2 main::x#1 main::e#1 main::cursor#7 ] + [22] (byte~) main::e#7 ← (byte) main::e#1 [ main::y#2 main::x#1 main::cursor#7 main::e#7 ] + [23] (byte~) main::y#6 ← (byte) main::y#2 [ main::x#1 main::cursor#7 main::e#7 main::y#6 ] to:main::@2 Created 7 initial phi equivalence classes -Coalesced [10] main::cursor#8 ← main::cursor#2 -Coalesced [11] main::e#8 ← main::e#2 -Coalesced [12] main::y#7 ← main::y#1 -Coalesced [16] main::cursor#6 ← main::cursor#5 -Coalesced [17] main::x#5 ← main::x#1 -Coalesced [18] main::e#6 ← main::e#5 -Coalesced [19] main::y#5 ← main::y#4 -Coalesced [20] main::cursor#7 ← main::cursor#1 -Coalesced [21] main::e#7 ← main::e#1 -Coalesced (already) [22] main::y#6 ← main::y#2 +Coalesced [11] main::cursor#8 ← main::cursor#2 +Coalesced [12] main::e#8 ← main::e#2 +Coalesced [13] main::y#7 ← main::y#1 +Coalesced [17] main::cursor#6 ← main::cursor#5 +Coalesced [18] main::x#5 ← main::x#1 +Coalesced [19] main::e#6 ← main::e#5 +Coalesced [20] main::y#5 ← main::y#4 +Coalesced [21] main::cursor#7 ← main::cursor#1 +Coalesced [22] main::e#7 ← main::e#1 +Coalesced (already) [23] main::y#6 ← main::y#2 Coalesced down to 4 phi equivalence classes Culled Empty Block (label) main::@5 Culled Empty Block (label) main::@6 Block Sequence Planned @begin @end main main::@1 main::@3 main::@2 main::@return +Adding NOP phi() at start of main +Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... @@ -1413,36 +1421,34 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@2 - [1] (byte) main::y#2 ← phi( main/(byte) 0 main::@2/(byte) main::y#4 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [1] (byte) main::e#3 ← phi( main/(byte) 12 main::@2/(byte) main::e#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [1] (byte) main::x#2 ← phi( main/(byte) 0 main::@2/(byte) main::x#1 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [1] (byte*) main::cursor#3 ← phi( main/(word) 1024 main::@2/(byte*) main::cursor#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] - [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] - [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] - [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] - [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] + [2] (byte) main::y#2 ← phi( main/(byte) 0 main::@2/(byte) main::y#4 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [2] (byte) main::e#3 ← phi( main/(byte) 12 main::@2/(byte) main::e#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [2] (byte) main::x#2 ← phi( main/(byte) 0 main::@2/(byte) main::x#1 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [2] (byte*) main::cursor#3 ← phi( main/(word) 1024 main::@2/(byte*) main::cursor#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] + [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] + [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] + [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] + [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] to:main::@3 main::@3: scope:[main] from main::@1 - [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] - [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] - [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] + [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] + [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] + [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] to:main::@2 main::@2: scope:[main] from main::@1 main::@3 - [10] (byte) main::y#4 ← phi( main::@1/(byte) main::y#2 main::@3/(byte) main::y#1 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] - [10] (byte) main::e#5 ← phi( main::@1/(byte) main::e#1 main::@3/(byte) main::e#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] - [10] (byte*) main::cursor#5 ← phi( main::@1/(byte*) main::cursor#1 main::@3/(byte*) main::cursor#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] - [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] + [11] (byte) main::y#4 ← phi( main::@1/(byte) main::y#2 main::@3/(byte) main::y#1 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] + [11] (byte) main::e#5 ← phi( main::@1/(byte) main::e#1 main::@3/(byte) main::e#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] + [11] (byte*) main::cursor#5 ← phi( main::@1/(byte*) main::cursor#1 main::@3/(byte*) main::cursor#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] + [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] to:main::@return main::@return: scope:[main] from main::@2 - [12] return [ ] + [13] return [ ] to:@return -CALL GRAPH -Calls in [] to 0:main - DOMINATORS @begin dominated by @begin @end dominated by @end @begin @@ -1511,68 +1517,70 @@ INITIAL ASM //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main jmp bend -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { .label x = 4 .label cursor = 2 .label e = 5 .label y = 6 - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1 + //SEG7 [2] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta y - //SEG7 [1] phi (byte) main::e#3 = (byte) 12 -- zpby1=coby1 + //SEG8 [2] phi (byte) main::e#3 = (byte) 12 -- zpby1=coby1 lda #$c sta e - //SEG8 [1] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1 + //SEG9 [2] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x - //SEG9 [1] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1 + //SEG10 [2] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta cursor lda #>$400 sta cursor+$1 jmp b1 - //SEG10 [1] phi from main::@2 to main::@1 + //SEG11 [2] phi from main::@2 to main::@1 b1_from_b2: - //SEG11 [1] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy - //SEG12 [1] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy - //SEG13 [1] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy - //SEG14 [1] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy + //SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy + //SEG13 [2] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy + //SEG14 [2] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy + //SEG15 [2] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy jmp b1 - //SEG15 main::@1 + //SEG16 main::@1 b1: - //SEG16 [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1 + //SEG17 [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$51 sta (cursor),y - //SEG17 [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] -- zpby1=zpby1_plus_1 + //SEG18 [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] -- zpby1=zpby1_plus_1 inc x - //SEG18 [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1 + //SEG19 [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1 inc cursor bne !+ inc cursor+$1 !: - //SEG19 [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- zpby1=zpby1_plus_coby1 + //SEG20 [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- zpby1=zpby1_plus_coby1 lda e clc adc #$18 sta e - //SEG20 [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- coby1_ge_zpby1_then_la1 + //SEG21 [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- coby1_ge_zpby1_then_la1 lda #$27 cmp e bcs b2_from_b1 jmp b3 - //SEG21 main::@3 + //SEG22 main::@3 b3: - //SEG22 [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] -- zpby1=zpby1_plus_1 + //SEG23 [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] -- zpby1=zpby1_plus_1 inc y - //SEG23 [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG24 [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] -- zpptrby1=zpptrby1_plus_coby1 lda cursor clc adc #$28 @@ -1580,45 +1588,45 @@ main: { bcc !+ inc cursor+$1 !: - //SEG24 [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] -- zpby1=zpby1_minus_coby1 + //SEG25 [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] -- zpby1=zpby1_minus_coby1 lda e sec sbc #$27 sta e - //SEG25 [10] phi from main::@1 main::@3 to main::@2 + //SEG26 [11] phi from main::@1 main::@3 to main::@2 b2_from_b1: b2_from_b3: - //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy - //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy - //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy + //SEG27 [11] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy + //SEG28 [11] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy + //SEG29 [11] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy jmp b2 - //SEG29 main::@2 + //SEG30 main::@2 b2: - //SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 + //SEG31 [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1_from_b2 jmp breturn - //SEG31 main::@return + //SEG32 main::@return breturn: - //SEG32 [12] return [ ] + //SEG33 [13] return [ ] rts } -Statement [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] always clobbers reg byte a reg byte y +Statement [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] always clobbers reg byte a reg byte y Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ main::x#2 main::x#1 ] Removing always clobbered register reg byte y as potential for zp ZP_BYTE:4 [ main::x#2 main::x#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ] Removing always clobbered register reg byte y as potential for zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] Removing always clobbered register reg byte y as potential for zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] -Statement [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] always clobbers reg byte a -Statement [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] always clobbers reg byte a -Statement [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] always clobbers reg byte a -Statement [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] always clobbers reg byte a reg byte y -Statement [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] always clobbers reg byte a -Statement [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] always clobbers reg byte a -Statement [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] always clobbers reg byte a +Statement [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] always clobbers reg byte a +Statement [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] always clobbers reg byte a +Statement [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] always clobbers reg byte a +Statement [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] always clobbers reg byte a reg byte y +Statement [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] always clobbers reg byte a +Statement [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] always clobbers reg byte a +Statement [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] always clobbers reg byte a REGISTER UPLIFT POTENTIAL REGISTERS Potential registers zp ZP_PTR_BYTE:2 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ] : zp ZP_PTR_BYTE:2 , Potential registers zp ZP_BYTE:4 [ main::x#2 main::x#1 ] : zp ZP_BYTE:4 , reg byte x , @@ -1631,6 +1639,10 @@ Uplift Scope [] Uplifting [main] best 1165 combination reg byte x [ main::e#3 main::e#5 main::e#1 main::e#2 ] zp ZP_PTR_BYTE:2 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ] zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] zp ZP_BYTE:4 [ main::x#2 main::x#1 ] Uplifting [] best 1165 combination +Attempting to uplift remaining variables inzp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] +Uplifting [main] best 1165 combination zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:4 [ main::x#2 main::x#1 ] +Uplifting [main] best 1165 combination zp ZP_BYTE:4 [ main::x#2 main::x#1 ] Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ] Removing instruction jmp bend Removing instruction jmp b1 @@ -1643,62 +1655,64 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { .label x = 4 .label cursor = 2 .label y = 5 - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1 + //SEG7 [2] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta y - //SEG7 [1] phi (byte) main::e#3 = (byte) 12 -- xby=coby1 + //SEG8 [2] phi (byte) main::e#3 = (byte) 12 -- xby=coby1 ldx #$c - //SEG8 [1] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1 + //SEG9 [2] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x - //SEG9 [1] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1 + //SEG10 [2] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta cursor lda #>$400 sta cursor+$1 jmp b1 - //SEG10 [1] phi from main::@2 to main::@1 + //SEG11 [2] phi from main::@2 to main::@1 b1_from_b2: - //SEG11 [1] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy - //SEG12 [1] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy - //SEG13 [1] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy - //SEG14 [1] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy - //SEG15 main::@1 + //SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy + //SEG13 [2] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy + //SEG14 [2] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy + //SEG15 [2] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy + //SEG16 main::@1 b1: - //SEG16 [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1 + //SEG17 [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$51 sta (cursor),y - //SEG17 [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] -- zpby1=zpby1_plus_1 + //SEG18 [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] -- zpby1=zpby1_plus_1 inc x - //SEG18 [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1 + //SEG19 [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1 inc cursor bne !+ inc cursor+$1 !: - //SEG19 [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- xby=xby_plus_coby1 + //SEG20 [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- xby=xby_plus_coby1 txa clc adc #$18 tax - //SEG20 [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- coby1_ge_xby_then_la1 + //SEG21 [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- coby1_ge_xby_then_la1 cpx #$27 bcc b2_from_b1 - //SEG21 main::@3 + //SEG22 main::@3 b3: - //SEG22 [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] -- zpby1=zpby1_plus_1 + //SEG23 [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] -- zpby1=zpby1_plus_1 inc y - //SEG23 [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG24 [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] -- zpptrby1=zpptrby1_plus_coby1 lda cursor clc adc #$28 @@ -1706,31 +1720,32 @@ main: { bcc !+ inc cursor+$1 !: - //SEG24 [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] -- xby=xby_minus_coby1 + //SEG25 [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] -- xby=xby_minus_coby1 txa sec sbc #$27 tax - //SEG25 [10] phi from main::@1 main::@3 to main::@2 + //SEG26 [11] phi from main::@1 main::@3 to main::@2 b2_from_b1: b2_from_b3: - //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy - //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy - //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy - //SEG29 main::@2 + //SEG27 [11] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy + //SEG28 [11] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy + //SEG29 [11] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy + //SEG30 main::@2 b2: - //SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 + //SEG31 [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1_from_b2 - //SEG31 main::@return + //SEG32 main::@return breturn: - //SEG32 [12] return [ ] + //SEG33 [13] return [ ] rts } Replacing label b2_from_b1 with b2 Replacing label b1_from_b2 with b1 +Removing instruction main_from_bbegin: Removing instruction b1_from_b2: Removing instruction b2_from_b1: Removing instruction b2_from_b3: @@ -1740,61 +1755,62 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { .label x = 4 .label cursor = 2 .label y = 5 - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1 + //SEG7 [2] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta y - //SEG7 [1] phi (byte) main::e#3 = (byte) 12 -- xby=coby1 + //SEG8 [2] phi (byte) main::e#3 = (byte) 12 -- xby=coby1 ldx #$c - //SEG8 [1] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1 + //SEG9 [2] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x - //SEG9 [1] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1 + //SEG10 [2] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta cursor lda #>$400 sta cursor+$1 jmp b1 - //SEG10 [1] phi from main::@2 to main::@1 - //SEG11 [1] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy - //SEG12 [1] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy - //SEG13 [1] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy - //SEG14 [1] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy - //SEG15 main::@1 + //SEG11 [2] phi from main::@2 to main::@1 + //SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy + //SEG13 [2] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy + //SEG14 [2] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy + //SEG15 [2] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy + //SEG16 main::@1 b1: - //SEG16 [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1 + //SEG17 [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$51 sta (cursor),y - //SEG17 [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] -- zpby1=zpby1_plus_1 + //SEG18 [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] -- zpby1=zpby1_plus_1 inc x - //SEG18 [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1 + //SEG19 [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1 inc cursor bne !+ inc cursor+$1 !: - //SEG19 [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- xby=xby_plus_coby1 + //SEG20 [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- xby=xby_plus_coby1 txa clc adc #$18 tax - //SEG20 [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- coby1_ge_xby_then_la1 + //SEG21 [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- coby1_ge_xby_then_la1 cpx #$27 bcc b2 - //SEG21 main::@3 + //SEG22 main::@3 b3: - //SEG22 [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] -- zpby1=zpby1_plus_1 + //SEG23 [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] -- zpby1=zpby1_plus_1 inc y - //SEG23 [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG24 [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] -- zpptrby1=zpptrby1_plus_coby1 lda cursor clc adc #$28 @@ -1802,24 +1818,24 @@ main: { bcc !+ inc cursor+$1 !: - //SEG24 [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] -- xby=xby_minus_coby1 + //SEG25 [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] -- xby=xby_minus_coby1 txa sec sbc #$27 tax - //SEG25 [10] phi from main::@1 main::@3 to main::@2 - //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy - //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy - //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy - //SEG29 main::@2 + //SEG26 [11] phi from main::@1 main::@3 to main::@2 + //SEG27 [11] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy + //SEG28 [11] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy + //SEG29 [11] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy + //SEG30 main::@2 b2: - //SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 + //SEG31 [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1 - //SEG31 main::@return + //SEG32 main::@return breturn: - //SEG32 [12] return [ ] + //SEG33 [13] return [ ] rts } @@ -1833,58 +1849,59 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { .label x = 4 .label cursor = 2 .label y = 5 - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta y - //SEG7 [1] phi (byte) main::e#3 = (byte) 12 -- xby=coby1 + //SEG8 [2] phi (byte) main::e#3 = (byte) 12 -- xby=coby1 ldx #$c - //SEG8 [1] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1 + //SEG9 [2] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x - //SEG9 [1] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1 + //SEG10 [2] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta cursor lda #>$400 sta cursor+$1 jmp b1 - //SEG10 [1] phi from main::@2 to main::@1 - //SEG11 [1] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy - //SEG12 [1] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy - //SEG13 [1] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy - //SEG14 [1] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy - //SEG15 main::@1 + //SEG11 [2] phi from main::@2 to main::@1 + //SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy + //SEG13 [2] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy + //SEG14 [2] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy + //SEG15 [2] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy + //SEG16 main::@1 b1: - //SEG16 [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1 + //SEG17 [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$51 sta (cursor),y - //SEG17 [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] -- zpby1=zpby1_plus_1 + //SEG18 [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] -- zpby1=zpby1_plus_1 inc x - //SEG18 [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1 + //SEG19 [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1 inc cursor bne !+ inc cursor+$1 !: - //SEG19 [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- xby=xby_plus_coby1 + //SEG20 [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- xby=xby_plus_coby1 txa clc adc #$18 tax - //SEG20 [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- coby1_ge_xby_then_la1 + //SEG21 [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- coby1_ge_xby_then_la1 cpx #$27 bcc b2 - //SEG21 main::@3 - //SEG22 [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] -- zpby1=zpby1_plus_1 + //SEG22 main::@3 + //SEG23 [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] -- zpby1=zpby1_plus_1 inc y - //SEG23 [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG24 [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] -- zpptrby1=zpptrby1_plus_coby1 lda cursor clc adc #$28 @@ -1892,23 +1909,23 @@ main: { bcc !+ inc cursor+$1 !: - //SEG24 [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] -- xby=xby_minus_coby1 + //SEG25 [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] -- xby=xby_minus_coby1 txa sec sbc #$27 tax - //SEG25 [10] phi from main::@1 main::@3 to main::@2 - //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy - //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy - //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy - //SEG29 main::@2 + //SEG26 [11] phi from main::@1 main::@3 to main::@2 + //SEG27 [11] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy + //SEG28 [11] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy + //SEG29 [11] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy + //SEG30 main::@2 b2: - //SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 + //SEG31 [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1 - //SEG31 main::@return - //SEG32 [12] return [ ] + //SEG32 main::@return + //SEG33 [13] return [ ] rts } @@ -1918,57 +1935,58 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { .label x = 4 .label cursor = 2 .label y = 5 - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta y - //SEG7 [1] phi (byte) main::e#3 = (byte) 12 -- xby=coby1 + //SEG8 [2] phi (byte) main::e#3 = (byte) 12 -- xby=coby1 ldx #$c - //SEG8 [1] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1 + //SEG9 [2] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x - //SEG9 [1] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1 + //SEG10 [2] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta cursor lda #>$400 sta cursor+$1 - //SEG10 [1] phi from main::@2 to main::@1 - //SEG11 [1] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy - //SEG12 [1] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy - //SEG13 [1] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy - //SEG14 [1] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy - //SEG15 main::@1 + //SEG11 [2] phi from main::@2 to main::@1 + //SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy + //SEG13 [2] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy + //SEG14 [2] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy + //SEG15 [2] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy + //SEG16 main::@1 b1: - //SEG16 [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1 + //SEG17 [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$51 sta (cursor),y - //SEG17 [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] -- zpby1=zpby1_plus_1 + //SEG18 [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] -- zpby1=zpby1_plus_1 inc x - //SEG18 [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1 + //SEG19 [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1 inc cursor bne !+ inc cursor+$1 !: - //SEG19 [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- xby=xby_plus_coby1 + //SEG20 [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- xby=xby_plus_coby1 txa clc adc #$18 tax - //SEG20 [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- coby1_ge_xby_then_la1 + //SEG21 [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- coby1_ge_xby_then_la1 cpx #$27 bcc b2 - //SEG21 main::@3 - //SEG22 [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] -- zpby1=zpby1_plus_1 + //SEG22 main::@3 + //SEG23 [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] -- zpby1=zpby1_plus_1 inc y - //SEG23 [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG24 [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] -- zpptrby1=zpptrby1_plus_coby1 lda cursor clc adc #$28 @@ -1976,23 +1994,23 @@ main: { bcc !+ inc cursor+$1 !: - //SEG24 [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] -- xby=xby_minus_coby1 + //SEG25 [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] -- xby=xby_minus_coby1 txa sec sbc #$27 tax - //SEG25 [10] phi from main::@1 main::@3 to main::@2 - //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy - //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy - //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy - //SEG29 main::@2 + //SEG26 [11] phi from main::@1 main::@3 to main::@2 + //SEG27 [11] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy + //SEG28 [11] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy + //SEG29 [11] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy + //SEG30 main::@2 b2: - //SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 + //SEG31 [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1 - //SEG31 main::@return - //SEG32 [12] return [ ] + //SEG32 main::@return + //SEG33 [13] return [ ] rts } @@ -2039,57 +2057,58 @@ FINAL CODE //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { .label x = 4 .label cursor = 2 .label y = 5 - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta y - //SEG7 [1] phi (byte) main::e#3 = (byte) 12 -- xby=coby1 + //SEG8 [2] phi (byte) main::e#3 = (byte) 12 -- xby=coby1 ldx #$c - //SEG8 [1] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1 + //SEG9 [2] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x - //SEG9 [1] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1 + //SEG10 [2] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta cursor lda #>$400 sta cursor+$1 - //SEG10 [1] phi from main::@2 to main::@1 - //SEG11 [1] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy - //SEG12 [1] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy - //SEG13 [1] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy - //SEG14 [1] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy - //SEG15 main::@1 + //SEG11 [2] phi from main::@2 to main::@1 + //SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy + //SEG13 [2] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy + //SEG14 [2] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy + //SEG15 [2] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy + //SEG16 main::@1 b1: - //SEG16 [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1 + //SEG17 [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$51 sta (cursor),y - //SEG17 [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] -- zpby1=zpby1_plus_1 + //SEG18 [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] -- zpby1=zpby1_plus_1 inc x - //SEG18 [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1 + //SEG19 [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1 inc cursor bne !+ inc cursor+$1 !: - //SEG19 [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- xby=xby_plus_coby1 + //SEG20 [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- xby=xby_plus_coby1 txa clc adc #$18 tax - //SEG20 [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- coby1_ge_xby_then_la1 + //SEG21 [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- coby1_ge_xby_then_la1 cpx #$27 bcc b2 - //SEG21 main::@3 - //SEG22 [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] -- zpby1=zpby1_plus_1 + //SEG22 main::@3 + //SEG23 [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] -- zpby1=zpby1_plus_1 inc y - //SEG23 [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG24 [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] -- zpptrby1=zpptrby1_plus_coby1 lda cursor clc adc #$28 @@ -2097,23 +2116,23 @@ main: { bcc !+ inc cursor+$1 !: - //SEG24 [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] -- xby=xby_minus_coby1 + //SEG25 [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] -- xby=xby_minus_coby1 txa sec sbc #$27 tax - //SEG25 [10] phi from main::@1 main::@3 to main::@2 - //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy - //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy - //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy - //SEG29 main::@2 + //SEG26 [11] phi from main::@1 main::@3 to main::@2 + //SEG27 [11] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy + //SEG28 [11] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy + //SEG29 [11] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy + //SEG30 main::@2 b2: - //SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 + //SEG31 [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1 - //SEG31 main::@return - //SEG32 [12] return [ ] + //SEG32 main::@return + //SEG33 [13] return [ ] rts } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.cfg b/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.cfg index e3dbb0c31..70ea80af6 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.cfg @@ -6,15 +6,15 @@ [0] (byte) x#2 ← phi( @2/(byte) x#1 @begin/(byte) 0 ) [ idx#3 x#2 e#3 y#2 ] [0] (word) idx#3 ← phi( @2/(word) idx#5 @begin/(byte) 0 ) [ idx#3 x#2 e#3 y#2 ] [1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ] - [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] - [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] - [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] - [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] + [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] + [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] + [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] + [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] to:@3 @3: scope:[] from @1 - [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] - [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] - [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] + [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] + [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] + [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] to:@2 @2: scope:[] from @1 @3 [9] (byte) y#4 ← phi( @1/(byte) y#2 @3/(byte) y#1 ) [ idx#5 x#1 e#5 y#4 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.log b/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.log index 82826e30e..4ec74d14a 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.log @@ -1040,6 +1040,8 @@ CONTROL FLOW GRAPH - PHI LIFTED (byte~) y#6 ← (byte) y#2 to:@2 +CALL GRAPH + Propagating live ranges... Propagating live ranges... Propagating live ranges... @@ -1047,7 +1049,8 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from to:@1 @1: scope:[] from @5 @begin @@ -1057,17 +1060,17 @@ CONTROL FLOW GRAPH - LIVE RANGES [0] (word) idx#3 ← phi( @5/(word~) idx#6 @begin/(byte) 0 ) [ idx#3 x#2 e#3 y#2 ] [1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ] [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] - [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 idx#1 x#1 ] - [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ e#1 y#2 idx#1 x#1 ] - [5] if((byte) 39>=(byte) e#1) goto @6 [ e#1 y#2 idx#1 x#1 ] + [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] + [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] + [5] if((byte) 39>=(byte) e#1) goto @6 [ y#2 x#1 idx#1 e#1 ] to:@3 @3: scope:[] from @1 - [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ e#1 idx#1 y#1 x#1 ] - [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ e#1 idx#2 y#1 x#1 ] - [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ idx#2 e#2 y#1 x#1 ] - [9] (word~) idx#8 ← (word) idx#2 [ e#2 y#1 idx#8 x#1 ] - [10] (byte~) e#8 ← (byte) e#2 [ y#1 idx#8 e#8 x#1 ] - [11] (byte~) y#7 ← (byte) y#1 [ idx#8 e#8 y#7 x#1 ] + [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] + [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] + [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] + [9] (word~) idx#8 ← (word) idx#2 [ x#1 y#1 e#2 idx#8 ] + [10] (byte~) e#8 ← (byte) e#2 [ x#1 y#1 idx#8 e#8 ] + [11] (byte~) y#7 ← (byte) y#1 [ x#1 idx#8 e#8 y#7 ] to:@2 @2: scope:[] from @3 @6 [12] (byte) y#4 ← phi( @6/(byte~) y#6 @3/(byte~) y#7 ) [ x#1 idx#5 e#5 y#4 ] @@ -1083,9 +1086,9 @@ CONTROL FLOW GRAPH - LIVE RANGES [17] (byte~) y#5 ← (byte) y#4 [ idx#6 x#5 e#6 y#5 ] to:@1 @6: scope:[] from @1 - [18] (word~) idx#7 ← (word) idx#1 [ e#1 y#2 idx#7 x#1 ] - [19] (byte~) e#7 ← (byte) e#1 [ y#2 idx#7 e#7 x#1 ] - [20] (byte~) y#6 ← (byte) y#2 [ idx#7 e#7 y#6 x#1 ] + [18] (word~) idx#7 ← (word) idx#1 [ y#2 x#1 e#1 idx#7 ] + [19] (byte~) e#7 ← (byte) e#1 [ y#2 x#1 idx#7 e#7 ] + [20] (byte~) y#6 ← (byte) y#2 [ x#1 idx#7 e#7 y#6 ] to:@2 Created 7 initial phi equivalence classes @@ -1109,6 +1112,7 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... +Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @begin: scope:[] from to:@1 @@ -1118,15 +1122,15 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED [0] (byte) x#2 ← phi( @2/(byte) x#1 @begin/(byte) 0 ) [ idx#3 x#2 e#3 y#2 ] [0] (word) idx#3 ← phi( @2/(word) idx#5 @begin/(byte) 0 ) [ idx#3 x#2 e#3 y#2 ] [1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ] - [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] - [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] - [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] - [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] + [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] + [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] + [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] + [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] to:@3 @3: scope:[] from @1 - [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] - [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] - [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] + [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] + [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] + [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] to:@2 @2: scope:[] from @1 @3 [9] (byte) y#4 ← phi( @1/(byte) y#2 @3/(byte) y#1 ) [ idx#5 x#1 e#5 y#4 ] @@ -1136,8 +1140,6 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @2 -CALL GRAPH - DOMINATORS @begin dominated by @begin @1 dominated by @1 @begin @@ -1242,28 +1244,28 @@ b1: lda #$51 !s: sta $400 -//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] -- zpby1=zpby1_plus_1 +//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] -- zpby1=zpby1_plus_1 inc x -//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] -- zpwo1=zpwo1_plus_1 +//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] -- zpwo1=zpwo1_plus_1 inc idx bne !+ inc idx+$1 !: -//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] -- zpby1=zpby1_plus_coby1 +//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] -- zpby1=zpby1_plus_coby1 lda e clc adc #$18 sta e -//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] -- coby1_ge_zpby1_then_la1 +//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] -- coby1_ge_zpby1_then_la1 lda #$27 cmp e bcs b2_from_b1 jmp b3 //SEG18 @3 b3: -//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] -- zpby1=zpby1_plus_1 +//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] -- zpby1=zpby1_plus_1 inc y -//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] -- zpwo1=zpwo1_plus_coby1 +//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] -- zpwo1=zpwo1_plus_coby1 lda idx clc adc #<$28 @@ -1271,7 +1273,7 @@ b3: bcc !+ inc idx+$1 !: -//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] -- zpby1=zpby1_minus_coby1 +//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] -- zpby1=zpby1_minus_coby1 lda e sec sbc #$27 @@ -1297,13 +1299,13 @@ Statement [1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ x#2 x#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ e#3 e#5 e#1 e#2 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ y#2 y#4 y#1 ] -Statement [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] always clobbers reg byte a -Statement [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] always clobbers reg byte a -Statement [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] always clobbers reg byte a +Statement [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] always clobbers reg byte a +Statement [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] always clobbers reg byte a +Statement [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] always clobbers reg byte a Statement [1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ] always clobbers reg byte a -Statement [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] always clobbers reg byte a -Statement [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] always clobbers reg byte a -Statement [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] always clobbers reg byte a +Statement [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] always clobbers reg byte a +Statement [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] always clobbers reg byte a +Statement [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] always clobbers reg byte a REGISTER UPLIFT POTENTIAL REGISTERS Potential registers zp ZP_WORD:2 [ idx#3 idx#5 idx#1 idx#2 ] : zp ZP_WORD:2 , Potential registers zp ZP_BYTE:4 [ x#2 x#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , @@ -1314,6 +1316,8 @@ REGISTER UPLIFT SCOPES Uplift Scope [] 55: zp ZP_BYTE:5 [ e#3 e#5 e#1 e#2 ] 46.75: zp ZP_WORD:2 [ idx#3 idx#5 idx#1 idx#2 ] 29.33: zp ZP_BYTE:6 [ y#2 y#4 y#1 ] 14.67: zp ZP_BYTE:4 [ x#2 x#1 ] Uplifting [] best 1220 combination reg byte y [ e#3 e#5 e#1 e#2 ] zp ZP_WORD:2 [ idx#3 idx#5 idx#1 idx#2 ] zp ZP_BYTE:6 [ y#2 y#4 y#1 ] reg byte x [ x#2 x#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:6 [ y#2 y#4 y#1 ] +Uplifting [] best 1220 combination zp ZP_BYTE:6 [ y#2 y#4 y#1 ] Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:4 [ y#2 y#4 y#1 ] Removing instruction jmp b1 Removing instruction jmp b3 @@ -1360,26 +1364,26 @@ b1: lda #$51 !s: sta $400 -//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] -- xby=xby_plus_1 +//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] -- xby=xby_plus_1 inx -//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] -- zpwo1=zpwo1_plus_1 +//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] -- zpwo1=zpwo1_plus_1 inc idx bne !+ inc idx+$1 !: -//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] -- yby=yby_plus_coby1 +//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] -- yby=yby_plus_coby1 tya clc adc #$18 tay -//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] -- coby1_ge_yby_then_la1 +//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] -- coby1_ge_yby_then_la1 cpy #$27 bcc b2_from_b1 //SEG18 @3 b3: -//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] -- zpby1=zpby1_plus_1 +//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] -- zpby1=zpby1_plus_1 inc y -//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] -- zpwo1=zpwo1_plus_coby1 +//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] -- zpwo1=zpwo1_plus_coby1 lda idx clc adc #<$28 @@ -1387,7 +1391,7 @@ b3: bcc !+ inc idx+$1 !: -//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] -- yby=yby_minus_coby1 +//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] -- yby=yby_minus_coby1 tya sec sbc #$27 @@ -1451,26 +1455,26 @@ b1: lda #$51 !s: sta $400 -//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] -- xby=xby_plus_1 +//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] -- xby=xby_plus_1 inx -//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] -- zpwo1=zpwo1_plus_1 +//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] -- zpwo1=zpwo1_plus_1 inc idx bne !+ inc idx+$1 !: -//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] -- yby=yby_plus_coby1 +//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] -- yby=yby_plus_coby1 tya clc adc #$18 tay -//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] -- coby1_ge_yby_then_la1 +//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] -- coby1_ge_yby_then_la1 cpy #$27 bcc b2 //SEG18 @3 b3: -//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] -- zpby1=zpby1_plus_1 +//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] -- zpby1=zpby1_plus_1 inc y -//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] -- zpwo1=zpwo1_plus_coby1 +//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] -- zpwo1=zpwo1_plus_coby1 lda idx clc adc #<$28 @@ -1478,7 +1482,7 @@ b3: bcc !+ inc idx+$1 !: -//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] -- yby=yby_minus_coby1 +//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] -- yby=yby_minus_coby1 tya sec sbc #$27 @@ -1536,25 +1540,25 @@ b1: lda #$51 !s: sta $400 -//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] -- xby=xby_plus_1 +//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] -- xby=xby_plus_1 inx -//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] -- zpwo1=zpwo1_plus_1 +//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] -- zpwo1=zpwo1_plus_1 inc idx bne !+ inc idx+$1 !: -//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] -- yby=yby_plus_coby1 +//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] -- yby=yby_plus_coby1 tya clc adc #$18 tay -//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] -- coby1_ge_yby_then_la1 +//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] -- coby1_ge_yby_then_la1 cpy #$27 bcc b2 //SEG18 @3 -//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] -- zpby1=zpby1_plus_1 +//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] -- zpby1=zpby1_plus_1 inc y -//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] -- zpwo1=zpwo1_plus_coby1 +//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] -- zpwo1=zpwo1_plus_coby1 lda idx clc adc #<$28 @@ -1562,7 +1566,7 @@ b1: bcc !+ inc idx+$1 !: -//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] -- yby=yby_minus_coby1 +//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] -- yby=yby_minus_coby1 tya sec sbc #$27 @@ -1616,25 +1620,25 @@ b1: lda #$51 !s: sta $400 -//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] -- xby=xby_plus_1 +//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] -- xby=xby_plus_1 inx -//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] -- zpwo1=zpwo1_plus_1 +//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] -- zpwo1=zpwo1_plus_1 inc idx bne !+ inc idx+$1 !: -//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] -- yby=yby_plus_coby1 +//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] -- yby=yby_plus_coby1 tya clc adc #$18 tay -//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] -- coby1_ge_yby_then_la1 +//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] -- coby1_ge_yby_then_la1 cpy #$27 bcc b2 //SEG18 @3 -//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] -- zpby1=zpby1_plus_1 +//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] -- zpby1=zpby1_plus_1 inc y -//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] -- zpwo1=zpwo1_plus_coby1 +//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] -- zpwo1=zpwo1_plus_coby1 lda idx clc adc #<$28 @@ -1642,7 +1646,7 @@ b1: bcc !+ inc idx+$1 !: -//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] -- yby=yby_minus_coby1 +//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] -- yby=yby_minus_coby1 tya sec sbc #$27 @@ -1731,25 +1735,25 @@ b1: lda #$51 !s: sta $400 -//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] -- xby=xby_plus_1 +//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] -- xby=xby_plus_1 inx -//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] -- zpwo1=zpwo1_plus_1 +//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] -- zpwo1=zpwo1_plus_1 inc idx bne !+ inc idx+$1 !: -//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] -- yby=yby_plus_coby1 +//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] -- yby=yby_plus_coby1 tya clc adc #$18 tay -//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] -- coby1_ge_yby_then_la1 +//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] -- coby1_ge_yby_then_la1 cpy #$27 bcc b2 //SEG18 @3 -//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] -- zpby1=zpby1_plus_1 +//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] -- zpby1=zpby1_plus_1 inc y -//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] -- zpwo1=zpwo1_plus_coby1 +//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] -- zpwo1=zpwo1_plus_coby1 lda idx clc adc #<$28 @@ -1757,7 +1761,7 @@ b1: bcc !+ inc idx+$1 !: -//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] -- yby=yby_minus_coby1 +//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] -- yby=yby_minus_coby1 tya sec sbc #$27 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 0615004dc..36b18c4a2 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log @@ -492,9 +492,13 @@ main::@3: scope:[main] from main::@1 (byte~) main::i#3 ← (byte) main::i#1 to:main::@1 +CALL GRAPH +Calls in [] to 0:main + Propagating live ranges... Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @@ -526,6 +530,7 @@ Culled Empty Block (label) main::@3 Block Sequence Planned @begin @end main main::@1 main::@return Propagating live ranges... Propagating live ranges... +Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @begin: scope:[] from [0] call main param-assignment [ ] @@ -548,9 +553,6 @@ main::@return: scope:[main] from main::@1 [10] return [ ] to:@return -CALL GRAPH -Calls in [] to 0:main - DOMINATORS @begin dominated by @begin @end dominated by @end @begin @@ -605,9 +607,9 @@ bbegin: bend: //SEG4 main main: { - .label $1 = 3 - .label $3 = 4 - .label $4 = 5 + .label _1 = 3 + .label _3 = 4 + .label _4 = 5 .label i = 2 //SEG5 [1] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 @@ -630,18 +632,18 @@ main: { //SEG12 [4] (byte~) main::$1 ← (word) 4352 *idx (byte) main::i#2 [ main::i#2 main::$1 ] -- zpby1=cowo1_staridx_zpby2 ldx i lda $1100,x - sta $1 + sta _1 //SEG13 [5] (byte~) main::$3 ← (word) 4353 *idx (byte) main::i#2 [ main::i#2 main::$1 main::$3 ] -- zpby1=cowo1_staridx_zpby2 ldx i lda $1101,x - sta $3 + sta _3 //SEG14 [6] (byte~) main::$4 ← (byte~) main::$1 + (byte~) main::$3 [ main::i#2 main::$4 ] -- zpby1=zpby2_plus_zpby3 - lda $1 + lda _1 clc - adc $3 - sta $4 + adc _3 + sta _4 //SEG15 [7] *((word) 4354 + (byte) main::i#2) ← (byte~) main::$4 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby2 - lda $4 + lda _4 ldx i sta $1102,x //SEG16 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1 @@ -680,57 +682,38 @@ MISSING FRAGMENTS zpby1=zpby2_plus_cowo1_staridx_xby zpby1=zpby2_plus_cowo1_staridx_yby aby=zpby1_plus_cowo1_staridx_zpby2 - aby=zpby1_plus_cowo1_staridx_aby aby=zpby1_plus_cowo1_staridx_xby aby=zpby1_plus_cowo1_staridx_yby xby=zpby1_plus_cowo1_staridx_zpby2 xby=zpby1_plus_cowo1_staridx_aby - xby=zpby1_plus_cowo1_staridx_xby xby=zpby1_plus_cowo1_staridx_yby yby=zpby1_plus_cowo1_staridx_zpby2 yby=zpby1_plus_cowo1_staridx_aby yby=zpby1_plus_cowo1_staridx_xby - yby=zpby1_plus_cowo1_staridx_yby zpby1=aby_plus_cowo1_staridx_zpby2 - zpby1=aby_plus_cowo1_staridx_aby aby=aby_plus_cowo1_staridx_zpby1 - aby=aby_plus_cowo1_staridx_aby xby=aby_plus_cowo1_staridx_zpby1 - xby=aby_plus_cowo1_staridx_aby yby=aby_plus_cowo1_staridx_zpby1 - yby=aby_plus_cowo1_staridx_aby zpby1=xby_plus_cowo1_staridx_zpby2 zpby1=xby_plus_cowo1_staridx_aby - zpby1=xby_plus_cowo1_staridx_xby zpby1=xby_plus_cowo1_staridx_yby aby=xby_plus_cowo1_staridx_zpby1 - aby=xby_plus_cowo1_staridx_aby - aby=xby_plus_cowo1_staridx_xby aby=xby_plus_cowo1_staridx_yby xby=xby_plus_cowo1_staridx_zpby1 xby=xby_plus_cowo1_staridx_aby - xby=xby_plus_cowo1_staridx_xby xby=xby_plus_cowo1_staridx_yby yby=xby_plus_cowo1_staridx_zpby1 yby=xby_plus_cowo1_staridx_aby - yby=xby_plus_cowo1_staridx_xby - yby=xby_plus_cowo1_staridx_yby zpby1=yby_plus_cowo1_staridx_zpby2 zpby1=yby_plus_cowo1_staridx_aby zpby1=yby_plus_cowo1_staridx_xby - zpby1=yby_plus_cowo1_staridx_yby aby=yby_plus_cowo1_staridx_zpby1 - aby=yby_plus_cowo1_staridx_aby aby=yby_plus_cowo1_staridx_xby - aby=yby_plus_cowo1_staridx_yby xby=yby_plus_cowo1_staridx_zpby1 xby=yby_plus_cowo1_staridx_aby - xby=yby_plus_cowo1_staridx_xby - xby=yby_plus_cowo1_staridx_yby yby=yby_plus_cowo1_staridx_zpby1 yby=yby_plus_cowo1_staridx_aby yby=yby_plus_cowo1_staridx_xby - yby=yby_plus_cowo1_staridx_yby Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp breturn diff --git a/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.cfg b/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.cfg index 3da8fde51..bd0b8422d 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.cfg @@ -3,98 +3,102 @@ to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call prepare param-assignment [ ] + [1] phi() [ ] + [2] call prepare param-assignment [ ] to:main::@3 main::@3: scope:[main] from main main::@11 main::@3 main::@6 - [2] (byte) main::c#2 ← phi( main/(byte) 25 main::@6/(byte) main::c#1 main::@11/(byte) 25 ) [ main::c#2 ] - [3] (byte~) main::$1 ← * (word) 53266 [ main::$1 main::c#2 ] - [4] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] + [3] (byte) main::c#2 ← phi( main/(byte) 25 main::@6/(byte) main::c#1 main::@11/(byte) 25 ) [ main::c#2 ] + [4] (byte~) main::$1 ← * (word) 53266 [ main::c#2 main::$1 ] + [5] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] to:main::@4 main::@4: scope:[main] from main::@3 main::@4 - [5] (byte~) main::$3 ← * (word) 53266 [ main::$3 main::c#2 ] - [6] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] + [6] (byte~) main::$3 ← * (word) 53266 [ main::c#2 main::$3 ] + [7] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] to:main::@6 main::@6: scope:[main] from main::@4 - [7] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] - [8] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] + [8] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] + [9] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] to:main::@7 main::@7: scope:[main] from main::@6 - [9] call flip param-assignment [ ] + [10] call flip param-assignment [ ] to:main::@10 main::@10: scope:[main] from main::@7 - [10] call plot param-assignment [ ] + [11] call plot param-assignment [ ] to:main::@11 main::@11: scope:[main] from main::@10 - [11] if(true) goto main::@3 [ ] + [12] if(true) goto main::@3 [ ] to:main::@return main::@return: scope:[main] from main::@11 - [12] return [ ] + [13] return [ ] to:@return plot: scope:[plot] from main::@10 + [14] phi() [ ] to:plot::@1 plot::@1: scope:[plot] from plot plot::@3 - [13] (byte) plot::y#2 ← phi( plot/(byte) 16 plot::@3/(byte) plot::y#1 ) [ plot::i#3 plot::line#2 plot::y#2 ] - [13] (byte*) plot::line#2 ← phi( plot/(word) 1236 plot::@3/(byte*) plot::line#1 ) [ plot::i#3 plot::line#2 plot::y#2 ] - [13] (byte) plot::i#3 ← phi( plot/(byte) 0 plot::@3/(byte) plot::i#1 ) [ plot::i#3 plot::line#2 plot::y#2 ] + [15] (byte) plot::y#2 ← phi( plot/(byte) 16 plot::@3/(byte) plot::y#1 ) [ plot::i#3 plot::line#2 plot::y#2 ] + [15] (byte*) plot::line#2 ← phi( plot/(word) 1236 plot::@3/(byte*) plot::line#1 ) [ plot::i#3 plot::line#2 plot::y#2 ] + [15] (byte) plot::i#3 ← phi( plot/(byte) 0 plot::@3/(byte) plot::i#1 ) [ plot::i#3 plot::line#2 plot::y#2 ] to:plot::@2 plot::@2: scope:[plot] from plot::@1 plot::@2 - [14] (byte) plot::x#2 ← phi( plot::@1/(byte) 0 plot::@2/(byte) plot::x#1 ) [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] - [14] (byte) plot::i#2 ← phi( plot::@1/(byte) plot::i#3 plot::@2/(byte) plot::i#1 ) [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] - [15] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::i#2 plot::line#2 plot::x#2 plot::$3 plot::y#2 ] - [16] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] - [17] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::i#1 plot::line#2 plot::x#2 plot::y#2 ] - [18] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] - [19] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] + [16] (byte) plot::x#2 ← phi( plot::@1/(byte) 0 plot::@2/(byte) plot::x#1 ) [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] + [16] (byte) plot::i#2 ← phi( plot::@1/(byte) plot::i#3 plot::@2/(byte) plot::i#1 ) [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] + [17] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 plot::$3 ] + [18] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] + [19] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#2 ] + [20] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] + [21] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] to:plot::@3 plot::@3: scope:[plot] from plot::@2 - [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] - [21] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] - [22] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] + [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] + [23] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] + [24] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] to:plot::@return plot::@return: scope:[plot] from plot::@3 - [23] return [ ] + [25] return [ ] to:@return flip: scope:[flip] from main::@7 + [26] phi() [ ] to:flip::@1 flip::@1: scope:[flip] from flip flip::@4 - [24] (byte) flip::r#2 ← phi( flip/(byte) 16 flip::@4/(byte) flip::r#1 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] - [24] (byte) flip::dstIdx#5 ← phi( flip/(byte) 15 flip::@4/(byte) flip::dstIdx#2 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] - [24] (byte) flip::srcIdx#3 ← phi( flip/(byte) 0 flip::@4/(byte) flip::srcIdx#1 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] + [27] (byte) flip::r#2 ← phi( flip/(byte) 16 flip::@4/(byte) flip::r#1 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] + [27] (byte) flip::dstIdx#5 ← phi( flip/(byte) 15 flip::@4/(byte) flip::dstIdx#2 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] + [27] (byte) flip::srcIdx#3 ← phi( flip/(byte) 0 flip::@4/(byte) flip::srcIdx#1 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] to:flip::@2 flip::@2: scope:[flip] from flip::@1 flip::@2 - [25] (byte) flip::c#2 ← phi( flip::@1/(byte) 16 flip::@2/(byte) flip::c#1 ) [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [25] (byte) flip::dstIdx#3 ← phi( flip::@1/(byte) flip::dstIdx#5 flip::@2/(byte) flip::dstIdx#1 ) [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [25] (byte) flip::srcIdx#2 ← phi( flip::@1/(byte) flip::srcIdx#3 flip::@2/(byte) flip::srcIdx#1 ) [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [26] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::srcIdx#2 flip::dstIdx#3 flip::$0 flip::c#2 flip::r#2 ] - [27] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [28] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::srcIdx#1 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] - [30] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] - [31] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] + [28] (byte) flip::c#2 ← phi( flip::@1/(byte) 16 flip::@2/(byte) flip::c#1 ) [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] + [28] (byte) flip::dstIdx#3 ← phi( flip::@1/(byte) flip::dstIdx#5 flip::@2/(byte) flip::dstIdx#1 ) [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] + [28] (byte) flip::srcIdx#2 ← phi( flip::@1/(byte) flip::srcIdx#3 flip::@2/(byte) flip::srcIdx#1 ) [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] + [29] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::$0 ] + [30] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] + [31] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ] + [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] + [33] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] + [34] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] to:flip::@4 flip::@4: scope:[flip] from flip::@2 - [32] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#2 ] - [33] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] - [34] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] + [35] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ] + [36] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] + [37] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] to:flip::@3 flip::@3: scope:[flip] from flip::@3 flip::@4 - [35] (byte) flip::i#2 ← phi( flip::@3/(byte) flip::i#1 flip::@4/(byte) 0 ) [ flip::i#2 ] - [36] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] - [37] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] - [38] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] - [39] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] + [38] (byte) flip::i#2 ← phi( flip::@3/(byte) flip::i#1 flip::@4/(byte) 0 ) [ flip::i#2 ] + [39] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] + [40] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] + [41] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] + [42] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] to:flip::@return flip::@return: scope:[flip] from flip::@3 - [40] return [ ] + [43] return [ ] to:@return prepare: scope:[prepare] from main + [44] phi() [ ] to:prepare::@1 prepare::@1: scope:[prepare] from prepare prepare::@1 - [41] (byte) prepare::i#2 ← phi( prepare/(byte) 0 prepare::@1/(byte) prepare::i#1 ) [ prepare::i#2 ] - [42] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] - [43] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] - [44] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] + [45] (byte) prepare::i#2 ← phi( prepare/(byte) 0 prepare::@1/(byte) prepare::i#1 ) [ prepare::i#2 ] + [46] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] + [47] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] + [48] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] to:prepare::@return prepare::@return: scope:[prepare] from prepare::@1 - [45] return [ ] + [49] return [ ] to:@return 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 e93dc0e38..7be73cab1 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 @@ -3882,6 +3882,14 @@ prepare::@3: scope:[prepare] from prepare::@1 (byte~) prepare::i#3 ← (byte) prepare::i#1 to:prepare::@1 +Adding NOP phi() at start of main +Adding NOP phi() at start of plot +Adding NOP phi() at start of flip +Adding NOP phi() at start of prepare +CALL GRAPH +Calls in [] to 0:main +Calls in [main] to 2:prepare 10:flip 11:plot + Propagating live ranges... Propagating live ranges... Propagating live ranges... @@ -3893,157 +3901,162 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call prepare param-assignment [ ] + [1] phi() [ ] + [2] call prepare param-assignment [ ] to:main::@3 main::@3: scope:[main] from main main::@11 main::@12 main::@3 - [2] (byte) main::c#2 ← phi( main/(byte) 25 main::@12/(byte~) main::c#6 main::@11/(byte) 25 ) [ main::c#2 ] - [3] (byte~) main::$1 ← * (word) 53266 [ main::$1 main::c#2 ] - [4] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] + [3] (byte) main::c#2 ← phi( main/(byte) 25 main::@12/(byte~) main::c#6 main::@11/(byte) 25 ) [ main::c#2 ] + [4] (byte~) main::$1 ← * (word) 53266 [ main::c#2 main::$1 ] + [5] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] to:main::@4 main::@4: scope:[main] from main::@3 main::@4 - [5] (byte~) main::$3 ← * (word) 53266 [ main::$3 main::c#2 ] - [6] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] + [6] (byte~) main::$3 ← * (word) 53266 [ main::c#2 main::$3 ] + [7] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] to:main::@6 main::@6: scope:[main] from main::@4 - [7] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] - [8] if((byte) main::c#1!=(byte) 0) goto main::@12 [ main::c#1 ] + [8] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] + [9] if((byte) main::c#1!=(byte) 0) goto main::@12 [ main::c#1 ] to:main::@7 main::@7: scope:[main] from main::@6 - [9] call flip param-assignment [ ] + [10] call flip param-assignment [ ] to:main::@10 main::@10: scope:[main] from main::@7 - [10] call plot param-assignment [ ] + [11] call plot param-assignment [ ] to:main::@11 main::@11: scope:[main] from main::@10 - [11] if(true) goto main::@3 [ ] + [12] if(true) goto main::@3 [ ] to:main::@return main::@return: scope:[main] from main::@11 - [12] return [ ] + [13] return [ ] to:@return main::@12: scope:[main] from main::@6 - [13] (byte~) main::c#6 ← (byte) main::c#1 [ main::c#6 ] + [14] (byte~) main::c#6 ← (byte) main::c#1 [ main::c#6 ] to:main::@3 plot: scope:[plot] from main::@10 + [15] phi() [ ] to:plot::@1 plot::@1: scope:[plot] from plot plot::@5 - [14] (byte) plot::y#2 ← phi( plot/(byte) 16 plot::@5/(byte~) plot::y#5 ) [ plot::i#3 plot::line#2 plot::y#2 ] - [14] (byte*) plot::line#2 ← phi( plot/(word) 1236 plot::@5/(byte*~) plot::line#5 ) [ plot::i#3 plot::line#2 plot::y#2 ] - [14] (byte) plot::i#3 ← phi( plot/(byte) 0 plot::@5/(byte~) plot::i#5 ) [ plot::i#3 plot::line#2 plot::y#2 ] - [15] (byte~) plot::i#6 ← (byte) plot::i#3 [ plot::i#6 plot::line#2 plot::y#2 ] + [16] (byte) plot::y#2 ← phi( plot/(byte) 16 plot::@5/(byte~) plot::y#5 ) [ plot::i#3 plot::line#2 plot::y#2 ] + [16] (byte*) plot::line#2 ← phi( plot/(word) 1236 plot::@5/(byte*~) plot::line#5 ) [ plot::i#3 plot::line#2 plot::y#2 ] + [16] (byte) plot::i#3 ← phi( plot/(byte) 0 plot::@5/(byte~) plot::i#5 ) [ plot::i#3 plot::line#2 plot::y#2 ] + [17] (byte~) plot::i#6 ← (byte) plot::i#3 [ plot::line#2 plot::y#2 plot::i#6 ] to:plot::@2 plot::@2: scope:[plot] from plot::@1 plot::@6 - [16] (byte) plot::x#2 ← phi( plot::@1/(byte) 0 plot::@6/(byte~) plot::x#3 ) [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] - [16] (byte) plot::i#2 ← phi( plot::@1/(byte~) plot::i#6 plot::@6/(byte~) plot::i#7 ) [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] - [17] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::i#2 plot::line#2 plot::x#2 plot::$3 plot::y#2 ] - [18] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] - [19] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::x#2 plot::y#2 plot::i#1 ] - [20] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::x#1 plot::y#2 plot::i#1 ] - [21] if((byte) plot::x#1<(byte) 16) goto plot::@6 [ plot::line#2 plot::x#1 plot::y#2 plot::i#1 ] + [18] (byte) plot::x#2 ← phi( plot::@1/(byte) 0 plot::@6/(byte~) plot::x#3 ) [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] + [18] (byte) plot::i#2 ← phi( plot::@1/(byte~) plot::i#6 plot::@6/(byte~) plot::i#7 ) [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] + [19] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 plot::$3 ] + [20] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] + [21] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::x#2 plot::i#1 ] + [22] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] + [23] if((byte) plot::x#1<(byte) 16) goto plot::@6 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] to:plot::@3 plot::@3: scope:[plot] from plot::@2 - [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] - [23] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::y#1 plot::i#1 plot::line#1 ] - [24] if((byte) plot::y#1!=(byte) 0) goto plot::@5 [ plot::y#1 plot::i#1 plot::line#1 ] + [24] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] + [25] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] + [26] if((byte) plot::y#1!=(byte) 0) goto plot::@5 [ plot::i#1 plot::line#1 plot::y#1 ] to:plot::@return plot::@return: scope:[plot] from plot::@3 - [25] return [ ] + [27] return [ ] to:@return plot::@5: scope:[plot] from plot::@3 - [26] (byte~) plot::i#5 ← (byte) plot::i#1 [ plot::i#5 plot::y#1 plot::line#1 ] - [27] (byte*~) plot::line#5 ← (byte*) plot::line#1 [ plot::i#5 plot::line#5 plot::y#1 ] - [28] (byte~) plot::y#5 ← (byte) plot::y#1 [ plot::i#5 plot::line#5 plot::y#5 ] + [28] (byte~) plot::i#5 ← (byte) plot::i#1 [ plot::i#5 plot::line#1 plot::y#1 ] + [29] (byte*~) plot::line#5 ← (byte*) plot::line#1 [ plot::i#5 plot::line#5 plot::y#1 ] + [30] (byte~) plot::y#5 ← (byte) plot::y#1 [ plot::i#5 plot::line#5 plot::y#5 ] to:plot::@1 plot::@6: scope:[plot] from plot::@2 - [29] (byte~) plot::i#7 ← (byte) plot::i#1 [ plot::i#7 plot::line#2 plot::x#1 plot::y#2 ] - [30] (byte~) plot::x#3 ← (byte) plot::x#1 [ plot::i#7 plot::x#3 plot::line#2 plot::y#2 ] + [31] (byte~) plot::i#7 ← (byte) plot::i#1 [ plot::line#2 plot::y#2 plot::i#7 plot::x#1 ] + [32] (byte~) plot::x#3 ← (byte) plot::x#1 [ plot::line#2 plot::y#2 plot::i#7 plot::x#3 ] to:plot::@2 flip: scope:[flip] from main::@7 + [33] phi() [ ] to:flip::@1 flip::@1: scope:[flip] from flip flip::@7 - [31] (byte) flip::r#2 ← phi( flip/(byte) 16 flip::@7/(byte~) flip::r#5 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] - [31] (byte) flip::dstIdx#5 ← phi( flip/(byte) 15 flip::@7/(byte~) flip::dstIdx#6 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] - [31] (byte) flip::srcIdx#3 ← phi( flip/(byte) 0 flip::@7/(byte~) flip::srcIdx#5 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] - [32] (byte~) flip::srcIdx#6 ← (byte) flip::srcIdx#3 [ flip::dstIdx#5 flip::srcIdx#6 flip::r#2 ] - [33] (byte~) flip::dstIdx#7 ← (byte) flip::dstIdx#5 [ flip::srcIdx#6 flip::dstIdx#7 flip::r#2 ] + [34] (byte) flip::r#2 ← phi( flip/(byte) 16 flip::@7/(byte~) flip::r#5 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] + [34] (byte) flip::dstIdx#5 ← phi( flip/(byte) 15 flip::@7/(byte~) flip::dstIdx#6 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] + [34] (byte) flip::srcIdx#3 ← phi( flip/(byte) 0 flip::@7/(byte~) flip::srcIdx#5 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] + [35] (byte~) flip::srcIdx#6 ← (byte) flip::srcIdx#3 [ flip::dstIdx#5 flip::r#2 flip::srcIdx#6 ] + [36] (byte~) flip::dstIdx#7 ← (byte) flip::dstIdx#5 [ flip::r#2 flip::srcIdx#6 flip::dstIdx#7 ] to:flip::@2 flip::@2: scope:[flip] from flip::@1 flip::@8 - [34] (byte) flip::c#2 ← phi( flip::@1/(byte) 16 flip::@8/(byte~) flip::c#3 ) [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [34] (byte) flip::dstIdx#3 ← phi( flip::@1/(byte~) flip::dstIdx#7 flip::@8/(byte~) flip::dstIdx#8 ) [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [34] (byte) flip::srcIdx#2 ← phi( flip::@1/(byte~) flip::srcIdx#6 flip::@8/(byte~) flip::srcIdx#7 ) [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [35] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::srcIdx#2 flip::dstIdx#3 flip::$0 flip::c#2 flip::r#2 ] - [36] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [37] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::dstIdx#3 flip::c#2 flip::r#2 flip::srcIdx#1 ] - [38] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::c#2 flip::dstIdx#1 flip::r#2 flip::srcIdx#1 ] - [39] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::c#1 flip::dstIdx#1 flip::r#2 flip::srcIdx#1 ] - [40] if((byte) flip::c#1!=(byte) 0) goto flip::@8 [ flip::c#1 flip::dstIdx#1 flip::r#2 flip::srcIdx#1 ] + [37] (byte) flip::c#2 ← phi( flip::@1/(byte) 16 flip::@8/(byte~) flip::c#3 ) [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] + [37] (byte) flip::dstIdx#3 ← phi( flip::@1/(byte~) flip::dstIdx#7 flip::@8/(byte~) flip::dstIdx#8 ) [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] + [37] (byte) flip::srcIdx#2 ← phi( flip::@1/(byte~) flip::srcIdx#6 flip::@8/(byte~) flip::srcIdx#7 ) [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] + [38] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::$0 ] + [39] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] + [40] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#2 flip::dstIdx#3 flip::c#2 flip::srcIdx#1 ] + [41] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::c#2 flip::srcIdx#1 flip::dstIdx#1 ] + [42] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] + [43] if((byte) flip::c#1!=(byte) 0) goto flip::@8 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] to:flip::@4 flip::@4: scope:[flip] from flip::@2 - [41] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ] - [42] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::r#1 flip::srcIdx#1 flip::dstIdx#2 ] - [43] if((byte) flip::r#1!=(byte) 0) goto flip::@7 [ flip::r#1 flip::srcIdx#1 flip::dstIdx#2 ] + [44] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ] + [45] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] + [46] if((byte) flip::r#1!=(byte) 0) goto flip::@7 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] to:flip::@3 flip::@3: scope:[flip] from flip::@4 flip::@9 - [44] (byte) flip::i#2 ← phi( flip::@9/(byte~) flip::i#3 flip::@4/(byte) 0 ) [ flip::i#2 ] - [45] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] - [46] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] - [47] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] - [48] if((byte) flip::i#1!=(byte) 0) goto flip::@9 [ flip::i#1 ] + [47] (byte) flip::i#2 ← phi( flip::@9/(byte~) flip::i#3 flip::@4/(byte) 0 ) [ flip::i#2 ] + [48] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] + [49] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] + [50] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] + [51] if((byte) flip::i#1!=(byte) 0) goto flip::@9 [ flip::i#1 ] to:flip::@return flip::@return: scope:[flip] from flip::@3 - [49] return [ ] + [52] return [ ] to:@return flip::@9: scope:[flip] from flip::@3 - [50] (byte~) flip::i#3 ← (byte) flip::i#1 [ flip::i#3 ] + [53] (byte~) flip::i#3 ← (byte) flip::i#1 [ flip::i#3 ] to:flip::@3 flip::@7: scope:[flip] from flip::@4 - [51] (byte~) flip::srcIdx#5 ← (byte) flip::srcIdx#1 [ flip::srcIdx#5 flip::r#1 flip::dstIdx#2 ] - [52] (byte~) flip::dstIdx#6 ← (byte) flip::dstIdx#2 [ flip::srcIdx#5 flip::dstIdx#6 flip::r#1 ] - [53] (byte~) flip::r#5 ← (byte) flip::r#1 [ flip::srcIdx#5 flip::dstIdx#6 flip::r#5 ] + [54] (byte~) flip::srcIdx#5 ← (byte) flip::srcIdx#1 [ flip::srcIdx#5 flip::dstIdx#2 flip::r#1 ] + [55] (byte~) flip::dstIdx#6 ← (byte) flip::dstIdx#2 [ flip::srcIdx#5 flip::dstIdx#6 flip::r#1 ] + [56] (byte~) flip::r#5 ← (byte) flip::r#1 [ flip::srcIdx#5 flip::dstIdx#6 flip::r#5 ] to:flip::@1 flip::@8: scope:[flip] from flip::@2 - [54] (byte~) flip::srcIdx#7 ← (byte) flip::srcIdx#1 [ flip::srcIdx#7 flip::c#1 flip::dstIdx#1 flip::r#2 ] - [55] (byte~) flip::dstIdx#8 ← (byte) flip::dstIdx#1 [ flip::srcIdx#7 flip::dstIdx#8 flip::c#1 flip::r#2 ] - [56] (byte~) flip::c#3 ← (byte) flip::c#1 [ flip::srcIdx#7 flip::dstIdx#8 flip::c#3 flip::r#2 ] + [57] (byte~) flip::srcIdx#7 ← (byte) flip::srcIdx#1 [ flip::r#2 flip::srcIdx#7 flip::dstIdx#1 flip::c#1 ] + [58] (byte~) flip::dstIdx#8 ← (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#7 flip::dstIdx#8 flip::c#1 ] + [59] (byte~) flip::c#3 ← (byte) flip::c#1 [ flip::r#2 flip::srcIdx#7 flip::dstIdx#8 flip::c#3 ] to:flip::@2 prepare: scope:[prepare] from main + [60] phi() [ ] to:prepare::@1 prepare::@1: scope:[prepare] from prepare prepare::@3 - [57] (byte) prepare::i#2 ← phi( prepare/(byte) 0 prepare::@3/(byte~) prepare::i#3 ) [ prepare::i#2 ] - [58] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] - [59] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] - [60] if((byte) prepare::i#1!=(byte) 0) goto prepare::@3 [ prepare::i#1 ] + [61] (byte) prepare::i#2 ← phi( prepare/(byte) 0 prepare::@3/(byte~) prepare::i#3 ) [ prepare::i#2 ] + [62] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] + [63] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] + [64] if((byte) prepare::i#1!=(byte) 0) goto prepare::@3 [ prepare::i#1 ] to:prepare::@return prepare::@return: scope:[prepare] from prepare::@1 - [61] return [ ] + [65] return [ ] to:@return prepare::@3: scope:[prepare] from prepare::@1 - [62] (byte~) prepare::i#3 ← (byte) prepare::i#1 [ prepare::i#3 ] + [66] (byte~) prepare::i#3 ← (byte) prepare::i#1 [ prepare::i#3 ] to:prepare::@1 Created 14 initial phi equivalence classes -Coalesced [13] main::c#6 ← main::c#1 -Coalesced [15] plot::i#6 ← plot::i#3 -Coalesced [26] plot::i#5 ← plot::i#1 -Coalesced [27] plot::line#5 ← plot::line#1 -Coalesced [28] plot::y#5 ← plot::y#1 -Coalesced (already) [29] plot::i#7 ← plot::i#1 -Coalesced [30] plot::x#3 ← plot::x#1 -Coalesced [32] flip::srcIdx#6 ← flip::srcIdx#3 -Coalesced [33] flip::dstIdx#7 ← flip::dstIdx#5 -Coalesced [50] flip::i#3 ← flip::i#1 -Coalesced [51] flip::srcIdx#5 ← flip::srcIdx#1 -Coalesced [52] flip::dstIdx#6 ← flip::dstIdx#2 -Coalesced [53] flip::r#5 ← flip::r#1 -Coalesced (already) [54] flip::srcIdx#7 ← flip::srcIdx#1 -Coalesced [55] flip::dstIdx#8 ← flip::dstIdx#1 -Coalesced [56] flip::c#3 ← flip::c#1 -Coalesced [62] prepare::i#3 ← prepare::i#1 +Coalesced [14] main::c#6 ← main::c#1 +Coalesced [17] plot::i#6 ← plot::i#3 +Coalesced [28] plot::i#5 ← plot::i#1 +Coalesced [29] plot::line#5 ← plot::line#1 +Coalesced [30] plot::y#5 ← plot::y#1 +Coalesced (already) [31] plot::i#7 ← plot::i#1 +Coalesced [32] plot::x#3 ← plot::x#1 +Coalesced [35] flip::srcIdx#6 ← flip::srcIdx#3 +Coalesced [36] flip::dstIdx#7 ← flip::dstIdx#5 +Coalesced [53] flip::i#3 ← flip::i#1 +Coalesced [54] flip::srcIdx#5 ← flip::srcIdx#1 +Coalesced [55] flip::dstIdx#6 ← flip::dstIdx#2 +Coalesced [56] flip::r#5 ← flip::r#1 +Coalesced (already) [57] flip::srcIdx#7 ← flip::srcIdx#1 +Coalesced [58] flip::dstIdx#8 ← flip::dstIdx#1 +Coalesced [59] flip::c#3 ← flip::c#1 +Coalesced [66] prepare::i#3 ← prepare::i#1 Coalesced down to 11 phi equivalence classes Culled Empty Block (label) main::@12 Culled Empty Block (label) plot::@5 @@ -4053,6 +4066,11 @@ Culled Empty Block (label) flip::@7 Culled Empty Block (label) flip::@8 Culled Empty Block (label) prepare::@3 Block Sequence Planned @begin @end main main::@3 main::@4 main::@6 main::@7 main::@10 main::@11 main::@return plot plot::@1 plot::@2 plot::@3 plot::@return flip flip::@1 flip::@2 flip::@4 flip::@3 flip::@return prepare prepare::@1 prepare::@return +Adding NOP phi() at start of main +Adding NOP phi() at start of plot +Adding NOP phi() at start of flip +Adding NOP phi() at start of prepare +Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... @@ -4068,106 +4086,106 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call prepare param-assignment [ ] + [1] phi() [ ] + [2] call prepare param-assignment [ ] to:main::@3 main::@3: scope:[main] from main main::@11 main::@3 main::@6 - [2] (byte) main::c#2 ← phi( main/(byte) 25 main::@6/(byte) main::c#1 main::@11/(byte) 25 ) [ main::c#2 ] - [3] (byte~) main::$1 ← * (word) 53266 [ main::$1 main::c#2 ] - [4] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] + [3] (byte) main::c#2 ← phi( main/(byte) 25 main::@6/(byte) main::c#1 main::@11/(byte) 25 ) [ main::c#2 ] + [4] (byte~) main::$1 ← * (word) 53266 [ main::c#2 main::$1 ] + [5] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] to:main::@4 main::@4: scope:[main] from main::@3 main::@4 - [5] (byte~) main::$3 ← * (word) 53266 [ main::$3 main::c#2 ] - [6] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] + [6] (byte~) main::$3 ← * (word) 53266 [ main::c#2 main::$3 ] + [7] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] to:main::@6 main::@6: scope:[main] from main::@4 - [7] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] - [8] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] + [8] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] + [9] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] to:main::@7 main::@7: scope:[main] from main::@6 - [9] call flip param-assignment [ ] + [10] call flip param-assignment [ ] to:main::@10 main::@10: scope:[main] from main::@7 - [10] call plot param-assignment [ ] + [11] call plot param-assignment [ ] to:main::@11 main::@11: scope:[main] from main::@10 - [11] if(true) goto main::@3 [ ] + [12] if(true) goto main::@3 [ ] to:main::@return main::@return: scope:[main] from main::@11 - [12] return [ ] + [13] return [ ] to:@return plot: scope:[plot] from main::@10 + [14] phi() [ ] to:plot::@1 plot::@1: scope:[plot] from plot plot::@3 - [13] (byte) plot::y#2 ← phi( plot/(byte) 16 plot::@3/(byte) plot::y#1 ) [ plot::i#3 plot::line#2 plot::y#2 ] - [13] (byte*) plot::line#2 ← phi( plot/(word) 1236 plot::@3/(byte*) plot::line#1 ) [ plot::i#3 plot::line#2 plot::y#2 ] - [13] (byte) plot::i#3 ← phi( plot/(byte) 0 plot::@3/(byte) plot::i#1 ) [ plot::i#3 plot::line#2 plot::y#2 ] + [15] (byte) plot::y#2 ← phi( plot/(byte) 16 plot::@3/(byte) plot::y#1 ) [ plot::i#3 plot::line#2 plot::y#2 ] + [15] (byte*) plot::line#2 ← phi( plot/(word) 1236 plot::@3/(byte*) plot::line#1 ) [ plot::i#3 plot::line#2 plot::y#2 ] + [15] (byte) plot::i#3 ← phi( plot/(byte) 0 plot::@3/(byte) plot::i#1 ) [ plot::i#3 plot::line#2 plot::y#2 ] to:plot::@2 plot::@2: scope:[plot] from plot::@1 plot::@2 - [14] (byte) plot::x#2 ← phi( plot::@1/(byte) 0 plot::@2/(byte) plot::x#1 ) [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] - [14] (byte) plot::i#2 ← phi( plot::@1/(byte) plot::i#3 plot::@2/(byte) plot::i#1 ) [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] - [15] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::i#2 plot::line#2 plot::x#2 plot::$3 plot::y#2 ] - [16] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] - [17] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::i#1 plot::line#2 plot::x#2 plot::y#2 ] - [18] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] - [19] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] + [16] (byte) plot::x#2 ← phi( plot::@1/(byte) 0 plot::@2/(byte) plot::x#1 ) [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] + [16] (byte) plot::i#2 ← phi( plot::@1/(byte) plot::i#3 plot::@2/(byte) plot::i#1 ) [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] + [17] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 plot::$3 ] + [18] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] + [19] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#2 ] + [20] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] + [21] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] to:plot::@3 plot::@3: scope:[plot] from plot::@2 - [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] - [21] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] - [22] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] + [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] + [23] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] + [24] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] to:plot::@return plot::@return: scope:[plot] from plot::@3 - [23] return [ ] + [25] return [ ] to:@return flip: scope:[flip] from main::@7 + [26] phi() [ ] to:flip::@1 flip::@1: scope:[flip] from flip flip::@4 - [24] (byte) flip::r#2 ← phi( flip/(byte) 16 flip::@4/(byte) flip::r#1 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] - [24] (byte) flip::dstIdx#5 ← phi( flip/(byte) 15 flip::@4/(byte) flip::dstIdx#2 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] - [24] (byte) flip::srcIdx#3 ← phi( flip/(byte) 0 flip::@4/(byte) flip::srcIdx#1 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] + [27] (byte) flip::r#2 ← phi( flip/(byte) 16 flip::@4/(byte) flip::r#1 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] + [27] (byte) flip::dstIdx#5 ← phi( flip/(byte) 15 flip::@4/(byte) flip::dstIdx#2 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] + [27] (byte) flip::srcIdx#3 ← phi( flip/(byte) 0 flip::@4/(byte) flip::srcIdx#1 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ] to:flip::@2 flip::@2: scope:[flip] from flip::@1 flip::@2 - [25] (byte) flip::c#2 ← phi( flip::@1/(byte) 16 flip::@2/(byte) flip::c#1 ) [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [25] (byte) flip::dstIdx#3 ← phi( flip::@1/(byte) flip::dstIdx#5 flip::@2/(byte) flip::dstIdx#1 ) [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [25] (byte) flip::srcIdx#2 ← phi( flip::@1/(byte) flip::srcIdx#3 flip::@2/(byte) flip::srcIdx#1 ) [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [26] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::srcIdx#2 flip::dstIdx#3 flip::$0 flip::c#2 flip::r#2 ] - [27] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [28] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::srcIdx#1 flip::dstIdx#3 flip::c#2 flip::r#2 ] - [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] - [30] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] - [31] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] + [28] (byte) flip::c#2 ← phi( flip::@1/(byte) 16 flip::@2/(byte) flip::c#1 ) [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] + [28] (byte) flip::dstIdx#3 ← phi( flip::@1/(byte) flip::dstIdx#5 flip::@2/(byte) flip::dstIdx#1 ) [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] + [28] (byte) flip::srcIdx#2 ← phi( flip::@1/(byte) flip::srcIdx#3 flip::@2/(byte) flip::srcIdx#1 ) [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] + [29] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::$0 ] + [30] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] + [31] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ] + [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] + [33] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] + [34] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] to:flip::@4 flip::@4: scope:[flip] from flip::@2 - [32] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#2 ] - [33] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] - [34] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] + [35] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ] + [36] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] + [37] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] to:flip::@3 flip::@3: scope:[flip] from flip::@3 flip::@4 - [35] (byte) flip::i#2 ← phi( flip::@3/(byte) flip::i#1 flip::@4/(byte) 0 ) [ flip::i#2 ] - [36] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] - [37] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] - [38] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] - [39] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] + [38] (byte) flip::i#2 ← phi( flip::@3/(byte) flip::i#1 flip::@4/(byte) 0 ) [ flip::i#2 ] + [39] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] + [40] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] + [41] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] + [42] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] to:flip::@return flip::@return: scope:[flip] from flip::@3 - [40] return [ ] + [43] return [ ] to:@return prepare: scope:[prepare] from main + [44] phi() [ ] to:prepare::@1 prepare::@1: scope:[prepare] from prepare prepare::@1 - [41] (byte) prepare::i#2 ← phi( prepare/(byte) 0 prepare::@1/(byte) prepare::i#1 ) [ prepare::i#2 ] - [42] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] - [43] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] - [44] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] + [45] (byte) prepare::i#2 ← phi( prepare/(byte) 0 prepare::@1/(byte) prepare::i#1 ) [ prepare::i#2 ] + [46] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] + [47] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] + [48] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] to:prepare::@return prepare::@return: scope:[prepare] from prepare::@1 - [45] return [ ] + [49] return [ ] to:@return -CALL GRAPH -Calls in [] to 0:main -Calls in [main] to 1:prepare 9:flip 10:plot - DOMINATORS @begin dominated by @begin @end dominated by @end @begin @@ -4361,142 +4379,150 @@ INITIAL ASM //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main jmp bend -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - .label $1 = 14 - .label $3 = 15 + .label _1 = 14 + .label _3 = 15 .label c = 2 - //SEG5 [1] call prepare param-assignment [ ] + //SEG6 [2] call prepare param-assignment [ ] + //SEG7 [44] phi from main to prepare + prepare_from_main: jsr prepare - //SEG6 [2] phi from main main::@11 to main::@3 + //SEG8 [3] phi from main main::@11 to main::@3 b3_from_main: b3_from_b11: - //SEG7 [2] phi (byte) main::c#2 = (byte) 25 -- zpby1=coby1 + //SEG9 [3] phi (byte) main::c#2 = (byte) 25 -- zpby1=coby1 lda #$19 sta c jmp b3 - //SEG8 [2] phi from main::@3 to main::@3 + //SEG10 [3] phi from main::@3 to main::@3 b3_from_b3: jmp b3 - //SEG9 [2] phi from main::@6 to main::@3 + //SEG11 [3] phi from main::@6 to main::@3 b3_from_b6: - //SEG10 [2] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy + //SEG12 [3] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy jmp b3 - //SEG11 main::@3 + //SEG13 main::@3 b3: - //SEG12 [3] (byte~) main::$1 ← * (word) 53266 [ main::$1 main::c#2 ] -- zpby1=_star_cowo1 + //SEG14 [4] (byte~) main::$1 ← * (word) 53266 [ main::c#2 main::$1 ] -- zpby1=_star_cowo1 lda $d012 - sta $1 - //SEG13 [4] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- zpby1_neq_coby1_then_la1 - lda $1 + sta _1 + //SEG15 [5] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- zpby1_neq_coby1_then_la1 + lda _1 cmp #$fe bne b3_from_b3 jmp b4 - //SEG14 main::@4 + //SEG16 main::@4 b4: - //SEG15 [5] (byte~) main::$3 ← * (word) 53266 [ main::$3 main::c#2 ] -- zpby1=_star_cowo1 + //SEG17 [6] (byte~) main::$3 ← * (word) 53266 [ main::c#2 main::$3 ] -- zpby1=_star_cowo1 lda $d012 - sta $3 - //SEG16 [6] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- zpby1_neq_coby1_then_la1 - lda $3 + sta _3 + //SEG18 [7] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- zpby1_neq_coby1_then_la1 + lda _3 cmp #$ff bne b4 jmp b6 - //SEG17 main::@6 + //SEG19 main::@6 b6: - //SEG18 [7] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- zpby1=_dec_zpby1 + //SEG20 [8] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- zpby1=_dec_zpby1 dec c - //SEG19 [8] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- zpby1_neq_0_then_la1 + //SEG21 [9] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- zpby1_neq_0_then_la1 lda c bne b3_from_b6 jmp b7 - //SEG20 main::@7 + //SEG22 main::@7 b7: - //SEG21 [9] call flip param-assignment [ ] + //SEG23 [10] call flip param-assignment [ ] + //SEG24 [26] phi from main::@7 to flip + flip_from_b7: jsr flip jmp b10 - //SEG22 main::@10 + //SEG25 main::@10 b10: - //SEG23 [10] call plot param-assignment [ ] + //SEG26 [11] call plot param-assignment [ ] + //SEG27 [14] phi from main::@10 to plot + plot_from_b10: jsr plot jmp b11 - //SEG24 main::@11 + //SEG28 main::@11 b11: - //SEG25 [11] if(true) goto main::@3 [ ] -- true_then_la1 + //SEG29 [12] if(true) goto main::@3 [ ] -- true_then_la1 jmp b3_from_b11 jmp breturn - //SEG26 main::@return + //SEG30 main::@return breturn: - //SEG27 [12] return [ ] + //SEG31 [13] return [ ] rts } -//SEG28 plot +//SEG32 plot plot: { - .label $3 = 16 + .label _3 = 16 .label i = 6 .label x = 7 .label line = 3 .label y = 5 - //SEG29 [13] phi from plot to plot::@1 + //SEG33 [15] phi from plot to plot::@1 b1_from_plot: - //SEG30 [13] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 + //SEG34 [15] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta y - //SEG31 [13] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 + //SEG35 [15] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 lda #<$4d4 sta line lda #>$4d4 sta line+$1 - //SEG32 [13] phi (byte) plot::i#3 = (byte) 0 -- zpby1=coby1 + //SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- zpby1=coby1 lda #$0 sta i jmp b1 - //SEG33 [13] phi from plot::@3 to plot::@1 + //SEG37 [15] phi from plot::@3 to plot::@1 b1_from_b3: - //SEG34 [13] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy - //SEG35 [13] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy - //SEG36 [13] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy + //SEG38 [15] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy + //SEG39 [15] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy + //SEG40 [15] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy jmp b1 - //SEG37 plot::@1 + //SEG41 plot::@1 b1: - //SEG38 [14] phi from plot::@1 to plot::@2 + //SEG42 [16] phi from plot::@1 to plot::@2 b2_from_b1: - //SEG39 [14] phi (byte) plot::x#2 = (byte) 0 -- zpby1=coby1 + //SEG43 [16] phi (byte) plot::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x - //SEG40 [14] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy + //SEG44 [16] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy jmp b2 - //SEG41 [14] phi from plot::@2 to plot::@2 + //SEG45 [16] phi from plot::@2 to plot::@2 b2_from_b2: - //SEG42 [14] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy - //SEG43 [14] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy + //SEG46 [16] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy + //SEG47 [16] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy jmp b2 - //SEG44 plot::@2 + //SEG48 plot::@2 b2: - //SEG45 [15] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::i#2 plot::line#2 plot::x#2 plot::$3 plot::y#2 ] -- zpby1=cowo1_staridx_zpby2 + //SEG49 [17] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 plot::$3 ] -- zpby1=cowo1_staridx_zpby2 ldx i lda $1000,x - sta $3 - //SEG46 [16] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] -- zpptrby1_staridx_zpby1=zpby2 - lda $3 + sta _3 + //SEG50 [18] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] -- zpptrby1_staridx_zpby1=zpby2 + lda _3 ldy x sta (line),y - //SEG47 [17] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::i#1 plot::line#2 plot::x#2 plot::y#2 ] -- zpby1=_inc_zpby1 + //SEG51 [19] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#2 ] -- zpby1=_inc_zpby1 inc i - //SEG48 [18] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- zpby1=_inc_zpby1 + //SEG52 [20] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- zpby1=_inc_zpby1 inc x - //SEG49 [19] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- zpby1_lt_coby1_then_la1 + //SEG53 [21] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$10 bcc b2_from_b2 jmp b3 - //SEG50 plot::@3 + //SEG54 plot::@3 b3: - //SEG51 [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG55 [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda line clc adc #$28 @@ -4504,163 +4530,163 @@ plot: { bcc !+ inc line+$1 !: - //SEG52 [21] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 + //SEG56 [23] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 dec y - //SEG53 [22] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 + //SEG57 [24] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 lda y bne b1_from_b3 jmp breturn - //SEG54 plot::@return + //SEG58 plot::@return breturn: - //SEG55 [23] return [ ] + //SEG59 [25] return [ ] rts } -//SEG56 flip +//SEG60 flip flip: { - .label $0 = 17 - .label $4 = 18 + .label _0 = 17 + .label _4 = 18 .label srcIdx = 9 .label dstIdx = 10 .label c = 11 .label r = 8 .label i = 12 - //SEG57 [24] phi from flip to flip::@1 + //SEG61 [27] phi from flip to flip::@1 b1_from_flip: - //SEG58 [24] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 + //SEG62 [27] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta r - //SEG59 [24] phi (byte) flip::dstIdx#5 = (byte) 15 -- zpby1=coby1 + //SEG63 [27] phi (byte) flip::dstIdx#5 = (byte) 15 -- zpby1=coby1 lda #$f sta dstIdx - //SEG60 [24] phi (byte) flip::srcIdx#3 = (byte) 0 -- zpby1=coby1 + //SEG64 [27] phi (byte) flip::srcIdx#3 = (byte) 0 -- zpby1=coby1 lda #$0 sta srcIdx jmp b1 - //SEG61 [24] phi from flip::@4 to flip::@1 + //SEG65 [27] phi from flip::@4 to flip::@1 b1_from_b4: - //SEG62 [24] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy - //SEG63 [24] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy - //SEG64 [24] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy + //SEG66 [27] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy + //SEG67 [27] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy + //SEG68 [27] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy jmp b1 - //SEG65 flip::@1 + //SEG69 flip::@1 b1: - //SEG66 [25] phi from flip::@1 to flip::@2 + //SEG70 [28] phi from flip::@1 to flip::@2 b2_from_b1: - //SEG67 [25] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 + //SEG71 [28] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta c - //SEG68 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy - //SEG69 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy + //SEG72 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy + //SEG73 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy jmp b2 - //SEG70 [25] phi from flip::@2 to flip::@2 + //SEG74 [28] phi from flip::@2 to flip::@2 b2_from_b2: - //SEG71 [25] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy - //SEG72 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy - //SEG73 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy + //SEG75 [28] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy + //SEG76 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy + //SEG77 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy jmp b2 - //SEG74 flip::@2 + //SEG78 flip::@2 b2: - //SEG75 [26] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::srcIdx#2 flip::dstIdx#3 flip::$0 flip::c#2 flip::r#2 ] -- zpby1=cowo1_staridx_zpby2 + //SEG79 [29] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::$0 ] -- zpby1=cowo1_staridx_zpby2 ldx srcIdx lda $1000,x - sta $0 - //SEG76 [27] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- cowo1_staridx_zpby1=zpby2 - lda $0 + sta _0 + //SEG80 [30] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] -- cowo1_staridx_zpby1=zpby2 + lda _0 ldx dstIdx sta $1100,x - //SEG77 [28] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::srcIdx#1 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- zpby1=_inc_zpby1 + //SEG81 [31] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ] -- zpby1=_inc_zpby1 inc srcIdx - //SEG78 [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] -- zpby1=zpby1_plus_coby1 + //SEG82 [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] -- zpby1=zpby1_plus_coby1 lda dstIdx clc adc #$10 sta dstIdx - //SEG79 [30] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1=_dec_zpby1 + //SEG83 [33] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1=_dec_zpby1 dec c - //SEG80 [31] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1_neq_0_then_la1 + //SEG84 [34] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1_neq_0_then_la1 lda c bne b2_from_b2 jmp b4 - //SEG81 flip::@4 + //SEG85 flip::@4 b4: - //SEG82 [32] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#2 ] -- zpby1=_dec_zpby1 + //SEG86 [35] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ] -- zpby1=_dec_zpby1 dec dstIdx - //SEG83 [33] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 + //SEG87 [36] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 dec r - //SEG84 [34] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 + //SEG88 [37] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 lda r bne b1_from_b4 - //SEG85 [35] phi from flip::@4 to flip::@3 + //SEG89 [38] phi from flip::@4 to flip::@3 b3_from_b4: - //SEG86 [35] phi (byte) flip::i#2 = (byte) 0 -- zpby1=coby1 + //SEG90 [38] phi (byte) flip::i#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta i jmp b3 - //SEG87 [35] phi from flip::@3 to flip::@3 + //SEG91 [38] phi from flip::@3 to flip::@3 b3_from_b3: - //SEG88 [35] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy + //SEG92 [38] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy jmp b3 - //SEG89 flip::@3 + //SEG93 flip::@3 b3: - //SEG90 [36] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- zpby1=cowo1_staridx_zpby2 + //SEG94 [39] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- zpby1=cowo1_staridx_zpby2 ldx i lda $1100,x - sta $4 - //SEG91 [37] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_zpby1=zpby2 - lda $4 + sta _4 + //SEG95 [40] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_zpby1=zpby2 + lda _4 ldx i sta $1000,x - //SEG92 [38] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- zpby1=_inc_zpby1 + //SEG96 [41] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- zpby1=_inc_zpby1 inc i - //SEG93 [39] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- zpby1_neq_0_then_la1 + //SEG97 [42] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- zpby1_neq_0_then_la1 lda i bne b3_from_b3 jmp breturn - //SEG94 flip::@return + //SEG98 flip::@return breturn: - //SEG95 [40] return [ ] + //SEG99 [43] return [ ] rts } -//SEG96 prepare +//SEG100 prepare prepare: { .label i = 13 - //SEG97 [41] phi from prepare to prepare::@1 + //SEG101 [45] phi from prepare to prepare::@1 b1_from_prepare: - //SEG98 [41] phi (byte) prepare::i#2 = (byte) 0 -- zpby1=coby1 + //SEG102 [45] phi (byte) prepare::i#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta i jmp b1 - //SEG99 [41] phi from prepare::@1 to prepare::@1 + //SEG103 [45] phi from prepare::@1 to prepare::@1 b1_from_b1: - //SEG100 [41] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy + //SEG104 [45] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy jmp b1 - //SEG101 prepare::@1 + //SEG105 prepare::@1 b1: - //SEG102 [42] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_zpby1=zpby1 + //SEG106 [46] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_zpby1=zpby1 ldx i txa sta $1000,x - //SEG103 [43] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- zpby1=_inc_zpby1 + //SEG107 [47] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- zpby1=_inc_zpby1 inc i - //SEG104 [44] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- zpby1_neq_0_then_la1 + //SEG108 [48] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- zpby1_neq_0_then_la1 lda i bne b1_from_b1 jmp breturn - //SEG105 prepare::@return + //SEG109 prepare::@return breturn: - //SEG106 [45] return [ ] + //SEG110 [49] return [ ] rts } -Statement [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ plot::i#2 plot::i#3 plot::i#1 ] +Statement [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ plot::y#2 plot::y#1 ] -Statement [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ plot::i#2 plot::i#3 plot::i#1 ] +Statement [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:8 [ flip::r#2 flip::r#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ flip::srcIdx#2 flip::srcIdx#3 flip::srcIdx#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:11 [ flip::c#2 flip::c#1 ] -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:8 [ flip::r#2 flip::r#1 ] -Statement [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] always clobbers reg byte a -Statement [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] always clobbers reg byte a +Statement [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] always clobbers reg byte a +Statement [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] always clobbers reg byte a REGISTER UPLIFT POTENTIAL REGISTERS Potential registers zp ZP_BYTE:2 [ main::c#2 main::c#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_PTR_BYTE:3 [ plot::line#2 plot::line#1 ] : zp ZP_PTR_BYTE:3 , @@ -4686,11 +4712,17 @@ Uplift Scope [main] 2,002: zp ZP_BYTE:14 [ main::$1 ] 2,002: zp ZP_BYTE:15 [ mai Uplift Scope [prepare] 38.5: zp ZP_BYTE:13 [ prepare::i#2 prepare::i#1 ] Uplift Scope [] -Uplifting [flip] best 160124 combination reg byte a [ flip::$0 ] zp ZP_BYTE:11 [ flip::c#2 flip::c#1 ] reg byte y [ flip::dstIdx#3 flip::dstIdx#5 flip::dstIdx#2 flip::dstIdx#1 ] reg byte x [ flip::srcIdx#2 flip::srcIdx#3 flip::srcIdx#1 ] reg byte x [ flip::i#2 flip::i#1 ] reg byte a [ flip::$4 ] zp ZP_BYTE:8 [ flip::r#2 flip::r#1 ] -Uplifting [plot] best 135824 combination reg byte y [ plot::x#2 plot::x#1 ] reg byte a [ plot::$3 ] reg byte x [ plot::i#2 plot::i#3 plot::i#1 ] zp ZP_PTR_BYTE:3 [ plot::line#2 plot::line#1 ] zp ZP_BYTE:5 [ plot::y#2 plot::y#1 ] -Uplifting [main] best 120424 combination reg byte a [ main::$1 ] reg byte a [ main::$3 ] reg byte x [ main::c#2 main::c#1 ] -Uplifting [prepare] best 120324 combination reg byte x [ prepare::i#2 prepare::i#1 ] -Uplifting [] best 120324 combination +Uplifting [flip] best 159962 combination reg byte a [ flip::$0 ] zp ZP_BYTE:11 [ flip::c#2 flip::c#1 ] reg byte y [ flip::dstIdx#3 flip::dstIdx#5 flip::dstIdx#2 flip::dstIdx#1 ] reg byte x [ flip::srcIdx#2 flip::srcIdx#3 flip::srcIdx#1 ] reg byte x [ flip::i#2 flip::i#1 ] reg byte a [ flip::$4 ] zp ZP_BYTE:8 [ flip::r#2 flip::r#1 ] +Uplifting [plot] best 135662 combination reg byte y [ plot::x#2 plot::x#1 ] reg byte a [ plot::$3 ] reg byte x [ plot::i#2 plot::i#3 plot::i#1 ] zp ZP_PTR_BYTE:3 [ plot::line#2 plot::line#1 ] zp ZP_BYTE:5 [ plot::y#2 plot::y#1 ] +Uplifting [main] best 120262 combination reg byte a [ main::$1 ] reg byte a [ main::$3 ] reg byte x [ main::c#2 main::c#1 ] +Uplifting [prepare] best 120162 combination reg byte x [ prepare::i#2 prepare::i#1 ] +Uplifting [] best 120162 combination +Attempting to uplift remaining variables inzp ZP_BYTE:11 [ flip::c#2 flip::c#1 ] +Uplifting [flip] best 120162 combination zp ZP_BYTE:11 [ flip::c#2 flip::c#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:5 [ plot::y#2 plot::y#1 ] +Uplifting [plot] best 120162 combination zp ZP_BYTE:5 [ plot::y#2 plot::y#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:8 [ flip::r#2 flip::r#1 ] +Uplifting [flip] best 120162 combination zp ZP_BYTE:8 [ flip::r#2 flip::r#1 ] Coalescing zero page register [ zp ZP_BYTE:5 [ plot::y#2 plot::y#1 ] ] with [ zp ZP_BYTE:8 [ flip::r#2 flip::r#1 ] ] Allocated (was zp ZP_PTR_BYTE:3) zp ZP_PTR_BYTE:2 [ plot::line#2 plot::line#1 ] Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:4 [ plot::y#2 plot::y#1 flip::r#2 flip::r#1 ] @@ -4720,113 +4752,121 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] call prepare param-assignment [ ] + //SEG6 [2] call prepare param-assignment [ ] + //SEG7 [44] phi from main to prepare + prepare_from_main: jsr prepare - //SEG6 [2] phi from main main::@11 to main::@3 + //SEG8 [3] phi from main main::@11 to main::@3 b3_from_main: b3_from_b11: - //SEG7 [2] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 + //SEG9 [3] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 ldx #$19 jmp b3 - //SEG8 [2] phi from main::@3 to main::@3 + //SEG10 [3] phi from main::@3 to main::@3 b3_from_b3: jmp b3 - //SEG9 [2] phi from main::@6 to main::@3 + //SEG11 [3] phi from main::@6 to main::@3 b3_from_b6: - //SEG10 [2] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy - //SEG11 main::@3 + //SEG12 [3] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy + //SEG13 main::@3 b3: - //SEG12 [3] (byte~) main::$1 ← * (word) 53266 [ main::$1 main::c#2 ] -- aby=_star_cowo1 + //SEG14 [4] (byte~) main::$1 ← * (word) 53266 [ main::c#2 main::$1 ] -- aby=_star_cowo1 lda $d012 - //SEG13 [4] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG15 [5] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$fe bne b3_from_b3 - //SEG14 main::@4 + //SEG16 main::@4 b4: - //SEG15 [5] (byte~) main::$3 ← * (word) 53266 [ main::$3 main::c#2 ] -- aby=_star_cowo1 + //SEG17 [6] (byte~) main::$3 ← * (word) 53266 [ main::c#2 main::$3 ] -- aby=_star_cowo1 lda $d012 - //SEG16 [6] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG18 [7] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$ff bne b4 - //SEG17 main::@6 + //SEG19 main::@6 b6: - //SEG18 [7] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby + //SEG20 [8] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby dex - //SEG19 [8] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 + //SEG21 [9] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3_from_b6 - //SEG20 main::@7 + //SEG22 main::@7 b7: - //SEG21 [9] call flip param-assignment [ ] + //SEG23 [10] call flip param-assignment [ ] + //SEG24 [26] phi from main::@7 to flip + flip_from_b7: jsr flip - //SEG22 main::@10 + //SEG25 main::@10 b10: - //SEG23 [10] call plot param-assignment [ ] + //SEG26 [11] call plot param-assignment [ ] + //SEG27 [14] phi from main::@10 to plot + plot_from_b10: jsr plot - //SEG24 main::@11 + //SEG28 main::@11 b11: - //SEG25 [11] if(true) goto main::@3 [ ] -- true_then_la1 + //SEG29 [12] if(true) goto main::@3 [ ] -- true_then_la1 jmp b3_from_b11 - //SEG26 main::@return + //SEG30 main::@return breturn: - //SEG27 [12] return [ ] + //SEG31 [13] return [ ] rts } -//SEG28 plot +//SEG32 plot plot: { .label line = 2 .label y = 4 - //SEG29 [13] phi from plot to plot::@1 + //SEG33 [15] phi from plot to plot::@1 b1_from_plot: - //SEG30 [13] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 + //SEG34 [15] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta y - //SEG31 [13] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 + //SEG35 [15] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 lda #<$4d4 sta line lda #>$4d4 sta line+$1 - //SEG32 [13] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 + //SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG33 [13] phi from plot::@3 to plot::@1 + //SEG37 [15] phi from plot::@3 to plot::@1 b1_from_b3: - //SEG34 [13] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy - //SEG35 [13] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy - //SEG36 [13] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy - //SEG37 plot::@1 + //SEG38 [15] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy + //SEG39 [15] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy + //SEG40 [15] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy + //SEG41 plot::@1 b1: - //SEG38 [14] phi from plot::@1 to plot::@2 + //SEG42 [16] phi from plot::@1 to plot::@2 b2_from_b1: - //SEG39 [14] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 + //SEG43 [16] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG40 [14] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy + //SEG44 [16] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy jmp b2 - //SEG41 [14] phi from plot::@2 to plot::@2 + //SEG45 [16] phi from plot::@2 to plot::@2 b2_from_b2: - //SEG42 [14] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy - //SEG43 [14] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy - //SEG44 plot::@2 + //SEG46 [16] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy + //SEG47 [16] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy + //SEG48 plot::@2 b2: - //SEG45 [15] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::i#2 plot::line#2 plot::x#2 plot::$3 plot::y#2 ] -- aby=cowo1_staridx_xby + //SEG49 [17] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 plot::$3 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG46 [16] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] -- zpptrby1_staridx_yby=aby + //SEG50 [18] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] -- zpptrby1_staridx_yby=aby sta (line),y - //SEG47 [17] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::i#1 plot::line#2 plot::x#2 plot::y#2 ] -- xby=_inc_xby + //SEG51 [19] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#2 ] -- xby=_inc_xby inx - //SEG48 [18] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby=_inc_yby + //SEG52 [20] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby=_inc_yby iny - //SEG49 [19] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby_lt_coby1_then_la1 + //SEG53 [21] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby_lt_coby1_then_la1 cpy #$10 bcc b2_from_b2 - //SEG50 plot::@3 + //SEG54 plot::@3 b3: - //SEG51 [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG55 [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda line clc adc #$28 @@ -4834,124 +4874,124 @@ plot: { bcc !+ inc line+$1 !: - //SEG52 [21] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 + //SEG56 [23] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 dec y - //SEG53 [22] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 + //SEG57 [24] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 lda y bne b1_from_b3 - //SEG54 plot::@return + //SEG58 plot::@return breturn: - //SEG55 [23] return [ ] + //SEG59 [25] return [ ] rts } -//SEG56 flip +//SEG60 flip flip: { .label c = 5 .label r = 4 - //SEG57 [24] phi from flip to flip::@1 + //SEG61 [27] phi from flip to flip::@1 b1_from_flip: - //SEG58 [24] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 + //SEG62 [27] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta r - //SEG59 [24] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 + //SEG63 [27] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 ldy #$f - //SEG60 [24] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 + //SEG64 [27] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG61 [24] phi from flip::@4 to flip::@1 + //SEG65 [27] phi from flip::@4 to flip::@1 b1_from_b4: - //SEG62 [24] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy - //SEG63 [24] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy - //SEG64 [24] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy - //SEG65 flip::@1 + //SEG66 [27] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy + //SEG67 [27] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy + //SEG68 [27] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy + //SEG69 flip::@1 b1: - //SEG66 [25] phi from flip::@1 to flip::@2 + //SEG70 [28] phi from flip::@1 to flip::@2 b2_from_b1: - //SEG67 [25] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 + //SEG71 [28] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta c - //SEG68 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy - //SEG69 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy + //SEG72 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy + //SEG73 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy jmp b2 - //SEG70 [25] phi from flip::@2 to flip::@2 + //SEG74 [28] phi from flip::@2 to flip::@2 b2_from_b2: - //SEG71 [25] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy - //SEG72 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy - //SEG73 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy - //SEG74 flip::@2 + //SEG75 [28] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy + //SEG76 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy + //SEG77 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy + //SEG78 flip::@2 b2: - //SEG75 [26] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::srcIdx#2 flip::dstIdx#3 flip::$0 flip::c#2 flip::r#2 ] -- aby=cowo1_staridx_xby + //SEG79 [29] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::$0 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG76 [27] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- cowo1_staridx_yby=aby + //SEG80 [30] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] -- cowo1_staridx_yby=aby sta $1100,y - //SEG77 [28] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::srcIdx#1 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- xby=_inc_xby + //SEG81 [31] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ] -- xby=_inc_xby inx - //SEG78 [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] -- yby=yby_plus_coby1 + //SEG82 [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] -- yby=yby_plus_coby1 tya clc adc #$10 tay - //SEG79 [30] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1=_dec_zpby1 + //SEG83 [33] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1=_dec_zpby1 dec c - //SEG80 [31] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1_neq_0_then_la1 + //SEG84 [34] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1_neq_0_then_la1 lda c bne b2_from_b2 - //SEG81 flip::@4 + //SEG85 flip::@4 b4: - //SEG82 [32] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#2 ] -- yby=_dec_yby + //SEG86 [35] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ] -- yby=_dec_yby dey - //SEG83 [33] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 + //SEG87 [36] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 dec r - //SEG84 [34] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 + //SEG88 [37] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 lda r bne b1_from_b4 - //SEG85 [35] phi from flip::@4 to flip::@3 + //SEG89 [38] phi from flip::@4 to flip::@3 b3_from_b4: - //SEG86 [35] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 + //SEG90 [38] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b3 - //SEG87 [35] phi from flip::@3 to flip::@3 + //SEG91 [38] phi from flip::@3 to flip::@3 b3_from_b3: - //SEG88 [35] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy - //SEG89 flip::@3 + //SEG92 [38] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy + //SEG93 flip::@3 b3: - //SEG90 [36] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby + //SEG94 [39] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby lda $1100,x - //SEG91 [37] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby + //SEG95 [40] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby sta $1000,x - //SEG92 [38] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby + //SEG96 [41] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby inx - //SEG93 [39] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 + //SEG97 [42] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3_from_b3 - //SEG94 flip::@return + //SEG98 flip::@return breturn: - //SEG95 [40] return [ ] + //SEG99 [43] return [ ] rts } -//SEG96 prepare +//SEG100 prepare prepare: { - //SEG97 [41] phi from prepare to prepare::@1 + //SEG101 [45] phi from prepare to prepare::@1 b1_from_prepare: - //SEG98 [41] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 + //SEG102 [45] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG99 [41] phi from prepare::@1 to prepare::@1 + //SEG103 [45] phi from prepare::@1 to prepare::@1 b1_from_b1: - //SEG100 [41] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy - //SEG101 prepare::@1 + //SEG104 [45] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy + //SEG105 prepare::@1 b1: - //SEG102 [42] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby + //SEG106 [46] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby txa sta $1000,x - //SEG103 [43] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby + //SEG107 [47] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby inx - //SEG104 [44] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 + //SEG108 [48] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b1_from_b1 - //SEG105 prepare::@return + //SEG109 prepare::@return breturn: - //SEG106 [45] return [ ] + //SEG110 [49] return [ ] rts } @@ -4962,8 +5002,11 @@ Replacing label b2_from_b2 with b2 Replacing label b1_from_b4 with b1 Replacing label b3_from_b3 with b3 Replacing label b1_from_b1 with b1 +Removing instruction main_from_bbegin: Removing instruction b3_from_main: Removing instruction b3_from_b6: +Removing instruction flip_from_b7: +Removing instruction plot_from_b10: Removing instruction b1_from_b3: Removing instruction b2_from_b1: Removing instruction b2_from_b2: @@ -4978,108 +5021,113 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] call prepare param-assignment [ ] + //SEG6 [2] call prepare param-assignment [ ] + //SEG7 [44] phi from main to prepare + prepare_from_main: jsr prepare - //SEG6 [2] phi from main main::@11 to main::@3 + //SEG8 [3] phi from main main::@11 to main::@3 b3_from_b11: - //SEG7 [2] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 + //SEG9 [3] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 ldx #$19 jmp b3 - //SEG8 [2] phi from main::@3 to main::@3 + //SEG10 [3] phi from main::@3 to main::@3 b3_from_b3: jmp b3 - //SEG9 [2] phi from main::@6 to main::@3 - //SEG10 [2] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy - //SEG11 main::@3 + //SEG11 [3] phi from main::@6 to main::@3 + //SEG12 [3] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy + //SEG13 main::@3 b3: - //SEG12 [3] (byte~) main::$1 ← * (word) 53266 [ main::$1 main::c#2 ] -- aby=_star_cowo1 + //SEG14 [4] (byte~) main::$1 ← * (word) 53266 [ main::c#2 main::$1 ] -- aby=_star_cowo1 lda $d012 - //SEG13 [4] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG15 [5] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$fe bne b3_from_b3 - //SEG14 main::@4 + //SEG16 main::@4 b4: - //SEG15 [5] (byte~) main::$3 ← * (word) 53266 [ main::$3 main::c#2 ] -- aby=_star_cowo1 + //SEG17 [6] (byte~) main::$3 ← * (word) 53266 [ main::c#2 main::$3 ] -- aby=_star_cowo1 lda $d012 - //SEG16 [6] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG18 [7] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$ff bne b4 - //SEG17 main::@6 + //SEG19 main::@6 b6: - //SEG18 [7] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby + //SEG20 [8] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby dex - //SEG19 [8] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 + //SEG21 [9] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3 - //SEG20 main::@7 + //SEG22 main::@7 b7: - //SEG21 [9] call flip param-assignment [ ] + //SEG23 [10] call flip param-assignment [ ] + //SEG24 [26] phi from main::@7 to flip jsr flip - //SEG22 main::@10 + //SEG25 main::@10 b10: - //SEG23 [10] call plot param-assignment [ ] + //SEG26 [11] call plot param-assignment [ ] + //SEG27 [14] phi from main::@10 to plot jsr plot - //SEG24 main::@11 + //SEG28 main::@11 b11: - //SEG25 [11] if(true) goto main::@3 [ ] -- true_then_la1 + //SEG29 [12] if(true) goto main::@3 [ ] -- true_then_la1 jmp b3_from_b11 - //SEG26 main::@return + //SEG30 main::@return breturn: - //SEG27 [12] return [ ] + //SEG31 [13] return [ ] rts } -//SEG28 plot +//SEG32 plot plot: { .label line = 2 .label y = 4 - //SEG29 [13] phi from plot to plot::@1 + //SEG33 [15] phi from plot to plot::@1 b1_from_plot: - //SEG30 [13] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 + //SEG34 [15] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta y - //SEG31 [13] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 + //SEG35 [15] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 lda #<$4d4 sta line lda #>$4d4 sta line+$1 - //SEG32 [13] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 + //SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG33 [13] phi from plot::@3 to plot::@1 - //SEG34 [13] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy - //SEG35 [13] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy - //SEG36 [13] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy - //SEG37 plot::@1 + //SEG37 [15] phi from plot::@3 to plot::@1 + //SEG38 [15] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy + //SEG39 [15] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy + //SEG40 [15] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy + //SEG41 plot::@1 b1: - //SEG38 [14] phi from plot::@1 to plot::@2 - //SEG39 [14] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 + //SEG42 [16] phi from plot::@1 to plot::@2 + //SEG43 [16] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG40 [14] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy + //SEG44 [16] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy jmp b2 - //SEG41 [14] phi from plot::@2 to plot::@2 - //SEG42 [14] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy - //SEG43 [14] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy - //SEG44 plot::@2 + //SEG45 [16] phi from plot::@2 to plot::@2 + //SEG46 [16] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy + //SEG47 [16] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy + //SEG48 plot::@2 b2: - //SEG45 [15] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::i#2 plot::line#2 plot::x#2 plot::$3 plot::y#2 ] -- aby=cowo1_staridx_xby + //SEG49 [17] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 plot::$3 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG46 [16] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] -- zpptrby1_staridx_yby=aby + //SEG50 [18] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] -- zpptrby1_staridx_yby=aby sta (line),y - //SEG47 [17] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::i#1 plot::line#2 plot::x#2 plot::y#2 ] -- xby=_inc_xby + //SEG51 [19] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#2 ] -- xby=_inc_xby inx - //SEG48 [18] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby=_inc_yby + //SEG52 [20] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby=_inc_yby iny - //SEG49 [19] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby_lt_coby1_then_la1 + //SEG53 [21] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby_lt_coby1_then_la1 cpy #$10 bcc b2 - //SEG50 plot::@3 + //SEG54 plot::@3 b3: - //SEG51 [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG55 [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda line clc adc #$28 @@ -5087,124 +5135,125 @@ plot: { bcc !+ inc line+$1 !: - //SEG52 [21] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 + //SEG56 [23] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 dec y - //SEG53 [22] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 + //SEG57 [24] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 lda y bne b1 - //SEG54 plot::@return + //SEG58 plot::@return breturn: - //SEG55 [23] return [ ] + //SEG59 [25] return [ ] rts } -//SEG56 flip +//SEG60 flip flip: { .label c = 5 .label r = 4 - //SEG57 [24] phi from flip to flip::@1 + //SEG61 [27] phi from flip to flip::@1 b1_from_flip: - //SEG58 [24] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 + //SEG62 [27] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta r - //SEG59 [24] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 + //SEG63 [27] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 ldy #$f - //SEG60 [24] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 + //SEG64 [27] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG61 [24] phi from flip::@4 to flip::@1 - //SEG62 [24] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy - //SEG63 [24] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy - //SEG64 [24] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy - //SEG65 flip::@1 + //SEG65 [27] phi from flip::@4 to flip::@1 + //SEG66 [27] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy + //SEG67 [27] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy + //SEG68 [27] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy + //SEG69 flip::@1 b1: - //SEG66 [25] phi from flip::@1 to flip::@2 - //SEG67 [25] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 + //SEG70 [28] phi from flip::@1 to flip::@2 + //SEG71 [28] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta c - //SEG68 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy - //SEG69 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy + //SEG72 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy + //SEG73 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy jmp b2 - //SEG70 [25] phi from flip::@2 to flip::@2 - //SEG71 [25] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy - //SEG72 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy - //SEG73 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy - //SEG74 flip::@2 + //SEG74 [28] phi from flip::@2 to flip::@2 + //SEG75 [28] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy + //SEG76 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy + //SEG77 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy + //SEG78 flip::@2 b2: - //SEG75 [26] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::srcIdx#2 flip::dstIdx#3 flip::$0 flip::c#2 flip::r#2 ] -- aby=cowo1_staridx_xby + //SEG79 [29] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::$0 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG76 [27] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- cowo1_staridx_yby=aby + //SEG80 [30] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] -- cowo1_staridx_yby=aby sta $1100,y - //SEG77 [28] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::srcIdx#1 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- xby=_inc_xby + //SEG81 [31] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ] -- xby=_inc_xby inx - //SEG78 [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] -- yby=yby_plus_coby1 + //SEG82 [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] -- yby=yby_plus_coby1 tya clc adc #$10 tay - //SEG79 [30] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1=_dec_zpby1 + //SEG83 [33] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1=_dec_zpby1 dec c - //SEG80 [31] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1_neq_0_then_la1 + //SEG84 [34] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1_neq_0_then_la1 lda c bne b2 - //SEG81 flip::@4 + //SEG85 flip::@4 b4: - //SEG82 [32] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#2 ] -- yby=_dec_yby + //SEG86 [35] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ] -- yby=_dec_yby dey - //SEG83 [33] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 + //SEG87 [36] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 dec r - //SEG84 [34] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 + //SEG88 [37] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 lda r bne b1 - //SEG85 [35] phi from flip::@4 to flip::@3 + //SEG89 [38] phi from flip::@4 to flip::@3 b3_from_b4: - //SEG86 [35] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 + //SEG90 [38] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b3 - //SEG87 [35] phi from flip::@3 to flip::@3 - //SEG88 [35] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy - //SEG89 flip::@3 + //SEG91 [38] phi from flip::@3 to flip::@3 + //SEG92 [38] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy + //SEG93 flip::@3 b3: - //SEG90 [36] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby + //SEG94 [39] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby lda $1100,x - //SEG91 [37] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby + //SEG95 [40] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby sta $1000,x - //SEG92 [38] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby + //SEG96 [41] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby inx - //SEG93 [39] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 + //SEG97 [42] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3 - //SEG94 flip::@return + //SEG98 flip::@return breturn: - //SEG95 [40] return [ ] + //SEG99 [43] return [ ] rts } -//SEG96 prepare +//SEG100 prepare prepare: { - //SEG97 [41] phi from prepare to prepare::@1 + //SEG101 [45] phi from prepare to prepare::@1 b1_from_prepare: - //SEG98 [41] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 + //SEG102 [45] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG99 [41] phi from prepare::@1 to prepare::@1 - //SEG100 [41] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy - //SEG101 prepare::@1 + //SEG103 [45] phi from prepare::@1 to prepare::@1 + //SEG104 [45] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy + //SEG105 prepare::@1 b1: - //SEG102 [42] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby + //SEG106 [46] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby txa sta $1000,x - //SEG103 [43] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby + //SEG107 [47] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby inx - //SEG104 [44] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 + //SEG108 [48] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b1 - //SEG105 prepare::@return + //SEG109 prepare::@return breturn: - //SEG106 [45] return [ ] + //SEG110 [49] return [ ] rts } Removing instruction bbegin: Removing instruction bend: +Removing instruction prepare_from_main: Removing instruction b6: Removing instruction b7: Removing instruction b10: @@ -5224,100 +5273,104 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call prepare param-assignment [ ] + //SEG6 [2] call prepare param-assignment [ ] + //SEG7 [44] phi from main to prepare jsr prepare - //SEG6 [2] phi from main main::@11 to main::@3 + //SEG8 [3] phi from main main::@11 to main::@3 b3_from_b11: - //SEG7 [2] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 + //SEG9 [3] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 ldx #$19 jmp b3 - //SEG8 [2] phi from main::@3 to main::@3 + //SEG10 [3] phi from main::@3 to main::@3 b3_from_b3: jmp b3 - //SEG9 [2] phi from main::@6 to main::@3 - //SEG10 [2] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy - //SEG11 main::@3 + //SEG11 [3] phi from main::@6 to main::@3 + //SEG12 [3] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy + //SEG13 main::@3 b3: - //SEG12 [3] (byte~) main::$1 ← * (word) 53266 [ main::$1 main::c#2 ] -- aby=_star_cowo1 + //SEG14 [4] (byte~) main::$1 ← * (word) 53266 [ main::c#2 main::$1 ] -- aby=_star_cowo1 lda $d012 - //SEG13 [4] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG15 [5] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$fe bne b3_from_b3 - //SEG14 main::@4 + //SEG16 main::@4 b4: - //SEG15 [5] (byte~) main::$3 ← * (word) 53266 [ main::$3 main::c#2 ] -- aby=_star_cowo1 + //SEG17 [6] (byte~) main::$3 ← * (word) 53266 [ main::c#2 main::$3 ] -- aby=_star_cowo1 lda $d012 - //SEG16 [6] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG18 [7] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$ff bne b4 - //SEG17 main::@6 - //SEG18 [7] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby + //SEG19 main::@6 + //SEG20 [8] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby dex - //SEG19 [8] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 + //SEG21 [9] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3 - //SEG20 main::@7 - //SEG21 [9] call flip param-assignment [ ] + //SEG22 main::@7 + //SEG23 [10] call flip param-assignment [ ] + //SEG24 [26] phi from main::@7 to flip jsr flip - //SEG22 main::@10 - //SEG23 [10] call plot param-assignment [ ] + //SEG25 main::@10 + //SEG26 [11] call plot param-assignment [ ] + //SEG27 [14] phi from main::@10 to plot jsr plot - //SEG24 main::@11 - //SEG25 [11] if(true) goto main::@3 [ ] -- true_then_la1 + //SEG28 main::@11 + //SEG29 [12] if(true) goto main::@3 [ ] -- true_then_la1 jmp b3_from_b11 - //SEG26 main::@return - //SEG27 [12] return [ ] + //SEG30 main::@return + //SEG31 [13] return [ ] rts } -//SEG28 plot +//SEG32 plot plot: { .label line = 2 .label y = 4 - //SEG29 [13] phi from plot to plot::@1 - //SEG30 [13] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 + //SEG33 [15] phi from plot to plot::@1 + //SEG34 [15] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta y - //SEG31 [13] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 + //SEG35 [15] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 lda #<$4d4 sta line lda #>$4d4 sta line+$1 - //SEG32 [13] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 + //SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG33 [13] phi from plot::@3 to plot::@1 - //SEG34 [13] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy - //SEG35 [13] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy - //SEG36 [13] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy - //SEG37 plot::@1 + //SEG37 [15] phi from plot::@3 to plot::@1 + //SEG38 [15] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy + //SEG39 [15] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy + //SEG40 [15] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy + //SEG41 plot::@1 b1: - //SEG38 [14] phi from plot::@1 to plot::@2 - //SEG39 [14] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 + //SEG42 [16] phi from plot::@1 to plot::@2 + //SEG43 [16] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG40 [14] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy + //SEG44 [16] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy jmp b2 - //SEG41 [14] phi from plot::@2 to plot::@2 - //SEG42 [14] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy - //SEG43 [14] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy - //SEG44 plot::@2 + //SEG45 [16] phi from plot::@2 to plot::@2 + //SEG46 [16] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy + //SEG47 [16] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy + //SEG48 plot::@2 b2: - //SEG45 [15] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::i#2 plot::line#2 plot::x#2 plot::$3 plot::y#2 ] -- aby=cowo1_staridx_xby + //SEG49 [17] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 plot::$3 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG46 [16] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] -- zpptrby1_staridx_yby=aby + //SEG50 [18] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] -- zpptrby1_staridx_yby=aby sta (line),y - //SEG47 [17] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::i#1 plot::line#2 plot::x#2 plot::y#2 ] -- xby=_inc_xby + //SEG51 [19] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#2 ] -- xby=_inc_xby inx - //SEG48 [18] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby=_inc_yby + //SEG52 [20] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby=_inc_yby iny - //SEG49 [19] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby_lt_coby1_then_la1 + //SEG53 [21] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby_lt_coby1_then_la1 cpy #$10 bcc b2 - //SEG50 plot::@3 - //SEG51 [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG54 plot::@3 + //SEG55 [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda line clc adc #$28 @@ -5325,112 +5378,112 @@ plot: { bcc !+ inc line+$1 !: - //SEG52 [21] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 + //SEG56 [23] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 dec y - //SEG53 [22] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 + //SEG57 [24] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 lda y bne b1 - //SEG54 plot::@return - //SEG55 [23] return [ ] + //SEG58 plot::@return + //SEG59 [25] return [ ] rts } -//SEG56 flip +//SEG60 flip flip: { .label c = 5 .label r = 4 - //SEG57 [24] phi from flip to flip::@1 - //SEG58 [24] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 + //SEG61 [27] phi from flip to flip::@1 + //SEG62 [27] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta r - //SEG59 [24] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 + //SEG63 [27] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 ldy #$f - //SEG60 [24] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 + //SEG64 [27] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG61 [24] phi from flip::@4 to flip::@1 - //SEG62 [24] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy - //SEG63 [24] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy - //SEG64 [24] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy - //SEG65 flip::@1 + //SEG65 [27] phi from flip::@4 to flip::@1 + //SEG66 [27] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy + //SEG67 [27] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy + //SEG68 [27] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy + //SEG69 flip::@1 b1: - //SEG66 [25] phi from flip::@1 to flip::@2 - //SEG67 [25] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 + //SEG70 [28] phi from flip::@1 to flip::@2 + //SEG71 [28] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta c - //SEG68 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy - //SEG69 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy + //SEG72 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy + //SEG73 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy jmp b2 - //SEG70 [25] phi from flip::@2 to flip::@2 - //SEG71 [25] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy - //SEG72 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy - //SEG73 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy - //SEG74 flip::@2 + //SEG74 [28] phi from flip::@2 to flip::@2 + //SEG75 [28] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy + //SEG76 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy + //SEG77 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy + //SEG78 flip::@2 b2: - //SEG75 [26] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::srcIdx#2 flip::dstIdx#3 flip::$0 flip::c#2 flip::r#2 ] -- aby=cowo1_staridx_xby + //SEG79 [29] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::$0 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG76 [27] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- cowo1_staridx_yby=aby + //SEG80 [30] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] -- cowo1_staridx_yby=aby sta $1100,y - //SEG77 [28] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::srcIdx#1 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- xby=_inc_xby + //SEG81 [31] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ] -- xby=_inc_xby inx - //SEG78 [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] -- yby=yby_plus_coby1 + //SEG82 [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] -- yby=yby_plus_coby1 tya clc adc #$10 tay - //SEG79 [30] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1=_dec_zpby1 + //SEG83 [33] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1=_dec_zpby1 dec c - //SEG80 [31] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1_neq_0_then_la1 + //SEG84 [34] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1_neq_0_then_la1 lda c bne b2 - //SEG81 flip::@4 - //SEG82 [32] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#2 ] -- yby=_dec_yby + //SEG85 flip::@4 + //SEG86 [35] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ] -- yby=_dec_yby dey - //SEG83 [33] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 + //SEG87 [36] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 dec r - //SEG84 [34] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 + //SEG88 [37] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 lda r bne b1 - //SEG85 [35] phi from flip::@4 to flip::@3 - //SEG86 [35] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 + //SEG89 [38] phi from flip::@4 to flip::@3 + //SEG90 [38] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b3 - //SEG87 [35] phi from flip::@3 to flip::@3 - //SEG88 [35] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy - //SEG89 flip::@3 + //SEG91 [38] phi from flip::@3 to flip::@3 + //SEG92 [38] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy + //SEG93 flip::@3 b3: - //SEG90 [36] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby + //SEG94 [39] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby lda $1100,x - //SEG91 [37] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby + //SEG95 [40] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby sta $1000,x - //SEG92 [38] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby + //SEG96 [41] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby inx - //SEG93 [39] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 + //SEG97 [42] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3 - //SEG94 flip::@return - //SEG95 [40] return [ ] + //SEG98 flip::@return + //SEG99 [43] return [ ] rts } -//SEG96 prepare +//SEG100 prepare prepare: { - //SEG97 [41] phi from prepare to prepare::@1 - //SEG98 [41] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 + //SEG101 [45] phi from prepare to prepare::@1 + //SEG102 [45] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG99 [41] phi from prepare::@1 to prepare::@1 - //SEG100 [41] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy - //SEG101 prepare::@1 + //SEG103 [45] phi from prepare::@1 to prepare::@1 + //SEG104 [45] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy + //SEG105 prepare::@1 b1: - //SEG102 [42] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby + //SEG106 [46] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby txa sta $1000,x - //SEG103 [43] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby + //SEG107 [47] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby inx - //SEG104 [44] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 + //SEG108 [48] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b1 - //SEG105 prepare::@return - //SEG106 [45] return [ ] + //SEG109 prepare::@return + //SEG110 [49] return [ ] rts } @@ -5446,97 +5499,101 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call prepare param-assignment [ ] + //SEG6 [2] call prepare param-assignment [ ] + //SEG7 [44] phi from main to prepare jsr prepare - //SEG6 [2] phi from main main::@11 to main::@3 + //SEG8 [3] phi from main main::@11 to main::@3 b3_from_b11: - //SEG7 [2] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 + //SEG9 [3] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 ldx #$19 jmp b3 - //SEG8 [2] phi from main::@3 to main::@3 + //SEG10 [3] phi from main::@3 to main::@3 b3_from_b3: - //SEG9 [2] phi from main::@6 to main::@3 - //SEG10 [2] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy - //SEG11 main::@3 + //SEG11 [3] phi from main::@6 to main::@3 + //SEG12 [3] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy + //SEG13 main::@3 b3: - //SEG12 [3] (byte~) main::$1 ← * (word) 53266 [ main::$1 main::c#2 ] -- aby=_star_cowo1 + //SEG14 [4] (byte~) main::$1 ← * (word) 53266 [ main::c#2 main::$1 ] -- aby=_star_cowo1 lda $d012 - //SEG13 [4] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG15 [5] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$fe bne b3_from_b3 - //SEG14 main::@4 + //SEG16 main::@4 b4: - //SEG15 [5] (byte~) main::$3 ← * (word) 53266 [ main::$3 main::c#2 ] -- aby=_star_cowo1 + //SEG17 [6] (byte~) main::$3 ← * (word) 53266 [ main::c#2 main::$3 ] -- aby=_star_cowo1 lda $d012 - //SEG16 [6] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG18 [7] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$ff bne b4 - //SEG17 main::@6 - //SEG18 [7] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby + //SEG19 main::@6 + //SEG20 [8] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby dex - //SEG19 [8] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 + //SEG21 [9] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3 - //SEG20 main::@7 - //SEG21 [9] call flip param-assignment [ ] + //SEG22 main::@7 + //SEG23 [10] call flip param-assignment [ ] + //SEG24 [26] phi from main::@7 to flip jsr flip - //SEG22 main::@10 - //SEG23 [10] call plot param-assignment [ ] + //SEG25 main::@10 + //SEG26 [11] call plot param-assignment [ ] + //SEG27 [14] phi from main::@10 to plot jsr plot - //SEG24 main::@11 - //SEG25 [11] if(true) goto main::@3 [ ] -- true_then_la1 + //SEG28 main::@11 + //SEG29 [12] if(true) goto main::@3 [ ] -- true_then_la1 jmp b3_from_b11 - //SEG26 main::@return - //SEG27 [12] return [ ] + //SEG30 main::@return + //SEG31 [13] return [ ] rts } -//SEG28 plot +//SEG32 plot plot: { .label line = 2 .label y = 4 - //SEG29 [13] phi from plot to plot::@1 - //SEG30 [13] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 + //SEG33 [15] phi from plot to plot::@1 + //SEG34 [15] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta y - //SEG31 [13] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 + //SEG35 [15] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 lda #<$4d4 sta line lda #>$4d4 sta line+$1 - //SEG32 [13] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 + //SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG33 [13] phi from plot::@3 to plot::@1 - //SEG34 [13] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy - //SEG35 [13] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy - //SEG36 [13] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy - //SEG37 plot::@1 + //SEG37 [15] phi from plot::@3 to plot::@1 + //SEG38 [15] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy + //SEG39 [15] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy + //SEG40 [15] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy + //SEG41 plot::@1 b1: - //SEG38 [14] phi from plot::@1 to plot::@2 - //SEG39 [14] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 + //SEG42 [16] phi from plot::@1 to plot::@2 + //SEG43 [16] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG40 [14] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy - //SEG41 [14] phi from plot::@2 to plot::@2 - //SEG42 [14] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy - //SEG43 [14] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy - //SEG44 plot::@2 + //SEG44 [16] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy + //SEG45 [16] phi from plot::@2 to plot::@2 + //SEG46 [16] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy + //SEG47 [16] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy + //SEG48 plot::@2 b2: - //SEG45 [15] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::i#2 plot::line#2 plot::x#2 plot::$3 plot::y#2 ] -- aby=cowo1_staridx_xby + //SEG49 [17] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 plot::$3 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG46 [16] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] -- zpptrby1_staridx_yby=aby + //SEG50 [18] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] -- zpptrby1_staridx_yby=aby sta (line),y - //SEG47 [17] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::i#1 plot::line#2 plot::x#2 plot::y#2 ] -- xby=_inc_xby + //SEG51 [19] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#2 ] -- xby=_inc_xby inx - //SEG48 [18] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby=_inc_yby + //SEG52 [20] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby=_inc_yby iny - //SEG49 [19] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby_lt_coby1_then_la1 + //SEG53 [21] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby_lt_coby1_then_la1 cpy #$10 bcc b2 - //SEG50 plot::@3 - //SEG51 [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG54 plot::@3 + //SEG55 [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda line clc adc #$28 @@ -5544,108 +5601,108 @@ plot: { bcc !+ inc line+$1 !: - //SEG52 [21] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 + //SEG56 [23] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 dec y - //SEG53 [22] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 + //SEG57 [24] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 lda y bne b1 - //SEG54 plot::@return - //SEG55 [23] return [ ] + //SEG58 plot::@return + //SEG59 [25] return [ ] rts } -//SEG56 flip +//SEG60 flip flip: { .label c = 5 .label r = 4 - //SEG57 [24] phi from flip to flip::@1 - //SEG58 [24] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 + //SEG61 [27] phi from flip to flip::@1 + //SEG62 [27] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta r - //SEG59 [24] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 + //SEG63 [27] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 ldy #$f - //SEG60 [24] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 + //SEG64 [27] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG61 [24] phi from flip::@4 to flip::@1 - //SEG62 [24] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy - //SEG63 [24] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy - //SEG64 [24] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy - //SEG65 flip::@1 + //SEG65 [27] phi from flip::@4 to flip::@1 + //SEG66 [27] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy + //SEG67 [27] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy + //SEG68 [27] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy + //SEG69 flip::@1 b1: - //SEG66 [25] phi from flip::@1 to flip::@2 - //SEG67 [25] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 + //SEG70 [28] phi from flip::@1 to flip::@2 + //SEG71 [28] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta c - //SEG68 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy - //SEG69 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy - //SEG70 [25] phi from flip::@2 to flip::@2 - //SEG71 [25] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy - //SEG72 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy - //SEG73 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy - //SEG74 flip::@2 + //SEG72 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy + //SEG73 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy + //SEG74 [28] phi from flip::@2 to flip::@2 + //SEG75 [28] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy + //SEG76 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy + //SEG77 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy + //SEG78 flip::@2 b2: - //SEG75 [26] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::srcIdx#2 flip::dstIdx#3 flip::$0 flip::c#2 flip::r#2 ] -- aby=cowo1_staridx_xby + //SEG79 [29] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::$0 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG76 [27] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- cowo1_staridx_yby=aby + //SEG80 [30] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] -- cowo1_staridx_yby=aby sta $1100,y - //SEG77 [28] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::srcIdx#1 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- xby=_inc_xby + //SEG81 [31] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ] -- xby=_inc_xby inx - //SEG78 [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] -- yby=yby_plus_coby1 + //SEG82 [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] -- yby=yby_plus_coby1 tya clc adc #$10 tay - //SEG79 [30] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1=_dec_zpby1 + //SEG83 [33] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1=_dec_zpby1 dec c - //SEG80 [31] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1_neq_0_then_la1 + //SEG84 [34] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1_neq_0_then_la1 lda c bne b2 - //SEG81 flip::@4 - //SEG82 [32] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#2 ] -- yby=_dec_yby + //SEG85 flip::@4 + //SEG86 [35] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ] -- yby=_dec_yby dey - //SEG83 [33] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 + //SEG87 [36] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 dec r - //SEG84 [34] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 + //SEG88 [37] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 lda r bne b1 - //SEG85 [35] phi from flip::@4 to flip::@3 - //SEG86 [35] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 + //SEG89 [38] phi from flip::@4 to flip::@3 + //SEG90 [38] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG87 [35] phi from flip::@3 to flip::@3 - //SEG88 [35] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy - //SEG89 flip::@3 + //SEG91 [38] phi from flip::@3 to flip::@3 + //SEG92 [38] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy + //SEG93 flip::@3 b3: - //SEG90 [36] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby + //SEG94 [39] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby lda $1100,x - //SEG91 [37] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby + //SEG95 [40] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby sta $1000,x - //SEG92 [38] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby + //SEG96 [41] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby inx - //SEG93 [39] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 + //SEG97 [42] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3 - //SEG94 flip::@return - //SEG95 [40] return [ ] + //SEG98 flip::@return + //SEG99 [43] return [ ] rts } -//SEG96 prepare +//SEG100 prepare prepare: { - //SEG97 [41] phi from prepare to prepare::@1 - //SEG98 [41] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 + //SEG101 [45] phi from prepare to prepare::@1 + //SEG102 [45] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG99 [41] phi from prepare::@1 to prepare::@1 - //SEG100 [41] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy - //SEG101 prepare::@1 + //SEG103 [45] phi from prepare::@1 to prepare::@1 + //SEG104 [45] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy + //SEG105 prepare::@1 b1: - //SEG102 [42] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby + //SEG106 [46] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby txa sta $1000,x - //SEG103 [43] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby + //SEG107 [47] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby inx - //SEG104 [44] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 + //SEG108 [48] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b1 - //SEG105 prepare::@return - //SEG106 [45] return [ ] + //SEG109 prepare::@return + //SEG110 [49] return [ ] rts } @@ -5656,96 +5713,100 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call prepare param-assignment [ ] + //SEG6 [2] call prepare param-assignment [ ] + //SEG7 [44] phi from main to prepare jsr prepare - //SEG6 [2] phi from main main::@11 to main::@3 + //SEG8 [3] phi from main main::@11 to main::@3 b3_from_b11: - //SEG7 [2] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 + //SEG9 [3] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 ldx #$19 jmp b3 - //SEG8 [2] phi from main::@3 to main::@3 - //SEG9 [2] phi from main::@6 to main::@3 - //SEG10 [2] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy - //SEG11 main::@3 + //SEG10 [3] phi from main::@3 to main::@3 + //SEG11 [3] phi from main::@6 to main::@3 + //SEG12 [3] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy + //SEG13 main::@3 b3: - //SEG12 [3] (byte~) main::$1 ← * (word) 53266 [ main::$1 main::c#2 ] -- aby=_star_cowo1 + //SEG14 [4] (byte~) main::$1 ← * (word) 53266 [ main::c#2 main::$1 ] -- aby=_star_cowo1 lda $d012 - //SEG13 [4] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG15 [5] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$fe bne b3 - //SEG14 main::@4 + //SEG16 main::@4 b4: - //SEG15 [5] (byte~) main::$3 ← * (word) 53266 [ main::$3 main::c#2 ] -- aby=_star_cowo1 + //SEG17 [6] (byte~) main::$3 ← * (word) 53266 [ main::c#2 main::$3 ] -- aby=_star_cowo1 lda $d012 - //SEG16 [6] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG18 [7] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$ff bne b4 - //SEG17 main::@6 - //SEG18 [7] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby + //SEG19 main::@6 + //SEG20 [8] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby dex - //SEG19 [8] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 + //SEG21 [9] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3 - //SEG20 main::@7 - //SEG21 [9] call flip param-assignment [ ] + //SEG22 main::@7 + //SEG23 [10] call flip param-assignment [ ] + //SEG24 [26] phi from main::@7 to flip jsr flip - //SEG22 main::@10 - //SEG23 [10] call plot param-assignment [ ] + //SEG25 main::@10 + //SEG26 [11] call plot param-assignment [ ] + //SEG27 [14] phi from main::@10 to plot jsr plot - //SEG24 main::@11 - //SEG25 [11] if(true) goto main::@3 [ ] -- true_then_la1 + //SEG28 main::@11 + //SEG29 [12] if(true) goto main::@3 [ ] -- true_then_la1 jmp b3_from_b11 - //SEG26 main::@return - //SEG27 [12] return [ ] + //SEG30 main::@return + //SEG31 [13] return [ ] rts } -//SEG28 plot +//SEG32 plot plot: { .label line = 2 .label y = 4 - //SEG29 [13] phi from plot to plot::@1 - //SEG30 [13] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 + //SEG33 [15] phi from plot to plot::@1 + //SEG34 [15] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta y - //SEG31 [13] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 + //SEG35 [15] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 lda #<$4d4 sta line lda #>$4d4 sta line+$1 - //SEG32 [13] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 + //SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG33 [13] phi from plot::@3 to plot::@1 - //SEG34 [13] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy - //SEG35 [13] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy - //SEG36 [13] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy - //SEG37 plot::@1 + //SEG37 [15] phi from plot::@3 to plot::@1 + //SEG38 [15] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy + //SEG39 [15] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy + //SEG40 [15] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy + //SEG41 plot::@1 b1: - //SEG38 [14] phi from plot::@1 to plot::@2 - //SEG39 [14] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 + //SEG42 [16] phi from plot::@1 to plot::@2 + //SEG43 [16] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG40 [14] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy - //SEG41 [14] phi from plot::@2 to plot::@2 - //SEG42 [14] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy - //SEG43 [14] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy - //SEG44 plot::@2 + //SEG44 [16] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy + //SEG45 [16] phi from plot::@2 to plot::@2 + //SEG46 [16] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy + //SEG47 [16] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy + //SEG48 plot::@2 b2: - //SEG45 [15] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::i#2 plot::line#2 plot::x#2 plot::$3 plot::y#2 ] -- aby=cowo1_staridx_xby + //SEG49 [17] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 plot::$3 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG46 [16] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] -- zpptrby1_staridx_yby=aby + //SEG50 [18] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] -- zpptrby1_staridx_yby=aby sta (line),y - //SEG47 [17] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::i#1 plot::line#2 plot::x#2 plot::y#2 ] -- xby=_inc_xby + //SEG51 [19] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#2 ] -- xby=_inc_xby inx - //SEG48 [18] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby=_inc_yby + //SEG52 [20] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby=_inc_yby iny - //SEG49 [19] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby_lt_coby1_then_la1 + //SEG53 [21] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby_lt_coby1_then_la1 cpy #$10 bcc b2 - //SEG50 plot::@3 - //SEG51 [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG54 plot::@3 + //SEG55 [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda line clc adc #$28 @@ -5753,108 +5814,108 @@ plot: { bcc !+ inc line+$1 !: - //SEG52 [21] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 + //SEG56 [23] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 dec y - //SEG53 [22] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 + //SEG57 [24] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 lda y bne b1 - //SEG54 plot::@return - //SEG55 [23] return [ ] + //SEG58 plot::@return + //SEG59 [25] return [ ] rts } -//SEG56 flip +//SEG60 flip flip: { .label c = 5 .label r = 4 - //SEG57 [24] phi from flip to flip::@1 - //SEG58 [24] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 + //SEG61 [27] phi from flip to flip::@1 + //SEG62 [27] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta r - //SEG59 [24] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 + //SEG63 [27] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 ldy #$f - //SEG60 [24] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 + //SEG64 [27] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG61 [24] phi from flip::@4 to flip::@1 - //SEG62 [24] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy - //SEG63 [24] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy - //SEG64 [24] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy - //SEG65 flip::@1 + //SEG65 [27] phi from flip::@4 to flip::@1 + //SEG66 [27] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy + //SEG67 [27] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy + //SEG68 [27] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy + //SEG69 flip::@1 b1: - //SEG66 [25] phi from flip::@1 to flip::@2 - //SEG67 [25] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 + //SEG70 [28] phi from flip::@1 to flip::@2 + //SEG71 [28] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta c - //SEG68 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy - //SEG69 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy - //SEG70 [25] phi from flip::@2 to flip::@2 - //SEG71 [25] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy - //SEG72 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy - //SEG73 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy - //SEG74 flip::@2 + //SEG72 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy + //SEG73 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy + //SEG74 [28] phi from flip::@2 to flip::@2 + //SEG75 [28] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy + //SEG76 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy + //SEG77 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy + //SEG78 flip::@2 b2: - //SEG75 [26] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::srcIdx#2 flip::dstIdx#3 flip::$0 flip::c#2 flip::r#2 ] -- aby=cowo1_staridx_xby + //SEG79 [29] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::$0 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG76 [27] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- cowo1_staridx_yby=aby + //SEG80 [30] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] -- cowo1_staridx_yby=aby sta $1100,y - //SEG77 [28] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::srcIdx#1 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- xby=_inc_xby + //SEG81 [31] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ] -- xby=_inc_xby inx - //SEG78 [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] -- yby=yby_plus_coby1 + //SEG82 [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] -- yby=yby_plus_coby1 tya clc adc #$10 tay - //SEG79 [30] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1=_dec_zpby1 + //SEG83 [33] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1=_dec_zpby1 dec c - //SEG80 [31] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1_neq_0_then_la1 + //SEG84 [34] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1_neq_0_then_la1 lda c bne b2 - //SEG81 flip::@4 - //SEG82 [32] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#2 ] -- yby=_dec_yby + //SEG85 flip::@4 + //SEG86 [35] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ] -- yby=_dec_yby dey - //SEG83 [33] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 + //SEG87 [36] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 dec r - //SEG84 [34] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 + //SEG88 [37] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 lda r bne b1 - //SEG85 [35] phi from flip::@4 to flip::@3 - //SEG86 [35] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 + //SEG89 [38] phi from flip::@4 to flip::@3 + //SEG90 [38] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG87 [35] phi from flip::@3 to flip::@3 - //SEG88 [35] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy - //SEG89 flip::@3 + //SEG91 [38] phi from flip::@3 to flip::@3 + //SEG92 [38] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy + //SEG93 flip::@3 b3: - //SEG90 [36] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby + //SEG94 [39] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby lda $1100,x - //SEG91 [37] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby + //SEG95 [40] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby sta $1000,x - //SEG92 [38] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby + //SEG96 [41] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby inx - //SEG93 [39] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 + //SEG97 [42] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3 - //SEG94 flip::@return - //SEG95 [40] return [ ] + //SEG98 flip::@return + //SEG99 [43] return [ ] rts } -//SEG96 prepare +//SEG100 prepare prepare: { - //SEG97 [41] phi from prepare to prepare::@1 - //SEG98 [41] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 + //SEG101 [45] phi from prepare to prepare::@1 + //SEG102 [45] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG99 [41] phi from prepare::@1 to prepare::@1 - //SEG100 [41] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy - //SEG101 prepare::@1 + //SEG103 [45] phi from prepare::@1 to prepare::@1 + //SEG104 [45] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy + //SEG105 prepare::@1 b1: - //SEG102 [42] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby + //SEG106 [46] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby txa sta $1000,x - //SEG103 [43] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby + //SEG107 [47] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby inx - //SEG104 [44] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 + //SEG108 [48] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b1 - //SEG105 prepare::@return - //SEG106 [45] return [ ] + //SEG109 prepare::@return + //SEG110 [49] return [ ] rts } @@ -5864,95 +5925,99 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call prepare param-assignment [ ] + //SEG6 [2] call prepare param-assignment [ ] + //SEG7 [44] phi from main to prepare jsr prepare - //SEG6 [2] phi from main main::@11 to main::@3 + //SEG8 [3] phi from main main::@11 to main::@3 b3_from_b11: - //SEG7 [2] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 + //SEG9 [3] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 ldx #$19 - //SEG8 [2] phi from main::@3 to main::@3 - //SEG9 [2] phi from main::@6 to main::@3 - //SEG10 [2] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy - //SEG11 main::@3 + //SEG10 [3] phi from main::@3 to main::@3 + //SEG11 [3] phi from main::@6 to main::@3 + //SEG12 [3] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy + //SEG13 main::@3 b3: - //SEG12 [3] (byte~) main::$1 ← * (word) 53266 [ main::$1 main::c#2 ] -- aby=_star_cowo1 + //SEG14 [4] (byte~) main::$1 ← * (word) 53266 [ main::c#2 main::$1 ] -- aby=_star_cowo1 lda $d012 - //SEG13 [4] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG15 [5] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$fe bne b3 - //SEG14 main::@4 + //SEG16 main::@4 b4: - //SEG15 [5] (byte~) main::$3 ← * (word) 53266 [ main::$3 main::c#2 ] -- aby=_star_cowo1 + //SEG17 [6] (byte~) main::$3 ← * (word) 53266 [ main::c#2 main::$3 ] -- aby=_star_cowo1 lda $d012 - //SEG16 [6] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG18 [7] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$ff bne b4 - //SEG17 main::@6 - //SEG18 [7] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby + //SEG19 main::@6 + //SEG20 [8] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby dex - //SEG19 [8] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 + //SEG21 [9] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3 - //SEG20 main::@7 - //SEG21 [9] call flip param-assignment [ ] + //SEG22 main::@7 + //SEG23 [10] call flip param-assignment [ ] + //SEG24 [26] phi from main::@7 to flip jsr flip - //SEG22 main::@10 - //SEG23 [10] call plot param-assignment [ ] + //SEG25 main::@10 + //SEG26 [11] call plot param-assignment [ ] + //SEG27 [14] phi from main::@10 to plot jsr plot - //SEG24 main::@11 - //SEG25 [11] if(true) goto main::@3 [ ] -- true_then_la1 + //SEG28 main::@11 + //SEG29 [12] if(true) goto main::@3 [ ] -- true_then_la1 jmp b3_from_b11 - //SEG26 main::@return - //SEG27 [12] return [ ] + //SEG30 main::@return + //SEG31 [13] return [ ] rts } -//SEG28 plot +//SEG32 plot plot: { .label line = 2 .label y = 4 - //SEG29 [13] phi from plot to plot::@1 - //SEG30 [13] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 + //SEG33 [15] phi from plot to plot::@1 + //SEG34 [15] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta y - //SEG31 [13] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 + //SEG35 [15] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 lda #<$4d4 sta line lda #>$4d4 sta line+$1 - //SEG32 [13] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 + //SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG33 [13] phi from plot::@3 to plot::@1 - //SEG34 [13] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy - //SEG35 [13] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy - //SEG36 [13] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy - //SEG37 plot::@1 + //SEG37 [15] phi from plot::@3 to plot::@1 + //SEG38 [15] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy + //SEG39 [15] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy + //SEG40 [15] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy + //SEG41 plot::@1 b1: - //SEG38 [14] phi from plot::@1 to plot::@2 - //SEG39 [14] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 + //SEG42 [16] phi from plot::@1 to plot::@2 + //SEG43 [16] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG40 [14] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy - //SEG41 [14] phi from plot::@2 to plot::@2 - //SEG42 [14] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy - //SEG43 [14] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy - //SEG44 plot::@2 + //SEG44 [16] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy + //SEG45 [16] phi from plot::@2 to plot::@2 + //SEG46 [16] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy + //SEG47 [16] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy + //SEG48 plot::@2 b2: - //SEG45 [15] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::i#2 plot::line#2 plot::x#2 plot::$3 plot::y#2 ] -- aby=cowo1_staridx_xby + //SEG49 [17] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 plot::$3 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG46 [16] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] -- zpptrby1_staridx_yby=aby + //SEG50 [18] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] -- zpptrby1_staridx_yby=aby sta (line),y - //SEG47 [17] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::i#1 plot::line#2 plot::x#2 plot::y#2 ] -- xby=_inc_xby + //SEG51 [19] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#2 ] -- xby=_inc_xby inx - //SEG48 [18] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby=_inc_yby + //SEG52 [20] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby=_inc_yby iny - //SEG49 [19] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby_lt_coby1_then_la1 + //SEG53 [21] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby_lt_coby1_then_la1 cpy #$10 bcc b2 - //SEG50 plot::@3 - //SEG51 [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG54 plot::@3 + //SEG55 [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda line clc adc #$28 @@ -5960,108 +6025,108 @@ plot: { bcc !+ inc line+$1 !: - //SEG52 [21] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 + //SEG56 [23] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 dec y - //SEG53 [22] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 + //SEG57 [24] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 lda y bne b1 - //SEG54 plot::@return - //SEG55 [23] return [ ] + //SEG58 plot::@return + //SEG59 [25] return [ ] rts } -//SEG56 flip +//SEG60 flip flip: { .label c = 5 .label r = 4 - //SEG57 [24] phi from flip to flip::@1 - //SEG58 [24] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 + //SEG61 [27] phi from flip to flip::@1 + //SEG62 [27] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta r - //SEG59 [24] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 + //SEG63 [27] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 ldy #$f - //SEG60 [24] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 + //SEG64 [27] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG61 [24] phi from flip::@4 to flip::@1 - //SEG62 [24] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy - //SEG63 [24] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy - //SEG64 [24] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy - //SEG65 flip::@1 + //SEG65 [27] phi from flip::@4 to flip::@1 + //SEG66 [27] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy + //SEG67 [27] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy + //SEG68 [27] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy + //SEG69 flip::@1 b1: - //SEG66 [25] phi from flip::@1 to flip::@2 - //SEG67 [25] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 + //SEG70 [28] phi from flip::@1 to flip::@2 + //SEG71 [28] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta c - //SEG68 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy - //SEG69 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy - //SEG70 [25] phi from flip::@2 to flip::@2 - //SEG71 [25] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy - //SEG72 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy - //SEG73 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy - //SEG74 flip::@2 + //SEG72 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy + //SEG73 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy + //SEG74 [28] phi from flip::@2 to flip::@2 + //SEG75 [28] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy + //SEG76 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy + //SEG77 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy + //SEG78 flip::@2 b2: - //SEG75 [26] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::srcIdx#2 flip::dstIdx#3 flip::$0 flip::c#2 flip::r#2 ] -- aby=cowo1_staridx_xby + //SEG79 [29] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::$0 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG76 [27] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- cowo1_staridx_yby=aby + //SEG80 [30] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] -- cowo1_staridx_yby=aby sta $1100,y - //SEG77 [28] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::srcIdx#1 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- xby=_inc_xby + //SEG81 [31] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ] -- xby=_inc_xby inx - //SEG78 [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] -- yby=yby_plus_coby1 + //SEG82 [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] -- yby=yby_plus_coby1 tya clc adc #$10 tay - //SEG79 [30] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1=_dec_zpby1 + //SEG83 [33] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1=_dec_zpby1 dec c - //SEG80 [31] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1_neq_0_then_la1 + //SEG84 [34] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1_neq_0_then_la1 lda c bne b2 - //SEG81 flip::@4 - //SEG82 [32] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#2 ] -- yby=_dec_yby + //SEG85 flip::@4 + //SEG86 [35] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ] -- yby=_dec_yby dey - //SEG83 [33] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 + //SEG87 [36] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 dec r - //SEG84 [34] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 + //SEG88 [37] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 lda r bne b1 - //SEG85 [35] phi from flip::@4 to flip::@3 - //SEG86 [35] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 + //SEG89 [38] phi from flip::@4 to flip::@3 + //SEG90 [38] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG87 [35] phi from flip::@3 to flip::@3 - //SEG88 [35] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy - //SEG89 flip::@3 + //SEG91 [38] phi from flip::@3 to flip::@3 + //SEG92 [38] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy + //SEG93 flip::@3 b3: - //SEG90 [36] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby + //SEG94 [39] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby lda $1100,x - //SEG91 [37] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby + //SEG95 [40] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby sta $1000,x - //SEG92 [38] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby + //SEG96 [41] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby inx - //SEG93 [39] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 + //SEG97 [42] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3 - //SEG94 flip::@return - //SEG95 [40] return [ ] + //SEG98 flip::@return + //SEG99 [43] return [ ] rts } -//SEG96 prepare +//SEG100 prepare prepare: { - //SEG97 [41] phi from prepare to prepare::@1 - //SEG98 [41] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 + //SEG101 [45] phi from prepare to prepare::@1 + //SEG102 [45] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG99 [41] phi from prepare::@1 to prepare::@1 - //SEG100 [41] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy - //SEG101 prepare::@1 + //SEG103 [45] phi from prepare::@1 to prepare::@1 + //SEG104 [45] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy + //SEG105 prepare::@1 b1: - //SEG102 [42] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby + //SEG106 [46] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby txa sta $1000,x - //SEG103 [43] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby + //SEG107 [47] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby inx - //SEG104 [44] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 + //SEG108 [48] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b1 - //SEG105 prepare::@return - //SEG106 [45] return [ ] + //SEG109 prepare::@return + //SEG110 [49] return [ ] rts } @@ -6157,95 +6222,99 @@ FINAL CODE //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call prepare param-assignment [ ] + //SEG6 [2] call prepare param-assignment [ ] + //SEG7 [44] phi from main to prepare jsr prepare - //SEG6 [2] phi from main main::@11 to main::@3 + //SEG8 [3] phi from main main::@11 to main::@3 b3_from_b11: - //SEG7 [2] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 + //SEG9 [3] phi (byte) main::c#2 = (byte) 25 -- xby=coby1 ldx #$19 - //SEG8 [2] phi from main::@3 to main::@3 - //SEG9 [2] phi from main::@6 to main::@3 - //SEG10 [2] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy - //SEG11 main::@3 + //SEG10 [3] phi from main::@3 to main::@3 + //SEG11 [3] phi from main::@6 to main::@3 + //SEG12 [3] phi (byte) main::c#2 = (byte) main::c#1 -- register_copy + //SEG13 main::@3 b3: - //SEG12 [3] (byte~) main::$1 ← * (word) 53266 [ main::$1 main::c#2 ] -- aby=_star_cowo1 + //SEG14 [4] (byte~) main::$1 ← * (word) 53266 [ main::c#2 main::$1 ] -- aby=_star_cowo1 lda $d012 - //SEG13 [4] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG15 [5] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$fe bne b3 - //SEG14 main::@4 + //SEG16 main::@4 b4: - //SEG15 [5] (byte~) main::$3 ← * (word) 53266 [ main::$3 main::c#2 ] -- aby=_star_cowo1 + //SEG17 [6] (byte~) main::$3 ← * (word) 53266 [ main::c#2 main::$3 ] -- aby=_star_cowo1 lda $d012 - //SEG16 [6] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 + //SEG18 [7] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ] -- aby_neq_coby1_then_la1 cmp #$ff bne b4 - //SEG17 main::@6 - //SEG18 [7] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby + //SEG19 main::@6 + //SEG20 [8] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ] -- xby=_dec_xby dex - //SEG19 [8] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 + //SEG21 [9] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3 - //SEG20 main::@7 - //SEG21 [9] call flip param-assignment [ ] + //SEG22 main::@7 + //SEG23 [10] call flip param-assignment [ ] + //SEG24 [26] phi from main::@7 to flip jsr flip - //SEG22 main::@10 - //SEG23 [10] call plot param-assignment [ ] + //SEG25 main::@10 + //SEG26 [11] call plot param-assignment [ ] + //SEG27 [14] phi from main::@10 to plot jsr plot - //SEG24 main::@11 - //SEG25 [11] if(true) goto main::@3 [ ] -- true_then_la1 + //SEG28 main::@11 + //SEG29 [12] if(true) goto main::@3 [ ] -- true_then_la1 jmp b3_from_b11 - //SEG26 main::@return - //SEG27 [12] return [ ] + //SEG30 main::@return + //SEG31 [13] return [ ] rts } -//SEG28 plot +//SEG32 plot plot: { .label line = 2 .label y = 4 - //SEG29 [13] phi from plot to plot::@1 - //SEG30 [13] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 + //SEG33 [15] phi from plot to plot::@1 + //SEG34 [15] phi (byte) plot::y#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta y - //SEG31 [13] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 + //SEG35 [15] phi (byte*) plot::line#2 = (word) 1236 -- zpptrby1=cowo1 lda #<$4d4 sta line lda #>$4d4 sta line+$1 - //SEG32 [13] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 + //SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG33 [13] phi from plot::@3 to plot::@1 - //SEG34 [13] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy - //SEG35 [13] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy - //SEG36 [13] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy - //SEG37 plot::@1 + //SEG37 [15] phi from plot::@3 to plot::@1 + //SEG38 [15] phi (byte) plot::y#2 = (byte) plot::y#1 -- register_copy + //SEG39 [15] phi (byte*) plot::line#2 = (byte*) plot::line#1 -- register_copy + //SEG40 [15] phi (byte) plot::i#3 = (byte) plot::i#1 -- register_copy + //SEG41 plot::@1 b1: - //SEG38 [14] phi from plot::@1 to plot::@2 - //SEG39 [14] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 + //SEG42 [16] phi from plot::@1 to plot::@2 + //SEG43 [16] phi (byte) plot::x#2 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG40 [14] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy - //SEG41 [14] phi from plot::@2 to plot::@2 - //SEG42 [14] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy - //SEG43 [14] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy - //SEG44 plot::@2 + //SEG44 [16] phi (byte) plot::i#2 = (byte) plot::i#3 -- register_copy + //SEG45 [16] phi from plot::@2 to plot::@2 + //SEG46 [16] phi (byte) plot::x#2 = (byte) plot::x#1 -- register_copy + //SEG47 [16] phi (byte) plot::i#2 = (byte) plot::i#1 -- register_copy + //SEG48 plot::@2 b2: - //SEG45 [15] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::i#2 plot::line#2 plot::x#2 plot::$3 plot::y#2 ] -- aby=cowo1_staridx_xby + //SEG49 [17] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 plot::$3 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG46 [16] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ] -- zpptrby1_staridx_yby=aby + //SEG50 [18] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ] -- zpptrby1_staridx_yby=aby sta (line),y - //SEG47 [17] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::i#1 plot::line#2 plot::x#2 plot::y#2 ] -- xby=_inc_xby + //SEG51 [19] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#2 ] -- xby=_inc_xby inx - //SEG48 [18] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby=_inc_yby + //SEG52 [20] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby=_inc_yby iny - //SEG49 [19] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ] -- yby_lt_coby1_then_la1 + //SEG53 [21] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ] -- yby_lt_coby1_then_la1 cpy #$10 bcc b2 - //SEG50 plot::@3 - //SEG51 [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG54 plot::@3 + //SEG55 [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda line clc adc #$28 @@ -6253,108 +6322,108 @@ plot: { bcc !+ inc line+$1 !: - //SEG52 [21] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 + //SEG56 [23] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1=_dec_zpby1 dec y - //SEG53 [22] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 + //SEG57 [24] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ] -- zpby1_neq_0_then_la1 lda y bne b1 - //SEG54 plot::@return - //SEG55 [23] return [ ] + //SEG58 plot::@return + //SEG59 [25] return [ ] rts } -//SEG56 flip +//SEG60 flip flip: { .label c = 5 .label r = 4 - //SEG57 [24] phi from flip to flip::@1 - //SEG58 [24] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 + //SEG61 [27] phi from flip to flip::@1 + //SEG62 [27] phi (byte) flip::r#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta r - //SEG59 [24] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 + //SEG63 [27] phi (byte) flip::dstIdx#5 = (byte) 15 -- yby=coby1 ldy #$f - //SEG60 [24] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 + //SEG64 [27] phi (byte) flip::srcIdx#3 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG61 [24] phi from flip::@4 to flip::@1 - //SEG62 [24] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy - //SEG63 [24] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy - //SEG64 [24] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy - //SEG65 flip::@1 + //SEG65 [27] phi from flip::@4 to flip::@1 + //SEG66 [27] phi (byte) flip::r#2 = (byte) flip::r#1 -- register_copy + //SEG67 [27] phi (byte) flip::dstIdx#5 = (byte) flip::dstIdx#2 -- register_copy + //SEG68 [27] phi (byte) flip::srcIdx#3 = (byte) flip::srcIdx#1 -- register_copy + //SEG69 flip::@1 b1: - //SEG66 [25] phi from flip::@1 to flip::@2 - //SEG67 [25] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 + //SEG70 [28] phi from flip::@1 to flip::@2 + //SEG71 [28] phi (byte) flip::c#2 = (byte) 16 -- zpby1=coby1 lda #$10 sta c - //SEG68 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy - //SEG69 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy - //SEG70 [25] phi from flip::@2 to flip::@2 - //SEG71 [25] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy - //SEG72 [25] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy - //SEG73 [25] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy - //SEG74 flip::@2 + //SEG72 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#5 -- register_copy + //SEG73 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#3 -- register_copy + //SEG74 [28] phi from flip::@2 to flip::@2 + //SEG75 [28] phi (byte) flip::c#2 = (byte) flip::c#1 -- register_copy + //SEG76 [28] phi (byte) flip::dstIdx#3 = (byte) flip::dstIdx#1 -- register_copy + //SEG77 [28] phi (byte) flip::srcIdx#2 = (byte) flip::srcIdx#1 -- register_copy + //SEG78 flip::@2 b2: - //SEG75 [26] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::srcIdx#2 flip::dstIdx#3 flip::$0 flip::c#2 flip::r#2 ] -- aby=cowo1_staridx_xby + //SEG79 [29] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::$0 ] -- aby=cowo1_staridx_xby lda $1000,x - //SEG76 [27] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- cowo1_staridx_yby=aby + //SEG80 [30] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ] -- cowo1_staridx_yby=aby sta $1100,y - //SEG77 [28] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::srcIdx#1 flip::dstIdx#3 flip::c#2 flip::r#2 ] -- xby=_inc_xby + //SEG81 [31] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ] -- xby=_inc_xby inx - //SEG78 [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] -- yby=yby_plus_coby1 + //SEG82 [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] -- yby=yby_plus_coby1 tya clc adc #$10 tay - //SEG79 [30] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1=_dec_zpby1 + //SEG83 [33] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1=_dec_zpby1 dec c - //SEG80 [31] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ] -- zpby1_neq_0_then_la1 + //SEG84 [34] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ] -- zpby1_neq_0_then_la1 lda c bne b2 - //SEG81 flip::@4 - //SEG82 [32] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#2 ] -- yby=_dec_yby + //SEG85 flip::@4 + //SEG86 [35] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ] -- yby=_dec_yby dey - //SEG83 [33] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 + //SEG87 [36] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1=_dec_zpby1 dec r - //SEG84 [34] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 + //SEG88 [37] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ] -- zpby1_neq_0_then_la1 lda r bne b1 - //SEG85 [35] phi from flip::@4 to flip::@3 - //SEG86 [35] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 + //SEG89 [38] phi from flip::@4 to flip::@3 + //SEG90 [38] phi (byte) flip::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG87 [35] phi from flip::@3 to flip::@3 - //SEG88 [35] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy - //SEG89 flip::@3 + //SEG91 [38] phi from flip::@3 to flip::@3 + //SEG92 [38] phi (byte) flip::i#2 = (byte) flip::i#1 -- register_copy + //SEG93 flip::@3 b3: - //SEG90 [36] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby + //SEG94 [39] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ] -- aby=cowo1_staridx_xby lda $1100,x - //SEG91 [37] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby + //SEG95 [40] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ] -- cowo1_staridx_xby=aby sta $1000,x - //SEG92 [38] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby + //SEG96 [41] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ] -- xby=_inc_xby inx - //SEG93 [39] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 + //SEG97 [42] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b3 - //SEG94 flip::@return - //SEG95 [40] return [ ] + //SEG98 flip::@return + //SEG99 [43] return [ ] rts } -//SEG96 prepare +//SEG100 prepare prepare: { - //SEG97 [41] phi from prepare to prepare::@1 - //SEG98 [41] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 + //SEG101 [45] phi from prepare to prepare::@1 + //SEG102 [45] phi (byte) prepare::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG99 [41] phi from prepare::@1 to prepare::@1 - //SEG100 [41] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy - //SEG101 prepare::@1 + //SEG103 [45] phi from prepare::@1 to prepare::@1 + //SEG104 [45] phi (byte) prepare::i#2 = (byte) prepare::i#1 -- register_copy + //SEG105 prepare::@1 b1: - //SEG102 [42] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby + //SEG106 [46] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ] -- cowo1_staridx_xby=xby txa sta $1000,x - //SEG103 [43] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby + //SEG107 [47] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ] -- xby=_inc_xby inx - //SEG104 [44] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 + //SEG108 [48] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b1 - //SEG105 prepare::@return - //SEG106 [45] return [ ] + //SEG109 prepare::@return + //SEG110 [49] return [ ] rts } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/forclassicmin.cfg b/src/main/java/dk/camelot64/kickc/test/ref/forclassicmin.cfg index 6f85559d9..95b5ef1e4 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/forclassicmin.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/forclassicmin.cfg @@ -5,13 +5,14 @@ to:@end @end: scope:[] from @1 main: scope:[main] from @1 + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@1 - [1] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ] - [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] - [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] + [2] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ] + [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] + [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@1 - [5] return [ ] + [6] return [ ] to:@return diff --git a/src/main/java/dk/camelot64/kickc/test/ref/forclassicmin.log b/src/main/java/dk/camelot64/kickc/test/ref/forclassicmin.log index 2ae1dff79..e69b3f788 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/forclassicmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/forclassicmin.log @@ -386,8 +386,13 @@ main::@3: scope:[main] from main::@1 (byte~) main::i#3 ← (byte) main::i#1 to:main::@1 +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to 0:main + Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from to:@1 @1: scope:[] from @begin @@ -395,25 +400,28 @@ CONTROL FLOW GRAPH - LIVE RANGES to:@end @end: scope:[] from @1 main: scope:[main] from @1 + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@3 - [1] (byte) main::i#2 ← phi( main/(byte) 0 main::@3/(byte~) main::i#3 ) [ main::i#2 ] - [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] - [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [4] if((byte) main::i#1!=(byte) 100) goto main::@3 [ main::i#1 ] + [2] (byte) main::i#2 ← phi( main/(byte) 0 main::@3/(byte~) main::i#3 ) [ main::i#2 ] + [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] + [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [5] if((byte) main::i#1!=(byte) 100) goto main::@3 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@1 - [5] return [ ] + [6] return [ ] to:@return main::@3: scope:[main] from main::@1 - [6] (byte~) main::i#3 ← (byte) main::i#1 [ main::i#3 ] + [7] (byte~) main::i#3 ← (byte) main::i#1 [ main::i#3 ] to:main::@1 Created 1 initial phi equivalence classes -Coalesced [6] main::i#3 ← main::i#1 +Coalesced [7] main::i#3 ← main::i#1 Coalesced down to 1 phi equivalence classes Culled Empty Block (label) main::@3 Block Sequence Planned @begin @1 @end main main::@1 main::@return +Adding NOP phi() at start of main +Propagating live ranges... Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @begin: scope:[] from @@ -423,20 +431,18 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @1 main: scope:[main] from @1 + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@1 - [1] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ] - [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] - [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] + [2] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ] + [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] + [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@1 - [5] return [ ] + [6] return [ ] to:@return -CALL GRAPH -Calls in [] to 0:main - DOMINATORS @begin dominated by @begin @1 dominated by @1 @begin @@ -477,39 +483,41 @@ bbegin: //SEG2 @1 b1: //SEG3 [0] call main param-assignment [ ] +//SEG4 [1] phi from @1 to main +main_from_b1: jsr main jmp bend -//SEG4 @end +//SEG5 @end bend: -//SEG5 main +//SEG6 main main: { .label i = 2 - //SEG6 [1] phi from main to main::@1 + //SEG7 [2] phi from main to main::@1 b1_from_main: - //SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta i jmp b1 - //SEG8 [1] phi from main::@1 to main::@1 + //SEG9 [2] phi from main::@1 to main::@1 b1_from_b1: - //SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 - //SEG10 main::@1 + //SEG11 main::@1 b1: - //SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby1 + //SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby1 ldx i txa sta $400,x - //SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1 + //SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1 inc i - //SEG13 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- zpby1_neq_coby1_then_la1 + //SEG14 [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- zpby1_neq_coby1_then_la1 lda i cmp #$64 bne b1_from_b1 jmp breturn - //SEG14 main::@return + //SEG15 main::@return breturn: - //SEG15 [5] return [ ] + //SEG16 [6] return [ ] rts } @@ -534,37 +542,40 @@ bbegin: //SEG2 @1 b1: //SEG3 [0] call main param-assignment [ ] +//SEG4 [1] phi from @1 to main +main_from_b1: jsr main -//SEG4 @end +//SEG5 @end bend: -//SEG5 main +//SEG6 main main: { - //SEG6 [1] phi from main to main::@1 + //SEG7 [2] phi from main to main::@1 b1_from_main: - //SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG8 [1] phi from main::@1 to main::@1 + //SEG9 [2] phi from main::@1 to main::@1 b1_from_b1: - //SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG10 main::@1 + //SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG11 main::@1 b1: - //SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby + //SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby txa sta $400,x - //SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG13 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 + //SEG14 [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 cpx #$64 bne b1_from_b1 - //SEG14 main::@return + //SEG15 main::@return breturn: - //SEG15 [5] return [ ] + //SEG16 [6] return [ ] rts } Replacing label b1_from_b1 with b1 Removing instruction bbegin: +Removing instruction main_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination ASSEMBLER @@ -573,31 +584,32 @@ ASSEMBLER //SEG2 @1 b1: //SEG3 [0] call main param-assignment [ ] +//SEG4 [1] phi from @1 to main jsr main -//SEG4 @end +//SEG5 @end bend: -//SEG5 main +//SEG6 main main: { - //SEG6 [1] phi from main to main::@1 + //SEG7 [2] phi from main to main::@1 b1_from_main: - //SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG8 [1] phi from main::@1 to main::@1 - //SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG10 main::@1 + //SEG9 [2] phi from main::@1 to main::@1 + //SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG11 main::@1 b1: - //SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby + //SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby txa sta $400,x - //SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG13 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 + //SEG14 [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 cpx #$64 bne b1 - //SEG14 main::@return + //SEG15 main::@return breturn: - //SEG15 [5] return [ ] + //SEG16 [6] return [ ] rts } @@ -611,28 +623,29 @@ ASSEMBLER //SEG1 @begin //SEG2 @1 //SEG3 [0] call main param-assignment [ ] +//SEG4 [1] phi from @1 to main jsr main -//SEG4 @end -//SEG5 main +//SEG5 @end +//SEG6 main main: { - //SEG6 [1] phi from main to main::@1 - //SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG7 [2] phi from main to main::@1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG8 [1] phi from main::@1 to main::@1 - //SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG10 main::@1 + //SEG9 [2] phi from main::@1 to main::@1 + //SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG11 main::@1 b1: - //SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby + //SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby txa sta $400,x - //SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG13 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 + //SEG14 [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 cpx #$64 bne b1 - //SEG14 main::@return - //SEG15 [5] return [ ] + //SEG15 main::@return + //SEG16 [6] return [ ] rts } @@ -643,27 +656,28 @@ ASSEMBLER //SEG1 @begin //SEG2 @1 //SEG3 [0] call main param-assignment [ ] +//SEG4 [1] phi from @1 to main jsr main -//SEG4 @end -//SEG5 main +//SEG5 @end +//SEG6 main main: { - //SEG6 [1] phi from main to main::@1 - //SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG7 [2] phi from main to main::@1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG8 [1] phi from main::@1 to main::@1 - //SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG10 main::@1 + //SEG9 [2] phi from main::@1 to main::@1 + //SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG11 main::@1 b1: - //SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby + //SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby txa sta $400,x - //SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG13 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 + //SEG14 [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 cpx #$64 bne b1 - //SEG14 main::@return - //SEG15 [5] return [ ] + //SEG15 main::@return + //SEG16 [6] return [ ] rts } @@ -686,27 +700,28 @@ FINAL CODE //SEG1 @begin //SEG2 @1 //SEG3 [0] call main param-assignment [ ] +//SEG4 [1] phi from @1 to main jsr main -//SEG4 @end -//SEG5 main +//SEG5 @end +//SEG6 main main: { - //SEG6 [1] phi from main to main::@1 - //SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG7 [2] phi from main to main::@1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG8 [1] phi from main::@1 to main::@1 - //SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG10 main::@1 + //SEG9 [2] phi from main::@1 to main::@1 + //SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG11 main::@1 b1: - //SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby + //SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby txa sta $400,x - //SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG13 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 + //SEG14 [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1 cpx #$64 bne b1 - //SEG14 main::@return - //SEG15 [5] return [ ] + //SEG15 main::@return + //SEG16 [6] return [ ] rts } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/forrangemin.cfg b/src/main/java/dk/camelot64/kickc/test/ref/forrangemin.cfg index 48b985f6f..1176cd475 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/forrangemin.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/forrangemin.cfg @@ -5,19 +5,20 @@ to:@end @end: scope:[] from @1 main: scope:[main] from @1 + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@1 - [1] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ] - [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] - [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] + [2] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ] + [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] + [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] to:main::@2 main::@2: scope:[main] from main::@1 main::@2 - [5] (byte) main::j#2 ← phi( main::@2/(byte) main::j#1 main::@1/(byte) 100 ) [ main::j#2 ] - [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] - [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] - [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] + [6] (byte) main::j#2 ← phi( main::@2/(byte) main::j#1 main::@1/(byte) 100 ) [ main::j#2 ] + [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] + [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] + [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] to:main::@return main::@return: scope:[main] from main::@2 - [9] return [ ] + [10] return [ ] to:@return diff --git a/src/main/java/dk/camelot64/kickc/test/ref/forrangemin.log b/src/main/java/dk/camelot64/kickc/test/ref/forrangemin.log index 12e412a46..0b69cc6bd 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/forrangemin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/forrangemin.log @@ -642,8 +642,13 @@ main::@5: scope:[main] from main::@1 (byte~) main::i#3 ← (byte) main::i#1 to:main::@1 +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to 0:main + Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from to:@1 @1: scope:[] from @begin @@ -651,36 +656,39 @@ CONTROL FLOW GRAPH - LIVE RANGES to:@end @end: scope:[] from @1 main: scope:[main] from @1 + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@5 - [1] (byte) main::i#2 ← phi( main/(byte) 0 main::@5/(byte~) main::i#3 ) [ main::i#2 ] - [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] - [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [4] if((byte) main::i#1!=(byte) 0) goto main::@5 [ main::i#1 ] + [2] (byte) main::i#2 ← phi( main/(byte) 0 main::@5/(byte~) main::i#3 ) [ main::i#2 ] + [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] + [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [5] if((byte) main::i#1!=(byte) 0) goto main::@5 [ main::i#1 ] to:main::@2 main::@2: scope:[main] from main::@1 main::@6 - [5] (byte) main::j#2 ← phi( main::@6/(byte~) main::j#3 main::@1/(byte) 100 ) [ main::j#2 ] - [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] - [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] - [8] if((byte) main::j#1!=(byte) 255) goto main::@6 [ main::j#1 ] + [6] (byte) main::j#2 ← phi( main::@6/(byte~) main::j#3 main::@1/(byte) 100 ) [ main::j#2 ] + [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] + [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] + [9] if((byte) main::j#1!=(byte) 255) goto main::@6 [ main::j#1 ] to:main::@return main::@return: scope:[main] from main::@2 - [9] return [ ] + [10] return [ ] to:@return main::@6: scope:[main] from main::@2 - [10] (byte~) main::j#3 ← (byte) main::j#1 [ main::j#3 ] + [11] (byte~) main::j#3 ← (byte) main::j#1 [ main::j#3 ] to:main::@2 main::@5: scope:[main] from main::@1 - [11] (byte~) main::i#3 ← (byte) main::i#1 [ main::i#3 ] + [12] (byte~) main::i#3 ← (byte) main::i#1 [ main::i#3 ] to:main::@1 Created 2 initial phi equivalence classes -Coalesced [10] main::j#3 ← main::j#1 -Coalesced [11] main::i#3 ← main::i#1 +Coalesced [11] main::j#3 ← main::j#1 +Coalesced [12] main::i#3 ← main::i#1 Coalesced down to 2 phi equivalence classes Culled Empty Block (label) main::@6 Culled Empty Block (label) main::@5 Block Sequence Planned @begin @1 @end main main::@1 main::@2 main::@return +Adding NOP phi() at start of main +Propagating live ranges... Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @begin: scope:[] from @@ -690,26 +698,24 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @1 main: scope:[main] from @1 + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@1 - [1] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ] - [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] - [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] + [2] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ] + [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] + [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] to:main::@2 main::@2: scope:[main] from main::@1 main::@2 - [5] (byte) main::j#2 ← phi( main::@2/(byte) main::j#1 main::@1/(byte) 100 ) [ main::j#2 ] - [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] - [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] - [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] + [6] (byte) main::j#2 ← phi( main::@2/(byte) main::j#1 main::@1/(byte) 100 ) [ main::j#2 ] + [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] + [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] + [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] to:main::@return main::@return: scope:[main] from main::@2 - [9] return [ ] + [10] return [ ] to:@return -CALL GRAPH -Calls in [] to 0:main - DOMINATORS @begin dominated by @begin @1 dominated by @1 @begin @@ -763,61 +769,63 @@ bbegin: //SEG2 @1 b1: //SEG3 [0] call main param-assignment [ ] +//SEG4 [1] phi from @1 to main +main_from_b1: jsr main jmp bend -//SEG4 @end +//SEG5 @end bend: -//SEG5 main +//SEG6 main main: { .label i = 2 .label j = 3 - //SEG6 [1] phi from main to main::@1 + //SEG7 [2] phi from main to main::@1 b1_from_main: - //SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta i jmp b1 - //SEG8 [1] phi from main::@1 to main::@1 + //SEG9 [2] phi from main::@1 to main::@1 b1_from_b1: - //SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 - //SEG10 main::@1 + //SEG11 main::@1 b1: - //SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby1 + //SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby1 ldx i txa sta $400,x - //SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1 + //SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1 inc i - //SEG13 [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_neq_0_then_la1 + //SEG14 [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_neq_0_then_la1 lda i bne b1_from_b1 - //SEG14 [5] phi from main::@1 to main::@2 + //SEG15 [6] phi from main::@1 to main::@2 b2_from_b1: - //SEG15 [5] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 + //SEG16 [6] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta j jmp b2 - //SEG16 [5] phi from main::@2 to main::@2 + //SEG17 [6] phi from main::@2 to main::@2 b2_from_b2: - //SEG17 [5] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy + //SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy jmp b2 - //SEG18 main::@2 + //SEG19 main::@2 b2: - //SEG19 [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_zpby1=zpby1 + //SEG20 [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_zpby1=zpby1 ldx j txa sta $500,x - //SEG20 [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- zpby1=_dec_zpby1 + //SEG21 [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- zpby1=_dec_zpby1 dec j - //SEG21 [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- zpby1_neq_coby1_then_la1 + //SEG22 [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- zpby1_neq_coby1_then_la1 lda j cmp #$ff bne b2_from_b2 jmp breturn - //SEG22 main::@return + //SEG23 main::@return breturn: - //SEG23 [9] return [ ] + //SEG24 [10] return [ ] rts } @@ -844,56 +852,59 @@ bbegin: //SEG2 @1 b1: //SEG3 [0] call main param-assignment [ ] +//SEG4 [1] phi from @1 to main +main_from_b1: jsr main -//SEG4 @end +//SEG5 @end bend: -//SEG5 main +//SEG6 main main: { - //SEG6 [1] phi from main to main::@1 + //SEG7 [2] phi from main to main::@1 b1_from_main: - //SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG8 [1] phi from main::@1 to main::@1 + //SEG9 [2] phi from main::@1 to main::@1 b1_from_b1: - //SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG10 main::@1 + //SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG11 main::@1 b1: - //SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby + //SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby txa sta $400,x - //SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG13 [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1 + //SEG14 [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b1_from_b1 - //SEG14 [5] phi from main::@1 to main::@2 + //SEG15 [6] phi from main::@1 to main::@2 b2_from_b1: - //SEG15 [5] phi (byte) main::j#2 = (byte) 100 -- xby=coby1 + //SEG16 [6] phi (byte) main::j#2 = (byte) 100 -- xby=coby1 ldx #$64 jmp b2 - //SEG16 [5] phi from main::@2 to main::@2 + //SEG17 [6] phi from main::@2 to main::@2 b2_from_b2: - //SEG17 [5] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy - //SEG18 main::@2 + //SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy + //SEG19 main::@2 b2: - //SEG19 [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby + //SEG20 [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby txa sta $500,x - //SEG20 [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby + //SEG21 [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby dex - //SEG21 [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1 + //SEG22 [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1 cpx #$ff bne b2_from_b2 - //SEG22 main::@return + //SEG23 main::@return breturn: - //SEG23 [9] return [ ] + //SEG24 [10] return [ ] rts } Replacing label b1_from_b1 with b1 Replacing label b2_from_b2 with b2 Removing instruction bbegin: +Removing instruction main_from_b1: Removing instruction b1_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination @@ -903,48 +914,49 @@ ASSEMBLER //SEG2 @1 b1: //SEG3 [0] call main param-assignment [ ] +//SEG4 [1] phi from @1 to main jsr main -//SEG4 @end +//SEG5 @end bend: -//SEG5 main +//SEG6 main main: { - //SEG6 [1] phi from main to main::@1 + //SEG7 [2] phi from main to main::@1 b1_from_main: - //SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG8 [1] phi from main::@1 to main::@1 - //SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG10 main::@1 + //SEG9 [2] phi from main::@1 to main::@1 + //SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG11 main::@1 b1: - //SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby + //SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby txa sta $400,x - //SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG13 [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1 + //SEG14 [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b1 - //SEG14 [5] phi from main::@1 to main::@2 + //SEG15 [6] phi from main::@1 to main::@2 b2_from_b1: - //SEG15 [5] phi (byte) main::j#2 = (byte) 100 -- xby=coby1 + //SEG16 [6] phi (byte) main::j#2 = (byte) 100 -- xby=coby1 ldx #$64 jmp b2 - //SEG16 [5] phi from main::@2 to main::@2 - //SEG17 [5] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy - //SEG18 main::@2 + //SEG17 [6] phi from main::@2 to main::@2 + //SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy + //SEG19 main::@2 b2: - //SEG19 [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby + //SEG20 [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby txa sta $500,x - //SEG20 [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby + //SEG21 [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby dex - //SEG21 [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1 + //SEG22 [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1 cpx #$ff bne b2 - //SEG22 main::@return + //SEG23 main::@return breturn: - //SEG23 [9] return [ ] + //SEG24 [10] return [ ] rts } @@ -959,44 +971,45 @@ ASSEMBLER //SEG1 @begin //SEG2 @1 //SEG3 [0] call main param-assignment [ ] +//SEG4 [1] phi from @1 to main jsr main -//SEG4 @end -//SEG5 main +//SEG5 @end +//SEG6 main main: { - //SEG6 [1] phi from main to main::@1 - //SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG7 [2] phi from main to main::@1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG8 [1] phi from main::@1 to main::@1 - //SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG10 main::@1 + //SEG9 [2] phi from main::@1 to main::@1 + //SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG11 main::@1 b1: - //SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby + //SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby txa sta $400,x - //SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG13 [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1 + //SEG14 [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b1 - //SEG14 [5] phi from main::@1 to main::@2 - //SEG15 [5] phi (byte) main::j#2 = (byte) 100 -- xby=coby1 + //SEG15 [6] phi from main::@1 to main::@2 + //SEG16 [6] phi (byte) main::j#2 = (byte) 100 -- xby=coby1 ldx #$64 jmp b2 - //SEG16 [5] phi from main::@2 to main::@2 - //SEG17 [5] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy - //SEG18 main::@2 + //SEG17 [6] phi from main::@2 to main::@2 + //SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy + //SEG19 main::@2 b2: - //SEG19 [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby + //SEG20 [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby txa sta $500,x - //SEG20 [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby + //SEG21 [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby dex - //SEG21 [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1 + //SEG22 [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1 cpx #$ff bne b2 - //SEG22 main::@return - //SEG23 [9] return [ ] + //SEG23 main::@return + //SEG24 [10] return [ ] rts } @@ -1008,42 +1021,43 @@ ASSEMBLER //SEG1 @begin //SEG2 @1 //SEG3 [0] call main param-assignment [ ] +//SEG4 [1] phi from @1 to main jsr main -//SEG4 @end -//SEG5 main +//SEG5 @end +//SEG6 main main: { - //SEG6 [1] phi from main to main::@1 - //SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG7 [2] phi from main to main::@1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG8 [1] phi from main::@1 to main::@1 - //SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG10 main::@1 + //SEG9 [2] phi from main::@1 to main::@1 + //SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG11 main::@1 b1: - //SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby + //SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby txa sta $400,x - //SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG13 [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1 + //SEG14 [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b1 - //SEG14 [5] phi from main::@1 to main::@2 - //SEG15 [5] phi (byte) main::j#2 = (byte) 100 -- xby=coby1 + //SEG15 [6] phi from main::@1 to main::@2 + //SEG16 [6] phi (byte) main::j#2 = (byte) 100 -- xby=coby1 ldx #$64 - //SEG16 [5] phi from main::@2 to main::@2 - //SEG17 [5] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy - //SEG18 main::@2 + //SEG17 [6] phi from main::@2 to main::@2 + //SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy + //SEG19 main::@2 b2: - //SEG19 [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby + //SEG20 [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby txa sta $500,x - //SEG20 [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby + //SEG21 [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby dex - //SEG21 [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1 + //SEG22 [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1 cpx #$ff bne b2 - //SEG22 main::@return - //SEG23 [9] return [ ] + //SEG23 main::@return + //SEG24 [10] return [ ] rts } @@ -1072,42 +1086,43 @@ FINAL CODE //SEG1 @begin //SEG2 @1 //SEG3 [0] call main param-assignment [ ] +//SEG4 [1] phi from @1 to main jsr main -//SEG4 @end -//SEG5 main +//SEG5 @end +//SEG6 main main: { - //SEG6 [1] phi from main to main::@1 - //SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG7 [2] phi from main to main::@1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG8 [1] phi from main::@1 to main::@1 - //SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG10 main::@1 + //SEG9 [2] phi from main::@1 to main::@1 + //SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG11 main::@1 b1: - //SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby + //SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby txa sta $400,x - //SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG13 [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1 + //SEG14 [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1 cpx #$0 bne b1 - //SEG14 [5] phi from main::@1 to main::@2 - //SEG15 [5] phi (byte) main::j#2 = (byte) 100 -- xby=coby1 + //SEG15 [6] phi from main::@1 to main::@2 + //SEG16 [6] phi (byte) main::j#2 = (byte) 100 -- xby=coby1 ldx #$64 - //SEG16 [5] phi from main::@2 to main::@2 - //SEG17 [5] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy - //SEG18 main::@2 + //SEG17 [6] phi from main::@2 to main::@2 + //SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy + //SEG19 main::@2 b2: - //SEG19 [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby + //SEG20 [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby txa sta $500,x - //SEG20 [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby + //SEG21 [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby dex - //SEG21 [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1 + //SEG22 [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1 cpx #$ff bne b2 - //SEG22 main::@return - //SEG23 [9] return [ ] + //SEG23 main::@return + //SEG24 [10] return [ ] rts } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ifmin.cfg b/src/main/java/dk/camelot64/kickc/test/ref/ifmin.cfg index c80e2b577..29c86213f 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ifmin.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/ifmin.cfg @@ -3,18 +3,19 @@ to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@2 - [1] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 ) [ main::i#2 ] - [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] + [2] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 ) [ main::i#2 ] + [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] to:main::@3 main::@3: scope:[main] from main::@1 - [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] + [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] to:main::@2 main::@2: scope:[main] from main::@1 main::@3 - [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] + [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@2 - [6] return [ ] + [7] return [ ] to:@return diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ifmin.log b/src/main/java/dk/camelot64/kickc/test/ref/ifmin.log index 2b1721667..fd2e11f7f 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ifmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ifmin.log @@ -507,37 +507,45 @@ main::@5: scope:[main] from main::@2 (byte~) main::i#5 ← (byte) main::i#1 to:main::@1 +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to 0:main + Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@5 - [1] (byte) main::i#2 ← phi( main/(byte) 0 main::@5/(byte~) main::i#5 ) [ main::i#2 ] - [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] + [2] (byte) main::i#2 ← phi( main/(byte) 0 main::@5/(byte~) main::i#5 ) [ main::i#2 ] + [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] to:main::@3 main::@3: scope:[main] from main::@1 - [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] + [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] to:main::@2 main::@2: scope:[main] from main::@1 main::@3 - [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [5] if((byte) main::i#1<(byte) 100) goto main::@5 [ main::i#1 ] + [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [6] if((byte) main::i#1<(byte) 100) goto main::@5 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@2 - [6] return [ ] + [7] return [ ] to:@return main::@5: scope:[main] from main::@2 - [7] (byte~) main::i#5 ← (byte) main::i#1 [ main::i#5 ] + [8] (byte~) main::i#5 ← (byte) main::i#1 [ main::i#5 ] to:main::@1 Created 1 initial phi equivalence classes -Coalesced [7] main::i#5 ← main::i#1 +Coalesced [8] main::i#5 ← main::i#1 Coalesced down to 1 phi equivalence classes Culled Empty Block (label) main::@5 Block Sequence Planned @begin @end main main::@1 main::@3 main::@2 main::@return +Adding NOP phi() at start of main +Propagating live ranges... Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @begin: scope:[] from @@ -545,25 +553,23 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@2 - [1] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 ) [ main::i#2 ] - [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] + [2] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 ) [ main::i#2 ] + [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] to:main::@3 main::@3: scope:[main] from main::@1 - [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] + [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] to:main::@2 main::@2: scope:[main] from main::@1 main::@3 - [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] + [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@2 - [6] return [ ] + [7] return [ ] to:@return -CALL GRAPH -Calls in [] to 0:main - DOMINATORS @begin dominated by @begin @end dominated by @end @begin @@ -602,48 +608,50 @@ INITIAL ASM //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main jmp bend -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { .label i = 2 - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta i jmp b1 - //SEG7 [1] phi from main::@2 to main::@1 + //SEG8 [2] phi from main::@2 to main::@1 b1_from_b2: - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 - //SEG9 main::@1 + //SEG10 main::@1 b1: - //SEG10 [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- zpby1_ge_coby1_then_la1 + //SEG11 [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- zpby1_ge_coby1_then_la1 lda i cmp #$32 bcs b2 jmp b3 - //SEG11 main::@3 + //SEG12 main::@3 b3: - //SEG12 [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=zpby1 + //SEG13 [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=zpby1 lda i sta $400 jmp b2 - //SEG13 main::@2 + //SEG14 main::@2 b2: - //SEG14 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1 + //SEG15 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1 inc i - //SEG15 [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- zpby1_lt_coby1_then_la1 + //SEG16 [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- zpby1_lt_coby1_then_la1 lda i cmp #$64 bcc b1_from_b2 jmp breturn - //SEG16 main::@return + //SEG17 main::@return breturn: - //SEG17 [6] return [ ] + //SEG18 [7] return [ ] rts } @@ -667,42 +675,45 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG7 [1] phi from main::@2 to main::@1 + //SEG8 [2] phi from main::@2 to main::@1 b1_from_b2: - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1 + //SEG11 [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1 cpx #$32 bcs b2 - //SEG11 main::@3 + //SEG12 main::@3 b3: - //SEG12 [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby + //SEG13 [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby stx $400 - //SEG13 main::@2 + //SEG14 main::@2 b2: - //SEG14 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG15 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG15 [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1 + //SEG16 [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1 cpx #$64 bcc b1_from_b2 - //SEG16 main::@return + //SEG17 main::@return breturn: - //SEG17 [6] return [ ] + //SEG18 [7] return [ ] rts } Replacing label b1_from_b2 with b1 +Removing instruction main_from_bbegin: Removing instruction b1_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination ASSEMBLER @@ -710,37 +721,38 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG7 [1] phi from main::@2 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@2 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1 + //SEG11 [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1 cpx #$32 bcs b2 - //SEG11 main::@3 + //SEG12 main::@3 b3: - //SEG12 [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby + //SEG13 [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby stx $400 - //SEG13 main::@2 + //SEG14 main::@2 b2: - //SEG14 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG15 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG15 [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1 + //SEG16 [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1 cpx #$64 bcc b1 - //SEG16 main::@return + //SEG17 main::@return breturn: - //SEG17 [6] return [ ] + //SEG18 [7] return [ ] rts } @@ -754,33 +766,34 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 jmp b1 - //SEG7 [1] phi from main::@2 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@2 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1 + //SEG11 [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1 cpx #$32 bcs b2 - //SEG11 main::@3 - //SEG12 [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby + //SEG12 main::@3 + //SEG13 [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby stx $400 - //SEG13 main::@2 + //SEG14 main::@2 b2: - //SEG14 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG15 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG15 [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1 + //SEG16 [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1 cpx #$64 bcc b1 - //SEG16 main::@return - //SEG17 [6] return [ ] + //SEG17 main::@return + //SEG18 [7] return [ ] rts } @@ -790,32 +803,33 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG7 [1] phi from main::@2 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@2 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1 + //SEG11 [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1 cpx #$32 bcs b2 - //SEG11 main::@3 - //SEG12 [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby + //SEG12 main::@3 + //SEG13 [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby stx $400 - //SEG13 main::@2 + //SEG14 main::@2 b2: - //SEG14 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG15 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG15 [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1 + //SEG16 [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1 cpx #$64 bcc b1 - //SEG16 main::@return - //SEG17 [6] return [ ] + //SEG17 main::@return + //SEG18 [7] return [ ] rts } @@ -838,32 +852,33 @@ FINAL CODE //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG7 [1] phi from main::@2 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@2 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1 + //SEG11 [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1 cpx #$32 bcs b2 - //SEG11 main::@3 - //SEG12 [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby + //SEG12 main::@3 + //SEG13 [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby stx $400 - //SEG13 main::@2 + //SEG14 main::@2 b2: - //SEG14 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG15 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG15 [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1 + //SEG16 [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1 cpx #$64 bcc b1 - //SEG16 main::@return - //SEG17 [6] return [ ] + //SEG17 main::@return + //SEG18 [7] return [ ] rts } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/liverange.asm b/src/main/java/dk/camelot64/kickc/test/ref/liverange.asm new file mode 100644 index 000000000..872c809c7 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/ref/liverange.asm @@ -0,0 +1,21 @@ + jsr main +main: { + .label a = 2 + ldx #$0 + jsr inc + clc + adc #$4 + sta a + jsr inc + clc + adc a + rts +} +inc: { + txa + clc + adc #$7 + tax + txa + rts +} diff --git a/src/main/java/dk/camelot64/kickc/test/ref/liverange.cfg b/src/main/java/dk/camelot64/kickc/test/ref/liverange.cfg new file mode 100644 index 000000000..d7bd7939b --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/ref/liverange.cfg @@ -0,0 +1,28 @@ +@begin: scope:[] from + [0] call main param-assignment [ ] + to:@end +@end: scope:[] from @begin +main: scope:[main] from @begin + [1] phi() [ ] + [2] call inc param-assignment [ inc::return#0 inc::$0 ] + to:main::@1 +main::@1: scope:[main] from main + [3] (byte~) main::$0 ← (byte) inc::return#0 [ main::$0 inc::$0 ] + [4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 inc::$0 ] + [5] call inc param-assignment [ inc::return#0 main::a#1 ] + to:main::@2 +main::@2: scope:[main] from main::@1 + [6] (byte~) main::$2 ← (byte) inc::return#0 [ main::a#1 main::$2 ] + [7] (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 [ ] + to:main::@return +main::@return: scope:[main] from main::@2 + [8] return [ ] + to:@return +inc: scope:[inc] from main main::@1 + [9] (byte) i#11 ← phi( main/(byte) 0 main::@1/(byte~) inc::$0 ) [ i#11 ] + [10] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ] + [11] (byte) inc::return#0 ← (byte~) inc::$0 [ inc::return#0 inc::$0 ] + to:inc::@return +inc::@return: scope:[inc] from inc + [12] return [ inc::return#0 inc::$0 ] + to:@return diff --git a/src/main/java/dk/camelot64/kickc/test/ref/liverange.log b/src/main/java/dk/camelot64/kickc/test/ref/liverange.log new file mode 100644 index 000000000..434595c28 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/ref/liverange.log @@ -0,0 +1,1044 @@ +byte i=0; + +main(); + +void main() { + byte a=4; + a=a+inc(); + a=a+inc(); +} + +byte inc() { + i = i+7; + return i; +} +PROGRAM + (byte) i ← (byte) 0 + (void~) $0 ← call main +proc (void()) main() + (byte) main::a ← (byte) 4 + (byte~) main::$0 ← call inc + (byte~) main::$1 ← (byte) main::a + (byte~) main::$0 + (byte) main::a ← (byte~) main::$1 + (byte~) main::$2 ← call inc + (byte~) main::$3 ← (byte) main::a + (byte~) main::$2 + (byte) main::a ← (byte~) main::$3 +main::@return: + return +endproc // main() +proc (byte()) inc() + (byte~) inc::$0 ← (byte) i + (byte) 7 + (byte) i ← (byte~) inc::$0 + (byte) inc::return ← (byte) i + goto inc::@return +inc::@return: + (byte) inc::return ← (byte) inc::return + return (byte) inc::return +endproc // inc() + +SYMBOLS +(void~) $0 +(byte) i +(byte()) inc() +(byte~) inc::$0 +(label) inc::@return +(byte) inc::return +(void()) main() +(byte~) main::$0 +(byte~) main::$1 +(byte~) main::$2 +(byte~) main::$3 +(label) main::@return +(byte) main::a + +INITIAL CONTROL FLOW GRAPH +@begin: scope:[] from + (byte) i ← (byte) 0 + (void~) $0 ← call main + to:@1 +main: scope:[main] from + (byte) main::a ← (byte) 4 + (byte~) main::$0 ← call inc + (byte~) main::$1 ← (byte) main::a + (byte~) main::$0 + (byte) main::a ← (byte~) main::$1 + (byte~) main::$2 ← call inc + (byte~) main::$3 ← (byte) main::a + (byte~) main::$2 + (byte) main::a ← (byte~) main::$3 + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@1: scope:[] from @begin + to:@2 +inc: scope:[inc] from + (byte~) inc::$0 ← (byte) i + (byte) 7 + (byte) i ← (byte~) inc::$0 + (byte) inc::return ← (byte) i + to:inc::@return +inc::@return: scope:[inc] from inc inc::@1 + (byte) inc::return ← (byte) inc::return + return (byte) inc::return + to:@return +inc::@1: scope:[inc] from + to:inc::@return +@2: scope:[] from @1 + to:@end +@end: scope:[] from @2 + +Removing empty block @1 +Removing empty block inc::@1 +Removing empty block @2 +CONTROL FLOW GRAPH +@begin: scope:[] from + (byte) i ← (byte) 0 + (void~) $0 ← call main + to:@end +main: scope:[main] from + (byte) main::a ← (byte) 4 + (byte~) main::$0 ← call inc + (byte~) main::$1 ← (byte) main::a + (byte~) main::$0 + (byte) main::a ← (byte~) main::$1 + (byte~) main::$2 ← call inc + (byte~) main::$3 ← (byte) main::a + (byte~) main::$2 + (byte) main::a ← (byte~) main::$3 + to:main::@return +main::@return: scope:[main] from main + return + to:@return +inc: scope:[inc] from + (byte~) inc::$0 ← (byte) i + (byte) 7 + (byte) i ← (byte~) inc::$0 + (byte) inc::return ← (byte) i + to:inc::@return +inc::@return: scope:[inc] from inc + (byte) inc::return ← (byte) inc::return + return (byte) inc::return + to:@return +@end: scope:[] from @begin + +PROCEDURE MODIFY VARIABLE ANALYSIS +main modifies i +inc modifies i + +CONTROL FLOW GRAPH WITH ASSIGNMENT CALL +@begin: scope:[] from + (byte) i ← (byte) 0 + call main param-assignment + to:@3 +@3: scope:[] from @begin + (byte) i ← (byte) i + to:@end +main: scope:[main] from @begin + (byte) main::a ← (byte) 4 + (byte) inc::return ← call inc param-assignment + to:main::@1 +main::@1: scope:[main] from main + (byte~) main::$0 ← (byte) inc::return + (byte) i ← (byte) i + (byte~) main::$1 ← (byte) main::a + (byte~) main::$0 + (byte) main::a ← (byte~) main::$1 + (byte) inc::return ← call inc param-assignment + to:main::@2 +main::@2: scope:[main] from main::@1 + (byte~) main::$2 ← (byte) inc::return + (byte) i ← (byte) i + (byte~) main::$3 ← (byte) main::a + (byte~) main::$2 + (byte) main::a ← (byte~) main::$3 + to:main::@return +main::@return: scope:[main] from main::@2 + (byte) i ← (byte) i + return + to:@return +inc: scope:[inc] from main main::@1 + (byte~) inc::$0 ← (byte) i + (byte) 7 + (byte) i ← (byte~) inc::$0 + (byte) inc::return ← (byte) i + to:inc::@return +inc::@return: scope:[inc] from inc + (byte) inc::return ← (byte) inc::return + (byte) i ← (byte) i + return (byte) inc::return + to:@return +@end: scope:[] from @3 + +Completing Phi functions... +Completing Phi functions... +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + (byte) i#0 ← (byte) 0 + call main param-assignment + to:@3 +@3: scope:[] from @begin + (byte) i#7 ← phi( @begin/(byte) i#0 ) + (byte) i#1 ← (byte) i#7 + to:@end +main: scope:[main] from @begin + (byte) i#13 ← phi( @begin/(byte) i#0 ) + (byte) main::a#0 ← (byte) 4 + (byte) inc::return#0 ← call inc param-assignment + to:main::@1 +main::@1: scope:[main] from main + (byte) main::a#3 ← phi( main/(byte) main::a#0 ) + (byte) i#8 ← phi( main/(byte) i#13 ) + (byte) inc::return#4 ← phi( main/(byte) inc::return#0 ) + (byte~) main::$0 ← (byte) inc::return#4 + (byte) i#2 ← (byte) i#8 + (byte~) main::$1 ← (byte) main::a#3 + (byte~) main::$0 + (byte) main::a#1 ← (byte~) main::$1 + (byte) inc::return#1 ← call inc param-assignment + to:main::@2 +main::@2: scope:[main] from main::@1 + (byte) main::a#4 ← phi( main::@1/(byte) main::a#1 ) + (byte) i#9 ← phi( main::@1/(byte) i#2 ) + (byte) inc::return#5 ← phi( main::@1/(byte) inc::return#1 ) + (byte~) main::$2 ← (byte) inc::return#5 + (byte) i#3 ← (byte) i#9 + (byte~) main::$3 ← (byte) main::a#4 + (byte~) main::$2 + (byte) main::a#2 ← (byte~) main::$3 + to:main::@return +main::@return: scope:[main] from main::@2 + (byte) i#10 ← phi( main::@2/(byte) i#3 ) + (byte) i#4 ← (byte) i#10 + return + to:@return +inc: scope:[inc] from main main::@1 + (byte) i#11 ← phi( main/(byte) i#13 main::@1/(byte) i#2 ) + (byte~) inc::$0 ← (byte) i#11 + (byte) 7 + (byte) i#5 ← (byte~) inc::$0 + (byte) inc::return#2 ← (byte) i#5 + to:inc::@return +inc::@return: scope:[inc] from inc + (byte) i#12 ← phi( inc/(byte) i#5 ) + (byte) inc::return#6 ← phi( inc/(byte) inc::return#2 ) + (byte) inc::return#3 ← (byte) inc::return#6 + (byte) i#6 ← (byte) i#12 + return (byte) inc::return#3 + to:@return +@end: scope:[] from @3 + +CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN +@begin: scope:[] from + (byte) i#0 ← (byte) 0 + call main param-assignment + to:@3 +@3: scope:[] from @begin + (byte) i#7 ← phi( @begin/(byte) i#4 ) + (byte) i#1 ← (byte) i#7 + to:@end +main: scope:[main] from @begin + (byte) i#13 ← phi( @begin/(byte) i#0 ) + (byte) main::a#0 ← (byte) 4 + call inc param-assignment + (byte) inc::return#0 ← (byte) inc::return#3 + to:main::@1 +main::@1: scope:[main] from main + (byte) main::a#3 ← phi( main/(byte) main::a#0 ) + (byte) i#8 ← phi( main/(byte) i#6 ) + (byte) inc::return#4 ← phi( main/(byte) inc::return#0 ) + (byte~) main::$0 ← (byte) inc::return#4 + (byte) i#2 ← (byte) i#8 + (byte~) main::$1 ← (byte) main::a#3 + (byte~) main::$0 + (byte) main::a#1 ← (byte~) main::$1 + call inc param-assignment + (byte) inc::return#1 ← (byte) inc::return#3 + to:main::@2 +main::@2: scope:[main] from main::@1 + (byte) main::a#4 ← phi( main::@1/(byte) main::a#1 ) + (byte) i#9 ← phi( main::@1/(byte) i#6 ) + (byte) inc::return#5 ← phi( main::@1/(byte) inc::return#1 ) + (byte~) main::$2 ← (byte) inc::return#5 + (byte) i#3 ← (byte) i#9 + (byte~) main::$3 ← (byte) main::a#4 + (byte~) main::$2 + (byte) main::a#2 ← (byte~) main::$3 + to:main::@return +main::@return: scope:[main] from main::@2 + (byte) i#10 ← phi( main::@2/(byte) i#3 ) + (byte) i#4 ← (byte) i#10 + return + to:@return +inc: scope:[inc] from main main::@1 + (byte) i#11 ← phi( main/(byte) i#13 main::@1/(byte) i#2 ) + (byte~) inc::$0 ← (byte) i#11 + (byte) 7 + (byte) i#5 ← (byte~) inc::$0 + (byte) inc::return#2 ← (byte) i#5 + to:inc::@return +inc::@return: scope:[inc] from inc + (byte) i#12 ← phi( inc/(byte) i#5 ) + (byte) inc::return#6 ← phi( inc/(byte) inc::return#2 ) + (byte) inc::return#3 ← (byte) inc::return#6 + (byte) i#6 ← (byte) i#12 + return + to:@return +@end: scope:[] from @3 + +INITIAL SSA SYMBOL TABLE +(label) @3 +(label) @begin +(label) @end +(byte) i +(byte) i#0 +(byte) i#1 +(byte) i#10 +(byte) i#11 +(byte) i#12 +(byte) i#13 +(byte) i#2 +(byte) i#3 +(byte) i#4 +(byte) i#5 +(byte) i#6 +(byte) i#7 +(byte) i#8 +(byte) i#9 +(byte()) inc() +(byte~) inc::$0 +(label) inc::@return +(byte) inc::return +(byte) inc::return#0 +(byte) inc::return#1 +(byte) inc::return#2 +(byte) inc::return#3 +(byte) inc::return#4 +(byte) inc::return#5 +(byte) inc::return#6 +(void()) main() +(byte~) main::$0 +(byte~) main::$1 +(byte~) main::$2 +(byte~) main::$3 +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte) main::a +(byte) main::a#0 +(byte) main::a#1 +(byte) main::a#2 +(byte) main::a#3 +(byte) main::a#4 + +Constant (byte) i#0 (byte) 0 +Constant (byte) main::a#0 (byte) 4 +Succesful SSA optimization Pass2ConstantPropagation +CONTROL FLOW GRAPH +@begin: scope:[] from + call main param-assignment + to:@3 +@3: scope:[] from @begin + (byte) i#7 ← phi( @begin/(byte) i#4 ) + (byte) i#1 ← (byte) i#7 + to:@end +main: scope:[main] from @begin + (byte) i#13 ← phi( @begin/(byte) 0 ) + call inc param-assignment + (byte) inc::return#0 ← (byte) inc::return#3 + to:main::@1 +main::@1: scope:[main] from main + (byte) main::a#3 ← phi( main/(byte) 4 ) + (byte) i#8 ← phi( main/(byte) i#6 ) + (byte) inc::return#4 ← phi( main/(byte) inc::return#0 ) + (byte~) main::$0 ← (byte) inc::return#4 + (byte) i#2 ← (byte) i#8 + (byte~) main::$1 ← (byte) main::a#3 + (byte~) main::$0 + (byte) main::a#1 ← (byte~) main::$1 + call inc param-assignment + (byte) inc::return#1 ← (byte) inc::return#3 + to:main::@2 +main::@2: scope:[main] from main::@1 + (byte) main::a#4 ← phi( main::@1/(byte) main::a#1 ) + (byte) i#9 ← phi( main::@1/(byte) i#6 ) + (byte) inc::return#5 ← phi( main::@1/(byte) inc::return#1 ) + (byte~) main::$2 ← (byte) inc::return#5 + (byte) i#3 ← (byte) i#9 + (byte~) main::$3 ← (byte) main::a#4 + (byte~) main::$2 + (byte) main::a#2 ← (byte~) main::$3 + to:main::@return +main::@return: scope:[main] from main::@2 + (byte) i#10 ← phi( main::@2/(byte) i#3 ) + (byte) i#4 ← (byte) i#10 + return + to:@return +inc: scope:[inc] from main main::@1 + (byte) i#11 ← phi( main/(byte) i#13 main::@1/(byte) i#2 ) + (byte~) inc::$0 ← (byte) i#11 + (byte) 7 + (byte) i#5 ← (byte~) inc::$0 + (byte) inc::return#2 ← (byte) i#5 + to:inc::@return +inc::@return: scope:[inc] from inc + (byte) i#12 ← phi( inc/(byte) i#5 ) + (byte) inc::return#6 ← phi( inc/(byte) inc::return#2 ) + (byte) inc::return#3 ← (byte) inc::return#6 + (byte) i#6 ← (byte) i#12 + return + to:@return +@end: scope:[] from @3 + +Not aliassing across scopes: main::$0 inc::return#4 +Not aliassing across scopes: main::$2 inc::return#5 +Not aliassing across scopes: i#5 inc::$0 +Not aliassing across scopes: inc::return#2 i#5 +Alias (byte) i#1 = (byte) i#7 (byte) i#4 (byte) i#8 (byte) i#6 (byte) i#2 (byte) i#9 (byte) i#3 (byte) i#10 (byte) i#12 (byte) i#5 +Alias (byte) inc::return#0 = (byte) inc::return#3 (byte) inc::return#4 (byte) inc::return#1 (byte) inc::return#5 (byte) inc::return#6 (byte) inc::return#2 +Alias (byte) main::a#1 = (byte~) main::$1 (byte) main::a#4 +Alias (byte) main::a#2 = (byte~) main::$3 +Succesful SSA optimization Pass2AliasElimination +CONTROL FLOW GRAPH +@begin: scope:[] from + call main param-assignment + to:@3 +@3: scope:[] from @begin + to:@end +main: scope:[main] from @begin + (byte) i#13 ← phi( @begin/(byte) 0 ) + call inc param-assignment + to:main::@1 +main::@1: scope:[main] from main + (byte) main::a#3 ← phi( main/(byte) 4 ) + (byte~) main::$0 ← (byte) inc::return#0 + (byte) main::a#1 ← (byte) main::a#3 + (byte~) main::$0 + call inc param-assignment + to:main::@2 +main::@2: scope:[main] from main::@1 + (byte~) main::$2 ← (byte) inc::return#0 + (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 + to:main::@return +main::@return: scope:[main] from main::@2 + return + to:@return +inc: scope:[inc] from main main::@1 + (byte) i#11 ← phi( main/(byte) i#13 main::@1/(byte) i#1 ) + (byte~) inc::$0 ← (byte) i#11 + (byte) 7 + (byte) i#1 ← (byte~) inc::$0 + (byte) inc::return#0 ← (byte) i#1 + to:inc::@return +inc::@return: scope:[inc] from inc + return + to:@return +@end: scope:[] from @3 + +Redundant Phi (byte) i#13 (byte) 0 +Redundant Phi (byte) main::a#3 (byte) 4 +Succesful SSA optimization Pass2RedundantPhiElimination +CONTROL FLOW GRAPH +@begin: scope:[] from + call main param-assignment + to:@3 +@3: scope:[] from @begin + to:@end +main: scope:[main] from @begin + call inc param-assignment + to:main::@1 +main::@1: scope:[main] from main + (byte~) main::$0 ← (byte) inc::return#0 + (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 + call inc param-assignment + to:main::@2 +main::@2: scope:[main] from main::@1 + (byte~) main::$2 ← (byte) inc::return#0 + (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 + to:main::@return +main::@return: scope:[main] from main::@2 + return + to:@return +inc: scope:[inc] from main main::@1 + (byte) i#11 ← phi( main/(byte) 0 main::@1/(byte) i#1 ) + (byte~) inc::$0 ← (byte) i#11 + (byte) 7 + (byte) i#1 ← (byte~) inc::$0 + (byte) inc::return#0 ← (byte) i#1 + to:inc::@return +inc::@return: scope:[inc] from inc + return + to:@return +@end: scope:[] from @3 + +Culled Empty Block (label) @3 +Succesful SSA optimization Pass2CullEmptyBlocks +CONTROL FLOW GRAPH +@begin: scope:[] from + call main param-assignment + to:@end +main: scope:[main] from @begin + call inc param-assignment + to:main::@1 +main::@1: scope:[main] from main + (byte~) main::$0 ← (byte) inc::return#0 + (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 + call inc param-assignment + to:main::@2 +main::@2: scope:[main] from main::@1 + (byte~) main::$2 ← (byte) inc::return#0 + (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 + to:main::@return +main::@return: scope:[main] from main::@2 + return + to:@return +inc: scope:[inc] from main main::@1 + (byte) i#11 ← phi( main/(byte) 0 main::@1/(byte) i#1 ) + (byte~) inc::$0 ← (byte) i#11 + (byte) 7 + (byte) i#1 ← (byte~) inc::$0 + (byte) inc::return#0 ← (byte) i#1 + to:inc::@return +inc::@return: scope:[inc] from inc + return + to:@return +@end: scope:[] from @begin + +Not aliassing across scopes: main::$0 inc::return#0 +Not aliassing across scopes: main::$2 inc::return#0 +Not aliassing across scopes: i#1 inc::$0 +Not aliassing across scopes: inc::return#0 i#1 +Not aliassing across scopes: main::$0 inc::return#0 +Not aliassing across scopes: main::$2 inc::return#0 +Not aliassing across scopes: i#1 inc::$0 +Not aliassing across scopes: inc::return#0 i#1 +FINAL SYMBOL TABLE +(label) @begin +(label) @end +(byte) i +(byte) i#1 +(byte) i#11 +(byte()) inc() +(byte~) inc::$0 +(label) inc::@return +(byte) inc::return +(byte) inc::return#0 +(void()) main() +(byte~) main::$0 +(byte~) main::$2 +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte) main::a +(byte) main::a#1 +(byte) main::a#2 + +Block Sequence Planned @begin @end main main::@1 main::@2 main::@return inc inc::@return +Block Sequence Planned @begin @end main main::@1 main::@2 main::@return inc inc::@return +CONTROL FLOW GRAPH - PHI LIFTED +@begin: scope:[] from + call main param-assignment + to:@end +@end: scope:[] from @begin +main: scope:[main] from @begin + call inc param-assignment + to:main::@1 +main::@1: scope:[main] from main + (byte~) main::$0 ← (byte) inc::return#0 + (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 + (byte~) i#14 ← (byte) i#1 + call inc param-assignment + to:main::@2 +main::@2: scope:[main] from main::@1 + (byte~) main::$2 ← (byte) inc::return#0 + (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 + to:main::@return +main::@return: scope:[main] from main::@2 + return + to:@return +inc: scope:[inc] from main main::@1 + (byte) i#11 ← phi( main/(byte) 0 main::@1/(byte~) i#14 ) + (byte~) inc::$0 ← (byte) i#11 + (byte) 7 + (byte) i#1 ← (byte~) inc::$0 + (byte) inc::return#0 ← (byte) i#1 + to:inc::@return +inc::@return: scope:[inc] from inc + return + to:@return + +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to 0:main +Calls in [main] to 2:inc 6:inc + +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND +@begin: scope:[] from + [0] call main param-assignment [ ] + to:@end +@end: scope:[] from @begin +main: scope:[main] from @begin + [1] phi() [ ] + [2] call inc param-assignment [ inc::return#0 i#1 ] + to:main::@1 +main::@1: scope:[main] from main + [3] (byte~) main::$0 ← (byte) inc::return#0 [ main::$0 i#1 ] + [4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 i#1 ] + [5] (byte~) i#14 ← (byte) i#1 [ main::a#1 i#14 ] + [6] call inc param-assignment [ inc::return#0 main::a#1 ] + to:main::@2 +main::@2: scope:[main] from main::@1 + [7] (byte~) main::$2 ← (byte) inc::return#0 [ main::a#1 main::$2 ] + [8] (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 [ ] + to:main::@return +main::@return: scope:[main] from main::@2 + [9] return [ ] + to:@return +inc: scope:[inc] from main main::@1 + [10] (byte) i#11 ← phi( main/(byte) 0 main::@1/(byte~) i#14 ) [ i#11 ] + [11] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ] + [12] (byte) i#1 ← (byte~) inc::$0 [ i#1 ] + [13] (byte) inc::return#0 ← (byte) i#1 [ inc::return#0 i#1 ] + to:inc::@return +inc::@return: scope:[inc] from inc + [14] return [ inc::return#0 i#1 ] + to:@return + +Created 1 initial phi equivalence classes +Coalesced [5] i#14 ← i#1 +Coalesced [12] i#1 ← inc::$0 +Coalesced down to 1 phi equivalence classes +Block Sequence Planned @begin @end main main::@1 main::@2 main::@return inc inc::@return +Adding NOP phi() at start of main +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +CONTROL FLOW GRAPH - PHI MEM COALESCED +@begin: scope:[] from + [0] call main param-assignment [ ] + to:@end +@end: scope:[] from @begin +main: scope:[main] from @begin + [1] phi() [ ] + [2] call inc param-assignment [ inc::return#0 inc::$0 ] + to:main::@1 +main::@1: scope:[main] from main + [3] (byte~) main::$0 ← (byte) inc::return#0 [ main::$0 inc::$0 ] + [4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 inc::$0 ] + [5] call inc param-assignment [ inc::return#0 main::a#1 ] + to:main::@2 +main::@2: scope:[main] from main::@1 + [6] (byte~) main::$2 ← (byte) inc::return#0 [ main::a#1 main::$2 ] + [7] (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 [ ] + to:main::@return +main::@return: scope:[main] from main::@2 + [8] return [ ] + to:@return +inc: scope:[inc] from main main::@1 + [9] (byte) i#11 ← phi( main/(byte) 0 main::@1/(byte~) inc::$0 ) [ i#11 ] + [10] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ] + [11] (byte) inc::return#0 ← (byte~) inc::$0 [ inc::return#0 inc::$0 ] + to:inc::@return +inc::@return: scope:[inc] from inc + [12] return [ inc::return#0 inc::$0 ] + to:@return + +DOMINATORS +@begin dominated by @begin +@end dominated by @end @begin +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 main::@return @begin main::@2 main::@1 main +inc dominated by inc @begin main +inc::@return dominated by inc @begin inc::@return main + +NATURAL LOOPS + +Found 0 loops in scope [] +Found 0 loops in scope [main] +Found 0 loops in scope [inc] +NATURAL LOOPS WITH DEPTH + + +VARIABLE REGISTER WEIGHTS +(byte) i +(byte) i#11 4.0 +(byte()) inc() +(byte~) inc::$0 1.0 +(byte) inc::return +(byte) inc::return#0 1.5 +(void()) main() +(byte~) main::$0 4.0 +(byte~) main::$2 4.0 +(byte) main::a +(byte) main::a#1 1.3333333333333333 +(byte) main::a#2 20.0 + +Initial phi equivalence classes +[ i#11 inc::$0 ] +Added variable main::$0 to zero page equivalence class [ main::$0 ] +Added variable main::a#1 to zero page equivalence class [ main::a#1 ] +Added variable main::$2 to zero page equivalence class [ main::$2 ] +Added variable main::a#2 to zero page equivalence class [ main::a#2 ] +Added variable inc::return#0 to zero page equivalence class [ inc::return#0 ] +Complete equivalence classes +[ i#11 inc::$0 ] +[ main::$0 ] +[ main::a#1 ] +[ main::$2 ] +[ main::a#2 ] +[ inc::return#0 ] +Allocated zp ZP_BYTE:2 [ i#11 inc::$0 ] +Allocated zp ZP_BYTE:3 [ main::$0 ] +Allocated zp ZP_BYTE:4 [ main::a#1 ] +Allocated zp ZP_BYTE:5 [ main::$2 ] +Allocated zp ZP_BYTE:6 [ main::a#2 ] +Allocated zp ZP_BYTE:7 [ inc::return#0 ] +INITIAL ASM +//SEG0 Global ZP labels + .label i = 2 +//SEG1 @begin +bbegin: +//SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: + jsr main + jmp bend +//SEG4 @end +bend: +//SEG5 main +main: { + .label _0 = 3 + .label _2 = 5 + .label a = 4 + .label a_2 = 6 + //SEG6 [2] call inc param-assignment [ inc::return#0 inc::$0 ] + //SEG7 [9] phi from main to inc + inc_from_main: + //SEG8 [9] phi (byte) i#11 = (byte) 0 -- zpby1=coby1 + lda #$0 + sta i + jsr inc + jmp b1 + //SEG9 main::@1 + b1: + //SEG10 [3] (byte~) main::$0 ← (byte) inc::return#0 [ main::$0 inc::$0 ] -- zpby1=zpby2 + lda inc.return + sta _0 + //SEG11 [4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 inc::$0 ] -- zpby1=coby1_plus_zpby2 + lda #$4 + clc + adc _0 + sta a + //SEG12 [5] call inc param-assignment [ inc::return#0 main::a#1 ] + //SEG13 [9] phi from main::@1 to inc + inc_from_b1: + //SEG14 [9] phi (byte) i#11 = (byte~) inc::$0 -- register_copy + jsr inc + jmp b2 + //SEG15 main::@2 + b2: + //SEG16 [6] (byte~) main::$2 ← (byte) inc::return#0 [ main::a#1 main::$2 ] -- zpby1=zpby2 + lda inc.return + sta _2 + //SEG17 [7] (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 [ ] -- zpby1=zpby2_plus_zpby3 + lda a + clc + adc _2 + sta a_2 + jmp breturn + //SEG18 main::@return + breturn: + //SEG19 [8] return [ ] + rts +} +//SEG20 inc +inc: { + .label _0 = 2 + .label return = 7 + //SEG21 [10] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ] -- zpby1=zpby1_plus_coby1 + lda _0 + clc + adc #$7 + sta _0 + //SEG22 [11] (byte) inc::return#0 ← (byte~) inc::$0 [ inc::return#0 inc::$0 ] -- zpby1=zpby2 + lda _0 + sta return + jmp breturn + //SEG23 inc::@return + breturn: + //SEG24 [12] return [ inc::return#0 inc::$0 ] + rts +} + +Statement [4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 inc::$0 ] always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ i#11 inc::$0 ] +Statement [10] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ] always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ main::a#1 ] +Statement [4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 inc::$0 ] always clobbers reg byte a +Statement [10] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ] always clobbers reg byte a +REGISTER UPLIFT POTENTIAL REGISTERS +Potential registers zp ZP_BYTE:2 [ i#11 inc::$0 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:3 [ main::$0 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:4 [ main::a#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:5 [ main::$2 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:6 [ main::a#2 ] : zp ZP_BYTE:6 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:7 [ inc::return#0 ] : zp ZP_BYTE:7 , reg byte a , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [main] 20: zp ZP_BYTE:6 [ main::a#2 ] 4: zp ZP_BYTE:3 [ main::$0 ] 4: zp ZP_BYTE:5 [ main::$2 ] 1.33: zp ZP_BYTE:4 [ main::a#1 ] +Uplift Scope [] 5: zp ZP_BYTE:2 [ i#11 inc::$0 ] +Uplift Scope [inc] 1.5: zp ZP_BYTE:7 [ inc::return#0 ] + +Uplifting [main] best 84 combination reg byte a [ main::a#2 ] reg byte a [ main::$0 ] reg byte a [ main::$2 ] zp ZP_BYTE:4 [ main::a#1 ] +Uplifting [] best 76 combination reg byte x [ i#11 inc::$0 ] +Uplifting [inc] best 69 combination reg byte a [ inc::return#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:4 [ main::a#1 ] +Uplifting [main] best 69 combination zp ZP_BYTE:4 [ main::a#1 ] +Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:2 [ main::a#1 ] +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp breturn +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +ASSEMBLER +//SEG0 Global ZP labels +//SEG1 @begin +bbegin: +//SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: + jsr main +//SEG4 @end +bend: +//SEG5 main +main: { + .label a = 2 + //SEG6 [2] call inc param-assignment [ inc::return#0 inc::$0 ] + //SEG7 [9] phi from main to inc + inc_from_main: + //SEG8 [9] phi (byte) i#11 = (byte) 0 -- xby=coby1 + ldx #$0 + jsr inc + //SEG9 main::@1 + b1: + //SEG10 [3] (byte~) main::$0 ← (byte) inc::return#0 [ main::$0 inc::$0 ] + // (byte~) main::$0 = (byte) inc::return#0 // register copy reg byte a + //SEG11 [4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 inc::$0 ] -- zpby1=coby1_plus_aby + clc + adc #$4 + sta a + //SEG12 [5] call inc param-assignment [ inc::return#0 main::a#1 ] + //SEG13 [9] phi from main::@1 to inc + inc_from_b1: + //SEG14 [9] phi (byte) i#11 = (byte~) inc::$0 -- register_copy + jsr inc + //SEG15 main::@2 + b2: + //SEG16 [6] (byte~) main::$2 ← (byte) inc::return#0 [ main::a#1 main::$2 ] + // (byte~) main::$2 = (byte) inc::return#0 // register copy reg byte a + //SEG17 [7] (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 [ ] -- aby=zpby1_plus_aby + clc + adc a + //SEG18 main::@return + breturn: + //SEG19 [8] return [ ] + rts +} +//SEG20 inc +inc: { + //SEG21 [10] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ] -- xby=xby_plus_coby1 + txa + clc + adc #$7 + tax + //SEG22 [11] (byte) inc::return#0 ← (byte~) inc::$0 [ inc::return#0 inc::$0 ] -- aby=xby + txa + //SEG23 inc::@return + breturn: + //SEG24 [12] return [ inc::return#0 inc::$0 ] + rts +} + +Removing instruction main_from_bbegin: +Succesful ASM optimization Pass5RedundantLabelElimination +ASSEMBLER +//SEG0 Global ZP labels +//SEG1 @begin +bbegin: +//SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main + jsr main +//SEG4 @end +bend: +//SEG5 main +main: { + .label a = 2 + //SEG6 [2] call inc param-assignment [ inc::return#0 inc::$0 ] + //SEG7 [9] phi from main to inc + inc_from_main: + //SEG8 [9] phi (byte) i#11 = (byte) 0 -- xby=coby1 + ldx #$0 + jsr inc + //SEG9 main::@1 + b1: + //SEG10 [3] (byte~) main::$0 ← (byte) inc::return#0 [ main::$0 inc::$0 ] + // (byte~) main::$0 = (byte) inc::return#0 // register copy reg byte a + //SEG11 [4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 inc::$0 ] -- zpby1=coby1_plus_aby + clc + adc #$4 + sta a + //SEG12 [5] call inc param-assignment [ inc::return#0 main::a#1 ] + //SEG13 [9] phi from main::@1 to inc + inc_from_b1: + //SEG14 [9] phi (byte) i#11 = (byte~) inc::$0 -- register_copy + jsr inc + //SEG15 main::@2 + b2: + //SEG16 [6] (byte~) main::$2 ← (byte) inc::return#0 [ main::a#1 main::$2 ] + // (byte~) main::$2 = (byte) inc::return#0 // register copy reg byte a + //SEG17 [7] (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 [ ] -- aby=zpby1_plus_aby + clc + adc a + //SEG18 main::@return + breturn: + //SEG19 [8] return [ ] + rts +} +//SEG20 inc +inc: { + //SEG21 [10] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ] -- xby=xby_plus_coby1 + txa + clc + adc #$7 + tax + //SEG22 [11] (byte) inc::return#0 ← (byte~) inc::$0 [ inc::return#0 inc::$0 ] -- aby=xby + txa + //SEG23 inc::@return + breturn: + //SEG24 [12] return [ inc::return#0 inc::$0 ] + rts +} + +Removing instruction bbegin: +Removing instruction bend: +Removing instruction inc_from_main: +Removing instruction b1: +Removing instruction inc_from_b1: +Removing instruction b2: +Removing instruction breturn: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +ASSEMBLER +//SEG0 Global ZP labels +//SEG1 @begin +//SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main + jsr main +//SEG4 @end +//SEG5 main +main: { + .label a = 2 + //SEG6 [2] call inc param-assignment [ inc::return#0 inc::$0 ] + //SEG7 [9] phi from main to inc + //SEG8 [9] phi (byte) i#11 = (byte) 0 -- xby=coby1 + ldx #$0 + jsr inc + //SEG9 main::@1 + //SEG10 [3] (byte~) main::$0 ← (byte) inc::return#0 [ main::$0 inc::$0 ] + // (byte~) main::$0 = (byte) inc::return#0 // register copy reg byte a + //SEG11 [4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 inc::$0 ] -- zpby1=coby1_plus_aby + clc + adc #$4 + sta a + //SEG12 [5] call inc param-assignment [ inc::return#0 main::a#1 ] + //SEG13 [9] phi from main::@1 to inc + //SEG14 [9] phi (byte) i#11 = (byte~) inc::$0 -- register_copy + jsr inc + //SEG15 main::@2 + //SEG16 [6] (byte~) main::$2 ← (byte) inc::return#0 [ main::a#1 main::$2 ] + // (byte~) main::$2 = (byte) inc::return#0 // register copy reg byte a + //SEG17 [7] (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 [ ] -- aby=zpby1_plus_aby + clc + adc a + //SEG18 main::@return + //SEG19 [8] return [ ] + rts +} +//SEG20 inc +inc: { + //SEG21 [10] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ] -- xby=xby_plus_coby1 + txa + clc + adc #$7 + tax + //SEG22 [11] (byte) inc::return#0 ← (byte~) inc::$0 [ inc::return#0 inc::$0 ] -- aby=xby + txa + //SEG23 inc::@return + //SEG24 [12] return [ inc::return#0 inc::$0 ] + rts +} + +FINAL SYMBOL TABLE +(label) @begin +(label) @end +(byte) i +(byte) i#11 reg byte x 4.0 +(byte()) inc() +(byte~) inc::$0 reg byte x 1.0 +(label) inc::@return +(byte) inc::return +(byte) inc::return#0 reg byte a 1.5 +(void()) main() +(byte~) main::$0 reg byte a 4.0 +(byte~) main::$2 reg byte a 4.0 +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte) main::a +(byte) main::a#1 a zp ZP_BYTE:2 1.3333333333333333 +(byte) main::a#2 reg byte a 20.0 + +reg byte x [ i#11 inc::$0 ] +reg byte a [ main::$0 ] +zp ZP_BYTE:2 [ main::a#1 ] +reg byte a [ main::$2 ] +reg byte a [ main::a#2 ] +reg byte a [ inc::return#0 ] + +FINAL CODE +//SEG0 Global ZP labels +//SEG1 @begin +//SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main + jsr main +//SEG4 @end +//SEG5 main +main: { + .label a = 2 + //SEG6 [2] call inc param-assignment [ inc::return#0 inc::$0 ] + //SEG7 [9] phi from main to inc + //SEG8 [9] phi (byte) i#11 = (byte) 0 -- xby=coby1 + ldx #$0 + jsr inc + //SEG9 main::@1 + //SEG10 [3] (byte~) main::$0 ← (byte) inc::return#0 [ main::$0 inc::$0 ] + // (byte~) main::$0 = (byte) inc::return#0 // register copy reg byte a + //SEG11 [4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 inc::$0 ] -- zpby1=coby1_plus_aby + clc + adc #$4 + sta a + //SEG12 [5] call inc param-assignment [ inc::return#0 main::a#1 ] + //SEG13 [9] phi from main::@1 to inc + //SEG14 [9] phi (byte) i#11 = (byte~) inc::$0 -- register_copy + jsr inc + //SEG15 main::@2 + //SEG16 [6] (byte~) main::$2 ← (byte) inc::return#0 [ main::a#1 main::$2 ] + // (byte~) main::$2 = (byte) inc::return#0 // register copy reg byte a + //SEG17 [7] (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 [ ] -- aby=zpby1_plus_aby + clc + adc a + //SEG18 main::@return + //SEG19 [8] return [ ] + rts +} +//SEG20 inc +inc: { + //SEG21 [10] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ] -- xby=xby_plus_coby1 + txa + clc + adc #$7 + tax + //SEG22 [11] (byte) inc::return#0 ← (byte~) inc::$0 [ inc::return#0 inc::$0 ] -- aby=xby + txa + //SEG23 inc::@return + //SEG24 [12] return [ inc::return#0 inc::$0 ] + rts +} + diff --git a/src/main/java/dk/camelot64/kickc/test/ref/liverange.sym b/src/main/java/dk/camelot64/kickc/test/ref/liverange.sym new file mode 100644 index 000000000..5af5575b6 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/ref/liverange.sym @@ -0,0 +1,25 @@ +(label) @begin +(label) @end +(byte) i +(byte) i#11 reg byte x 4.0 +(byte()) inc() +(byte~) inc::$0 reg byte x 1.0 +(label) inc::@return +(byte) inc::return +(byte) inc::return#0 reg byte a 1.5 +(void()) main() +(byte~) main::$0 reg byte a 4.0 +(byte~) main::$2 reg byte a 4.0 +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte) main::a +(byte) main::a#1 a zp ZP_BYTE:2 1.3333333333333333 +(byte) main::a#2 reg byte a 20.0 + +reg byte x [ i#11 inc::$0 ] +reg byte a [ main::$0 ] +zp ZP_BYTE:2 [ main::a#1 ] +reg byte a [ main::$2 ] +reg byte a [ main::a#2 ] +reg byte a [ inc::return#0 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopmin.cfg b/src/main/java/dk/camelot64/kickc/test/ref/loopmin.cfg index 73e9e233b..12254f48c 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopmin.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopmin.cfg @@ -9,7 +9,7 @@ [2] (byte) s#1 ← (byte) s#2 + (byte) i#2 [ i#2 s#1 ] to:@2 @2: scope:[] from @1 @3 - [3] (byte) s#4 ← phi( @1/(byte) s#2 @3/(byte) s#1 ) [ s#4 i#2 ] + [3] (byte) s#4 ← phi( @1/(byte) s#2 @3/(byte) s#1 ) [ i#2 s#4 ] [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] to:@end 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 57e210b00..4625dea7c 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopmin.log @@ -345,11 +345,14 @@ CONTROL FLOW GRAPH - PHI LIFTED (byte~) s#6 ← (byte) s#2 to:@2 +CALL GRAPH + Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from to:@1 @1: scope:[] from @5 @begin @@ -363,8 +366,8 @@ CONTROL FLOW GRAPH - LIVE RANGES to:@2 @2: scope:[] from @3 @6 [4] (byte) s#4 ← phi( @6/(byte~) s#6 @3/(byte~) s#7 ) [ i#2 s#4 ] - [5] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] - [6] if((byte) i#1>(byte) 0) goto @5 [ i#1 s#4 ] + [5] (byte) i#1 ← -- (byte) i#2 [ s#4 i#1 ] + [6] if((byte) i#1>(byte) 0) goto @5 [ s#4 i#1 ] to:@end @end: scope:[] from @2 @5: scope:[] from @2 @@ -399,14 +402,12 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED [2] (byte) s#1 ← (byte) s#2 + (byte) i#2 [ i#2 s#1 ] to:@2 @2: scope:[] from @1 @3 - [3] (byte) s#4 ← phi( @1/(byte) s#2 @3/(byte) s#1 ) [ s#4 i#2 ] + [3] (byte) s#4 ← phi( @1/(byte) s#2 @3/(byte) s#1 ) [ i#2 s#4 ] [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] to:@end @end: scope:[] from @2 -CALL GRAPH - DOMINATORS @begin dominated by @begin @1 dominated by @1 @begin diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopnest.cfg b/src/main/java/dk/camelot64/kickc/test/ref/loopnest.cfg index 5b5b091ab..dee3bb292 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest.cfg @@ -3,26 +3,28 @@ to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@3 - [1] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ] - [2] call nest param-assignment [ main::i#2 ] + [2] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ] + [3] call nest param-assignment [ main::i#2 ] to:main::@3 main::@3: scope:[main] from main::@1 - [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] - [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] + [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] + [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@3 - [5] return [ ] + [6] return [ ] to:@return nest: scope:[nest] from main::@1 + [7] phi() [ ] to:nest::@1 nest::@1: scope:[nest] from nest nest::@1 - [6] (byte) nest::j#2 ← phi( nest/(byte) 100 nest::@1/(byte) nest::j#1 ) [ main::i#2 nest::j#2 ] - [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] - [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] - [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] + [8] (byte) nest::j#2 ← phi( nest/(byte) 100 nest::@1/(byte) nest::j#1 ) [ nest::j#2 ] + [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] + [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] + [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] to:nest::@return nest::@return: scope:[nest] from nest::@1 - [10] return [ main::i#2 ] + [12] return [ ] to:@return 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 67eac9fdb..54babb250 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest.log @@ -642,99 +642,97 @@ nest::@3: scope:[nest] from nest::@1 (byte~) nest::j#3 ← (byte) nest::j#1 to:nest::@1 +Adding NOP phi() at start of main +Adding NOP phi() at start of nest +CALL GRAPH +Calls in [] to 0:main +Calls in [main] to 3:nest + Propagating live ranges... Propagating live ranges... Propagating live ranges... -Propagating live ranges... -Propagated main::i#2 through call [2] call nest param-assignment -Propagating live ranges... -Propagated main::i#2 through call [2] call nest param-assignment -Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@4 - [1] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte~) main::i#4 ) [ main::i#2 ] - [2] call nest param-assignment [ main::i#2 ] + [2] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte~) main::i#4 ) [ main::i#2 ] + [3] call nest param-assignment [ main::i#2 ] to:main::@3 main::@3: scope:[main] from main::@1 - [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] - [4] if((byte) main::i#1>(byte) 0) goto main::@4 [ main::i#1 ] + [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] + [5] if((byte) main::i#1>(byte) 0) goto main::@4 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@3 - [5] return [ ] + [6] return [ ] to:@return main::@4: scope:[main] from main::@3 - [6] (byte~) main::i#4 ← (byte) main::i#1 [ main::i#4 ] + [7] (byte~) main::i#4 ← (byte) main::i#1 [ main::i#4 ] to:main::@1 nest: scope:[nest] from main::@1 + [8] phi() [ ] to:nest::@1 nest::@1: scope:[nest] from nest nest::@3 - [7] (byte) nest::j#2 ← phi( nest/(byte) 100 nest::@3/(byte~) nest::j#3 ) [ main::i#2 nest::j#2 ] - [8] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] - [9] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] - [10] if((byte) nest::j#1>(byte) 0) goto nest::@3 [ main::i#2 nest::j#1 ] + [9] (byte) nest::j#2 ← phi( nest/(byte) 100 nest::@3/(byte~) nest::j#3 ) [ nest::j#2 ] + [10] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] + [11] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] + [12] if((byte) nest::j#1>(byte) 0) goto nest::@3 [ nest::j#1 ] to:nest::@return nest::@return: scope:[nest] from nest::@1 - [11] return [ main::i#2 ] + [13] return [ ] to:@return nest::@3: scope:[nest] from nest::@1 - [12] (byte~) nest::j#3 ← (byte) nest::j#1 [ main::i#2 nest::j#3 ] + [14] (byte~) nest::j#3 ← (byte) nest::j#1 [ nest::j#3 ] to:nest::@1 Created 2 initial phi equivalence classes -Coalesced [6] main::i#4 ← main::i#1 -Coalesced [12] nest::j#3 ← nest::j#1 +Coalesced [7] main::i#4 ← main::i#1 +Coalesced [14] nest::j#3 ← nest::j#1 Coalesced down to 2 phi equivalence classes Culled Empty Block (label) main::@4 Culled Empty Block (label) nest::@3 Block Sequence Planned @begin @end main main::@1 main::@3 main::@return nest nest::@1 nest::@return +Adding NOP phi() at start of main +Adding NOP phi() at start of nest Propagating live ranges... Propagating live ranges... Propagating live ranges... -Propagating live ranges... -Propagated main::i#2 through call [2] call nest param-assignment -Propagating live ranges... -Propagated main::i#2 through call [2] call nest param-assignment -Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@3 - [1] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ] - [2] call nest param-assignment [ main::i#2 ] + [2] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ] + [3] call nest param-assignment [ main::i#2 ] to:main::@3 main::@3: scope:[main] from main::@1 - [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] - [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] + [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] + [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@3 - [5] return [ ] + [6] return [ ] to:@return nest: scope:[nest] from main::@1 + [7] phi() [ ] to:nest::@1 nest::@1: scope:[nest] from nest nest::@1 - [6] (byte) nest::j#2 ← phi( nest/(byte) 100 nest::@1/(byte) nest::j#1 ) [ main::i#2 nest::j#2 ] - [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] - [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] - [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] + [8] (byte) nest::j#2 ← phi( nest/(byte) 100 nest::@1/(byte) nest::j#1 ) [ nest::j#2 ] + [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] + [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] + [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] to:nest::@return nest::@return: scope:[nest] from nest::@1 - [10] return [ main::i#2 ] + [12] return [ ] to:@return -CALL GRAPH -Calls in [] to 0:main -Calls in [main] to 2:nest - DOMINATORS @begin dominated by @begin @end dominated by @end @begin @@ -769,7 +767,7 @@ VARIABLE REGISTER WEIGHTS (void()) main() (byte) main::i (byte) main::i#1 16.5 -(byte) main::i#2 3.142857142857143 +(byte) main::i#2 11.0 (void()) nest() (byte) nest::j (byte) nest::j#1 151.5 @@ -788,68 +786,72 @@ INITIAL ASM //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main jmp bend -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { .label i = 2 - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i jmp b1 - //SEG7 [1] phi from main::@3 to main::@1 + //SEG8 [2] phi from main::@3 to main::@1 b1_from_b3: - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 - //SEG9 main::@1 + //SEG10 main::@1 b1: - //SEG10 [2] call nest param-assignment [ main::i#2 ] + //SEG11 [3] call nest param-assignment [ main::i#2 ] + //SEG12 [7] phi from main::@1 to nest + nest_from_b1: jsr nest jmp b3 - //SEG11 main::@3 + //SEG13 main::@3 b3: - //SEG12 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 + //SEG14 [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG13 [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 + //SEG15 [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1_from_b3 jmp breturn - //SEG14 main::@return + //SEG16 main::@return breturn: - //SEG15 [5] return [ ] + //SEG17 [6] return [ ] rts } -//SEG16 nest +//SEG18 nest nest: { .label j = 3 - //SEG17 [6] phi from nest to nest::@1 + //SEG19 [8] phi from nest to nest::@1 b1_from_nest: - //SEG18 [6] phi (byte) nest::j#2 = (byte) 100 -- zpby1=coby1 + //SEG20 [8] phi (byte) nest::j#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta j jmp b1 - //SEG19 [6] phi from nest::@1 to nest::@1 + //SEG21 [8] phi from nest::@1 to nest::@1 b1_from_b1: - //SEG20 [6] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy + //SEG22 [8] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy jmp b1 - //SEG21 nest::@1 + //SEG23 nest::@1 b1: - //SEG22 [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] -- _star_cowo1=zpby1 + //SEG24 [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] -- _star_cowo1=zpby1 lda j sta $400 - //SEG23 [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] -- zpby1=_dec_zpby1 + //SEG25 [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] -- zpby1=_dec_zpby1 dec j - //SEG24 [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] -- zpby1_gt_0_then_la1 + //SEG26 [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] -- zpby1_gt_0_then_la1 lda j bne b1_from_b1 jmp breturn - //SEG25 nest::@return + //SEG27 nest::@return breturn: - //SEG26 [10] return [ main::i#2 ] + //SEG28 [12] return [ ] rts } @@ -859,12 +861,12 @@ Potential registers zp ZP_BYTE:3 [ nest::j#2 nest::j#1 ] : zp ZP_BYTE:3 , reg by REGISTER UPLIFT SCOPES Uplift Scope [nest] 303: zp ZP_BYTE:3 [ nest::j#2 nest::j#1 ] -Uplift Scope [main] 19.64: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] +Uplift Scope [main] 27.5: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] Uplift Scope [] -Uplifting [nest] best 2506 combination reg byte x [ nest::j#2 nest::j#1 ] -Uplifting [main] best 2436 combination reg byte y [ main::i#2 main::i#1 ] -Uplifting [] best 2436 combination +Uplifting [nest] best 2425 combination reg byte x [ nest::j#2 nest::j#1 ] +Uplifting [main] best 2355 combination reg byte y [ main::i#2 main::i#1 ] +Uplifting [] best 2355 combination Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp b3 @@ -877,63 +879,69 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- yby=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- yby=coby1 ldy #$64 jmp b1 - //SEG7 [1] phi from main::@3 to main::@1 + //SEG8 [2] phi from main::@3 to main::@1 b1_from_b3: - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] call nest param-assignment [ main::i#2 ] + //SEG11 [3] call nest param-assignment [ main::i#2 ] + //SEG12 [7] phi from main::@1 to nest + nest_from_b1: jsr nest - //SEG11 main::@3 + //SEG13 main::@3 b3: - //SEG12 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby + //SEG14 [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby dey - //SEG13 [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1 + //SEG15 [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1 cpy #$0 bne b1_from_b3 - //SEG14 main::@return + //SEG16 main::@return breturn: - //SEG15 [5] return [ ] + //SEG17 [6] return [ ] rts } -//SEG16 nest +//SEG18 nest nest: { - //SEG17 [6] phi from nest to nest::@1 + //SEG19 [8] phi from nest to nest::@1 b1_from_nest: - //SEG18 [6] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1 + //SEG20 [8] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1 ldx #$64 jmp b1 - //SEG19 [6] phi from nest::@1 to nest::@1 + //SEG21 [8] phi from nest::@1 to nest::@1 b1_from_b1: - //SEG20 [6] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy - //SEG21 nest::@1 + //SEG22 [8] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy + //SEG23 nest::@1 b1: - //SEG22 [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] -- _star_cowo1=xby + //SEG24 [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] -- _star_cowo1=xby stx $400 - //SEG23 [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] -- xby=_dec_xby + //SEG25 [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] -- xby=_dec_xby dex - //SEG24 [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] -- xby_gt_0_then_la1 + //SEG26 [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b1_from_b1 - //SEG25 nest::@return + //SEG27 nest::@return breturn: - //SEG26 [10] return [ main::i#2 ] + //SEG28 [12] return [ ] rts } Replacing label b1_from_b3 with b1 Replacing label b1_from_b1 with b1 +Removing instruction main_from_bbegin: Removing instruction b1_from_b3: +Removing instruction nest_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination ASSEMBLER @@ -941,55 +949,57 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- yby=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- yby=coby1 ldy #$64 jmp b1 - //SEG7 [1] phi from main::@3 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@3 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] call nest param-assignment [ main::i#2 ] + //SEG11 [3] call nest param-assignment [ main::i#2 ] + //SEG12 [7] phi from main::@1 to nest jsr nest - //SEG11 main::@3 + //SEG13 main::@3 b3: - //SEG12 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby + //SEG14 [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby dey - //SEG13 [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1 + //SEG15 [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1 cpy #$0 bne b1 - //SEG14 main::@return + //SEG16 main::@return breturn: - //SEG15 [5] return [ ] + //SEG17 [6] return [ ] rts } -//SEG16 nest +//SEG18 nest nest: { - //SEG17 [6] phi from nest to nest::@1 + //SEG19 [8] phi from nest to nest::@1 b1_from_nest: - //SEG18 [6] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1 + //SEG20 [8] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1 ldx #$64 jmp b1 - //SEG19 [6] phi from nest::@1 to nest::@1 - //SEG20 [6] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy - //SEG21 nest::@1 + //SEG21 [8] phi from nest::@1 to nest::@1 + //SEG22 [8] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy + //SEG23 nest::@1 b1: - //SEG22 [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] -- _star_cowo1=xby + //SEG24 [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] -- _star_cowo1=xby stx $400 - //SEG23 [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] -- xby=_dec_xby + //SEG25 [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] -- xby=_dec_xby dex - //SEG24 [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] -- xby_gt_0_then_la1 + //SEG26 [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b1 - //SEG25 nest::@return + //SEG27 nest::@return breturn: - //SEG26 [10] return [ main::i#2 ] + //SEG28 [12] return [ ] rts } @@ -1005,49 +1015,51 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- yby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- yby=coby1 ldy #$64 jmp b1 - //SEG7 [1] phi from main::@3 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@3 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] call nest param-assignment [ main::i#2 ] + //SEG11 [3] call nest param-assignment [ main::i#2 ] + //SEG12 [7] phi from main::@1 to nest jsr nest - //SEG11 main::@3 - //SEG12 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby + //SEG13 main::@3 + //SEG14 [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby dey - //SEG13 [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1 + //SEG15 [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1 cpy #$0 bne b1 - //SEG14 main::@return - //SEG15 [5] return [ ] + //SEG16 main::@return + //SEG17 [6] return [ ] rts } -//SEG16 nest +//SEG18 nest nest: { - //SEG17 [6] phi from nest to nest::@1 - //SEG18 [6] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1 + //SEG19 [8] phi from nest to nest::@1 + //SEG20 [8] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1 ldx #$64 jmp b1 - //SEG19 [6] phi from nest::@1 to nest::@1 - //SEG20 [6] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy - //SEG21 nest::@1 + //SEG21 [8] phi from nest::@1 to nest::@1 + //SEG22 [8] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy + //SEG23 nest::@1 b1: - //SEG22 [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] -- _star_cowo1=xby + //SEG24 [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] -- _star_cowo1=xby stx $400 - //SEG23 [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] -- xby=_dec_xby + //SEG25 [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] -- xby=_dec_xby dex - //SEG24 [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] -- xby_gt_0_then_la1 + //SEG26 [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b1 - //SEG25 nest::@return - //SEG26 [10] return [ main::i#2 ] + //SEG27 nest::@return + //SEG28 [12] return [ ] rts } @@ -1058,47 +1070,49 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- yby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- yby=coby1 ldy #$64 - //SEG7 [1] phi from main::@3 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@3 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] call nest param-assignment [ main::i#2 ] + //SEG11 [3] call nest param-assignment [ main::i#2 ] + //SEG12 [7] phi from main::@1 to nest jsr nest - //SEG11 main::@3 - //SEG12 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby + //SEG13 main::@3 + //SEG14 [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby dey - //SEG13 [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1 + //SEG15 [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1 cpy #$0 bne b1 - //SEG14 main::@return - //SEG15 [5] return [ ] + //SEG16 main::@return + //SEG17 [6] return [ ] rts } -//SEG16 nest +//SEG18 nest nest: { - //SEG17 [6] phi from nest to nest::@1 - //SEG18 [6] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1 + //SEG19 [8] phi from nest to nest::@1 + //SEG20 [8] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1 ldx #$64 - //SEG19 [6] phi from nest::@1 to nest::@1 - //SEG20 [6] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy - //SEG21 nest::@1 + //SEG21 [8] phi from nest::@1 to nest::@1 + //SEG22 [8] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy + //SEG23 nest::@1 b1: - //SEG22 [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] -- _star_cowo1=xby + //SEG24 [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] -- _star_cowo1=xby stx $400 - //SEG23 [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] -- xby=_dec_xby + //SEG25 [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] -- xby=_dec_xby dex - //SEG24 [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] -- xby_gt_0_then_la1 + //SEG26 [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b1 - //SEG25 nest::@return - //SEG26 [10] return [ main::i#2 ] + //SEG27 nest::@return + //SEG28 [12] return [ ] rts } @@ -1112,7 +1126,7 @@ FINAL SYMBOL TABLE (label) main::@return (byte) main::i (byte) main::i#1 reg byte y 16.5 -(byte) main::i#2 reg byte y 3.142857142857143 +(byte) main::i#2 reg byte y 11.0 (void()) nest() (label) nest::@1 (label) nest::@return @@ -1127,47 +1141,49 @@ FINAL CODE //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- yby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- yby=coby1 ldy #$64 - //SEG7 [1] phi from main::@3 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@3 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] call nest param-assignment [ main::i#2 ] + //SEG11 [3] call nest param-assignment [ main::i#2 ] + //SEG12 [7] phi from main::@1 to nest jsr nest - //SEG11 main::@3 - //SEG12 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby + //SEG13 main::@3 + //SEG14 [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby dey - //SEG13 [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1 + //SEG15 [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1 cpy #$0 bne b1 - //SEG14 main::@return - //SEG15 [5] return [ ] + //SEG16 main::@return + //SEG17 [6] return [ ] rts } -//SEG16 nest +//SEG18 nest nest: { - //SEG17 [6] phi from nest to nest::@1 - //SEG18 [6] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1 + //SEG19 [8] phi from nest to nest::@1 + //SEG20 [8] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1 ldx #$64 - //SEG19 [6] phi from nest::@1 to nest::@1 - //SEG20 [6] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy - //SEG21 nest::@1 + //SEG21 [8] phi from nest::@1 to nest::@1 + //SEG22 [8] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy + //SEG23 nest::@1 b1: - //SEG22 [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] -- _star_cowo1=xby + //SEG24 [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] -- _star_cowo1=xby stx $400 - //SEG23 [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] -- xby=_dec_xby + //SEG25 [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] -- xby=_dec_xby dex - //SEG24 [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] -- xby_gt_0_then_la1 + //SEG26 [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b1 - //SEG25 nest::@return - //SEG26 [10] return [ main::i#2 ] + //SEG27 nest::@return + //SEG28 [12] return [ ] rts } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopnest.sym b/src/main/java/dk/camelot64/kickc/test/ref/loopnest.sym index 15982bd6e..6d5bb0f25 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest.sym @@ -7,7 +7,7 @@ (label) main::@return (byte) main::i (byte) main::i#1 reg byte y 16.5 -(byte) main::i#2 reg byte y 3.142857142857143 +(byte) main::i#2 reg byte y 11.0 (void()) nest() (label) nest::@1 (label) nest::@return diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.cfg b/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.cfg index de4818e85..c8abefd81 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.cfg @@ -3,60 +3,63 @@ to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@3 - [1] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ] + [2] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ] to:main::@2 main::@2: scope:[main] from main::@1 main::@5 - [2] (byte) main::j#2 ← phi( main::@1/(byte) 100 main::@5/(byte) main::j#1 ) [ main::j#2 main::i#2 ] - [3] call nest1 param-assignment [ main::j#2 main::i#2 ] + [3] (byte) main::j#2 ← phi( main::@1/(byte) 100 main::@5/(byte) main::j#1 ) [ main::i#2 main::j#2 ] + [4] call nest1 param-assignment [ main::i#2 main::j#2 ] to:main::@5 main::@5: scope:[main] from main::@2 - [4] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 main::i#2 ] - [5] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::j#1 main::i#2 ] + [5] (byte) main::j#1 ← -- (byte) main::j#2 [ main::i#2 main::j#1 ] + [6] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::i#2 main::j#1 ] to:main::@3 main::@3: scope:[main] from main::@5 - [6] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] - [7] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] + [7] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] + [8] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@3 - [8] return [ ] + [9] return [ ] to:@return nest1: scope:[nest1] from main::@2 + [10] phi() [ ] to:nest1::@1 nest1::@1: scope:[nest1] from nest1 nest1::@3 - [9] (byte) nest1::i#2 ← phi( nest1/(byte) 100 nest1::@3/(byte) nest1::i#1 ) [ main::j#2 main::i#2 nest1::i#2 ] + [11] (byte) nest1::i#2 ← phi( nest1/(byte) 100 nest1::@3/(byte) nest1::i#1 ) [ nest1::i#2 ] to:nest1::@2 nest1::@2: scope:[nest1] from nest1::@1 nest1::@5 - [10] (byte) nest1::j#2 ← phi( nest1::@1/(byte) 100 nest1::@5/(byte) nest1::j#1 ) [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] - [11] call nest2 param-assignment [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + [12] (byte) nest1::j#2 ← phi( nest1::@1/(byte) 100 nest1::@5/(byte) nest1::j#1 ) [ nest1::i#2 nest1::j#2 ] + [13] call nest2 param-assignment [ nest1::i#2 nest1::j#2 ] to:nest1::@5 nest1::@5: scope:[nest1] from nest1::@2 - [12] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] - [13] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] + [14] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ nest1::i#2 nest1::j#1 ] + [15] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ nest1::i#2 nest1::j#1 ] to:nest1::@3 nest1::@3: scope:[nest1] from nest1::@5 - [14] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ main::j#2 main::i#2 nest1::i#1 ] - [15] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ main::j#2 main::i#2 nest1::i#1 ] + [16] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ nest1::i#1 ] + [17] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ nest1::i#1 ] to:nest1::@return nest1::@return: scope:[nest1] from nest1::@3 - [16] return [ main::j#2 main::i#2 ] + [18] return [ ] to:@return nest2: scope:[nest2] from nest1::@2 + [19] phi() [ ] to:nest2::@1 nest2::@1: scope:[nest2] from nest2 nest2::@3 - [17] (byte) nest2::i#2 ← phi( nest2/(byte) 100 nest2::@3/(byte) nest2::i#1 ) [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#2 ] + [20] (byte) nest2::i#2 ← phi( nest2/(byte) 100 nest2::@3/(byte) nest2::i#1 ) [ nest2::i#2 ] to:nest2::@2 nest2::@2: scope:[nest2] from nest2::@1 nest2::@2 - [18] (byte) nest2::j#2 ← phi( nest2::@1/(byte) 100 nest2::@2/(byte) nest2::j#1 ) [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] - [19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] - [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] - [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] + [21] (byte) nest2::j#2 ← phi( nest2::@1/(byte) 100 nest2::@2/(byte) nest2::j#1 ) [ nest2::i#2 nest2::j#2 ] + [22] *((word) 1024) ← (byte) nest2::j#2 [ nest2::i#2 nest2::j#2 ] + [23] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ nest2::i#2 nest2::j#1 ] + [24] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ nest2::i#2 nest2::j#1 ] to:nest2::@3 nest2::@3: scope:[nest2] from nest2::@2 - [22] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] - [23] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] + [25] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ nest2::i#1 ] + [26] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ nest2::i#1 ] to:nest2::@return nest2::@return: scope:[nest2] from nest2::@3 - [24] return [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + [27] return [ ] to:@return 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 7533cc304..4d51fee8f 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.log @@ -1654,156 +1654,112 @@ nest2::@6: scope:[nest2] from nest2::@2 (byte~) nest2::j#3 ← (byte) nest2::j#1 to:nest2::@2 +Adding NOP phi() at start of main +Adding NOP phi() at start of nest1 +Adding NOP phi() at start of nest2 +CALL GRAPH +Calls in [] to 0:main +Calls in [main] to 4:nest1 +Calls in [nest1] to 15:nest2 + Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -Propagating live ranges... -Propagated nest1::j#2 through call [13] call nest2 param-assignment -Propagating live ranges... -Propagated nest1::j#2 through call [13] call nest2 param-assignment -Propagating live ranges... -Propagated nest1::j#2 through call [13] call nest2 param-assignment -Propagated nest1::i#2 through call [13] call nest2 param-assignment -Propagating live ranges... -Propagated nest1::j#2 through call [13] call nest2 param-assignment -Propagated nest1::i#2 through call [13] call nest2 param-assignment -Propagating live ranges... -Propagated nest1::j#2 through call [13] call nest2 param-assignment -Propagated nest1::i#2 through call [13] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [13] call nest2 param-assignment -Propagated nest1::j#2 through call [13] call nest2 param-assignment -Propagated nest1::i#2 through call [13] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [13] call nest2 param-assignment -Propagated nest1::j#2 through call [13] call nest2 param-assignment -Propagated nest1::i#2 through call [13] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [3] call nest1 param-assignment -Propagated main::j#2 through call [13] call nest2 param-assignment -Propagated main::i#2 through call [13] call nest2 param-assignment -Propagated nest1::j#2 through call [13] call nest2 param-assignment -Propagated nest1::i#2 through call [13] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [3] call nest1 param-assignment -Propagated main::j#2 through call [13] call nest2 param-assignment -Propagated main::i#2 through call [13] call nest2 param-assignment -Propagated nest1::j#2 through call [13] call nest2 param-assignment -Propagated nest1::i#2 through call [13] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [3] call nest1 param-assignment -Propagated main::i#2 through call [3] call nest1 param-assignment -Propagated main::j#2 through call [13] call nest2 param-assignment -Propagated main::i#2 through call [13] call nest2 param-assignment -Propagated nest1::j#2 through call [13] call nest2 param-assignment -Propagated nest1::i#2 through call [13] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [3] call nest1 param-assignment -Propagated main::i#2 through call [3] call nest1 param-assignment -Propagated main::j#2 through call [13] call nest2 param-assignment -Propagated main::i#2 through call [13] call nest2 param-assignment -Propagated nest1::j#2 through call [13] call nest2 param-assignment -Propagated nest1::i#2 through call [13] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [3] call nest1 param-assignment -Propagated main::i#2 through call [3] call nest1 param-assignment -Propagated main::j#2 through call [13] call nest2 param-assignment -Propagated main::i#2 through call [13] call nest2 param-assignment -Propagated nest1::j#2 through call [13] call nest2 param-assignment -Propagated nest1::i#2 through call [13] call nest2 param-assignment -Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@6 - [1] (byte) main::i#2 ← phi( main/(byte) 100 main::@6/(byte~) main::i#6 ) [ main::i#2 ] + [2] (byte) main::i#2 ← phi( main/(byte) 100 main::@6/(byte~) main::i#6 ) [ main::i#2 ] to:main::@2 main::@2: scope:[main] from main::@1 main::@7 - [2] (byte) main::j#2 ← phi( main::@1/(byte) 100 main::@7/(byte~) main::j#4 ) [ main::j#2 main::i#2 ] - [3] call nest1 param-assignment [ main::j#2 main::i#2 ] + [3] (byte) main::j#2 ← phi( main::@1/(byte) 100 main::@7/(byte~) main::j#4 ) [ main::i#2 main::j#2 ] + [4] call nest1 param-assignment [ main::i#2 main::j#2 ] to:main::@5 main::@5: scope:[main] from main::@2 - [4] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 main::i#2 ] - [5] if((byte) main::j#1>(byte) 0) goto main::@7 [ main::j#1 main::i#2 ] + [5] (byte) main::j#1 ← -- (byte) main::j#2 [ main::i#2 main::j#1 ] + [6] if((byte) main::j#1>(byte) 0) goto main::@7 [ main::i#2 main::j#1 ] to:main::@3 main::@3: scope:[main] from main::@5 - [6] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] - [7] if((byte) main::i#1>(byte) 0) goto main::@6 [ main::i#1 ] + [7] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] + [8] if((byte) main::i#1>(byte) 0) goto main::@6 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@3 - [8] return [ ] + [9] return [ ] to:@return main::@6: scope:[main] from main::@3 - [9] (byte~) main::i#6 ← (byte) main::i#1 [ main::i#6 ] + [10] (byte~) main::i#6 ← (byte) main::i#1 [ main::i#6 ] to:main::@1 main::@7: scope:[main] from main::@5 - [10] (byte~) main::j#4 ← (byte) main::j#1 [ main::j#4 main::i#2 ] + [11] (byte~) main::j#4 ← (byte) main::j#1 [ main::i#2 main::j#4 ] to:main::@2 nest1: scope:[nest1] from main::@2 + [12] phi() [ ] to:nest1::@1 nest1::@1: scope:[nest1] from nest1 nest1::@6 - [11] (byte) nest1::i#2 ← phi( nest1/(byte) 100 nest1::@6/(byte~) nest1::i#6 ) [ main::j#2 main::i#2 nest1::i#2 ] + [13] (byte) nest1::i#2 ← phi( nest1/(byte) 100 nest1::@6/(byte~) nest1::i#6 ) [ nest1::i#2 ] to:nest1::@2 nest1::@2: scope:[nest1] from nest1::@1 nest1::@7 - [12] (byte) nest1::j#2 ← phi( nest1::@1/(byte) 100 nest1::@7/(byte~) nest1::j#4 ) [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] - [13] call nest2 param-assignment [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + [14] (byte) nest1::j#2 ← phi( nest1::@1/(byte) 100 nest1::@7/(byte~) nest1::j#4 ) [ nest1::i#2 nest1::j#2 ] + [15] call nest2 param-assignment [ nest1::i#2 nest1::j#2 ] to:nest1::@5 nest1::@5: scope:[nest1] from nest1::@2 - [14] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] - [15] if((byte) nest1::j#1>(byte) 0) goto nest1::@7 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] + [16] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ nest1::i#2 nest1::j#1 ] + [17] if((byte) nest1::j#1>(byte) 0) goto nest1::@7 [ nest1::i#2 nest1::j#1 ] to:nest1::@3 nest1::@3: scope:[nest1] from nest1::@5 - [16] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ main::j#2 main::i#2 nest1::i#1 ] - [17] if((byte) nest1::i#1>(byte) 0) goto nest1::@6 [ main::j#2 main::i#2 nest1::i#1 ] + [18] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ nest1::i#1 ] + [19] if((byte) nest1::i#1>(byte) 0) goto nest1::@6 [ nest1::i#1 ] to:nest1::@return nest1::@return: scope:[nest1] from nest1::@3 - [18] return [ main::j#2 main::i#2 ] + [20] return [ ] to:@return nest1::@6: scope:[nest1] from nest1::@3 - [19] (byte~) nest1::i#6 ← (byte) nest1::i#1 [ main::j#2 main::i#2 nest1::i#6 ] + [21] (byte~) nest1::i#6 ← (byte) nest1::i#1 [ nest1::i#6 ] to:nest1::@1 nest1::@7: scope:[nest1] from nest1::@5 - [20] (byte~) nest1::j#4 ← (byte) nest1::j#1 [ main::j#2 main::i#2 nest1::j#4 nest1::i#2 ] + [22] (byte~) nest1::j#4 ← (byte) nest1::j#1 [ nest1::i#2 nest1::j#4 ] to:nest1::@2 nest2: scope:[nest2] from nest1::@2 + [23] phi() [ ] to:nest2::@1 nest2::@1: scope:[nest2] from nest2 nest2::@5 - [21] (byte) nest2::i#2 ← phi( nest2/(byte) 100 nest2::@5/(byte~) nest2::i#5 ) [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#2 ] + [24] (byte) nest2::i#2 ← phi( nest2/(byte) 100 nest2::@5/(byte~) nest2::i#5 ) [ nest2::i#2 ] to:nest2::@2 nest2::@2: scope:[nest2] from nest2::@1 nest2::@6 - [22] (byte) nest2::j#2 ← phi( nest2::@1/(byte) 100 nest2::@6/(byte~) nest2::j#3 ) [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] - [23] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] - [24] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] - [25] if((byte) nest2::j#1>(byte) 0) goto nest2::@6 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] + [25] (byte) nest2::j#2 ← phi( nest2::@1/(byte) 100 nest2::@6/(byte~) nest2::j#3 ) [ nest2::i#2 nest2::j#2 ] + [26] *((word) 1024) ← (byte) nest2::j#2 [ nest2::i#2 nest2::j#2 ] + [27] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ nest2::i#2 nest2::j#1 ] + [28] if((byte) nest2::j#1>(byte) 0) goto nest2::@6 [ nest2::i#2 nest2::j#1 ] to:nest2::@3 nest2::@3: scope:[nest2] from nest2::@2 - [26] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] - [27] if((byte) nest2::i#1>(byte) 0) goto nest2::@5 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] + [29] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ nest2::i#1 ] + [30] if((byte) nest2::i#1>(byte) 0) goto nest2::@5 [ nest2::i#1 ] to:nest2::@return nest2::@return: scope:[nest2] from nest2::@3 - [28] return [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + [31] return [ ] to:@return nest2::@5: scope:[nest2] from nest2::@3 - [29] (byte~) nest2::i#5 ← (byte) nest2::i#1 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#5 ] + [32] (byte~) nest2::i#5 ← (byte) nest2::i#1 [ nest2::i#5 ] to:nest2::@1 nest2::@6: scope:[nest2] from nest2::@2 - [30] (byte~) nest2::j#3 ← (byte) nest2::j#1 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#3 nest2::i#2 ] + [33] (byte~) nest2::j#3 ← (byte) nest2::j#1 [ nest2::i#2 nest2::j#3 ] to:nest2::@2 Created 6 initial phi equivalence classes -Coalesced [9] main::i#6 ← main::i#1 -Coalesced [10] main::j#4 ← main::j#1 -Coalesced [19] nest1::i#6 ← nest1::i#1 -Coalesced [20] nest1::j#4 ← nest1::j#1 -Coalesced [29] nest2::i#5 ← nest2::i#1 -Coalesced [30] nest2::j#3 ← nest2::j#1 +Coalesced [10] main::i#6 ← main::i#1 +Coalesced [11] main::j#4 ← main::j#1 +Coalesced [21] nest1::i#6 ← nest1::i#1 +Coalesced [22] nest1::j#4 ← nest1::j#1 +Coalesced [32] nest2::i#5 ← nest2::i#1 +Coalesced [33] nest2::j#3 ← nest2::j#1 Coalesced down to 6 phi equivalence classes Culled Empty Block (label) main::@6 Culled Empty Block (label) main::@7 @@ -1812,136 +1768,82 @@ Culled Empty Block (label) nest1::@7 Culled Empty Block (label) nest2::@5 Culled Empty Block (label) nest2::@6 Block Sequence Planned @begin @end main main::@1 main::@2 main::@5 main::@3 main::@return nest1 nest1::@1 nest1::@2 nest1::@5 nest1::@3 nest1::@return nest2 nest2::@1 nest2::@2 nest2::@3 nest2::@return +Adding NOP phi() at start of main +Adding NOP phi() at start of nest1 +Adding NOP phi() at start of nest2 Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -Propagating live ranges... -Propagated nest1::j#2 through call [11] call nest2 param-assignment -Propagating live ranges... -Propagated nest1::j#2 through call [11] call nest2 param-assignment -Propagating live ranges... -Propagated nest1::j#2 through call [11] call nest2 param-assignment -Propagated nest1::i#2 through call [11] call nest2 param-assignment -Propagating live ranges... -Propagated nest1::j#2 through call [11] call nest2 param-assignment -Propagated nest1::i#2 through call [11] call nest2 param-assignment -Propagating live ranges... -Propagated nest1::j#2 through call [11] call nest2 param-assignment -Propagated nest1::i#2 through call [11] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [11] call nest2 param-assignment -Propagated nest1::j#2 through call [11] call nest2 param-assignment -Propagated nest1::i#2 through call [11] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [11] call nest2 param-assignment -Propagated nest1::j#2 through call [11] call nest2 param-assignment -Propagated nest1::i#2 through call [11] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [3] call nest1 param-assignment -Propagated main::j#2 through call [11] call nest2 param-assignment -Propagated main::i#2 through call [11] call nest2 param-assignment -Propagated nest1::j#2 through call [11] call nest2 param-assignment -Propagated nest1::i#2 through call [11] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [3] call nest1 param-assignment -Propagated main::j#2 through call [11] call nest2 param-assignment -Propagated main::i#2 through call [11] call nest2 param-assignment -Propagated nest1::j#2 through call [11] call nest2 param-assignment -Propagated nest1::i#2 through call [11] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [3] call nest1 param-assignment -Propagated main::i#2 through call [3] call nest1 param-assignment -Propagated main::j#2 through call [11] call nest2 param-assignment -Propagated main::i#2 through call [11] call nest2 param-assignment -Propagated nest1::j#2 through call [11] call nest2 param-assignment -Propagated nest1::i#2 through call [11] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [3] call nest1 param-assignment -Propagated main::i#2 through call [3] call nest1 param-assignment -Propagated main::j#2 through call [11] call nest2 param-assignment -Propagated main::i#2 through call [11] call nest2 param-assignment -Propagated nest1::j#2 through call [11] call nest2 param-assignment -Propagated nest1::i#2 through call [11] call nest2 param-assignment -Propagating live ranges... -Propagated main::j#2 through call [3] call nest1 param-assignment -Propagated main::i#2 through call [3] call nest1 param-assignment -Propagated main::j#2 through call [11] call nest2 param-assignment -Propagated main::i#2 through call [11] call nest2 param-assignment -Propagated nest1::j#2 through call [11] call nest2 param-assignment -Propagated nest1::i#2 through call [11] call nest2 param-assignment -Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@3 - [1] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ] + [2] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ] to:main::@2 main::@2: scope:[main] from main::@1 main::@5 - [2] (byte) main::j#2 ← phi( main::@1/(byte) 100 main::@5/(byte) main::j#1 ) [ main::j#2 main::i#2 ] - [3] call nest1 param-assignment [ main::j#2 main::i#2 ] + [3] (byte) main::j#2 ← phi( main::@1/(byte) 100 main::@5/(byte) main::j#1 ) [ main::i#2 main::j#2 ] + [4] call nest1 param-assignment [ main::i#2 main::j#2 ] to:main::@5 main::@5: scope:[main] from main::@2 - [4] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 main::i#2 ] - [5] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::j#1 main::i#2 ] + [5] (byte) main::j#1 ← -- (byte) main::j#2 [ main::i#2 main::j#1 ] + [6] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::i#2 main::j#1 ] to:main::@3 main::@3: scope:[main] from main::@5 - [6] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] - [7] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] + [7] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] + [8] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@3 - [8] return [ ] + [9] return [ ] to:@return nest1: scope:[nest1] from main::@2 + [10] phi() [ ] to:nest1::@1 nest1::@1: scope:[nest1] from nest1 nest1::@3 - [9] (byte) nest1::i#2 ← phi( nest1/(byte) 100 nest1::@3/(byte) nest1::i#1 ) [ main::j#2 main::i#2 nest1::i#2 ] + [11] (byte) nest1::i#2 ← phi( nest1/(byte) 100 nest1::@3/(byte) nest1::i#1 ) [ nest1::i#2 ] to:nest1::@2 nest1::@2: scope:[nest1] from nest1::@1 nest1::@5 - [10] (byte) nest1::j#2 ← phi( nest1::@1/(byte) 100 nest1::@5/(byte) nest1::j#1 ) [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] - [11] call nest2 param-assignment [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + [12] (byte) nest1::j#2 ← phi( nest1::@1/(byte) 100 nest1::@5/(byte) nest1::j#1 ) [ nest1::i#2 nest1::j#2 ] + [13] call nest2 param-assignment [ nest1::i#2 nest1::j#2 ] to:nest1::@5 nest1::@5: scope:[nest1] from nest1::@2 - [12] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] - [13] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] + [14] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ nest1::i#2 nest1::j#1 ] + [15] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ nest1::i#2 nest1::j#1 ] to:nest1::@3 nest1::@3: scope:[nest1] from nest1::@5 - [14] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ main::j#2 main::i#2 nest1::i#1 ] - [15] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ main::j#2 main::i#2 nest1::i#1 ] + [16] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ nest1::i#1 ] + [17] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ nest1::i#1 ] to:nest1::@return nest1::@return: scope:[nest1] from nest1::@3 - [16] return [ main::j#2 main::i#2 ] + [18] return [ ] to:@return nest2: scope:[nest2] from nest1::@2 + [19] phi() [ ] to:nest2::@1 nest2::@1: scope:[nest2] from nest2 nest2::@3 - [17] (byte) nest2::i#2 ← phi( nest2/(byte) 100 nest2::@3/(byte) nest2::i#1 ) [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#2 ] + [20] (byte) nest2::i#2 ← phi( nest2/(byte) 100 nest2::@3/(byte) nest2::i#1 ) [ nest2::i#2 ] to:nest2::@2 nest2::@2: scope:[nest2] from nest2::@1 nest2::@2 - [18] (byte) nest2::j#2 ← phi( nest2::@1/(byte) 100 nest2::@2/(byte) nest2::j#1 ) [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] - [19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] - [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] - [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] + [21] (byte) nest2::j#2 ← phi( nest2::@1/(byte) 100 nest2::@2/(byte) nest2::j#1 ) [ nest2::i#2 nest2::j#2 ] + [22] *((word) 1024) ← (byte) nest2::j#2 [ nest2::i#2 nest2::j#2 ] + [23] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ nest2::i#2 nest2::j#1 ] + [24] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ nest2::i#2 nest2::j#1 ] to:nest2::@3 nest2::@3: scope:[nest2] from nest2::@2 - [22] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] - [23] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] + [25] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ nest2::i#1 ] + [26] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ nest2::i#1 ] to:nest2::@return nest2::@return: scope:[nest2] from nest2::@3 - [24] return [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + [27] return [ ] to:@return -CALL GRAPH -Calls in [] to 0:main -Calls in [main] to 3:nest1 -Calls in [nest1] to 11:nest2 - DOMINATORS @begin dominated by @begin @end dominated by @end @begin @@ -2007,17 +1909,17 @@ VARIABLE REGISTER WEIGHTS (void()) main() (byte) main::i (byte) main::i#1 16.5 -(byte) main::i#2 1.0476190476190477 +(byte) main::i#2 4.4 (byte) main::j (byte) main::j#1 151.5 -(byte) main::j#2 11.222222222222221 +(byte) main::j#2 101.0 (void()) nest1() (byte) nest1::i (byte) nest1::i#1 1501.5 -(byte) nest1::i#2 154.0 +(byte) nest1::i#2 400.4 (byte) nest1::j (byte) nest1::j#1 15001.5 -(byte) nest1::j#2 2000.2 +(byte) nest1::j#2 10001.0 (void()) nest2() (byte) nest2::i (byte) nest2::i#1 150001.5 @@ -2051,162 +1953,168 @@ INITIAL ASM //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main jmp bend -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { .label j = 3 .label i = 2 - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i jmp b1 - //SEG7 [1] phi from main::@3 to main::@1 + //SEG8 [2] phi from main::@3 to main::@1 b1_from_b3: - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 - //SEG9 main::@1 + //SEG10 main::@1 b1: - //SEG10 [2] phi from main::@1 to main::@2 + //SEG11 [3] phi from main::@1 to main::@2 b2_from_b1: - //SEG11 [2] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 + //SEG12 [3] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta j jmp b2 - //SEG12 [2] phi from main::@5 to main::@2 + //SEG13 [3] phi from main::@5 to main::@2 b2_from_b5: - //SEG13 [2] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy + //SEG14 [3] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy jmp b2 - //SEG14 main::@2 + //SEG15 main::@2 b2: - //SEG15 [3] call nest1 param-assignment [ main::j#2 main::i#2 ] + //SEG16 [4] call nest1 param-assignment [ main::i#2 main::j#2 ] + //SEG17 [10] phi from main::@2 to nest1 + nest1_from_b2: jsr nest1 jmp b5 - //SEG16 main::@5 + //SEG18 main::@5 b5: - //SEG17 [4] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 main::i#2 ] -- zpby1=_dec_zpby1 + //SEG19 [5] (byte) main::j#1 ← -- (byte) main::j#2 [ main::i#2 main::j#1 ] -- zpby1=_dec_zpby1 dec j - //SEG18 [5] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::j#1 main::i#2 ] -- zpby1_gt_0_then_la1 + //SEG20 [6] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::i#2 main::j#1 ] -- zpby1_gt_0_then_la1 lda j bne b2_from_b5 jmp b3 - //SEG19 main::@3 + //SEG21 main::@3 b3: - //SEG20 [6] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 + //SEG22 [7] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG21 [7] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 + //SEG23 [8] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1_from_b3 jmp breturn - //SEG22 main::@return + //SEG24 main::@return breturn: - //SEG23 [8] return [ ] + //SEG25 [9] return [ ] rts } -//SEG24 nest1 +//SEG26 nest1 nest1: { .label j = 5 .label i = 4 - //SEG25 [9] phi from nest1 to nest1::@1 + //SEG27 [11] phi from nest1 to nest1::@1 b1_from_nest1: - //SEG26 [9] phi (byte) nest1::i#2 = (byte) 100 -- zpby1=coby1 + //SEG28 [11] phi (byte) nest1::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i jmp b1 - //SEG27 [9] phi from nest1::@3 to nest1::@1 + //SEG29 [11] phi from nest1::@3 to nest1::@1 b1_from_b3: - //SEG28 [9] phi (byte) nest1::i#2 = (byte) nest1::i#1 -- register_copy + //SEG30 [11] phi (byte) nest1::i#2 = (byte) nest1::i#1 -- register_copy jmp b1 - //SEG29 nest1::@1 + //SEG31 nest1::@1 b1: - //SEG30 [10] phi from nest1::@1 to nest1::@2 + //SEG32 [12] phi from nest1::@1 to nest1::@2 b2_from_b1: - //SEG31 [10] phi (byte) nest1::j#2 = (byte) 100 -- zpby1=coby1 + //SEG33 [12] phi (byte) nest1::j#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta j jmp b2 - //SEG32 [10] phi from nest1::@5 to nest1::@2 + //SEG34 [12] phi from nest1::@5 to nest1::@2 b2_from_b5: - //SEG33 [10] phi (byte) nest1::j#2 = (byte) nest1::j#1 -- register_copy + //SEG35 [12] phi (byte) nest1::j#2 = (byte) nest1::j#1 -- register_copy jmp b2 - //SEG34 nest1::@2 + //SEG36 nest1::@2 b2: - //SEG35 [11] call nest2 param-assignment [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + //SEG37 [13] call nest2 param-assignment [ nest1::i#2 nest1::j#2 ] + //SEG38 [19] phi from nest1::@2 to nest2 + nest2_from_b2: jsr nest2 jmp b5 - //SEG36 nest1::@5 + //SEG39 nest1::@5 b5: - //SEG37 [12] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] -- zpby1=_dec_zpby1 + //SEG40 [14] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ nest1::i#2 nest1::j#1 ] -- zpby1=_dec_zpby1 dec j - //SEG38 [13] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] -- zpby1_gt_0_then_la1 + //SEG41 [15] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ nest1::i#2 nest1::j#1 ] -- zpby1_gt_0_then_la1 lda j bne b2_from_b5 jmp b3 - //SEG39 nest1::@3 + //SEG42 nest1::@3 b3: - //SEG40 [14] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ main::j#2 main::i#2 nest1::i#1 ] -- zpby1=_dec_zpby1 + //SEG43 [16] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ nest1::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG41 [15] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ main::j#2 main::i#2 nest1::i#1 ] -- zpby1_gt_0_then_la1 + //SEG44 [17] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ nest1::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1_from_b3 jmp breturn - //SEG42 nest1::@return + //SEG45 nest1::@return breturn: - //SEG43 [16] return [ main::j#2 main::i#2 ] + //SEG46 [18] return [ ] rts } -//SEG44 nest2 +//SEG47 nest2 nest2: { .label j = 7 .label i = 6 - //SEG45 [17] phi from nest2 to nest2::@1 + //SEG48 [20] phi from nest2 to nest2::@1 b1_from_nest2: - //SEG46 [17] phi (byte) nest2::i#2 = (byte) 100 -- zpby1=coby1 + //SEG49 [20] phi (byte) nest2::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i jmp b1 - //SEG47 [17] phi from nest2::@3 to nest2::@1 + //SEG50 [20] phi from nest2::@3 to nest2::@1 b1_from_b3: - //SEG48 [17] phi (byte) nest2::i#2 = (byte) nest2::i#1 -- register_copy + //SEG51 [20] phi (byte) nest2::i#2 = (byte) nest2::i#1 -- register_copy jmp b1 - //SEG49 nest2::@1 + //SEG52 nest2::@1 b1: - //SEG50 [18] phi from nest2::@1 to nest2::@2 + //SEG53 [21] phi from nest2::@1 to nest2::@2 b2_from_b1: - //SEG51 [18] phi (byte) nest2::j#2 = (byte) 100 -- zpby1=coby1 + //SEG54 [21] phi (byte) nest2::j#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta j jmp b2 - //SEG52 [18] phi from nest2::@2 to nest2::@2 + //SEG55 [21] phi from nest2::@2 to nest2::@2 b2_from_b2: - //SEG53 [18] phi (byte) nest2::j#2 = (byte) nest2::j#1 -- register_copy + //SEG56 [21] phi (byte) nest2::j#2 = (byte) nest2::j#1 -- register_copy jmp b2 - //SEG54 nest2::@2 + //SEG57 nest2::@2 b2: - //SEG55 [19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] -- _star_cowo1=zpby1 + //SEG58 [22] *((word) 1024) ← (byte) nest2::j#2 [ nest2::i#2 nest2::j#2 ] -- _star_cowo1=zpby1 lda j sta $400 - //SEG56 [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] -- zpby1=_dec_zpby1 + //SEG59 [23] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ nest2::i#2 nest2::j#1 ] -- zpby1=_dec_zpby1 dec j - //SEG57 [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] -- zpby1_gt_0_then_la1 + //SEG60 [24] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ nest2::i#2 nest2::j#1 ] -- zpby1_gt_0_then_la1 lda j bne b2_from_b2 jmp b3 - //SEG58 nest2::@3 + //SEG61 nest2::@3 b3: - //SEG59 [22] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] -- zpby1=_dec_zpby1 + //SEG62 [25] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ nest2::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG60 [23] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] -- zpby1_gt_0_then_la1 + //SEG63 [26] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ nest2::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1_from_b3 jmp breturn - //SEG61 nest2::@return + //SEG64 nest2::@return breturn: - //SEG62 [24] return [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + //SEG65 [27] return [ ] rts } @@ -2220,14 +2128,20 @@ Potential registers zp ZP_BYTE:7 [ nest2::j#2 nest2::j#1 ] : zp ZP_BYTE:7 , reg REGISTER UPLIFT SCOPES Uplift Scope [nest2] 3,000,003: zp ZP_BYTE:7 [ nest2::j#2 nest2::j#1 ] 190,001.9: zp ZP_BYTE:6 [ nest2::i#2 nest2::i#1 ] -Uplift Scope [nest1] 17,001.7: zp ZP_BYTE:5 [ nest1::j#2 nest1::j#1 ] 1,655.5: zp ZP_BYTE:4 [ nest1::i#2 nest1::i#1 ] -Uplift Scope [main] 162.72: zp ZP_BYTE:3 [ main::j#2 main::j#1 ] 17.55: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] +Uplift Scope [nest1] 25,002.5: zp ZP_BYTE:5 [ nest1::j#2 nest1::j#1 ] 1,901.9: zp ZP_BYTE:4 [ nest1::i#2 nest1::i#1 ] +Uplift Scope [main] 252.5: zp ZP_BYTE:3 [ main::j#2 main::j#1 ] 20.9: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] Uplift Scope [] -Uplifting [nest2] best 23613122 combination reg byte y [ nest2::j#2 nest2::j#1 ] reg byte x [ nest2::i#2 nest2::i#1 ] -Uplifting [nest1] best 23563122 combination reg byte a [ nest1::j#2 nest1::j#1 ] zp ZP_BYTE:4 [ nest1::i#2 nest1::i#1 ] -Uplifting [main] best 23563122 combination zp ZP_BYTE:3 [ main::j#2 main::j#1 ] zp ZP_BYTE:2 [ main::i#2 main::i#1 ] -Uplifting [] best 23563122 combination +Uplifting [nest2] best 23522240 combination reg byte y [ nest2::j#2 nest2::j#1 ] reg byte x [ nest2::i#2 nest2::i#1 ] +Uplifting [nest1] best 23472240 combination reg byte a [ nest1::j#2 nest1::j#1 ] zp ZP_BYTE:4 [ nest1::i#2 nest1::i#1 ] +Uplifting [main] best 23472240 combination zp ZP_BYTE:3 [ main::j#2 main::j#1 ] zp ZP_BYTE:2 [ main::i#2 main::i#1 ] +Uplifting [] best 23472240 combination +Attempting to uplift remaining variables inzp ZP_BYTE:4 [ nest1::i#2 nest1::i#1 ] +Uplifting [nest1] best 23472240 combination zp ZP_BYTE:4 [ nest1::i#2 nest1::i#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:3 [ main::j#2 main::j#1 ] +Uplifting [main] best 23472240 combination zp ZP_BYTE:3 [ main::j#2 main::j#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::i#2 main::i#1 ] +Uplifting [main] best 23472240 combination zp ZP_BYTE:2 [ main::i#2 main::i#1 ] Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp b2 @@ -2249,141 +2163,147 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { .label j = 3 .label i = 2 - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i jmp b1 - //SEG7 [1] phi from main::@3 to main::@1 + //SEG8 [2] phi from main::@3 to main::@1 b1_from_b3: - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] phi from main::@1 to main::@2 + //SEG11 [3] phi from main::@1 to main::@2 b2_from_b1: - //SEG11 [2] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 + //SEG12 [3] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta j jmp b2 - //SEG12 [2] phi from main::@5 to main::@2 + //SEG13 [3] phi from main::@5 to main::@2 b2_from_b5: - //SEG13 [2] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy - //SEG14 main::@2 + //SEG14 [3] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy + //SEG15 main::@2 b2: - //SEG15 [3] call nest1 param-assignment [ main::j#2 main::i#2 ] + //SEG16 [4] call nest1 param-assignment [ main::i#2 main::j#2 ] + //SEG17 [10] phi from main::@2 to nest1 + nest1_from_b2: jsr nest1 - //SEG16 main::@5 + //SEG18 main::@5 b5: - //SEG17 [4] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 main::i#2 ] -- zpby1=_dec_zpby1 + //SEG19 [5] (byte) main::j#1 ← -- (byte) main::j#2 [ main::i#2 main::j#1 ] -- zpby1=_dec_zpby1 dec j - //SEG18 [5] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::j#1 main::i#2 ] -- zpby1_gt_0_then_la1 + //SEG20 [6] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::i#2 main::j#1 ] -- zpby1_gt_0_then_la1 lda j bne b2_from_b5 - //SEG19 main::@3 + //SEG21 main::@3 b3: - //SEG20 [6] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 + //SEG22 [7] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG21 [7] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 + //SEG23 [8] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1_from_b3 - //SEG22 main::@return + //SEG24 main::@return breturn: - //SEG23 [8] return [ ] + //SEG25 [9] return [ ] rts } -//SEG24 nest1 +//SEG26 nest1 nest1: { .label i = 4 - //SEG25 [9] phi from nest1 to nest1::@1 + //SEG27 [11] phi from nest1 to nest1::@1 b1_from_nest1: - //SEG26 [9] phi (byte) nest1::i#2 = (byte) 100 -- zpby1=coby1 + //SEG28 [11] phi (byte) nest1::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i jmp b1 - //SEG27 [9] phi from nest1::@3 to nest1::@1 + //SEG29 [11] phi from nest1::@3 to nest1::@1 b1_from_b3: - //SEG28 [9] phi (byte) nest1::i#2 = (byte) nest1::i#1 -- register_copy - //SEG29 nest1::@1 + //SEG30 [11] phi (byte) nest1::i#2 = (byte) nest1::i#1 -- register_copy + //SEG31 nest1::@1 b1: - //SEG30 [10] phi from nest1::@1 to nest1::@2 + //SEG32 [12] phi from nest1::@1 to nest1::@2 b2_from_b1: - //SEG31 [10] phi (byte) nest1::j#2 = (byte) 100 -- aby=coby1 + //SEG33 [12] phi (byte) nest1::j#2 = (byte) 100 -- aby=coby1 lda #$64 jmp b2 - //SEG32 [10] phi from nest1::@5 to nest1::@2 + //SEG34 [12] phi from nest1::@5 to nest1::@2 b2_from_b5: - //SEG33 [10] phi (byte) nest1::j#2 = (byte) nest1::j#1 -- register_copy - //SEG34 nest1::@2 + //SEG35 [12] phi (byte) nest1::j#2 = (byte) nest1::j#1 -- register_copy + //SEG36 nest1::@2 b2: - //SEG35 [11] call nest2 param-assignment [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + //SEG37 [13] call nest2 param-assignment [ nest1::i#2 nest1::j#2 ] + //SEG38 [19] phi from nest1::@2 to nest2 + nest2_from_b2: jsr nest2 - //SEG36 nest1::@5 + //SEG39 nest1::@5 b5: - //SEG37 [12] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] -- aby=_dec_aby + //SEG40 [14] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ nest1::i#2 nest1::j#1 ] -- aby=_dec_aby sec sbc #$1 - //SEG38 [13] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] -- aby_gt_0_then_la1 + //SEG41 [15] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ nest1::i#2 nest1::j#1 ] -- aby_gt_0_then_la1 cmp #$0 bne b2_from_b5 - //SEG39 nest1::@3 + //SEG42 nest1::@3 b3: - //SEG40 [14] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ main::j#2 main::i#2 nest1::i#1 ] -- zpby1=_dec_zpby1 + //SEG43 [16] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ nest1::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG41 [15] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ main::j#2 main::i#2 nest1::i#1 ] -- zpby1_gt_0_then_la1 + //SEG44 [17] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ nest1::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1_from_b3 - //SEG42 nest1::@return + //SEG45 nest1::@return breturn: - //SEG43 [16] return [ main::j#2 main::i#2 ] + //SEG46 [18] return [ ] rts } -//SEG44 nest2 +//SEG47 nest2 nest2: { - //SEG45 [17] phi from nest2 to nest2::@1 + //SEG48 [20] phi from nest2 to nest2::@1 b1_from_nest2: - //SEG46 [17] phi (byte) nest2::i#2 = (byte) 100 -- xby=coby1 + //SEG49 [20] phi (byte) nest2::i#2 = (byte) 100 -- xby=coby1 ldx #$64 jmp b1 - //SEG47 [17] phi from nest2::@3 to nest2::@1 + //SEG50 [20] phi from nest2::@3 to nest2::@1 b1_from_b3: - //SEG48 [17] phi (byte) nest2::i#2 = (byte) nest2::i#1 -- register_copy - //SEG49 nest2::@1 + //SEG51 [20] phi (byte) nest2::i#2 = (byte) nest2::i#1 -- register_copy + //SEG52 nest2::@1 b1: - //SEG50 [18] phi from nest2::@1 to nest2::@2 + //SEG53 [21] phi from nest2::@1 to nest2::@2 b2_from_b1: - //SEG51 [18] phi (byte) nest2::j#2 = (byte) 100 -- yby=coby1 + //SEG54 [21] phi (byte) nest2::j#2 = (byte) 100 -- yby=coby1 ldy #$64 jmp b2 - //SEG52 [18] phi from nest2::@2 to nest2::@2 + //SEG55 [21] phi from nest2::@2 to nest2::@2 b2_from_b2: - //SEG53 [18] phi (byte) nest2::j#2 = (byte) nest2::j#1 -- register_copy - //SEG54 nest2::@2 + //SEG56 [21] phi (byte) nest2::j#2 = (byte) nest2::j#1 -- register_copy + //SEG57 nest2::@2 b2: - //SEG55 [19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] -- _star_cowo1=yby + //SEG58 [22] *((word) 1024) ← (byte) nest2::j#2 [ nest2::i#2 nest2::j#2 ] -- _star_cowo1=yby sty $400 - //SEG56 [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] -- yby=_dec_yby + //SEG59 [23] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ nest2::i#2 nest2::j#1 ] -- yby=_dec_yby dey - //SEG57 [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] -- yby_gt_0_then_la1 + //SEG60 [24] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ nest2::i#2 nest2::j#1 ] -- yby_gt_0_then_la1 cpy #$0 bne b2_from_b2 - //SEG58 nest2::@3 + //SEG61 nest2::@3 b3: - //SEG59 [22] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] -- xby=_dec_xby + //SEG62 [25] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ nest2::i#1 ] -- xby=_dec_xby dex - //SEG60 [23] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] -- xby_gt_0_then_la1 + //SEG63 [26] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ nest2::i#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b1_from_b3 - //SEG61 nest2::@return + //SEG64 nest2::@return breturn: - //SEG62 [24] return [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + //SEG65 [27] return [ ] rts } @@ -2393,12 +2313,15 @@ Replacing label b2_from_b5 with b2 Replacing label b1_from_b3 with b1 Replacing label b2_from_b2 with b2 Replacing label b1_from_b3 with b1 +Removing instruction main_from_bbegin: Removing instruction b1_from_b3: Removing instruction b2_from_b1: Removing instruction b2_from_b5: +Removing instruction nest1_from_b2: Removing instruction b1_from_b3: Removing instruction b2_from_b1: Removing instruction b2_from_b5: +Removing instruction nest2_from_b2: Removing instruction b1_from_b3: Removing instruction b2_from_b1: Removing instruction b2_from_b2: @@ -2408,132 +2331,135 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { .label j = 3 .label i = 2 - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i jmp b1 - //SEG7 [1] phi from main::@3 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@3 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] phi from main::@1 to main::@2 - //SEG11 [2] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 + //SEG11 [3] phi from main::@1 to main::@2 + //SEG12 [3] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta j jmp b2 - //SEG12 [2] phi from main::@5 to main::@2 - //SEG13 [2] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy - //SEG14 main::@2 + //SEG13 [3] phi from main::@5 to main::@2 + //SEG14 [3] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy + //SEG15 main::@2 b2: - //SEG15 [3] call nest1 param-assignment [ main::j#2 main::i#2 ] + //SEG16 [4] call nest1 param-assignment [ main::i#2 main::j#2 ] + //SEG17 [10] phi from main::@2 to nest1 jsr nest1 - //SEG16 main::@5 + //SEG18 main::@5 b5: - //SEG17 [4] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 main::i#2 ] -- zpby1=_dec_zpby1 + //SEG19 [5] (byte) main::j#1 ← -- (byte) main::j#2 [ main::i#2 main::j#1 ] -- zpby1=_dec_zpby1 dec j - //SEG18 [5] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::j#1 main::i#2 ] -- zpby1_gt_0_then_la1 + //SEG20 [6] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::i#2 main::j#1 ] -- zpby1_gt_0_then_la1 lda j bne b2 - //SEG19 main::@3 + //SEG21 main::@3 b3: - //SEG20 [6] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 + //SEG22 [7] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG21 [7] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 + //SEG23 [8] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1 - //SEG22 main::@return + //SEG24 main::@return breturn: - //SEG23 [8] return [ ] + //SEG25 [9] return [ ] rts } -//SEG24 nest1 +//SEG26 nest1 nest1: { .label i = 4 - //SEG25 [9] phi from nest1 to nest1::@1 + //SEG27 [11] phi from nest1 to nest1::@1 b1_from_nest1: - //SEG26 [9] phi (byte) nest1::i#2 = (byte) 100 -- zpby1=coby1 + //SEG28 [11] phi (byte) nest1::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i jmp b1 - //SEG27 [9] phi from nest1::@3 to nest1::@1 - //SEG28 [9] phi (byte) nest1::i#2 = (byte) nest1::i#1 -- register_copy - //SEG29 nest1::@1 + //SEG29 [11] phi from nest1::@3 to nest1::@1 + //SEG30 [11] phi (byte) nest1::i#2 = (byte) nest1::i#1 -- register_copy + //SEG31 nest1::@1 b1: - //SEG30 [10] phi from nest1::@1 to nest1::@2 - //SEG31 [10] phi (byte) nest1::j#2 = (byte) 100 -- aby=coby1 + //SEG32 [12] phi from nest1::@1 to nest1::@2 + //SEG33 [12] phi (byte) nest1::j#2 = (byte) 100 -- aby=coby1 lda #$64 jmp b2 - //SEG32 [10] phi from nest1::@5 to nest1::@2 - //SEG33 [10] phi (byte) nest1::j#2 = (byte) nest1::j#1 -- register_copy - //SEG34 nest1::@2 + //SEG34 [12] phi from nest1::@5 to nest1::@2 + //SEG35 [12] phi (byte) nest1::j#2 = (byte) nest1::j#1 -- register_copy + //SEG36 nest1::@2 b2: - //SEG35 [11] call nest2 param-assignment [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + //SEG37 [13] call nest2 param-assignment [ nest1::i#2 nest1::j#2 ] + //SEG38 [19] phi from nest1::@2 to nest2 jsr nest2 - //SEG36 nest1::@5 + //SEG39 nest1::@5 b5: - //SEG37 [12] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] -- aby=_dec_aby + //SEG40 [14] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ nest1::i#2 nest1::j#1 ] -- aby=_dec_aby sec sbc #$1 - //SEG38 [13] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] -- aby_gt_0_then_la1 + //SEG41 [15] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ nest1::i#2 nest1::j#1 ] -- aby_gt_0_then_la1 cmp #$0 bne b2 - //SEG39 nest1::@3 + //SEG42 nest1::@3 b3: - //SEG40 [14] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ main::j#2 main::i#2 nest1::i#1 ] -- zpby1=_dec_zpby1 + //SEG43 [16] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ nest1::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG41 [15] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ main::j#2 main::i#2 nest1::i#1 ] -- zpby1_gt_0_then_la1 + //SEG44 [17] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ nest1::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1 - //SEG42 nest1::@return + //SEG45 nest1::@return breturn: - //SEG43 [16] return [ main::j#2 main::i#2 ] + //SEG46 [18] return [ ] rts } -//SEG44 nest2 +//SEG47 nest2 nest2: { - //SEG45 [17] phi from nest2 to nest2::@1 + //SEG48 [20] phi from nest2 to nest2::@1 b1_from_nest2: - //SEG46 [17] phi (byte) nest2::i#2 = (byte) 100 -- xby=coby1 + //SEG49 [20] phi (byte) nest2::i#2 = (byte) 100 -- xby=coby1 ldx #$64 jmp b1 - //SEG47 [17] phi from nest2::@3 to nest2::@1 - //SEG48 [17] phi (byte) nest2::i#2 = (byte) nest2::i#1 -- register_copy - //SEG49 nest2::@1 + //SEG50 [20] phi from nest2::@3 to nest2::@1 + //SEG51 [20] phi (byte) nest2::i#2 = (byte) nest2::i#1 -- register_copy + //SEG52 nest2::@1 b1: - //SEG50 [18] phi from nest2::@1 to nest2::@2 - //SEG51 [18] phi (byte) nest2::j#2 = (byte) 100 -- yby=coby1 + //SEG53 [21] phi from nest2::@1 to nest2::@2 + //SEG54 [21] phi (byte) nest2::j#2 = (byte) 100 -- yby=coby1 ldy #$64 jmp b2 - //SEG52 [18] phi from nest2::@2 to nest2::@2 - //SEG53 [18] phi (byte) nest2::j#2 = (byte) nest2::j#1 -- register_copy - //SEG54 nest2::@2 + //SEG55 [21] phi from nest2::@2 to nest2::@2 + //SEG56 [21] phi (byte) nest2::j#2 = (byte) nest2::j#1 -- register_copy + //SEG57 nest2::@2 b2: - //SEG55 [19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] -- _star_cowo1=yby + //SEG58 [22] *((word) 1024) ← (byte) nest2::j#2 [ nest2::i#2 nest2::j#2 ] -- _star_cowo1=yby sty $400 - //SEG56 [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] -- yby=_dec_yby + //SEG59 [23] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ nest2::i#2 nest2::j#1 ] -- yby=_dec_yby dey - //SEG57 [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] -- yby_gt_0_then_la1 + //SEG60 [24] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ nest2::i#2 nest2::j#1 ] -- yby_gt_0_then_la1 cpy #$0 bne b2 - //SEG58 nest2::@3 + //SEG61 nest2::@3 b3: - //SEG59 [22] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] -- xby=_dec_xby + //SEG62 [25] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ nest2::i#1 ] -- xby=_dec_xby dex - //SEG60 [23] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] -- xby_gt_0_then_la1 + //SEG63 [26] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ nest2::i#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b1 - //SEG61 nest2::@return + //SEG64 nest2::@return breturn: - //SEG62 [24] return [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + //SEG65 [27] return [ ] rts } @@ -2555,120 +2481,123 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { .label j = 3 .label i = 2 - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i jmp b1 - //SEG7 [1] phi from main::@3 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@3 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] phi from main::@1 to main::@2 - //SEG11 [2] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 + //SEG11 [3] phi from main::@1 to main::@2 + //SEG12 [3] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta j jmp b2 - //SEG12 [2] phi from main::@5 to main::@2 - //SEG13 [2] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy - //SEG14 main::@2 + //SEG13 [3] phi from main::@5 to main::@2 + //SEG14 [3] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy + //SEG15 main::@2 b2: - //SEG15 [3] call nest1 param-assignment [ main::j#2 main::i#2 ] + //SEG16 [4] call nest1 param-assignment [ main::i#2 main::j#2 ] + //SEG17 [10] phi from main::@2 to nest1 jsr nest1 - //SEG16 main::@5 - //SEG17 [4] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 main::i#2 ] -- zpby1=_dec_zpby1 + //SEG18 main::@5 + //SEG19 [5] (byte) main::j#1 ← -- (byte) main::j#2 [ main::i#2 main::j#1 ] -- zpby1=_dec_zpby1 dec j - //SEG18 [5] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::j#1 main::i#2 ] -- zpby1_gt_0_then_la1 + //SEG20 [6] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::i#2 main::j#1 ] -- zpby1_gt_0_then_la1 lda j bne b2 - //SEG19 main::@3 - //SEG20 [6] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 + //SEG21 main::@3 + //SEG22 [7] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG21 [7] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 + //SEG23 [8] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1 - //SEG22 main::@return - //SEG23 [8] return [ ] + //SEG24 main::@return + //SEG25 [9] return [ ] rts } -//SEG24 nest1 +//SEG26 nest1 nest1: { .label i = 4 - //SEG25 [9] phi from nest1 to nest1::@1 - //SEG26 [9] phi (byte) nest1::i#2 = (byte) 100 -- zpby1=coby1 + //SEG27 [11] phi from nest1 to nest1::@1 + //SEG28 [11] phi (byte) nest1::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i jmp b1 - //SEG27 [9] phi from nest1::@3 to nest1::@1 - //SEG28 [9] phi (byte) nest1::i#2 = (byte) nest1::i#1 -- register_copy - //SEG29 nest1::@1 + //SEG29 [11] phi from nest1::@3 to nest1::@1 + //SEG30 [11] phi (byte) nest1::i#2 = (byte) nest1::i#1 -- register_copy + //SEG31 nest1::@1 b1: - //SEG30 [10] phi from nest1::@1 to nest1::@2 - //SEG31 [10] phi (byte) nest1::j#2 = (byte) 100 -- aby=coby1 + //SEG32 [12] phi from nest1::@1 to nest1::@2 + //SEG33 [12] phi (byte) nest1::j#2 = (byte) 100 -- aby=coby1 lda #$64 jmp b2 - //SEG32 [10] phi from nest1::@5 to nest1::@2 - //SEG33 [10] phi (byte) nest1::j#2 = (byte) nest1::j#1 -- register_copy - //SEG34 nest1::@2 + //SEG34 [12] phi from nest1::@5 to nest1::@2 + //SEG35 [12] phi (byte) nest1::j#2 = (byte) nest1::j#1 -- register_copy + //SEG36 nest1::@2 b2: - //SEG35 [11] call nest2 param-assignment [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + //SEG37 [13] call nest2 param-assignment [ nest1::i#2 nest1::j#2 ] + //SEG38 [19] phi from nest1::@2 to nest2 jsr nest2 - //SEG36 nest1::@5 - //SEG37 [12] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] -- aby=_dec_aby + //SEG39 nest1::@5 + //SEG40 [14] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ nest1::i#2 nest1::j#1 ] -- aby=_dec_aby sec sbc #$1 - //SEG38 [13] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] -- aby_gt_0_then_la1 + //SEG41 [15] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ nest1::i#2 nest1::j#1 ] -- aby_gt_0_then_la1 cmp #$0 bne b2 - //SEG39 nest1::@3 - //SEG40 [14] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ main::j#2 main::i#2 nest1::i#1 ] -- zpby1=_dec_zpby1 + //SEG42 nest1::@3 + //SEG43 [16] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ nest1::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG41 [15] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ main::j#2 main::i#2 nest1::i#1 ] -- zpby1_gt_0_then_la1 + //SEG44 [17] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ nest1::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1 - //SEG42 nest1::@return - //SEG43 [16] return [ main::j#2 main::i#2 ] + //SEG45 nest1::@return + //SEG46 [18] return [ ] rts } -//SEG44 nest2 +//SEG47 nest2 nest2: { - //SEG45 [17] phi from nest2 to nest2::@1 - //SEG46 [17] phi (byte) nest2::i#2 = (byte) 100 -- xby=coby1 + //SEG48 [20] phi from nest2 to nest2::@1 + //SEG49 [20] phi (byte) nest2::i#2 = (byte) 100 -- xby=coby1 ldx #$64 jmp b1 - //SEG47 [17] phi from nest2::@3 to nest2::@1 - //SEG48 [17] phi (byte) nest2::i#2 = (byte) nest2::i#1 -- register_copy - //SEG49 nest2::@1 + //SEG50 [20] phi from nest2::@3 to nest2::@1 + //SEG51 [20] phi (byte) nest2::i#2 = (byte) nest2::i#1 -- register_copy + //SEG52 nest2::@1 b1: - //SEG50 [18] phi from nest2::@1 to nest2::@2 - //SEG51 [18] phi (byte) nest2::j#2 = (byte) 100 -- yby=coby1 + //SEG53 [21] phi from nest2::@1 to nest2::@2 + //SEG54 [21] phi (byte) nest2::j#2 = (byte) 100 -- yby=coby1 ldy #$64 jmp b2 - //SEG52 [18] phi from nest2::@2 to nest2::@2 - //SEG53 [18] phi (byte) nest2::j#2 = (byte) nest2::j#1 -- register_copy - //SEG54 nest2::@2 + //SEG55 [21] phi from nest2::@2 to nest2::@2 + //SEG56 [21] phi (byte) nest2::j#2 = (byte) nest2::j#1 -- register_copy + //SEG57 nest2::@2 b2: - //SEG55 [19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] -- _star_cowo1=yby + //SEG58 [22] *((word) 1024) ← (byte) nest2::j#2 [ nest2::i#2 nest2::j#2 ] -- _star_cowo1=yby sty $400 - //SEG56 [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] -- yby=_dec_yby + //SEG59 [23] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ nest2::i#2 nest2::j#1 ] -- yby=_dec_yby dey - //SEG57 [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] -- yby_gt_0_then_la1 + //SEG60 [24] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ nest2::i#2 nest2::j#1 ] -- yby_gt_0_then_la1 cpy #$0 bne b2 - //SEG58 nest2::@3 - //SEG59 [22] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] -- xby=_dec_xby + //SEG61 nest2::@3 + //SEG62 [25] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ nest2::i#1 ] -- xby=_dec_xby dex - //SEG60 [23] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] -- xby_gt_0_then_la1 + //SEG63 [26] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ nest2::i#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b1 - //SEG61 nest2::@return - //SEG62 [24] return [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + //SEG64 nest2::@return + //SEG65 [27] return [ ] rts } @@ -2683,114 +2612,117 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { .label j = 3 .label i = 2 - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i - //SEG7 [1] phi from main::@3 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@3 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] phi from main::@1 to main::@2 - //SEG11 [2] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 + //SEG11 [3] phi from main::@1 to main::@2 + //SEG12 [3] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta j - //SEG12 [2] phi from main::@5 to main::@2 - //SEG13 [2] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy - //SEG14 main::@2 + //SEG13 [3] phi from main::@5 to main::@2 + //SEG14 [3] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy + //SEG15 main::@2 b2: - //SEG15 [3] call nest1 param-assignment [ main::j#2 main::i#2 ] + //SEG16 [4] call nest1 param-assignment [ main::i#2 main::j#2 ] + //SEG17 [10] phi from main::@2 to nest1 jsr nest1 - //SEG16 main::@5 - //SEG17 [4] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 main::i#2 ] -- zpby1=_dec_zpby1 + //SEG18 main::@5 + //SEG19 [5] (byte) main::j#1 ← -- (byte) main::j#2 [ main::i#2 main::j#1 ] -- zpby1=_dec_zpby1 dec j - //SEG18 [5] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::j#1 main::i#2 ] -- zpby1_gt_0_then_la1 + //SEG20 [6] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::i#2 main::j#1 ] -- zpby1_gt_0_then_la1 lda j bne b2 - //SEG19 main::@3 - //SEG20 [6] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 + //SEG21 main::@3 + //SEG22 [7] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG21 [7] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 + //SEG23 [8] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1 - //SEG22 main::@return - //SEG23 [8] return [ ] + //SEG24 main::@return + //SEG25 [9] return [ ] rts } -//SEG24 nest1 +//SEG26 nest1 nest1: { .label i = 4 - //SEG25 [9] phi from nest1 to nest1::@1 - //SEG26 [9] phi (byte) nest1::i#2 = (byte) 100 -- zpby1=coby1 + //SEG27 [11] phi from nest1 to nest1::@1 + //SEG28 [11] phi (byte) nest1::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i - //SEG27 [9] phi from nest1::@3 to nest1::@1 - //SEG28 [9] phi (byte) nest1::i#2 = (byte) nest1::i#1 -- register_copy - //SEG29 nest1::@1 + //SEG29 [11] phi from nest1::@3 to nest1::@1 + //SEG30 [11] phi (byte) nest1::i#2 = (byte) nest1::i#1 -- register_copy + //SEG31 nest1::@1 b1: - //SEG30 [10] phi from nest1::@1 to nest1::@2 - //SEG31 [10] phi (byte) nest1::j#2 = (byte) 100 -- aby=coby1 + //SEG32 [12] phi from nest1::@1 to nest1::@2 + //SEG33 [12] phi (byte) nest1::j#2 = (byte) 100 -- aby=coby1 lda #$64 - //SEG32 [10] phi from nest1::@5 to nest1::@2 - //SEG33 [10] phi (byte) nest1::j#2 = (byte) nest1::j#1 -- register_copy - //SEG34 nest1::@2 + //SEG34 [12] phi from nest1::@5 to nest1::@2 + //SEG35 [12] phi (byte) nest1::j#2 = (byte) nest1::j#1 -- register_copy + //SEG36 nest1::@2 b2: - //SEG35 [11] call nest2 param-assignment [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + //SEG37 [13] call nest2 param-assignment [ nest1::i#2 nest1::j#2 ] + //SEG38 [19] phi from nest1::@2 to nest2 jsr nest2 - //SEG36 nest1::@5 - //SEG37 [12] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] -- aby=_dec_aby + //SEG39 nest1::@5 + //SEG40 [14] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ nest1::i#2 nest1::j#1 ] -- aby=_dec_aby sec sbc #$1 - //SEG38 [13] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] -- aby_gt_0_then_la1 + //SEG41 [15] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ nest1::i#2 nest1::j#1 ] -- aby_gt_0_then_la1 cmp #$0 bne b2 - //SEG39 nest1::@3 - //SEG40 [14] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ main::j#2 main::i#2 nest1::i#1 ] -- zpby1=_dec_zpby1 + //SEG42 nest1::@3 + //SEG43 [16] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ nest1::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG41 [15] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ main::j#2 main::i#2 nest1::i#1 ] -- zpby1_gt_0_then_la1 + //SEG44 [17] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ nest1::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1 - //SEG42 nest1::@return - //SEG43 [16] return [ main::j#2 main::i#2 ] + //SEG45 nest1::@return + //SEG46 [18] return [ ] rts } -//SEG44 nest2 +//SEG47 nest2 nest2: { - //SEG45 [17] phi from nest2 to nest2::@1 - //SEG46 [17] phi (byte) nest2::i#2 = (byte) 100 -- xby=coby1 + //SEG48 [20] phi from nest2 to nest2::@1 + //SEG49 [20] phi (byte) nest2::i#2 = (byte) 100 -- xby=coby1 ldx #$64 - //SEG47 [17] phi from nest2::@3 to nest2::@1 - //SEG48 [17] phi (byte) nest2::i#2 = (byte) nest2::i#1 -- register_copy - //SEG49 nest2::@1 + //SEG50 [20] phi from nest2::@3 to nest2::@1 + //SEG51 [20] phi (byte) nest2::i#2 = (byte) nest2::i#1 -- register_copy + //SEG52 nest2::@1 b1: - //SEG50 [18] phi from nest2::@1 to nest2::@2 - //SEG51 [18] phi (byte) nest2::j#2 = (byte) 100 -- yby=coby1 + //SEG53 [21] phi from nest2::@1 to nest2::@2 + //SEG54 [21] phi (byte) nest2::j#2 = (byte) 100 -- yby=coby1 ldy #$64 - //SEG52 [18] phi from nest2::@2 to nest2::@2 - //SEG53 [18] phi (byte) nest2::j#2 = (byte) nest2::j#1 -- register_copy - //SEG54 nest2::@2 + //SEG55 [21] phi from nest2::@2 to nest2::@2 + //SEG56 [21] phi (byte) nest2::j#2 = (byte) nest2::j#1 -- register_copy + //SEG57 nest2::@2 b2: - //SEG55 [19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] -- _star_cowo1=yby + //SEG58 [22] *((word) 1024) ← (byte) nest2::j#2 [ nest2::i#2 nest2::j#2 ] -- _star_cowo1=yby sty $400 - //SEG56 [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] -- yby=_dec_yby + //SEG59 [23] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ nest2::i#2 nest2::j#1 ] -- yby=_dec_yby dey - //SEG57 [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] -- yby_gt_0_then_la1 + //SEG60 [24] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ nest2::i#2 nest2::j#1 ] -- yby_gt_0_then_la1 cpy #$0 bne b2 - //SEG58 nest2::@3 - //SEG59 [22] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] -- xby=_dec_xby + //SEG61 nest2::@3 + //SEG62 [25] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ nest2::i#1 ] -- xby=_dec_xby dex - //SEG60 [23] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] -- xby_gt_0_then_la1 + //SEG63 [26] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ nest2::i#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b1 - //SEG61 nest2::@return - //SEG62 [24] return [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + //SEG64 nest2::@return + //SEG65 [27] return [ ] rts } @@ -2806,10 +2738,10 @@ FINAL SYMBOL TABLE (label) main::@return (byte) main::i (byte) main::i#1 i zp ZP_BYTE:2 16.5 -(byte) main::i#2 i zp ZP_BYTE:2 1.0476190476190477 +(byte) main::i#2 i zp ZP_BYTE:2 4.4 (byte) main::j (byte) main::j#1 j zp ZP_BYTE:3 151.5 -(byte) main::j#2 j zp ZP_BYTE:3 11.222222222222221 +(byte) main::j#2 j zp ZP_BYTE:3 101.0 (void()) nest1() (label) nest1::@1 (label) nest1::@2 @@ -2818,10 +2750,10 @@ FINAL SYMBOL TABLE (label) nest1::@return (byte) nest1::i (byte) nest1::i#1 i zp ZP_BYTE:4 1501.5 -(byte) nest1::i#2 i zp ZP_BYTE:4 154.0 +(byte) nest1::i#2 i zp ZP_BYTE:4 400.4 (byte) nest1::j (byte) nest1::j#1 reg byte a 15001.5 -(byte) nest1::j#2 reg byte a 2000.2 +(byte) nest1::j#2 reg byte a 10001.0 (void()) nest2() (label) nest2::@1 (label) nest2::@2 @@ -2845,114 +2777,117 @@ FINAL CODE //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { .label j = 3 .label i = 2 - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i - //SEG7 [1] phi from main::@3 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@3 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] phi from main::@1 to main::@2 - //SEG11 [2] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 + //SEG11 [3] phi from main::@1 to main::@2 + //SEG12 [3] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta j - //SEG12 [2] phi from main::@5 to main::@2 - //SEG13 [2] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy - //SEG14 main::@2 + //SEG13 [3] phi from main::@5 to main::@2 + //SEG14 [3] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy + //SEG15 main::@2 b2: - //SEG15 [3] call nest1 param-assignment [ main::j#2 main::i#2 ] + //SEG16 [4] call nest1 param-assignment [ main::i#2 main::j#2 ] + //SEG17 [10] phi from main::@2 to nest1 jsr nest1 - //SEG16 main::@5 - //SEG17 [4] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 main::i#2 ] -- zpby1=_dec_zpby1 + //SEG18 main::@5 + //SEG19 [5] (byte) main::j#1 ← -- (byte) main::j#2 [ main::i#2 main::j#1 ] -- zpby1=_dec_zpby1 dec j - //SEG18 [5] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::j#1 main::i#2 ] -- zpby1_gt_0_then_la1 + //SEG20 [6] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::i#2 main::j#1 ] -- zpby1_gt_0_then_la1 lda j bne b2 - //SEG19 main::@3 - //SEG20 [6] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 + //SEG21 main::@3 + //SEG22 [7] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG21 [7] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 + //SEG23 [8] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1 - //SEG22 main::@return - //SEG23 [8] return [ ] + //SEG24 main::@return + //SEG25 [9] return [ ] rts } -//SEG24 nest1 +//SEG26 nest1 nest1: { .label i = 4 - //SEG25 [9] phi from nest1 to nest1::@1 - //SEG26 [9] phi (byte) nest1::i#2 = (byte) 100 -- zpby1=coby1 + //SEG27 [11] phi from nest1 to nest1::@1 + //SEG28 [11] phi (byte) nest1::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i - //SEG27 [9] phi from nest1::@3 to nest1::@1 - //SEG28 [9] phi (byte) nest1::i#2 = (byte) nest1::i#1 -- register_copy - //SEG29 nest1::@1 + //SEG29 [11] phi from nest1::@3 to nest1::@1 + //SEG30 [11] phi (byte) nest1::i#2 = (byte) nest1::i#1 -- register_copy + //SEG31 nest1::@1 b1: - //SEG30 [10] phi from nest1::@1 to nest1::@2 - //SEG31 [10] phi (byte) nest1::j#2 = (byte) 100 -- aby=coby1 + //SEG32 [12] phi from nest1::@1 to nest1::@2 + //SEG33 [12] phi (byte) nest1::j#2 = (byte) 100 -- aby=coby1 lda #$64 - //SEG32 [10] phi from nest1::@5 to nest1::@2 - //SEG33 [10] phi (byte) nest1::j#2 = (byte) nest1::j#1 -- register_copy - //SEG34 nest1::@2 + //SEG34 [12] phi from nest1::@5 to nest1::@2 + //SEG35 [12] phi (byte) nest1::j#2 = (byte) nest1::j#1 -- register_copy + //SEG36 nest1::@2 b2: - //SEG35 [11] call nest2 param-assignment [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + //SEG37 [13] call nest2 param-assignment [ nest1::i#2 nest1::j#2 ] + //SEG38 [19] phi from nest1::@2 to nest2 jsr nest2 - //SEG36 nest1::@5 - //SEG37 [12] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] -- aby=_dec_aby + //SEG39 nest1::@5 + //SEG40 [14] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ nest1::i#2 nest1::j#1 ] -- aby=_dec_aby sec sbc #$1 - //SEG38 [13] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ] -- aby_gt_0_then_la1 + //SEG41 [15] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ nest1::i#2 nest1::j#1 ] -- aby_gt_0_then_la1 cmp #$0 bne b2 - //SEG39 nest1::@3 - //SEG40 [14] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ main::j#2 main::i#2 nest1::i#1 ] -- zpby1=_dec_zpby1 + //SEG42 nest1::@3 + //SEG43 [16] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ nest1::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG41 [15] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ main::j#2 main::i#2 nest1::i#1 ] -- zpby1_gt_0_then_la1 + //SEG44 [17] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ nest1::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b1 - //SEG42 nest1::@return - //SEG43 [16] return [ main::j#2 main::i#2 ] + //SEG45 nest1::@return + //SEG46 [18] return [ ] rts } -//SEG44 nest2 +//SEG47 nest2 nest2: { - //SEG45 [17] phi from nest2 to nest2::@1 - //SEG46 [17] phi (byte) nest2::i#2 = (byte) 100 -- xby=coby1 + //SEG48 [20] phi from nest2 to nest2::@1 + //SEG49 [20] phi (byte) nest2::i#2 = (byte) 100 -- xby=coby1 ldx #$64 - //SEG47 [17] phi from nest2::@3 to nest2::@1 - //SEG48 [17] phi (byte) nest2::i#2 = (byte) nest2::i#1 -- register_copy - //SEG49 nest2::@1 + //SEG50 [20] phi from nest2::@3 to nest2::@1 + //SEG51 [20] phi (byte) nest2::i#2 = (byte) nest2::i#1 -- register_copy + //SEG52 nest2::@1 b1: - //SEG50 [18] phi from nest2::@1 to nest2::@2 - //SEG51 [18] phi (byte) nest2::j#2 = (byte) 100 -- yby=coby1 + //SEG53 [21] phi from nest2::@1 to nest2::@2 + //SEG54 [21] phi (byte) nest2::j#2 = (byte) 100 -- yby=coby1 ldy #$64 - //SEG52 [18] phi from nest2::@2 to nest2::@2 - //SEG53 [18] phi (byte) nest2::j#2 = (byte) nest2::j#1 -- register_copy - //SEG54 nest2::@2 + //SEG55 [21] phi from nest2::@2 to nest2::@2 + //SEG56 [21] phi (byte) nest2::j#2 = (byte) nest2::j#1 -- register_copy + //SEG57 nest2::@2 b2: - //SEG55 [19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] -- _star_cowo1=yby + //SEG58 [22] *((word) 1024) ← (byte) nest2::j#2 [ nest2::i#2 nest2::j#2 ] -- _star_cowo1=yby sty $400 - //SEG56 [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] -- yby=_dec_yby + //SEG59 [23] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ nest2::i#2 nest2::j#1 ] -- yby=_dec_yby dey - //SEG57 [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] -- yby_gt_0_then_la1 + //SEG60 [24] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ nest2::i#2 nest2::j#1 ] -- yby_gt_0_then_la1 cpy #$0 bne b2 - //SEG58 nest2::@3 - //SEG59 [22] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] -- xby=_dec_xby + //SEG61 nest2::@3 + //SEG62 [25] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ nest2::i#1 ] -- xby=_dec_xby dex - //SEG60 [23] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] -- xby_gt_0_then_la1 + //SEG63 [26] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ nest2::i#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b1 - //SEG61 nest2::@return - //SEG62 [24] return [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ] + //SEG64 nest2::@return + //SEG65 [27] return [ ] rts } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.sym b/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.sym index c4c06add9..c4adc87e6 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.sym @@ -9,10 +9,10 @@ (label) main::@return (byte) main::i (byte) main::i#1 i zp ZP_BYTE:2 16.5 -(byte) main::i#2 i zp ZP_BYTE:2 1.0476190476190477 +(byte) main::i#2 i zp ZP_BYTE:2 4.4 (byte) main::j (byte) main::j#1 j zp ZP_BYTE:3 151.5 -(byte) main::j#2 j zp ZP_BYTE:3 11.222222222222221 +(byte) main::j#2 j zp ZP_BYTE:3 101.0 (void()) nest1() (label) nest1::@1 (label) nest1::@2 @@ -21,10 +21,10 @@ (label) nest1::@return (byte) nest1::i (byte) nest1::i#1 i zp ZP_BYTE:4 1501.5 -(byte) nest1::i#2 i zp ZP_BYTE:4 154.0 +(byte) nest1::i#2 i zp ZP_BYTE:4 400.4 (byte) nest1::j (byte) nest1::j#1 reg byte a 15001.5 -(byte) nest1::j#2 reg byte a 2000.2 +(byte) nest1::j#2 reg byte a 10001.0 (void()) nest2() (label) nest2::@1 (label) nest2::@2 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.cfg b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.cfg index 94cb39dd4..4aab0dd20 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.cfg @@ -3,22 +3,23 @@ to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@4 main::@8 - [1] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte) main::s#1 main::@8/(byte) main::s#2 ) [ main::i#2 main::s#3 ] - [1] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte) main::i#1 main::@8/(byte) main::i#1 ) [ main::i#2 main::s#3 ] - [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] - [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] + [2] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte) main::s#1 main::@8/(byte) main::s#2 ) [ main::i#2 main::s#3 ] + [2] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte) main::i#1 main::@8/(byte) main::i#1 ) [ main::i#2 main::s#3 ] + [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] + [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] to:main::@return main::@return: scope:[main] from main::@1 - [4] return [ ] + [5] return [ ] to:@return main::@2: scope:[main] from main::@1 - [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] + [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] to:main::@8 main::@8: scope:[main] from main::@2 - [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] + [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] to:main::@1 main::@4: scope:[main] from main::@2 - [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] + [8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] to:main::@1 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log index 64441a861..055ffe83f 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log @@ -499,47 +499,55 @@ main::@4: scope:[main] from main::@2 (byte~) main::s#7 ← (byte) main::s#1 to:main::@1 +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to 0:main + Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@4 main::@8 - [1] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte~) main::s#7 main::@8/(byte~) main::s#8 ) [ main::i#2 main::s#3 ] - [1] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte~) main::i#6 main::@8/(byte~) main::i#7 ) [ main::i#2 main::s#3 ] - [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] - [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] + [2] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte~) main::s#7 main::@8/(byte~) main::s#8 ) [ main::i#2 main::s#3 ] + [2] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte~) main::i#6 main::@8/(byte~) main::i#7 ) [ main::i#2 main::s#3 ] + [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] + [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] to:main::@return main::@return: scope:[main] from main::@1 - [4] return [ ] + [5] return [ ] to:@return main::@2: scope:[main] from main::@1 - [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] + [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] to:main::@8 main::@8: scope:[main] from main::@2 - [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] - [7] (byte~) main::i#7 ← (byte) main::i#1 [ main::i#7 main::s#2 ] - [8] (byte~) main::s#8 ← (byte) main::s#2 [ main::i#7 main::s#8 ] + [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] + [8] (byte~) main::i#7 ← (byte) main::i#1 [ main::i#7 main::s#2 ] + [9] (byte~) main::s#8 ← (byte) main::s#2 [ main::i#7 main::s#8 ] to:main::@1 main::@4: scope:[main] from main::@2 - [9] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] - [10] (byte~) main::i#6 ← (byte) main::i#1 [ main::i#6 main::s#1 ] - [11] (byte~) main::s#7 ← (byte) main::s#1 [ main::i#6 main::s#7 ] + [10] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] + [11] (byte~) main::i#6 ← (byte) main::i#1 [ main::i#6 main::s#1 ] + [12] (byte~) main::s#7 ← (byte) main::s#1 [ main::i#6 main::s#7 ] to:main::@1 Created 2 initial phi equivalence classes -Coalesced [7] main::i#7 ← main::i#1 -Coalesced [8] main::s#8 ← main::s#2 -Coalesced (already) [10] main::i#6 ← main::i#1 -Coalesced [11] main::s#7 ← main::s#1 +Coalesced [8] main::i#7 ← main::i#1 +Coalesced [9] main::s#8 ← main::s#2 +Coalesced (already) [11] main::i#6 ← main::i#1 +Coalesced [12] main::s#7 ← main::s#1 Coalesced down to 2 phi equivalence classes Block Sequence Planned @begin @end main main::@1 main::@return main::@2 main::@8 main::@4 +Adding NOP phi() at start of main +Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... @@ -550,29 +558,27 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@4 main::@8 - [1] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte) main::s#1 main::@8/(byte) main::s#2 ) [ main::i#2 main::s#3 ] - [1] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte) main::i#1 main::@8/(byte) main::i#1 ) [ main::i#2 main::s#3 ] - [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] - [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] + [2] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte) main::s#1 main::@8/(byte) main::s#2 ) [ main::i#2 main::s#3 ] + [2] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte) main::i#1 main::@8/(byte) main::i#1 ) [ main::i#2 main::s#3 ] + [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] + [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] to:main::@return main::@return: scope:[main] from main::@1 - [4] return [ ] + [5] return [ ] to:@return main::@2: scope:[main] from main::@1 - [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] + [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] to:main::@8 main::@8: scope:[main] from main::@2 - [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] + [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] to:main::@1 main::@4: scope:[main] from main::@2 - [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] + [8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] to:main::@1 -CALL GRAPH -Calls in [] to 0:main - DOMINATORS @begin dominated by @begin @end dominated by @end @begin @@ -621,56 +627,58 @@ INITIAL ASM //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main jmp bend -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { .label i = 2 .label s = 3 - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::s#3 = (byte) 0 -- zpby1=coby1 + //SEG7 [2] phi (byte) main::s#3 = (byte) 0 -- zpby1=coby1 lda #$0 sta s - //SEG7 [1] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1 lda #$64 sta i jmp b1 - //SEG8 main::@1 + //SEG9 main::@1 b1: - //SEG9 [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] -- zpby1=_dec_zpby1 + //SEG10 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] -- zpby1=_dec_zpby1 dec i - //SEG10 [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] -- zpby1_gt_0_then_la1 + //SEG11 [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] -- zpby1_gt_0_then_la1 lda i bne b2 jmp breturn - //SEG11 main::@return + //SEG12 main::@return breturn: - //SEG12 [4] return [ ] + //SEG13 [5] return [ ] rts - //SEG13 main::@2 + //SEG14 main::@2 b2: - //SEG14 [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] -- zpby1_le_coby1_then_la1 + //SEG15 [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] -- zpby1_le_coby1_then_la1 lda i cmp #$32 bcc b4 beq b4 jmp b8 - //SEG15 main::@8 + //SEG16 main::@8 b8: - //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- zpby1=_inc_zpby1 + //SEG17 [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- zpby1=_inc_zpby1 inc s - //SEG17 [1] phi from main::@4 main::@8 to main::@1 + //SEG18 [2] phi from main::@4 main::@8 to main::@1 b1_from_b4: b1_from_b8: - //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy - //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG19 [2] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy + //SEG20 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 - //SEG20 main::@4 + //SEG21 main::@4 b4: - //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- zpby1=_dec_zpby1 + //SEG22 [8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- zpby1=_dec_zpby1 dec s jmp b1_from_b4 } @@ -695,52 +703,55 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::s#3 = (byte) 0 -- yby=coby1 + //SEG7 [2] phi (byte) main::s#3 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG7 [1] phi (byte) main::i#2 = (byte) 100 -- xby=coby1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 100 -- xby=coby1 ldx #$64 - //SEG8 main::@1 + //SEG9 main::@1 b1: - //SEG9 [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] -- xby=_dec_xby + //SEG10 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] -- xby=_dec_xby dex - //SEG10 [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] -- xby_gt_0_then_la1 + //SEG11 [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b2 - //SEG11 main::@return + //SEG12 main::@return breturn: - //SEG12 [4] return [ ] + //SEG13 [5] return [ ] rts - //SEG13 main::@2 + //SEG14 main::@2 b2: - //SEG14 [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] -- xby_le_coby1_then_la1 + //SEG15 [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] -- xby_le_coby1_then_la1 cpx #$32 bcc b4 beq b4 - //SEG15 main::@8 + //SEG16 main::@8 b8: - //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby + //SEG17 [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby iny - //SEG17 [1] phi from main::@4 main::@8 to main::@1 + //SEG18 [2] phi from main::@4 main::@8 to main::@1 b1_from_b4: b1_from_b8: - //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy - //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG19 [2] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy + //SEG20 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 - //SEG20 main::@4 + //SEG21 main::@4 b4: - //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby + //SEG22 [8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby dey jmp b1_from_b4 } Replacing label b1_from_b4 with b1_from_b8 +Removing instruction main_from_bbegin: Removing instruction b1_from_b4: Succesful ASM optimization Pass5RedundantLabelElimination ASSEMBLER @@ -748,46 +759,47 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::s#3 = (byte) 0 -- yby=coby1 + //SEG7 [2] phi (byte) main::s#3 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG7 [1] phi (byte) main::i#2 = (byte) 100 -- xby=coby1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 100 -- xby=coby1 ldx #$64 - //SEG8 main::@1 + //SEG9 main::@1 b1: - //SEG9 [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] -- xby=_dec_xby + //SEG10 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] -- xby=_dec_xby dex - //SEG10 [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] -- xby_gt_0_then_la1 + //SEG11 [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b2 - //SEG11 main::@return + //SEG12 main::@return breturn: - //SEG12 [4] return [ ] + //SEG13 [5] return [ ] rts - //SEG13 main::@2 + //SEG14 main::@2 b2: - //SEG14 [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] -- xby_le_coby1_then_la1 + //SEG15 [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] -- xby_le_coby1_then_la1 cpx #$32 bcc b4 beq b4 - //SEG15 main::@8 + //SEG16 main::@8 b8: - //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby + //SEG17 [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby iny - //SEG17 [1] phi from main::@4 main::@8 to main::@1 + //SEG18 [2] phi from main::@4 main::@8 to main::@1 b1_from_b8: - //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy - //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG19 [2] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy + //SEG20 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 - //SEG20 main::@4 + //SEG21 main::@4 b4: - //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby + //SEG22 [8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby dey jmp b1_from_b8 } @@ -802,42 +814,43 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::s#3 = (byte) 0 -- yby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::s#3 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG7 [1] phi (byte) main::i#2 = (byte) 100 -- xby=coby1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 100 -- xby=coby1 ldx #$64 - //SEG8 main::@1 + //SEG9 main::@1 b1: - //SEG9 [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] -- xby=_dec_xby + //SEG10 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] -- xby=_dec_xby dex - //SEG10 [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] -- xby_gt_0_then_la1 + //SEG11 [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b2 - //SEG11 main::@return - //SEG12 [4] return [ ] + //SEG12 main::@return + //SEG13 [5] return [ ] rts - //SEG13 main::@2 + //SEG14 main::@2 b2: - //SEG14 [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] -- xby_le_coby1_then_la1 + //SEG15 [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] -- xby_le_coby1_then_la1 cpx #$32 bcc b4 beq b4 - //SEG15 main::@8 - //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby + //SEG16 main::@8 + //SEG17 [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby iny - //SEG17 [1] phi from main::@4 main::@8 to main::@1 + //SEG18 [2] phi from main::@4 main::@8 to main::@1 b1_from_b8: - //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy - //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG19 [2] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy + //SEG20 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 - //SEG20 main::@4 + //SEG21 main::@4 b4: - //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby + //SEG22 [8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby dey jmp b1_from_b8 } @@ -866,42 +879,43 @@ FINAL CODE //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::s#3 = (byte) 0 -- yby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::s#3 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG7 [1] phi (byte) main::i#2 = (byte) 100 -- xby=coby1 + //SEG8 [2] phi (byte) main::i#2 = (byte) 100 -- xby=coby1 ldx #$64 - //SEG8 main::@1 + //SEG9 main::@1 b1: - //SEG9 [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] -- xby=_dec_xby + //SEG10 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] -- xby=_dec_xby dex - //SEG10 [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] -- xby_gt_0_then_la1 + //SEG11 [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] -- xby_gt_0_then_la1 cpx #$0 bne b2 - //SEG11 main::@return - //SEG12 [4] return [ ] + //SEG12 main::@return + //SEG13 [5] return [ ] rts - //SEG13 main::@2 + //SEG14 main::@2 b2: - //SEG14 [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] -- xby_le_coby1_then_la1 + //SEG15 [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] -- xby_le_coby1_then_la1 cpx #$32 bcc b4 beq b4 - //SEG15 main::@8 - //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby + //SEG16 main::@8 + //SEG17 [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby iny - //SEG17 [1] phi from main::@4 main::@8 to main::@1 + //SEG18 [2] phi from main::@4 main::@8 to main::@1 b1_from_b8: - //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy - //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG19 [2] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy + //SEG20 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 - //SEG20 main::@4 + //SEG21 main::@4 b4: - //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby + //SEG22 [8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby dey jmp b1_from_b8 } 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 0f965ce20..d3c2b1e32 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/minus.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/minus.log @@ -267,8 +267,11 @@ CONTROL FLOW GRAPH - PHI LIFTED (byte~) i#3 ← (byte) i#1 to:@1 +CALL GRAPH + Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from to:@1 @1: scope:[] from @3 @begin @@ -289,6 +292,7 @@ Coalesced down to 1 phi equivalence classes Culled Empty Block (label) @3 Block Sequence Planned @begin @1 @end Propagating live ranges... +Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @begin: scope:[] from to:@1 @@ -301,8 +305,6 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @1 -CALL GRAPH - DOMINATORS @begin dominated by @begin @1 dominated by @1 @begin @@ -336,7 +338,7 @@ Allocated zp ZP_BYTE:2 [ i#2 i#1 ] Allocated zp ZP_BYTE:3 [ $1 ] INITIAL ASM //SEG0 Global ZP labels - .label $1 = 3 + .label _1 = 3 .label i = 2 //SEG1 @begin bbegin: @@ -356,9 +358,9 @@ b1: lda i clc adc #$4 - sta $1 + sta _1 //SEG8 [2] *((word) 4352 + (byte) i#2) ← (byte~) $1 [ i#2 ] -- cowo1_staridx_zpby1=zpby2 - lda $1 + lda _1 ldx i sta $1100,x //SEG9 [3] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] -- zpby1=zpby1_plus_1 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/modglobal.cfg b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.cfg index 1b3462ece..ef2979f1d 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/modglobal.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.cfg @@ -3,30 +3,31 @@ to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + [1] phi() [ ] + [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] to:main::@1 main::@1: scope:[main] from main - [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] - [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] - [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] - [5] call inccnt param-assignment [ inccnt::return#0 ] + [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] + [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] + [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] + [6] call inccnt param-assignment [ inccnt::return#0 ] to:main::@2 main::@2: scope:[main] from main::@1 - [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] - [7] *((word) 1025) ← (byte~) main::$1 [ ] + [7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] + [8] *((word) 1025) ← (byte~) main::$1 [ ] to:main::@return main::@return: scope:[main] from main::@2 - [8] return [ ] + [9] return [ ] to:@return inccnt: scope:[inccnt] from main main::@1 - [9] (byte) cnt3#11 ← phi( main/(byte) 0 main::@1/(byte) cnt3#1 ) [ cnt#12 cnt2#11 cnt3#11 ] - [9] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) [ cnt#12 cnt2#11 cnt3#11 ] - [9] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#12 cnt2#11 cnt3#11 ] - [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] - [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ] - [12] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] - [13] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + [10] (byte) cnt3#11 ← phi( main/(byte) 0 main::@1/(byte) cnt3#1 ) [ cnt#12 cnt2#11 cnt3#11 ] + [10] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) [ cnt#12 cnt2#11 cnt3#11 ] + [10] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#12 cnt2#11 cnt3#11 ] + [11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] + [12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ] + [13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] + [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] to:inccnt::@return inccnt::@return: scope:[inccnt] from inccnt - [14] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + [15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#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 index 82fcd0545..272afb9c6 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/modglobal.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.log @@ -747,6 +747,11 @@ inccnt::@return: scope:[inccnt] from inccnt return to:@return +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to 0:main +Calls in [main] to 2:inccnt 9:inccnt + Propagating live ranges... Propagating live ranges... Propagating live ranges... @@ -755,49 +760,53 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + [1] phi() [ ] + [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] to:main::@1 main::@1: scope:[main] from main - [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] - [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] - [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] - [5] (byte~) cnt#15 ← (byte) cnt#3 [ cnt2#1 cnt3#1 cnt#15 ] - [6] (byte~) cnt2#14 ← (byte) cnt2#1 [ cnt3#1 cnt#15 cnt2#14 ] - [7] (byte~) cnt3#14 ← (byte) cnt3#1 [ cnt#15 cnt2#14 cnt3#14 ] - [8] call inccnt param-assignment [ inccnt::return#0 ] + [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] + [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] + [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] + [6] (byte~) cnt#15 ← (byte) cnt#3 [ cnt#15 cnt2#1 cnt3#1 ] + [7] (byte~) cnt2#14 ← (byte) cnt2#1 [ cnt#15 cnt2#14 cnt3#1 ] + [8] (byte~) cnt3#14 ← (byte) cnt3#1 [ cnt#15 cnt2#14 cnt3#14 ] + [9] call inccnt param-assignment [ inccnt::return#0 ] to:main::@2 main::@2: scope:[main] from main::@1 - [9] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] - [10] *((word) 1025) ← (byte~) main::$1 [ ] + [10] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] + [11] *((word) 1025) ← (byte~) main::$1 [ ] to:main::@return main::@return: scope:[main] from main::@2 - [11] return [ ] + [12] return [ ] to:@return inccnt: scope:[inccnt] from main main::@1 - [12] (byte) cnt3#11 ← phi( main/(byte) 0 main::@1/(byte~) cnt3#14 ) [ cnt#12 cnt2#11 cnt3#11 ] - [12] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte~) cnt2#14 ) [ cnt#12 cnt2#11 cnt3#11 ] - [12] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte~) cnt#15 ) [ cnt#12 cnt2#11 cnt3#11 ] - [13] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] - [14] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ] - [15] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] - [16] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + [13] (byte) cnt3#11 ← phi( main/(byte) 0 main::@1/(byte~) cnt3#14 ) [ cnt#12 cnt2#11 cnt3#11 ] + [13] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte~) cnt2#14 ) [ cnt#12 cnt2#11 cnt3#11 ] + [13] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte~) cnt#15 ) [ cnt#12 cnt2#11 cnt3#11 ] + [14] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] + [15] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ] + [16] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] + [17] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] to:inccnt::@return inccnt::@return: scope:[inccnt] from inccnt - [17] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + [18] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] to:@return Created 3 initial phi equivalence classes -Coalesced [5] cnt#15 ← cnt#3 -Coalesced [6] cnt2#14 ← cnt2#1 -Coalesced [7] cnt3#14 ← cnt3#1 +Coalesced [6] cnt#15 ← cnt#3 +Coalesced [7] cnt2#14 ← cnt2#1 +Coalesced [8] cnt3#14 ← cnt3#1 Coalesced down to 3 phi equivalence classes Block Sequence Planned @begin @end main main::@1 main::@2 main::@return inccnt inccnt::@return +Adding NOP phi() at start of main +Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... @@ -811,38 +820,35 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + [1] phi() [ ] + [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] to:main::@1 main::@1: scope:[main] from main - [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] - [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] - [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] - [5] call inccnt param-assignment [ inccnt::return#0 ] + [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] + [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] + [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] + [6] call inccnt param-assignment [ inccnt::return#0 ] to:main::@2 main::@2: scope:[main] from main::@1 - [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] - [7] *((word) 1025) ← (byte~) main::$1 [ ] + [7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] + [8] *((word) 1025) ← (byte~) main::$1 [ ] to:main::@return main::@return: scope:[main] from main::@2 - [8] return [ ] + [9] return [ ] to:@return inccnt: scope:[inccnt] from main main::@1 - [9] (byte) cnt3#11 ← phi( main/(byte) 0 main::@1/(byte) cnt3#1 ) [ cnt#12 cnt2#11 cnt3#11 ] - [9] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) [ cnt#12 cnt2#11 cnt3#11 ] - [9] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#12 cnt2#11 cnt3#11 ] - [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] - [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ] - [12] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] - [13] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + [10] (byte) cnt3#11 ← phi( main/(byte) 0 main::@1/(byte) cnt3#1 ) [ cnt#12 cnt2#11 cnt3#11 ] + [10] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) [ cnt#12 cnt2#11 cnt3#11 ] + [10] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#12 cnt2#11 cnt3#11 ] + [11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] + [12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ] + [13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] + [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] to:inccnt::@return inccnt::@return: scope:[inccnt] from inccnt - [14] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + [15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#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 @end @begin @@ -908,85 +914,87 @@ INITIAL ASM .label cnt = 7 .label cnt2 = 3 .label cnt3 = 4 - .label cnt#3 = 2 - .label cnt#12 = 2 + .label cnt_3 = 2 + .label cnt_12 = 2 //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main jmp bend -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - .label $0 = 5 - .label $1 = 6 - //SEG5 [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] - //SEG6 [9] phi from main to inccnt + .label _0 = 5 + .label _1 = 6 + //SEG6 [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + //SEG7 [10] phi from main to inccnt inccnt_from_main: - //SEG7 [9] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1 + //SEG8 [10] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1 lda #$0 sta cnt3 - //SEG8 [9] phi (byte) cnt2#11 = (byte) 0 -- zpby1=coby1 + //SEG9 [10] phi (byte) cnt2#11 = (byte) 0 -- zpby1=coby1 lda #$0 sta cnt2 - //SEG9 [9] phi (byte) cnt#12 = (byte) 0 -- zpby1=coby1 + //SEG10 [10] phi (byte) cnt#12 = (byte) 0 -- zpby1=coby1 lda #$0 sta cnt_12 jsr inccnt jmp b1 - //SEG10 main::@1 + //SEG11 main::@1 b1: - //SEG11 [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] -- zpby1=zpby2 + //SEG12 [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] -- zpby1=zpby2 lda inccnt.return - sta $0 - //SEG12 [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=zpby1 - lda $0 + sta _0 + //SEG13 [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=zpby1 + lda _0 sta $400 - //SEG13 [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby2 + //SEG14 [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby2 lda cnt sta cnt_3 inc cnt_3 - //SEG14 [5] call inccnt param-assignment [ inccnt::return#0 ] - //SEG15 [9] phi from main::@1 to inccnt + //SEG15 [6] call inccnt param-assignment [ inccnt::return#0 ] + //SEG16 [10] phi from main::@1 to inccnt inccnt_from_b1: - //SEG16 [9] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy - //SEG17 [9] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy - //SEG18 [9] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy + //SEG17 [10] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy + //SEG18 [10] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy + //SEG19 [10] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy jsr inccnt jmp b2 - //SEG19 main::@2 + //SEG20 main::@2 b2: - //SEG20 [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] -- zpby1=zpby2 + //SEG21 [7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] -- zpby1=zpby2 lda inccnt.return - sta $1 - //SEG21 [7] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=zpby1 - lda $1 + sta _1 + //SEG22 [8] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=zpby1 + lda _1 sta $401 jmp breturn - //SEG22 main::@return + //SEG23 main::@return breturn: - //SEG23 [8] return [ ] + //SEG24 [9] return [ ] rts } -//SEG24 inccnt +//SEG25 inccnt inccnt: { .label return = 8 - //SEG25 [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- zpby1=_inc_zpby2 + //SEG26 [11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- zpby1=_inc_zpby2 lda cnt_12 sta cnt inc cnt - //SEG26 [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ] -- zpby1=_inc_zpby1 + //SEG27 [12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ] -- zpby1=_inc_zpby1 inc cnt2 - //SEG27 [12] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1 + //SEG28 [13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1 inc cnt3 - //SEG28 [13] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- zpby1=zpby2 + //SEG29 [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- zpby1=zpby2 lda cnt sta return jmp breturn - //SEG29 inccnt::@return + //SEG30 inccnt::@return breturn: - //SEG30 [14] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + //SEG31 [15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] rts } @@ -1007,6 +1015,8 @@ Uplift Scope [inccnt] 1.5: zp ZP_BYTE:8 [ inccnt::return#0 ] Uplifting [] best 94 combination reg byte x [ cnt#12 cnt#3 ] reg byte y [ cnt2#11 cnt2#1 ] zp ZP_BYTE:4 [ cnt3#11 cnt3#1 ] reg byte x [ cnt#1 ] Uplifting [main] best 82 combination reg byte a [ main::$0 ] reg byte a [ main::$1 ] Uplifting [inccnt] best 75 combination reg byte a [ inccnt::return#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:4 [ cnt3#11 cnt3#1 ] +Uplifting [] best 75 combination zp ZP_BYTE:4 [ cnt3#11 cnt3#1 ] Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:2 [ cnt3#11 cnt3#1 ] Removing instruction jmp bend Removing instruction jmp b1 @@ -1020,61 +1030,130 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] - //SEG6 [9] phi from main to inccnt + //SEG6 [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + //SEG7 [10] phi from main to inccnt inccnt_from_main: - //SEG7 [9] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1 + //SEG8 [10] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1 lda #$0 sta cnt3 - //SEG8 [9] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1 + //SEG9 [10] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG9 [9] phi (byte) cnt#12 = (byte) 0 -- xby=coby1 + //SEG10 [10] phi (byte) cnt#12 = (byte) 0 -- xby=coby1 ldx #$0 jsr inccnt - //SEG10 main::@1 + //SEG11 main::@1 b1: - //SEG11 [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] + //SEG12 [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] // (byte~) main::$0 = (byte) inccnt::return#0 // register copy reg byte a - //SEG12 [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby + //SEG13 [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby sta $400 - //SEG13 [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby + //SEG14 [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby inx - //SEG14 [5] call inccnt param-assignment [ inccnt::return#0 ] - //SEG15 [9] phi from main::@1 to inccnt + //SEG15 [6] call inccnt param-assignment [ inccnt::return#0 ] + //SEG16 [10] phi from main::@1 to inccnt inccnt_from_b1: - //SEG16 [9] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy - //SEG17 [9] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy - //SEG18 [9] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy + //SEG17 [10] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy + //SEG18 [10] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy + //SEG19 [10] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy jsr inccnt - //SEG19 main::@2 + //SEG20 main::@2 b2: - //SEG20 [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] + //SEG21 [7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] // (byte~) main::$1 = (byte) inccnt::return#0 // register copy reg byte a - //SEG21 [7] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby + //SEG22 [8] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby sta $401 - //SEG22 main::@return + //SEG23 main::@return breturn: - //SEG23 [8] return [ ] + //SEG24 [9] return [ ] rts } -//SEG24 inccnt +//SEG25 inccnt inccnt: { - //SEG25 [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby + //SEG26 [11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby inx - //SEG26 [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ] -- yby=_inc_yby + //SEG27 [12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ] -- yby=_inc_yby iny - //SEG27 [12] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1 + //SEG28 [13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1 inc cnt3 - //SEG28 [13] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby + //SEG29 [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby txa - //SEG29 inccnt::@return + //SEG30 inccnt::@return breturn: - //SEG30 [14] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + //SEG31 [15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + rts +} + +Removing instruction main_from_bbegin: +Succesful ASM optimization Pass5RedundantLabelElimination +ASSEMBLER +//SEG0 Global ZP labels + .label cnt3 = 2 +//SEG1 @begin +bbegin: +//SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main + jsr main +//SEG4 @end +bend: +//SEG5 main +main: { + //SEG6 [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + //SEG7 [10] phi from main to inccnt + inccnt_from_main: + //SEG8 [10] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1 + lda #$0 + sta cnt3 + //SEG9 [10] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1 + ldy #$0 + //SEG10 [10] phi (byte) cnt#12 = (byte) 0 -- xby=coby1 + ldx #$0 + jsr inccnt + //SEG11 main::@1 + b1: + //SEG12 [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] + // (byte~) main::$0 = (byte) inccnt::return#0 // register copy reg byte a + //SEG13 [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby + sta $400 + //SEG14 [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby + inx + //SEG15 [6] call inccnt param-assignment [ inccnt::return#0 ] + //SEG16 [10] phi from main::@1 to inccnt + inccnt_from_b1: + //SEG17 [10] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy + //SEG18 [10] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy + //SEG19 [10] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy + jsr inccnt + //SEG20 main::@2 + b2: + //SEG21 [7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] + // (byte~) main::$1 = (byte) inccnt::return#0 // register copy reg byte a + //SEG22 [8] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby + sta $401 + //SEG23 main::@return + breturn: + //SEG24 [9] return [ ] + rts +} +//SEG25 inccnt +inccnt: { + //SEG26 [11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby + inx + //SEG27 [12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ] -- yby=_inc_yby + iny + //SEG28 [13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1 + inc cnt3 + //SEG29 [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby + txa + //SEG30 inccnt::@return + breturn: + //SEG31 [15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] rts } @@ -1092,54 +1171,55 @@ ASSEMBLER .label cnt3 = 2 //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] - //SEG6 [9] phi from main to inccnt - //SEG7 [9] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1 + //SEG6 [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + //SEG7 [10] phi from main to inccnt + //SEG8 [10] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1 lda #$0 sta cnt3 - //SEG8 [9] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1 + //SEG9 [10] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG9 [9] phi (byte) cnt#12 = (byte) 0 -- xby=coby1 + //SEG10 [10] phi (byte) cnt#12 = (byte) 0 -- xby=coby1 ldx #$0 jsr inccnt - //SEG10 main::@1 - //SEG11 [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] + //SEG11 main::@1 + //SEG12 [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] // (byte~) main::$0 = (byte) inccnt::return#0 // register copy reg byte a - //SEG12 [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby + //SEG13 [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby sta $400 - //SEG13 [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby + //SEG14 [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby inx - //SEG14 [5] call inccnt param-assignment [ inccnt::return#0 ] - //SEG15 [9] phi from main::@1 to inccnt - //SEG16 [9] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy - //SEG17 [9] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy - //SEG18 [9] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy + //SEG15 [6] call inccnt param-assignment [ inccnt::return#0 ] + //SEG16 [10] phi from main::@1 to inccnt + //SEG17 [10] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy + //SEG18 [10] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy + //SEG19 [10] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy jsr inccnt - //SEG19 main::@2 - //SEG20 [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] + //SEG20 main::@2 + //SEG21 [7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] // (byte~) main::$1 = (byte) inccnt::return#0 // register copy reg byte a - //SEG21 [7] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby + //SEG22 [8] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby sta $401 - //SEG22 main::@return - //SEG23 [8] return [ ] + //SEG23 main::@return + //SEG24 [9] return [ ] rts } -//SEG24 inccnt +//SEG25 inccnt inccnt: { - //SEG25 [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby + //SEG26 [11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby inx - //SEG26 [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ] -- yby=_inc_yby + //SEG27 [12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ] -- yby=_inc_yby iny - //SEG27 [12] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1 + //SEG28 [13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1 inc cnt3 - //SEG28 [13] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby + //SEG29 [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby txa - //SEG29 inccnt::@return - //SEG30 [14] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + //SEG30 inccnt::@return + //SEG31 [15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] rts } @@ -1181,54 +1261,55 @@ FINAL CODE .label cnt3 = 2 //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] - //SEG6 [9] phi from main to inccnt - //SEG7 [9] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1 + //SEG6 [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + //SEG7 [10] phi from main to inccnt + //SEG8 [10] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1 lda #$0 sta cnt3 - //SEG8 [9] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1 + //SEG9 [10] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG9 [9] phi (byte) cnt#12 = (byte) 0 -- xby=coby1 + //SEG10 [10] phi (byte) cnt#12 = (byte) 0 -- xby=coby1 ldx #$0 jsr inccnt - //SEG10 main::@1 - //SEG11 [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] + //SEG11 main::@1 + //SEG12 [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] // (byte~) main::$0 = (byte) inccnt::return#0 // register copy reg byte a - //SEG12 [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby + //SEG13 [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby sta $400 - //SEG13 [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby + //SEG14 [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby inx - //SEG14 [5] call inccnt param-assignment [ inccnt::return#0 ] - //SEG15 [9] phi from main::@1 to inccnt - //SEG16 [9] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy - //SEG17 [9] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy - //SEG18 [9] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy + //SEG15 [6] call inccnt param-assignment [ inccnt::return#0 ] + //SEG16 [10] phi from main::@1 to inccnt + //SEG17 [10] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy + //SEG18 [10] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy + //SEG19 [10] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy jsr inccnt - //SEG19 main::@2 - //SEG20 [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] + //SEG20 main::@2 + //SEG21 [7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] // (byte~) main::$1 = (byte) inccnt::return#0 // register copy reg byte a - //SEG21 [7] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby + //SEG22 [8] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby sta $401 - //SEG22 main::@return - //SEG23 [8] return [ ] + //SEG23 main::@return + //SEG24 [9] return [ ] rts } -//SEG24 inccnt +//SEG25 inccnt inccnt: { - //SEG25 [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby + //SEG26 [11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby inx - //SEG26 [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ] -- yby=_inc_yby + //SEG27 [12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ] -- yby=_inc_yby iny - //SEG27 [12] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1 + //SEG28 [13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1 inc cnt3 - //SEG28 [13] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby + //SEG29 [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby txa - //SEG29 inccnt::@return - //SEG30 [14] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] + //SEG30 inccnt::@return + //SEG31 [15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] rts } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/modglobalmin.cfg b/src/main/java/dk/camelot64/kickc/test/ref/modglobalmin.cfg index 77d4d157d..4298af0c6 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/modglobalmin.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/modglobalmin.cfg @@ -3,24 +3,25 @@ to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call inccnt param-assignment [ cnt#10 ] + [1] phi() [ ] + [2] call inccnt param-assignment [ cnt#10 ] to:main::@1 main::@1: scope:[main] from main - [2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] - [3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] - [4] call inccnt param-assignment [ cnt#10 ] + [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] + [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] + [5] call inccnt param-assignment [ cnt#10 ] to:main::@2 main::@2: scope:[main] from main::@1 - [5] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] - [6] *((word) 1025) ← (byte) cnt#1 [ ] + [6] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] + [7] *((word) 1025) ← (byte) cnt#1 [ ] to:main::@return main::@return: scope:[main] from main::@2 - [7] return [ ] + [8] return [ ] to:@return inccnt: scope:[inccnt] from main main::@1 - [8] (byte) cnt#13 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#13 ] - [9] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] + [9] (byte) cnt#13 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#13 ] + [10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] to:inccnt::@return inccnt::@return: scope:[inccnt] from inccnt - [10] return [ cnt#10 ] + [11] return [ cnt#10 ] to:@return diff --git a/src/main/java/dk/camelot64/kickc/test/ref/modglobalmin.log b/src/main/java/dk/camelot64/kickc/test/ref/modglobalmin.log index 3393504bb..961125447 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/modglobalmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/modglobalmin.log @@ -498,20 +498,64 @@ inccnt::@return: scope:[inccnt] from inccnt return to:@return +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to 0:main +Calls in [main] to 2:inccnt 6:inccnt + Propagating live ranges... Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call inccnt param-assignment [ cnt#10 ] + [1] phi() [ ] + [2] call inccnt param-assignment [ cnt#10 ] to:main::@1 main::@1: scope:[main] from main - [2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] - [3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] - [4] (byte~) cnt#16 ← (byte) cnt#3 [ cnt#16 ] + [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] + [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] + [5] (byte~) cnt#16 ← (byte) cnt#3 [ cnt#16 ] + [6] call inccnt param-assignment [ cnt#10 ] + to:main::@2 +main::@2: scope:[main] from main::@1 + [7] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] + [8] *((word) 1025) ← (byte) cnt#1 [ ] + to:main::@return +main::@return: scope:[main] from main::@2 + [9] return [ ] + to:@return +inccnt: scope:[inccnt] from main main::@1 + [10] (byte) cnt#13 ← phi( main/(byte) 0 main::@1/(byte~) cnt#16 ) [ cnt#13 ] + [11] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] + to:inccnt::@return +inccnt::@return: scope:[inccnt] from inccnt + [12] return [ cnt#10 ] + to:@return + +Created 1 initial phi equivalence classes +Coalesced [5] cnt#16 ← cnt#3 +Coalesced down to 1 phi equivalence classes +Block Sequence Planned @begin @end main main::@1 main::@2 main::@return inccnt inccnt::@return +Adding NOP phi() at start of main +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +CONTROL FLOW GRAPH - PHI MEM COALESCED +@begin: scope:[] from + [0] call main param-assignment [ ] + to:@end +@end: scope:[] from @begin +main: scope:[main] from @begin + [1] phi() [ ] + [2] call inccnt param-assignment [ cnt#10 ] + to:main::@1 +main::@1: scope:[main] from main + [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] + [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] [5] call inccnt param-assignment [ cnt#10 ] to:main::@2 main::@2: scope:[main] from main::@1 @@ -522,51 +566,13 @@ main::@return: scope:[main] from main::@2 [8] return [ ] to:@return inccnt: scope:[inccnt] from main main::@1 - [9] (byte) cnt#13 ← phi( main/(byte) 0 main::@1/(byte~) cnt#16 ) [ cnt#13 ] + [9] (byte) cnt#13 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#13 ] [10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] to:inccnt::@return inccnt::@return: scope:[inccnt] from inccnt [11] return [ cnt#10 ] to:@return -Created 1 initial phi equivalence classes -Coalesced [4] cnt#16 ← cnt#3 -Coalesced down to 1 phi equivalence classes -Block Sequence Planned @begin @end main main::@1 main::@2 main::@return inccnt inccnt::@return -Propagating live ranges... -Propagating live ranges... -CONTROL FLOW GRAPH - PHI MEM COALESCED -@begin: scope:[] from - [0] call main param-assignment [ ] - to:@end -@end: scope:[] from @begin -main: scope:[main] from @begin - [1] call inccnt param-assignment [ cnt#10 ] - to:main::@1 -main::@1: scope:[main] from main - [2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] - [3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] - [4] call inccnt param-assignment [ cnt#10 ] - to:main::@2 -main::@2: scope:[main] from main::@1 - [5] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] - [6] *((word) 1025) ← (byte) cnt#1 [ ] - to:main::@return -main::@return: scope:[main] from main::@2 - [7] return [ ] - to:@return -inccnt: scope:[inccnt] from main main::@1 - [8] (byte) cnt#13 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#13 ] - [9] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] - to:inccnt::@return -inccnt::@return: scope:[inccnt] from inccnt - [10] return [ cnt#10 ] - to:@return - -CALL GRAPH -Calls in [] to 0:main -Calls in [main] to 1:inccnt 4:inccnt - DOMINATORS @begin dominated by @begin @end dominated by @end @begin @@ -609,66 +615,68 @@ Allocated zp ZP_BYTE:4 [ cnt#10 ] INITIAL ASM //SEG0 Global ZP labels .label cnt = 3 - .label cnt#3 = 2 - .label cnt#10 = 4 - .label cnt#13 = 2 + .label cnt_3 = 2 + .label cnt_10 = 4 + .label cnt_13 = 2 //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main jmp bend -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] call inccnt param-assignment [ cnt#10 ] - //SEG6 [8] phi from main to inccnt + //SEG6 [2] call inccnt param-assignment [ cnt#10 ] + //SEG7 [9] phi from main to inccnt inccnt_from_main: - //SEG7 [8] phi (byte) cnt#13 = (byte) 0 -- zpby1=coby1 + //SEG8 [9] phi (byte) cnt#13 = (byte) 0 -- zpby1=coby1 lda #$0 sta cnt_13 jsr inccnt jmp b1 - //SEG8 main::@1 + //SEG9 main::@1 b1: - //SEG9 [2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=zpby1 + //SEG10 [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=zpby1 lda cnt_10 sta $400 - //SEG10 [3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- zpby1=_inc_zpby2 + //SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- zpby1=_inc_zpby2 lda cnt_10 sta cnt_3 inc cnt_3 - //SEG11 [4] call inccnt param-assignment [ cnt#10 ] - //SEG12 [8] phi from main::@1 to inccnt + //SEG12 [5] call inccnt param-assignment [ cnt#10 ] + //SEG13 [9] phi from main::@1 to inccnt inccnt_from_b1: - //SEG13 [8] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy + //SEG14 [9] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy jsr inccnt jmp b2 - //SEG14 main::@2 + //SEG15 main::@2 b2: - //SEG15 [5] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- zpby1=_inc_zpby2 + //SEG16 [6] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- zpby1=_inc_zpby2 lda cnt_10 sta cnt inc cnt - //SEG16 [6] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=zpby1 + //SEG17 [7] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=zpby1 lda cnt sta $401 jmp breturn - //SEG17 main::@return + //SEG18 main::@return breturn: - //SEG18 [7] return [ ] + //SEG19 [8] return [ ] rts } -//SEG19 inccnt +//SEG20 inccnt inccnt: { - //SEG20 [9] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- zpby1=_inc_zpby2 + //SEG21 [10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- zpby1=_inc_zpby2 lda cnt_13 sta cnt_10 inc cnt_10 jmp breturn - //SEG21 inccnt::@return + //SEG22 inccnt::@return breturn: - //SEG22 [10] return [ cnt#10 ] + //SEG23 [11] return [ cnt#10 ] rts } @@ -696,46 +704,99 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] call inccnt param-assignment [ cnt#10 ] - //SEG6 [8] phi from main to inccnt + //SEG6 [2] call inccnt param-assignment [ cnt#10 ] + //SEG7 [9] phi from main to inccnt inccnt_from_main: - //SEG7 [8] phi (byte) cnt#13 = (byte) 0 -- xby=coby1 + //SEG8 [9] phi (byte) cnt#13 = (byte) 0 -- xby=coby1 ldx #$0 jsr inccnt - //SEG8 main::@1 + //SEG9 main::@1 b1: - //SEG9 [2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby + //SEG10 [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby stx $400 - //SEG10 [3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby + //SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby inx - //SEG11 [4] call inccnt param-assignment [ cnt#10 ] - //SEG12 [8] phi from main::@1 to inccnt + //SEG12 [5] call inccnt param-assignment [ cnt#10 ] + //SEG13 [9] phi from main::@1 to inccnt inccnt_from_b1: - //SEG13 [8] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy + //SEG14 [9] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy jsr inccnt - //SEG14 main::@2 + //SEG15 main::@2 b2: - //SEG15 [5] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby + //SEG16 [6] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby inx - //SEG16 [6] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby + //SEG17 [7] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby stx $401 - //SEG17 main::@return + //SEG18 main::@return breturn: - //SEG18 [7] return [ ] + //SEG19 [8] return [ ] rts } -//SEG19 inccnt +//SEG20 inccnt inccnt: { - //SEG20 [9] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby + //SEG21 [10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby inx - //SEG21 inccnt::@return + //SEG22 inccnt::@return breturn: - //SEG22 [10] return [ cnt#10 ] + //SEG23 [11] return [ cnt#10 ] + rts +} + +Removing instruction main_from_bbegin: +Succesful ASM optimization Pass5RedundantLabelElimination +ASSEMBLER +//SEG0 Global ZP labels +//SEG1 @begin +bbegin: +//SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main + jsr main +//SEG4 @end +bend: +//SEG5 main +main: { + //SEG6 [2] call inccnt param-assignment [ cnt#10 ] + //SEG7 [9] phi from main to inccnt + inccnt_from_main: + //SEG8 [9] phi (byte) cnt#13 = (byte) 0 -- xby=coby1 + ldx #$0 + jsr inccnt + //SEG9 main::@1 + b1: + //SEG10 [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby + stx $400 + //SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby + inx + //SEG12 [5] call inccnt param-assignment [ cnt#10 ] + //SEG13 [9] phi from main::@1 to inccnt + inccnt_from_b1: + //SEG14 [9] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy + jsr inccnt + //SEG15 main::@2 + b2: + //SEG16 [6] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby + inx + //SEG17 [7] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby + stx $401 + //SEG18 main::@return + breturn: + //SEG19 [8] return [ ] + rts +} +//SEG20 inccnt +inccnt: { + //SEG21 [10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby + inx + //SEG22 inccnt::@return + breturn: + //SEG23 [11] return [ cnt#10 ] rts } @@ -752,39 +813,40 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call inccnt param-assignment [ cnt#10 ] - //SEG6 [8] phi from main to inccnt - //SEG7 [8] phi (byte) cnt#13 = (byte) 0 -- xby=coby1 + //SEG6 [2] call inccnt param-assignment [ cnt#10 ] + //SEG7 [9] phi from main to inccnt + //SEG8 [9] phi (byte) cnt#13 = (byte) 0 -- xby=coby1 ldx #$0 jsr inccnt - //SEG8 main::@1 - //SEG9 [2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby + //SEG9 main::@1 + //SEG10 [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby stx $400 - //SEG10 [3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby + //SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby inx - //SEG11 [4] call inccnt param-assignment [ cnt#10 ] - //SEG12 [8] phi from main::@1 to inccnt - //SEG13 [8] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy + //SEG12 [5] call inccnt param-assignment [ cnt#10 ] + //SEG13 [9] phi from main::@1 to inccnt + //SEG14 [9] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy jsr inccnt - //SEG14 main::@2 - //SEG15 [5] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby + //SEG15 main::@2 + //SEG16 [6] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby inx - //SEG16 [6] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby + //SEG17 [7] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby stx $401 - //SEG17 main::@return - //SEG18 [7] return [ ] + //SEG18 main::@return + //SEG19 [8] return [ ] rts } -//SEG19 inccnt +//SEG20 inccnt inccnt: { - //SEG20 [9] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby + //SEG21 [10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby inx - //SEG21 inccnt::@return - //SEG22 [10] return [ cnt#10 ] + //SEG22 inccnt::@return + //SEG23 [11] return [ cnt#10 ] rts } @@ -812,39 +874,40 @@ FINAL CODE //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call inccnt param-assignment [ cnt#10 ] - //SEG6 [8] phi from main to inccnt - //SEG7 [8] phi (byte) cnt#13 = (byte) 0 -- xby=coby1 + //SEG6 [2] call inccnt param-assignment [ cnt#10 ] + //SEG7 [9] phi from main to inccnt + //SEG8 [9] phi (byte) cnt#13 = (byte) 0 -- xby=coby1 ldx #$0 jsr inccnt - //SEG8 main::@1 - //SEG9 [2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby + //SEG9 main::@1 + //SEG10 [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby stx $400 - //SEG10 [3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby + //SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby inx - //SEG11 [4] call inccnt param-assignment [ cnt#10 ] - //SEG12 [8] phi from main::@1 to inccnt - //SEG13 [8] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy + //SEG12 [5] call inccnt param-assignment [ cnt#10 ] + //SEG13 [9] phi from main::@1 to inccnt + //SEG14 [9] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy jsr inccnt - //SEG14 main::@2 - //SEG15 [5] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby + //SEG15 main::@2 + //SEG16 [6] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby inx - //SEG16 [6] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby + //SEG17 [7] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby stx $401 - //SEG17 main::@return - //SEG18 [7] return [ ] + //SEG18 main::@return + //SEG19 [8] return [ ] rts } -//SEG19 inccnt +//SEG20 inccnt inccnt: { - //SEG20 [9] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby + //SEG21 [10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby inx - //SEG21 inccnt::@return - //SEG22 [10] return [ cnt#10 ] + //SEG22 inccnt::@return + //SEG23 [11] return [ cnt#10 ] rts } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.cfg b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.cfg index ec4f78e42..0fbe30f7b 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.cfg @@ -3,77 +3,80 @@ to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call lvalue param-assignment [ ] + [1] phi() [ ] + [2] call lvalue param-assignment [ ] to:main::@1 main::@1: scope:[main] from main - [2] call rvalue param-assignment [ ] + [3] call rvalue param-assignment [ ] to:main::@2 main::@2: scope:[main] from main::@1 - [3] call rvaluevar param-assignment [ ] + [4] call rvaluevar param-assignment [ ] to:main::@3 main::@3: scope:[main] from main::@2 - [4] call lvaluevar param-assignment [ ] + [5] call lvaluevar param-assignment [ ] to:main::@return main::@return: scope:[main] from main::@3 - [5] return [ ] + [6] return [ ] to:@return lvaluevar: scope:[lvaluevar] from main::@3 + [7] phi() [ ] to:lvaluevar::@1 lvaluevar::@1: scope:[lvaluevar] from lvaluevar lvaluevar::@2 - [6] (byte*) lvaluevar::screen#2 ← phi( lvaluevar/(word) 1024 lvaluevar::@2/(byte*) lvaluevar::screen#1 ) [ lvaluevar::i#2 lvaluevar::screen#2 ] - [6] (byte) lvaluevar::i#2 ← phi( lvaluevar/(byte) 2 lvaluevar::@2/(byte) lvaluevar::i#1 ) [ lvaluevar::i#2 lvaluevar::screen#2 ] - [7] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] + [8] (byte*) lvaluevar::screen#2 ← phi( lvaluevar/(word) 1024 lvaluevar::@2/(byte*) lvaluevar::screen#1 ) [ lvaluevar::i#2 lvaluevar::screen#2 ] + [8] (byte) lvaluevar::i#2 ← phi( lvaluevar/(byte) 2 lvaluevar::@2/(byte) lvaluevar::i#1 ) [ lvaluevar::i#2 lvaluevar::screen#2 ] + [9] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] to:lvaluevar::@return lvaluevar::@return: scope:[lvaluevar] from lvaluevar::@1 - [8] return [ ] + [10] return [ ] to:@return lvaluevar::@2: scope:[lvaluevar] from lvaluevar::@1 - [9] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] - [10] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::screen#1 lvaluevar::i#2 ] - [11] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] + [11] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] + [12] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::i#2 lvaluevar::screen#1 ] + [13] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] to:lvaluevar::@1 rvaluevar: scope:[rvaluevar] from main::@2 + [14] phi() [ ] to:rvaluevar::@1 rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 - [12] (byte*) rvaluevar::screen#2 ← phi( rvaluevar/(word) 1024 rvaluevar::@2/(byte*) rvaluevar::screen#1 ) [ rvaluevar::i#2 rvaluevar::screen#2 ] - [12] (byte) rvaluevar::i#2 ← phi( rvaluevar/(byte) 2 rvaluevar::@2/(byte) rvaluevar::i#1 ) [ rvaluevar::i#2 rvaluevar::screen#2 ] - [13] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] + [15] (byte*) rvaluevar::screen#2 ← phi( rvaluevar/(word) 1024 rvaluevar::@2/(byte*) rvaluevar::screen#1 ) [ rvaluevar::i#2 rvaluevar::screen#2 ] + [15] (byte) rvaluevar::i#2 ← phi( rvaluevar/(byte) 2 rvaluevar::@2/(byte) rvaluevar::i#1 ) [ rvaluevar::i#2 rvaluevar::screen#2 ] + [16] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] to:rvaluevar::@return rvaluevar::@return: scope:[rvaluevar] from rvaluevar::@1 - [14] return [ ] + [17] return [ ] to:@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - [15] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] - [16] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::screen#1 rvaluevar::i#2 ] - [17] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] + [18] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] + [19] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] + [20] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] to:rvaluevar::@1 rvalue: scope:[rvalue] from main::@1 - [18] (byte) rvalue::b#0 ← * (word) 1024 [ ] - [19] (byte) rvalue::b#1 ← * (word) 1025 [ ] + [21] (byte) rvalue::b#0 ← * (word) 1024 [ ] + [22] (byte) rvalue::b#1 ← * (word) 1025 [ ] to:rvalue::@1 rvalue::@1: scope:[rvalue] from rvalue rvalue::@2 - [20] (byte) rvalue::i#2 ← phi( rvalue/(byte) 2 rvalue::@2/(byte) rvalue::i#1 ) [ rvalue::i#2 ] - [21] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] + [23] (byte) rvalue::i#2 ← phi( rvalue/(byte) 2 rvalue::@2/(byte) rvalue::i#1 ) [ rvalue::i#2 ] + [24] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] to:rvalue::@return rvalue::@return: scope:[rvalue] from rvalue::@1 - [22] return [ ] + [25] return [ ] to:@return rvalue::@2: scope:[rvalue] from rvalue::@1 - [23] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] - [24] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] + [26] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] + [27] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] to:rvalue::@1 lvalue: scope:[lvalue] from main - [25] *((word) 1024) ← (byte) 1 [ ] - [26] *((word) 1025) ← (byte) 2 [ ] + [28] *((word) 1024) ← (byte) 1 [ ] + [29] *((word) 1025) ← (byte) 2 [ ] to:lvalue::@1 lvalue::@1: scope:[lvalue] from lvalue lvalue::@2 - [27] (byte) lvalue::i#2 ← phi( lvalue/(byte) 2 lvalue::@2/(byte) lvalue::i#1 ) [ lvalue::i#2 ] - [28] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] + [30] (byte) lvalue::i#2 ← phi( lvalue/(byte) 2 lvalue::@2/(byte) lvalue::i#1 ) [ lvalue::i#2 ] + [31] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] to:lvalue::@return lvalue::@return: scope:[lvalue] from lvalue::@1 - [29] return [ ] + [32] return [ ] to:@return lvalue::@2: scope:[lvalue] from lvalue::@1 - [30] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] - [31] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] + [33] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] + [34] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] to:lvalue::@1 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 7d2a9589e..8a521d4c2 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log @@ -1695,113 +1695,120 @@ lvalue::@2: scope:[lvalue] from lvalue::@1 (byte~) lvalue::i#4 ← (byte) lvalue::i#1 to:lvalue::@1 -Adding empty live range for unused variable rvaluevar::b#0 -Adding empty live range for unused variable rvalue::b#0 -Adding empty live range for unused variable rvalue::b#1 -Adding empty live range for unused variable rvalue::b#2 +Adding NOP phi() at start of main +Adding NOP phi() at start of lvaluevar +Adding NOP phi() at start of rvaluevar +CALL GRAPH +Calls in [] to 0:main +Calls in [main] to 2:lvalue 3:rvalue 4:rvaluevar 5:lvaluevar + Propagating live ranges... Propagating live ranges... Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call lvalue param-assignment [ ] + [1] phi() [ ] + [2] call lvalue param-assignment [ ] to:main::@1 main::@1: scope:[main] from main - [2] call rvalue param-assignment [ ] + [3] call rvalue param-assignment [ ] to:main::@2 main::@2: scope:[main] from main::@1 - [3] call rvaluevar param-assignment [ ] + [4] call rvaluevar param-assignment [ ] to:main::@3 main::@3: scope:[main] from main::@2 - [4] call lvaluevar param-assignment [ ] + [5] call lvaluevar param-assignment [ ] to:main::@return main::@return: scope:[main] from main::@3 - [5] return [ ] + [6] return [ ] to:@return lvaluevar: scope:[lvaluevar] from main::@3 + [7] phi() [ ] to:lvaluevar::@1 lvaluevar::@1: scope:[lvaluevar] from lvaluevar lvaluevar::@2 - [6] (byte*) lvaluevar::screen#2 ← phi( lvaluevar/(word) 1024 lvaluevar::@2/(byte*~) lvaluevar::screen#4 ) [ lvaluevar::i#2 lvaluevar::screen#2 ] - [6] (byte) lvaluevar::i#2 ← phi( lvaluevar/(byte) 2 lvaluevar::@2/(byte~) lvaluevar::i#4 ) [ lvaluevar::i#2 lvaluevar::screen#2 ] - [7] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] + [8] (byte*) lvaluevar::screen#2 ← phi( lvaluevar/(word) 1024 lvaluevar::@2/(byte*~) lvaluevar::screen#4 ) [ lvaluevar::i#2 lvaluevar::screen#2 ] + [8] (byte) lvaluevar::i#2 ← phi( lvaluevar/(byte) 2 lvaluevar::@2/(byte~) lvaluevar::i#4 ) [ lvaluevar::i#2 lvaluevar::screen#2 ] + [9] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] to:lvaluevar::@return lvaluevar::@return: scope:[lvaluevar] from lvaluevar::@1 - [8] return [ ] + [10] return [ ] to:@return lvaluevar::@2: scope:[lvaluevar] from lvaluevar::@1 - [9] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] - [10] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::i#2 lvaluevar::screen#1 ] - [11] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] - [12] (byte~) lvaluevar::i#4 ← (byte) lvaluevar::i#1 [ lvaluevar::i#4 lvaluevar::screen#1 ] - [13] (byte*~) lvaluevar::screen#4 ← (byte*) lvaluevar::screen#1 [ lvaluevar::i#4 lvaluevar::screen#4 ] + [11] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] + [12] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::i#2 lvaluevar::screen#1 ] + [13] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::screen#1 lvaluevar::i#1 ] + [14] (byte~) lvaluevar::i#4 ← (byte) lvaluevar::i#1 [ lvaluevar::i#4 lvaluevar::screen#1 ] + [15] (byte*~) lvaluevar::screen#4 ← (byte*) lvaluevar::screen#1 [ lvaluevar::i#4 lvaluevar::screen#4 ] to:lvaluevar::@1 rvaluevar: scope:[rvaluevar] from main::@2 + [16] phi() [ ] to:rvaluevar::@1 rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 - [14] (byte*) rvaluevar::screen#2 ← phi( rvaluevar/(word) 1024 rvaluevar::@2/(byte*~) rvaluevar::screen#4 ) [ rvaluevar::i#2 rvaluevar::screen#2 ] - [14] (byte) rvaluevar::i#2 ← phi( rvaluevar/(byte) 2 rvaluevar::@2/(byte~) rvaluevar::i#4 ) [ rvaluevar::i#2 rvaluevar::screen#2 ] - [15] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] + [17] (byte*) rvaluevar::screen#2 ← phi( rvaluevar/(word) 1024 rvaluevar::@2/(byte*~) rvaluevar::screen#4 ) [ rvaluevar::i#2 rvaluevar::screen#2 ] + [17] (byte) rvaluevar::i#2 ← phi( rvaluevar/(byte) 2 rvaluevar::@2/(byte~) rvaluevar::i#4 ) [ rvaluevar::i#2 rvaluevar::screen#2 ] + [18] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] to:rvaluevar::@return rvaluevar::@return: scope:[rvaluevar] from rvaluevar::@1 - [16] return [ ] + [19] return [ ] to:@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - [17] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] - [18] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] - [19] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] - [20] (byte~) rvaluevar::i#4 ← (byte) rvaluevar::i#1 [ rvaluevar::i#4 rvaluevar::screen#1 ] - [21] (byte*~) rvaluevar::screen#4 ← (byte*) rvaluevar::screen#1 [ rvaluevar::i#4 rvaluevar::screen#4 ] + [20] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] + [21] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] + [22] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::screen#1 rvaluevar::i#1 ] + [23] (byte~) rvaluevar::i#4 ← (byte) rvaluevar::i#1 [ rvaluevar::i#4 rvaluevar::screen#1 ] + [24] (byte*~) rvaluevar::screen#4 ← (byte*) rvaluevar::screen#1 [ rvaluevar::i#4 rvaluevar::screen#4 ] to:rvaluevar::@1 rvalue: scope:[rvalue] from main::@1 - [22] (byte) rvalue::b#0 ← * (word) 1024 [ ] - [23] (byte) rvalue::b#1 ← * (word) 1025 [ ] + [25] (byte) rvalue::b#0 ← * (word) 1024 [ ] + [26] (byte) rvalue::b#1 ← * (word) 1025 [ ] to:rvalue::@1 rvalue::@1: scope:[rvalue] from rvalue rvalue::@2 - [24] (byte) rvalue::i#2 ← phi( rvalue/(byte) 2 rvalue::@2/(byte~) rvalue::i#4 ) [ rvalue::i#2 ] - [25] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] + [27] (byte) rvalue::i#2 ← phi( rvalue/(byte) 2 rvalue::@2/(byte~) rvalue::i#4 ) [ rvalue::i#2 ] + [28] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] to:rvalue::@return rvalue::@return: scope:[rvalue] from rvalue::@1 - [26] return [ ] + [29] return [ ] to:@return rvalue::@2: scope:[rvalue] from rvalue::@1 - [27] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] - [28] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] - [29] (byte~) rvalue::i#4 ← (byte) rvalue::i#1 [ rvalue::i#4 ] + [30] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] + [31] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] + [32] (byte~) rvalue::i#4 ← (byte) rvalue::i#1 [ rvalue::i#4 ] to:rvalue::@1 lvalue: scope:[lvalue] from main - [30] *((word) 1024) ← (byte) 1 [ ] - [31] *((word) 1025) ← (byte) 2 [ ] + [33] *((word) 1024) ← (byte) 1 [ ] + [34] *((word) 1025) ← (byte) 2 [ ] to:lvalue::@1 lvalue::@1: scope:[lvalue] from lvalue lvalue::@2 - [32] (byte) lvalue::i#2 ← phi( lvalue/(byte) 2 lvalue::@2/(byte~) lvalue::i#4 ) [ lvalue::i#2 ] - [33] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] + [35] (byte) lvalue::i#2 ← phi( lvalue/(byte) 2 lvalue::@2/(byte~) lvalue::i#4 ) [ lvalue::i#2 ] + [36] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] to:lvalue::@return lvalue::@return: scope:[lvalue] from lvalue::@1 - [34] return [ ] + [37] return [ ] to:@return lvalue::@2: scope:[lvalue] from lvalue::@1 - [35] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] - [36] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] - [37] (byte~) lvalue::i#4 ← (byte) lvalue::i#1 [ lvalue::i#4 ] + [38] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] + [39] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] + [40] (byte~) lvalue::i#4 ← (byte) lvalue::i#1 [ lvalue::i#4 ] to:lvalue::@1 Created 6 initial phi equivalence classes -Coalesced [12] lvaluevar::i#4 ← lvaluevar::i#1 -Coalesced [13] lvaluevar::screen#4 ← lvaluevar::screen#1 -Coalesced [20] rvaluevar::i#4 ← rvaluevar::i#1 -Coalesced [21] rvaluevar::screen#4 ← rvaluevar::screen#1 -Coalesced [29] rvalue::i#4 ← rvalue::i#1 -Coalesced [37] lvalue::i#4 ← lvalue::i#1 +Coalesced [14] lvaluevar::i#4 ← lvaluevar::i#1 +Coalesced [15] lvaluevar::screen#4 ← lvaluevar::screen#1 +Coalesced [23] rvaluevar::i#4 ← rvaluevar::i#1 +Coalesced [24] rvaluevar::screen#4 ← rvaluevar::screen#1 +Coalesced [32] rvalue::i#4 ← rvalue::i#1 +Coalesced [40] lvalue::i#4 ← lvalue::i#1 Coalesced down to 6 phi equivalence classes Block Sequence Planned @begin @end main main::@1 main::@2 main::@3 main::@return lvaluevar lvaluevar::@1 lvaluevar::@return lvaluevar::@2 rvaluevar rvaluevar::@1 rvaluevar::@return rvaluevar::@2 rvalue rvalue::@1 rvalue::@return rvalue::@2 lvalue lvalue::@1 lvalue::@return lvalue::@2 -Adding empty live range for unused variable rvaluevar::b#0 -Adding empty live range for unused variable rvalue::b#0 -Adding empty live range for unused variable rvalue::b#1 -Adding empty live range for unused variable rvalue::b#2 +Adding NOP phi() at start of main +Adding NOP phi() at start of lvaluevar +Adding NOP phi() at start of rvaluevar +Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... @@ -1811,85 +1818,84 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call lvalue param-assignment [ ] + [1] phi() [ ] + [2] call lvalue param-assignment [ ] to:main::@1 main::@1: scope:[main] from main - [2] call rvalue param-assignment [ ] + [3] call rvalue param-assignment [ ] to:main::@2 main::@2: scope:[main] from main::@1 - [3] call rvaluevar param-assignment [ ] + [4] call rvaluevar param-assignment [ ] to:main::@3 main::@3: scope:[main] from main::@2 - [4] call lvaluevar param-assignment [ ] + [5] call lvaluevar param-assignment [ ] to:main::@return main::@return: scope:[main] from main::@3 - [5] return [ ] + [6] return [ ] to:@return lvaluevar: scope:[lvaluevar] from main::@3 + [7] phi() [ ] to:lvaluevar::@1 lvaluevar::@1: scope:[lvaluevar] from lvaluevar lvaluevar::@2 - [6] (byte*) lvaluevar::screen#2 ← phi( lvaluevar/(word) 1024 lvaluevar::@2/(byte*) lvaluevar::screen#1 ) [ lvaluevar::i#2 lvaluevar::screen#2 ] - [6] (byte) lvaluevar::i#2 ← phi( lvaluevar/(byte) 2 lvaluevar::@2/(byte) lvaluevar::i#1 ) [ lvaluevar::i#2 lvaluevar::screen#2 ] - [7] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] + [8] (byte*) lvaluevar::screen#2 ← phi( lvaluevar/(word) 1024 lvaluevar::@2/(byte*) lvaluevar::screen#1 ) [ lvaluevar::i#2 lvaluevar::screen#2 ] + [8] (byte) lvaluevar::i#2 ← phi( lvaluevar/(byte) 2 lvaluevar::@2/(byte) lvaluevar::i#1 ) [ lvaluevar::i#2 lvaluevar::screen#2 ] + [9] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] to:lvaluevar::@return lvaluevar::@return: scope:[lvaluevar] from lvaluevar::@1 - [8] return [ ] + [10] return [ ] to:@return lvaluevar::@2: scope:[lvaluevar] from lvaluevar::@1 - [9] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] - [10] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::screen#1 lvaluevar::i#2 ] - [11] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] + [11] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] + [12] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::i#2 lvaluevar::screen#1 ] + [13] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] to:lvaluevar::@1 rvaluevar: scope:[rvaluevar] from main::@2 + [14] phi() [ ] to:rvaluevar::@1 rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 - [12] (byte*) rvaluevar::screen#2 ← phi( rvaluevar/(word) 1024 rvaluevar::@2/(byte*) rvaluevar::screen#1 ) [ rvaluevar::i#2 rvaluevar::screen#2 ] - [12] (byte) rvaluevar::i#2 ← phi( rvaluevar/(byte) 2 rvaluevar::@2/(byte) rvaluevar::i#1 ) [ rvaluevar::i#2 rvaluevar::screen#2 ] - [13] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] + [15] (byte*) rvaluevar::screen#2 ← phi( rvaluevar/(word) 1024 rvaluevar::@2/(byte*) rvaluevar::screen#1 ) [ rvaluevar::i#2 rvaluevar::screen#2 ] + [15] (byte) rvaluevar::i#2 ← phi( rvaluevar/(byte) 2 rvaluevar::@2/(byte) rvaluevar::i#1 ) [ rvaluevar::i#2 rvaluevar::screen#2 ] + [16] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] to:rvaluevar::@return rvaluevar::@return: scope:[rvaluevar] from rvaluevar::@1 - [14] return [ ] + [17] return [ ] to:@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - [15] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] - [16] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::screen#1 rvaluevar::i#2 ] - [17] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] + [18] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] + [19] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] + [20] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] to:rvaluevar::@1 rvalue: scope:[rvalue] from main::@1 - [18] (byte) rvalue::b#0 ← * (word) 1024 [ ] - [19] (byte) rvalue::b#1 ← * (word) 1025 [ ] + [21] (byte) rvalue::b#0 ← * (word) 1024 [ ] + [22] (byte) rvalue::b#1 ← * (word) 1025 [ ] to:rvalue::@1 rvalue::@1: scope:[rvalue] from rvalue rvalue::@2 - [20] (byte) rvalue::i#2 ← phi( rvalue/(byte) 2 rvalue::@2/(byte) rvalue::i#1 ) [ rvalue::i#2 ] - [21] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] + [23] (byte) rvalue::i#2 ← phi( rvalue/(byte) 2 rvalue::@2/(byte) rvalue::i#1 ) [ rvalue::i#2 ] + [24] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] to:rvalue::@return rvalue::@return: scope:[rvalue] from rvalue::@1 - [22] return [ ] + [25] return [ ] to:@return rvalue::@2: scope:[rvalue] from rvalue::@1 - [23] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] - [24] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] + [26] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] + [27] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] to:rvalue::@1 lvalue: scope:[lvalue] from main - [25] *((word) 1024) ← (byte) 1 [ ] - [26] *((word) 1025) ← (byte) 2 [ ] + [28] *((word) 1024) ← (byte) 1 [ ] + [29] *((word) 1025) ← (byte) 2 [ ] to:lvalue::@1 lvalue::@1: scope:[lvalue] from lvalue lvalue::@2 - [27] (byte) lvalue::i#2 ← phi( lvalue/(byte) 2 lvalue::@2/(byte) lvalue::i#1 ) [ lvalue::i#2 ] - [28] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] + [30] (byte) lvalue::i#2 ← phi( lvalue/(byte) 2 lvalue::@2/(byte) lvalue::i#1 ) [ lvalue::i#2 ] + [31] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] to:lvalue::@return lvalue::@return: scope:[lvalue] from lvalue::@1 - [29] return [ ] + [32] return [ ] to:@return lvalue::@2: scope:[lvalue] from lvalue::@1 - [30] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] - [31] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] + [33] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] + [34] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] to:lvalue::@1 -CALL GRAPH -Calls in [] to 0:main -Calls in [main] to 1:lvalue 2:rvalue 3:rvaluevar 4:lvaluevar - DOMINATORS @begin dominated by @begin @end dominated by @end @begin @@ -1964,15 +1970,15 @@ VARIABLE REGISTER WEIGHTS (void()) rvalue() (byte[1024]) rvalue::SCREEN (byte) rvalue::b -(byte) rvalue::b#0 Infinity -(byte) rvalue::b#1 Infinity -(byte) rvalue::b#2 Infinity +(byte) rvalue::b#0 20.0 +(byte) rvalue::b#1 20.0 +(byte) rvalue::b#2 110.0 (byte) rvalue::i (byte) rvalue::i#1 22.0 (byte) rvalue::i#2 14.666666666666666 (void()) rvaluevar() (byte) rvaluevar::b -(byte) rvaluevar::b#0 Infinity +(byte) rvaluevar::b#0 110.0 (byte) rvaluevar::i (byte) rvaluevar::i#1 22.0 (byte) rvaluevar::i#2 8.25 @@ -2017,223 +2023,229 @@ INITIAL ASM //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main jmp bend -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] call lvalue param-assignment [ ] + //SEG6 [2] call lvalue param-assignment [ ] jsr lvalue jmp b1 - //SEG6 main::@1 + //SEG7 main::@1 b1: - //SEG7 [2] call rvalue param-assignment [ ] + //SEG8 [3] call rvalue param-assignment [ ] jsr rvalue jmp b2 - //SEG8 main::@2 + //SEG9 main::@2 b2: - //SEG9 [3] call rvaluevar param-assignment [ ] + //SEG10 [4] call rvaluevar param-assignment [ ] + //SEG11 [14] phi from main::@2 to rvaluevar + rvaluevar_from_b2: jsr rvaluevar jmp b3 - //SEG10 main::@3 + //SEG12 main::@3 b3: - //SEG11 [4] call lvaluevar param-assignment [ ] + //SEG13 [5] call lvaluevar param-assignment [ ] + //SEG14 [7] phi from main::@3 to lvaluevar + lvaluevar_from_b3: jsr lvaluevar jmp breturn - //SEG12 main::@return + //SEG15 main::@return breturn: - //SEG13 [5] return [ ] + //SEG16 [6] return [ ] rts } -//SEG14 lvaluevar +//SEG17 lvaluevar lvaluevar: { .label screen = 3 .label i = 2 - //SEG15 [6] phi from lvaluevar to lvaluevar::@1 + //SEG18 [8] phi from lvaluevar to lvaluevar::@1 b1_from_lvaluevar: - //SEG16 [6] phi (byte*) lvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG19 [8] phi (byte*) lvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 - //SEG17 [6] phi (byte) lvaluevar::i#2 = (byte) 2 -- zpby1=coby1 + //SEG20 [8] phi (byte) lvaluevar::i#2 = (byte) 2 -- zpby1=coby1 lda #$2 sta i jmp b1 - //SEG18 lvaluevar::@1 + //SEG21 lvaluevar::@1 b1: - //SEG19 [7] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- zpby1_lt_coby1_then_la1 + //SEG22 [9] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- zpby1_lt_coby1_then_la1 lda i cmp #$a bcc b2 jmp breturn - //SEG20 lvaluevar::@return + //SEG23 lvaluevar::@return breturn: - //SEG21 [8] return [ ] + //SEG24 [10] return [ ] rts - //SEG22 lvaluevar::@2 + //SEG25 lvaluevar::@2 b2: - //SEG23 [9] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- _star_zpptrby1=coby1 + //SEG26 [11] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$4 sta (screen),y - //SEG24 [10] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::screen#1 lvaluevar::i#2 ] -- zpptrby1=_inc_zpptrby1 + //SEG27 [12] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::i#2 lvaluevar::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG25 [11] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] -- zpby1=_inc_zpby1 + //SEG28 [13] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] -- zpby1=_inc_zpby1 inc i - //SEG26 [6] phi from lvaluevar::@2 to lvaluevar::@1 + //SEG29 [8] phi from lvaluevar::@2 to lvaluevar::@1 b1_from_b2: - //SEG27 [6] phi (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#1 -- register_copy - //SEG28 [6] phi (byte) lvaluevar::i#2 = (byte) lvaluevar::i#1 -- register_copy + //SEG30 [8] phi (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#1 -- register_copy + //SEG31 [8] phi (byte) lvaluevar::i#2 = (byte) lvaluevar::i#1 -- register_copy jmp b1 } -//SEG29 rvaluevar +//SEG32 rvaluevar rvaluevar: { .label b = 10 .label screen = 6 .label i = 5 - //SEG30 [12] phi from rvaluevar to rvaluevar::@1 + //SEG33 [15] phi from rvaluevar to rvaluevar::@1 b1_from_rvaluevar: - //SEG31 [12] phi (byte*) rvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG34 [15] phi (byte*) rvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 - //SEG32 [12] phi (byte) rvaluevar::i#2 = (byte) 2 -- zpby1=coby1 + //SEG35 [15] phi (byte) rvaluevar::i#2 = (byte) 2 -- zpby1=coby1 lda #$2 sta i jmp b1 - //SEG33 rvaluevar::@1 + //SEG36 rvaluevar::@1 b1: - //SEG34 [13] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- zpby1_lt_coby1_then_la1 + //SEG37 [16] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- zpby1_lt_coby1_then_la1 lda i cmp #$a bcc b2 jmp breturn - //SEG35 rvaluevar::@return + //SEG38 rvaluevar::@return breturn: - //SEG36 [14] return [ ] + //SEG39 [17] return [ ] rts - //SEG37 rvaluevar::@2 + //SEG40 rvaluevar::@2 b2: - //SEG38 [15] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- zpby1=_star_zpptrby1 + //SEG41 [18] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- zpby1=_star_zpptrby1 ldy #$0 lda (screen),y sta b - //SEG39 [16] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::screen#1 rvaluevar::i#2 ] -- zpptrby1=_inc_zpptrby1 + //SEG42 [19] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG40 [17] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] -- zpby1=_inc_zpby1 + //SEG43 [20] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] -- zpby1=_inc_zpby1 inc i - //SEG41 [12] phi from rvaluevar::@2 to rvaluevar::@1 + //SEG44 [15] phi from rvaluevar::@2 to rvaluevar::@1 b1_from_b2: - //SEG42 [12] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 -- register_copy - //SEG43 [12] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 -- register_copy + //SEG45 [15] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 -- register_copy + //SEG46 [15] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 -- register_copy jmp b1 } -//SEG44 rvalue +//SEG47 rvalue rvalue: { .label b = 11 - .label b#1 = 12 - .label b#2 = 13 + .label b_1 = 12 + .label b_2 = 13 .label i = 8 - //SEG45 [18] (byte) rvalue::b#0 ← * (word) 1024 [ ] -- zpby1=_star_cowo1 + //SEG48 [21] (byte) rvalue::b#0 ← * (word) 1024 [ ] -- zpby1=_star_cowo1 lda $400 sta b - //SEG46 [19] (byte) rvalue::b#1 ← * (word) 1025 [ ] -- zpby1=_star_cowo1 + //SEG49 [22] (byte) rvalue::b#1 ← * (word) 1025 [ ] -- zpby1=_star_cowo1 lda $401 sta b_1 - //SEG47 [20] phi from rvalue to rvalue::@1 + //SEG50 [23] phi from rvalue to rvalue::@1 b1_from_rvalue: - //SEG48 [20] phi (byte) rvalue::i#2 = (byte) 2 -- zpby1=coby1 + //SEG51 [23] phi (byte) rvalue::i#2 = (byte) 2 -- zpby1=coby1 lda #$2 sta i jmp b1 - //SEG49 rvalue::@1 + //SEG52 rvalue::@1 b1: - //SEG50 [21] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] -- zpby1_lt_coby1_then_la1 + //SEG53 [24] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] -- zpby1_lt_coby1_then_la1 lda i cmp #$a bcc b2 jmp breturn - //SEG51 rvalue::@return + //SEG54 rvalue::@return breturn: - //SEG52 [22] return [ ] + //SEG55 [25] return [ ] rts - //SEG53 rvalue::@2 + //SEG56 rvalue::@2 b2: - //SEG54 [23] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] -- zpby1=cowo1_staridx_zpby2 + //SEG57 [26] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] -- zpby1=cowo1_staridx_zpby2 ldx i lda $400,x sta b_2 - //SEG55 [24] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] -- zpby1=_inc_zpby1 + //SEG58 [27] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] -- zpby1=_inc_zpby1 inc i - //SEG56 [20] phi from rvalue::@2 to rvalue::@1 + //SEG59 [23] phi from rvalue::@2 to rvalue::@1 b1_from_b2: - //SEG57 [20] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 -- register_copy + //SEG60 [23] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 -- register_copy jmp b1 } -//SEG58 lvalue +//SEG61 lvalue lvalue: { .label i = 9 - //SEG59 [25] *((word) 1024) ← (byte) 1 [ ] -- _star_cowo1=coby2 + //SEG62 [28] *((word) 1024) ← (byte) 1 [ ] -- _star_cowo1=coby2 lda #$1 sta $400 - //SEG60 [26] *((word) 1025) ← (byte) 2 [ ] -- _star_cowo1=coby2 + //SEG63 [29] *((word) 1025) ← (byte) 2 [ ] -- _star_cowo1=coby2 lda #$2 sta $401 - //SEG61 [27] phi from lvalue to lvalue::@1 + //SEG64 [30] phi from lvalue to lvalue::@1 b1_from_lvalue: - //SEG62 [27] phi (byte) lvalue::i#2 = (byte) 2 -- zpby1=coby1 + //SEG65 [30] phi (byte) lvalue::i#2 = (byte) 2 -- zpby1=coby1 lda #$2 sta i jmp b1 - //SEG63 lvalue::@1 + //SEG66 lvalue::@1 b1: - //SEG64 [28] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] -- zpby1_lt_coby1_then_la1 + //SEG67 [31] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] -- zpby1_lt_coby1_then_la1 lda i cmp #$a bcc b2 jmp breturn - //SEG65 lvalue::@return + //SEG68 lvalue::@return breturn: - //SEG66 [29] return [ ] + //SEG69 [32] return [ ] rts - //SEG67 lvalue::@2 + //SEG70 lvalue::@2 b2: - //SEG68 [30] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] -- cowo1_staridx_zpby1=coby2 + //SEG71 [33] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] -- cowo1_staridx_zpby1=coby2 lda #$3 ldx i sta $400,x - //SEG69 [31] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] -- zpby1=_inc_zpby1 + //SEG72 [34] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] -- zpby1=_inc_zpby1 inc i - //SEG70 [27] phi from lvalue::@2 to lvalue::@1 + //SEG73 [30] phi from lvalue::@2 to lvalue::@1 b1_from_b2: - //SEG71 [27] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 -- register_copy + //SEG74 [30] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 -- register_copy jmp b1 } -Statement [9] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] always clobbers reg byte a reg byte y +Statement [11] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] always clobbers reg byte a reg byte y Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ lvaluevar::i#2 lvaluevar::i#1 ] Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ lvaluevar::i#2 lvaluevar::i#1 ] -Statement [15] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] always clobbers reg byte a reg byte y +Statement [18] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] always clobbers reg byte a reg byte y Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ] Removing always clobbered register reg byte y as potential for zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ] -Statement [25] *((word) 1024) ← (byte) 1 [ ] always clobbers reg byte a -Statement [26] *((word) 1025) ← (byte) 2 [ ] always clobbers reg byte a -Statement [30] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] always clobbers reg byte a +Statement [28] *((word) 1024) ← (byte) 1 [ ] always clobbers reg byte a +Statement [29] *((word) 1025) ← (byte) 2 [ ] always clobbers reg byte a +Statement [33] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ lvalue::i#2 lvalue::i#1 ] -Statement [9] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] always clobbers reg byte a reg byte y -Statement [15] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] always clobbers reg byte a reg byte y -Statement [25] *((word) 1024) ← (byte) 1 [ ] always clobbers reg byte a -Statement [26] *((word) 1025) ← (byte) 2 [ ] always clobbers reg byte a -Statement [30] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] always clobbers reg byte a +Statement [11] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] always clobbers reg byte a reg byte y +Statement [18] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] always clobbers reg byte a reg byte y +Statement [28] *((word) 1024) ← (byte) 1 [ ] always clobbers reg byte a +Statement [29] *((word) 1025) ← (byte) 2 [ ] always clobbers reg byte a +Statement [33] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] always clobbers reg byte a REGISTER UPLIFT POTENTIAL REGISTERS Potential registers zp ZP_BYTE:2 [ lvaluevar::i#2 lvaluevar::i#1 ] : zp ZP_BYTE:2 , reg byte x , Potential registers zp ZP_PTR_BYTE:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] : zp ZP_PTR_BYTE:3 , @@ -2247,14 +2259,14 @@ Potential registers zp ZP_BYTE:12 [ rvalue::b#1 ] : zp ZP_BYTE:12 , reg byte a , Potential registers zp ZP_BYTE:13 [ rvalue::b#2 ] : zp ZP_BYTE:13 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -Uplift Scope [rvalue] ∞: zp ZP_BYTE:11 [ rvalue::b#0 ] ∞: zp ZP_BYTE:12 [ rvalue::b#1 ] ∞: zp ZP_BYTE:13 [ rvalue::b#2 ] 36.67: zp ZP_BYTE:8 [ rvalue::i#2 rvalue::i#1 ] -Uplift Scope [rvaluevar] ∞: zp ZP_BYTE:10 [ rvaluevar::b#0 ] 30.25: zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ] 22: zp ZP_PTR_BYTE:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ] +Uplift Scope [rvalue] 110: zp ZP_BYTE:13 [ rvalue::b#2 ] 36.67: zp ZP_BYTE:8 [ rvalue::i#2 rvalue::i#1 ] 20: zp ZP_BYTE:11 [ rvalue::b#0 ] 20: zp ZP_BYTE:12 [ rvalue::b#1 ] +Uplift Scope [rvaluevar] 110: zp ZP_BYTE:10 [ rvaluevar::b#0 ] 30.25: zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ] 22: zp ZP_PTR_BYTE:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ] Uplift Scope [lvaluevar] 30.25: zp ZP_BYTE:2 [ lvaluevar::i#2 lvaluevar::i#1 ] 22: zp ZP_PTR_BYTE:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] Uplift Scope [lvalue] 36.67: zp ZP_BYTE:9 [ lvalue::i#2 lvalue::i#1 ] Uplift Scope [main] Uplift Scope [] -Uplifting [rvalue] best 1865 combination reg byte a [ rvalue::b#0 ] reg byte a [ rvalue::b#1 ] reg byte a [ rvalue::b#2 ] reg byte x [ rvalue::i#2 rvalue::i#1 ] +Uplifting [rvalue] best 1865 combination reg byte a [ rvalue::b#2 ] reg byte x [ rvalue::i#2 rvalue::i#1 ] reg byte a [ rvalue::b#0 ] reg byte a [ rvalue::b#1 ] Uplifting [rvaluevar] best 1745 combination reg byte a [ rvaluevar::b#0 ] reg byte x [ rvaluevar::i#2 rvaluevar::i#1 ] zp ZP_PTR_BYTE:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ] Uplifting [lvaluevar] best 1655 combination reg byte x [ lvaluevar::i#2 lvaluevar::i#1 ] zp ZP_PTR_BYTE:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] Uplifting [lvalue] best 1535 combination reg byte x [ lvalue::i#2 lvalue::i#1 ] @@ -2281,170 +2293,355 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] call lvalue param-assignment [ ] + //SEG6 [2] call lvalue param-assignment [ ] jsr lvalue - //SEG6 main::@1 + //SEG7 main::@1 b1: - //SEG7 [2] call rvalue param-assignment [ ] + //SEG8 [3] call rvalue param-assignment [ ] jsr rvalue - //SEG8 main::@2 + //SEG9 main::@2 b2: - //SEG9 [3] call rvaluevar param-assignment [ ] + //SEG10 [4] call rvaluevar param-assignment [ ] + //SEG11 [14] phi from main::@2 to rvaluevar + rvaluevar_from_b2: jsr rvaluevar - //SEG10 main::@3 + //SEG12 main::@3 b3: - //SEG11 [4] call lvaluevar param-assignment [ ] + //SEG13 [5] call lvaluevar param-assignment [ ] + //SEG14 [7] phi from main::@3 to lvaluevar + lvaluevar_from_b3: jsr lvaluevar - //SEG12 main::@return + //SEG15 main::@return breturn: - //SEG13 [5] return [ ] + //SEG16 [6] return [ ] rts } -//SEG14 lvaluevar +//SEG17 lvaluevar lvaluevar: { .label screen = 2 - //SEG15 [6] phi from lvaluevar to lvaluevar::@1 + //SEG18 [8] phi from lvaluevar to lvaluevar::@1 b1_from_lvaluevar: - //SEG16 [6] phi (byte*) lvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG19 [8] phi (byte*) lvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 - //SEG17 [6] phi (byte) lvaluevar::i#2 = (byte) 2 -- xby=coby1 + //SEG20 [8] phi (byte) lvaluevar::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG18 lvaluevar::@1 + //SEG21 lvaluevar::@1 b1: - //SEG19 [7] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 + //SEG22 [9] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG20 lvaluevar::@return + //SEG23 lvaluevar::@return breturn: - //SEG21 [8] return [ ] + //SEG24 [10] return [ ] rts - //SEG22 lvaluevar::@2 + //SEG25 lvaluevar::@2 b2: - //SEG23 [9] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- _star_zpptrby1=coby1 + //SEG26 [11] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$4 sta (screen),y - //SEG24 [10] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::screen#1 lvaluevar::i#2 ] -- zpptrby1=_inc_zpptrby1 + //SEG27 [12] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::i#2 lvaluevar::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG25 [11] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] -- xby=_inc_xby + //SEG28 [13] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] -- xby=_inc_xby inx - //SEG26 [6] phi from lvaluevar::@2 to lvaluevar::@1 + //SEG29 [8] phi from lvaluevar::@2 to lvaluevar::@1 b1_from_b2: - //SEG27 [6] phi (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#1 -- register_copy - //SEG28 [6] phi (byte) lvaluevar::i#2 = (byte) lvaluevar::i#1 -- register_copy + //SEG30 [8] phi (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#1 -- register_copy + //SEG31 [8] phi (byte) lvaluevar::i#2 = (byte) lvaluevar::i#1 -- register_copy jmp b1 } -//SEG29 rvaluevar +//SEG32 rvaluevar rvaluevar: { .label screen = 2 - //SEG30 [12] phi from rvaluevar to rvaluevar::@1 + //SEG33 [15] phi from rvaluevar to rvaluevar::@1 b1_from_rvaluevar: - //SEG31 [12] phi (byte*) rvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG34 [15] phi (byte*) rvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 - //SEG32 [12] phi (byte) rvaluevar::i#2 = (byte) 2 -- xby=coby1 + //SEG35 [15] phi (byte) rvaluevar::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG33 rvaluevar::@1 + //SEG36 rvaluevar::@1 b1: - //SEG34 [13] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 + //SEG37 [16] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG35 rvaluevar::@return + //SEG38 rvaluevar::@return breturn: - //SEG36 [14] return [ ] + //SEG39 [17] return [ ] rts - //SEG37 rvaluevar::@2 + //SEG40 rvaluevar::@2 b2: - //SEG38 [15] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- aby=_star_zpptrby1 + //SEG41 [18] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- aby=_star_zpptrby1 ldy #$0 lda (screen),y - //SEG39 [16] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::screen#1 rvaluevar::i#2 ] -- zpptrby1=_inc_zpptrby1 + //SEG42 [19] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG40 [17] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] -- xby=_inc_xby + //SEG43 [20] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] -- xby=_inc_xby inx - //SEG41 [12] phi from rvaluevar::@2 to rvaluevar::@1 + //SEG44 [15] phi from rvaluevar::@2 to rvaluevar::@1 b1_from_b2: - //SEG42 [12] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 -- register_copy - //SEG43 [12] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 -- register_copy + //SEG45 [15] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 -- register_copy + //SEG46 [15] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 -- register_copy jmp b1 } -//SEG44 rvalue +//SEG47 rvalue rvalue: { - //SEG45 [18] (byte) rvalue::b#0 ← * (word) 1024 [ ] -- aby=_star_cowo1 + //SEG48 [21] (byte) rvalue::b#0 ← * (word) 1024 [ ] -- aby=_star_cowo1 lda $400 - //SEG46 [19] (byte) rvalue::b#1 ← * (word) 1025 [ ] -- aby=_star_cowo1 + //SEG49 [22] (byte) rvalue::b#1 ← * (word) 1025 [ ] -- aby=_star_cowo1 lda $401 - //SEG47 [20] phi from rvalue to rvalue::@1 + //SEG50 [23] phi from rvalue to rvalue::@1 b1_from_rvalue: - //SEG48 [20] phi (byte) rvalue::i#2 = (byte) 2 -- xby=coby1 + //SEG51 [23] phi (byte) rvalue::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG49 rvalue::@1 + //SEG52 rvalue::@1 b1: - //SEG50 [21] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] -- xby_lt_coby1_then_la1 + //SEG53 [24] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG51 rvalue::@return + //SEG54 rvalue::@return breturn: - //SEG52 [22] return [ ] + //SEG55 [25] return [ ] rts - //SEG53 rvalue::@2 + //SEG56 rvalue::@2 b2: - //SEG54 [23] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] -- aby=cowo1_staridx_xby + //SEG57 [26] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] -- aby=cowo1_staridx_xby lda $400,x - //SEG55 [24] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] -- xby=_inc_xby + //SEG58 [27] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] -- xby=_inc_xby inx - //SEG56 [20] phi from rvalue::@2 to rvalue::@1 + //SEG59 [23] phi from rvalue::@2 to rvalue::@1 b1_from_b2: - //SEG57 [20] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 -- register_copy + //SEG60 [23] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 -- register_copy jmp b1 } -//SEG58 lvalue +//SEG61 lvalue lvalue: { - //SEG59 [25] *((word) 1024) ← (byte) 1 [ ] -- _star_cowo1=coby2 + //SEG62 [28] *((word) 1024) ← (byte) 1 [ ] -- _star_cowo1=coby2 lda #$1 sta $400 - //SEG60 [26] *((word) 1025) ← (byte) 2 [ ] -- _star_cowo1=coby2 + //SEG63 [29] *((word) 1025) ← (byte) 2 [ ] -- _star_cowo1=coby2 lda #$2 sta $401 - //SEG61 [27] phi from lvalue to lvalue::@1 + //SEG64 [30] phi from lvalue to lvalue::@1 b1_from_lvalue: - //SEG62 [27] phi (byte) lvalue::i#2 = (byte) 2 -- xby=coby1 + //SEG65 [30] phi (byte) lvalue::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG63 lvalue::@1 + //SEG66 lvalue::@1 b1: - //SEG64 [28] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] -- xby_lt_coby1_then_la1 + //SEG67 [31] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG65 lvalue::@return + //SEG68 lvalue::@return breturn: - //SEG66 [29] return [ ] + //SEG69 [32] return [ ] rts - //SEG67 lvalue::@2 + //SEG70 lvalue::@2 b2: - //SEG68 [30] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] -- cowo1_staridx_xby=coby2 + //SEG71 [33] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] -- cowo1_staridx_xby=coby2 lda #$3 sta $400,x - //SEG69 [31] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] -- xby=_inc_xby + //SEG72 [34] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] -- xby=_inc_xby inx - //SEG70 [27] phi from lvalue::@2 to lvalue::@1 + //SEG73 [30] phi from lvalue::@2 to lvalue::@1 b1_from_b2: - //SEG71 [27] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 -- register_copy + //SEG74 [30] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 -- register_copy + jmp b1 +} + +Removing instruction main_from_bbegin: +Removing instruction rvaluevar_from_b2: +Removing instruction lvaluevar_from_b3: +Succesful ASM optimization Pass5RedundantLabelElimination +ASSEMBLER +//SEG0 Global ZP labels +//SEG1 @begin +bbegin: +//SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main + jsr main +//SEG4 @end +bend: +//SEG5 main +main: { + //SEG6 [2] call lvalue param-assignment [ ] + jsr lvalue + //SEG7 main::@1 + b1: + //SEG8 [3] call rvalue param-assignment [ ] + jsr rvalue + //SEG9 main::@2 + b2: + //SEG10 [4] call rvaluevar param-assignment [ ] + //SEG11 [14] phi from main::@2 to rvaluevar + jsr rvaluevar + //SEG12 main::@3 + b3: + //SEG13 [5] call lvaluevar param-assignment [ ] + //SEG14 [7] phi from main::@3 to lvaluevar + jsr lvaluevar + //SEG15 main::@return + breturn: + //SEG16 [6] return [ ] + rts +} +//SEG17 lvaluevar +lvaluevar: { + .label screen = 2 + //SEG18 [8] phi from lvaluevar to lvaluevar::@1 + b1_from_lvaluevar: + //SEG19 [8] phi (byte*) lvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 + lda #<$400 + sta screen + lda #>$400 + sta screen+$1 + //SEG20 [8] phi (byte) lvaluevar::i#2 = (byte) 2 -- xby=coby1 + ldx #$2 + //SEG21 lvaluevar::@1 + b1: + //SEG22 [9] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 + cpx #$a + bcc b2 + //SEG23 lvaluevar::@return + breturn: + //SEG24 [10] return [ ] + rts + //SEG25 lvaluevar::@2 + b2: + //SEG26 [11] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- _star_zpptrby1=coby1 + ldy #$0 + lda #$4 + sta (screen),y + //SEG27 [12] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::i#2 lvaluevar::screen#1 ] -- zpptrby1=_inc_zpptrby1 + inc screen + bne !+ + inc screen+$1 + !: + //SEG28 [13] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] -- xby=_inc_xby + inx + //SEG29 [8] phi from lvaluevar::@2 to lvaluevar::@1 + b1_from_b2: + //SEG30 [8] phi (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#1 -- register_copy + //SEG31 [8] phi (byte) lvaluevar::i#2 = (byte) lvaluevar::i#1 -- register_copy + jmp b1 +} +//SEG32 rvaluevar +rvaluevar: { + .label screen = 2 + //SEG33 [15] phi from rvaluevar to rvaluevar::@1 + b1_from_rvaluevar: + //SEG34 [15] phi (byte*) rvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 + lda #<$400 + sta screen + lda #>$400 + sta screen+$1 + //SEG35 [15] phi (byte) rvaluevar::i#2 = (byte) 2 -- xby=coby1 + ldx #$2 + //SEG36 rvaluevar::@1 + b1: + //SEG37 [16] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 + cpx #$a + bcc b2 + //SEG38 rvaluevar::@return + breturn: + //SEG39 [17] return [ ] + rts + //SEG40 rvaluevar::@2 + b2: + //SEG41 [18] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- aby=_star_zpptrby1 + ldy #$0 + lda (screen),y + //SEG42 [19] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] -- zpptrby1=_inc_zpptrby1 + inc screen + bne !+ + inc screen+$1 + !: + //SEG43 [20] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] -- xby=_inc_xby + inx + //SEG44 [15] phi from rvaluevar::@2 to rvaluevar::@1 + b1_from_b2: + //SEG45 [15] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 -- register_copy + //SEG46 [15] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 -- register_copy + jmp b1 +} +//SEG47 rvalue +rvalue: { + //SEG48 [21] (byte) rvalue::b#0 ← * (word) 1024 [ ] -- aby=_star_cowo1 + lda $400 + //SEG49 [22] (byte) rvalue::b#1 ← * (word) 1025 [ ] -- aby=_star_cowo1 + lda $401 + //SEG50 [23] phi from rvalue to rvalue::@1 + b1_from_rvalue: + //SEG51 [23] phi (byte) rvalue::i#2 = (byte) 2 -- xby=coby1 + ldx #$2 + //SEG52 rvalue::@1 + b1: + //SEG53 [24] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] -- xby_lt_coby1_then_la1 + cpx #$a + bcc b2 + //SEG54 rvalue::@return + breturn: + //SEG55 [25] return [ ] + rts + //SEG56 rvalue::@2 + b2: + //SEG57 [26] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] -- aby=cowo1_staridx_xby + lda $400,x + //SEG58 [27] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] -- xby=_inc_xby + inx + //SEG59 [23] phi from rvalue::@2 to rvalue::@1 + b1_from_b2: + //SEG60 [23] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 -- register_copy + jmp b1 +} +//SEG61 lvalue +lvalue: { + //SEG62 [28] *((word) 1024) ← (byte) 1 [ ] -- _star_cowo1=coby2 + lda #$1 + sta $400 + //SEG63 [29] *((word) 1025) ← (byte) 2 [ ] -- _star_cowo1=coby2 + lda #$2 + sta $401 + //SEG64 [30] phi from lvalue to lvalue::@1 + b1_from_lvalue: + //SEG65 [30] phi (byte) lvalue::i#2 = (byte) 2 -- xby=coby1 + ldx #$2 + //SEG66 lvalue::@1 + b1: + //SEG67 [31] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] -- xby_lt_coby1_then_la1 + cpx #$a + bcc b2 + //SEG68 lvalue::@return + breturn: + //SEG69 [32] return [ ] + rts + //SEG70 lvalue::@2 + b2: + //SEG71 [33] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] -- cowo1_staridx_xby=coby2 + lda #$3 + sta $400,x + //SEG72 [34] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] -- xby=_inc_xby + inx + //SEG73 [30] phi from lvalue::@2 to lvalue::@1 + b1_from_b2: + //SEG74 [30] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 -- register_copy jmp b1 } @@ -2471,153 +2668,156 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call lvalue param-assignment [ ] + //SEG6 [2] call lvalue param-assignment [ ] jsr lvalue - //SEG6 main::@1 - //SEG7 [2] call rvalue param-assignment [ ] + //SEG7 main::@1 + //SEG8 [3] call rvalue param-assignment [ ] jsr rvalue - //SEG8 main::@2 - //SEG9 [3] call rvaluevar param-assignment [ ] + //SEG9 main::@2 + //SEG10 [4] call rvaluevar param-assignment [ ] + //SEG11 [14] phi from main::@2 to rvaluevar jsr rvaluevar - //SEG10 main::@3 - //SEG11 [4] call lvaluevar param-assignment [ ] + //SEG12 main::@3 + //SEG13 [5] call lvaluevar param-assignment [ ] + //SEG14 [7] phi from main::@3 to lvaluevar jsr lvaluevar - //SEG12 main::@return - //SEG13 [5] return [ ] + //SEG15 main::@return + //SEG16 [6] return [ ] rts } -//SEG14 lvaluevar +//SEG17 lvaluevar lvaluevar: { .label screen = 2 - //SEG15 [6] phi from lvaluevar to lvaluevar::@1 - //SEG16 [6] phi (byte*) lvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG18 [8] phi from lvaluevar to lvaluevar::@1 + //SEG19 [8] phi (byte*) lvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 - //SEG17 [6] phi (byte) lvaluevar::i#2 = (byte) 2 -- xby=coby1 + //SEG20 [8] phi (byte) lvaluevar::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG18 lvaluevar::@1 + //SEG21 lvaluevar::@1 b1: - //SEG19 [7] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 + //SEG22 [9] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG20 lvaluevar::@return - //SEG21 [8] return [ ] + //SEG23 lvaluevar::@return + //SEG24 [10] return [ ] rts - //SEG22 lvaluevar::@2 + //SEG25 lvaluevar::@2 b2: - //SEG23 [9] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- _star_zpptrby1=coby1 + //SEG26 [11] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$4 sta (screen),y - //SEG24 [10] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::screen#1 lvaluevar::i#2 ] -- zpptrby1=_inc_zpptrby1 + //SEG27 [12] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::i#2 lvaluevar::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG25 [11] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] -- xby=_inc_xby + //SEG28 [13] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] -- xby=_inc_xby inx - //SEG26 [6] phi from lvaluevar::@2 to lvaluevar::@1 - //SEG27 [6] phi (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#1 -- register_copy - //SEG28 [6] phi (byte) lvaluevar::i#2 = (byte) lvaluevar::i#1 -- register_copy + //SEG29 [8] phi from lvaluevar::@2 to lvaluevar::@1 + //SEG30 [8] phi (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#1 -- register_copy + //SEG31 [8] phi (byte) lvaluevar::i#2 = (byte) lvaluevar::i#1 -- register_copy jmp b1 } -//SEG29 rvaluevar +//SEG32 rvaluevar rvaluevar: { .label screen = 2 - //SEG30 [12] phi from rvaluevar to rvaluevar::@1 - //SEG31 [12] phi (byte*) rvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG33 [15] phi from rvaluevar to rvaluevar::@1 + //SEG34 [15] phi (byte*) rvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 - //SEG32 [12] phi (byte) rvaluevar::i#2 = (byte) 2 -- xby=coby1 + //SEG35 [15] phi (byte) rvaluevar::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG33 rvaluevar::@1 + //SEG36 rvaluevar::@1 b1: - //SEG34 [13] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 + //SEG37 [16] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG35 rvaluevar::@return - //SEG36 [14] return [ ] + //SEG38 rvaluevar::@return + //SEG39 [17] return [ ] rts - //SEG37 rvaluevar::@2 + //SEG40 rvaluevar::@2 b2: - //SEG38 [15] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- aby=_star_zpptrby1 + //SEG41 [18] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- aby=_star_zpptrby1 ldy #$0 lda (screen),y - //SEG39 [16] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::screen#1 rvaluevar::i#2 ] -- zpptrby1=_inc_zpptrby1 + //SEG42 [19] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG40 [17] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] -- xby=_inc_xby + //SEG43 [20] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] -- xby=_inc_xby inx - //SEG41 [12] phi from rvaluevar::@2 to rvaluevar::@1 - //SEG42 [12] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 -- register_copy - //SEG43 [12] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 -- register_copy + //SEG44 [15] phi from rvaluevar::@2 to rvaluevar::@1 + //SEG45 [15] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 -- register_copy + //SEG46 [15] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 -- register_copy jmp b1 } -//SEG44 rvalue +//SEG47 rvalue rvalue: { - //SEG45 [18] (byte) rvalue::b#0 ← * (word) 1024 [ ] -- aby=_star_cowo1 + //SEG48 [21] (byte) rvalue::b#0 ← * (word) 1024 [ ] -- aby=_star_cowo1 lda $400 - //SEG46 [19] (byte) rvalue::b#1 ← * (word) 1025 [ ] -- aby=_star_cowo1 + //SEG49 [22] (byte) rvalue::b#1 ← * (word) 1025 [ ] -- aby=_star_cowo1 lda $401 - //SEG47 [20] phi from rvalue to rvalue::@1 - //SEG48 [20] phi (byte) rvalue::i#2 = (byte) 2 -- xby=coby1 + //SEG50 [23] phi from rvalue to rvalue::@1 + //SEG51 [23] phi (byte) rvalue::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG49 rvalue::@1 + //SEG52 rvalue::@1 b1: - //SEG50 [21] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] -- xby_lt_coby1_then_la1 + //SEG53 [24] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG51 rvalue::@return - //SEG52 [22] return [ ] + //SEG54 rvalue::@return + //SEG55 [25] return [ ] rts - //SEG53 rvalue::@2 + //SEG56 rvalue::@2 b2: - //SEG54 [23] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] -- aby=cowo1_staridx_xby + //SEG57 [26] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] -- aby=cowo1_staridx_xby lda $400,x - //SEG55 [24] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] -- xby=_inc_xby + //SEG58 [27] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] -- xby=_inc_xby inx - //SEG56 [20] phi from rvalue::@2 to rvalue::@1 - //SEG57 [20] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 -- register_copy + //SEG59 [23] phi from rvalue::@2 to rvalue::@1 + //SEG60 [23] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 -- register_copy jmp b1 } -//SEG58 lvalue +//SEG61 lvalue lvalue: { - //SEG59 [25] *((word) 1024) ← (byte) 1 [ ] -- _star_cowo1=coby2 + //SEG62 [28] *((word) 1024) ← (byte) 1 [ ] -- _star_cowo1=coby2 lda #$1 sta $400 - //SEG60 [26] *((word) 1025) ← (byte) 2 [ ] -- _star_cowo1=coby2 + //SEG63 [29] *((word) 1025) ← (byte) 2 [ ] -- _star_cowo1=coby2 lda #$2 sta $401 - //SEG61 [27] phi from lvalue to lvalue::@1 - //SEG62 [27] phi (byte) lvalue::i#2 = (byte) 2 -- xby=coby1 + //SEG64 [30] phi from lvalue to lvalue::@1 + //SEG65 [30] phi (byte) lvalue::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG63 lvalue::@1 + //SEG66 lvalue::@1 b1: - //SEG64 [28] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] -- xby_lt_coby1_then_la1 + //SEG67 [31] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG65 lvalue::@return - //SEG66 [29] return [ ] + //SEG68 lvalue::@return + //SEG69 [32] return [ ] rts - //SEG67 lvalue::@2 + //SEG70 lvalue::@2 b2: - //SEG68 [30] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] -- cowo1_staridx_xby=coby2 + //SEG71 [33] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] -- cowo1_staridx_xby=coby2 lda #$3 sta $400,x - //SEG69 [31] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] -- xby=_inc_xby + //SEG72 [34] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] -- xby=_inc_xby inx - //SEG70 [27] phi from lvalue::@2 to lvalue::@1 - //SEG71 [27] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 -- register_copy + //SEG73 [30] phi from lvalue::@2 to lvalue::@1 + //SEG74 [30] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 -- register_copy jmp b1 } @@ -2654,9 +2854,9 @@ FINAL SYMBOL TABLE (label) rvalue::@return (byte[1024]) rvalue::SCREEN (byte) rvalue::b -(byte) rvalue::b#0 reg byte a Infinity -(byte) rvalue::b#1 reg byte a Infinity -(byte) rvalue::b#2 reg byte a Infinity +(byte) rvalue::b#0 reg byte a 20.0 +(byte) rvalue::b#1 reg byte a 20.0 +(byte) rvalue::b#2 reg byte a 110.0 (byte) rvalue::i (byte) rvalue::i#1 reg byte x 22.0 (byte) rvalue::i#2 reg byte x 14.666666666666666 @@ -2665,7 +2865,7 @@ FINAL SYMBOL TABLE (label) rvaluevar::@2 (label) rvaluevar::@return (byte) rvaluevar::b -(byte) rvaluevar::b#0 reg byte a Infinity +(byte) rvaluevar::b#0 reg byte a 110.0 (byte) rvaluevar::i (byte) rvaluevar::i#1 reg byte x 22.0 (byte) rvaluevar::i#2 reg byte x 8.25 @@ -2687,153 +2887,156 @@ FINAL CODE //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call lvalue param-assignment [ ] + //SEG6 [2] call lvalue param-assignment [ ] jsr lvalue - //SEG6 main::@1 - //SEG7 [2] call rvalue param-assignment [ ] + //SEG7 main::@1 + //SEG8 [3] call rvalue param-assignment [ ] jsr rvalue - //SEG8 main::@2 - //SEG9 [3] call rvaluevar param-assignment [ ] + //SEG9 main::@2 + //SEG10 [4] call rvaluevar param-assignment [ ] + //SEG11 [14] phi from main::@2 to rvaluevar jsr rvaluevar - //SEG10 main::@3 - //SEG11 [4] call lvaluevar param-assignment [ ] + //SEG12 main::@3 + //SEG13 [5] call lvaluevar param-assignment [ ] + //SEG14 [7] phi from main::@3 to lvaluevar jsr lvaluevar - //SEG12 main::@return - //SEG13 [5] return [ ] + //SEG15 main::@return + //SEG16 [6] return [ ] rts } -//SEG14 lvaluevar +//SEG17 lvaluevar lvaluevar: { .label screen = 2 - //SEG15 [6] phi from lvaluevar to lvaluevar::@1 - //SEG16 [6] phi (byte*) lvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG18 [8] phi from lvaluevar to lvaluevar::@1 + //SEG19 [8] phi (byte*) lvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 - //SEG17 [6] phi (byte) lvaluevar::i#2 = (byte) 2 -- xby=coby1 + //SEG20 [8] phi (byte) lvaluevar::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG18 lvaluevar::@1 + //SEG21 lvaluevar::@1 b1: - //SEG19 [7] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 + //SEG22 [9] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG20 lvaluevar::@return - //SEG21 [8] return [ ] + //SEG23 lvaluevar::@return + //SEG24 [10] return [ ] rts - //SEG22 lvaluevar::@2 + //SEG25 lvaluevar::@2 b2: - //SEG23 [9] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- _star_zpptrby1=coby1 + //SEG26 [11] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$4 sta (screen),y - //SEG24 [10] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::screen#1 lvaluevar::i#2 ] -- zpptrby1=_inc_zpptrby1 + //SEG27 [12] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::i#2 lvaluevar::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG25 [11] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] -- xby=_inc_xby + //SEG28 [13] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ] -- xby=_inc_xby inx - //SEG26 [6] phi from lvaluevar::@2 to lvaluevar::@1 - //SEG27 [6] phi (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#1 -- register_copy - //SEG28 [6] phi (byte) lvaluevar::i#2 = (byte) lvaluevar::i#1 -- register_copy + //SEG29 [8] phi from lvaluevar::@2 to lvaluevar::@1 + //SEG30 [8] phi (byte*) lvaluevar::screen#2 = (byte*) lvaluevar::screen#1 -- register_copy + //SEG31 [8] phi (byte) lvaluevar::i#2 = (byte) lvaluevar::i#1 -- register_copy jmp b1 } -//SEG29 rvaluevar +//SEG32 rvaluevar rvaluevar: { .label screen = 2 - //SEG30 [12] phi from rvaluevar to rvaluevar::@1 - //SEG31 [12] phi (byte*) rvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG33 [15] phi from rvaluevar to rvaluevar::@1 + //SEG34 [15] phi (byte*) rvaluevar::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 - //SEG32 [12] phi (byte) rvaluevar::i#2 = (byte) 2 -- xby=coby1 + //SEG35 [15] phi (byte) rvaluevar::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG33 rvaluevar::@1 + //SEG36 rvaluevar::@1 b1: - //SEG34 [13] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 + //SEG37 [16] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG35 rvaluevar::@return - //SEG36 [14] return [ ] + //SEG38 rvaluevar::@return + //SEG39 [17] return [ ] rts - //SEG37 rvaluevar::@2 + //SEG40 rvaluevar::@2 b2: - //SEG38 [15] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- aby=_star_zpptrby1 + //SEG41 [18] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] -- aby=_star_zpptrby1 ldy #$0 lda (screen),y - //SEG39 [16] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::screen#1 rvaluevar::i#2 ] -- zpptrby1=_inc_zpptrby1 + //SEG42 [19] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG40 [17] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] -- xby=_inc_xby + //SEG43 [20] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] -- xby=_inc_xby inx - //SEG41 [12] phi from rvaluevar::@2 to rvaluevar::@1 - //SEG42 [12] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 -- register_copy - //SEG43 [12] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 -- register_copy + //SEG44 [15] phi from rvaluevar::@2 to rvaluevar::@1 + //SEG45 [15] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 -- register_copy + //SEG46 [15] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 -- register_copy jmp b1 } -//SEG44 rvalue +//SEG47 rvalue rvalue: { - //SEG45 [18] (byte) rvalue::b#0 ← * (word) 1024 [ ] -- aby=_star_cowo1 + //SEG48 [21] (byte) rvalue::b#0 ← * (word) 1024 [ ] -- aby=_star_cowo1 lda $400 - //SEG46 [19] (byte) rvalue::b#1 ← * (word) 1025 [ ] -- aby=_star_cowo1 + //SEG49 [22] (byte) rvalue::b#1 ← * (word) 1025 [ ] -- aby=_star_cowo1 lda $401 - //SEG47 [20] phi from rvalue to rvalue::@1 - //SEG48 [20] phi (byte) rvalue::i#2 = (byte) 2 -- xby=coby1 + //SEG50 [23] phi from rvalue to rvalue::@1 + //SEG51 [23] phi (byte) rvalue::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG49 rvalue::@1 + //SEG52 rvalue::@1 b1: - //SEG50 [21] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] -- xby_lt_coby1_then_la1 + //SEG53 [24] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG51 rvalue::@return - //SEG52 [22] return [ ] + //SEG54 rvalue::@return + //SEG55 [25] return [ ] rts - //SEG53 rvalue::@2 + //SEG56 rvalue::@2 b2: - //SEG54 [23] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] -- aby=cowo1_staridx_xby + //SEG57 [26] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] -- aby=cowo1_staridx_xby lda $400,x - //SEG55 [24] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] -- xby=_inc_xby + //SEG58 [27] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] -- xby=_inc_xby inx - //SEG56 [20] phi from rvalue::@2 to rvalue::@1 - //SEG57 [20] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 -- register_copy + //SEG59 [23] phi from rvalue::@2 to rvalue::@1 + //SEG60 [23] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 -- register_copy jmp b1 } -//SEG58 lvalue +//SEG61 lvalue lvalue: { - //SEG59 [25] *((word) 1024) ← (byte) 1 [ ] -- _star_cowo1=coby2 + //SEG62 [28] *((word) 1024) ← (byte) 1 [ ] -- _star_cowo1=coby2 lda #$1 sta $400 - //SEG60 [26] *((word) 1025) ← (byte) 2 [ ] -- _star_cowo1=coby2 + //SEG63 [29] *((word) 1025) ← (byte) 2 [ ] -- _star_cowo1=coby2 lda #$2 sta $401 - //SEG61 [27] phi from lvalue to lvalue::@1 - //SEG62 [27] phi (byte) lvalue::i#2 = (byte) 2 -- xby=coby1 + //SEG64 [30] phi from lvalue to lvalue::@1 + //SEG65 [30] phi (byte) lvalue::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG63 lvalue::@1 + //SEG66 lvalue::@1 b1: - //SEG64 [28] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] -- xby_lt_coby1_then_la1 + //SEG67 [31] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG65 lvalue::@return - //SEG66 [29] return [ ] + //SEG68 lvalue::@return + //SEG69 [32] return [ ] rts - //SEG67 lvalue::@2 + //SEG70 lvalue::@2 b2: - //SEG68 [30] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] -- cowo1_staridx_xby=coby2 + //SEG71 [33] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] -- cowo1_staridx_xby=coby2 lda #$3 sta $400,x - //SEG69 [31] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] -- xby=_inc_xby + //SEG72 [34] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] -- xby=_inc_xby inx - //SEG70 [27] phi from lvalue::@2 to lvalue::@1 - //SEG71 [27] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 -- register_copy + //SEG73 [30] phi from lvalue::@2 to lvalue::@1 + //SEG74 [30] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 -- register_copy jmp b1 } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.sym b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.sym index 03a6a2042..474d1005e 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.sym @@ -30,9 +30,9 @@ (label) rvalue::@return (byte[1024]) rvalue::SCREEN (byte) rvalue::b -(byte) rvalue::b#0 reg byte a Infinity -(byte) rvalue::b#1 reg byte a Infinity -(byte) rvalue::b#2 reg byte a Infinity +(byte) rvalue::b#0 reg byte a 20.0 +(byte) rvalue::b#1 reg byte a 20.0 +(byte) rvalue::b#2 reg byte a 110.0 (byte) rvalue::i (byte) rvalue::i#1 reg byte x 22.0 (byte) rvalue::i#2 reg byte x 14.666666666666666 @@ -41,7 +41,7 @@ (label) rvaluevar::@2 (label) rvaluevar::@return (byte) rvaluevar::b -(byte) rvaluevar::b#0 reg byte a Infinity +(byte) rvaluevar::b#0 reg byte a 110.0 (byte) rvaluevar::i (byte) rvaluevar::i#1 reg byte x 22.0 (byte) rvaluevar::i#2 reg byte x 8.25 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.cfg b/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.cfg index 5d6760bdf..685bb12e0 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.cfg @@ -3,15 +3,16 @@ to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@2 - [1] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte) main::i#1 ) [ main::i#2 ] - [2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] + [2] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte) main::i#1 ) [ main::i#2 ] + [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] to:main::@return main::@return: scope:[main] from main::@1 - [3] return [ ] + [4] return [ ] to:@return main::@2: scope:[main] from main::@1 - [4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] - [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] + [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] to:main::@1 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 139979291..fe54be096 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.log @@ -399,33 +399,39 @@ main::@2: scope:[main] from main::@1 (byte~) main::i#4 ← (byte) main::i#1 to:main::@1 -Adding empty live range for unused variable main::b#0 +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to 0:main + Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@2 - [1] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte~) main::i#4 ) [ main::i#2 ] - [2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] + [2] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte~) main::i#4 ) [ main::i#2 ] + [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] to:main::@return main::@return: scope:[main] from main::@1 - [3] return [ ] + [4] return [ ] to:@return main::@2: scope:[main] from main::@1 - [4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] - [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [6] (byte~) main::i#4 ← (byte) main::i#1 [ main::i#4 ] + [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] + [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [7] (byte~) main::i#4 ← (byte) main::i#1 [ main::i#4 ] to:main::@1 Created 1 initial phi equivalence classes -Coalesced [6] main::i#4 ← main::i#1 +Coalesced [7] main::i#4 ← main::i#1 Coalesced down to 1 phi equivalence classes Block Sequence Planned @begin @end main main::@1 main::@return main::@2 -Adding empty live range for unused variable main::b#0 +Adding NOP phi() at start of main +Propagating live ranges... Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @begin: scope:[] from @@ -433,22 +439,20 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@2 - [1] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte) main::i#1 ) [ main::i#2 ] - [2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] + [2] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte) main::i#1 ) [ main::i#2 ] + [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] to:main::@return main::@return: scope:[main] from main::@1 - [3] return [ ] + [4] return [ ] to:@return main::@2: scope:[main] from main::@1 - [4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] - [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] + [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] to:main::@1 -CALL GRAPH -Calls in [] to 0:main - DOMINATORS @begin dominated by @begin @end dominated by @end @begin @@ -473,7 +477,7 @@ VARIABLE REGISTER WEIGHTS (void()) main() (byte[1024]) main::SCREEN (byte) main::b -(byte) main::b#0 Infinity +(byte) main::b#0 110.0 (byte) main::i (byte) main::i#1 22.0 (byte) main::i#2 14.666666666666666 @@ -491,42 +495,44 @@ INITIAL ASM //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main jmp bend -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { .label b = 3 .label i = 2 - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 2 -- zpby1=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 2 -- zpby1=coby1 lda #$2 sta i jmp b1 - //SEG7 main::@1 + //SEG8 main::@1 b1: - //SEG8 [2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- zpby1_lt_coby1_then_la1 + //SEG9 [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- zpby1_lt_coby1_then_la1 lda i cmp #$a bcc b2 jmp breturn - //SEG9 main::@return + //SEG10 main::@return breturn: - //SEG10 [3] return [ ] + //SEG11 [4] return [ ] rts - //SEG11 main::@2 + //SEG12 main::@2 b2: - //SEG12 [4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- zpby1=cowo1_staridx_zpby2 + //SEG13 [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- zpby1=cowo1_staridx_zpby2 ldx i lda $400,x sta b - //SEG13 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1 + //SEG14 [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1 inc i - //SEG14 [1] phi from main::@2 to main::@1 + //SEG15 [2] phi from main::@2 to main::@1 b1_from_b2: - //SEG15 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG16 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 } @@ -535,7 +541,7 @@ Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg by Potential registers zp ZP_BYTE:3 [ main::b#0 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -Uplift Scope [main] ∞: zp ZP_BYTE:3 [ main::b#0 ] 36.67: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] +Uplift Scope [main] 110: zp ZP_BYTE:3 [ main::b#0 ] 36.67: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] Uplift Scope [] Uplifting [main] best 235 combination reg byte a [ main::b#0 ] reg byte x [ main::i#2 main::i#1 ] @@ -549,33 +555,73 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 2 -- xby=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG7 main::@1 + //SEG8 main::@1 b1: - //SEG8 [2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1 + //SEG9 [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG9 main::@return + //SEG10 main::@return breturn: - //SEG10 [3] return [ ] + //SEG11 [4] return [ ] rts - //SEG11 main::@2 + //SEG12 main::@2 b2: - //SEG12 [4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby + //SEG13 [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby lda $400,x - //SEG13 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG14 [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG14 [1] phi from main::@2 to main::@1 + //SEG15 [2] phi from main::@2 to main::@1 b1_from_b2: - //SEG15 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG16 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + jmp b1 +} + +Removing instruction main_from_bbegin: +Succesful ASM optimization Pass5RedundantLabelElimination +ASSEMBLER +//SEG0 Global ZP labels +//SEG1 @begin +bbegin: +//SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main + jsr main +//SEG4 @end +bend: +//SEG5 main +main: { + //SEG6 [2] phi from main to main::@1 + b1_from_main: + //SEG7 [2] phi (byte) main::i#2 = (byte) 2 -- xby=coby1 + ldx #$2 + //SEG8 main::@1 + b1: + //SEG9 [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1 + cpx #$a + bcc b2 + //SEG10 main::@return + breturn: + //SEG11 [4] return [ ] + rts + //SEG12 main::@2 + b2: + //SEG13 [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby + lda $400,x + //SEG14 [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + inx + //SEG15 [2] phi from main::@2 to main::@1 + b1_from_b2: + //SEG16 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 } @@ -589,29 +635,30 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 2 -- xby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG7 main::@1 + //SEG8 main::@1 b1: - //SEG8 [2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1 + //SEG9 [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG9 main::@return - //SEG10 [3] return [ ] + //SEG10 main::@return + //SEG11 [4] return [ ] rts - //SEG11 main::@2 + //SEG12 main::@2 b2: - //SEG12 [4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby + //SEG13 [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby lda $400,x - //SEG13 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG14 [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG14 [1] phi from main::@2 to main::@1 - //SEG15 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG15 [2] phi from main::@2 to main::@1 + //SEG16 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 } @@ -624,7 +671,7 @@ FINAL SYMBOL TABLE (label) main::@return (byte[1024]) main::SCREEN (byte) main::b -(byte) main::b#0 reg byte a Infinity +(byte) main::b#0 reg byte a 110.0 (byte) main::i (byte) main::i#1 reg byte x 22.0 (byte) main::i#2 reg byte x 14.666666666666666 @@ -636,29 +683,30 @@ FINAL CODE //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 2 -- xby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 2 -- xby=coby1 ldx #$2 - //SEG7 main::@1 + //SEG8 main::@1 b1: - //SEG8 [2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1 + //SEG9 [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG9 main::@return - //SEG10 [3] return [ ] + //SEG10 main::@return + //SEG11 [4] return [ ] rts - //SEG11 main::@2 + //SEG12 main::@2 b2: - //SEG12 [4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby + //SEG13 [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby lda $400,x - //SEG13 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby + //SEG14 [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby inx - //SEG14 [1] phi from main::@2 to main::@1 - //SEG15 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG15 [2] phi from main::@2 to main::@1 + //SEG16 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.sym b/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.sym index 9948ec675..973e3884e 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.sym @@ -6,7 +6,7 @@ (label) main::@return (byte[1024]) main::SCREEN (byte) main::b -(byte) main::b#0 reg byte a Infinity +(byte) main::b#0 reg byte a 110.0 (byte) main::i (byte) main::i#1 reg byte x 22.0 (byte) main::i#2 reg byte x 14.666666666666666 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 a4f69355f..f72acbdf9 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/summin.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/summin.cfg @@ -3,23 +3,23 @@ to:@2 @2: scope:[] from @begin [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] - [2] call sum param-assignment [ sum::return#0 s1#0 ] + [2] call sum param-assignment [ s1#0 sum::return#0 ] to:@3 @3: scope:[] from @2 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] - [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ] + [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ] to:@4 @4: scope:[] from @3 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] - [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] + [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] to:@end @end: scope:[] from @4 sum: scope:[sum] from @2 @3 @begin - [8] (byte) sum::b#3 ← phi( @2/(byte) 4 @3/(byte) 13 @begin/(byte) 2 ) [ s1#0 s2#0 sum::a#3 sum::b#3 ] - [8] (byte) sum::a#3 ← phi( @2/(byte) 3 @3/(byte) 9 @begin/(byte) 1 ) [ s1#0 s2#0 sum::a#3 sum::b#3 ] - [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] + [8] (byte) sum::b#3 ← phi( @2/(byte) 4 @3/(byte) 13 @begin/(byte) 2 ) [ sum::a#3 sum::b#3 ] + [8] (byte) sum::a#3 ← phi( @2/(byte) 3 @3/(byte) 9 @begin/(byte) 1 ) [ sum::a#3 sum::b#3 ] + [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] to:sum::@return sum::@return: scope:[sum] from sum - [10] return [ sum::return#0 s1#0 s2#0 ] + [10] return [ sum::return#0 ] to:@return 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 b69671c58..0491042fd 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/summin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/summin.log @@ -416,65 +416,50 @@ sum::@return: scope:[sum] from sum return to:@return -Adding empty live range for unused variable s4#0 +CALL GRAPH +Calls in [] to 0:sum 2:sum 4:sum + Propagating live ranges... Propagating live ranges... Propagating live ranges... -Propagated s1#0 through call [4] call sum param-assignment -Propagated s2#0 through call [4] call sum param-assignment Propagating live ranges... -Propagated s1#0 through call [2] call sum param-assignment -Propagated s1#0 through call [4] call sum param-assignment -Propagated s2#0 through call [4] call sum param-assignment Propagating live ranges... -Propagated s1#0 through call [2] call sum param-assignment -Propagated s1#0 through call [4] call sum param-assignment -Propagated s2#0 through call [4] call sum param-assignment Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call sum param-assignment [ sum::return#0 ] to:@2 @2: scope:[] from @begin [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] - [2] call sum param-assignment [ sum::return#0 s1#0 ] + [2] call sum param-assignment [ s1#0 sum::return#0 ] to:@3 @3: scope:[] from @2 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] - [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ] + [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ] to:@4 @4: scope:[] from @3 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] - [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] + [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] to:@end @end: scope:[] from @4 sum: scope:[sum] from @2 @3 @begin - [8] (byte) sum::b#3 ← phi( @2/(byte) 4 @3/(byte) 13 @begin/(byte) 2 ) [ s1#0 s2#0 sum::a#3 sum::b#3 ] - [8] (byte) sum::a#3 ← phi( @2/(byte) 3 @3/(byte) 9 @begin/(byte) 1 ) [ s1#0 s2#0 sum::a#3 sum::b#3 ] - [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] + [8] (byte) sum::b#3 ← phi( @2/(byte) 4 @3/(byte) 13 @begin/(byte) 2 ) [ sum::a#3 sum::b#3 ] + [8] (byte) sum::a#3 ← phi( @2/(byte) 3 @3/(byte) 9 @begin/(byte) 1 ) [ sum::a#3 sum::b#3 ] + [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] to:sum::@return sum::@return: scope:[sum] from sum - [10] return [ sum::return#0 s1#0 s2#0 ] + [10] return [ sum::return#0 ] to:@return Created 2 initial phi equivalence classes Coalesced down to 2 phi equivalence classes Block Sequence Planned @begin @2 @3 @4 @end sum sum::@return -Adding empty live range for unused variable s4#0 Propagating live ranges... Propagating live ranges... Propagating live ranges... -Propagated s1#0 through call [4] call sum param-assignment -Propagated s2#0 through call [4] call sum param-assignment Propagating live ranges... -Propagated s1#0 through call [2] call sum param-assignment -Propagated s1#0 through call [4] call sum param-assignment -Propagated s2#0 through call [4] call sum param-assignment Propagating live ranges... -Propagated s1#0 through call [2] call sum param-assignment -Propagated s1#0 through call [4] call sum param-assignment -Propagated s2#0 through call [4] call sum param-assignment Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @begin: scope:[] from @@ -482,30 +467,27 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@2 @2: scope:[] from @begin [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] - [2] call sum param-assignment [ sum::return#0 s1#0 ] + [2] call sum param-assignment [ s1#0 sum::return#0 ] to:@3 @3: scope:[] from @2 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] - [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ] + [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ] to:@4 @4: scope:[] from @3 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] - [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] + [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] to:@end @end: scope:[] from @4 sum: scope:[sum] from @2 @3 @begin - [8] (byte) sum::b#3 ← phi( @2/(byte) 4 @3/(byte) 13 @begin/(byte) 2 ) [ s1#0 s2#0 sum::a#3 sum::b#3 ] - [8] (byte) sum::a#3 ← phi( @2/(byte) 3 @3/(byte) 9 @begin/(byte) 1 ) [ s1#0 s2#0 sum::a#3 sum::b#3 ] - [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] + [8] (byte) sum::b#3 ← phi( @2/(byte) 4 @3/(byte) 13 @begin/(byte) 2 ) [ sum::a#3 sum::b#3 ] + [8] (byte) sum::a#3 ← phi( @2/(byte) 3 @3/(byte) 9 @begin/(byte) 1 ) [ sum::a#3 sum::b#3 ] + [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] to:sum::@return sum::@return: scope:[sum] from sum - [10] return [ sum::return#0 s1#0 s2#0 ] + [10] return [ sum::return#0 ] to:@return -CALL GRAPH -Calls in [] to 0:sum 2:sum 4:sum - DOMINATORS @begin dominated by @begin @2 dominated by @2 @begin @@ -525,13 +507,13 @@ NATURAL LOOPS WITH DEPTH VARIABLE REGISTER WEIGHTS (byte~) $3 4.0 (byte) s1 -(byte) s1#0 0.5 +(byte) s1#0 0.8 (byte) s2 -(byte) s2#0 0.6666666666666666 +(byte) s2#0 1.3333333333333333 (byte) s3 (byte) s3#0 2.0 (byte) s4 -(byte) s4#0 Infinity +(byte) s4#0 20.0 (byte()) sum((byte) sum::a , (byte) sum::b) (byte) sum::a (byte) sum::a#3 2.0 @@ -568,7 +550,7 @@ Allocated zp ZP_BYTE:8 [ s4#0 ] Allocated zp ZP_BYTE:9 [ sum::return#0 ] INITIAL ASM //SEG0 Global ZP labels - .label $3 = 7 + .label _3 = 7 .label s1 = 4 .label s2 = 5 .label s3 = 6 @@ -591,7 +573,7 @@ b2: //SEG7 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=zpby2 lda sum.return sta s1 -//SEG8 [2] call sum param-assignment [ sum::return#0 s1#0 ] +//SEG8 [2] call sum param-assignment [ s1#0 sum::return#0 ] //SEG9 [8] phi from @2 to sum sum_from_b2: //SEG10 [8] phi (byte) sum::b#3 = (byte) 4 -- zpby1=coby1 @@ -607,7 +589,7 @@ b3: //SEG13 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] -- zpby1=zpby2 lda sum.return sta s2 -//SEG14 [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ] +//SEG14 [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ] //SEG15 [8] phi from @3 to sum sum_from_b3: //SEG16 [8] phi (byte) sum::b#3 = (byte) 13 -- zpby1=coby1 @@ -623,13 +605,13 @@ b4: //SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- zpby1=zpby2 lda sum.return sta s3 -//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] -- zpby1=zpby2_plus_zpby3 +//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] -- zpby1=zpby2_plus_zpby3 lda s1 clc adc s2 - sta $3 + sta _3 //SEG21 [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] -- zpby1=zpby2_plus_zpby3 - lda $3 + lda _3 clc adc s3 sta s4 @@ -641,7 +623,7 @@ sum: { .label return = 9 .label a = 2 .label b = 3 - //SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] -- zpby1=zpby2_plus_zpby3 + //SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] -- zpby1=zpby2_plus_zpby3 lda a clc adc b @@ -649,7 +631,7 @@ sum: { jmp breturn //SEG25 sum::@return breturn: - //SEG26 [10] return [ sum::return#0 s1#0 s2#0 ] + //SEG26 [10] return [ sum::return#0 ] rts } @@ -664,11 +646,15 @@ Potential registers zp ZP_BYTE:8 [ s4#0 ] : zp ZP_BYTE:8 , reg byte a , reg byte Potential registers zp ZP_BYTE:9 [ sum::return#0 ] : zp ZP_BYTE:9 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -Uplift Scope [] ∞: zp ZP_BYTE:8 [ s4#0 ] 4: zp ZP_BYTE:7 [ $3 ] 2: zp ZP_BYTE:6 [ s3#0 ] 0.67: zp ZP_BYTE:5 [ s2#0 ] 0.5: zp ZP_BYTE:4 [ s1#0 ] +Uplift Scope [] 20: zp ZP_BYTE:8 [ s4#0 ] 4: zp ZP_BYTE:7 [ $3 ] 2: zp ZP_BYTE:6 [ s3#0 ] 1.33: zp ZP_BYTE:5 [ s2#0 ] 0.8: zp ZP_BYTE:4 [ s1#0 ] Uplift Scope [sum] 2: zp ZP_BYTE:2 [ sum::a#3 ] 2: zp ZP_BYTE:3 [ sum::b#3 ] 1.6: zp ZP_BYTE:9 [ sum::return#0 ] Uplifting [] best 107 combination reg byte a [ s4#0 ] reg byte a [ $3 ] zp ZP_BYTE:6 [ s3#0 ] reg byte x [ s2#0 ] zp ZP_BYTE:4 [ s1#0 ] Uplifting [sum] best 79 combination reg byte y [ sum::a#3 ] reg byte a [ sum::b#3 ] reg byte a [ sum::return#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:6 [ s3#0 ] +Uplifting [] best 79 combination zp ZP_BYTE:6 [ s3#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:4 [ s1#0 ] +Uplifting [] best 79 combination zp ZP_BYTE:4 [ s1#0 ] Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:2 [ s1#0 ] Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:3 [ s3#0 ] Removing instruction jmp b2 @@ -695,7 +681,7 @@ sum_from_bbegin: b2: //SEG7 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=aby sta s1 -//SEG8 [2] call sum param-assignment [ sum::return#0 s1#0 ] +//SEG8 [2] call sum param-assignment [ s1#0 sum::return#0 ] //SEG9 [8] phi from @2 to sum sum_from_b2: //SEG10 [8] phi (byte) sum::b#3 = (byte) 4 -- aby=coby1 @@ -707,7 +693,7 @@ sum_from_b2: b3: //SEG13 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] -- xby=aby tax -//SEG14 [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ] +//SEG14 [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ] //SEG15 [8] phi from @3 to sum sum_from_b3: //SEG16 [8] phi (byte) sum::b#3 = (byte) 13 -- aby=coby1 @@ -719,7 +705,7 @@ sum_from_b3: b4: //SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- zpby1=aby sta s3 -//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] -- aby=zpby1_plus_xby +//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] -- aby=zpby1_plus_xby txa clc adc s1 @@ -730,13 +716,13 @@ b4: bend: //SEG23 sum sum: { - //SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] -- aby=yby_plus_aby + //SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] -- aby=yby_plus_aby sty $ff clc adc $ff //SEG25 sum::@return breturn: - //SEG26 [10] return [ sum::return#0 s1#0 s2#0 ] + //SEG26 [10] return [ sum::return#0 ] rts } @@ -759,7 +745,7 @@ bbegin: b2: //SEG7 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=aby sta s1 -//SEG8 [2] call sum param-assignment [ sum::return#0 s1#0 ] +//SEG8 [2] call sum param-assignment [ s1#0 sum::return#0 ] //SEG9 [8] phi from @2 to sum sum_from_b2: //SEG10 [8] phi (byte) sum::b#3 = (byte) 4 -- aby=coby1 @@ -771,7 +757,7 @@ sum_from_b2: b3: //SEG13 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] -- xby=aby tax -//SEG14 [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ] +//SEG14 [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ] //SEG15 [8] phi from @3 to sum sum_from_b3: //SEG16 [8] phi (byte) sum::b#3 = (byte) 13 -- aby=coby1 @@ -783,7 +769,7 @@ sum_from_b3: b4: //SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- zpby1=aby sta s3 -//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] -- aby=zpby1_plus_xby +//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] -- aby=zpby1_plus_xby txa clc adc s1 @@ -794,13 +780,13 @@ b4: bend: //SEG23 sum sum: { - //SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] -- aby=yby_plus_aby + //SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] -- aby=yby_plus_aby sty $ff clc adc $ff //SEG25 sum::@return breturn: - //SEG26 [10] return [ sum::return#0 s1#0 s2#0 ] + //SEG26 [10] return [ sum::return#0 ] rts } @@ -828,7 +814,7 @@ ASSEMBLER //SEG6 @2 //SEG7 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=aby sta s1 -//SEG8 [2] call sum param-assignment [ sum::return#0 s1#0 ] +//SEG8 [2] call sum param-assignment [ s1#0 sum::return#0 ] //SEG9 [8] phi from @2 to sum //SEG10 [8] phi (byte) sum::b#3 = (byte) 4 -- aby=coby1 lda #$4 @@ -838,7 +824,7 @@ ASSEMBLER //SEG12 @3 //SEG13 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] -- xby=aby tax -//SEG14 [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ] +//SEG14 [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ] //SEG15 [8] phi from @3 to sum //SEG16 [8] phi (byte) sum::b#3 = (byte) 13 -- aby=coby1 lda #$d @@ -848,7 +834,7 @@ ASSEMBLER //SEG18 @4 //SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- zpby1=aby sta s3 -//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] -- aby=zpby1_plus_xby +//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] -- aby=zpby1_plus_xby txa clc adc s1 @@ -858,12 +844,12 @@ ASSEMBLER //SEG22 @end //SEG23 sum sum: { - //SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] -- aby=yby_plus_aby + //SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] -- aby=yby_plus_aby sty $ff clc adc $ff //SEG25 sum::@return - //SEG26 [10] return [ sum::return#0 s1#0 s2#0 ] + //SEG26 [10] return [ sum::return#0 ] rts } @@ -875,13 +861,13 @@ FINAL SYMBOL TABLE (label) @begin (label) @end (byte) s1 -(byte) s1#0 s1 zp ZP_BYTE:2 0.5 +(byte) s1#0 s1 zp ZP_BYTE:2 0.8 (byte) s2 -(byte) s2#0 reg byte x 0.6666666666666666 +(byte) s2#0 reg byte x 1.3333333333333333 (byte) s3 (byte) s3#0 s3 zp ZP_BYTE:3 2.0 (byte) s4 -(byte) s4#0 reg byte a Infinity +(byte) s4#0 reg byte a 20.0 (byte()) sum((byte) sum::a , (byte) sum::b) (label) sum::@return (byte) sum::a @@ -915,7 +901,7 @@ FINAL CODE //SEG6 @2 //SEG7 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=aby sta s1 -//SEG8 [2] call sum param-assignment [ sum::return#0 s1#0 ] +//SEG8 [2] call sum param-assignment [ s1#0 sum::return#0 ] //SEG9 [8] phi from @2 to sum //SEG10 [8] phi (byte) sum::b#3 = (byte) 4 -- aby=coby1 lda #$4 @@ -925,7 +911,7 @@ FINAL CODE //SEG12 @3 //SEG13 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] -- xby=aby tax -//SEG14 [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ] +//SEG14 [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ] //SEG15 [8] phi from @3 to sum //SEG16 [8] phi (byte) sum::b#3 = (byte) 13 -- aby=coby1 lda #$d @@ -935,7 +921,7 @@ FINAL CODE //SEG18 @4 //SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- zpby1=aby sta s3 -//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] -- aby=zpby1_plus_xby +//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] -- aby=zpby1_plus_xby txa clc adc s1 @@ -945,12 +931,12 @@ FINAL CODE //SEG22 @end //SEG23 sum sum: { - //SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] -- aby=yby_plus_aby + //SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] -- aby=yby_plus_aby sty $ff clc adc $ff //SEG25 sum::@return - //SEG26 [10] return [ sum::return#0 s1#0 s2#0 ] + //SEG26 [10] return [ sum::return#0 ] rts } 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 31e81b0c6..c5e2e3d85 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/summin.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/summin.sym @@ -5,13 +5,13 @@ (label) @begin (label) @end (byte) s1 -(byte) s1#0 s1 zp ZP_BYTE:2 0.5 +(byte) s1#0 s1 zp ZP_BYTE:2 0.8 (byte) s2 -(byte) s2#0 reg byte x 0.6666666666666666 +(byte) s2#0 reg byte x 1.3333333333333333 (byte) s3 (byte) s3#0 s3 zp ZP_BYTE:3 2.0 (byte) s4 -(byte) s4#0 reg byte a Infinity +(byte) s4#0 reg byte a 20.0 (byte()) sum((byte) sum::a , (byte) sum::b) (label) sum::@return (byte) sum::a 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 9296dd334..699adfee1 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log @@ -174,8 +174,11 @@ main::@return: scope:[main] from main return to:@return +CALL GRAPH +Calls in [] to 0:main + Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @@ -203,9 +206,6 @@ main::@return: scope:[main] from main [2] return [ ] to:@return -CALL GRAPH -Calls in [] to 0:main - DOMINATORS @begin dominated by @begin @end dominated by @end @begin 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 c4847a9d2..bfacf8d4d 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.cfg @@ -3,205 +3,209 @@ to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call addpoint param-assignment [ ] + [1] phi() [ ] + [2] call addpoint param-assignment [ ] to:main::@3 main::@3: scope:[main] from main - [2] call addpoint param-assignment [ ] + [3] call addpoint param-assignment [ numpoints#1 ] to:main::@4 main::@4: scope:[main] from main::@3 - [3] call addpoint param-assignment [ ] + [4] call addpoint param-assignment [ numpoints#1 ] to:main::@5 main::@5: scope:[main] from main::@4 - [4] call addpoint param-assignment [ ] + [5] call addpoint param-assignment [ numpoints#1 ] to:main::@6 main::@6: scope:[main] from main::@5 - [5] call addpoint param-assignment [ ] + [6] call addpoint param-assignment [ numpoints#1 ] to:main::@7 main::@7: scope:[main] from main::@6 - [6] call addpoint param-assignment [ ] + [7] call addpoint param-assignment [ numpoints#1 ] to:main::@8 main::@8: scope:[main] from main::@7 - [7] call initscreen param-assignment [ ] + [8] call initscreen param-assignment [ numpoints#1 ] to:main::@1 main::@1: scope:[main] from main::@11 main::@8 - [8] call render param-assignment [ ] + [9] call render param-assignment [ numpoints#1 ] to:main::@10 main::@10: scope:[main] from main::@1 - [9] call animate param-assignment [ ] + [10] call animate param-assignment [ numpoints#1 ] to:main::@11 main::@11: scope:[main] from main::@10 - [10] if(true) goto main::@1 [ ] + [11] if(true) goto main::@1 [ numpoints#1 ] to:main::@return main::@return: scope:[main] from main::@11 - [11] return [ ] + [12] return [ ] to:@return animate: scope:[animate] from main::@10 - [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 [ ] + [13] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] + [14] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] + [15] *((word) 4096) ← (byte~) animate::$1 [ ] + [16] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] + [17] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] to:animate::@7 animate::@7: scope:[animate] from animate - [17] *((word) 4096) ← (byte) 0 [ ] + [18] *((word) 4096) ← (byte) 0 [ ] to:animate::@1 animate::@1: scope:[animate] from animate animate::@7 - [18] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] - [19] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] - [20] *((word) 4352) ← (byte~) animate::$6 [ ] - [21] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] - [22] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] + [19] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] + [20] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] + [21] *((word) 4352) ← (byte~) animate::$6 [ ] + [22] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] + [23] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] to:animate::@8 animate::@8: scope:[animate] from animate::@1 - [23] *((word) 4352) ← (byte) 0 [ ] + [24] *((word) 4352) ← (byte) 0 [ ] to:animate::@2 animate::@2: scope:[animate] from animate::@1 animate::@8 - [24] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] - [25] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] - [26] *((word) 4097) ← (byte~) animate::$11 [ ] - [27] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] - [28] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] + [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] + [26] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] + [27] *((word) 4097) ← (byte~) animate::$11 [ ] + [28] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] + [29] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] to:animate::@9 animate::@9: scope:[animate] from animate::@2 - [29] *((word) 4097) ← (byte) 40 [ ] + [30] *((word) 4097) ← (byte) 40 [ ] to:animate::@3 animate::@3: scope:[animate] from animate::@2 animate::@9 - [30] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] - [31] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] - [32] *((word) 4354) ← (byte~) animate::$16 [ ] - [33] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] - [34] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] + [31] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] + [32] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] + [33] *((word) 4354) ← (byte~) animate::$16 [ ] + [34] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] + [35] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] to:animate::@10 animate::@10: scope:[animate] from animate::@3 - [35] *((word) 4354) ← (byte) 0 [ ] + [36] *((word) 4354) ← (byte) 0 [ ] to:animate::@4 animate::@4: scope:[animate] from animate::@10 animate::@3 - [36] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] - [37] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] - [38] *((word) 4355) ← (byte~) animate::$21 [ ] - [39] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] - [40] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] + [37] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] + [38] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] + [39] *((word) 4355) ← (byte~) animate::$21 [ ] + [40] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] + [41] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] to:animate::@11 animate::@11: scope:[animate] from animate::@4 - [41] *((word) 4355) ← (byte) 25 [ ] - [42] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] - [43] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] - [44] *((word) 4099) ← (byte~) animate::$26 [ ] - [45] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] - [46] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] + [42] *((word) 4355) ← (byte) 25 [ ] + [43] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] + [44] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] + [45] *((word) 4099) ← (byte~) animate::$26 [ ] + [46] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] + [47] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] to:animate::@12 animate::@12: scope:[animate] from animate::@11 - [47] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] - [48] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] - [49] *((word) 4099) ← (byte~) animate::$31 [ ] + [48] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] + [49] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] + [50] *((word) 4099) ← (byte~) animate::$31 [ ] to:animate::@return animate::@return: scope:[animate] from animate::@11 animate::@12 animate::@4 - [50] return [ ] + [51] return [ ] to:@return render: scope:[render] from main::@1 + [52] phi() [ numpoints#1 ] to:render::@1 render::@1: scope:[render] from render render::@3 - [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 ] + [53] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@3/(byte*) render::colline#1 ) [ render::y#2 render::colline#2 numpoints#1 ] + [53] (byte) render::y#2 ← phi( render/(byte) 0 render::@3/(byte) render::y#1 ) [ render::y#2 render::colline#2 numpoints#1 ] to:render::@2 render::@2: scope:[render] 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 render::colline#2 ] - [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 ] - [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 ] - [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + [54] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@5/(byte) render::x#1 ) [ render::y#2 render::colline#2 render::x#2 numpoints#1 ] + [55] (byte) findcol::x#0 ← (byte) render::x#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 numpoints#1 ] + [56] (byte) findcol::y#0 ← (byte) render::y#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 findcol::y#0 numpoints#1 ] + [57] call findcol param-assignment [ render::y#2 render::colline#2 render::x#2 findcol::return#0 numpoints#1 ] to:render::@5 render::@5: scope:[render] from render::@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 ] + [58] (byte) render::col#0 ← (byte) findcol::return#0 [ render::y#2 render::colline#2 render::x#2 render::col#0 numpoints#1 ] + [59] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::y#2 render::colline#2 render::x#2 numpoints#1 ] + [60] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] + [61] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] to:render::@3 render::@3: scope:[render] from render::@5 - [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 ] + [62] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 render::colline#1 numpoints#1 ] + [63] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 numpoints#1 ] + [64] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 numpoints#1 ] to:render::@return render::@return: scope:[render] from render::@3 - [63] return [ ] + [65] return [ numpoints#1 ] to:@return findcol: scope:[findcol] from render::@2 + [66] phi() [ findcol::x#0 findcol::y#0 numpoints#1 ] to:findcol::@1 findcol::@1: scope:[findcol] from findcol findcol::@19 - [64] (byte) findcol::mincol#11 ← phi( findcol/(byte) 0 findcol::@19/(byte) findcol::mincol#2 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] - [64] (byte) findcol::mindiff#10 ← phi( findcol/(byte) 255 findcol::@19/(byte~) findcol::mindiff#13 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] - [64] (byte) findcol::i#12 ← phi( findcol/(byte) 0 findcol::@19/(byte) findcol::i#1 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] - [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 numpoints#1 ] - [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 numpoints#1 ] - [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 numpoints#1 ] + [67] (byte) findcol::mincol#11 ← phi( findcol/(byte) 0 findcol::@19/(byte) findcol::mincol#2 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] + [67] (byte) findcol::mindiff#10 ← phi( findcol/(byte) 255 findcol::@19/(byte~) findcol::mindiff#13 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] + [67] (byte) findcol::i#12 ← phi( findcol/(byte) 0 findcol::@19/(byte) findcol::i#1 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] + [68] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 numpoints#1 ] + [69] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] + [70] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] to:findcol::@9 findcol::@9: scope:[findcol] from findcol::@1 - [68] if((byte) findcol::y#0!=(byte) findcol::yp#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 numpoints#1 ] + [71] if((byte) findcol::y#0!=(byte) findcol::yp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] to:findcol::@return findcol::@return: scope:[findcol] from findcol::@8 findcol::@9 - [69] (byte) findcol::return#0 ← phi( findcol::@9/(byte) 0 findcol::@8/(byte) findcol::mincol#2 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] - [70] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + [72] (byte) findcol::return#0 ← phi( findcol::@9/(byte) 0 findcol::@8/(byte) findcol::mincol#2 ) [ findcol::return#0 numpoints#1 ] + [73] return [ findcol::return#0 numpoints#1 ] to:@return findcol::@2: scope:[findcol] from findcol::@1 findcol::@9 - [71] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ 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 numpoints#1 ] + [74] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] to:findcol::@12 findcol::@12: scope:[findcol] from findcol::@2 - [72] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#1 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] + [75] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#1 numpoints#1 ] to:findcol::@5 findcol::@5: scope:[findcol] from findcol::@12 findcol::@4 - [73] (byte) findcol::diff#4 ← phi( findcol::@12/(byte) findcol::diff#1 findcol::@4/(byte) findcol::diff#0 ) [ 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 numpoints#1 ] - [74] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ 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 numpoints#1 ] + [76] (byte) findcol::diff#4 ← phi( findcol::@12/(byte) findcol::diff#1 findcol::@4/(byte) findcol::diff#0 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 numpoints#1 ] + [77] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 numpoints#1 ] to:findcol::@14 findcol::@14: scope:[findcol] from findcol::@5 - [75] (byte~) findcol::$12 ← (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::$12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] - [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ 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 numpoints#1 ] + [78] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 findcol::$12 numpoints#1 ] + [79] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#3 numpoints#1 ] to:findcol::@7 findcol::@7: scope:[findcol] from findcol::@14 findcol::@6 - [77] (byte) findcol::diff#6 ← phi( findcol::@14/(byte) findcol::diff#3 findcol::@6/(byte) findcol::diff#2 ) [ 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 numpoints#1 ] - [78] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ 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 numpoints#1 ] + [80] (byte) findcol::diff#6 ← phi( findcol::@14/(byte) findcol::diff#3 findcol::@6/(byte) findcol::diff#2 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 numpoints#1 ] + [81] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 numpoints#1 ] to:findcol::@16 findcol::@16: scope:[findcol] from findcol::@7 - [79] (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 numpoints#1 ] + [82] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::diff#6 findcol::mincol#1 numpoints#1 ] to:findcol::@8 findcol::@8: scope:[findcol] from findcol::@16 findcol::@21 - [80] (byte) findcol::mindiff#11 ← phi( findcol::@16/(byte) findcol::diff#6 findcol::@21/(byte~) findcol::mindiff#14 ) [ render::x#2 render::y#2 render::colline#2 findcol::mincol#2 findcol::i#12 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] - [80] (byte) findcol::mincol#2 ← phi( findcol::@16/(byte) findcol::mincol#1 findcol::@21/(byte) findcol::mincol#11 ) [ render::x#2 render::y#2 render::colline#2 findcol::mincol#2 findcol::i#12 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] - [81] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] - [82] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] + [83] (byte) findcol::mindiff#11 ← phi( findcol::@16/(byte) findcol::diff#6 findcol::@21/(byte~) findcol::mindiff#14 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] + [83] (byte) findcol::mincol#2 ← phi( findcol::@16/(byte) findcol::mincol#1 findcol::@21/(byte) findcol::mincol#11 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] + [84] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] + [85] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] to:findcol::@return findcol::@19: scope:[findcol] from findcol::@8 - [83] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 ] + [86] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 numpoints#1 ] to:findcol::@1 findcol::@21: scope:[findcol] from findcol::@7 - [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] + [87] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] to:findcol::@8 findcol::@6: scope:[findcol] from findcol::@5 - [85] (byte~) findcol::$14 ← (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::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] - [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ 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 numpoints#1 ] + [88] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 numpoints#1 findcol::$14 ] + [89] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#2 numpoints#1 ] to:findcol::@7 findcol::@4: scope:[findcol] from findcol::@2 - [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] + [90] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#0 numpoints#1 ] to:findcol::@5 initscreen: scope:[initscreen] from main::@8 + [91] phi() [ ] to:initscreen::@1 initscreen::@1: scope:[initscreen] from initscreen initscreen::@1 - [88] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@1/(byte*) initscreen::screen#1 ) [ initscreen::screen#2 ] - [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] - [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] - [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] + [92] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@1/(byte*) initscreen::screen#1 ) [ initscreen::screen#2 ] + [93] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] + [94] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] + [95] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] to:initscreen::@return initscreen::@return: scope:[initscreen] from initscreen::@1 - [92] return [ ] + [96] return [ ] to:@return addpoint: scope:[addpoint] from main main::@3 main::@4 main::@5 main::@6 main::@7 - [93] (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 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [93] (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 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [93] (byte) numpoints#19 ← phi( main/(byte) 0 main::@3/(byte) numpoints#1 main::@4/(byte) numpoints#1 main::@5/(byte) numpoints#1 main::@6/(byte) numpoints#1 main::@7/(byte) numpoints#1 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [93] (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 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] - [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] - [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] - [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] + [97] (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::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ] + [97] (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::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ] + [97] (byte) numpoints#19 ← phi( main/(byte) 0 main::@3/(byte) numpoints#1 main::@4/(byte) numpoints#1 main::@5/(byte) numpoints#1 main::@6/(byte) numpoints#1 main::@7/(byte) numpoints#1 ) [ addpoint::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ] + [97] (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::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ] + [98] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] + [99] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] + [100] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] + [101] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ numpoints#1 ] to:addpoint::@return addpoint::@return: scope:[addpoint] from addpoint - [98] return [ ] + [102] return [ numpoints#1 ] 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 55843882b..ba0b67396 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log @@ -7593,6 +7593,15 @@ addpoint::@return: scope:[addpoint] from addpoint return to:@return +Adding NOP phi() at start of main +Adding NOP phi() at start of render +Adding NOP phi() at start of findcol +Adding NOP phi() at start of initscreen +CALL GRAPH +Calls in [] to 0:main +Calls in [main] to 2:addpoint 4:addpoint 6:addpoint 8:addpoint 10:addpoint 12:addpoint 13:initscreen 14:render 15:animate +Calls in [render] to 62:findcol + Propagating live ranges... Propagating live ranges... Propagating live ranges... @@ -7600,314 +7609,306 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -Propagated render::x#2 through call [60] call findcol param-assignment -Propagated render::colline#2 through call [60] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [60] call findcol param-assignment -Propagated render::colline#2 through call [60] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [60] call findcol param-assignment -Propagated render::colline#2 through call [60] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [60] call findcol param-assignment -Propagated render::colline#2 through call [60] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [60] call findcol param-assignment -Propagated render::y#2 through call [60] call findcol param-assignment -Propagated render::colline#2 through call [60] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [60] call findcol param-assignment -Propagated render::y#2 through call [60] call findcol param-assignment -Propagated render::colline#2 through call [60] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [60] call findcol param-assignment -Propagated render::y#2 through call [60] call findcol param-assignment -Propagated render::colline#2 through call [60] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [60] call findcol param-assignment -Propagated render::y#2 through call [60] call findcol param-assignment -Propagated render::colline#2 through call [60] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [60] call findcol param-assignment -Propagated render::y#2 through call [60] call findcol param-assignment -Propagated render::colline#2 through call [60] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [60] call findcol param-assignment -Propagated render::y#2 through call [60] call findcol param-assignment -Propagated render::colline#2 through call [60] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [60] call findcol param-assignment -Propagated render::y#2 through call [60] call findcol param-assignment -Propagated render::colline#2 through call [60] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [60] call findcol param-assignment -Propagated render::y#2 through call [60] call findcol param-assignment -Propagated render::colline#2 through call [60] call findcol param-assignment Propagating live ranges... -CONTROL FLOW GRAPH - 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 FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call addpoint param-assignment [ numpoints#1 ] + [1] phi() [ ] + [2] call addpoint param-assignment [ numpoints#1 ] to:main::@3 main::@3: scope:[main] from main - [2] (byte~) numpoints#44 ← (byte) numpoints#1 [ numpoints#44 ] - [3] call addpoint param-assignment [ numpoints#1 ] + [3] (byte~) numpoints#44 ← (byte) numpoints#1 [ numpoints#44 ] + [4] call addpoint param-assignment [ numpoints#1 ] to:main::@4 main::@4: scope:[main] from main::@3 - [4] (byte~) numpoints#45 ← (byte) numpoints#1 [ numpoints#45 ] - [5] call addpoint param-assignment [ numpoints#1 ] + [5] (byte~) numpoints#45 ← (byte) numpoints#1 [ numpoints#45 ] + [6] call addpoint param-assignment [ numpoints#1 ] to:main::@5 main::@5: scope:[main] from main::@4 - [6] (byte~) numpoints#46 ← (byte) numpoints#1 [ numpoints#46 ] - [7] call addpoint param-assignment [ numpoints#1 ] + [7] (byte~) numpoints#46 ← (byte) numpoints#1 [ numpoints#46 ] + [8] call addpoint param-assignment [ numpoints#1 ] to:main::@6 main::@6: scope:[main] from main::@5 - [8] (byte~) numpoints#47 ← (byte) numpoints#1 [ numpoints#47 ] - [9] call addpoint param-assignment [ numpoints#1 ] + [9] (byte~) numpoints#47 ← (byte) numpoints#1 [ numpoints#47 ] + [10] call addpoint param-assignment [ numpoints#1 ] to:main::@7 main::@7: scope:[main] from main::@6 - [10] (byte~) numpoints#48 ← (byte) numpoints#1 [ numpoints#48 ] - [11] call addpoint param-assignment [ ] + [11] (byte~) numpoints#48 ← (byte) numpoints#1 [ numpoints#48 ] + [12] call addpoint param-assignment [ numpoints#1 ] to:main::@8 main::@8: scope:[main] from main::@7 - [12] call initscreen param-assignment [ ] + [13] call initscreen param-assignment [ numpoints#1 ] to:main::@1 main::@1: scope:[main] from main::@11 main::@8 - [13] call render param-assignment [ ] + [14] call render param-assignment [ numpoints#1 ] to:main::@10 main::@10: scope:[main] from main::@1 - [14] call animate param-assignment [ ] + [15] call animate param-assignment [ numpoints#1 ] to:main::@11 main::@11: scope:[main] from main::@10 - [15] if(true) goto main::@1 [ ] + [16] if(true) goto main::@1 [ numpoints#1 ] to:main::@return main::@return: scope:[main] from main::@11 - [16] return [ ] + [17] return [ ] to:@return animate: scope:[animate] from main::@10 - [17] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] - [18] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] - [19] *((word) 4096) ← (byte~) animate::$1 [ ] - [20] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] - [21] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] + [18] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] + [19] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] + [20] *((word) 4096) ← (byte~) animate::$1 [ ] + [21] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] + [22] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] to:animate::@7 animate::@7: scope:[animate] from animate - [22] *((word) 4096) ← (byte) 0 [ ] + [23] *((word) 4096) ← (byte) 0 [ ] to:animate::@1 animate::@1: scope:[animate] from animate animate::@7 - [23] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] - [24] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] - [25] *((word) 4352) ← (byte~) animate::$6 [ ] - [26] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] - [27] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] + [24] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] + [25] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] + [26] *((word) 4352) ← (byte~) animate::$6 [ ] + [27] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] + [28] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] to:animate::@8 animate::@8: scope:[animate] from animate::@1 - [28] *((word) 4352) ← (byte) 0 [ ] + [29] *((word) 4352) ← (byte) 0 [ ] to:animate::@2 animate::@2: scope:[animate] from animate::@1 animate::@8 - [29] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] - [30] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] - [31] *((word) 4097) ← (byte~) animate::$11 [ ] - [32] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] - [33] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] + [30] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] + [31] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] + [32] *((word) 4097) ← (byte~) animate::$11 [ ] + [33] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] + [34] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] to:animate::@9 animate::@9: scope:[animate] from animate::@2 - [34] *((word) 4097) ← (byte) 40 [ ] + [35] *((word) 4097) ← (byte) 40 [ ] to:animate::@3 animate::@3: scope:[animate] from animate::@2 animate::@9 - [35] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] - [36] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] - [37] *((word) 4354) ← (byte~) animate::$16 [ ] - [38] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] - [39] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] + [36] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] + [37] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] + [38] *((word) 4354) ← (byte~) animate::$16 [ ] + [39] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] + [40] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] to:animate::@10 animate::@10: scope:[animate] from animate::@3 - [40] *((word) 4354) ← (byte) 0 [ ] + [41] *((word) 4354) ← (byte) 0 [ ] to:animate::@4 animate::@4: scope:[animate] from animate::@10 animate::@3 - [41] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] - [42] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] - [43] *((word) 4355) ← (byte~) animate::$21 [ ] - [44] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] - [45] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] + [42] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] + [43] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] + [44] *((word) 4355) ← (byte~) animate::$21 [ ] + [45] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] + [46] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] to:animate::@11 animate::@11: scope:[animate] from animate::@4 - [46] *((word) 4355) ← (byte) 25 [ ] - [47] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] - [48] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] - [49] *((word) 4099) ← (byte~) animate::$26 [ ] - [50] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] - [51] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] + [47] *((word) 4355) ← (byte) 25 [ ] + [48] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] + [49] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] + [50] *((word) 4099) ← (byte~) animate::$26 [ ] + [51] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] + [52] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] to:animate::@12 animate::@12: scope:[animate] from animate::@11 - [52] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] - [53] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] - [54] *((word) 4099) ← (byte~) animate::$31 [ ] + [53] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] + [54] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] + [55] *((word) 4099) ← (byte~) animate::$31 [ ] to:animate::@return animate::@return: scope:[animate] from animate::@11 animate::@12 animate::@4 - [55] return [ ] + [56] return [ ] to:@return render: scope:[render] from main::@1 + [57] phi() [ numpoints#1 ] to:render::@1 render::@1: scope:[render] from render render::@6 - [56] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@6/(byte*~) render::colline#6 ) [ render::y#2 render::colline#2 ] - [56] (byte) render::y#2 ← phi( render/(byte) 0 render::@6/(byte~) render::y#6 ) [ render::y#2 render::colline#2 ] + [58] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@6/(byte*~) render::colline#6 ) [ numpoints#1 render::y#2 render::colline#2 ] + [58] (byte) render::y#2 ← phi( render/(byte) 0 render::@6/(byte~) render::y#6 ) [ numpoints#1 render::y#2 render::colline#2 ] to:render::@2 render::@2: scope:[render] from render::@1 render::@7 - [57] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@7/(byte~) render::x#4 ) [ render::x#2 render::y#2 render::colline#2 ] - [58] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 ] - [59] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 ] - [60] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + [59] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@7/(byte~) render::x#4 ) [ numpoints#1 render::y#2 render::colline#2 render::x#2 ] + [60] (byte) findcol::x#0 ← (byte) render::x#2 [ numpoints#1 render::y#2 render::colline#2 render::x#2 findcol::x#0 ] + [61] (byte) findcol::y#0 ← (byte) render::y#2 [ numpoints#1 render::y#2 render::colline#2 render::x#2 findcol::x#0 findcol::y#0 ] + [62] call findcol param-assignment [ numpoints#1 render::y#2 render::colline#2 render::x#2 findcol::return#0 ] to:render::@5 render::@5: scope:[render] from render::@2 - [61] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] - [62] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 render::colline#2 ] - [63] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::y#2 render::colline#2 render::x#1 ] - [64] if((byte) render::x#1!=(byte) 40) goto render::@7 [ render::y#2 render::colline#2 render::x#1 ] + [63] (byte) render::col#0 ← (byte) findcol::return#0 [ numpoints#1 render::y#2 render::colline#2 render::x#2 render::col#0 ] + [64] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ numpoints#1 render::y#2 render::colline#2 render::x#2 ] + [65] (byte) render::x#1 ← ++ (byte) render::x#2 [ numpoints#1 render::y#2 render::colline#2 render::x#1 ] + [66] if((byte) render::x#1!=(byte) 40) goto render::@7 [ numpoints#1 render::y#2 render::colline#2 render::x#1 ] to:render::@3 render::@3: scope:[render] from render::@5 - [65] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 render::colline#1 ] - [66] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] - [67] if((byte) render::y#1!=(byte) 25) goto render::@6 [ render::y#1 render::colline#1 ] + [67] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ numpoints#1 render::y#2 render::colline#1 ] + [68] (byte) render::y#1 ← ++ (byte) render::y#2 [ numpoints#1 render::colline#1 render::y#1 ] + [69] if((byte) render::y#1!=(byte) 25) goto render::@6 [ numpoints#1 render::colline#1 render::y#1 ] to:render::@return render::@return: scope:[render] from render::@3 - [68] return [ ] + [70] return [ numpoints#1 ] to:@return render::@6: scope:[render] from render::@3 - [69] (byte~) render::y#6 ← (byte) render::y#1 [ render::y#6 render::colline#1 ] - [70] (byte*~) render::colline#6 ← (byte*) render::colline#1 [ render::y#6 render::colline#6 ] + [71] (byte~) render::y#6 ← (byte) render::y#1 [ numpoints#1 render::y#6 render::colline#1 ] + [72] (byte*~) render::colline#6 ← (byte*) render::colline#1 [ numpoints#1 render::y#6 render::colline#6 ] to:render::@1 render::@7: scope:[render] from render::@5 - [71] (byte~) render::x#4 ← (byte) render::x#1 [ render::x#4 render::y#2 render::colline#2 ] + [73] (byte~) render::x#4 ← (byte) render::x#1 [ numpoints#1 render::y#2 render::colline#2 render::x#4 ] to:render::@2 findcol: scope:[findcol] from render::@2 + [74] phi() [ numpoints#1 findcol::x#0 findcol::y#0 ] to:findcol::@1 findcol::@1: scope:[findcol] from findcol findcol::@19 - [72] (byte) findcol::mincol#11 ← phi( findcol/(byte) 0 findcol::@19/(byte~) findcol::mincol#14 ) [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ] - [72] (byte) findcol::mindiff#10 ← phi( findcol/(byte) 255 findcol::@19/(byte~) findcol::mindiff#13 ) [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ] - [72] (byte) findcol::i#12 ← phi( findcol/(byte) 0 findcol::@19/(byte~) findcol::i#14 ) [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 ] - [73] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ numpoints#1 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 ] - [74] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ numpoints#1 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 ] - [75] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ numpoints#1 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 ] + [75] (byte) findcol::mincol#11 ← phi( findcol/(byte) 0 findcol::@19/(byte~) findcol::mincol#14 ) [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 ] + [75] (byte) findcol::mindiff#10 ← phi( findcol/(byte) 255 findcol::@19/(byte~) findcol::mindiff#13 ) [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 ] + [75] (byte) findcol::i#12 ← phi( findcol/(byte) 0 findcol::@19/(byte~) findcol::i#14 ) [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 ] + [76] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 ] + [77] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 ] + [78] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 ] to:findcol::@9 findcol::@9: scope:[findcol] from findcol::@1 - [76] if((byte) findcol::y#0!=(byte) findcol::yp#0) goto findcol::@2 [ numpoints#1 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 ] + [79] if((byte) findcol::y#0!=(byte) findcol::yp#0) goto findcol::@2 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 ] to:findcol::@return findcol::@return: scope:[findcol] from findcol::@20 findcol::@9 - [77] (byte) findcol::return#0 ← phi( findcol::@9/(byte) 0 findcol::@20/(byte~) findcol::mincol#15 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] - [78] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + [80] (byte) findcol::return#0 ← phi( findcol::@9/(byte) 0 findcol::@20/(byte~) findcol::mincol#15 ) [ numpoints#1 findcol::return#0 ] + [81] return [ numpoints#1 findcol::return#0 ] to:@return findcol::@2: scope:[findcol] from findcol::@1 findcol::@9 - [79] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ numpoints#1 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 ] + [82] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 ] to:findcol::@12 findcol::@12: scope:[findcol] from findcol::@2 - [80] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#1 findcol::mindiff#10 findcol::mincol#11 ] - [81] (byte~) findcol::diff#9 ← (byte) findcol::diff#1 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#9 findcol::mindiff#10 findcol::mincol#11 ] + [83] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#1 ] + [84] (byte~) findcol::diff#9 ← (byte) findcol::diff#1 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#9 ] to:findcol::@5 findcol::@5: scope:[findcol] from findcol::@12 findcol::@4 - [82] (byte) findcol::diff#4 ← phi( findcol::@12/(byte~) findcol::diff#9 findcol::@4/(byte~) findcol::diff#10 ) [ numpoints#1 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 ] - [83] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ numpoints#1 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 ] + [85] (byte) findcol::diff#4 ← phi( findcol::@12/(byte~) findcol::diff#9 findcol::@4/(byte~) findcol::diff#10 ) [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 ] + [86] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 ] to:findcol::@14 findcol::@14: scope:[findcol] from findcol::@5 - [84] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::$12 findcol::mindiff#10 findcol::mincol#11 ] - [85] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ numpoints#1 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 ] - [86] (byte~) findcol::diff#11 ← (byte) findcol::diff#3 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#11 findcol::mindiff#10 findcol::mincol#11 ] + [87] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 findcol::$12 ] + [88] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#3 ] + [89] (byte~) findcol::diff#11 ← (byte) findcol::diff#3 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#11 ] to:findcol::@7 findcol::@7: scope:[findcol] from findcol::@14 findcol::@6 - [87] (byte) findcol::diff#6 ← phi( findcol::@14/(byte~) findcol::diff#11 findcol::@6/(byte~) findcol::diff#12 ) [ numpoints#1 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 ] - [88] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ numpoints#1 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 ] + [90] (byte) findcol::diff#6 ← phi( findcol::@14/(byte~) findcol::diff#11 findcol::@6/(byte~) findcol::diff#12 ) [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 ] + [91] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 ] to:findcol::@16 findcol::@16: scope:[findcol] from findcol::@7 - [89] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 ] - [90] (byte~) findcol::mincol#16 ← (byte) findcol::mincol#1 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#16 ] - [91] (byte~) findcol::diff#13 ← (byte) findcol::diff#6 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#16 findcol::diff#13 ] + [92] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::diff#6 findcol::mincol#1 ] + [93] (byte~) findcol::mincol#16 ← (byte) findcol::mincol#1 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::diff#6 findcol::mincol#16 ] + [94] (byte~) findcol::diff#13 ← (byte) findcol::diff#6 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#16 findcol::diff#13 ] to:findcol::@8 findcol::@8: scope:[findcol] from findcol::@16 findcol::@21 - [92] (byte) findcol::mindiff#11 ← phi( findcol::@16/(byte~) findcol::diff#13 findcol::@21/(byte~) findcol::mindiff#14 ) [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#2 findcol::mindiff#11 ] - [92] (byte) findcol::mincol#2 ← phi( findcol::@16/(byte~) findcol::mincol#16 findcol::@21/(byte~) findcol::mincol#17 ) [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#2 findcol::mindiff#11 ] - [93] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] - [94] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] + [95] (byte) findcol::mindiff#11 ← phi( findcol::@16/(byte~) findcol::diff#13 findcol::@21/(byte~) findcol::mindiff#14 ) [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#2 findcol::mindiff#11 ] + [95] (byte) findcol::mincol#2 ← phi( findcol::@16/(byte~) findcol::mincol#16 findcol::@21/(byte~) findcol::mincol#17 ) [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#2 findcol::mindiff#11 ] + [96] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::mincol#2 findcol::mindiff#11 findcol::i#1 ] + [97] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::mincol#2 findcol::mindiff#11 findcol::i#1 ] to:findcol::@20 findcol::@20: scope:[findcol] from findcol::@8 - [95] (byte~) findcol::mincol#15 ← (byte) findcol::mincol#2 [ render::x#2 render::y#2 render::colline#2 findcol::mincol#15 ] + [98] (byte~) findcol::mincol#15 ← (byte) findcol::mincol#2 [ numpoints#1 findcol::mincol#15 ] to:findcol::@return findcol::@19: scope:[findcol] from findcol::@8 - [96] (byte~) findcol::i#14 ← (byte) findcol::i#1 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#14 findcol::x#0 findcol::y#0 findcol::mincol#2 findcol::mindiff#11 ] - [97] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#14 findcol::mindiff#13 findcol::x#0 findcol::y#0 findcol::mincol#2 ] - [98] (byte~) findcol::mincol#14 ← (byte) findcol::mincol#2 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#14 findcol::mindiff#13 findcol::mincol#14 findcol::x#0 findcol::y#0 ] + [99] (byte~) findcol::i#14 ← (byte) findcol::i#1 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#14 findcol::mincol#2 findcol::mindiff#11 ] + [100] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#14 findcol::mindiff#13 findcol::mincol#2 ] + [101] (byte~) findcol::mincol#14 ← (byte) findcol::mincol#2 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#14 findcol::mindiff#13 findcol::mincol#14 ] to:findcol::@1 findcol::@21: scope:[findcol] from findcol::@7 - [99] (byte~) findcol::mincol#17 ← (byte) findcol::mincol#11 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#17 ] - [100] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#17 findcol::mindiff#14 ] + [102] (byte~) findcol::mincol#17 ← (byte) findcol::mincol#11 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#17 ] + [103] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#17 findcol::mindiff#14 ] to:findcol::@8 findcol::@6: scope:[findcol] from findcol::@5 - [101] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ numpoints#1 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::$14 ] - [102] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 findcol::diff#2 ] - [103] (byte~) findcol::diff#12 ← (byte) findcol::diff#2 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#12 findcol::mindiff#10 findcol::mincol#11 ] + [104] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 findcol::$14 ] + [105] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#2 ] + [106] (byte~) findcol::diff#12 ← (byte) findcol::diff#2 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#12 ] to:findcol::@7 findcol::@4: scope:[findcol] from findcol::@2 - [104] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 findcol::diff#0 ] - [105] (byte~) findcol::diff#10 ← (byte) findcol::diff#0 [ numpoints#1 render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#10 findcol::mindiff#10 findcol::mincol#11 ] + [107] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#0 ] + [108] (byte~) findcol::diff#10 ← (byte) findcol::diff#0 [ numpoints#1 findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#10 ] to:findcol::@5 initscreen: scope:[initscreen] from main::@8 + [109] phi() [ ] to:initscreen::@1 initscreen::@1: scope:[initscreen] from initscreen initscreen::@3 - [106] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@3/(byte*~) initscreen::screen#3 ) [ initscreen::screen#2 ] - [107] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] - [108] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] - [109] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@3 [ initscreen::screen#1 ] + [110] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@3/(byte*~) initscreen::screen#3 ) [ initscreen::screen#2 ] + [111] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] + [112] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] + [113] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@3 [ initscreen::screen#1 ] to:initscreen::@return initscreen::@return: scope:[initscreen] from initscreen::@1 - [110] return [ ] + [114] return [ ] to:@return initscreen::@3: scope:[initscreen] from initscreen::@1 - [111] (byte*~) initscreen::screen#3 ← (byte*) initscreen::screen#1 [ initscreen::screen#3 ] + [115] (byte*~) initscreen::screen#3 ← (byte*) initscreen::screen#1 [ initscreen::screen#3 ] to:initscreen::@1 addpoint: scope:[addpoint] from main main::@3 main::@4 main::@5 main::@6 main::@7 - [112] (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 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [112] (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 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [112] (byte) numpoints#19 ← phi( main/(byte) 0 main::@3/(byte~) numpoints#44 main::@4/(byte~) numpoints#45 main::@5/(byte~) numpoints#46 main::@6/(byte~) numpoints#47 main::@7/(byte~) numpoints#48 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [112] (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 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [113] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] - [114] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] - [115] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] - [116] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ numpoints#1 ] + [116] (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::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ] + [116] (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::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ] + [116] (byte) numpoints#19 ← phi( main/(byte) 0 main::@3/(byte~) numpoints#44 main::@4/(byte~) numpoints#45 main::@5/(byte~) numpoints#46 main::@6/(byte~) numpoints#47 main::@7/(byte~) numpoints#48 ) [ addpoint::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ] + [116] (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::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ] + [117] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] + [118] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] + [119] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] + [120] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ numpoints#1 ] to:addpoint::@return addpoint::@return: scope:[addpoint] from addpoint - [117] return [ numpoints#1 ] + [121] return [ numpoints#1 ] to:@return Created 16 initial phi equivalence classes -Coalesced [2] numpoints#44 ← numpoints#1 -Coalesced (already) [4] numpoints#45 ← numpoints#1 -Coalesced (already) [6] numpoints#46 ← numpoints#1 -Coalesced (already) [8] numpoints#47 ← numpoints#1 -Coalesced (already) [10] numpoints#48 ← numpoints#1 -Coalesced [69] render::y#6 ← render::y#1 -Coalesced [70] render::colline#6 ← render::colline#1 -Coalesced [71] render::x#4 ← render::x#1 -Coalesced [81] findcol::diff#9 ← findcol::diff#1 -Coalesced [86] findcol::diff#11 ← findcol::diff#3 -Coalesced [90] findcol::mincol#16 ← findcol::mincol#1 -Coalesced [91] findcol::diff#13 ← findcol::diff#6 -Coalesced [95] findcol::mincol#15 ← findcol::mincol#2 -Coalesced [96] findcol::i#14 ← findcol::i#1 -Not coalescing [97] findcol::mindiff#13 ← findcol::mindiff#11 -Coalesced [98] findcol::mincol#14 ← findcol::mincol#2 -Coalesced (already) [99] findcol::mincol#17 ← findcol::mincol#11 -Not coalescing [100] findcol::mindiff#14 ← findcol::mindiff#10 -Coalesced [103] findcol::diff#12 ← findcol::diff#2 -Coalesced [105] findcol::diff#10 ← findcol::diff#0 -Coalesced [111] initscreen::screen#3 ← initscreen::screen#1 +Coalesced [3] numpoints#44 ← numpoints#1 +Coalesced (already) [5] numpoints#45 ← numpoints#1 +Coalesced (already) [7] numpoints#46 ← numpoints#1 +Coalesced (already) [9] numpoints#47 ← numpoints#1 +Coalesced (already) [11] numpoints#48 ← numpoints#1 +Coalesced [71] render::y#6 ← render::y#1 +Coalesced [72] render::colline#6 ← render::colline#1 +Coalesced [73] render::x#4 ← render::x#1 +Coalesced [84] findcol::diff#9 ← findcol::diff#1 +Coalesced [89] findcol::diff#11 ← findcol::diff#3 +Coalesced [93] findcol::mincol#16 ← findcol::mincol#1 +Coalesced [94] findcol::diff#13 ← findcol::diff#6 +Coalesced [98] findcol::mincol#15 ← findcol::mincol#2 +Coalesced [99] findcol::i#14 ← findcol::i#1 +Not coalescing [100] findcol::mindiff#13 ← findcol::mindiff#11 +Coalesced [101] findcol::mincol#14 ← findcol::mincol#2 +Coalesced (already) [102] findcol::mincol#17 ← findcol::mincol#11 +Not coalescing [103] findcol::mindiff#14 ← findcol::mindiff#10 +Coalesced [106] findcol::diff#12 ← findcol::diff#2 +Coalesced [108] findcol::diff#10 ← findcol::diff#0 +Coalesced [115] initscreen::screen#3 ← initscreen::screen#1 Coalesced down to 13 phi equivalence classes Culled Empty Block (label) render::@6 Culled Empty Block (label) render::@7 Culled Empty Block (label) findcol::@20 Culled Empty Block (label) initscreen::@3 Block Sequence Planned @begin @end main main::@3 main::@4 main::@5 main::@6 main::@7 main::@8 main::@1 main::@10 main::@11 main::@return animate animate::@7 animate::@1 animate::@8 animate::@2 animate::@9 animate::@3 animate::@10 animate::@4 animate::@11 animate::@12 animate::@return render render::@1 render::@2 render::@5 render::@3 render::@return findcol findcol::@1 findcol::@9 findcol::@return findcol::@2 findcol::@12 findcol::@5 findcol::@14 findcol::@7 findcol::@16 findcol::@8 findcol::@19 findcol::@21 findcol::@6 findcol::@4 initscreen initscreen::@1 initscreen::@return addpoint addpoint::@return +Adding NOP phi() at start of main +Adding NOP phi() at start of render +Adding NOP phi() at start of findcol +Adding NOP phi() at start of initscreen +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... @@ -7915,33 +7916,13 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Propagating live ranges... -Propagated render::x#2 through call [55] call findcol param-assignment -Propagated render::colline#2 through call [55] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [55] call findcol param-assignment -Propagated render::colline#2 through call [55] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [55] call findcol param-assignment -Propagated render::colline#2 through call [55] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [55] call findcol param-assignment -Propagated render::colline#2 through call [55] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [55] call findcol param-assignment -Propagated render::y#2 through call [55] call findcol param-assignment -Propagated render::colline#2 through call [55] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [55] call findcol param-assignment -Propagated render::y#2 through call [55] call findcol param-assignment -Propagated render::colline#2 through call [55] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [55] call findcol param-assignment -Propagated render::y#2 through call [55] call findcol param-assignment -Propagated render::colline#2 through call [55] call findcol param-assignment Propagating live ranges... -Propagated render::x#2 through call [55] call findcol param-assignment -Propagated render::y#2 through call [55] call findcol param-assignment -Propagated render::colline#2 through call [55] call findcol param-assignment Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @begin: scope:[] from @@ -7949,214 +7930,213 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @begin main: scope:[main] from @begin - [1] call addpoint param-assignment [ ] + [1] phi() [ ] + [2] call addpoint param-assignment [ ] to:main::@3 main::@3: scope:[main] from main - [2] call addpoint param-assignment [ ] + [3] call addpoint param-assignment [ numpoints#1 ] to:main::@4 main::@4: scope:[main] from main::@3 - [3] call addpoint param-assignment [ ] + [4] call addpoint param-assignment [ numpoints#1 ] to:main::@5 main::@5: scope:[main] from main::@4 - [4] call addpoint param-assignment [ ] + [5] call addpoint param-assignment [ numpoints#1 ] to:main::@6 main::@6: scope:[main] from main::@5 - [5] call addpoint param-assignment [ ] + [6] call addpoint param-assignment [ numpoints#1 ] to:main::@7 main::@7: scope:[main] from main::@6 - [6] call addpoint param-assignment [ ] + [7] call addpoint param-assignment [ numpoints#1 ] to:main::@8 main::@8: scope:[main] from main::@7 - [7] call initscreen param-assignment [ ] + [8] call initscreen param-assignment [ numpoints#1 ] to:main::@1 main::@1: scope:[main] from main::@11 main::@8 - [8] call render param-assignment [ ] + [9] call render param-assignment [ numpoints#1 ] to:main::@10 main::@10: scope:[main] from main::@1 - [9] call animate param-assignment [ ] + [10] call animate param-assignment [ numpoints#1 ] to:main::@11 main::@11: scope:[main] from main::@10 - [10] if(true) goto main::@1 [ ] + [11] if(true) goto main::@1 [ numpoints#1 ] to:main::@return main::@return: scope:[main] from main::@11 - [11] return [ ] + [12] return [ ] to:@return animate: scope:[animate] from main::@10 - [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 [ ] + [13] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] + [14] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] + [15] *((word) 4096) ← (byte~) animate::$1 [ ] + [16] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] + [17] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] to:animate::@7 animate::@7: scope:[animate] from animate - [17] *((word) 4096) ← (byte) 0 [ ] + [18] *((word) 4096) ← (byte) 0 [ ] to:animate::@1 animate::@1: scope:[animate] from animate animate::@7 - [18] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] - [19] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] - [20] *((word) 4352) ← (byte~) animate::$6 [ ] - [21] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] - [22] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] + [19] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] + [20] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] + [21] *((word) 4352) ← (byte~) animate::$6 [ ] + [22] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] + [23] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] to:animate::@8 animate::@8: scope:[animate] from animate::@1 - [23] *((word) 4352) ← (byte) 0 [ ] + [24] *((word) 4352) ← (byte) 0 [ ] to:animate::@2 animate::@2: scope:[animate] from animate::@1 animate::@8 - [24] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] - [25] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] - [26] *((word) 4097) ← (byte~) animate::$11 [ ] - [27] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] - [28] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] + [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] + [26] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] + [27] *((word) 4097) ← (byte~) animate::$11 [ ] + [28] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] + [29] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] to:animate::@9 animate::@9: scope:[animate] from animate::@2 - [29] *((word) 4097) ← (byte) 40 [ ] + [30] *((word) 4097) ← (byte) 40 [ ] to:animate::@3 animate::@3: scope:[animate] from animate::@2 animate::@9 - [30] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] - [31] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] - [32] *((word) 4354) ← (byte~) animate::$16 [ ] - [33] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] - [34] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] + [31] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] + [32] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] + [33] *((word) 4354) ← (byte~) animate::$16 [ ] + [34] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] + [35] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] to:animate::@10 animate::@10: scope:[animate] from animate::@3 - [35] *((word) 4354) ← (byte) 0 [ ] + [36] *((word) 4354) ← (byte) 0 [ ] to:animate::@4 animate::@4: scope:[animate] from animate::@10 animate::@3 - [36] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] - [37] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] - [38] *((word) 4355) ← (byte~) animate::$21 [ ] - [39] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] - [40] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] + [37] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] + [38] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] + [39] *((word) 4355) ← (byte~) animate::$21 [ ] + [40] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] + [41] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] to:animate::@11 animate::@11: scope:[animate] from animate::@4 - [41] *((word) 4355) ← (byte) 25 [ ] - [42] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] - [43] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] - [44] *((word) 4099) ← (byte~) animate::$26 [ ] - [45] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] - [46] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] + [42] *((word) 4355) ← (byte) 25 [ ] + [43] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] + [44] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] + [45] *((word) 4099) ← (byte~) animate::$26 [ ] + [46] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] + [47] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] to:animate::@12 animate::@12: scope:[animate] from animate::@11 - [47] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] - [48] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] - [49] *((word) 4099) ← (byte~) animate::$31 [ ] + [48] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] + [49] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] + [50] *((word) 4099) ← (byte~) animate::$31 [ ] to:animate::@return animate::@return: scope:[animate] from animate::@11 animate::@12 animate::@4 - [50] return [ ] + [51] return [ ] to:@return render: scope:[render] from main::@1 + [52] phi() [ numpoints#1 ] to:render::@1 render::@1: scope:[render] from render render::@3 - [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 ] + [53] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@3/(byte*) render::colline#1 ) [ render::y#2 render::colline#2 numpoints#1 ] + [53] (byte) render::y#2 ← phi( render/(byte) 0 render::@3/(byte) render::y#1 ) [ render::y#2 render::colline#2 numpoints#1 ] to:render::@2 render::@2: scope:[render] 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 render::colline#2 ] - [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 ] - [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 ] - [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + [54] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@5/(byte) render::x#1 ) [ render::y#2 render::colline#2 render::x#2 numpoints#1 ] + [55] (byte) findcol::x#0 ← (byte) render::x#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 numpoints#1 ] + [56] (byte) findcol::y#0 ← (byte) render::y#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 findcol::y#0 numpoints#1 ] + [57] call findcol param-assignment [ render::y#2 render::colline#2 render::x#2 findcol::return#0 numpoints#1 ] to:render::@5 render::@5: scope:[render] from render::@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 ] + [58] (byte) render::col#0 ← (byte) findcol::return#0 [ render::y#2 render::colline#2 render::x#2 render::col#0 numpoints#1 ] + [59] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::y#2 render::colline#2 render::x#2 numpoints#1 ] + [60] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] + [61] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] to:render::@3 render::@3: scope:[render] from render::@5 - [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 ] + [62] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 render::colline#1 numpoints#1 ] + [63] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 numpoints#1 ] + [64] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 numpoints#1 ] to:render::@return render::@return: scope:[render] from render::@3 - [63] return [ ] + [65] return [ numpoints#1 ] to:@return findcol: scope:[findcol] from render::@2 + [66] phi() [ findcol::x#0 findcol::y#0 numpoints#1 ] to:findcol::@1 findcol::@1: scope:[findcol] from findcol findcol::@19 - [64] (byte) findcol::mincol#11 ← phi( findcol/(byte) 0 findcol::@19/(byte) findcol::mincol#2 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] - [64] (byte) findcol::mindiff#10 ← phi( findcol/(byte) 255 findcol::@19/(byte~) findcol::mindiff#13 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] - [64] (byte) findcol::i#12 ← phi( findcol/(byte) 0 findcol::@19/(byte) findcol::i#1 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] - [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 numpoints#1 ] - [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 numpoints#1 ] - [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 numpoints#1 ] + [67] (byte) findcol::mincol#11 ← phi( findcol/(byte) 0 findcol::@19/(byte) findcol::mincol#2 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] + [67] (byte) findcol::mindiff#10 ← phi( findcol/(byte) 255 findcol::@19/(byte~) findcol::mindiff#13 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] + [67] (byte) findcol::i#12 ← phi( findcol/(byte) 0 findcol::@19/(byte) findcol::i#1 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] + [68] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 numpoints#1 ] + [69] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] + [70] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] to:findcol::@9 findcol::@9: scope:[findcol] from findcol::@1 - [68] if((byte) findcol::y#0!=(byte) findcol::yp#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 numpoints#1 ] + [71] if((byte) findcol::y#0!=(byte) findcol::yp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] to:findcol::@return findcol::@return: scope:[findcol] from findcol::@8 findcol::@9 - [69] (byte) findcol::return#0 ← phi( findcol::@9/(byte) 0 findcol::@8/(byte) findcol::mincol#2 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] - [70] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + [72] (byte) findcol::return#0 ← phi( findcol::@9/(byte) 0 findcol::@8/(byte) findcol::mincol#2 ) [ findcol::return#0 numpoints#1 ] + [73] return [ findcol::return#0 numpoints#1 ] to:@return findcol::@2: scope:[findcol] from findcol::@1 findcol::@9 - [71] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ 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 numpoints#1 ] + [74] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] to:findcol::@12 findcol::@12: scope:[findcol] from findcol::@2 - [72] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#1 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] + [75] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#1 numpoints#1 ] to:findcol::@5 findcol::@5: scope:[findcol] from findcol::@12 findcol::@4 - [73] (byte) findcol::diff#4 ← phi( findcol::@12/(byte) findcol::diff#1 findcol::@4/(byte) findcol::diff#0 ) [ 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 numpoints#1 ] - [74] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ 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 numpoints#1 ] + [76] (byte) findcol::diff#4 ← phi( findcol::@12/(byte) findcol::diff#1 findcol::@4/(byte) findcol::diff#0 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 numpoints#1 ] + [77] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 numpoints#1 ] to:findcol::@14 findcol::@14: scope:[findcol] from findcol::@5 - [75] (byte~) findcol::$12 ← (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::$12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] - [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ 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 numpoints#1 ] + [78] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 findcol::$12 numpoints#1 ] + [79] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#3 numpoints#1 ] to:findcol::@7 findcol::@7: scope:[findcol] from findcol::@14 findcol::@6 - [77] (byte) findcol::diff#6 ← phi( findcol::@14/(byte) findcol::diff#3 findcol::@6/(byte) findcol::diff#2 ) [ 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 numpoints#1 ] - [78] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ 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 numpoints#1 ] + [80] (byte) findcol::diff#6 ← phi( findcol::@14/(byte) findcol::diff#3 findcol::@6/(byte) findcol::diff#2 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 numpoints#1 ] + [81] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 numpoints#1 ] to:findcol::@16 findcol::@16: scope:[findcol] from findcol::@7 - [79] (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 numpoints#1 ] + [82] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::diff#6 findcol::mincol#1 numpoints#1 ] to:findcol::@8 findcol::@8: scope:[findcol] from findcol::@16 findcol::@21 - [80] (byte) findcol::mindiff#11 ← phi( findcol::@16/(byte) findcol::diff#6 findcol::@21/(byte~) findcol::mindiff#14 ) [ render::x#2 render::y#2 render::colline#2 findcol::mincol#2 findcol::i#12 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] - [80] (byte) findcol::mincol#2 ← phi( findcol::@16/(byte) findcol::mincol#1 findcol::@21/(byte) findcol::mincol#11 ) [ render::x#2 render::y#2 render::colline#2 findcol::mincol#2 findcol::i#12 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] - [81] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] - [82] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] + [83] (byte) findcol::mindiff#11 ← phi( findcol::@16/(byte) findcol::diff#6 findcol::@21/(byte~) findcol::mindiff#14 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] + [83] (byte) findcol::mincol#2 ← phi( findcol::@16/(byte) findcol::mincol#1 findcol::@21/(byte) findcol::mincol#11 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] + [84] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] + [85] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] to:findcol::@return findcol::@19: scope:[findcol] from findcol::@8 - [83] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 ] + [86] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 numpoints#1 ] to:findcol::@1 findcol::@21: scope:[findcol] from findcol::@7 - [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] + [87] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] to:findcol::@8 findcol::@6: scope:[findcol] from findcol::@5 - [85] (byte~) findcol::$14 ← (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::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] - [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ 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 numpoints#1 ] + [88] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 numpoints#1 findcol::$14 ] + [89] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#2 numpoints#1 ] to:findcol::@7 findcol::@4: scope:[findcol] from findcol::@2 - [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] + [90] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#0 numpoints#1 ] to:findcol::@5 initscreen: scope:[initscreen] from main::@8 + [91] phi() [ ] to:initscreen::@1 initscreen::@1: scope:[initscreen] from initscreen initscreen::@1 - [88] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@1/(byte*) initscreen::screen#1 ) [ initscreen::screen#2 ] - [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] - [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] - [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] + [92] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@1/(byte*) initscreen::screen#1 ) [ initscreen::screen#2 ] + [93] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] + [94] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] + [95] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] to:initscreen::@return initscreen::@return: scope:[initscreen] from initscreen::@1 - [92] return [ ] + [96] return [ ] to:@return addpoint: scope:[addpoint] from main main::@3 main::@4 main::@5 main::@6 main::@7 - [93] (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 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [93] (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 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [93] (byte) numpoints#19 ← phi( main/(byte) 0 main::@3/(byte) numpoints#1 main::@4/(byte) numpoints#1 main::@5/(byte) numpoints#1 main::@6/(byte) numpoints#1 main::@7/(byte) numpoints#1 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [93] (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 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ] - [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] - [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] - [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] - [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] + [97] (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::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ] + [97] (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::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ] + [97] (byte) numpoints#19 ← phi( main/(byte) 0 main::@3/(byte) numpoints#1 main::@4/(byte) numpoints#1 main::@5/(byte) numpoints#1 main::@6/(byte) numpoints#1 main::@7/(byte) numpoints#1 ) [ addpoint::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ] + [97] (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::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ] + [98] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] + [99] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] + [100] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] + [101] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ numpoints#1 ] to:addpoint::@return addpoint::@return: scope:[addpoint] from addpoint - [98] return [ ] + [102] return [ numpoints#1 ] to:@return -CALL GRAPH -Calls in [] to 0:main -Calls in [main] to 1:addpoint 2:addpoint 3:addpoint 4:addpoint 5:addpoint 6:addpoint 7:initscreen 8:render 9:animate -Calls in [render] to 55:findcol - DOMINATORS @begin dominated by @begin @end dominated by @end @begin @@ -8307,11 +8287,11 @@ VARIABLE REGISTER WEIGHTS (byte) findcol::return (byte) findcol::return#0 3667.333333333333 (byte) findcol::x -(byte) findcol::x#0 1863.8636363636363 +(byte) findcol::x#0 1640.2 (byte) findcol::xp (byte) findcol::xp#0 10001.0 (byte) findcol::y -(byte) findcol::y#0 1863.8636363636363 +(byte) findcol::y#0 1708.5416666666665 (byte) findcol::yp (byte) findcol::yp#0 6250.625 (void()) initscreen() @@ -8320,20 +8300,20 @@ VARIABLE REGISTER WEIGHTS (byte*) initscreen::screen#2 16.5 (void()) main() (byte) numpoints -(byte) numpoints#1 455.13636363636346 +(byte) numpoints#1 200.25999999999996 (byte) numpoints#19 4.5 (void()) render() (byte) render::col (byte) render::col#0 2002.0 (byte*) render::colline (byte*) render::colline#1 67.33333333333333 -(byte*) render::colline#2 36.45454545454545 +(byte*) render::colline#2 133.66666666666669 (byte) render::x (byte) render::x#1 1501.5 -(byte) render::x#2 133.46666666666667 +(byte) render::x#2 667.3333333333334 (byte) render::y (byte) render::y#1 151.5 -(byte) render::y#2 35.38235294117647 +(byte) render::y#2 120.29999999999998 Initial phi equivalence classes [ render::y#2 render::y#1 ] @@ -8463,395 +8443,403 @@ INITIAL ASM //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main jmp bend -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] call addpoint param-assignment [ ] - //SEG6 [93] phi from main to addpoint + //SEG6 [2] call addpoint param-assignment [ ] + //SEG7 [97] phi from main to addpoint addpoint_from_main: - //SEG7 [93] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 + //SEG8 [97] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 lda #$1 sta addpoint.c - //SEG8 [93] phi (byte) addpoint::y#6 = (byte) 5 -- zpby1=coby1 + //SEG9 [97] phi (byte) addpoint::y#6 = (byte) 5 -- zpby1=coby1 lda #$5 sta addpoint.y - //SEG9 [93] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1 + //SEG10 [97] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1 lda #$0 sta numpoints - //SEG10 [93] phi (byte) addpoint::x#6 = (byte) 5 -- zpby1=coby1 + //SEG11 [97] phi (byte) addpoint::x#6 = (byte) 5 -- zpby1=coby1 lda #$5 sta addpoint.x jsr addpoint jmp b3 - //SEG11 main::@3 + //SEG12 main::@3 b3: - //SEG12 [2] call addpoint param-assignment [ ] - //SEG13 [93] phi from main::@3 to addpoint + //SEG13 [3] call addpoint param-assignment [ numpoints#1 ] + //SEG14 [97] phi from main::@3 to addpoint addpoint_from_b3: - //SEG14 [93] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 + //SEG15 [97] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 lda #$2 sta addpoint.c - //SEG15 [93] phi (byte) addpoint::y#6 = (byte) 8 -- zpby1=coby1 + //SEG16 [97] phi (byte) addpoint::y#6 = (byte) 8 -- zpby1=coby1 lda #$8 sta addpoint.y - //SEG16 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG17 [93] phi (byte) addpoint::x#6 = (byte) 15 -- zpby1=coby1 + //SEG17 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG18 [97] phi (byte) addpoint::x#6 = (byte) 15 -- zpby1=coby1 lda #$f sta addpoint.x jsr addpoint jmp b4 - //SEG18 main::@4 + //SEG19 main::@4 b4: - //SEG19 [3] call addpoint param-assignment [ ] - //SEG20 [93] phi from main::@4 to addpoint + //SEG20 [4] call addpoint param-assignment [ numpoints#1 ] + //SEG21 [97] phi from main::@4 to addpoint addpoint_from_b4: - //SEG21 [93] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 + //SEG22 [97] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 lda #$3 sta addpoint.c - //SEG22 [93] phi (byte) addpoint::y#6 = (byte) 14 -- zpby1=coby1 + //SEG23 [97] phi (byte) addpoint::y#6 = (byte) 14 -- zpby1=coby1 lda #$e sta addpoint.y - //SEG23 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG24 [93] phi (byte) addpoint::x#6 = (byte) 6 -- zpby1=coby1 + //SEG24 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG25 [97] phi (byte) addpoint::x#6 = (byte) 6 -- zpby1=coby1 lda #$6 sta addpoint.x jsr addpoint jmp b5 - //SEG25 main::@5 + //SEG26 main::@5 b5: - //SEG26 [4] call addpoint param-assignment [ ] - //SEG27 [93] phi from main::@5 to addpoint + //SEG27 [5] call addpoint param-assignment [ numpoints#1 ] + //SEG28 [97] phi from main::@5 to addpoint addpoint_from_b5: - //SEG28 [93] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 + //SEG29 [97] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 lda #$4 sta addpoint.c - //SEG29 [93] phi (byte) addpoint::y#6 = (byte) 2 -- zpby1=coby1 + //SEG30 [97] phi (byte) addpoint::y#6 = (byte) 2 -- zpby1=coby1 lda #$2 sta addpoint.y - //SEG30 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG31 [93] phi (byte) addpoint::x#6 = (byte) 34 -- zpby1=coby1 + //SEG31 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG32 [97] phi (byte) addpoint::x#6 = (byte) 34 -- zpby1=coby1 lda #$22 sta addpoint.x jsr addpoint jmp b6 - //SEG32 main::@6 + //SEG33 main::@6 b6: - //SEG33 [5] call addpoint param-assignment [ ] - //SEG34 [93] phi from main::@6 to addpoint + //SEG34 [6] call addpoint param-assignment [ numpoints#1 ] + //SEG35 [97] phi from main::@6 to addpoint addpoint_from_b6: - //SEG35 [93] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 + //SEG36 [97] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 lda #$5 sta addpoint.c - //SEG36 [93] phi (byte) addpoint::y#6 = (byte) 17 -- zpby1=coby1 + //SEG37 [97] phi (byte) addpoint::y#6 = (byte) 17 -- zpby1=coby1 lda #$11 sta addpoint.y - //SEG37 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG38 [93] phi (byte) addpoint::x#6 = (byte) 21 -- zpby1=coby1 + //SEG38 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG39 [97] phi (byte) addpoint::x#6 = (byte) 21 -- zpby1=coby1 lda #$15 sta addpoint.x jsr addpoint jmp b7 - //SEG39 main::@7 + //SEG40 main::@7 b7: - //SEG40 [6] call addpoint param-assignment [ ] - //SEG41 [93] phi from main::@7 to addpoint + //SEG41 [7] call addpoint param-assignment [ numpoints#1 ] + //SEG42 [97] phi from main::@7 to addpoint addpoint_from_b7: - //SEG42 [93] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 + //SEG43 [97] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 lda #$7 sta addpoint.c - //SEG43 [93] phi (byte) addpoint::y#6 = (byte) 22 -- zpby1=coby1 + //SEG44 [97] phi (byte) addpoint::y#6 = (byte) 22 -- zpby1=coby1 lda #$16 sta addpoint.y - //SEG44 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG45 [93] phi (byte) addpoint::x#6 = (byte) 31 -- zpby1=coby1 + //SEG45 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG46 [97] phi (byte) addpoint::x#6 = (byte) 31 -- zpby1=coby1 lda #$1f sta addpoint.x jsr addpoint jmp b8 - //SEG46 main::@8 + //SEG47 main::@8 b8: - //SEG47 [7] call initscreen param-assignment [ ] + //SEG48 [8] call initscreen param-assignment [ numpoints#1 ] + //SEG49 [91] phi from main::@8 to initscreen + initscreen_from_b8: jsr initscreen jmp b1 - //SEG48 main::@1 + //SEG50 main::@1 b1: - //SEG49 [8] call render param-assignment [ ] + //SEG51 [9] call render param-assignment [ numpoints#1 ] + //SEG52 [52] phi from main::@1 to render + render_from_b1: jsr render jmp b10 - //SEG50 main::@10 + //SEG53 main::@10 b10: - //SEG51 [9] call animate param-assignment [ ] + //SEG54 [10] call animate param-assignment [ numpoints#1 ] jsr animate jmp b11 - //SEG52 main::@11 + //SEG55 main::@11 b11: - //SEG53 [10] if(true) goto main::@1 [ ] -- true_then_la1 + //SEG56 [11] if(true) goto main::@1 [ numpoints#1 ] -- true_then_la1 jmp b1 jmp breturn - //SEG54 main::@return + //SEG57 main::@return breturn: - //SEG55 [11] return [ ] + //SEG58 [12] return [ ] rts } -//SEG56 animate +//SEG59 animate animate: { - .label $0 = 17 - .label $1 = 18 - .label $2 = 19 - .label $5 = 20 - .label $6 = 21 - .label $7 = 22 - .label $10 = 23 - .label $11 = 24 - .label $12 = 25 - .label $15 = 26 - .label $16 = 27 - .label $17 = 28 - .label $20 = 29 - .label $21 = 30 - .label $22 = 31 - .label $25 = 32 - .label $26 = 33 - .label $27 = 34 - .label $30 = 35 - .label $31 = 36 - //SEG57 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- zpby1=_star_cowo1 + .label _0 = 17 + .label _1 = 18 + .label _2 = 19 + .label _5 = 20 + .label _6 = 21 + .label _7 = 22 + .label _10 = 23 + .label _11 = 24 + .label _12 = 25 + .label _15 = 26 + .label _16 = 27 + .label _17 = 28 + .label _20 = 29 + .label _21 = 30 + .label _22 = 31 + .label _25 = 32 + .label _26 = 33 + .label _27 = 34 + .label _30 = 35 + .label _31 = 36 + //SEG60 [13] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- zpby1=_star_cowo1 lda $1000 - sta $0 - //SEG58 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- zpby1=zpby2_plus_1 - lda $0 + sta _0 + //SEG61 [14] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- zpby1=zpby2_plus_1 + lda _0 clc adc #$1 - sta $1 - //SEG59 [14] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=zpby1 - lda $1 + sta _1 + //SEG62 [15] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=zpby1 + lda _1 sta $1000 - //SEG60 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- zpby1=_star_cowo1 + //SEG63 [16] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- zpby1=_star_cowo1 lda $1000 - sta $2 - //SEG61 [16] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] -- zpby1_neq_coby1_then_la1 - lda $2 + sta _2 + //SEG64 [17] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] -- zpby1_neq_coby1_then_la1 + lda _2 cmp #$28 bne b1 jmp b7 - //SEG62 animate::@7 + //SEG65 animate::@7 b7: - //SEG63 [17] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG66 [18] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1000 jmp b1 - //SEG64 animate::@1 + //SEG67 animate::@1 b1: - //SEG65 [18] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] -- zpby1=_star_cowo1 + //SEG68 [19] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] -- zpby1=_star_cowo1 lda $1100 - sta $5 - //SEG66 [19] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] -- zpby1=zpby2_plus_1 - lda $5 + sta _5 + //SEG69 [20] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] -- zpby1=zpby2_plus_1 + lda _5 clc adc #$1 - sta $6 - //SEG67 [20] *((word) 4352) ← (byte~) animate::$6 [ ] -- _star_cowo1=zpby1 - lda $6 + sta _6 + //SEG70 [21] *((word) 4352) ← (byte~) animate::$6 [ ] -- _star_cowo1=zpby1 + lda _6 sta $1100 - //SEG68 [21] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] -- zpby1=_star_cowo1 + //SEG71 [22] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] -- zpby1=_star_cowo1 lda $1100 - sta $7 - //SEG69 [22] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] -- zpby1_neq_coby1_then_la1 - lda $7 + sta _7 + //SEG72 [23] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] -- zpby1_neq_coby1_then_la1 + lda _7 cmp #$19 bne b2 jmp b8 - //SEG70 animate::@8 + //SEG73 animate::@8 b8: - //SEG71 [23] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG74 [24] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1100 jmp b2 - //SEG72 animate::@2 + //SEG75 animate::@2 b2: - //SEG73 [24] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- zpby1=_star_cowo1 + //SEG76 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- zpby1=_star_cowo1 lda $1001 - sta $10 - //SEG74 [25] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] -- zpby1=zpby2_minus_1 - lda $10 + sta _10 + //SEG77 [26] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] -- zpby1=zpby2_minus_1 + lda _10 sec sbc #$1 - sta $11 - //SEG75 [26] *((word) 4097) ← (byte~) animate::$11 [ ] -- _star_cowo1=zpby1 - lda $11 + sta _11 + //SEG78 [27] *((word) 4097) ← (byte~) animate::$11 [ ] -- _star_cowo1=zpby1 + lda _11 sta $1001 - //SEG76 [27] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] -- zpby1=_star_cowo1 + //SEG79 [28] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] -- zpby1=_star_cowo1 lda $1001 - sta $12 - //SEG77 [28] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] -- zpby1_neq_coby1_then_la1 - lda $12 + sta _12 + //SEG80 [29] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] -- zpby1_neq_coby1_then_la1 + lda _12 cmp #$ff bne b3 jmp b9 - //SEG78 animate::@9 + //SEG81 animate::@9 b9: - //SEG79 [29] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 + //SEG82 [30] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 lda #$28 sta $1001 jmp b3 - //SEG80 animate::@3 + //SEG83 animate::@3 b3: - //SEG81 [30] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] -- zpby1=_star_cowo1 + //SEG84 [31] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] -- zpby1=_star_cowo1 lda $1102 - sta $15 - //SEG82 [31] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] -- zpby1=zpby2_plus_1 - lda $15 + sta _15 + //SEG85 [32] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] -- zpby1=zpby2_plus_1 + lda _15 clc adc #$1 - sta $16 - //SEG83 [32] *((word) 4354) ← (byte~) animate::$16 [ ] -- _star_cowo1=zpby1 - lda $16 + sta _16 + //SEG86 [33] *((word) 4354) ← (byte~) animate::$16 [ ] -- _star_cowo1=zpby1 + lda _16 sta $1102 - //SEG84 [33] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] -- zpby1=_star_cowo1 + //SEG87 [34] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] -- zpby1=_star_cowo1 lda $1102 - sta $17 - //SEG85 [34] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] -- zpby1_neq_coby1_then_la1 - lda $17 + sta _17 + //SEG88 [35] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] -- zpby1_neq_coby1_then_la1 + lda _17 cmp #$19 bne b4 jmp b10 - //SEG86 animate::@10 + //SEG89 animate::@10 b10: - //SEG87 [35] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG90 [36] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1102 jmp b4 - //SEG88 animate::@4 + //SEG91 animate::@4 b4: - //SEG89 [36] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] -- zpby1=_star_cowo1 + //SEG92 [37] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] -- zpby1=_star_cowo1 lda $1103 - sta $20 - //SEG90 [37] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] -- zpby1=zpby2_minus_1 - lda $20 + sta _20 + //SEG93 [38] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] -- zpby1=zpby2_minus_1 + lda _20 sec sbc #$1 - sta $21 - //SEG91 [38] *((word) 4355) ← (byte~) animate::$21 [ ] -- _star_cowo1=zpby1 - lda $21 + sta _21 + //SEG94 [39] *((word) 4355) ← (byte~) animate::$21 [ ] -- _star_cowo1=zpby1 + lda _21 sta $1103 - //SEG92 [39] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] -- zpby1=_star_cowo1 + //SEG95 [40] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] -- zpby1=_star_cowo1 lda $1103 - sta $22 - //SEG93 [40] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] -- zpby1_neq_coby1_then_la1 - lda $22 + sta _22 + //SEG96 [41] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] -- zpby1_neq_coby1_then_la1 + lda _22 cmp #$ff bne breturn jmp b11 - //SEG94 animate::@11 + //SEG97 animate::@11 b11: - //SEG95 [41] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 + //SEG98 [42] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 lda #$19 sta $1103 - //SEG96 [42] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] -- zpby1=_star_cowo1 + //SEG99 [43] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] -- zpby1=_star_cowo1 lda $1003 - sta $25 - //SEG97 [43] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] -- zpby1=zpby2_plus_coby1 - lda $25 + sta _25 + //SEG100 [44] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] -- zpby1=zpby2_plus_coby1 + lda _25 clc adc #$7 - sta $26 - //SEG98 [44] *((word) 4099) ← (byte~) animate::$26 [ ] -- _star_cowo1=zpby1 - lda $26 + sta _26 + //SEG101 [45] *((word) 4099) ← (byte~) animate::$26 [ ] -- _star_cowo1=zpby1 + lda _26 sta $1003 - //SEG99 [45] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] -- zpby1=_star_cowo1 + //SEG102 [46] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] -- zpby1=_star_cowo1 lda $1003 - sta $27 - //SEG100 [46] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] -- zpby1_lt_coby1_then_la1 - lda $27 + sta _27 + //SEG103 [47] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] -- zpby1_lt_coby1_then_la1 + lda _27 cmp #$28 bcc breturn jmp b12 - //SEG101 animate::@12 + //SEG104 animate::@12 b12: - //SEG102 [47] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] -- zpby1=_star_cowo1 + //SEG105 [48] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] -- zpby1=_star_cowo1 lda $1003 - sta $30 - //SEG103 [48] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] -- zpby1=zpby2_minus_coby1 - lda $30 + sta _30 + //SEG106 [49] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] -- zpby1=zpby2_minus_coby1 + lda _30 sec sbc #$28 - sta $31 - //SEG104 [49] *((word) 4099) ← (byte~) animate::$31 [ ] -- _star_cowo1=zpby1 - lda $31 + sta _31 + //SEG107 [50] *((word) 4099) ← (byte~) animate::$31 [ ] -- _star_cowo1=zpby1 + lda _31 sta $1003 jmp breturn - //SEG105 animate::@return + //SEG108 animate::@return breturn: - //SEG106 [50] return [ ] + //SEG109 [51] return [ ] rts } -//SEG107 render +//SEG110 render render: { .label col = 39 .label x = 5 .label colline = 3 .label y = 2 - //SEG108 [51] phi from render to render::@1 + //SEG111 [53] phi from render to render::@1 b1_from_render: - //SEG109 [51] phi (byte*) render::colline#2 = (word) 55296 -- zpptrby1=cowo1 + //SEG112 [53] phi (byte*) render::colline#2 = (word) 55296 -- zpptrby1=cowo1 lda #<$d800 sta colline lda #>$d800 sta colline+$1 - //SEG110 [51] phi (byte) render::y#2 = (byte) 0 -- zpby1=coby1 + //SEG113 [53] phi (byte) render::y#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta y jmp b1 - //SEG111 [51] phi from render::@3 to render::@1 + //SEG114 [53] phi from render::@3 to render::@1 b1_from_b3: - //SEG112 [51] phi (byte*) render::colline#2 = (byte*) render::colline#1 -- register_copy - //SEG113 [51] phi (byte) render::y#2 = (byte) render::y#1 -- register_copy + //SEG115 [53] phi (byte*) render::colline#2 = (byte*) render::colline#1 -- register_copy + //SEG116 [53] phi (byte) render::y#2 = (byte) render::y#1 -- register_copy jmp b1 - //SEG114 render::@1 + //SEG117 render::@1 b1: - //SEG115 [52] phi from render::@1 to render::@2 + //SEG118 [54] phi from render::@1 to render::@2 b2_from_b1: - //SEG116 [52] phi (byte) render::x#2 = (byte) 0 -- zpby1=coby1 + //SEG119 [54] phi (byte) render::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x jmp b2 - //SEG117 [52] phi from render::@5 to render::@2 + //SEG120 [54] phi from render::@5 to render::@2 b2_from_b5: - //SEG118 [52] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy + //SEG121 [54] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy jmp b2 - //SEG119 render::@2 + //SEG122 render::@2 b2: - //SEG120 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 ] -- zpby1=zpby2 + //SEG123 [55] (byte) findcol::x#0 ← (byte) render::x#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 numpoints#1 ] -- zpby1=zpby2 lda x sta findcol.x - //SEG121 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 ] -- zpby1=zpby2 + //SEG124 [56] (byte) findcol::y#0 ← (byte) render::y#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 findcol::y#0 numpoints#1 ] -- zpby1=zpby2 lda y sta findcol.y - //SEG122 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + //SEG125 [57] call findcol param-assignment [ render::y#2 render::colline#2 render::x#2 findcol::return#0 numpoints#1 ] + //SEG126 [66] phi from render::@2 to findcol + findcol_from_b2: jsr findcol jmp b5 - //SEG123 render::@5 + //SEG127 render::@5 b5: - //SEG124 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] -- zpby1=zpby2 + //SEG128 [58] (byte) render::col#0 ← (byte) findcol::return#0 [ render::y#2 render::colline#2 render::x#2 render::col#0 numpoints#1 ] -- zpby1=zpby2 lda findcol.return sta col - //SEG125 [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 + //SEG129 [59] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::y#2 render::colline#2 render::x#2 numpoints#1 ] -- zpptrby1_staridx_zpby1=zpby2 lda col ldy x sta (colline),y - //SEG126 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1=_inc_zpby1 + //SEG130 [60] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] -- zpby1=_inc_zpby1 inc x - //SEG127 [59] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1_neq_coby1_then_la1 + //SEG131 [61] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] -- zpby1_neq_coby1_then_la1 lda x cmp #$28 bne b2_from_b5 jmp b3 - //SEG128 render::@3 + //SEG132 render::@3 b3: - //SEG129 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG133 [62] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 render::colline#1 numpoints#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda colline clc adc #$28 @@ -8859,219 +8847,219 @@ render: { bcc !+ inc colline+$1 !: - //SEG130 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] -- zpby1=_inc_zpby1 + //SEG134 [63] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 numpoints#1 ] -- zpby1=_inc_zpby1 inc y - //SEG131 [62] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ] -- zpby1_neq_coby1_then_la1 + //SEG135 [64] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 numpoints#1 ] -- zpby1_neq_coby1_then_la1 lda y cmp #$19 bne b1_from_b3 jmp breturn - //SEG132 render::@return + //SEG136 render::@return breturn: - //SEG133 [63] return [ ] + //SEG137 [65] return [ numpoints#1 ] rts } -//SEG134 findcol +//SEG138 findcol findcol: { - .label $12 = 42 - .label $14 = 43 + .label _12 = 42 + .label _14 = 43 .label x = 37 .label y = 38 .label return = 8 .label xp = 40 .label yp = 41 .label diff = 9 - .label diff#2 = 10 - .label diff#3 = 10 + .label diff_2 = 10 + .label diff_3 = 10 .label i = 6 .label mincol = 8 - .label diff#6 = 10 + .label diff_6 = 10 .label mindiff = 7 - .label mindiff#11 = 10 - .label mindiff#14 = 10 - //SEG135 [64] phi from findcol to findcol::@1 + .label mindiff_11 = 10 + .label mindiff_14 = 10 + //SEG139 [67] phi from findcol to findcol::@1 b1_from_findcol: - //SEG136 [64] phi (byte) findcol::mincol#11 = (byte) 0 -- zpby1=coby1 + //SEG140 [67] phi (byte) findcol::mincol#11 = (byte) 0 -- zpby1=coby1 lda #$0 sta mincol - //SEG137 [64] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 + //SEG141 [67] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 lda #$ff sta mindiff - //SEG138 [64] phi (byte) findcol::i#12 = (byte) 0 -- zpby1=coby1 + //SEG142 [67] phi (byte) findcol::i#12 = (byte) 0 -- zpby1=coby1 lda #$0 sta i jmp b1 - //SEG139 findcol::@1 + //SEG143 findcol::@1 b1: - //SEG140 [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 numpoints#1 ] -- zpby1=cowo1_staridx_zpby2 + //SEG144 [68] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 numpoints#1 ] -- zpby1=cowo1_staridx_zpby2 ldx i lda $1000,x sta xp - //SEG141 [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 numpoints#1 ] -- zpby1=cowo1_staridx_zpby2 + //SEG145 [69] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1=cowo1_staridx_zpby2 ldx i lda $1100,x sta yp - //SEG142 [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 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 + //SEG146 [70] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 lda x cmp xp bne b2 jmp b9 - //SEG143 findcol::@9 + //SEG147 findcol::@9 b9: - //SEG144 [68] if((byte) findcol::y#0!=(byte) findcol::yp#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 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 + //SEG148 [71] if((byte) findcol::y#0!=(byte) findcol::yp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 lda y cmp yp bne b2 - //SEG145 [69] phi from findcol::@9 to findcol::@return + //SEG149 [72] phi from findcol::@9 to findcol::@return breturn_from_b9: - //SEG146 [69] phi (byte) findcol::return#0 = (byte) 0 -- zpby1=coby1 + //SEG150 [72] phi (byte) findcol::return#0 = (byte) 0 -- zpby1=coby1 lda #$0 sta return jmp breturn - //SEG147 findcol::@return + //SEG151 findcol::@return breturn: - //SEG148 [70] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + //SEG152 [73] return [ findcol::return#0 numpoints#1 ] rts - //SEG149 findcol::@2 + //SEG153 findcol::@2 b2: - //SEG150 [71] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG154 [74] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda x cmp xp bcs b4 jmp b12 - //SEG151 findcol::@12 + //SEG155 findcol::@12 b12: - //SEG152 [72] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#1 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby3 + //SEG156 [75] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#1 numpoints#1 ] -- zpby1=zpby2_minus_zpby3 lda xp sec sbc x sta diff - //SEG153 [73] phi from findcol::@12 findcol::@4 to findcol::@5 + //SEG157 [76] phi from findcol::@12 findcol::@4 to findcol::@5 b5_from_b12: b5_from_b4: - //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy + //SEG158 [76] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy jmp b5 - //SEG155 findcol::@5 + //SEG159 findcol::@5 b5: - //SEG156 [74] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG160 [77] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda y cmp yp bcs b6 jmp b14 - //SEG157 findcol::@14 + //SEG161 findcol::@14 b14: - //SEG158 [75] (byte~) findcol::$12 ← (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::$12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby3 + //SEG162 [78] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 findcol::$12 numpoints#1 ] -- zpby1=zpby2_minus_zpby3 lda yp sec sbc y - sta $12 - //SEG159 [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ 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 numpoints#1 ] -- zpby1=zpby2_plus_zpby3 + sta _12 + //SEG163 [79] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#3 numpoints#1 ] -- zpby1=zpby2_plus_zpby3 lda diff clc - adc $12 + adc _12 sta diff_3 - //SEG160 [77] phi from findcol::@14 findcol::@6 to findcol::@7 + //SEG164 [80] phi from findcol::@14 findcol::@6 to findcol::@7 b7_from_b14: b7_from_b6: - //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy + //SEG165 [80] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy jmp b7 - //SEG162 findcol::@7 + //SEG166 findcol::@7 b7: - //SEG163 [78] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG167 [81] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda diff_6 cmp mindiff bcs b21 jmp b16 - //SEG164 findcol::@16 + //SEG168 findcol::@16 b16: - //SEG165 [79] (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 numpoints#1 ] -- zpby1=cowo1_staridx_zpby2 + //SEG169 [82] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::diff#6 findcol::mincol#1 numpoints#1 ] -- zpby1=cowo1_staridx_zpby2 ldx i lda $1200,x sta mincol - //SEG166 [80] phi from findcol::@16 findcol::@21 to findcol::@8 + //SEG170 [83] phi from findcol::@16 findcol::@21 to findcol::@8 b8_from_b16: b8_from_b21: - //SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy - //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy + //SEG171 [83] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy + //SEG172 [83] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy jmp b8 - //SEG169 findcol::@8 + //SEG173 findcol::@8 b8: - //SEG170 [81] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] -- zpby1=_inc_zpby1 + //SEG174 [84] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] -- zpby1=_inc_zpby1 inc i - //SEG171 [82] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] -- zpby1_lt_zpby2_then_la1 + //SEG175 [85] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] -- zpby1_lt_zpby2_then_la1 lda i cmp numpoints bcc b19 - //SEG172 [69] phi from findcol::@8 to findcol::@return + //SEG176 [72] phi from findcol::@8 to findcol::@return breturn_from_b8: - //SEG173 [69] phi (byte) findcol::return#0 = (byte) findcol::mincol#2 -- register_copy + //SEG177 [72] phi (byte) findcol::return#0 = (byte) findcol::mincol#2 -- register_copy jmp breturn - //SEG174 findcol::@19 + //SEG178 findcol::@19 b19: - //SEG175 [83] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 ] -- zpby1=zpby2 + //SEG179 [86] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 numpoints#1 ] -- zpby1=zpby2 lda mindiff_11 sta mindiff - //SEG176 [64] phi from findcol::@19 to findcol::@1 + //SEG180 [67] phi from findcol::@19 to findcol::@1 b1_from_b19: - //SEG177 [64] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy - //SEG178 [64] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 -- register_copy - //SEG179 [64] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy + //SEG181 [67] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy + //SEG182 [67] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 -- register_copy + //SEG183 [67] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy jmp b1 - //SEG180 findcol::@21 + //SEG184 findcol::@21 b21: - //SEG181 [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- zpby1=zpby2 + //SEG185 [87] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- zpby1=zpby2 lda mindiff sta mindiff_14 jmp b8_from_b21 - //SEG182 findcol::@6 + //SEG186 findcol::@6 b6: - //SEG183 [85] (byte~) findcol::$14 ← (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::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- zpby1=zpby2_minus_zpby3 + //SEG187 [88] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 numpoints#1 findcol::$14 ] -- zpby1=zpby2_minus_zpby3 lda y sec sbc yp - sta $14 - //SEG184 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ 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 numpoints#1 ] -- zpby1=zpby2_plus_zpby3 + sta _14 + //SEG188 [89] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#2 numpoints#1 ] -- zpby1=zpby2_plus_zpby3 lda diff clc - adc $14 + adc _14 sta diff_2 jmp b7_from_b6 - //SEG185 findcol::@4 + //SEG189 findcol::@4 b4: - //SEG186 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby3 + //SEG190 [90] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#0 numpoints#1 ] -- zpby1=zpby2_minus_zpby3 lda x sec sbc xp sta diff jmp b5_from_b4 } -//SEG187 initscreen +//SEG191 initscreen initscreen: { .label screen = 11 - //SEG188 [88] phi from initscreen to initscreen::@1 + //SEG192 [92] phi from initscreen to initscreen::@1 b1_from_initscreen: - //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG193 [92] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 jmp b1 - //SEG190 [88] phi from initscreen::@1 to initscreen::@1 + //SEG194 [92] phi from initscreen::@1 to initscreen::@1 b1_from_b1: - //SEG191 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy + //SEG195 [92] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy jmp b1 - //SEG192 initscreen::@1 + //SEG196 initscreen::@1 b1: - //SEG193 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 + //SEG197 [93] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$e6 sta (screen),y - //SEG194 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 + //SEG198 [94] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG195 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 + //SEG199 [95] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda screen+$1 cmp #>$7e8 bcc b1_from_b1 @@ -9081,75 +9069,162 @@ initscreen: { bcc b1_from_b1 !: jmp breturn - //SEG196 initscreen::@return + //SEG200 initscreen::@return breturn: - //SEG197 [92] return [ ] + //SEG201 [96] return [ ] rts } -//SEG198 addpoint +//SEG202 addpoint addpoint: { .label x = 13 .label y = 15 .label c = 16 - //SEG199 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=zpby2 + //SEG203 [98] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=zpby2 lda x ldx numpoints sta $1000,x - //SEG200 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=zpby2 + //SEG204 [99] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=zpby2 lda y ldx numpoints sta $1100,x - //SEG201 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 + //SEG205 [100] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 lda c ldx numpoints sta $1200,x - //SEG202 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 + //SEG206 [101] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ numpoints#1 ] -- zpby1=_inc_zpby1 inc numpoints jmp breturn - //SEG203 addpoint::@return + //SEG207 addpoint::@return breturn: - //SEG204 [98] return [ ] + //SEG208 [102] return [ numpoints#1 ] rts } -Statement [17] *((word) 4096) ← (byte) 0 [ ] always clobbers reg byte a -Statement [23] *((word) 4352) ← (byte) 0 [ ] always clobbers reg byte a -Statement [29] *((word) 4097) ← (byte) 40 [ ] always clobbers reg byte a -Statement [35] *((word) 4354) ← (byte) 0 [ ] always clobbers reg byte a -Statement [41] *((word) 4355) ← (byte) 25 [ ] always clobbers reg byte a -Statement [43] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] always clobbers reg byte a -Statement [48] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] 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 [18] *((word) 4096) ← (byte) 0 [ ] always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:14 [ numpoints#19 numpoints#1 ] +Statement [24] *((word) 4352) ← (byte) 0 [ ] always clobbers reg byte a +Statement [30] *((word) 4097) ← (byte) 40 [ ] always clobbers reg byte a +Statement [36] *((word) 4354) ← (byte) 0 [ ] always clobbers reg byte a +Statement [42] *((word) 4355) ← (byte) 25 [ ] always clobbers reg byte a +Statement [44] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] always clobbers reg byte a +Statement [49] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] always clobbers reg byte a +Statement [62] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 render::colline#1 numpoints#1 ] always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ render::y#2 render::y#1 ] -Statement [72] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#1 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ render::x#2 render::x#1 ] -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ findcol::i#12 findcol::i#1 ] +Potential register analysis [75] findcol::diff#1 ← findcol::xp#0 - findcol::x#0 missing fragment zpby1=xby_minus_zpby2 allocation: zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] reg byte x [ findcol::xp#0 ] zp ZP_BYTE:37 [ findcol::x#0 ] +Potential register analysis [75] findcol::diff#1 ← findcol::xp#0 - findcol::x#0 missing fragment zpby1=yby_minus_zpby2 allocation: zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] reg byte y [ findcol::xp#0 ] zp ZP_BYTE:37 [ findcol::x#0 ] +Potential register analysis [75] findcol::diff#1 ← findcol::xp#0 - findcol::x#0 missing fragment zpby1=zpby2_minus_aby allocation: zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] zp ZP_BYTE:40 [ findcol::xp#0 ] reg byte a [ findcol::x#0 ] +Potential register analysis [75] findcol::diff#1 ← findcol::xp#0 - findcol::x#0 missing fragment zpby1=zpby2_minus_xby allocation: zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] zp ZP_BYTE:40 [ findcol::xp#0 ] reg byte x [ findcol::x#0 ] +Potential register analysis [75] findcol::diff#1 ← findcol::xp#0 - findcol::x#0 missing fragment zpby1=zpby2_minus_yby allocation: zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] zp ZP_BYTE:40 [ findcol::xp#0 ] reg byte y [ findcol::x#0 ] +MISSING FRAGMENTS + zpby1=xby_minus_zpby2 + zpby1=yby_minus_zpby2 + zpby1=zpby2_minus_aby + zpby1=zpby2_minus_xby + zpby1=zpby2_minus_yby +Statement [75] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#1 numpoints#1 ] always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:37 [ findcol::x#0 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:38 [ findcol::y#0 ] -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:41 [ findcol::yp#0 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ findcol::i#12 findcol::i#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:7 [ findcol::mindiff#10 findcol::mindiff#13 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:8 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:14 [ numpoints#19 numpoints#1 ] -Statement [75] (byte~) findcol::$12 ← (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::$12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:41 [ findcol::yp#0 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ render::x#2 render::x#1 ] +Potential register analysis [78] findcol::$12 ← findcol::yp#0 - findcol::y#0 missing fragment zpby1=xby_minus_zpby2 allocation: zp ZP_BYTE:42 [ findcol::$12 ] reg byte x [ findcol::yp#0 ] zp ZP_BYTE:38 [ findcol::y#0 ] +Potential register analysis [78] findcol::$12 ← findcol::yp#0 - findcol::y#0 missing fragment zpby1=yby_minus_zpby2 allocation: zp ZP_BYTE:42 [ findcol::$12 ] reg byte y [ findcol::yp#0 ] zp ZP_BYTE:38 [ findcol::y#0 ] +Potential register analysis [78] findcol::$12 ← findcol::yp#0 - findcol::y#0 missing fragment zpby1=zpby2_minus_xby allocation: zp ZP_BYTE:42 [ findcol::$12 ] zp ZP_BYTE:41 [ findcol::yp#0 ] reg byte x [ findcol::y#0 ] +Potential register analysis [78] findcol::$12 ← findcol::yp#0 - findcol::y#0 missing fragment zpby1=zpby2_minus_yby allocation: zp ZP_BYTE:42 [ findcol::$12 ] zp ZP_BYTE:41 [ findcol::yp#0 ] reg byte y [ findcol::y#0 ] +MISSING FRAGMENTS + zpby1=xby_minus_zpby2 + zpby1=yby_minus_zpby2 + zpby1=zpby2_minus_xby + zpby1=zpby2_minus_yby +Statement [78] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 findcol::$12 numpoints#1 ] always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] -Statement [85] (byte~) findcol::$14 ← (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::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] always clobbers reg byte a -Statement [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] always clobbers reg byte a -Statement [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] always clobbers reg byte a reg byte y -Statement [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] always clobbers reg byte a -Statement [17] *((word) 4096) ← (byte) 0 [ ] always clobbers reg byte a -Statement [23] *((word) 4352) ← (byte) 0 [ ] always clobbers reg byte a -Statement [29] *((word) 4097) ← (byte) 40 [ ] always clobbers reg byte a -Statement [35] *((word) 4354) ← (byte) 0 [ ] always clobbers reg byte a -Statement [41] *((word) 4355) ← (byte) 25 [ ] always clobbers reg byte a -Statement [43] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] always clobbers reg byte a -Statement [48] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] 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 [72] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#1 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] always clobbers reg byte a -Statement [75] (byte~) findcol::$12 ← (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::$12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] always clobbers reg byte a -Statement [85] (byte~) findcol::$14 ← (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::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] always clobbers reg byte a -Statement [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] always clobbers reg byte a -Statement [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] always clobbers reg byte a reg byte y -Statement [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] always clobbers reg byte a +Potential register analysis [85] if(findcol::i#1$d800 sta colline+$1 - //SEG110 [51] phi (byte) render::y#2 = (byte) 0 -- zpby1=coby1 + //SEG113 [53] phi (byte) render::y#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta y jmp b1 - //SEG111 [51] phi from render::@3 to render::@1 + //SEG114 [53] phi from render::@3 to render::@1 b1_from_b3: - //SEG112 [51] phi (byte*) render::colline#2 = (byte*) render::colline#1 -- register_copy - //SEG113 [51] phi (byte) render::y#2 = (byte) render::y#1 -- register_copy - //SEG114 render::@1 + //SEG115 [53] phi (byte*) render::colline#2 = (byte*) render::colline#1 -- register_copy + //SEG116 [53] phi (byte) render::y#2 = (byte) render::y#1 -- register_copy + //SEG117 render::@1 b1: - //SEG115 [52] phi from render::@1 to render::@2 + //SEG118 [54] phi from render::@1 to render::@2 b2_from_b1: - //SEG116 [52] phi (byte) render::x#2 = (byte) 0 -- zpby1=coby1 + //SEG119 [54] phi (byte) render::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x jmp b2 - //SEG117 [52] phi from render::@5 to render::@2 + //SEG120 [54] phi from render::@5 to render::@2 b2_from_b5: - //SEG118 [52] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy - //SEG119 render::@2 + //SEG121 [54] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy + //SEG122 render::@2 b2: - //SEG120 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 ] -- zpby1=zpby2 + //SEG123 [55] (byte) findcol::x#0 ← (byte) render::x#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 numpoints#1 ] -- zpby1=zpby2 lda x sta findcol.x - //SEG121 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 ] -- zpby1=zpby2 + //SEG124 [56] (byte) findcol::y#0 ← (byte) render::y#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 findcol::y#0 numpoints#1 ] -- zpby1=zpby2 lda y sta findcol.y - //SEG122 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + //SEG125 [57] call findcol param-assignment [ render::y#2 render::colline#2 render::x#2 findcol::return#0 numpoints#1 ] + //SEG126 [66] phi from render::@2 to findcol + findcol_from_b2: jsr findcol - //SEG123 render::@5 + //SEG127 render::@5 b5: - //SEG124 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] -- aby=yby + //SEG128 [58] (byte) render::col#0 ← (byte) findcol::return#0 [ render::y#2 render::colline#2 render::x#2 render::col#0 numpoints#1 ] -- aby=yby tya - //SEG125 [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 + //SEG129 [59] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::y#2 render::colline#2 render::x#2 numpoints#1 ] -- zpptrby1_staridx_zpby1=aby ldy x sta (colline),y - //SEG126 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1=_inc_zpby1 + //SEG130 [60] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] -- zpby1=_inc_zpby1 inc x - //SEG127 [59] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1_neq_coby1_then_la1 + //SEG131 [61] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] -- zpby1_neq_coby1_then_la1 lda x cmp #$28 bne b2_from_b5 - //SEG128 render::@3 + //SEG132 render::@3 b3: - //SEG129 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG133 [62] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 render::colline#1 numpoints#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda colline clc adc #$28 @@ -9581,18 +9708,18 @@ render: { bcc !+ inc colline+$1 !: - //SEG130 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] -- zpby1=_inc_zpby1 + //SEG134 [63] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 numpoints#1 ] -- zpby1=_inc_zpby1 inc y - //SEG131 [62] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ] -- zpby1_neq_coby1_then_la1 + //SEG135 [64] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 numpoints#1 ] -- zpby1_neq_coby1_then_la1 lda y cmp #$19 bne b1_from_b3 - //SEG132 render::@return + //SEG136 render::@return breturn: - //SEG133 [63] return [ ] + //SEG137 [65] return [ numpoints#1 ] rts } -//SEG134 findcol +//SEG138 findcol findcol: { .label x = 9 .label y = 10 @@ -9600,162 +9727,162 @@ findcol: { .label yp = 11 .label diff = 7 .label mindiff = 6 - //SEG135 [64] phi from findcol to findcol::@1 + //SEG139 [67] phi from findcol to findcol::@1 b1_from_findcol: - //SEG136 [64] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 + //SEG140 [67] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG137 [64] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 + //SEG141 [67] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 lda #$ff sta mindiff - //SEG138 [64] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 + //SEG142 [67] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG139 findcol::@1 + //SEG143 findcol::@1 b1: - //SEG140 [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 numpoints#1 ] -- zpby1=cowo1_staridx_xby + //SEG144 [68] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 numpoints#1 ] -- zpby1=cowo1_staridx_xby lda $1000,x sta xp - //SEG141 [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 numpoints#1 ] -- zpby1=cowo1_staridx_xby + //SEG145 [69] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1=cowo1_staridx_xby lda $1100,x sta yp - //SEG142 [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 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 + //SEG146 [70] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 lda x cmp xp bne b2 - //SEG143 findcol::@9 + //SEG147 findcol::@9 b9: - //SEG144 [68] if((byte) findcol::y#0!=(byte) findcol::yp#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 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 + //SEG148 [71] if((byte) findcol::y#0!=(byte) findcol::yp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 lda y cmp yp bne b2 - //SEG145 [69] phi from findcol::@9 to findcol::@return + //SEG149 [72] phi from findcol::@9 to findcol::@return breturn_from_b9: - //SEG146 [69] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 + //SEG150 [72] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG147 findcol::@return + //SEG151 findcol::@return breturn: - //SEG148 [70] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + //SEG152 [73] return [ findcol::return#0 numpoints#1 ] rts - //SEG149 findcol::@2 + //SEG153 findcol::@2 b2: - //SEG150 [71] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG154 [74] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda x cmp xp bcs b4 - //SEG151 findcol::@12 + //SEG155 findcol::@12 b12: - //SEG152 [72] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#1 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby1_minus_zpby2 + //SEG156 [75] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#1 numpoints#1 ] -- zpby1=zpby1_minus_zpby2 lda diff sec sbc x sta diff - //SEG153 [73] phi from findcol::@12 findcol::@4 to findcol::@5 + //SEG157 [76] phi from findcol::@12 findcol::@4 to findcol::@5 b5_from_b12: b5_from_b4: - //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy - //SEG155 findcol::@5 + //SEG158 [76] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy + //SEG159 findcol::@5 b5: - //SEG156 [74] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG160 [77] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda y cmp yp bcs b6 - //SEG157 findcol::@14 + //SEG161 findcol::@14 b14: - //SEG158 [75] (byte~) findcol::$12 ← (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::$12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_minus_zpby2 + //SEG162 [78] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 findcol::$12 numpoints#1 ] -- aby=zpby1_minus_zpby2 lda yp sec sbc y - //SEG159 [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ 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 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG163 [79] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#3 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG160 [77] phi from findcol::@14 findcol::@6 to findcol::@7 + //SEG164 [80] phi from findcol::@14 findcol::@6 to findcol::@7 b7_from_b14: b7_from_b6: - //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy - //SEG162 findcol::@7 + //SEG165 [80] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy + //SEG166 findcol::@7 b7: - //SEG163 [78] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ 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 numpoints#1 ] -- aby_ge_zpby1_then_la1 + //SEG167 [81] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 numpoints#1 ] -- aby_ge_zpby1_then_la1 cmp mindiff bcs b21 - //SEG164 findcol::@16 + //SEG168 findcol::@16 b16: - //SEG165 [79] (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 numpoints#1 ] -- yby=cowo1_staridx_xby + //SEG169 [82] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::diff#6 findcol::mincol#1 numpoints#1 ] -- yby=cowo1_staridx_xby ldy $1200,x - //SEG166 [80] phi from findcol::@16 findcol::@21 to findcol::@8 + //SEG170 [83] phi from findcol::@16 findcol::@21 to findcol::@8 b8_from_b16: b8_from_b21: - //SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy - //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy - //SEG169 findcol::@8 + //SEG171 [83] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy + //SEG172 [83] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy + //SEG173 findcol::@8 b8: - //SEG170 [81] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] -- xby=_inc_xby + //SEG174 [84] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] -- xby=_inc_xby inx - //SEG171 [82] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] -- xby_lt_zpby1_then_la1 + //SEG175 [85] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] -- xby_lt_zpby1_then_la1 cpx numpoints bcc b19 - //SEG172 [69] phi from findcol::@8 to findcol::@return + //SEG176 [72] phi from findcol::@8 to findcol::@return breturn_from_b8: - //SEG173 [69] phi (byte) findcol::return#0 = (byte) findcol::mincol#2 -- register_copy + //SEG177 [72] phi (byte) findcol::return#0 = (byte) findcol::mincol#2 -- register_copy jmp breturn - //SEG174 findcol::@19 + //SEG178 findcol::@19 b19: - //SEG175 [83] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 ] -- zpby1=aby + //SEG179 [86] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 numpoints#1 ] -- zpby1=aby sta mindiff - //SEG176 [64] phi from findcol::@19 to findcol::@1 + //SEG180 [67] phi from findcol::@19 to findcol::@1 b1_from_b19: - //SEG177 [64] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy - //SEG178 [64] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 -- register_copy - //SEG179 [64] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy + //SEG181 [67] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy + //SEG182 [67] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 -- register_copy + //SEG183 [67] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy jmp b1 - //SEG180 findcol::@21 + //SEG184 findcol::@21 b21: - //SEG181 [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 + //SEG185 [87] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 lda mindiff jmp b8_from_b21 - //SEG182 findcol::@6 + //SEG186 findcol::@6 b6: - //SEG183 [85] (byte~) findcol::$14 ← (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::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 + //SEG187 [88] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 lda y sec sbc yp - //SEG184 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ 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 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG188 [89] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#2 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff jmp b7_from_b6 - //SEG185 findcol::@4 + //SEG189 findcol::@4 b4: - //SEG186 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 + //SEG190 [90] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#0 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 lda x sec sbc diff sta diff jmp b5_from_b4 } -//SEG187 initscreen +//SEG191 initscreen initscreen: { .label screen = 3 - //SEG188 [88] phi from initscreen to initscreen::@1 + //SEG192 [92] phi from initscreen to initscreen::@1 b1_from_initscreen: - //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG193 [92] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 jmp b1 - //SEG190 [88] phi from initscreen::@1 to initscreen::@1 + //SEG194 [92] phi from initscreen::@1 to initscreen::@1 b1_from_b1: - //SEG191 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy - //SEG192 initscreen::@1 + //SEG195 [92] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy + //SEG196 initscreen::@1 b1: - //SEG193 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 + //SEG197 [93] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$e6 sta (screen),y - //SEG194 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 + //SEG198 [94] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG195 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 + //SEG199 [95] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda screen+$1 cmp #>$7e8 bcc b1_from_b1 @@ -9764,30 +9891,30 @@ initscreen: { cmp #<$7e8 bcc b1_from_b1 !: - //SEG196 initscreen::@return + //SEG200 initscreen::@return breturn: - //SEG197 [92] return [ ] + //SEG201 [96] return [ ] rts } -//SEG198 addpoint +//SEG202 addpoint addpoint: { .label c = 2 - //SEG199 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby + //SEG203 [98] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby ldx numpoints sta $1000,x - //SEG200 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby + //SEG204 [99] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby tya ldy numpoints sta $1100,y - //SEG201 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 + //SEG205 [100] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 lda c ldx numpoints sta $1200,x - //SEG202 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 + //SEG206 [101] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ numpoints#1 ] -- zpby1=_inc_zpby1 inc numpoints - //SEG203 addpoint::@return + //SEG207 addpoint::@return breturn: - //SEG204 [98] return [ ] + //SEG208 [102] return [ numpoints#1 ] rts } @@ -9798,11 +9925,14 @@ Replacing label b7_from_b6 with b7 Replacing label b5_from_b4 with b5 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 +Removing instruction main_from_bbegin: Removing instruction addpoint_from_b3: Removing instruction addpoint_from_b4: Removing instruction addpoint_from_b5: Removing instruction addpoint_from_b6: Removing instruction addpoint_from_b7: +Removing instruction initscreen_from_b8: +Removing instruction render_from_b1: Removing instruction b1_from_b3: Removing instruction b2_from_b1: Removing instruction b2_from_b5: @@ -9820,284 +9950,289 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] call addpoint param-assignment [ ] - //SEG6 [93] phi from main to addpoint + //SEG6 [2] call addpoint param-assignment [ ] + //SEG7 [97] phi from main to addpoint addpoint_from_main: - //SEG7 [93] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 + //SEG8 [97] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 lda #$1 sta addpoint.c - //SEG8 [93] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1 + //SEG9 [97] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1 ldy #$5 - //SEG9 [93] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1 + //SEG10 [97] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1 lda #$0 sta numpoints - //SEG10 [93] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1 + //SEG11 [97] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1 lda #$5 jsr addpoint - //SEG11 main::@3 + //SEG12 main::@3 b3: - //SEG12 [2] call addpoint param-assignment [ ] - //SEG13 [93] phi from main::@3 to addpoint - //SEG14 [93] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 + //SEG13 [3] call addpoint param-assignment [ numpoints#1 ] + //SEG14 [97] phi from main::@3 to addpoint + //SEG15 [97] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 lda #$2 sta addpoint.c - //SEG15 [93] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1 + //SEG16 [97] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1 ldy #$8 - //SEG16 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG17 [93] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1 + //SEG17 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG18 [97] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1 lda #$f jsr addpoint - //SEG18 main::@4 + //SEG19 main::@4 b4: - //SEG19 [3] call addpoint param-assignment [ ] - //SEG20 [93] phi from main::@4 to addpoint - //SEG21 [93] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 + //SEG20 [4] call addpoint param-assignment [ numpoints#1 ] + //SEG21 [97] phi from main::@4 to addpoint + //SEG22 [97] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 lda #$3 sta addpoint.c - //SEG22 [93] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1 + //SEG23 [97] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1 ldy #$e - //SEG23 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG24 [93] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1 + //SEG24 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG25 [97] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1 lda #$6 jsr addpoint - //SEG25 main::@5 + //SEG26 main::@5 b5: - //SEG26 [4] call addpoint param-assignment [ ] - //SEG27 [93] phi from main::@5 to addpoint - //SEG28 [93] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 + //SEG27 [5] call addpoint param-assignment [ numpoints#1 ] + //SEG28 [97] phi from main::@5 to addpoint + //SEG29 [97] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 lda #$4 sta addpoint.c - //SEG29 [93] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1 + //SEG30 [97] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1 ldy #$2 - //SEG30 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG31 [93] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1 + //SEG31 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG32 [97] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1 lda #$22 jsr addpoint - //SEG32 main::@6 + //SEG33 main::@6 b6: - //SEG33 [5] call addpoint param-assignment [ ] - //SEG34 [93] phi from main::@6 to addpoint - //SEG35 [93] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 + //SEG34 [6] call addpoint param-assignment [ numpoints#1 ] + //SEG35 [97] phi from main::@6 to addpoint + //SEG36 [97] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 lda #$5 sta addpoint.c - //SEG36 [93] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1 + //SEG37 [97] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1 ldy #$11 - //SEG37 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG38 [93] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1 + //SEG38 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG39 [97] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1 lda #$15 jsr addpoint - //SEG39 main::@7 + //SEG40 main::@7 b7: - //SEG40 [6] call addpoint param-assignment [ ] - //SEG41 [93] phi from main::@7 to addpoint - //SEG42 [93] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 + //SEG41 [7] call addpoint param-assignment [ numpoints#1 ] + //SEG42 [97] phi from main::@7 to addpoint + //SEG43 [97] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 lda #$7 sta addpoint.c - //SEG43 [93] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1 + //SEG44 [97] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1 ldy #$16 - //SEG44 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG45 [93] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1 + //SEG45 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG46 [97] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1 lda #$1f jsr addpoint - //SEG46 main::@8 + //SEG47 main::@8 b8: - //SEG47 [7] call initscreen param-assignment [ ] + //SEG48 [8] call initscreen param-assignment [ numpoints#1 ] + //SEG49 [91] phi from main::@8 to initscreen jsr initscreen - //SEG48 main::@1 + //SEG50 main::@1 b1: - //SEG49 [8] call render param-assignment [ ] + //SEG51 [9] call render param-assignment [ numpoints#1 ] + //SEG52 [52] phi from main::@1 to render jsr render - //SEG50 main::@10 + //SEG53 main::@10 b10: - //SEG51 [9] call animate param-assignment [ ] + //SEG54 [10] call animate param-assignment [ numpoints#1 ] jsr animate - //SEG52 main::@11 + //SEG55 main::@11 b11: - //SEG53 [10] if(true) goto main::@1 [ ] -- true_then_la1 + //SEG56 [11] if(true) goto main::@1 [ numpoints#1 ] -- true_then_la1 jmp b1 - //SEG54 main::@return + //SEG57 main::@return breturn: - //SEG55 [11] return [ ] + //SEG58 [12] return [ ] rts } -//SEG56 animate +//SEG59 animate animate: { - //SEG57 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- aby=_star_cowo1 + //SEG60 [13] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- aby=_star_cowo1 lda $1000 - //SEG58 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- aby=aby_plus_1 + //SEG61 [14] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- aby=aby_plus_1 clc adc #$1 - //SEG59 [14] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=aby + //SEG62 [15] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=aby sta $1000 - //SEG60 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- aby=_star_cowo1 + //SEG63 [16] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- aby=_star_cowo1 lda $1000 - //SEG61 [16] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] -- aby_neq_coby1_then_la1 + //SEG64 [17] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] -- aby_neq_coby1_then_la1 cmp #$28 bne b1 - //SEG62 animate::@7 + //SEG65 animate::@7 b7: - //SEG63 [17] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG66 [18] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1000 - //SEG64 animate::@1 + //SEG67 animate::@1 b1: - //SEG65 [18] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] -- aby=_star_cowo1 + //SEG68 [19] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] -- aby=_star_cowo1 lda $1100 - //SEG66 [19] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] -- aby=aby_plus_1 + //SEG69 [20] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] -- aby=aby_plus_1 clc adc #$1 - //SEG67 [20] *((word) 4352) ← (byte~) animate::$6 [ ] -- _star_cowo1=aby + //SEG70 [21] *((word) 4352) ← (byte~) animate::$6 [ ] -- _star_cowo1=aby sta $1100 - //SEG68 [21] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] -- aby=_star_cowo1 + //SEG71 [22] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] -- aby=_star_cowo1 lda $1100 - //SEG69 [22] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] -- aby_neq_coby1_then_la1 + //SEG72 [23] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] -- aby_neq_coby1_then_la1 cmp #$19 bne b2 - //SEG70 animate::@8 + //SEG73 animate::@8 b8: - //SEG71 [23] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG74 [24] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1100 - //SEG72 animate::@2 + //SEG75 animate::@2 b2: - //SEG73 [24] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- xby=_star_cowo1 + //SEG76 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- xby=_star_cowo1 ldx $1001 - //SEG74 [25] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] -- xby=xby_minus_1 + //SEG77 [26] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] -- xby=xby_minus_1 dex - //SEG75 [26] *((word) 4097) ← (byte~) animate::$11 [ ] -- _star_cowo1=xby + //SEG78 [27] *((word) 4097) ← (byte~) animate::$11 [ ] -- _star_cowo1=xby stx $1001 - //SEG76 [27] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] -- aby=_star_cowo1 + //SEG79 [28] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] -- aby=_star_cowo1 lda $1001 - //SEG77 [28] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] -- aby_neq_coby1_then_la1 + //SEG80 [29] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] -- aby_neq_coby1_then_la1 cmp #$ff bne b3 - //SEG78 animate::@9 + //SEG81 animate::@9 b9: - //SEG79 [29] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 + //SEG82 [30] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 lda #$28 sta $1001 - //SEG80 animate::@3 + //SEG83 animate::@3 b3: - //SEG81 [30] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] -- aby=_star_cowo1 + //SEG84 [31] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] -- aby=_star_cowo1 lda $1102 - //SEG82 [31] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] -- aby=aby_plus_1 + //SEG85 [32] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] -- aby=aby_plus_1 clc adc #$1 - //SEG83 [32] *((word) 4354) ← (byte~) animate::$16 [ ] -- _star_cowo1=aby + //SEG86 [33] *((word) 4354) ← (byte~) animate::$16 [ ] -- _star_cowo1=aby sta $1102 - //SEG84 [33] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] -- aby=_star_cowo1 + //SEG87 [34] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] -- aby=_star_cowo1 lda $1102 - //SEG85 [34] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] -- aby_neq_coby1_then_la1 + //SEG88 [35] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] -- aby_neq_coby1_then_la1 cmp #$19 bne b4 - //SEG86 animate::@10 + //SEG89 animate::@10 b10: - //SEG87 [35] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG90 [36] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1102 - //SEG88 animate::@4 + //SEG91 animate::@4 b4: - //SEG89 [36] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] -- xby=_star_cowo1 + //SEG92 [37] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] -- xby=_star_cowo1 ldx $1103 - //SEG90 [37] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] -- xby=xby_minus_1 + //SEG93 [38] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] -- xby=xby_minus_1 dex - //SEG91 [38] *((word) 4355) ← (byte~) animate::$21 [ ] -- _star_cowo1=xby + //SEG94 [39] *((word) 4355) ← (byte~) animate::$21 [ ] -- _star_cowo1=xby stx $1103 - //SEG92 [39] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] -- aby=_star_cowo1 + //SEG95 [40] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] -- aby=_star_cowo1 lda $1103 - //SEG93 [40] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] -- aby_neq_coby1_then_la1 + //SEG96 [41] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] -- aby_neq_coby1_then_la1 cmp #$ff bne breturn - //SEG94 animate::@11 + //SEG97 animate::@11 b11: - //SEG95 [41] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 + //SEG98 [42] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 lda #$19 sta $1103 - //SEG96 [42] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] -- aby=_star_cowo1 + //SEG99 [43] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] -- aby=_star_cowo1 lda $1003 - //SEG97 [43] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] -- aby=aby_plus_coby1 + //SEG100 [44] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] -- aby=aby_plus_coby1 clc adc #$7 - //SEG98 [44] *((word) 4099) ← (byte~) animate::$26 [ ] -- _star_cowo1=aby + //SEG101 [45] *((word) 4099) ← (byte~) animate::$26 [ ] -- _star_cowo1=aby sta $1003 - //SEG99 [45] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] -- aby=_star_cowo1 + //SEG102 [46] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] -- aby=_star_cowo1 lda $1003 - //SEG100 [46] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] -- aby_lt_coby1_then_la1 + //SEG103 [47] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] -- aby_lt_coby1_then_la1 cmp #$28 bcc breturn - //SEG101 animate::@12 + //SEG104 animate::@12 b12: - //SEG102 [47] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] -- aby=_star_cowo1 + //SEG105 [48] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] -- aby=_star_cowo1 lda $1003 - //SEG103 [48] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] -- aby=aby_minus_coby1 + //SEG106 [49] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] -- aby=aby_minus_coby1 sec sbc #$28 - //SEG104 [49] *((word) 4099) ← (byte~) animate::$31 [ ] -- _star_cowo1=aby + //SEG107 [50] *((word) 4099) ← (byte~) animate::$31 [ ] -- _star_cowo1=aby sta $1003 - //SEG105 animate::@return + //SEG108 animate::@return breturn: - //SEG106 [50] return [ ] + //SEG109 [51] return [ ] rts } -//SEG107 render +//SEG110 render render: { .label x = 5 .label colline = 3 .label y = 2 - //SEG108 [51] phi from render to render::@1 + //SEG111 [53] phi from render to render::@1 b1_from_render: - //SEG109 [51] phi (byte*) render::colline#2 = (word) 55296 -- zpptrby1=cowo1 + //SEG112 [53] phi (byte*) render::colline#2 = (word) 55296 -- zpptrby1=cowo1 lda #<$d800 sta colline lda #>$d800 sta colline+$1 - //SEG110 [51] phi (byte) render::y#2 = (byte) 0 -- zpby1=coby1 + //SEG113 [53] phi (byte) render::y#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta y jmp b1 - //SEG111 [51] phi from render::@3 to render::@1 - //SEG112 [51] phi (byte*) render::colline#2 = (byte*) render::colline#1 -- register_copy - //SEG113 [51] phi (byte) render::y#2 = (byte) render::y#1 -- register_copy - //SEG114 render::@1 + //SEG114 [53] phi from render::@3 to render::@1 + //SEG115 [53] phi (byte*) render::colline#2 = (byte*) render::colline#1 -- register_copy + //SEG116 [53] phi (byte) render::y#2 = (byte) render::y#1 -- register_copy + //SEG117 render::@1 b1: - //SEG115 [52] phi from render::@1 to render::@2 - //SEG116 [52] phi (byte) render::x#2 = (byte) 0 -- zpby1=coby1 + //SEG118 [54] phi from render::@1 to render::@2 + //SEG119 [54] phi (byte) render::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x jmp b2 - //SEG117 [52] phi from render::@5 to render::@2 - //SEG118 [52] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy - //SEG119 render::@2 + //SEG120 [54] phi from render::@5 to render::@2 + //SEG121 [54] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy + //SEG122 render::@2 b2: - //SEG120 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 ] -- zpby1=zpby2 + //SEG123 [55] (byte) findcol::x#0 ← (byte) render::x#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 numpoints#1 ] -- zpby1=zpby2 lda x sta findcol.x - //SEG121 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 ] -- zpby1=zpby2 + //SEG124 [56] (byte) findcol::y#0 ← (byte) render::y#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 findcol::y#0 numpoints#1 ] -- zpby1=zpby2 lda y sta findcol.y - //SEG122 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + //SEG125 [57] call findcol param-assignment [ render::y#2 render::colline#2 render::x#2 findcol::return#0 numpoints#1 ] + //SEG126 [66] phi from render::@2 to findcol + findcol_from_b2: jsr findcol - //SEG123 render::@5 + //SEG127 render::@5 b5: - //SEG124 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] -- aby=yby + //SEG128 [58] (byte) render::col#0 ← (byte) findcol::return#0 [ render::y#2 render::colline#2 render::x#2 render::col#0 numpoints#1 ] -- aby=yby tya - //SEG125 [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 + //SEG129 [59] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::y#2 render::colline#2 render::x#2 numpoints#1 ] -- zpptrby1_staridx_zpby1=aby ldy x sta (colline),y - //SEG126 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1=_inc_zpby1 + //SEG130 [60] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] -- zpby1=_inc_zpby1 inc x - //SEG127 [59] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1_neq_coby1_then_la1 + //SEG131 [61] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] -- zpby1_neq_coby1_then_la1 lda x cmp #$28 bne b2 - //SEG128 render::@3 + //SEG132 render::@3 b3: - //SEG129 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG133 [62] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 render::colline#1 numpoints#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda colline clc adc #$28 @@ -10105,18 +10240,18 @@ render: { bcc !+ inc colline+$1 !: - //SEG130 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] -- zpby1=_inc_zpby1 + //SEG134 [63] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 numpoints#1 ] -- zpby1=_inc_zpby1 inc y - //SEG131 [62] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ] -- zpby1_neq_coby1_then_la1 + //SEG135 [64] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 numpoints#1 ] -- zpby1_neq_coby1_then_la1 lda y cmp #$19 bne b1 - //SEG132 render::@return + //SEG136 render::@return breturn: - //SEG133 [63] return [ ] + //SEG137 [65] return [ numpoints#1 ] rts } -//SEG134 findcol +//SEG138 findcol findcol: { .label x = 9 .label y = 10 @@ -10124,155 +10259,155 @@ findcol: { .label yp = 11 .label diff = 7 .label mindiff = 6 - //SEG135 [64] phi from findcol to findcol::@1 + //SEG139 [67] phi from findcol to findcol::@1 b1_from_findcol: - //SEG136 [64] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 + //SEG140 [67] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG137 [64] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 + //SEG141 [67] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 lda #$ff sta mindiff - //SEG138 [64] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 + //SEG142 [67] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG139 findcol::@1 + //SEG143 findcol::@1 b1: - //SEG140 [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 numpoints#1 ] -- zpby1=cowo1_staridx_xby + //SEG144 [68] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 numpoints#1 ] -- zpby1=cowo1_staridx_xby lda $1000,x sta xp - //SEG141 [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 numpoints#1 ] -- zpby1=cowo1_staridx_xby + //SEG145 [69] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1=cowo1_staridx_xby lda $1100,x sta yp - //SEG142 [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 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 + //SEG146 [70] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 lda x cmp xp bne b2 - //SEG143 findcol::@9 + //SEG147 findcol::@9 b9: - //SEG144 [68] if((byte) findcol::y#0!=(byte) findcol::yp#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 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 + //SEG148 [71] if((byte) findcol::y#0!=(byte) findcol::yp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 lda y cmp yp bne b2 - //SEG145 [69] phi from findcol::@9 to findcol::@return + //SEG149 [72] phi from findcol::@9 to findcol::@return breturn_from_b9: - //SEG146 [69] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 + //SEG150 [72] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG147 findcol::@return + //SEG151 findcol::@return breturn: - //SEG148 [70] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + //SEG152 [73] return [ findcol::return#0 numpoints#1 ] rts - //SEG149 findcol::@2 + //SEG153 findcol::@2 b2: - //SEG150 [71] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG154 [74] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda x cmp xp bcs b4 - //SEG151 findcol::@12 + //SEG155 findcol::@12 b12: - //SEG152 [72] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#1 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby1_minus_zpby2 + //SEG156 [75] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#1 numpoints#1 ] -- zpby1=zpby1_minus_zpby2 lda diff sec sbc x sta diff - //SEG153 [73] phi from findcol::@12 findcol::@4 to findcol::@5 - //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy - //SEG155 findcol::@5 + //SEG157 [76] phi from findcol::@12 findcol::@4 to findcol::@5 + //SEG158 [76] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy + //SEG159 findcol::@5 b5: - //SEG156 [74] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG160 [77] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda y cmp yp bcs b6 - //SEG157 findcol::@14 + //SEG161 findcol::@14 b14: - //SEG158 [75] (byte~) findcol::$12 ← (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::$12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_minus_zpby2 + //SEG162 [78] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 findcol::$12 numpoints#1 ] -- aby=zpby1_minus_zpby2 lda yp sec sbc y - //SEG159 [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ 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 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG163 [79] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#3 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG160 [77] phi from findcol::@14 findcol::@6 to findcol::@7 - //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy - //SEG162 findcol::@7 + //SEG164 [80] phi from findcol::@14 findcol::@6 to findcol::@7 + //SEG165 [80] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy + //SEG166 findcol::@7 b7: - //SEG163 [78] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ 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 numpoints#1 ] -- aby_ge_zpby1_then_la1 + //SEG167 [81] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 numpoints#1 ] -- aby_ge_zpby1_then_la1 cmp mindiff bcs b21 - //SEG164 findcol::@16 + //SEG168 findcol::@16 b16: - //SEG165 [79] (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 numpoints#1 ] -- yby=cowo1_staridx_xby + //SEG169 [82] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::diff#6 findcol::mincol#1 numpoints#1 ] -- yby=cowo1_staridx_xby ldy $1200,x - //SEG166 [80] phi from findcol::@16 findcol::@21 to findcol::@8 - //SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy - //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy - //SEG169 findcol::@8 + //SEG170 [83] phi from findcol::@16 findcol::@21 to findcol::@8 + //SEG171 [83] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy + //SEG172 [83] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy + //SEG173 findcol::@8 b8: - //SEG170 [81] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] -- xby=_inc_xby + //SEG174 [84] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] -- xby=_inc_xby inx - //SEG171 [82] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] -- xby_lt_zpby1_then_la1 + //SEG175 [85] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] -- xby_lt_zpby1_then_la1 cpx numpoints bcc b19 - //SEG172 [69] phi from findcol::@8 to findcol::@return + //SEG176 [72] phi from findcol::@8 to findcol::@return breturn_from_b8: - //SEG173 [69] phi (byte) findcol::return#0 = (byte) findcol::mincol#2 -- register_copy + //SEG177 [72] phi (byte) findcol::return#0 = (byte) findcol::mincol#2 -- register_copy jmp breturn - //SEG174 findcol::@19 + //SEG178 findcol::@19 b19: - //SEG175 [83] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 ] -- zpby1=aby + //SEG179 [86] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 numpoints#1 ] -- zpby1=aby sta mindiff - //SEG176 [64] phi from findcol::@19 to findcol::@1 + //SEG180 [67] phi from findcol::@19 to findcol::@1 b1_from_b19: - //SEG177 [64] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy - //SEG178 [64] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 -- register_copy - //SEG179 [64] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy + //SEG181 [67] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy + //SEG182 [67] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 -- register_copy + //SEG183 [67] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy jmp b1 - //SEG180 findcol::@21 + //SEG184 findcol::@21 b21: - //SEG181 [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 + //SEG185 [87] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 lda mindiff jmp b8 - //SEG182 findcol::@6 + //SEG186 findcol::@6 b6: - //SEG183 [85] (byte~) findcol::$14 ← (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::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 + //SEG187 [88] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 lda y sec sbc yp - //SEG184 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ 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 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG188 [89] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#2 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff jmp b7 - //SEG185 findcol::@4 + //SEG189 findcol::@4 b4: - //SEG186 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 + //SEG190 [90] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#0 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 lda x sec sbc diff sta diff jmp b5 } -//SEG187 initscreen +//SEG191 initscreen initscreen: { .label screen = 3 - //SEG188 [88] phi from initscreen to initscreen::@1 + //SEG192 [92] phi from initscreen to initscreen::@1 b1_from_initscreen: - //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG193 [92] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 jmp b1 - //SEG190 [88] phi from initscreen::@1 to initscreen::@1 - //SEG191 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy - //SEG192 initscreen::@1 + //SEG194 [92] phi from initscreen::@1 to initscreen::@1 + //SEG195 [92] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy + //SEG196 initscreen::@1 b1: - //SEG193 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 + //SEG197 [93] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$e6 sta (screen),y - //SEG194 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 + //SEG198 [94] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG195 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 + //SEG199 [95] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda screen+$1 cmp #>$7e8 bcc b1 @@ -10281,30 +10416,30 @@ initscreen: { cmp #<$7e8 bcc b1 !: - //SEG196 initscreen::@return + //SEG200 initscreen::@return breturn: - //SEG197 [92] return [ ] + //SEG201 [96] return [ ] rts } -//SEG198 addpoint +//SEG202 addpoint addpoint: { .label c = 2 - //SEG199 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby + //SEG203 [98] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby ldx numpoints sta $1000,x - //SEG200 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby + //SEG204 [99] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby tya ldy numpoints sta $1100,y - //SEG201 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 + //SEG205 [100] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 lda c ldx numpoints sta $1200,x - //SEG202 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 + //SEG206 [101] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ numpoints#1 ] -- zpby1=_inc_zpby1 inc numpoints - //SEG203 addpoint::@return + //SEG207 addpoint::@return breturn: - //SEG204 [98] return [ ] + //SEG208 [102] return [ numpoints#1 ] rts } @@ -10327,6 +10462,7 @@ Removing instruction b10: Removing instruction b11: Removing instruction b12: Removing instruction b1_from_render: +Removing instruction findcol_from_b2: Removing instruction b5: Removing instruction b3: Removing instruction breturn: @@ -10347,264 +10483,268 @@ ASSEMBLER .label numpoints = 8 //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call addpoint param-assignment [ ] - //SEG6 [93] phi from main to addpoint - //SEG7 [93] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 + //SEG6 [2] call addpoint param-assignment [ ] + //SEG7 [97] phi from main to addpoint + //SEG8 [97] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 lda #$1 sta addpoint.c - //SEG8 [93] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1 + //SEG9 [97] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1 ldy #$5 - //SEG9 [93] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1 + //SEG10 [97] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1 lda #$0 sta numpoints - //SEG10 [93] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1 + //SEG11 [97] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1 lda #$5 jsr addpoint - //SEG11 main::@3 - //SEG12 [2] call addpoint param-assignment [ ] - //SEG13 [93] phi from main::@3 to addpoint - //SEG14 [93] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 + //SEG12 main::@3 + //SEG13 [3] call addpoint param-assignment [ numpoints#1 ] + //SEG14 [97] phi from main::@3 to addpoint + //SEG15 [97] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 lda #$2 sta addpoint.c - //SEG15 [93] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1 + //SEG16 [97] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1 ldy #$8 - //SEG16 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG17 [93] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1 + //SEG17 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG18 [97] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1 lda #$f jsr addpoint - //SEG18 main::@4 - //SEG19 [3] call addpoint param-assignment [ ] - //SEG20 [93] phi from main::@4 to addpoint - //SEG21 [93] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 + //SEG19 main::@4 + //SEG20 [4] call addpoint param-assignment [ numpoints#1 ] + //SEG21 [97] phi from main::@4 to addpoint + //SEG22 [97] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 lda #$3 sta addpoint.c - //SEG22 [93] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1 + //SEG23 [97] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1 ldy #$e - //SEG23 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG24 [93] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1 + //SEG24 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG25 [97] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1 lda #$6 jsr addpoint - //SEG25 main::@5 - //SEG26 [4] call addpoint param-assignment [ ] - //SEG27 [93] phi from main::@5 to addpoint - //SEG28 [93] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 + //SEG26 main::@5 + //SEG27 [5] call addpoint param-assignment [ numpoints#1 ] + //SEG28 [97] phi from main::@5 to addpoint + //SEG29 [97] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 lda #$4 sta addpoint.c - //SEG29 [93] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1 + //SEG30 [97] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1 ldy #$2 - //SEG30 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG31 [93] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1 + //SEG31 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG32 [97] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1 lda #$22 jsr addpoint - //SEG32 main::@6 - //SEG33 [5] call addpoint param-assignment [ ] - //SEG34 [93] phi from main::@6 to addpoint - //SEG35 [93] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 + //SEG33 main::@6 + //SEG34 [6] call addpoint param-assignment [ numpoints#1 ] + //SEG35 [97] phi from main::@6 to addpoint + //SEG36 [97] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 lda #$5 sta addpoint.c - //SEG36 [93] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1 + //SEG37 [97] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1 ldy #$11 - //SEG37 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG38 [93] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1 + //SEG38 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG39 [97] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1 lda #$15 jsr addpoint - //SEG39 main::@7 - //SEG40 [6] call addpoint param-assignment [ ] - //SEG41 [93] phi from main::@7 to addpoint - //SEG42 [93] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 + //SEG40 main::@7 + //SEG41 [7] call addpoint param-assignment [ numpoints#1 ] + //SEG42 [97] phi from main::@7 to addpoint + //SEG43 [97] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 lda #$7 sta addpoint.c - //SEG43 [93] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1 + //SEG44 [97] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1 ldy #$16 - //SEG44 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG45 [93] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1 + //SEG45 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG46 [97] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1 lda #$1f jsr addpoint - //SEG46 main::@8 - //SEG47 [7] call initscreen param-assignment [ ] + //SEG47 main::@8 + //SEG48 [8] call initscreen param-assignment [ numpoints#1 ] + //SEG49 [91] phi from main::@8 to initscreen jsr initscreen - //SEG48 main::@1 + //SEG50 main::@1 b1: - //SEG49 [8] call render param-assignment [ ] + //SEG51 [9] call render param-assignment [ numpoints#1 ] + //SEG52 [52] phi from main::@1 to render jsr render - //SEG50 main::@10 - //SEG51 [9] call animate param-assignment [ ] + //SEG53 main::@10 + //SEG54 [10] call animate param-assignment [ numpoints#1 ] jsr animate - //SEG52 main::@11 - //SEG53 [10] if(true) goto main::@1 [ ] -- true_then_la1 + //SEG55 main::@11 + //SEG56 [11] if(true) goto main::@1 [ numpoints#1 ] -- true_then_la1 jmp b1 - //SEG54 main::@return - //SEG55 [11] return [ ] + //SEG57 main::@return + //SEG58 [12] return [ ] rts } -//SEG56 animate +//SEG59 animate animate: { - //SEG57 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- aby=_star_cowo1 + //SEG60 [13] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- aby=_star_cowo1 lda $1000 - //SEG58 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- aby=aby_plus_1 + //SEG61 [14] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- aby=aby_plus_1 clc adc #$1 - //SEG59 [14] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=aby + //SEG62 [15] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=aby sta $1000 - //SEG60 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- aby=_star_cowo1 + //SEG63 [16] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- aby=_star_cowo1 lda $1000 - //SEG61 [16] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] -- aby_neq_coby1_then_la1 + //SEG64 [17] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] -- aby_neq_coby1_then_la1 cmp #$28 bne b1 - //SEG62 animate::@7 - //SEG63 [17] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG65 animate::@7 + //SEG66 [18] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1000 - //SEG64 animate::@1 + //SEG67 animate::@1 b1: - //SEG65 [18] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] -- aby=_star_cowo1 + //SEG68 [19] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] -- aby=_star_cowo1 lda $1100 - //SEG66 [19] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] -- aby=aby_plus_1 + //SEG69 [20] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] -- aby=aby_plus_1 clc adc #$1 - //SEG67 [20] *((word) 4352) ← (byte~) animate::$6 [ ] -- _star_cowo1=aby + //SEG70 [21] *((word) 4352) ← (byte~) animate::$6 [ ] -- _star_cowo1=aby sta $1100 - //SEG68 [21] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] -- aby=_star_cowo1 + //SEG71 [22] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] -- aby=_star_cowo1 lda $1100 - //SEG69 [22] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] -- aby_neq_coby1_then_la1 + //SEG72 [23] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] -- aby_neq_coby1_then_la1 cmp #$19 bne b2 - //SEG70 animate::@8 - //SEG71 [23] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG73 animate::@8 + //SEG74 [24] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1100 - //SEG72 animate::@2 + //SEG75 animate::@2 b2: - //SEG73 [24] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- xby=_star_cowo1 + //SEG76 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- xby=_star_cowo1 ldx $1001 - //SEG74 [25] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] -- xby=xby_minus_1 + //SEG77 [26] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] -- xby=xby_minus_1 dex - //SEG75 [26] *((word) 4097) ← (byte~) animate::$11 [ ] -- _star_cowo1=xby + //SEG78 [27] *((word) 4097) ← (byte~) animate::$11 [ ] -- _star_cowo1=xby stx $1001 - //SEG76 [27] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] -- aby=_star_cowo1 + //SEG79 [28] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] -- aby=_star_cowo1 lda $1001 - //SEG77 [28] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] -- aby_neq_coby1_then_la1 + //SEG80 [29] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] -- aby_neq_coby1_then_la1 cmp #$ff bne b3 - //SEG78 animate::@9 - //SEG79 [29] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 + //SEG81 animate::@9 + //SEG82 [30] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 lda #$28 sta $1001 - //SEG80 animate::@3 + //SEG83 animate::@3 b3: - //SEG81 [30] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] -- aby=_star_cowo1 + //SEG84 [31] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] -- aby=_star_cowo1 lda $1102 - //SEG82 [31] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] -- aby=aby_plus_1 + //SEG85 [32] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] -- aby=aby_plus_1 clc adc #$1 - //SEG83 [32] *((word) 4354) ← (byte~) animate::$16 [ ] -- _star_cowo1=aby + //SEG86 [33] *((word) 4354) ← (byte~) animate::$16 [ ] -- _star_cowo1=aby sta $1102 - //SEG84 [33] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] -- aby=_star_cowo1 + //SEG87 [34] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] -- aby=_star_cowo1 lda $1102 - //SEG85 [34] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] -- aby_neq_coby1_then_la1 + //SEG88 [35] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] -- aby_neq_coby1_then_la1 cmp #$19 bne b4 - //SEG86 animate::@10 - //SEG87 [35] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG89 animate::@10 + //SEG90 [36] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1102 - //SEG88 animate::@4 + //SEG91 animate::@4 b4: - //SEG89 [36] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] -- xby=_star_cowo1 + //SEG92 [37] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] -- xby=_star_cowo1 ldx $1103 - //SEG90 [37] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] -- xby=xby_minus_1 + //SEG93 [38] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] -- xby=xby_minus_1 dex - //SEG91 [38] *((word) 4355) ← (byte~) animate::$21 [ ] -- _star_cowo1=xby + //SEG94 [39] *((word) 4355) ← (byte~) animate::$21 [ ] -- _star_cowo1=xby stx $1103 - //SEG92 [39] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] -- aby=_star_cowo1 + //SEG95 [40] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] -- aby=_star_cowo1 lda $1103 - //SEG93 [40] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] -- aby_neq_coby1_then_la1 + //SEG96 [41] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] -- aby_neq_coby1_then_la1 cmp #$ff bne breturn - //SEG94 animate::@11 - //SEG95 [41] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 + //SEG97 animate::@11 + //SEG98 [42] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 lda #$19 sta $1103 - //SEG96 [42] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] -- aby=_star_cowo1 + //SEG99 [43] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] -- aby=_star_cowo1 lda $1003 - //SEG97 [43] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] -- aby=aby_plus_coby1 + //SEG100 [44] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] -- aby=aby_plus_coby1 clc adc #$7 - //SEG98 [44] *((word) 4099) ← (byte~) animate::$26 [ ] -- _star_cowo1=aby + //SEG101 [45] *((word) 4099) ← (byte~) animate::$26 [ ] -- _star_cowo1=aby sta $1003 - //SEG99 [45] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] -- aby=_star_cowo1 + //SEG102 [46] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] -- aby=_star_cowo1 lda $1003 - //SEG100 [46] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] -- aby_lt_coby1_then_la1 + //SEG103 [47] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] -- aby_lt_coby1_then_la1 cmp #$28 bcc breturn - //SEG101 animate::@12 - //SEG102 [47] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] -- aby=_star_cowo1 + //SEG104 animate::@12 + //SEG105 [48] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] -- aby=_star_cowo1 lda $1003 - //SEG103 [48] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] -- aby=aby_minus_coby1 + //SEG106 [49] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] -- aby=aby_minus_coby1 sec sbc #$28 - //SEG104 [49] *((word) 4099) ← (byte~) animate::$31 [ ] -- _star_cowo1=aby + //SEG107 [50] *((word) 4099) ← (byte~) animate::$31 [ ] -- _star_cowo1=aby sta $1003 - //SEG105 animate::@return + //SEG108 animate::@return breturn: - //SEG106 [50] return [ ] + //SEG109 [51] return [ ] rts } -//SEG107 render +//SEG110 render render: { .label x = 5 .label colline = 3 .label y = 2 - //SEG108 [51] phi from render to render::@1 - //SEG109 [51] phi (byte*) render::colline#2 = (word) 55296 -- zpptrby1=cowo1 + //SEG111 [53] phi from render to render::@1 + //SEG112 [53] phi (byte*) render::colline#2 = (word) 55296 -- zpptrby1=cowo1 lda #<$d800 sta colline lda #>$d800 sta colline+$1 - //SEG110 [51] phi (byte) render::y#2 = (byte) 0 -- zpby1=coby1 + //SEG113 [53] phi (byte) render::y#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta y jmp b1 - //SEG111 [51] phi from render::@3 to render::@1 - //SEG112 [51] phi (byte*) render::colline#2 = (byte*) render::colline#1 -- register_copy - //SEG113 [51] phi (byte) render::y#2 = (byte) render::y#1 -- register_copy - //SEG114 render::@1 + //SEG114 [53] phi from render::@3 to render::@1 + //SEG115 [53] phi (byte*) render::colline#2 = (byte*) render::colline#1 -- register_copy + //SEG116 [53] phi (byte) render::y#2 = (byte) render::y#1 -- register_copy + //SEG117 render::@1 b1: - //SEG115 [52] phi from render::@1 to render::@2 - //SEG116 [52] phi (byte) render::x#2 = (byte) 0 -- zpby1=coby1 + //SEG118 [54] phi from render::@1 to render::@2 + //SEG119 [54] phi (byte) render::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x jmp b2 - //SEG117 [52] phi from render::@5 to render::@2 - //SEG118 [52] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy - //SEG119 render::@2 + //SEG120 [54] phi from render::@5 to render::@2 + //SEG121 [54] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy + //SEG122 render::@2 b2: - //SEG120 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 ] -- zpby1=zpby2 + //SEG123 [55] (byte) findcol::x#0 ← (byte) render::x#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 numpoints#1 ] -- zpby1=zpby2 lda x sta findcol.x - //SEG121 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 ] -- zpby1=zpby2 + //SEG124 [56] (byte) findcol::y#0 ← (byte) render::y#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 findcol::y#0 numpoints#1 ] -- zpby1=zpby2 lda y sta findcol.y - //SEG122 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + //SEG125 [57] call findcol param-assignment [ render::y#2 render::colline#2 render::x#2 findcol::return#0 numpoints#1 ] + //SEG126 [66] phi from render::@2 to findcol jsr findcol - //SEG123 render::@5 - //SEG124 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] -- aby=yby + //SEG127 render::@5 + //SEG128 [58] (byte) render::col#0 ← (byte) findcol::return#0 [ render::y#2 render::colline#2 render::x#2 render::col#0 numpoints#1 ] -- aby=yby tya - //SEG125 [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 + //SEG129 [59] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::y#2 render::colline#2 render::x#2 numpoints#1 ] -- zpptrby1_staridx_zpby1=aby ldy x sta (colline),y - //SEG126 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1=_inc_zpby1 + //SEG130 [60] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] -- zpby1=_inc_zpby1 inc x - //SEG127 [59] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1_neq_coby1_then_la1 + //SEG131 [61] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] -- zpby1_neq_coby1_then_la1 lda x cmp #$28 bne b2 - //SEG128 render::@3 - //SEG129 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG132 render::@3 + //SEG133 [62] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 render::colline#1 numpoints#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda colline clc adc #$28 @@ -10612,17 +10752,17 @@ render: { bcc !+ inc colline+$1 !: - //SEG130 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] -- zpby1=_inc_zpby1 + //SEG134 [63] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 numpoints#1 ] -- zpby1=_inc_zpby1 inc y - //SEG131 [62] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ] -- zpby1_neq_coby1_then_la1 + //SEG135 [64] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 numpoints#1 ] -- zpby1_neq_coby1_then_la1 lda y cmp #$19 bne b1 - //SEG132 render::@return - //SEG133 [63] return [ ] + //SEG136 render::@return + //SEG137 [65] return [ numpoints#1 ] rts } -//SEG134 findcol +//SEG138 findcol findcol: { .label x = 9 .label y = 10 @@ -10630,146 +10770,146 @@ findcol: { .label yp = 11 .label diff = 7 .label mindiff = 6 - //SEG135 [64] phi from findcol to findcol::@1 - //SEG136 [64] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 + //SEG139 [67] phi from findcol to findcol::@1 + //SEG140 [67] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG137 [64] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 + //SEG141 [67] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 lda #$ff sta mindiff - //SEG138 [64] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 + //SEG142 [67] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG139 findcol::@1 + //SEG143 findcol::@1 b1: - //SEG140 [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 numpoints#1 ] -- zpby1=cowo1_staridx_xby + //SEG144 [68] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 numpoints#1 ] -- zpby1=cowo1_staridx_xby lda $1000,x sta xp - //SEG141 [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 numpoints#1 ] -- zpby1=cowo1_staridx_xby + //SEG145 [69] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1=cowo1_staridx_xby lda $1100,x sta yp - //SEG142 [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 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 + //SEG146 [70] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 lda x cmp xp bne b2 - //SEG143 findcol::@9 - //SEG144 [68] if((byte) findcol::y#0!=(byte) findcol::yp#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 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 + //SEG147 findcol::@9 + //SEG148 [71] if((byte) findcol::y#0!=(byte) findcol::yp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 lda y cmp yp bne b2 - //SEG145 [69] phi from findcol::@9 to findcol::@return - //SEG146 [69] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 + //SEG149 [72] phi from findcol::@9 to findcol::@return + //SEG150 [72] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG147 findcol::@return + //SEG151 findcol::@return breturn: - //SEG148 [70] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + //SEG152 [73] return [ findcol::return#0 numpoints#1 ] rts - //SEG149 findcol::@2 + //SEG153 findcol::@2 b2: - //SEG150 [71] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG154 [74] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda x cmp xp bcs b4 - //SEG151 findcol::@12 - //SEG152 [72] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#1 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby1_minus_zpby2 + //SEG155 findcol::@12 + //SEG156 [75] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#1 numpoints#1 ] -- zpby1=zpby1_minus_zpby2 lda diff sec sbc x sta diff - //SEG153 [73] phi from findcol::@12 findcol::@4 to findcol::@5 - //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy - //SEG155 findcol::@5 + //SEG157 [76] phi from findcol::@12 findcol::@4 to findcol::@5 + //SEG158 [76] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy + //SEG159 findcol::@5 b5: - //SEG156 [74] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG160 [77] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda y cmp yp bcs b6 - //SEG157 findcol::@14 - //SEG158 [75] (byte~) findcol::$12 ← (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::$12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_minus_zpby2 + //SEG161 findcol::@14 + //SEG162 [78] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 findcol::$12 numpoints#1 ] -- aby=zpby1_minus_zpby2 lda yp sec sbc y - //SEG159 [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ 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 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG163 [79] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#3 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG160 [77] phi from findcol::@14 findcol::@6 to findcol::@7 - //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy - //SEG162 findcol::@7 + //SEG164 [80] phi from findcol::@14 findcol::@6 to findcol::@7 + //SEG165 [80] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy + //SEG166 findcol::@7 b7: - //SEG163 [78] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ 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 numpoints#1 ] -- aby_ge_zpby1_then_la1 + //SEG167 [81] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 numpoints#1 ] -- aby_ge_zpby1_then_la1 cmp mindiff bcs b21 - //SEG164 findcol::@16 - //SEG165 [79] (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 numpoints#1 ] -- yby=cowo1_staridx_xby + //SEG168 findcol::@16 + //SEG169 [82] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::diff#6 findcol::mincol#1 numpoints#1 ] -- yby=cowo1_staridx_xby ldy $1200,x - //SEG166 [80] phi from findcol::@16 findcol::@21 to findcol::@8 - //SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy - //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy - //SEG169 findcol::@8 + //SEG170 [83] phi from findcol::@16 findcol::@21 to findcol::@8 + //SEG171 [83] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy + //SEG172 [83] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy + //SEG173 findcol::@8 b8: - //SEG170 [81] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] -- xby=_inc_xby + //SEG174 [84] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] -- xby=_inc_xby inx - //SEG171 [82] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] -- xby_lt_zpby1_then_la1 + //SEG175 [85] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] -- xby_lt_zpby1_then_la1 cpx numpoints bcc b19 - //SEG172 [69] phi from findcol::@8 to findcol::@return - //SEG173 [69] phi (byte) findcol::return#0 = (byte) findcol::mincol#2 -- register_copy + //SEG176 [72] phi from findcol::@8 to findcol::@return + //SEG177 [72] phi (byte) findcol::return#0 = (byte) findcol::mincol#2 -- register_copy jmp breturn - //SEG174 findcol::@19 + //SEG178 findcol::@19 b19: - //SEG175 [83] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 ] -- zpby1=aby + //SEG179 [86] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 numpoints#1 ] -- zpby1=aby sta mindiff - //SEG176 [64] phi from findcol::@19 to findcol::@1 - //SEG177 [64] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy - //SEG178 [64] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 -- register_copy - //SEG179 [64] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy + //SEG180 [67] phi from findcol::@19 to findcol::@1 + //SEG181 [67] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy + //SEG182 [67] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 -- register_copy + //SEG183 [67] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy jmp b1 - //SEG180 findcol::@21 + //SEG184 findcol::@21 b21: - //SEG181 [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 + //SEG185 [87] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 lda mindiff jmp b8 - //SEG182 findcol::@6 + //SEG186 findcol::@6 b6: - //SEG183 [85] (byte~) findcol::$14 ← (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::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 + //SEG187 [88] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 lda y sec sbc yp - //SEG184 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ 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 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG188 [89] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#2 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff jmp b7 - //SEG185 findcol::@4 + //SEG189 findcol::@4 b4: - //SEG186 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 + //SEG190 [90] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#0 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 lda x sec sbc diff sta diff jmp b5 } -//SEG187 initscreen +//SEG191 initscreen initscreen: { .label screen = 3 - //SEG188 [88] phi from initscreen to initscreen::@1 - //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG192 [92] phi from initscreen to initscreen::@1 + //SEG193 [92] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 jmp b1 - //SEG190 [88] phi from initscreen::@1 to initscreen::@1 - //SEG191 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy - //SEG192 initscreen::@1 + //SEG194 [92] phi from initscreen::@1 to initscreen::@1 + //SEG195 [92] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy + //SEG196 initscreen::@1 b1: - //SEG193 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 + //SEG197 [93] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$e6 sta (screen),y - //SEG194 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 + //SEG198 [94] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG195 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 + //SEG199 [95] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda screen+$1 cmp #>$7e8 bcc b1 @@ -10778,28 +10918,28 @@ initscreen: { cmp #<$7e8 bcc b1 !: - //SEG196 initscreen::@return - //SEG197 [92] return [ ] + //SEG200 initscreen::@return + //SEG201 [96] return [ ] rts } -//SEG198 addpoint +//SEG202 addpoint addpoint: { .label c = 2 - //SEG199 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby + //SEG203 [98] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby ldx numpoints sta $1000,x - //SEG200 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby + //SEG204 [99] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby tya ldy numpoints sta $1100,y - //SEG201 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 + //SEG205 [100] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 lda c ldx numpoints sta $1200,x - //SEG202 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 + //SEG206 [101] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ numpoints#1 ] -- zpby1=_inc_zpby1 inc numpoints - //SEG203 addpoint::@return - //SEG204 [98] return [ ] + //SEG207 addpoint::@return + //SEG208 [102] return [ numpoints#1 ] rts } @@ -10812,262 +10952,266 @@ ASSEMBLER .label numpoints = 8 //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call addpoint param-assignment [ ] - //SEG6 [93] phi from main to addpoint - //SEG7 [93] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 + //SEG6 [2] call addpoint param-assignment [ ] + //SEG7 [97] phi from main to addpoint + //SEG8 [97] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 lda #$1 sta addpoint.c - //SEG8 [93] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1 + //SEG9 [97] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1 ldy #$5 - //SEG9 [93] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1 + //SEG10 [97] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1 lda #$0 sta numpoints - //SEG10 [93] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1 + //SEG11 [97] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1 lda #$5 jsr addpoint - //SEG11 main::@3 - //SEG12 [2] call addpoint param-assignment [ ] - //SEG13 [93] phi from main::@3 to addpoint - //SEG14 [93] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 + //SEG12 main::@3 + //SEG13 [3] call addpoint param-assignment [ numpoints#1 ] + //SEG14 [97] phi from main::@3 to addpoint + //SEG15 [97] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 lda #$2 sta addpoint.c - //SEG15 [93] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1 + //SEG16 [97] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1 ldy #$8 - //SEG16 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG17 [93] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1 + //SEG17 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG18 [97] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1 lda #$f jsr addpoint - //SEG18 main::@4 - //SEG19 [3] call addpoint param-assignment [ ] - //SEG20 [93] phi from main::@4 to addpoint - //SEG21 [93] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 + //SEG19 main::@4 + //SEG20 [4] call addpoint param-assignment [ numpoints#1 ] + //SEG21 [97] phi from main::@4 to addpoint + //SEG22 [97] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 lda #$3 sta addpoint.c - //SEG22 [93] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1 + //SEG23 [97] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1 ldy #$e - //SEG23 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG24 [93] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1 + //SEG24 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG25 [97] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1 lda #$6 jsr addpoint - //SEG25 main::@5 - //SEG26 [4] call addpoint param-assignment [ ] - //SEG27 [93] phi from main::@5 to addpoint - //SEG28 [93] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 + //SEG26 main::@5 + //SEG27 [5] call addpoint param-assignment [ numpoints#1 ] + //SEG28 [97] phi from main::@5 to addpoint + //SEG29 [97] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 lda #$4 sta addpoint.c - //SEG29 [93] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1 + //SEG30 [97] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1 ldy #$2 - //SEG30 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG31 [93] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1 + //SEG31 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG32 [97] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1 lda #$22 jsr addpoint - //SEG32 main::@6 - //SEG33 [5] call addpoint param-assignment [ ] - //SEG34 [93] phi from main::@6 to addpoint - //SEG35 [93] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 + //SEG33 main::@6 + //SEG34 [6] call addpoint param-assignment [ numpoints#1 ] + //SEG35 [97] phi from main::@6 to addpoint + //SEG36 [97] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 lda #$5 sta addpoint.c - //SEG36 [93] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1 + //SEG37 [97] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1 ldy #$11 - //SEG37 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG38 [93] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1 + //SEG38 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG39 [97] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1 lda #$15 jsr addpoint - //SEG39 main::@7 - //SEG40 [6] call addpoint param-assignment [ ] - //SEG41 [93] phi from main::@7 to addpoint - //SEG42 [93] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 + //SEG40 main::@7 + //SEG41 [7] call addpoint param-assignment [ numpoints#1 ] + //SEG42 [97] phi from main::@7 to addpoint + //SEG43 [97] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 lda #$7 sta addpoint.c - //SEG43 [93] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1 + //SEG44 [97] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1 ldy #$16 - //SEG44 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG45 [93] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1 + //SEG45 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG46 [97] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1 lda #$1f jsr addpoint - //SEG46 main::@8 - //SEG47 [7] call initscreen param-assignment [ ] + //SEG47 main::@8 + //SEG48 [8] call initscreen param-assignment [ numpoints#1 ] + //SEG49 [91] phi from main::@8 to initscreen jsr initscreen - //SEG48 main::@1 + //SEG50 main::@1 b1: - //SEG49 [8] call render param-assignment [ ] + //SEG51 [9] call render param-assignment [ numpoints#1 ] + //SEG52 [52] phi from main::@1 to render jsr render - //SEG50 main::@10 - //SEG51 [9] call animate param-assignment [ ] + //SEG53 main::@10 + //SEG54 [10] call animate param-assignment [ numpoints#1 ] jsr animate - //SEG52 main::@11 - //SEG53 [10] if(true) goto main::@1 [ ] -- true_then_la1 + //SEG55 main::@11 + //SEG56 [11] if(true) goto main::@1 [ numpoints#1 ] -- true_then_la1 jmp b1 - //SEG54 main::@return - //SEG55 [11] return [ ] + //SEG57 main::@return + //SEG58 [12] return [ ] rts } -//SEG56 animate +//SEG59 animate animate: { - //SEG57 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- aby=_star_cowo1 + //SEG60 [13] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- aby=_star_cowo1 lda $1000 - //SEG58 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- aby=aby_plus_1 + //SEG61 [14] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- aby=aby_plus_1 clc adc #$1 - //SEG59 [14] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=aby + //SEG62 [15] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=aby sta $1000 - //SEG60 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- aby=_star_cowo1 + //SEG63 [16] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- aby=_star_cowo1 lda $1000 - //SEG61 [16] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] -- aby_neq_coby1_then_la1 + //SEG64 [17] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] -- aby_neq_coby1_then_la1 cmp #$28 bne b1 - //SEG62 animate::@7 - //SEG63 [17] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG65 animate::@7 + //SEG66 [18] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1000 - //SEG64 animate::@1 + //SEG67 animate::@1 b1: - //SEG65 [18] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] -- aby=_star_cowo1 + //SEG68 [19] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] -- aby=_star_cowo1 lda $1100 - //SEG66 [19] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] -- aby=aby_plus_1 + //SEG69 [20] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] -- aby=aby_plus_1 clc adc #$1 - //SEG67 [20] *((word) 4352) ← (byte~) animate::$6 [ ] -- _star_cowo1=aby + //SEG70 [21] *((word) 4352) ← (byte~) animate::$6 [ ] -- _star_cowo1=aby sta $1100 - //SEG68 [21] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] -- aby=_star_cowo1 + //SEG71 [22] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] -- aby=_star_cowo1 lda $1100 - //SEG69 [22] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] -- aby_neq_coby1_then_la1 + //SEG72 [23] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] -- aby_neq_coby1_then_la1 cmp #$19 bne b2 - //SEG70 animate::@8 - //SEG71 [23] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG73 animate::@8 + //SEG74 [24] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1100 - //SEG72 animate::@2 + //SEG75 animate::@2 b2: - //SEG73 [24] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- xby=_star_cowo1 + //SEG76 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- xby=_star_cowo1 ldx $1001 - //SEG74 [25] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] -- xby=xby_minus_1 + //SEG77 [26] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] -- xby=xby_minus_1 dex - //SEG75 [26] *((word) 4097) ← (byte~) animate::$11 [ ] -- _star_cowo1=xby + //SEG78 [27] *((word) 4097) ← (byte~) animate::$11 [ ] -- _star_cowo1=xby stx $1001 - //SEG76 [27] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] -- aby=_star_cowo1 + //SEG79 [28] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] -- aby=_star_cowo1 lda $1001 - //SEG77 [28] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] -- aby_neq_coby1_then_la1 + //SEG80 [29] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] -- aby_neq_coby1_then_la1 cmp #$ff bne b3 - //SEG78 animate::@9 - //SEG79 [29] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 + //SEG81 animate::@9 + //SEG82 [30] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 lda #$28 sta $1001 - //SEG80 animate::@3 + //SEG83 animate::@3 b3: - //SEG81 [30] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] -- aby=_star_cowo1 + //SEG84 [31] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] -- aby=_star_cowo1 lda $1102 - //SEG82 [31] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] -- aby=aby_plus_1 + //SEG85 [32] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] -- aby=aby_plus_1 clc adc #$1 - //SEG83 [32] *((word) 4354) ← (byte~) animate::$16 [ ] -- _star_cowo1=aby + //SEG86 [33] *((word) 4354) ← (byte~) animate::$16 [ ] -- _star_cowo1=aby sta $1102 - //SEG84 [33] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] -- aby=_star_cowo1 + //SEG87 [34] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] -- aby=_star_cowo1 lda $1102 - //SEG85 [34] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] -- aby_neq_coby1_then_la1 + //SEG88 [35] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] -- aby_neq_coby1_then_la1 cmp #$19 bne b4 - //SEG86 animate::@10 - //SEG87 [35] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG89 animate::@10 + //SEG90 [36] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1102 - //SEG88 animate::@4 + //SEG91 animate::@4 b4: - //SEG89 [36] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] -- xby=_star_cowo1 + //SEG92 [37] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] -- xby=_star_cowo1 ldx $1103 - //SEG90 [37] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] -- xby=xby_minus_1 + //SEG93 [38] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] -- xby=xby_minus_1 dex - //SEG91 [38] *((word) 4355) ← (byte~) animate::$21 [ ] -- _star_cowo1=xby + //SEG94 [39] *((word) 4355) ← (byte~) animate::$21 [ ] -- _star_cowo1=xby stx $1103 - //SEG92 [39] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] -- aby=_star_cowo1 + //SEG95 [40] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] -- aby=_star_cowo1 lda $1103 - //SEG93 [40] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] -- aby_neq_coby1_then_la1 + //SEG96 [41] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] -- aby_neq_coby1_then_la1 cmp #$ff bne breturn - //SEG94 animate::@11 - //SEG95 [41] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 + //SEG97 animate::@11 + //SEG98 [42] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 lda #$19 sta $1103 - //SEG96 [42] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] -- aby=_star_cowo1 + //SEG99 [43] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] -- aby=_star_cowo1 lda $1003 - //SEG97 [43] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] -- aby=aby_plus_coby1 + //SEG100 [44] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] -- aby=aby_plus_coby1 clc adc #$7 - //SEG98 [44] *((word) 4099) ← (byte~) animate::$26 [ ] -- _star_cowo1=aby + //SEG101 [45] *((word) 4099) ← (byte~) animate::$26 [ ] -- _star_cowo1=aby sta $1003 - //SEG99 [45] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] -- aby=_star_cowo1 + //SEG102 [46] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] -- aby=_star_cowo1 lda $1003 - //SEG100 [46] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] -- aby_lt_coby1_then_la1 + //SEG103 [47] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] -- aby_lt_coby1_then_la1 cmp #$28 bcc breturn - //SEG101 animate::@12 - //SEG102 [47] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] -- aby=_star_cowo1 + //SEG104 animate::@12 + //SEG105 [48] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] -- aby=_star_cowo1 lda $1003 - //SEG103 [48] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] -- aby=aby_minus_coby1 + //SEG106 [49] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] -- aby=aby_minus_coby1 sec sbc #$28 - //SEG104 [49] *((word) 4099) ← (byte~) animate::$31 [ ] -- _star_cowo1=aby + //SEG107 [50] *((word) 4099) ← (byte~) animate::$31 [ ] -- _star_cowo1=aby sta $1003 - //SEG105 animate::@return + //SEG108 animate::@return breturn: - //SEG106 [50] return [ ] + //SEG109 [51] return [ ] rts } -//SEG107 render +//SEG110 render render: { .label x = 5 .label colline = 3 .label y = 2 - //SEG108 [51] phi from render to render::@1 - //SEG109 [51] phi (byte*) render::colline#2 = (word) 55296 -- zpptrby1=cowo1 + //SEG111 [53] phi from render to render::@1 + //SEG112 [53] phi (byte*) render::colline#2 = (word) 55296 -- zpptrby1=cowo1 lda #<$d800 sta colline lda #>$d800 sta colline+$1 - //SEG110 [51] phi (byte) render::y#2 = (byte) 0 -- zpby1=coby1 + //SEG113 [53] phi (byte) render::y#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta y - //SEG111 [51] phi from render::@3 to render::@1 - //SEG112 [51] phi (byte*) render::colline#2 = (byte*) render::colline#1 -- register_copy - //SEG113 [51] phi (byte) render::y#2 = (byte) render::y#1 -- register_copy - //SEG114 render::@1 + //SEG114 [53] phi from render::@3 to render::@1 + //SEG115 [53] phi (byte*) render::colline#2 = (byte*) render::colline#1 -- register_copy + //SEG116 [53] phi (byte) render::y#2 = (byte) render::y#1 -- register_copy + //SEG117 render::@1 b1: - //SEG115 [52] phi from render::@1 to render::@2 - //SEG116 [52] phi (byte) render::x#2 = (byte) 0 -- zpby1=coby1 + //SEG118 [54] phi from render::@1 to render::@2 + //SEG119 [54] phi (byte) render::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x - //SEG117 [52] phi from render::@5 to render::@2 - //SEG118 [52] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy - //SEG119 render::@2 + //SEG120 [54] phi from render::@5 to render::@2 + //SEG121 [54] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy + //SEG122 render::@2 b2: - //SEG120 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 ] -- zpby1=zpby2 + //SEG123 [55] (byte) findcol::x#0 ← (byte) render::x#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 numpoints#1 ] -- zpby1=zpby2 lda x sta findcol.x - //SEG121 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 ] -- zpby1=zpby2 + //SEG124 [56] (byte) findcol::y#0 ← (byte) render::y#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 findcol::y#0 numpoints#1 ] -- zpby1=zpby2 lda y sta findcol.y - //SEG122 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + //SEG125 [57] call findcol param-assignment [ render::y#2 render::colline#2 render::x#2 findcol::return#0 numpoints#1 ] + //SEG126 [66] phi from render::@2 to findcol jsr findcol - //SEG123 render::@5 - //SEG124 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] -- aby=yby + //SEG127 render::@5 + //SEG128 [58] (byte) render::col#0 ← (byte) findcol::return#0 [ render::y#2 render::colline#2 render::x#2 render::col#0 numpoints#1 ] -- aby=yby tya - //SEG125 [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 + //SEG129 [59] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::y#2 render::colline#2 render::x#2 numpoints#1 ] -- zpptrby1_staridx_zpby1=aby ldy x sta (colline),y - //SEG126 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1=_inc_zpby1 + //SEG130 [60] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] -- zpby1=_inc_zpby1 inc x - //SEG127 [59] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1_neq_coby1_then_la1 + //SEG131 [61] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] -- zpby1_neq_coby1_then_la1 lda x cmp #$28 bne b2 - //SEG128 render::@3 - //SEG129 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG132 render::@3 + //SEG133 [62] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 render::colline#1 numpoints#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda colline clc adc #$28 @@ -11075,17 +11219,17 @@ render: { bcc !+ inc colline+$1 !: - //SEG130 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] -- zpby1=_inc_zpby1 + //SEG134 [63] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 numpoints#1 ] -- zpby1=_inc_zpby1 inc y - //SEG131 [62] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ] -- zpby1_neq_coby1_then_la1 + //SEG135 [64] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 numpoints#1 ] -- zpby1_neq_coby1_then_la1 lda y cmp #$19 bne b1 - //SEG132 render::@return - //SEG133 [63] return [ ] + //SEG136 render::@return + //SEG137 [65] return [ numpoints#1 ] rts } -//SEG134 findcol +//SEG138 findcol findcol: { .label x = 9 .label y = 10 @@ -11093,145 +11237,145 @@ findcol: { .label yp = 11 .label diff = 7 .label mindiff = 6 - //SEG135 [64] phi from findcol to findcol::@1 - //SEG136 [64] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 + //SEG139 [67] phi from findcol to findcol::@1 + //SEG140 [67] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG137 [64] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 + //SEG141 [67] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 lda #$ff sta mindiff - //SEG138 [64] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 + //SEG142 [67] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG139 findcol::@1 + //SEG143 findcol::@1 b1: - //SEG140 [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 numpoints#1 ] -- zpby1=cowo1_staridx_xby + //SEG144 [68] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 numpoints#1 ] -- zpby1=cowo1_staridx_xby lda $1000,x sta xp - //SEG141 [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 numpoints#1 ] -- zpby1=cowo1_staridx_xby + //SEG145 [69] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1=cowo1_staridx_xby lda $1100,x sta yp - //SEG142 [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 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 + //SEG146 [70] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 lda x cmp xp bne b2 - //SEG143 findcol::@9 - //SEG144 [68] if((byte) findcol::y#0!=(byte) findcol::yp#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 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 + //SEG147 findcol::@9 + //SEG148 [71] if((byte) findcol::y#0!=(byte) findcol::yp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 lda y cmp yp bne b2 - //SEG145 [69] phi from findcol::@9 to findcol::@return - //SEG146 [69] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 + //SEG149 [72] phi from findcol::@9 to findcol::@return + //SEG150 [72] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG147 findcol::@return + //SEG151 findcol::@return breturn: - //SEG148 [70] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + //SEG152 [73] return [ findcol::return#0 numpoints#1 ] rts - //SEG149 findcol::@2 + //SEG153 findcol::@2 b2: - //SEG150 [71] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG154 [74] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda x cmp xp bcs b4 - //SEG151 findcol::@12 - //SEG152 [72] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#1 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby1_minus_zpby2 + //SEG155 findcol::@12 + //SEG156 [75] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#1 numpoints#1 ] -- zpby1=zpby1_minus_zpby2 lda diff sec sbc x sta diff - //SEG153 [73] phi from findcol::@12 findcol::@4 to findcol::@5 - //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy - //SEG155 findcol::@5 + //SEG157 [76] phi from findcol::@12 findcol::@4 to findcol::@5 + //SEG158 [76] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy + //SEG159 findcol::@5 b5: - //SEG156 [74] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG160 [77] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda y cmp yp bcs b6 - //SEG157 findcol::@14 - //SEG158 [75] (byte~) findcol::$12 ← (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::$12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_minus_zpby2 + //SEG161 findcol::@14 + //SEG162 [78] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 findcol::$12 numpoints#1 ] -- aby=zpby1_minus_zpby2 lda yp sec sbc y - //SEG159 [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ 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 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG163 [79] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#3 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG160 [77] phi from findcol::@14 findcol::@6 to findcol::@7 - //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy - //SEG162 findcol::@7 + //SEG164 [80] phi from findcol::@14 findcol::@6 to findcol::@7 + //SEG165 [80] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy + //SEG166 findcol::@7 b7: - //SEG163 [78] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ 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 numpoints#1 ] -- aby_ge_zpby1_then_la1 + //SEG167 [81] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 numpoints#1 ] -- aby_ge_zpby1_then_la1 cmp mindiff bcs b21 - //SEG164 findcol::@16 - //SEG165 [79] (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 numpoints#1 ] -- yby=cowo1_staridx_xby + //SEG168 findcol::@16 + //SEG169 [82] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::diff#6 findcol::mincol#1 numpoints#1 ] -- yby=cowo1_staridx_xby ldy $1200,x - //SEG166 [80] phi from findcol::@16 findcol::@21 to findcol::@8 - //SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy - //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy - //SEG169 findcol::@8 + //SEG170 [83] phi from findcol::@16 findcol::@21 to findcol::@8 + //SEG171 [83] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy + //SEG172 [83] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy + //SEG173 findcol::@8 b8: - //SEG170 [81] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] -- xby=_inc_xby + //SEG174 [84] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] -- xby=_inc_xby inx - //SEG171 [82] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] -- xby_lt_zpby1_then_la1 + //SEG175 [85] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] -- xby_lt_zpby1_then_la1 cpx numpoints bcc b19 - //SEG172 [69] phi from findcol::@8 to findcol::@return - //SEG173 [69] phi (byte) findcol::return#0 = (byte) findcol::mincol#2 -- register_copy + //SEG176 [72] phi from findcol::@8 to findcol::@return + //SEG177 [72] phi (byte) findcol::return#0 = (byte) findcol::mincol#2 -- register_copy jmp breturn - //SEG174 findcol::@19 + //SEG178 findcol::@19 b19: - //SEG175 [83] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 ] -- zpby1=aby + //SEG179 [86] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 numpoints#1 ] -- zpby1=aby sta mindiff - //SEG176 [64] phi from findcol::@19 to findcol::@1 - //SEG177 [64] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy - //SEG178 [64] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 -- register_copy - //SEG179 [64] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy + //SEG180 [67] phi from findcol::@19 to findcol::@1 + //SEG181 [67] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy + //SEG182 [67] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 -- register_copy + //SEG183 [67] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy jmp b1 - //SEG180 findcol::@21 + //SEG184 findcol::@21 b21: - //SEG181 [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 + //SEG185 [87] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 lda mindiff jmp b8 - //SEG182 findcol::@6 + //SEG186 findcol::@6 b6: - //SEG183 [85] (byte~) findcol::$14 ← (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::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 + //SEG187 [88] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 lda y sec sbc yp - //SEG184 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ 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 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG188 [89] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#2 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff jmp b7 - //SEG185 findcol::@4 + //SEG189 findcol::@4 b4: - //SEG186 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 + //SEG190 [90] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#0 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 lda x sec sbc diff sta diff jmp b5 } -//SEG187 initscreen +//SEG191 initscreen initscreen: { .label screen = 3 - //SEG188 [88] phi from initscreen to initscreen::@1 - //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG192 [92] phi from initscreen to initscreen::@1 + //SEG193 [92] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 - //SEG190 [88] phi from initscreen::@1 to initscreen::@1 - //SEG191 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy - //SEG192 initscreen::@1 + //SEG194 [92] phi from initscreen::@1 to initscreen::@1 + //SEG195 [92] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy + //SEG196 initscreen::@1 b1: - //SEG193 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 + //SEG197 [93] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$e6 sta (screen),y - //SEG194 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 + //SEG198 [94] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG195 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 + //SEG199 [95] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda screen+$1 cmp #>$7e8 bcc b1 @@ -11240,28 +11384,28 @@ initscreen: { cmp #<$7e8 bcc b1 !: - //SEG196 initscreen::@return - //SEG197 [92] return [ ] + //SEG200 initscreen::@return + //SEG201 [96] return [ ] rts } -//SEG198 addpoint +//SEG202 addpoint addpoint: { .label c = 2 - //SEG199 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby + //SEG203 [98] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby ldx numpoints sta $1000,x - //SEG200 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby + //SEG204 [99] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby tya ldy numpoints sta $1100,y - //SEG201 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 + //SEG205 [100] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 lda c ldx numpoints sta $1200,x - //SEG202 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 + //SEG206 [101] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ numpoints#1 ] -- zpby1=_inc_zpby1 inc numpoints - //SEG203 addpoint::@return - //SEG204 [98] return [ ] + //SEG207 addpoint::@return + //SEG208 [102] return [ numpoints#1 ] rts } @@ -11353,11 +11497,11 @@ FINAL SYMBOL TABLE (byte) findcol::return (byte) findcol::return#0 reg byte y 3667.333333333333 (byte) findcol::x -(byte) findcol::x#0 x zp ZP_BYTE:9 1863.8636363636363 +(byte) findcol::x#0 x zp ZP_BYTE:9 1640.2 (byte) findcol::xp (byte) findcol::xp#0 xp zp ZP_BYTE:7 10001.0 (byte) findcol::y -(byte) findcol::y#0 y zp ZP_BYTE:10 1863.8636363636363 +(byte) findcol::y#0 y zp ZP_BYTE:10 1708.5416666666665 (byte) findcol::yp (byte) findcol::yp#0 yp zp ZP_BYTE:11 6250.625 (void()) initscreen() @@ -11378,7 +11522,7 @@ FINAL SYMBOL TABLE (label) main::@8 (label) main::@return (byte) numpoints -(byte) numpoints#1 numpoints zp ZP_BYTE:8 455.13636363636346 +(byte) numpoints#1 numpoints zp ZP_BYTE:8 200.25999999999996 (byte) numpoints#19 numpoints zp ZP_BYTE:8 4.5 (void()) render() (label) render::@1 @@ -11390,13 +11534,13 @@ FINAL SYMBOL TABLE (byte) render::col#0 reg byte a 2002.0 (byte*) render::colline (byte*) render::colline#1 colline zp ZP_PTR_BYTE:3 67.33333333333333 -(byte*) render::colline#2 colline zp ZP_PTR_BYTE:3 36.45454545454545 +(byte*) render::colline#2 colline zp ZP_PTR_BYTE:3 133.66666666666669 (byte) render::x (byte) render::x#1 x zp ZP_BYTE:5 1501.5 -(byte) render::x#2 x zp ZP_BYTE:5 133.46666666666667 +(byte) render::x#2 x zp ZP_BYTE:5 667.3333333333334 (byte) render::y (byte) render::y#1 y zp ZP_BYTE:2 151.5 -(byte) render::y#2 y zp ZP_BYTE:2 35.38235294117647 +(byte) render::y#2 y zp ZP_BYTE:2 120.29999999999998 zp ZP_BYTE:2 [ render::y#2 render::y#1 addpoint::c#6 ] zp ZP_PTR_BYTE:3 [ render::colline#2 render::colline#1 initscreen::screen#2 initscreen::screen#1 ] @@ -11441,262 +11585,266 @@ FINAL CODE .label numpoints = 8 //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] call addpoint param-assignment [ ] - //SEG6 [93] phi from main to addpoint - //SEG7 [93] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 + //SEG6 [2] call addpoint param-assignment [ ] + //SEG7 [97] phi from main to addpoint + //SEG8 [97] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1 lda #$1 sta addpoint.c - //SEG8 [93] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1 + //SEG9 [97] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1 ldy #$5 - //SEG9 [93] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1 + //SEG10 [97] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1 lda #$0 sta numpoints - //SEG10 [93] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1 + //SEG11 [97] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1 lda #$5 jsr addpoint - //SEG11 main::@3 - //SEG12 [2] call addpoint param-assignment [ ] - //SEG13 [93] phi from main::@3 to addpoint - //SEG14 [93] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 + //SEG12 main::@3 + //SEG13 [3] call addpoint param-assignment [ numpoints#1 ] + //SEG14 [97] phi from main::@3 to addpoint + //SEG15 [97] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1 lda #$2 sta addpoint.c - //SEG15 [93] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1 + //SEG16 [97] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1 ldy #$8 - //SEG16 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG17 [93] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1 + //SEG17 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG18 [97] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1 lda #$f jsr addpoint - //SEG18 main::@4 - //SEG19 [3] call addpoint param-assignment [ ] - //SEG20 [93] phi from main::@4 to addpoint - //SEG21 [93] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 + //SEG19 main::@4 + //SEG20 [4] call addpoint param-assignment [ numpoints#1 ] + //SEG21 [97] phi from main::@4 to addpoint + //SEG22 [97] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1 lda #$3 sta addpoint.c - //SEG22 [93] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1 + //SEG23 [97] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1 ldy #$e - //SEG23 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG24 [93] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1 + //SEG24 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG25 [97] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1 lda #$6 jsr addpoint - //SEG25 main::@5 - //SEG26 [4] call addpoint param-assignment [ ] - //SEG27 [93] phi from main::@5 to addpoint - //SEG28 [93] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 + //SEG26 main::@5 + //SEG27 [5] call addpoint param-assignment [ numpoints#1 ] + //SEG28 [97] phi from main::@5 to addpoint + //SEG29 [97] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1 lda #$4 sta addpoint.c - //SEG29 [93] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1 + //SEG30 [97] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1 ldy #$2 - //SEG30 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG31 [93] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1 + //SEG31 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG32 [97] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1 lda #$22 jsr addpoint - //SEG32 main::@6 - //SEG33 [5] call addpoint param-assignment [ ] - //SEG34 [93] phi from main::@6 to addpoint - //SEG35 [93] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 + //SEG33 main::@6 + //SEG34 [6] call addpoint param-assignment [ numpoints#1 ] + //SEG35 [97] phi from main::@6 to addpoint + //SEG36 [97] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1 lda #$5 sta addpoint.c - //SEG36 [93] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1 + //SEG37 [97] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1 ldy #$11 - //SEG37 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG38 [93] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1 + //SEG38 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG39 [97] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1 lda #$15 jsr addpoint - //SEG39 main::@7 - //SEG40 [6] call addpoint param-assignment [ ] - //SEG41 [93] phi from main::@7 to addpoint - //SEG42 [93] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 + //SEG40 main::@7 + //SEG41 [7] call addpoint param-assignment [ numpoints#1 ] + //SEG42 [97] phi from main::@7 to addpoint + //SEG43 [97] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1 lda #$7 sta addpoint.c - //SEG43 [93] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1 + //SEG44 [97] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1 ldy #$16 - //SEG44 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy - //SEG45 [93] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1 + //SEG45 [97] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy + //SEG46 [97] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1 lda #$1f jsr addpoint - //SEG46 main::@8 - //SEG47 [7] call initscreen param-assignment [ ] + //SEG47 main::@8 + //SEG48 [8] call initscreen param-assignment [ numpoints#1 ] + //SEG49 [91] phi from main::@8 to initscreen jsr initscreen - //SEG48 main::@1 + //SEG50 main::@1 b1: - //SEG49 [8] call render param-assignment [ ] + //SEG51 [9] call render param-assignment [ numpoints#1 ] + //SEG52 [52] phi from main::@1 to render jsr render - //SEG50 main::@10 - //SEG51 [9] call animate param-assignment [ ] + //SEG53 main::@10 + //SEG54 [10] call animate param-assignment [ numpoints#1 ] jsr animate - //SEG52 main::@11 - //SEG53 [10] if(true) goto main::@1 [ ] -- true_then_la1 + //SEG55 main::@11 + //SEG56 [11] if(true) goto main::@1 [ numpoints#1 ] -- true_then_la1 jmp b1 - //SEG54 main::@return - //SEG55 [11] return [ ] + //SEG57 main::@return + //SEG58 [12] return [ ] rts } -//SEG56 animate +//SEG59 animate animate: { - //SEG57 [12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- aby=_star_cowo1 + //SEG60 [13] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ] -- aby=_star_cowo1 lda $1000 - //SEG58 [13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- aby=aby_plus_1 + //SEG61 [14] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ] -- aby=aby_plus_1 clc adc #$1 - //SEG59 [14] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=aby + //SEG62 [15] *((word) 4096) ← (byte~) animate::$1 [ ] -- _star_cowo1=aby sta $1000 - //SEG60 [15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- aby=_star_cowo1 + //SEG63 [16] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ] -- aby=_star_cowo1 lda $1000 - //SEG61 [16] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] -- aby_neq_coby1_then_la1 + //SEG64 [17] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ] -- aby_neq_coby1_then_la1 cmp #$28 bne b1 - //SEG62 animate::@7 - //SEG63 [17] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG65 animate::@7 + //SEG66 [18] *((word) 4096) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1000 - //SEG64 animate::@1 + //SEG67 animate::@1 b1: - //SEG65 [18] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] -- aby=_star_cowo1 + //SEG68 [19] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ] -- aby=_star_cowo1 lda $1100 - //SEG66 [19] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] -- aby=aby_plus_1 + //SEG69 [20] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ] -- aby=aby_plus_1 clc adc #$1 - //SEG67 [20] *((word) 4352) ← (byte~) animate::$6 [ ] -- _star_cowo1=aby + //SEG70 [21] *((word) 4352) ← (byte~) animate::$6 [ ] -- _star_cowo1=aby sta $1100 - //SEG68 [21] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] -- aby=_star_cowo1 + //SEG71 [22] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ] -- aby=_star_cowo1 lda $1100 - //SEG69 [22] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] -- aby_neq_coby1_then_la1 + //SEG72 [23] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ] -- aby_neq_coby1_then_la1 cmp #$19 bne b2 - //SEG70 animate::@8 - //SEG71 [23] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG73 animate::@8 + //SEG74 [24] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1100 - //SEG72 animate::@2 + //SEG75 animate::@2 b2: - //SEG73 [24] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- xby=_star_cowo1 + //SEG76 [25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ] -- xby=_star_cowo1 ldx $1001 - //SEG74 [25] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] -- xby=xby_minus_1 + //SEG77 [26] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ] -- xby=xby_minus_1 dex - //SEG75 [26] *((word) 4097) ← (byte~) animate::$11 [ ] -- _star_cowo1=xby + //SEG78 [27] *((word) 4097) ← (byte~) animate::$11 [ ] -- _star_cowo1=xby stx $1001 - //SEG76 [27] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] -- aby=_star_cowo1 + //SEG79 [28] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ] -- aby=_star_cowo1 lda $1001 - //SEG77 [28] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] -- aby_neq_coby1_then_la1 + //SEG80 [29] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ] -- aby_neq_coby1_then_la1 cmp #$ff bne b3 - //SEG78 animate::@9 - //SEG79 [29] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 + //SEG81 animate::@9 + //SEG82 [30] *((word) 4097) ← (byte) 40 [ ] -- _star_cowo1=coby2 lda #$28 sta $1001 - //SEG80 animate::@3 + //SEG83 animate::@3 b3: - //SEG81 [30] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] -- aby=_star_cowo1 + //SEG84 [31] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ] -- aby=_star_cowo1 lda $1102 - //SEG82 [31] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] -- aby=aby_plus_1 + //SEG85 [32] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ] -- aby=aby_plus_1 clc adc #$1 - //SEG83 [32] *((word) 4354) ← (byte~) animate::$16 [ ] -- _star_cowo1=aby + //SEG86 [33] *((word) 4354) ← (byte~) animate::$16 [ ] -- _star_cowo1=aby sta $1102 - //SEG84 [33] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] -- aby=_star_cowo1 + //SEG87 [34] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ] -- aby=_star_cowo1 lda $1102 - //SEG85 [34] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] -- aby_neq_coby1_then_la1 + //SEG88 [35] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ] -- aby_neq_coby1_then_la1 cmp #$19 bne b4 - //SEG86 animate::@10 - //SEG87 [35] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 + //SEG89 animate::@10 + //SEG90 [36] *((word) 4354) ← (byte) 0 [ ] -- _star_cowo1=coby2 lda #$0 sta $1102 - //SEG88 animate::@4 + //SEG91 animate::@4 b4: - //SEG89 [36] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] -- xby=_star_cowo1 + //SEG92 [37] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ] -- xby=_star_cowo1 ldx $1103 - //SEG90 [37] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] -- xby=xby_minus_1 + //SEG93 [38] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ] -- xby=xby_minus_1 dex - //SEG91 [38] *((word) 4355) ← (byte~) animate::$21 [ ] -- _star_cowo1=xby + //SEG94 [39] *((word) 4355) ← (byte~) animate::$21 [ ] -- _star_cowo1=xby stx $1103 - //SEG92 [39] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] -- aby=_star_cowo1 + //SEG95 [40] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ] -- aby=_star_cowo1 lda $1103 - //SEG93 [40] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] -- aby_neq_coby1_then_la1 + //SEG96 [41] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ] -- aby_neq_coby1_then_la1 cmp #$ff bne breturn - //SEG94 animate::@11 - //SEG95 [41] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 + //SEG97 animate::@11 + //SEG98 [42] *((word) 4355) ← (byte) 25 [ ] -- _star_cowo1=coby2 lda #$19 sta $1103 - //SEG96 [42] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] -- aby=_star_cowo1 + //SEG99 [43] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ] -- aby=_star_cowo1 lda $1003 - //SEG97 [43] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] -- aby=aby_plus_coby1 + //SEG100 [44] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ] -- aby=aby_plus_coby1 clc adc #$7 - //SEG98 [44] *((word) 4099) ← (byte~) animate::$26 [ ] -- _star_cowo1=aby + //SEG101 [45] *((word) 4099) ← (byte~) animate::$26 [ ] -- _star_cowo1=aby sta $1003 - //SEG99 [45] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] -- aby=_star_cowo1 + //SEG102 [46] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ] -- aby=_star_cowo1 lda $1003 - //SEG100 [46] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] -- aby_lt_coby1_then_la1 + //SEG103 [47] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ] -- aby_lt_coby1_then_la1 cmp #$28 bcc breturn - //SEG101 animate::@12 - //SEG102 [47] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] -- aby=_star_cowo1 + //SEG104 animate::@12 + //SEG105 [48] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ] -- aby=_star_cowo1 lda $1003 - //SEG103 [48] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] -- aby=aby_minus_coby1 + //SEG106 [49] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ] -- aby=aby_minus_coby1 sec sbc #$28 - //SEG104 [49] *((word) 4099) ← (byte~) animate::$31 [ ] -- _star_cowo1=aby + //SEG107 [50] *((word) 4099) ← (byte~) animate::$31 [ ] -- _star_cowo1=aby sta $1003 - //SEG105 animate::@return + //SEG108 animate::@return breturn: - //SEG106 [50] return [ ] + //SEG109 [51] return [ ] rts } -//SEG107 render +//SEG110 render render: { .label x = 5 .label colline = 3 .label y = 2 - //SEG108 [51] phi from render to render::@1 - //SEG109 [51] phi (byte*) render::colline#2 = (word) 55296 -- zpptrby1=cowo1 + //SEG111 [53] phi from render to render::@1 + //SEG112 [53] phi (byte*) render::colline#2 = (word) 55296 -- zpptrby1=cowo1 lda #<$d800 sta colline lda #>$d800 sta colline+$1 - //SEG110 [51] phi (byte) render::y#2 = (byte) 0 -- zpby1=coby1 + //SEG113 [53] phi (byte) render::y#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta y - //SEG111 [51] phi from render::@3 to render::@1 - //SEG112 [51] phi (byte*) render::colline#2 = (byte*) render::colline#1 -- register_copy - //SEG113 [51] phi (byte) render::y#2 = (byte) render::y#1 -- register_copy - //SEG114 render::@1 + //SEG114 [53] phi from render::@3 to render::@1 + //SEG115 [53] phi (byte*) render::colline#2 = (byte*) render::colline#1 -- register_copy + //SEG116 [53] phi (byte) render::y#2 = (byte) render::y#1 -- register_copy + //SEG117 render::@1 b1: - //SEG115 [52] phi from render::@1 to render::@2 - //SEG116 [52] phi (byte) render::x#2 = (byte) 0 -- zpby1=coby1 + //SEG118 [54] phi from render::@1 to render::@2 + //SEG119 [54] phi (byte) render::x#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta x - //SEG117 [52] phi from render::@5 to render::@2 - //SEG118 [52] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy - //SEG119 render::@2 + //SEG120 [54] phi from render::@5 to render::@2 + //SEG121 [54] phi (byte) render::x#2 = (byte) render::x#1 -- register_copy + //SEG122 render::@2 b2: - //SEG120 [53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 ] -- zpby1=zpby2 + //SEG123 [55] (byte) findcol::x#0 ← (byte) render::x#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 numpoints#1 ] -- zpby1=zpby2 lda x sta findcol.x - //SEG121 [54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 ] -- zpby1=zpby2 + //SEG124 [56] (byte) findcol::y#0 ← (byte) render::y#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 findcol::y#0 numpoints#1 ] -- zpby1=zpby2 lda y sta findcol.y - //SEG122 [55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + //SEG125 [57] call findcol param-assignment [ render::y#2 render::colline#2 render::x#2 findcol::return#0 numpoints#1 ] + //SEG126 [66] phi from render::@2 to findcol jsr findcol - //SEG123 render::@5 - //SEG124 [56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ] -- aby=yby + //SEG127 render::@5 + //SEG128 [58] (byte) render::col#0 ← (byte) findcol::return#0 [ render::y#2 render::colline#2 render::x#2 render::col#0 numpoints#1 ] -- aby=yby tya - //SEG125 [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 + //SEG129 [59] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::y#2 render::colline#2 render::x#2 numpoints#1 ] -- zpptrby1_staridx_zpby1=aby ldy x sta (colline),y - //SEG126 [58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1=_inc_zpby1 + //SEG130 [60] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] -- zpby1=_inc_zpby1 inc x - //SEG127 [59] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ] -- zpby1_neq_coby1_then_la1 + //SEG131 [61] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ] -- zpby1_neq_coby1_then_la1 lda x cmp #$28 bne b2 - //SEG128 render::@3 - //SEG129 [60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ] -- zpptrby1=zpptrby1_plus_coby1 + //SEG132 render::@3 + //SEG133 [62] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 render::colline#1 numpoints#1 ] -- zpptrby1=zpptrby1_plus_coby1 lda colline clc adc #$28 @@ -11704,17 +11852,17 @@ render: { bcc !+ inc colline+$1 !: - //SEG130 [61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ] -- zpby1=_inc_zpby1 + //SEG134 [63] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 numpoints#1 ] -- zpby1=_inc_zpby1 inc y - //SEG131 [62] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ] -- zpby1_neq_coby1_then_la1 + //SEG135 [64] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 numpoints#1 ] -- zpby1_neq_coby1_then_la1 lda y cmp #$19 bne b1 - //SEG132 render::@return - //SEG133 [63] return [ ] + //SEG136 render::@return + //SEG137 [65] return [ numpoints#1 ] rts } -//SEG134 findcol +//SEG138 findcol findcol: { .label x = 9 .label y = 10 @@ -11722,145 +11870,145 @@ findcol: { .label yp = 11 .label diff = 7 .label mindiff = 6 - //SEG135 [64] phi from findcol to findcol::@1 - //SEG136 [64] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 + //SEG139 [67] phi from findcol to findcol::@1 + //SEG140 [67] phi (byte) findcol::mincol#11 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG137 [64] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 + //SEG141 [67] phi (byte) findcol::mindiff#10 = (byte) 255 -- zpby1=coby1 lda #$ff sta mindiff - //SEG138 [64] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 + //SEG142 [67] phi (byte) findcol::i#12 = (byte) 0 -- xby=coby1 ldx #$0 - //SEG139 findcol::@1 + //SEG143 findcol::@1 b1: - //SEG140 [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 numpoints#1 ] -- zpby1=cowo1_staridx_xby + //SEG144 [68] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 numpoints#1 ] -- zpby1=cowo1_staridx_xby lda $1000,x sta xp - //SEG141 [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 numpoints#1 ] -- zpby1=cowo1_staridx_xby + //SEG145 [69] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1=cowo1_staridx_xby lda $1100,x sta yp - //SEG142 [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 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 + //SEG146 [70] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 lda x cmp xp bne b2 - //SEG143 findcol::@9 - //SEG144 [68] if((byte) findcol::y#0!=(byte) findcol::yp#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 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 + //SEG147 findcol::@9 + //SEG148 [71] if((byte) findcol::y#0!=(byte) findcol::yp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_neq_zpby2_then_la1 lda y cmp yp bne b2 - //SEG145 [69] phi from findcol::@9 to findcol::@return - //SEG146 [69] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 + //SEG149 [72] phi from findcol::@9 to findcol::@return + //SEG150 [72] phi (byte) findcol::return#0 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG147 findcol::@return + //SEG151 findcol::@return breturn: - //SEG148 [70] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ] + //SEG152 [73] return [ findcol::return#0 numpoints#1 ] rts - //SEG149 findcol::@2 + //SEG153 findcol::@2 b2: - //SEG150 [71] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG154 [74] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda x cmp xp bcs b4 - //SEG151 findcol::@12 - //SEG152 [72] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#1 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby1_minus_zpby2 + //SEG155 findcol::@12 + //SEG156 [75] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#1 numpoints#1 ] -- zpby1=zpby1_minus_zpby2 lda diff sec sbc x sta diff - //SEG153 [73] phi from findcol::@12 findcol::@4 to findcol::@5 - //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy - //SEG155 findcol::@5 + //SEG157 [76] phi from findcol::@12 findcol::@4 to findcol::@5 + //SEG158 [76] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy + //SEG159 findcol::@5 b5: - //SEG156 [74] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ 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 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 + //SEG160 [77] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 numpoints#1 ] -- zpby1_ge_zpby2_then_la1 lda y cmp yp bcs b6 - //SEG157 findcol::@14 - //SEG158 [75] (byte~) findcol::$12 ← (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::$12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_minus_zpby2 + //SEG161 findcol::@14 + //SEG162 [78] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 findcol::$12 numpoints#1 ] -- aby=zpby1_minus_zpby2 lda yp sec sbc y - //SEG159 [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ 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 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG163 [79] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#3 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG160 [77] phi from findcol::@14 findcol::@6 to findcol::@7 - //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy - //SEG162 findcol::@7 + //SEG164 [80] phi from findcol::@14 findcol::@6 to findcol::@7 + //SEG165 [80] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy + //SEG166 findcol::@7 b7: - //SEG163 [78] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ 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 numpoints#1 ] -- aby_ge_zpby1_then_la1 + //SEG167 [81] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 numpoints#1 ] -- aby_ge_zpby1_then_la1 cmp mindiff bcs b21 - //SEG164 findcol::@16 - //SEG165 [79] (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 numpoints#1 ] -- yby=cowo1_staridx_xby + //SEG168 findcol::@16 + //SEG169 [82] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::diff#6 findcol::mincol#1 numpoints#1 ] -- yby=cowo1_staridx_xby ldy $1200,x - //SEG166 [80] phi from findcol::@16 findcol::@21 to findcol::@8 - //SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy - //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy - //SEG169 findcol::@8 + //SEG170 [83] phi from findcol::@16 findcol::@21 to findcol::@8 + //SEG171 [83] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy + //SEG172 [83] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy + //SEG173 findcol::@8 b8: - //SEG170 [81] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] -- xby=_inc_xby + //SEG174 [84] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] -- xby=_inc_xby inx - //SEG171 [82] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ] -- xby_lt_zpby1_then_la1 + //SEG175 [85] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ] -- xby_lt_zpby1_then_la1 cpx numpoints bcc b19 - //SEG172 [69] phi from findcol::@8 to findcol::@return - //SEG173 [69] phi (byte) findcol::return#0 = (byte) findcol::mincol#2 -- register_copy + //SEG176 [72] phi from findcol::@8 to findcol::@return + //SEG177 [72] phi (byte) findcol::return#0 = (byte) findcol::mincol#2 -- register_copy jmp breturn - //SEG174 findcol::@19 + //SEG178 findcol::@19 b19: - //SEG175 [83] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 ] -- zpby1=aby + //SEG179 [86] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 numpoints#1 ] -- zpby1=aby sta mindiff - //SEG176 [64] phi from findcol::@19 to findcol::@1 - //SEG177 [64] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy - //SEG178 [64] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 -- register_copy - //SEG179 [64] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy + //SEG180 [67] phi from findcol::@19 to findcol::@1 + //SEG181 [67] phi (byte) findcol::mincol#11 = (byte) findcol::mincol#2 -- register_copy + //SEG182 [67] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 -- register_copy + //SEG183 [67] phi (byte) findcol::i#12 = (byte) findcol::i#1 -- register_copy jmp b1 - //SEG180 findcol::@21 + //SEG184 findcol::@21 b21: - //SEG181 [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 + //SEG185 [87] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 lda mindiff jmp b8 - //SEG182 findcol::@6 + //SEG186 findcol::@6 b6: - //SEG183 [85] (byte~) findcol::$14 ← (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::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 + //SEG187 [88] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 lda y sec sbc yp - //SEG184 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ 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 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG188 [89] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#2 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff jmp b7 - //SEG185 findcol::@4 + //SEG189 findcol::@4 b4: - //SEG186 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 + //SEG190 [90] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#0 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 lda x sec sbc diff sta diff jmp b5 } -//SEG187 initscreen +//SEG191 initscreen initscreen: { .label screen = 3 - //SEG188 [88] phi from initscreen to initscreen::@1 - //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG192 [92] phi from initscreen to initscreen::@1 + //SEG193 [92] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 - //SEG190 [88] phi from initscreen::@1 to initscreen::@1 - //SEG191 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy - //SEG192 initscreen::@1 + //SEG194 [92] phi from initscreen::@1 to initscreen::@1 + //SEG195 [92] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy + //SEG196 initscreen::@1 b1: - //SEG193 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 + //SEG197 [93] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$e6 sta (screen),y - //SEG194 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 + //SEG198 [94] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG195 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 + //SEG199 [95] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda screen+$1 cmp #>$7e8 bcc b1 @@ -11869,28 +12017,28 @@ initscreen: { cmp #<$7e8 bcc b1 !: - //SEG196 initscreen::@return - //SEG197 [92] return [ ] + //SEG200 initscreen::@return + //SEG201 [96] return [ ] rts } -//SEG198 addpoint +//SEG202 addpoint addpoint: { .label c = 2 - //SEG199 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby + //SEG203 [98] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby ldx numpoints sta $1000,x - //SEG200 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby + //SEG204 [99] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby tya ldy numpoints sta $1100,y - //SEG201 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 + //SEG205 [100] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 lda c ldx numpoints sta $1200,x - //SEG202 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 + //SEG206 [101] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ numpoints#1 ] -- zpby1=_inc_zpby1 inc numpoints - //SEG203 addpoint::@return - //SEG204 [98] return [ ] + //SEG207 addpoint::@return + //SEG208 [102] return [ numpoints#1 ] 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 64e00c16a..4a6a02948 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.sym @@ -85,11 +85,11 @@ (byte) findcol::return (byte) findcol::return#0 reg byte y 3667.333333333333 (byte) findcol::x -(byte) findcol::x#0 x zp ZP_BYTE:9 1863.8636363636363 +(byte) findcol::x#0 x zp ZP_BYTE:9 1640.2 (byte) findcol::xp (byte) findcol::xp#0 xp zp ZP_BYTE:7 10001.0 (byte) findcol::y -(byte) findcol::y#0 y zp ZP_BYTE:10 1863.8636363636363 +(byte) findcol::y#0 y zp ZP_BYTE:10 1708.5416666666665 (byte) findcol::yp (byte) findcol::yp#0 yp zp ZP_BYTE:11 6250.625 (void()) initscreen() @@ -110,7 +110,7 @@ (label) main::@8 (label) main::@return (byte) numpoints -(byte) numpoints#1 numpoints zp ZP_BYTE:8 455.13636363636346 +(byte) numpoints#1 numpoints zp ZP_BYTE:8 200.25999999999996 (byte) numpoints#19 numpoints zp ZP_BYTE:8 4.5 (void()) render() (label) render::@1 @@ -122,13 +122,13 @@ (byte) render::col#0 reg byte a 2002.0 (byte*) render::colline (byte*) render::colline#1 colline zp ZP_PTR_BYTE:3 67.33333333333333 -(byte*) render::colline#2 colline zp ZP_PTR_BYTE:3 36.45454545454545 +(byte*) render::colline#2 colline zp ZP_PTR_BYTE:3 133.66666666666669 (byte) render::x (byte) render::x#1 x zp ZP_BYTE:5 1501.5 -(byte) render::x#2 x zp ZP_BYTE:5 133.46666666666667 +(byte) render::x#2 x zp ZP_BYTE:5 667.3333333333334 (byte) render::y (byte) render::y#1 y zp ZP_BYTE:2 151.5 -(byte) render::y#2 y zp ZP_BYTE:2 35.38235294117647 +(byte) render::y#2 y zp ZP_BYTE:2 120.29999999999998 zp ZP_BYTE:2 [ render::y#2 render::y#1 addpoint::c#6 ] zp ZP_PTR_BYTE:3 [ render::colline#2 render::colline#1 initscreen::screen#2 initscreen::screen#1 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.asm b/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.asm index ab8d8b5f4..b28f6c54f 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.asm +++ b/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.asm @@ -8,6 +8,7 @@ main: { tya clc adc #$2 + sty sum.a sta sum.c jsr sum sta $400,y @@ -17,6 +18,7 @@ main: { tya clc adc #$2 + sty sum2.a sta sum2.c jsr sum2 sta $428,y @@ -26,21 +28,21 @@ main: { rts } sum2: { - .label c = 2 - sty $ff + .label a = 2 + .label c = 3 txa clc - adc $ff + adc a clc adc c rts } sum: { - .label c = 2 - sty $ff + .label a = 2 + .label c = 3 txa clc - adc $ff + adc a clc adc c rts diff --git a/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.cfg b/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.cfg index b63f8d410..4a7debb8b 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.cfg @@ -3,46 +3,47 @@ to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@4 - [1] (byte) main::i#2 ← phi( main/(byte) 0 main::@4/(byte) main::i#1 ) [ main::i#2 ] - [2] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] - [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] - [4] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] - [5] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] - [6] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 ] - [7] call sum param-assignment [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + [2] (byte) main::i#2 ← phi( main/(byte) 0 main::@4/(byte) main::i#1 ) [ main::i#2 ] + [3] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] + [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] + [5] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] + [6] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] + [7] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 sum::c#0 ] + [8] call sum param-assignment [ main::i#2 sum::return#0 ] to:main::@3 main::@3: scope:[main] from main::@1 - [8] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] - [9] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] - [10] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] - [11] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] - [12] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] - [13] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] - [14] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 ] - [15] call sum2 param-assignment [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + [9] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] + [10] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] + [11] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] + [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] + [13] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] + [14] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] + [15] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 sum2::c#0 ] + [16] call sum2 param-assignment [ main::i#2 sum2::return#0 ] to:main::@4 main::@4: scope:[main] from main::@3 - [16] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] - [17] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] - [18] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [19] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] + [17] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] + [18] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] + [19] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [20] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@4 - [20] return [ ] + [21] return [ ] to:@return sum2: scope:[sum2] from main::@3 - [21] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ main::i#2 sum2::a#0 sum2::b#0 sum2::$0 sum2::c#0 ] - [22] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + [22] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ sum2::c#0 sum2::$0 ] + [23] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ sum2::return#0 ] to:sum2::@return sum2::@return: scope:[sum2] from sum2 - [23] return [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + [24] return [ sum2::return#0 ] to:@return sum: scope:[sum] from main::@1 - [24] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ main::i#2 sum::a#0 sum::b#0 sum::$0 sum::c#0 ] - [25] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + [25] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ sum::c#0 sum::$0 ] + [26] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ sum::return#0 ] to:sum::@return sum::@return: scope:[sum] from sum - [26] return [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + [27] return [ sum::return#0 ] to:@return diff --git a/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.log b/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.log index e5294c5f7..774240c4d 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.log @@ -1149,133 +1149,82 @@ sum::@return: scope:[sum] from sum return to:@return +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to 0:main +Calls in [main] to 8:sum 16:sum2 + Propagating live ranges... Propagating live ranges... -Propagated sum2::a#0 through call [15] call sum2 param-assignment -Propagated sum2::b#0 through call [15] call sum2 param-assignment -Propagated sum::a#0 through call [7] call sum param-assignment -Propagated sum::b#0 through call [7] call sum param-assignment Propagating live ranges... -Propagated main::i#2 through call [15] call sum2 param-assignment -Propagated sum2::a#0 through call [15] call sum2 param-assignment -Propagated sum2::b#0 through call [15] call sum2 param-assignment -Propagated main::i#2 through call [7] call sum param-assignment -Propagated sum::a#0 through call [7] call sum param-assignment -Propagated sum::b#0 through call [7] call sum param-assignment Propagating live ranges... -Propagated main::i#2 through call [15] call sum2 param-assignment -Propagated sum2::a#0 through call [15] call sum2 param-assignment -Propagated sum2::b#0 through call [15] call sum2 param-assignment -Propagated main::i#2 through call [7] call sum param-assignment -Propagated sum::a#0 through call [7] call sum param-assignment -Propagated sum::b#0 through call [7] call sum param-assignment Propagating live ranges... -Propagated main::i#2 through call [15] call sum2 param-assignment -Propagated sum2::a#0 through call [15] call sum2 param-assignment -Propagated sum2::b#0 through call [15] call sum2 param-assignment -Propagated main::i#2 through call [7] call sum param-assignment -Propagated sum::a#0 through call [7] call sum param-assignment -Propagated sum::b#0 through call [7] call sum param-assignment Propagating live ranges... -Propagated main::i#2 through call [15] call sum2 param-assignment -Propagated sum2::a#0 through call [15] call sum2 param-assignment -Propagated sum2::b#0 through call [15] call sum2 param-assignment -Propagated main::i#2 through call [7] call sum param-assignment -Propagated sum::a#0 through call [7] call sum param-assignment -Propagated sum::b#0 through call [7] call sum param-assignment -Propagating live ranges... -CONTROL FLOW GRAPH - LIVE RANGES +CONTROL FLOW GRAPH - LIVE RANGES FOUND @begin: scope:[] from [0] call main param-assignment [ ] to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@5 - [1] (byte) main::i#2 ← phi( main/(byte) 0 main::@5/(byte~) main::i#5 ) [ main::i#2 ] - [2] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] - [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] - [4] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] - [5] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] - [6] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 ] - [7] call sum param-assignment [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + [2] (byte) main::i#2 ← phi( main/(byte) 0 main::@5/(byte~) main::i#5 ) [ main::i#2 ] + [3] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] + [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] + [5] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] + [6] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] + [7] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 sum::c#0 ] + [8] call sum param-assignment [ main::i#2 sum::return#0 ] to:main::@3 main::@3: scope:[main] from main::@1 - [8] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] - [9] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] - [10] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] - [11] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] - [12] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] - [13] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] - [14] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 ] - [15] call sum2 param-assignment [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + [9] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] + [10] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] + [11] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] + [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] + [13] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] + [14] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] + [15] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 sum2::c#0 ] + [16] call sum2 param-assignment [ main::i#2 sum2::return#0 ] to:main::@4 main::@4: scope:[main] from main::@3 - [16] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] - [17] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] - [18] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [19] if((byte) main::i#1!=(byte) 11) goto main::@5 [ main::i#1 ] + [17] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] + [18] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] + [19] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [20] if((byte) main::i#1!=(byte) 11) goto main::@5 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@4 - [20] return [ ] + [21] return [ ] to:@return main::@5: scope:[main] from main::@4 - [21] (byte~) main::i#5 ← (byte) main::i#1 [ main::i#5 ] + [22] (byte~) main::i#5 ← (byte) main::i#1 [ main::i#5 ] to:main::@1 sum2: scope:[sum2] from main::@3 - [22] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ main::i#2 sum2::a#0 sum2::b#0 sum2::$0 sum2::c#0 ] - [23] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + [23] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ sum2::c#0 sum2::$0 ] + [24] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ sum2::return#0 ] to:sum2::@return sum2::@return: scope:[sum2] from sum2 - [24] return [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + [25] return [ sum2::return#0 ] to:@return sum: scope:[sum] from main::@1 - [25] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ main::i#2 sum::a#0 sum::b#0 sum::$0 sum::c#0 ] - [26] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + [26] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ sum::c#0 sum::$0 ] + [27] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ sum::return#0 ] to:sum::@return sum::@return: scope:[sum] from sum - [27] return [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + [28] return [ sum::return#0 ] to:@return Created 1 initial phi equivalence classes -Coalesced [21] main::i#5 ← main::i#1 +Coalesced [22] main::i#5 ← main::i#1 Coalesced down to 1 phi equivalence classes Culled Empty Block (label) main::@5 Block Sequence Planned @begin @end main main::@1 main::@3 main::@4 main::@return sum2 sum2::@return sum sum::@return +Adding NOP phi() at start of main Propagating live ranges... Propagating live ranges... -Propagated sum2::a#0 through call [15] call sum2 param-assignment -Propagated sum2::b#0 through call [15] call sum2 param-assignment -Propagated sum::a#0 through call [7] call sum param-assignment -Propagated sum::b#0 through call [7] call sum param-assignment Propagating live ranges... -Propagated main::i#2 through call [15] call sum2 param-assignment -Propagated sum2::a#0 through call [15] call sum2 param-assignment -Propagated sum2::b#0 through call [15] call sum2 param-assignment -Propagated main::i#2 through call [7] call sum param-assignment -Propagated sum::a#0 through call [7] call sum param-assignment -Propagated sum::b#0 through call [7] call sum param-assignment Propagating live ranges... -Propagated main::i#2 through call [15] call sum2 param-assignment -Propagated sum2::a#0 through call [15] call sum2 param-assignment -Propagated sum2::b#0 through call [15] call sum2 param-assignment -Propagated main::i#2 through call [7] call sum param-assignment -Propagated sum::a#0 through call [7] call sum param-assignment -Propagated sum::b#0 through call [7] call sum param-assignment Propagating live ranges... -Propagated main::i#2 through call [15] call sum2 param-assignment -Propagated sum2::a#0 through call [15] call sum2 param-assignment -Propagated sum2::b#0 through call [15] call sum2 param-assignment -Propagated main::i#2 through call [7] call sum param-assignment -Propagated sum::a#0 through call [7] call sum param-assignment -Propagated sum::b#0 through call [7] call sum param-assignment -Propagating live ranges... -Propagated main::i#2 through call [15] call sum2 param-assignment -Propagated sum2::a#0 through call [15] call sum2 param-assignment -Propagated sum2::b#0 through call [15] call sum2 param-assignment -Propagated main::i#2 through call [7] call sum param-assignment -Propagated sum::a#0 through call [7] call sum param-assignment -Propagated sum::b#0 through call [7] call sum param-assignment Propagating live ranges... CONTROL FLOW GRAPH - PHI MEM COALESCED @begin: scope:[] from @@ -1283,54 +1232,51 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED to:@end @end: scope:[] from @begin main: scope:[main] from @begin + [1] phi() [ ] to:main::@1 main::@1: scope:[main] from main main::@4 - [1] (byte) main::i#2 ← phi( main/(byte) 0 main::@4/(byte) main::i#1 ) [ main::i#2 ] - [2] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] - [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] - [4] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] - [5] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] - [6] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 ] - [7] call sum param-assignment [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + [2] (byte) main::i#2 ← phi( main/(byte) 0 main::@4/(byte) main::i#1 ) [ main::i#2 ] + [3] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] + [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] + [5] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] + [6] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] + [7] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 sum::c#0 ] + [8] call sum param-assignment [ main::i#2 sum::return#0 ] to:main::@3 main::@3: scope:[main] from main::@1 - [8] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] - [9] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] - [10] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] - [11] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] - [12] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] - [13] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] - [14] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 ] - [15] call sum2 param-assignment [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + [9] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] + [10] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] + [11] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] + [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] + [13] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] + [14] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] + [15] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 sum2::c#0 ] + [16] call sum2 param-assignment [ main::i#2 sum2::return#0 ] to:main::@4 main::@4: scope:[main] from main::@3 - [16] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] - [17] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] - [18] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] - [19] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] + [17] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] + [18] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] + [19] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] + [20] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] to:main::@return main::@return: scope:[main] from main::@4 - [20] return [ ] + [21] return [ ] to:@return sum2: scope:[sum2] from main::@3 - [21] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ main::i#2 sum2::a#0 sum2::b#0 sum2::$0 sum2::c#0 ] - [22] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + [22] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ sum2::c#0 sum2::$0 ] + [23] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ sum2::return#0 ] to:sum2::@return sum2::@return: scope:[sum2] from sum2 - [23] return [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + [24] return [ sum2::return#0 ] to:@return sum: scope:[sum] from main::@1 - [24] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ main::i#2 sum::a#0 sum::b#0 sum::$0 sum::c#0 ] - [25] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + [25] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ sum::c#0 sum::$0 ] + [26] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ sum::return#0 ] to:sum::@return sum::@return: scope:[sum] from sum - [26] return [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + [27] return [ sum::return#0 ] to:@return -CALL GRAPH -Calls in [] to 0:main -Calls in [main] to 7:sum 15:sum2 - DOMINATORS @begin dominated by @begin @end dominated by @end @begin @@ -1370,25 +1316,25 @@ VARIABLE REGISTER WEIGHTS (byte~) main::$5 22.0 (byte) main::i (byte) main::i#1 16.5 -(byte) main::i#2 4.782608695652174 +(byte) main::i#2 6.470588235294119 (byte()) sum((byte) sum::a , (byte) sum::b , (byte) sum::c) (byte~) sum::$0 4.0 (byte) sum::a -(byte) sum::a#0 1.8571428571428572 +(byte) sum::a#0 4.333333333333333 (byte) sum::b -(byte) sum::b#0 2.1666666666666665 +(byte) sum::b#0 6.5 (byte) sum::c -(byte) sum::c#0 13.0 +(byte) sum::c#0 6.5 (byte) sum::return (byte) sum::return#0 4.333333333333333 (byte()) sum2((byte) sum2::a , (byte) sum2::b , (byte) sum2::c) (byte~) sum2::$0 4.0 (byte) sum2::a -(byte) sum2::a#0 1.8571428571428572 +(byte) sum2::a#0 4.333333333333333 (byte) sum2::b -(byte) sum2::b#0 2.1666666666666665 +(byte) sum2::b#0 6.5 (byte) sum2::c -(byte) sum2::c#0 13.0 +(byte) sum2::c#0 6.5 (byte) sum2::return (byte) sum2::return#0 4.333333333333333 @@ -1450,159 +1396,161 @@ INITIAL ASM //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main jmp bend -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - .label $0 = 3 - .label $1 = 4 - .label $2 = 8 - .label $3 = 9 - .label $4 = 10 - .label $5 = 14 + .label _0 = 3 + .label _1 = 4 + .label _2 = 8 + .label _3 = 9 + .label _4 = 10 + .label _5 = 14 .label i = 2 - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1 lda #$0 sta i jmp b1 - //SEG7 [1] phi from main::@4 to main::@1 + //SEG8 [2] phi from main::@4 to main::@1 b1_from_b4: - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 - //SEG9 main::@1 + //SEG10 main::@1 b1: - //SEG10 [2] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] -- zpby1=zpby2_plus_1 + //SEG11 [3] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] -- zpby1=zpby2_plus_1 lda i clc adc #$1 - sta $0 - //SEG11 [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] -- zpby1=zpby2_plus_coby1 + sta _0 + //SEG12 [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] -- zpby1=zpby2_plus_coby1 lda i clc adc #$2 - sta $1 - //SEG12 [4] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] -- zpby1=zpby2 + sta _1 + //SEG13 [5] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] -- zpby1=zpby2 lda i sta sum.a - //SEG13 [5] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] -- zpby1=zpby2 - lda $0 + //SEG14 [6] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] -- zpby1=zpby2 + lda _0 sta sum.b - //SEG14 [6] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 ] -- zpby1=zpby2 - lda $1 + //SEG15 [7] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 sum::c#0 ] -- zpby1=zpby2 + lda _1 sta sum.c - //SEG15 [7] call sum param-assignment [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + //SEG16 [8] call sum param-assignment [ main::i#2 sum::return#0 ] jsr sum jmp b3 - //SEG16 main::@3 + //SEG17 main::@3 b3: - //SEG17 [8] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] -- zpby1=zpby2 + //SEG18 [9] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] -- zpby1=zpby2 lda sum.return - sta $2 - //SEG18 [9] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby2 - lda $2 + sta _2 + //SEG19 [10] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby2 + lda _2 ldx i sta $400,x - //SEG19 [10] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] -- zpby1=zpby2_plus_1 + //SEG20 [11] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] -- zpby1=zpby2_plus_1 lda i clc adc #$1 - sta $3 - //SEG20 [11] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] -- zpby1=zpby2_plus_coby1 + sta _3 + //SEG21 [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] -- zpby1=zpby2_plus_coby1 lda i clc adc #$2 - sta $4 - //SEG21 [12] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] -- zpby1=zpby2 + sta _4 + //SEG22 [13] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] -- zpby1=zpby2 lda i sta sum2.a - //SEG22 [13] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] -- zpby1=zpby2 - lda $3 + //SEG23 [14] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] -- zpby1=zpby2 + lda _3 sta sum2.b - //SEG23 [14] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 ] -- zpby1=zpby2 - lda $4 + //SEG24 [15] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 sum2::c#0 ] -- zpby1=zpby2 + lda _4 sta sum2.c - //SEG24 [15] call sum2 param-assignment [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + //SEG25 [16] call sum2 param-assignment [ main::i#2 sum2::return#0 ] jsr sum2 jmp b4 - //SEG25 main::@4 + //SEG26 main::@4 b4: - //SEG26 [16] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] -- zpby1=zpby2 + //SEG27 [17] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] -- zpby1=zpby2 lda sum2.return - sta $5 - //SEG27 [17] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby2 - lda $5 + sta _5 + //SEG28 [18] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby2 + lda _5 ldx i sta $428,x - //SEG28 [18] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1 + //SEG29 [19] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1 inc i - //SEG29 [19] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] -- zpby1_neq_coby1_then_la1 + //SEG30 [20] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] -- zpby1_neq_coby1_then_la1 lda i cmp #$b bne b1_from_b4 jmp breturn - //SEG30 main::@return + //SEG31 main::@return breturn: - //SEG31 [20] return [ ] + //SEG32 [21] return [ ] rts } -//SEG32 sum2 +//SEG33 sum2 sum2: { - .label $0 = 15 + .label _0 = 15 .label a = 11 .label b = 12 .label c = 13 .label return = 16 - //SEG33 [21] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ main::i#2 sum2::a#0 sum2::b#0 sum2::$0 sum2::c#0 ] -- zpby1=zpby2_plus_zpby3 + //SEG34 [22] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ sum2::c#0 sum2::$0 ] -- zpby1=zpby2_plus_zpby3 lda a clc adc b - sta $0 - //SEG34 [22] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] -- zpby1=zpby2_plus_zpby3 - lda $0 + sta _0 + //SEG35 [23] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ sum2::return#0 ] -- zpby1=zpby2_plus_zpby3 + lda _0 clc adc c sta return jmp breturn - //SEG35 sum2::@return + //SEG36 sum2::@return breturn: - //SEG36 [23] return [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + //SEG37 [24] return [ sum2::return#0 ] rts } -//SEG37 sum +//SEG38 sum sum: { - .label $0 = 17 + .label _0 = 17 .label a = 5 .label b = 6 .label c = 7 .label return = 18 - //SEG38 [24] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ main::i#2 sum::a#0 sum::b#0 sum::$0 sum::c#0 ] -- zpby1=zpby2_plus_zpby3 + //SEG39 [25] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ sum::c#0 sum::$0 ] -- zpby1=zpby2_plus_zpby3 lda a clc adc b - sta $0 - //SEG39 [25] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] -- zpby1=zpby2_plus_zpby3 - lda $0 + sta _0 + //SEG40 [26] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ sum::return#0 ] -- zpby1=zpby2_plus_zpby3 + lda _0 clc adc c sta return jmp breturn - //SEG40 sum::@return + //SEG41 sum::@return breturn: - //SEG41 [26] return [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + //SEG42 [27] return [ sum::return#0 ] rts } -Statement [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] always clobbers reg byte a +Statement [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::$0 ] -Statement [11] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] always clobbers reg byte a +Statement [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ main::$3 ] -Statement [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] always clobbers reg byte a -Statement [11] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] always clobbers reg byte a +Statement [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] always clobbers reg byte a +Statement [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] always clobbers reg byte a REGISTER UPLIFT POTENTIAL REGISTERS Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , Potential registers zp ZP_BYTE:3 [ main::$0 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , @@ -1623,17 +1571,27 @@ Potential registers zp ZP_BYTE:17 [ sum::$0 ] : zp ZP_BYTE:17 , reg byte a , reg Potential registers zp ZP_BYTE:18 [ sum::return#0 ] : zp ZP_BYTE:18 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -Uplift Scope [main] 22: zp ZP_BYTE:8 [ main::$2 ] 22: zp ZP_BYTE:14 [ main::$5 ] 21.28: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 7.33: zp ZP_BYTE:3 [ main::$0 ] 7.33: zp ZP_BYTE:4 [ main::$1 ] 7.33: zp ZP_BYTE:9 [ main::$3 ] 7.33: zp ZP_BYTE:10 [ main::$4 ] -Uplift Scope [sum] 13: zp ZP_BYTE:7 [ sum::c#0 ] 4.33: zp ZP_BYTE:18 [ sum::return#0 ] 4: zp ZP_BYTE:17 [ sum::$0 ] 2.17: zp ZP_BYTE:6 [ sum::b#0 ] 1.86: zp ZP_BYTE:5 [ sum::a#0 ] -Uplift Scope [sum2] 13: zp ZP_BYTE:13 [ sum2::c#0 ] 4.33: zp ZP_BYTE:16 [ sum2::return#0 ] 4: zp ZP_BYTE:15 [ sum2::$0 ] 2.17: zp ZP_BYTE:12 [ sum2::b#0 ] 1.86: zp ZP_BYTE:11 [ sum2::a#0 ] +Uplift Scope [main] 22.97: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 22: zp ZP_BYTE:8 [ main::$2 ] 22: zp ZP_BYTE:14 [ main::$5 ] 7.33: zp ZP_BYTE:3 [ main::$0 ] 7.33: zp ZP_BYTE:4 [ main::$1 ] 7.33: zp ZP_BYTE:9 [ main::$3 ] 7.33: zp ZP_BYTE:10 [ main::$4 ] +Uplift Scope [sum] 6.5: zp ZP_BYTE:6 [ sum::b#0 ] 6.5: zp ZP_BYTE:7 [ sum::c#0 ] 4.33: zp ZP_BYTE:5 [ sum::a#0 ] 4.33: zp ZP_BYTE:18 [ sum::return#0 ] 4: zp ZP_BYTE:17 [ sum::$0 ] +Uplift Scope [sum2] 6.5: zp ZP_BYTE:12 [ sum2::b#0 ] 6.5: zp ZP_BYTE:13 [ sum2::c#0 ] 4.33: zp ZP_BYTE:11 [ sum2::a#0 ] 4.33: zp ZP_BYTE:16 [ sum2::return#0 ] 4: zp ZP_BYTE:15 [ sum2::$0 ] Uplift Scope [] -Uplifting [main] best 1012 combination reg byte a [ main::$2 ] reg byte a [ main::$5 ] reg byte y [ main::i#2 main::i#1 ] reg byte x [ main::$0 ] reg byte a [ main::$1 ] reg byte x [ main::$3 ] reg byte a [ main::$4 ] -Uplifting [sum] best 915 combination zp ZP_BYTE:7 [ sum::c#0 ] reg byte a [ sum::return#0 ] reg byte a [ sum::$0 ] reg byte x [ sum::b#0 ] reg byte y [ sum::a#0 ] -Uplifting [sum2] best 818 combination zp ZP_BYTE:13 [ sum2::c#0 ] reg byte a [ sum2::return#0 ] reg byte a [ sum2::$0 ] reg byte x [ sum2::b#0 ] reg byte y [ sum2::a#0 ] -Uplifting [] best 818 combination +Uplifting [main] best 1012 combination reg byte y [ main::i#2 main::i#1 ] reg byte a [ main::$2 ] reg byte a [ main::$5 ] reg byte x [ main::$0 ] reg byte a [ main::$1 ] reg byte x [ main::$3 ] reg byte a [ main::$4 ] +Uplifting [sum] best 942 combination reg byte x [ sum::b#0 ] zp ZP_BYTE:7 [ sum::c#0 ] zp ZP_BYTE:5 [ sum::a#0 ] reg byte a [ sum::return#0 ] reg byte a [ sum::$0 ] +Uplifting [sum2] best 872 combination reg byte x [ sum2::b#0 ] zp ZP_BYTE:13 [ sum2::c#0 ] zp ZP_BYTE:11 [ sum2::a#0 ] reg byte a [ sum2::return#0 ] reg byte a [ sum2::$0 ] +Uplifting [] best 872 combination +Attempting to uplift remaining variables inzp ZP_BYTE:7 [ sum::c#0 ] +Uplifting [sum] best 872 combination zp ZP_BYTE:7 [ sum::c#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:13 [ sum2::c#0 ] +Uplifting [sum2] best 872 combination zp ZP_BYTE:13 [ sum2::c#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:5 [ sum::a#0 ] +Uplifting [sum] best 872 combination zp ZP_BYTE:5 [ sum::a#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:11 [ sum2::a#0 ] +Uplifting [sum2] best 872 combination zp ZP_BYTE:11 [ sum2::a#0 ] +Coalescing zero page register [ zp ZP_BYTE:5 [ sum::a#0 ] ] with [ zp ZP_BYTE:11 [ sum2::a#0 ] ] Coalescing zero page register [ zp ZP_BYTE:7 [ sum::c#0 ] ] with [ zp ZP_BYTE:13 [ sum2::c#0 ] ] -Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:2 [ sum::c#0 sum2::c#0 ] +Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:2 [ sum::a#0 sum2::a#0 ] +Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:3 [ sum::c#0 sum2::c#0 ] Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp b3 @@ -1647,109 +1605,112 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main +main_from_bbegin: jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- yby=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- yby=coby1 ldy #$0 jmp b1 - //SEG7 [1] phi from main::@4 to main::@1 + //SEG8 [2] phi from main::@4 to main::@1 b1_from_b4: - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] -- xby=yby_plus_1 + //SEG11 [3] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] -- xby=yby_plus_1 tya tax inx - //SEG11 [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] -- aby=yby_plus_coby1 + //SEG12 [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] -- aby=yby_plus_coby1 tya clc adc #$2 - //SEG12 [4] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] - // (byte) sum::a#0 = (byte) main::i#2 // register copy reg byte y - //SEG13 [5] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] + //SEG13 [5] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] -- zpby1=yby + sty sum.a + //SEG14 [6] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] // (byte) sum::b#0 = (byte~) main::$0 // register copy reg byte x - //SEG14 [6] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 ] -- zpby1=aby + //SEG15 [7] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 sum::c#0 ] -- zpby1=aby sta sum.c - //SEG15 [7] call sum param-assignment [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + //SEG16 [8] call sum param-assignment [ main::i#2 sum::return#0 ] jsr sum - //SEG16 main::@3 + //SEG17 main::@3 b3: - //SEG17 [8] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] + //SEG18 [9] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] // (byte~) main::$2 = (byte) sum::return#0 // register copy reg byte a - //SEG18 [9] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] -- cowo1_staridx_yby=aby + //SEG19 [10] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] -- cowo1_staridx_yby=aby sta $400,y - //SEG19 [10] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] -- xby=yby_plus_1 + //SEG20 [11] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] -- xby=yby_plus_1 tya tax inx - //SEG20 [11] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] -- aby=yby_plus_coby1 + //SEG21 [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] -- aby=yby_plus_coby1 tya clc adc #$2 - //SEG21 [12] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] - // (byte) sum2::a#0 = (byte) main::i#2 // register copy reg byte y - //SEG22 [13] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] + //SEG22 [13] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] -- zpby1=yby + sty sum2.a + //SEG23 [14] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] // (byte) sum2::b#0 = (byte~) main::$3 // register copy reg byte x - //SEG23 [14] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 ] -- zpby1=aby + //SEG24 [15] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 sum2::c#0 ] -- zpby1=aby sta sum2.c - //SEG24 [15] call sum2 param-assignment [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + //SEG25 [16] call sum2 param-assignment [ main::i#2 sum2::return#0 ] jsr sum2 - //SEG25 main::@4 + //SEG26 main::@4 b4: - //SEG26 [16] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] + //SEG27 [17] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] // (byte~) main::$5 = (byte) sum2::return#0 // register copy reg byte a - //SEG27 [17] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] -- cowo1_staridx_yby=aby + //SEG28 [18] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] -- cowo1_staridx_yby=aby sta $428,y - //SEG28 [18] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- yby=_inc_yby + //SEG29 [19] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- yby=_inc_yby iny - //SEG29 [19] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] -- yby_neq_coby1_then_la1 + //SEG30 [20] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] -- yby_neq_coby1_then_la1 cpy #$b bne b1_from_b4 - //SEG30 main::@return + //SEG31 main::@return breturn: - //SEG31 [20] return [ ] + //SEG32 [21] return [ ] rts } -//SEG32 sum2 +//SEG33 sum2 sum2: { - .label c = 2 - //SEG33 [21] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ main::i#2 sum2::a#0 sum2::b#0 sum2::$0 sum2::c#0 ] -- aby=yby_plus_xby - sty $ff + .label a = 2 + .label c = 3 + //SEG34 [22] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ sum2::c#0 sum2::$0 ] -- aby=zpby1_plus_xby txa clc - adc $ff - //SEG34 [22] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] -- aby=aby_plus_zpby1 + adc a + //SEG35 [23] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ sum2::return#0 ] -- aby=aby_plus_zpby1 clc adc c - //SEG35 sum2::@return + //SEG36 sum2::@return breturn: - //SEG36 [23] return [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + //SEG37 [24] return [ sum2::return#0 ] rts } -//SEG37 sum +//SEG38 sum sum: { - .label c = 2 - //SEG38 [24] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ main::i#2 sum::a#0 sum::b#0 sum::$0 sum::c#0 ] -- aby=yby_plus_xby - sty $ff + .label a = 2 + .label c = 3 + //SEG39 [25] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ sum::c#0 sum::$0 ] -- aby=zpby1_plus_xby txa clc - adc $ff - //SEG39 [25] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] -- aby=aby_plus_zpby1 + adc a + //SEG40 [26] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ sum::return#0 ] -- aby=aby_plus_zpby1 clc adc c - //SEG40 sum::@return + //SEG41 sum::@return breturn: - //SEG41 [26] return [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + //SEG42 [27] return [ sum::return#0 ] rts } Replacing label b1_from_b4 with b1 +Removing instruction main_from_bbegin: Removing instruction b1_from_b4: Succesful ASM optimization Pass5RedundantLabelElimination ASSEMBLER @@ -1757,104 +1718,105 @@ ASSEMBLER //SEG1 @begin bbegin: //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end +//SEG4 @end bend: -//SEG4 main +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 + //SEG6 [2] phi from main to main::@1 b1_from_main: - //SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- yby=coby1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- yby=coby1 ldy #$0 jmp b1 - //SEG7 [1] phi from main::@4 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@4 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] -- xby=yby_plus_1 + //SEG11 [3] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] -- xby=yby_plus_1 tya tax inx - //SEG11 [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] -- aby=yby_plus_coby1 + //SEG12 [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] -- aby=yby_plus_coby1 tya clc adc #$2 - //SEG12 [4] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] - // (byte) sum::a#0 = (byte) main::i#2 // register copy reg byte y - //SEG13 [5] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] + //SEG13 [5] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] -- zpby1=yby + sty sum.a + //SEG14 [6] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] // (byte) sum::b#0 = (byte~) main::$0 // register copy reg byte x - //SEG14 [6] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 ] -- zpby1=aby + //SEG15 [7] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 sum::c#0 ] -- zpby1=aby sta sum.c - //SEG15 [7] call sum param-assignment [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + //SEG16 [8] call sum param-assignment [ main::i#2 sum::return#0 ] jsr sum - //SEG16 main::@3 + //SEG17 main::@3 b3: - //SEG17 [8] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] + //SEG18 [9] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] // (byte~) main::$2 = (byte) sum::return#0 // register copy reg byte a - //SEG18 [9] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] -- cowo1_staridx_yby=aby + //SEG19 [10] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] -- cowo1_staridx_yby=aby sta $400,y - //SEG19 [10] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] -- xby=yby_plus_1 + //SEG20 [11] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] -- xby=yby_plus_1 tya tax inx - //SEG20 [11] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] -- aby=yby_plus_coby1 + //SEG21 [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] -- aby=yby_plus_coby1 tya clc adc #$2 - //SEG21 [12] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] - // (byte) sum2::a#0 = (byte) main::i#2 // register copy reg byte y - //SEG22 [13] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] + //SEG22 [13] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] -- zpby1=yby + sty sum2.a + //SEG23 [14] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] // (byte) sum2::b#0 = (byte~) main::$3 // register copy reg byte x - //SEG23 [14] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 ] -- zpby1=aby + //SEG24 [15] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 sum2::c#0 ] -- zpby1=aby sta sum2.c - //SEG24 [15] call sum2 param-assignment [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + //SEG25 [16] call sum2 param-assignment [ main::i#2 sum2::return#0 ] jsr sum2 - //SEG25 main::@4 + //SEG26 main::@4 b4: - //SEG26 [16] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] + //SEG27 [17] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] // (byte~) main::$5 = (byte) sum2::return#0 // register copy reg byte a - //SEG27 [17] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] -- cowo1_staridx_yby=aby + //SEG28 [18] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] -- cowo1_staridx_yby=aby sta $428,y - //SEG28 [18] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- yby=_inc_yby + //SEG29 [19] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- yby=_inc_yby iny - //SEG29 [19] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] -- yby_neq_coby1_then_la1 + //SEG30 [20] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] -- yby_neq_coby1_then_la1 cpy #$b bne b1 - //SEG30 main::@return + //SEG31 main::@return breturn: - //SEG31 [20] return [ ] + //SEG32 [21] return [ ] rts } -//SEG32 sum2 +//SEG33 sum2 sum2: { - .label c = 2 - //SEG33 [21] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ main::i#2 sum2::a#0 sum2::b#0 sum2::$0 sum2::c#0 ] -- aby=yby_plus_xby - sty $ff + .label a = 2 + .label c = 3 + //SEG34 [22] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ sum2::c#0 sum2::$0 ] -- aby=zpby1_plus_xby txa clc - adc $ff - //SEG34 [22] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] -- aby=aby_plus_zpby1 + adc a + //SEG35 [23] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ sum2::return#0 ] -- aby=aby_plus_zpby1 clc adc c - //SEG35 sum2::@return + //SEG36 sum2::@return breturn: - //SEG36 [23] return [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + //SEG37 [24] return [ sum2::return#0 ] rts } -//SEG37 sum +//SEG38 sum sum: { - .label c = 2 - //SEG38 [24] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ main::i#2 sum::a#0 sum::b#0 sum::$0 sum::c#0 ] -- aby=yby_plus_xby - sty $ff + .label a = 2 + .label c = 3 + //SEG39 [25] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ sum::c#0 sum::$0 ] -- aby=zpby1_plus_xby txa clc - adc $ff - //SEG39 [25] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] -- aby=aby_plus_zpby1 + adc a + //SEG40 [26] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ sum::return#0 ] -- aby=aby_plus_zpby1 clc adc c - //SEG40 sum::@return + //SEG41 sum::@return breturn: - //SEG41 [26] return [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + //SEG42 [27] return [ sum::return#0 ] rts } @@ -1871,97 +1833,98 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- yby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- yby=coby1 ldy #$0 jmp b1 - //SEG7 [1] phi from main::@4 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@4 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] -- xby=yby_plus_1 + //SEG11 [3] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] -- xby=yby_plus_1 tya tax inx - //SEG11 [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] -- aby=yby_plus_coby1 + //SEG12 [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] -- aby=yby_plus_coby1 tya clc adc #$2 - //SEG12 [4] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] - // (byte) sum::a#0 = (byte) main::i#2 // register copy reg byte y - //SEG13 [5] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] + //SEG13 [5] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] -- zpby1=yby + sty sum.a + //SEG14 [6] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] // (byte) sum::b#0 = (byte~) main::$0 // register copy reg byte x - //SEG14 [6] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 ] -- zpby1=aby + //SEG15 [7] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 sum::c#0 ] -- zpby1=aby sta sum.c - //SEG15 [7] call sum param-assignment [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + //SEG16 [8] call sum param-assignment [ main::i#2 sum::return#0 ] jsr sum - //SEG16 main::@3 - //SEG17 [8] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] + //SEG17 main::@3 + //SEG18 [9] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] // (byte~) main::$2 = (byte) sum::return#0 // register copy reg byte a - //SEG18 [9] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] -- cowo1_staridx_yby=aby + //SEG19 [10] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] -- cowo1_staridx_yby=aby sta $400,y - //SEG19 [10] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] -- xby=yby_plus_1 + //SEG20 [11] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] -- xby=yby_plus_1 tya tax inx - //SEG20 [11] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] -- aby=yby_plus_coby1 + //SEG21 [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] -- aby=yby_plus_coby1 tya clc adc #$2 - //SEG21 [12] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] - // (byte) sum2::a#0 = (byte) main::i#2 // register copy reg byte y - //SEG22 [13] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] + //SEG22 [13] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] -- zpby1=yby + sty sum2.a + //SEG23 [14] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] // (byte) sum2::b#0 = (byte~) main::$3 // register copy reg byte x - //SEG23 [14] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 ] -- zpby1=aby + //SEG24 [15] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 sum2::c#0 ] -- zpby1=aby sta sum2.c - //SEG24 [15] call sum2 param-assignment [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + //SEG25 [16] call sum2 param-assignment [ main::i#2 sum2::return#0 ] jsr sum2 - //SEG25 main::@4 - //SEG26 [16] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] + //SEG26 main::@4 + //SEG27 [17] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] // (byte~) main::$5 = (byte) sum2::return#0 // register copy reg byte a - //SEG27 [17] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] -- cowo1_staridx_yby=aby + //SEG28 [18] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] -- cowo1_staridx_yby=aby sta $428,y - //SEG28 [18] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- yby=_inc_yby + //SEG29 [19] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- yby=_inc_yby iny - //SEG29 [19] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] -- yby_neq_coby1_then_la1 + //SEG30 [20] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] -- yby_neq_coby1_then_la1 cpy #$b bne b1 - //SEG30 main::@return - //SEG31 [20] return [ ] + //SEG31 main::@return + //SEG32 [21] return [ ] rts } -//SEG32 sum2 +//SEG33 sum2 sum2: { - .label c = 2 - //SEG33 [21] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ main::i#2 sum2::a#0 sum2::b#0 sum2::$0 sum2::c#0 ] -- aby=yby_plus_xby - sty $ff + .label a = 2 + .label c = 3 + //SEG34 [22] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ sum2::c#0 sum2::$0 ] -- aby=zpby1_plus_xby txa clc - adc $ff - //SEG34 [22] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] -- aby=aby_plus_zpby1 + adc a + //SEG35 [23] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ sum2::return#0 ] -- aby=aby_plus_zpby1 clc adc c - //SEG35 sum2::@return - //SEG36 [23] return [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + //SEG36 sum2::@return + //SEG37 [24] return [ sum2::return#0 ] rts } -//SEG37 sum +//SEG38 sum sum: { - .label c = 2 - //SEG38 [24] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ main::i#2 sum::a#0 sum::b#0 sum::$0 sum::c#0 ] -- aby=yby_plus_xby - sty $ff + .label a = 2 + .label c = 3 + //SEG39 [25] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ sum::c#0 sum::$0 ] -- aby=zpby1_plus_xby txa clc - adc $ff - //SEG39 [25] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] -- aby=aby_plus_zpby1 + adc a + //SEG40 [26] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ sum::return#0 ] -- aby=aby_plus_zpby1 clc adc c - //SEG40 sum::@return - //SEG41 [26] return [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + //SEG41 sum::@return + //SEG42 [27] return [ sum::return#0 ] rts } @@ -1971,96 +1934,97 @@ ASSEMBLER //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- yby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG7 [1] phi from main::@4 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@4 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] -- xby=yby_plus_1 + //SEG11 [3] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] -- xby=yby_plus_1 tya tax inx - //SEG11 [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] -- aby=yby_plus_coby1 + //SEG12 [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] -- aby=yby_plus_coby1 tya clc adc #$2 - //SEG12 [4] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] - // (byte) sum::a#0 = (byte) main::i#2 // register copy reg byte y - //SEG13 [5] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] + //SEG13 [5] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] -- zpby1=yby + sty sum.a + //SEG14 [6] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] // (byte) sum::b#0 = (byte~) main::$0 // register copy reg byte x - //SEG14 [6] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 ] -- zpby1=aby + //SEG15 [7] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 sum::c#0 ] -- zpby1=aby sta sum.c - //SEG15 [7] call sum param-assignment [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + //SEG16 [8] call sum param-assignment [ main::i#2 sum::return#0 ] jsr sum - //SEG16 main::@3 - //SEG17 [8] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] + //SEG17 main::@3 + //SEG18 [9] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] // (byte~) main::$2 = (byte) sum::return#0 // register copy reg byte a - //SEG18 [9] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] -- cowo1_staridx_yby=aby + //SEG19 [10] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] -- cowo1_staridx_yby=aby sta $400,y - //SEG19 [10] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] -- xby=yby_plus_1 + //SEG20 [11] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] -- xby=yby_plus_1 tya tax inx - //SEG20 [11] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] -- aby=yby_plus_coby1 + //SEG21 [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] -- aby=yby_plus_coby1 tya clc adc #$2 - //SEG21 [12] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] - // (byte) sum2::a#0 = (byte) main::i#2 // register copy reg byte y - //SEG22 [13] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] + //SEG22 [13] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] -- zpby1=yby + sty sum2.a + //SEG23 [14] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] // (byte) sum2::b#0 = (byte~) main::$3 // register copy reg byte x - //SEG23 [14] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 ] -- zpby1=aby + //SEG24 [15] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 sum2::c#0 ] -- zpby1=aby sta sum2.c - //SEG24 [15] call sum2 param-assignment [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + //SEG25 [16] call sum2 param-assignment [ main::i#2 sum2::return#0 ] jsr sum2 - //SEG25 main::@4 - //SEG26 [16] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] + //SEG26 main::@4 + //SEG27 [17] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] // (byte~) main::$5 = (byte) sum2::return#0 // register copy reg byte a - //SEG27 [17] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] -- cowo1_staridx_yby=aby + //SEG28 [18] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] -- cowo1_staridx_yby=aby sta $428,y - //SEG28 [18] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- yby=_inc_yby + //SEG29 [19] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- yby=_inc_yby iny - //SEG29 [19] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] -- yby_neq_coby1_then_la1 + //SEG30 [20] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] -- yby_neq_coby1_then_la1 cpy #$b bne b1 - //SEG30 main::@return - //SEG31 [20] return [ ] + //SEG31 main::@return + //SEG32 [21] return [ ] rts } -//SEG32 sum2 +//SEG33 sum2 sum2: { - .label c = 2 - //SEG33 [21] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ main::i#2 sum2::a#0 sum2::b#0 sum2::$0 sum2::c#0 ] -- aby=yby_plus_xby - sty $ff + .label a = 2 + .label c = 3 + //SEG34 [22] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ sum2::c#0 sum2::$0 ] -- aby=zpby1_plus_xby txa clc - adc $ff - //SEG34 [22] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] -- aby=aby_plus_zpby1 + adc a + //SEG35 [23] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ sum2::return#0 ] -- aby=aby_plus_zpby1 clc adc c - //SEG35 sum2::@return - //SEG36 [23] return [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + //SEG36 sum2::@return + //SEG37 [24] return [ sum2::return#0 ] rts } -//SEG37 sum +//SEG38 sum sum: { - .label c = 2 - //SEG38 [24] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ main::i#2 sum::a#0 sum::b#0 sum::$0 sum::c#0 ] -- aby=yby_plus_xby - sty $ff + .label a = 2 + .label c = 3 + //SEG39 [25] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ sum::c#0 sum::$0 ] -- aby=zpby1_plus_xby txa clc - adc $ff - //SEG39 [25] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] -- aby=aby_plus_zpby1 + adc a + //SEG40 [26] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ sum::return#0 ] -- aby=aby_plus_zpby1 clc adc c - //SEG40 sum::@return - //SEG41 [26] return [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + //SEG41 sum::@return + //SEG42 [27] return [ sum::return#0 ] rts } @@ -2082,40 +2046,39 @@ FINAL SYMBOL TABLE (label) main::@return (byte) main::i (byte) main::i#1 reg byte y 16.5 -(byte) main::i#2 reg byte y 4.782608695652174 +(byte) main::i#2 reg byte y 6.470588235294119 (byte()) sum((byte) sum::a , (byte) sum::b , (byte) sum::c) (byte~) sum::$0 reg byte a 4.0 (label) sum::@return (byte) sum::a -(byte) sum::a#0 reg byte y 1.8571428571428572 +(byte) sum::a#0 a zp ZP_BYTE:2 4.333333333333333 (byte) sum::b -(byte) sum::b#0 reg byte x 2.1666666666666665 +(byte) sum::b#0 reg byte x 6.5 (byte) sum::c -(byte) sum::c#0 c zp ZP_BYTE:2 13.0 +(byte) sum::c#0 c zp ZP_BYTE:3 6.5 (byte) sum::return (byte) sum::return#0 reg byte a 4.333333333333333 (byte()) sum2((byte) sum2::a , (byte) sum2::b , (byte) sum2::c) (byte~) sum2::$0 reg byte a 4.0 (label) sum2::@return (byte) sum2::a -(byte) sum2::a#0 reg byte y 1.8571428571428572 +(byte) sum2::a#0 a zp ZP_BYTE:2 4.333333333333333 (byte) sum2::b -(byte) sum2::b#0 reg byte x 2.1666666666666665 +(byte) sum2::b#0 reg byte x 6.5 (byte) sum2::c -(byte) sum2::c#0 c zp ZP_BYTE:2 13.0 +(byte) sum2::c#0 c zp ZP_BYTE:3 6.5 (byte) sum2::return (byte) sum2::return#0 reg byte a 4.333333333333333 reg byte y [ main::i#2 main::i#1 ] reg byte x [ main::$0 ] reg byte a [ main::$1 ] -reg byte y [ sum::a#0 ] +zp ZP_BYTE:2 [ sum::a#0 sum2::a#0 ] reg byte x [ sum::b#0 ] -zp ZP_BYTE:2 [ sum::c#0 sum2::c#0 ] +zp ZP_BYTE:3 [ sum::c#0 sum2::c#0 ] reg byte a [ main::$2 ] reg byte x [ main::$3 ] reg byte a [ main::$4 ] -reg byte y [ sum2::a#0 ] reg byte x [ sum2::b#0 ] reg byte a [ main::$5 ] reg byte a [ sum2::$0 ] @@ -2127,96 +2090,97 @@ FINAL CODE //SEG0 Global ZP labels //SEG1 @begin //SEG2 [0] call main param-assignment [ ] +//SEG3 [1] phi from @begin to main jsr main -//SEG3 @end -//SEG4 main +//SEG4 @end +//SEG5 main main: { - //SEG5 [1] phi from main to main::@1 - //SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- yby=coby1 + //SEG6 [2] phi from main to main::@1 + //SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- yby=coby1 ldy #$0 - //SEG7 [1] phi from main::@4 to main::@1 - //SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - //SEG9 main::@1 + //SEG8 [2] phi from main::@4 to main::@1 + //SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + //SEG10 main::@1 b1: - //SEG10 [2] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] -- xby=yby_plus_1 + //SEG11 [3] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ] -- xby=yby_plus_1 tya tax inx - //SEG11 [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] -- aby=yby_plus_coby1 + //SEG12 [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] -- aby=yby_plus_coby1 tya clc adc #$2 - //SEG12 [4] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] - // (byte) sum::a#0 = (byte) main::i#2 // register copy reg byte y - //SEG13 [5] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] + //SEG13 [5] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ] -- zpby1=yby + sty sum.a + //SEG14 [6] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ] // (byte) sum::b#0 = (byte~) main::$0 // register copy reg byte x - //SEG14 [6] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 ] -- zpby1=aby + //SEG15 [7] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 sum::c#0 ] -- zpby1=aby sta sum.c - //SEG15 [7] call sum param-assignment [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + //SEG16 [8] call sum param-assignment [ main::i#2 sum::return#0 ] jsr sum - //SEG16 main::@3 - //SEG17 [8] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] + //SEG17 main::@3 + //SEG18 [9] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ] // (byte~) main::$2 = (byte) sum::return#0 // register copy reg byte a - //SEG18 [9] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] -- cowo1_staridx_yby=aby + //SEG19 [10] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ] -- cowo1_staridx_yby=aby sta $400,y - //SEG19 [10] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] -- xby=yby_plus_1 + //SEG20 [11] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ] -- xby=yby_plus_1 tya tax inx - //SEG20 [11] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] -- aby=yby_plus_coby1 + //SEG21 [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] -- aby=yby_plus_coby1 tya clc adc #$2 - //SEG21 [12] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] - // (byte) sum2::a#0 = (byte) main::i#2 // register copy reg byte y - //SEG22 [13] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] + //SEG22 [13] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ] -- zpby1=yby + sty sum2.a + //SEG23 [14] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ] // (byte) sum2::b#0 = (byte~) main::$3 // register copy reg byte x - //SEG23 [14] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 ] -- zpby1=aby + //SEG24 [15] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 sum2::c#0 ] -- zpby1=aby sta sum2.c - //SEG24 [15] call sum2 param-assignment [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + //SEG25 [16] call sum2 param-assignment [ main::i#2 sum2::return#0 ] jsr sum2 - //SEG25 main::@4 - //SEG26 [16] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] + //SEG26 main::@4 + //SEG27 [17] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ] // (byte~) main::$5 = (byte) sum2::return#0 // register copy reg byte a - //SEG27 [17] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] -- cowo1_staridx_yby=aby + //SEG28 [18] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ] -- cowo1_staridx_yby=aby sta $428,y - //SEG28 [18] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- yby=_inc_yby + //SEG29 [19] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- yby=_inc_yby iny - //SEG29 [19] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] -- yby_neq_coby1_then_la1 + //SEG30 [20] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ] -- yby_neq_coby1_then_la1 cpy #$b bne b1 - //SEG30 main::@return - //SEG31 [20] return [ ] + //SEG31 main::@return + //SEG32 [21] return [ ] rts } -//SEG32 sum2 +//SEG33 sum2 sum2: { - .label c = 2 - //SEG33 [21] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ main::i#2 sum2::a#0 sum2::b#0 sum2::$0 sum2::c#0 ] -- aby=yby_plus_xby - sty $ff + .label a = 2 + .label c = 3 + //SEG34 [22] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ sum2::c#0 sum2::$0 ] -- aby=zpby1_plus_xby txa clc - adc $ff - //SEG34 [22] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] -- aby=aby_plus_zpby1 + adc a + //SEG35 [23] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ sum2::return#0 ] -- aby=aby_plus_zpby1 clc adc c - //SEG35 sum2::@return - //SEG36 [23] return [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ] + //SEG36 sum2::@return + //SEG37 [24] return [ sum2::return#0 ] rts } -//SEG37 sum +//SEG38 sum sum: { - .label c = 2 - //SEG38 [24] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ main::i#2 sum::a#0 sum::b#0 sum::$0 sum::c#0 ] -- aby=yby_plus_xby - sty $ff + .label a = 2 + .label c = 3 + //SEG39 [25] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ sum::c#0 sum::$0 ] -- aby=zpby1_plus_xby txa clc - adc $ff - //SEG39 [25] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] -- aby=aby_plus_zpby1 + adc a + //SEG40 [26] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ sum::return#0 ] -- aby=aby_plus_zpby1 clc adc c - //SEG40 sum::@return - //SEG41 [26] return [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ] + //SEG41 sum::@return + //SEG42 [27] return [ sum::return#0 ] rts } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.sym b/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.sym index e72590e12..167854176 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.sym @@ -15,40 +15,39 @@ (label) main::@return (byte) main::i (byte) main::i#1 reg byte y 16.5 -(byte) main::i#2 reg byte y 4.782608695652174 +(byte) main::i#2 reg byte y 6.470588235294119 (byte()) sum((byte) sum::a , (byte) sum::b , (byte) sum::c) (byte~) sum::$0 reg byte a 4.0 (label) sum::@return (byte) sum::a -(byte) sum::a#0 reg byte y 1.8571428571428572 +(byte) sum::a#0 a zp ZP_BYTE:2 4.333333333333333 (byte) sum::b -(byte) sum::b#0 reg byte x 2.1666666666666665 +(byte) sum::b#0 reg byte x 6.5 (byte) sum::c -(byte) sum::c#0 c zp ZP_BYTE:2 13.0 +(byte) sum::c#0 c zp ZP_BYTE:3 6.5 (byte) sum::return (byte) sum::return#0 reg byte a 4.333333333333333 (byte()) sum2((byte) sum2::a , (byte) sum2::b , (byte) sum2::c) (byte~) sum2::$0 reg byte a 4.0 (label) sum2::@return (byte) sum2::a -(byte) sum2::a#0 reg byte y 1.8571428571428572 +(byte) sum2::a#0 a zp ZP_BYTE:2 4.333333333333333 (byte) sum2::b -(byte) sum2::b#0 reg byte x 2.1666666666666665 +(byte) sum2::b#0 reg byte x 6.5 (byte) sum2::c -(byte) sum2::c#0 c zp ZP_BYTE:2 13.0 +(byte) sum2::c#0 c zp ZP_BYTE:3 6.5 (byte) sum2::return (byte) sum2::return#0 reg byte a 4.333333333333333 reg byte y [ main::i#2 main::i#1 ] reg byte x [ main::$0 ] reg byte a [ main::$1 ] -reg byte y [ sum::a#0 ] +zp ZP_BYTE:2 [ sum::a#0 sum2::a#0 ] reg byte x [ sum::b#0 ] -zp ZP_BYTE:2 [ sum::c#0 sum2::c#0 ] +zp ZP_BYTE:3 [ sum::c#0 sum2::c#0 ] reg byte a [ main::$2 ] reg byte x [ main::$3 ] reg byte a [ main::$4 ] -reg byte y [ sum2::a#0 ] reg byte x [ sum2::b#0 ] reg byte a [ main::$5 ] reg byte a [ sum2::$0 ]