1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-01-12 11:31:11 +00:00

Implemented phi transition reuse when transitions are identical on a register basis

This commit is contained in:
jespergravgaard 2017-08-26 02:05:46 +02:00
parent 83edd3e21b
commit 61d16b3030
8 changed files with 422 additions and 470 deletions

View File

@ -30,6 +30,7 @@ Assembler Improvements
- Make generated ASM human readable. - Make generated ASM human readable.
+ Use hex-numbers + Use hex-numbers
- add labels for constants and zp-variables. - add labels for constants and zp-variables.
- Eliminate chained JMP's (replace by direct JMP) - example: loopsplit.asm
- Better ASM static value analysis - Better ASM static value analysis
- Not just constants - but also other values (value of var, value of var1[var2], value of var+4 etc.) - 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 - Also analyze back/forward through block entry/exit
@ -48,8 +49,6 @@ Known Problems
Register Allocation Register Allocation
- Allow user to limit number of combinations tested - Allow user to limit number of combinations tested
- Safe-Copy based SSA deconstruction - 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. - Optimize by finding optimal sequence for multiple phi assignments in entry-segments.
- Avoid clobbering alive vars - Avoid clobbering alive vars
- Maybe support several fragments for the same operation with different cost and clobbering profiles. - 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. - 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 - 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. - 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 + Limit number of combinations tested
+ Equivalences not tested through combinaitons should be tested individually afterwards. + Equivalences not tested through combinaitons should be tested individually afterwards.
+ Matrix Phi operation (instead of separate statements) + Matrix Phi operation (instead of separate statements)

View File

@ -55,9 +55,19 @@ public class Pass4CodeGeneration {
ControlFlowBlock defaultSuccessor = getGraph().getDefaultSuccessor(block); ControlFlowBlock defaultSuccessor = getGraph().getDefaultSuccessor(block);
if (defaultSuccessor != null) { if (defaultSuccessor != null) {
if (defaultSuccessor.hasPhiBlock()) { 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)) { if (!ScopeRef.ROOT.equals(currentScope)) {
@ -159,6 +169,10 @@ public class Pass4CodeGeneration {
if (genCallPhiEntry) { if (genCallPhiEntry) {
ControlFlowBlock callSuccessor = getGraph().getCallSuccessor(block); ControlFlowBlock callSuccessor = getGraph().getCallSuccessor(block);
if (callSuccessor != null && callSuccessor.hasPhiBlock()) { 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()); genBlockPhiTransition(asm, block, callSuccessor, block.getScope());
} }
} }
@ -246,6 +260,8 @@ public class Pass4CodeGeneration {
genAsmMove(asm, assignment.getVariable(), assignment.getrValue(), assignment.getPhiBlock(), scope); genAsmMove(asm, assignment.getVariable(), assignment.getrValue(), assignment.getPhiBlock(), scope);
} }
transition.setGenerated(true); 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. * 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. * If another transition already has the same assignments it is reused. If not a new transition is created.
*
* @param fromBlock * @param fromBlock
* @return * @return
*/ */
private PhiTransition findTransition(ControlFlowBlock fromBlock) { private PhiTransition findTransition(ControlFlowBlock fromBlock) {
PhiTransition transition = new PhiTransition(fromBlock); PhiTransition transition = new PhiTransition(fromBlock);
for (PhiTransition candidate : transitions.values()) { for (PhiTransition candidate : transitions.values()) {
if(candidate.equalAssignments(transition)) { if (candidate.equalAssignments(transition)) {
candidate.addFromBlock(fromBlock); candidate.addFromBlock(fromBlock);
return candidate; return candidate;
} }
@ -409,21 +426,35 @@ public class Pass4CodeGeneration {
/** /**
* Determines if another transition has the exact same assignments as this block * Determines if another transition has the exact same assignments as this block
*
* @param other The other transition to examine * @param other The other transition to examine
* @return true if the assignments are identical * @return true if the assignments are identical
*/ */
public boolean equalAssignments(PhiTransition other) { public boolean equalAssignments(PhiTransition other) {
List<PhiAssignment> otherAssignments = other.getAssignments(); List<PhiAssignment> otherAssignments = other.getAssignments();
if(assignments.size()!=otherAssignments.size()) { if (assignments.size() != otherAssignments.size()) {
return false; return false;
} }
for (int i = 0; i < assignments.size(); i++) { for (int i = 0; i < assignments.size(); i++) {
PhiAssignment assignment = assignments.get(i); PhiAssignment assignment = assignments.get(i);
PhiAssignment otherAssignment = otherAssignments.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; 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; return false;
} }
} }
@ -466,7 +497,6 @@ public class Pass4CodeGeneration {
} }
private Registers.Register getRegister(RValue rValue) { private Registers.Register getRegister(RValue rValue) {
if (rValue instanceof VariableRef) { if (rValue instanceof VariableRef) {
VariableRef rValueRef = (VariableRef) rValue; VariableRef rValueRef = (VariableRef) rValue;

View File

@ -1585,28 +1585,23 @@ main: {
sec sec
sbc #$27 sbc #$27
sta e sta e
//SEG25 [10] phi from main::@3 to main::@2 //SEG25 [10] phi from main::@1 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
b2_from_b1: b2_from_b1:
//SEG30 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy b2_from_b3:
//SEG31 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG32 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- 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 jmp b2
//SEG33 main::@2 //SEG29 main::@2
b2: 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 lda x
cmp #$28 cmp #$28
bcc b1_from_b2 bcc b1_from_b2
jmp breturn jmp breturn
//SEG35 main::@return //SEG31 main::@return
breturn: breturn:
//SEG36 [12] return [ ] //SEG32 [12] return [ ]
rts 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 [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 [] 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 [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 1195 combination Uplifting [] best 1165 combination
Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ] Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ]
Removing instruction jmp bend Removing instruction jmp bend
Removing instruction jmp b1 Removing instruction jmp b1
@ -1716,26 +1711,21 @@ main: {
sec sec
sbc #$27 sbc #$27
tax tax
//SEG25 [10] phi from main::@3 to main::@2 //SEG25 [10] phi from main::@1 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
b2_from_b1: b2_from_b1:
//SEG30 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy b2_from_b3:
//SEG31 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG32 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG33 main::@2 //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG29 main::@2
b2: 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 lda x
cmp #$28 cmp #$28
bcc b1_from_b2 bcc b1_from_b2
//SEG35 main::@return //SEG31 main::@return
breturn: breturn:
//SEG36 [12] return [ ] //SEG32 [12] return [ ]
rts rts
} }
@ -1743,6 +1733,7 @@ Replacing label b2_from_b1 with b2
Replacing label b1_from_b2 with b1 Replacing label b1_from_b2 with b1
Removing instruction b1_from_b2: Removing instruction b1_from_b2:
Removing instruction b2_from_b1: Removing instruction b2_from_b1:
Removing instruction b2_from_b3:
Succesful ASM optimization Pass5RedundantLabelElimination Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER ASSEMBLER
//SEG0 Global ZP labels //SEG0 Global ZP labels
@ -1816,25 +1807,19 @@ main: {
sec sec
sbc #$27 sbc #$27
tax tax
//SEG25 [10] phi from main::@3 to main::@2 //SEG25 [10] phi from main::@1 main::@3 to main::@2
b2_from_b3: //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG26 [10] phi (byte) main::y#4 = (byte) main::y#1 -- register_copy //SEG27 [10] phi (byte) main::e#5 = (byte) main::e#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#1 -- register_copy
//SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#2 -- register_copy //SEG29 main::@2
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
b2: 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 lda x
cmp #$28 cmp #$28
bcc b1 bcc b1
//SEG35 main::@return //SEG31 main::@return
breturn: breturn:
//SEG36 [12] return [ ] //SEG32 [12] return [ ]
rts rts
} }
@ -1842,7 +1827,6 @@ Removing instruction bbegin:
Removing instruction bend: Removing instruction bend:
Removing instruction b1_from_main: Removing instruction b1_from_main:
Removing instruction b3: Removing instruction b3:
Removing instruction b2_from_b3:
Removing instruction breturn: Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination Succesful ASM optimization Pass5UnusedLabelElimination
ASSEMBLER ASSEMBLER
@ -1913,28 +1897,22 @@ main: {
sec sec
sbc #$27 sbc #$27
tax tax
//SEG25 [10] phi from main::@3 to main::@2 //SEG25 [10] phi from main::@1 main::@3 to main::@2
//SEG26 [10] phi (byte) main::y#4 = (byte) main::y#1 -- register_copy //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG27 [10] phi (byte) main::e#5 = (byte) main::e#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#2 -- register_copy //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
jmp b2 //SEG29 main::@2
//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
b2: 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 lda x
cmp #$28 cmp #$28
bcc b1 bcc b1
//SEG35 main::@return //SEG31 main::@return
//SEG36 [12] return [ ] //SEG32 [12] return [ ]
rts rts
} }
Removing instruction jmp b1 Removing instruction jmp b1
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination Succesful ASM optimization Pass5NextJumpElimination
ASSEMBLER ASSEMBLER
//SEG0 Global ZP labels //SEG0 Global ZP labels
@ -2003,22 +1981,18 @@ main: {
sec sec
sbc #$27 sbc #$27
tax tax
//SEG25 [10] phi from main::@3 to main::@2 //SEG25 [10] phi from main::@1 main::@3 to main::@2
//SEG26 [10] phi (byte) main::y#4 = (byte) main::y#1 -- register_copy //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG27 [10] phi (byte) main::e#5 = (byte) main::e#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#2 -- register_copy //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG29 [10] phi from main::@1 to main::@2 //SEG29 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
b2: 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 lda x
cmp #$28 cmp #$28
bcc b1 bcc b1
//SEG35 main::@return //SEG31 main::@return
//SEG36 [12] return [ ] //SEG32 [12] return [ ]
rts rts
} }
@ -2128,22 +2102,18 @@ main: {
sec sec
sbc #$27 sbc #$27
tax tax
//SEG25 [10] phi from main::@3 to main::@2 //SEG25 [10] phi from main::@1 main::@3 to main::@2
//SEG26 [10] phi (byte) main::y#4 = (byte) main::y#1 -- register_copy //SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG27 [10] phi (byte) main::e#5 = (byte) main::e#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#2 -- register_copy //SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG29 [10] phi from main::@1 to main::@2 //SEG29 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
b2: 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 lda x
cmp #$28 cmp #$28
bcc b1 bcc b1
//SEG35 main::@return //SEG31 main::@return
//SEG36 [12] return [ ] //SEG32 [12] return [ ]
rts rts
} }

View File

@ -1276,26 +1276,21 @@ b3:
sec sec
sbc #$27 sbc #$27
sta e sta e
//SEG22 [9] phi from @3 to @2 //SEG22 [9] phi from @1 @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
b2_from_b1: b2_from_b1:
//SEG27 [9] phi (byte) y#4 = (byte) y#2 -- register_copy b2_from_b3:
//SEG28 [9] phi (byte) e#5 = (byte) e#1 -- register_copy //SEG23 [9] phi (byte) y#4 = (byte) y#2 -- register_copy
//SEG29 [9] phi (word) idx#5 = (word) idx#1 -- 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 jmp b2
//SEG30 @2 //SEG26 @2
b2: 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 lda x
cmp #$28 cmp #$28
bcc b1_from_b2 bcc b1_from_b2
jmp bend jmp bend
//SEG32 @end //SEG28 @end
bend: bend:
Statement [1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ] always clobbers reg byte a Statement [1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ] always clobbers reg byte a
@ -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 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 ] 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 ] Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:4 [ y#2 y#4 y#1 ]
Removing instruction jmp b1 Removing instruction jmp b1
Removing instruction jmp b3 Removing instruction jmp b3
@ -1397,23 +1392,18 @@ b3:
sec sec
sbc #$27 sbc #$27
tay tay
//SEG22 [9] phi from @3 to @2 //SEG22 [9] phi from @1 @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
b2_from_b1: b2_from_b1:
//SEG27 [9] phi (byte) y#4 = (byte) y#2 -- register_copy b2_from_b3:
//SEG28 [9] phi (byte) e#5 = (byte) e#1 -- register_copy //SEG23 [9] phi (byte) y#4 = (byte) y#2 -- register_copy
//SEG29 [9] phi (word) idx#5 = (word) idx#1 -- register_copy //SEG24 [9] phi (byte) e#5 = (byte) e#1 -- register_copy
//SEG30 @2 //SEG25 [9] phi (word) idx#5 = (word) idx#1 -- register_copy
//SEG26 @2
b2: 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 cpx #$28
bcc b1_from_b2 bcc b1_from_b2
//SEG32 @end //SEG28 @end
bend: bend:
Replacing label b2_from_b1 with b2 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_bbegin:
Removing instruction b1_from_b2: Removing instruction b1_from_b2:
Removing instruction b2_from_b1: Removing instruction b2_from_b1:
Removing instruction b2_from_b3:
Succesful ASM optimization Pass5RedundantLabelElimination Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER ASSEMBLER
//SEG0 Global ZP labels //SEG0 Global ZP labels
@ -1492,27 +1483,20 @@ b3:
sec sec
sbc #$27 sbc #$27
tay tay
//SEG22 [9] phi from @3 to @2 //SEG22 [9] phi from @1 @3 to @2
b2_from_b3: //SEG23 [9] phi (byte) y#4 = (byte) y#2 -- register_copy
//SEG23 [9] phi (byte) y#4 = (byte) y#1 -- register_copy //SEG24 [9] phi (byte) e#5 = (byte) e#1 -- register_copy
//SEG24 [9] phi (byte) e#5 = (byte) e#2 -- register_copy //SEG25 [9] phi (word) idx#5 = (word) idx#1 -- register_copy
//SEG25 [9] phi (word) idx#5 = (word) idx#2 -- register_copy //SEG26 @2
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
b2: 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 cpx #$28
bcc b1 bcc b1
//SEG32 @end //SEG28 @end
bend: bend:
Removing instruction bbegin: Removing instruction bbegin:
Removing instruction b3: Removing instruction b3:
Removing instruction b2_from_b3:
Removing instruction bend: Removing instruction bend:
Succesful ASM optimization Pass5UnusedLabelElimination Succesful ASM optimization Pass5UnusedLabelElimination
ASSEMBLER ASSEMBLER
@ -1583,24 +1567,18 @@ b1:
sec sec
sbc #$27 sbc #$27
tay tay
//SEG22 [9] phi from @3 to @2 //SEG22 [9] phi from @1 @3 to @2
//SEG23 [9] phi (byte) y#4 = (byte) y#1 -- register_copy //SEG23 [9] phi (byte) y#4 = (byte) y#2 -- register_copy
//SEG24 [9] phi (byte) e#5 = (byte) e#2 -- register_copy //SEG24 [9] phi (byte) e#5 = (byte) e#1 -- register_copy
//SEG25 [9] phi (word) idx#5 = (word) idx#2 -- register_copy //SEG25 [9] phi (word) idx#5 = (word) idx#1 -- register_copy
jmp b2 //SEG26 @2
//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
b2: 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 cpx #$28
bcc b1 bcc b1
//SEG32 @end //SEG28 @end
Removing instruction jmp b1 Removing instruction jmp b1
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination Succesful ASM optimization Pass5NextJumpElimination
ASSEMBLER ASSEMBLER
//SEG0 Global ZP labels //SEG0 Global ZP labels
@ -1669,20 +1647,16 @@ b1:
sec sec
sbc #$27 sbc #$27
tay tay
//SEG22 [9] phi from @3 to @2 //SEG22 [9] phi from @1 @3 to @2
//SEG23 [9] phi (byte) y#4 = (byte) y#1 -- register_copy //SEG23 [9] phi (byte) y#4 = (byte) y#2 -- register_copy
//SEG24 [9] phi (byte) e#5 = (byte) e#2 -- register_copy //SEG24 [9] phi (byte) e#5 = (byte) e#1 -- register_copy
//SEG25 [9] phi (word) idx#5 = (word) idx#2 -- register_copy //SEG25 [9] phi (word) idx#5 = (word) idx#1 -- register_copy
//SEG26 [9] phi from @1 to @2 //SEG26 @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
b2: 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 cpx #$28
bcc b1 bcc b1
//SEG32 @end //SEG28 @end
FINAL SYMBOL TABLE FINAL SYMBOL TABLE
(label) @1 (label) @1
@ -1788,18 +1762,14 @@ b1:
sec sec
sbc #$27 sbc #$27
tay tay
//SEG22 [9] phi from @3 to @2 //SEG22 [9] phi from @1 @3 to @2
//SEG23 [9] phi (byte) y#4 = (byte) y#1 -- register_copy //SEG23 [9] phi (byte) y#4 = (byte) y#2 -- register_copy
//SEG24 [9] phi (byte) e#5 = (byte) e#2 -- register_copy //SEG24 [9] phi (byte) e#5 = (byte) e#1 -- register_copy
//SEG25 [9] phi (word) idx#5 = (word) idx#2 -- register_copy //SEG25 [9] phi (word) idx#5 = (word) idx#1 -- register_copy
//SEG26 [9] phi from @1 to @2 //SEG26 @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
b2: 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 cpx #$28
bcc b1 bcc b1
//SEG32 @end //SEG28 @end

View File

@ -477,23 +477,20 @@ b3:
clc clc
adc i adc i
sta s sta s
//SEG12 [3] phi from @3 to @2 //SEG12 [3] phi from @1 @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
b2_from_b1: 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 jmp b2
//SEG16 @2 //SEG14 @2
b2: 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 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 lda i
bne b1_from_b2 bne b1_from_b2
jmp bend jmp bend
//SEG19 @end //SEG17 @end
bend: bend:
REGISTER UPLIFT POTENTIAL REGISTERS 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 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 ] 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 b1
Removing instruction jmp b3 Removing instruction jmp b3
Removing instruction jmp b2 Removing instruction jmp b2
@ -536,21 +533,18 @@ b3:
stx $ff stx $ff
clc clc
adc $ff adc $ff
//SEG12 [3] phi from @3 to @2 //SEG12 [3] phi from @1 @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
b2_from_b1: b2_from_b1:
//SEG15 [3] phi (byte) s#4 = (byte) s#2 -- register_copy b2_from_b3:
//SEG16 @2 //SEG13 [3] phi (byte) s#4 = (byte) s#2 -- register_copy
//SEG14 @2
b2: 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 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 cpx #$0
bne b1_from_b2 bne b1_from_b2
//SEG19 @end //SEG17 @end
bend: bend:
Replacing label b2_from_b1 with b2 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_bbegin:
Removing instruction b1_from_b2: Removing instruction b1_from_b2:
Removing instruction b2_from_b1: Removing instruction b2_from_b1:
Removing instruction b2_from_b3:
Succesful ASM optimization Pass5RedundantLabelElimination Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER ASSEMBLER
//SEG0 Global ZP labels //SEG0 Global ZP labels
@ -585,25 +580,20 @@ b3:
stx $ff stx $ff
clc clc
adc $ff adc $ff
//SEG12 [3] phi from @3 to @2 //SEG12 [3] phi from @1 @3 to @2
b2_from_b3: //SEG13 [3] phi (byte) s#4 = (byte) s#2 -- register_copy
//SEG13 [3] phi (byte) s#4 = (byte) s#1 -- register_copy //SEG14 @2
jmp b2
//SEG14 [3] phi from @1 to @2
//SEG15 [3] phi (byte) s#4 = (byte) s#2 -- register_copy
//SEG16 @2
b2: 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 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 cpx #$0
bne b1 bne b1
//SEG19 @end //SEG17 @end
bend: bend:
Removing instruction bbegin: Removing instruction bbegin:
Removing instruction b3: Removing instruction b3:
Removing instruction b2_from_b3:
Removing instruction bend: Removing instruction bend:
Succesful ASM optimization Pass5UnusedLabelElimination Succesful ASM optimization Pass5UnusedLabelElimination
ASSEMBLER ASSEMBLER
@ -629,22 +619,18 @@ b1:
stx $ff stx $ff
clc clc
adc $ff adc $ff
//SEG12 [3] phi from @3 to @2 //SEG12 [3] phi from @1 @3 to @2
//SEG13 [3] phi (byte) s#4 = (byte) s#1 -- register_copy //SEG13 [3] phi (byte) s#4 = (byte) s#2 -- register_copy
jmp b2 //SEG14 @2
//SEG14 [3] phi from @1 to @2
//SEG15 [3] phi (byte) s#4 = (byte) s#2 -- register_copy
//SEG16 @2
b2: 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 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 cpx #$0
bne b1 bne b1
//SEG19 @end //SEG17 @end
Removing instruction jmp b1 Removing instruction jmp b1
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination Succesful ASM optimization Pass5NextJumpElimination
ASSEMBLER ASSEMBLER
//SEG0 Global ZP labels //SEG0 Global ZP labels
@ -668,18 +654,16 @@ b1:
stx $ff stx $ff
clc clc
adc $ff adc $ff
//SEG12 [3] phi from @3 to @2 //SEG12 [3] phi from @1 @3 to @2
//SEG13 [3] phi (byte) s#4 = (byte) s#1 -- register_copy //SEG13 [3] phi (byte) s#4 = (byte) s#2 -- register_copy
//SEG14 [3] phi from @1 to @2 //SEG14 @2
//SEG15 [3] phi (byte) s#4 = (byte) s#2 -- register_copy
//SEG16 @2
b2: 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 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 cpx #$0
bne b1 bne b1
//SEG19 @end //SEG17 @end
FINAL SYMBOL TABLE FINAL SYMBOL TABLE
(label) @1 (label) @1
@ -720,16 +704,14 @@ b1:
stx $ff stx $ff
clc clc
adc $ff adc $ff
//SEG12 [3] phi from @3 to @2 //SEG12 [3] phi from @1 @3 to @2
//SEG13 [3] phi (byte) s#4 = (byte) s#1 -- register_copy //SEG13 [3] phi (byte) s#4 = (byte) s#2 -- register_copy
//SEG14 [3] phi from @1 to @2 //SEG14 @2
//SEG15 [3] phi (byte) s#4 = (byte) s#2 -- register_copy
//SEG16 @2
b2: 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 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 cpx #$0
bne b1 bne b1
//SEG19 @end //SEG17 @end

View File

@ -12,8 +12,9 @@ main: {
bcc b4 bcc b4
beq b4 beq b4
iny iny
b1_from_b8:
jmp b1 jmp b1
b4: b4:
dey dey
jmp b1 jmp b1_from_b8
} }

View File

@ -662,20 +662,17 @@ main: {
b8: b8:
//SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- zpby1=_inc_zpby1 //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- zpby1=_inc_zpby1
inc s 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: 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 //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1 jmp b1
//SEG20 main::@4 //SEG20 main::@4
b4: b4:
//SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- zpby1=_dec_zpby1 //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- zpby1=_dec_zpby1
dec s dec s
//SEG22 [1] phi from main::@4 to main::@1 jmp b1_from_b4
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
} }
REGISTER UPLIFT POTENTIAL REGISTERS REGISTER UPLIFT POTENTIAL REGISTERS
@ -730,20 +727,69 @@ main: {
b8: b8:
//SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby
iny 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: 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 //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1 jmp b1
//SEG20 main::@4 //SEG20 main::@4
b4: b4:
//SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby
dey dey
//SEG22 [1] phi from main::@4 to main::@1 jmp b1_from_b4
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 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 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: Removing instruction bbegin:
@ -751,8 +797,6 @@ Removing instruction bend:
Removing instruction b1_from_main: Removing instruction b1_from_main:
Removing instruction breturn: Removing instruction breturn:
Removing instruction b8: Removing instruction b8:
Removing instruction b1_from_b8:
Removing instruction b1_from_b4:
Succesful ASM optimization Pass5UnusedLabelElimination Succesful ASM optimization Pass5UnusedLabelElimination
ASSEMBLER ASSEMBLER
//SEG0 Global ZP labels //SEG0 Global ZP labels
@ -786,18 +830,16 @@ main: {
//SEG15 main::@8 //SEG15 main::@8
//SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby
iny iny
//SEG17 [1] phi from main::@8 to main::@1 //SEG17 [1] phi from main::@4 main::@8 to main::@1
//SEG18 [1] phi (byte) main::s#3 = (byte) main::s#2 -- register_copy b1_from_b8:
//SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy
//SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1 jmp b1
//SEG20 main::@4 //SEG20 main::@4
b4: b4:
//SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby
dey dey
//SEG22 [1] phi from main::@4 to main::@1 jmp b1_from_b8
//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
} }
FINAL SYMBOL TABLE FINAL SYMBOL TABLE
@ -852,17 +894,15 @@ main: {
//SEG15 main::@8 //SEG15 main::@8
//SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby //SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby
iny iny
//SEG17 [1] phi from main::@8 to main::@1 //SEG17 [1] phi from main::@4 main::@8 to main::@1
//SEG18 [1] phi (byte) main::s#3 = (byte) main::s#2 -- register_copy b1_from_b8:
//SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy
//SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy //SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1 jmp b1
//SEG20 main::@4 //SEG20 main::@4
b4: b4:
//SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby //SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby
dey dey
//SEG22 [1] phi from main::@4 to main::@1 jmp b1_from_b8
//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
} }

View File

@ -8946,8 +8946,9 @@ findcol: {
sec sec
sbc x sbc x
sta diff 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_b12:
b5_from_b4:
//SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy
jmp b5 jmp b5
//SEG155 findcol::@5 //SEG155 findcol::@5
@ -8969,8 +8970,9 @@ findcol: {
clc clc
adc $12 adc $12
sta diff_3 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_b14:
b7_from_b6:
//SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy
jmp b7 jmp b7
//SEG162 findcol::@7 //SEG162 findcol::@7
@ -8986,8 +8988,9 @@ findcol: {
ldx i ldx i
lda $1200,x lda $1200,x
sta mincol 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_b16:
b8_from_b21:
//SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy //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 //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy
jmp b8 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 //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 lda mindiff
sta mindiff_14 sta mindiff_14
//SEG182 [80] phi from findcol::@21 to findcol::@8 jmp b8_from_b21
b8_from_b21: //SEG182 findcol::@6
//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
b6: 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 lda y
sec sec
sbc yp sbc yp
sta $14 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 lda diff
clc clc
adc $14 adc $14
sta diff_2 sta diff_2
//SEG188 [77] phi from findcol::@6 to findcol::@7 jmp b7_from_b6
b7_from_b6: //SEG185 findcol::@4
//SEG189 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#2 -- register_copy
jmp b7
//SEG190 findcol::@4
b4: 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 lda x
sec sec
sbc xp sbc xp
sta diff sta diff
//SEG192 [73] phi from findcol::@4 to findcol::@5 jmp b5_from_b4
b5_from_b4:
//SEG193 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#0 -- register_copy
jmp b5
} }
//SEG194 initscreen //SEG187 initscreen
initscreen: { initscreen: {
.label screen = 11 .label screen = 11
//SEG195 [88] phi from initscreen to initscreen::@1 //SEG188 [88] phi from initscreen to initscreen::@1
b1_from_initscreen: 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 lda #<$400
sta screen sta screen
lda #>$400 lda #>$400
sta screen+$1 sta screen+$1
jmp b1 jmp b1
//SEG197 [88] phi from initscreen::@1 to initscreen::@1 //SEG190 [88] phi from initscreen::@1 to initscreen::@1
b1_from_b1: 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 jmp b1
//SEG199 initscreen::@1 //SEG192 initscreen::@1
b1: 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 ldy #$0
lda #$e6 lda #$e6
sta (screen),y 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 inc screen
bne !+ bne !+
inc screen+$1 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 lda screen+$1
cmp #>$7e8 cmp #>$7e8
bcc b1_from_b1 bcc b1_from_b1
@ -9088,34 +9081,34 @@ initscreen: {
bcc b1_from_b1 bcc b1_from_b1
!: !:
jmp breturn jmp breturn
//SEG203 initscreen::@return //SEG196 initscreen::@return
breturn: breturn:
//SEG204 [92] return [ ] //SEG197 [92] return [ ]
rts rts
} }
//SEG205 addpoint //SEG198 addpoint
addpoint: { addpoint: {
.label x = 13 .label x = 13
.label y = 15 .label y = 15
.label c = 16 .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 lda x
ldx numpoints ldx numpoints
sta $1000,x 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 lda y
ldx numpoints ldx numpoints
sta $1100,x 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 lda c
ldx numpoints ldx numpoints
sta $1200,x 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 inc numpoints
jmp breturn jmp breturn
//SEG210 addpoint::@return //SEG203 addpoint::@return
breturn: breturn:
//SEG211 [98] return [ ] //SEG204 [98] return [ ]
rts rts
} }
@ -9655,8 +9648,9 @@ findcol: {
sec sec
sbc x sbc x
sta diff 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_b12:
b5_from_b4:
//SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy
//SEG155 findcol::@5 //SEG155 findcol::@5
b5: 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 //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 clc
adc diff 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_b14:
b7_from_b6:
//SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy
//SEG162 findcol::@7 //SEG162 findcol::@7
b7: b7:
@ -9685,8 +9680,9 @@ findcol: {
b16: 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 //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 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_b16:
b8_from_b21:
//SEG167 [80] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 -- register_copy //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 //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy
//SEG169 findcol::@8 //SEG169 findcol::@8
@ -9714,62 +9710,52 @@ findcol: {
b21: 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 //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 lda mindiff
//SEG182 [80] phi from findcol::@21 to findcol::@8 jmp b8_from_b21
b8_from_b21: //SEG182 findcol::@6
//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
b6: 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 lda y
sec sec
sbc yp 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 clc
adc diff adc diff
//SEG188 [77] phi from findcol::@6 to findcol::@7 jmp b7_from_b6
b7_from_b6: //SEG185 findcol::@4
//SEG189 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#2 -- register_copy
jmp b7
//SEG190 findcol::@4
b4: 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 lda x
sec sec
sbc diff sbc diff
sta diff sta diff
//SEG192 [73] phi from findcol::@4 to findcol::@5 jmp b5_from_b4
b5_from_b4:
//SEG193 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#0 -- register_copy
jmp b5
} }
//SEG194 initscreen //SEG187 initscreen
initscreen: { initscreen: {
.label screen = 3 .label screen = 3
//SEG195 [88] phi from initscreen to initscreen::@1 //SEG188 [88] phi from initscreen to initscreen::@1
b1_from_initscreen: 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 lda #<$400
sta screen sta screen
lda #>$400 lda #>$400
sta screen+$1 sta screen+$1
jmp b1 jmp b1
//SEG197 [88] phi from initscreen::@1 to initscreen::@1 //SEG190 [88] phi from initscreen::@1 to initscreen::@1
b1_from_b1: 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
//SEG199 initscreen::@1 //SEG192 initscreen::@1
b1: 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 ldy #$0
lda #$e6 lda #$e6
sta (screen),y 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 inc screen
bne !+ bne !+
inc screen+$1 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 lda screen+$1
cmp #>$7e8 cmp #>$7e8
bcc b1_from_b1 bcc b1_from_b1
@ -9778,35 +9764,38 @@ initscreen: {
cmp #<$7e8 cmp #<$7e8
bcc b1_from_b1 bcc b1_from_b1
!: !:
//SEG203 initscreen::@return //SEG196 initscreen::@return
breturn: breturn:
//SEG204 [92] return [ ] //SEG197 [92] return [ ]
rts rts
} }
//SEG205 addpoint //SEG198 addpoint
addpoint: { addpoint: {
.label c = 2 .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 ldx numpoints
sta $1000,x 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 tya
ldy numpoints ldy numpoints
sta $1100,y 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 lda c
ldx numpoints ldx numpoints
sta $1200,x 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 inc numpoints
//SEG210 addpoint::@return //SEG203 addpoint::@return
breturn: breturn:
//SEG211 [98] return [ ] //SEG204 [98] return [ ]
rts rts
} }
Replacing label b2_from_b5 with b2 Replacing label b2_from_b5 with b2
Replacing label b1_from_b3 with b1 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
Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1
Removing instruction addpoint_from_b3: Removing instruction addpoint_from_b3:
@ -9818,8 +9807,11 @@ Removing instruction b1_from_b3:
Removing instruction b2_from_b1: Removing instruction b2_from_b1:
Removing instruction b2_from_b5: Removing instruction b2_from_b5:
Removing instruction b5_from_b12: Removing instruction b5_from_b12:
Removing instruction b5_from_b4:
Removing instruction b7_from_b14: Removing instruction b7_from_b14:
Removing instruction b7_from_b6:
Removing instruction b8_from_b16: Removing instruction b8_from_b16:
Removing instruction b8_from_b21:
Removing instruction b1_from_b1: Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER ASSEMBLER
@ -10180,7 +10172,7 @@ findcol: {
sec sec
sbc x sbc x
sta diff 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 //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy
//SEG155 findcol::@5 //SEG155 findcol::@5
b5: 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 //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 clc
adc diff 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 //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy
//SEG162 findcol::@7 //SEG162 findcol::@7
b7: b7:
@ -10208,7 +10200,7 @@ findcol: {
b16: 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 //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 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 //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 //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy
//SEG169 findcol::@8 //SEG169 findcol::@8
@ -10236,61 +10228,51 @@ findcol: {
b21: 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 //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 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 jmp b8
//SEG185 findcol::@6 //SEG182 findcol::@6
b6: 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 lda y
sec sec
sbc yp 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 clc
adc diff 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 jmp b7
//SEG190 findcol::@4 //SEG185 findcol::@4
b4: 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 lda x
sec sec
sbc diff sbc diff
sta 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
} }
//SEG194 initscreen //SEG187 initscreen
initscreen: { initscreen: {
.label screen = 3 .label screen = 3
//SEG195 [88] phi from initscreen to initscreen::@1 //SEG188 [88] phi from initscreen to initscreen::@1
b1_from_initscreen: 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 lda #<$400
sta screen sta screen
lda #>$400 lda #>$400
sta screen+$1 sta screen+$1
jmp b1 jmp b1
//SEG197 [88] phi from initscreen::@1 to initscreen::@1 //SEG190 [88] phi from initscreen::@1 to initscreen::@1
//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
//SEG199 initscreen::@1 //SEG192 initscreen::@1
b1: 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 ldy #$0
lda #$e6 lda #$e6
sta (screen),y 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 inc screen
bne !+ bne !+
inc screen+$1 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 lda screen+$1
cmp #>$7e8 cmp #>$7e8
bcc b1 bcc b1
@ -10299,30 +10281,30 @@ initscreen: {
cmp #<$7e8 cmp #<$7e8
bcc b1 bcc b1
!: !:
//SEG203 initscreen::@return //SEG196 initscreen::@return
breturn: breturn:
//SEG204 [92] return [ ] //SEG197 [92] return [ ]
rts rts
} }
//SEG205 addpoint //SEG198 addpoint
addpoint: { addpoint: {
.label c = 2 .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 ldx numpoints
sta $1000,x 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 tya
ldy numpoints ldy numpoints
sta $1100,y 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 lda c
ldx numpoints ldx numpoints
sta $1200,x 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 inc numpoints
//SEG210 addpoint::@return //SEG203 addpoint::@return
breturn: breturn:
//SEG211 [98] return [ ] //SEG204 [98] return [ ]
rts rts
} }
@ -10356,9 +10338,6 @@ Removing instruction b14:
Removing instruction b16: Removing instruction b16:
Removing instruction breturn_from_b8: Removing instruction breturn_from_b8:
Removing instruction b1_from_b19: 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 b1_from_initscreen:
Removing instruction breturn: Removing instruction breturn:
Removing instruction breturn: Removing instruction breturn:
@ -10695,7 +10674,7 @@ findcol: {
sec sec
sbc x sbc x
sta diff 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 //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy
//SEG155 findcol::@5 //SEG155 findcol::@5
b5: 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 //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 clc
adc diff 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 //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy
//SEG162 findcol::@7 //SEG162 findcol::@7
b7: b7:
@ -10721,7 +10700,7 @@ findcol: {
//SEG164 findcol::@16 //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 //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 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 //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 //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy
//SEG169 findcol::@8 //SEG169 findcol::@8
@ -10747,57 +10726,50 @@ findcol: {
b21: 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 //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 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 jmp b8
//SEG185 findcol::@6 //SEG182 findcol::@6
b6: 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 lda y
sec sec
sbc yp 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 clc
adc diff 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 jmp b7
//SEG190 findcol::@4 //SEG185 findcol::@4
b4: 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 lda x
sec sec
sbc diff sbc diff
sta 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 jmp b5
} }
//SEG194 initscreen //SEG187 initscreen
initscreen: { initscreen: {
.label screen = 3 .label screen = 3
//SEG195 [88] phi from initscreen to initscreen::@1 //SEG188 [88] phi from initscreen to initscreen::@1
//SEG196 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1
lda #<$400 lda #<$400
sta screen sta screen
lda #>$400 lda #>$400
sta screen+$1 sta screen+$1
jmp b1 jmp b1
//SEG197 [88] phi from initscreen::@1 to initscreen::@1 //SEG190 [88] phi from initscreen::@1 to initscreen::@1
//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
//SEG199 initscreen::@1 //SEG192 initscreen::@1
b1: 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 ldy #$0
lda #$e6 lda #$e6
sta (screen),y 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 inc screen
bne !+ bne !+
inc screen+$1 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 lda screen+$1
cmp #>$7e8 cmp #>$7e8
bcc b1 bcc b1
@ -10806,28 +10778,28 @@ initscreen: {
cmp #<$7e8 cmp #<$7e8
bcc b1 bcc b1
!: !:
//SEG203 initscreen::@return //SEG196 initscreen::@return
//SEG204 [92] return [ ] //SEG197 [92] return [ ]
rts rts
} }
//SEG205 addpoint //SEG198 addpoint
addpoint: { addpoint: {
.label c = 2 .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 ldx numpoints
sta $1000,x 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 tya
ldy numpoints ldy numpoints
sta $1100,y 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 lda c
ldx numpoints ldx numpoints
sta $1200,x 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 inc numpoints
//SEG210 addpoint::@return //SEG203 addpoint::@return
//SEG211 [98] return [ ] //SEG204 [98] return [ ]
rts rts
} }
@ -11165,7 +11137,7 @@ findcol: {
sec sec
sbc x sbc x
sta diff 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 //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy
//SEG155 findcol::@5 //SEG155 findcol::@5
b5: 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 //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 clc
adc diff 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 //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy
//SEG162 findcol::@7 //SEG162 findcol::@7
b7: b7:
@ -11191,7 +11163,7 @@ findcol: {
//SEG164 findcol::@16 //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 //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 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 //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 //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy
//SEG169 findcol::@8 //SEG169 findcol::@8
@ -11217,56 +11189,49 @@ findcol: {
b21: 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 //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 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 jmp b8
//SEG185 findcol::@6 //SEG182 findcol::@6
b6: 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 lda y
sec sec
sbc yp 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 clc
adc diff 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 jmp b7
//SEG190 findcol::@4 //SEG185 findcol::@4
b4: 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 lda x
sec sec
sbc diff sbc diff
sta 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 jmp b5
} }
//SEG194 initscreen //SEG187 initscreen
initscreen: { initscreen: {
.label screen = 3 .label screen = 3
//SEG195 [88] phi from initscreen to initscreen::@1 //SEG188 [88] phi from initscreen to initscreen::@1
//SEG196 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1
lda #<$400 lda #<$400
sta screen sta screen
lda #>$400 lda #>$400
sta screen+$1 sta screen+$1
//SEG197 [88] phi from initscreen::@1 to initscreen::@1 //SEG190 [88] phi from initscreen::@1 to initscreen::@1
//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
//SEG199 initscreen::@1 //SEG192 initscreen::@1
b1: 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 ldy #$0
lda #$e6 lda #$e6
sta (screen),y 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 inc screen
bne !+ bne !+
inc screen+$1 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 lda screen+$1
cmp #>$7e8 cmp #>$7e8
bcc b1 bcc b1
@ -11275,28 +11240,28 @@ initscreen: {
cmp #<$7e8 cmp #<$7e8
bcc b1 bcc b1
!: !:
//SEG203 initscreen::@return //SEG196 initscreen::@return
//SEG204 [92] return [ ] //SEG197 [92] return [ ]
rts rts
} }
//SEG205 addpoint //SEG198 addpoint
addpoint: { addpoint: {
.label c = 2 .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 ldx numpoints
sta $1000,x 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 tya
ldy numpoints ldy numpoints
sta $1100,y 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 lda c
ldx numpoints ldx numpoints
sta $1200,x 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 inc numpoints
//SEG210 addpoint::@return //SEG203 addpoint::@return
//SEG211 [98] return [ ] //SEG204 [98] return [ ]
rts rts
} }
@ -11801,7 +11766,7 @@ findcol: {
sec sec
sbc x sbc x
sta diff 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 //SEG154 [73] phi (byte) findcol::diff#4 = (byte) findcol::diff#1 -- register_copy
//SEG155 findcol::@5 //SEG155 findcol::@5
b5: 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 //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 clc
adc diff 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 //SEG161 [77] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 -- register_copy
//SEG162 findcol::@7 //SEG162 findcol::@7
b7: b7:
@ -11827,7 +11792,7 @@ findcol: {
//SEG164 findcol::@16 //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 //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 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 //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 //SEG168 [80] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 -- register_copy
//SEG169 findcol::@8 //SEG169 findcol::@8
@ -11853,56 +11818,49 @@ findcol: {
b21: 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 //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 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 jmp b8
//SEG185 findcol::@6 //SEG182 findcol::@6
b6: 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 lda y
sec sec
sbc yp 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 clc
adc diff 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 jmp b7
//SEG190 findcol::@4 //SEG185 findcol::@4
b4: 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 lda x
sec sec
sbc diff sbc diff
sta 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 jmp b5
} }
//SEG194 initscreen //SEG187 initscreen
initscreen: { initscreen: {
.label screen = 3 .label screen = 3
//SEG195 [88] phi from initscreen to initscreen::@1 //SEG188 [88] phi from initscreen to initscreen::@1
//SEG196 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1 //SEG189 [88] phi (byte*) initscreen::screen#2 = (word) 1024 -- zpptrby1=cowo1
lda #<$400 lda #<$400
sta screen sta screen
lda #>$400 lda #>$400
sta screen+$1 sta screen+$1
//SEG197 [88] phi from initscreen::@1 to initscreen::@1 //SEG190 [88] phi from initscreen::@1 to initscreen::@1
//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
//SEG199 initscreen::@1 //SEG192 initscreen::@1
b1: 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 ldy #$0
lda #$e6 lda #$e6
sta (screen),y 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 inc screen
bne !+ bne !+
inc screen+$1 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 lda screen+$1
cmp #>$7e8 cmp #>$7e8
bcc b1 bcc b1
@ -11911,28 +11869,28 @@ initscreen: {
cmp #<$7e8 cmp #<$7e8
bcc b1 bcc b1
!: !:
//SEG203 initscreen::@return //SEG196 initscreen::@return
//SEG204 [92] return [ ] //SEG197 [92] return [ ]
rts rts
} }
//SEG205 addpoint //SEG198 addpoint
addpoint: { addpoint: {
.label c = 2 .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 ldx numpoints
sta $1000,x 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 tya
ldy numpoints ldy numpoints
sta $1100,y 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 lda c
ldx numpoints ldx numpoints
sta $1200,x 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 inc numpoints
//SEG210 addpoint::@return //SEG203 addpoint::@return
//SEG211 [98] return [ ] //SEG204 [98] return [ ]
rts rts
} }