1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-19 00:29:29 +00:00

Fixed clobber issues caused by statement idx of phi statementsin ASM changed to the call-statement instead of the phi.

This commit is contained in:
Jesper Gravgaard 2017-08-22 14:57:04 +02:00
parent 64c690f925
commit f72585e3c0
23 changed files with 526 additions and 388 deletions

View File

@ -3,7 +3,9 @@ package dk.camelot64.kickc;
/** Log of actions & results during compile*/
public class CompileLog {
StringBuilder log;
private StringBuilder log;
private boolean verboseUplift;
public CompileLog() {
this.log = new StringBuilder();
@ -19,6 +21,14 @@ public class CompileLog {
return log;
}
public boolean isVerboseUplift() {
return verboseUplift;
}
public void setVerboseUplift(boolean verboseUplift) {
this.verboseUplift = verboseUplift;
}
@Override
public String toString() {
return log.toString();

View File

@ -14,7 +14,6 @@ import java.util.List;
*/
public class Compiler {
public Program compile(final CharStream input) {
CompileLog log = new CompileLog();
try {
@ -235,6 +234,9 @@ public class Compiler {
// Attempt uplifting registers through a lot of combinations
new Pass4RegisterUpliftCombinations(program).performUplift(10_000);
//program.getLog().setVerboseUplift(true);
//new Pass4RegisterUpliftStatic(program).performUplift();
// Attempt uplifting registers one at a time to catch remaining potential not realized by combination search
new Pass4RegisterUpliftRemains(program).performUplift();

View File

@ -48,8 +48,8 @@ public class AsmFragment {
setSignature(assignmentSignature(assignment.getlValue(), assignment.getrValue1(), assignment.getOperator(), assignment.getrValue2()));
}
public AsmFragment(LValue lValue, RValue rValue, Program program, Statement statement) {
this.scope = program.getGraph().getBlockFromStatementIdx(statement.getIndex()).getScope();
public AsmFragment(LValue lValue, RValue rValue, Program program, ScopeRef scope) {
this.scope = scope;
this.bindings = new LinkedHashMap<>();
this.program = program;
setSignature(assignmentSignature(lValue, null, null, rValue));
@ -226,9 +226,6 @@ public class AsmFragment {
* @return The bound name of the value. If the value has already been bound the existing bound name is returned.
*/
public String bind(Value value) {
if (value instanceof VariableRef) {
value = program.getScope().getVariable((VariableRef) value);
}
if (value instanceof PointerDereferenceSimple) {
PointerDereferenceSimple deref = (PointerDereferenceSimple) value;
return "_star_" + bind(deref.getPointer());
@ -237,9 +234,11 @@ public class AsmFragment {
return bind(deref.getPointer()) + "_staridx_" + bind(deref.getIndex());
}
if (value instanceof VariableRef) {
value = program.getScope().getVariable((VariableRef) value);
}
if (value instanceof Variable) {
Registers.Register register = ((Variable) value).getAllocation();
// Find value if it is already bound
for (String name : bindings.keySet()) {
Value bound = bindings.get(name);
@ -308,12 +307,11 @@ public class AsmFragment {
* @param name The name of the bound value in the fragment
* @return The bound value to use in the generated ASM code
*/
public String getBoundValue(String name) {
public AsmParameter getBoundValue(String name) {
Value boundValue = getBinding(name);
if (boundValue == null) {
throw new RuntimeException("Binding '" + name + "' not found in fragment " + signature + ".asm");
}
String bound;
if (boundValue instanceof Variable) {
Variable boundVar = (Variable) boundValue;
Registers.Register register = boundVar.getAllocation();
@ -321,9 +319,13 @@ public class AsmFragment {
Scope varScope = boundVar.getScope();
String asmName = boundVar.getAsmName() == null ? boundVar.getLocalName() : boundVar.getAsmName();
if (!varScope.getRef().equals(scope) && varScope.getRef().getFullName().length() > 0) {
bound = varScope.getFullName() + "." + asmName.replace('@', 'b').replace(':', '_').replace("#", "_");
String param = varScope.getFullName() + "." + asmName.replace('@', 'b').replace(':', '_').replace("#", "_");
//param = ""+((Registers.RegisterZp) register).getZp();
return new AsmParameter(param, true);
} else {
bound = asmName.replace('@', 'b').replace(':', '_').replace("#", "_");
String param = asmName.replace('@', 'b').replace(':', '_').replace("#", "_");
//param = ""+((Registers.RegisterZp) register).getZp();
return new AsmParameter(param, true);
}
} else {
throw new RuntimeException("Register Type not implemented " + register);
@ -335,7 +337,8 @@ public class AsmFragment {
Constant pointerConst = (Constant) pointer;
if (pointerConst instanceof ConstantInteger) {
ConstantInteger intPointer = (ConstantInteger) pointerConst;
bound = String.format("$%x", intPointer.getNumber());
String param = String.format("$%x", intPointer.getNumber());
return new AsmParameter(param, SymbolTypeBasic.BYTE.equals(intPointer.getType()));
} else {
throw new RuntimeException("Bound Value Type not implemented " + boundValue);
}
@ -345,19 +348,43 @@ public class AsmFragment {
} else if (boundValue instanceof ConstantInteger) {
ConstantInteger boundInt = (ConstantInteger) boundValue;
if (boundInt.getType().equals(SymbolTypeBasic.BYTE)) {
bound = String.format("$%x", boundInt.getNumber());
String param = String.format("$%x", boundInt.getNumber());
return new AsmParameter(param, SymbolTypeBasic.BYTE.equals(boundInt.getType()));
} else {
bound = String.format("$%x", boundInt.getNumber());
String param = String.format("$%x", boundInt.getNumber());
return new AsmParameter(param, SymbolTypeBasic.BYTE.equals(boundInt.getType()));
}
} else if (boundValue instanceof Label) {
bound = ((Label) boundValue).getLocalName().replace('@', 'b').replace(':', '_');
String param = ((Label) boundValue).getLocalName().replace('@', 'b').replace(':', '_');
return new AsmParameter(param, false);
} else {
throw new RuntimeException("Bound Value Type not implemented " + boundValue);
}
return bound;
}
/** A parameter of an ASM instruction from a bound value. */
public static class AsmParameter {
private String param;
private boolean zp;
public AsmParameter(String param, boolean zp) {
this.param = param;
this.zp = zp;
}
public String getParam() {
return param;
}
public boolean isZp() {
return zp;
}
}
/**
* Generate assembler code for the assembler fragment.
*
@ -408,7 +435,7 @@ public class AsmFragment {
Asm6502Parser.ParamModeContext paramModeCtx = ctx.paramMode();
AsmInstruction instruction;
if (paramModeCtx == null) {
AsmInstructionType type = AsmInstructionSet.getInstructionType(ctx.MNEMONIC().getText(), AsmAddressingMode.NON, null);
AsmInstructionType type = AsmInstructionSet.getInstructionType(ctx.MNEMONIC().getText(), AsmAddressingMode.NON, null, false);
instruction = new AsmInstruction(type, null);
} else {
instruction = (AsmInstruction) this.visit(paramModeCtx);
@ -459,40 +486,47 @@ public class AsmFragment {
private AsmInstruction createAsmInstruction(Asm6502Parser.ParamModeContext ctx, Asm6502Parser.ExprContext exprCtx, AsmAddressingMode addressingMode) {
Asm6502Parser.InstructionContext instructionCtx = (Asm6502Parser.InstructionContext) ctx.getParent();
String mnemonic = instructionCtx.MNEMONIC().getSymbol().getText();
String parameter = (String) this.visit(exprCtx);
AsmInstructionType type = AsmInstructionSet.getInstructionType(mnemonic, addressingMode, parameter);
AsmParameter parameter = (AsmParameter) this.visit(exprCtx);
AsmInstructionType type = AsmInstructionSet.getInstructionType(mnemonic, addressingMode, parameter.getParam(), parameter.isZp());
if (type == null) {
throw new RuntimeException("Error in " + signature + ".asm line " + ctx.getStart().getLine() + " - Instruction type unknown " + mnemonic + " " + addressingMode + " " + parameter);
}
return new AsmInstruction(type, parameter);
return new AsmInstruction(type, parameter.getParam());
}
@Override
public Object visitExprBinary(Asm6502Parser.ExprBinaryContext ctx) {
Object left = this.visit(ctx.expr(0));
Object right = this.visit(ctx.expr(1));
return "" + left + ctx.getChild(1).getText() + right;
public AsmParameter visitExprBinary(Asm6502Parser.ExprBinaryContext ctx) {
AsmParameter left = (AsmParameter) this.visit(ctx.expr(0));
AsmParameter right = (AsmParameter) this.visit(ctx.expr(1));
String param = "" + left.getParam() + ctx.getChild(1).getText() + right.getParam();
boolean zp = left.isZp() && right.isZp();
return new AsmParameter(param, zp);
}
@Override
public Object visitExprUnary(Asm6502Parser.ExprUnaryContext ctx) {
Object sub = this.visit(ctx.expr());
return ctx.getChild(0).getText() + sub;
public AsmParameter visitExprUnary(Asm6502Parser.ExprUnaryContext ctx) {
AsmParameter sub = (AsmParameter) this.visit(ctx.expr());
String param = ctx.getChild(0).getText() + sub.getParam();
return new AsmParameter(param, sub.isZp());
}
@Override
public Object visitExprInt(Asm6502Parser.ExprIntContext ctx) {
public AsmParameter visitExprInt(Asm6502Parser.ExprIntContext ctx) {
Number number = NumberParser.parseLiteral(ctx.NUMINT().getText());
return String.format("$%x", number);
ConstantInteger intVal = new ConstantInteger(number.intValue());
boolean isZp = SymbolTypeBasic.BYTE.equals(intVal.getType());
String param = String.format("$%x", number);
return new AsmParameter(param, isZp);
}
@Override
public Object visitExprLabel(Asm6502Parser.ExprLabelContext ctx) {
return ctx.NAME().getSymbol().getText();
public AsmParameter visitExprLabel(Asm6502Parser.ExprLabelContext ctx) {
String param = ctx.NAME().getSymbol().getText();
return new AsmParameter(param, false);
}
@Override
public Object visitExprReplace(Asm6502Parser.ExprReplaceContext ctx) {
public AsmParameter visitExprReplace(Asm6502Parser.ExprReplaceContext ctx) {
String replaceName = ctx.NAME().getSymbol().getText();
return bindings.getBoundValue(replaceName);
}

View File

@ -11,15 +11,15 @@ public class AsmInstructionSet {
private static AsmInstructionSet set = new AsmInstructionSet();
public static AsmInstructionType getInstructionType(String mnemonic, AsmAddressingMode mode, String parameter) {
public static AsmInstructionType getInstructionType(String mnemonic, AsmAddressingMode mode, String parameter, boolean isZp) {
AsmInstructionType type = null;
if (AsmAddressingMode.ABS.equals(mode) && isZp(parameter)) {
if (AsmAddressingMode.ABS.equals(mode) && isZp) {
type = set.getType(mnemonic, AsmAddressingMode.ZP);
}
if (AsmAddressingMode.ABX.equals(mode) && isZp(parameter)) {
if (AsmAddressingMode.ABX.equals(mode) && isZp) {
type = set.getType(mnemonic, AsmAddressingMode.ZPX);
}
if (AsmAddressingMode.ABY.equals(mode) && isZp(parameter)) {
if (AsmAddressingMode.ABY.equals(mode) && isZp) {
type = set.getType(mnemonic, AsmAddressingMode.ZPY);
}
if (type == null) {

View File

@ -67,8 +67,8 @@ public class AsmProgram {
addLine(new AsmScopeEnd());
}
public void addInstruction(String mnemonic, AsmAddressingMode addressingMode, String parameter) {
AsmInstructionType instructionType = AsmInstructionSet.getInstructionType(mnemonic, addressingMode, parameter);
public void addInstruction(String mnemonic, AsmAddressingMode addressingMode, String parameter, boolean zp) {
AsmInstructionType instructionType = AsmInstructionSet.getInstructionType(mnemonic, addressingMode, parameter, zp);
addLine(new AsmInstruction(instructionType, parameter));
}

View File

@ -9,13 +9,11 @@ public class RegisterCombination {
/** The registers allocated to each equivalence class. */
private Map<LiveRangeEquivalenceClass, Registers.Register> allocation;
public RegisterCombination() {
this.allocation = new LinkedHashMap<>();
}
void setRegister(LiveRangeEquivalenceClass equivalenceClass, Registers.Register register) {
public void setRegister(LiveRangeEquivalenceClass equivalenceClass, Registers.Register register) {
allocation.put(equivalenceClass, register);
}

View File

@ -57,7 +57,6 @@ public class Pass4AssertNoCpuClobber extends Pass2Base {
if (register1.equals(register2)) {
if (verbose) {
getLog().append("Two assigned variables " + assignedVar1 + " and " + assignedVar2 + " clobbered by use of same register " + register1 + " in statement " + statement);
getLog().append(asm.toString(false));
}
clobberProblem = true;
}
@ -82,13 +81,15 @@ public class Pass4AssertNoCpuClobber extends Pass2Base {
if (clobberRegisters.contains(aliveVarRegister)) {
if (verbose) {
getLog().append("Error! Alive variable " + aliveVar + " register " + aliveVarRegister + " clobbered by the ASM generated by statement " + statement);
getLog().append(asm.toString(false));
}
clobberProblem = true;
}
}
}
}
if(verbose && clobberProblem) {
getLog().append(asm.toString(true));
}
return clobberProblem;
}

View File

@ -56,9 +56,9 @@ public class Pass4CodeGeneration {
ControlFlowBlock defaultSuccessor = getGraph().getDefaultSuccessor(block);
if (defaultSuccessor != null) {
if (defaultSuccessor.hasPhiBlock()) {
genBlockPhiTransition(asm, block, defaultSuccessor, defaultSuccessor.getPhiBlock());
genBlockPhiTransition(asm, block, defaultSuccessor, defaultSuccessor.getScope());
}
asm.addInstruction("JMP", AsmAddressingMode.ABS, defaultSuccessor.getLabel().getLocalName().replace('@', 'b').replace(':', '_'));
asm.addInstruction("JMP", AsmAddressingMode.ABS, defaultSuccessor.getLabel().getLocalName().replace('@', 'b').replace(':', '_'), false);
}
}
if (!ScopeRef.ROOT.equals(currentScope)) {
@ -159,12 +159,12 @@ public class Pass4CodeGeneration {
if (genCallPhiEntry) {
ControlFlowBlock callSuccessor = getGraph().getCallSuccessor(block);
if (callSuccessor != null && callSuccessor.hasPhiBlock()) {
genBlockPhiTransition(asm, block, callSuccessor, call);
genBlockPhiTransition(asm, block, callSuccessor, block.getScope());
}
}
asm.addInstruction("jsr", AsmAddressingMode.ABS, call.getProcedure().getFullName());
asm.addInstruction("jsr", AsmAddressingMode.ABS, call.getProcedure().getFullName(), false);
} else if (statement instanceof StatementReturn) {
asm.addInstruction("rts", AsmAddressingMode.NON, null);
asm.addInstruction("rts", AsmAddressingMode.NON, null, false);
} else {
throw new RuntimeException("Statement not supported " + statement);
}
@ -208,14 +208,14 @@ public class Pass4CodeGeneration {
});
for (ControlFlowBlock predecessor : predecessors) {
if (block.getLabel().equals(predecessor.getConditionalSuccessor())) {
genBlockPhiTransition(asm, predecessor, block, block.getPhiBlock());
asm.addInstruction("JMP", AsmAddressingMode.ABS, block.getLabel().getLocalName().replace('@', 'b').replace(':', '_'));
genBlockPhiTransition(asm, predecessor, block, block.getScope());
asm.addInstruction("JMP", AsmAddressingMode.ABS, block.getLabel().getLocalName().replace('@', 'b').replace(':', '_'), false);
}
}
}
}
private void genBlockPhiTransition(AsmProgram asm, ControlFlowBlock fromBlock, ControlFlowBlock toBlock, Statement scopeStatement) {
private void genBlockPhiTransition(AsmProgram asm, ControlFlowBlock fromBlock, ControlFlowBlock toBlock, ScopeRef scope) {
Statement toFirstStatement = toBlock.getStatements().get(0);
asm.startSegment(toFirstStatement.getIndex(), "[" + toFirstStatement.getIndex() + "]" + " phi from " + fromBlock.getLabel().getFullName() + " to " + toBlock.getLabel().getFullName());
asm.addLabel((toBlock.getLabel().getLocalName() + "_from_" + fromBlock.getLabel().getLocalName()).replace('@', 'b').replace(':', '_'));
@ -233,7 +233,7 @@ public class Pass4CodeGeneration {
});
for (StatementPhiBlock.PhiRValue phiRValue : phiRValues) {
if (phiRValue.getPredecessor().equals(fromBlock.getLabel())) {
genAsmMove(asm, phiVariable.getVariable(), phiRValue.getrValue(), scopeStatement);
genAsmMove(asm, phiVariable.getVariable(), phiRValue.getrValue(), phiBlock, scope);
break;
}
}
@ -250,12 +250,12 @@ public class Pass4CodeGeneration {
}
}
private void genAsmMove(AsmProgram asm, LValue lValue, RValue rValue, Statement statement) {
private void genAsmMove(AsmProgram asm, LValue lValue, RValue rValue, Statement statement, ScopeRef scope) {
asm.startSegment(statement.getIndex(), "[" + statement.getIndex() + "] phi " + lValue.toString(program) + " = " + rValue.toString(program));
if (isRegisterCopy(lValue, rValue)) {
asm.getCurrentSegment().setFragment("register_copy");
} else {
AsmFragment asmFragment = new AsmFragment(lValue, rValue, program, statement);
AsmFragment asmFragment = new AsmFragment(lValue, rValue, program, scope);
asm.getCurrentSegment().setFragment(asmFragment.getSignature());
asmFragment.generate(asm);
}

View File

@ -26,61 +26,36 @@ public class Pass4RegisterUpliftCombinations extends Pass2Base {
RegisterCombinationIterator combinationIterator = upliftScope.getCombinationIterator(getProgram().getRegisterPotentials());
int countCombinations = 0;
while (combinationIterator.hasNext() && countCombinations<maxCombinations) {
while (combinationIterator.hasNext() && countCombinations < maxCombinations) {
countCombinations++;
if(countCombinations%10000==0) {
getLog().append("Uplift attempts ["+upliftScope.getScopeRef()+"] "+countCombinations+"/"+combinationIterator.getNumIterations()+" (limiting to "+maxCombinations+")");
if (countCombinations % 10000 == 0) {
getLog().append("Uplift attempts [" + upliftScope.getScopeRef() + "] " + countCombinations + "/" + combinationIterator.getNumIterations() + " (limiting to " + maxCombinations + ")");
}
RegisterCombination combination = combinationIterator.next();
// Reset register allocation to original zero page allocation
new Pass4RegistersFinalize(getProgram()).allocate(false);
// Apply the uplift combination
combination.allocate(getProgram().getScope());
// Generate ASM
try {
new Pass4CodeGeneration(getProgram()).generate();
} catch (AsmFragment.UnknownFragmentException e) {
unknownFragments.add(e.getFragmentSignature());
//StringBuilder msg = new StringBuilder();
//msg.append("Uplift attempt [" + upliftScope.getScopeRef() + "] ");
//msg.append("missing fragment " + e.getFragmentSignature());
//msg.append(" allocation: ").append(combination.toString());
//getLog().append(msg.toString());
continue;
} catch (AsmFragment.AluNotApplicableException e) {
//StringBuilder msg = new StringBuilder();
//msg.append("Uplift attempt [" + upliftScope.getScopeRef() + "] ");
//msg.append("alu not applicable");
//msg.append(" allocation: ").append(combination.toString());
//getLog().append(msg.toString());
if (!generateAsm(combination, getProgram(), unknownFragments, upliftScope)) {
continue;
}
// If no clobber - Find value of the resulting allocation
boolean hasClobberProblem = new Pass4AssertNoCpuClobber(getProgram()).hasClobberProblem(false);
int combinationScore = getAsmScore(getProgram());
StringBuilder msg = new StringBuilder();
//msg.append("Uplift attempt [" + upliftScope.getScopeRef() + "] ");
//if (hasClobberProblem) {
// msg.append("clobber");
//} else {
// msg.append(combinationScore);
//}
//msg.append(" allocation: ").append(combination.toString());
//getLog().append(msg.toString());
if (!hasClobberProblem) {
if (combinationScore < bestScore) {
bestScore = combinationScore;
bestCombination = combination;
}
if (getLog().isVerboseUplift()) {
StringBuilder msg = new StringBuilder();
msg.append("Uplift attempt [" + upliftScope.getScopeRef() + "] ");
msg.append(combinationScore);
msg.append(" allocation: ").append(combination.toString());
getLog().append(msg.toString());
}
if (combinationScore < bestScore) {
bestScore = combinationScore;
bestCombination = combination;
}
}
if(bestCombination!=null) {
if (bestCombination != null) {
// Save the best combination in the equivalence class
bestCombination.store(getProgram().getLiveRangeEquivalenceClassSet());
getLog().append("Uplifting [" + upliftScope.getScopeRef() + "] best " + bestScore + " combination " + bestCombination.toString());
}
if(combinationIterator.hasNext()) {
getLog().append("Limited combination testing to "+countCombinations+" combinations of "+combinationIterator.getNumIterations()+" possible.");
if (combinationIterator.hasNext()) {
getLog().append("Limited combination testing to " + countCombinations + " combinations of " + combinationIterator.getNumIterations() + " possible.");
}
}
@ -94,6 +69,65 @@ public class Pass4RegisterUpliftCombinations extends Pass2Base {
}
/**
* Attempt generate ASM with a specific register combination.
* The generation may result in failure if
* <ul>
* <li>some ASM fragments are missing </li>
* <li>the ALU register is used in a non-applicable way</li>
* <li>The register combination results in clobbering registers containing values that are still alive</li>
* </ul>
*
* @param combination The register allocation combination
* @param unknownFragments Will receive any AsmFragments that can not be found during the ASM code generation
* @param scope The scope where the combination is tested. (Only used for logging)
* @return true if the generation was successful
*/
public static boolean generateAsm(
RegisterCombination combination, Program program,
Set<String> unknownFragments,
RegisterUpliftScope scope) {
// Reset register allocation to original zero page allocation
new Pass4RegistersFinalize(program).allocate(false);
// Apply the uplift combination
combination.allocate(program.getScope());
// Generate ASM
try {
new Pass4CodeGeneration(program).generate();
} catch (AsmFragment.UnknownFragmentException e) {
unknownFragments.add(e.getFragmentSignature());
if (program.getLog().isVerboseUplift()) {
StringBuilder msg = new StringBuilder();
msg.append("Uplift attempt [" + (scope==null?"":scope.getScopeRef()) + "] ");
msg.append("missing fragment " + e.getFragmentSignature());
msg.append(" allocation: ").append(combination.toString());
program.getLog().append(msg.toString());
}
return false;
} catch (AsmFragment.AluNotApplicableException e) {
if (program.getLog().isVerboseUplift()) {
StringBuilder msg = new StringBuilder();
msg.append("Uplift attempt [" + (scope==null?"":scope.getScopeRef()) + "] ");
msg.append("alu not applicable");
msg.append(" allocation: ").append(combination.toString());
program.getLog().append(msg.toString());
}
return false;
}
boolean hasClobberProblem = new Pass4AssertNoCpuClobber(program).hasClobberProblem(false);
if (hasClobberProblem) {
if (program.getLog().isVerboseUplift()) {
StringBuilder msg = new StringBuilder();
msg.append("Uplift attempt [" + (scope==null?"":scope.getScopeRef()) + "] ");
msg.append("clobber");
msg.append(" allocation: ").append(combination.toString());
program.getLog().append(msg.toString());
}
return false;
}
return true;
}
public static int getAsmScore(Program program) {
int score = 0;
AsmProgram asm = program.getAsm();
@ -103,8 +137,8 @@ public class Pass4RegisterUpliftCombinations extends Pass2Base {
double asmSegmentCycles = asmSegment.getCycles();
if (asmSegmentCycles > 0) {
Integer statementIdx = asmSegment.getStatementIdx();
int maxLoopDepth=1;
if(statementIdx!=null) {
int maxLoopDepth = 1;
if (statementIdx != null) {
ControlFlowBlock block = graph.getBlockFromStatementIdx(statementIdx);
maxLoopDepth = loopSet.getMaxLoopDepth(block.getLabel());
}

View File

@ -0,0 +1,56 @@
package dk.camelot64.kickc.passes;
import dk.camelot64.kickc.icl.*;
import java.util.HashSet;
/*** Find the variable equivalence classes to attempt to uplift in each scope */
public class Pass4RegisterUpliftStatic extends Pass2Base {
public Pass4RegisterUpliftStatic(Program program) {
super(program);
}
public void performUplift() {
RegisterCombination combination = new RegisterCombination();
setRegister(combination, "cnt#12", Registers.getRegisterX());
setRegister(combination, "cnt2#11", Registers.getRegisterY());
setRegister(combination, "cnt3#11", new Registers.RegisterZpByte(4));
setRegister(combination, "cnt#1", Registers.getRegisterX());
setRegister(combination, "main::$0", Registers.getRegisterA());
setRegister(combination, "main::$1", Registers.getRegisterA());
setRegister(combination, "inccnt::return#0", Registers.getRegisterA());
boolean success = Pass4RegisterUpliftCombinations.generateAsm(
combination,
getProgram(),
new HashSet<String>(),
null);
if (success) {
// If no clobber - Find value of the resulting allocation
int combinationScore = Pass4RegisterUpliftCombinations.getAsmScore(getProgram());
if (getLog().isVerboseUplift()) {
StringBuilder msg = new StringBuilder();
msg.append("Static Uplift ");
msg.append(combinationScore);
msg.append(" allocation: ").append(combination.toString());
getLog().append(msg.toString());
}
} else {
throw new RuntimeException("Static uplift problem.");
}
}
private void setRegister(RegisterCombination combination, String varFullName, Registers.Register register) {
LiveRangeEquivalenceClassSet equivalenceClassSet = getProgram().getLiveRangeEquivalenceClassSet();
ProgramScope scope = getProgram().getScope();
VariableRef variableRef = scope.getVariable(varFullName).getRef();
LiveRangeEquivalenceClass equivalenceClass = equivalenceClassSet.getEquivalenceClass(variableRef);
combination.setRegister(equivalenceClass, register);
}
}

View File

@ -1634,8 +1634,8 @@ REGISTER UPLIFT SCOPES
Uplift Scope [main] 55: zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ] 46.75: zp ZP_PTR_BYTE:2 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ] 29.33: zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] 14.67: zp ZP_BYTE:4 [ main::x#2 main::x#1 ]
Uplift Scope []
Uplifting [main] best 1315 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 1315 combination
Uplifting [main] best 1195 combination reg byte x [ main::e#3 main::e#5 main::e#1 main::e#2 ] zp ZP_PTR_BYTE:2 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ] zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] zp ZP_BYTE:4 [ main::x#2 main::x#1 ]
Uplifting [] best 1195 combination
Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ]
Removing instruction jmp bend
Removing instruction jmp b1

View File

@ -4691,11 +4691,11 @@ Uplift Scope [main] 2,002: zp ZP_BYTE:14 [ main::$1 ] 2,002: zp ZP_BYTE:15 [ mai
Uplift Scope [prepare] 38.5: zp ZP_BYTE:13 [ prepare::i#2 prepare::i#1 ]
Uplift Scope []
Uplifting [flip] best 180564 combination reg byte a [ flip::$0 ] zp ZP_BYTE:11 [ flip::c#2 flip::c#1 ] reg byte y [ flip::dstIdx#3 flip::dstIdx#5 flip::dstIdx#2 flip::dstIdx#1 ] reg byte x [ flip::srcIdx#2 flip::srcIdx#3 flip::srcIdx#1 ] reg byte x [ flip::i#2 flip::i#1 ] reg byte a [ flip::$4 ] zp ZP_BYTE:8 [ flip::r#2 flip::r#1 ]
Uplifting [plot] best 150164 combination reg byte y [ plot::x#2 plot::x#1 ] reg byte a [ plot::$3 ] reg byte x [ plot::i#2 plot::i#3 plot::i#1 ] zp ZP_PTR_BYTE:3 [ plot::line#2 plot::line#1 ] zp ZP_BYTE:5 [ plot::y#2 plot::y#1 ]
Uplifting [main] best 129564 combination reg byte a [ main::$1 ] reg byte a [ main::$3 ] reg byte x [ main::c#2 main::c#1 ]
Uplifting [prepare] best 129424 combination reg byte x [ prepare::i#2 prepare::i#1 ]
Uplifting [] best 129424 combination
Uplifting [flip] best 168124 combination reg byte a [ flip::$0 ] zp ZP_BYTE:11 [ flip::c#2 flip::c#1 ] reg byte y [ flip::dstIdx#3 flip::dstIdx#5 flip::dstIdx#2 flip::dstIdx#1 ] reg byte x [ flip::srcIdx#2 flip::srcIdx#3 flip::srcIdx#1 ] reg byte x [ flip::i#2 flip::i#1 ] reg byte a [ flip::$4 ] zp ZP_BYTE:8 [ flip::r#2 flip::r#1 ]
Uplifting [plot] best 143824 combination reg byte y [ plot::x#2 plot::x#1 ] reg byte a [ plot::$3 ] reg byte x [ plot::i#2 plot::i#3 plot::i#1 ] zp ZP_PTR_BYTE:3 [ plot::line#2 plot::line#1 ] zp ZP_BYTE:5 [ plot::y#2 plot::y#1 ]
Uplifting [main] best 125424 combination reg byte a [ main::$1 ] reg byte a [ main::$3 ] reg byte x [ main::c#2 main::c#1 ]
Uplifting [prepare] best 125324 combination reg byte x [ prepare::i#2 prepare::i#1 ]
Uplifting [] best 125324 combination
Coalescing zero page register [ zp ZP_BYTE:5 [ plot::y#2 plot::y#1 ] ] with [ zp ZP_BYTE:8 [ flip::r#2 flip::r#1 ] ]
Allocated (was zp ZP_PTR_BYTE:3) zp ZP_PTR_BYTE:2 [ plot::line#2 plot::line#1 ]
Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:4 [ plot::y#2 plot::y#1 flip::r#2 flip::r#1 ]

View File

@ -862,7 +862,7 @@ Uplift Scope [nest] 303: zp ZP_BYTE:3 [ nest::j#2 nest::j#1 ]
Uplift Scope [main] 19.64: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope []
Uplifting [nest] best 2536 combination reg byte x [ nest::j#2 nest::j#1 ]
Uplifting [nest] best 2506 combination reg byte x [ nest::j#2 nest::j#1 ]
Uplifting [main] best 2436 combination reg byte y [ main::i#2 main::i#1 ]
Uplifting [] best 2436 combination
Removing instruction jmp bend

View File

@ -2224,10 +2224,10 @@ Uplift Scope [nest1] 17,001.7: zp ZP_BYTE:5 [ nest1::j#2 nest1::j#1 ] 1,655.5: z
Uplift Scope [main] 162.72: zp ZP_BYTE:3 [ main::j#2 main::j#1 ] 17.55: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope []
Uplifting [nest2] best 23646452 combination reg byte y [ nest2::j#2 nest2::j#1 ] reg byte x [ nest2::i#2 nest2::i#1 ]
Uplifting [nest1] best 23566452 combination reg byte a [ nest1::j#2 nest1::j#1 ] zp ZP_BYTE:4 [ nest1::i#2 nest1::i#1 ]
Uplifting [main] best 23566452 combination zp ZP_BYTE:3 [ main::j#2 main::j#1 ] zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplifting [] best 23566452 combination
Uplifting [nest2] best 23613122 combination reg byte y [ nest2::j#2 nest2::j#1 ] reg byte x [ nest2::i#2 nest2::i#1 ]
Uplifting [nest1] best 23563122 combination reg byte a [ nest1::j#2 nest1::j#1 ] zp ZP_BYTE:4 [ nest1::i#2 nest1::i#1 ]
Uplifting [main] best 23563122 combination zp ZP_BYTE:3 [ main::j#2 main::j#1 ] zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplifting [] best 23563122 combination
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2

View File

@ -896,18 +896,19 @@ Complete equivalence classes
[ main::$1 ]
[ cnt#1 ]
[ inccnt::return#0 ]
Allocated zp ZP_BYTE:2 cnt#12 [ cnt#12 cnt#3 ]
Allocated zp ZP_BYTE:3 cnt2#11 [ cnt2#11 cnt2#1 ]
Allocated zp ZP_BYTE:4 cnt3#11 [ cnt3#11 cnt3#1 ]
Allocated zp ZP_BYTE:5 $0 [ main::$0 ]
Allocated zp ZP_BYTE:6 $1 [ main::$1 ]
Allocated zp ZP_BYTE:7 cnt#1 [ cnt#1 ]
Allocated zp ZP_BYTE:8 return#0 [ inccnt::return#0 ]
Allocated zp ZP_BYTE:2 [ cnt#12 cnt#3 ]
Allocated zp ZP_BYTE:3 [ cnt2#11 cnt2#1 ]
Allocated zp ZP_BYTE:4 [ cnt3#11 cnt3#1 ]
Allocated zp ZP_BYTE:5 [ main::$0 ]
Allocated zp ZP_BYTE:6 [ main::$1 ]
Allocated zp ZP_BYTE:7 [ cnt#1 ]
Allocated zp ZP_BYTE:8 [ inccnt::return#0 ]
INITIAL ASM
//SEG0 Global ZP labels
.label cnt = 7
.label cnt2 = 3
.label cnt3 = 4
.label cnt#3 = 2
.label cnt#12 = 2
//SEG1 @begin
bbegin:
@ -944,8 +945,8 @@ main: {
sta $400
//SEG13 [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby2
lda cnt
sta cnt_12
inc cnt_12
sta cnt_3
inc cnt_3
//SEG14 [5] call inccnt param-assignment [ inccnt::return#0 ]
//SEG15 [9] phi from main::@1 to inccnt
inccnt_from_b1:
@ -990,23 +991,23 @@ inccnt: {
}
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 cnt#12 [ cnt#12 cnt#3 ] : zp ZP_BYTE:2 cnt#12 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 cnt2 [ cnt2#11 cnt2#1 ] : zp ZP_BYTE:3 cnt2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 cnt3 [ cnt3#11 cnt3#1 ] : zp ZP_BYTE:4 cnt3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 $0 [ main::$0 ] : zp ZP_BYTE:5 $0 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:6 $1 [ main::$1 ] : zp ZP_BYTE:6 $1 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:7 cnt [ cnt#1 ] : zp ZP_BYTE:7 cnt , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:8 return [ inccnt::return#0 ] : zp ZP_BYTE:8 return , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:2 [ cnt#12 cnt#3 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ cnt2#11 cnt2#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ cnt3#11 cnt3#1 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 [ main::$0 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:6 [ main::$1 ] : zp ZP_BYTE:6 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:7 [ cnt#1 ] : zp ZP_BYTE:7 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:8 [ inccnt::return#0 ] : zp ZP_BYTE:8 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 8: zp ZP_BYTE:2 cnt#12 [ cnt#12 cnt#3 ] 2.5: zp ZP_BYTE:3 cnt2 [ cnt2#11 cnt2#1 ] 1.9: zp ZP_BYTE:4 cnt3 [ cnt3#11 cnt3#1 ] 0.75: zp ZP_BYTE:7 cnt [ cnt#1 ]
Uplift Scope [main] 4: zp ZP_BYTE:5 $0 [ main::$0 ] 4: zp ZP_BYTE:6 $1 [ main::$1 ]
Uplift Scope [inccnt] 1.5: zp ZP_BYTE:8 return [ inccnt::return#0 ]
Uplift Scope [] 8: zp ZP_BYTE:2 [ cnt#12 cnt#3 ] 2.5: zp ZP_BYTE:3 [ cnt2#11 cnt2#1 ] 1.9: zp ZP_BYTE:4 [ cnt3#11 cnt3#1 ] 0.75: zp ZP_BYTE:7 [ cnt#1 ]
Uplift Scope [main] 4: zp ZP_BYTE:5 [ main::$0 ] 4: zp ZP_BYTE:6 [ main::$1 ]
Uplift Scope [inccnt] 1.5: zp ZP_BYTE:8 [ inccnt::return#0 ]
Uplifting [] best 99 combination reg byte x [ cnt#12 cnt#3 ] reg byte y [ cnt2#11 cnt2#1 ] zp ZP_BYTE:4 cnt3 [ cnt3#11 cnt3#1 ] reg byte x [ cnt#1 ]
Uplifting [main] best 87 combination reg byte a [ main::$0 ] reg byte a [ main::$1 ]
Uplifting [inccnt] best 77 combination reg byte a [ inccnt::return#0 ]
Allocated (was zp ZP_BYTE:4 cnt3) zp ZP_BYTE:2 cnt3#11 [ cnt3#11 cnt3#1 ]
Uplifting [] best 94 combination reg byte x [ cnt#12 cnt#3 ] reg byte y [ cnt2#11 cnt2#1 ] zp ZP_BYTE:4 [ cnt3#11 cnt3#1 ] reg byte x [ cnt#1 ]
Uplifting [main] best 82 combination reg byte a [ main::$0 ] reg byte a [ main::$1 ]
Uplifting [inccnt] best 75 combination reg byte a [ inccnt::return#0 ]
Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:2 [ cnt3#11 cnt3#1 ]
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
@ -1154,8 +1155,8 @@ FINAL SYMBOL TABLE
(byte) cnt2#1 reg byte y 0.5
(byte) cnt2#11 reg byte y 2.0
(byte) cnt3
(byte) cnt3#1 zp ZP_BYTE:2 cnt3 0.5714285714285714
(byte) cnt3#11 zp ZP_BYTE:2 cnt3 1.3333333333333333
(byte) cnt3#1 cnt3 zp ZP_BYTE:2 0.5714285714285714
(byte) cnt3#11 cnt3 zp ZP_BYTE:2 1.3333333333333333
(byte()) inccnt()
(label) inccnt::@return
(byte) inccnt::return
@ -1169,7 +1170,7 @@ FINAL SYMBOL TABLE
reg byte x [ cnt#12 cnt#3 ]
reg byte y [ cnt2#11 cnt2#1 ]
zp ZP_BYTE:2 cnt3 [ cnt3#11 cnt3#1 ]
zp ZP_BYTE:2 [ cnt3#11 cnt3#1 ]
reg byte a [ main::$0 ]
reg byte a [ main::$1 ]
reg byte x [ cnt#1 ]

View File

@ -9,8 +9,8 @@
(byte) cnt2#1 reg byte y 0.5
(byte) cnt2#11 reg byte y 2.0
(byte) cnt3
(byte) cnt3#1 zp ZP_BYTE:2 cnt3 0.5714285714285714
(byte) cnt3#11 zp ZP_BYTE:2 cnt3 1.3333333333333333
(byte) cnt3#1 cnt3 zp ZP_BYTE:2 0.5714285714285714
(byte) cnt3#11 cnt3 zp ZP_BYTE:2 1.3333333333333333
(byte()) inccnt()
(label) inccnt::@return
(byte) inccnt::return
@ -24,7 +24,7 @@
reg byte x [ cnt#12 cnt#3 ]
reg byte y [ cnt2#11 cnt2#1 ]
zp ZP_BYTE:2 cnt3 [ cnt3#11 cnt3#1 ]
zp ZP_BYTE:2 [ cnt3#11 cnt3#1 ]
reg byte a [ main::$0 ]
reg byte a [ main::$1 ]
reg byte x [ cnt#1 ]

View File

@ -603,14 +603,15 @@ Complete equivalence classes
[ cnt#13 cnt#3 ]
[ cnt#1 ]
[ cnt#10 ]
Allocated zp ZP_BYTE:2 cnt#13 [ cnt#13 cnt#3 ]
Allocated zp ZP_BYTE:3 cnt#1 [ cnt#1 ]
Allocated zp ZP_BYTE:4 cnt#10 [ cnt#10 ]
Allocated zp ZP_BYTE:2 [ cnt#13 cnt#3 ]
Allocated zp ZP_BYTE:3 [ cnt#1 ]
Allocated zp ZP_BYTE:4 [ cnt#10 ]
INITIAL ASM
//SEG0 Global ZP labels
.label cnt = 3
.label cnt#13 = 2
.label cnt#3 = 2
.label cnt#10 = 4
.label cnt#13 = 2
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
@ -635,8 +636,8 @@ main: {
sta $400
//SEG10 [3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- zpby1=_inc_zpby2
lda cnt_10
sta cnt_13
inc cnt_13
sta cnt_3
inc cnt_3
//SEG11 [4] call inccnt param-assignment [ cnt#10 ]
//SEG12 [8] phi from main::@1 to inccnt
inccnt_from_b1:
@ -672,12 +673,12 @@ inccnt: {
}
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 cnt#13 [ cnt#13 cnt#3 ] : zp ZP_BYTE:2 cnt#13 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 cnt [ cnt#1 ] : zp ZP_BYTE:3 cnt , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 cnt#10 [ cnt#10 ] : zp ZP_BYTE:4 cnt#10 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:2 [ cnt#13 cnt#3 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ cnt#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ cnt#10 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 8: zp ZP_BYTE:2 cnt#13 [ cnt#13 cnt#3 ] 4: zp ZP_BYTE:3 cnt [ cnt#1 ] 1.6: zp ZP_BYTE:4 cnt#10 [ cnt#10 ]
Uplift Scope [] 8: zp ZP_BYTE:2 [ cnt#13 cnt#3 ] 4: zp ZP_BYTE:3 [ cnt#1 ] 1.6: zp ZP_BYTE:4 [ cnt#10 ]
Uplift Scope [main]
Uplift Scope [inccnt]

View File

@ -2254,12 +2254,12 @@ Uplift Scope [lvalue] 36.67: zp ZP_BYTE:9 [ lvalue::i#2 lvalue::i#1 ]
Uplift Scope [main]
Uplift Scope []
Uplifting [rvalue] best 2055 combination reg byte a [ rvalue::b#0 ] reg byte a [ rvalue::b#1 ] reg byte a [ rvalue::b#2 ] reg byte x [ rvalue::i#2 rvalue::i#1 ]
Uplifting [rvaluevar] best 1895 combination reg byte a [ rvaluevar::b#0 ] reg byte x [ rvaluevar::i#2 rvaluevar::i#1 ] zp ZP_PTR_BYTE:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ]
Uplifting [lvaluevar] best 1775 combination reg byte x [ lvaluevar::i#2 lvaluevar::i#1 ] zp ZP_PTR_BYTE:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ]
Uplifting [lvalue] best 1615 combination reg byte x [ lvalue::i#2 lvalue::i#1 ]
Uplifting [main] best 1615 combination
Uplifting [] best 1615 combination
Uplifting [rvalue] best 1865 combination reg byte a [ rvalue::b#0 ] reg byte a [ rvalue::b#1 ] reg byte a [ rvalue::b#2 ] reg byte x [ rvalue::i#2 rvalue::i#1 ]
Uplifting [rvaluevar] best 1745 combination reg byte a [ rvaluevar::b#0 ] reg byte x [ rvaluevar::i#2 rvaluevar::i#1 ] zp ZP_PTR_BYTE:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ]
Uplifting [lvaluevar] best 1655 combination reg byte x [ lvaluevar::i#2 lvaluevar::i#1 ] zp ZP_PTR_BYTE:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ]
Uplifting [lvalue] best 1535 combination reg byte x [ lvalue::i#2 lvalue::i#1 ]
Uplifting [main] best 1535 combination
Uplifting [] best 1535 combination
Coalescing zero page register [ zp ZP_PTR_BYTE:3 [ lvaluevar::screen#2 lvaluevar::screen#1 ] ] with [ zp ZP_PTR_BYTE:6 [ rvaluevar::screen#2 rvaluevar::screen#1 ] ]
Allocated (was zp ZP_PTR_BYTE:3) zp ZP_PTR_BYTE:2 [ lvaluevar::screen#2 lvaluevar::screen#1 rvaluevar::screen#2 rvaluevar::screen#1 ]
Removing instruction jmp bend

View File

@ -1,4 +1,5 @@
.label s1 = 2
.label s3 = 3
lda #$2
ldy #$1
jsr sum
@ -10,13 +11,12 @@
lda #$d
ldy #$9
jsr sum
tay
sta s3
txa
clc
adc s1
sty $ff
clc
adc $ff
adc s3
sum: {
sty $ff
clc

View File

@ -558,14 +558,14 @@ Complete equivalence classes
[ $3 ]
[ s4#0 ]
[ sum::return#0 ]
Allocated zp ZP_BYTE:2 a#3 [ sum::a#3 ]
Allocated zp ZP_BYTE:3 b#3 [ sum::b#3 ]
Allocated zp ZP_BYTE:4 s1#0 [ s1#0 ]
Allocated zp ZP_BYTE:5 s2#0 [ s2#0 ]
Allocated zp ZP_BYTE:6 s3#0 [ s3#0 ]
Allocated zp ZP_BYTE:7 $3 [ $3 ]
Allocated zp ZP_BYTE:8 s4#0 [ s4#0 ]
Allocated zp ZP_BYTE:9 return#0 [ sum::return#0 ]
Allocated zp ZP_BYTE:2 [ sum::a#3 ]
Allocated zp ZP_BYTE:3 [ sum::b#3 ]
Allocated zp ZP_BYTE:4 [ s1#0 ]
Allocated zp ZP_BYTE:5 [ s2#0 ]
Allocated zp ZP_BYTE:6 [ s3#0 ]
Allocated zp ZP_BYTE:7 [ $3 ]
Allocated zp ZP_BYTE:8 [ s4#0 ]
Allocated zp ZP_BYTE:9 [ sum::return#0 ]
INITIAL ASM
//SEG0 Global ZP labels
.label $3 = 7
@ -580,10 +580,10 @@ bbegin:
sum_from_bbegin:
//SEG4 [8] phi (byte) sum::b#3 = (byte) 2 -- zpby1=coby1
lda #$2
sta b
sta sum.b
//SEG5 [8] phi (byte) sum::a#3 = (byte) 1 -- zpby1=coby1
lda #$1
sta a
sta sum.a
jsr sum
jmp b2
//SEG6 @2
@ -596,10 +596,10 @@ b2:
sum_from_b2:
//SEG10 [8] phi (byte) sum::b#3 = (byte) 4 -- zpby1=coby1
lda #$4
sta b
sta sum.b
//SEG11 [8] phi (byte) sum::a#3 = (byte) 3 -- zpby1=coby1
lda #$3
sta a
sta sum.a
jsr sum
jmp b3
//SEG12 @3
@ -612,10 +612,10 @@ b3:
sum_from_b3:
//SEG16 [8] phi (byte) sum::b#3 = (byte) 13 -- zpby1=coby1
lda #$d
sta b
sta sum.b
//SEG17 [8] phi (byte) sum::a#3 = (byte) 9 -- zpby1=coby1
lda #$9
sta a
sta sum.a
jsr sum
jmp b4
//SEG18 @4
@ -654,22 +654,23 @@ sum: {
}
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 a [ sum::a#3 ] : zp ZP_BYTE:2 a , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 b [ sum::b#3 ] : zp ZP_BYTE:3 b , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 s1 [ s1#0 ] : zp ZP_BYTE:4 s1 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 s2 [ s2#0 ] : zp ZP_BYTE:5 s2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:6 s3 [ s3#0 ] : zp ZP_BYTE:6 s3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:7 $3 [ $3 ] : zp ZP_BYTE:7 $3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:8 s4 [ s4#0 ] : zp ZP_BYTE:8 s4 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:9 return [ sum::return#0 ] : zp ZP_BYTE:9 return , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:2 [ sum::a#3 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ sum::b#3 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ s1#0 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 [ s2#0 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:6 [ s3#0 ] : zp ZP_BYTE:6 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:7 [ $3 ] : zp ZP_BYTE:7 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:8 [ s4#0 ] : zp ZP_BYTE:8 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:9 [ sum::return#0 ] : zp ZP_BYTE:9 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [] ∞: zp ZP_BYTE:8 s4 [ s4#0 ] 4: zp ZP_BYTE:7 $3 [ $3 ] 2: zp ZP_BYTE:6 s3 [ s3#0 ] 0.67: zp ZP_BYTE:5 s2 [ s2#0 ] 0.5: zp ZP_BYTE:4 s1 [ s1#0 ]
Uplift Scope [sum] 2: zp ZP_BYTE:2 a [ sum::a#3 ] 2: zp ZP_BYTE:3 b [ sum::b#3 ] 1.6: zp ZP_BYTE:9 return [ sum::return#0 ]
Uplift Scope [] ∞: zp ZP_BYTE:8 [ s4#0 ] 4: zp ZP_BYTE:7 [ $3 ] 2: zp ZP_BYTE:6 [ s3#0 ] 0.67: zp ZP_BYTE:5 [ s2#0 ] 0.5: zp ZP_BYTE:4 [ s1#0 ]
Uplift Scope [sum] 2: zp ZP_BYTE:2 [ sum::a#3 ] 2: zp ZP_BYTE:3 [ sum::b#3 ] 1.6: zp ZP_BYTE:9 [ sum::return#0 ]
Uplifting [] best 121 combination reg byte a [ s4#0 ] reg byte a [ $3 ] reg byte y [ s3#0 ] reg byte x [ s2#0 ] zp ZP_BYTE:4 s1 [ s1#0 ]
Uplifting [sum] best 83 combination reg byte y [ sum::a#3 ] reg byte a [ sum::b#3 ] reg byte a [ sum::return#0 ]
Allocated (was zp ZP_BYTE:4 s1) zp ZP_BYTE:2 s1#0 [ s1#0 ]
Uplifting [] best 107 combination reg byte a [ s4#0 ] reg byte a [ $3 ] zp ZP_BYTE:6 [ s3#0 ] reg byte x [ s2#0 ] zp ZP_BYTE:4 [ s1#0 ]
Uplifting [sum] best 79 combination reg byte y [ sum::a#3 ] reg byte a [ sum::b#3 ] reg byte a [ sum::return#0 ]
Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:2 [ s1#0 ]
Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:3 [ s3#0 ]
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp b4
@ -679,6 +680,7 @@ Succesful ASM optimization Pass5NextJumpElimination
ASSEMBLER
//SEG0 Global ZP labels
.label s1 = 2
.label s3 = 3
//SEG1 @begin
bbegin:
//SEG2 [0] call sum param-assignment [ sum::return#0 ]
@ -715,16 +717,15 @@ sum_from_b3:
jsr sum
//SEG18 @4
b4:
//SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- yby=aby
tay
//SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- zpby1=aby
sta s3
//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] -- aby=zpby1_plus_xby
txa
clc
adc s1
//SEG21 [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] -- aby=aby_plus_yby
sty $ff
//SEG21 [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] -- aby=aby_plus_zpby1
clc
adc $ff
adc s3
//SEG22 @end
bend:
//SEG23 sum
@ -744,6 +745,7 @@ Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER
//SEG0 Global ZP labels
.label s1 = 2
.label s3 = 3
//SEG1 @begin
bbegin:
//SEG2 [0] call sum param-assignment [ sum::return#0 ]
@ -779,16 +781,15 @@ sum_from_b3:
jsr sum
//SEG18 @4
b4:
//SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- yby=aby
tay
//SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- zpby1=aby
sta s3
//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] -- aby=zpby1_plus_xby
txa
clc
adc s1
//SEG21 [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] -- aby=aby_plus_yby
sty $ff
//SEG21 [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] -- aby=aby_plus_zpby1
clc
adc $ff
adc s3
//SEG22 @end
bend:
//SEG23 sum
@ -815,6 +816,7 @@ Succesful ASM optimization Pass5UnusedLabelElimination
ASSEMBLER
//SEG0 Global ZP labels
.label s1 = 2
.label s3 = 3
//SEG1 @begin
//SEG2 [0] call sum param-assignment [ sum::return#0 ]
//SEG3 [8] phi from @begin to sum
@ -844,16 +846,15 @@ ASSEMBLER
ldy #$9
jsr sum
//SEG18 @4
//SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- yby=aby
tay
//SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- zpby1=aby
sta s3
//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] -- aby=zpby1_plus_xby
txa
clc
adc s1
//SEG21 [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] -- aby=aby_plus_yby
sty $ff
//SEG21 [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] -- aby=aby_plus_zpby1
clc
adc $ff
adc s3
//SEG22 @end
//SEG23 sum
sum: {
@ -874,11 +875,11 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(byte) s1
(byte) s1#0 zp ZP_BYTE:2 s1 0.5
(byte) s1#0 s1 zp ZP_BYTE:2 0.5
(byte) s2
(byte) s2#0 reg byte x 0.6666666666666666
(byte) s3
(byte) s3#0 reg byte y 2.0
(byte) s3#0 s3 zp ZP_BYTE:3 2.0
(byte) s4
(byte) s4#0 reg byte a Infinity
(byte()) sum((byte) sum::a , (byte) sum::b)
@ -892,9 +893,9 @@ FINAL SYMBOL TABLE
reg byte y [ sum::a#3 ]
reg byte a [ sum::b#3 ]
zp ZP_BYTE:2 s1 [ s1#0 ]
zp ZP_BYTE:2 [ s1#0 ]
reg byte x [ s2#0 ]
reg byte y [ s3#0 ]
zp ZP_BYTE:3 [ s3#0 ]
reg byte a [ $3 ]
reg byte a [ s4#0 ]
reg byte a [ sum::return#0 ]
@ -902,6 +903,7 @@ reg byte a [ sum::return#0 ]
FINAL CODE
//SEG0 Global ZP labels
.label s1 = 2
.label s3 = 3
//SEG1 @begin
//SEG2 [0] call sum param-assignment [ sum::return#0 ]
//SEG3 [8] phi from @begin to sum
@ -931,16 +933,15 @@ FINAL CODE
ldy #$9
jsr sum
//SEG18 @4
//SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- yby=aby
tay
//SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- zpby1=aby
sta s3
//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] -- aby=zpby1_plus_xby
txa
clc
adc s1
//SEG21 [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] -- aby=aby_plus_yby
sty $ff
//SEG21 [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] -- aby=aby_plus_zpby1
clc
adc $ff
adc s3
//SEG22 @end
//SEG23 sum
sum: {

View File

@ -5,11 +5,11 @@
(label) @begin
(label) @end
(byte) s1
(byte) s1#0 zp ZP_BYTE:2 s1 0.5
(byte) s1#0 s1 zp ZP_BYTE:2 0.5
(byte) s2
(byte) s2#0 reg byte x 0.6666666666666666
(byte) s3
(byte) s3#0 reg byte y 2.0
(byte) s3#0 s3 zp ZP_BYTE:3 2.0
(byte) s4
(byte) s4#0 reg byte a Infinity
(byte()) sum((byte) sum::a , (byte) sum::b)
@ -23,9 +23,9 @@
reg byte y [ sum::a#3 ]
reg byte a [ sum::b#3 ]
zp ZP_BYTE:2 s1 [ s1#0 ]
zp ZP_BYTE:2 [ s1#0 ]
reg byte x [ s2#0 ]
reg byte y [ s3#0 ]
zp ZP_BYTE:3 [ s3#0 ]
reg byte a [ $3 ]
reg byte a [ s4#0 ]
reg byte a [ sum::return#0 ]

View File

@ -8472,16 +8472,16 @@ main: {
//SEG5 [1] call addpoint param-assignment [ ]
//SEG6 [93] phi from main to addpoint
addpoint_from_main:
//SEG7 [1] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1
//SEG7 [93] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1
lda #$1
sta addpoint.c
//SEG8 [1] phi (byte) addpoint::y#6 = (byte) 5 -- zpby1=coby1
//SEG8 [93] phi (byte) addpoint::y#6 = (byte) 5 -- zpby1=coby1
lda #$5
sta addpoint.y
//SEG9 [1] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1
//SEG9 [93] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1
lda #$0
sta numpoints
//SEG10 [1] phi (byte) addpoint::x#6 = (byte) 5 -- zpby1=coby1
//SEG10 [93] phi (byte) addpoint::x#6 = (byte) 5 -- zpby1=coby1
lda #$5
sta addpoint.x
jsr addpoint
@ -8491,14 +8491,14 @@ main: {
//SEG12 [2] call addpoint param-assignment [ ]
//SEG13 [93] phi from main::@3 to addpoint
addpoint_from_b3:
//SEG14 [2] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1
//SEG14 [93] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1
lda #$2
sta addpoint.c
//SEG15 [2] phi (byte) addpoint::y#6 = (byte) 8 -- zpby1=coby1
//SEG15 [93] phi (byte) addpoint::y#6 = (byte) 8 -- zpby1=coby1
lda #$8
sta addpoint.y
//SEG16 [2] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG17 [2] phi (byte) addpoint::x#6 = (byte) 15 -- zpby1=coby1
//SEG16 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG17 [93] phi (byte) addpoint::x#6 = (byte) 15 -- zpby1=coby1
lda #$f
sta addpoint.x
jsr addpoint
@ -8508,14 +8508,14 @@ main: {
//SEG19 [3] call addpoint param-assignment [ ]
//SEG20 [93] phi from main::@4 to addpoint
addpoint_from_b4:
//SEG21 [3] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1
//SEG21 [93] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1
lda #$3
sta addpoint.c
//SEG22 [3] phi (byte) addpoint::y#6 = (byte) 14 -- zpby1=coby1
//SEG22 [93] phi (byte) addpoint::y#6 = (byte) 14 -- zpby1=coby1
lda #$e
sta addpoint.y
//SEG23 [3] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG24 [3] phi (byte) addpoint::x#6 = (byte) 6 -- zpby1=coby1
//SEG23 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG24 [93] phi (byte) addpoint::x#6 = (byte) 6 -- zpby1=coby1
lda #$6
sta addpoint.x
jsr addpoint
@ -8525,14 +8525,14 @@ main: {
//SEG26 [4] call addpoint param-assignment [ ]
//SEG27 [93] phi from main::@5 to addpoint
addpoint_from_b5:
//SEG28 [4] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1
//SEG28 [93] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1
lda #$4
sta addpoint.c
//SEG29 [4] phi (byte) addpoint::y#6 = (byte) 2 -- zpby1=coby1
//SEG29 [93] phi (byte) addpoint::y#6 = (byte) 2 -- zpby1=coby1
lda #$2
sta addpoint.y
//SEG30 [4] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG31 [4] phi (byte) addpoint::x#6 = (byte) 34 -- zpby1=coby1
//SEG30 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG31 [93] phi (byte) addpoint::x#6 = (byte) 34 -- zpby1=coby1
lda #$22
sta addpoint.x
jsr addpoint
@ -8542,14 +8542,14 @@ main: {
//SEG33 [5] call addpoint param-assignment [ ]
//SEG34 [93] phi from main::@6 to addpoint
addpoint_from_b6:
//SEG35 [5] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1
//SEG35 [93] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1
lda #$5
sta addpoint.c
//SEG36 [5] phi (byte) addpoint::y#6 = (byte) 17 -- zpby1=coby1
//SEG36 [93] phi (byte) addpoint::y#6 = (byte) 17 -- zpby1=coby1
lda #$11
sta addpoint.y
//SEG37 [5] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG38 [5] phi (byte) addpoint::x#6 = (byte) 21 -- zpby1=coby1
//SEG37 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG38 [93] phi (byte) addpoint::x#6 = (byte) 21 -- zpby1=coby1
lda #$15
sta addpoint.x
jsr addpoint
@ -8559,14 +8559,14 @@ main: {
//SEG40 [6] call addpoint param-assignment [ ]
//SEG41 [93] phi from main::@7 to addpoint
addpoint_from_b7:
//SEG42 [6] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1
//SEG42 [93] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1
lda #$7
sta addpoint.c
//SEG43 [6] phi (byte) addpoint::y#6 = (byte) 22 -- zpby1=coby1
//SEG43 [93] phi (byte) addpoint::y#6 = (byte) 22 -- zpby1=coby1
lda #$16
sta addpoint.y
//SEG44 [6] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG45 [6] phi (byte) addpoint::x#6 = (byte) 31 -- zpby1=coby1
//SEG44 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG45 [93] phi (byte) addpoint::x#6 = (byte) 31 -- zpby1=coby1
lda #$1f
sta addpoint.x
jsr addpoint
@ -9213,33 +9213,33 @@ Uplift Scope [addpoint] 2: zp ZP_BYTE:13 [ addpoint::x#6 ] 1: zp ZP_BYTE:15 [ ad
Uplift Scope [main]
Uplift attempts [findcol] 10000/559872 (limiting to 10000)
Uplifting [findcol] best 2005183 combination reg byte a [ findcol::mindiff#11 findcol::diff#6 findcol::diff#3 findcol::diff#2 findcol::mindiff#14 ] zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] reg byte y [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] zp ZP_BYTE:7 [ findcol::mindiff#10 findcol::mindiff#13 ] reg byte a [ findcol::$12 ] reg byte a [ findcol::$14 ] reg byte x [ findcol::i#12 findcol::i#1 ] zp ZP_BYTE:40 [ findcol::xp#0 ] zp ZP_BYTE:41 [ findcol::yp#0 ] zp ZP_BYTE:37 [ findcol::x#0 ] zp ZP_BYTE:38 [ findcol::y#0 ]
Uplifting [findcol] best 1724297 combination reg byte a [ findcol::mindiff#11 findcol::diff#6 findcol::diff#3 findcol::diff#2 findcol::mindiff#14 ] zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] reg byte y [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ] zp ZP_BYTE:7 [ findcol::mindiff#10 findcol::mindiff#13 ] reg byte a [ findcol::$12 ] reg byte a [ findcol::$14 ] reg byte x [ findcol::i#12 findcol::i#1 ] zp ZP_BYTE:40 [ findcol::xp#0 ] zp ZP_BYTE:41 [ findcol::yp#0 ] zp ZP_BYTE:37 [ findcol::x#0 ] zp ZP_BYTE:38 [ findcol::y#0 ]
Limited combination testing to 10000 combinations of 559872 possible.
Uplifting [render] best 1999183 combination reg byte a [ render::col#0 ] zp ZP_BYTE:5 [ render::x#2 render::x#1 ] zp ZP_BYTE:2 [ render::y#2 render::y#1 ] zp ZP_PTR_BYTE:3 [ render::colline#2 render::colline#1 ]
Uplifting [] best 1999183 combination zp ZP_BYTE:14 [ numpoints#19 numpoints#1 ]
Uplifting [initscreen] best 1999183 combination zp ZP_PTR_BYTE:11 [ initscreen::screen#2 initscreen::screen#1 ]
Uplifting [addpoint] best 1999129 combination reg byte a [ addpoint::x#6 ] reg byte y [ addpoint::y#6 ] zp ZP_BYTE:16 [ addpoint::c#6 ]
Uplifting [main] best 1999129 combination
Uplifting remains [reg byte a [ animate::$0 ]] best 1999123 combination reg byte a [ animate::$0 ]
Uplifting remains [reg byte a [ animate::$1 ]] best 1999117 combination reg byte a [ animate::$1 ]
Uplifting remains [reg byte a [ animate::$2 ]] best 1999111 combination reg byte a [ animate::$2 ]
Uplifting remains [reg byte a [ animate::$5 ]] best 1999105 combination reg byte a [ animate::$5 ]
Uplifting remains [reg byte a [ animate::$6 ]] best 1999099 combination reg byte a [ animate::$6 ]
Uplifting remains [reg byte a [ animate::$7 ]] best 1999093 combination reg byte a [ animate::$7 ]
Uplifting remains [reg byte x [ animate::$10 ]] best 1999087 combination reg byte x [ animate::$10 ]
Uplifting remains [reg byte x [ animate::$11 ]] best 1999079 combination reg byte x [ animate::$11 ]
Uplifting remains [reg byte a [ animate::$12 ]] best 1999073 combination reg byte a [ animate::$12 ]
Uplifting remains [reg byte a [ animate::$15 ]] best 1999067 combination reg byte a [ animate::$15 ]
Uplifting remains [reg byte a [ animate::$16 ]] best 1999061 combination reg byte a [ animate::$16 ]
Uplifting remains [reg byte a [ animate::$17 ]] best 1999055 combination reg byte a [ animate::$17 ]
Uplifting remains [reg byte x [ animate::$20 ]] best 1999049 combination reg byte x [ animate::$20 ]
Uplifting remains [reg byte x [ animate::$21 ]] best 1999041 combination reg byte x [ animate::$21 ]
Uplifting remains [reg byte a [ animate::$22 ]] best 1999035 combination reg byte a [ animate::$22 ]
Uplifting remains [reg byte a [ animate::$25 ]] best 1999029 combination reg byte a [ animate::$25 ]
Uplifting remains [reg byte a [ animate::$26 ]] best 1999023 combination reg byte a [ animate::$26 ]
Uplifting remains [reg byte a [ animate::$27 ]] best 1999017 combination reg byte a [ animate::$27 ]
Uplifting remains [reg byte a [ animate::$30 ]] best 1999011 combination reg byte a [ animate::$30 ]
Uplifting remains [reg byte a [ animate::$31 ]] best 1999005 combination reg byte a [ animate::$31 ]
Uplifting [render] best 1720297 combination reg byte a [ render::col#0 ] zp ZP_BYTE:5 [ render::x#2 render::x#1 ] zp ZP_BYTE:2 [ render::y#2 render::y#1 ] zp ZP_PTR_BYTE:3 [ render::colline#2 render::colline#1 ]
Uplifting [] best 1720297 combination zp ZP_BYTE:14 [ numpoints#19 numpoints#1 ]
Uplifting [initscreen] best 1720297 combination zp ZP_PTR_BYTE:11 [ initscreen::screen#2 initscreen::screen#1 ]
Uplifting [addpoint] best 1720257 combination reg byte a [ addpoint::x#6 ] reg byte y [ addpoint::y#6 ] zp ZP_BYTE:16 [ addpoint::c#6 ]
Uplifting [main] best 1720257 combination
Uplifting remains [reg byte a [ animate::$0 ]] best 1720251 combination reg byte a [ animate::$0 ]
Uplifting remains [reg byte a [ animate::$1 ]] best 1720245 combination reg byte a [ animate::$1 ]
Uplifting remains [reg byte a [ animate::$2 ]] best 1720239 combination reg byte a [ animate::$2 ]
Uplifting remains [reg byte a [ animate::$5 ]] best 1720233 combination reg byte a [ animate::$5 ]
Uplifting remains [reg byte a [ animate::$6 ]] best 1720227 combination reg byte a [ animate::$6 ]
Uplifting remains [reg byte a [ animate::$7 ]] best 1720221 combination reg byte a [ animate::$7 ]
Uplifting remains [reg byte x [ animate::$10 ]] best 1720215 combination reg byte x [ animate::$10 ]
Uplifting remains [reg byte x [ animate::$11 ]] best 1720207 combination reg byte x [ animate::$11 ]
Uplifting remains [reg byte a [ animate::$12 ]] best 1720201 combination reg byte a [ animate::$12 ]
Uplifting remains [reg byte a [ animate::$15 ]] best 1720195 combination reg byte a [ animate::$15 ]
Uplifting remains [reg byte a [ animate::$16 ]] best 1720189 combination reg byte a [ animate::$16 ]
Uplifting remains [reg byte a [ animate::$17 ]] best 1720183 combination reg byte a [ animate::$17 ]
Uplifting remains [reg byte x [ animate::$20 ]] best 1720177 combination reg byte x [ animate::$20 ]
Uplifting remains [reg byte x [ animate::$21 ]] best 1720169 combination reg byte x [ animate::$21 ]
Uplifting remains [reg byte a [ animate::$22 ]] best 1720163 combination reg byte a [ animate::$22 ]
Uplifting remains [reg byte a [ animate::$25 ]] best 1720157 combination reg byte a [ animate::$25 ]
Uplifting remains [reg byte a [ animate::$26 ]] best 1720151 combination reg byte a [ animate::$26 ]
Uplifting remains [reg byte a [ animate::$27 ]] best 1720145 combination reg byte a [ animate::$27 ]
Uplifting remains [reg byte a [ animate::$30 ]] best 1720139 combination reg byte a [ animate::$30 ]
Uplifting remains [reg byte a [ animate::$31 ]] best 1720133 combination reg byte a [ animate::$31 ]
Coalescing zero page register [ zp ZP_BYTE:2 [ render::y#2 render::y#1 ] ] with [ zp ZP_BYTE:16 [ addpoint::c#6 ] ]
Coalescing zero page register [ zp ZP_PTR_BYTE:3 [ render::colline#2 render::colline#1 ] ] with [ zp ZP_PTR_BYTE:11 [ initscreen::screen#2 initscreen::screen#1 ] ]
Coalescing zero page register [ zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] ] with [ zp ZP_BYTE:40 [ findcol::xp#0 ] ]
@ -9303,15 +9303,15 @@ main: {
//SEG5 [1] call addpoint param-assignment [ ]
//SEG6 [93] phi from main to addpoint
addpoint_from_main:
//SEG7 [1] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1
//SEG7 [93] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1
lda #$1
sta addpoint.c
//SEG8 [1] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1
//SEG8 [93] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1
ldy #$5
//SEG9 [1] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1
//SEG9 [93] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1
lda #$0
sta numpoints
//SEG10 [1] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1
//SEG10 [93] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1
lda #$5
jsr addpoint
//SEG11 main::@3
@ -9319,13 +9319,13 @@ main: {
//SEG12 [2] call addpoint param-assignment [ ]
//SEG13 [93] phi from main::@3 to addpoint
addpoint_from_b3:
//SEG14 [2] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1
//SEG14 [93] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1
lda #$2
sta addpoint.c
//SEG15 [2] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1
//SEG15 [93] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1
ldy #$8
//SEG16 [2] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG17 [2] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1
//SEG16 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG17 [93] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1
lda #$f
jsr addpoint
//SEG18 main::@4
@ -9333,13 +9333,13 @@ main: {
//SEG19 [3] call addpoint param-assignment [ ]
//SEG20 [93] phi from main::@4 to addpoint
addpoint_from_b4:
//SEG21 [3] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1
//SEG21 [93] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1
lda #$3
sta addpoint.c
//SEG22 [3] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1
//SEG22 [93] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1
ldy #$e
//SEG23 [3] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG24 [3] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1
//SEG23 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG24 [93] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1
lda #$6
jsr addpoint
//SEG25 main::@5
@ -9347,13 +9347,13 @@ main: {
//SEG26 [4] call addpoint param-assignment [ ]
//SEG27 [93] phi from main::@5 to addpoint
addpoint_from_b5:
//SEG28 [4] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1
//SEG28 [93] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1
lda #$4
sta addpoint.c
//SEG29 [4] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1
//SEG29 [93] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1
ldy #$2
//SEG30 [4] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG31 [4] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1
//SEG30 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG31 [93] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1
lda #$22
jsr addpoint
//SEG32 main::@6
@ -9361,13 +9361,13 @@ main: {
//SEG33 [5] call addpoint param-assignment [ ]
//SEG34 [93] phi from main::@6 to addpoint
addpoint_from_b6:
//SEG35 [5] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1
//SEG35 [93] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1
lda #$5
sta addpoint.c
//SEG36 [5] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1
//SEG36 [93] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1
ldy #$11
//SEG37 [5] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG38 [5] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1
//SEG37 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG38 [93] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1
lda #$15
jsr addpoint
//SEG39 main::@7
@ -9375,13 +9375,13 @@ main: {
//SEG40 [6] call addpoint param-assignment [ ]
//SEG41 [93] phi from main::@7 to addpoint
addpoint_from_b7:
//SEG42 [6] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1
//SEG42 [93] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1
lda #$7
sta addpoint.c
//SEG43 [6] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1
//SEG43 [93] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1
ldy #$16
//SEG44 [6] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG45 [6] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1
//SEG44 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG45 [93] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1
lda #$1f
jsr addpoint
//SEG46 main::@8
@ -9836,80 +9836,80 @@ main: {
//SEG5 [1] call addpoint param-assignment [ ]
//SEG6 [93] phi from main to addpoint
addpoint_from_main:
//SEG7 [1] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1
//SEG7 [93] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1
lda #$1
sta addpoint.c
//SEG8 [1] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1
//SEG8 [93] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1
ldy #$5
//SEG9 [1] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1
//SEG9 [93] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1
lda #$0
sta numpoints
//SEG10 [1] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1
//SEG10 [93] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1
lda #$5
jsr addpoint
//SEG11 main::@3
b3:
//SEG12 [2] call addpoint param-assignment [ ]
//SEG13 [93] phi from main::@3 to addpoint
//SEG14 [2] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1
//SEG14 [93] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1
lda #$2
sta addpoint.c
//SEG15 [2] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1
//SEG15 [93] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1
ldy #$8
//SEG16 [2] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG17 [2] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1
//SEG16 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG17 [93] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1
lda #$f
jsr addpoint
//SEG18 main::@4
b4:
//SEG19 [3] call addpoint param-assignment [ ]
//SEG20 [93] phi from main::@4 to addpoint
//SEG21 [3] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1
//SEG21 [93] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1
lda #$3
sta addpoint.c
//SEG22 [3] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1
//SEG22 [93] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1
ldy #$e
//SEG23 [3] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG24 [3] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1
//SEG23 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG24 [93] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1
lda #$6
jsr addpoint
//SEG25 main::@5
b5:
//SEG26 [4] call addpoint param-assignment [ ]
//SEG27 [93] phi from main::@5 to addpoint
//SEG28 [4] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1
//SEG28 [93] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1
lda #$4
sta addpoint.c
//SEG29 [4] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1
//SEG29 [93] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1
ldy #$2
//SEG30 [4] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG31 [4] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1
//SEG30 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG31 [93] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1
lda #$22
jsr addpoint
//SEG32 main::@6
b6:
//SEG33 [5] call addpoint param-assignment [ ]
//SEG34 [93] phi from main::@6 to addpoint
//SEG35 [5] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1
//SEG35 [93] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1
lda #$5
sta addpoint.c
//SEG36 [5] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1
//SEG36 [93] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1
ldy #$11
//SEG37 [5] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG38 [5] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1
//SEG37 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG38 [93] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1
lda #$15
jsr addpoint
//SEG39 main::@7
b7:
//SEG40 [6] call addpoint param-assignment [ ]
//SEG41 [93] phi from main::@7 to addpoint
//SEG42 [6] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1
//SEG42 [93] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1
lda #$7
sta addpoint.c
//SEG43 [6] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1
//SEG43 [93] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1
ldy #$16
//SEG44 [6] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG45 [6] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1
//SEG44 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG45 [93] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1
lda #$1f
jsr addpoint
//SEG46 main::@8
@ -10374,75 +10374,75 @@ ASSEMBLER
main: {
//SEG5 [1] call addpoint param-assignment [ ]
//SEG6 [93] phi from main to addpoint
//SEG7 [1] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1
//SEG7 [93] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1
lda #$1
sta addpoint.c
//SEG8 [1] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1
//SEG8 [93] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1
ldy #$5
//SEG9 [1] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1
//SEG9 [93] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1
lda #$0
sta numpoints
//SEG10 [1] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1
//SEG10 [93] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1
lda #$5
jsr addpoint
//SEG11 main::@3
//SEG12 [2] call addpoint param-assignment [ ]
//SEG13 [93] phi from main::@3 to addpoint
//SEG14 [2] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1
//SEG14 [93] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1
lda #$2
sta addpoint.c
//SEG15 [2] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1
//SEG15 [93] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1
ldy #$8
//SEG16 [2] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG17 [2] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1
//SEG16 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG17 [93] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1
lda #$f
jsr addpoint
//SEG18 main::@4
//SEG19 [3] call addpoint param-assignment [ ]
//SEG20 [93] phi from main::@4 to addpoint
//SEG21 [3] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1
//SEG21 [93] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1
lda #$3
sta addpoint.c
//SEG22 [3] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1
//SEG22 [93] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1
ldy #$e
//SEG23 [3] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG24 [3] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1
//SEG23 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG24 [93] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1
lda #$6
jsr addpoint
//SEG25 main::@5
//SEG26 [4] call addpoint param-assignment [ ]
//SEG27 [93] phi from main::@5 to addpoint
//SEG28 [4] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1
//SEG28 [93] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1
lda #$4
sta addpoint.c
//SEG29 [4] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1
//SEG29 [93] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1
ldy #$2
//SEG30 [4] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG31 [4] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1
//SEG30 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG31 [93] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1
lda #$22
jsr addpoint
//SEG32 main::@6
//SEG33 [5] call addpoint param-assignment [ ]
//SEG34 [93] phi from main::@6 to addpoint
//SEG35 [5] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1
//SEG35 [93] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1
lda #$5
sta addpoint.c
//SEG36 [5] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1
//SEG36 [93] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1
ldy #$11
//SEG37 [5] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG38 [5] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1
//SEG37 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG38 [93] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1
lda #$15
jsr addpoint
//SEG39 main::@7
//SEG40 [6] call addpoint param-assignment [ ]
//SEG41 [93] phi from main::@7 to addpoint
//SEG42 [6] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1
//SEG42 [93] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1
lda #$7
sta addpoint.c
//SEG43 [6] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1
//SEG43 [93] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1
ldy #$16
//SEG44 [6] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG45 [6] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1
//SEG44 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG45 [93] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1
lda #$1f
jsr addpoint
//SEG46 main::@8
@ -10846,75 +10846,75 @@ ASSEMBLER
main: {
//SEG5 [1] call addpoint param-assignment [ ]
//SEG6 [93] phi from main to addpoint
//SEG7 [1] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1
//SEG7 [93] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1
lda #$1
sta addpoint.c
//SEG8 [1] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1
//SEG8 [93] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1
ldy #$5
//SEG9 [1] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1
//SEG9 [93] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1
lda #$0
sta numpoints
//SEG10 [1] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1
//SEG10 [93] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1
lda #$5
jsr addpoint
//SEG11 main::@3
//SEG12 [2] call addpoint param-assignment [ ]
//SEG13 [93] phi from main::@3 to addpoint
//SEG14 [2] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1
//SEG14 [93] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1
lda #$2
sta addpoint.c
//SEG15 [2] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1
//SEG15 [93] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1
ldy #$8
//SEG16 [2] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG17 [2] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1
//SEG16 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG17 [93] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1
lda #$f
jsr addpoint
//SEG18 main::@4
//SEG19 [3] call addpoint param-assignment [ ]
//SEG20 [93] phi from main::@4 to addpoint
//SEG21 [3] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1
//SEG21 [93] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1
lda #$3
sta addpoint.c
//SEG22 [3] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1
//SEG22 [93] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1
ldy #$e
//SEG23 [3] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG24 [3] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1
//SEG23 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG24 [93] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1
lda #$6
jsr addpoint
//SEG25 main::@5
//SEG26 [4] call addpoint param-assignment [ ]
//SEG27 [93] phi from main::@5 to addpoint
//SEG28 [4] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1
//SEG28 [93] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1
lda #$4
sta addpoint.c
//SEG29 [4] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1
//SEG29 [93] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1
ldy #$2
//SEG30 [4] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG31 [4] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1
//SEG30 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG31 [93] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1
lda #$22
jsr addpoint
//SEG32 main::@6
//SEG33 [5] call addpoint param-assignment [ ]
//SEG34 [93] phi from main::@6 to addpoint
//SEG35 [5] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1
//SEG35 [93] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1
lda #$5
sta addpoint.c
//SEG36 [5] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1
//SEG36 [93] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1
ldy #$11
//SEG37 [5] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG38 [5] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1
//SEG37 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG38 [93] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1
lda #$15
jsr addpoint
//SEG39 main::@7
//SEG40 [6] call addpoint param-assignment [ ]
//SEG41 [93] phi from main::@7 to addpoint
//SEG42 [6] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1
//SEG42 [93] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1
lda #$7
sta addpoint.c
//SEG43 [6] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1
//SEG43 [93] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1
ldy #$16
//SEG44 [6] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG45 [6] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1
//SEG44 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG45 [93] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1
lda #$1f
jsr addpoint
//SEG46 main::@8
@ -11482,75 +11482,75 @@ FINAL CODE
main: {
//SEG5 [1] call addpoint param-assignment [ ]
//SEG6 [93] phi from main to addpoint
//SEG7 [1] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1
//SEG7 [93] phi (byte) addpoint::c#6 = (byte) 1 -- zpby1=coby1
lda #$1
sta addpoint.c
//SEG8 [1] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1
//SEG8 [93] phi (byte) addpoint::y#6 = (byte) 5 -- yby=coby1
ldy #$5
//SEG9 [1] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1
//SEG9 [93] phi (byte) numpoints#19 = (byte) 0 -- zpby1=coby1
lda #$0
sta numpoints
//SEG10 [1] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1
//SEG10 [93] phi (byte) addpoint::x#6 = (byte) 5 -- aby=coby1
lda #$5
jsr addpoint
//SEG11 main::@3
//SEG12 [2] call addpoint param-assignment [ ]
//SEG13 [93] phi from main::@3 to addpoint
//SEG14 [2] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1
//SEG14 [93] phi (byte) addpoint::c#6 = (byte) 2 -- zpby1=coby1
lda #$2
sta addpoint.c
//SEG15 [2] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1
//SEG15 [93] phi (byte) addpoint::y#6 = (byte) 8 -- yby=coby1
ldy #$8
//SEG16 [2] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG17 [2] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1
//SEG16 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG17 [93] phi (byte) addpoint::x#6 = (byte) 15 -- aby=coby1
lda #$f
jsr addpoint
//SEG18 main::@4
//SEG19 [3] call addpoint param-assignment [ ]
//SEG20 [93] phi from main::@4 to addpoint
//SEG21 [3] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1
//SEG21 [93] phi (byte) addpoint::c#6 = (byte) 3 -- zpby1=coby1
lda #$3
sta addpoint.c
//SEG22 [3] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1
//SEG22 [93] phi (byte) addpoint::y#6 = (byte) 14 -- yby=coby1
ldy #$e
//SEG23 [3] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG24 [3] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1
//SEG23 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG24 [93] phi (byte) addpoint::x#6 = (byte) 6 -- aby=coby1
lda #$6
jsr addpoint
//SEG25 main::@5
//SEG26 [4] call addpoint param-assignment [ ]
//SEG27 [93] phi from main::@5 to addpoint
//SEG28 [4] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1
//SEG28 [93] phi (byte) addpoint::c#6 = (byte) 4 -- zpby1=coby1
lda #$4
sta addpoint.c
//SEG29 [4] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1
//SEG29 [93] phi (byte) addpoint::y#6 = (byte) 2 -- yby=coby1
ldy #$2
//SEG30 [4] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG31 [4] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1
//SEG30 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG31 [93] phi (byte) addpoint::x#6 = (byte) 34 -- aby=coby1
lda #$22
jsr addpoint
//SEG32 main::@6
//SEG33 [5] call addpoint param-assignment [ ]
//SEG34 [93] phi from main::@6 to addpoint
//SEG35 [5] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1
//SEG35 [93] phi (byte) addpoint::c#6 = (byte) 5 -- zpby1=coby1
lda #$5
sta addpoint.c
//SEG36 [5] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1
//SEG36 [93] phi (byte) addpoint::y#6 = (byte) 17 -- yby=coby1
ldy #$11
//SEG37 [5] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG38 [5] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1
//SEG37 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG38 [93] phi (byte) addpoint::x#6 = (byte) 21 -- aby=coby1
lda #$15
jsr addpoint
//SEG39 main::@7
//SEG40 [6] call addpoint param-assignment [ ]
//SEG41 [93] phi from main::@7 to addpoint
//SEG42 [6] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1
//SEG42 [93] phi (byte) addpoint::c#6 = (byte) 7 -- zpby1=coby1
lda #$7
sta addpoint.c
//SEG43 [6] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1
//SEG43 [93] phi (byte) addpoint::y#6 = (byte) 22 -- yby=coby1
ldy #$16
//SEG44 [6] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG45 [6] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1
//SEG44 [93] phi (byte) numpoints#19 = (byte) numpoints#1 -- register_copy
//SEG45 [93] phi (byte) addpoint::x#6 = (byte) 31 -- aby=coby1
lda #$1f
jsr addpoint
//SEG46 main::@8

View File

@ -1628,10 +1628,10 @@ Uplift Scope [sum] 13: zp ZP_BYTE:7 [ sum::c#0 ] 4.33: zp ZP_BYTE:18 [ sum::retu
Uplift Scope [sum2] 13: zp ZP_BYTE:13 [ sum2::c#0 ] 4.33: zp ZP_BYTE:16 [ sum2::return#0 ] 4: zp ZP_BYTE:15 [ sum2::$0 ] 2.17: zp ZP_BYTE:12 [ sum2::b#0 ] 1.86: zp ZP_BYTE:11 [ sum2::a#0 ]
Uplift Scope []
Uplifting [main] best 1100 combination reg byte a [ main::$2 ] reg byte a [ main::$5 ] reg byte y [ main::i#2 main::i#1 ] reg byte x [ main::$0 ] reg byte a [ main::$1 ] reg byte x [ main::$3 ] reg byte a [ main::$4 ]
Uplifting [sum] best 970 combination zp ZP_BYTE:7 [ sum::c#0 ] reg byte a [ sum::return#0 ] reg byte a [ sum::$0 ] reg byte x [ sum::b#0 ] reg byte y [ sum::a#0 ]
Uplifting [sum2] best 840 combination zp ZP_BYTE:13 [ sum2::c#0 ] reg byte a [ sum2::return#0 ] reg byte a [ sum2::$0 ] reg byte x [ sum2::b#0 ] reg byte y [ sum2::a#0 ]
Uplifting [] best 840 combination
Uplifting [main] best 1012 combination reg byte a [ main::$2 ] reg byte a [ main::$5 ] reg byte y [ main::i#2 main::i#1 ] reg byte x [ main::$0 ] reg byte a [ main::$1 ] reg byte x [ main::$3 ] reg byte a [ main::$4 ]
Uplifting [sum] best 915 combination zp ZP_BYTE:7 [ sum::c#0 ] reg byte a [ sum::return#0 ] reg byte a [ sum::$0 ] reg byte x [ sum::b#0 ] reg byte y [ sum::a#0 ]
Uplifting [sum2] best 818 combination zp ZP_BYTE:13 [ sum2::c#0 ] reg byte a [ sum2::return#0 ] reg byte a [ sum2::$0 ] reg byte x [ sum2::b#0 ] reg byte y [ sum2::a#0 ]
Uplifting [] best 818 combination
Coalescing zero page register [ zp ZP_BYTE:7 [ sum::c#0 ] ] with [ zp ZP_BYTE:13 [ sum2::c#0 ] ]
Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:2 [ sum::c#0 sum2::c#0 ]
Removing instruction jmp bend