From 61d16b3030cca1090279792dfd80b7b4c09532f3 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Sat, 26 Aug 2017 02:05:46 +0200 Subject: [PATCH] Implemented phi transition reuse when transitions are identical on a register basis --- src/main/java/dk/camelot64/kickc/TODO.txt | 5 +- .../kickc/passes/Pass4CodeGeneration.java | 44 +- .../dk/camelot64/kickc/test/ref/bresenham.log | 136 +++--- .../camelot64/kickc/test/ref/bresenhamarr.log | 122 +++--- .../dk/camelot64/kickc/test/ref/loopmin.log | 98 ++--- .../dk/camelot64/kickc/test/ref/loopsplit.asm | 3 +- .../dk/camelot64/kickc/test/ref/loopsplit.log | 94 +++-- .../dk/camelot64/kickc/test/ref/voronoi.log | 390 ++++++++---------- 8 files changed, 422 insertions(+), 470 deletions(-) diff --git a/src/main/java/dk/camelot64/kickc/TODO.txt b/src/main/java/dk/camelot64/kickc/TODO.txt index 6ee4c7bc6..98d2c8bd1 100644 --- a/src/main/java/dk/camelot64/kickc/TODO.txt +++ b/src/main/java/dk/camelot64/kickc/TODO.txt @@ -30,6 +30,7 @@ Assembler Improvements - Make generated ASM human readable. + Use hex-numbers - add labels for constants and zp-variables. +- Eliminate chained JMP's (replace by direct JMP) - example: loopsplit.asm - Better ASM static value analysis - Not just constants - but also other values (value of var, value of var1[var2], value of var+4 etc.) - Also analyze back/forward through block entry/exit @@ -48,8 +49,6 @@ Known Problems Register Allocation - Allow user to limit number of combinations tested - Safe-Copy based SSA deconstruction - - Reuse phi-transitions that are identical - - Optimize phi transitions by ensuring that identical phi-transitions with regards to register allocation are collected into a single transition. - Optimize by finding optimal sequence for multiple phi assignments in entry-segments. - Avoid clobbering alive vars - Maybe support several fragments for the same operation with different cost and clobbering profiles. @@ -58,6 +57,8 @@ Register Allocation - Improve combination testing by finding live range overlaps and not creating combinations that would create an overlap conflict. - Combinations should be created in a tree-structure instead of just doing all combinations - Example: For equivalence classes a, b, c if a&c have overlapping live ranges they can never have the same register. Therefore the combination iterator should not create combinations where C has the same register as a. ++ Reuse phi-transitions that are identical ++ Optimize phi transitions by ensuring that identical phi-transitions with regards to register allocation are collected into a single transition. + Limit number of combinations tested + Equivalences not tested through combinaitons should be tested individually afterwards. + Matrix Phi operation (instead of separate statements) diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java b/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java index 28e8cf1ad..315a7dc8a 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java @@ -55,9 +55,19 @@ public class Pass4CodeGeneration { ControlFlowBlock defaultSuccessor = getGraph().getDefaultSuccessor(block); if (defaultSuccessor != null) { if (defaultSuccessor.hasPhiBlock()) { - genBlockPhiTransition(asm, block, defaultSuccessor, defaultSuccessor.getScope()); + PhiTransitions.PhiTransition transition = getTransitions(defaultSuccessor).getTransition(block); + if (!transition.isGenerated()) { + genBlockPhiTransition(asm, block, defaultSuccessor, defaultSuccessor.getScope()); + String label = defaultSuccessor.getLabel().getLocalName().replace('@', 'b').replace(':', '_'); + asm.addInstruction("JMP", AsmAddressingMode.ABS, label, false); + } else { + String label = (defaultSuccessor.getLabel().getLocalName() + "_from_" + block.getLabel().getLocalName()).replace('@', 'b').replace(':', '_'); + asm.addInstruction("JMP", AsmAddressingMode.ABS, label, false); + } + } else { + String label = defaultSuccessor.getLabel().getLocalName().replace('@', 'b').replace(':', '_'); + asm.addInstruction("JMP", AsmAddressingMode.ABS, label, false); } - asm.addInstruction("JMP", AsmAddressingMode.ABS, defaultSuccessor.getLabel().getLocalName().replace('@', 'b').replace(':', '_'), false); } } if (!ScopeRef.ROOT.equals(currentScope)) { @@ -159,6 +169,10 @@ public class Pass4CodeGeneration { if (genCallPhiEntry) { ControlFlowBlock callSuccessor = getGraph().getCallSuccessor(block); if (callSuccessor != null && callSuccessor.hasPhiBlock()) { + PhiTransitions.PhiTransition transition = getTransitions(callSuccessor).getTransition(block); + if (transition.isGenerated()) { + throw new RuntimeException("Error! JSR transition already generated. Must modify PhiTransitions code to ensure this does not happen."); + } genBlockPhiTransition(asm, block, callSuccessor, block.getScope()); } } @@ -246,6 +260,8 @@ public class Pass4CodeGeneration { genAsmMove(asm, assignment.getVariable(), assignment.getrValue(), assignment.getPhiBlock(), scope); } transition.setGenerated(true); + } else { + program.getLog().append("Already generated transition from "+fromBlock.getLabel()+" to "+toBlock.getLabel()+ " - not generating it again!"); } } @@ -315,13 +331,14 @@ public class Pass4CodeGeneration { /** * Find the transition from a specific fromBlock. * If another transition already has the same assignments it is reused. If not a new transition is created. + * * @param fromBlock * @return */ private PhiTransition findTransition(ControlFlowBlock fromBlock) { PhiTransition transition = new PhiTransition(fromBlock); for (PhiTransition candidate : transitions.values()) { - if(candidate.equalAssignments(transition)) { + if (candidate.equalAssignments(transition)) { candidate.addFromBlock(fromBlock); return candidate; } @@ -409,21 +426,35 @@ public class Pass4CodeGeneration { /** * Determines if another transition has the exact same assignments as this block + * * @param other The other transition to examine * @return true if the assignments are identical */ public boolean equalAssignments(PhiTransition other) { List otherAssignments = other.getAssignments(); - if(assignments.size()!=otherAssignments.size()) { + if (assignments.size() != otherAssignments.size()) { return false; } for (int i = 0; i < assignments.size(); i++) { PhiAssignment assignment = assignments.get(i); PhiAssignment otherAssignment = otherAssignments.get(i); - if(!assignment.getVariable().equals(otherAssignment.getVariable())) { + ProgramScope scope = program.getScope(); + if (assignment.getVariable() instanceof VariableRef && otherAssignment.getVariable() instanceof VariableRef) { + Variable var = scope.getVariable((VariableRef) assignment.getVariable()); + Variable otherVar = scope.getVariable((VariableRef) otherAssignment.getVariable()); + if (!var.getAllocation().equals(otherVar.getAllocation())) { + return false; + } + } else if (!assignment.getVariable().equals(otherAssignment.getVariable())) { return false; } - if(!assignment.getrValue().equals(otherAssignment.getrValue())) { + if (assignment.getrValue() instanceof VariableRef && otherAssignment.getrValue() instanceof VariableRef) { + Variable var = scope.getVariable((VariableRef) assignment.getrValue()); + Variable otherVar = scope.getVariable((VariableRef) otherAssignment.getrValue()); + if (!var.getAllocation().equals(otherVar.getAllocation())) { + return false; + } + } else if (!assignment.getrValue().equals(otherAssignment.getrValue())) { return false; } } @@ -466,7 +497,6 @@ public class Pass4CodeGeneration { } - private Registers.Register getRegister(RValue rValue) { if (rValue instanceof VariableRef) { VariableRef rValueRef = (VariableRef) rValue; diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log index 8f48c6350..56beae5a6 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log @@ -1585,28 +1585,23 @@ main: { sec sbc #$27 sta e - //SEG25 [10] phi from main::@3 to main::@2 - b2_from_b3: - //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#1 -- register_copy - //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#2 -- register_copy - //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#2 -- register_copy - jmp b2 - //SEG29 [10] phi from main::@1 to main::@2 + //SEG25 [10] phi from main::@1 main::@3 to main::@2 b2_from_b1: - //SEG30 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy - //SEG31 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy - //SEG32 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy + b2_from_b3: + //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy + //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy + //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy jmp b2 - //SEG33 main::@2 + //SEG29 main::@2 b2: - //SEG34 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 + //SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1_from_b2 jmp breturn - //SEG35 main::@return + //SEG31 main::@return breturn: - //SEG36 [12] return [ ] + //SEG32 [12] return [ ] rts } @@ -1634,8 +1629,8 @@ REGISTER UPLIFT SCOPES Uplift Scope [main] 55: zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ] 46.75: zp ZP_PTR_BYTE:2 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ] 29.33: zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] 14.67: zp ZP_BYTE:4 [ main::x#2 main::x#1 ] Uplift Scope [] -Uplifting [main] best 1195 combination reg byte x [ main::e#3 main::e#5 main::e#1 main::e#2 ] zp ZP_PTR_BYTE:2 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ] zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] zp ZP_BYTE:4 [ main::x#2 main::x#1 ] -Uplifting [] best 1195 combination +Uplifting [main] best 1165 combination reg byte x [ main::e#3 main::e#5 main::e#1 main::e#2 ] zp ZP_PTR_BYTE:2 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ] zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] zp ZP_BYTE:4 [ main::x#2 main::x#1 ] +Uplifting [] best 1165 combination Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ] Removing instruction jmp bend Removing instruction jmp b1 @@ -1716,26 +1711,21 @@ main: { sec sbc #$27 tax - //SEG25 [10] phi from main::@3 to main::@2 - b2_from_b3: - //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#1 -- register_copy - //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#2 -- register_copy - //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#2 -- register_copy - jmp b2 - //SEG29 [10] phi from main::@1 to main::@2 + //SEG25 [10] phi from main::@1 main::@3 to main::@2 b2_from_b1: - //SEG30 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy - //SEG31 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy - //SEG32 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy - //SEG33 main::@2 + b2_from_b3: + //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy + //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy + //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy + //SEG29 main::@2 b2: - //SEG34 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 + //SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1_from_b2 - //SEG35 main::@return + //SEG31 main::@return breturn: - //SEG36 [12] return [ ] + //SEG32 [12] return [ ] rts } @@ -1743,6 +1733,7 @@ Replacing label b2_from_b1 with b2 Replacing label b1_from_b2 with b1 Removing instruction b1_from_b2: Removing instruction b2_from_b1: +Removing instruction b2_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination ASSEMBLER //SEG0 Global ZP labels @@ -1816,25 +1807,19 @@ main: { sec sbc #$27 tax - //SEG25 [10] phi from main::@3 to main::@2 - b2_from_b3: - //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#1 -- register_copy - //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#2 -- register_copy - //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#2 -- register_copy - jmp b2 - //SEG29 [10] phi from main::@1 to main::@2 - //SEG30 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy - //SEG31 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy - //SEG32 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy - //SEG33 main::@2 + //SEG25 [10] phi from main::@1 main::@3 to main::@2 + //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy + //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy + //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy + //SEG29 main::@2 b2: - //SEG34 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 + //SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1 - //SEG35 main::@return + //SEG31 main::@return breturn: - //SEG36 [12] return [ ] + //SEG32 [12] return [ ] rts } @@ -1842,7 +1827,6 @@ Removing instruction bbegin: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3: -Removing instruction b2_from_b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination ASSEMBLER @@ -1913,28 +1897,22 @@ main: { sec sbc #$27 tax - //SEG25 [10] phi from main::@3 to main::@2 - //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#1 -- register_copy - //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#2 -- register_copy - //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#2 -- register_copy - jmp b2 - //SEG29 [10] phi from main::@1 to main::@2 - //SEG30 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy - //SEG31 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy - //SEG32 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy - //SEG33 main::@2 + //SEG25 [10] phi from main::@1 main::@3 to main::@2 + //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy + //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy + //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy + //SEG29 main::@2 b2: - //SEG34 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 + //SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1 - //SEG35 main::@return - //SEG36 [12] return [ ] + //SEG31 main::@return + //SEG32 [12] return [ ] rts } Removing instruction jmp b1 -Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination ASSEMBLER //SEG0 Global ZP labels @@ -2003,22 +1981,18 @@ main: { sec sbc #$27 tax - //SEG25 [10] phi from main::@3 to main::@2 - //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#1 -- register_copy - //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#2 -- register_copy - //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#2 -- register_copy - //SEG29 [10] phi from main::@1 to main::@2 - //SEG30 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy - //SEG31 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy - //SEG32 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy - //SEG33 main::@2 + //SEG25 [10] phi from main::@1 main::@3 to main::@2 + //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy + //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy + //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy + //SEG29 main::@2 b2: - //SEG34 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 + //SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1 - //SEG35 main::@return - //SEG36 [12] return [ ] + //SEG31 main::@return + //SEG32 [12] return [ ] rts } @@ -2128,22 +2102,18 @@ main: { sec sbc #$27 tax - //SEG25 [10] phi from main::@3 to main::@2 - //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#1 -- register_copy - //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#2 -- register_copy - //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#2 -- register_copy - //SEG29 [10] phi from main::@1 to main::@2 - //SEG30 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy - //SEG31 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy - //SEG32 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy - //SEG33 main::@2 + //SEG25 [10] phi from main::@1 main::@3 to main::@2 + //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy + //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy + //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy + //SEG29 main::@2 b2: - //SEG34 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 + //SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1 - //SEG35 main::@return - //SEG36 [12] return [ ] + //SEG31 main::@return + //SEG32 [12] return [ ] rts } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.log b/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.log index a5b54c0e8..82826e30e 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.log @@ -1276,26 +1276,21 @@ b3: sec sbc #$27 sta e -//SEG22 [9] phi from @3 to @2 -b2_from_b3: -//SEG23 [9] phi (byte) y#4 = (byte) y#1 -- register_copy -//SEG24 [9] phi (byte) e#5 = (byte) e#2 -- register_copy -//SEG25 [9] phi (word) idx#5 = (word) idx#2 -- register_copy - jmp b2 -//SEG26 [9] phi from @1 to @2 +//SEG22 [9] phi from @1 @3 to @2 b2_from_b1: -//SEG27 [9] phi (byte) y#4 = (byte) y#2 -- register_copy -//SEG28 [9] phi (byte) e#5 = (byte) e#1 -- register_copy -//SEG29 [9] phi (word) idx#5 = (word) idx#1 -- register_copy +b2_from_b3: +//SEG23 [9] phi (byte) y#4 = (byte) y#2 -- register_copy +//SEG24 [9] phi (byte) e#5 = (byte) e#1 -- register_copy +//SEG25 [9] phi (word) idx#5 = (word) idx#1 -- register_copy jmp b2 -//SEG30 @2 +//SEG26 @2 b2: -//SEG31 [10] if((byte) x#1<(byte) 40) goto @1 [ idx#5 x#1 e#5 y#4 ] -- zpby1_lt_coby1_then_la1 +//SEG27 [10] if((byte) x#1<(byte) 40) goto @1 [ idx#5 x#1 e#5 y#4 ] -- zpby1_lt_coby1_then_la1 lda x cmp #$28 bcc b1_from_b2 jmp bend -//SEG32 @end +//SEG28 @end bend: Statement [1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ] always clobbers reg byte a @@ -1318,7 +1313,7 @@ Potential registers zp ZP_BYTE:6 [ y#2 y#4 y#1 ] : zp ZP_BYTE:6 , reg byte x , r REGISTER UPLIFT SCOPES Uplift Scope [] 55: zp ZP_BYTE:5 [ e#3 e#5 e#1 e#2 ] 46.75: zp ZP_WORD:2 [ idx#3 idx#5 idx#1 idx#2 ] 29.33: zp ZP_BYTE:6 [ y#2 y#4 y#1 ] 14.67: zp ZP_BYTE:4 [ x#2 x#1 ] -Uplifting [] best 1250 combination reg byte y [ e#3 e#5 e#1 e#2 ] zp ZP_WORD:2 [ idx#3 idx#5 idx#1 idx#2 ] zp ZP_BYTE:6 [ y#2 y#4 y#1 ] reg byte x [ x#2 x#1 ] +Uplifting [] best 1220 combination reg byte y [ e#3 e#5 e#1 e#2 ] zp ZP_WORD:2 [ idx#3 idx#5 idx#1 idx#2 ] zp ZP_BYTE:6 [ y#2 y#4 y#1 ] reg byte x [ x#2 x#1 ] Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:4 [ y#2 y#4 y#1 ] Removing instruction jmp b1 Removing instruction jmp b3 @@ -1397,23 +1392,18 @@ b3: sec sbc #$27 tay -//SEG22 [9] phi from @3 to @2 -b2_from_b3: -//SEG23 [9] phi (byte) y#4 = (byte) y#1 -- register_copy -//SEG24 [9] phi (byte) e#5 = (byte) e#2 -- register_copy -//SEG25 [9] phi (word) idx#5 = (word) idx#2 -- register_copy - jmp b2 -//SEG26 [9] phi from @1 to @2 +//SEG22 [9] phi from @1 @3 to @2 b2_from_b1: -//SEG27 [9] phi (byte) y#4 = (byte) y#2 -- register_copy -//SEG28 [9] phi (byte) e#5 = (byte) e#1 -- register_copy -//SEG29 [9] phi (word) idx#5 = (word) idx#1 -- register_copy -//SEG30 @2 +b2_from_b3: +//SEG23 [9] phi (byte) y#4 = (byte) y#2 -- register_copy +//SEG24 [9] phi (byte) e#5 = (byte) e#1 -- register_copy +//SEG25 [9] phi (word) idx#5 = (word) idx#1 -- register_copy +//SEG26 @2 b2: -//SEG31 [10] if((byte) x#1<(byte) 40) goto @1 [ idx#5 x#1 e#5 y#4 ] -- xby_lt_coby1_then_la1 +//SEG27 [10] if((byte) x#1<(byte) 40) goto @1 [ idx#5 x#1 e#5 y#4 ] -- xby_lt_coby1_then_la1 cpx #$28 bcc b1_from_b2 -//SEG32 @end +//SEG28 @end bend: Replacing label b2_from_b1 with b2 @@ -1421,6 +1411,7 @@ Replacing label b1_from_b2 with b1 Removing instruction b1_from_bbegin: Removing instruction b1_from_b2: Removing instruction b2_from_b1: +Removing instruction b2_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination ASSEMBLER //SEG0 Global ZP labels @@ -1492,27 +1483,20 @@ b3: sec sbc #$27 tay -//SEG22 [9] phi from @3 to @2 -b2_from_b3: -//SEG23 [9] phi (byte) y#4 = (byte) y#1 -- register_copy -//SEG24 [9] phi (byte) e#5 = (byte) e#2 -- register_copy -//SEG25 [9] phi (word) idx#5 = (word) idx#2 -- register_copy - jmp b2 -//SEG26 [9] phi from @1 to @2 -//SEG27 [9] phi (byte) y#4 = (byte) y#2 -- register_copy -//SEG28 [9] phi (byte) e#5 = (byte) e#1 -- register_copy -//SEG29 [9] phi (word) idx#5 = (word) idx#1 -- register_copy -//SEG30 @2 +//SEG22 [9] phi from @1 @3 to @2 +//SEG23 [9] phi (byte) y#4 = (byte) y#2 -- register_copy +//SEG24 [9] phi (byte) e#5 = (byte) e#1 -- register_copy +//SEG25 [9] phi (word) idx#5 = (word) idx#1 -- register_copy +//SEG26 @2 b2: -//SEG31 [10] if((byte) x#1<(byte) 40) goto @1 [ idx#5 x#1 e#5 y#4 ] -- xby_lt_coby1_then_la1 +//SEG27 [10] if((byte) x#1<(byte) 40) goto @1 [ idx#5 x#1 e#5 y#4 ] -- xby_lt_coby1_then_la1 cpx #$28 bcc b1 -//SEG32 @end +//SEG28 @end bend: Removing instruction bbegin: Removing instruction b3: -Removing instruction b2_from_b3: Removing instruction bend: Succesful ASM optimization Pass5UnusedLabelElimination ASSEMBLER @@ -1583,24 +1567,18 @@ b1: sec sbc #$27 tay -//SEG22 [9] phi from @3 to @2 -//SEG23 [9] phi (byte) y#4 = (byte) y#1 -- register_copy -//SEG24 [9] phi (byte) e#5 = (byte) e#2 -- register_copy -//SEG25 [9] phi (word) idx#5 = (word) idx#2 -- register_copy - jmp b2 -//SEG26 [9] phi from @1 to @2 -//SEG27 [9] phi (byte) y#4 = (byte) y#2 -- register_copy -//SEG28 [9] phi (byte) e#5 = (byte) e#1 -- register_copy -//SEG29 [9] phi (word) idx#5 = (word) idx#1 -- register_copy -//SEG30 @2 +//SEG22 [9] phi from @1 @3 to @2 +//SEG23 [9] phi (byte) y#4 = (byte) y#2 -- register_copy +//SEG24 [9] phi (byte) e#5 = (byte) e#1 -- register_copy +//SEG25 [9] phi (word) idx#5 = (word) idx#1 -- register_copy +//SEG26 @2 b2: -//SEG31 [10] if((byte) x#1<(byte) 40) goto @1 [ idx#5 x#1 e#5 y#4 ] -- xby_lt_coby1_then_la1 +//SEG27 [10] if((byte) x#1<(byte) 40) goto @1 [ idx#5 x#1 e#5 y#4 ] -- xby_lt_coby1_then_la1 cpx #$28 bcc b1 -//SEG32 @end +//SEG28 @end Removing instruction jmp b1 -Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination ASSEMBLER //SEG0 Global ZP labels @@ -1669,20 +1647,16 @@ b1: sec sbc #$27 tay -//SEG22 [9] phi from @3 to @2 -//SEG23 [9] phi (byte) y#4 = (byte) y#1 -- register_copy -//SEG24 [9] phi (byte) e#5 = (byte) e#2 -- register_copy -//SEG25 [9] phi (word) idx#5 = (word) idx#2 -- register_copy -//SEG26 [9] phi from @1 to @2 -//SEG27 [9] phi (byte) y#4 = (byte) y#2 -- register_copy -//SEG28 [9] phi (byte) e#5 = (byte) e#1 -- register_copy -//SEG29 [9] phi (word) idx#5 = (word) idx#1 -- register_copy -//SEG30 @2 +//SEG22 [9] phi from @1 @3 to @2 +//SEG23 [9] phi (byte) y#4 = (byte) y#2 -- register_copy +//SEG24 [9] phi (byte) e#5 = (byte) e#1 -- register_copy +//SEG25 [9] phi (word) idx#5 = (word) idx#1 -- register_copy +//SEG26 @2 b2: -//SEG31 [10] if((byte) x#1<(byte) 40) goto @1 [ idx#5 x#1 e#5 y#4 ] -- xby_lt_coby1_then_la1 +//SEG27 [10] if((byte) x#1<(byte) 40) goto @1 [ idx#5 x#1 e#5 y#4 ] -- xby_lt_coby1_then_la1 cpx #$28 bcc b1 -//SEG32 @end +//SEG28 @end FINAL SYMBOL TABLE (label) @1 @@ -1788,18 +1762,14 @@ b1: sec sbc #$27 tay -//SEG22 [9] phi from @3 to @2 -//SEG23 [9] phi (byte) y#4 = (byte) y#1 -- register_copy -//SEG24 [9] phi (byte) e#5 = (byte) e#2 -- register_copy -//SEG25 [9] phi (word) idx#5 = (word) idx#2 -- register_copy -//SEG26 [9] phi from @1 to @2 -//SEG27 [9] phi (byte) y#4 = (byte) y#2 -- register_copy -//SEG28 [9] phi (byte) e#5 = (byte) e#1 -- register_copy -//SEG29 [9] phi (word) idx#5 = (word) idx#1 -- register_copy -//SEG30 @2 +//SEG22 [9] phi from @1 @3 to @2 +//SEG23 [9] phi (byte) y#4 = (byte) y#2 -- register_copy +//SEG24 [9] phi (byte) e#5 = (byte) e#1 -- register_copy +//SEG25 [9] phi (word) idx#5 = (word) idx#1 -- register_copy +//SEG26 @2 b2: -//SEG31 [10] if((byte) x#1<(byte) 40) goto @1 [ idx#5 x#1 e#5 y#4 ] -- xby_lt_coby1_then_la1 +//SEG27 [10] if((byte) x#1<(byte) 40) goto @1 [ idx#5 x#1 e#5 y#4 ] -- xby_lt_coby1_then_la1 cpx #$28 bcc b1 -//SEG32 @end +//SEG28 @end diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopmin.log b/src/main/java/dk/camelot64/kickc/test/ref/loopmin.log index b66cb5fdd..57e210b00 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopmin.log @@ -477,23 +477,20 @@ b3: clc adc i sta s -//SEG12 [3] phi from @3 to @2 -b2_from_b3: -//SEG13 [3] phi (byte) s#4 = (byte) s#1 -- register_copy - jmp b2 -//SEG14 [3] phi from @1 to @2 +//SEG12 [3] phi from @1 @3 to @2 b2_from_b1: -//SEG15 [3] phi (byte) s#4 = (byte) s#2 -- register_copy +b2_from_b3: +//SEG13 [3] phi (byte) s#4 = (byte) s#2 -- register_copy jmp b2 -//SEG16 @2 +//SEG14 @2 b2: -//SEG17 [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] -- zpby1=_dec_zpby1 +//SEG15 [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] -- zpby1=_dec_zpby1 dec i -//SEG18 [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] -- zpby1_gt_0_then_la1 +//SEG16 [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] -- zpby1_gt_0_then_la1 lda i bne b1_from_b2 jmp bend -//SEG19 @end +//SEG17 @end bend: REGISTER UPLIFT POTENTIAL REGISTERS @@ -503,7 +500,7 @@ Potential registers zp ZP_BYTE:3 [ s#2 s#4 s#1 ] : zp ZP_BYTE:3 , reg byte a , r REGISTER UPLIFT SCOPES Uplift Scope [] 49.5: zp ZP_BYTE:3 [ s#2 s#4 s#1 ] 27.5: zp ZP_BYTE:2 [ i#2 i#1 ] -Uplifting [] best 435 combination reg byte a [ s#2 s#4 s#1 ] reg byte x [ i#2 i#1 ] +Uplifting [] best 405 combination reg byte a [ s#2 s#4 s#1 ] reg byte x [ i#2 i#1 ] Removing instruction jmp b1 Removing instruction jmp b3 Removing instruction jmp b2 @@ -536,21 +533,18 @@ b3: stx $ff clc adc $ff -//SEG12 [3] phi from @3 to @2 -b2_from_b3: -//SEG13 [3] phi (byte) s#4 = (byte) s#1 -- register_copy - jmp b2 -//SEG14 [3] phi from @1 to @2 +//SEG12 [3] phi from @1 @3 to @2 b2_from_b1: -//SEG15 [3] phi (byte) s#4 = (byte) s#2 -- register_copy -//SEG16 @2 +b2_from_b3: +//SEG13 [3] phi (byte) s#4 = (byte) s#2 -- register_copy +//SEG14 @2 b2: -//SEG17 [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] -- xby=_dec_xby +//SEG15 [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] -- xby=_dec_xby dex -//SEG18 [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] -- xby_gt_0_then_la1 +//SEG16 [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] -- xby_gt_0_then_la1 cpx #$0 bne b1_from_b2 -//SEG19 @end +//SEG17 @end bend: Replacing label b2_from_b1 with b2 @@ -559,6 +553,7 @@ Replacing label b1_from_b2 with b1 Removing instruction b1_from_bbegin: Removing instruction b1_from_b2: Removing instruction b2_from_b1: +Removing instruction b2_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination ASSEMBLER //SEG0 Global ZP labels @@ -585,25 +580,20 @@ b3: stx $ff clc adc $ff -//SEG12 [3] phi from @3 to @2 -b2_from_b3: -//SEG13 [3] phi (byte) s#4 = (byte) s#1 -- register_copy - jmp b2 -//SEG14 [3] phi from @1 to @2 -//SEG15 [3] phi (byte) s#4 = (byte) s#2 -- register_copy -//SEG16 @2 +//SEG12 [3] phi from @1 @3 to @2 +//SEG13 [3] phi (byte) s#4 = (byte) s#2 -- register_copy +//SEG14 @2 b2: -//SEG17 [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] -- xby=_dec_xby +//SEG15 [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] -- xby=_dec_xby dex -//SEG18 [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] -- xby_gt_0_then_la1 +//SEG16 [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] -- xby_gt_0_then_la1 cpx #$0 bne b1 -//SEG19 @end +//SEG17 @end bend: Removing instruction bbegin: Removing instruction b3: -Removing instruction b2_from_b3: Removing instruction bend: Succesful ASM optimization Pass5UnusedLabelElimination ASSEMBLER @@ -629,22 +619,18 @@ b1: stx $ff clc adc $ff -//SEG12 [3] phi from @3 to @2 -//SEG13 [3] phi (byte) s#4 = (byte) s#1 -- register_copy - jmp b2 -//SEG14 [3] phi from @1 to @2 -//SEG15 [3] phi (byte) s#4 = (byte) s#2 -- register_copy -//SEG16 @2 +//SEG12 [3] phi from @1 @3 to @2 +//SEG13 [3] phi (byte) s#4 = (byte) s#2 -- register_copy +//SEG14 @2 b2: -//SEG17 [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] -- xby=_dec_xby +//SEG15 [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] -- xby=_dec_xby dex -//SEG18 [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] -- xby_gt_0_then_la1 +//SEG16 [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] -- xby_gt_0_then_la1 cpx #$0 bne b1 -//SEG19 @end +//SEG17 @end Removing instruction jmp b1 -Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination ASSEMBLER //SEG0 Global ZP labels @@ -668,18 +654,16 @@ b1: stx $ff clc adc $ff -//SEG12 [3] phi from @3 to @2 -//SEG13 [3] phi (byte) s#4 = (byte) s#1 -- register_copy -//SEG14 [3] phi from @1 to @2 -//SEG15 [3] phi (byte) s#4 = (byte) s#2 -- register_copy -//SEG16 @2 +//SEG12 [3] phi from @1 @3 to @2 +//SEG13 [3] phi (byte) s#4 = (byte) s#2 -- register_copy +//SEG14 @2 b2: -//SEG17 [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] -- xby=_dec_xby +//SEG15 [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] -- xby=_dec_xby dex -//SEG18 [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] -- xby_gt_0_then_la1 +//SEG16 [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] -- xby_gt_0_then_la1 cpx #$0 bne b1 -//SEG19 @end +//SEG17 @end FINAL SYMBOL TABLE (label) @1 @@ -720,16 +704,14 @@ b1: stx $ff clc adc $ff -//SEG12 [3] phi from @3 to @2 -//SEG13 [3] phi (byte) s#4 = (byte) s#1 -- register_copy -//SEG14 [3] phi from @1 to @2 -//SEG15 [3] phi (byte) s#4 = (byte) s#2 -- register_copy -//SEG16 @2 +//SEG12 [3] phi from @1 @3 to @2 +//SEG13 [3] phi (byte) s#4 = (byte) s#2 -- register_copy +//SEG14 @2 b2: -//SEG17 [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] -- xby=_dec_xby +//SEG15 [4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ] -- xby=_dec_xby dex -//SEG18 [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] -- xby_gt_0_then_la1 +//SEG16 [5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ] -- xby_gt_0_then_la1 cpx #$0 bne b1 -//SEG19 @end +//SEG17 @end diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.asm b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.asm index bb01c5948..124aca971 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.asm +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.asm @@ -12,8 +12,9 @@ main: { bcc b4 beq b4 iny + b1_from_b8: jmp b1 b4: dey - jmp b1 + jmp b1_from_b8 } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log index 30f352118..64441a861 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopsplit.log @@ -662,20 +662,17 @@ main: { b8: //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- zpby1=_inc_zpby1 inc s - //SEG17 [1] phi from main::@8 to main::@1 + //SEG17 [1] phi from main::@4 main::@8 to main::@1 + b1_from_b4: b1_from_b8: - //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#2 -- register_copy + //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 //SEG20 main::@4 b4: //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- zpby1=_dec_zpby1 dec s - //SEG22 [1] phi from main::@4 to main::@1 - b1_from_b4: - //SEG23 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy - //SEG24 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - jmp b1 + jmp b1_from_b4 } REGISTER UPLIFT POTENTIAL REGISTERS @@ -730,20 +727,69 @@ main: { b8: //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby iny - //SEG17 [1] phi from main::@8 to main::@1 + //SEG17 [1] phi from main::@4 main::@8 to main::@1 + b1_from_b4: b1_from_b8: - //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#2 -- register_copy + //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 //SEG20 main::@4 b4: //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby dey - //SEG22 [1] phi from main::@4 to main::@1 - b1_from_b4: - //SEG23 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy - //SEG24 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy + jmp b1_from_b4 +} + +Replacing label b1_from_b4 with b1_from_b8 +Removing instruction b1_from_b4: +Succesful ASM optimization Pass5RedundantLabelElimination +ASSEMBLER +//SEG0 Global ZP labels +//SEG1 @begin +bbegin: +//SEG2 [0] call main param-assignment [ ] + jsr main +//SEG3 @end +bend: +//SEG4 main +main: { + //SEG5 [1] phi from main to main::@1 + b1_from_main: + //SEG6 [1] phi (byte) main::s#3 = (byte) 0 -- yby=coby1 + ldy #$0 + //SEG7 [1] phi (byte) main::i#2 = (byte) 100 -- xby=coby1 + ldx #$64 + //SEG8 main::@1 + b1: + //SEG9 [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] -- xby=_dec_xby + dex + //SEG10 [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] -- xby_gt_0_then_la1 + cpx #$0 + bne b2 + //SEG11 main::@return + breturn: + //SEG12 [4] return [ ] + rts + //SEG13 main::@2 + b2: + //SEG14 [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] -- xby_le_coby1_then_la1 + cpx #$32 + bcc b4 + beq b4 + //SEG15 main::@8 + b8: + //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby + iny + //SEG17 [1] phi from main::@4 main::@8 to main::@1 + b1_from_b8: + //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy + //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 + //SEG20 main::@4 + b4: + //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby + dey + jmp b1_from_b8 } Removing instruction bbegin: @@ -751,8 +797,6 @@ Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Removing instruction b8: -Removing instruction b1_from_b8: -Removing instruction b1_from_b4: Succesful ASM optimization Pass5UnusedLabelElimination ASSEMBLER //SEG0 Global ZP labels @@ -786,18 +830,16 @@ main: { //SEG15 main::@8 //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby iny - //SEG17 [1] phi from main::@8 to main::@1 - //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#2 -- register_copy + //SEG17 [1] phi from main::@4 main::@8 to main::@1 + b1_from_b8: + //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 //SEG20 main::@4 b4: //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby dey - //SEG22 [1] phi from main::@4 to main::@1 - //SEG23 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy - //SEG24 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - jmp b1 + jmp b1_from_b8 } FINAL SYMBOL TABLE @@ -852,17 +894,15 @@ main: { //SEG15 main::@8 //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby iny - //SEG17 [1] phi from main::@8 to main::@1 - //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#2 -- register_copy + //SEG17 [1] phi from main::@4 main::@8 to main::@1 + b1_from_b8: + //SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy jmp b1 //SEG20 main::@4 b4: //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby dey - //SEG22 [1] phi from main::@4 to main::@1 - //SEG23 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy - //SEG24 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy - jmp b1 + jmp b1_from_b8 } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log index ee56fd0e0..55843882b 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log @@ -8946,8 +8946,9 @@ findcol: { sec sbc x sta diff - //SEG153 [73] phi from findcol::@12 to findcol::@5 + //SEG153 [73] phi from findcol::@12 findcol::@4 to findcol::@5 b5_from_b12: + b5_from_b4: //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy jmp b5 //SEG155 findcol::@5 @@ -8969,8 +8970,9 @@ findcol: { clc adc $12 sta diff_3 - //SEG160 [77] phi from findcol::@14 to findcol::@7 + //SEG160 [77] phi from findcol::@14 findcol::@6 to findcol::@7 b7_from_b14: + b7_from_b6: //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy jmp b7 //SEG162 findcol::@7 @@ -8986,8 +8988,9 @@ findcol: { ldx i lda $1200,x sta mincol - //SEG166 [80] phi from findcol::@16 to findcol::@8 + //SEG166 [80] phi from findcol::@16 findcol::@21 to findcol::@8 b8_from_b16: + b8_from_b21: //SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy jmp b8 @@ -9019,66 +9022,56 @@ findcol: { //SEG181 [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- zpby1=zpby2 lda mindiff sta mindiff_14 - //SEG182 [80] phi from findcol::@21 to findcol::@8 - b8_from_b21: - //SEG183 [80] phi (byte) findcol::mindiff#11 = (byte~) findcol::mindiff#14 -- register_copy - //SEG184 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#11 -- register_copy - jmp b8 - //SEG185 findcol::@6 + jmp b8_from_b21 + //SEG182 findcol::@6 b6: - //SEG186 [85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- zpby1=zpby2_minus_zpby3 + //SEG183 [85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- zpby1=zpby2_minus_zpby3 lda y sec sbc yp sta $14 - //SEG187 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_plus_zpby3 + //SEG184 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_plus_zpby3 lda diff clc adc $14 sta diff_2 - //SEG188 [77] phi from findcol::@6 to findcol::@7 - b7_from_b6: - //SEG189 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#2 -- register_copy - jmp b7 - //SEG190 findcol::@4 + jmp b7_from_b6 + //SEG185 findcol::@4 b4: - //SEG191 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby3 + //SEG186 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby3 lda x sec sbc xp sta diff - //SEG192 [73] phi from findcol::@4 to findcol::@5 - b5_from_b4: - //SEG193 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#0 -- register_copy - jmp b5 + jmp b5_from_b4 } -//SEG194 initscreen +//SEG187 initscreen initscreen: { .label screen = 11 - //SEG195 [88] phi from initscreen to initscreen::@1 + //SEG188 [88] phi from initscreen to initscreen::@1 b1_from_initscreen: - //SEG196 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 jmp b1 - //SEG197 [88] phi from initscreen::@1 to initscreen::@1 + //SEG190 [88] phi from initscreen::@1 to initscreen::@1 b1_from_b1: - //SEG198 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy + //SEG191 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy jmp b1 - //SEG199 initscreen::@1 + //SEG192 initscreen::@1 b1: - //SEG200 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 + //SEG193 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$e6 sta (screen),y - //SEG201 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 + //SEG194 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG202 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 + //SEG195 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda screen+$1 cmp #>$7e8 bcc b1_from_b1 @@ -9088,34 +9081,34 @@ initscreen: { bcc b1_from_b1 !: jmp breturn - //SEG203 initscreen::@return + //SEG196 initscreen::@return breturn: - //SEG204 [92] return [ ] + //SEG197 [92] return [ ] rts } -//SEG205 addpoint +//SEG198 addpoint addpoint: { .label x = 13 .label y = 15 .label c = 16 - //SEG206 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=zpby2 + //SEG199 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=zpby2 lda x ldx numpoints sta $1000,x - //SEG207 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=zpby2 + //SEG200 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=zpby2 lda y ldx numpoints sta $1100,x - //SEG208 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 + //SEG201 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 lda c ldx numpoints sta $1200,x - //SEG209 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 + //SEG202 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 inc numpoints jmp breturn - //SEG210 addpoint::@return + //SEG203 addpoint::@return breturn: - //SEG211 [98] return [ ] + //SEG204 [98] return [ ] rts } @@ -9655,8 +9648,9 @@ findcol: { sec sbc x sta diff - //SEG153 [73] phi from findcol::@12 to findcol::@5 + //SEG153 [73] phi from findcol::@12 findcol::@4 to findcol::@5 b5_from_b12: + b5_from_b4: //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy //SEG155 findcol::@5 b5: @@ -9673,8 +9667,9 @@ findcol: { //SEG159 [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG160 [77] phi from findcol::@14 to findcol::@7 + //SEG160 [77] phi from findcol::@14 findcol::@6 to findcol::@7 b7_from_b14: + b7_from_b6: //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy //SEG162 findcol::@7 b7: @@ -9685,8 +9680,9 @@ findcol: { b16: //SEG165 [79] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 numpoints#1 ] -- yby=cowo1_staridx_xby ldy $1200,x - //SEG166 [80] phi from findcol::@16 to findcol::@8 + //SEG166 [80] phi from findcol::@16 findcol::@21 to findcol::@8 b8_from_b16: + b8_from_b21: //SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy //SEG169 findcol::@8 @@ -9714,62 +9710,52 @@ findcol: { b21: //SEG181 [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 lda mindiff - //SEG182 [80] phi from findcol::@21 to findcol::@8 - b8_from_b21: - //SEG183 [80] phi (byte) findcol::mindiff#11 = (byte~) findcol::mindiff#14 -- register_copy - //SEG184 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#11 -- register_copy - jmp b8 - //SEG185 findcol::@6 + jmp b8_from_b21 + //SEG182 findcol::@6 b6: - //SEG186 [85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 + //SEG183 [85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 lda y sec sbc yp - //SEG187 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG184 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG188 [77] phi from findcol::@6 to findcol::@7 - b7_from_b6: - //SEG189 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#2 -- register_copy - jmp b7 - //SEG190 findcol::@4 + jmp b7_from_b6 + //SEG185 findcol::@4 b4: - //SEG191 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 + //SEG186 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 lda x sec sbc diff sta diff - //SEG192 [73] phi from findcol::@4 to findcol::@5 - b5_from_b4: - //SEG193 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#0 -- register_copy - jmp b5 + jmp b5_from_b4 } -//SEG194 initscreen +//SEG187 initscreen initscreen: { .label screen = 3 - //SEG195 [88] phi from initscreen to initscreen::@1 + //SEG188 [88] phi from initscreen to initscreen::@1 b1_from_initscreen: - //SEG196 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 jmp b1 - //SEG197 [88] phi from initscreen::@1 to initscreen::@1 + //SEG190 [88] phi from initscreen::@1 to initscreen::@1 b1_from_b1: - //SEG198 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy - //SEG199 initscreen::@1 + //SEG191 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy + //SEG192 initscreen::@1 b1: - //SEG200 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 + //SEG193 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$e6 sta (screen),y - //SEG201 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 + //SEG194 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG202 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 + //SEG195 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda screen+$1 cmp #>$7e8 bcc b1_from_b1 @@ -9778,35 +9764,38 @@ initscreen: { cmp #<$7e8 bcc b1_from_b1 !: - //SEG203 initscreen::@return + //SEG196 initscreen::@return breturn: - //SEG204 [92] return [ ] + //SEG197 [92] return [ ] rts } -//SEG205 addpoint +//SEG198 addpoint addpoint: { .label c = 2 - //SEG206 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby + //SEG199 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby ldx numpoints sta $1000,x - //SEG207 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby + //SEG200 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby tya ldy numpoints sta $1100,y - //SEG208 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 + //SEG201 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 lda c ldx numpoints sta $1200,x - //SEG209 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 + //SEG202 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 inc numpoints - //SEG210 addpoint::@return + //SEG203 addpoint::@return breturn: - //SEG211 [98] return [ ] + //SEG204 [98] return [ ] rts } Replacing label b2_from_b5 with b2 Replacing label b1_from_b3 with b1 +Replacing label b8_from_b21 with b8 +Replacing label b7_from_b6 with b7 +Replacing label b5_from_b4 with b5 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Removing instruction addpoint_from_b3: @@ -9818,8 +9807,11 @@ Removing instruction b1_from_b3: Removing instruction b2_from_b1: Removing instruction b2_from_b5: Removing instruction b5_from_b12: +Removing instruction b5_from_b4: Removing instruction b7_from_b14: +Removing instruction b7_from_b6: Removing instruction b8_from_b16: +Removing instruction b8_from_b21: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination ASSEMBLER @@ -10180,7 +10172,7 @@ findcol: { sec sbc x sta diff - //SEG153 [73] phi from findcol::@12 to findcol::@5 + //SEG153 [73] phi from findcol::@12 findcol::@4 to findcol::@5 //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy //SEG155 findcol::@5 b5: @@ -10197,7 +10189,7 @@ findcol: { //SEG159 [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG160 [77] phi from findcol::@14 to findcol::@7 + //SEG160 [77] phi from findcol::@14 findcol::@6 to findcol::@7 //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy //SEG162 findcol::@7 b7: @@ -10208,7 +10200,7 @@ findcol: { b16: //SEG165 [79] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 numpoints#1 ] -- yby=cowo1_staridx_xby ldy $1200,x - //SEG166 [80] phi from findcol::@16 to findcol::@8 + //SEG166 [80] phi from findcol::@16 findcol::@21 to findcol::@8 //SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy //SEG169 findcol::@8 @@ -10236,61 +10228,51 @@ findcol: { b21: //SEG181 [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 lda mindiff - //SEG182 [80] phi from findcol::@21 to findcol::@8 - b8_from_b21: - //SEG183 [80] phi (byte) findcol::mindiff#11 = (byte~) findcol::mindiff#14 -- register_copy - //SEG184 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#11 -- register_copy jmp b8 - //SEG185 findcol::@6 + //SEG182 findcol::@6 b6: - //SEG186 [85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 + //SEG183 [85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 lda y sec sbc yp - //SEG187 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG184 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG188 [77] phi from findcol::@6 to findcol::@7 - b7_from_b6: - //SEG189 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#2 -- register_copy jmp b7 - //SEG190 findcol::@4 + //SEG185 findcol::@4 b4: - //SEG191 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 + //SEG186 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 lda x sec sbc diff sta diff - //SEG192 [73] phi from findcol::@4 to findcol::@5 - b5_from_b4: - //SEG193 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#0 -- register_copy jmp b5 } -//SEG194 initscreen +//SEG187 initscreen initscreen: { .label screen = 3 - //SEG195 [88] phi from initscreen to initscreen::@1 + //SEG188 [88] phi from initscreen to initscreen::@1 b1_from_initscreen: - //SEG196 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 jmp b1 - //SEG197 [88] phi from initscreen::@1 to initscreen::@1 - //SEG198 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy - //SEG199 initscreen::@1 + //SEG190 [88] phi from initscreen::@1 to initscreen::@1 + //SEG191 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy + //SEG192 initscreen::@1 b1: - //SEG200 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 + //SEG193 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$e6 sta (screen),y - //SEG201 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 + //SEG194 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG202 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 + //SEG195 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda screen+$1 cmp #>$7e8 bcc b1 @@ -10299,30 +10281,30 @@ initscreen: { cmp #<$7e8 bcc b1 !: - //SEG203 initscreen::@return + //SEG196 initscreen::@return breturn: - //SEG204 [92] return [ ] + //SEG197 [92] return [ ] rts } -//SEG205 addpoint +//SEG198 addpoint addpoint: { .label c = 2 - //SEG206 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby + //SEG199 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby ldx numpoints sta $1000,x - //SEG207 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby + //SEG200 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby tya ldy numpoints sta $1100,y - //SEG208 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 + //SEG201 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 lda c ldx numpoints sta $1200,x - //SEG209 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 + //SEG202 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 inc numpoints - //SEG210 addpoint::@return + //SEG203 addpoint::@return breturn: - //SEG211 [98] return [ ] + //SEG204 [98] return [ ] rts } @@ -10356,9 +10338,6 @@ Removing instruction b14: Removing instruction b16: Removing instruction breturn_from_b8: Removing instruction b1_from_b19: -Removing instruction b8_from_b21: -Removing instruction b7_from_b6: -Removing instruction b5_from_b4: Removing instruction b1_from_initscreen: Removing instruction breturn: Removing instruction breturn: @@ -10695,7 +10674,7 @@ findcol: { sec sbc x sta diff - //SEG153 [73] phi from findcol::@12 to findcol::@5 + //SEG153 [73] phi from findcol::@12 findcol::@4 to findcol::@5 //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy //SEG155 findcol::@5 b5: @@ -10711,7 +10690,7 @@ findcol: { //SEG159 [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG160 [77] phi from findcol::@14 to findcol::@7 + //SEG160 [77] phi from findcol::@14 findcol::@6 to findcol::@7 //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy //SEG162 findcol::@7 b7: @@ -10721,7 +10700,7 @@ findcol: { //SEG164 findcol::@16 //SEG165 [79] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 numpoints#1 ] -- yby=cowo1_staridx_xby ldy $1200,x - //SEG166 [80] phi from findcol::@16 to findcol::@8 + //SEG166 [80] phi from findcol::@16 findcol::@21 to findcol::@8 //SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy //SEG169 findcol::@8 @@ -10747,57 +10726,50 @@ findcol: { b21: //SEG181 [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 lda mindiff - //SEG182 [80] phi from findcol::@21 to findcol::@8 - //SEG183 [80] phi (byte) findcol::mindiff#11 = (byte~) findcol::mindiff#14 -- register_copy - //SEG184 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#11 -- register_copy jmp b8 - //SEG185 findcol::@6 + //SEG182 findcol::@6 b6: - //SEG186 [85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 + //SEG183 [85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 lda y sec sbc yp - //SEG187 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG184 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG188 [77] phi from findcol::@6 to findcol::@7 - //SEG189 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#2 -- register_copy jmp b7 - //SEG190 findcol::@4 + //SEG185 findcol::@4 b4: - //SEG191 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 + //SEG186 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 lda x sec sbc diff sta diff - //SEG192 [73] phi from findcol::@4 to findcol::@5 - //SEG193 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#0 -- register_copy jmp b5 } -//SEG194 initscreen +//SEG187 initscreen initscreen: { .label screen = 3 - //SEG195 [88] phi from initscreen to initscreen::@1 - //SEG196 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG188 [88] phi from initscreen to initscreen::@1 + //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 jmp b1 - //SEG197 [88] phi from initscreen::@1 to initscreen::@1 - //SEG198 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy - //SEG199 initscreen::@1 + //SEG190 [88] phi from initscreen::@1 to initscreen::@1 + //SEG191 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy + //SEG192 initscreen::@1 b1: - //SEG200 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 + //SEG193 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$e6 sta (screen),y - //SEG201 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 + //SEG194 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG202 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 + //SEG195 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda screen+$1 cmp #>$7e8 bcc b1 @@ -10806,28 +10778,28 @@ initscreen: { cmp #<$7e8 bcc b1 !: - //SEG203 initscreen::@return - //SEG204 [92] return [ ] + //SEG196 initscreen::@return + //SEG197 [92] return [ ] rts } -//SEG205 addpoint +//SEG198 addpoint addpoint: { .label c = 2 - //SEG206 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby + //SEG199 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby ldx numpoints sta $1000,x - //SEG207 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby + //SEG200 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby tya ldy numpoints sta $1100,y - //SEG208 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 + //SEG201 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 lda c ldx numpoints sta $1200,x - //SEG209 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 + //SEG202 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 inc numpoints - //SEG210 addpoint::@return - //SEG211 [98] return [ ] + //SEG203 addpoint::@return + //SEG204 [98] return [ ] rts } @@ -11165,7 +11137,7 @@ findcol: { sec sbc x sta diff - //SEG153 [73] phi from findcol::@12 to findcol::@5 + //SEG153 [73] phi from findcol::@12 findcol::@4 to findcol::@5 //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy //SEG155 findcol::@5 b5: @@ -11181,7 +11153,7 @@ findcol: { //SEG159 [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG160 [77] phi from findcol::@14 to findcol::@7 + //SEG160 [77] phi from findcol::@14 findcol::@6 to findcol::@7 //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy //SEG162 findcol::@7 b7: @@ -11191,7 +11163,7 @@ findcol: { //SEG164 findcol::@16 //SEG165 [79] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 numpoints#1 ] -- yby=cowo1_staridx_xby ldy $1200,x - //SEG166 [80] phi from findcol::@16 to findcol::@8 + //SEG166 [80] phi from findcol::@16 findcol::@21 to findcol::@8 //SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy //SEG169 findcol::@8 @@ -11217,56 +11189,49 @@ findcol: { b21: //SEG181 [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 lda mindiff - //SEG182 [80] phi from findcol::@21 to findcol::@8 - //SEG183 [80] phi (byte) findcol::mindiff#11 = (byte~) findcol::mindiff#14 -- register_copy - //SEG184 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#11 -- register_copy jmp b8 - //SEG185 findcol::@6 + //SEG182 findcol::@6 b6: - //SEG186 [85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 + //SEG183 [85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 lda y sec sbc yp - //SEG187 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG184 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG188 [77] phi from findcol::@6 to findcol::@7 - //SEG189 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#2 -- register_copy jmp b7 - //SEG190 findcol::@4 + //SEG185 findcol::@4 b4: - //SEG191 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 + //SEG186 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 lda x sec sbc diff sta diff - //SEG192 [73] phi from findcol::@4 to findcol::@5 - //SEG193 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#0 -- register_copy jmp b5 } -//SEG194 initscreen +//SEG187 initscreen initscreen: { .label screen = 3 - //SEG195 [88] phi from initscreen to initscreen::@1 - //SEG196 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG188 [88] phi from initscreen to initscreen::@1 + //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 - //SEG197 [88] phi from initscreen::@1 to initscreen::@1 - //SEG198 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy - //SEG199 initscreen::@1 + //SEG190 [88] phi from initscreen::@1 to initscreen::@1 + //SEG191 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy + //SEG192 initscreen::@1 b1: - //SEG200 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 + //SEG193 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$e6 sta (screen),y - //SEG201 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 + //SEG194 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG202 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 + //SEG195 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda screen+$1 cmp #>$7e8 bcc b1 @@ -11275,28 +11240,28 @@ initscreen: { cmp #<$7e8 bcc b1 !: - //SEG203 initscreen::@return - //SEG204 [92] return [ ] + //SEG196 initscreen::@return + //SEG197 [92] return [ ] rts } -//SEG205 addpoint +//SEG198 addpoint addpoint: { .label c = 2 - //SEG206 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby + //SEG199 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby ldx numpoints sta $1000,x - //SEG207 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby + //SEG200 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby tya ldy numpoints sta $1100,y - //SEG208 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 + //SEG201 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 lda c ldx numpoints sta $1200,x - //SEG209 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 + //SEG202 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 inc numpoints - //SEG210 addpoint::@return - //SEG211 [98] return [ ] + //SEG203 addpoint::@return + //SEG204 [98] return [ ] rts } @@ -11801,7 +11766,7 @@ findcol: { sec sbc x sta diff - //SEG153 [73] phi from findcol::@12 to findcol::@5 + //SEG153 [73] phi from findcol::@12 findcol::@4 to findcol::@5 //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy //SEG155 findcol::@5 b5: @@ -11817,7 +11782,7 @@ findcol: { //SEG159 [76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG160 [77] phi from findcol::@14 to findcol::@7 + //SEG160 [77] phi from findcol::@14 findcol::@6 to findcol::@7 //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy //SEG162 findcol::@7 b7: @@ -11827,7 +11792,7 @@ findcol: { //SEG164 findcol::@16 //SEG165 [79] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 numpoints#1 ] -- yby=cowo1_staridx_xby ldy $1200,x - //SEG166 [80] phi from findcol::@16 to findcol::@8 + //SEG166 [80] phi from findcol::@16 findcol::@21 to findcol::@8 //SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy //SEG169 findcol::@8 @@ -11853,56 +11818,49 @@ findcol: { b21: //SEG181 [84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ] -- aby=zpby1 lda mindiff - //SEG182 [80] phi from findcol::@21 to findcol::@8 - //SEG183 [80] phi (byte) findcol::mindiff#11 = (byte~) findcol::mindiff#14 -- register_copy - //SEG184 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#11 -- register_copy jmp b8 - //SEG185 findcol::@6 + //SEG182 findcol::@6 b6: - //SEG186 [85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 + //SEG183 [85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ] -- aby=zpby1_minus_zpby2 lda y sec sbc yp - //SEG187 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby + //SEG184 [86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- aby=zpby1_plus_aby clc adc diff - //SEG188 [77] phi from findcol::@6 to findcol::@7 - //SEG189 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#2 -- register_copy jmp b7 - //SEG190 findcol::@4 + //SEG185 findcol::@4 b4: - //SEG191 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 + //SEG186 [87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ] -- zpby1=zpby2_minus_zpby1 lda x sec sbc diff sta diff - //SEG192 [73] phi from findcol::@4 to findcol::@5 - //SEG193 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#0 -- register_copy jmp b5 } -//SEG194 initscreen +//SEG187 initscreen initscreen: { .label screen = 3 - //SEG195 [88] phi from initscreen to initscreen::@1 - //SEG196 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 + //SEG188 [88] phi from initscreen to initscreen::@1 + //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 lda #<$400 sta screen lda #>$400 sta screen+$1 - //SEG197 [88] phi from initscreen::@1 to initscreen::@1 - //SEG198 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy - //SEG199 initscreen::@1 + //SEG190 [88] phi from initscreen::@1 to initscreen::@1 + //SEG191 [88] phi (byte*) initscreen::screen#2 = (byte*) initscreen::screen#1 -- register_copy + //SEG192 initscreen::@1 b1: - //SEG200 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 + //SEG193 [89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ] -- _star_zpptrby1=coby1 ldy #$0 lda #$e6 sta (screen),y - //SEG201 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 + //SEG194 [90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ] -- zpptrby1=_inc_zpptrby1 inc screen bne !+ inc screen+$1 !: - //SEG202 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 + //SEG195 [91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ] -- zpptrby1_lt_cowo1_then_la1 lda screen+$1 cmp #>$7e8 bcc b1 @@ -11911,28 +11869,28 @@ initscreen: { cmp #<$7e8 bcc b1 !: - //SEG203 initscreen::@return - //SEG204 [92] return [ ] + //SEG196 initscreen::@return + //SEG197 [92] return [ ] rts } -//SEG205 addpoint +//SEG198 addpoint addpoint: { .label c = 2 - //SEG206 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby + //SEG199 [94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ] -- cowo1_staridx_zpby1=aby ldx numpoints sta $1000,x - //SEG207 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby + //SEG200 [95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ] -- cowo1_staridx_zpby1=yby tya ldy numpoints sta $1100,y - //SEG208 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 + //SEG201 [96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ] -- cowo1_staridx_zpby1=zpby2 lda c ldx numpoints sta $1200,x - //SEG209 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 + //SEG202 [97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ] -- zpby1=_inc_zpby1 inc numpoints - //SEG210 addpoint::@return - //SEG211 [98] return [ ] + //SEG203 addpoint::@return + //SEG204 [98] return [ ] rts }