1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-26 03:32:23 +00:00

Ensured that assignment to variables with ALU potential does not affect potential registers through clobbering.

This commit is contained in:
jespergravgaard 2017-11-01 16:43:13 +01:00
parent 4bcef390f3
commit 14219443a8
25 changed files with 105 additions and 73 deletions

View File

@ -244,12 +244,13 @@ public class Compiler {
program.getLog().append(program.getAsm().toString());
// Find potential registers for each live range equivalence class - based on clobbering of fragments
program.getLog().append("REGISTER UPLIFT POTENTIAL REGISTERS");
new Pass4RegisterUpliftPotentialInitialize(program).initPotentialRegisters();
new Pass4RegisterUpliftPotentialAluAnalysis(program).findPotentialAlu();
boolean change;
do {
change = new Pass4RegisterUpliftPotentialRegisterAnalysis(program).findPotentialRegisters();
} while (change);
new Pass4RegisterUpliftPotentialAluAnalysis(program).findPotentialAlu();
program.getLog().append("REGISTER UPLIFT POTENTIAL REGISTERS");
program.getLog().append(program.getRegisterPotentials().toString());
// Find register uplift scopes

View File

@ -29,7 +29,7 @@ Features
- Add support for casting. Specifically casting a byte* to a word and the other way (eg. to enable calculating D018-value from pointer to bitmap & screen.) - *D018 = (byte*)((word)SCREEN/$40)|((word)BITMAP/$400);
- Consider whether autocasting word & byte* is possible ?
- Add UpliftRemains support for attempting to uplift potentials to ALU (requires modifying two registers: 1. the ALU potential to ALU - the one added to the ALU potential to A.)
- Support array-initializer syntax as literal word syntax. byte* plotter = { lo, hi };
- Syntax for composing a word from two bytes. word w = { lo, hi } --> ICL: w = lo _word_ hi;
Word Math
- Support Word table lookup (through 2 byte-tables)
@ -46,8 +46,9 @@ Arrays / Strings / Inline data
- Add support for expressions in data initializers.
- Create a fill-like array initialization - byte[$100] plot_xlo = { [x] = x&$f8 };
- Support word-arrays as two underlying byte-arrays in memory: word[$100] plot_x; -> ASM { plot_x_lo .fill $100,0 plot_x_hi .fill $100,0; }
- Support syntax for initializing the address of the two byte-arrays underlying a word array. word[] plot_x = { lo=$1000, hi=$1000 };
- Support syntax for initializing the address of a byte-array. byte[] plot_x = { addr=$1000 }; -- current syntax as a short hand byte[] plot_x = $1000;
- Support syntax for initializing the address of the two byte-arrays underlying a word array. word[] plot_x = { lo=$1000, hi=$1000 };
- Support syntax for initializing the address of a byte-array. byte[] plot_x = { addr=$1000 }; -- current syntax as a short hand byte[] plot_x = $1000;
- Syntax for accessing the low/high byte-array that underlies the word-array. word[$100] plot_x; byte* plot_x_lo = plot_x.lo; plot_x_lo[0] = 0;
- Inline ASM
- Add support for inline asm
@ -164,3 +165,4 @@ Done
+ (callconstparam.kc) Constant parameters to multiple calls are mixed together because their versioned names (x0#0, X0#1) are shortened to not include the version and only one version is output in the ASM.
+ (callconstparam.kc) Constant call parameters are stored as values in the called function - not at the call. The reference from the call to the constant does not include the function name, so the result is an unknown symbol error when compiling the ASM.
+ Inline constants that are only call parameters used once (eg. x0#0 and x0#1 in callconstparam.kc)
+ Ensured that assignment to variables with ALU potential does not affect potential registers through clobbering.

View File

@ -49,6 +49,10 @@ public class RegisterPotentials {
public void addPotentialRegister(LiveRangeEquivalenceClass equivalenceClass, Registers.Register register) {
List<Registers.Register> registers = potentials.get(equivalenceClass);
if(registers==null) {
registers= new ArrayList<>();
potentials.put(equivalenceClass, registers);
}
if (!registers.contains(register)) {
registers.add(register);
}

View File

@ -99,5 +99,4 @@ public class Pass4RegisterUpliftPotentialAluAnalysis extends Pass2Base {
getLog().append("Equivalence Class "+potentialAluEquivalenceClass+" has ALU potential.");
}
}

View File

@ -0,0 +1,40 @@
package dk.camelot64.kickc.passes;
import dk.camelot64.kickc.model.*;
import java.util.Arrays;
import java.util.List;
/*** Initialize potential registers for each equivalence class.
*
* */
public class Pass4RegisterUpliftPotentialInitialize extends Pass2Base {
public Pass4RegisterUpliftPotentialInitialize(Program program) {
super(program);
}
/***
* Initialize register potentials for each equivalence class with all potential registers
*/
public void initPotentialRegisters() {
LiveRangeEquivalenceClassSet liveRangeEquivalenceClassSet = getProgram().getLiveRangeEquivalenceClassSet();
RegisterPotentials registerPotentials = new RegisterPotentials();
for (LiveRangeEquivalenceClass equivalenceClass : liveRangeEquivalenceClassSet.getEquivalenceClasses()) {
Registers.Register defaultRegister = equivalenceClass.getRegister();
Registers.RegisterType registerType = defaultRegister.getType();
if (registerType.equals(Registers.RegisterType.ZP_BYTE)) {
List<Registers.Register> potentials = Arrays.asList(
defaultRegister,
Registers.getRegisterA(),
Registers.getRegisterX(),
Registers.getRegisterY());
registerPotentials.setPotentialRegisters(equivalenceClass, potentials);
} else {
registerPotentials.setPotentialRegisters(equivalenceClass, Arrays.asList(defaultRegister));
}
}
getProgram().setRegisterPotentials(registerPotentials);
}
}

View File

@ -22,7 +22,7 @@ public class Pass4RegisterUpliftPotentialRegisterAnalysis extends Pass2Base {
/***
* 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
* @return true if the potential registers of the program was changed. Means that another call might refine them further
*/
public boolean findPotentialRegisters() {
@ -31,26 +31,6 @@ public class Pass4RegisterUpliftPotentialRegisterAnalysis extends Pass2Base {
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()) {
Registers.Register defaultRegister = equivalenceClass.getRegister();
Registers.RegisterType registerType = defaultRegister.getType();
if (registerType.equals(Registers.RegisterType.ZP_BYTE)) {
List<Registers.Register> potentials = Arrays.asList(
defaultRegister,
Registers.getRegisterA(),
Registers.getRegisterX(),
Registers.getRegisterY());
registerPotentials.setPotentialRegisters(equivalenceClass, potentials);
} else {
registerPotentials.setPotentialRegisters(equivalenceClass, Arrays.asList(defaultRegister));
}
}
}
VariableReferenceInfo referenceInfo = new VariableReferenceInfo(getProgram());
for (ControlFlowBlock block : getProgram().getGraph().getAllBlocks()) {
for (Statement statement : block.getStatements()) {
@ -69,6 +49,13 @@ public class Pass4RegisterUpliftPotentialRegisterAnalysis extends Pass2Base {
referencedClasses.add(liveRangeEquivalenceClassSet.getEquivalenceClass(var));
}
// If statement assigns to an ALU potential equivalence class then always clobbered is empty
for (LiveRangeEquivalenceClass assignedClass : assignedClasses) {
if(registerPotentials.getPotentialRegisters(assignedClass).contains(Registers.getRegisterALU())) {
continue;
}
}
// Generate all combinations of potential register allocations for the referenced equivalence classes
// one statement has so few references that all combinations wont explode
RegisterCombinationIterator combinationIterator = registerPotentials.getAllCombinations(referencedClasses);
@ -156,6 +143,15 @@ public class Pass4RegisterUpliftPotentialRegisterAnalysis extends Pass2Base {
msg.append(" allocation: ").append(combination.toString());
getLog().append(msg.toString());
continue;
} catch (AsmFragment.AluNotApplicableException e) {
if (getProgram().getLog().isVerboseUplift()) {
StringBuilder msg = new StringBuilder();
msg.append("Potential register analysis ");
msg.append("alu not applicable");
msg.append(" allocation: ").append(combination.toString());
getProgram().getLog().append(msg.toString());
}
continue;
}
AsmClobber clobber = asm.getClobber();
Collection<Registers.Register> clobberRegisters = Pass4AssertNoCpuClobber.getClobberRegisters(clobber);

View File

@ -60,6 +60,7 @@ public class Pass4RegisterUpliftStatic extends Pass2Base {
*/
// ALU combination plotter ORA in bitmap-bresenham.kc
/*
collapseEquivalenceClasses("line::plotter#0", "line::plotter#1");
//setRegister(combination, "line::plotter#1", new Registers.RegisterZpPointerByte(21));
setRegister(combination, "line::$11", Registers.getRegisterA());
@ -73,6 +74,8 @@ public class Pass4RegisterUpliftStatic extends Pass2Base {
setRegister(combination, "line::$7", Registers.getRegisterALU());
setRegister(combination, "initplottables::$6", Registers.getRegisterA());
setRegister(combination, "initplottables::$7", Registers.getRegisterALU());
*/
setRegister(combination, "initplottables::$6", Registers.getRegisterA());
boolean success = Pass4RegisterUpliftCombinations.generateCombinationAsm(
combination,

View File

@ -6326,6 +6326,9 @@ initscreen: {
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Equivalence Class zp ZP_BYTE:36 [ plot::$6 ] has ALU potential.
Equivalence Class zp ZP_BYTE:40 [ initplottables::$7 ] has ALU potential.
Statement [1] *((const byte*) BGCOL#0) ← (byte) 0 [ ] always clobbers reg byte a
Statement [2] *((const byte*) FGCOL#0) ← (byte) 0 [ ] always clobbers reg byte a
Statement [3] *((const byte*) D011#0) ← (const byte) BMM#0|(const byte) DEN#0|(const byte) RSEL#0|(byte) 3 [ ] always clobbers reg byte a
@ -6361,9 +6364,6 @@ Statement [45] *((const byte[]) plot_xhi#0 + (byte) initplottables::x#2) ← >(c
Statement [46] *((const byte[]) plot_bit#0 + (byte) initplottables::x#2) ← (byte) initplottables::bit#3 [ initplottables::x#2 initplottables::bit#3 ] always clobbers reg byte a
Statement [53] (byte~) initplottables::$6 ← (byte) initplottables::y#2 & (byte) 7 [ initplottables::y#2 initplottables::yoffs#2 initplottables::$6 ] always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ initplottables::y#2 initplottables::y#1 ]
Statement [54] (byte~) initplottables::$7 ← < (byte*) initplottables::yoffs#2 [ initplottables::y#2 initplottables::yoffs#2 initplottables::$6 initplottables::$7 ] always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:39 [ initplottables::$6 ]
Statement [55] (byte~) initplottables::$8 ← (byte~) initplottables::$6 | (byte~) initplottables::$7 [ initplottables::y#2 initplottables::yoffs#2 initplottables::$8 ] always clobbers reg byte a
Statement [57] (byte~) initplottables::$9 ← > (byte*) initplottables::yoffs#2 [ initplottables::y#2 initplottables::yoffs#2 initplottables::$9 ] always clobbers reg byte a
Statement [59] (byte~) initplottables::$10 ← (byte) initplottables::y#2 & (byte) 7 [ initplottables::y#2 initplottables::yoffs#2 initplottables::$10 ] always clobbers reg byte a
Statement [61] (byte*) initplottables::yoffs#1 ← (byte*) initplottables::yoffs#2 + (word) 320 [ initplottables::y#2 initplottables::yoffs#1 ] always clobbers reg byte a
@ -6389,8 +6389,6 @@ Statement [43] (byte~) initplottables::$0 ← (byte) initplottables::x#2 & (byte
Statement [45] *((const byte[]) plot_xhi#0 + (byte) initplottables::x#2) ← >(const byte*) BITMAP#0 [ initplottables::x#2 initplottables::bit#3 ] always clobbers reg byte a
Statement [46] *((const byte[]) plot_bit#0 + (byte) initplottables::x#2) ← (byte) initplottables::bit#3 [ initplottables::x#2 initplottables::bit#3 ] always clobbers reg byte a
Statement [53] (byte~) initplottables::$6 ← (byte) initplottables::y#2 & (byte) 7 [ initplottables::y#2 initplottables::yoffs#2 initplottables::$6 ] always clobbers reg byte a
Statement [54] (byte~) initplottables::$7 ← < (byte*) initplottables::yoffs#2 [ initplottables::y#2 initplottables::yoffs#2 initplottables::$6 initplottables::$7 ] always clobbers reg byte a
Statement [55] (byte~) initplottables::$8 ← (byte~) initplottables::$6 | (byte~) initplottables::$7 [ initplottables::y#2 initplottables::yoffs#2 initplottables::$8 ] always clobbers reg byte a
Statement [57] (byte~) initplottables::$9 ← > (byte*) initplottables::yoffs#2 [ initplottables::y#2 initplottables::yoffs#2 initplottables::$9 ] always clobbers reg byte a
Statement [59] (byte~) initplottables::$10 ← (byte) initplottables::y#2 & (byte) 7 [ initplottables::y#2 initplottables::yoffs#2 initplottables::$10 ] always clobbers reg byte a
Statement [61] (byte*) initplottables::yoffs#1 ← (byte*) initplottables::yoffs#2 + (word) 320 [ initplottables::y#2 initplottables::yoffs#1 ] always clobbers reg byte a
@ -6398,9 +6396,6 @@ Statement [68] *((byte*) initscreen::b#2) ← (byte) 0 [ initscreen::b#2 ] alway
Statement [70] if((byte*) initscreen::b#1!=(const byte*) BITMAP#0+(word) 8192) goto initscreen::@1 [ initscreen::b#1 ] always clobbers reg byte a
Statement [72] *((byte*) initscreen::c#2) ← (byte) 20 [ initscreen::c#2 ] always clobbers reg byte a reg byte y
Statement [74] if((byte*) initscreen::c#1!=(const byte*) SCREEN#0+(word) 1024) goto initscreen::@2 [ initscreen::c#1 ] always clobbers reg byte a
Equivalence Class zp ZP_BYTE:36 [ plot::$6 ] has ALU potential.
Equivalence Class zp ZP_BYTE:40 [ initplottables::$7 ] has ALU potential.
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ line::x1#2 ] : zp ZP_BYTE:2 , reg byte x ,
Potential registers zp ZP_BYTE:3 [ line::y1#2 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ line::x#2 line::x#0 line::x#1 ] : zp ZP_BYTE:4 , reg byte x ,
@ -6430,7 +6425,7 @@ Potential registers zp ZP_BYTE:35 [ plot::$5 ] : zp ZP_BYTE:35 , reg byte a , re
Potential registers zp ZP_BYTE:36 [ plot::$6 ] : zp ZP_BYTE:36 , reg byte a , reg byte x , reg byte y , reg byte alu ,
Potential registers zp ZP_BYTE:37 [ plot::$7 ] : zp ZP_BYTE:37 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:38 [ initplottables::$0 ] : zp ZP_BYTE:38 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:39 [ initplottables::$6 ] : zp ZP_BYTE:39 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:39 [ initplottables::$6 ] : zp ZP_BYTE:39 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:40 [ initplottables::$7 ] : zp ZP_BYTE:40 , reg byte a , reg byte x , reg byte y , reg byte alu ,
Potential registers zp ZP_BYTE:41 [ initplottables::$8 ] : zp ZP_BYTE:41 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:42 [ initplottables::$9 ] : zp ZP_BYTE:42 , reg byte a , reg byte x , reg byte y ,
@ -6444,9 +6439,9 @@ Uplift Scope [plot] 4: zp ZP_BYTE:21 [ plot::$0 ] 4: zp ZP_BYTE:24 [ plot::$1 ]
Uplift Scope [main]
Uplift Scope []
Uplift attempts [initplottables] 10000/103680 (limiting to 10000)
Uplift attempts [initplottables] 10000/138240 (limiting to 10000)
Uplifting [initplottables] best 3868 combination reg byte y [ initplottables::bit#3 initplottables::bit#4 initplottables::bit#1 ] zp ZP_PTR_BYTE:10 [ initplottables::yoffs#2 initplottables::yoffs#4 initplottables::yoffs#1 ] reg byte x [ initplottables::x#2 initplottables::x#1 ] reg byte x [ initplottables::y#2 initplottables::y#1 ] reg byte a [ initplottables::$0 ] reg byte a [ initplottables::$7 ] reg byte a [ initplottables::$8 ] reg byte a [ initplottables::$9 ] zp ZP_BYTE:43 [ initplottables::$10 ] zp ZP_BYTE:39 [ initplottables::$6 ]
Limited combination testing to 10000 combinations of 103680 possible.
Limited combination testing to 10000 combinations of 138240 possible.
Uplifting [line] best 3801 combination zp ZP_BYTE:6 [ line::e#3 line::e#0 line::e#6 line::e#2 line::e#1 ] zp ZP_BYTE:5 [ line::y#2 line::y#0 line::y#4 line::y#1 ] reg byte a [ line::$10 ] zp ZP_BYTE:4 [ line::x#2 line::x#0 line::x#1 ] zp ZP_BYTE:16 [ line::xd#0 ] zp ZP_BYTE:17 [ line::yd#0 ] reg byte x [ line::y1#2 ] zp ZP_BYTE:2 [ line::x1#2 ]
Uplifting [initscreen] best 3801 combination zp ZP_PTR_BYTE:12 [ initscreen::b#2 initscreen::b#1 ] zp ZP_PTR_BYTE:14 [ initscreen::c#2 initscreen::c#1 ]
Uplift attempts [plot] 10000/122880 (limiting to 10000)

View File

@ -1533,6 +1533,7 @@ main: {
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [3] *((byte*) main::cursor#3) ← (const byte) STAR#0 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] always clobbers reg byte a reg byte y
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ main::x#2 main::x#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:4 [ main::x#2 main::x#1 ]
@ -1547,7 +1548,6 @@ Statement [3] *((byte*) main::cursor#3) ← (const byte) STAR#0 [ main::cursor#3
Statement [6] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] always clobbers reg byte a
Statement [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] always clobbers reg byte a
Statement [10] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] always clobbers reg byte a
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_PTR_BYTE:2 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ] : zp ZP_PTR_BYTE:2 ,
Potential registers zp ZP_BYTE:4 [ main::x#2 main::x#1 ] : zp ZP_BYTE:4 , reg byte x ,
Potential registers zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ] : zp ZP_BYTE:5 , reg byte x ,

View File

@ -1270,6 +1270,7 @@ b2:
//SEG28 @end
bend:
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] *((const byte[1000]) screen#0 + (word) idx#3) ← (const byte) STAR#0 [ idx#3 x#2 e#3 y#2 ] always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ x#2 x#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ e#3 e#5 e#1 e#2 ]
@ -1281,7 +1282,6 @@ Statement [1] *((const byte[1000]) screen#0 + (word) idx#3) ← (const byte) STA
Statement [4] (byte) e#1 ← (byte) e#3 + (const byte) yd#0 [ y#2 x#1 idx#1 e#1 ] always clobbers reg byte a
Statement [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] always clobbers reg byte a
Statement [8] (byte) e#2 ← (byte) e#1 - (const byte) xd#0 [ x#1 y#1 idx#2 e#2 ] always clobbers reg byte a
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_WORD:2 [ idx#3 idx#5 idx#1 idx#2 ] : zp ZP_WORD:2 ,
Potential registers zp ZP_BYTE:4 [ x#2 x#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 [ e#3 e#5 e#1 e#2 ] : zp ZP_BYTE:5 , reg byte x , reg byte y ,

View File

@ -891,11 +891,11 @@ line: {
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [7] *((byte*) screen#11) ← (byte) line::x#2 [ line::x1#2 line::x#2 screen#11 ] always clobbers reg byte y
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ line::x1#2 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:3 [ line::x#2 line::x#0 line::x#1 ]
Statement [7] *((byte*) screen#11) ← (byte) line::x#2 [ line::x1#2 line::x#2 screen#11 ] always clobbers reg byte y
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ line::x1#2 ] : zp ZP_BYTE:2 , reg byte a , reg byte x ,
Potential registers zp ZP_BYTE:3 [ line::x#2 line::x#0 line::x#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x ,
Potential registers zp ZP_PTR_BYTE:4 [ screen#11 screen#14 screen#1 ] : zp ZP_PTR_BYTE:4 ,

View File

@ -691,6 +691,7 @@ main: {
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] *((const byte*) SCREEN#0) ← (const byte) STAR#0 [ ] always clobbers reg byte a
Statement [2] *((const byte*) BGCOL#0) ← (const byte) RED#0 [ ] always clobbers reg byte a
Statement [4] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (const byte) STAR#0+(byte) 1 [ main::i#2 ] always clobbers reg byte a
@ -698,7 +699,6 @@ Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ ma
Statement [1] *((const byte*) SCREEN#0) ← (const byte) STAR#0 [ ] always clobbers reg byte a
Statement [2] *((const byte*) BGCOL#0) ← (const byte) RED#0 [ ] always clobbers reg byte a
Statement [4] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (const byte) STAR#0+(byte) 1 [ main::i#2 ] always clobbers reg byte a
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES

View File

@ -692,12 +692,10 @@ main: {
rts
}
Statement [1] *((const byte[15]) fibs#0+(byte) 0) ← (byte) 0 [ ] always clobbers reg byte a
Statement [2] *((const byte[15]) fibs#0+(byte) 1) ← (byte) 1 [ ] always clobbers reg byte a
Statement [1] *((const byte[15]) fibs#0+(byte) 0) ← (byte) 0 [ ] always clobbers reg byte a
Statement [2] *((const byte[15]) fibs#0+(byte) 1) ← (byte) 1 [ ] always clobbers reg byte a
Equivalence Class zp ZP_BYTE:4 [ main::$3 ] has ALU potential.
REGISTER UPLIFT POTENTIAL REGISTERS
Equivalence Class zp ZP_BYTE:4 [ main::$3 ] has ALU potential.
Statement [1] *((const byte[15]) fibs#0+(byte) 0) ← (byte) 0 [ ] always clobbers reg byte a
Statement [2] *((const byte[15]) fibs#0+(byte) 1) ← (byte) 1 [ ] always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::$1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::$3 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y , reg byte alu ,

View File

@ -4585,6 +4585,7 @@ prepare: {
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ plot::y#2 plot::y#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ plot::i#2 plot::i#3 plot::i#1 ]
@ -4594,7 +4595,6 @@ Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ fl
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:11 [ flip::c#2 flip::c#1 ]
Statement [22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ] always clobbers reg byte a
Statement [32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ] always clobbers reg byte a
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::c#2 main::c#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_PTR_BYTE:3 [ plot::line#2 plot::line#1 ] : zp ZP_PTR_BYTE:3 ,
Potential registers zp ZP_BYTE:5 [ plot::y#2 plot::y#1 ] : zp ZP_BYTE:5 , reg byte x , reg byte y ,

View File

@ -3898,6 +3898,7 @@ main: {
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] *((const byte*) PROCPORT#0) ← (byte) 50 [ ] always clobbers reg byte a
Statement [3] (byte*) main::chargen1#0 ← (byte*) main::chargen#2 + (byte) 1 [ main::chargen#2 main::charset4#10 main::chargen1#0 ] always clobbers reg byte a
Statement [4] (byte~) main::$1 ← * (byte*) main::chargen#2 [ main::chargen#2 main::charset4#10 main::chargen1#0 main::$1 ] always clobbers reg byte a reg byte y
@ -3972,7 +3973,6 @@ Statement [53] (byte*) main::chargen#1 ← (byte*) main::chargen#2 + (byte) 2 [
Statement [54] if((byte*) main::chargen#1<(const byte*) CHARGEN#0+(word) 2048) goto main::@1 [ main::chargen#1 main::charset4#1 ] always clobbers reg byte a
Statement [55] *((const byte*) PROCPORT#0) ← (byte) 55 [ ] always clobbers reg byte a
Statement [60] *((const byte*) D018#0) ← (byte) 25 [ ] always clobbers reg byte a
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_PTR_BYTE:2 [ main::chargen#2 main::chargen#1 ] : zp ZP_PTR_BYTE:2 ,
Potential registers zp ZP_PTR_BYTE:4 [ main::charset4#10 main::charset4#1 ] : zp ZP_PTR_BYTE:4 ,
Potential registers zp ZP_BYTE:6 [ main::bits_gen#9 ] : zp ZP_BYTE:6 , reg byte a , reg byte x , reg byte y ,

View File

@ -956,13 +956,13 @@ main: {
jmp b2
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((byte*) main::cursor#2) ← (byte~) main::$0 [ main::i#3 main::cursor#2 ] always clobbers reg byte y
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ main::i#3 main::i#4 main::i#1 ]
Statement [9] if((byte*) main::cursor#1<(const byte*) SCREEN#0+(word) 1000) goto main::@1 [ main::i#4 main::cursor#1 ] always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#3 main::i#4 main::i#1 ]
Statement [4] *((byte*) main::cursor#2) ← (byte~) main::$0 [ main::i#3 main::cursor#2 ] always clobbers reg byte y
Statement [9] if((byte*) main::cursor#1<(const byte*) SCREEN#0+(word) 1000) goto main::@1 [ main::i#4 main::cursor#1 ] always clobbers reg byte a
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::i#3 main::i#4 main::i#1 ] : zp ZP_BYTE:2 , reg byte x ,
Potential registers zp ZP_PTR_BYTE:3 [ main::cursor#2 main::cursor#1 ] : zp ZP_PTR_BYTE:3 ,
Potential registers zp ZP_BYTE:5 [ main::$0 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y ,

View File

@ -579,10 +579,10 @@ main: {
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2+(byte) 2 [ main::i#2 main::$1 ] always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Statement [3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2+(byte) 2 [ main::i#2 main::$1 ] always clobbers reg byte a
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::$1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,

View File

@ -853,11 +853,9 @@ main: {
rts
}
Statement [1] *((const byte*) SCREEN#0+(byte) 0) ← (const byte) char#0 [ ] always clobbers reg byte a
Statement [2] *((const byte*) SCREEN#0+(byte) 2) ← (const byte) num#0 [ ] always clobbers reg byte a
Statement [1] *((const byte*) SCREEN#0+(byte) 0) ← (const byte) char#0 [ ] always clobbers reg byte a
Statement [2] *((const byte*) SCREEN#0+(byte) 2) ← (const byte) num#0 [ ] always clobbers reg byte a
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] *((const byte*) SCREEN#0+(byte) 0) ← (const byte) char#0 [ ] always clobbers reg byte a
Statement [2] *((const byte*) SCREEN#0+(byte) 2) ← (const byte) num#0 [ ] always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::$1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::$3 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,

View File

@ -739,6 +739,7 @@ inc: {
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 inc::$0 ] always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ i#11 inc::$0 ]
Statement [10] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ] always clobbers reg byte a
@ -746,7 +747,6 @@ Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ ma
Statement [4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 inc::$0 ] always clobbers reg byte a
Statement [7] (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 [ ] always clobbers reg byte a
Statement [10] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ] always clobbers reg byte a
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ i#11 inc::$0 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::$0 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::a#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y ,

View File

@ -2319,6 +2319,7 @@ lvalue: {
jmp b1
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [11] *((byte*) lvaluevar::screen#2) ← (const byte) lvaluevar::b#0 [ lvaluevar::i#2 lvaluevar::screen#2 ] always clobbers reg byte a reg byte y
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ lvaluevar::i#2 lvaluevar::i#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ lvaluevar::i#2 lvaluevar::i#1 ]
@ -2334,7 +2335,6 @@ Statement [18] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluev
Statement [28] *((const byte[1024]) lvalue::SCREEN#0) ← (byte) 1 [ ] always clobbers reg byte a
Statement [29] *((const byte[1024]) lvalue::SCREEN#0+(byte) 1) ← (byte) 2 [ ] always clobbers reg byte a
Statement [33] *((const byte[1024]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ] always clobbers reg byte a
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ lvaluevar::i#2 lvaluevar::i#1 ] : zp ZP_BYTE:2 , reg byte x ,
Potential registers zp ZP_PTR_BYTE:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] : zp ZP_PTR_BYTE:3 ,
Potential registers zp ZP_BYTE:5 [ rvaluevar::i#2 rvaluevar::i#1 ] : zp ZP_BYTE:5 , reg byte x ,

View File

@ -1021,11 +1021,11 @@ main: {
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [3] (byte) main::c#0 ← * (byte*) main::nxt#3 [ main::nxt#3 main::i#3 main::c#0 ] always clobbers reg byte a reg byte y
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#3 main::i#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ main::i#3 main::i#1 ]
Statement [3] (byte) main::c#0 ← * (byte*) main::nxt#3 [ main::nxt#3 main::i#3 main::c#0 ] always clobbers reg byte a reg byte y
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::i#3 main::i#1 ] : zp ZP_BYTE:2 , reg byte x ,
Potential registers zp ZP_BYTE:3 [ main::c#2 main::c#0 main::c#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_PTR_BYTE:4 [ main::nxt#4 main::nxt#3 main::nxt#1 ] : zp ZP_PTR_BYTE:4 ,

View File

@ -3810,14 +3810,11 @@ fillscreen: {
rts
}
Statement [18] (byte) main::c#0 ← * (byte*) main::nxt#3 [ main::nxt#3 main::c#0 ] always clobbers reg byte a reg byte y
Statement [33] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0 [ fillscreen::cursor#2 ] always clobbers reg byte a reg byte y
Statement [35] if((byte*) fillscreen::cursor#1<(const byte*) SCREEN#0+(word) 1000) goto fillscreen::@1 [ fillscreen::cursor#1 ] always clobbers reg byte a
Statement [18] (byte) main::c#0 ← * (byte*) main::nxt#3 [ main::nxt#3 main::c#0 ] always clobbers reg byte a reg byte y
Statement [33] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0 [ fillscreen::cursor#2 ] always clobbers reg byte a reg byte y
Statement [35] if((byte*) fillscreen::cursor#1<(const byte*) SCREEN#0+(word) 1000) goto fillscreen::@1 [ fillscreen::cursor#1 ] always clobbers reg byte a
Equivalence Class zp ZP_BYTE:11 [ main::$6 ] has ALU potential.
REGISTER UPLIFT POTENTIAL REGISTERS
Equivalence Class zp ZP_BYTE:11 [ main::$6 ] has ALU potential.
Statement [18] (byte) main::c#0 ← * (byte*) main::nxt#3 [ main::nxt#3 main::c#0 ] always clobbers reg byte a reg byte y
Statement [33] *((byte*) fillscreen::cursor#2) ← (const byte) fillscreen::fill#0 [ fillscreen::cursor#2 ] always clobbers reg byte a reg byte y
Statement [35] if((byte*) fillscreen::cursor#1<(const byte*) SCREEN#0+(word) 1000) goto fillscreen::@1 [ fillscreen::cursor#1 ] always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::scroll#3 main::scroll#10 main::scroll#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::i#2 main::i#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::c#2 main::c#0 main::c#1 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,

View File

@ -248,9 +248,8 @@ main: {
rts
}
Statement [1] *((const byte*) SCREEN#0) ← (byte) 1 [ ] always clobbers reg byte a
Statement [1] *((const byte*) SCREEN#0) ← (byte) 1 [ ] always clobbers reg byte a
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] *((const byte*) SCREEN#0) ← (byte) 1 [ ] always clobbers reg byte a
REGISTER UPLIFT SCOPES
Uplift Scope [main]

View File

@ -7767,6 +7767,11 @@ initscreen: {
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Equivalence Class zp ZP_BYTE:13 [ animate::$0 ] has ALU potential.
Equivalence Class zp ZP_BYTE:16 [ animate::$5 ] has ALU potential.
Equivalence Class zp ZP_BYTE:22 [ animate::$15 ] has ALU potential.
Equivalence Class zp ZP_BYTE:28 [ animate::$25 ] has ALU potential.
Statement [12] *((const byte[]) XPOS#0+(byte) 0) ← (byte) 0 [ ] always clobbers reg byte a
Statement [18] *((const byte[]) YPOS#0+(byte) 0) ← (byte) 0 [ ] always clobbers reg byte a
Statement [24] *((const byte[]) XPOS#0+(byte) 1) ← (byte) 40 [ ] always clobbers reg byte a
@ -7808,11 +7813,6 @@ Statement [83] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findc
Statement [84] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#0 ] always clobbers reg byte a
Statement [87] *((byte*) initscreen::screen#2) ← (const byte) FILL#0 [ initscreen::screen#2 ] always clobbers reg byte a reg byte y
Statement [89] if((byte*) initscreen::screen#1<(const byte*) SCREEN#0+(word) 1000) goto initscreen::@1 [ initscreen::screen#1 ] always clobbers reg byte a
Equivalence Class zp ZP_BYTE:13 [ animate::$0 ] has ALU potential.
Equivalence Class zp ZP_BYTE:16 [ animate::$5 ] has ALU potential.
Equivalence Class zp ZP_BYTE:22 [ animate::$15 ] has ALU potential.
Equivalence Class zp ZP_BYTE:28 [ animate::$25 ] has ALU potential.
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ render::y#2 render::y#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_PTR_BYTE:3 [ render::colline#2 render::colline#1 ] : zp ZP_PTR_BYTE:3 ,
Potential registers zp ZP_BYTE:5 [ render::x#2 render::x#1 ] : zp ZP_BYTE:5 , reg byte x , reg byte y ,

View File

@ -1470,6 +1470,7 @@ sum: {
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::$0 ]
@ -1477,7 +1478,6 @@ Statement [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ main::$3 ]
Statement [4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ] always clobbers reg byte a
Statement [12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ] always clobbers reg byte a
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::$0 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::$1 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,