diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index fe299e48b..eb17d79f0 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -81,6 +81,7 @@ public class Compiler { new Pass1ExtractInlineStrings(program).execute(); new Pass1EliminateUncalledProcedures(program).execute(); new Pass1EliminateUnusedVars(program).execute(); + new Pass1EliminateEmptyBlocks(program).execute(); log.append("CONTROL FLOW GRAPH"); log.append(program.getGraph().toString(program)); diff --git a/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java b/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java index d9b7d5cab..bd250a55e 100644 --- a/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java +++ b/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java @@ -9,6 +9,9 @@ import java.util.Map; /** Cached information about which variables are defined/referenced/used in statements / blocks. */ public class VariableReferenceInfos { + /** The congtaining program. */ + private Program program; + /** Variables referenced in each block. */ private Map> blockReferenced; @@ -21,14 +24,27 @@ public class VariableReferenceInfos { /** Variables defined in each statement. */ private Map> stmtDefined; + /** The statement defining each variable. */ + private Map varDefinitions; + + /** All statements referencing each variable . */ + private Map> varReferences; + public VariableReferenceInfos( Map> blockReferenced, Map> blockUsed, - Map> stmtReferenced, Map> stmtDefined) { + Map> stmtReferenced, + Map> stmtDefined, + Map varDefinitions, + Map> varReferences + + ) { this.blockReferenced = blockReferenced; this.blockUsed = blockUsed; this.stmtDefined = stmtDefined; this.stmtReferenced = stmtReferenced; + this.varDefinitions = varDefinitions; + this.varReferences = varReferences; } /** @@ -79,7 +95,6 @@ public class VariableReferenceInfos { return used; } - /** * Get all variables referenced in an rValue * @param rValue The rValue @@ -89,4 +104,15 @@ public class VariableReferenceInfos { return Pass3VariableReferenceInfos.getReferenced(rValue); } + /** + * Determines if a variable is unused + * @return true if the variable is defined but never referenced + */ + public boolean isUnused(VariableRef variableRef) { + Collection refs = new LinkedHashSet<>(varReferences.get(variableRef)); + refs.remove(varDefinitions.get(variableRef)); + return refs.size()==0; + } + + } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1EliminateUnusedVars.java b/src/main/java/dk/camelot64/kickc/passes/Pass1EliminateUnusedVars.java index 72a278641..486dcc362 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass1EliminateUnusedVars.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass1EliminateUnusedVars.java @@ -14,8 +14,11 @@ public class Pass1EliminateUnusedVars extends Pass1Base { } @Override - boolean executeStep() { - Collection allUsedVars = getAllVarUsage(); + public boolean executeStep() { + new Pass3StatementIndices(getProgram()).generateStatementIndices(); + new Pass3VariableReferenceInfos(getProgram()).generateVariableReferenceInfos(); + + VariableReferenceInfos referenceInfos = getProgram().getVariableReferenceInfos(); boolean modified = false; for (ControlFlowBlock block : getGraph().getAllBlocks()) { @@ -25,7 +28,7 @@ public class Pass1EliminateUnusedVars extends Pass1Base { if (statement instanceof StatementAssignment) { StatementAssignment assignment = (StatementAssignment) statement; LValue lValue = assignment.getlValue(); - if (lValue instanceof VariableRef && !allUsedVars.contains(lValue)) { + if (lValue instanceof VariableRef && referenceInfos.isUnused((VariableRef) lValue)) { getLog().append("Eliminating unused variable "+ lValue.toString(getProgram()) + " and assignment "+ assignment.toString(getProgram(), false)); stmtIt.remove(); Variable variable = getScope().getVariable((VariableRef) lValue); @@ -35,7 +38,7 @@ public class Pass1EliminateUnusedVars extends Pass1Base { } else if(statement instanceof StatementCall) { StatementCall call = (StatementCall) statement; LValue lValue = call.getlValue(); - if(lValue instanceof VariableRef && !allUsedVars.contains(lValue)) { + if(lValue instanceof VariableRef && referenceInfos.isUnused((VariableRef) lValue)) { getLog().append("Eliminating unused variable - keeping the call "+ lValue.toString(getProgram())); Variable variable = getScope().getVariable((VariableRef) lValue); variable.getScope().remove(variable); @@ -45,87 +48,12 @@ public class Pass1EliminateUnusedVars extends Pass1Base { } } } + + getProgram().setVariableReferenceInfos(null); + new Pass3StatementIndices(getProgram()).clearStatementIndices(); + return modified; } - /** - * Get all Variable or Constant usage in RValues. - * - * @return Collection containing VariableRef and ConstantRef for all used vars/constants. - */ - private Collection getAllVarUsage() { - Collection allRvalues = new LinkedHashSet<>(); - for (ControlFlowBlock block : getGraph().getAllBlocks()) { - for (Statement statement : block.getStatements()) { - if (statement instanceof StatementAssignment) { - addLvalueUses(allRvalues, ((StatementAssignment) statement).getlValue()); - addRvalueUses(allRvalues, ((StatementAssignment) statement).getrValue1()); - addRvalueUses(allRvalues, ((StatementAssignment) statement).getrValue2()); - } else if (statement instanceof StatementCall) { - addLvalueUses(allRvalues, ((StatementCall) statement).getlValue()); - for (RValue param : ((StatementCall) statement).getParameters()) { - addRvalueUses(allRvalues, param); - } - } else if (statement instanceof StatementConditionalJump) { - addRvalueUses(allRvalues, ((StatementConditionalJump) statement).getrValue1()); - addRvalueUses(allRvalues, ((StatementConditionalJump) statement).getrValue2()); - } else if (statement instanceof StatementReturn) { - addRvalueUses(allRvalues, ((StatementReturn) statement).getValue()); - } else if (statement instanceof StatementPhiBlock) { - for (StatementPhiBlock.PhiVariable phiVariable : ((StatementPhiBlock) statement).getPhiVariables()) { - addLvalueUses(allRvalues, phiVariable.getVariable()); - for (StatementPhiBlock.PhiRValue phiRValue : phiVariable.getValues()) { - addRvalueUses(allRvalues, phiRValue.getrValue()); - } - } - } - } - } - return allRvalues; - } - - private void addLvalueUses(Collection allUses, LValue lValue) { - if (lValue == null) { - return; - } else if (lValue instanceof VariableRef) { - return; - } else if (lValue instanceof LvalueLoHiByte) { - addRvalueUses(allUses, ((LvalueLoHiByte) lValue).getVariable()); - } else if (lValue instanceof PointerDereferenceSimple) { - addRvalueUses(allUses, ((PointerDereference) lValue).getPointer()); - } else if (lValue instanceof PointerDereferenceIndexed) { - addRvalueUses(allUses, ((PointerDereferenceIndexed) lValue).getPointer()); - addRvalueUses(allUses, ((PointerDereferenceIndexed) lValue).getIndex()); - } else { - throw new RuntimeException("Unknown LValue type " + lValue); - } - } - - private void addRvalueUses(Collection allUses, RValue rValue) { - if (rValue == null) { - return; - } else if (rValue instanceof VariableRef || rValue instanceof ConstantRef) { - allUses.add(rValue); - } else if (rValue instanceof LValue) { - addLvalueUses(allUses, (LValue) rValue); - } else if (rValue instanceof ConstantString || rValue instanceof ConstantInteger || rValue instanceof ConstantBool || rValue instanceof ConstantChar || rValue instanceof ConstantDouble) { - return; - } else if (rValue instanceof ConstantArray) { - for (ConstantValue constantValue : ((ConstantArray) rValue).getElements()) { - addRvalueUses(allUses, constantValue); - } - } else if (rValue instanceof ValueArray) { - for (RValue value : ((ValueArray) rValue).getList()) { - addRvalueUses(allUses, value); - } - } else if (rValue instanceof ConstantUnary) { - addRvalueUses(allUses, ((ConstantUnary) rValue).getOperand()); - } else if (rValue instanceof ConstantBinary) { - addRvalueUses(allUses, ((ConstantBinary) rValue).getLeft()); - addRvalueUses(allUses, ((ConstantBinary) rValue).getRight()); - } else { - throw new RuntimeException("Unknown RValue type " + rValue); - } - } } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3StatementIndices.java b/src/main/java/dk/camelot64/kickc/passes/Pass3StatementIndices.java index 149d427b4..7ca34dc7c 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass3StatementIndices.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3StatementIndices.java @@ -24,5 +24,16 @@ public class Pass3StatementIndices extends Pass2Base { } } + /** + * Clear index numbers for all statements in the control flow graph. + */ + public void clearStatementIndices() { + for (ControlFlowBlock block : getProgram().getGraph().getAllBlocks()) { + for (Statement statement : block.getStatements()) { + statement.setIndex(null); + } + } + } + } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3VariableReferenceInfos.java b/src/main/java/dk/camelot64/kickc/passes/Pass3VariableReferenceInfos.java index 0e8ae3c92..6d31373ec 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass3VariableReferenceInfos.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3VariableReferenceInfos.java @@ -19,16 +19,32 @@ public class Pass3VariableReferenceInfos extends Pass2Base { LinkedHashMap> blockUsed = new LinkedHashMap<>(); LinkedHashMap> stmtReferenced = new LinkedHashMap<>(); LinkedHashMap> stmtDefined = new LinkedHashMap<>(); + LinkedHashMap varDefines = new LinkedHashMap<>(); + LinkedHashMap> varReferences = new LinkedHashMap<>(); for (ControlFlowBlock block : getProgram().getGraph().getAllBlocks()) { LabelRef blockLabel = block.getLabel(); - blockReferenced.put(blockLabel, getReferenced(blockLabel, new ArrayList())); - blockUsed.put(blockLabel, getUsed(blockLabel, new ArrayList())); + blockReferenced.put(blockLabel, getReferenced(blockLabel, new ArrayList<>())); + blockUsed.put(blockLabel, getUsed(blockLabel, new ArrayList<>())); for (Statement statement : block.getStatements()) { - stmtDefined.put(statement.getIndex(), getDefined(statement)); - stmtReferenced.put(statement.getIndex(), getReferenced(statement)); + Collection defined = getDefined(statement); + Collection referenced = getReferenced(statement); + stmtDefined.put(statement.getIndex(), defined); + stmtReferenced.put(statement.getIndex(), referenced); + for (VariableRef variableRef : defined) { + varDefines.put(variableRef, statement.getIndex()); + } + for (VariableRef variableRef : referenced) { + Collection stmts = varReferences.get(variableRef); + if(stmts==null) { + stmts = new LinkedHashSet<>(); + varReferences.put(variableRef, stmts); + } + stmts.add(statement.getIndex()); + } + } } - getProgram().setVariableReferenceInfos(new VariableReferenceInfos(blockReferenced, blockUsed, stmtReferenced, stmtDefined)); + getProgram().setVariableReferenceInfos(new VariableReferenceInfos(blockReferenced, blockUsed, stmtReferenced, stmtDefined, varDefines, varReferences)); } @@ -113,6 +129,12 @@ public class Pass3VariableReferenceInfos extends Pass2Base { defined.add(phiVariable.getVariable()); } return defined; + } else if (stmt instanceof StatementCall) { + List defined = new ArrayList<>(); + if(((StatementCall) stmt).getlValue() instanceof VariableRef) { + defined.add((VariableRef) ((StatementCall) stmt).getlValue()); + } + return defined; } return new ArrayList<>(); } @@ -191,11 +213,16 @@ public class Pass3VariableReferenceInfos extends Pass2Base { return used; } else if (rValue instanceof VariableRef) { return Arrays.asList((VariableRef) rValue); + } else if (rValue instanceof ValueArray) { + LinkedHashSet used = new LinkedHashSet<>(); + for (RValue value : ((ValueArray) rValue).getList()) { + used.addAll(getReferenced(value)); + } + return used; } else { throw new RuntimeException("Unhandled RValue type " + rValue); } } - } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log b/src/main/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log index c9a0665a1..466ef1b6e 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log @@ -1134,13 +1134,13 @@ init_screen::@return: scope:[init_screen] from init_screen::@4 to:@end @end: scope:[] from @10 -Eliminating unused variable (byte*) COLS and assignment (byte*) COLS ← ((byte*)) (word) 55296 -Eliminating unused variable (byte*) SCROLL and assignment (byte*) SCROLL ← ((byte*)) (word) 53270 -Eliminating unused variable (byte) RST8 and assignment (byte) RST8 ← (byte/word/signed word) 128 -Eliminating unused variable (byte) ECM and assignment (byte) ECM ← (byte/signed byte/word/signed word) 64 -Eliminating unused variable (byte*) D016 and assignment (byte*) D016 ← ((byte*)) (word) 53270 -Eliminating unused variable (byte) MCM and assignment (byte) MCM ← (byte/signed byte/word/signed word) 16 -Eliminating unused variable (byte) CSEL and assignment (byte) CSEL ← (byte/signed byte/word/signed word) 8 +Eliminating unused variable (byte*) COLS and assignment [0] (byte*) COLS ← ((byte*)) (word) 55296 +Eliminating unused variable (byte*) SCROLL and assignment [3] (byte*) SCROLL ← ((byte*)) (word) 53270 +Eliminating unused variable (byte) RST8 and assignment [6] (byte) RST8 ← (byte/word/signed word) 128 +Eliminating unused variable (byte) ECM and assignment [7] (byte) ECM ← (byte/signed byte/word/signed word) 64 +Eliminating unused variable (byte*) D016 and assignment [11] (byte*) D016 ← ((byte*)) (word) 53270 +Eliminating unused variable (byte) MCM and assignment [12] (byte) MCM ← (byte/signed byte/word/signed word) 16 +Eliminating unused variable (byte) CSEL and assignment [13] (byte) CSEL ← (byte/signed byte/word/signed word) 8 Eliminating unused variable - keeping the call (void~) main::$3 Eliminating unused variable - keeping the call (void~) main::$4 Eliminating unused variable - keeping the call (void~) main::$5 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log b/src/main/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log index 0c7fe3bb0..6d1bdf1c4 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log @@ -530,12 +530,12 @@ init_screen::@return: scope:[init_screen] from init_screen::@4 to:@end @end: scope:[] from @5 -Eliminating unused variable (byte) RST8 and assignment (byte) RST8 ← (byte/word/signed word) 128 -Eliminating unused variable (byte) ECM and assignment (byte) ECM ← (byte/signed byte/word/signed word) 64 -Eliminating unused variable (byte*) D016 and assignment (byte*) D016 ← ((byte*)) (word) 53270 -Eliminating unused variable (byte) MCM and assignment (byte) MCM ← (byte/signed byte/word/signed word) 16 -Eliminating unused variable (byte) CSEL and assignment (byte) CSEL ← (byte/signed byte/word/signed word) 8 -Eliminating unused variable (byte*) COLS and assignment (byte*) COLS ← ((byte*)) (word) 55296 +Eliminating unused variable (byte) RST8 and assignment [1] (byte) RST8 ← (byte/word/signed word) 128 +Eliminating unused variable (byte) ECM and assignment [2] (byte) ECM ← (byte/signed byte/word/signed word) 64 +Eliminating unused variable (byte*) D016 and assignment [7] (byte*) D016 ← ((byte*)) (word) 53270 +Eliminating unused variable (byte) MCM and assignment [8] (byte) MCM ← (byte/signed byte/word/signed word) 16 +Eliminating unused variable (byte) CSEL and assignment [9] (byte) CSEL ← (byte/signed byte/word/signed word) 8 +Eliminating unused variable (byte*) COLS and assignment [13] (byte*) COLS ← ((byte*)) (word) 55296 Eliminating unused variable - keeping the call (void~) main::$3 Eliminating unused variable - keeping the call (void~) main::$4 Eliminating unused variable - keeping the call (void~) main::$6 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/halfscii.log b/src/main/java/dk/camelot64/kickc/test/ref/halfscii.log index c14a71dba..84a9abac7 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/halfscii.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/halfscii.log @@ -336,7 +336,7 @@ main::@return: scope:[main] from main::@12 to:@end @end: scope:[] from @1 -Eliminating unused variable (byte*) CHARSET and assignment (byte*) CHARSET ← ((byte*)) (word/signed word) 8192 +Eliminating unused variable (byte*) CHARSET and assignment [1] (byte*) CHARSET ← ((byte*)) (word/signed word) 8192 CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ptr-complex.log b/src/main/java/dk/camelot64/kickc/test/ref/ptr-complex.log index 4d7810c17..fffc481c6 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptr-complex.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptr-complex.log @@ -180,14 +180,14 @@ main::@return: scope:[main] from main::@4 to:@end @end: scope:[] from @1 -Eliminating unused variable (byte) main::a and assignment (byte) main::a ← *((byte*~) main::$0) -Eliminating unused variable (byte*~) main::$14 and assignment (byte*~) main::$14 ← ((byte*)) (word) 53280 -Eliminating unused variable (byte*~) main::$15 and assignment (byte*~) main::$15 ← ((byte*)) (word) 53280 -Eliminating unused variable (byte*~) main::$19 and assignment (byte*~) main::$19 ← ((byte*)) (word~) main::$18 -Eliminating unused variable (byte*~) main::$21 and assignment (byte*~) main::$21 ← ((byte*)) (word~) main::$20 -Eliminating unused variable (byte*~) main::$0 and assignment (byte*~) main::$0 ← (byte*) main::screen + (byte/signed byte/word/signed word) 80 -Eliminating unused variable (word~) main::$18 and assignment (word~) main::$18 ← (word) 53248 + (byte/signed byte/word/signed word) 33 -Eliminating unused variable (word~) main::$20 and assignment (word~) main::$20 ← (word) 53248 + (byte/signed byte/word/signed word) 33 +Eliminating unused variable (byte) main::a and assignment [2] (byte) main::a ← *((byte*~) main::$0) +Eliminating unused variable (byte*~) main::$14 and assignment [28] (byte*~) main::$14 ← ((byte*)) (word) 53280 +Eliminating unused variable (byte*~) main::$15 and assignment [29] (byte*~) main::$15 ← ((byte*)) (word) 53280 +Eliminating unused variable (byte*~) main::$19 and assignment [34] (byte*~) main::$19 ← ((byte*)) (word~) main::$18 +Eliminating unused variable (byte*~) main::$21 and assignment [36] (byte*~) main::$21 ← ((byte*)) (word~) main::$20 +Eliminating unused variable (byte*~) main::$0 and assignment [1] (byte*~) main::$0 ← (byte*) main::screen + (byte/signed byte/word/signed word) 80 +Eliminating unused variable (word~) main::$18 and assignment [30] (word~) main::$18 ← (word) 53248 + (byte/signed byte/word/signed word) 33 +Eliminating unused variable (word~) main::$20 and assignment [31] (word~) main::$20 ← (word) 53248 + (byte/signed byte/word/signed word) 33 CONTROL FLOW GRAPH @begin: scope:[] from to:@1 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.asm b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.asm index 08cd2eb27..49f3b3704 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.asm +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.asm @@ -44,8 +44,6 @@ rvaluevar: { bcc b2 rts b2: - ldy #0 - lda (screen),y inc screen bne !+ inc screen+1 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 89f8258bc..e6f6cb0b7 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.cfg +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.cfg @@ -54,37 +54,36 @@ rvaluevar::@return: scope:[rvaluevar] from rvaluevar::@1 [23] return [ ] ( main:2::rvaluevar:9 [ ] ) to:@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#2 ] ) - [25] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) - [26] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) + [24] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) + [25] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) to:rvaluevar::@1 rvalue: scope:[rvalue] from main::@1 - [27] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) - [28] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) + [26] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) + [27] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) to:rvalue::@1 rvalue::@1: scope:[rvalue] from rvalue rvalue::@2 - [29] (byte) rvalue::i#2 ← phi( rvalue/(byte/signed byte/word/signed word) 2 rvalue::@2/(byte) rvalue::i#1 ) [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) - [30] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) + [28] (byte) rvalue::i#2 ← phi( rvalue/(byte/signed byte/word/signed word) 2 rvalue::@2/(byte) rvalue::i#1 ) [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) + [29] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) to:rvalue::@return rvalue::@return: scope:[rvalue] from rvalue::@1 - [31] return [ ] ( main:2::rvalue:7 [ ] ) + [30] return [ ] ( main:2::rvalue:7 [ ] ) to:@return rvalue::@2: scope:[rvalue] from rvalue::@1 - [32] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) - [33] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) + [31] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) + [32] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) to:rvalue::@1 lvalue: scope:[lvalue] from main - [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) - [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) + [33] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) + [34] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) to:lvalue::@1 lvalue::@1: scope:[lvalue] from lvalue lvalue::@2 - [36] (byte) lvalue::i#2 ← phi( lvalue/(byte/signed byte/word/signed word) 2 lvalue::@2/(byte) lvalue::i#1 ) [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) - [37] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) + [35] (byte) lvalue::i#2 ← phi( lvalue/(byte/signed byte/word/signed word) 2 lvalue::@2/(byte) lvalue::i#1 ) [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) + [36] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) to:lvalue::@return lvalue::@return: scope:[lvalue] from lvalue::@1 - [38] return [ ] ( main:2::lvalue:5 [ ] ) + [37] return [ ] ( main:2::lvalue:5 [ ] ) to:@return lvalue::@2: scope:[lvalue] from lvalue::@1 - [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) - [40] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) + [38] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) + [39] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ 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 4bfa17ca6..bec44e949 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log @@ -333,6 +333,11 @@ rvaluevar::@return: scope:[rvaluevar] from rvaluevar::@3 to:@end @end: scope:[] from @5 +Eliminating unused variable - keeping the call (void~) main::$0 +Eliminating unused variable - keeping the call (void~) main::$1 +Eliminating unused variable - keeping the call (void~) main::$2 +Eliminating unused variable - keeping the call (void~) main::$3 +Eliminating unused variable (byte) rvaluevar::b and assignment [38] (byte) rvaluevar::b ← *((byte*) rvaluevar::screen) Removing empty block @1 Removing empty block lvalue::@4 Removing empty block lvalue::@3 @@ -357,10 +362,10 @@ CONTROL FLOW GRAPH @begin: scope:[] from to:@5 main: scope:[main] from - (void~) main::$0 ← call lvalue - (void~) main::$1 ← call rvalue - (void~) main::$2 ← call rvaluevar - (void~) main::$3 ← call lvaluevar + call lvalue + call rvalue + call rvaluevar + call lvaluevar to:main::@return main::@return: scope:[main] from main return @@ -427,7 +432,6 @@ rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 if((boolean~) rvaluevar::$0) goto rvaluevar::@2 to:rvaluevar::@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - (byte) rvaluevar::b ← *((byte*) rvaluevar::screen) (byte*) rvaluevar::screen ← ++ (byte*) rvaluevar::screen (byte) rvaluevar::i ← ++ (byte) rvaluevar::i to:rvaluevar::@1 @@ -523,7 +527,6 @@ rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 if((boolean~) rvaluevar::$0) goto rvaluevar::@2 to:rvaluevar::@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - (byte) rvaluevar::b ← *((byte*) rvaluevar::screen) (byte*) rvaluevar::screen ← ++ (byte*) rvaluevar::screen (byte) rvaluevar::i ← ++ (byte) rvaluevar::i to:rvaluevar::@1 @@ -639,7 +642,6 @@ rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 (byte) rvaluevar::i#3 ← phi( rvaluevar::@1/(byte) rvaluevar::i#2 ) (byte*) rvaluevar::screen#2 ← phi( rvaluevar::@1/(byte*) rvaluevar::screen#3 ) - (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#3 to:rvaluevar::@1 @@ -753,7 +755,6 @@ rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 (byte) rvaluevar::i#3 ← phi( rvaluevar::@1/(byte) rvaluevar::i#2 ) (byte*) rvaluevar::screen#2 ← phi( rvaluevar::@1/(byte*) rvaluevar::screen#3 ) - (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#3 to:rvaluevar::@1 @@ -836,8 +837,6 @@ INITIAL SSA SYMBOL TABLE (label) rvaluevar::@1 (label) rvaluevar::@2 (label) rvaluevar::@return -(byte) rvaluevar::b -(byte) rvaluevar::b#0 (byte) rvaluevar::i (byte) rvaluevar::i#0 (byte) rvaluevar::i#1 @@ -950,7 +949,6 @@ rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 (byte) rvaluevar::i#3 ← phi( rvaluevar::@1/(byte) rvaluevar::i#2 ) (byte*) rvaluevar::screen#2 ← phi( rvaluevar::@1/(byte*) rvaluevar::screen#3 ) - (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#3 to:rvaluevar::@1 @@ -1061,7 +1059,6 @@ rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 if((boolean~) rvaluevar::$0) goto rvaluevar::@2 to:rvaluevar::@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 to:rvaluevar::@1 @@ -1164,7 +1161,6 @@ rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 if((boolean~) rvaluevar::$0) goto rvaluevar::@2 to:rvaluevar::@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 to:rvaluevar::@1 @@ -1264,7 +1260,6 @@ rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 if((boolean~) rvaluevar::$0) goto rvaluevar::@2 to:rvaluevar::@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 to:rvaluevar::@1 @@ -1361,7 +1356,6 @@ rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 if((byte) rvaluevar::i#2<(byte/signed byte/word/signed word) 10) goto rvaluevar::@2 to:rvaluevar::@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 to:rvaluevar::@1 @@ -1454,7 +1448,6 @@ rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 if((byte) rvaluevar::i#2<(byte/signed byte/word/signed word) 10) goto rvaluevar::@2 to:rvaluevar::@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 to:rvaluevar::@1 @@ -1541,7 +1534,6 @@ rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 if((byte) rvaluevar::i#2<(byte/signed byte/word/signed word) 10) goto rvaluevar::@2 to:rvaluevar::@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 to:rvaluevar::@1 @@ -1645,7 +1637,6 @@ rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2 if((byte) rvaluevar::i#2<(byte/signed byte/word/signed word) 10) goto rvaluevar::@2 to:rvaluevar::@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 to:rvaluevar::@1 @@ -1704,8 +1695,6 @@ FINAL SYMBOL TABLE (label) rvaluevar::@1 (label) rvaluevar::@2 (label) rvaluevar::@return -(byte) rvaluevar::b -(byte) rvaluevar::b#0 (byte) rvaluevar::i (byte) rvaluevar::i#1 (byte) rvaluevar::i#2 @@ -1765,7 +1754,6 @@ rvaluevar::@return: scope:[rvaluevar] from rvaluevar::@1 return to:@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 (byte~) rvaluevar::i#4 ← (byte) rvaluevar::i#1 @@ -1880,52 +1868,51 @@ rvaluevar::@return: scope:[rvaluevar] from rvaluevar::@1 [25] return [ ] to:@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - [26] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] - [27] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] - [28] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::screen#1 rvaluevar::i#1 ] - [29] (byte~) rvaluevar::i#4 ← (byte) rvaluevar::i#1 [ rvaluevar::i#4 rvaluevar::screen#1 ] - [30] (byte*~) rvaluevar::screen#4 ← (byte*) rvaluevar::screen#1 [ rvaluevar::i#4 rvaluevar::screen#4 ] + [26] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] + [27] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::screen#1 rvaluevar::i#1 ] + [28] (byte~) rvaluevar::i#4 ← (byte) rvaluevar::i#1 [ rvaluevar::i#4 rvaluevar::screen#1 ] + [29] (byte*~) rvaluevar::screen#4 ← (byte*) rvaluevar::screen#1 [ rvaluevar::i#4 rvaluevar::screen#4 ] to:rvaluevar::@1 rvalue: scope:[rvalue] from main::@1 - [31] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] - [32] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] + [30] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] + [31] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] to:rvalue::@1 rvalue::@1: scope:[rvalue] from rvalue rvalue::@2 - [33] (byte) rvalue::i#2 ← phi( rvalue/(byte/signed byte/word/signed word) 2 rvalue::@2/(byte~) rvalue::i#4 ) [ rvalue::i#2 ] - [34] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] + [32] (byte) rvalue::i#2 ← phi( rvalue/(byte/signed byte/word/signed word) 2 rvalue::@2/(byte~) rvalue::i#4 ) [ rvalue::i#2 ] + [33] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] to:rvalue::@return rvalue::@return: scope:[rvalue] from rvalue::@1 - [35] return [ ] + [34] return [ ] to:@return rvalue::@2: scope:[rvalue] from rvalue::@1 - [36] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] - [37] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] - [38] (byte~) rvalue::i#4 ← (byte) rvalue::i#1 [ rvalue::i#4 ] + [35] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] + [36] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] + [37] (byte~) rvalue::i#4 ← (byte) rvalue::i#1 [ rvalue::i#4 ] to:rvalue::@1 lvalue: scope:[lvalue] from main - [39] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] - [40] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] + [38] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] + [39] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] to:lvalue::@1 lvalue::@1: scope:[lvalue] from lvalue lvalue::@2 - [41] (byte) lvalue::i#2 ← phi( lvalue/(byte/signed byte/word/signed word) 2 lvalue::@2/(byte~) lvalue::i#4 ) [ lvalue::i#2 ] - [42] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] + [40] (byte) lvalue::i#2 ← phi( lvalue/(byte/signed byte/word/signed word) 2 lvalue::@2/(byte~) lvalue::i#4 ) [ lvalue::i#2 ] + [41] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] to:lvalue::@return lvalue::@return: scope:[lvalue] from lvalue::@1 - [43] return [ ] + [42] return [ ] to:@return lvalue::@2: scope:[lvalue] from lvalue::@1 - [44] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] - [45] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] - [46] (byte~) lvalue::i#4 ← (byte) lvalue::i#1 [ lvalue::i#4 ] + [43] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] + [44] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] + [45] (byte~) lvalue::i#4 ← (byte) lvalue::i#1 [ lvalue::i#4 ] to:lvalue::@1 Created 6 initial phi equivalence classes Coalesced [20] lvaluevar::i#4 ← lvaluevar::i#1 Coalesced [21] lvaluevar::screen#4 ← lvaluevar::screen#1 -Coalesced [29] rvaluevar::i#4 ← rvaluevar::i#1 -Coalesced [30] rvaluevar::screen#4 ← rvaluevar::screen#1 -Coalesced [38] rvalue::i#4 ← rvalue::i#1 -Coalesced [46] lvalue::i#4 ← lvalue::i#1 +Coalesced [28] rvaluevar::i#4 ← rvaluevar::i#1 +Coalesced [29] rvaluevar::screen#4 ← rvaluevar::screen#1 +Coalesced [37] rvalue::i#4 ← rvalue::i#1 +Coalesced [45] lvalue::i#4 ← lvalue::i#1 Coalesced down to 6 phi equivalence classes Block Sequence Planned @begin @5 @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 NOP phi() at start of @begin @@ -1998,39 +1985,38 @@ rvaluevar::@return: scope:[rvaluevar] from rvaluevar::@1 [23] return [ ] to:@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] - [25] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] - [26] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] + [24] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] + [25] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] to:rvaluevar::@1 rvalue: scope:[rvalue] from main::@1 - [27] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] - [28] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] + [26] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] + [27] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] to:rvalue::@1 rvalue::@1: scope:[rvalue] from rvalue rvalue::@2 - [29] (byte) rvalue::i#2 ← phi( rvalue/(byte/signed byte/word/signed word) 2 rvalue::@2/(byte) rvalue::i#1 ) [ rvalue::i#2 ] - [30] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] + [28] (byte) rvalue::i#2 ← phi( rvalue/(byte/signed byte/word/signed word) 2 rvalue::@2/(byte) rvalue::i#1 ) [ rvalue::i#2 ] + [29] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] to:rvalue::@return rvalue::@return: scope:[rvalue] from rvalue::@1 - [31] return [ ] + [30] return [ ] to:@return rvalue::@2: scope:[rvalue] from rvalue::@1 - [32] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] - [33] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] + [31] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] + [32] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] to:rvalue::@1 lvalue: scope:[lvalue] from main - [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] - [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] + [33] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] + [34] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] to:lvalue::@1 lvalue::@1: scope:[lvalue] from lvalue lvalue::@2 - [36] (byte) lvalue::i#2 ← phi( lvalue/(byte/signed byte/word/signed word) 2 lvalue::@2/(byte) lvalue::i#1 ) [ lvalue::i#2 ] - [37] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] + [35] (byte) lvalue::i#2 ← phi( lvalue/(byte/signed byte/word/signed word) 2 lvalue::@2/(byte) lvalue::i#1 ) [ lvalue::i#2 ] + [36] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] to:lvalue::@return lvalue::@return: scope:[lvalue] from lvalue::@1 - [38] return [ ] + [37] return [ ] to:@return lvalue::@2: scope:[lvalue] from lvalue::@1 - [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] - [40] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] + [38] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] + [39] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] to:lvalue::@1 CONTROL FLOW GRAPH - PHI MEM COALESCED @@ -2090,39 +2076,38 @@ rvaluevar::@return: scope:[rvaluevar] from rvaluevar::@1 [23] return [ ] ( main:2::rvaluevar:9 [ ] ) to:@return rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1 - [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#2 ] ) - [25] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) - [26] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) + [24] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) + [25] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) to:rvaluevar::@1 rvalue: scope:[rvalue] from main::@1 - [27] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) - [28] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) + [26] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) + [27] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) to:rvalue::@1 rvalue::@1: scope:[rvalue] from rvalue rvalue::@2 - [29] (byte) rvalue::i#2 ← phi( rvalue/(byte/signed byte/word/signed word) 2 rvalue::@2/(byte) rvalue::i#1 ) [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) - [30] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) + [28] (byte) rvalue::i#2 ← phi( rvalue/(byte/signed byte/word/signed word) 2 rvalue::@2/(byte) rvalue::i#1 ) [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) + [29] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) to:rvalue::@return rvalue::@return: scope:[rvalue] from rvalue::@1 - [31] return [ ] ( main:2::rvalue:7 [ ] ) + [30] return [ ] ( main:2::rvalue:7 [ ] ) to:@return rvalue::@2: scope:[rvalue] from rvalue::@1 - [32] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) - [33] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) + [31] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) + [32] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) to:rvalue::@1 lvalue: scope:[lvalue] from main - [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) - [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) + [33] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) + [34] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) to:lvalue::@1 lvalue::@1: scope:[lvalue] from lvalue lvalue::@2 - [36] (byte) lvalue::i#2 ← phi( lvalue/(byte/signed byte/word/signed word) 2 lvalue::@2/(byte) lvalue::i#1 ) [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) - [37] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) + [35] (byte) lvalue::i#2 ← phi( lvalue/(byte/signed byte/word/signed word) 2 lvalue::@2/(byte) lvalue::i#1 ) [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) + [36] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) to:lvalue::@return lvalue::@return: scope:[lvalue] from lvalue::@1 - [38] return [ ] ( main:2::lvalue:5 [ ] ) + [37] return [ ] ( main:2::lvalue:5 [ ] ) to:@return lvalue::@2: scope:[lvalue] from lvalue::@1 - [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) - [40] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) + [38] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) + [39] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) to:lvalue::@1 DOMINATORS @@ -2207,11 +2192,9 @@ VARIABLE REGISTER WEIGHTS (byte) rvalue::i#1 22.0 (byte) rvalue::i#2 14.666666666666666 (void()) rvaluevar() -(byte) rvaluevar::b -(byte) rvaluevar::b#0 110.0 (byte) rvaluevar::i (byte) rvaluevar::i#1 22.0 -(byte) rvaluevar::i#2 8.25 +(byte) rvaluevar::i#2 11.0 (byte*) rvaluevar::screen (byte*) rvaluevar::screen#1 11.0 (byte*) rvaluevar::screen#2 11.0 @@ -2223,7 +2206,6 @@ Initial phi equivalence classes [ rvaluevar::screen#2 rvaluevar::screen#1 ] [ rvalue::i#2 rvalue::i#1 ] [ lvalue::i#2 lvalue::i#1 ] -Added variable rvaluevar::b#0 to zero page equivalence class [ rvaluevar::b#0 ] Added variable rvalue::b#0 to zero page equivalence class [ rvalue::b#0 ] Added variable rvalue::b#1 to zero page equivalence class [ rvalue::b#1 ] Added variable rvalue::b#2 to zero page equivalence class [ rvalue::b#2 ] @@ -2234,7 +2216,6 @@ Complete equivalence classes [ rvaluevar::screen#2 rvaluevar::screen#1 ] [ rvalue::i#2 rvalue::i#1 ] [ lvalue::i#2 lvalue::i#1 ] -[ rvaluevar::b#0 ] [ rvalue::b#0 ] [ rvalue::b#1 ] [ rvalue::b#2 ] @@ -2244,10 +2225,9 @@ Allocated zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ] Allocated zp ZP_PTR_BYTE:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ] Allocated zp ZP_BYTE:8 [ rvalue::i#2 rvalue::i#1 ] Allocated zp ZP_BYTE:9 [ lvalue::i#2 lvalue::i#1 ] -Allocated zp ZP_BYTE:10 [ rvaluevar::b#0 ] -Allocated zp ZP_BYTE:11 [ rvalue::b#0 ] -Allocated zp ZP_BYTE:12 [ rvalue::b#1 ] -Allocated zp ZP_BYTE:13 [ rvalue::b#2 ] +Allocated zp ZP_BYTE:10 [ rvalue::b#0 ] +Allocated zp ZP_BYTE:11 [ rvalue::b#1 ] +Allocated zp ZP_BYTE:12 [ rvalue::b#2 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2353,7 +2333,6 @@ lvaluevar: { } //SEG39 rvaluevar rvaluevar: { - .label b = $a .label screen = 6 .label i = 5 //SEG40 [21] phi from rvaluevar to rvaluevar::@1 [phi:rvaluevar->rvaluevar::@1] @@ -2380,104 +2359,100 @@ rvaluevar: { rts //SEG47 rvaluevar::@2 b2: - //SEG48 [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#2 ] ) -- zpby1=_deref_zpptrby1 - ldy #0 - lda (screen),y - sta b - //SEG49 [25] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) -- zpptrby1=_inc_zpptrby1 + //SEG48 [24] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+1 !: - //SEG50 [26] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) -- zpby1=_inc_zpby1 + //SEG49 [25] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) -- zpby1=_inc_zpby1 inc i - //SEG51 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1] + //SEG50 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1] b1_from_b2: - //SEG52 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy - //SEG53 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy + //SEG51 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy + //SEG52 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy jmp b1 } -//SEG54 rvalue +//SEG53 rvalue rvalue: { .const SCREEN = $400 - .label b = $b - .label b_1 = $c - .label b_2 = $d + .label b = $a + .label b_1 = $b + .label b_2 = $c .label i = 8 - //SEG55 [27] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) -- zpby1=_deref_cowo1 + //SEG54 [26] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) -- zpby1=_deref_cowo1 lda SCREEN sta b - //SEG56 [28] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) -- zpby1=_deref_cowo1 + //SEG55 [27] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) -- zpby1=_deref_cowo1 lda SCREEN+1 sta b_1 - //SEG57 [29] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1] + //SEG56 [28] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1] b1_from_rvalue: - //SEG58 [29] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:rvalue->rvalue::@1#0] -- zpby1=coby1 + //SEG57 [28] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:rvalue->rvalue::@1#0] -- zpby1=coby1 lda #2 sta i jmp b1 - //SEG59 rvalue::@1 + //SEG58 rvalue::@1 b1: - //SEG60 [30] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- zpby1_lt_coby1_then_la1 + //SEG59 [29] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- zpby1_lt_coby1_then_la1 lda i cmp #$a bcc b2 jmp breturn - //SEG61 rvalue::@return + //SEG60 rvalue::@return breturn: - //SEG62 [31] return [ ] ( main:2::rvalue:7 [ ] ) + //SEG61 [30] return [ ] ( main:2::rvalue:7 [ ] ) rts - //SEG63 rvalue::@2 + //SEG62 rvalue::@2 b2: - //SEG64 [32] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- zpby1=cowo1_derefidx_zpby2 + //SEG63 [31] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- zpby1=cowo1_derefidx_zpby2 ldx i lda SCREEN,x sta b_2 - //SEG65 [33] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) -- zpby1=_inc_zpby1 + //SEG64 [32] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) -- zpby1=_inc_zpby1 inc i - //SEG66 [29] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1] + //SEG65 [28] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1] b1_from_b2: - //SEG67 [29] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy + //SEG66 [28] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy jmp b1 } -//SEG68 lvalue +//SEG67 lvalue lvalue: { .const SCREEN = $400 .label i = 9 - //SEG69 [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 + //SEG68 [33] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 lda #1 sta SCREEN - //SEG70 [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 + //SEG69 [34] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 lda #2 sta SCREEN+1 - //SEG71 [36] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1] + //SEG70 [35] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1] b1_from_lvalue: - //SEG72 [36] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:lvalue->lvalue::@1#0] -- zpby1=coby1 + //SEG71 [35] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:lvalue->lvalue::@1#0] -- zpby1=coby1 lda #2 sta i jmp b1 - //SEG73 lvalue::@1 + //SEG72 lvalue::@1 b1: - //SEG74 [37] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- zpby1_lt_coby1_then_la1 + //SEG73 [36] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- zpby1_lt_coby1_then_la1 lda i cmp #$a bcc b2 jmp breturn - //SEG75 lvalue::@return + //SEG74 lvalue::@return breturn: - //SEG76 [38] return [ ] ( main:2::lvalue:5 [ ] ) + //SEG75 [37] return [ ] ( main:2::lvalue:5 [ ] ) rts - //SEG77 lvalue::@2 + //SEG76 lvalue::@2 b2: - //SEG78 [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- cowo1_derefidx_zpby1=coby2 + //SEG77 [38] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- cowo1_derefidx_zpby1=coby2 lda #3 ldx i sta SCREEN,x - //SEG79 [40] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) -- zpby1=_inc_zpby1 + //SEG78 [39] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) -- zpby1=_inc_zpby1 inc i - //SEG80 [36] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1] + //SEG79 [35] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1] b1_from_b2: - //SEG81 [36] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- register_copy + //SEG80 [35] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- register_copy jmp b1 } @@ -2485,43 +2460,38 @@ REGISTER UPLIFT POTENTIAL REGISTERS Statement [17] *((byte*) lvaluevar::screen#2) ← (const byte) lvaluevar::b#0 [ lvaluevar::i#2 lvaluevar::screen#2 ] ( main:2::lvaluevar:11 [ 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 [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] ( main:2::rvaluevar:9 [ 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 [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) always clobbers reg byte a -Statement [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) always clobbers reg byte a -Statement [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) always clobbers reg byte a +Statement [33] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) always clobbers reg byte a +Statement [34] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) always clobbers reg byte a +Statement [38] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ 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 [17] *((byte*) lvaluevar::screen#2) ← (const byte) lvaluevar::b#0 [ lvaluevar::i#2 lvaluevar::screen#2 ] ( main:2::lvaluevar:11 [ lvaluevar::i#2 lvaluevar::screen#2 ] ) always clobbers reg byte a reg byte y -Statement [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#2 ] ) always clobbers reg byte a reg byte y -Statement [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) always clobbers reg byte a -Statement [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) always clobbers reg byte a -Statement [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) always clobbers reg byte a +Statement [33] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) always clobbers reg byte a +Statement [34] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) always clobbers reg byte a +Statement [38] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) always clobbers reg byte a 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 , -Potential registers zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ] : zp ZP_BYTE:5 , reg byte x , +Potential registers zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_PTR_BYTE:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ] : zp ZP_PTR_BYTE:6 , Potential registers zp ZP_BYTE:8 [ rvalue::i#2 rvalue::i#1 ] : zp ZP_BYTE:8 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_BYTE:9 [ lvalue::i#2 lvalue::i#1 ] : zp ZP_BYTE:9 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:10 [ rvaluevar::b#0 ] : zp ZP_BYTE:10 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:11 [ rvalue::b#0 ] : zp ZP_BYTE:11 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:12 [ rvalue::b#1 ] : zp ZP_BYTE:12 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:13 [ rvalue::b#2 ] : zp ZP_BYTE:13 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:10 [ rvalue::b#0 ] : zp ZP_BYTE:10 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:11 [ rvalue::b#1 ] : zp ZP_BYTE:11 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:12 [ rvalue::b#2 ] : zp ZP_BYTE:12 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -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 [rvalue] 110: zp ZP_BYTE:12 [ rvalue::b#2 ] 36.67: zp ZP_BYTE:8 [ rvalue::i#2 rvalue::i#1 ] 20: zp ZP_BYTE:10 [ rvalue::b#0 ] 20: zp ZP_BYTE:11 [ rvalue::b#1 ] +Uplift Scope [rvaluevar] 33: 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 1908 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 1788 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 1698 combination reg byte x [ lvaluevar::i#2 lvaluevar::i#1 ] zp ZP_PTR_BYTE:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] -Uplifting [lvalue] best 1578 combination reg byte x [ lvalue::i#2 lvalue::i#1 ] -Uplifting [main] best 1578 combination -Uplifting [] best 1578 combination +Uplifting [rvalue] best 1803 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 1713 combination reg byte x [ rvaluevar::i#2 rvaluevar::i#1 ] zp ZP_PTR_BYTE:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ] +Uplifting [lvaluevar] best 1623 combination reg byte x [ lvaluevar::i#2 lvaluevar::i#1 ] zp ZP_PTR_BYTE:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] +Uplifting [lvalue] best 1503 combination reg byte x [ lvalue::i#2 lvalue::i#1 ] +Uplifting [main] best 1503 combination +Uplifting [] best 1503 combination Coalescing zero page register [ zp ZP_PTR_BYTE:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] ] with [ zp ZP_PTR_BYTE:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ] ] Allocated (was zp ZP_PTR_BYTE:3) zp ZP_PTR_BYTE:2 [ lvaluevar::screen#2 lvaluevar::screen#1 rvaluevar::screen#2 rvaluevar::screen#1 ] Removing instruction jmp b5 @@ -2654,85 +2624,82 @@ rvaluevar: { rts //SEG47 rvaluevar::@2 b2: - //SEG48 [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#2 ] ) -- aby=_deref_zpptrby1 - ldy #0 - lda (screen),y - //SEG49 [25] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) -- zpptrby1=_inc_zpptrby1 + //SEG48 [24] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+1 !: - //SEG50 [26] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) -- xby=_inc_xby + //SEG49 [25] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) -- xby=_inc_xby inx - //SEG51 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1] + //SEG50 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1] b1_from_b2: - //SEG52 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy - //SEG53 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy + //SEG51 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy + //SEG52 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy jmp b1 } -//SEG54 rvalue +//SEG53 rvalue rvalue: { .const SCREEN = $400 - //SEG55 [27] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 + //SEG54 [26] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 lda SCREEN - //SEG56 [28] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 + //SEG55 [27] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 lda SCREEN+1 - //SEG57 [29] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1] + //SEG56 [28] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1] b1_from_rvalue: - //SEG58 [29] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:rvalue->rvalue::@1#0] -- xby=coby1 + //SEG57 [28] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:rvalue->rvalue::@1#0] -- xby=coby1 ldx #2 - //SEG59 rvalue::@1 + //SEG58 rvalue::@1 b1: - //SEG60 [30] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- xby_lt_coby1_then_la1 + //SEG59 [29] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG61 rvalue::@return + //SEG60 rvalue::@return breturn: - //SEG62 [31] return [ ] ( main:2::rvalue:7 [ ] ) + //SEG61 [30] return [ ] ( main:2::rvalue:7 [ ] ) rts - //SEG63 rvalue::@2 + //SEG62 rvalue::@2 b2: - //SEG64 [32] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- aby=cowo1_derefidx_xby + //SEG63 [31] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- aby=cowo1_derefidx_xby lda SCREEN,x - //SEG65 [33] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) -- xby=_inc_xby + //SEG64 [32] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) -- xby=_inc_xby inx - //SEG66 [29] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1] + //SEG65 [28] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1] b1_from_b2: - //SEG67 [29] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy + //SEG66 [28] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy jmp b1 } -//SEG68 lvalue +//SEG67 lvalue lvalue: { .const SCREEN = $400 - //SEG69 [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 + //SEG68 [33] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 lda #1 sta SCREEN - //SEG70 [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 + //SEG69 [34] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 lda #2 sta SCREEN+1 - //SEG71 [36] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1] + //SEG70 [35] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1] b1_from_lvalue: - //SEG72 [36] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:lvalue->lvalue::@1#0] -- xby=coby1 + //SEG71 [35] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:lvalue->lvalue::@1#0] -- xby=coby1 ldx #2 - //SEG73 lvalue::@1 + //SEG72 lvalue::@1 b1: - //SEG74 [37] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- xby_lt_coby1_then_la1 + //SEG73 [36] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG75 lvalue::@return + //SEG74 lvalue::@return breturn: - //SEG76 [38] return [ ] ( main:2::lvalue:5 [ ] ) + //SEG75 [37] return [ ] ( main:2::lvalue:5 [ ] ) rts - //SEG77 lvalue::@2 + //SEG76 lvalue::@2 b2: - //SEG78 [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- cowo1_derefidx_xby=coby2 + //SEG77 [38] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- cowo1_derefidx_xby=coby2 lda #3 sta SCREEN,x - //SEG79 [40] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) -- xby=_inc_xby + //SEG78 [39] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) -- xby=_inc_xby inx - //SEG80 [36] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1] + //SEG79 [35] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1] b1_from_b2: - //SEG81 [36] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- register_copy + //SEG80 [35] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- register_copy jmp b1 } @@ -2852,85 +2819,82 @@ rvaluevar: { rts //SEG47 rvaluevar::@2 b2: - //SEG48 [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#2 ] ) -- aby=_deref_zpptrby1 - ldy #0 - lda (screen),y - //SEG49 [25] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) -- zpptrby1=_inc_zpptrby1 + //SEG48 [24] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+1 !: - //SEG50 [26] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) -- xby=_inc_xby + //SEG49 [25] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) -- xby=_inc_xby inx - //SEG51 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1] + //SEG50 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1] b1_from_b2: - //SEG52 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy - //SEG53 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy + //SEG51 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy + //SEG52 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy jmp b1 } -//SEG54 rvalue +//SEG53 rvalue rvalue: { .const SCREEN = $400 - //SEG55 [27] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 + //SEG54 [26] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 lda SCREEN - //SEG56 [28] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 + //SEG55 [27] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 lda SCREEN+1 - //SEG57 [29] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1] + //SEG56 [28] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1] b1_from_rvalue: - //SEG58 [29] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:rvalue->rvalue::@1#0] -- xby=coby1 + //SEG57 [28] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:rvalue->rvalue::@1#0] -- xby=coby1 ldx #2 - //SEG59 rvalue::@1 + //SEG58 rvalue::@1 b1: - //SEG60 [30] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- xby_lt_coby1_then_la1 + //SEG59 [29] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG61 rvalue::@return + //SEG60 rvalue::@return breturn: - //SEG62 [31] return [ ] ( main:2::rvalue:7 [ ] ) + //SEG61 [30] return [ ] ( main:2::rvalue:7 [ ] ) rts - //SEG63 rvalue::@2 + //SEG62 rvalue::@2 b2: - //SEG64 [32] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- aby=cowo1_derefidx_xby + //SEG63 [31] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- aby=cowo1_derefidx_xby lda SCREEN,x - //SEG65 [33] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) -- xby=_inc_xby + //SEG64 [32] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) -- xby=_inc_xby inx - //SEG66 [29] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1] + //SEG65 [28] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1] b1_from_b2: - //SEG67 [29] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy + //SEG66 [28] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy jmp b1 } -//SEG68 lvalue +//SEG67 lvalue lvalue: { .const SCREEN = $400 - //SEG69 [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 + //SEG68 [33] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 lda #1 sta SCREEN - //SEG70 [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 + //SEG69 [34] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 lda #2 sta SCREEN+1 - //SEG71 [36] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1] + //SEG70 [35] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1] b1_from_lvalue: - //SEG72 [36] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:lvalue->lvalue::@1#0] -- xby=coby1 + //SEG71 [35] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:lvalue->lvalue::@1#0] -- xby=coby1 ldx #2 - //SEG73 lvalue::@1 + //SEG72 lvalue::@1 b1: - //SEG74 [37] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- xby_lt_coby1_then_la1 + //SEG73 [36] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG75 lvalue::@return + //SEG74 lvalue::@return breturn: - //SEG76 [38] return [ ] ( main:2::lvalue:5 [ ] ) + //SEG75 [37] return [ ] ( main:2::lvalue:5 [ ] ) rts - //SEG77 lvalue::@2 + //SEG76 lvalue::@2 b2: - //SEG78 [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- cowo1_derefidx_xby=coby2 + //SEG77 [38] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- cowo1_derefidx_xby=coby2 lda #3 sta SCREEN,x - //SEG79 [40] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) -- xby=_inc_xby + //SEG78 [39] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) -- xby=_inc_xby inx - //SEG80 [36] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1] + //SEG79 [35] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1] b1_from_b2: - //SEG81 [36] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- register_copy + //SEG80 [35] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- register_copy jmp b1 } @@ -3048,78 +3012,75 @@ rvaluevar: { rts //SEG47 rvaluevar::@2 b2: - //SEG48 [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#2 ] ) -- aby=_deref_zpptrby1 - ldy #0 - lda (screen),y - //SEG49 [25] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) -- zpptrby1=_inc_zpptrby1 + //SEG48 [24] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+1 !: - //SEG50 [26] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) -- xby=_inc_xby + //SEG49 [25] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) -- xby=_inc_xby inx - //SEG51 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1] - //SEG52 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy - //SEG53 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy + //SEG50 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1] + //SEG51 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy + //SEG52 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy jmp b1 } -//SEG54 rvalue +//SEG53 rvalue rvalue: { .const SCREEN = $400 - //SEG55 [27] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 + //SEG54 [26] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 lda SCREEN - //SEG56 [28] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 + //SEG55 [27] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 lda SCREEN+1 - //SEG57 [29] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1] - //SEG58 [29] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:rvalue->rvalue::@1#0] -- xby=coby1 + //SEG56 [28] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1] + //SEG57 [28] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:rvalue->rvalue::@1#0] -- xby=coby1 ldx #2 - //SEG59 rvalue::@1 + //SEG58 rvalue::@1 b1: - //SEG60 [30] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- xby_lt_coby1_then_la1 + //SEG59 [29] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG61 rvalue::@return - //SEG62 [31] return [ ] ( main:2::rvalue:7 [ ] ) + //SEG60 rvalue::@return + //SEG61 [30] return [ ] ( main:2::rvalue:7 [ ] ) rts - //SEG63 rvalue::@2 + //SEG62 rvalue::@2 b2: - //SEG64 [32] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- aby=cowo1_derefidx_xby + //SEG63 [31] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- aby=cowo1_derefidx_xby lda SCREEN,x - //SEG65 [33] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) -- xby=_inc_xby + //SEG64 [32] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) -- xby=_inc_xby inx - //SEG66 [29] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1] - //SEG67 [29] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy + //SEG65 [28] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1] + //SEG66 [28] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy jmp b1 } -//SEG68 lvalue +//SEG67 lvalue lvalue: { .const SCREEN = $400 - //SEG69 [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 + //SEG68 [33] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 lda #1 sta SCREEN - //SEG70 [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 + //SEG69 [34] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 lda #2 sta SCREEN+1 - //SEG71 [36] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1] - //SEG72 [36] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:lvalue->lvalue::@1#0] -- xby=coby1 + //SEG70 [35] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1] + //SEG71 [35] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:lvalue->lvalue::@1#0] -- xby=coby1 ldx #2 - //SEG73 lvalue::@1 + //SEG72 lvalue::@1 b1: - //SEG74 [37] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- xby_lt_coby1_then_la1 + //SEG73 [36] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG75 lvalue::@return - //SEG76 [38] return [ ] ( main:2::lvalue:5 [ ] ) + //SEG74 lvalue::@return + //SEG75 [37] return [ ] ( main:2::lvalue:5 [ ] ) rts - //SEG77 lvalue::@2 + //SEG76 lvalue::@2 b2: - //SEG78 [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- cowo1_derefidx_xby=coby2 + //SEG77 [38] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- cowo1_derefidx_xby=coby2 lda #3 sta SCREEN,x - //SEG79 [40] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) -- xby=_inc_xby + //SEG78 [39] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) -- xby=_inc_xby inx - //SEG80 [36] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1] - //SEG81 [36] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- register_copy + //SEG79 [35] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1] + //SEG80 [35] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- register_copy jmp b1 } @@ -3171,11 +3132,9 @@ FINAL SYMBOL TABLE (label) rvaluevar::@1 (label) rvaluevar::@2 (label) rvaluevar::@return -(byte) rvaluevar::b -(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 +(byte) rvaluevar::i#2 reg byte x 11.0 (byte*) rvaluevar::screen (byte*) rvaluevar::screen#1 screen zp ZP_PTR_BYTE:2 11.0 (byte*) rvaluevar::screen#2 screen zp ZP_PTR_BYTE:2 11.0 @@ -3185,7 +3144,6 @@ zp ZP_PTR_BYTE:2 [ lvaluevar::screen#2 lvaluevar::screen#1 rvaluevar::screen#2 r reg byte x [ rvaluevar::i#2 rvaluevar::i#1 ] reg byte x [ rvalue::i#2 rvalue::i#1 ] reg byte x [ lvalue::i#2 lvalue::i#1 ] -reg byte a [ rvaluevar::b#0 ] reg byte a [ rvalue::b#0 ] reg byte a [ rvalue::b#1 ] reg byte a [ rvalue::b#2 ] @@ -3285,78 +3243,75 @@ rvaluevar: { rts //SEG47 rvaluevar::@2 b2: - //SEG48 [24] (byte) rvaluevar::b#0 ← *((byte*) rvaluevar::screen#2) [ rvaluevar::i#2 rvaluevar::screen#2 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#2 ] ) -- aby=_deref_zpptrby1 - ldy #0 - lda (screen),y - //SEG49 [25] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) -- zpptrby1=_inc_zpptrby1 + //SEG48 [24] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#2 rvaluevar::screen#1 ] ) -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+1 !: - //SEG50 [26] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) -- xby=_inc_xby + //SEG49 [25] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ] ( main:2::rvaluevar:9 [ rvaluevar::i#1 rvaluevar::screen#1 ] ) -- xby=_inc_xby inx - //SEG51 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1] - //SEG52 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy - //SEG53 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy + //SEG50 [21] phi from rvaluevar::@2 to rvaluevar::@1 [phi:rvaluevar::@2->rvaluevar::@1] + //SEG51 [21] phi (byte*) rvaluevar::screen#2 = (byte*) rvaluevar::screen#1 [phi:rvaluevar::@2->rvaluevar::@1#0] -- register_copy + //SEG52 [21] phi (byte) rvaluevar::i#2 = (byte) rvaluevar::i#1 [phi:rvaluevar::@2->rvaluevar::@1#1] -- register_copy jmp b1 } -//SEG54 rvalue +//SEG53 rvalue rvalue: { .const SCREEN = $400 - //SEG55 [27] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 + //SEG54 [26] (byte) rvalue::b#0 ← *((const byte[1024]) rvalue::SCREEN#0) [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 lda SCREEN - //SEG56 [28] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 + //SEG55 [27] (byte) rvalue::b#1 ← * (const byte[1024]) rvalue::SCREEN#0+(byte/signed byte/word/signed word) 1 [ ] ( main:2::rvalue:7 [ ] ) -- aby=_deref_cowo1 lda SCREEN+1 - //SEG57 [29] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1] - //SEG58 [29] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:rvalue->rvalue::@1#0] -- xby=coby1 + //SEG56 [28] phi from rvalue to rvalue::@1 [phi:rvalue->rvalue::@1] + //SEG57 [28] phi (byte) rvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:rvalue->rvalue::@1#0] -- xby=coby1 ldx #2 - //SEG59 rvalue::@1 + //SEG58 rvalue::@1 b1: - //SEG60 [30] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- xby_lt_coby1_then_la1 + //SEG59 [29] if((byte) rvalue::i#2<(byte/signed byte/word/signed word) 10) goto rvalue::@2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG61 rvalue::@return - //SEG62 [31] return [ ] ( main:2::rvalue:7 [ ] ) + //SEG60 rvalue::@return + //SEG61 [30] return [ ] ( main:2::rvalue:7 [ ] ) rts - //SEG63 rvalue::@2 + //SEG62 rvalue::@2 b2: - //SEG64 [32] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- aby=cowo1_derefidx_xby + //SEG63 [31] (byte) rvalue::b#2 ← (const byte[1024]) rvalue::SCREEN#0 *idx (byte) rvalue::i#2 [ rvalue::i#2 ] ( main:2::rvalue:7 [ rvalue::i#2 ] ) -- aby=cowo1_derefidx_xby lda SCREEN,x - //SEG65 [33] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) -- xby=_inc_xby + //SEG64 [32] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ] ( main:2::rvalue:7 [ rvalue::i#1 ] ) -- xby=_inc_xby inx - //SEG66 [29] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1] - //SEG67 [29] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy + //SEG65 [28] phi from rvalue::@2 to rvalue::@1 [phi:rvalue::@2->rvalue::@1] + //SEG66 [28] phi (byte) rvalue::i#2 = (byte) rvalue::i#1 [phi:rvalue::@2->rvalue::@1#0] -- register_copy jmp b1 } -//SEG68 lvalue +//SEG67 lvalue lvalue: { .const SCREEN = $400 - //SEG69 [34] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 + //SEG68 [33] *((const byte[1024]) lvalue::SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 lda #1 sta SCREEN - //SEG70 [35] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 + //SEG69 [34] *((const byte[1024]) lvalue::SCREEN#0+(byte/signed byte/word/signed word) 1) ← (byte/signed byte/word/signed word) 2 [ ] ( main:2::lvalue:5 [ ] ) -- _deref_cowo1=coby2 lda #2 sta SCREEN+1 - //SEG71 [36] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1] - //SEG72 [36] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:lvalue->lvalue::@1#0] -- xby=coby1 + //SEG70 [35] phi from lvalue to lvalue::@1 [phi:lvalue->lvalue::@1] + //SEG71 [35] phi (byte) lvalue::i#2 = (byte/signed byte/word/signed word) 2 [phi:lvalue->lvalue::@1#0] -- xby=coby1 tax - //SEG73 lvalue::@1 + //SEG72 lvalue::@1 b1: - //SEG74 [37] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- xby_lt_coby1_then_la1 + //SEG73 [36] if((byte) lvalue::i#2<(byte/signed byte/word/signed word) 10) goto lvalue::@2 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- xby_lt_coby1_then_la1 cpx #$a bcc b2 - //SEG75 lvalue::@return - //SEG76 [38] return [ ] ( main:2::lvalue:5 [ ] ) + //SEG74 lvalue::@return + //SEG75 [37] return [ ] ( main:2::lvalue:5 [ ] ) rts - //SEG77 lvalue::@2 + //SEG76 lvalue::@2 b2: - //SEG78 [39] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- cowo1_derefidx_xby=coby2 + //SEG77 [38] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte/signed byte/word/signed word) 3 [ lvalue::i#2 ] ( main:2::lvalue:5 [ lvalue::i#2 ] ) -- cowo1_derefidx_xby=coby2 lda #3 sta SCREEN,x - //SEG79 [40] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) -- xby=_inc_xby + //SEG78 [39] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ] ( main:2::lvalue:5 [ lvalue::i#1 ] ) -- xby=_inc_xby inx - //SEG80 [36] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1] - //SEG81 [36] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- register_copy + //SEG79 [35] phi from lvalue::@2 to lvalue::@1 [phi:lvalue::@2->lvalue::@1] + //SEG80 [35] phi (byte) lvalue::i#2 = (byte) lvalue::i#1 [phi:lvalue::@2->lvalue::@1#0] -- 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 1f0d58132..fc362fb94 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.sym @@ -44,11 +44,9 @@ (label) rvaluevar::@1 (label) rvaluevar::@2 (label) rvaluevar::@return -(byte) rvaluevar::b -(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 +(byte) rvaluevar::i#2 reg byte x 11.0 (byte*) rvaluevar::screen (byte*) rvaluevar::screen#1 screen zp ZP_PTR_BYTE:2 11.0 (byte*) rvaluevar::screen#2 screen zp ZP_PTR_BYTE:2 11.0 @@ -58,7 +56,6 @@ zp ZP_PTR_BYTE:2 [ lvaluevar::screen#2 lvaluevar::screen#1 rvaluevar::screen#2 r reg byte x [ rvaluevar::i#2 rvaluevar::i#1 ] reg byte x [ rvalue::i#2 rvalue::i#1 ] reg byte x [ lvalue::i#2 lvalue::i#1 ] -reg byte a [ rvaluevar::b#0 ] reg byte a [ rvalue::b#0 ] reg byte a [ rvalue::b#1 ] reg byte a [ rvalue::b#2 ] 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 9031ca56e..02d490603 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.log @@ -80,9 +80,9 @@ main::@return: scope:[main] from main::@3 to:@end @end: scope:[] from @1 -Eliminating unused variable (byte) main::b and assignment (byte) main::b ← (byte~) main::$1 -Eliminating unused variable (byte~) main::$1 and assignment (byte~) main::$1 ← (byte[1024]) main::SCREEN *idx (byte) main::i -Eliminating unused variable (byte[1024]) main::SCREEN and assignment (byte[1024]) main::SCREEN ← ((byte*)) (word/signed word) 1024 +Eliminating unused variable (byte) main::b and assignment [5] (byte) main::b ← (byte~) main::$1 +Eliminating unused variable (byte~) main::$1 and assignment [4] (byte~) main::$1 ← (byte[1024]) main::SCREEN *idx (byte) main::i +Eliminating unused variable (byte[1024]) main::SCREEN and assignment [0] (byte[1024]) main::SCREEN ← ((byte*)) (word/signed word) 1024 Removing empty block main::@4 Removing empty block main::@3 Removing empty block main::@5 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/scroll-clobber.log b/src/main/java/dk/camelot64/kickc/test/ref/scroll-clobber.log index 245584527..97671a466 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/scroll-clobber.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/scroll-clobber.log @@ -94,7 +94,7 @@ main::@return: scope:[main] from main::@4 to:@end @end: scope:[] from @1 -Eliminating unused variable (byte*) SCROLL and assignment (byte*) SCROLL ← ((byte*)) (word) 53270 +Eliminating unused variable (byte*) SCROLL and assignment [1] (byte*) SCROLL ← ((byte*)) (word) 53270 Removing empty block main::@4 CONTROL FLOW GRAPH @begin: scope:[] from diff --git a/src/main/java/dk/camelot64/kickc/test/ref/unused-vars.log b/src/main/java/dk/camelot64/kickc/test/ref/unused-vars.log index 1f5092cfa..bfa49992c 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/unused-vars.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/unused-vars.log @@ -178,25 +178,25 @@ s::@1: scope:[s] from to:@end @end: scope:[] from @2 -Eliminating unused variable (byte*) BGCOL and assignment (byte*) BGCOL ← ((byte*)) (word) 53281 -Eliminating unused variable (byte[]) msg and assignment (byte[]) msg ← (string) "hello world@" -Eliminating unused variable (byte[]) arr and assignment (byte[]) arr ← { (byte/signed byte/word/signed word) 7, (byte/signed byte/word/signed word) 8, (byte/signed byte/word/signed word) 9 } -Eliminating unused variable (byte) c and assignment (byte) c ← (byte/signed byte/word/signed word) 1 -Eliminating unused variable (byte) c2 and assignment (byte) c2 ← (byte/signed byte/word/signed word) 1 -Eliminating unused variable (byte) main::e and assignment (byte) main::e ← (byte~) main::$3 -Eliminating unused variable (word) main::f and assignment (word) main::f ← (word~) main::$6 -Eliminating unused variable (byte[]) main::g and assignment (byte[]) main::g ← { (byte/signed byte/word/signed word) 4, (byte/signed byte/word/signed word) 5, (byte/signed byte/word/signed word) 6 } -Eliminating unused variable (byte[]) main::h and assignment (byte[]) main::h ← (string) "goodbye sky " -Eliminating unused variable (signed byte) main::x and assignment (signed byte) main::x ← (signed byte/signed word~) main::$7 -Eliminating unused variable (byte~) main::$3 and assignment (byte~) main::$3 ← (byte~) main::$1 + (byte~) main::$2 -Eliminating unused variable (word~) main::$6 and assignment (word~) main::$6 ← (word~) main::$5 + (byte) b -Eliminating unused variable (signed byte/signed word~) main::$7 and assignment (signed byte/signed word~) main::$7 ← - (byte/signed byte/word/signed word) 13 -Eliminating unused variable (byte~) main::$1 and assignment (byte~) main::$1 ← (byte/signed byte/word/signed word~) main::$0 + (byte/signed byte/word/signed word) 3 +Eliminating unused variable (byte*) BGCOL and assignment [3] (byte*) BGCOL ← ((byte*)) (word) 53281 +Eliminating unused variable (byte[]) msg and assignment [4] (byte[]) msg ← (string) "hello world@" +Eliminating unused variable (byte[]) arr and assignment [5] (byte[]) arr ← { (byte/signed byte/word/signed word) 7, (byte/signed byte/word/signed word) 8, (byte/signed byte/word/signed word) 9 } +Eliminating unused variable (byte) c and assignment [6] (byte) c ← (byte/signed byte/word/signed word) 1 +Eliminating unused variable (byte) c2 and assignment [7] (byte) c2 ← (byte/signed byte/word/signed word) 1 +Eliminating unused variable (byte) main::e and assignment [15] (byte) main::e ← (byte~) main::$3 +Eliminating unused variable (word) main::f and assignment [19] (word) main::f ← (word~) main::$6 +Eliminating unused variable (byte[]) main::g and assignment [21] (byte[]) main::g ← { (byte/signed byte/word/signed word) 4, (byte/signed byte/word/signed word) 5, (byte/signed byte/word/signed word) 6 } +Eliminating unused variable (byte[]) main::h and assignment [22] (byte[]) main::h ← (string) "goodbye sky " +Eliminating unused variable (signed byte) main::x and assignment [25] (signed byte) main::x ← (signed byte/signed word~) main::$7 +Eliminating unused variable (byte~) main::$3 and assignment [9] (byte~) main::$3 ← (byte~) main::$1 + (byte~) main::$2 +Eliminating unused variable (word~) main::$6 and assignment [12] (word~) main::$6 ← (word~) main::$5 + (byte) b +Eliminating unused variable (signed byte/signed word~) main::$7 and assignment [15] (signed byte/signed word~) main::$7 ← - (byte/signed byte/word/signed word) 13 +Eliminating unused variable (byte~) main::$1 and assignment [7] (byte~) main::$1 ← (byte/signed byte/word/signed word~) main::$0 + (byte/signed byte/word/signed word) 3 Eliminating unused variable - keeping the call (byte~) main::$2 -Eliminating unused variable (word~) main::$5 and assignment (word~) main::$5 ← (word/signed word~) main::$4 + (word) d -Eliminating unused variable (word) d and assignment (word) d ← (word/signed word) 1000 -Eliminating unused variable (byte/signed byte/word/signed word~) main::$0 and assignment (byte/signed byte/word/signed word~) main::$0 ← (byte/signed byte/word/signed word) 3 + (byte/signed byte/word/signed word) 3 -Eliminating unused variable (word/signed word~) main::$4 and assignment (word/signed word~) main::$4 ← (word/signed word) 2000 + (word/signed word) 2000 +Eliminating unused variable (word~) main::$5 and assignment [10] (word~) main::$5 ← (word/signed word~) main::$4 + (word) d +Eliminating unused variable (word) d and assignment [3] (word) d ← (word/signed word) 1000 +Eliminating unused variable (byte/signed byte/word/signed word~) main::$0 and assignment [6] (byte/signed byte/word/signed word~) main::$0 ← (byte/signed byte/word/signed word) 3 + (byte/signed byte/word/signed word) 3 +Eliminating unused variable (word/signed word~) main::$4 and assignment [8] (word/signed word~) main::$4 ← (word/signed word) 2000 + (word/signed word) 2000 Removing empty block main::@2 Removing empty block @1 Removing empty block s::@1