1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-01-26 15:30:28 +00:00

Finally new live ranges are working correctly - including effective live ranges for statements inside methods.

This commit is contained in:
Jesper Gravgaard 2017-09-06 18:59:53 +02:00
parent 99088aef58
commit 616311daf8
57 changed files with 7876 additions and 6096 deletions

View File

@ -5,8 +5,8 @@ TODO's for new Constant Solution
- Implement constants into the symbol table and support them in code.
- Implement new constant consolidation steps.
- Look at optimizing liverange.kc's ASM further - atm. there are to many copy-operations into unnecesary registers.
- In summin.asm the result of the 2nd sum() is clobbered twice during call to sum(). jsr sum, txa, lda #$d, ldx #$9, jsr sum
- Fix by introducing "effective alive vars" which includes alive vars at all calls to containing methods and using that during clobber check.
+ In summin.asm the result of the 2nd sum() is clobbered twice during call to sum(). jsr sum, txa, lda #$d, ldx #$9, jsr sum
+ Fix by introducing "effective alive vars" which includes alive vars at all calls to containing methods and using that during clobber check.
+ In loopnest.asm x&y are used in both loops - the outer x&y are clobbered by the inner loop.
- In voronoi.asm in render() x is clobbered during call to findcol().

View File

@ -1,18 +1,19 @@
package dk.camelot64.kickc.icl;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.*;
/** Live ranges for all variables.
* Created by * Created by {@link dk.camelot64.kickc.passes.Pass3CallGraphAnalysis}
* Created by {@link dk.camelot64.kickc.passes.Pass3CallGraphAnalysis}
*/
public class LiveRangeVariables {
private LinkedHashMap<VariableRef, LiveRange> liveRanges;
public LiveRangeVariables() {
private Program program;
public LiveRangeVariables(Program program) {
this.liveRanges = new LinkedHashMap<>();
this.program = program;
}
/** Add a single statement to the live range of a variable.
@ -67,4 +68,40 @@ public class LiveRangeVariables {
return liveRanges.get(variable);
}
/**
* Get all variables alive at a statement.
* If the statement is inside a method this also includes all variables alive at the exit of the calls.
* <p>
* This method requires a number of other analysis to be present and updated in the (global) program - especailly the Call Graph.
* </p>
* @param statement The statement to examine
* @return All variables alive at the statement
*/
public Collection<VariableRef> getAliveEffective(Statement statement) {
// Get variables alive from live range analysis
Collection<VariableRef> effectiveAlive = new LinkedHashSet<>();
effectiveAlive.addAll(getAlive(statement));
// If the statement is inside a method recurse back to all calls
// For each call add the variables alive after the call that are not referenced (used/defined) inside the method
ControlFlowBlock block = program.getGraph().getBlockFromStatementIdx(statement.getIndex());
ScopeRef scopeRef = block.getScope();
Scope scope = program.getScope().getScope(scopeRef);
if (scope instanceof Procedure) {
Procedure procedure = (Procedure) scope;
Collection<CallGraph.CallBlock.Call> callers =
program.getCallGraph().getCallers(procedure.getLabel().getRef());
VariableReferenceInfo referenceInfo = new VariableReferenceInfo(program);
Collection<VariableRef> referencedInProcedure = referenceInfo.getReferenced(procedure.getRef().getLabelRef());
for (CallGraph.CallBlock.Call caller : callers) {
StatementCall callStatement =
(StatementCall) program.getGraph().getStatementByIndex(caller.getCallStatementIdx());
Set<VariableRef> callAliveEffective = new LinkedHashSet<>(getAliveEffective(callStatement));
// Clear out any variables referenced in the method
callAliveEffective.removeAll(referencedInProcedure);
effectiveAlive.addAll(callAliveEffective);
}
}
return effectiveAlive;
}
}

View File

@ -0,0 +1,199 @@
package dk.camelot64.kickc.icl;
import java.util.*;
/** Information about variable referenced/used/defined in statements/blocks */
public class VariableReferenceInfo {
private Program program;
public VariableReferenceInfo(Program program) {
this.program = program;
}
public Program getProgram() {
return program;
}
/**
* Get all variables used or defined inside a block and its successors (including any called method)
* @param labelRef The block to examine
* @return All used variables
*/
public Collection<VariableRef> getReferenced(LabelRef labelRef) {
return getReferenced(labelRef, new ArrayList<LabelRef>());
}
/**
* Get all variables used inside a block and its successors (including any called method)
* @param labelRef The block to examine
* @return All used variables
*/
public Collection<VariableRef> getUsed(LabelRef labelRef) {
return getUsed(labelRef, new ArrayList<LabelRef>());
}
/**
* Get all variables used inside a block and its successors (including any called method)
* @param labelRef The block to examine
* @param visited The blocks already visited during the search. Used to stop infinite recursion
* @return All used variables
*/
private Collection<VariableRef> getUsed(LabelRef labelRef, Collection<LabelRef> visited) {
if (labelRef == null) {
return new ArrayList<>();
}
if (visited.contains(labelRef)) {
return new ArrayList<>();
}
visited.add(labelRef);
ControlFlowBlock block = getProgram().getGraph().getBlock(labelRef);
if (block == null) {
return new ArrayList<>();
}
LinkedHashSet<VariableRef> used = new LinkedHashSet<>();
for (Statement statement : block.getStatements()) {
used.addAll(getUsed(statement));
if (statement instanceof StatementCall) {
ProcedureRef procedure = ((StatementCall) statement).getProcedure();
used.addAll(getUsed(procedure.getLabelRef(), visited));
}
}
used.addAll(getUsed(block.getDefaultSuccessor(), visited));
used.addAll(getUsed(block.getConditionalSuccessor(), visited));
return used;
}
/**
* Get all variables used or defined inside a block and its successors (including any called method)
* @param labelRef The block to examine
* @param visited The blocks already visited during the search. Used to stop infinite recursion
* @return All used variables
*/
private Collection<VariableRef> getReferenced(LabelRef labelRef, Collection<LabelRef> visited) {
if (labelRef == null) {
return new ArrayList<>();
}
if (visited.contains(labelRef)) {
return new ArrayList<>();
}
visited.add(labelRef);
ControlFlowBlock block = getProgram().getGraph().getBlock(labelRef);
if (block == null) {
return new ArrayList<>();
}
LinkedHashSet<VariableRef> referenced = new LinkedHashSet<>();
for (Statement statement : block.getStatements()) {
referenced.addAll(getReferenced(statement));
if (statement instanceof StatementCall) {
ProcedureRef procedure = ((StatementCall) statement).getProcedure();
referenced.addAll(getReferenced(procedure.getLabelRef(), visited));
}
}
referenced.addAll(getReferenced(block.getDefaultSuccessor(), visited));
referenced.addAll(getReferenced(block.getConditionalSuccessor(), visited));
return referenced;
}
/**
* Get the variables defined by a statement
* @param stmt The statement
* @return Variables defined by the statement
*/
public Collection<VariableRef> getDefined(Statement stmt) {
if (stmt instanceof StatementAssignment) {
StatementAssignment assignment = (StatementAssignment) stmt;
LValue lValue = assignment.getlValue();
if (lValue instanceof VariableRef) {
return Arrays.asList((VariableRef) lValue);
}
} else if (stmt instanceof StatementPhiBlock) {
List<VariableRef> defined = new ArrayList<>();
StatementPhiBlock phi = (StatementPhiBlock) stmt;
for (StatementPhiBlock.PhiVariable phiVariable : phi.getPhiVariables()) {
defined.add(phiVariable.getVariable());
}
return defined;
}
return new ArrayList<>();
}
/**
* Get the variables used, but not defined, in a statement
* @param statement The statement to examine
* @return The used variables (not including defined variables)
*/
public Collection<VariableRef> getUsed(Statement statement) {
LinkedHashSet<VariableRef> used = new LinkedHashSet<>();
used.addAll(getReferenced(statement));
used.removeAll(getDefined(statement));
return used;
}
/**
* Get the variables referenced (used or defined) in a statement
* @param statement The statement to examine
* @return The referenced variables
*/
public Collection<VariableRef> getReferenced(Statement statement) {
LinkedHashSet<VariableRef> referenced = new LinkedHashSet<>();
if (statement instanceof StatementPhiBlock) {
StatementPhiBlock phiBlock = (StatementPhiBlock) statement;
for (StatementPhiBlock.PhiVariable phiVariable : phiBlock.getPhiVariables()) {
referenced.add(phiVariable.getVariable());
for (StatementPhiBlock.PhiRValue phiRValue : phiVariable.getValues()) {
referenced.addAll(getReferenced(phiRValue.getrValue()));
}
}
} else if (statement instanceof StatementAssignment) {
StatementAssignment assignment = (StatementAssignment) statement;
referenced.addAll(getReferenced(assignment.getlValue()));
referenced.addAll(getReferenced(assignment.getrValue1()));
referenced.addAll(getReferenced(assignment.getrValue2()));
} else if (statement instanceof StatementConditionalJump) {
StatementConditionalJump conditionalJump = (StatementConditionalJump) statement;
referenced.addAll(getReferenced(conditionalJump.getrValue1()));
referenced.addAll(getReferenced(conditionalJump.getrValue2()));
} else if (statement instanceof StatementCall) {
StatementCall call = (StatementCall) statement;
referenced.addAll(getReferenced(call.getlValue()));
if (call.getParameters() != null) {
for (RValue param : call.getParameters()) {
referenced.addAll(getReferenced(param));
}
}
} else if (statement instanceof StatementReturn) {
StatementReturn statementReturn = (StatementReturn) statement;
referenced.addAll(getReferenced(statementReturn.getValue()));
} else {
throw new RuntimeException("Unknown statement type " + statement);
}
return referenced;
}
/**
* Get all variables referenced in an rValue
* @param rValue The rValue
* @return All referenced variables
*/
private Collection<VariableRef> getReferenced(RValue rValue) {
if (rValue == null) {
return new ArrayList<>();
} else if (rValue instanceof Constant) {
return new ArrayList<>();
} else if (rValue instanceof PointerDereferenceSimple) {
return getReferenced(((PointerDereferenceSimple) rValue).getPointer());
} else if (rValue instanceof PointerDereferenceIndexed) {
Collection<VariableRef> used = new LinkedHashSet<>();
used.addAll(getReferenced(((PointerDereferenceIndexed) rValue).getPointer()));
used.addAll(getReferenced(((PointerDereferenceIndexed) rValue).getIndex()));
return used;
} else if (rValue instanceof VariableRef) {
return Arrays.asList((VariableRef) rValue);
} else {
throw new RuntimeException("Unhandled RValue type " + rValue);
}
}
}

View File

@ -15,7 +15,7 @@ public class Pass3LiveRangesAnalysis extends Pass2Base {
}
public void findLiveRanges() {
LiveRangeVariables liveRanges = new LiveRangeVariables();
LiveRangeVariables liveRanges = new LiveRangeVariables(getProgram());
boolean propagating;
do {
propagating = calculateLiveRanges(liveRanges);
@ -51,11 +51,12 @@ public class Pass3LiveRangesAnalysis extends Pass2Base {
* @return true if any live ranges was modified. false if no modification was performed (and the propagation is complete)
*/
private boolean calculateLiveRanges(LiveRangeVariables liveRanges) {
VariableReferenceInfo referenceInfo = new VariableReferenceInfo(getProgram());
boolean modified = false;
for (ControlFlowBlock block : getProgram().getGraph().getAllBlocks()) {
for (Statement stmt : block.getStatements()) {
List<VariableRef> aliveNextStmt = liveRanges.getAlive(stmt);
Collection<VariableRef> definedNextStmt = getDefined(stmt);
Collection<VariableRef> definedNextStmt = referenceInfo.getDefined(stmt);
initLiveRange(liveRanges, definedNextStmt);
Collection<PreviousStatement> previousStmts = getPreviousStatements(stmt);
for (PreviousStatement previousStmt : previousStmts) {
@ -76,7 +77,7 @@ public class Pass3LiveRangesAnalysis extends Pass2Base {
// Add all vars that are referenced in the method
StatementCall call = (StatementCall) stmt;
ProcedureRef procedure = call.getProcedure();
Collection<VariableRef> procUsed = getReferenced(procedure.getLabelRef());
Collection<VariableRef> procUsed = referenceInfo.getReferenced(procedure.getLabelRef());
// The call statement has no used or defined by itself so only work with the alive vars
for (VariableRef aliveVar : aliveNextStmt) {
// Add all variables to previous that are not used inside the method
@ -92,7 +93,7 @@ public class Pass3LiveRangesAnalysis extends Pass2Base {
// Add all vars that the method does not use
StatementCall call = (StatementCall) stmt;
ProcedureRef procedure = call.getProcedure();
Collection<VariableRef> procUsed = getReferenced(procedure.getLabelRef());
Collection<VariableRef> procUsed = referenceInfo.getReferenced(procedure.getLabelRef());
// The call statement has no used or defined by itself so only work with the alive vars
for (VariableRef aliveVar : aliveNextStmt) {
// Add all variables to previous that are not used inside the method
@ -110,7 +111,7 @@ public class Pass3LiveRangesAnalysis extends Pass2Base {
// Add all alive variables to previous that are used inside the method
ControlFlowBlock procBlock = getProgram().getGraph().getBlockFromStatementIdx(stmt.getIndex());
Procedure procedure = (Procedure) getProgram().getScope().getSymbol(procBlock.getLabel());
Collection<VariableRef> procUsed = getUsed(procedure.getRef().getLabelRef());
Collection<VariableRef> procUsed = referenceInfo.getUsed(procedure.getRef().getLabelRef());
// The call statement has no used or defined by itself so only work with the alive vars
for (VariableRef aliveVar : aliveNextStmt) {
// Add all variables to previous that are used inside the method
@ -146,7 +147,8 @@ public class Pass3LiveRangesAnalysis extends Pass2Base {
Statement stmt,
PreviousStatement previousStmt) {
boolean modified = false;
Collection<VariableRef> usedNextStmt = getUsed(stmt);
VariableReferenceInfo referenceInfo = new VariableReferenceInfo(getProgram());
Collection<VariableRef> usedNextStmt = referenceInfo.getUsed(stmt);
if (stmt instanceof StatementPhiBlock) {
// If current statement is a phi add the used variables to previous based on the phi entries
StatementPhiBlock phi = (StatementPhiBlock) stmt;
@ -179,185 +181,6 @@ public class Pass3LiveRangesAnalysis extends Pass2Base {
return modified;
}
/**
* Get all variables used or defined inside a block and its successors (including any called method)
* @param labelRef The block to examine
* @return All used variables
*/
private Collection<VariableRef> getReferenced(LabelRef labelRef) {
return getReferenced(labelRef, new ArrayList<LabelRef>());
}
/**
* Get all variables used inside a block and its successors (including any called method)
* @param labelRef The block to examine
* @return All used variables
*/
private Collection<VariableRef> getUsed(LabelRef labelRef) {
return getUsed(labelRef, new ArrayList<LabelRef>());
}
/**
* Get all variables used inside a block and its successors (including any called method)
* @param labelRef The block to examine
* @param visited The blocks already visited during the search. Used to stop infinite recursion
* @return All used variables
*/
private Collection<VariableRef> getUsed(LabelRef labelRef, Collection<LabelRef> visited) {
if (labelRef == null) {
return new ArrayList<>();
}
if (visited.contains(labelRef)) {
return new ArrayList<>();
}
visited.add(labelRef);
ControlFlowBlock block = getProgram().getGraph().getBlock(labelRef);
if (block == null) {
return new ArrayList<>();
}
LinkedHashSet<VariableRef> used = new LinkedHashSet<>();
for (Statement statement : block.getStatements()) {
used.addAll(getUsed(statement));
if (statement instanceof StatementCall) {
ProcedureRef procedure = ((StatementCall) statement).getProcedure();
used.addAll(getUsed(procedure.getLabelRef(), visited));
}
}
used.addAll(getUsed(block.getDefaultSuccessor(), visited));
used.addAll(getUsed(block.getConditionalSuccessor(), visited));
return used;
}
/**
* Get all variables used or defined inside a block and its successors (including any called method)
* @param labelRef The block to examine
* @param visited The blocks already visited during the search. Used to stop infinite recursion
* @return All used variables
*/
private Collection<VariableRef> getReferenced(LabelRef labelRef, Collection<LabelRef> visited) {
if (labelRef == null) {
return new ArrayList<>();
}
if (visited.contains(labelRef)) {
return new ArrayList<>();
}
visited.add(labelRef);
ControlFlowBlock block = getProgram().getGraph().getBlock(labelRef);
if (block == null) {
return new ArrayList<>();
}
LinkedHashSet<VariableRef> referenced = new LinkedHashSet<>();
for (Statement statement : block.getStatements()) {
referenced.addAll(getReferenced(statement));
if (statement instanceof StatementCall) {
ProcedureRef procedure = ((StatementCall) statement).getProcedure();
referenced.addAll(getReferenced(procedure.getLabelRef(), visited));
}
}
referenced.addAll(getReferenced(block.getDefaultSuccessor(), visited));
referenced.addAll(getReferenced(block.getConditionalSuccessor(), visited));
return referenced;
}
/**
* Get the variables defined by a statement
* @param stmt The statement
* @return Variables defined by the statement
*/
private Collection<VariableRef> getDefined(Statement stmt) {
if (stmt instanceof StatementAssignment) {
StatementAssignment assignment = (StatementAssignment) stmt;
LValue lValue = assignment.getlValue();
if (lValue instanceof VariableRef) {
return Arrays.asList((VariableRef) lValue);
}
} else if (stmt instanceof StatementPhiBlock) {
List<VariableRef> defined = new ArrayList<>();
StatementPhiBlock phi = (StatementPhiBlock) stmt;
for (StatementPhiBlock.PhiVariable phiVariable : phi.getPhiVariables()) {
defined.add(phiVariable.getVariable());
}
return defined;
}
return new ArrayList<>();
}
/**
* Get the variables used, but not defined, in a statement
* @param statement The statement to examine
* @return The used variables (not including defined variables)
*/
private Collection<VariableRef> getUsed(Statement statement) {
LinkedHashSet<VariableRef> used = new LinkedHashSet<>();
used.addAll(getReferenced(statement));
used.removeAll(getDefined(statement));
return used;
}
/**
* Get the variables referenced (used or defined) in a statement
* @param statement The statement to examine
* @return The referenced variables
*/
private Collection<VariableRef> getReferenced(Statement statement) {
LinkedHashSet<VariableRef> referenced = new LinkedHashSet<>();
if (statement instanceof StatementPhiBlock) {
StatementPhiBlock phiBlock = (StatementPhiBlock) statement;
for (StatementPhiBlock.PhiVariable phiVariable : phiBlock.getPhiVariables()) {
referenced.add(phiVariable.getVariable());
for (StatementPhiBlock.PhiRValue phiRValue : phiVariable.getValues()) {
referenced.addAll(getReferenced(phiRValue.getrValue()));
}
}
} else if (statement instanceof StatementAssignment) {
StatementAssignment assignment = (StatementAssignment) statement;
referenced.addAll(getReferenced(assignment.getlValue()));
referenced.addAll(getReferenced(assignment.getrValue1()));
referenced.addAll(getReferenced(assignment.getrValue2()));
} else if (statement instanceof StatementConditionalJump) {
StatementConditionalJump conditionalJump = (StatementConditionalJump) statement;
referenced.addAll(getReferenced(conditionalJump.getrValue1()));
referenced.addAll(getReferenced(conditionalJump.getrValue2()));
} else if (statement instanceof StatementCall) {
StatementCall call = (StatementCall) statement;
referenced.addAll(getReferenced(call.getlValue()));
if (call.getParameters() != null) {
for (RValue param : call.getParameters()) {
referenced.addAll(getReferenced(param));
}
}
} else if (statement instanceof StatementReturn) {
StatementReturn statementReturn = (StatementReturn) statement;
referenced.addAll(getReferenced(statementReturn.getValue()));
} else {
throw new RuntimeException("Unknown statement type " + statement);
}
return referenced;
}
/**
* Get all variables referenced in an rValue
* @param rValue The rValue
* @return All referenced variables
*/
private Collection<VariableRef> getReferenced(RValue rValue) {
if (rValue == null) {
return new ArrayList<>();
} else if (rValue instanceof Constant) {
return new ArrayList<>();
} else if (rValue instanceof PointerDereferenceSimple) {
return getReferenced(((PointerDereferenceSimple) rValue).getPointer());
} else if (rValue instanceof PointerDereferenceIndexed) {
Collection<VariableRef> used = new LinkedHashSet<>();
used.addAll(getReferenced(((PointerDereferenceIndexed) rValue).getPointer()));
used.addAll(getReferenced(((PointerDereferenceIndexed) rValue).getIndex()));
return used;
} else if (rValue instanceof VariableRef) {
return Arrays.asList((VariableRef) rValue);
} else {
throw new RuntimeException("Unhandled RValue type " + rValue);
}
}
/** A statement just before the current statement. */
@ -383,7 +206,7 @@ public class Pass3LiveRangesAnalysis extends Pass2Base {
SKIP_METHOD
}
public PreviousStatement(Statement statement, Type type) {
PreviousStatement(Statement statement, Type type) {
this.statement = statement;
this.type = type;
}
@ -456,7 +279,9 @@ public class Pass3LiveRangesAnalysis extends Pass2Base {
LiveRange lValLiveRange = liveRanges.getLiveRange(variableRef);
if (lValLiveRange == null) {
liveRanges.addEmptyAlive(variableRef);
getProgram().getLog().append("Adding empty live range for unused variable " + variableRef);
if(getProgram().getLog().isVerboseLiveRanges()) {
getProgram().getLog().append("Adding empty live range for unused variable " + variableRef);
}
}
}
}

View File

@ -31,7 +31,6 @@ public class Pass4AssertNoCpuClobber extends Pass2Base {
* @return true if there is a clobber problem in the program
*/
public boolean hasClobberProblem(boolean verbose) {
LiveRangeVariables liveRangeVariables = getProgram().getLiveRangeVariables();
AsmProgram asm = getProgram().getAsm();
boolean clobberProblem = false;
for (AsmSegment asmSegment : asm.getSegments()) {
@ -65,7 +64,7 @@ public class Pass4AssertNoCpuClobber extends Pass2Base {
}
// Find alive variables
List<VariableRef> aliveVars = new ArrayList<>(liveRangeVariables.getAlive(statement));
List<VariableRef> aliveVars = new ArrayList<>(getProgram().getLiveRangeVariables().getAliveEffective(statement));
// Non-assigned alive variables must not be clobbered
for (VariableRef aliveVar : aliveVars) {
Registers.Register aliveVarRegister = getProgram().getScope().getVariable(aliveVar).getAllocation();

View File

@ -219,9 +219,8 @@ public class Pass4RegisterUpliftCombinations extends Pass2Base {
Program program,
Statement statement,
LinkedHashMap<Registers.Register, LiveRangeEquivalenceClass> usedRegisters) {
LiveRangeVariables liveRangeVariables = program.getLiveRangeVariables();
ProgramScope programScope = program.getScope();
List<VariableRef> alive = liveRangeVariables.getAlive(statement);
Collection<VariableRef> alive = program.getLiveRangeVariables().getAliveEffective(statement);
for (VariableRef varRef : alive) {
Variable var = programScope.getVariable(varRef);
Registers.Register allocation = var.getAllocation();
@ -238,23 +237,7 @@ public class Pass4RegisterUpliftCombinations extends Pass2Base {
program.getLiveRangeEquivalenceClassSet().getEquivalenceClass(varRef);
usedRegisters.put(allocation, varClass);
}
// If the statement is inside a method -also check against all variables alive at the exit of the calls.
ControlFlowBlock block = program.getGraph().getBlockFromStatementIdx(statement.getIndex());
ScopeRef scopeRef = block.getScope();
Scope scope = program.getScope().getScope(scopeRef);
if (scope instanceof Procedure) {
Procedure procedure = (Procedure) scope;
Collection<CallGraph.CallBlock.Call> callers =
program.getCallGraph().getCallers(procedure.getLabel().getRef());
for (CallGraph.CallBlock.Call caller : callers) {
StatementCall callStatement =
(StatementCall) program.getGraph().getStatementByIndex(caller.getCallStatementIdx());
if (isStatementAllocationOverlapping(program, callStatement, usedRegisters)) {
return true;
}
}
}
return false;
}
}

View File

@ -51,12 +51,13 @@ public class Pass4RegisterUpliftPotentialRegisterAnalysis extends Pass2Base {
}
}
VariableReferenceInfo referenceInfo = new VariableReferenceInfo(getProgram());
for (ControlFlowBlock block : getProgram().getGraph().getAllBlocks()) {
for (Statement statement : block.getStatements()) {
// Find all variables referenced/assigned in the statement
Set<VariableRef> referencedVars = getReferencedVars(statement);
Set<VariableRef> assignedVars = getAssignedVars(statement);
Set<VariableRef> referencedVars = new HashSet<>(referenceInfo.getReferenced(statement));
Set<VariableRef> assignedVars = new HashSet<>(referenceInfo.getDefined(statement));
// Find referenced/assigned live range equivalence classes
Set<LiveRangeEquivalenceClass> assignedClasses = new LinkedHashSet<>();
@ -89,7 +90,7 @@ public class Pass4RegisterUpliftPotentialRegisterAnalysis extends Pass2Base {
}
// For all non-assigned live variables: remove always clobbered registers from their potential allocation
List<VariableRef> aliveVars = getProgram().getLiveRangeVariables().getAlive(statement);
Collection<VariableRef> aliveVars = getProgram().getLiveRangeVariables().getAliveEffective(statement);
for (VariableRef aliveVar : aliveVars) {
LiveRangeEquivalenceClass aliveClass = liveRangeEquivalenceClassSet.getEquivalenceClass(aliveVar);
if (assignedClasses.contains(aliveClass)) {

View File

@ -37,6 +37,17 @@ public class Pass4RegisterUpliftStatic extends Pass2Base {
setRegister(combination, "inccnt::return#0", Registers.getRegisterA());
*/
// Good combination for liverange.kc
setRegister(combination, "inc::$0", Registers.getRegisterX());
setRegister(combination, "main::$0", Registers.getRegisterA());
setRegister(combination, "inc::return#0", Registers.getRegisterA());
setRegister(combination, "main::a#1", new Registers.RegisterZpByte(2));
setRegister(combination, "main::$2", Registers.getRegisterA());
setRegister(combination, "main::a#2", Registers.getRegisterA());
setRegister(combination, "i#11", Registers.getRegisterX());
setRegister(combination, "inc::$0", Registers.getRegisterX());
boolean success = Pass4RegisterUpliftCombinations.generateCombinationAsm(
combination,
getProgram(),

View File

@ -3,29 +3,30 @@
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@2
[1] (byte) main::y#2 ← phi( main/(byte) 0 main::@2/(byte) main::y#4 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[1] (byte) main::e#3 ← phi( main/(byte) 12 main::@2/(byte) main::e#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[1] (byte) main::x#2 ← phi( main/(byte) 0 main::@2/(byte) main::x#1 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[1] (byte*) main::cursor#3 ← phi( main/(word) 1024 main::@2/(byte*) main::cursor#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ]
[4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ]
[5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ]
[6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ]
[2] (byte) main::y#2 ← phi( main/(byte) 0 main::@2/(byte) main::y#4 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[2] (byte) main::e#3 ← phi( main/(byte) 12 main::@2/(byte) main::e#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[2] (byte) main::x#2 ← phi( main/(byte) 0 main::@2/(byte) main::x#1 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[2] (byte*) main::cursor#3 ← phi( main/(word) 1024 main::@2/(byte*) main::cursor#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ]
[5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ]
[6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ]
[7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ]
to:main::@3
main::@3: scope:[main] from main::@1
[7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ]
[8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ]
[9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ]
[8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ]
[9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ]
[10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ]
to:main::@2
main::@2: scope:[main] from main::@1 main::@3
[10] (byte) main::y#4 ← phi( main::@1/(byte) main::y#2 main::@3/(byte) main::y#1 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[10] (byte) main::e#5 ← phi( main::@1/(byte) main::e#1 main::@3/(byte) main::e#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[10] (byte*) main::cursor#5 ← phi( main::@1/(byte*) main::cursor#1 main::@3/(byte*) main::cursor#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[11] (byte) main::y#4 ← phi( main::@1/(byte) main::y#2 main::@3/(byte) main::y#1 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[11] (byte) main::e#5 ← phi( main::@1/(byte) main::e#1 main::@3/(byte) main::e#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[11] (byte*) main::cursor#5 ← phi( main::@1/(byte*) main::cursor#1 main::@3/(byte*) main::cursor#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
to:main::@return
main::@return: scope:[main] from main::@2
[12] return [ ]
[13] return [ ]
to:@return

View File

@ -1332,6 +1332,10 @@ main::@6: scope:[main] from main::@1
(byte~) main::y#6 ← (byte) main::y#2
to:main::@2
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to 0:main
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
@ -1339,68 +1343,72 @@ Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@5
[1] (byte) main::y#2 ← phi( main/(byte) 0 main::@5/(byte~) main::y#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[1] (byte) main::e#3 ← phi( main/(byte) 12 main::@5/(byte~) main::e#6 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[1] (byte) main::x#2 ← phi( main/(byte) 0 main::@5/(byte~) main::x#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[1] (byte*) main::cursor#3 ← phi( main/(word) 1024 main::@5/(byte*~) main::cursor#6 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ]
[4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::cursor#1 main::x#1 ]
[5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::e#1 main::y#2 main::cursor#1 main::x#1 ]
[6] if((byte) 39>=(byte) main::e#1) goto main::@6 [ main::e#1 main::y#2 main::cursor#1 main::x#1 ]
[2] (byte) main::y#2 ← phi( main/(byte) 0 main::@5/(byte~) main::y#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[2] (byte) main::e#3 ← phi( main/(byte) 12 main::@5/(byte~) main::e#6 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[2] (byte) main::x#2 ← phi( main/(byte) 0 main::@5/(byte~) main::x#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[2] (byte*) main::cursor#3 ← phi( main/(word) 1024 main::@5/(byte*~) main::cursor#6 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ]
[5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ]
[6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ]
[7] if((byte) 39>=(byte) main::e#1) goto main::@6 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ]
to:main::@3
main::@3: scope:[main] from main::@1
[7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::e#1 main::cursor#1 main::y#1 main::x#1 ]
[8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::e#1 main::cursor#2 main::y#1 main::x#1 ]
[9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::cursor#2 main::e#2 main::y#1 main::x#1 ]
[10] (byte*~) main::cursor#8 ← (byte*) main::cursor#2 [ main::e#2 main::y#1 main::cursor#8 main::x#1 ]
[11] (byte~) main::e#8 ← (byte) main::e#2 [ main::y#1 main::cursor#8 main::e#8 main::x#1 ]
[12] (byte~) main::y#7 ← (byte) main::y#1 [ main::cursor#8 main::e#8 main::y#7 main::x#1 ]
[8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ]
[9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ]
[10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ]
[11] (byte*~) main::cursor#8 ← (byte*) main::cursor#2 [ main::x#1 main::y#1 main::e#2 main::cursor#8 ]
[12] (byte~) main::e#8 ← (byte) main::e#2 [ main::x#1 main::y#1 main::cursor#8 main::e#8 ]
[13] (byte~) main::y#7 ← (byte) main::y#1 [ main::x#1 main::cursor#8 main::e#8 main::y#7 ]
to:main::@2
main::@2: scope:[main] from main::@3 main::@6
[13] (byte) main::y#4 ← phi( main::@6/(byte~) main::y#6 main::@3/(byte~) main::y#7 ) [ main::x#1 main::cursor#5 main::e#5 main::y#4 ]
[13] (byte) main::e#5 ← phi( main::@6/(byte~) main::e#7 main::@3/(byte~) main::e#8 ) [ main::x#1 main::cursor#5 main::e#5 main::y#4 ]
[13] (byte*) main::cursor#5 ← phi( main::@6/(byte*~) main::cursor#7 main::@3/(byte*~) main::cursor#8 ) [ main::x#1 main::cursor#5 main::e#5 main::y#4 ]
[14] if((byte) main::x#1<(byte) 40) goto main::@5 [ main::x#1 main::cursor#5 main::e#5 main::y#4 ]
[14] (byte) main::y#4 ← phi( main::@6/(byte~) main::y#6 main::@3/(byte~) main::y#7 ) [ main::x#1 main::cursor#5 main::e#5 main::y#4 ]
[14] (byte) main::e#5 ← phi( main::@6/(byte~) main::e#7 main::@3/(byte~) main::e#8 ) [ main::x#1 main::cursor#5 main::e#5 main::y#4 ]
[14] (byte*) main::cursor#5 ← phi( main::@6/(byte*~) main::cursor#7 main::@3/(byte*~) main::cursor#8 ) [ main::x#1 main::cursor#5 main::e#5 main::y#4 ]
[15] if((byte) main::x#1<(byte) 40) goto main::@5 [ main::x#1 main::cursor#5 main::e#5 main::y#4 ]
to:main::@return
main::@return: scope:[main] from main::@2
[15] return [ ]
[16] return [ ]
to:@return
main::@5: scope:[main] from main::@2
[16] (byte*~) main::cursor#6 ← (byte*) main::cursor#5 [ main::cursor#6 main::x#1 main::e#5 main::y#4 ]
[17] (byte~) main::x#5 ← (byte) main::x#1 [ main::cursor#6 main::x#5 main::e#5 main::y#4 ]
[18] (byte~) main::e#6 ← (byte) main::e#5 [ main::cursor#6 main::x#5 main::e#6 main::y#4 ]
[19] (byte~) main::y#5 ← (byte) main::y#4 [ main::cursor#6 main::x#5 main::e#6 main::y#5 ]
[17] (byte*~) main::cursor#6 ← (byte*) main::cursor#5 [ main::cursor#6 main::x#1 main::e#5 main::y#4 ]
[18] (byte~) main::x#5 ← (byte) main::x#1 [ main::cursor#6 main::x#5 main::e#5 main::y#4 ]
[19] (byte~) main::e#6 ← (byte) main::e#5 [ main::cursor#6 main::x#5 main::e#6 main::y#4 ]
[20] (byte~) main::y#5 ← (byte) main::y#4 [ main::cursor#6 main::x#5 main::e#6 main::y#5 ]
to:main::@1
main::@6: scope:[main] from main::@1
[20] (byte*~) main::cursor#7 ← (byte*) main::cursor#1 [ main::e#1 main::y#2 main::cursor#7 main::x#1 ]
[21] (byte~) main::e#7 ← (byte) main::e#1 [ main::y#2 main::cursor#7 main::e#7 main::x#1 ]
[22] (byte~) main::y#6 ← (byte) main::y#2 [ main::cursor#7 main::e#7 main::y#6 main::x#1 ]
[21] (byte*~) main::cursor#7 ← (byte*) main::cursor#1 [ main::y#2 main::x#1 main::e#1 main::cursor#7 ]
[22] (byte~) main::e#7 ← (byte) main::e#1 [ main::y#2 main::x#1 main::cursor#7 main::e#7 ]
[23] (byte~) main::y#6 ← (byte) main::y#2 [ main::x#1 main::cursor#7 main::e#7 main::y#6 ]
to:main::@2
Created 7 initial phi equivalence classes
Coalesced [10] main::cursor#8 ← main::cursor#2
Coalesced [11] main::e#8 ← main::e#2
Coalesced [12] main::y#7 ← main::y#1
Coalesced [16] main::cursor#6 ← main::cursor#5
Coalesced [17] main::x#5 ← main::x#1
Coalesced [18] main::e#6 ← main::e#5
Coalesced [19] main::y#5 ← main::y#4
Coalesced [20] main::cursor#7 ← main::cursor#1
Coalesced [21] main::e#7 ← main::e#1
Coalesced (already) [22] main::y#6 ← main::y#2
Coalesced [11] main::cursor#8 ← main::cursor#2
Coalesced [12] main::e#8 ← main::e#2
Coalesced [13] main::y#7 ← main::y#1
Coalesced [17] main::cursor#6 ← main::cursor#5
Coalesced [18] main::x#5 ← main::x#1
Coalesced [19] main::e#6 ← main::e#5
Coalesced [20] main::y#5 ← main::y#4
Coalesced [21] main::cursor#7 ← main::cursor#1
Coalesced [22] main::e#7 ← main::e#1
Coalesced (already) [23] main::y#6 ← main::y#2
Coalesced down to 4 phi equivalence classes
Culled Empty Block (label) main::@5
Culled Empty Block (label) main::@6
Block Sequence Planned @begin @end main main::@1 main::@3 main::@2 main::@return
Adding NOP phi() at start of main
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
@ -1413,36 +1421,34 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@2
[1] (byte) main::y#2 ← phi( main/(byte) 0 main::@2/(byte) main::y#4 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[1] (byte) main::e#3 ← phi( main/(byte) 12 main::@2/(byte) main::e#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[1] (byte) main::x#2 ← phi( main/(byte) 0 main::@2/(byte) main::x#1 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[1] (byte*) main::cursor#3 ← phi( main/(word) 1024 main::@2/(byte*) main::cursor#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ]
[4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ]
[5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ]
[6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ]
[2] (byte) main::y#2 ← phi( main/(byte) 0 main::@2/(byte) main::y#4 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[2] (byte) main::e#3 ← phi( main/(byte) 12 main::@2/(byte) main::e#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[2] (byte) main::x#2 ← phi( main/(byte) 0 main::@2/(byte) main::x#1 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[2] (byte*) main::cursor#3 ← phi( main/(word) 1024 main::@2/(byte*) main::cursor#5 ) [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ]
[4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ]
[5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ]
[6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ]
[7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ]
to:main::@3
main::@3: scope:[main] from main::@1
[7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ]
[8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ]
[9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ]
[8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ]
[9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ]
[10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ]
to:main::@2
main::@2: scope:[main] from main::@1 main::@3
[10] (byte) main::y#4 ← phi( main::@1/(byte) main::y#2 main::@3/(byte) main::y#1 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[10] (byte) main::e#5 ← phi( main::@1/(byte) main::e#1 main::@3/(byte) main::e#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[10] (byte*) main::cursor#5 ← phi( main::@1/(byte*) main::cursor#1 main::@3/(byte*) main::cursor#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[11] (byte) main::y#4 ← phi( main::@1/(byte) main::y#2 main::@3/(byte) main::y#1 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[11] (byte) main::e#5 ← phi( main::@1/(byte) main::e#1 main::@3/(byte) main::e#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[11] (byte*) main::cursor#5 ← phi( main::@1/(byte*) main::cursor#1 main::@3/(byte*) main::cursor#2 ) [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
[12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ]
to:main::@return
main::@return: scope:[main] from main::@2
[12] return [ ]
[13] return [ ]
to:@return
CALL GRAPH
Calls in [] to 0:main
DOMINATORS
@begin dominated by @begin
@end dominated by @end @begin
@ -1511,68 +1517,70 @@ INITIAL ASM
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
jmp bend
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
.label x = 4
.label cursor = 2
.label e = 5
.label y = 6
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1
//SEG7 [2] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta y
//SEG7 [1] phi (byte) main::e#3 = (byte) 12 -- zpby1=coby1
//SEG8 [2] phi (byte) main::e#3 = (byte) 12 -- zpby1=coby1
lda #$c
sta e
//SEG8 [1] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1
//SEG9 [2] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta x
//SEG9 [1] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1
//SEG10 [2] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1
lda #<$400
sta cursor
lda #>$400
sta cursor+$1
jmp b1
//SEG10 [1] phi from main::@2 to main::@1
//SEG11 [2] phi from main::@2 to main::@1
b1_from_b2:
//SEG11 [1] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
//SEG12 [1] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy
//SEG13 [1] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy
//SEG14 [1] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy
//SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
//SEG13 [2] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy
//SEG14 [2] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy
//SEG15 [2] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy
jmp b1
//SEG15 main::@1
//SEG16 main::@1
b1:
//SEG16 [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1
//SEG17 [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1
ldy #$0
lda #$51
sta (cursor),y
//SEG17 [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] -- zpby1=zpby1_plus_1
//SEG18 [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] -- zpby1=zpby1_plus_1
inc x
//SEG18 [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1
//SEG19 [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1
inc cursor
bne !+
inc cursor+$1
!:
//SEG19 [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- zpby1=zpby1_plus_coby1
//SEG20 [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- zpby1=zpby1_plus_coby1
lda e
clc
adc #$18
sta e
//SEG20 [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- coby1_ge_zpby1_then_la1
//SEG21 [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- coby1_ge_zpby1_then_la1
lda #$27
cmp e
bcs b2_from_b1
jmp b3
//SEG21 main::@3
//SEG22 main::@3
b3:
//SEG22 [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] -- zpby1=zpby1_plus_1
//SEG23 [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] -- zpby1=zpby1_plus_1
inc y
//SEG23 [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] -- zpptrby1=zpptrby1_plus_coby1
//SEG24 [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] -- zpptrby1=zpptrby1_plus_coby1
lda cursor
clc
adc #$28
@ -1580,45 +1588,45 @@ main: {
bcc !+
inc cursor+$1
!:
//SEG24 [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] -- zpby1=zpby1_minus_coby1
//SEG25 [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] -- zpby1=zpby1_minus_coby1
lda e
sec
sbc #$27
sta e
//SEG25 [10] phi from main::@1 main::@3 to main::@2
//SEG26 [11] phi from main::@1 main::@3 to main::@2
b2_from_b1:
b2_from_b3:
//SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG27 [11] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG28 [11] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG29 [11] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
jmp b2
//SEG29 main::@2
//SEG30 main::@2
b2:
//SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1
//SEG31 [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1
lda x
cmp #$28
bcc b1_from_b2
jmp breturn
//SEG31 main::@return
//SEG32 main::@return
breturn:
//SEG32 [12] return [ ]
//SEG33 [13] return [ ]
rts
}
Statement [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] always clobbers reg byte a reg byte y
Statement [3] *((byte*) main::cursor#3) ← (byte) 81 [ 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 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ]
Statement [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] always clobbers reg byte a
Statement [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] always clobbers reg byte a
Statement [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] always clobbers reg byte a
Statement [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] always clobbers reg byte a reg byte y
Statement [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] always clobbers reg byte a
Statement [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] always clobbers reg byte a
Statement [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] always clobbers reg byte a
Statement [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ 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 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] always clobbers reg byte a
Statement [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] always clobbers reg byte a reg byte y
Statement [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ 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 - (byte) 39 [ 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 ,
@ -1631,6 +1639,10 @@ Uplift Scope []
Uplifting [main] best 1165 combination reg byte x [ main::e#3 main::e#5 main::e#1 main::e#2 ] zp ZP_PTR_BYTE:2 [ main::cursor#3 main::cursor#5 main::cursor#1 main::cursor#2 ] zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] zp ZP_BYTE:4 [ main::x#2 main::x#1 ]
Uplifting [] best 1165 combination
Attempting to uplift remaining variables inzp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ]
Uplifting [main] best 1165 combination zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ main::x#2 main::x#1 ]
Uplifting [main] best 1165 combination zp ZP_BYTE:4 [ main::x#2 main::x#1 ]
Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ]
Removing instruction jmp bend
Removing instruction jmp b1
@ -1643,62 +1655,64 @@ ASSEMBLER
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
.label x = 4
.label cursor = 2
.label y = 5
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1
//SEG7 [2] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta y
//SEG7 [1] phi (byte) main::e#3 = (byte) 12 -- xby=coby1
//SEG8 [2] phi (byte) main::e#3 = (byte) 12 -- xby=coby1
ldx #$c
//SEG8 [1] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1
//SEG9 [2] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta x
//SEG9 [1] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1
//SEG10 [2] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1
lda #<$400
sta cursor
lda #>$400
sta cursor+$1
jmp b1
//SEG10 [1] phi from main::@2 to main::@1
//SEG11 [2] phi from main::@2 to main::@1
b1_from_b2:
//SEG11 [1] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
//SEG12 [1] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy
//SEG13 [1] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy
//SEG14 [1] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy
//SEG15 main::@1
//SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
//SEG13 [2] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy
//SEG14 [2] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy
//SEG15 [2] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy
//SEG16 main::@1
b1:
//SEG16 [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1
//SEG17 [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1
ldy #$0
lda #$51
sta (cursor),y
//SEG17 [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] -- zpby1=zpby1_plus_1
//SEG18 [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] -- zpby1=zpby1_plus_1
inc x
//SEG18 [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1
//SEG19 [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1
inc cursor
bne !+
inc cursor+$1
!:
//SEG19 [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- xby=xby_plus_coby1
//SEG20 [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- xby=xby_plus_coby1
txa
clc
adc #$18
tax
//SEG20 [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- coby1_ge_xby_then_la1
//SEG21 [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- coby1_ge_xby_then_la1
cpx #$27
bcc b2_from_b1
//SEG21 main::@3
//SEG22 main::@3
b3:
//SEG22 [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] -- zpby1=zpby1_plus_1
//SEG23 [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] -- zpby1=zpby1_plus_1
inc y
//SEG23 [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] -- zpptrby1=zpptrby1_plus_coby1
//SEG24 [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] -- zpptrby1=zpptrby1_plus_coby1
lda cursor
clc
adc #$28
@ -1706,31 +1720,32 @@ main: {
bcc !+
inc cursor+$1
!:
//SEG24 [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] -- xby=xby_minus_coby1
//SEG25 [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] -- xby=xby_minus_coby1
txa
sec
sbc #$27
tax
//SEG25 [10] phi from main::@1 main::@3 to main::@2
//SEG26 [11] phi from main::@1 main::@3 to main::@2
b2_from_b1:
b2_from_b3:
//SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG29 main::@2
//SEG27 [11] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG28 [11] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG29 [11] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG30 main::@2
b2:
//SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1
//SEG31 [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1
lda x
cmp #$28
bcc b1_from_b2
//SEG31 main::@return
//SEG32 main::@return
breturn:
//SEG32 [12] return [ ]
//SEG33 [13] return [ ]
rts
}
Replacing label b2_from_b1 with b2
Replacing label b1_from_b2 with b1
Removing instruction main_from_bbegin:
Removing instruction b1_from_b2:
Removing instruction b2_from_b1:
Removing instruction b2_from_b3:
@ -1740,61 +1755,62 @@ ASSEMBLER
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
.label x = 4
.label cursor = 2
.label y = 5
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1
//SEG7 [2] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta y
//SEG7 [1] phi (byte) main::e#3 = (byte) 12 -- xby=coby1
//SEG8 [2] phi (byte) main::e#3 = (byte) 12 -- xby=coby1
ldx #$c
//SEG8 [1] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1
//SEG9 [2] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta x
//SEG9 [1] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1
//SEG10 [2] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1
lda #<$400
sta cursor
lda #>$400
sta cursor+$1
jmp b1
//SEG10 [1] phi from main::@2 to main::@1
//SEG11 [1] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
//SEG12 [1] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy
//SEG13 [1] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy
//SEG14 [1] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy
//SEG15 main::@1
//SEG11 [2] phi from main::@2 to main::@1
//SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
//SEG13 [2] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy
//SEG14 [2] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy
//SEG15 [2] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy
//SEG16 main::@1
b1:
//SEG16 [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1
//SEG17 [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1
ldy #$0
lda #$51
sta (cursor),y
//SEG17 [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] -- zpby1=zpby1_plus_1
//SEG18 [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] -- zpby1=zpby1_plus_1
inc x
//SEG18 [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1
//SEG19 [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1
inc cursor
bne !+
inc cursor+$1
!:
//SEG19 [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- xby=xby_plus_coby1
//SEG20 [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- xby=xby_plus_coby1
txa
clc
adc #$18
tax
//SEG20 [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- coby1_ge_xby_then_la1
//SEG21 [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- coby1_ge_xby_then_la1
cpx #$27
bcc b2
//SEG21 main::@3
//SEG22 main::@3
b3:
//SEG22 [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] -- zpby1=zpby1_plus_1
//SEG23 [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] -- zpby1=zpby1_plus_1
inc y
//SEG23 [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] -- zpptrby1=zpptrby1_plus_coby1
//SEG24 [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] -- zpptrby1=zpptrby1_plus_coby1
lda cursor
clc
adc #$28
@ -1802,24 +1818,24 @@ main: {
bcc !+
inc cursor+$1
!:
//SEG24 [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] -- xby=xby_minus_coby1
//SEG25 [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] -- xby=xby_minus_coby1
txa
sec
sbc #$27
tax
//SEG25 [10] phi from main::@1 main::@3 to main::@2
//SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG29 main::@2
//SEG26 [11] phi from main::@1 main::@3 to main::@2
//SEG27 [11] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG28 [11] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG29 [11] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG30 main::@2
b2:
//SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1
//SEG31 [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1
lda x
cmp #$28
bcc b1
//SEG31 main::@return
//SEG32 main::@return
breturn:
//SEG32 [12] return [ ]
//SEG33 [13] return [ ]
rts
}
@ -1833,58 +1849,59 @@ ASSEMBLER
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
.label x = 4
.label cursor = 2
.label y = 5
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta y
//SEG7 [1] phi (byte) main::e#3 = (byte) 12 -- xby=coby1
//SEG8 [2] phi (byte) main::e#3 = (byte) 12 -- xby=coby1
ldx #$c
//SEG8 [1] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1
//SEG9 [2] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta x
//SEG9 [1] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1
//SEG10 [2] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1
lda #<$400
sta cursor
lda #>$400
sta cursor+$1
jmp b1
//SEG10 [1] phi from main::@2 to main::@1
//SEG11 [1] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
//SEG12 [1] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy
//SEG13 [1] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy
//SEG14 [1] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy
//SEG15 main::@1
//SEG11 [2] phi from main::@2 to main::@1
//SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
//SEG13 [2] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy
//SEG14 [2] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy
//SEG15 [2] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy
//SEG16 main::@1
b1:
//SEG16 [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1
//SEG17 [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1
ldy #$0
lda #$51
sta (cursor),y
//SEG17 [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] -- zpby1=zpby1_plus_1
//SEG18 [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] -- zpby1=zpby1_plus_1
inc x
//SEG18 [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1
//SEG19 [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1
inc cursor
bne !+
inc cursor+$1
!:
//SEG19 [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- xby=xby_plus_coby1
//SEG20 [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- xby=xby_plus_coby1
txa
clc
adc #$18
tax
//SEG20 [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- coby1_ge_xby_then_la1
//SEG21 [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- coby1_ge_xby_then_la1
cpx #$27
bcc b2
//SEG21 main::@3
//SEG22 [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] -- zpby1=zpby1_plus_1
//SEG22 main::@3
//SEG23 [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] -- zpby1=zpby1_plus_1
inc y
//SEG23 [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] -- zpptrby1=zpptrby1_plus_coby1
//SEG24 [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] -- zpptrby1=zpptrby1_plus_coby1
lda cursor
clc
adc #$28
@ -1892,23 +1909,23 @@ main: {
bcc !+
inc cursor+$1
!:
//SEG24 [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] -- xby=xby_minus_coby1
//SEG25 [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] -- xby=xby_minus_coby1
txa
sec
sbc #$27
tax
//SEG25 [10] phi from main::@1 main::@3 to main::@2
//SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG29 main::@2
//SEG26 [11] phi from main::@1 main::@3 to main::@2
//SEG27 [11] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG28 [11] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG29 [11] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG30 main::@2
b2:
//SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1
//SEG31 [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1
lda x
cmp #$28
bcc b1
//SEG31 main::@return
//SEG32 [12] return [ ]
//SEG32 main::@return
//SEG33 [13] return [ ]
rts
}
@ -1918,57 +1935,58 @@ ASSEMBLER
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
.label x = 4
.label cursor = 2
.label y = 5
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta y
//SEG7 [1] phi (byte) main::e#3 = (byte) 12 -- xby=coby1
//SEG8 [2] phi (byte) main::e#3 = (byte) 12 -- xby=coby1
ldx #$c
//SEG8 [1] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1
//SEG9 [2] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta x
//SEG9 [1] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1
//SEG10 [2] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1
lda #<$400
sta cursor
lda #>$400
sta cursor+$1
//SEG10 [1] phi from main::@2 to main::@1
//SEG11 [1] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
//SEG12 [1] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy
//SEG13 [1] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy
//SEG14 [1] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy
//SEG15 main::@1
//SEG11 [2] phi from main::@2 to main::@1
//SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
//SEG13 [2] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy
//SEG14 [2] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy
//SEG15 [2] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy
//SEG16 main::@1
b1:
//SEG16 [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1
//SEG17 [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1
ldy #$0
lda #$51
sta (cursor),y
//SEG17 [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] -- zpby1=zpby1_plus_1
//SEG18 [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] -- zpby1=zpby1_plus_1
inc x
//SEG18 [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1
//SEG19 [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1
inc cursor
bne !+
inc cursor+$1
!:
//SEG19 [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- xby=xby_plus_coby1
//SEG20 [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- xby=xby_plus_coby1
txa
clc
adc #$18
tax
//SEG20 [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- coby1_ge_xby_then_la1
//SEG21 [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- coby1_ge_xby_then_la1
cpx #$27
bcc b2
//SEG21 main::@3
//SEG22 [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] -- zpby1=zpby1_plus_1
//SEG22 main::@3
//SEG23 [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] -- zpby1=zpby1_plus_1
inc y
//SEG23 [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] -- zpptrby1=zpptrby1_plus_coby1
//SEG24 [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] -- zpptrby1=zpptrby1_plus_coby1
lda cursor
clc
adc #$28
@ -1976,23 +1994,23 @@ main: {
bcc !+
inc cursor+$1
!:
//SEG24 [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] -- xby=xby_minus_coby1
//SEG25 [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] -- xby=xby_minus_coby1
txa
sec
sbc #$27
tax
//SEG25 [10] phi from main::@1 main::@3 to main::@2
//SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG29 main::@2
//SEG26 [11] phi from main::@1 main::@3 to main::@2
//SEG27 [11] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG28 [11] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG29 [11] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG30 main::@2
b2:
//SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1
//SEG31 [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1
lda x
cmp #$28
bcc b1
//SEG31 main::@return
//SEG32 [12] return [ ]
//SEG32 main::@return
//SEG33 [13] return [ ]
rts
}
@ -2039,57 +2057,58 @@ FINAL CODE
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
.label x = 4
.label cursor = 2
.label y = 5
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::y#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta y
//SEG7 [1] phi (byte) main::e#3 = (byte) 12 -- xby=coby1
//SEG8 [2] phi (byte) main::e#3 = (byte) 12 -- xby=coby1
ldx #$c
//SEG8 [1] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1
//SEG9 [2] phi (byte) main::x#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta x
//SEG9 [1] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1
//SEG10 [2] phi (byte*) main::cursor#3 = (word) 1024 -- zpptrby1=cowo1
lda #<$400
sta cursor
lda #>$400
sta cursor+$1
//SEG10 [1] phi from main::@2 to main::@1
//SEG11 [1] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
//SEG12 [1] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy
//SEG13 [1] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy
//SEG14 [1] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy
//SEG15 main::@1
//SEG11 [2] phi from main::@2 to main::@1
//SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
//SEG13 [2] phi (byte) main::e#3 = (byte) main::e#5 -- register_copy
//SEG14 [2] phi (byte) main::x#2 = (byte) main::x#1 -- register_copy
//SEG15 [2] phi (byte*) main::cursor#3 = (byte*) main::cursor#5 -- register_copy
//SEG16 main::@1
b1:
//SEG16 [2] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1
//SEG17 [3] *((byte*) main::cursor#3) ← (byte) 81 [ main::cursor#3 main::x#2 main::e#3 main::y#2 ] -- _star_zpptrby1=coby1
ldy #$0
lda #$51
sta (cursor),y
//SEG17 [3] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::x#1 main::cursor#3 main::e#3 main::y#2 ] -- zpby1=zpby1_plus_1
//SEG18 [4] (byte) main::x#1 ← (byte) main::x#2 + (byte) 1 [ main::cursor#3 main::e#3 main::y#2 main::x#1 ] -- zpby1=zpby1_plus_1
inc x
//SEG18 [4] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::x#1 main::e#3 main::y#2 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1
//SEG19 [5] (byte*) main::cursor#1 ← (byte*) main::cursor#3 + (byte) 1 [ main::e#3 main::y#2 main::x#1 main::cursor#1 ] -- zpptrby1=zpptrby1_plus_1
inc cursor
bne !+
inc cursor+$1
!:
//SEG19 [5] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- xby=xby_plus_coby1
//SEG20 [6] (byte) main::e#1 ← (byte) main::e#3 + (byte) 24 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- xby=xby_plus_coby1
txa
clc
adc #$18
tax
//SEG20 [6] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::x#1 main::e#1 main::y#2 main::cursor#1 ] -- coby1_ge_xby_then_la1
//SEG21 [7] if((byte) 39>=(byte) main::e#1) goto main::@2 [ main::y#2 main::x#1 main::cursor#1 main::e#1 ] -- coby1_ge_xby_then_la1
cpx #$27
bcc b2
//SEG21 main::@3
//SEG22 [7] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::e#1 main::cursor#1 main::y#1 ] -- zpby1=zpby1_plus_1
//SEG22 main::@3
//SEG23 [8] (byte) main::y#1 ← (byte) main::y#2 + (byte) 1 [ main::x#1 main::cursor#1 main::e#1 main::y#1 ] -- zpby1=zpby1_plus_1
inc y
//SEG23 [8] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::cursor#2 main::y#1 ] -- zpptrby1=zpptrby1_plus_coby1
//SEG24 [9] (byte*) main::cursor#2 ← (byte*) main::cursor#1 + (byte) 40 [ main::x#1 main::e#1 main::y#1 main::cursor#2 ] -- zpptrby1=zpptrby1_plus_coby1
lda cursor
clc
adc #$28
@ -2097,23 +2116,23 @@ main: {
bcc !+
inc cursor+$1
!:
//SEG24 [9] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::cursor#2 main::e#2 main::y#1 ] -- xby=xby_minus_coby1
//SEG25 [10] (byte) main::e#2 ← (byte) main::e#1 - (byte) 39 [ main::x#1 main::y#1 main::cursor#2 main::e#2 ] -- xby=xby_minus_coby1
txa
sec
sbc #$27
tax
//SEG25 [10] phi from main::@1 main::@3 to main::@2
//SEG26 [10] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG27 [10] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG28 [10] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG29 main::@2
//SEG26 [11] phi from main::@1 main::@3 to main::@2
//SEG27 [11] phi (byte) main::y#4 = (byte) main::y#2 -- register_copy
//SEG28 [11] phi (byte) main::e#5 = (byte) main::e#1 -- register_copy
//SEG29 [11] phi (byte*) main::cursor#5 = (byte*) main::cursor#1 -- register_copy
//SEG30 main::@2
b2:
//SEG30 [11] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1
//SEG31 [12] if((byte) main::x#1<(byte) 40) goto main::@1 [ main::cursor#5 main::x#1 main::e#5 main::y#4 ] -- zpby1_lt_coby1_then_la1
lda x
cmp #$28
bcc b1
//SEG31 main::@return
//SEG32 [12] return [ ]
//SEG32 main::@return
//SEG33 [13] return [ ]
rts
}

View File

@ -6,15 +6,15 @@
[0] (byte) x#2 ← phi( @2/(byte) x#1 @begin/(byte) 0 ) [ idx#3 x#2 e#3 y#2 ]
[0] (word) idx#3 ← phi( @2/(word) idx#5 @begin/(byte) 0 ) [ idx#3 x#2 e#3 y#2 ]
[1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ]
[2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ]
[3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ]
[4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ]
[5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ]
[2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ]
[3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ]
[4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ]
[5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ]
to:@3
@3: scope:[] from @1
[6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ]
[7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ]
[8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ]
[6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ]
[7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ]
[8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ]
to:@2
@2: scope:[] from @1 @3
[9] (byte) y#4 ← phi( @1/(byte) y#2 @3/(byte) y#1 ) [ idx#5 x#1 e#5 y#4 ]

View File

@ -1040,6 +1040,8 @@ CONTROL FLOW GRAPH - PHI LIFTED
(byte~) y#6 ← (byte) y#2
to:@2
CALL GRAPH
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
@ -1047,7 +1049,8 @@ Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
to:@1
@1: scope:[] from @5 @begin
@ -1057,17 +1060,17 @@ CONTROL FLOW GRAPH - LIVE RANGES
[0] (word) idx#3 ← phi( @5/(word~) idx#6 @begin/(byte) 0 ) [ idx#3 x#2 e#3 y#2 ]
[1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ]
[2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ]
[3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 idx#1 x#1 ]
[4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ e#1 y#2 idx#1 x#1 ]
[5] if((byte) 39>=(byte) e#1) goto @6 [ e#1 y#2 idx#1 x#1 ]
[3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ]
[4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ]
[5] if((byte) 39>=(byte) e#1) goto @6 [ y#2 x#1 idx#1 e#1 ]
to:@3
@3: scope:[] from @1
[6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ e#1 idx#1 y#1 x#1 ]
[7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ e#1 idx#2 y#1 x#1 ]
[8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ idx#2 e#2 y#1 x#1 ]
[9] (word~) idx#8 ← (word) idx#2 [ e#2 y#1 idx#8 x#1 ]
[10] (byte~) e#8 ← (byte) e#2 [ y#1 idx#8 e#8 x#1 ]
[11] (byte~) y#7 ← (byte) y#1 [ idx#8 e#8 y#7 x#1 ]
[6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ]
[7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ]
[8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ]
[9] (word~) idx#8 ← (word) idx#2 [ x#1 y#1 e#2 idx#8 ]
[10] (byte~) e#8 ← (byte) e#2 [ x#1 y#1 idx#8 e#8 ]
[11] (byte~) y#7 ← (byte) y#1 [ x#1 idx#8 e#8 y#7 ]
to:@2
@2: scope:[] from @3 @6
[12] (byte) y#4 ← phi( @6/(byte~) y#6 @3/(byte~) y#7 ) [ x#1 idx#5 e#5 y#4 ]
@ -1083,9 +1086,9 @@ CONTROL FLOW GRAPH - LIVE RANGES
[17] (byte~) y#5 ← (byte) y#4 [ idx#6 x#5 e#6 y#5 ]
to:@1
@6: scope:[] from @1
[18] (word~) idx#7 ← (word) idx#1 [ e#1 y#2 idx#7 x#1 ]
[19] (byte~) e#7 ← (byte) e#1 [ y#2 idx#7 e#7 x#1 ]
[20] (byte~) y#6 ← (byte) y#2 [ idx#7 e#7 y#6 x#1 ]
[18] (word~) idx#7 ← (word) idx#1 [ y#2 x#1 e#1 idx#7 ]
[19] (byte~) e#7 ← (byte) e#1 [ y#2 x#1 idx#7 e#7 ]
[20] (byte~) y#6 ← (byte) y#2 [ x#1 idx#7 e#7 y#6 ]
to:@2
Created 7 initial phi equivalence classes
@ -1109,6 +1112,7 @@ Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
to:@1
@ -1118,15 +1122,15 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED
[0] (byte) x#2 ← phi( @2/(byte) x#1 @begin/(byte) 0 ) [ idx#3 x#2 e#3 y#2 ]
[0] (word) idx#3 ← phi( @2/(word) idx#5 @begin/(byte) 0 ) [ idx#3 x#2 e#3 y#2 ]
[1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ]
[2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ]
[3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ]
[4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ]
[5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ]
[2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ]
[3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ]
[4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ]
[5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ]
to:@3
@3: scope:[] from @1
[6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ]
[7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ]
[8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ]
[6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ]
[7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ]
[8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ]
to:@2
@2: scope:[] from @1 @3
[9] (byte) y#4 ← phi( @1/(byte) y#2 @3/(byte) y#1 ) [ idx#5 x#1 e#5 y#4 ]
@ -1136,8 +1140,6 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED
to:@end
@end: scope:[] from @2
CALL GRAPH
DOMINATORS
@begin dominated by @begin
@1 dominated by @1 @begin
@ -1242,28 +1244,28 @@ b1:
lda #$51
!s:
sta $400
//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] -- zpby1=zpby1_plus_1
//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] -- zpby1=zpby1_plus_1
inc x
//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] -- zpwo1=zpwo1_plus_1
//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] -- zpwo1=zpwo1_plus_1
inc idx
bne !+
inc idx+$1
!:
//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] -- zpby1=zpby1_plus_coby1
//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] -- zpby1=zpby1_plus_coby1
lda e
clc
adc #$18
sta e
//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] -- coby1_ge_zpby1_then_la1
//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] -- coby1_ge_zpby1_then_la1
lda #$27
cmp e
bcs b2_from_b1
jmp b3
//SEG18 @3
b3:
//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] -- zpby1=zpby1_plus_1
//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] -- zpby1=zpby1_plus_1
inc y
//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] -- zpwo1=zpwo1_plus_coby1
//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] -- zpwo1=zpwo1_plus_coby1
lda idx
clc
adc #<$28
@ -1271,7 +1273,7 @@ b3:
bcc !+
inc idx+$1
!:
//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] -- zpby1=zpby1_minus_coby1
//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] -- zpby1=zpby1_minus_coby1
lda e
sec
sbc #$27
@ -1297,13 +1299,13 @@ Statement [1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ]
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 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ y#2 y#4 y#1 ]
Statement [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] always clobbers reg byte a
Statement [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] always clobbers reg byte a
Statement [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] always clobbers reg byte a
Statement [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ 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 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] always clobbers reg byte a
Statement [1] *((word) 1024 + (word) idx#3) ← (byte) 81 [ idx#3 x#2 e#3 y#2 ] always clobbers reg byte a
Statement [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] always clobbers reg byte a
Statement [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] always clobbers reg byte a
Statement [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] always clobbers reg byte a
Statement [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ 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 - (byte) 39 [ 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 ,
@ -1314,6 +1316,8 @@ REGISTER UPLIFT SCOPES
Uplift Scope [] 55: zp ZP_BYTE:5 [ e#3 e#5 e#1 e#2 ] 46.75: zp ZP_WORD:2 [ idx#3 idx#5 idx#1 idx#2 ] 29.33: zp ZP_BYTE:6 [ y#2 y#4 y#1 ] 14.67: zp ZP_BYTE:4 [ x#2 x#1 ]
Uplifting [] best 1220 combination reg byte y [ e#3 e#5 e#1 e#2 ] zp ZP_WORD:2 [ idx#3 idx#5 idx#1 idx#2 ] zp ZP_BYTE:6 [ y#2 y#4 y#1 ] reg byte x [ x#2 x#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:6 [ y#2 y#4 y#1 ]
Uplifting [] best 1220 combination zp ZP_BYTE:6 [ y#2 y#4 y#1 ]
Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:4 [ y#2 y#4 y#1 ]
Removing instruction jmp b1
Removing instruction jmp b3
@ -1360,26 +1364,26 @@ b1:
lda #$51
!s:
sta $400
//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] -- xby=xby_plus_1
//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] -- xby=xby_plus_1
inx
//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] -- zpwo1=zpwo1_plus_1
//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] -- zpwo1=zpwo1_plus_1
inc idx
bne !+
inc idx+$1
!:
//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] -- yby=yby_plus_coby1
//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] -- yby=yby_plus_coby1
tya
clc
adc #$18
tay
//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] -- coby1_ge_yby_then_la1
//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] -- coby1_ge_yby_then_la1
cpy #$27
bcc b2_from_b1
//SEG18 @3
b3:
//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] -- zpby1=zpby1_plus_1
//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] -- zpby1=zpby1_plus_1
inc y
//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] -- zpwo1=zpwo1_plus_coby1
//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] -- zpwo1=zpwo1_plus_coby1
lda idx
clc
adc #<$28
@ -1387,7 +1391,7 @@ b3:
bcc !+
inc idx+$1
!:
//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] -- yby=yby_minus_coby1
//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] -- yby=yby_minus_coby1
tya
sec
sbc #$27
@ -1451,26 +1455,26 @@ b1:
lda #$51
!s:
sta $400
//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] -- xby=xby_plus_1
//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] -- xby=xby_plus_1
inx
//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] -- zpwo1=zpwo1_plus_1
//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] -- zpwo1=zpwo1_plus_1
inc idx
bne !+
inc idx+$1
!:
//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] -- yby=yby_plus_coby1
//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] -- yby=yby_plus_coby1
tya
clc
adc #$18
tay
//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] -- coby1_ge_yby_then_la1
//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] -- coby1_ge_yby_then_la1
cpy #$27
bcc b2
//SEG18 @3
b3:
//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] -- zpby1=zpby1_plus_1
//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] -- zpby1=zpby1_plus_1
inc y
//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] -- zpwo1=zpwo1_plus_coby1
//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] -- zpwo1=zpwo1_plus_coby1
lda idx
clc
adc #<$28
@ -1478,7 +1482,7 @@ b3:
bcc !+
inc idx+$1
!:
//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] -- yby=yby_minus_coby1
//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] -- yby=yby_minus_coby1
tya
sec
sbc #$27
@ -1536,25 +1540,25 @@ b1:
lda #$51
!s:
sta $400
//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] -- xby=xby_plus_1
//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] -- xby=xby_plus_1
inx
//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] -- zpwo1=zpwo1_plus_1
//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] -- zpwo1=zpwo1_plus_1
inc idx
bne !+
inc idx+$1
!:
//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] -- yby=yby_plus_coby1
//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] -- yby=yby_plus_coby1
tya
clc
adc #$18
tay
//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] -- coby1_ge_yby_then_la1
//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] -- coby1_ge_yby_then_la1
cpy #$27
bcc b2
//SEG18 @3
//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] -- zpby1=zpby1_plus_1
//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] -- zpby1=zpby1_plus_1
inc y
//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] -- zpwo1=zpwo1_plus_coby1
//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] -- zpwo1=zpwo1_plus_coby1
lda idx
clc
adc #<$28
@ -1562,7 +1566,7 @@ b1:
bcc !+
inc idx+$1
!:
//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] -- yby=yby_minus_coby1
//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] -- yby=yby_minus_coby1
tya
sec
sbc #$27
@ -1616,25 +1620,25 @@ b1:
lda #$51
!s:
sta $400
//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] -- xby=xby_plus_1
//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] -- xby=xby_plus_1
inx
//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] -- zpwo1=zpwo1_plus_1
//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] -- zpwo1=zpwo1_plus_1
inc idx
bne !+
inc idx+$1
!:
//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] -- yby=yby_plus_coby1
//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] -- yby=yby_plus_coby1
tya
clc
adc #$18
tay
//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] -- coby1_ge_yby_then_la1
//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] -- coby1_ge_yby_then_la1
cpy #$27
bcc b2
//SEG18 @3
//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] -- zpby1=zpby1_plus_1
//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] -- zpby1=zpby1_plus_1
inc y
//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] -- zpwo1=zpwo1_plus_coby1
//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] -- zpwo1=zpwo1_plus_coby1
lda idx
clc
adc #<$28
@ -1642,7 +1646,7 @@ b1:
bcc !+
inc idx+$1
!:
//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] -- yby=yby_minus_coby1
//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] -- yby=yby_minus_coby1
tya
sec
sbc #$27
@ -1731,25 +1735,25 @@ b1:
lda #$51
!s:
sta $400
//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ x#1 idx#3 e#3 y#2 ] -- xby=xby_plus_1
//SEG14 [2] (byte) x#1 ← (byte) x#2 + (byte) 1 [ idx#3 e#3 y#2 x#1 ] -- xby=xby_plus_1
inx
//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ x#1 e#3 y#2 idx#1 ] -- zpwo1=zpwo1_plus_1
//SEG15 [3] (word) idx#1 ← (word) idx#3 + (byte) 1 [ e#3 y#2 x#1 idx#1 ] -- zpwo1=zpwo1_plus_1
inc idx
bne !+
inc idx+$1
!:
//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ x#1 e#1 y#2 idx#1 ] -- yby=yby_plus_coby1
//SEG16 [4] (byte) e#1 ← (byte) e#3 + (byte) 24 [ y#2 x#1 idx#1 e#1 ] -- yby=yby_plus_coby1
tya
clc
adc #$18
tay
//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ x#1 e#1 y#2 idx#1 ] -- coby1_ge_yby_then_la1
//SEG17 [5] if((byte) 39>=(byte) e#1) goto @2 [ y#2 x#1 idx#1 e#1 ] -- coby1_ge_yby_then_la1
cpy #$27
bcc b2
//SEG18 @3
//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 e#1 idx#1 y#1 ] -- zpby1=zpby1_plus_1
//SEG19 [6] (byte) y#1 ← (byte) y#2 + (byte) 1 [ x#1 idx#1 e#1 y#1 ] -- zpby1=zpby1_plus_1
inc y
//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 idx#2 y#1 ] -- zpwo1=zpwo1_plus_coby1
//SEG20 [7] (word) idx#2 ← (word) idx#1 + (byte) 40 [ x#1 e#1 y#1 idx#2 ] -- zpwo1=zpwo1_plus_coby1
lda idx
clc
adc #<$28
@ -1757,7 +1761,7 @@ b1:
bcc !+
inc idx+$1
!:
//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 idx#2 e#2 y#1 ] -- yby=yby_minus_coby1
//SEG21 [8] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 y#1 idx#2 e#2 ] -- yby=yby_minus_coby1
tya
sec
sbc #$27

View File

@ -492,9 +492,13 @@ main::@3: scope:[main] from main::@1
(byte~) main::i#3 ← (byte) main::i#1
to:main::@1
CALL GRAPH
Calls in [] to 0:main
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@ -526,6 +530,7 @@ Culled Empty Block (label) main::@3
Block Sequence Planned @begin @end main main::@1 main::@return
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
[0] call main param-assignment [ ]
@ -548,9 +553,6 @@ main::@return: scope:[main] from main::@1
[10] return [ ]
to:@return
CALL GRAPH
Calls in [] to 0:main
DOMINATORS
@begin dominated by @begin
@end dominated by @end @begin
@ -605,9 +607,9 @@ bbegin:
bend:
//SEG4 main
main: {
.label $1 = 3
.label $3 = 4
.label $4 = 5
.label _1 = 3
.label _3 = 4
.label _4 = 5
.label i = 2
//SEG5 [1] *((word) 4352) ← (byte) 0 [ ] -- _star_cowo1=coby2
lda #$0
@ -630,18 +632,18 @@ main: {
//SEG12 [4] (byte~) main::$1 ← (word) 4352 *idx (byte) main::i#2 [ main::i#2 main::$1 ] -- zpby1=cowo1_staridx_zpby2
ldx i
lda $1100,x
sta $1
sta _1
//SEG13 [5] (byte~) main::$3 ← (word) 4353 *idx (byte) main::i#2 [ main::i#2 main::$1 main::$3 ] -- zpby1=cowo1_staridx_zpby2
ldx i
lda $1101,x
sta $3
sta _3
//SEG14 [6] (byte~) main::$4 ← (byte~) main::$1 + (byte~) main::$3 [ main::i#2 main::$4 ] -- zpby1=zpby2_plus_zpby3
lda $1
lda _1
clc
adc $3
sta $4
adc _3
sta _4
//SEG15 [7] *((word) 4354 + (byte) main::i#2) ← (byte~) main::$4 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby2
lda $4
lda _4
ldx i
sta $1102,x
//SEG16 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1
@ -680,57 +682,38 @@ MISSING FRAGMENTS
zpby1=zpby2_plus_cowo1_staridx_xby
zpby1=zpby2_plus_cowo1_staridx_yby
aby=zpby1_plus_cowo1_staridx_zpby2
aby=zpby1_plus_cowo1_staridx_aby
aby=zpby1_plus_cowo1_staridx_xby
aby=zpby1_plus_cowo1_staridx_yby
xby=zpby1_plus_cowo1_staridx_zpby2
xby=zpby1_plus_cowo1_staridx_aby
xby=zpby1_plus_cowo1_staridx_xby
xby=zpby1_plus_cowo1_staridx_yby
yby=zpby1_plus_cowo1_staridx_zpby2
yby=zpby1_plus_cowo1_staridx_aby
yby=zpby1_plus_cowo1_staridx_xby
yby=zpby1_plus_cowo1_staridx_yby
zpby1=aby_plus_cowo1_staridx_zpby2
zpby1=aby_plus_cowo1_staridx_aby
aby=aby_plus_cowo1_staridx_zpby1
aby=aby_plus_cowo1_staridx_aby
xby=aby_plus_cowo1_staridx_zpby1
xby=aby_plus_cowo1_staridx_aby
yby=aby_plus_cowo1_staridx_zpby1
yby=aby_plus_cowo1_staridx_aby
zpby1=xby_plus_cowo1_staridx_zpby2
zpby1=xby_plus_cowo1_staridx_aby
zpby1=xby_plus_cowo1_staridx_xby
zpby1=xby_plus_cowo1_staridx_yby
aby=xby_plus_cowo1_staridx_zpby1
aby=xby_plus_cowo1_staridx_aby
aby=xby_plus_cowo1_staridx_xby
aby=xby_plus_cowo1_staridx_yby
xby=xby_plus_cowo1_staridx_zpby1
xby=xby_plus_cowo1_staridx_aby
xby=xby_plus_cowo1_staridx_xby
xby=xby_plus_cowo1_staridx_yby
yby=xby_plus_cowo1_staridx_zpby1
yby=xby_plus_cowo1_staridx_aby
yby=xby_plus_cowo1_staridx_xby
yby=xby_plus_cowo1_staridx_yby
zpby1=yby_plus_cowo1_staridx_zpby2
zpby1=yby_plus_cowo1_staridx_aby
zpby1=yby_plus_cowo1_staridx_xby
zpby1=yby_plus_cowo1_staridx_yby
aby=yby_plus_cowo1_staridx_zpby1
aby=yby_plus_cowo1_staridx_aby
aby=yby_plus_cowo1_staridx_xby
aby=yby_plus_cowo1_staridx_yby
xby=yby_plus_cowo1_staridx_zpby1
xby=yby_plus_cowo1_staridx_aby
xby=yby_plus_cowo1_staridx_xby
xby=yby_plus_cowo1_staridx_yby
yby=yby_plus_cowo1_staridx_zpby1
yby=yby_plus_cowo1_staridx_aby
yby=yby_plus_cowo1_staridx_xby
yby=yby_plus_cowo1_staridx_yby
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp breturn

View File

@ -3,98 +3,102 @@
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] call prepare param-assignment [ ]
[1] phi() [ ]
[2] call prepare param-assignment [ ]
to:main::@3
main::@3: scope:[main] from main main::@11 main::@3 main::@6
[2] (byte) main::c#2 ← phi( main/(byte) 25 main::@6/(byte) main::c#1 main::@11/(byte) 25 ) [ main::c#2 ]
[3] (byte~) main::$1 ← * (word) 53266 [ main::$1 main::c#2 ]
[4] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ]
[3] (byte) main::c#2 ← phi( main/(byte) 25 main::@6/(byte) main::c#1 main::@11/(byte) 25 ) [ main::c#2 ]
[4] (byte~) main::$1 ← * (word) 53266 [ main::c#2 main::$1 ]
[5] if((byte~) main::$1!=(byte) 254) goto main::@3 [ main::c#2 ]
to:main::@4
main::@4: scope:[main] from main::@3 main::@4
[5] (byte~) main::$3 ← * (word) 53266 [ main::$3 main::c#2 ]
[6] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ]
[6] (byte~) main::$3 ← * (word) 53266 [ main::c#2 main::$3 ]
[7] if((byte~) main::$3!=(byte) 255) goto main::@4 [ main::c#2 ]
to:main::@6
main::@6: scope:[main] from main::@4
[7] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ]
[8] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ]
[8] (byte) main::c#1 ← -- (byte) main::c#2 [ main::c#1 ]
[9] if((byte) main::c#1!=(byte) 0) goto main::@3 [ main::c#1 ]
to:main::@7
main::@7: scope:[main] from main::@6
[9] call flip param-assignment [ ]
[10] call flip param-assignment [ ]
to:main::@10
main::@10: scope:[main] from main::@7
[10] call plot param-assignment [ ]
[11] call plot param-assignment [ ]
to:main::@11
main::@11: scope:[main] from main::@10
[11] if(true) goto main::@3 [ ]
[12] if(true) goto main::@3 [ ]
to:main::@return
main::@return: scope:[main] from main::@11
[12] return [ ]
[13] return [ ]
to:@return
plot: scope:[plot] from main::@10
[14] phi() [ ]
to:plot::@1
plot::@1: scope:[plot] from plot plot::@3
[13] (byte) plot::y#2 ← phi( plot/(byte) 16 plot::@3/(byte) plot::y#1 ) [ plot::i#3 plot::line#2 plot::y#2 ]
[13] (byte*) plot::line#2 ← phi( plot/(word) 1236 plot::@3/(byte*) plot::line#1 ) [ plot::i#3 plot::line#2 plot::y#2 ]
[13] (byte) plot::i#3 ← phi( plot/(byte) 0 plot::@3/(byte) plot::i#1 ) [ plot::i#3 plot::line#2 plot::y#2 ]
[15] (byte) plot::y#2 ← phi( plot/(byte) 16 plot::@3/(byte) plot::y#1 ) [ plot::i#3 plot::line#2 plot::y#2 ]
[15] (byte*) plot::line#2 ← phi( plot/(word) 1236 plot::@3/(byte*) plot::line#1 ) [ plot::i#3 plot::line#2 plot::y#2 ]
[15] (byte) plot::i#3 ← phi( plot/(byte) 0 plot::@3/(byte) plot::i#1 ) [ plot::i#3 plot::line#2 plot::y#2 ]
to:plot::@2
plot::@2: scope:[plot] from plot::@1 plot::@2
[14] (byte) plot::x#2 ← phi( plot::@1/(byte) 0 plot::@2/(byte) plot::x#1 ) [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ]
[14] (byte) plot::i#2 ← phi( plot::@1/(byte) plot::i#3 plot::@2/(byte) plot::i#1 ) [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ]
[15] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::i#2 plot::line#2 plot::x#2 plot::$3 plot::y#2 ]
[16] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::i#2 plot::line#2 plot::x#2 plot::y#2 ]
[17] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::i#1 plot::line#2 plot::x#2 plot::y#2 ]
[18] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ]
[19] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::i#1 plot::x#1 plot::line#2 plot::y#2 ]
[16] (byte) plot::x#2 ← phi( plot::@1/(byte) 0 plot::@2/(byte) plot::x#1 ) [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ]
[16] (byte) plot::i#2 ← phi( plot::@1/(byte) plot::i#3 plot::@2/(byte) plot::i#1 ) [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ]
[17] (byte~) plot::$3 ← (word) 4096 *idx (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 plot::$3 ]
[18] *((byte*) plot::line#2 + (byte) plot::x#2) ← (byte~) plot::$3 [ plot::line#2 plot::y#2 plot::i#2 plot::x#2 ]
[19] (byte) plot::i#1 ← ++ (byte) plot::i#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#2 ]
[20] (byte) plot::x#1 ← ++ (byte) plot::x#2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ]
[21] if((byte) plot::x#1<(byte) 16) goto plot::@2 [ plot::line#2 plot::y#2 plot::i#1 plot::x#1 ]
to:plot::@3
plot::@3: scope:[plot] from plot::@2
[20] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::i#1 plot::line#1 plot::y#2 ]
[21] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ]
[22] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ]
[22] (byte*) plot::line#1 ← (byte*) plot::line#2 + (byte) 40 [ plot::y#2 plot::i#1 plot::line#1 ]
[23] (byte) plot::y#1 ← -- (byte) plot::y#2 [ plot::i#1 plot::line#1 plot::y#1 ]
[24] if((byte) plot::y#1!=(byte) 0) goto plot::@1 [ plot::i#1 plot::line#1 plot::y#1 ]
to:plot::@return
plot::@return: scope:[plot] from plot::@3
[23] return [ ]
[25] return [ ]
to:@return
flip: scope:[flip] from main::@7
[26] phi() [ ]
to:flip::@1
flip::@1: scope:[flip] from flip flip::@4
[24] (byte) flip::r#2 ← phi( flip/(byte) 16 flip::@4/(byte) flip::r#1 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ]
[24] (byte) flip::dstIdx#5 ← phi( flip/(byte) 15 flip::@4/(byte) flip::dstIdx#2 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ]
[24] (byte) flip::srcIdx#3 ← phi( flip/(byte) 0 flip::@4/(byte) flip::srcIdx#1 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ]
[27] (byte) flip::r#2 ← phi( flip/(byte) 16 flip::@4/(byte) flip::r#1 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ]
[27] (byte) flip::dstIdx#5 ← phi( flip/(byte) 15 flip::@4/(byte) flip::dstIdx#2 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ]
[27] (byte) flip::srcIdx#3 ← phi( flip/(byte) 0 flip::@4/(byte) flip::srcIdx#1 ) [ flip::srcIdx#3 flip::dstIdx#5 flip::r#2 ]
to:flip::@2
flip::@2: scope:[flip] from flip::@1 flip::@2
[25] (byte) flip::c#2 ← phi( flip::@1/(byte) 16 flip::@2/(byte) flip::c#1 ) [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ]
[25] (byte) flip::dstIdx#3 ← phi( flip::@1/(byte) flip::dstIdx#5 flip::@2/(byte) flip::dstIdx#1 ) [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ]
[25] (byte) flip::srcIdx#2 ← phi( flip::@1/(byte) flip::srcIdx#3 flip::@2/(byte) flip::srcIdx#1 ) [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ]
[26] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::srcIdx#2 flip::dstIdx#3 flip::$0 flip::c#2 flip::r#2 ]
[27] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::r#2 ]
[28] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::srcIdx#1 flip::dstIdx#3 flip::c#2 flip::r#2 ]
[29] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#2 flip::r#2 ]
[30] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ]
[31] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::srcIdx#1 flip::dstIdx#1 flip::c#1 flip::r#2 ]
[28] (byte) flip::c#2 ← phi( flip::@1/(byte) 16 flip::@2/(byte) flip::c#1 ) [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ]
[28] (byte) flip::dstIdx#3 ← phi( flip::@1/(byte) flip::dstIdx#5 flip::@2/(byte) flip::dstIdx#1 ) [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ]
[28] (byte) flip::srcIdx#2 ← phi( flip::@1/(byte) flip::srcIdx#3 flip::@2/(byte) flip::srcIdx#1 ) [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ]
[29] (byte~) flip::$0 ← (word) 4096 *idx (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 flip::$0 ]
[30] *((word) 4352 + (byte) flip::dstIdx#3) ← (byte~) flip::$0 [ flip::r#2 flip::srcIdx#2 flip::dstIdx#3 flip::c#2 ]
[31] (byte) flip::srcIdx#1 ← ++ (byte) flip::srcIdx#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#3 flip::c#2 ]
[32] (byte) flip::dstIdx#1 ← (byte) flip::dstIdx#3 + (byte) 16 [ flip::r#2 flip::srcIdx#1 flip::c#2 flip::dstIdx#1 ]
[33] (byte) flip::c#1 ← -- (byte) flip::c#2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ]
[34] if((byte) flip::c#1!=(byte) 0) goto flip::@2 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#1 flip::c#1 ]
to:flip::@4
flip::@4: scope:[flip] from flip::@2
[32] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#2 ]
[33] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ]
[34] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ]
[35] (byte) flip::dstIdx#2 ← -- (byte) flip::dstIdx#1 [ flip::r#2 flip::srcIdx#1 flip::dstIdx#2 ]
[36] (byte) flip::r#1 ← -- (byte) flip::r#2 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ]
[37] if((byte) flip::r#1!=(byte) 0) goto flip::@1 [ flip::srcIdx#1 flip::dstIdx#2 flip::r#1 ]
to:flip::@3
flip::@3: scope:[flip] from flip::@3 flip::@4
[35] (byte) flip::i#2 ← phi( flip::@3/(byte) flip::i#1 flip::@4/(byte) 0 ) [ flip::i#2 ]
[36] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ]
[37] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ]
[38] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ]
[39] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ]
[38] (byte) flip::i#2 ← phi( flip::@3/(byte) flip::i#1 flip::@4/(byte) 0 ) [ flip::i#2 ]
[39] (byte~) flip::$4 ← (word) 4352 *idx (byte) flip::i#2 [ flip::i#2 flip::$4 ]
[40] *((word) 4096 + (byte) flip::i#2) ← (byte~) flip::$4 [ flip::i#2 ]
[41] (byte) flip::i#1 ← ++ (byte) flip::i#2 [ flip::i#1 ]
[42] if((byte) flip::i#1!=(byte) 0) goto flip::@3 [ flip::i#1 ]
to:flip::@return
flip::@return: scope:[flip] from flip::@3
[40] return [ ]
[43] return [ ]
to:@return
prepare: scope:[prepare] from main
[44] phi() [ ]
to:prepare::@1
prepare::@1: scope:[prepare] from prepare prepare::@1
[41] (byte) prepare::i#2 ← phi( prepare/(byte) 0 prepare::@1/(byte) prepare::i#1 ) [ prepare::i#2 ]
[42] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ]
[43] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ]
[44] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ]
[45] (byte) prepare::i#2 ← phi( prepare/(byte) 0 prepare::@1/(byte) prepare::i#1 ) [ prepare::i#2 ]
[46] *((word) 4096 + (byte) prepare::i#2) ← (byte) prepare::i#2 [ prepare::i#2 ]
[47] (byte) prepare::i#1 ← ++ (byte) prepare::i#2 [ prepare::i#1 ]
[48] if((byte) prepare::i#1!=(byte) 0) goto prepare::@1 [ prepare::i#1 ]
to:prepare::@return
prepare::@return: scope:[prepare] from prepare::@1
[45] return [ ]
[49] return [ ]
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -5,13 +5,14 @@
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@1
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ]
[2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ]
[2] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ]
[3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@1
[5] return [ ]
[6] return [ ]
to:@return

View File

@ -386,8 +386,13 @@ main::@3: scope:[main] from main::@1
(byte~) main::i#3 ← (byte) main::i#1
to:main::@1
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to 0:main
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
to:@1
@1: scope:[] from @begin
@ -395,25 +400,28 @@ CONTROL FLOW GRAPH - LIVE RANGES
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@3
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@3/(byte~) main::i#3 ) [ main::i#2 ]
[2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[4] if((byte) main::i#1!=(byte) 100) goto main::@3 [ main::i#1 ]
[2] (byte) main::i#2 ← phi( main/(byte) 0 main::@3/(byte~) main::i#3 ) [ main::i#2 ]
[3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[5] if((byte) main::i#1!=(byte) 100) goto main::@3 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@1
[5] return [ ]
[6] return [ ]
to:@return
main::@3: scope:[main] from main::@1
[6] (byte~) main::i#3 ← (byte) main::i#1 [ main::i#3 ]
[7] (byte~) main::i#3 ← (byte) main::i#1 [ main::i#3 ]
to:main::@1
Created 1 initial phi equivalence classes
Coalesced [6] main::i#3 ← main::i#1
Coalesced [7] main::i#3 ← main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) main::@3
Block Sequence Planned @begin @1 @end main main::@1 main::@return
Adding NOP phi() at start of main
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
@ -423,20 +431,18 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@1
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ]
[2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ]
[2] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ]
[3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@1
[5] return [ ]
[6] return [ ]
to:@return
CALL GRAPH
Calls in [] to 0:main
DOMINATORS
@begin dominated by @begin
@1 dominated by @1 @begin
@ -477,39 +483,41 @@ bbegin:
//SEG2 @1
b1:
//SEG3 [0] call main param-assignment [ ]
//SEG4 [1] phi from @1 to main
main_from_b1:
jsr main
jmp bend
//SEG4 @end
//SEG5 @end
bend:
//SEG5 main
//SEG6 main
main: {
.label i = 2
//SEG6 [1] phi from main to main::@1
//SEG7 [2] phi from main to main::@1
b1_from_main:
//SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1
//SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta i
jmp b1
//SEG8 [1] phi from main::@1 to main::@1
//SEG9 [2] phi from main::@1 to main::@1
b1_from_b1:
//SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
//SEG10 main::@1
//SEG11 main::@1
b1:
//SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby1
//SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby1
ldx i
txa
sta $400,x
//SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1
//SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1
inc i
//SEG13 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- zpby1_neq_coby1_then_la1
//SEG14 [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- zpby1_neq_coby1_then_la1
lda i
cmp #$64
bne b1_from_b1
jmp breturn
//SEG14 main::@return
//SEG15 main::@return
breturn:
//SEG15 [5] return [ ]
//SEG16 [6] return [ ]
rts
}
@ -534,37 +542,40 @@ bbegin:
//SEG2 @1
b1:
//SEG3 [0] call main param-assignment [ ]
//SEG4 [1] phi from @1 to main
main_from_b1:
jsr main
//SEG4 @end
//SEG5 @end
bend:
//SEG5 main
//SEG6 main
main: {
//SEG6 [1] phi from main to main::@1
//SEG7 [2] phi from main to main::@1
b1_from_main:
//SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
jmp b1
//SEG8 [1] phi from main::@1 to main::@1
//SEG9 [2] phi from main::@1 to main::@1
b1_from_b1:
//SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
//SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG11 main::@1
b1:
//SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
//SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG13 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
//SEG14 [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
cpx #$64
bne b1_from_b1
//SEG14 main::@return
//SEG15 main::@return
breturn:
//SEG15 [5] return [ ]
//SEG16 [6] return [ ]
rts
}
Replacing label b1_from_b1 with b1
Removing instruction bbegin:
Removing instruction main_from_b1:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER
@ -573,31 +584,32 @@ ASSEMBLER
//SEG2 @1
b1:
//SEG3 [0] call main param-assignment [ ]
//SEG4 [1] phi from @1 to main
jsr main
//SEG4 @end
//SEG5 @end
bend:
//SEG5 main
//SEG6 main
main: {
//SEG6 [1] phi from main to main::@1
//SEG7 [2] phi from main to main::@1
b1_from_main:
//SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
jmp b1
//SEG8 [1] phi from main::@1 to main::@1
//SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
//SEG9 [2] phi from main::@1 to main::@1
//SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG11 main::@1
b1:
//SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
//SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG13 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
//SEG14 [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
cpx #$64
bne b1
//SEG14 main::@return
//SEG15 main::@return
breturn:
//SEG15 [5] return [ ]
//SEG16 [6] return [ ]
rts
}
@ -611,28 +623,29 @@ ASSEMBLER
//SEG1 @begin
//SEG2 @1
//SEG3 [0] call main param-assignment [ ]
//SEG4 [1] phi from @1 to main
jsr main
//SEG4 @end
//SEG5 main
//SEG5 @end
//SEG6 main
main: {
//SEG6 [1] phi from main to main::@1
//SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG7 [2] phi from main to main::@1
//SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
jmp b1
//SEG8 [1] phi from main::@1 to main::@1
//SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
//SEG9 [2] phi from main::@1 to main::@1
//SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG11 main::@1
b1:
//SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
//SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG13 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
//SEG14 [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
cpx #$64
bne b1
//SEG14 main::@return
//SEG15 [5] return [ ]
//SEG15 main::@return
//SEG16 [6] return [ ]
rts
}
@ -643,27 +656,28 @@ ASSEMBLER
//SEG1 @begin
//SEG2 @1
//SEG3 [0] call main param-assignment [ ]
//SEG4 [1] phi from @1 to main
jsr main
//SEG4 @end
//SEG5 main
//SEG5 @end
//SEG6 main
main: {
//SEG6 [1] phi from main to main::@1
//SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG7 [2] phi from main to main::@1
//SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
//SEG8 [1] phi from main::@1 to main::@1
//SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
//SEG9 [2] phi from main::@1 to main::@1
//SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG11 main::@1
b1:
//SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
//SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG13 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
//SEG14 [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
cpx #$64
bne b1
//SEG14 main::@return
//SEG15 [5] return [ ]
//SEG15 main::@return
//SEG16 [6] return [ ]
rts
}
@ -686,27 +700,28 @@ FINAL CODE
//SEG1 @begin
//SEG2 @1
//SEG3 [0] call main param-assignment [ ]
//SEG4 [1] phi from @1 to main
jsr main
//SEG4 @end
//SEG5 main
//SEG5 @end
//SEG6 main
main: {
//SEG6 [1] phi from main to main::@1
//SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG7 [2] phi from main to main::@1
//SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
//SEG8 [1] phi from main::@1 to main::@1
//SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
//SEG9 [2] phi from main::@1 to main::@1
//SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG11 main::@1
b1:
//SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
//SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG13 [4] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
//SEG14 [5] if((byte) main::i#1!=(byte) 100) goto main::@1 [ main::i#1 ] -- xby_neq_coby1_then_la1
cpx #$64
bne b1
//SEG14 main::@return
//SEG15 [5] return [ ]
//SEG15 main::@return
//SEG16 [6] return [ ]
rts
}

View File

@ -5,19 +5,20 @@
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@1
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ]
[2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ]
[2] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ]
[3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ]
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
[5] (byte) main::j#2 ← phi( main::@2/(byte) main::j#1 main::@1/(byte) 100 ) [ main::j#2 ]
[6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ]
[7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ]
[8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ]
[6] (byte) main::j#2 ← phi( main::@2/(byte) main::j#1 main::@1/(byte) 100 ) [ main::j#2 ]
[7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ]
[8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ]
[9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ]
to:main::@return
main::@return: scope:[main] from main::@2
[9] return [ ]
[10] return [ ]
to:@return

View File

@ -642,8 +642,13 @@ main::@5: scope:[main] from main::@1
(byte~) main::i#3 ← (byte) main::i#1
to:main::@1
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to 0:main
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
to:@1
@1: scope:[] from @begin
@ -651,36 +656,39 @@ CONTROL FLOW GRAPH - LIVE RANGES
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@5
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@5/(byte~) main::i#3 ) [ main::i#2 ]
[2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[4] if((byte) main::i#1!=(byte) 0) goto main::@5 [ main::i#1 ]
[2] (byte) main::i#2 ← phi( main/(byte) 0 main::@5/(byte~) main::i#3 ) [ main::i#2 ]
[3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[5] if((byte) main::i#1!=(byte) 0) goto main::@5 [ main::i#1 ]
to:main::@2
main::@2: scope:[main] from main::@1 main::@6
[5] (byte) main::j#2 ← phi( main::@6/(byte~) main::j#3 main::@1/(byte) 100 ) [ main::j#2 ]
[6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ]
[7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ]
[8] if((byte) main::j#1!=(byte) 255) goto main::@6 [ main::j#1 ]
[6] (byte) main::j#2 ← phi( main::@6/(byte~) main::j#3 main::@1/(byte) 100 ) [ main::j#2 ]
[7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ]
[8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ]
[9] if((byte) main::j#1!=(byte) 255) goto main::@6 [ main::j#1 ]
to:main::@return
main::@return: scope:[main] from main::@2
[9] return [ ]
[10] return [ ]
to:@return
main::@6: scope:[main] from main::@2
[10] (byte~) main::j#3 ← (byte) main::j#1 [ main::j#3 ]
[11] (byte~) main::j#3 ← (byte) main::j#1 [ main::j#3 ]
to:main::@2
main::@5: scope:[main] from main::@1
[11] (byte~) main::i#3 ← (byte) main::i#1 [ main::i#3 ]
[12] (byte~) main::i#3 ← (byte) main::i#1 [ main::i#3 ]
to:main::@1
Created 2 initial phi equivalence classes
Coalesced [10] main::j#3 ← main::j#1
Coalesced [11] main::i#3 ← main::i#1
Coalesced [11] main::j#3 ← main::j#1
Coalesced [12] main::i#3 ← main::i#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) main::@6
Culled Empty Block (label) main::@5
Block Sequence Planned @begin @1 @end main main::@1 main::@2 main::@return
Adding NOP phi() at start of main
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
@ -690,26 +698,24 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@1
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ]
[2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ]
[2] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 ) [ main::i#2 ]
[3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ]
[4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ]
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
[5] (byte) main::j#2 ← phi( main::@2/(byte) main::j#1 main::@1/(byte) 100 ) [ main::j#2 ]
[6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ]
[7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ]
[8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ]
[6] (byte) main::j#2 ← phi( main::@2/(byte) main::j#1 main::@1/(byte) 100 ) [ main::j#2 ]
[7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ]
[8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ]
[9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ]
to:main::@return
main::@return: scope:[main] from main::@2
[9] return [ ]
[10] return [ ]
to:@return
CALL GRAPH
Calls in [] to 0:main
DOMINATORS
@begin dominated by @begin
@1 dominated by @1 @begin
@ -763,61 +769,63 @@ bbegin:
//SEG2 @1
b1:
//SEG3 [0] call main param-assignment [ ]
//SEG4 [1] phi from @1 to main
main_from_b1:
jsr main
jmp bend
//SEG4 @end
//SEG5 @end
bend:
//SEG5 main
//SEG6 main
main: {
.label i = 2
.label j = 3
//SEG6 [1] phi from main to main::@1
//SEG7 [2] phi from main to main::@1
b1_from_main:
//SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1
//SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta i
jmp b1
//SEG8 [1] phi from main::@1 to main::@1
//SEG9 [2] phi from main::@1 to main::@1
b1_from_b1:
//SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
//SEG10 main::@1
//SEG11 main::@1
b1:
//SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby1
//SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_zpby1=zpby1
ldx i
txa
sta $400,x
//SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1
//SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1
inc i
//SEG13 [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_neq_0_then_la1
//SEG14 [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_neq_0_then_la1
lda i
bne b1_from_b1
//SEG14 [5] phi from main::@1 to main::@2
//SEG15 [6] phi from main::@1 to main::@2
b2_from_b1:
//SEG15 [5] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1
//SEG16 [6] phi (byte) main::j#2 = (byte) 100 -- zpby1=coby1
lda #$64
sta j
jmp b2
//SEG16 [5] phi from main::@2 to main::@2
//SEG17 [6] phi from main::@2 to main::@2
b2_from_b2:
//SEG17 [5] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy
//SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy
jmp b2
//SEG18 main::@2
//SEG19 main::@2
b2:
//SEG19 [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_zpby1=zpby1
//SEG20 [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_zpby1=zpby1
ldx j
txa
sta $500,x
//SEG20 [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- zpby1=_dec_zpby1
//SEG21 [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- zpby1=_dec_zpby1
dec j
//SEG21 [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- zpby1_neq_coby1_then_la1
//SEG22 [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- zpby1_neq_coby1_then_la1
lda j
cmp #$ff
bne b2_from_b2
jmp breturn
//SEG22 main::@return
//SEG23 main::@return
breturn:
//SEG23 [9] return [ ]
//SEG24 [10] return [ ]
rts
}
@ -844,56 +852,59 @@ bbegin:
//SEG2 @1
b1:
//SEG3 [0] call main param-assignment [ ]
//SEG4 [1] phi from @1 to main
main_from_b1:
jsr main
//SEG4 @end
//SEG5 @end
bend:
//SEG5 main
//SEG6 main
main: {
//SEG6 [1] phi from main to main::@1
//SEG7 [2] phi from main to main::@1
b1_from_main:
//SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
jmp b1
//SEG8 [1] phi from main::@1 to main::@1
//SEG9 [2] phi from main::@1 to main::@1
b1_from_b1:
//SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
//SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG11 main::@1
b1:
//SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
//SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG13 [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1
//SEG14 [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1
cpx #$0
bne b1_from_b1
//SEG14 [5] phi from main::@1 to main::@2
//SEG15 [6] phi from main::@1 to main::@2
b2_from_b1:
//SEG15 [5] phi (byte) main::j#2 = (byte) 100 -- xby=coby1
//SEG16 [6] phi (byte) main::j#2 = (byte) 100 -- xby=coby1
ldx #$64
jmp b2
//SEG16 [5] phi from main::@2 to main::@2
//SEG17 [6] phi from main::@2 to main::@2
b2_from_b2:
//SEG17 [5] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy
//SEG18 main::@2
//SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy
//SEG19 main::@2
b2:
//SEG19 [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby
//SEG20 [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby
txa
sta $500,x
//SEG20 [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby
//SEG21 [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby
dex
//SEG21 [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1
//SEG22 [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1
cpx #$ff
bne b2_from_b2
//SEG22 main::@return
//SEG23 main::@return
breturn:
//SEG23 [9] return [ ]
//SEG24 [10] return [ ]
rts
}
Replacing label b1_from_b1 with b1
Replacing label b2_from_b2 with b2
Removing instruction bbegin:
Removing instruction main_from_b1:
Removing instruction b1_from_b1:
Removing instruction b2_from_b2:
Succesful ASM optimization Pass5RedundantLabelElimination
@ -903,48 +914,49 @@ ASSEMBLER
//SEG2 @1
b1:
//SEG3 [0] call main param-assignment [ ]
//SEG4 [1] phi from @1 to main
jsr main
//SEG4 @end
//SEG5 @end
bend:
//SEG5 main
//SEG6 main
main: {
//SEG6 [1] phi from main to main::@1
//SEG7 [2] phi from main to main::@1
b1_from_main:
//SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
jmp b1
//SEG8 [1] phi from main::@1 to main::@1
//SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
//SEG9 [2] phi from main::@1 to main::@1
//SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG11 main::@1
b1:
//SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
//SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG13 [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1
//SEG14 [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1
cpx #$0
bne b1
//SEG14 [5] phi from main::@1 to main::@2
//SEG15 [6] phi from main::@1 to main::@2
b2_from_b1:
//SEG15 [5] phi (byte) main::j#2 = (byte) 100 -- xby=coby1
//SEG16 [6] phi (byte) main::j#2 = (byte) 100 -- xby=coby1
ldx #$64
jmp b2
//SEG16 [5] phi from main::@2 to main::@2
//SEG17 [5] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy
//SEG18 main::@2
//SEG17 [6] phi from main::@2 to main::@2
//SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy
//SEG19 main::@2
b2:
//SEG19 [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby
//SEG20 [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby
txa
sta $500,x
//SEG20 [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby
//SEG21 [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby
dex
//SEG21 [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1
//SEG22 [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1
cpx #$ff
bne b2
//SEG22 main::@return
//SEG23 main::@return
breturn:
//SEG23 [9] return [ ]
//SEG24 [10] return [ ]
rts
}
@ -959,44 +971,45 @@ ASSEMBLER
//SEG1 @begin
//SEG2 @1
//SEG3 [0] call main param-assignment [ ]
//SEG4 [1] phi from @1 to main
jsr main
//SEG4 @end
//SEG5 main
//SEG5 @end
//SEG6 main
main: {
//SEG6 [1] phi from main to main::@1
//SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG7 [2] phi from main to main::@1
//SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
jmp b1
//SEG8 [1] phi from main::@1 to main::@1
//SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
//SEG9 [2] phi from main::@1 to main::@1
//SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG11 main::@1
b1:
//SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
//SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG13 [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1
//SEG14 [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1
cpx #$0
bne b1
//SEG14 [5] phi from main::@1 to main::@2
//SEG15 [5] phi (byte) main::j#2 = (byte) 100 -- xby=coby1
//SEG15 [6] phi from main::@1 to main::@2
//SEG16 [6] phi (byte) main::j#2 = (byte) 100 -- xby=coby1
ldx #$64
jmp b2
//SEG16 [5] phi from main::@2 to main::@2
//SEG17 [5] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy
//SEG18 main::@2
//SEG17 [6] phi from main::@2 to main::@2
//SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy
//SEG19 main::@2
b2:
//SEG19 [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby
//SEG20 [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby
txa
sta $500,x
//SEG20 [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby
//SEG21 [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby
dex
//SEG21 [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1
//SEG22 [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1
cpx #$ff
bne b2
//SEG22 main::@return
//SEG23 [9] return [ ]
//SEG23 main::@return
//SEG24 [10] return [ ]
rts
}
@ -1008,42 +1021,43 @@ ASSEMBLER
//SEG1 @begin
//SEG2 @1
//SEG3 [0] call main param-assignment [ ]
//SEG4 [1] phi from @1 to main
jsr main
//SEG4 @end
//SEG5 main
//SEG5 @end
//SEG6 main
main: {
//SEG6 [1] phi from main to main::@1
//SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG7 [2] phi from main to main::@1
//SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
//SEG8 [1] phi from main::@1 to main::@1
//SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
//SEG9 [2] phi from main::@1 to main::@1
//SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG11 main::@1
b1:
//SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
//SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG13 [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1
//SEG14 [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1
cpx #$0
bne b1
//SEG14 [5] phi from main::@1 to main::@2
//SEG15 [5] phi (byte) main::j#2 = (byte) 100 -- xby=coby1
//SEG15 [6] phi from main::@1 to main::@2
//SEG16 [6] phi (byte) main::j#2 = (byte) 100 -- xby=coby1
ldx #$64
//SEG16 [5] phi from main::@2 to main::@2
//SEG17 [5] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy
//SEG18 main::@2
//SEG17 [6] phi from main::@2 to main::@2
//SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy
//SEG19 main::@2
b2:
//SEG19 [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby
//SEG20 [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby
txa
sta $500,x
//SEG20 [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby
//SEG21 [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby
dex
//SEG21 [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1
//SEG22 [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1
cpx #$ff
bne b2
//SEG22 main::@return
//SEG23 [9] return [ ]
//SEG23 main::@return
//SEG24 [10] return [ ]
rts
}
@ -1072,42 +1086,43 @@ FINAL CODE
//SEG1 @begin
//SEG2 @1
//SEG3 [0] call main param-assignment [ ]
//SEG4 [1] phi from @1 to main
jsr main
//SEG4 @end
//SEG5 main
//SEG5 @end
//SEG6 main
main: {
//SEG6 [1] phi from main to main::@1
//SEG7 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG7 [2] phi from main to main::@1
//SEG8 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
//SEG8 [1] phi from main::@1 to main::@1
//SEG9 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
//SEG9 [2] phi from main::@1 to main::@1
//SEG10 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG11 main::@1
b1:
//SEG11 [2] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
//SEG12 [3] *((word) 1024 + (byte) main::i#2) ← (byte) main::i#2 [ main::i#2 ] -- cowo1_staridx_xby=xby
txa
sta $400,x
//SEG12 [3] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG13 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG13 [4] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1
//SEG14 [5] if((byte) main::i#1!=(byte) 0) goto main::@1 [ main::i#1 ] -- xby_neq_0_then_la1
cpx #$0
bne b1
//SEG14 [5] phi from main::@1 to main::@2
//SEG15 [5] phi (byte) main::j#2 = (byte) 100 -- xby=coby1
//SEG15 [6] phi from main::@1 to main::@2
//SEG16 [6] phi (byte) main::j#2 = (byte) 100 -- xby=coby1
ldx #$64
//SEG16 [5] phi from main::@2 to main::@2
//SEG17 [5] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy
//SEG18 main::@2
//SEG17 [6] phi from main::@2 to main::@2
//SEG18 [6] phi (byte) main::j#2 = (byte) main::j#1 -- register_copy
//SEG19 main::@2
b2:
//SEG19 [6] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby
//SEG20 [7] *((word) 1280 + (byte) main::j#2) ← (byte) main::j#2 [ main::j#2 ] -- cowo1_staridx_xby=xby
txa
sta $500,x
//SEG20 [7] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby
//SEG21 [8] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 ] -- xby=_dec_xby
dex
//SEG21 [8] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1
//SEG22 [9] if((byte) main::j#1!=(byte) 255) goto main::@2 [ main::j#1 ] -- xby_neq_coby1_then_la1
cpx #$ff
bne b2
//SEG22 main::@return
//SEG23 [9] return [ ]
//SEG23 main::@return
//SEG24 [10] return [ ]
rts
}

View File

@ -3,18 +3,19 @@
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@2
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 ) [ main::i#2 ]
[2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ]
[2] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 ) [ main::i#2 ]
[3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ]
to:main::@3
main::@3: scope:[main] from main::@1
[3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ]
[4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ]
to:main::@2
main::@2: scope:[main] from main::@1 main::@3
[4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ]
[5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@2
[6] return [ ]
[7] return [ ]
to:@return

View File

@ -507,37 +507,45 @@ main::@5: scope:[main] from main::@2
(byte~) main::i#5 ← (byte) main::i#1
to:main::@1
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to 0:main
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@5
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@5/(byte~) main::i#5 ) [ main::i#2 ]
[2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ]
[2] (byte) main::i#2 ← phi( main/(byte) 0 main::@5/(byte~) main::i#5 ) [ main::i#2 ]
[3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ]
to:main::@3
main::@3: scope:[main] from main::@1
[3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ]
[4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ]
to:main::@2
main::@2: scope:[main] from main::@1 main::@3
[4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[5] if((byte) main::i#1<(byte) 100) goto main::@5 [ main::i#1 ]
[5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[6] if((byte) main::i#1<(byte) 100) goto main::@5 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@2
[6] return [ ]
[7] return [ ]
to:@return
main::@5: scope:[main] from main::@2
[7] (byte~) main::i#5 ← (byte) main::i#1 [ main::i#5 ]
[8] (byte~) main::i#5 ← (byte) main::i#1 [ main::i#5 ]
to:main::@1
Created 1 initial phi equivalence classes
Coalesced [7] main::i#5 ← main::i#1
Coalesced [8] main::i#5 ← main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) main::@5
Block Sequence Planned @begin @end main main::@1 main::@3 main::@2 main::@return
Adding NOP phi() at start of main
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
@ -545,25 +553,23 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@2
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 ) [ main::i#2 ]
[2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ]
[2] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 ) [ main::i#2 ]
[3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ]
to:main::@3
main::@3: scope:[main] from main::@1
[3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ]
[4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ]
to:main::@2
main::@2: scope:[main] from main::@1 main::@3
[4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ]
[5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@2
[6] return [ ]
[7] return [ ]
to:@return
CALL GRAPH
Calls in [] to 0:main
DOMINATORS
@begin dominated by @begin
@end dominated by @end @begin
@ -602,48 +608,50 @@ INITIAL ASM
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
jmp bend
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
.label i = 2
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1
//SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- zpby1=coby1
lda #$0
sta i
jmp b1
//SEG7 [1] phi from main::@2 to main::@1
//SEG8 [2] phi from main::@2 to main::@1
b1_from_b2:
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
//SEG9 main::@1
//SEG10 main::@1
b1:
//SEG10 [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- zpby1_ge_coby1_then_la1
//SEG11 [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- zpby1_ge_coby1_then_la1
lda i
cmp #$32
bcs b2
jmp b3
//SEG11 main::@3
//SEG12 main::@3
b3:
//SEG12 [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=zpby1
//SEG13 [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=zpby1
lda i
sta $400
jmp b2
//SEG13 main::@2
//SEG14 main::@2
b2:
//SEG14 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1
//SEG15 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1
inc i
//SEG15 [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- zpby1_lt_coby1_then_la1
//SEG16 [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- zpby1_lt_coby1_then_la1
lda i
cmp #$64
bcc b1_from_b2
jmp breturn
//SEG16 main::@return
//SEG17 main::@return
breturn:
//SEG17 [6] return [ ]
//SEG18 [7] return [ ]
rts
}
@ -667,42 +675,45 @@ ASSEMBLER
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
jmp b1
//SEG7 [1] phi from main::@2 to main::@1
//SEG8 [2] phi from main::@2 to main::@1
b1_from_b2:
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
//SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
b1:
//SEG10 [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1
//SEG11 [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1
cpx #$32
bcs b2
//SEG11 main::@3
//SEG12 main::@3
b3:
//SEG12 [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby
//SEG13 [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby
stx $400
//SEG13 main::@2
//SEG14 main::@2
b2:
//SEG14 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG15 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG15 [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1
//SEG16 [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1
cpx #$64
bcc b1_from_b2
//SEG16 main::@return
//SEG17 main::@return
breturn:
//SEG17 [6] return [ ]
//SEG18 [7] return [ ]
rts
}
Replacing label b1_from_b2 with b1
Removing instruction main_from_bbegin:
Removing instruction b1_from_b2:
Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER
@ -710,37 +721,38 @@ ASSEMBLER
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
jmp b1
//SEG7 [1] phi from main::@2 to main::@1
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
//SEG8 [2] phi from main::@2 to main::@1
//SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
b1:
//SEG10 [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1
//SEG11 [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1
cpx #$32
bcs b2
//SEG11 main::@3
//SEG12 main::@3
b3:
//SEG12 [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby
//SEG13 [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby
stx $400
//SEG13 main::@2
//SEG14 main::@2
b2:
//SEG14 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG15 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG15 [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1
//SEG16 [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1
cpx #$64
bcc b1
//SEG16 main::@return
//SEG17 main::@return
breturn:
//SEG17 [6] return [ ]
//SEG18 [7] return [ ]
rts
}
@ -754,33 +766,34 @@ ASSEMBLER
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
jmp b1
//SEG7 [1] phi from main::@2 to main::@1
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
//SEG8 [2] phi from main::@2 to main::@1
//SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
b1:
//SEG10 [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1
//SEG11 [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1
cpx #$32
bcs b2
//SEG11 main::@3
//SEG12 [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby
//SEG12 main::@3
//SEG13 [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby
stx $400
//SEG13 main::@2
//SEG14 main::@2
b2:
//SEG14 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG15 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG15 [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1
//SEG16 [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1
cpx #$64
bcc b1
//SEG16 main::@return
//SEG17 [6] return [ ]
//SEG17 main::@return
//SEG18 [7] return [ ]
rts
}
@ -790,32 +803,33 @@ ASSEMBLER
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
//SEG7 [1] phi from main::@2 to main::@1
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
//SEG8 [2] phi from main::@2 to main::@1
//SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
b1:
//SEG10 [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1
//SEG11 [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1
cpx #$32
bcs b2
//SEG11 main::@3
//SEG12 [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby
//SEG12 main::@3
//SEG13 [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby
stx $400
//SEG13 main::@2
//SEG14 main::@2
b2:
//SEG14 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG15 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG15 [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1
//SEG16 [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1
cpx #$64
bcc b1
//SEG16 main::@return
//SEG17 [6] return [ ]
//SEG17 main::@return
//SEG18 [7] return [ ]
rts
}
@ -838,32 +852,33 @@ FINAL CODE
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::i#2 = (byte) 0 -- xby=coby1
ldx #$0
//SEG7 [1] phi from main::@2 to main::@1
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
//SEG8 [2] phi from main::@2 to main::@1
//SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
b1:
//SEG10 [2] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1
//SEG11 [3] if((byte) main::i#2>=(byte) 50) goto main::@2 [ main::i#2 ] -- xby_ge_coby1_then_la1
cpx #$32
bcs b2
//SEG11 main::@3
//SEG12 [3] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby
//SEG12 main::@3
//SEG13 [4] *((word) 1024) ← (byte) main::i#2 [ main::i#2 ] -- _star_cowo1=xby
stx $400
//SEG13 main::@2
//SEG14 main::@2
b2:
//SEG14 [4] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG15 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG15 [5] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1
//SEG16 [6] if((byte) main::i#1<(byte) 100) goto main::@1 [ main::i#1 ] -- xby_lt_coby1_then_la1
cpx #$64
bcc b1
//SEG16 main::@return
//SEG17 [6] return [ ]
//SEG17 main::@return
//SEG18 [7] return [ ]
rts
}

View File

@ -0,0 +1,21 @@
jsr main
main: {
.label a = 2
ldx #$0
jsr inc
clc
adc #$4
sta a
jsr inc
clc
adc a
rts
}
inc: {
txa
clc
adc #$7
tax
txa
rts
}

View File

@ -0,0 +1,28 @@
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
[2] call inc param-assignment [ inc::return#0 inc::$0 ]
to:main::@1
main::@1: scope:[main] from main
[3] (byte~) main::$0 ← (byte) inc::return#0 [ main::$0 inc::$0 ]
[4] (byte) main::a#1 ← (byte) 4 + (byte~) main::$0 [ main::a#1 inc::$0 ]
[5] call inc param-assignment [ inc::return#0 main::a#1 ]
to:main::@2
main::@2: scope:[main] from main::@1
[6] (byte~) main::$2 ← (byte) inc::return#0 [ main::a#1 main::$2 ]
[7] (byte) main::a#2 ← (byte) main::a#1 + (byte~) main::$2 [ ]
to:main::@return
main::@return: scope:[main] from main::@2
[8] return [ ]
to:@return
inc: scope:[inc] from main main::@1
[9] (byte) i#11 ← phi( main/(byte) 0 main::@1/(byte~) inc::$0 ) [ i#11 ]
[10] (byte~) inc::$0 ← (byte) i#11 + (byte) 7 [ inc::$0 ]
[11] (byte) inc::return#0 ← (byte~) inc::$0 [ inc::return#0 inc::$0 ]
to:inc::@return
inc::@return: scope:[inc] from inc
[12] return [ inc::return#0 inc::$0 ]
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
(label) @begin
(label) @end
(byte) i
(byte) i#11 reg byte x 4.0
(byte()) inc()
(byte~) inc::$0 reg byte x 1.0
(label) inc::@return
(byte) inc::return
(byte) inc::return#0 reg byte a 1.5
(void()) main()
(byte~) main::$0 reg byte a 4.0
(byte~) main::$2 reg byte a 4.0
(label) main::@1
(label) main::@2
(label) main::@return
(byte) main::a
(byte) main::a#1 a zp ZP_BYTE:2 1.3333333333333333
(byte) main::a#2 reg byte a 20.0
reg byte x [ i#11 inc::$0 ]
reg byte a [ main::$0 ]
zp ZP_BYTE:2 [ main::a#1 ]
reg byte a [ main::$2 ]
reg byte a [ main::a#2 ]
reg byte a [ inc::return#0 ]

View File

@ -9,7 +9,7 @@
[2] (byte) s#1 ← (byte) s#2 + (byte) i#2 [ i#2 s#1 ]
to:@2
@2: scope:[] from @1 @3
[3] (byte) s#4 ← phi( @1/(byte) s#2 @3/(byte) s#1 ) [ s#4 i#2 ]
[3] (byte) s#4 ← phi( @1/(byte) s#2 @3/(byte) s#1 ) [ i#2 s#4 ]
[4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ]
[5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ]
to:@end

View File

@ -345,11 +345,14 @@ CONTROL FLOW GRAPH - PHI LIFTED
(byte~) s#6 ← (byte) s#2
to:@2
CALL GRAPH
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
to:@1
@1: scope:[] from @5 @begin
@ -363,8 +366,8 @@ CONTROL FLOW GRAPH - LIVE RANGES
to:@2
@2: scope:[] from @3 @6
[4] (byte) s#4 ← phi( @6/(byte~) s#6 @3/(byte~) s#7 ) [ i#2 s#4 ]
[5] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ]
[6] if((byte) i#1>(byte) 0) goto @5 [ i#1 s#4 ]
[5] (byte) i#1 ← -- (byte) i#2 [ s#4 i#1 ]
[6] if((byte) i#1>(byte) 0) goto @5 [ s#4 i#1 ]
to:@end
@end: scope:[] from @2
@5: scope:[] from @2
@ -399,14 +402,12 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED
[2] (byte) s#1 ← (byte) s#2 + (byte) i#2 [ i#2 s#1 ]
to:@2
@2: scope:[] from @1 @3
[3] (byte) s#4 ← phi( @1/(byte) s#2 @3/(byte) s#1 ) [ s#4 i#2 ]
[3] (byte) s#4 ← phi( @1/(byte) s#2 @3/(byte) s#1 ) [ i#2 s#4 ]
[4] (byte) i#1 ← -- (byte) i#2 [ i#1 s#4 ]
[5] if((byte) i#1>(byte) 0) goto @1 [ i#1 s#4 ]
to:@end
@end: scope:[] from @2
CALL GRAPH
DOMINATORS
@begin dominated by @begin
@1 dominated by @1 @begin

View File

@ -3,26 +3,28 @@
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@3
[1] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ]
[2] call nest param-assignment [ main::i#2 ]
[2] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ]
[3] call nest param-assignment [ main::i#2 ]
to:main::@3
main::@3: scope:[main] from main::@1
[3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ]
[4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ]
[4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ]
[5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@3
[5] return [ ]
[6] return [ ]
to:@return
nest: scope:[nest] from main::@1
[7] phi() [ ]
to:nest::@1
nest::@1: scope:[nest] from nest nest::@1
[6] (byte) nest::j#2 ← phi( nest/(byte) 100 nest::@1/(byte) nest::j#1 ) [ main::i#2 nest::j#2 ]
[7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ]
[8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ]
[9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ]
[8] (byte) nest::j#2 ← phi( nest/(byte) 100 nest::@1/(byte) nest::j#1 ) [ nest::j#2 ]
[9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ]
[10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ]
[11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ]
to:nest::@return
nest::@return: scope:[nest] from nest::@1
[10] return [ main::i#2 ]
[12] return [ ]
to:@return

View File

@ -642,99 +642,97 @@ nest::@3: scope:[nest] from nest::@1
(byte~) nest::j#3 ← (byte) nest::j#1
to:nest::@1
Adding NOP phi() at start of main
Adding NOP phi() at start of nest
CALL GRAPH
Calls in [] to 0:main
Calls in [main] to 3:nest
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagated main::i#2 through call [2] call nest param-assignment
Propagating live ranges...
Propagated main::i#2 through call [2] call nest param-assignment
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@4
[1] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte~) main::i#4 ) [ main::i#2 ]
[2] call nest param-assignment [ main::i#2 ]
[2] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte~) main::i#4 ) [ main::i#2 ]
[3] call nest param-assignment [ main::i#2 ]
to:main::@3
main::@3: scope:[main] from main::@1
[3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ]
[4] if((byte) main::i#1>(byte) 0) goto main::@4 [ main::i#1 ]
[4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ]
[5] if((byte) main::i#1>(byte) 0) goto main::@4 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@3
[5] return [ ]
[6] return [ ]
to:@return
main::@4: scope:[main] from main::@3
[6] (byte~) main::i#4 ← (byte) main::i#1 [ main::i#4 ]
[7] (byte~) main::i#4 ← (byte) main::i#1 [ main::i#4 ]
to:main::@1
nest: scope:[nest] from main::@1
[8] phi() [ ]
to:nest::@1
nest::@1: scope:[nest] from nest nest::@3
[7] (byte) nest::j#2 ← phi( nest/(byte) 100 nest::@3/(byte~) nest::j#3 ) [ main::i#2 nest::j#2 ]
[8] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ]
[9] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ]
[10] if((byte) nest::j#1>(byte) 0) goto nest::@3 [ main::i#2 nest::j#1 ]
[9] (byte) nest::j#2 ← phi( nest/(byte) 100 nest::@3/(byte~) nest::j#3 ) [ nest::j#2 ]
[10] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ]
[11] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ]
[12] if((byte) nest::j#1>(byte) 0) goto nest::@3 [ nest::j#1 ]
to:nest::@return
nest::@return: scope:[nest] from nest::@1
[11] return [ main::i#2 ]
[13] return [ ]
to:@return
nest::@3: scope:[nest] from nest::@1
[12] (byte~) nest::j#3 ← (byte) nest::j#1 [ main::i#2 nest::j#3 ]
[14] (byte~) nest::j#3 ← (byte) nest::j#1 [ nest::j#3 ]
to:nest::@1
Created 2 initial phi equivalence classes
Coalesced [6] main::i#4 ← main::i#1
Coalesced [12] nest::j#3 ← nest::j#1
Coalesced [7] main::i#4 ← main::i#1
Coalesced [14] nest::j#3 ← nest::j#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) main::@4
Culled Empty Block (label) nest::@3
Block Sequence Planned @begin @end main main::@1 main::@3 main::@return nest nest::@1 nest::@return
Adding NOP phi() at start of main
Adding NOP phi() at start of nest
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagated main::i#2 through call [2] call nest param-assignment
Propagating live ranges...
Propagated main::i#2 through call [2] call nest param-assignment
Propagating live ranges...
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@3
[1] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ]
[2] call nest param-assignment [ main::i#2 ]
[2] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ]
[3] call nest param-assignment [ main::i#2 ]
to:main::@3
main::@3: scope:[main] from main::@1
[3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ]
[4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ]
[4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ]
[5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@3
[5] return [ ]
[6] return [ ]
to:@return
nest: scope:[nest] from main::@1
[7] phi() [ ]
to:nest::@1
nest::@1: scope:[nest] from nest nest::@1
[6] (byte) nest::j#2 ← phi( nest/(byte) 100 nest::@1/(byte) nest::j#1 ) [ main::i#2 nest::j#2 ]
[7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ]
[8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ]
[9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ]
[8] (byte) nest::j#2 ← phi( nest/(byte) 100 nest::@1/(byte) nest::j#1 ) [ nest::j#2 ]
[9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ]
[10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ]
[11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ]
to:nest::@return
nest::@return: scope:[nest] from nest::@1
[10] return [ main::i#2 ]
[12] return [ ]
to:@return
CALL GRAPH
Calls in [] to 0:main
Calls in [main] to 2:nest
DOMINATORS
@begin dominated by @begin
@end dominated by @end @begin
@ -769,7 +767,7 @@ VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 3.142857142857143
(byte) main::i#2 11.0
(void()) nest()
(byte) nest::j
(byte) nest::j#1 151.5
@ -788,68 +786,72 @@ INITIAL ASM
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
jmp bend
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
.label i = 2
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1
//SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1
lda #$64
sta i
jmp b1
//SEG7 [1] phi from main::@3 to main::@1
//SEG8 [2] phi from main::@3 to main::@1
b1_from_b3:
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
//SEG9 main::@1
//SEG10 main::@1
b1:
//SEG10 [2] call nest param-assignment [ main::i#2 ]
//SEG11 [3] call nest param-assignment [ main::i#2 ]
//SEG12 [7] phi from main::@1 to nest
nest_from_b1:
jsr nest
jmp b3
//SEG11 main::@3
//SEG13 main::@3
b3:
//SEG12 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1
//SEG14 [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- zpby1=_dec_zpby1
dec i
//SEG13 [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1
//SEG15 [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- zpby1_gt_0_then_la1
lda i
bne b1_from_b3
jmp breturn
//SEG14 main::@return
//SEG16 main::@return
breturn:
//SEG15 [5] return [ ]
//SEG17 [6] return [ ]
rts
}
//SEG16 nest
//SEG18 nest
nest: {
.label j = 3
//SEG17 [6] phi from nest to nest::@1
//SEG19 [8] phi from nest to nest::@1
b1_from_nest:
//SEG18 [6] phi (byte) nest::j#2 = (byte) 100 -- zpby1=coby1
//SEG20 [8] phi (byte) nest::j#2 = (byte) 100 -- zpby1=coby1
lda #$64
sta j
jmp b1
//SEG19 [6] phi from nest::@1 to nest::@1
//SEG21 [8] phi from nest::@1 to nest::@1
b1_from_b1:
//SEG20 [6] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy
//SEG22 [8] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy
jmp b1
//SEG21 nest::@1
//SEG23 nest::@1
b1:
//SEG22 [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] -- _star_cowo1=zpby1
//SEG24 [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] -- _star_cowo1=zpby1
lda j
sta $400
//SEG23 [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] -- zpby1=_dec_zpby1
//SEG25 [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] -- zpby1=_dec_zpby1
dec j
//SEG24 [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] -- zpby1_gt_0_then_la1
//SEG26 [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] -- zpby1_gt_0_then_la1
lda j
bne b1_from_b1
jmp breturn
//SEG25 nest::@return
//SEG27 nest::@return
breturn:
//SEG26 [10] return [ main::i#2 ]
//SEG28 [12] return [ ]
rts
}
@ -859,12 +861,12 @@ Potential registers zp ZP_BYTE:3 [ nest::j#2 nest::j#1 ] : zp ZP_BYTE:3 , reg by
REGISTER UPLIFT SCOPES
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 [main] 27.5: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope []
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
Uplifting [nest] best 2425 combination reg byte x [ nest::j#2 nest::j#1 ]
Uplifting [main] best 2355 combination reg byte y [ main::i#2 main::i#1 ]
Uplifting [] best 2355 combination
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b3
@ -877,63 +879,69 @@ ASSEMBLER
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- yby=coby1
//SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- yby=coby1
ldy #$64
jmp b1
//SEG7 [1] phi from main::@3 to main::@1
//SEG8 [2] phi from main::@3 to main::@1
b1_from_b3:
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
//SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
b1:
//SEG10 [2] call nest param-assignment [ main::i#2 ]
//SEG11 [3] call nest param-assignment [ main::i#2 ]
//SEG12 [7] phi from main::@1 to nest
nest_from_b1:
jsr nest
//SEG11 main::@3
//SEG13 main::@3
b3:
//SEG12 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby
//SEG14 [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby
dey
//SEG13 [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1
//SEG15 [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1
cpy #$0
bne b1_from_b3
//SEG14 main::@return
//SEG16 main::@return
breturn:
//SEG15 [5] return [ ]
//SEG17 [6] return [ ]
rts
}
//SEG16 nest
//SEG18 nest
nest: {
//SEG17 [6] phi from nest to nest::@1
//SEG19 [8] phi from nest to nest::@1
b1_from_nest:
//SEG18 [6] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1
//SEG20 [8] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1
ldx #$64
jmp b1
//SEG19 [6] phi from nest::@1 to nest::@1
//SEG21 [8] phi from nest::@1 to nest::@1
b1_from_b1:
//SEG20 [6] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy
//SEG21 nest::@1
//SEG22 [8] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy
//SEG23 nest::@1
b1:
//SEG22 [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] -- _star_cowo1=xby
//SEG24 [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] -- _star_cowo1=xby
stx $400
//SEG23 [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] -- xby=_dec_xby
//SEG25 [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] -- xby=_dec_xby
dex
//SEG24 [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] -- xby_gt_0_then_la1
//SEG26 [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] -- xby_gt_0_then_la1
cpx #$0
bne b1_from_b1
//SEG25 nest::@return
//SEG27 nest::@return
breturn:
//SEG26 [10] return [ main::i#2 ]
//SEG28 [12] return [ ]
rts
}
Replacing label b1_from_b3 with b1
Replacing label b1_from_b1 with b1
Removing instruction main_from_bbegin:
Removing instruction b1_from_b3:
Removing instruction nest_from_b1:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER
@ -941,55 +949,57 @@ ASSEMBLER
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- yby=coby1
//SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- yby=coby1
ldy #$64
jmp b1
//SEG7 [1] phi from main::@3 to main::@1
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
//SEG8 [2] phi from main::@3 to main::@1
//SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
b1:
//SEG10 [2] call nest param-assignment [ main::i#2 ]
//SEG11 [3] call nest param-assignment [ main::i#2 ]
//SEG12 [7] phi from main::@1 to nest
jsr nest
//SEG11 main::@3
//SEG13 main::@3
b3:
//SEG12 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby
//SEG14 [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby
dey
//SEG13 [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1
//SEG15 [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1
cpy #$0
bne b1
//SEG14 main::@return
//SEG16 main::@return
breturn:
//SEG15 [5] return [ ]
//SEG17 [6] return [ ]
rts
}
//SEG16 nest
//SEG18 nest
nest: {
//SEG17 [6] phi from nest to nest::@1
//SEG19 [8] phi from nest to nest::@1
b1_from_nest:
//SEG18 [6] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1
//SEG20 [8] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1
ldx #$64
jmp b1
//SEG19 [6] phi from nest::@1 to nest::@1
//SEG20 [6] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy
//SEG21 nest::@1
//SEG21 [8] phi from nest::@1 to nest::@1
//SEG22 [8] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy
//SEG23 nest::@1
b1:
//SEG22 [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] -- _star_cowo1=xby
//SEG24 [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] -- _star_cowo1=xby
stx $400
//SEG23 [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] -- xby=_dec_xby
//SEG25 [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] -- xby=_dec_xby
dex
//SEG24 [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] -- xby_gt_0_then_la1
//SEG26 [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] -- xby_gt_0_then_la1
cpx #$0
bne b1
//SEG25 nest::@return
//SEG27 nest::@return
breturn:
//SEG26 [10] return [ main::i#2 ]
//SEG28 [12] return [ ]
rts
}
@ -1005,49 +1015,51 @@ ASSEMBLER
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- yby=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- yby=coby1
ldy #$64
jmp b1
//SEG7 [1] phi from main::@3 to main::@1
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
//SEG8 [2] phi from main::@3 to main::@1
//SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
b1:
//SEG10 [2] call nest param-assignment [ main::i#2 ]
//SEG11 [3] call nest param-assignment [ main::i#2 ]
//SEG12 [7] phi from main::@1 to nest
jsr nest
//SEG11 main::@3
//SEG12 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby
//SEG13 main::@3
//SEG14 [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby
dey
//SEG13 [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1
//SEG15 [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1
cpy #$0
bne b1
//SEG14 main::@return
//SEG15 [5] return [ ]
//SEG16 main::@return
//SEG17 [6] return [ ]
rts
}
//SEG16 nest
//SEG18 nest
nest: {
//SEG17 [6] phi from nest to nest::@1
//SEG18 [6] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1
//SEG19 [8] phi from nest to nest::@1
//SEG20 [8] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1
ldx #$64
jmp b1
//SEG19 [6] phi from nest::@1 to nest::@1
//SEG20 [6] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy
//SEG21 nest::@1
//SEG21 [8] phi from nest::@1 to nest::@1
//SEG22 [8] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy
//SEG23 nest::@1
b1:
//SEG22 [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] -- _star_cowo1=xby
//SEG24 [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] -- _star_cowo1=xby
stx $400
//SEG23 [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] -- xby=_dec_xby
//SEG25 [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] -- xby=_dec_xby
dex
//SEG24 [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] -- xby_gt_0_then_la1
//SEG26 [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] -- xby_gt_0_then_la1
cpx #$0
bne b1
//SEG25 nest::@return
//SEG26 [10] return [ main::i#2 ]
//SEG27 nest::@return
//SEG28 [12] return [ ]
rts
}
@ -1058,47 +1070,49 @@ ASSEMBLER
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- yby=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- yby=coby1
ldy #$64
//SEG7 [1] phi from main::@3 to main::@1
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
//SEG8 [2] phi from main::@3 to main::@1
//SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
b1:
//SEG10 [2] call nest param-assignment [ main::i#2 ]
//SEG11 [3] call nest param-assignment [ main::i#2 ]
//SEG12 [7] phi from main::@1 to nest
jsr nest
//SEG11 main::@3
//SEG12 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby
//SEG13 main::@3
//SEG14 [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby
dey
//SEG13 [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1
//SEG15 [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1
cpy #$0
bne b1
//SEG14 main::@return
//SEG15 [5] return [ ]
//SEG16 main::@return
//SEG17 [6] return [ ]
rts
}
//SEG16 nest
//SEG18 nest
nest: {
//SEG17 [6] phi from nest to nest::@1
//SEG18 [6] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1
//SEG19 [8] phi from nest to nest::@1
//SEG20 [8] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1
ldx #$64
//SEG19 [6] phi from nest::@1 to nest::@1
//SEG20 [6] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy
//SEG21 nest::@1
//SEG21 [8] phi from nest::@1 to nest::@1
//SEG22 [8] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy
//SEG23 nest::@1
b1:
//SEG22 [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] -- _star_cowo1=xby
//SEG24 [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] -- _star_cowo1=xby
stx $400
//SEG23 [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] -- xby=_dec_xby
//SEG25 [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] -- xby=_dec_xby
dex
//SEG24 [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] -- xby_gt_0_then_la1
//SEG26 [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] -- xby_gt_0_then_la1
cpx #$0
bne b1
//SEG25 nest::@return
//SEG26 [10] return [ main::i#2 ]
//SEG27 nest::@return
//SEG28 [12] return [ ]
rts
}
@ -1112,7 +1126,7 @@ FINAL SYMBOL TABLE
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte y 16.5
(byte) main::i#2 reg byte y 3.142857142857143
(byte) main::i#2 reg byte y 11.0
(void()) nest()
(label) nest::@1
(label) nest::@return
@ -1127,47 +1141,49 @@ FINAL CODE
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::i#2 = (byte) 100 -- yby=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::i#2 = (byte) 100 -- yby=coby1
ldy #$64
//SEG7 [1] phi from main::@3 to main::@1
//SEG8 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG9 main::@1
//SEG8 [2] phi from main::@3 to main::@1
//SEG9 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG10 main::@1
b1:
//SEG10 [2] call nest param-assignment [ main::i#2 ]
//SEG11 [3] call nest param-assignment [ main::i#2 ]
//SEG12 [7] phi from main::@1 to nest
jsr nest
//SEG11 main::@3
//SEG12 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby
//SEG13 main::@3
//SEG14 [4] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ] -- yby=_dec_yby
dey
//SEG13 [4] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1
//SEG15 [5] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ] -- yby_gt_0_then_la1
cpy #$0
bne b1
//SEG14 main::@return
//SEG15 [5] return [ ]
//SEG16 main::@return
//SEG17 [6] return [ ]
rts
}
//SEG16 nest
//SEG18 nest
nest: {
//SEG17 [6] phi from nest to nest::@1
//SEG18 [6] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1
//SEG19 [8] phi from nest to nest::@1
//SEG20 [8] phi (byte) nest::j#2 = (byte) 100 -- xby=coby1
ldx #$64
//SEG19 [6] phi from nest::@1 to nest::@1
//SEG20 [6] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy
//SEG21 nest::@1
//SEG21 [8] phi from nest::@1 to nest::@1
//SEG22 [8] phi (byte) nest::j#2 = (byte) nest::j#1 -- register_copy
//SEG23 nest::@1
b1:
//SEG22 [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] -- _star_cowo1=xby
//SEG24 [9] *((word) 1024) ← (byte) nest::j#2 [ nest::j#2 ] -- _star_cowo1=xby
stx $400
//SEG23 [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] -- xby=_dec_xby
//SEG25 [10] (byte) nest::j#1 ← -- (byte) nest::j#2 [ nest::j#1 ] -- xby=_dec_xby
dex
//SEG24 [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] -- xby_gt_0_then_la1
//SEG26 [11] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ nest::j#1 ] -- xby_gt_0_then_la1
cpx #$0
bne b1
//SEG25 nest::@return
//SEG26 [10] return [ main::i#2 ]
//SEG27 nest::@return
//SEG28 [12] return [ ]
rts
}

View File

@ -7,7 +7,7 @@
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte y 16.5
(byte) main::i#2 reg byte y 3.142857142857143
(byte) main::i#2 reg byte y 11.0
(void()) nest()
(label) nest::@1
(label) nest::@return

View File

@ -3,60 +3,63 @@
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@3
[1] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ]
[2] (byte) main::i#2 ← phi( main/(byte) 100 main::@3/(byte) main::i#1 ) [ main::i#2 ]
to:main::@2
main::@2: scope:[main] from main::@1 main::@5
[2] (byte) main::j#2 ← phi( main::@1/(byte) 100 main::@5/(byte) main::j#1 ) [ main::j#2 main::i#2 ]
[3] call nest1 param-assignment [ main::j#2 main::i#2 ]
[3] (byte) main::j#2 ← phi( main::@1/(byte) 100 main::@5/(byte) main::j#1 ) [ main::i#2 main::j#2 ]
[4] call nest1 param-assignment [ main::i#2 main::j#2 ]
to:main::@5
main::@5: scope:[main] from main::@2
[4] (byte) main::j#1 ← -- (byte) main::j#2 [ main::j#1 main::i#2 ]
[5] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::j#1 main::i#2 ]
[5] (byte) main::j#1 ← -- (byte) main::j#2 [ main::i#2 main::j#1 ]
[6] if((byte) main::j#1>(byte) 0) goto main::@2 [ main::i#2 main::j#1 ]
to:main::@3
main::@3: scope:[main] from main::@5
[6] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ]
[7] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ]
[7] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 ]
[8] if((byte) main::i#1>(byte) 0) goto main::@1 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@3
[8] return [ ]
[9] return [ ]
to:@return
nest1: scope:[nest1] from main::@2
[10] phi() [ ]
to:nest1::@1
nest1::@1: scope:[nest1] from nest1 nest1::@3
[9] (byte) nest1::i#2 ← phi( nest1/(byte) 100 nest1::@3/(byte) nest1::i#1 ) [ main::j#2 main::i#2 nest1::i#2 ]
[11] (byte) nest1::i#2 ← phi( nest1/(byte) 100 nest1::@3/(byte) nest1::i#1 ) [ nest1::i#2 ]
to:nest1::@2
nest1::@2: scope:[nest1] from nest1::@1 nest1::@5
[10] (byte) nest1::j#2 ← phi( nest1::@1/(byte) 100 nest1::@5/(byte) nest1::j#1 ) [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ]
[11] call nest2 param-assignment [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ]
[12] (byte) nest1::j#2 ← phi( nest1::@1/(byte) 100 nest1::@5/(byte) nest1::j#1 ) [ nest1::i#2 nest1::j#2 ]
[13] call nest2 param-assignment [ nest1::i#2 nest1::j#2 ]
to:nest1::@5
nest1::@5: scope:[nest1] from nest1::@2
[12] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ]
[13] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ main::j#2 main::i#2 nest1::j#1 nest1::i#2 ]
[14] (byte) nest1::j#1 ← -- (byte) nest1::j#2 [ nest1::i#2 nest1::j#1 ]
[15] if((byte) nest1::j#1>(byte) 0) goto nest1::@2 [ nest1::i#2 nest1::j#1 ]
to:nest1::@3
nest1::@3: scope:[nest1] from nest1::@5
[14] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ main::j#2 main::i#2 nest1::i#1 ]
[15] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ main::j#2 main::i#2 nest1::i#1 ]
[16] (byte) nest1::i#1 ← -- (byte) nest1::i#2 [ nest1::i#1 ]
[17] if((byte) nest1::i#1>(byte) 0) goto nest1::@1 [ nest1::i#1 ]
to:nest1::@return
nest1::@return: scope:[nest1] from nest1::@3
[16] return [ main::j#2 main::i#2 ]
[18] return [ ]
to:@return
nest2: scope:[nest2] from nest1::@2
[19] phi() [ ]
to:nest2::@1
nest2::@1: scope:[nest2] from nest2 nest2::@3
[17] (byte) nest2::i#2 ← phi( nest2/(byte) 100 nest2::@3/(byte) nest2::i#1 ) [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#2 ]
[20] (byte) nest2::i#2 ← phi( nest2/(byte) 100 nest2::@3/(byte) nest2::i#1 ) [ nest2::i#2 ]
to:nest2::@2
nest2::@2: scope:[nest2] from nest2::@1 nest2::@2
[18] (byte) nest2::j#2 ← phi( nest2::@1/(byte) 100 nest2::@2/(byte) nest2::j#1 ) [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ]
[19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ]
[20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ]
[21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ]
[21] (byte) nest2::j#2 ← phi( nest2::@1/(byte) 100 nest2::@2/(byte) nest2::j#1 ) [ nest2::i#2 nest2::j#2 ]
[22] *((word) 1024) ← (byte) nest2::j#2 [ nest2::i#2 nest2::j#2 ]
[23] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ nest2::i#2 nest2::j#1 ]
[24] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ nest2::i#2 nest2::j#1 ]
to:nest2::@3
nest2::@3: scope:[nest2] from nest2::@2
[22] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ]
[23] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ]
[25] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ nest2::i#1 ]
[26] if((byte) nest2::i#1>(byte) 0) goto nest2::@1 [ nest2::i#1 ]
to:nest2::@return
nest2::@return: scope:[nest2] from nest2::@3
[24] return [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 ]
[27] return [ ]
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -9,10 +9,10 @@
(label) main::@return
(byte) main::i
(byte) main::i#1 i zp ZP_BYTE:2 16.5
(byte) main::i#2 i zp ZP_BYTE:2 1.0476190476190477
(byte) main::i#2 i zp ZP_BYTE:2 4.4
(byte) main::j
(byte) main::j#1 j zp ZP_BYTE:3 151.5
(byte) main::j#2 j zp ZP_BYTE:3 11.222222222222221
(byte) main::j#2 j zp ZP_BYTE:3 101.0
(void()) nest1()
(label) nest1::@1
(label) nest1::@2
@ -21,10 +21,10 @@
(label) nest1::@return
(byte) nest1::i
(byte) nest1::i#1 i zp ZP_BYTE:4 1501.5
(byte) nest1::i#2 i zp ZP_BYTE:4 154.0
(byte) nest1::i#2 i zp ZP_BYTE:4 400.4
(byte) nest1::j
(byte) nest1::j#1 reg byte a 15001.5
(byte) nest1::j#2 reg byte a 2000.2
(byte) nest1::j#2 reg byte a 10001.0
(void()) nest2()
(label) nest2::@1
(label) nest2::@2

View File

@ -3,22 +3,23 @@
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@4 main::@8
[1] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte) main::s#1 main::@8/(byte) main::s#2 ) [ main::i#2 main::s#3 ]
[1] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte) main::i#1 main::@8/(byte) main::i#1 ) [ main::i#2 main::s#3 ]
[2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ]
[3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ]
[2] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte) main::s#1 main::@8/(byte) main::s#2 ) [ main::i#2 main::s#3 ]
[2] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte) main::i#1 main::@8/(byte) main::i#1 ) [ main::i#2 main::s#3 ]
[3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ]
[4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@1
[4] return [ ]
[5] return [ ]
to:@return
main::@2: scope:[main] from main::@1
[5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ]
[6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ]
to:main::@8
main::@8: scope:[main] from main::@2
[6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ]
[7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ]
to:main::@1
main::@4: scope:[main] from main::@2
[7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ]
[8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ]
to:main::@1

View File

@ -499,47 +499,55 @@ main::@4: scope:[main] from main::@2
(byte~) main::s#7 ← (byte) main::s#1
to:main::@1
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to 0:main
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@4 main::@8
[1] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte~) main::s#7 main::@8/(byte~) main::s#8 ) [ main::i#2 main::s#3 ]
[1] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte~) main::i#6 main::@8/(byte~) main::i#7 ) [ main::i#2 main::s#3 ]
[2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ]
[3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ]
[2] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte~) main::s#7 main::@8/(byte~) main::s#8 ) [ main::i#2 main::s#3 ]
[2] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte~) main::i#6 main::@8/(byte~) main::i#7 ) [ main::i#2 main::s#3 ]
[3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ]
[4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@1
[4] return [ ]
[5] return [ ]
to:@return
main::@2: scope:[main] from main::@1
[5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ]
[6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ]
to:main::@8
main::@8: scope:[main] from main::@2
[6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ]
[7] (byte~) main::i#7 ← (byte) main::i#1 [ main::i#7 main::s#2 ]
[8] (byte~) main::s#8 ← (byte) main::s#2 [ main::i#7 main::s#8 ]
[7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ]
[8] (byte~) main::i#7 ← (byte) main::i#1 [ main::i#7 main::s#2 ]
[9] (byte~) main::s#8 ← (byte) main::s#2 [ main::i#7 main::s#8 ]
to:main::@1
main::@4: scope:[main] from main::@2
[9] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ]
[10] (byte~) main::i#6 ← (byte) main::i#1 [ main::i#6 main::s#1 ]
[11] (byte~) main::s#7 ← (byte) main::s#1 [ main::i#6 main::s#7 ]
[10] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ]
[11] (byte~) main::i#6 ← (byte) main::i#1 [ main::i#6 main::s#1 ]
[12] (byte~) main::s#7 ← (byte) main::s#1 [ main::i#6 main::s#7 ]
to:main::@1
Created 2 initial phi equivalence classes
Coalesced [7] main::i#7 ← main::i#1
Coalesced [8] main::s#8 ← main::s#2
Coalesced (already) [10] main::i#6 ← main::i#1
Coalesced [11] main::s#7 ← main::s#1
Coalesced [8] main::i#7 ← main::i#1
Coalesced [9] main::s#8 ← main::s#2
Coalesced (already) [11] main::i#6 ← main::i#1
Coalesced [12] main::s#7 ← main::s#1
Coalesced down to 2 phi equivalence classes
Block Sequence Planned @begin @end main main::@1 main::@return main::@2 main::@8 main::@4
Adding NOP phi() at start of main
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
@ -550,29 +558,27 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@4 main::@8
[1] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte) main::s#1 main::@8/(byte) main::s#2 ) [ main::i#2 main::s#3 ]
[1] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte) main::i#1 main::@8/(byte) main::i#1 ) [ main::i#2 main::s#3 ]
[2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ]
[3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ]
[2] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte) main::s#1 main::@8/(byte) main::s#2 ) [ main::i#2 main::s#3 ]
[2] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte) main::i#1 main::@8/(byte) main::i#1 ) [ main::i#2 main::s#3 ]
[3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ]
[4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@1
[4] return [ ]
[5] return [ ]
to:@return
main::@2: scope:[main] from main::@1
[5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ]
[6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ]
to:main::@8
main::@8: scope:[main] from main::@2
[6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ]
[7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ]
to:main::@1
main::@4: scope:[main] from main::@2
[7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ]
[8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ]
to:main::@1
CALL GRAPH
Calls in [] to 0:main
DOMINATORS
@begin dominated by @begin
@end dominated by @end @begin
@ -621,56 +627,58 @@ INITIAL ASM
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
jmp bend
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
.label i = 2
.label s = 3
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::s#3 = (byte) 0 -- zpby1=coby1
//SEG7 [2] phi (byte) main::s#3 = (byte) 0 -- zpby1=coby1
lda #$0
sta s
//SEG7 [1] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1
//SEG8 [2] phi (byte) main::i#2 = (byte) 100 -- zpby1=coby1
lda #$64
sta i
jmp b1
//SEG8 main::@1
//SEG9 main::@1
b1:
//SEG9 [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] -- zpby1=_dec_zpby1
//SEG10 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] -- zpby1=_dec_zpby1
dec i
//SEG10 [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] -- zpby1_gt_0_then_la1
//SEG11 [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] -- zpby1_gt_0_then_la1
lda i
bne b2
jmp breturn
//SEG11 main::@return
//SEG12 main::@return
breturn:
//SEG12 [4] return [ ]
//SEG13 [5] return [ ]
rts
//SEG13 main::@2
//SEG14 main::@2
b2:
//SEG14 [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] -- zpby1_le_coby1_then_la1
//SEG15 [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] -- zpby1_le_coby1_then_la1
lda i
cmp #$32
bcc b4
beq b4
jmp b8
//SEG15 main::@8
//SEG16 main::@8
b8:
//SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- zpby1=_inc_zpby1
//SEG17 [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- zpby1=_inc_zpby1
inc s
//SEG17 [1] phi from main::@4 main::@8 to main::@1
//SEG18 [2] phi from main::@4 main::@8 to main::@1
b1_from_b4:
b1_from_b8:
//SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy
//SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG19 [2] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy
//SEG20 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
//SEG20 main::@4
//SEG21 main::@4
b4:
//SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- zpby1=_dec_zpby1
//SEG22 [8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- zpby1=_dec_zpby1
dec s
jmp b1_from_b4
}
@ -695,52 +703,55 @@ ASSEMBLER
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::s#3 = (byte) 0 -- yby=coby1
//SEG7 [2] phi (byte) main::s#3 = (byte) 0 -- yby=coby1
ldy #$0
//SEG7 [1] phi (byte) main::i#2 = (byte) 100 -- xby=coby1
//SEG8 [2] phi (byte) main::i#2 = (byte) 100 -- xby=coby1
ldx #$64
//SEG8 main::@1
//SEG9 main::@1
b1:
//SEG9 [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] -- xby=_dec_xby
//SEG10 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] -- xby=_dec_xby
dex
//SEG10 [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] -- xby_gt_0_then_la1
//SEG11 [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] -- xby_gt_0_then_la1
cpx #$0
bne b2
//SEG11 main::@return
//SEG12 main::@return
breturn:
//SEG12 [4] return [ ]
//SEG13 [5] return [ ]
rts
//SEG13 main::@2
//SEG14 main::@2
b2:
//SEG14 [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] -- xby_le_coby1_then_la1
//SEG15 [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] -- xby_le_coby1_then_la1
cpx #$32
bcc b4
beq b4
//SEG15 main::@8
//SEG16 main::@8
b8:
//SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby
//SEG17 [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby
iny
//SEG17 [1] phi from main::@4 main::@8 to main::@1
//SEG18 [2] phi from main::@4 main::@8 to main::@1
b1_from_b4:
b1_from_b8:
//SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy
//SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG19 [2] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy
//SEG20 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
//SEG20 main::@4
//SEG21 main::@4
b4:
//SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby
//SEG22 [8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby
dey
jmp b1_from_b4
}
Replacing label b1_from_b4 with b1_from_b8
Removing instruction main_from_bbegin:
Removing instruction b1_from_b4:
Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER
@ -748,46 +759,47 @@ ASSEMBLER
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::s#3 = (byte) 0 -- yby=coby1
//SEG7 [2] phi (byte) main::s#3 = (byte) 0 -- yby=coby1
ldy #$0
//SEG7 [1] phi (byte) main::i#2 = (byte) 100 -- xby=coby1
//SEG8 [2] phi (byte) main::i#2 = (byte) 100 -- xby=coby1
ldx #$64
//SEG8 main::@1
//SEG9 main::@1
b1:
//SEG9 [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] -- xby=_dec_xby
//SEG10 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] -- xby=_dec_xby
dex
//SEG10 [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] -- xby_gt_0_then_la1
//SEG11 [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] -- xby_gt_0_then_la1
cpx #$0
bne b2
//SEG11 main::@return
//SEG12 main::@return
breturn:
//SEG12 [4] return [ ]
//SEG13 [5] return [ ]
rts
//SEG13 main::@2
//SEG14 main::@2
b2:
//SEG14 [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] -- xby_le_coby1_then_la1
//SEG15 [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] -- xby_le_coby1_then_la1
cpx #$32
bcc b4
beq b4
//SEG15 main::@8
//SEG16 main::@8
b8:
//SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby
//SEG17 [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby
iny
//SEG17 [1] phi from main::@4 main::@8 to main::@1
//SEG18 [2] phi from main::@4 main::@8 to main::@1
b1_from_b8:
//SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy
//SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG19 [2] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy
//SEG20 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
//SEG20 main::@4
//SEG21 main::@4
b4:
//SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby
//SEG22 [8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby
dey
jmp b1_from_b8
}
@ -802,42 +814,43 @@ ASSEMBLER
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::s#3 = (byte) 0 -- yby=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::s#3 = (byte) 0 -- yby=coby1
ldy #$0
//SEG7 [1] phi (byte) main::i#2 = (byte) 100 -- xby=coby1
//SEG8 [2] phi (byte) main::i#2 = (byte) 100 -- xby=coby1
ldx #$64
//SEG8 main::@1
//SEG9 main::@1
b1:
//SEG9 [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] -- xby=_dec_xby
//SEG10 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] -- xby=_dec_xby
dex
//SEG10 [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] -- xby_gt_0_then_la1
//SEG11 [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] -- xby_gt_0_then_la1
cpx #$0
bne b2
//SEG11 main::@return
//SEG12 [4] return [ ]
//SEG12 main::@return
//SEG13 [5] return [ ]
rts
//SEG13 main::@2
//SEG14 main::@2
b2:
//SEG14 [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] -- xby_le_coby1_then_la1
//SEG15 [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] -- xby_le_coby1_then_la1
cpx #$32
bcc b4
beq b4
//SEG15 main::@8
//SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby
//SEG16 main::@8
//SEG17 [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby
iny
//SEG17 [1] phi from main::@4 main::@8 to main::@1
//SEG18 [2] phi from main::@4 main::@8 to main::@1
b1_from_b8:
//SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy
//SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG19 [2] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy
//SEG20 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
//SEG20 main::@4
//SEG21 main::@4
b4:
//SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby
//SEG22 [8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby
dey
jmp b1_from_b8
}
@ -866,42 +879,43 @@ FINAL CODE
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::s#3 = (byte) 0 -- yby=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::s#3 = (byte) 0 -- yby=coby1
ldy #$0
//SEG7 [1] phi (byte) main::i#2 = (byte) 100 -- xby=coby1
//SEG8 [2] phi (byte) main::i#2 = (byte) 100 -- xby=coby1
ldx #$64
//SEG8 main::@1
//SEG9 main::@1
b1:
//SEG9 [2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ] -- xby=_dec_xby
//SEG10 [3] (byte) main::i#1 ← -- (byte) main::i#2 [ main::s#3 main::i#1 ] -- xby=_dec_xby
dex
//SEG10 [3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ] -- xby_gt_0_then_la1
//SEG11 [4] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::s#3 main::i#1 ] -- xby_gt_0_then_la1
cpx #$0
bne b2
//SEG11 main::@return
//SEG12 [4] return [ ]
//SEG12 main::@return
//SEG13 [5] return [ ]
rts
//SEG13 main::@2
//SEG14 main::@2
b2:
//SEG14 [5] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::i#1 main::s#3 ] -- xby_le_coby1_then_la1
//SEG15 [6] if((byte) main::i#1<=(byte) 50) goto main::@4 [ main::s#3 main::i#1 ] -- xby_le_coby1_then_la1
cpx #$32
bcc b4
beq b4
//SEG15 main::@8
//SEG16 [6] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby
//SEG16 main::@8
//SEG17 [7] (byte) main::s#2 ← ++ (byte) main::s#3 [ main::i#1 main::s#2 ] -- yby=_inc_yby
iny
//SEG17 [1] phi from main::@4 main::@8 to main::@1
//SEG18 [2] phi from main::@4 main::@8 to main::@1
b1_from_b8:
//SEG18 [1] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy
//SEG19 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG19 [2] phi (byte) main::s#3 = (byte) main::s#1 -- register_copy
//SEG20 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
//SEG20 main::@4
//SEG21 main::@4
b4:
//SEG21 [7] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby
//SEG22 [8] (byte) main::s#1 ← -- (byte) main::s#3 [ main::i#1 main::s#1 ] -- yby=_dec_yby
dey
jmp b1_from_b8
}

View File

@ -267,8 +267,11 @@ CONTROL FLOW GRAPH - PHI LIFTED
(byte~) i#3 ← (byte) i#1
to:@1
CALL GRAPH
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
to:@1
@1: scope:[] from @3 @begin
@ -289,6 +292,7 @@ Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @3
Block Sequence Planned @begin @1 @end
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
to:@1
@ -301,8 +305,6 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED
to:@end
@end: scope:[] from @1
CALL GRAPH
DOMINATORS
@begin dominated by @begin
@1 dominated by @1 @begin
@ -336,7 +338,7 @@ Allocated zp ZP_BYTE:2 [ i#2 i#1 ]
Allocated zp ZP_BYTE:3 [ $1 ]
INITIAL ASM
//SEG0 Global ZP labels
.label $1 = 3
.label _1 = 3
.label i = 2
//SEG1 @begin
bbegin:
@ -356,9 +358,9 @@ b1:
lda i
clc
adc #$4
sta $1
sta _1
//SEG8 [2] *((word) 4352 + (byte) i#2) ← (byte~) $1 [ i#2 ] -- cowo1_staridx_zpby1=zpby2
lda $1
lda _1
ldx i
sta $1100,x
//SEG9 [3] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] -- zpby1=zpby1_plus_1

View File

@ -3,30 +3,31 @@
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
[1] phi() [ ]
[2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
to:main::@1
main::@1: scope:[main] from main
[2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
[3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ]
[4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ]
[5] call inccnt param-assignment [ inccnt::return#0 ]
[3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
[4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ]
[5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ]
[6] call inccnt param-assignment [ inccnt::return#0 ]
to:main::@2
main::@2: scope:[main] from main::@1
[6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
[7] *((word) 1025) ← (byte~) main::$1 [ ]
[7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
[8] *((word) 1025) ← (byte~) main::$1 [ ]
to:main::@return
main::@return: scope:[main] from main::@2
[8] return [ ]
[9] return [ ]
to:@return
inccnt: scope:[inccnt] from main main::@1
[9] (byte) cnt3#11 ← phi( main/(byte) 0 main::@1/(byte) cnt3#1 ) [ cnt#12 cnt2#11 cnt3#11 ]
[9] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) [ cnt#12 cnt2#11 cnt3#11 ]
[9] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#12 cnt2#11 cnt3#11 ]
[10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ]
[11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ]
[12] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ]
[13] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
[10] (byte) cnt3#11 ← phi( main/(byte) 0 main::@1/(byte) cnt3#1 ) [ cnt#12 cnt2#11 cnt3#11 ]
[10] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) [ cnt#12 cnt2#11 cnt3#11 ]
[10] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#12 cnt2#11 cnt3#11 ]
[11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ]
[12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ]
[13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ]
[14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
to:inccnt::@return
inccnt::@return: scope:[inccnt] from inccnt
[14] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
[15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
to:@return

View File

@ -747,6 +747,11 @@ inccnt::@return: scope:[inccnt] from inccnt
return
to:@return
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to 0:main
Calls in [main] to 2:inccnt 9:inccnt
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
@ -755,49 +760,53 @@ Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
[1] phi() [ ]
[2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
to:main::@1
main::@1: scope:[main] from main
[2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
[3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ]
[4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ]
[5] (byte~) cnt#15 ← (byte) cnt#3 [ cnt2#1 cnt3#1 cnt#15 ]
[6] (byte~) cnt2#14 ← (byte) cnt2#1 [ cnt3#1 cnt#15 cnt2#14 ]
[7] (byte~) cnt3#14 ← (byte) cnt3#1 [ cnt#15 cnt2#14 cnt3#14 ]
[8] call inccnt param-assignment [ inccnt::return#0 ]
[3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
[4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ]
[5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ]
[6] (byte~) cnt#15 ← (byte) cnt#3 [ cnt#15 cnt2#1 cnt3#1 ]
[7] (byte~) cnt2#14 ← (byte) cnt2#1 [ cnt#15 cnt2#14 cnt3#1 ]
[8] (byte~) cnt3#14 ← (byte) cnt3#1 [ cnt#15 cnt2#14 cnt3#14 ]
[9] call inccnt param-assignment [ inccnt::return#0 ]
to:main::@2
main::@2: scope:[main] from main::@1
[9] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
[10] *((word) 1025) ← (byte~) main::$1 [ ]
[10] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
[11] *((word) 1025) ← (byte~) main::$1 [ ]
to:main::@return
main::@return: scope:[main] from main::@2
[11] return [ ]
[12] return [ ]
to:@return
inccnt: scope:[inccnt] from main main::@1
[12] (byte) cnt3#11 ← phi( main/(byte) 0 main::@1/(byte~) cnt3#14 ) [ cnt#12 cnt2#11 cnt3#11 ]
[12] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte~) cnt2#14 ) [ cnt#12 cnt2#11 cnt3#11 ]
[12] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte~) cnt#15 ) [ cnt#12 cnt2#11 cnt3#11 ]
[13] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ]
[14] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ]
[15] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ]
[16] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
[13] (byte) cnt3#11 ← phi( main/(byte) 0 main::@1/(byte~) cnt3#14 ) [ cnt#12 cnt2#11 cnt3#11 ]
[13] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte~) cnt2#14 ) [ cnt#12 cnt2#11 cnt3#11 ]
[13] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte~) cnt#15 ) [ cnt#12 cnt2#11 cnt3#11 ]
[14] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ]
[15] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ]
[16] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ]
[17] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
to:inccnt::@return
inccnt::@return: scope:[inccnt] from inccnt
[17] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
[18] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
to:@return
Created 3 initial phi equivalence classes
Coalesced [5] cnt#15 ← cnt#3
Coalesced [6] cnt2#14 ← cnt2#1
Coalesced [7] cnt3#14 ← cnt3#1
Coalesced [6] cnt#15 ← cnt#3
Coalesced [7] cnt2#14 ← cnt2#1
Coalesced [8] cnt3#14 ← cnt3#1
Coalesced down to 3 phi equivalence classes
Block Sequence Planned @begin @end main main::@1 main::@2 main::@return inccnt inccnt::@return
Adding NOP phi() at start of main
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
@ -811,38 +820,35 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
[1] phi() [ ]
[2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
to:main::@1
main::@1: scope:[main] from main
[2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
[3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ]
[4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ]
[5] call inccnt param-assignment [ inccnt::return#0 ]
[3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
[4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ]
[5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ]
[6] call inccnt param-assignment [ inccnt::return#0 ]
to:main::@2
main::@2: scope:[main] from main::@1
[6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
[7] *((word) 1025) ← (byte~) main::$1 [ ]
[7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
[8] *((word) 1025) ← (byte~) main::$1 [ ]
to:main::@return
main::@return: scope:[main] from main::@2
[8] return [ ]
[9] return [ ]
to:@return
inccnt: scope:[inccnt] from main main::@1
[9] (byte) cnt3#11 ← phi( main/(byte) 0 main::@1/(byte) cnt3#1 ) [ cnt#12 cnt2#11 cnt3#11 ]
[9] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) [ cnt#12 cnt2#11 cnt3#11 ]
[9] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#12 cnt2#11 cnt3#11 ]
[10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ]
[11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ]
[12] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ]
[13] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
[10] (byte) cnt3#11 ← phi( main/(byte) 0 main::@1/(byte) cnt3#1 ) [ cnt#12 cnt2#11 cnt3#11 ]
[10] (byte) cnt2#11 ← phi( main/(byte) 0 main::@1/(byte) cnt2#1 ) [ cnt#12 cnt2#11 cnt3#11 ]
[10] (byte) cnt#12 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#12 cnt2#11 cnt3#11 ]
[11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ]
[12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ]
[13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ]
[14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
to:inccnt::@return
inccnt::@return: scope:[inccnt] from inccnt
[14] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
[15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
to:@return
CALL GRAPH
Calls in [] to 0:main
Calls in [main] to 1:inccnt 5:inccnt
DOMINATORS
@begin dominated by @begin
@end dominated by @end @begin
@ -908,85 +914,87 @@ INITIAL ASM
.label cnt = 7
.label cnt2 = 3
.label cnt3 = 4
.label cnt#3 = 2
.label cnt#12 = 2
.label cnt_3 = 2
.label cnt_12 = 2
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
jmp bend
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
.label $0 = 5
.label $1 = 6
//SEG5 [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG6 [9] phi from main to inccnt
.label _0 = 5
.label _1 = 6
//SEG6 [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG7 [10] phi from main to inccnt
inccnt_from_main:
//SEG7 [9] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1
//SEG8 [10] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1
lda #$0
sta cnt3
//SEG8 [9] phi (byte) cnt2#11 = (byte) 0 -- zpby1=coby1
//SEG9 [10] phi (byte) cnt2#11 = (byte) 0 -- zpby1=coby1
lda #$0
sta cnt2
//SEG9 [9] phi (byte) cnt#12 = (byte) 0 -- zpby1=coby1
//SEG10 [10] phi (byte) cnt#12 = (byte) 0 -- zpby1=coby1
lda #$0
sta cnt_12
jsr inccnt
jmp b1
//SEG10 main::@1
//SEG11 main::@1
b1:
//SEG11 [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] -- zpby1=zpby2
//SEG12 [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ] -- zpby1=zpby2
lda inccnt.return
sta $0
//SEG12 [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=zpby1
lda $0
sta _0
//SEG13 [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=zpby1
lda _0
sta $400
//SEG13 [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby2
//SEG14 [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby2
lda cnt
sta cnt_3
inc cnt_3
//SEG14 [5] call inccnt param-assignment [ inccnt::return#0 ]
//SEG15 [9] phi from main::@1 to inccnt
//SEG15 [6] call inccnt param-assignment [ inccnt::return#0 ]
//SEG16 [10] phi from main::@1 to inccnt
inccnt_from_b1:
//SEG16 [9] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy
//SEG17 [9] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy
//SEG18 [9] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy
//SEG17 [10] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy
//SEG18 [10] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy
//SEG19 [10] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy
jsr inccnt
jmp b2
//SEG19 main::@2
//SEG20 main::@2
b2:
//SEG20 [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] -- zpby1=zpby2
//SEG21 [7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ] -- zpby1=zpby2
lda inccnt.return
sta $1
//SEG21 [7] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=zpby1
lda $1
sta _1
//SEG22 [8] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=zpby1
lda _1
sta $401
jmp breturn
//SEG22 main::@return
//SEG23 main::@return
breturn:
//SEG23 [8] return [ ]
//SEG24 [9] return [ ]
rts
}
//SEG24 inccnt
//SEG25 inccnt
inccnt: {
.label return = 8
//SEG25 [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- zpby1=_inc_zpby2
//SEG26 [11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- zpby1=_inc_zpby2
lda cnt_12
sta cnt
inc cnt
//SEG26 [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ] -- zpby1=_inc_zpby1
//SEG27 [12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ] -- zpby1=_inc_zpby1
inc cnt2
//SEG27 [12] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1
//SEG28 [13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1
inc cnt3
//SEG28 [13] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- zpby1=zpby2
//SEG29 [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- zpby1=zpby2
lda cnt
sta return
jmp breturn
//SEG29 inccnt::@return
//SEG30 inccnt::@return
breturn:
//SEG30 [14] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG31 [15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
rts
}
@ -1007,6 +1015,8 @@ Uplift Scope [inccnt] 1.5: zp ZP_BYTE:8 [ inccnt::return#0 ]
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 ]
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ cnt3#11 cnt3#1 ]
Uplifting [] best 75 combination zp ZP_BYTE:4 [ cnt3#11 cnt3#1 ]
Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:2 [ cnt3#11 cnt3#1 ]
Removing instruction jmp bend
Removing instruction jmp b1
@ -1020,61 +1030,130 @@ ASSEMBLER
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
//SEG5 [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG6 [9] phi from main to inccnt
//SEG6 [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG7 [10] phi from main to inccnt
inccnt_from_main:
//SEG7 [9] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1
//SEG8 [10] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1
lda #$0
sta cnt3
//SEG8 [9] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1
//SEG9 [10] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1
ldy #$0
//SEG9 [9] phi (byte) cnt#12 = (byte) 0 -- xby=coby1
//SEG10 [10] phi (byte) cnt#12 = (byte) 0 -- xby=coby1
ldx #$0
jsr inccnt
//SEG10 main::@1
//SEG11 main::@1
b1:
//SEG11 [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
//SEG12 [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
// (byte~) main::$0 = (byte) inccnt::return#0 // register copy reg byte a
//SEG12 [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby
//SEG13 [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby
sta $400
//SEG13 [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby
//SEG14 [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby
inx
//SEG14 [5] call inccnt param-assignment [ inccnt::return#0 ]
//SEG15 [9] phi from main::@1 to inccnt
//SEG15 [6] call inccnt param-assignment [ inccnt::return#0 ]
//SEG16 [10] phi from main::@1 to inccnt
inccnt_from_b1:
//SEG16 [9] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy
//SEG17 [9] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy
//SEG18 [9] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy
//SEG17 [10] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy
//SEG18 [10] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy
//SEG19 [10] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy
jsr inccnt
//SEG19 main::@2
//SEG20 main::@2
b2:
//SEG20 [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
//SEG21 [7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
// (byte~) main::$1 = (byte) inccnt::return#0 // register copy reg byte a
//SEG21 [7] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby
//SEG22 [8] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby
sta $401
//SEG22 main::@return
//SEG23 main::@return
breturn:
//SEG23 [8] return [ ]
//SEG24 [9] return [ ]
rts
}
//SEG24 inccnt
//SEG25 inccnt
inccnt: {
//SEG25 [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby
//SEG26 [11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby
inx
//SEG26 [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ] -- yby=_inc_yby
//SEG27 [12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ] -- yby=_inc_yby
iny
//SEG27 [12] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1
//SEG28 [13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1
inc cnt3
//SEG28 [13] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby
//SEG29 [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby
txa
//SEG29 inccnt::@return
//SEG30 inccnt::@return
breturn:
//SEG30 [14] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG31 [15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
rts
}
Removing instruction main_from_bbegin:
Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER
//SEG0 Global ZP labels
.label cnt3 = 2
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG4 @end
bend:
//SEG5 main
main: {
//SEG6 [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG7 [10] phi from main to inccnt
inccnt_from_main:
//SEG8 [10] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1
lda #$0
sta cnt3
//SEG9 [10] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1
ldy #$0
//SEG10 [10] phi (byte) cnt#12 = (byte) 0 -- xby=coby1
ldx #$0
jsr inccnt
//SEG11 main::@1
b1:
//SEG12 [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
// (byte~) main::$0 = (byte) inccnt::return#0 // register copy reg byte a
//SEG13 [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby
sta $400
//SEG14 [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby
inx
//SEG15 [6] call inccnt param-assignment [ inccnt::return#0 ]
//SEG16 [10] phi from main::@1 to inccnt
inccnt_from_b1:
//SEG17 [10] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy
//SEG18 [10] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy
//SEG19 [10] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy
jsr inccnt
//SEG20 main::@2
b2:
//SEG21 [7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
// (byte~) main::$1 = (byte) inccnt::return#0 // register copy reg byte a
//SEG22 [8] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby
sta $401
//SEG23 main::@return
breturn:
//SEG24 [9] return [ ]
rts
}
//SEG25 inccnt
inccnt: {
//SEG26 [11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby
inx
//SEG27 [12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ] -- yby=_inc_yby
iny
//SEG28 [13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1
inc cnt3
//SEG29 [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby
txa
//SEG30 inccnt::@return
breturn:
//SEG31 [15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
rts
}
@ -1092,54 +1171,55 @@ ASSEMBLER
.label cnt3 = 2
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG6 [9] phi from main to inccnt
//SEG7 [9] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1
//SEG6 [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG7 [10] phi from main to inccnt
//SEG8 [10] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1
lda #$0
sta cnt3
//SEG8 [9] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1
//SEG9 [10] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1
ldy #$0
//SEG9 [9] phi (byte) cnt#12 = (byte) 0 -- xby=coby1
//SEG10 [10] phi (byte) cnt#12 = (byte) 0 -- xby=coby1
ldx #$0
jsr inccnt
//SEG10 main::@1
//SEG11 [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
//SEG11 main::@1
//SEG12 [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
// (byte~) main::$0 = (byte) inccnt::return#0 // register copy reg byte a
//SEG12 [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby
//SEG13 [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby
sta $400
//SEG13 [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby
//SEG14 [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby
inx
//SEG14 [5] call inccnt param-assignment [ inccnt::return#0 ]
//SEG15 [9] phi from main::@1 to inccnt
//SEG16 [9] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy
//SEG17 [9] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy
//SEG18 [9] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy
//SEG15 [6] call inccnt param-assignment [ inccnt::return#0 ]
//SEG16 [10] phi from main::@1 to inccnt
//SEG17 [10] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy
//SEG18 [10] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy
//SEG19 [10] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy
jsr inccnt
//SEG19 main::@2
//SEG20 [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
//SEG20 main::@2
//SEG21 [7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
// (byte~) main::$1 = (byte) inccnt::return#0 // register copy reg byte a
//SEG21 [7] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby
//SEG22 [8] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby
sta $401
//SEG22 main::@return
//SEG23 [8] return [ ]
//SEG23 main::@return
//SEG24 [9] return [ ]
rts
}
//SEG24 inccnt
//SEG25 inccnt
inccnt: {
//SEG25 [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby
//SEG26 [11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby
inx
//SEG26 [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ] -- yby=_inc_yby
//SEG27 [12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ] -- yby=_inc_yby
iny
//SEG27 [12] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1
//SEG28 [13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1
inc cnt3
//SEG28 [13] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby
//SEG29 [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby
txa
//SEG29 inccnt::@return
//SEG30 [14] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG30 inccnt::@return
//SEG31 [15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
rts
}
@ -1181,54 +1261,55 @@ FINAL CODE
.label cnt3 = 2
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG6 [9] phi from main to inccnt
//SEG7 [9] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1
//SEG6 [2] call inccnt param-assignment [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG7 [10] phi from main to inccnt
//SEG8 [10] phi (byte) cnt3#11 = (byte) 0 -- zpby1=coby1
lda #$0
sta cnt3
//SEG8 [9] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1
//SEG9 [10] phi (byte) cnt2#11 = (byte) 0 -- yby=coby1
ldy #$0
//SEG9 [9] phi (byte) cnt#12 = (byte) 0 -- xby=coby1
//SEG10 [10] phi (byte) cnt#12 = (byte) 0 -- xby=coby1
ldx #$0
jsr inccnt
//SEG10 main::@1
//SEG11 [2] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
//SEG11 main::@1
//SEG12 [3] (byte~) main::$0 ← (byte) inccnt::return#0 [ main::$0 cnt#1 cnt2#1 cnt3#1 ]
// (byte~) main::$0 = (byte) inccnt::return#0 // register copy reg byte a
//SEG12 [3] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby
//SEG13 [4] *((word) 1024) ← (byte~) main::$0 [ cnt#1 cnt2#1 cnt3#1 ] -- _star_cowo1=aby
sta $400
//SEG13 [4] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby
//SEG14 [5] (byte) cnt#3 ← ++ (byte) cnt#1 [ cnt#3 cnt2#1 cnt3#1 ] -- xby=_inc_xby
inx
//SEG14 [5] call inccnt param-assignment [ inccnt::return#0 ]
//SEG15 [9] phi from main::@1 to inccnt
//SEG16 [9] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy
//SEG17 [9] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy
//SEG18 [9] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy
//SEG15 [6] call inccnt param-assignment [ inccnt::return#0 ]
//SEG16 [10] phi from main::@1 to inccnt
//SEG17 [10] phi (byte) cnt3#11 = (byte) cnt3#1 -- register_copy
//SEG18 [10] phi (byte) cnt2#11 = (byte) cnt2#1 -- register_copy
//SEG19 [10] phi (byte) cnt#12 = (byte) cnt#3 -- register_copy
jsr inccnt
//SEG19 main::@2
//SEG20 [6] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
//SEG20 main::@2
//SEG21 [7] (byte~) main::$1 ← (byte) inccnt::return#0 [ main::$1 ]
// (byte~) main::$1 = (byte) inccnt::return#0 // register copy reg byte a
//SEG21 [7] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby
//SEG22 [8] *((word) 1025) ← (byte~) main::$1 [ ] -- _star_cowo1=aby
sta $401
//SEG22 main::@return
//SEG23 [8] return [ ]
//SEG23 main::@return
//SEG24 [9] return [ ]
rts
}
//SEG24 inccnt
//SEG25 inccnt
inccnt: {
//SEG25 [10] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby
//SEG26 [11] (byte) cnt#1 ← ++ (byte) cnt#12 [ cnt#1 cnt2#11 cnt3#11 ] -- xby=_inc_xby
inx
//SEG26 [11] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt2#1 cnt3#11 ] -- yby=_inc_yby
//SEG27 [12] (byte) cnt2#1 ← ++ (byte) cnt2#11 [ cnt#1 cnt3#11 cnt2#1 ] -- yby=_inc_yby
iny
//SEG27 [12] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1
//SEG28 [13] (byte) cnt3#1 ← ++ (byte) cnt3#11 [ cnt#1 cnt2#1 cnt3#1 ] -- zpby1=_inc_zpby1
inc cnt3
//SEG28 [13] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby
//SEG29 [14] (byte) inccnt::return#0 ← (byte) cnt#1 [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ] -- aby=xby
txa
//SEG29 inccnt::@return
//SEG30 [14] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
//SEG30 inccnt::@return
//SEG31 [15] return [ inccnt::return#0 cnt#1 cnt2#1 cnt3#1 ]
rts
}

View File

@ -3,24 +3,25 @@
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] call inccnt param-assignment [ cnt#10 ]
[1] phi() [ ]
[2] call inccnt param-assignment [ cnt#10 ]
to:main::@1
main::@1: scope:[main] from main
[2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ]
[3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ]
[4] call inccnt param-assignment [ cnt#10 ]
[3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ]
[4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ]
[5] call inccnt param-assignment [ cnt#10 ]
to:main::@2
main::@2: scope:[main] from main::@1
[5] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ]
[6] *((word) 1025) ← (byte) cnt#1 [ ]
[6] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ]
[7] *((word) 1025) ← (byte) cnt#1 [ ]
to:main::@return
main::@return: scope:[main] from main::@2
[7] return [ ]
[8] return [ ]
to:@return
inccnt: scope:[inccnt] from main main::@1
[8] (byte) cnt#13 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#13 ]
[9] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ]
[9] (byte) cnt#13 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#13 ]
[10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ]
to:inccnt::@return
inccnt::@return: scope:[inccnt] from inccnt
[10] return [ cnt#10 ]
[11] return [ cnt#10 ]
to:@return

View File

@ -498,20 +498,64 @@ inccnt::@return: scope:[inccnt] from inccnt
return
to:@return
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to 0:main
Calls in [main] to 2:inccnt 6:inccnt
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] call inccnt param-assignment [ cnt#10 ]
[1] phi() [ ]
[2] call inccnt param-assignment [ cnt#10 ]
to:main::@1
main::@1: scope:[main] from main
[2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ]
[3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ]
[4] (byte~) cnt#16 ← (byte) cnt#3 [ cnt#16 ]
[3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ]
[4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ]
[5] (byte~) cnt#16 ← (byte) cnt#3 [ cnt#16 ]
[6] call inccnt param-assignment [ cnt#10 ]
to:main::@2
main::@2: scope:[main] from main::@1
[7] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ]
[8] *((word) 1025) ← (byte) cnt#1 [ ]
to:main::@return
main::@return: scope:[main] from main::@2
[9] return [ ]
to:@return
inccnt: scope:[inccnt] from main main::@1
[10] (byte) cnt#13 ← phi( main/(byte) 0 main::@1/(byte~) cnt#16 ) [ cnt#13 ]
[11] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ]
to:inccnt::@return
inccnt::@return: scope:[inccnt] from inccnt
[12] return [ cnt#10 ]
to:@return
Created 1 initial phi equivalence classes
Coalesced [5] cnt#16 ← cnt#3
Coalesced down to 1 phi equivalence classes
Block Sequence Planned @begin @end main main::@1 main::@2 main::@return inccnt inccnt::@return
Adding NOP phi() at start of main
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
[2] call inccnt param-assignment [ cnt#10 ]
to:main::@1
main::@1: scope:[main] from main
[3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ]
[4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ]
[5] call inccnt param-assignment [ cnt#10 ]
to:main::@2
main::@2: scope:[main] from main::@1
@ -522,51 +566,13 @@ main::@return: scope:[main] from main::@2
[8] return [ ]
to:@return
inccnt: scope:[inccnt] from main main::@1
[9] (byte) cnt#13 ← phi( main/(byte) 0 main::@1/(byte~) cnt#16 ) [ cnt#13 ]
[9] (byte) cnt#13 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#13 ]
[10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ]
to:inccnt::@return
inccnt::@return: scope:[inccnt] from inccnt
[11] return [ cnt#10 ]
to:@return
Created 1 initial phi equivalence classes
Coalesced [4] cnt#16 ← cnt#3
Coalesced down to 1 phi equivalence classes
Block Sequence Planned @begin @end main main::@1 main::@2 main::@return inccnt inccnt::@return
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] call inccnt param-assignment [ cnt#10 ]
to:main::@1
main::@1: scope:[main] from main
[2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ]
[3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ]
[4] call inccnt param-assignment [ cnt#10 ]
to:main::@2
main::@2: scope:[main] from main::@1
[5] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ]
[6] *((word) 1025) ← (byte) cnt#1 [ ]
to:main::@return
main::@return: scope:[main] from main::@2
[7] return [ ]
to:@return
inccnt: scope:[inccnt] from main main::@1
[8] (byte) cnt#13 ← phi( main/(byte) 0 main::@1/(byte) cnt#3 ) [ cnt#13 ]
[9] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ]
to:inccnt::@return
inccnt::@return: scope:[inccnt] from inccnt
[10] return [ cnt#10 ]
to:@return
CALL GRAPH
Calls in [] to 0:main
Calls in [main] to 1:inccnt 4:inccnt
DOMINATORS
@begin dominated by @begin
@end dominated by @end @begin
@ -609,66 +615,68 @@ Allocated zp ZP_BYTE:4 [ cnt#10 ]
INITIAL ASM
//SEG0 Global ZP labels
.label cnt = 3
.label cnt#3 = 2
.label cnt#10 = 4
.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 [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
jmp bend
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
//SEG5 [1] call inccnt param-assignment [ cnt#10 ]
//SEG6 [8] phi from main to inccnt
//SEG6 [2] call inccnt param-assignment [ cnt#10 ]
//SEG7 [9] phi from main to inccnt
inccnt_from_main:
//SEG7 [8] phi (byte) cnt#13 = (byte) 0 -- zpby1=coby1
//SEG8 [9] phi (byte) cnt#13 = (byte) 0 -- zpby1=coby1
lda #$0
sta cnt_13
jsr inccnt
jmp b1
//SEG8 main::@1
//SEG9 main::@1
b1:
//SEG9 [2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=zpby1
//SEG10 [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=zpby1
lda cnt_10
sta $400
//SEG10 [3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- zpby1=_inc_zpby2
//SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- zpby1=_inc_zpby2
lda cnt_10
sta cnt_3
inc cnt_3
//SEG11 [4] call inccnt param-assignment [ cnt#10 ]
//SEG12 [8] phi from main::@1 to inccnt
//SEG12 [5] call inccnt param-assignment [ cnt#10 ]
//SEG13 [9] phi from main::@1 to inccnt
inccnt_from_b1:
//SEG13 [8] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy
//SEG14 [9] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy
jsr inccnt
jmp b2
//SEG14 main::@2
//SEG15 main::@2
b2:
//SEG15 [5] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- zpby1=_inc_zpby2
//SEG16 [6] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- zpby1=_inc_zpby2
lda cnt_10
sta cnt
inc cnt
//SEG16 [6] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=zpby1
//SEG17 [7] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=zpby1
lda cnt
sta $401
jmp breturn
//SEG17 main::@return
//SEG18 main::@return
breturn:
//SEG18 [7] return [ ]
//SEG19 [8] return [ ]
rts
}
//SEG19 inccnt
//SEG20 inccnt
inccnt: {
//SEG20 [9] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- zpby1=_inc_zpby2
//SEG21 [10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- zpby1=_inc_zpby2
lda cnt_13
sta cnt_10
inc cnt_10
jmp breturn
//SEG21 inccnt::@return
//SEG22 inccnt::@return
breturn:
//SEG22 [10] return [ cnt#10 ]
//SEG23 [11] return [ cnt#10 ]
rts
}
@ -696,46 +704,99 @@ ASSEMBLER
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
//SEG5 [1] call inccnt param-assignment [ cnt#10 ]
//SEG6 [8] phi from main to inccnt
//SEG6 [2] call inccnt param-assignment [ cnt#10 ]
//SEG7 [9] phi from main to inccnt
inccnt_from_main:
//SEG7 [8] phi (byte) cnt#13 = (byte) 0 -- xby=coby1
//SEG8 [9] phi (byte) cnt#13 = (byte) 0 -- xby=coby1
ldx #$0
jsr inccnt
//SEG8 main::@1
//SEG9 main::@1
b1:
//SEG9 [2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby
//SEG10 [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby
stx $400
//SEG10 [3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby
//SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby
inx
//SEG11 [4] call inccnt param-assignment [ cnt#10 ]
//SEG12 [8] phi from main::@1 to inccnt
//SEG12 [5] call inccnt param-assignment [ cnt#10 ]
//SEG13 [9] phi from main::@1 to inccnt
inccnt_from_b1:
//SEG13 [8] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy
//SEG14 [9] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy
jsr inccnt
//SEG14 main::@2
//SEG15 main::@2
b2:
//SEG15 [5] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby
//SEG16 [6] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby
inx
//SEG16 [6] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby
//SEG17 [7] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby
stx $401
//SEG17 main::@return
//SEG18 main::@return
breturn:
//SEG18 [7] return [ ]
//SEG19 [8] return [ ]
rts
}
//SEG19 inccnt
//SEG20 inccnt
inccnt: {
//SEG20 [9] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby
//SEG21 [10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby
inx
//SEG21 inccnt::@return
//SEG22 inccnt::@return
breturn:
//SEG22 [10] return [ cnt#10 ]
//SEG23 [11] return [ cnt#10 ]
rts
}
Removing instruction main_from_bbegin:
Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER
//SEG0 Global ZP labels
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG4 @end
bend:
//SEG5 main
main: {
//SEG6 [2] call inccnt param-assignment [ cnt#10 ]
//SEG7 [9] phi from main to inccnt
inccnt_from_main:
//SEG8 [9] phi (byte) cnt#13 = (byte) 0 -- xby=coby1
ldx #$0
jsr inccnt
//SEG9 main::@1
b1:
//SEG10 [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby
stx $400
//SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby
inx
//SEG12 [5] call inccnt param-assignment [ cnt#10 ]
//SEG13 [9] phi from main::@1 to inccnt
inccnt_from_b1:
//SEG14 [9] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy
jsr inccnt
//SEG15 main::@2
b2:
//SEG16 [6] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby
inx
//SEG17 [7] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby
stx $401
//SEG18 main::@return
breturn:
//SEG19 [8] return [ ]
rts
}
//SEG20 inccnt
inccnt: {
//SEG21 [10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby
inx
//SEG22 inccnt::@return
breturn:
//SEG23 [11] return [ cnt#10 ]
rts
}
@ -752,39 +813,40 @@ ASSEMBLER
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] call inccnt param-assignment [ cnt#10 ]
//SEG6 [8] phi from main to inccnt
//SEG7 [8] phi (byte) cnt#13 = (byte) 0 -- xby=coby1
//SEG6 [2] call inccnt param-assignment [ cnt#10 ]
//SEG7 [9] phi from main to inccnt
//SEG8 [9] phi (byte) cnt#13 = (byte) 0 -- xby=coby1
ldx #$0
jsr inccnt
//SEG8 main::@1
//SEG9 [2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby
//SEG9 main::@1
//SEG10 [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby
stx $400
//SEG10 [3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby
//SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby
inx
//SEG11 [4] call inccnt param-assignment [ cnt#10 ]
//SEG12 [8] phi from main::@1 to inccnt
//SEG13 [8] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy
//SEG12 [5] call inccnt param-assignment [ cnt#10 ]
//SEG13 [9] phi from main::@1 to inccnt
//SEG14 [9] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy
jsr inccnt
//SEG14 main::@2
//SEG15 [5] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby
//SEG15 main::@2
//SEG16 [6] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby
inx
//SEG16 [6] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby
//SEG17 [7] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby
stx $401
//SEG17 main::@return
//SEG18 [7] return [ ]
//SEG18 main::@return
//SEG19 [8] return [ ]
rts
}
//SEG19 inccnt
//SEG20 inccnt
inccnt: {
//SEG20 [9] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby
//SEG21 [10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby
inx
//SEG21 inccnt::@return
//SEG22 [10] return [ cnt#10 ]
//SEG22 inccnt::@return
//SEG23 [11] return [ cnt#10 ]
rts
}
@ -812,39 +874,40 @@ FINAL CODE
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] call inccnt param-assignment [ cnt#10 ]
//SEG6 [8] phi from main to inccnt
//SEG7 [8] phi (byte) cnt#13 = (byte) 0 -- xby=coby1
//SEG6 [2] call inccnt param-assignment [ cnt#10 ]
//SEG7 [9] phi from main to inccnt
//SEG8 [9] phi (byte) cnt#13 = (byte) 0 -- xby=coby1
ldx #$0
jsr inccnt
//SEG8 main::@1
//SEG9 [2] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby
//SEG9 main::@1
//SEG10 [3] *((word) 1024) ← (byte) cnt#10 [ cnt#10 ] -- _star_cowo1=xby
stx $400
//SEG10 [3] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby
//SEG11 [4] (byte) cnt#3 ← ++ (byte) cnt#10 [ cnt#3 ] -- xby=_inc_xby
inx
//SEG11 [4] call inccnt param-assignment [ cnt#10 ]
//SEG12 [8] phi from main::@1 to inccnt
//SEG13 [8] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy
//SEG12 [5] call inccnt param-assignment [ cnt#10 ]
//SEG13 [9] phi from main::@1 to inccnt
//SEG14 [9] phi (byte) cnt#13 = (byte) cnt#3 -- register_copy
jsr inccnt
//SEG14 main::@2
//SEG15 [5] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby
//SEG15 main::@2
//SEG16 [6] (byte) cnt#1 ← ++ (byte) cnt#10 [ cnt#1 ] -- xby=_inc_xby
inx
//SEG16 [6] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby
//SEG17 [7] *((word) 1025) ← (byte) cnt#1 [ ] -- _star_cowo1=xby
stx $401
//SEG17 main::@return
//SEG18 [7] return [ ]
//SEG18 main::@return
//SEG19 [8] return [ ]
rts
}
//SEG19 inccnt
//SEG20 inccnt
inccnt: {
//SEG20 [9] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby
//SEG21 [10] (byte) cnt#10 ← ++ (byte) cnt#13 [ cnt#10 ] -- xby=_inc_xby
inx
//SEG21 inccnt::@return
//SEG22 [10] return [ cnt#10 ]
//SEG22 inccnt::@return
//SEG23 [11] return [ cnt#10 ]
rts
}

View File

@ -3,77 +3,80 @@
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] call lvalue param-assignment [ ]
[1] phi() [ ]
[2] call lvalue param-assignment [ ]
to:main::@1
main::@1: scope:[main] from main
[2] call rvalue param-assignment [ ]
[3] call rvalue param-assignment [ ]
to:main::@2
main::@2: scope:[main] from main::@1
[3] call rvaluevar param-assignment [ ]
[4] call rvaluevar param-assignment [ ]
to:main::@3
main::@3: scope:[main] from main::@2
[4] call lvaluevar param-assignment [ ]
[5] call lvaluevar param-assignment [ ]
to:main::@return
main::@return: scope:[main] from main::@3
[5] return [ ]
[6] return [ ]
to:@return
lvaluevar: scope:[lvaluevar] from main::@3
[7] phi() [ ]
to:lvaluevar::@1
lvaluevar::@1: scope:[lvaluevar] from lvaluevar lvaluevar::@2
[6] (byte*) lvaluevar::screen#2 ← phi( lvaluevar/(word) 1024 lvaluevar::@2/(byte*) lvaluevar::screen#1 ) [ lvaluevar::i#2 lvaluevar::screen#2 ]
[6] (byte) lvaluevar::i#2 ← phi( lvaluevar/(byte) 2 lvaluevar::@2/(byte) lvaluevar::i#1 ) [ lvaluevar::i#2 lvaluevar::screen#2 ]
[7] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ]
[8] (byte*) lvaluevar::screen#2 ← phi( lvaluevar/(word) 1024 lvaluevar::@2/(byte*) lvaluevar::screen#1 ) [ lvaluevar::i#2 lvaluevar::screen#2 ]
[8] (byte) lvaluevar::i#2 ← phi( lvaluevar/(byte) 2 lvaluevar::@2/(byte) lvaluevar::i#1 ) [ lvaluevar::i#2 lvaluevar::screen#2 ]
[9] if((byte) lvaluevar::i#2<(byte) 10) goto lvaluevar::@2 [ lvaluevar::i#2 lvaluevar::screen#2 ]
to:lvaluevar::@return
lvaluevar::@return: scope:[lvaluevar] from lvaluevar::@1
[8] return [ ]
[10] return [ ]
to:@return
lvaluevar::@2: scope:[lvaluevar] from lvaluevar::@1
[9] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ]
[10] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::screen#1 lvaluevar::i#2 ]
[11] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ]
[11] *((byte*) lvaluevar::screen#2) ← (byte) 4 [ lvaluevar::i#2 lvaluevar::screen#2 ]
[12] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2 [ lvaluevar::i#2 lvaluevar::screen#1 ]
[13] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2 [ lvaluevar::i#1 lvaluevar::screen#1 ]
to:lvaluevar::@1
rvaluevar: scope:[rvaluevar] from main::@2
[14] phi() [ ]
to:rvaluevar::@1
rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2
[12] (byte*) rvaluevar::screen#2 ← phi( rvaluevar/(word) 1024 rvaluevar::@2/(byte*) rvaluevar::screen#1 ) [ rvaluevar::i#2 rvaluevar::screen#2 ]
[12] (byte) rvaluevar::i#2 ← phi( rvaluevar/(byte) 2 rvaluevar::@2/(byte) rvaluevar::i#1 ) [ rvaluevar::i#2 rvaluevar::screen#2 ]
[13] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ]
[15] (byte*) rvaluevar::screen#2 ← phi( rvaluevar/(word) 1024 rvaluevar::@2/(byte*) rvaluevar::screen#1 ) [ rvaluevar::i#2 rvaluevar::screen#2 ]
[15] (byte) rvaluevar::i#2 ← phi( rvaluevar/(byte) 2 rvaluevar::@2/(byte) rvaluevar::i#1 ) [ rvaluevar::i#2 rvaluevar::screen#2 ]
[16] if((byte) rvaluevar::i#2<(byte) 10) goto rvaluevar::@2 [ rvaluevar::i#2 rvaluevar::screen#2 ]
to:rvaluevar::@return
rvaluevar::@return: scope:[rvaluevar] from rvaluevar::@1
[14] return [ ]
[17] return [ ]
to:@return
rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1
[15] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ]
[16] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::screen#1 rvaluevar::i#2 ]
[17] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ]
[18] (byte) rvaluevar::b#0 ← * (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#2 ]
[19] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2 [ rvaluevar::i#2 rvaluevar::screen#1 ]
[20] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2 [ rvaluevar::i#1 rvaluevar::screen#1 ]
to:rvaluevar::@1
rvalue: scope:[rvalue] from main::@1
[18] (byte) rvalue::b#0 ← * (word) 1024 [ ]
[19] (byte) rvalue::b#1 ← * (word) 1025 [ ]
[21] (byte) rvalue::b#0 ← * (word) 1024 [ ]
[22] (byte) rvalue::b#1 ← * (word) 1025 [ ]
to:rvalue::@1
rvalue::@1: scope:[rvalue] from rvalue rvalue::@2
[20] (byte) rvalue::i#2 ← phi( rvalue/(byte) 2 rvalue::@2/(byte) rvalue::i#1 ) [ rvalue::i#2 ]
[21] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ]
[23] (byte) rvalue::i#2 ← phi( rvalue/(byte) 2 rvalue::@2/(byte) rvalue::i#1 ) [ rvalue::i#2 ]
[24] if((byte) rvalue::i#2<(byte) 10) goto rvalue::@2 [ rvalue::i#2 ]
to:rvalue::@return
rvalue::@return: scope:[rvalue] from rvalue::@1
[22] return [ ]
[25] return [ ]
to:@return
rvalue::@2: scope:[rvalue] from rvalue::@1
[23] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ]
[24] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ]
[26] (byte) rvalue::b#2 ← (word) 1024 *idx (byte) rvalue::i#2 [ rvalue::i#2 ]
[27] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2 [ rvalue::i#1 ]
to:rvalue::@1
lvalue: scope:[lvalue] from main
[25] *((word) 1024) ← (byte) 1 [ ]
[26] *((word) 1025) ← (byte) 2 [ ]
[28] *((word) 1024) ← (byte) 1 [ ]
[29] *((word) 1025) ← (byte) 2 [ ]
to:lvalue::@1
lvalue::@1: scope:[lvalue] from lvalue lvalue::@2
[27] (byte) lvalue::i#2 ← phi( lvalue/(byte) 2 lvalue::@2/(byte) lvalue::i#1 ) [ lvalue::i#2 ]
[28] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ]
[30] (byte) lvalue::i#2 ← phi( lvalue/(byte) 2 lvalue::@2/(byte) lvalue::i#1 ) [ lvalue::i#2 ]
[31] if((byte) lvalue::i#2<(byte) 10) goto lvalue::@2 [ lvalue::i#2 ]
to:lvalue::@return
lvalue::@return: scope:[lvalue] from lvalue::@1
[29] return [ ]
[32] return [ ]
to:@return
lvalue::@2: scope:[lvalue] from lvalue::@1
[30] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ]
[31] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ]
[33] *((word) 1024 + (byte) lvalue::i#2) ← (byte) 3 [ lvalue::i#2 ]
[34] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2 [ lvalue::i#1 ]
to:lvalue::@1

File diff suppressed because it is too large Load Diff

View File

@ -30,9 +30,9 @@
(label) rvalue::@return
(byte[1024]) rvalue::SCREEN
(byte) rvalue::b
(byte) rvalue::b#0 reg byte a Infinity
(byte) rvalue::b#1 reg byte a Infinity
(byte) rvalue::b#2 reg byte a Infinity
(byte) rvalue::b#0 reg byte a 20.0
(byte) rvalue::b#1 reg byte a 20.0
(byte) rvalue::b#2 reg byte a 110.0
(byte) rvalue::i
(byte) rvalue::i#1 reg byte x 22.0
(byte) rvalue::i#2 reg byte x 14.666666666666666
@ -41,7 +41,7 @@
(label) rvaluevar::@2
(label) rvaluevar::@return
(byte) rvaluevar::b
(byte) rvaluevar::b#0 reg byte a Infinity
(byte) rvaluevar::b#0 reg byte a 110.0
(byte) rvaluevar::i
(byte) rvaluevar::i#1 reg byte x 22.0
(byte) rvaluevar::i#2 reg byte x 8.25

View File

@ -3,15 +3,16 @@
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@2
[1] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte) main::i#1 ) [ main::i#2 ]
[2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ]
[2] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte) main::i#1 ) [ main::i#2 ]
[3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ]
to:main::@return
main::@return: scope:[main] from main::@1
[3] return [ ]
[4] return [ ]
to:@return
main::@2: scope:[main] from main::@1
[4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ]
[5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ]
[6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
to:main::@1

View File

@ -399,33 +399,39 @@ main::@2: scope:[main] from main::@1
(byte~) main::i#4 ← (byte) main::i#1
to:main::@1
Adding empty live range for unused variable main::b#0
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to 0:main
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@2
[1] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte~) main::i#4 ) [ main::i#2 ]
[2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ]
[2] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte~) main::i#4 ) [ main::i#2 ]
[3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ]
to:main::@return
main::@return: scope:[main] from main::@1
[3] return [ ]
[4] return [ ]
to:@return
main::@2: scope:[main] from main::@1
[4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ]
[5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[6] (byte~) main::i#4 ← (byte) main::i#1 [ main::i#4 ]
[5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ]
[6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[7] (byte~) main::i#4 ← (byte) main::i#1 [ main::i#4 ]
to:main::@1
Created 1 initial phi equivalence classes
Coalesced [6] main::i#4 ← main::i#1
Coalesced [7] main::i#4 ← main::i#1
Coalesced down to 1 phi equivalence classes
Block Sequence Planned @begin @end main main::@1 main::@return main::@2
Adding empty live range for unused variable main::b#0
Adding NOP phi() at start of main
Propagating live ranges...
Propagating live ranges...
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
@ -433,22 +439,20 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@2
[1] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte) main::i#1 ) [ main::i#2 ]
[2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ]
[2] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte) main::i#1 ) [ main::i#2 ]
[3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ]
to:main::@return
main::@return: scope:[main] from main::@1
[3] return [ ]
[4] return [ ]
to:@return
main::@2: scope:[main] from main::@1
[4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ]
[5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ]
[6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
to:main::@1
CALL GRAPH
Calls in [] to 0:main
DOMINATORS
@begin dominated by @begin
@end dominated by @end @begin
@ -473,7 +477,7 @@ VARIABLE REGISTER WEIGHTS
(void()) main()
(byte[1024]) main::SCREEN
(byte) main::b
(byte) main::b#0 Infinity
(byte) main::b#0 110.0
(byte) main::i
(byte) main::i#1 22.0
(byte) main::i#2 14.666666666666666
@ -491,42 +495,44 @@ INITIAL ASM
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
jmp bend
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
.label b = 3
.label i = 2
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::i#2 = (byte) 2 -- zpby1=coby1
//SEG7 [2] phi (byte) main::i#2 = (byte) 2 -- zpby1=coby1
lda #$2
sta i
jmp b1
//SEG7 main::@1
//SEG8 main::@1
b1:
//SEG8 [2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- zpby1_lt_coby1_then_la1
//SEG9 [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- zpby1_lt_coby1_then_la1
lda i
cmp #$a
bcc b2
jmp breturn
//SEG9 main::@return
//SEG10 main::@return
breturn:
//SEG10 [3] return [ ]
//SEG11 [4] return [ ]
rts
//SEG11 main::@2
//SEG12 main::@2
b2:
//SEG12 [4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- zpby1=cowo1_staridx_zpby2
//SEG13 [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- zpby1=cowo1_staridx_zpby2
ldx i
lda $400,x
sta b
//SEG13 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1
//SEG14 [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- zpby1=_inc_zpby1
inc i
//SEG14 [1] phi from main::@2 to main::@1
//SEG15 [2] phi from main::@2 to main::@1
b1_from_b2:
//SEG15 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG16 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
}
@ -535,7 +541,7 @@ Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg by
Potential registers zp ZP_BYTE:3 [ main::b#0 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] : zp ZP_BYTE:3 [ main::b#0 ] 36.67: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope [main] 110: zp ZP_BYTE:3 [ main::b#0 ] 36.67: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope []
Uplifting [main] best 235 combination reg byte a [ main::b#0 ] reg byte x [ main::i#2 main::i#1 ]
@ -549,33 +555,73 @@ ASSEMBLER
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
main_from_bbegin:
jsr main
//SEG3 @end
//SEG4 @end
bend:
//SEG4 main
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG6 [1] phi (byte) main::i#2 = (byte) 2 -- xby=coby1
//SEG7 [2] phi (byte) main::i#2 = (byte) 2 -- xby=coby1
ldx #$2
//SEG7 main::@1
//SEG8 main::@1
b1:
//SEG8 [2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1
//SEG9 [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1
cpx #$a
bcc b2
//SEG9 main::@return
//SEG10 main::@return
breturn:
//SEG10 [3] return [ ]
//SEG11 [4] return [ ]
rts
//SEG11 main::@2
//SEG12 main::@2
b2:
//SEG12 [4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby
//SEG13 [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby
lda $400,x
//SEG13 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG14 [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG14 [1] phi from main::@2 to main::@1
//SEG15 [2] phi from main::@2 to main::@1
b1_from_b2:
//SEG15 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG16 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
}
Removing instruction main_from_bbegin:
Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER
//SEG0 Global ZP labels
//SEG1 @begin
bbegin:
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG4 @end
bend:
//SEG5 main
main: {
//SEG6 [2] phi from main to main::@1
b1_from_main:
//SEG7 [2] phi (byte) main::i#2 = (byte) 2 -- xby=coby1
ldx #$2
//SEG8 main::@1
b1:
//SEG9 [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1
cpx #$a
bcc b2
//SEG10 main::@return
breturn:
//SEG11 [4] return [ ]
rts
//SEG12 main::@2
b2:
//SEG13 [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby
lda $400,x
//SEG14 [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG15 [2] phi from main::@2 to main::@1
b1_from_b2:
//SEG16 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
}
@ -589,29 +635,30 @@ ASSEMBLER
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::i#2 = (byte) 2 -- xby=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::i#2 = (byte) 2 -- xby=coby1
ldx #$2
//SEG7 main::@1
//SEG8 main::@1
b1:
//SEG8 [2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1
//SEG9 [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1
cpx #$a
bcc b2
//SEG9 main::@return
//SEG10 [3] return [ ]
//SEG10 main::@return
//SEG11 [4] return [ ]
rts
//SEG11 main::@2
//SEG12 main::@2
b2:
//SEG12 [4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby
//SEG13 [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby
lda $400,x
//SEG13 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG14 [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG14 [1] phi from main::@2 to main::@1
//SEG15 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG15 [2] phi from main::@2 to main::@1
//SEG16 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
}
@ -624,7 +671,7 @@ FINAL SYMBOL TABLE
(label) main::@return
(byte[1024]) main::SCREEN
(byte) main::b
(byte) main::b#0 reg byte a Infinity
(byte) main::b#0 reg byte a 110.0
(byte) main::i
(byte) main::i#1 reg byte x 22.0
(byte) main::i#2 reg byte x 14.666666666666666
@ -636,29 +683,30 @@ FINAL CODE
//SEG0 Global ZP labels
//SEG1 @begin
//SEG2 [0] call main param-assignment [ ]
//SEG3 [1] phi from @begin to main
jsr main
//SEG3 @end
//SEG4 main
//SEG4 @end
//SEG5 main
main: {
//SEG5 [1] phi from main to main::@1
//SEG6 [1] phi (byte) main::i#2 = (byte) 2 -- xby=coby1
//SEG6 [2] phi from main to main::@1
//SEG7 [2] phi (byte) main::i#2 = (byte) 2 -- xby=coby1
ldx #$2
//SEG7 main::@1
//SEG8 main::@1
b1:
//SEG8 [2] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1
//SEG9 [3] if((byte) main::i#2<(byte) 10) goto main::@2 [ main::i#2 ] -- xby_lt_coby1_then_la1
cpx #$a
bcc b2
//SEG9 main::@return
//SEG10 [3] return [ ]
//SEG10 main::@return
//SEG11 [4] return [ ]
rts
//SEG11 main::@2
//SEG12 main::@2
b2:
//SEG12 [4] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby
//SEG13 [5] (byte) main::b#0 ← (word) 1024 *idx (byte) main::i#2 [ main::i#2 ] -- aby=cowo1_staridx_xby
lda $400,x
//SEG13 [5] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
//SEG14 [6] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] -- xby=_inc_xby
inx
//SEG14 [1] phi from main::@2 to main::@1
//SEG15 [1] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
//SEG15 [2] phi from main::@2 to main::@1
//SEG16 [2] phi (byte) main::i#2 = (byte) main::i#1 -- register_copy
jmp b1
}

View File

@ -6,7 +6,7 @@
(label) main::@return
(byte[1024]) main::SCREEN
(byte) main::b
(byte) main::b#0 reg byte a Infinity
(byte) main::b#0 reg byte a 110.0
(byte) main::i
(byte) main::i#1 reg byte x 22.0
(byte) main::i#2 reg byte x 14.666666666666666

View File

@ -3,23 +3,23 @@
to:@2
@2: scope:[] from @begin
[1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ]
[2] call sum param-assignment [ sum::return#0 s1#0 ]
[2] call sum param-assignment [ s1#0 sum::return#0 ]
to:@3
@3: scope:[] from @2
[3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ]
[4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ]
[4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ]
to:@4
@4: scope:[] from @3
[5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ]
[6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ]
[6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ]
[7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ]
to:@end
@end: scope:[] from @4
sum: scope:[sum] from @2 @3 @begin
[8] (byte) sum::b#3 ← phi( @2/(byte) 4 @3/(byte) 13 @begin/(byte) 2 ) [ s1#0 s2#0 sum::a#3 sum::b#3 ]
[8] (byte) sum::a#3 ← phi( @2/(byte) 3 @3/(byte) 9 @begin/(byte) 1 ) [ s1#0 s2#0 sum::a#3 sum::b#3 ]
[9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ]
[8] (byte) sum::b#3 ← phi( @2/(byte) 4 @3/(byte) 13 @begin/(byte) 2 ) [ sum::a#3 sum::b#3 ]
[8] (byte) sum::a#3 ← phi( @2/(byte) 3 @3/(byte) 9 @begin/(byte) 1 ) [ sum::a#3 sum::b#3 ]
[9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ]
to:sum::@return
sum::@return: scope:[sum] from sum
[10] return [ sum::return#0 s1#0 s2#0 ]
[10] return [ sum::return#0 ]
to:@return

View File

@ -416,65 +416,50 @@ sum::@return: scope:[sum] from sum
return
to:@return
Adding empty live range for unused variable s4#0
CALL GRAPH
Calls in [] to 0:sum 2:sum 4:sum
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagated s1#0 through call [4] call sum param-assignment
Propagated s2#0 through call [4] call sum param-assignment
Propagating live ranges...
Propagated s1#0 through call [2] call sum param-assignment
Propagated s1#0 through call [4] call sum param-assignment
Propagated s2#0 through call [4] call sum param-assignment
Propagating live ranges...
Propagated s1#0 through call [2] call sum param-assignment
Propagated s1#0 through call [4] call sum param-assignment
Propagated s2#0 through call [4] call sum param-assignment
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
[0] call sum param-assignment [ sum::return#0 ]
to:@2
@2: scope:[] from @begin
[1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ]
[2] call sum param-assignment [ sum::return#0 s1#0 ]
[2] call sum param-assignment [ s1#0 sum::return#0 ]
to:@3
@3: scope:[] from @2
[3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ]
[4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ]
[4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ]
to:@4
@4: scope:[] from @3
[5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ]
[6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ]
[6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ]
[7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ]
to:@end
@end: scope:[] from @4
sum: scope:[sum] from @2 @3 @begin
[8] (byte) sum::b#3 ← phi( @2/(byte) 4 @3/(byte) 13 @begin/(byte) 2 ) [ s1#0 s2#0 sum::a#3 sum::b#3 ]
[8] (byte) sum::a#3 ← phi( @2/(byte) 3 @3/(byte) 9 @begin/(byte) 1 ) [ s1#0 s2#0 sum::a#3 sum::b#3 ]
[9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ]
[8] (byte) sum::b#3 ← phi( @2/(byte) 4 @3/(byte) 13 @begin/(byte) 2 ) [ sum::a#3 sum::b#3 ]
[8] (byte) sum::a#3 ← phi( @2/(byte) 3 @3/(byte) 9 @begin/(byte) 1 ) [ sum::a#3 sum::b#3 ]
[9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ]
to:sum::@return
sum::@return: scope:[sum] from sum
[10] return [ sum::return#0 s1#0 s2#0 ]
[10] return [ sum::return#0 ]
to:@return
Created 2 initial phi equivalence classes
Coalesced down to 2 phi equivalence classes
Block Sequence Planned @begin @2 @3 @4 @end sum sum::@return
Adding empty live range for unused variable s4#0
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagated s1#0 through call [4] call sum param-assignment
Propagated s2#0 through call [4] call sum param-assignment
Propagating live ranges...
Propagated s1#0 through call [2] call sum param-assignment
Propagated s1#0 through call [4] call sum param-assignment
Propagated s2#0 through call [4] call sum param-assignment
Propagating live ranges...
Propagated s1#0 through call [2] call sum param-assignment
Propagated s1#0 through call [4] call sum param-assignment
Propagated s2#0 through call [4] call sum param-assignment
Propagating live ranges...
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
@ -482,30 +467,27 @@ CONTROL FLOW GRAPH - PHI MEM COALESCED
to:@2
@2: scope:[] from @begin
[1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ]
[2] call sum param-assignment [ sum::return#0 s1#0 ]
[2] call sum param-assignment [ s1#0 sum::return#0 ]
to:@3
@3: scope:[] from @2
[3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ]
[4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ]
[4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ]
to:@4
@4: scope:[] from @3
[5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ]
[6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ]
[6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ]
[7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ]
to:@end
@end: scope:[] from @4
sum: scope:[sum] from @2 @3 @begin
[8] (byte) sum::b#3 ← phi( @2/(byte) 4 @3/(byte) 13 @begin/(byte) 2 ) [ s1#0 s2#0 sum::a#3 sum::b#3 ]
[8] (byte) sum::a#3 ← phi( @2/(byte) 3 @3/(byte) 9 @begin/(byte) 1 ) [ s1#0 s2#0 sum::a#3 sum::b#3 ]
[9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ]
[8] (byte) sum::b#3 ← phi( @2/(byte) 4 @3/(byte) 13 @begin/(byte) 2 ) [ sum::a#3 sum::b#3 ]
[8] (byte) sum::a#3 ← phi( @2/(byte) 3 @3/(byte) 9 @begin/(byte) 1 ) [ sum::a#3 sum::b#3 ]
[9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ]
to:sum::@return
sum::@return: scope:[sum] from sum
[10] return [ sum::return#0 s1#0 s2#0 ]
[10] return [ sum::return#0 ]
to:@return
CALL GRAPH
Calls in [] to 0:sum 2:sum 4:sum
DOMINATORS
@begin dominated by @begin
@2 dominated by @2 @begin
@ -525,13 +507,13 @@ NATURAL LOOPS WITH DEPTH
VARIABLE REGISTER WEIGHTS
(byte~) $3 4.0
(byte) s1
(byte) s1#0 0.5
(byte) s1#0 0.8
(byte) s2
(byte) s2#0 0.6666666666666666
(byte) s2#0 1.3333333333333333
(byte) s3
(byte) s3#0 2.0
(byte) s4
(byte) s4#0 Infinity
(byte) s4#0 20.0
(byte()) sum((byte) sum::a , (byte) sum::b)
(byte) sum::a
(byte) sum::a#3 2.0
@ -568,7 +550,7 @@ Allocated zp ZP_BYTE:8 [ s4#0 ]
Allocated zp ZP_BYTE:9 [ sum::return#0 ]
INITIAL ASM
//SEG0 Global ZP labels
.label $3 = 7
.label _3 = 7
.label s1 = 4
.label s2 = 5
.label s3 = 6
@ -591,7 +573,7 @@ b2:
//SEG7 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=zpby2
lda sum.return
sta s1
//SEG8 [2] call sum param-assignment [ sum::return#0 s1#0 ]
//SEG8 [2] call sum param-assignment [ s1#0 sum::return#0 ]
//SEG9 [8] phi from @2 to sum
sum_from_b2:
//SEG10 [8] phi (byte) sum::b#3 = (byte) 4 -- zpby1=coby1
@ -607,7 +589,7 @@ b3:
//SEG13 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] -- zpby1=zpby2
lda sum.return
sta s2
//SEG14 [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ]
//SEG14 [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ]
//SEG15 [8] phi from @3 to sum
sum_from_b3:
//SEG16 [8] phi (byte) sum::b#3 = (byte) 13 -- zpby1=coby1
@ -623,13 +605,13 @@ b4:
//SEG19 [5] (byte) s3#0 ← (byte) sum::return#0 [ s1#0 s2#0 s3#0 ] -- zpby1=zpby2
lda sum.return
sta s3
//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ $3 s3#0 ] -- zpby1=zpby2_plus_zpby3
//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] -- zpby1=zpby2_plus_zpby3
lda s1
clc
adc s2
sta $3
sta _3
//SEG21 [7] (byte) s4#0 ← (byte~) $3 + (byte) s3#0 [ ] -- zpby1=zpby2_plus_zpby3
lda $3
lda _3
clc
adc s3
sta s4
@ -641,7 +623,7 @@ sum: {
.label return = 9
.label a = 2
.label b = 3
//SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] -- zpby1=zpby2_plus_zpby3
//SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] -- zpby1=zpby2_plus_zpby3
lda a
clc
adc b
@ -649,7 +631,7 @@ sum: {
jmp breturn
//SEG25 sum::@return
breturn:
//SEG26 [10] return [ sum::return#0 s1#0 s2#0 ]
//SEG26 [10] return [ sum::return#0 ]
rts
}
@ -664,11 +646,15 @@ Potential registers zp ZP_BYTE:8 [ s4#0 ] : zp ZP_BYTE:8 , reg byte a , reg byte
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#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 [] 20: zp ZP_BYTE:8 [ s4#0 ] 4: zp ZP_BYTE:7 [ $3 ] 2: zp ZP_BYTE:6 [ s3#0 ] 1.33: zp ZP_BYTE:5 [ s2#0 ] 0.8: 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 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 ]
Attempting to uplift remaining variables inzp ZP_BYTE:6 [ s3#0 ]
Uplifting [] best 79 combination zp ZP_BYTE:6 [ s3#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ s1#0 ]
Uplifting [] best 79 combination zp ZP_BYTE:4 [ s1#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
@ -695,7 +681,7 @@ sum_from_bbegin:
b2:
//SEG7 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=aby
sta s1
//SEG8 [2] call sum param-assignment [ sum::return#0 s1#0 ]
//SEG8 [2] call sum param-assignment [ s1#0 sum::return#0 ]
//SEG9 [8] phi from @2 to sum
sum_from_b2:
//SEG10 [8] phi (byte) sum::b#3 = (byte) 4 -- aby=coby1
@ -707,7 +693,7 @@ sum_from_b2:
b3:
//SEG13 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] -- xby=aby
tax
//SEG14 [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ]
//SEG14 [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ]
//SEG15 [8] phi from @3 to sum
sum_from_b3:
//SEG16 [8] phi (byte) sum::b#3 = (byte) 13 -- aby=coby1
@ -719,7 +705,7 @@ sum_from_b3:
b4:
//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
//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] -- aby=zpby1_plus_xby
txa
clc
adc s1
@ -730,13 +716,13 @@ b4:
bend:
//SEG23 sum
sum: {
//SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] -- aby=yby_plus_aby
//SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] -- aby=yby_plus_aby
sty $ff
clc
adc $ff
//SEG25 sum::@return
breturn:
//SEG26 [10] return [ sum::return#0 s1#0 s2#0 ]
//SEG26 [10] return [ sum::return#0 ]
rts
}
@ -759,7 +745,7 @@ bbegin:
b2:
//SEG7 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=aby
sta s1
//SEG8 [2] call sum param-assignment [ sum::return#0 s1#0 ]
//SEG8 [2] call sum param-assignment [ s1#0 sum::return#0 ]
//SEG9 [8] phi from @2 to sum
sum_from_b2:
//SEG10 [8] phi (byte) sum::b#3 = (byte) 4 -- aby=coby1
@ -771,7 +757,7 @@ sum_from_b2:
b3:
//SEG13 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] -- xby=aby
tax
//SEG14 [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ]
//SEG14 [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ]
//SEG15 [8] phi from @3 to sum
sum_from_b3:
//SEG16 [8] phi (byte) sum::b#3 = (byte) 13 -- aby=coby1
@ -783,7 +769,7 @@ sum_from_b3:
b4:
//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
//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] -- aby=zpby1_plus_xby
txa
clc
adc s1
@ -794,13 +780,13 @@ b4:
bend:
//SEG23 sum
sum: {
//SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] -- aby=yby_plus_aby
//SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] -- aby=yby_plus_aby
sty $ff
clc
adc $ff
//SEG25 sum::@return
breturn:
//SEG26 [10] return [ sum::return#0 s1#0 s2#0 ]
//SEG26 [10] return [ sum::return#0 ]
rts
}
@ -828,7 +814,7 @@ ASSEMBLER
//SEG6 @2
//SEG7 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=aby
sta s1
//SEG8 [2] call sum param-assignment [ sum::return#0 s1#0 ]
//SEG8 [2] call sum param-assignment [ s1#0 sum::return#0 ]
//SEG9 [8] phi from @2 to sum
//SEG10 [8] phi (byte) sum::b#3 = (byte) 4 -- aby=coby1
lda #$4
@ -838,7 +824,7 @@ ASSEMBLER
//SEG12 @3
//SEG13 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] -- xby=aby
tax
//SEG14 [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ]
//SEG14 [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ]
//SEG15 [8] phi from @3 to sum
//SEG16 [8] phi (byte) sum::b#3 = (byte) 13 -- aby=coby1
lda #$d
@ -848,7 +834,7 @@ ASSEMBLER
//SEG18 @4
//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
//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] -- aby=zpby1_plus_xby
txa
clc
adc s1
@ -858,12 +844,12 @@ ASSEMBLER
//SEG22 @end
//SEG23 sum
sum: {
//SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] -- aby=yby_plus_aby
//SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] -- aby=yby_plus_aby
sty $ff
clc
adc $ff
//SEG25 sum::@return
//SEG26 [10] return [ sum::return#0 s1#0 s2#0 ]
//SEG26 [10] return [ sum::return#0 ]
rts
}
@ -875,13 +861,13 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(byte) s1
(byte) s1#0 s1 zp ZP_BYTE:2 0.5
(byte) s1#0 s1 zp ZP_BYTE:2 0.8
(byte) s2
(byte) s2#0 reg byte x 0.6666666666666666
(byte) s2#0 reg byte x 1.3333333333333333
(byte) s3
(byte) s3#0 s3 zp ZP_BYTE:3 2.0
(byte) s4
(byte) s4#0 reg byte a Infinity
(byte) s4#0 reg byte a 20.0
(byte()) sum((byte) sum::a , (byte) sum::b)
(label) sum::@return
(byte) sum::a
@ -915,7 +901,7 @@ FINAL CODE
//SEG6 @2
//SEG7 [1] (byte) s1#0 ← (byte) sum::return#0 [ s1#0 ] -- zpby1=aby
sta s1
//SEG8 [2] call sum param-assignment [ sum::return#0 s1#0 ]
//SEG8 [2] call sum param-assignment [ s1#0 sum::return#0 ]
//SEG9 [8] phi from @2 to sum
//SEG10 [8] phi (byte) sum::b#3 = (byte) 4 -- aby=coby1
lda #$4
@ -925,7 +911,7 @@ FINAL CODE
//SEG12 @3
//SEG13 [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] -- xby=aby
tax
//SEG14 [4] call sum param-assignment [ sum::return#0 s1#0 s2#0 ]
//SEG14 [4] call sum param-assignment [ s1#0 sum::return#0 s2#0 ]
//SEG15 [8] phi from @3 to sum
//SEG16 [8] phi (byte) sum::b#3 = (byte) 13 -- aby=coby1
lda #$d
@ -935,7 +921,7 @@ FINAL CODE
//SEG18 @4
//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
//SEG20 [6] (byte~) $3 ← (byte) s1#0 + (byte) s2#0 [ s3#0 $3 ] -- aby=zpby1_plus_xby
txa
clc
adc s1
@ -945,12 +931,12 @@ FINAL CODE
//SEG22 @end
//SEG23 sum
sum: {
//SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 s1#0 s2#0 ] -- aby=yby_plus_aby
//SEG24 [9] (byte) sum::return#0 ← (byte) sum::a#3 + (byte) sum::b#3 [ sum::return#0 ] -- aby=yby_plus_aby
sty $ff
clc
adc $ff
//SEG25 sum::@return
//SEG26 [10] return [ sum::return#0 s1#0 s2#0 ]
//SEG26 [10] return [ sum::return#0 ]
rts
}

View File

@ -5,13 +5,13 @@
(label) @begin
(label) @end
(byte) s1
(byte) s1#0 s1 zp ZP_BYTE:2 0.5
(byte) s1#0 s1 zp ZP_BYTE:2 0.8
(byte) s2
(byte) s2#0 reg byte x 0.6666666666666666
(byte) s2#0 reg byte x 1.3333333333333333
(byte) s3
(byte) s3#0 s3 zp ZP_BYTE:3 2.0
(byte) s4
(byte) s4#0 reg byte a Infinity
(byte) s4#0 reg byte a 20.0
(byte()) sum((byte) sum::a , (byte) sum::b)
(label) sum::@return
(byte) sum::a

View File

@ -174,8 +174,11 @@ main::@return: scope:[main] from main
return
to:@return
CALL GRAPH
Calls in [] to 0:main
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
[0] call main param-assignment [ ]
to:@end
@ -203,9 +206,6 @@ main::@return: scope:[main] from main
[2] return [ ]
to:@return
CALL GRAPH
Calls in [] to 0:main
DOMINATORS
@begin dominated by @begin
@end dominated by @end @begin

View File

@ -3,205 +3,209 @@
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] call addpoint param-assignment [ ]
[1] phi() [ ]
[2] call addpoint param-assignment [ ]
to:main::@3
main::@3: scope:[main] from main
[2] call addpoint param-assignment [ ]
[3] call addpoint param-assignment [ numpoints#1 ]
to:main::@4
main::@4: scope:[main] from main::@3
[3] call addpoint param-assignment [ ]
[4] call addpoint param-assignment [ numpoints#1 ]
to:main::@5
main::@5: scope:[main] from main::@4
[4] call addpoint param-assignment [ ]
[5] call addpoint param-assignment [ numpoints#1 ]
to:main::@6
main::@6: scope:[main] from main::@5
[5] call addpoint param-assignment [ ]
[6] call addpoint param-assignment [ numpoints#1 ]
to:main::@7
main::@7: scope:[main] from main::@6
[6] call addpoint param-assignment [ ]
[7] call addpoint param-assignment [ numpoints#1 ]
to:main::@8
main::@8: scope:[main] from main::@7
[7] call initscreen param-assignment [ ]
[8] call initscreen param-assignment [ numpoints#1 ]
to:main::@1
main::@1: scope:[main] from main::@11 main::@8
[8] call render param-assignment [ ]
[9] call render param-assignment [ numpoints#1 ]
to:main::@10
main::@10: scope:[main] from main::@1
[9] call animate param-assignment [ ]
[10] call animate param-assignment [ numpoints#1 ]
to:main::@11
main::@11: scope:[main] from main::@10
[10] if(true) goto main::@1 [ ]
[11] if(true) goto main::@1 [ numpoints#1 ]
to:main::@return
main::@return: scope:[main] from main::@11
[11] return [ ]
[12] return [ ]
to:@return
animate: scope:[animate] from main::@10
[12] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ]
[13] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ]
[14] *((word) 4096) ← (byte~) animate::$1 [ ]
[15] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ]
[16] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ]
[13] (byte~) animate::$0 ← * (word) 4096 [ animate::$0 ]
[14] (byte~) animate::$1 ← (byte~) animate::$0 + (byte) 1 [ animate::$1 ]
[15] *((word) 4096) ← (byte~) animate::$1 [ ]
[16] (byte~) animate::$2 ← * (word) 4096 [ animate::$2 ]
[17] if((byte~) animate::$2!=(byte) 40) goto animate::@1 [ ]
to:animate::@7
animate::@7: scope:[animate] from animate
[17] *((word) 4096) ← (byte) 0 [ ]
[18] *((word) 4096) ← (byte) 0 [ ]
to:animate::@1
animate::@1: scope:[animate] from animate animate::@7
[18] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ]
[19] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ]
[20] *((word) 4352) ← (byte~) animate::$6 [ ]
[21] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ]
[22] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ]
[19] (byte~) animate::$5 ← * (word) 4352 [ animate::$5 ]
[20] (byte~) animate::$6 ← (byte~) animate::$5 + (byte) 1 [ animate::$6 ]
[21] *((word) 4352) ← (byte~) animate::$6 [ ]
[22] (byte~) animate::$7 ← * (word) 4352 [ animate::$7 ]
[23] if((byte~) animate::$7!=(byte) 25) goto animate::@2 [ ]
to:animate::@8
animate::@8: scope:[animate] from animate::@1
[23] *((word) 4352) ← (byte) 0 [ ]
[24] *((word) 4352) ← (byte) 0 [ ]
to:animate::@2
animate::@2: scope:[animate] from animate::@1 animate::@8
[24] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ]
[25] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ]
[26] *((word) 4097) ← (byte~) animate::$11 [ ]
[27] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ]
[28] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ]
[25] (byte~) animate::$10 ← * (word) 4097 [ animate::$10 ]
[26] (byte~) animate::$11 ← (byte~) animate::$10 - (byte) 1 [ animate::$11 ]
[27] *((word) 4097) ← (byte~) animate::$11 [ ]
[28] (byte~) animate::$12 ← * (word) 4097 [ animate::$12 ]
[29] if((byte~) animate::$12!=(byte) 255) goto animate::@3 [ ]
to:animate::@9
animate::@9: scope:[animate] from animate::@2
[29] *((word) 4097) ← (byte) 40 [ ]
[30] *((word) 4097) ← (byte) 40 [ ]
to:animate::@3
animate::@3: scope:[animate] from animate::@2 animate::@9
[30] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ]
[31] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ]
[32] *((word) 4354) ← (byte~) animate::$16 [ ]
[33] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ]
[34] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ]
[31] (byte~) animate::$15 ← * (word) 4354 [ animate::$15 ]
[32] (byte~) animate::$16 ← (byte~) animate::$15 + (byte) 1 [ animate::$16 ]
[33] *((word) 4354) ← (byte~) animate::$16 [ ]
[34] (byte~) animate::$17 ← * (word) 4354 [ animate::$17 ]
[35] if((byte~) animate::$17!=(byte) 25) goto animate::@4 [ ]
to:animate::@10
animate::@10: scope:[animate] from animate::@3
[35] *((word) 4354) ← (byte) 0 [ ]
[36] *((word) 4354) ← (byte) 0 [ ]
to:animate::@4
animate::@4: scope:[animate] from animate::@10 animate::@3
[36] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ]
[37] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ]
[38] *((word) 4355) ← (byte~) animate::$21 [ ]
[39] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ]
[40] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ]
[37] (byte~) animate::$20 ← * (word) 4355 [ animate::$20 ]
[38] (byte~) animate::$21 ← (byte~) animate::$20 - (byte) 1 [ animate::$21 ]
[39] *((word) 4355) ← (byte~) animate::$21 [ ]
[40] (byte~) animate::$22 ← * (word) 4355 [ animate::$22 ]
[41] if((byte~) animate::$22!=(byte) 255) goto animate::@return [ ]
to:animate::@11
animate::@11: scope:[animate] from animate::@4
[41] *((word) 4355) ← (byte) 25 [ ]
[42] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ]
[43] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ]
[44] *((word) 4099) ← (byte~) animate::$26 [ ]
[45] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ]
[46] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ]
[42] *((word) 4355) ← (byte) 25 [ ]
[43] (byte~) animate::$25 ← * (word) 4099 [ animate::$25 ]
[44] (byte~) animate::$26 ← (byte~) animate::$25 + (byte) 7 [ animate::$26 ]
[45] *((word) 4099) ← (byte~) animate::$26 [ ]
[46] (byte~) animate::$27 ← * (word) 4099 [ animate::$27 ]
[47] if((byte~) animate::$27<(byte) 40) goto animate::@return [ ]
to:animate::@12
animate::@12: scope:[animate] from animate::@11
[47] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ]
[48] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ]
[49] *((word) 4099) ← (byte~) animate::$31 [ ]
[48] (byte~) animate::$30 ← * (word) 4099 [ animate::$30 ]
[49] (byte~) animate::$31 ← (byte~) animate::$30 - (byte) 40 [ animate::$31 ]
[50] *((word) 4099) ← (byte~) animate::$31 [ ]
to:animate::@return
animate::@return: scope:[animate] from animate::@11 animate::@12 animate::@4
[50] return [ ]
[51] return [ ]
to:@return
render: scope:[render] from main::@1
[52] phi() [ numpoints#1 ]
to:render::@1
render::@1: scope:[render] from render render::@3
[51] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@3/(byte*) render::colline#1 ) [ render::y#2 render::colline#2 ]
[51] (byte) render::y#2 ← phi( render/(byte) 0 render::@3/(byte) render::y#1 ) [ render::y#2 render::colline#2 ]
[53] (byte*) render::colline#2 ← phi( render/(word) 55296 render::@3/(byte*) render::colline#1 ) [ render::y#2 render::colline#2 numpoints#1 ]
[53] (byte) render::y#2 ← phi( render/(byte) 0 render::@3/(byte) render::y#1 ) [ render::y#2 render::colline#2 numpoints#1 ]
to:render::@2
render::@2: scope:[render] from render::@1 render::@5
[52] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@5/(byte) render::x#1 ) [ render::x#2 render::y#2 render::colline#2 ]
[53] (byte) findcol::x#0 ← (byte) render::x#2 [ render::x#2 render::y#2 render::colline#2 ]
[54] (byte) findcol::y#0 ← (byte) render::y#2 [ render::x#2 render::y#2 render::colline#2 ]
[55] call findcol param-assignment [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ]
[54] (byte) render::x#2 ← phi( render::@1/(byte) 0 render::@5/(byte) render::x#1 ) [ render::y#2 render::colline#2 render::x#2 numpoints#1 ]
[55] (byte) findcol::x#0 ← (byte) render::x#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 numpoints#1 ]
[56] (byte) findcol::y#0 ← (byte) render::y#2 [ render::y#2 render::colline#2 render::x#2 findcol::x#0 findcol::y#0 numpoints#1 ]
[57] call findcol param-assignment [ render::y#2 render::colline#2 render::x#2 findcol::return#0 numpoints#1 ]
to:render::@5
render::@5: scope:[render] from render::@2
[56] (byte) render::col#0 ← (byte) findcol::return#0 [ render::x#2 render::y#2 render::colline#2 render::col#0 ]
[57] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::x#2 render::y#2 render::colline#2 ]
[58] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::x#1 render::y#2 render::colline#2 ]
[59] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::x#1 render::y#2 render::colline#2 ]
[58] (byte) render::col#0 ← (byte) findcol::return#0 [ render::y#2 render::colline#2 render::x#2 render::col#0 numpoints#1 ]
[59] *((byte*) render::colline#2 + (byte) render::x#2) ← (byte) render::col#0 [ render::y#2 render::colline#2 render::x#2 numpoints#1 ]
[60] (byte) render::x#1 ← ++ (byte) render::x#2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ]
[61] if((byte) render::x#1!=(byte) 40) goto render::@2 [ render::y#2 render::colline#2 render::x#1 numpoints#1 ]
to:render::@3
render::@3: scope:[render] from render::@5
[60] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::colline#1 render::y#2 ]
[61] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 ]
[62] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 ]
[62] (byte*) render::colline#1 ← (byte*) render::colline#2 + (byte) 40 [ render::y#2 render::colline#1 numpoints#1 ]
[63] (byte) render::y#1 ← ++ (byte) render::y#2 [ render::y#1 render::colline#1 numpoints#1 ]
[64] if((byte) render::y#1!=(byte) 25) goto render::@1 [ render::y#1 render::colline#1 numpoints#1 ]
to:render::@return
render::@return: scope:[render] from render::@3
[63] return [ ]
[65] return [ numpoints#1 ]
to:@return
findcol: scope:[findcol] from render::@2
[66] phi() [ findcol::x#0 findcol::y#0 numpoints#1 ]
to:findcol::@1
findcol::@1: scope:[findcol] from findcol findcol::@19
[64] (byte) findcol::mincol#11 ← phi( findcol/(byte) 0 findcol::@19/(byte) findcol::mincol#2 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[64] (byte) findcol::mindiff#10 ← phi( findcol/(byte) 255 findcol::@19/(byte~) findcol::mindiff#13 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[64] (byte) findcol::i#12 ← phi( findcol/(byte) 0 findcol::@19/(byte) findcol::i#1 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[65] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[66] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[67] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[67] (byte) findcol::mincol#11 ← phi( findcol/(byte) 0 findcol::@19/(byte) findcol::mincol#2 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[67] (byte) findcol::mindiff#10 ← phi( findcol/(byte) 255 findcol::@19/(byte~) findcol::mindiff#13 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[67] (byte) findcol::i#12 ← phi( findcol/(byte) 0 findcol::@19/(byte) findcol::i#1 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[68] (byte) findcol::xp#0 ← (word) 4096 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 numpoints#1 ]
[69] (byte) findcol::yp#0 ← (word) 4352 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ]
[70] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ]
to:findcol::@9
findcol::@9: scope:[findcol] from findcol::@1
[68] if((byte) findcol::y#0!=(byte) findcol::yp#0) goto findcol::@2 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[71] if((byte) findcol::y#0!=(byte) findcol::yp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ]
to:findcol::@return
findcol::@return: scope:[findcol] from findcol::@8 findcol::@9
[69] (byte) findcol::return#0 ← phi( findcol::@9/(byte) 0 findcol::@8/(byte) findcol::mincol#2 ) [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ]
[70] return [ render::x#2 render::y#2 findcol::return#0 render::colline#2 ]
[72] (byte) findcol::return#0 ← phi( findcol::@9/(byte) 0 findcol::@8/(byte) findcol::mincol#2 ) [ findcol::return#0 numpoints#1 ]
[73] return [ findcol::return#0 numpoints#1 ]
to:@return
findcol::@2: scope:[findcol] from findcol::@1 findcol::@9
[71] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::xp#0 findcol::y#0 findcol::yp#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[74] if((byte) findcol::x#0>=(byte) findcol::xp#0) goto findcol::@4 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::xp#0 findcol::yp#0 numpoints#1 ]
to:findcol::@12
findcol::@12: scope:[findcol] from findcol::@2
[72] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#1 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[75] (byte) findcol::diff#1 ← (byte) findcol::xp#0 - (byte) findcol::x#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#1 numpoints#1 ]
to:findcol::@5
findcol::@5: scope:[findcol] from findcol::@12 findcol::@4
[73] (byte) findcol::diff#4 ← phi( findcol::@12/(byte) findcol::diff#1 findcol::@4/(byte) findcol::diff#0 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[74] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[76] (byte) findcol::diff#4 ← phi( findcol::@12/(byte) findcol::diff#1 findcol::@4/(byte) findcol::diff#0 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 numpoints#1 ]
[77] if((byte) findcol::y#0>=(byte) findcol::yp#0) goto findcol::@6 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::yp#0 findcol::diff#4 numpoints#1 ]
to:findcol::@14
findcol::@14: scope:[findcol] from findcol::@5
[75] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::$12 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[76] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#3 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[78] (byte~) findcol::$12 ← (byte) findcol::yp#0 - (byte) findcol::y#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 findcol::$12 numpoints#1 ]
[79] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#3 numpoints#1 ]
to:findcol::@7
findcol::@7: scope:[findcol] from findcol::@14 findcol::@6
[77] (byte) findcol::diff#6 ← phi( findcol::@14/(byte) findcol::diff#3 findcol::@6/(byte) findcol::diff#2 ) [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[78] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[80] (byte) findcol::diff#6 ← phi( findcol::@14/(byte) findcol::diff#3 findcol::@6/(byte) findcol::diff#2 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 numpoints#1 ]
[81] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#6 numpoints#1 ]
to:findcol::@16
findcol::@16: scope:[findcol] from findcol::@7
[79] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#6 findcol::mincol#1 numpoints#1 ]
[82] (byte) findcol::mincol#1 ← (word) 4608 *idx (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::diff#6 findcol::mincol#1 numpoints#1 ]
to:findcol::@8
findcol::@8: scope:[findcol] from findcol::@16 findcol::@21
[80] (byte) findcol::mindiff#11 ← phi( findcol::@16/(byte) findcol::diff#6 findcol::@21/(byte~) findcol::mindiff#14 ) [ render::x#2 render::y#2 render::colline#2 findcol::mincol#2 findcol::i#12 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ]
[80] (byte) findcol::mincol#2 ← phi( findcol::@16/(byte) findcol::mincol#1 findcol::@21/(byte) findcol::mincol#11 ) [ render::x#2 render::y#2 render::colline#2 findcol::mincol#2 findcol::i#12 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ]
[81] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ]
[82] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 findcol::mindiff#11 ]
[83] (byte) findcol::mindiff#11 ← phi( findcol::@16/(byte) findcol::diff#6 findcol::@21/(byte~) findcol::mindiff#14 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ]
[83] (byte) findcol::mincol#2 ← phi( findcol::@16/(byte) findcol::mincol#1 findcol::@21/(byte) findcol::mincol#11 ) [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ]
[84] (byte) findcol::i#1 ← ++ (byte) findcol::i#12 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ]
[85] if((byte) findcol::i#1<(byte) numpoints#1) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 numpoints#1 ]
to:findcol::@return
findcol::@19: scope:[findcol] from findcol::@8
[83] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ render::x#2 render::y#2 render::colline#2 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 findcol::x#0 findcol::y#0 numpoints#1 ]
[86] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 numpoints#1 ]
to:findcol::@1
findcol::@21: scope:[findcol] from findcol::@7
[84] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ]
[87] (byte~) findcol::mindiff#14 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mincol#11 findcol::mindiff#14 numpoints#1 ]
to:findcol::@8
findcol::@6: scope:[findcol] from findcol::@5
[85] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#4 findcol::mindiff#10 findcol::mincol#11 numpoints#1 findcol::$14 ]
[86] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::diff#2 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[88] (byte~) findcol::$14 ← (byte) findcol::y#0 - (byte) findcol::yp#0 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#4 numpoints#1 findcol::$14 ]
[89] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$14 [ findcol::x#0 findcol::y#0 findcol::i#12 findcol::mindiff#10 findcol::mincol#11 findcol::diff#2 numpoints#1 ]
to:findcol::@7
findcol::@4: scope:[findcol] from findcol::@2
[87] (byte) findcol::diff#0 ← (byte) findcol::x#0 - (byte) findcol::xp#0 [ render::x#2 render::y#2 render::colline#2 findcol::i#12 findcol::x#0 findcol::y#0 findcol::yp#0 findcol::diff#0 findcol::mindiff#10 findcol::mincol#11 numpoints#1 ]
[90] (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 numpoints#1 ]
to:findcol::@5
initscreen: scope:[initscreen] from main::@8
[91] phi() [ ]
to:initscreen::@1
initscreen::@1: scope:[initscreen] from initscreen initscreen::@1
[88] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@1/(byte*) initscreen::screen#1 ) [ initscreen::screen#2 ]
[89] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ]
[90] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ]
[91] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ]
[92] (byte*) initscreen::screen#2 ← phi( initscreen/(word) 1024 initscreen::@1/(byte*) initscreen::screen#1 ) [ initscreen::screen#2 ]
[93] *((byte*) initscreen::screen#2) ← (byte) 230 [ initscreen::screen#2 ]
[94] (byte*) initscreen::screen#1 ← ++ (byte*) initscreen::screen#2 [ initscreen::screen#1 ]
[95] if((byte*) initscreen::screen#1<(word) 2024) goto initscreen::@1 [ initscreen::screen#1 ]
to:initscreen::@return
initscreen::@return: scope:[initscreen] from initscreen::@1
[92] return [ ]
[96] return [ ]
to:@return
addpoint: scope:[addpoint] from main main::@3 main::@4 main::@5 main::@6 main::@7
[93] (byte) addpoint::c#6 ← phi( main/(byte) 1 main::@3/(byte) 2 main::@4/(byte) 3 main::@5/(byte) 4 main::@6/(byte) 5 main::@7/(byte) 7 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ]
[93] (byte) addpoint::y#6 ← phi( main/(byte) 5 main::@3/(byte) 8 main::@4/(byte) 14 main::@5/(byte) 2 main::@6/(byte) 17 main::@7/(byte) 22 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ]
[93] (byte) numpoints#19 ← phi( main/(byte) 0 main::@3/(byte) numpoints#1 main::@4/(byte) numpoints#1 main::@5/(byte) numpoints#1 main::@6/(byte) numpoints#1 main::@7/(byte) numpoints#1 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ]
[93] (byte) addpoint::x#6 ← phi( main/(byte) 5 main::@3/(byte) 15 main::@4/(byte) 6 main::@5/(byte) 34 main::@6/(byte) 21 main::@7/(byte) 31 ) [ numpoints#19 addpoint::x#6 addpoint::y#6 addpoint::c#6 ]
[94] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ]
[95] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ]
[96] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ]
[97] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ ]
[97] (byte) addpoint::c#6 ← phi( main/(byte) 1 main::@3/(byte) 2 main::@4/(byte) 3 main::@5/(byte) 4 main::@6/(byte) 5 main::@7/(byte) 7 ) [ addpoint::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ]
[97] (byte) addpoint::y#6 ← phi( main/(byte) 5 main::@3/(byte) 8 main::@4/(byte) 14 main::@5/(byte) 2 main::@6/(byte) 17 main::@7/(byte) 22 ) [ addpoint::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ]
[97] (byte) numpoints#19 ← phi( main/(byte) 0 main::@3/(byte) numpoints#1 main::@4/(byte) numpoints#1 main::@5/(byte) numpoints#1 main::@6/(byte) numpoints#1 main::@7/(byte) numpoints#1 ) [ addpoint::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ]
[97] (byte) addpoint::x#6 ← phi( main/(byte) 5 main::@3/(byte) 15 main::@4/(byte) 6 main::@5/(byte) 34 main::@6/(byte) 21 main::@7/(byte) 31 ) [ addpoint::x#6 numpoints#19 addpoint::y#6 addpoint::c#6 ]
[98] *((word) 4096 + (byte) numpoints#19) ← (byte) addpoint::x#6 [ numpoints#19 addpoint::y#6 addpoint::c#6 ]
[99] *((word) 4352 + (byte) numpoints#19) ← (byte) addpoint::y#6 [ numpoints#19 addpoint::c#6 ]
[100] *((word) 4608 + (byte) numpoints#19) ← (byte) addpoint::c#6 [ numpoints#19 ]
[101] (byte) numpoints#1 ← ++ (byte) numpoints#19 [ numpoints#1 ]
to:addpoint::@return
addpoint::@return: scope:[addpoint] from addpoint
[98] return [ ]
[102] return [ numpoints#1 ]
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -85,11 +85,11 @@
(byte) findcol::return
(byte) findcol::return#0 reg byte y 3667.333333333333
(byte) findcol::x
(byte) findcol::x#0 x zp ZP_BYTE:9 1863.8636363636363
(byte) findcol::x#0 x zp ZP_BYTE:9 1640.2
(byte) findcol::xp
(byte) findcol::xp#0 xp zp ZP_BYTE:7 10001.0
(byte) findcol::y
(byte) findcol::y#0 y zp ZP_BYTE:10 1863.8636363636363
(byte) findcol::y#0 y zp ZP_BYTE:10 1708.5416666666665
(byte) findcol::yp
(byte) findcol::yp#0 yp zp ZP_BYTE:11 6250.625
(void()) initscreen()
@ -110,7 +110,7 @@
(label) main::@8
(label) main::@return
(byte) numpoints
(byte) numpoints#1 numpoints zp ZP_BYTE:8 455.13636363636346
(byte) numpoints#1 numpoints zp ZP_BYTE:8 200.25999999999996
(byte) numpoints#19 numpoints zp ZP_BYTE:8 4.5
(void()) render()
(label) render::@1
@ -122,13 +122,13 @@
(byte) render::col#0 reg byte a 2002.0
(byte*) render::colline
(byte*) render::colline#1 colline zp ZP_PTR_BYTE:3 67.33333333333333
(byte*) render::colline#2 colline zp ZP_PTR_BYTE:3 36.45454545454545
(byte*) render::colline#2 colline zp ZP_PTR_BYTE:3 133.66666666666669
(byte) render::x
(byte) render::x#1 x zp ZP_BYTE:5 1501.5
(byte) render::x#2 x zp ZP_BYTE:5 133.46666666666667
(byte) render::x#2 x zp ZP_BYTE:5 667.3333333333334
(byte) render::y
(byte) render::y#1 y zp ZP_BYTE:2 151.5
(byte) render::y#2 y zp ZP_BYTE:2 35.38235294117647
(byte) render::y#2 y zp ZP_BYTE:2 120.29999999999998
zp ZP_BYTE:2 [ render::y#2 render::y#1 addpoint::c#6 ]
zp ZP_PTR_BYTE:3 [ render::colline#2 render::colline#1 initscreen::screen#2 initscreen::screen#1 ]

View File

@ -8,6 +8,7 @@ main: {
tya
clc
adc #$2
sty sum.a
sta sum.c
jsr sum
sta $400,y
@ -17,6 +18,7 @@ main: {
tya
clc
adc #$2
sty sum2.a
sta sum2.c
jsr sum2
sta $428,y
@ -26,21 +28,21 @@ main: {
rts
}
sum2: {
.label c = 2
sty $ff
.label a = 2
.label c = 3
txa
clc
adc $ff
adc a
clc
adc c
rts
}
sum: {
.label c = 2
sty $ff
.label a = 2
.label c = 3
txa
clc
adc $ff
adc a
clc
adc c
rts

View File

@ -3,46 +3,47 @@
to:@end
@end: scope:[] from @begin
main: scope:[main] from @begin
[1] phi() [ ]
to:main::@1
main::@1: scope:[main] from main main::@4
[1] (byte) main::i#2 ← phi( main/(byte) 0 main::@4/(byte) main::i#1 ) [ main::i#2 ]
[2] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ]
[3] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ]
[4] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ]
[5] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ]
[6] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 ]
[7] call sum param-assignment [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ]
[2] (byte) main::i#2 ← phi( main/(byte) 0 main::@4/(byte) main::i#1 ) [ main::i#2 ]
[3] (byte~) main::$0 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$0 ]
[4] (byte~) main::$1 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$0 main::$1 ]
[5] (byte) sum::a#0 ← (byte) main::i#2 [ main::i#2 main::$0 main::$1 sum::a#0 ]
[6] (byte) sum::b#0 ← (byte~) main::$0 [ main::i#2 main::$1 sum::a#0 sum::b#0 ]
[7] (byte) sum::c#0 ← (byte~) main::$1 [ main::i#2 sum::a#0 sum::b#0 sum::c#0 ]
[8] call sum param-assignment [ main::i#2 sum::return#0 ]
to:main::@3
main::@3: scope:[main] from main::@1
[8] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ]
[9] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ]
[10] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ]
[11] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ]
[12] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ]
[13] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ]
[14] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 ]
[15] call sum2 param-assignment [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ]
[9] (byte~) main::$2 ← (byte) sum::return#0 [ main::i#2 main::$2 ]
[10] *((word) 1024 + (byte) main::i#2) ← (byte~) main::$2 [ main::i#2 ]
[11] (byte~) main::$3 ← (byte) main::i#2 + (byte) 1 [ main::i#2 main::$3 ]
[12] (byte~) main::$4 ← (byte) main::i#2 + (byte) 2 [ main::i#2 main::$3 main::$4 ]
[13] (byte) sum2::a#0 ← (byte) main::i#2 [ main::i#2 main::$3 main::$4 sum2::a#0 ]
[14] (byte) sum2::b#0 ← (byte~) main::$3 [ main::i#2 main::$4 sum2::a#0 sum2::b#0 ]
[15] (byte) sum2::c#0 ← (byte~) main::$4 [ main::i#2 sum2::a#0 sum2::b#0 sum2::c#0 ]
[16] call sum2 param-assignment [ main::i#2 sum2::return#0 ]
to:main::@4
main::@4: scope:[main] from main::@3
[16] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ]
[17] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ]
[18] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[19] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ]
[17] (byte~) main::$5 ← (byte) sum2::return#0 [ main::i#2 main::$5 ]
[18] *((word) 1064 + (byte) main::i#2) ← (byte~) main::$5 [ main::i#2 ]
[19] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ]
[20] if((byte) main::i#1!=(byte) 11) goto main::@1 [ main::i#1 ]
to:main::@return
main::@return: scope:[main] from main::@4
[20] return [ ]
[21] return [ ]
to:@return
sum2: scope:[sum2] from main::@3
[21] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ main::i#2 sum2::a#0 sum2::b#0 sum2::$0 sum2::c#0 ]
[22] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ]
[22] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 [ sum2::c#0 sum2::$0 ]
[23] (byte) sum2::return#0 ← (byte~) sum2::$0 + (byte) sum2::c#0 [ sum2::return#0 ]
to:sum2::@return
sum2::@return: scope:[sum2] from sum2
[23] return [ main::i#2 sum2::return#0 sum2::a#0 sum2::b#0 ]
[24] return [ sum2::return#0 ]
to:@return
sum: scope:[sum] from main::@1
[24] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ main::i#2 sum::a#0 sum::b#0 sum::$0 sum::c#0 ]
[25] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ]
[25] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 [ sum::c#0 sum::$0 ]
[26] (byte) sum::return#0 ← (byte~) sum::$0 + (byte) sum::c#0 [ sum::return#0 ]
to:sum::@return
sum::@return: scope:[sum] from sum
[26] return [ main::i#2 sum::return#0 sum::a#0 sum::b#0 ]
[27] return [ sum::return#0 ]
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -15,40 +15,39 @@
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte y 16.5
(byte) main::i#2 reg byte y 4.782608695652174
(byte) main::i#2 reg byte y 6.470588235294119
(byte()) sum((byte) sum::a , (byte) sum::b , (byte) sum::c)
(byte~) sum::$0 reg byte a 4.0
(label) sum::@return
(byte) sum::a
(byte) sum::a#0 reg byte y 1.8571428571428572
(byte) sum::a#0 a zp ZP_BYTE:2 4.333333333333333
(byte) sum::b
(byte) sum::b#0 reg byte x 2.1666666666666665
(byte) sum::b#0 reg byte x 6.5
(byte) sum::c
(byte) sum::c#0 c zp ZP_BYTE:2 13.0
(byte) sum::c#0 c zp ZP_BYTE:3 6.5
(byte) sum::return
(byte) sum::return#0 reg byte a 4.333333333333333
(byte()) sum2((byte) sum2::a , (byte) sum2::b , (byte) sum2::c)
(byte~) sum2::$0 reg byte a 4.0
(label) sum2::@return
(byte) sum2::a
(byte) sum2::a#0 reg byte y 1.8571428571428572
(byte) sum2::a#0 a zp ZP_BYTE:2 4.333333333333333
(byte) sum2::b
(byte) sum2::b#0 reg byte x 2.1666666666666665
(byte) sum2::b#0 reg byte x 6.5
(byte) sum2::c
(byte) sum2::c#0 c zp ZP_BYTE:2 13.0
(byte) sum2::c#0 c zp ZP_BYTE:3 6.5
(byte) sum2::return
(byte) sum2::return#0 reg byte a 4.333333333333333
reg byte y [ main::i#2 main::i#1 ]
reg byte x [ main::$0 ]
reg byte a [ main::$1 ]
reg byte y [ sum::a#0 ]
zp ZP_BYTE:2 [ sum::a#0 sum2::a#0 ]
reg byte x [ sum::b#0 ]
zp ZP_BYTE:2 [ sum::c#0 sum2::c#0 ]
zp ZP_BYTE:3 [ sum::c#0 sum2::c#0 ]
reg byte a [ main::$2 ]
reg byte x [ main::$3 ]
reg byte a [ main::$4 ]
reg byte y [ sum2::a#0 ]
reg byte x [ sum2::b#0 ]
reg byte a [ main::$5 ]
reg byte a [ sum2::$0 ]