diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index 8c83cff19..e3bee1c4c 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -65,10 +65,17 @@ public class Compiler { private void pass4RegisterAllocation(Program program) { // Find potential registers for each live range equivalence class - based on clobbering of fragments - new Pass3RegisterUpliftPotentialRegisterAnalysis(program).findPotentialRegisters(); + boolean change; + do { + change = new Pass3RegisterUpliftPotentialRegisterAnalysis(program).findPotentialRegisters(); + } while (change); + new Pass3RegisterUpliftPotentialAluAnalysis(program).findPotentialAlu(); program.getLog().append("REGISTER UPLIFT POTENTIAL REGISTERS"); program.getLog().append(program.getRegisterPotentials().toString()); + + + // Find register uplift scopes new Pass3RegisterUpliftScopeAnalysis(program).findScopes(); program.getLog().append("REGISTER UPLIFT SCOPES"); diff --git a/src/main/java/dk/camelot64/kickc/asm/fragment/aby=aby_plus_cowo1_staridx_yby.asm b/src/main/java/dk/camelot64/kickc/asm/fragment/aby=aby_plus_cowo1_staridx_yby.asm new file mode 100644 index 000000000..bd0e9870a --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/asm/fragment/aby=aby_plus_cowo1_staridx_yby.asm @@ -0,0 +1,2 @@ +clc +adc {cowo1},y \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/asm/fragment/xby=aby_plus_cowo1_staridx_xby.asm b/src/main/java/dk/camelot64/kickc/asm/fragment/xby=aby_plus_cowo1_staridx_xby.asm new file mode 100644 index 000000000..177665e5b --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/asm/fragment/xby=aby_plus_cowo1_staridx_xby.asm @@ -0,0 +1,3 @@ +clc +adc {cowo1},x +tax \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/asm/fragment/xby=aby_plus_cowo1_staridx_yby.asm b/src/main/java/dk/camelot64/kickc/asm/fragment/xby=aby_plus_cowo1_staridx_yby.asm new file mode 100644 index 000000000..c6b1ebdc2 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/asm/fragment/xby=aby_plus_cowo1_staridx_yby.asm @@ -0,0 +1,3 @@ +clc +adc {cowo1},y +tax \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/asm/fragment/yby=aby_plus_cowo1_staridx_xby.asm b/src/main/java/dk/camelot64/kickc/asm/fragment/yby=aby_plus_cowo1_staridx_xby.asm new file mode 100644 index 000000000..e8c6dc27e --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/asm/fragment/yby=aby_plus_cowo1_staridx_xby.asm @@ -0,0 +1,3 @@ +clc +adc {cowo1},x +tay \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/asm/fragment/yby=aby_plus_cowo1_staridx_yby.asm b/src/main/java/dk/camelot64/kickc/asm/fragment/yby=aby_plus_cowo1_staridx_yby.asm new file mode 100644 index 000000000..eff42ca27 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/asm/fragment/yby=aby_plus_cowo1_staridx_yby.asm @@ -0,0 +1,3 @@ +clc +adc {cowo1},y +tay \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/icl/RegisterPotentials.java b/src/main/java/dk/camelot64/kickc/icl/RegisterPotentials.java index 3b79a6b1f..a3dbee309 100644 --- a/src/main/java/dk/camelot64/kickc/icl/RegisterPotentials.java +++ b/src/main/java/dk/camelot64/kickc/icl/RegisterPotentials.java @@ -13,12 +13,10 @@ public class RegisterPotentials { this.potentials = new LinkedHashMap<>(); } - public List getPotentialRegisters(LiveRangeEquivalenceClass equivalenceClass) { return potentials.get(equivalenceClass); } - public void setPotentialRegisters(LiveRangeEquivalenceClass equivalenceClass, List registers) { potentials.put(equivalenceClass, new ArrayList<>(registers)); } @@ -48,4 +46,11 @@ public class RegisterPotentials { } return out.toString(); } + + public void addPotentialRegister(LiveRangeEquivalenceClass equivalenceClass, RegisterAllocation.Register register) { + List registers = potentials.get(equivalenceClass); + if (!registers.contains(register)) { + registers.add(register); + } + } } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftPotentialAluAnalysis.java b/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftPotentialAluAnalysis.java new file mode 100644 index 000000000..a22730d7d --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftPotentialAluAnalysis.java @@ -0,0 +1,95 @@ +package dk.camelot64.kickc.passes; + +import dk.camelot64.kickc.icl.*; + +/*** + * Find equivalence classes that could be assigned to the special ALU register. + */ +public class Pass3RegisterUpliftPotentialAluAnalysis extends Pass2Base { + + private LiveRangeEquivalenceClassSet liveRangeEquivalenceClassSet; + + public Pass3RegisterUpliftPotentialAluAnalysis(Program program) { + super(program); + } + + /*** + * Look through all statements identifying statement combinations that are fit for ALU. + * + * ALU is usable for v1 in the following sequence - if v1 is alive only in the first statement:
+ * v1 = vx *idx vy / v1 = * vx
+ * zzz = v1 + vz / zzz = vz + v1 / zzz = vz - v1
+ * + */ + public void findPotentialAlu() { + + RegisterPotentials registerPotentials = getProgram().getRegisterPotentials(); + this.liveRangeEquivalenceClassSet = getProgram().getLiveRangeEquivalenceClassSet(); + + for (ControlFlowBlock block : getProgram().getGraph().getAllBlocks()) { + + VariableRef potentialAluVar = null; + + for (Statement statement : block.getStatements()) { + if (potentialAluVar != null) { + // Previous assignment has ALU potential - check if current statement can use it + if (statement instanceof StatementAssignment) { + StatementAssignment assignment = (StatementAssignment) statement; + if (assignment.getOperator()!=null && "-".equals(assignment.getOperator().getOperator())) { + // ALU applicable if the variable is the second lValue and the first lValue is non-null + if (assignment.getrValue2().equals(potentialAluVar) && assignment.getrValue1() != null) { + // The variable has ALU potential + hasAluPotential(registerPotentials, potentialAluVar); + } + } else if (assignment.getOperator()!=null && "+".equals(assignment.getOperator().getOperator())) { + // ALU applicable if the variable is one of the two values + if (assignment.getrValue2().equals(potentialAluVar) && assignment.getrValue1() != null) { + // The variable has ALU potential + hasAluPotential(registerPotentials, potentialAluVar); + } + if (assignment.getrValue1().equals(potentialAluVar) && assignment.getrValue2() != null) { + // The variable has ALU potential + hasAluPotential(registerPotentials, potentialAluVar); + } + } + } + } + potentialAluVar = null; + if (statement instanceof StatementAssignment) { + StatementAssignment assignment = (StatementAssignment) statement; + if (assignment.getOperator()!=null && "*".equals(assignment.getOperator().getOperator()) && assignment.getrValue1() == null) { + potentialAluVar = findAluPotential(assignment); + } + if (assignment.getOperator()!=null && "*idx".equals(assignment.getOperator().getOperator())) { + potentialAluVar = findAluPotential(assignment); + } + } + } + } + } + + private VariableRef findAluPotential(StatementAssignment assignment) { + VariableRef potentialAluVar = null; + if (assignment.getlValue() instanceof VariableRef) { + VariableRef var = (VariableRef) assignment.getlValue(); + LiveRangeEquivalenceClass varEquivalenceClass = liveRangeEquivalenceClassSet.getEquivalenceClass(var); + if (varEquivalenceClass.getVariables().size() == 1) { + // Alone in equivalence class + LiveRange liveRange = varEquivalenceClass.getLiveRange(); + if (liveRange.size() == 1) { + // Only used in the following statement + potentialAluVar = var; + } + } + } + return potentialAluVar; + } + + private void hasAluPotential(RegisterPotentials registerPotentials, VariableRef ref) { + LiveRangeEquivalenceClass potentialAluEquivalenceClass = liveRangeEquivalenceClassSet.getEquivalenceClass(ref); + registerPotentials.addPotentialRegister(potentialAluEquivalenceClass, RegisterAllocation.getRegisterALU()); + getLog().append("Equivalence Class "+potentialAluEquivalenceClass+" has ALU potential."); + } + + +} diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftPotentialRegisterAnalysis.java b/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftPotentialRegisterAnalysis.java index fade879ba..241014b7a 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftPotentialRegisterAnalysis.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3RegisterUpliftPotentialRegisterAnalysis.java @@ -18,15 +18,21 @@ public class Pass3RegisterUpliftPotentialRegisterAnalysis extends Pass2Base { super(program); } - /*** For each statement - try out all potential register combinations and examine the clobber */ - public void findPotentialRegisters() { + /*** + * For each statement - try out all potential register combinations and examine the clobber + * + * @return true if the potential registers of the program was changed. Menas that another call might refine them further + */ + public boolean findPotentialRegisters() { + boolean modified = false; LiveRangeEquivalenceClassSet liveRangeEquivalenceClassSet = getProgram().getLiveRangeEquivalenceClassSet(); RegisterPotentials registerPotentials = getProgram().getRegisterPotentials(); // Initialize potential registers for all live range equilavence classes if (registerPotentials == null) { + modified = true; registerPotentials = new RegisterPotentials(); for (LiveRangeEquivalenceClass equivalenceClass : liveRangeEquivalenceClassSet.getEquivalenceClasses()) { RegisterAllocation.Register defaultRegister = equivalenceClass.getRegister(); @@ -96,6 +102,7 @@ public class Pass3RegisterUpliftPotentialRegisterAnalysis extends Pass2Base { StringBuilder msg = new StringBuilder(); msg.append("Removing always clobbered register " + clobberedRegister + " as potential for " + aliveClass); getLog().append(msg.toString()); + modified = true; } } } @@ -104,10 +111,12 @@ public class Pass3RegisterUpliftPotentialRegisterAnalysis extends Pass2Base { getProgram().setRegisterPotentials(registerPotentials); + return modified; + } /** - * Find the registers clobbered by all regsiter allocation combinations. + * Find the registers clobbered by all register allocation combinations. * For each combination generate the ASM and examine the clobber of all alive variables. * * @param block The block containins the statement @@ -116,6 +125,8 @@ public class Pass3RegisterUpliftPotentialRegisterAnalysis extends Pass2Base { * @return A set with registers that are clobbered by all different register assignments in the combination */ private Set findAlwaysClobberedRegisters(ControlFlowBlock block, Statement statement, RegisterCombinationIterator combinations) { + + // Initially assume all registers are always clobbered Set alwaysClobbered = new LinkedHashSet<>(); alwaysClobbered.add(RegisterAllocation.getRegisterA()); alwaysClobbered.add(RegisterAllocation.getRegisterX()); diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log index fb064b3ee..57c871feb 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log @@ -1181,6 +1181,10 @@ Removing always clobbered register reg byte y as potential for zp byte:6 [ y#2 y Statement [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 cursor#1 y#2 ] always clobbers reg byte a Statement [9] (byte*) cursor#2 ← (byte*) cursor#1 + (byte) 40 [ x#1 e#1 cursor#2 y#1 ] always clobbers reg byte a Statement [10] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 cursor#2 e#2 y#1 ] always clobbers reg byte a +Statement [1] *((byte*) cursor#3) ← (byte) 81 [ cursor#3 x#2 e#3 y#2 ] always clobbers reg byte a reg byte y +Statement [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 cursor#1 y#2 ] always clobbers reg byte a +Statement [9] (byte*) cursor#2 ← (byte*) cursor#1 + (byte) 40 [ x#1 e#1 cursor#2 y#1 ] always clobbers reg byte a +Statement [10] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 cursor#2 e#2 y#1 ] always clobbers reg byte a REGISTER UPLIFT POTENTIAL REGISTERS Potential registers zp ptr byte:2 [ cursor#3 cursor#5 cursor#1 cursor#2 ] : zp ptr byte:2 , Potential registers zp byte:4 [ x#2 x#1 ] : zp byte:4 , reg byte x , diff --git a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.asm b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.asm index a060d31d8..18b38dca0 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.asm +++ b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.asm @@ -8,10 +8,8 @@ B1_from_BBEGIN: B1_from_B1: B1: lda 4352,x - sta 2 - lda 4353,x clc - adc 2 + adc 4353,x sta 4354,x inx cpx #15 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log index 7ce4be1eb..9dfc2fb60 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log @@ -489,10 +489,13 @@ BEND: Statement [0] *((word) 4352) ← (byte) 0 [ ] always clobbers reg byte a Statement [1] *((word) 4353) ← (byte) 1 [ ] always clobbers reg byte a +Statement [0] *((word) 4352) ← (byte) 0 [ ] always clobbers reg byte a +Statement [1] *((word) 4353) ← (byte) 1 [ ] always clobbers reg byte a +Equivalence Class zp byte:4 [ $3 ] has ALU potential. REGISTER UPLIFT POTENTIAL REGISTERS Potential registers zp byte:2 [ i#2 i#1 ] : zp byte:2 , reg byte a , reg byte x , reg byte y , Potential registers zp byte:3 [ $1 ] : zp byte:3 , reg byte a , reg byte x , reg byte y , -Potential registers zp byte:4 [ $3 ] : zp byte:4 , reg byte a , reg byte x , reg byte y , +Potential registers zp byte:4 [ $3 ] : zp byte:4 , reg byte a , reg byte x , reg byte y , reg byte alu , Potential registers zp byte:5 [ $4 ] : zp byte:5 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES @@ -514,6 +517,10 @@ Uplift attempt [] 687 allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] zp byt Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] zp byte:5 [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] 487 allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] zp byte:5 [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] zp byte:5 [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment zpby1=zpby2_plus_cowo1_staridx_zpby3 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment zpby1=zpby2_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment zpby1=zpby2_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment zpby1=zpby2_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] 647 allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte a [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte a [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] 467 allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte a [ $4 ] zp byte:3 [ $1 ] @@ -530,6 +537,10 @@ Uplift attempt [] 627 allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] reg by Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] reg byte a [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] 427 allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] reg byte a [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] reg byte a [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment aby=zpby1_plus_cowo1_staridx_zpby2 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment aby=zpby1_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment aby=zpby1_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment aby=zpby1_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] 687 allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte x [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte x [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte x [ $4 ] zp byte:3 [ $1 ] @@ -546,6 +557,10 @@ Uplift attempt [] 667 allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] reg by Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] reg byte x [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] reg byte x [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] reg byte x [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment xby=zpby1_plus_cowo1_staridx_zpby2 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment xby=zpby1_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment xby=zpby1_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment xby=zpby1_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] 687 allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte y [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte y [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] 507 allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte y [ $4 ] zp byte:3 [ $1 ] @@ -562,6 +577,10 @@ Uplift attempt [] 667 allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] reg by Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] reg byte y [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] 467 allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] reg byte y [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] reg byte y [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment yby=zpby1_plus_cowo1_staridx_zpby2 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment yby=zpby1_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment yby=zpby1_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] zp byte:3 [ $1 ] +Uplift attempt [] missing fragment yby=zpby1_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] zp byte:3 [ $1 ] Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] zp byte:5 [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] zp byte:5 [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] zp byte:5 [ $4 ] reg byte a [ $1 ] @@ -578,6 +597,10 @@ Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] zp Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] zp byte:5 [ $4 ] reg byte a [ $1 ] Uplift attempt [] 467 allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] zp byte:5 [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] zp byte:5 [ $4 ] reg byte a [ $1 ] +Uplift attempt [] missing fragment zpby1=aby_plus_cowo1_staridx_zpby2 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] reg byte a [ $1 ] +Uplift attempt [] missing fragment zpby1=aby_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] reg byte a [ $1 ] +Uplift attempt [] missing fragment zpby1=aby_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] reg byte a [ $1 ] +Uplift attempt [] missing fragment zpby1=aby_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte a [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte a [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte a [ $4 ] reg byte a [ $1 ] @@ -594,6 +617,10 @@ Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] re Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] reg byte a [ $4 ] reg byte a [ $1 ] Uplift attempt [] 407 allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] reg byte a [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] reg byte a [ $4 ] reg byte a [ $1 ] +Uplift attempt [] missing fragment aby=aby_plus_cowo1_staridx_zpby1 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte a [ $1 ] +Uplift attempt [] missing fragment aby=aby_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte a [ $1 ] +Uplift attempt [] 347 allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte a [ $1 ] +Uplift attempt [] 347 allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte x [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte x [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte x [ $4 ] reg byte a [ $1 ] @@ -610,6 +637,10 @@ Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] re Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] reg byte x [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] reg byte x [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] reg byte x [ $4 ] reg byte a [ $1 ] +Uplift attempt [] missing fragment xby=aby_plus_cowo1_staridx_zpby1 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] reg byte a [ $1 ] +Uplift attempt [] missing fragment xby=aby_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] reg byte a [ $1 ] +Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] reg byte a [ $1 ] +Uplift attempt [] 387 allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte y [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte y [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte y [ $4 ] reg byte a [ $1 ] @@ -626,6 +657,10 @@ Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] re Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] reg byte y [ $4 ] reg byte a [ $1 ] Uplift attempt [] 447 allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] reg byte y [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] reg byte y [ $4 ] reg byte a [ $1 ] +Uplift attempt [] missing fragment yby=aby_plus_cowo1_staridx_zpby1 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] reg byte a [ $1 ] +Uplift attempt [] missing fragment yby=aby_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] reg byte a [ $1 ] +Uplift attempt [] 387 allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] reg byte a [ $1 ] +Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] reg byte a [ $1 ] Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] zp byte:5 [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] zp byte:5 [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] zp byte:5 [ $4 ] reg byte x [ $1 ] @@ -642,6 +677,10 @@ Uplift attempt [] 707 allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] zp byt Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] zp byte:5 [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] zp byte:5 [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] zp byte:5 [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment zpby1=xby_plus_cowo1_staridx_zpby2 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment zpby1=xby_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment zpby1=xby_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment zpby1=xby_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte a [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte a [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte a [ $4 ] reg byte x [ $1 ] @@ -658,6 +697,10 @@ Uplift attempt [] 647 allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] reg by Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] reg byte a [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] reg byte a [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] reg byte a [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment aby=xby_plus_cowo1_staridx_zpby1 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment aby=xby_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment aby=xby_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment aby=xby_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte x [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte x [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte x [ $4 ] reg byte x [ $1 ] @@ -674,6 +717,10 @@ Uplift attempt [] 687 allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] reg by Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] reg byte x [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] reg byte x [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] reg byte x [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment xby=xby_plus_cowo1_staridx_zpby1 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment xby=xby_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment xby=xby_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment xby=xby_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte y [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte y [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte y [ $4 ] reg byte x [ $1 ] @@ -690,6 +737,10 @@ Uplift attempt [] 687 allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] reg by Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] reg byte y [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] reg byte y [ $4 ] reg byte x [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] reg byte y [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment yby=xby_plus_cowo1_staridx_zpby1 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment yby=xby_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment yby=xby_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] reg byte x [ $1 ] +Uplift attempt [] missing fragment yby=xby_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] reg byte x [ $1 ] Uplift attempt [] 687 allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] zp byte:5 [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] zp byte:5 [ $4 ] reg byte y [ $1 ] Uplift attempt [] 487 allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] zp byte:5 [ $4 ] reg byte y [ $1 ] @@ -706,6 +757,10 @@ Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] zp Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] zp byte:5 [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] zp byte:5 [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] zp byte:5 [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment zpby1=yby_plus_cowo1_staridx_zpby2 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment zpby1=yby_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment zpby1=yby_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment zpby1=yby_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] zp byte:5 [ $4 ] reg byte y [ $1 ] Uplift attempt [] 627 allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte a [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte a [ $4 ] reg byte y [ $1 ] Uplift attempt [] 427 allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte a [ $4 ] reg byte y [ $1 ] @@ -722,6 +777,10 @@ Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] re Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] reg byte a [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] reg byte a [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] reg byte a [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment aby=yby_plus_cowo1_staridx_zpby1 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment aby=yby_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment aby=yby_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment aby=yby_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte y [ $1 ] Uplift attempt [] 667 allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte x [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte x [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte x [ $4 ] reg byte y [ $1 ] @@ -738,6 +797,10 @@ Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] re Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] reg byte x [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] reg byte x [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] reg byte x [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment xby=yby_plus_cowo1_staridx_zpby1 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment xby=yby_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment xby=yby_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment xby=yby_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] reg byte x [ $4 ] reg byte y [ $1 ] Uplift attempt [] 667 allocation: zp byte:2 [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte y [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte y [ $4 ] reg byte y [ $1 ] Uplift attempt [] 467 allocation: reg byte x [ i#2 i#1 ] zp byte:4 [ $3 ] reg byte y [ $4 ] reg byte y [ $1 ] @@ -754,8 +817,70 @@ Uplift attempt [] clobber allocation: zp byte:2 [ i#2 i#1 ] reg byte y [ $3 ] re Uplift attempt [] clobber allocation: reg byte a [ i#2 i#1 ] reg byte y [ $3 ] reg byte y [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte x [ i#2 i#1 ] reg byte y [ $3 ] reg byte y [ $4 ] reg byte y [ $1 ] Uplift attempt [] clobber allocation: reg byte y [ i#2 i#1 ] reg byte y [ $3 ] reg byte y [ $4 ] reg byte y [ $1 ] -Uplifting [] best 407 combination reg byte x [ i#2 i#1 ] reg byte a [ $3 ] reg byte a [ $4 ] zp byte:3 [ $1 ] -Re-allocated ZP register from zp byte:3 to zp byte:2 +Uplift attempt [] missing fragment yby=yby_plus_cowo1_staridx_zpby1 allocation: zp byte:2 [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment yby=yby_plus_cowo1_staridx_aby allocation: reg byte a [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment yby=yby_plus_cowo1_staridx_xby allocation: reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] reg byte y [ $1 ] +Uplift attempt [] missing fragment yby=yby_plus_cowo1_staridx_yby allocation: reg byte y [ i#2 i#1 ] reg byte alu [ $3 ] reg byte y [ $4 ] reg byte y [ $1 ] +Uplifting [] best 347 combination reg byte x [ i#2 i#1 ] reg byte alu [ $3 ] reg byte a [ $4 ] reg byte a [ $1 ] +MISSING FRAGMENTS + zpby1=zpby2_plus_cowo1_staridx_zpby3 + zpby1=zpby2_plus_cowo1_staridx_aby + zpby1=zpby2_plus_cowo1_staridx_xby + zpby1=zpby2_plus_cowo1_staridx_yby + aby=zpby1_plus_cowo1_staridx_zpby2 + aby=zpby1_plus_cowo1_staridx_aby + aby=zpby1_plus_cowo1_staridx_xby + aby=zpby1_plus_cowo1_staridx_yby + xby=zpby1_plus_cowo1_staridx_zpby2 + xby=zpby1_plus_cowo1_staridx_aby + xby=zpby1_plus_cowo1_staridx_xby + xby=zpby1_plus_cowo1_staridx_yby + yby=zpby1_plus_cowo1_staridx_zpby2 + yby=zpby1_plus_cowo1_staridx_aby + yby=zpby1_plus_cowo1_staridx_xby + yby=zpby1_plus_cowo1_staridx_yby + zpby1=aby_plus_cowo1_staridx_zpby2 + zpby1=aby_plus_cowo1_staridx_aby + zpby1=aby_plus_cowo1_staridx_xby + zpby1=aby_plus_cowo1_staridx_yby + aby=aby_plus_cowo1_staridx_zpby1 + aby=aby_plus_cowo1_staridx_aby + xby=aby_plus_cowo1_staridx_zpby1 + xby=aby_plus_cowo1_staridx_aby + yby=aby_plus_cowo1_staridx_zpby1 + yby=aby_plus_cowo1_staridx_aby + zpby1=xby_plus_cowo1_staridx_zpby2 + zpby1=xby_plus_cowo1_staridx_aby + zpby1=xby_plus_cowo1_staridx_xby + zpby1=xby_plus_cowo1_staridx_yby + aby=xby_plus_cowo1_staridx_zpby1 + aby=xby_plus_cowo1_staridx_aby + aby=xby_plus_cowo1_staridx_xby + aby=xby_plus_cowo1_staridx_yby + xby=xby_plus_cowo1_staridx_zpby1 + xby=xby_plus_cowo1_staridx_aby + xby=xby_plus_cowo1_staridx_xby + xby=xby_plus_cowo1_staridx_yby + yby=xby_plus_cowo1_staridx_zpby1 + yby=xby_plus_cowo1_staridx_aby + yby=xby_plus_cowo1_staridx_xby + yby=xby_plus_cowo1_staridx_yby + zpby1=yby_plus_cowo1_staridx_zpby2 + zpby1=yby_plus_cowo1_staridx_aby + zpby1=yby_plus_cowo1_staridx_xby + zpby1=yby_plus_cowo1_staridx_yby + aby=yby_plus_cowo1_staridx_zpby1 + aby=yby_plus_cowo1_staridx_aby + aby=yby_plus_cowo1_staridx_xby + aby=yby_plus_cowo1_staridx_yby + xby=yby_plus_cowo1_staridx_zpby1 + xby=yby_plus_cowo1_staridx_aby + xby=yby_plus_cowo1_staridx_xby + xby=yby_plus_cowo1_staridx_yby + yby=yby_plus_cowo1_staridx_zpby1 + yby=yby_plus_cowo1_staridx_aby + yby=yby_plus_cowo1_staridx_xby + yby=yby_plus_cowo1_staridx_yby Removing instruction jmp B1 Removing instruction jmp BEND Succesful ASM optimization Pass5NextJumpElimination @@ -778,14 +903,13 @@ B1_from_B1: //SEG6 [2] phi (byte) i#2 = (byte) i#1 -- register_copy //SEG7 @1 B1: -//SEG8 [3] (byte~) $1 ← (word) 4352 *idx (byte) i#2 [ i#2 $1 ] -- zpby1=cowo1_staridx_xby +//SEG8 [3] (byte~) $1 ← (word) 4352 *idx (byte) i#2 [ i#2 $1 ] -- aby=cowo1_staridx_xby lda 4352,x - sta 2 -//SEG9 [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] -- aby=cowo1_staridx_xby - lda 4353,x -//SEG10 [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] -- aby=zpby1_plus_aby +//SEG9 [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] + // [4] $3 ← 4353 *idx i#2 // ALU +//SEG10 [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] -- aby=aby_plus_cowo1_staridx_xby clc - adc 2 + adc 4353,x //SEG11 [6] *((word) 4354 + (byte) i#2) ← (byte~) $4 [ i#2 ] -- cowo1_staridx_xby=aby sta 4354,x //SEG12 [7] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] -- xby=xby_plus_1 @@ -816,14 +940,13 @@ B1_from_B1: //SEG6 [2] phi (byte) i#2 = (byte) i#1 -- register_copy //SEG7 @1 B1: -//SEG8 [3] (byte~) $1 ← (word) 4352 *idx (byte) i#2 [ i#2 $1 ] -- zpby1=cowo1_staridx_xby +//SEG8 [3] (byte~) $1 ← (word) 4352 *idx (byte) i#2 [ i#2 $1 ] -- aby=cowo1_staridx_xby lda 4352,x - sta 2 -//SEG9 [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] -- aby=cowo1_staridx_xby - lda 4353,x -//SEG10 [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] -- aby=zpby1_plus_aby +//SEG9 [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] + // [4] $3 ← 4353 *idx i#2 // ALU +//SEG10 [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] -- aby=aby_plus_cowo1_staridx_xby clc - adc 2 + adc 4353,x //SEG11 [6] *((word) 4354 + (byte) i#2) ← (byte~) $4 [ i#2 ] -- cowo1_staridx_xby=aby sta 4354,x //SEG12 [7] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] -- xby=xby_plus_1 @@ -835,8 +958,8 @@ B1: BEND: FINAL SYMBOL TABLE -(byte~) $1 zp byte:2 11.0 -(byte~) $3 reg byte a 22.0 +(byte~) $1 reg byte a 11.0 +(byte~) $3 reg byte alu 22.0 (byte~) $4 reg byte a 22.0 (label) @1 (label) @BEGIN @@ -847,8 +970,8 @@ FINAL SYMBOL TABLE (byte) i#2 reg byte x 11.0 reg byte x [ i#2 i#1 ] -zp byte:2 [ $1 ] -reg byte a [ $3 ] +reg byte a [ $1 ] +reg byte alu [ $3 ] reg byte a [ $4 ] FINAL CODE @@ -869,14 +992,13 @@ B1_from_B1: //SEG6 [2] phi (byte) i#2 = (byte) i#1 -- register_copy //SEG7 @1 B1: -//SEG8 [3] (byte~) $1 ← (word) 4352 *idx (byte) i#2 [ i#2 $1 ] -- zpby1=cowo1_staridx_xby +//SEG8 [3] (byte~) $1 ← (word) 4352 *idx (byte) i#2 [ i#2 $1 ] -- aby=cowo1_staridx_xby lda 4352,x - sta 2 -//SEG9 [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] -- aby=cowo1_staridx_xby - lda 4353,x -//SEG10 [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] -- aby=zpby1_plus_aby +//SEG9 [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] + // [4] $3 ← 4353 *idx i#2 // ALU +//SEG10 [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] -- aby=aby_plus_cowo1_staridx_xby clc - adc 2 + adc 4353,x //SEG11 [6] *((word) 4354 + (byte) i#2) ← (byte~) $4 [ i#2 ] -- cowo1_staridx_xby=aby sta 4354,x //SEG12 [7] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] -- xby=xby_plus_1 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.sym b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.sym index 0d7def637..46f46f159 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.sym +++ b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.sym @@ -1,5 +1,5 @@ -(byte~) $1 zp byte:2 11.0 -(byte~) $3 reg byte a 22.0 +(byte~) $1 reg byte a 11.0 +(byte~) $3 reg byte alu 22.0 (byte~) $4 reg byte a 22.0 (label) @1 (label) @BEGIN @@ -10,6 +10,6 @@ (byte) i#2 reg byte x 11.0 reg byte x [ i#2 i#1 ] -zp byte:2 [ $1 ] -reg byte a [ $3 ] +reg byte a [ $1 ] +reg byte alu [ $3 ] reg byte a [ $4 ] diff --git a/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.log b/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.log index bb12ab38b..ba47abd52 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.log @@ -4406,6 +4406,8 @@ Statement [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ fli Removing always clobbered register reg byte a as potential for zp byte:9 [ flip::srcIdx#2 flip::srcIdx#3 flip::srcIdx#1 ] Removing always clobbered register reg byte a as potential for zp byte:11 [ flip::c#2 flip::c#1 ] Removing always clobbered register reg byte a as potential for zp byte:8 [ flip::r#2 flip::r#1 ] +Statement [20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ] always clobbers reg byte a +Statement [29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ] always clobbers reg byte a REGISTER UPLIFT POTENTIAL REGISTERS Potential registers zp byte:2 [ main::c#2 main::c#1 ] : zp byte:2 , reg byte a , reg byte x , reg byte y , Potential registers zp ptr byte:3 [ plot::line#2 plot::line#1 ] : zp ptr byte:3 , diff --git a/src/main/java/dk/camelot64/kickc/test/ref/minus.log b/src/main/java/dk/camelot64/kickc/test/ref/minus.log index 9667f3b3a..f0f43ed26 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/minus.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/minus.log @@ -342,6 +342,7 @@ BEND: Statement [1] (byte~) $1 ← (byte) i#2 + (byte) 4 [ i#2 $1 ] always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp byte:2 [ i#2 i#1 ] +Statement [1] (byte~) $1 ← (byte) i#2 + (byte) 4 [ i#2 $1 ] always clobbers reg byte a REGISTER UPLIFT POTENTIAL REGISTERS Potential registers zp byte:2 [ i#2 i#1 ] : zp byte:2 , reg byte x , reg byte y , Potential registers zp byte:3 [ $1 ] : zp byte:3 , reg byte a , reg byte x , reg byte y , diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log index 79baf5b71..2b51fa027 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log @@ -2076,6 +2076,11 @@ Statement [25] *((word) 1024) ← (byte) 1 [ ] always clobbers reg byte a Statement [26] *((word) 1025) ← (byte) 2 [ ] always clobbers reg byte a Statement [30] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp byte:9 [ lvalue::i#2 lvalue::i#1 ] +Statement [9] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ] always clobbers reg byte a reg byte y +Statement [15] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ] always clobbers reg byte a reg byte y +Statement [25] *((word) 1024) ← (byte) 1 [ ] always clobbers reg byte a +Statement [26] *((word) 1025) ← (byte) 2 [ ] always clobbers reg byte a +Statement [30] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] always clobbers reg byte a REGISTER UPLIFT POTENTIAL REGISTERS Potential registers zp byte:2 [ lvaluevar::i#2 lvaluevar::i#1 ] : zp byte:2 , reg byte x , Potential registers zp ptr byte:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] : zp ptr byte:3 , diff --git a/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log b/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log index e60c92d91..38027bcfc 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log @@ -225,6 +225,7 @@ main__Breturn: //SEG6 [2] return [ ] rts +Statement [1] *((word) 1024) ← (byte) 1 [ ] always clobbers reg byte a Statement [1] *((word) 1024) ← (byte) 1 [ ] always clobbers reg byte a REGISTER UPLIFT POTENTIAL REGISTERS