1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-01-18 22:30:05 +00:00

Constant loop head identification working. #246 is essentially complete. A few program grow to much from the optimization - this needs attention at some point.

This commit is contained in:
jespergravgaard 2019-08-07 01:32:46 +02:00
parent 50b59555fc
commit 0a58b03094
127 changed files with 41541 additions and 18852 deletions

View File

@ -8,11 +8,10 @@ import dk.camelot64.kickc.model.values.*;
/**
* Any Value in the program being iterated by {@link ProgramValueIterator}.
*
* <p>
* The Value can be inspected using get() and replaced inside the model using set(val).
*
* <p>
* The context of the Value can be determined from the sub-class containing it plus the parameters to the ProgramValueHandler.
*
*/
public interface ProgramValue {
@ -204,6 +203,11 @@ public interface ProgramValue {
public void set(Value value) {
phiVariable.getValues().get(i).setrValue((RValue) value);
}
public LabelRef getPredecessor() {
return phiVariable.getValues().get(i).getPredecessor();
}
}
class PhiValuePredecessor implements ProgramValue {
@ -472,7 +476,7 @@ public interface ProgramValue {
@Override
public void set(Value value) {
structValue.setValue(memberRef, (ConstantValue)value);
structValue.setValue(memberRef, (ConstantValue) value);
}
}

View File

@ -36,6 +36,7 @@ public class Pass2LoopHeadConstantIdentification extends Pass2SsaOptimization {
ControlFlowBlock loopHeadBlock = getGraph().getBlock(loopHeadRef);
boolean modified = optimizeLoopHead(loopHeadBlock, loop, variableReferenceInfos);
if(modified) {
getProgram().clearVariableReferenceInfos();
getProgram().clearStatementInfos();
getProgram().clearLoopSet();
getProgram().clearDominators();

View File

@ -183,32 +183,19 @@ public class PassNCalcVariableReferenceInfos extends PassNCalcBase<VariableRefer
* @param stmt The statement
* @return Variables defined by the statement
*/
private Collection<VariableRef> getDefinedVars(Statement stmt) {
if(stmt instanceof StatementAssignment) {
StatementAssignment assignment = (StatementAssignment) stmt;
LValue lValue = assignment.getlValue();
if(lValue instanceof VariableRef) {
return Collections.singletonList((VariableRef) lValue);
}
} else if(stmt instanceof StatementPhiBlock) {
public static Collection<VariableRef> getDefinedVars(Statement stmt) {
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;
} else if(stmt instanceof StatementCall) {
List<VariableRef> defined = new ArrayList<>();
if(((StatementCall) stmt).getlValue() instanceof VariableRef) {
defined.add((VariableRef) ((StatementCall) stmt).getlValue());
} else if(stmt instanceof StatementLValue) {
LValue lValue = ((StatementLValue) stmt).getlValue();
if(lValue instanceof VariableRef) {
return Collections.singletonList((VariableRef) lValue);
}
return defined;
} else if(stmt instanceof StatementCallPointer) {
List<VariableRef> defined = new ArrayList<>();
if(((StatementCallPointer) stmt).getlValue() instanceof VariableRef) {
defined.add((VariableRef) ((StatementCallPointer) stmt).getlValue());
}
return defined;
}
return new ArrayList<>();
}

View File

@ -10,8 +10,11 @@ import dk.camelot64.kickc.model.symbols.Variable;
import dk.camelot64.kickc.model.symbols.VariableVersion;
import dk.camelot64.kickc.model.values.*;
import dk.camelot64.kickc.passes.AliasReplacer;
import dk.camelot64.kickc.passes.Pass1GenerateSingleStaticAssignmentForm;
import dk.camelot64.kickc.passes.calcs.PassNCalcVariableReferenceInfos;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
/**
* Utility for copying blocks in a program - typically to unroll loops or conditions.
@ -72,70 +75,142 @@ public class Unroller {
}
/**
* Ensure that all variables defined inside the blocks to be copied has a PHI in successor blocks.
* Ensure that variables defined inside and used outside the blocks to be copied has different versions in different successors blocks.
*/
private void prepare() {
for(VariableRef origVarRef : getVarsDefinedIn(unrollBlocks, program)) {
// Find out if the variable is ever referenced outside the loop
if(isReferencedOutside(origVarRef, unrollBlocks, program)) {
// Add any needed PHI-statements to the successors
for(SuccessorTransition successorTransition : getSuccessorTransitions(unrollBlocks, program.getGraph())) {
ControlFlowBlock successorBlock = program.getGraph().getBlock(successorTransition.successor);
StatementPhiBlock phiBlock = successorBlock.getPhiBlock();
// Create a new version of the variable
Variable origVar = program.getScope().getVariable(origVarRef);
Variable newVar;
if(origVar instanceof VariableVersion) {
newVar = ((VariableVersion) origVar).getVersionOf().createVersion();
} else {
newVar = origVar.getScope().addVariableIntermediate();
}
// Replace all references from the new phi and forward
forwardReplaceAllUsages(successorTransition.successor, origVarRef, newVar.getRef(), new LinkedHashSet<>());
// Create the new phi-variable in the successor phi block
StatementPhiBlock.PhiVariable newPhiVar = phiBlock.addPhiVariable(newVar.getRef());
newPhiVar.setrValue(successorTransition.predecessor, origVarRef);
program.getLog().append("Creating PHI for " + origVarRef.getFullName() + " in block " + successorBlock.getLabel() + " - " + phiBlock.toString(program, false));
}
// Re-version all usages of the specific variable version
Map<LabelRef, VariableRef> newPhis = new LinkedHashMap<>();
Map<LabelRef, VariableRef> varVersions = new LinkedHashMap<>();
reVersionAllUsages(origVarRef, newPhis, varVersions);
program.getLog().append("GRAPH (NEW VERSIONS for " + origVarRef + ")");
program.getLog().append(program.getGraph().toString(program));
// Recursively fill out & add PHI-functions until they have propagated everywhere needed
completePhiFunctions(newPhis, varVersions);
}
}
}
/**
* Introduces a new version of a variable - and replaces all uses of the old variable with the new one from a specific point in the control flow graph and forward until the old variable is defined.
* @param blockRef The block to replace the usage from
* @param origVarRef The original variable
* @param newVarRef The new variable replacing the original
* @param visited All blocks that have already been visited.
* Find all usages of a variable and create new versions for each usage.
*
* @param origVarRef The original variable where all usages must have new versions
* @param newPhis Map that will be populated with all new (empty) PHI-variables for the new versionw - these will be populated later.
* @param varVersions Map that will be populated with the version of the origVariable at the end of each block where it has a defined version.
*/
private void forwardReplaceAllUsages(LabelRef blockRef, VariableRef origVarRef, VariableRef newVarRef, Set<LabelRef> visited) {
VariableReferenceInfos variableReferenceInfos = program.getVariableReferenceInfos();
LinkedHashMap<SymbolRef, RValue> aliases = new LinkedHashMap<>();
aliases.put(origVarRef, newVarRef);
AliasReplacer aliasReplacer = new AliasReplacer(aliases);
ControlFlowBlock block = program.getGraph().getBlock(blockRef);
if(block!=null) {
private void reVersionAllUsages(VariableRef origVarRef, Map<LabelRef, VariableRef> newPhis, Map<LabelRef, VariableRef> varVersions) {
// First add the definition of origVar to varVersions
for(ControlFlowBlock block : program.getGraph().getAllBlocks()) {
for(Statement statement : block.getStatements()) {
Collection<VariableRef> definedVars = variableReferenceInfos.getDefinedVars(statement);
if(definedVars!=null && definedVars.contains(origVarRef)) {
// Found definition of the original variable - don't replace any more
return;
Collection<VariableRef> definedVars = PassNCalcVariableReferenceInfos.getDefinedVars(statement);
if(definedVars.contains(origVarRef)) {
varVersions.put(block.getLabel(), origVarRef);
}
// Replace any usage in the statement
ProgramValueIterator.execute(statement, aliasReplacer, null, block);
}
}
visited.add(blockRef);
if(block!=null) {
if(block.getConditionalSuccessor() != null && !visited.contains(block.getConditionalSuccessor())) {
forwardReplaceAllUsages(block.getConditionalSuccessor(), origVarRef, newVarRef, visited);
// Next iterate the entire graph ensuring that all usages create new versions (except usages right after the definition)
for(ControlFlowBlock block : program.getGraph().getAllBlocks()) {
AtomicReference<VariableRef> currentVersion = new AtomicReference<>();
// Set current version from map
currentVersion.set(varVersions.get(block.getLabel()));
for(Statement statement : block.getStatements()) {
ProgramValueIterator.execute(statement, (programValue, currentStmt, stmtIt, currentBlock) -> {
Value value = programValue.get();
if(origVarRef.equals(value)) {
// Found a reference!
if(statement instanceof StatementPhiBlock && programValue instanceof ProgramValue.PhiVariable) {
// This is the definition - don't replace it
currentVersion.set(origVarRef);
varVersions.put(block.getLabel(), origVarRef);
} else if(statement instanceof StatementLValue && programValue instanceof ProgramValue.ProgramValueLValue) {
// This is the definition - don't replace it
currentVersion.set(origVarRef);
varVersions.put(block.getLabel(), origVarRef);
} else if(statement instanceof StatementPhiBlock && programValue instanceof ProgramValue.PhiValue) {
// The reference is inside a PHI-value - we need a version in the predecessor
LabelRef predecessor = ((ProgramValue.PhiValue) programValue).getPredecessor();
VariableRef predecessorVersion = varVersions.get(predecessor);
if(predecessorVersion == null) {
// Add a new PHI to the predecessor
predecessorVersion = createNewVersion(origVarRef);
varVersions.put(predecessor, predecessorVersion);
newPhis.put(predecessor, predecessorVersion);
}
// Use the definition
programValue.set(predecessorVersion);
} else if(currentVersion.get() == null) {
// Found a reference - no definition - create a new version
VariableRef newVarRef = createNewVersion(origVarRef);
currentVersion.set(newVarRef);
varVersions.put(block.getLabel(), newVarRef);
newPhis.put(block.getLabel(), currentVersion.get());
// Use the definition
programValue.set(newVarRef);
} else {
programValue.set(currentVersion.get());
}
}
}, null, null);
}
if(block.getDefaultSuccessor() != null && !visited.contains(block.getDefaultSuccessor())) {
forwardReplaceAllUsages(block.getDefaultSuccessor(), origVarRef, newVarRef, visited);
}
if(block.getCallSuccessor() != null && !visited.contains(block.getCallSuccessor())) {
forwardReplaceAllUsages(block.getCallSuccessor(), origVarRef, newVarRef, visited);
}
// Add the new empty PHI-blocks()
for(LabelRef blockRef : newPhis.keySet()) {
ControlFlowBlock block = program.getGraph().getBlock(blockRef);
VariableRef newVersion = newPhis.get(blockRef);
block.getPhiBlock().addPhiVariable(newVersion);
}
}
/**
* Create a new version of a variable
* @param origVarRef The original variable
* @return The new version
*/
private VariableRef createNewVersion(VariableRef origVarRef) {
Variable origVar = program.getScope().getVariable(origVarRef);
Scope scope = origVar.getScope();
VariableRef newVarRef;
if(origVarRef.isIntermediate()) {
newVarRef = scope.addVariableIntermediate().getRef();
} else {
newVarRef = ((VariableVersion) origVar).getVersionOf().createVersion().getRef();
}
return newVarRef;
}
/**
* Look through all new phi-functions and fill out their parameters.
* Both passed maps are modified
*
* @param newPhis New (empty) PHI-variables for the new versions that need to be populated
* @param varVersions Map with the version of the origVariable at the end of each block where it has a defined version.
*/
private void completePhiFunctions(Map<LabelRef, VariableRef> newPhis, Map<LabelRef, VariableRef> varVersions) {
Map<LabelRef, VariableRef> todo = newPhis;
while(todo.size() > 0) {
Map<LabelRef, VariableRef> doing = todo;
todo = new LinkedHashMap<>();
for(LabelRef blockRef : doing.keySet()) {
VariableRef doingVarRef = doing.get(blockRef);
ControlFlowBlock block = program.getGraph().getBlock(blockRef);
StatementPhiBlock.PhiVariable doingPhiVariable = block.getPhiBlock().getPhiVariable(doingVarRef);
List<ControlFlowBlock> predecessors = Pass1GenerateSingleStaticAssignmentForm.getPhiPredecessors(block, program);
for(ControlFlowBlock predecessor : predecessors) {
VariableRef predecessorVarRef = varVersions.get(predecessor.getLabel());
if(predecessorVarRef == null) {
// Variable has no version in the predecessor block - add a new PHI and populate later!
VariableRef newVarRef = createNewVersion(doingVarRef);
predecessor.getPhiBlock().addPhiVariable(newVarRef);
varVersions.put(predecessor.getLabel(), newVarRef);
todo.put(predecessor.getLabel(), newVarRef);
predecessorVarRef = newVarRef;
}
doingPhiVariable.setrValue(predecessor.getLabel(), predecessorVarRef);
}
}
}
}
@ -272,7 +347,7 @@ public class Unroller {
}
/**
* Patch the PHI-block of an external successor block. Ensures that the PHI-block also receives data from the new coped block.
* Patch the PHI-block of an external successor block. Ensures that the PHI-block also receives data from the new copied block.
*
* @param successor The successor block's label
* @param origBlock The label of the original block

View File

@ -0,0 +1,24 @@
// A test of boolean conditions using && || and !
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
main: {
.label screen = $400
ldx #0
b3:
lda #'*'
sta screen,x
b2:
inx
cpx #$15
bne b1
rts
b1:
txa
and #1
cpx #$a
bcs b2
cmp #0
bne b2
jmp b3
}

View File

@ -0,0 +1,31 @@
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] phi()
[2] call main
to:@end
@end: scope:[] from @1
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@3
main::@3: scope:[main] from main main::@4
[5] (byte) main::i#9 ← phi( main::@4/(byte) main::i#1 main/(byte) 0 )
[6] *((const byte*) main::screen#0 + (byte) main::i#9) ← (byte) '*'
to:main::@2
main::@2: scope:[main] from main::@1 main::@3 main::@4
[7] (byte) main::i#5 ← phi( main::@1/(byte) main::i#1 main::@3/(byte) main::i#9 main::@4/(byte) main::i#1 )
[8] (byte) main::i#1 ← ++ (byte) main::i#5
[9] if((byte) main::i#1!=(byte) $15) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[10] return
to:@return
main::@1: scope:[main] from main::@2
[11] (byte~) main::$6 ← (byte) main::i#1 & (byte) 1
[12] if((byte) main::i#1>=(byte) $a) goto main::@2
to:main::@4
main::@4: scope:[main] from main::@1
[13] if((byte~) main::$6!=(byte) 0) goto main::@2
to:main::@3

View File

@ -0,0 +1,613 @@
Culled Empty Block (label) main::@4
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
to:@1
main: scope:[main] from @1
(byte*) main::screen#0 ← ((byte*)) (number) $400
(byte) main::i#0 ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@2
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@2/(byte) main::i#1 )
(bool~) main::$0 ← (byte) main::i#2 < (number) $a
(number~) main::$1 ← (byte) main::i#2 & (number) 1
(bool~) main::$2 ← (number~) main::$1 == (number) 0
(bool~) main::$3 ← (bool~) main::$0 && (bool~) main::$2
(bool~) main::$4 ← ! (bool~) main::$3
if((bool~) main::$4) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1 main::@3
(byte) main::i#3 ← phi( main::@1/(byte) main::i#2 main::@3/(byte) main::i#4 )
(byte) main::i#1 ← (byte) main::i#3 + rangenext(0,$14)
(bool~) main::$5 ← (byte) main::i#1 != rangelast(0,$14)
if((bool~) main::$5) goto main::@1
to:main::@return
main::@3: scope:[main] from main::@1
(byte) main::i#4 ← phi( main::@1/(byte) main::i#2 )
*((byte*) main::screen#0 + (byte) main::i#4) ← (byte) '*'
to:main::@2
main::@return: scope:[main] from main::@2
return
to:@return
@1: scope:[] from @begin
call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(void()) main()
(bool~) main::$0
(number~) main::$1
(bool~) main::$2
(bool~) main::$3
(bool~) main::$4
(bool~) main::$5
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i#3
(byte) main::i#4
(byte*) main::screen
(byte*) main::screen#0
Adding number conversion cast (unumber) $a in (bool~) main::$0 ← (byte) main::i#2 < (number) $a
Adding number conversion cast (unumber) 1 in (number~) main::$1 ← (byte) main::i#2 & (number) 1
Adding number conversion cast (unumber) main::$1 in (number~) main::$1 ← (byte) main::i#2 & (unumber)(number) 1
Adding number conversion cast (unumber) 0 in (bool~) main::$2 ← (unumber~) main::$1 == (number) 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte*) main::screen#0 ← (byte*)(number) $400
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast $a
Simplifying constant integer cast 1
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $a
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) main::$1 ← (byte) main::i#2 & (byte) 1
Alias (byte) main::i#2 = (byte) main::i#4
Successful SSA optimization Pass2AliasElimination
Alias (byte) main::i#2 = (byte) main::i#3
Successful SSA optimization Pass2AliasElimination
Simple Condition (bool~) main::$5 [12] if((byte) main::i#1!=rangelast(0,$14)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Rewriting ! if()-condition to reversed if() [7] (bool~) main::$4 ← ! (bool~) main::$3
Successful SSA optimization Pass2ConditionalAndOrRewriting
Rewriting && if()-condition to two if()s [6] (bool~) main::$3 ← (bool~) main::$0 && (bool~) main::$2
Successful SSA optimization Pass2ConditionalAndOrRewriting
Constant (const byte*) main::screen#0 = (byte*) 1024
Constant (const byte) main::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [10] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [12] if(main::i#1!=rangelast(0,$14)) goto main::@1 to (number) $15
Adding number conversion cast (unumber) $15 in if((byte) main::i#1!=(number) $15) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $15
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $15
Successful SSA optimization PassNFinalizeNumberTypeConversions
Simple Condition (bool~) main::$0 [4] if((byte) main::i#2<(byte) $a) goto main::@5
Simple Condition (bool~) main::$2 [10] if((byte~) main::$1==(byte) 0) goto main::@3
Successful SSA optimization Pass2ConditionalJumpSimplification
Negating conditional jump and destination [4] if((byte) main::i#2>=(byte) $a) goto main::@2
Negating conditional jump and destination [10] if((byte~) main::$1!=(byte) 0) goto main::@2
Successful SSA optimization Pass2ConditionalJumpSequenceImprovement
GRAPH (NEW VERSIONS for main::i#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@2
[0] (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@2/(byte) main::i#1 )
[1] (byte~) main::$1 ← (byte) main::i#2 & (byte) 1
[2] if((byte) main::i#2>=(byte) $a) goto main::@2
to:main::@5
main::@2: scope:[main] from main::@1 main::@3 main::@5
(byte) main::i#5 ← phi( )
[3] (byte) main::i#1 ← ++ (byte) main::i#5
[4] if((byte) main::i#1!=(byte) $15) goto main::@1
to:main::@return
main::@3: scope:[main] from main::@5
(byte) main::i#6 ← phi( )
[5] *((const byte*) main::screen#0 + (byte) main::i#6) ← (byte) '*'
to:main::@2
main::@return: scope:[main] from main::@2
[6] return
to:@return
@1: scope:[] from @begin
[7] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
main::@5: scope:[main] from main::@1
[8] if((byte~) main::$1!=(byte) 0) goto main::@2
to:main::@3
GRAPH (NEW VERSIONS for main::$1)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@2
[0] (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@2/(byte) main::i#1 )
[1] (byte~) main::$1 ← (byte) main::i#2 & (byte) 1
[2] if((byte) main::i#2>=(byte) $a) goto main::@2
to:main::@5
main::@2: scope:[main] from main::@1 main::@3 main::@5
(byte) main::i#5 ← phi( main::@1/(byte) main::i#2 main::@3/(byte) main::i#6 main::@5/(byte) main::i#7 )
[3] (byte) main::i#1 ← ++ (byte) main::i#5
[4] if((byte) main::i#1!=(byte) $15) goto main::@1
to:main::@return
main::@3: scope:[main] from main::@5
(byte) main::i#6 ← phi( main::@5/(byte) main::i#7 )
[5] *((const byte*) main::screen#0 + (byte) main::i#6) ← (byte) '*'
to:main::@2
main::@return: scope:[main] from main::@2
[6] return
to:@return
@1: scope:[] from @begin
[7] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
main::@5: scope:[main] from main::@1
(var) main::$6 ← phi( )
(byte) main::i#7 ← phi( main::@1/(byte) main::i#2 )
[8] if((var) main::$6!=(byte) 0) goto main::@2
to:main::@3
Successful SSA optimization Pass2LoopHeadConstantIdentification
Alias (byte) main::i#1 = (byte) main::i#2
Alias (byte) main::i#6 = (byte) main::i#7
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::i#8 (const byte) main::i#0
Successful SSA optimization Pass2IdenticalPhiElimination
Constant right-side identified [13] (byte~) main::$7 ← (const byte) main::i#0 & (byte) 1
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::$7 = main::i#0&1
Successful SSA optimization Pass2ConstantIdentification
Removing PHI-reference to removed block (main::@1_1) in block main::@2
if() condition always false - eliminating [14] if((const byte) main::i#0>=(byte) $a) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Simplifying constant evaluating to zero (const byte) main::i#0&(byte) 1 in
Successful SSA optimization PassNSimplifyConstantZero
GRAPH (NEW VERSIONS for main::i#6)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1_1
main::@1: scope:[main] from main::@2
[0] (byte~) main::$1 ← (byte) main::i#1 & (byte) 1
[1] if((byte) main::i#1>=(byte) $a) goto main::@2
to:main::@5
main::@2: scope:[main] from main::@1 main::@3 main::@5
[2] (byte) main::i#5 ← phi( main::@1/(byte) main::i#1 main::@3/(byte) main::i#9 main::@5/(byte) main::i#6 )
[3] (byte) main::i#1 ← ++ (byte) main::i#5
[4] if((byte) main::i#1!=(byte) $15) goto main::@1
to:main::@return
main::@3: scope:[main] from main::@5
(byte) main::i#9 ← phi( )
[5] *((const byte*) main::screen#0 + (byte) main::i#9) ← (byte) '*'
to:main::@2
main::@return: scope:[main] from main::@2
[6] return
to:@return
@1: scope:[] from @begin
[7] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
main::@5: scope:[main] from main::@1 main::@1_1
[8] (byte~) main::$6 ← phi( main::@1/(byte~) main::$1 main::@1_1/(const byte) main::$7 )
[8] (byte) main::i#6 ← phi( main::@1/(byte) main::i#1 main::@1_1/(const byte) main::i#0 )
[9] if((byte~) main::$6!=(byte) 0) goto main::@2
to:main::@3
main::@1_1: scope:[main] from main
to:main::@5
Successful SSA optimization Pass2LoopHeadConstantIdentification
Alias (byte) main::i#1 = (byte) main::i#6
Alias (byte~) main::$6 = (byte~) main::$1
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::i#10 (const byte) main::i#0
Identical Phi Values (byte~) main::$8 (const byte) main::$7
Successful SSA optimization Pass2IdenticalPhiElimination
Removing PHI-reference to removed block (main::@5_1) in block main::@2
if() condition always false - eliminating [12] if((const byte) main::$7!=(byte) 0) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) main::$7
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) main::i#0
Constant inlined main::i#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@6(between main::@1 and main::@2)
Added new block during phi lifting main::@7(between main::@5 and main::@2)
Added new block during phi lifting main::@8(between main::@5 and main::@3)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1_1
Adding NOP phi() at start of main::@5_1
CALL GRAPH
Calls in [] to main:2
Created 2 initial phi equivalence classes
Coalesced [10] main::i#12 ← main::i#9
Coalesced [18] main::i#14 ← main::i#1
Coalesced (already) [19] main::i#13 ← main::i#1
Coalesced (already) [20] main::i#11 ← main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@1_1
Culled Empty Block (label) main::@5_1
Culled Empty Block (label) main::@8
Culled Empty Block (label) main::@7
Culled Empty Block (label) main::@6
Renumbering block main::@5 to main::@4
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] phi()
[2] call main
to:@end
@end: scope:[] from @1
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@3
main::@3: scope:[main] from main main::@4
[5] (byte) main::i#9 ← phi( main::@4/(byte) main::i#1 main/(byte) 0 )
[6] *((const byte*) main::screen#0 + (byte) main::i#9) ← (byte) '*'
to:main::@2
main::@2: scope:[main] from main::@1 main::@3 main::@4
[7] (byte) main::i#5 ← phi( main::@1/(byte) main::i#1 main::@3/(byte) main::i#9 main::@4/(byte) main::i#1 )
[8] (byte) main::i#1 ← ++ (byte) main::i#5
[9] if((byte) main::i#1!=(byte) $15) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[10] return
to:@return
main::@1: scope:[main] from main::@2
[11] (byte~) main::$6 ← (byte) main::i#1 & (byte) 1
[12] if((byte) main::i#1>=(byte) $a) goto main::@2
to:main::@4
main::@4: scope:[main] from main::@1
[13] if((byte~) main::$6!=(byte) 0) goto main::@2
to:main::@3
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte~) main::$6 551.0
(byte) main::i
(byte) main::i#1 1041.4
(byte) main::i#5 2114.0
(byte) main::i#9 61.5
(byte*) main::screen
Initial phi equivalence classes
[ main::i#5 main::i#9 main::i#1 ]
Added variable main::$6 to zero page equivalence class [ main::$6 ]
Complete equivalence classes
[ main::i#5 main::i#9 main::i#1 ]
[ main::$6 ]
Allocated zp ZP_BYTE:2 [ main::i#5 main::i#9 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::$6 ]
INITIAL ASM
Target platform is c64basic
// File Comments
// A test of boolean conditions using && || and !
// Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
// Global Constants & labels
// @begin
bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
// @1
b1:
// [2] call main
// [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
// @end
bend:
// main
main: {
.label screen = $400
.label i = 2
.label _6 = 3
// [5] phi from main to main::@3 [phi:main->main::@3]
b3_from_main:
// [5] phi (byte) main::i#9 = (byte) 0 [phi:main->main::@3#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b3
// main::@3
b3:
// [6] *((const byte*) main::screen#0 + (byte) main::i#9) ← (byte) '*' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'*'
ldy i
sta screen,y
// [7] phi from main::@1 main::@3 main::@4 to main::@2 [phi:main::@1/main::@3/main::@4->main::@2]
b2_from_b1:
b2_from_b3:
b2_from_b4:
// [7] phi (byte) main::i#5 = (byte) main::i#1 [phi:main::@1/main::@3/main::@4->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [8] (byte) main::i#1 ← ++ (byte) main::i#5 -- vbuz1=_inc_vbuz1
inc i
// [9] if((byte) main::i#1!=(byte) $15) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #$15
cmp i
bne b1
jmp breturn
// main::@return
breturn:
// [10] return
rts
// main::@1
b1:
// [11] (byte~) main::$6 ← (byte) main::i#1 & (byte) 1 -- vbuz1=vbuz2_band_vbuc1
lda #1
and i
sta _6
// [12] if((byte) main::i#1>=(byte) $a) goto main::@2 -- vbuz1_ge_vbuc1_then_la1
lda i
cmp #$a
bcs b2_from_b1
jmp b4
// main::@4
b4:
// [13] if((byte~) main::$6!=(byte) 0) goto main::@2 -- vbuz1_neq_0_then_la1
lda _6
cmp #0
bne b2_from_b4
// [5] phi from main::@4 to main::@3 [phi:main::@4->main::@3]
b3_from_b4:
// [5] phi (byte) main::i#9 = (byte) main::i#1 [phi:main::@4->main::@3#0] -- register_copy
jmp b3
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] *((const byte*) main::screen#0 + (byte) main::i#9) ← (byte) '*' [ main::i#9 ] ( main:2 [ main::i#9 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#5 main::i#9 main::i#1 ]
Statement [11] (byte~) main::$6 ← (byte) main::i#1 & (byte) 1 [ main::i#1 main::$6 ] ( main:2 [ main::i#1 main::$6 ] ) always clobbers reg byte a
Statement [6] *((const byte*) main::screen#0 + (byte) main::i#9) ← (byte) '*' [ main::i#9 ] ( main:2 [ main::i#9 ] ) always clobbers reg byte a
Statement [11] (byte~) main::$6 ← (byte) main::i#1 & (byte) 1 [ main::i#1 main::$6 ] ( main:2 [ main::i#1 main::$6 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::i#5 main::i#9 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::$6 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 3,216.9: zp ZP_BYTE:2 [ main::i#5 main::i#9 main::i#1 ] 551: zp ZP_BYTE:3 [ main::$6 ]
Uplift Scope []
Uplifting [main] best 24618 combination reg byte x [ main::i#5 main::i#9 main::i#1 ] reg byte a [ main::$6 ]
Uplifting [] best 24618 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// A test of boolean conditions using && || and !
// Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
// Global Constants & labels
// @begin
bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
// @1
b1:
// [2] call main
// [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
// @end
bend:
// main
main: {
.label screen = $400
// [5] phi from main to main::@3 [phi:main->main::@3]
b3_from_main:
// [5] phi (byte) main::i#9 = (byte) 0 [phi:main->main::@3#0] -- vbuxx=vbuc1
ldx #0
jmp b3
// main::@3
b3:
// [6] *((const byte*) main::screen#0 + (byte) main::i#9) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2
lda #'*'
sta screen,x
// [7] phi from main::@1 main::@3 main::@4 to main::@2 [phi:main::@1/main::@3/main::@4->main::@2]
b2_from_b1:
b2_from_b3:
b2_from_b4:
// [7] phi (byte) main::i#5 = (byte) main::i#1 [phi:main::@1/main::@3/main::@4->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [8] (byte) main::i#1 ← ++ (byte) main::i#5 -- vbuxx=_inc_vbuxx
inx
// [9] if((byte) main::i#1!=(byte) $15) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$15
bne b1
jmp breturn
// main::@return
breturn:
// [10] return
rts
// main::@1
b1:
// [11] (byte~) main::$6 ← (byte) main::i#1 & (byte) 1 -- vbuaa=vbuxx_band_vbuc1
txa
and #1
// [12] if((byte) main::i#1>=(byte) $a) goto main::@2 -- vbuxx_ge_vbuc1_then_la1
cpx #$a
bcs b2_from_b1
jmp b4
// main::@4
b4:
// [13] if((byte~) main::$6!=(byte) 0) goto main::@2 -- vbuaa_neq_0_then_la1
cmp #0
bne b2_from_b4
// [5] phi from main::@4 to main::@3 [phi:main::@4->main::@3]
b3_from_b4:
// [5] phi (byte) main::i#9 = (byte) main::i#1 [phi:main::@4->main::@3#0] -- register_copy
jmp b3
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b3
Removing instruction jmp b2
Removing instruction jmp breturn
Removing instruction jmp b4
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b2_from_b1 with b2
Replacing label b2_from_b4 with b2
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b2_from_b1:
Removing instruction b2_from_b3:
Removing instruction b2_from_b4:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b3_from_main:
Removing instruction breturn:
Removing instruction b4:
Removing instruction b3_from_b4:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(byte~) main::$6 reg byte a 551.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 1041.4
(byte) main::i#5 reg byte x 2114.0
(byte) main::i#9 reg byte x 61.5
(byte*) main::screen
(const byte*) main::screen#0 screen = (byte*) 1024
reg byte x [ main::i#5 main::i#9 main::i#1 ]
reg byte a [ main::$6 ]
FINAL ASSEMBLER
Score: 15576
// File Comments
// A test of boolean conditions using && || and !
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
// @begin
// [1] phi from @begin to @1 [phi:@begin->@1]
// @1
// [2] call main
// [4] phi from @1 to main [phi:@1->main]
// [3] phi from @1 to @end [phi:@1->@end]
// @end
// main
main: {
.label screen = $400
// [5] phi from main to main::@3 [phi:main->main::@3]
// [5] phi (byte) main::i#9 = (byte) 0 [phi:main->main::@3#0] -- vbuxx=vbuc1
ldx #0
// main::@3
b3:
// screen[i] = '*'
// [6] *((const byte*) main::screen#0 + (byte) main::i#9) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2
lda #'*'
sta screen,x
// [7] phi from main::@1 main::@3 main::@4 to main::@2 [phi:main::@1/main::@3/main::@4->main::@2]
// [7] phi (byte) main::i#5 = (byte) main::i#1 [phi:main::@1/main::@3/main::@4->main::@2#0] -- register_copy
// main::@2
b2:
// for( char i : 0..20)
// [8] (byte) main::i#1 ← ++ (byte) main::i#5 -- vbuxx=_inc_vbuxx
inx
// [9] if((byte) main::i#1!=(byte) $15) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$15
bne b1
// main::@return
// }
// [10] return
rts
// main::@1
b1:
// i&1
// [11] (byte~) main::$6 ← (byte) main::i#1 & (byte) 1 -- vbuaa=vbuxx_band_vbuc1
txa
and #1
// if( (i<10) && ((i&1)==0) )
// [12] if((byte) main::i#1>=(byte) $a) goto main::@2 -- vbuxx_ge_vbuc1_then_la1
cpx #$a
bcs b2
// main::@4
// [13] if((byte~) main::$6!=(byte) 0) goto main::@2 -- vbuaa_neq_0_then_la1
cmp #0
bne b2
// [5] phi from main::@4 to main::@3 [phi:main::@4->main::@3]
// [5] phi (byte) main::i#9 = (byte) main::i#1 [phi:main::@4->main::@3#0] -- register_copy
jmp b3
}
// File Data

View File

@ -0,0 +1,19 @@
(label) @1
(label) @begin
(label) @end
(void()) main()
(byte~) main::$6 reg byte a 551.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 1041.4
(byte) main::i#5 reg byte x 2114.0
(byte) main::i#9 reg byte x 61.5
(byte*) main::screen
(const byte*) main::screen#0 screen = (byte*) 1024
reg byte x [ main::i#5 main::i#9 main::i#1 ]
reg byte a [ main::$6 ]

View File

@ -59,6 +59,14 @@ bool_complex: {
bool_not: {
.label screen = $450
ldx #0
b4:
lda #' '
sta screen,x
b3:
inx
cpx #$15
bne b1
rts
b1:
txa
and #1
@ -68,19 +76,19 @@ bool_not: {
beq b4
lda #'*'
sta screen,x
b3:
inx
cpx #$15
bne b1
rts
b4:
lda #' '
sta screen,x
jmp b3
}
bool_or: {
.label screen = $428
ldx #0
b2:
lda #'*'
sta screen,x
b3:
inx
cpx #$15
bne b1
rts
b1:
txa
and #1
@ -90,19 +98,19 @@ bool_or: {
beq b2
lda #' '
sta screen,x
b3:
inx
cpx #$15
bne b1
rts
b2:
lda #'*'
sta screen,x
jmp b3
}
bool_and: {
.label screen = $400
ldx #0
b2:
lda #'*'
sta screen,x
b3:
inx
cpx #$15
bne b1
rts
b1:
txa
and #1
@ -113,13 +121,5 @@ bool_and: {
b4:
lda #' '
sta screen,x
b3:
inx
cpx #$15
bne b1
rts
b2:
lda #'*'
sta screen,x
jmp b3
}

View File

@ -60,73 +60,76 @@ bool_complex::@4: scope:[bool_complex] from bool_complex::@5 bool_complex::@7
to:bool_complex::@3
bool_not: scope:[bool_not] from main::@2
[27] phi()
to:bool_not::@1
bool_not::@1: scope:[bool_not] from bool_not bool_not::@3
[28] (byte) bool_not::i#2 ← phi( bool_not/(byte) 0 bool_not::@3/(byte) bool_not::i#1 )
[29] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte) 1
[30] if((byte) bool_not::i#2<(byte) $a) goto bool_not::@4
to:bool_not::@5
bool_not::@5: scope:[bool_not] from bool_not::@1
[31] if((byte~) bool_not::$1==(byte) 0) goto bool_not::@4
to:bool_not::@2
bool_not::@2: scope:[bool_not] from bool_not::@5
[32] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*'
to:bool_not::@4
bool_not::@4: scope:[bool_not] from bool_not bool_not::@1 bool_not::@5
[28] (byte) bool_not::i#7 ← phi( bool_not::@1/(byte) bool_not::i#1 bool_not/(byte) 0 bool_not::@5/(byte) bool_not::i#1 )
[29] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#7) ← (byte) ' '
to:bool_not::@3
bool_not::@3: scope:[bool_not] from bool_not::@2 bool_not::@4
[33] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2
[34] if((byte) bool_not::i#1!=(byte) $15) goto bool_not::@1
[30] (byte) bool_not::i#8 ← phi( bool_not::@2/(byte) bool_not::i#1 bool_not::@4/(byte) bool_not::i#7 )
[31] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#8
[32] if((byte) bool_not::i#1!=(byte) $15) goto bool_not::@1
to:bool_not::@return
bool_not::@return: scope:[bool_not] from bool_not::@3
[35] return
[33] return
to:@return
bool_not::@4: scope:[bool_not] from bool_not::@1 bool_not::@5
[36] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' '
bool_not::@1: scope:[bool_not] from bool_not::@3
[34] (byte~) bool_not::$6 ← (byte) bool_not::i#1 & (byte) 1
[35] if((byte) bool_not::i#1<(byte) $a) goto bool_not::@4
to:bool_not::@5
bool_not::@5: scope:[bool_not] from bool_not::@1
[36] if((byte~) bool_not::$6==(byte) 0) goto bool_not::@4
to:bool_not::@2
bool_not::@2: scope:[bool_not] from bool_not::@5
[37] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#1) ← (byte) '*'
to:bool_not::@3
bool_or: scope:[bool_or] from main::@1
[37] phi()
to:bool_or::@1
bool_or::@1: scope:[bool_or] from bool_or bool_or::@3
[38] (byte) bool_or::i#2 ← phi( bool_or/(byte) 0 bool_or::@3/(byte) bool_or::i#1 )
[39] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte) 1
[40] if((byte) bool_or::i#2<(byte) $a) goto bool_or::@2
to:bool_or::@5
bool_or::@5: scope:[bool_or] from bool_or::@1
[41] if((byte~) bool_or::$1==(byte) 0) goto bool_or::@2
to:bool_or::@4
bool_or::@4: scope:[bool_or] from bool_or::@5
[42] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' '
[38] phi()
to:bool_or::@2
bool_or::@2: scope:[bool_or] from bool_or bool_or::@1 bool_or::@5
[39] (byte) bool_or::i#6 ← phi( bool_or::@1/(byte) bool_or::i#1 bool_or/(byte) 0 bool_or::@5/(byte) bool_or::i#1 )
[40] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#6) ← (byte) '*'
to:bool_or::@3
bool_or::@3: scope:[bool_or] from bool_or::@2 bool_or::@4
[43] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2
[44] if((byte) bool_or::i#1!=(byte) $15) goto bool_or::@1
[41] (byte) bool_or::i#8 ← phi( bool_or::@2/(byte) bool_or::i#6 bool_or::@4/(byte) bool_or::i#1 )
[42] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#8
[43] if((byte) bool_or::i#1!=(byte) $15) goto bool_or::@1
to:bool_or::@return
bool_or::@return: scope:[bool_or] from bool_or::@3
[45] return
[44] return
to:@return
bool_or::@2: scope:[bool_or] from bool_or::@1 bool_or::@5
[46] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*'
bool_or::@1: scope:[bool_or] from bool_or::@3
[45] (byte~) bool_or::$5 ← (byte) bool_or::i#1 & (byte) 1
[46] if((byte) bool_or::i#1<(byte) $a) goto bool_or::@2
to:bool_or::@5
bool_or::@5: scope:[bool_or] from bool_or::@1
[47] if((byte~) bool_or::$5==(byte) 0) goto bool_or::@2
to:bool_or::@4
bool_or::@4: scope:[bool_or] from bool_or::@5
[48] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#1) ← (byte) ' '
to:bool_or::@3
bool_and: scope:[bool_and] from main
[47] phi()
to:bool_and::@1
bool_and::@1: scope:[bool_and] from bool_and bool_and::@3
[48] (byte) bool_and::i#2 ← phi( bool_and/(byte) 0 bool_and::@3/(byte) bool_and::i#1 )
[49] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte) 1
[50] if((byte) bool_and::i#2>=(byte) $a) goto bool_and::@4
to:bool_and::@5
bool_and::@5: scope:[bool_and] from bool_and::@1
[51] if((byte~) bool_and::$1==(byte) 0) goto bool_and::@2
to:bool_and::@4
bool_and::@4: scope:[bool_and] from bool_and::@1 bool_and::@5
[52] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' '
[49] phi()
to:bool_and::@2
bool_and::@2: scope:[bool_and] from bool_and bool_and::@5
[50] (byte) bool_and::i#11 ← phi( bool_and::@5/(byte) bool_and::i#1 bool_and/(byte) 0 )
[51] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#11) ← (byte) '*'
to:bool_and::@3
bool_and::@3: scope:[bool_and] from bool_and::@2 bool_and::@4
[53] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2
[52] (byte) bool_and::i#8 ← phi( bool_and::@2/(byte) bool_and::i#11 bool_and::@4/(byte) bool_and::i#1 )
[53] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#8
[54] if((byte) bool_and::i#1!=(byte) $15) goto bool_and::@1
to:bool_and::@return
bool_and::@return: scope:[bool_and] from bool_and::@3
[55] return
to:@return
bool_and::@2: scope:[bool_and] from bool_and::@5
[56] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*'
bool_and::@1: scope:[bool_and] from bool_and::@3
[56] (byte~) bool_and::$5 ← (byte) bool_and::i#1 & (byte) 1
[57] if((byte) bool_and::i#1>=(byte) $a) goto bool_and::@4
to:bool_and::@5
bool_and::@5: scope:[bool_and] from bool_and::@1
[58] if((byte~) bool_and::$5==(byte) 0) goto bool_and::@2
to:bool_and::@4
bool_and::@4: scope:[bool_and] from bool_and::@1 bool_and::@5
[59] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#1) ← (byte) ' '
to:bool_and::@3

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
(label) @begin
(label) @end
(void()) bool_and()
(byte~) bool_and::$1 reg byte a 11.0
(byte~) bool_and::$5 reg byte a 101.0
(label) bool_and::@1
(label) bool_and::@2
(label) bool_and::@3
@ -10,8 +10,9 @@
(label) bool_and::@5
(label) bool_and::@return
(byte) bool_and::i
(byte) bool_and::i#1 reg byte x 16.5
(byte) bool_and::i#2 reg byte x 11.0
(byte) bool_and::i#1 reg byte x 117.83333333333331
(byte) bool_and::i#11 reg byte x 61.5
(byte) bool_and::i#8 reg byte x 213.0
(bool) bool_and::o1
(bool) bool_and::o2
(bool) bool_and::o3
@ -40,7 +41,7 @@
(byte*) bool_complex::screen
(const byte*) bool_complex::screen#0 screen = (byte*) 1144
(void()) bool_not()
(byte~) bool_not::$1 reg byte a 11.0
(byte~) bool_not::$6 reg byte a 101.0
(label) bool_not::@1
(label) bool_not::@2
(label) bool_not::@3
@ -48,15 +49,16 @@
(label) bool_not::@5
(label) bool_not::@return
(byte) bool_not::i
(byte) bool_not::i#1 reg byte x 16.5
(byte) bool_not::i#2 reg byte x 11.0
(byte) bool_not::i#1 reg byte x 134.66666666666666
(byte) bool_not::i#7 reg byte x 112.0
(byte) bool_not::i#8 reg byte x 213.0
(bool) bool_not::o1
(bool) bool_not::o2
(bool) bool_not::o3
(byte*) bool_not::screen
(const byte*) bool_not::screen#0 screen = (byte*) 1104
(void()) bool_or()
(byte~) bool_or::$1 reg byte a 11.0
(byte~) bool_or::$5 reg byte a 101.0
(label) bool_or::@1
(label) bool_or::@2
(label) bool_or::@3
@ -64,8 +66,9 @@
(label) bool_or::@5
(label) bool_or::@return
(byte) bool_or::i
(byte) bool_or::i#1 reg byte x 16.5
(byte) bool_or::i#2 reg byte x 11.0
(byte) bool_or::i#1 reg byte x 134.66666666666666
(byte) bool_or::i#6 reg byte x 112.0
(byte) bool_or::i#8 reg byte x 213.0
(bool) bool_or::o1
(bool) bool_or::o2
(bool) bool_or::o3
@ -78,12 +81,12 @@
(label) main::@return
reg byte x [ bool_complex::i#2 bool_complex::i#1 ]
reg byte x [ bool_not::i#2 bool_not::i#1 ]
reg byte x [ bool_or::i#2 bool_or::i#1 ]
reg byte x [ bool_and::i#2 bool_and::i#1 ]
reg byte x [ bool_not::i#8 bool_not::i#7 bool_not::i#1 ]
reg byte x [ bool_or::i#8 bool_or::i#6 bool_or::i#1 ]
reg byte x [ bool_and::i#8 bool_and::i#11 bool_and::i#1 ]
zp ZP_BOOL:2 [ bool_complex::o1#0 ]
reg byte a [ bool_complex::$1 ]
zp ZP_BOOL:3 [ bool_complex::o2#0 ]
reg byte a [ bool_not::$1 ]
reg byte a [ bool_or::$1 ]
reg byte a [ bool_and::$1 ]
reg byte a [ bool_not::$6 ]
reg byte a [ bool_or::$5 ]
reg byte a [ bool_and::$5 ]

View File

@ -31,26 +31,14 @@ main: {
lda header,x
cmp #0
bne b2
ldx #0
lda #<$400
lda #'0'
sta $400+$28
lda #<$400+$28
sta screen
lda #>$400
lda #>$400+$28
sta screen+1
b3:
lda #$28
clc
adc screen
sta screen
bcc !+
inc screen+1
!:
txa
clc
adc #'0'
ldy #0
sta (screen),y
cpx #5
bcs b4
ldx #0
b9:
lda #'+'
ldy #2
sta (screen),y
@ -83,5 +71,21 @@ main: {
cpx #9+1
bcc b3
rts
b3:
lda #$28
clc
adc screen
sta screen
bcc !+
inc screen+1
!:
txa
clc
adc #'0'
ldy #0
sta (screen),y
cpx #5
bcs b4
jmp b9
header: .text " < <= == >= >@"
}

View File

@ -21,46 +21,51 @@ main::@2: scope:[main] from main::@1 main::@2
[10] *((byte*) 1024 + (byte) main::i#2) ← *((const byte[]) main::header#0 + (byte) main::i#2)
[11] (byte) main::i#1 ← ++ (byte) main::i#2
[12] if(*((const byte[]) main::header#0 + (byte) main::i#1)!=(byte) 0) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@2 main::@8
[13] (byte) main::i1#10 ← phi( main::@8/(byte) main::i1#1 main::@2/(byte) 0 )
[13] (byte*) main::screen#4 ← phi( main::@8/(byte*) main::screen#1 main::@2/(byte*) 1024 )
[14] (byte*) main::screen#1 ← (byte*) main::screen#4 + (byte) $28
[15] (byte~) main::$3 ← (byte) '0' + (byte) main::i1#10
[16] *((byte*) main::screen#1) ← (byte~) main::$3
[17] if((byte) main::i1#10>=(byte) 5) goto main::@4
to:main::@5_1
main::@5_1: scope:[main] from main::@2
[13] *((byte*) 1024+(byte) $28) ← (byte) '0'
to:main::@9
main::@9: scope:[main] from main::@3
[18] *((byte*) main::screen#1 + (byte) 2) ← (byte) '+'
main::@9: scope:[main] from main::@3 main::@5_1
[14] (byte*) main::screen#18 ← phi( main::@3/(byte*) main::screen#1 main::@5_1/(byte*) 1024+(byte) $28 )
[14] (byte) main::i1#18 ← phi( main::@3/(byte) main::i1#1 main::@5_1/(byte) 0 )
[15] *((byte*) main::screen#18 + (byte) 2) ← (byte) '+'
to:main::@4
main::@4: scope:[main] from main::@3 main::@9
[19] if((byte) main::i1#10>=(byte) 5+(byte) 1) goto main::@5
[16] (byte*) main::screen#17 ← phi( main::@9/(byte*) main::screen#18 main::@3/(byte*) main::screen#1 )
[16] (byte) main::i1#13 ← phi( main::@9/(byte) main::i1#18 main::@3/(byte) main::i1#1 )
[17] if((byte) main::i1#13>=(byte) 5+(byte) 1) goto main::@5
to:main::@10
main::@10: scope:[main] from main::@4
[20] *((byte*) main::screen#1 + (byte) 5) ← (byte) '+'
[18] *((byte*) main::screen#17 + (byte) 5) ← (byte) '+'
to:main::@5
main::@5: scope:[main] from main::@10 main::@4
[21] if((byte) main::i1#10!=(byte) 5) goto main::@6
[19] if((byte) main::i1#13!=(byte) 5) goto main::@6
to:main::@11
main::@11: scope:[main] from main::@5
[22] *((byte*) main::screen#1 + (byte) 8) ← (byte) '+'
[20] *((byte*) main::screen#17 + (byte) 8) ← (byte) '+'
to:main::@6
main::@6: scope:[main] from main::@11 main::@5
[23] if((byte) main::i1#10<(byte) 5) goto main::@7
[21] if((byte) main::i1#13<(byte) 5) goto main::@7
to:main::@12
main::@12: scope:[main] from main::@6
[24] *((byte*) main::screen#1 + (byte) $b) ← (byte) '+'
[22] *((byte*) main::screen#17 + (byte) $b) ← (byte) '+'
to:main::@7
main::@7: scope:[main] from main::@12 main::@6
[25] if((byte) main::i1#10<(byte) 5+(byte) 1) goto main::@8
[23] if((byte) main::i1#13<(byte) 5+(byte) 1) goto main::@8
to:main::@13
main::@13: scope:[main] from main::@7
[26] *((byte*) main::screen#1 + (byte) $e) ← (byte) '+'
[24] *((byte*) main::screen#17 + (byte) $e) ← (byte) '+'
to:main::@8
main::@8: scope:[main] from main::@13 main::@7
[27] (byte) main::i1#1 ← ++ (byte) main::i1#10
[28] if((byte) main::i1#1<(byte) 9+(byte) 1) goto main::@3
[25] (byte) main::i1#1 ← ++ (byte) main::i1#13
[26] if((byte) main::i1#1<(byte) 9+(byte) 1) goto main::@3
to:main::@return
main::@return: scope:[main] from main::@8
[29] return
[27] return
to:@return
main::@3: scope:[main] from main::@8
[28] (byte*) main::screen#1 ← (byte*) main::screen#17 + (byte) $28
[29] (byte~) main::$3 ← (byte) '0' + (byte) main::i1#1
[30] *((byte*) main::screen#1) ← (byte~) main::$3
[31] if((byte) main::i1#1>=(byte) 5) goto main::@4
to:main::@9

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
(label) @begin
(label) @end
(void()) main()
(byte~) main::$3 reg byte a 22.0
(byte~) main::$3 reg byte a 202.0
(label) main::@1
(label) main::@10
(label) main::@11
@ -12,6 +12,7 @@
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@5_1
(label) main::@6
(label) main::@7
(label) main::@8
@ -23,17 +24,19 @@
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 22.0
(byte) main::i1
(byte) main::i1#1 reg byte x 16.5
(byte) main::i1#10 reg byte x 6.285714285714286
(byte) main::i1#1 reg byte x 100.99999999999999
(byte) main::i1#13 reg byte x 68.55555555555554
(byte) main::i1#18 reg byte x 56.0
(byte*) main::sc
(byte*) main::sc#1 sc zp ZP_WORD:2 16.5
(byte*) main::sc#2 sc zp ZP_WORD:2 16.5
(byte*) main::screen
(byte*) main::screen#1 screen zp ZP_WORD:4 5.866666666666666
(byte*) main::screen#4 screen zp ZP_WORD:4 22.0
(byte*) main::screen#1 screen zp ZP_WORD:4 101.0
(byte*) main::screen#17 screen zp ZP_WORD:4 56.090909090909086
(byte*) main::screen#18 screen zp ZP_WORD:4 61.5
zp ZP_WORD:2 [ main::sc#2 main::sc#1 ]
reg byte x [ main::i#2 main::i#1 ]
zp ZP_WORD:4 [ main::screen#4 main::screen#1 ]
reg byte x [ main::i1#10 main::i1#1 ]
reg byte x [ main::i1#13 main::i1#18 main::i1#1 ]
zp ZP_WORD:4 [ main::screen#17 main::screen#18 main::screen#1 ]
reg byte a [ main::$3 ]

View File

@ -878,18 +878,13 @@ play_spawn_current: {
lda #1
sta game_over
b1:
lda #7
sta piece_idx
b2:
lda #7
cmp piece_idx
beq sid_rnd1
rts
sid_rnd1:
lda SID_VOICE3_OSC
and #7
sta piece_idx
jmp b2
lda #7
cmp piece_idx
beq b1
rts
}
// Update the score based on the number of lines removed
// play_update_score(byte register(X) removed)

View File

@ -93,7 +93,7 @@ main::@15: scope:[main] from main::@14
[35] call render_moving
to:main::@16
main::@16: scope:[main] from main::@15
[36] (byte~) next_piece_idx#77 ← (byte) play_spawn_current::piece_idx#2
[36] (byte~) next_piece_idx#77 ← (byte) play_spawn_current::piece_idx#1
[37] call render_next
to:main::@17
main::@17: scope:[main] from main::@16
@ -108,7 +108,7 @@ main::@1: scope:[main] from main::@17 main::@25 main::@6
[40] (byte) current_movedown_counter#16 ← phi( main::@6/(byte) current_movedown_counter#14 main::@17/(byte) 0 main::@25/(byte) current_movedown_counter#14 )
[40] (byte) keyboard_events_size#19 ← phi( main::@6/(byte) keyboard_events_size#16 main::@17/(byte) 0 main::@25/(byte) keyboard_events_size#16 )
[40] (byte) render_screen_showing#13 ← phi( main::@6/(byte) render_screen_showing#1 main::@17/(byte) render_screen_showing#0 main::@25/(byte) render_screen_showing#1 )
[40] (byte) next_piece_idx#10 ← phi( main::@6/(byte) next_piece_idx#16 main::@17/(byte) play_spawn_current::piece_idx#2 main::@25/(byte) next_piece_idx#16 )
[40] (byte) next_piece_idx#10 ← phi( main::@6/(byte) next_piece_idx#16 main::@17/(byte) play_spawn_current::piece_idx#1 main::@25/(byte) next_piece_idx#16 )
[40] (byte) game_over#10 ← phi( main::@6/(byte) game_over#15 main::@17/(byte) game_over#52 main::@25/(byte) game_over#15 )
[40] (byte) current_ypos#11 ← phi( main::@6/(byte) current_ypos#19 main::@17/(byte) current_ypos#6 main::@25/(byte) current_ypos#19 )
[40] (byte) current_xpos#14 ← phi( main::@6/(byte) current_xpos#19 main::@17/(byte) current_xpos#100 main::@25/(byte) current_xpos#19 )
@ -603,7 +603,7 @@ play_move_down::@17: scope:[play_move_down] from play_move_down::@16
[282] (byte*~) current_piece_gfx#117 ← (byte*)*((const word[]) PIECES#0 + (byte~) play_spawn_current::$7)
to:play_move_down::@11
play_move_down::@11: scope:[play_move_down] from play_move_down::@10 play_move_down::@17
[283] (byte) next_piece_idx#30 ← phi( play_move_down::@10/(byte) next_piece_idx#10 play_move_down::@17/(byte) play_spawn_current::piece_idx#2 )
[283] (byte) next_piece_idx#30 ← phi( play_move_down::@10/(byte) next_piece_idx#10 play_move_down::@17/(byte) play_spawn_current::piece_idx#1 )
[283] (byte) game_over#27 ← phi( play_move_down::@10/(byte) game_over#10 play_move_down::@17/(byte) game_over#52 )
[283] (byte) current_xpos#43 ← phi( play_move_down::@10/(byte) current_xpos#14 play_move_down::@17/(byte) current_xpos#100 )
[283] (byte*) current_piece_gfx#35 ← phi( play_move_down::@10/(byte*) current_piece_gfx#13 play_move_down::@17/(byte*~) current_piece_gfx#117 )
@ -640,7 +640,7 @@ play_move_down::@10: scope:[play_move_down] from play_move_down::@13
to:play_move_down::@11
play_spawn_current: scope:[play_spawn_current] from main::@12 main::@13 play_move_down::@16
[287] (byte) game_over#65 ← phi( main::@12/(byte) 0 main::@13/(byte) game_over#52 play_move_down::@16/(byte) game_over#10 )
[287] (byte) next_piece_idx#17 ← phi( main::@12/(byte) 0 main::@13/(byte) play_spawn_current::piece_idx#2 play_move_down::@16/(byte) next_piece_idx#10 )
[287] (byte) next_piece_idx#17 ← phi( main::@12/(byte) 0 main::@13/(byte) play_spawn_current::piece_idx#1 play_move_down::@16/(byte) next_piece_idx#10 )
[288] (byte) play_spawn_current::current_piece_idx#0 ← (byte) next_piece_idx#17
[289] (byte~) play_spawn_current::$7 ← (byte) play_spawn_current::current_piece_idx#0 << (byte) 1
[290] (byte) current_piece_char#5 ← *((const byte[]) PIECES_CHARS#0 + (byte) play_spawn_current::current_piece_idx#0)
@ -661,563 +661,562 @@ play_spawn_current::@5: scope:[play_spawn_current] from play_spawn_current::@4
to:play_spawn_current::@1
play_spawn_current::@1: scope:[play_spawn_current] from play_spawn_current::@4 play_spawn_current::@5
[301] (byte) game_over#52 ← phi( play_spawn_current::@5/(byte) game_over#65 play_spawn_current::@4/(byte) 1 )
to:play_spawn_current::@2
play_spawn_current::@2: scope:[play_spawn_current] from play_spawn_current::@1 play_spawn_current::@3
[302] (byte) play_spawn_current::piece_idx#2 ← phi( play_spawn_current::@1/(byte) 7 play_spawn_current::@3/(byte) play_spawn_current::piece_idx#1 )
[303] if((byte) play_spawn_current::piece_idx#2==(byte) 7) goto play_spawn_current::sid_rnd1
to:play_spawn_current::@return
play_spawn_current::@return: scope:[play_spawn_current] from play_spawn_current::@2
[304] return
to:@return
play_spawn_current::sid_rnd1: scope:[play_spawn_current] from play_spawn_current::@2
[305] (byte) play_spawn_current::sid_rnd1_return#0 ← *((const byte*) SID_VOICE3_OSC#0)
to:play_spawn_current::sid_rnd1
play_spawn_current::sid_rnd1: scope:[play_spawn_current] from play_spawn_current::@1 play_spawn_current::@2
[302] (byte) play_spawn_current::sid_rnd1_return#0 ← *((const byte*) SID_VOICE3_OSC#0)
to:play_spawn_current::@3
play_spawn_current::@3: scope:[play_spawn_current] from play_spawn_current::sid_rnd1
[306] (byte) play_spawn_current::piece_idx#1 ← (byte) play_spawn_current::sid_rnd1_return#0 & (byte) 7
[303] (byte) play_spawn_current::piece_idx#1 ← (byte) play_spawn_current::sid_rnd1_return#0 & (byte) 7
to:play_spawn_current::@2
play_spawn_current::@2: scope:[play_spawn_current] from play_spawn_current::@3
[304] if((byte) play_spawn_current::piece_idx#1==(byte) 7) goto play_spawn_current::sid_rnd1
to:play_spawn_current::@return
play_spawn_current::@return: scope:[play_spawn_current] from play_spawn_current::@2
[305] return
to:@return
play_update_score: scope:[play_update_score] from play_move_down::@15
[307] if((byte) play_update_score::removed#0==(byte) 0) goto play_update_score::@return
[306] if((byte) play_update_score::removed#0==(byte) 0) goto play_update_score::@return
to:play_update_score::@1
play_update_score::@1: scope:[play_update_score] from play_update_score
[308] (byte~) play_update_score::$2 ← < (word) lines_bcd#19
[309] (byte) play_update_score::lines_before#0 ← (byte~) play_update_score::$2 & (byte) $f0
[310] (byte~) play_update_score::$9 ← (byte) play_update_score::removed#0 << (byte) 2
[311] (dword) play_update_score::add_bcd#0 ← *((const dword[5]) score_add_bcd#0 + (byte~) play_update_score::$9)
[307] (byte~) play_update_score::$2 ← < (word) lines_bcd#19
[308] (byte) play_update_score::lines_before#0 ← (byte~) play_update_score::$2 & (byte) $f0
[309] (byte~) play_update_score::$9 ← (byte) play_update_score::removed#0 << (byte) 2
[310] (dword) play_update_score::add_bcd#0 ← *((const dword[5]) score_add_bcd#0 + (byte~) play_update_score::$9)
asm { sed }
[313] (word) lines_bcd#29 ← (word) lines_bcd#19 + (byte) play_update_score::removed#0
[314] (dword) score_bcd#29 ← (dword) score_bcd#18 + (dword) play_update_score::add_bcd#0
[312] (word) lines_bcd#29 ← (word) lines_bcd#19 + (byte) play_update_score::removed#0
[313] (dword) score_bcd#29 ← (dword) score_bcd#18 + (dword) play_update_score::add_bcd#0
asm { cld }
[316] (byte~) play_update_score::$4 ← < (word) lines_bcd#29
[317] (byte) play_update_score::lines_after#0 ← (byte~) play_update_score::$4 & (byte) $f0
[318] if((byte) play_update_score::lines_before#0==(byte) play_update_score::lines_after#0) goto play_update_score::@return
[315] (byte~) play_update_score::$4 ← < (word) lines_bcd#29
[316] (byte) play_update_score::lines_after#0 ← (byte~) play_update_score::$4 & (byte) $f0
[317] if((byte) play_update_score::lines_before#0==(byte) play_update_score::lines_after#0) goto play_update_score::@return
to:play_update_score::@2
play_update_score::@2: scope:[play_update_score] from play_update_score::@1
[319] phi()
[320] call play_increase_level
[318] phi()
[319] call play_increase_level
to:play_update_score::@return
play_update_score::@return: scope:[play_update_score] from play_update_score play_update_score::@1 play_update_score::@2
[321] (byte) level_bcd#19 ← phi( play_update_score/(byte) level_bcd#11 play_update_score::@1/(byte) level_bcd#11 play_update_score::@2/(byte) level_bcd#62 )
[321] (byte) current_movedown_slow#23 ← phi( play_update_score/(byte) current_movedown_slow#14 play_update_score::@1/(byte) current_movedown_slow#14 play_update_score::@2/(byte) current_movedown_slow#66 )
[321] (byte) level#19 ← phi( play_update_score/(byte) level#10 play_update_score::@1/(byte) level#10 play_update_score::@2/(byte) level#21 )
[321] (dword) score_bcd#16 ← phi( play_update_score/(dword) score_bcd#18 play_update_score::@1/(dword) score_bcd#29 play_update_score::@2/(dword) score_bcd#29 )
[321] (word) lines_bcd#17 ← phi( play_update_score/(word) lines_bcd#19 play_update_score::@1/(word) lines_bcd#29 play_update_score::@2/(word) lines_bcd#29 )
[322] return
[320] (byte) level_bcd#19 ← phi( play_update_score/(byte) level_bcd#11 play_update_score::@1/(byte) level_bcd#11 play_update_score::@2/(byte) level_bcd#62 )
[320] (byte) current_movedown_slow#23 ← phi( play_update_score/(byte) current_movedown_slow#14 play_update_score::@1/(byte) current_movedown_slow#14 play_update_score::@2/(byte) current_movedown_slow#66 )
[320] (byte) level#19 ← phi( play_update_score/(byte) level#10 play_update_score::@1/(byte) level#10 play_update_score::@2/(byte) level#21 )
[320] (dword) score_bcd#16 ← phi( play_update_score/(dword) score_bcd#18 play_update_score::@1/(dword) score_bcd#29 play_update_score::@2/(dword) score_bcd#29 )
[320] (word) lines_bcd#17 ← phi( play_update_score/(word) lines_bcd#19 play_update_score::@1/(word) lines_bcd#29 play_update_score::@2/(word) lines_bcd#29 )
[321] return
to:@return
play_increase_level: scope:[play_increase_level] from play_update_score::@2
[323] (byte) level#21 ← ++ (byte) level#10
[324] if((byte) level#21>=(byte) $1d+(byte) 1) goto play_increase_level::@1
[322] (byte) level#21 ← ++ (byte) level#10
[323] if((byte) level#21>=(byte) $1d+(byte) 1) goto play_increase_level::@1
to:play_increase_level::@3
play_increase_level::@3: scope:[play_increase_level] from play_increase_level
[325] (byte) current_movedown_slow#10 ← *((const byte[]) MOVEDOWN_SLOW_SPEEDS#0 + (byte) level#21)
[324] (byte) current_movedown_slow#10 ← *((const byte[]) MOVEDOWN_SLOW_SPEEDS#0 + (byte) level#21)
to:play_increase_level::@1
play_increase_level::@1: scope:[play_increase_level] from play_increase_level play_increase_level::@3
[326] (byte) current_movedown_slow#66 ← phi( play_increase_level/(byte) 1 play_increase_level::@3/(byte) current_movedown_slow#10 )
[327] (byte) level_bcd#21 ← ++ (byte) level_bcd#11
[328] (byte~) play_increase_level::$1 ← (byte) level_bcd#21 & (byte) $f
[329] if((byte~) play_increase_level::$1!=(byte) $a) goto play_increase_level::@2
[325] (byte) current_movedown_slow#66 ← phi( play_increase_level/(byte) 1 play_increase_level::@3/(byte) current_movedown_slow#10 )
[326] (byte) level_bcd#21 ← ++ (byte) level_bcd#11
[327] (byte~) play_increase_level::$1 ← (byte) level_bcd#21 & (byte) $f
[328] if((byte~) play_increase_level::$1!=(byte) $a) goto play_increase_level::@2
to:play_increase_level::@4
play_increase_level::@4: scope:[play_increase_level] from play_increase_level::@1
[330] (byte) level_bcd#8 ← (byte) level_bcd#21 + (byte) 6
[329] (byte) level_bcd#8 ← (byte) level_bcd#21 + (byte) 6
to:play_increase_level::@2
play_increase_level::@2: scope:[play_increase_level] from play_increase_level::@1 play_increase_level::@4
[331] (byte) level_bcd#62 ← phi( play_increase_level::@1/(byte) level_bcd#21 play_increase_level::@4/(byte) level_bcd#8 )
[330] (byte) level_bcd#62 ← phi( play_increase_level::@1/(byte) level_bcd#21 play_increase_level::@4/(byte) level_bcd#8 )
asm { sed }
to:play_increase_level::@5
play_increase_level::@5: scope:[play_increase_level] from play_increase_level::@2 play_increase_level::@5
[333] (byte) play_increase_level::b#2 ← phi( play_increase_level::@2/(byte) 0 play_increase_level::@5/(byte) play_increase_level::b#1 )
[334] (byte~) play_increase_level::$5 ← (byte) play_increase_level::b#2 << (byte) 2
[335] *((const dword[5]) score_add_bcd#0 + (byte~) play_increase_level::$5) ← *((const dword[5]) score_add_bcd#0 + (byte~) play_increase_level::$5) + *((const dword[]) SCORE_BASE_BCD#0 + (byte~) play_increase_level::$5)
[336] (byte) play_increase_level::b#1 ← ++ (byte) play_increase_level::b#2
[337] if((byte) play_increase_level::b#1!=(byte) 5) goto play_increase_level::@5
[332] (byte) play_increase_level::b#2 ← phi( play_increase_level::@2/(byte) 0 play_increase_level::@5/(byte) play_increase_level::b#1 )
[333] (byte~) play_increase_level::$5 ← (byte) play_increase_level::b#2 << (byte) 2
[334] *((const dword[5]) score_add_bcd#0 + (byte~) play_increase_level::$5) ← *((const dword[5]) score_add_bcd#0 + (byte~) play_increase_level::$5) + *((const dword[]) SCORE_BASE_BCD#0 + (byte~) play_increase_level::$5)
[335] (byte) play_increase_level::b#1 ← ++ (byte) play_increase_level::b#2
[336] if((byte) play_increase_level::b#1!=(byte) 5) goto play_increase_level::@5
to:play_increase_level::@6
play_increase_level::@6: scope:[play_increase_level] from play_increase_level::@5
asm { cld }
to:play_increase_level::@return
play_increase_level::@return: scope:[play_increase_level] from play_increase_level::@6
[339] return
[338] return
to:@return
play_remove_lines: scope:[play_remove_lines] from play_move_down::@14
[340] phi()
[339] phi()
to:play_remove_lines::@1
play_remove_lines::@1: scope:[play_remove_lines] from play_remove_lines play_remove_lines::@6
[341] (byte) play_remove_lines::removed#11 ← phi( play_remove_lines/(byte) 0 play_remove_lines::@6/(byte) play_remove_lines::removed#8 )
[341] (byte) play_remove_lines::y#8 ← phi( play_remove_lines/(byte) 0 play_remove_lines::@6/(byte) play_remove_lines::y#1 )
[341] (byte) play_remove_lines::w#12 ← phi( play_remove_lines/(const byte) PLAYFIELD_LINES#0*(const byte) PLAYFIELD_COLS#0-(byte) 1 play_remove_lines::@6/(byte) play_remove_lines::w#11 )
[341] (byte) play_remove_lines::r#3 ← phi( play_remove_lines/(const byte) PLAYFIELD_LINES#0*(const byte) PLAYFIELD_COLS#0-(byte) 1 play_remove_lines::@6/(byte) play_remove_lines::r#1 )
[340] (byte) play_remove_lines::removed#11 ← phi( play_remove_lines/(byte) 0 play_remove_lines::@6/(byte) play_remove_lines::removed#8 )
[340] (byte) play_remove_lines::y#8 ← phi( play_remove_lines/(byte) 0 play_remove_lines::@6/(byte) play_remove_lines::y#1 )
[340] (byte) play_remove_lines::w#12 ← phi( play_remove_lines/(const byte) PLAYFIELD_LINES#0*(const byte) PLAYFIELD_COLS#0-(byte) 1 play_remove_lines::@6/(byte) play_remove_lines::w#11 )
[340] (byte) play_remove_lines::r#3 ← phi( play_remove_lines/(const byte) PLAYFIELD_LINES#0*(const byte) PLAYFIELD_COLS#0-(byte) 1 play_remove_lines::@6/(byte) play_remove_lines::r#1 )
to:play_remove_lines::@2
play_remove_lines::@2: scope:[play_remove_lines] from play_remove_lines::@1 play_remove_lines::@3
[342] (byte) play_remove_lines::full#4 ← phi( play_remove_lines::@1/(byte) 1 play_remove_lines::@3/(byte) play_remove_lines::full#2 )
[342] (byte) play_remove_lines::x#2 ← phi( play_remove_lines::@1/(byte) 0 play_remove_lines::@3/(byte) play_remove_lines::x#1 )
[342] (byte) play_remove_lines::w#4 ← phi( play_remove_lines::@1/(byte) play_remove_lines::w#12 play_remove_lines::@3/(byte) play_remove_lines::w#1 )
[342] (byte) play_remove_lines::r#2 ← phi( play_remove_lines::@1/(byte) play_remove_lines::r#3 play_remove_lines::@3/(byte) play_remove_lines::r#1 )
[343] (byte) play_remove_lines::c#0 ← *((const byte[PLAYFIELD_LINES#0*PLAYFIELD_COLS#0]) playfield#0 + (byte) play_remove_lines::r#2)
[344] (byte) play_remove_lines::r#1 ← -- (byte) play_remove_lines::r#2
[345] if((byte) play_remove_lines::c#0!=(byte) 0) goto play_remove_lines::@9
[341] (byte) play_remove_lines::full#4 ← phi( play_remove_lines::@1/(byte) 1 play_remove_lines::@3/(byte) play_remove_lines::full#2 )
[341] (byte) play_remove_lines::x#2 ← phi( play_remove_lines::@1/(byte) 0 play_remove_lines::@3/(byte) play_remove_lines::x#1 )
[341] (byte) play_remove_lines::w#4 ← phi( play_remove_lines::@1/(byte) play_remove_lines::w#12 play_remove_lines::@3/(byte) play_remove_lines::w#1 )
[341] (byte) play_remove_lines::r#2 ← phi( play_remove_lines::@1/(byte) play_remove_lines::r#3 play_remove_lines::@3/(byte) play_remove_lines::r#1 )
[342] (byte) play_remove_lines::c#0 ← *((const byte[PLAYFIELD_LINES#0*PLAYFIELD_COLS#0]) playfield#0 + (byte) play_remove_lines::r#2)
[343] (byte) play_remove_lines::r#1 ← -- (byte) play_remove_lines::r#2
[344] if((byte) play_remove_lines::c#0!=(byte) 0) goto play_remove_lines::@9
to:play_remove_lines::@3
play_remove_lines::@9: scope:[play_remove_lines] from play_remove_lines::@2
[346] phi()
[345] phi()
to:play_remove_lines::@3
play_remove_lines::@3: scope:[play_remove_lines] from play_remove_lines::@2 play_remove_lines::@9
[347] (byte) play_remove_lines::full#2 ← phi( play_remove_lines::@9/(byte) play_remove_lines::full#4 play_remove_lines::@2/(byte) 0 )
[348] *((const byte[PLAYFIELD_LINES#0*PLAYFIELD_COLS#0]) playfield#0 + (byte) play_remove_lines::w#4) ← (byte) play_remove_lines::c#0
[349] (byte) play_remove_lines::w#1 ← -- (byte) play_remove_lines::w#4
[350] (byte) play_remove_lines::x#1 ← ++ (byte) play_remove_lines::x#2
[351] if((byte) play_remove_lines::x#1!=(const byte) PLAYFIELD_COLS#0-(byte) 1+(byte) 1) goto play_remove_lines::@2
[346] (byte) play_remove_lines::full#2 ← phi( play_remove_lines::@9/(byte) play_remove_lines::full#4 play_remove_lines::@2/(byte) 0 )
[347] *((const byte[PLAYFIELD_LINES#0*PLAYFIELD_COLS#0]) playfield#0 + (byte) play_remove_lines::w#4) ← (byte) play_remove_lines::c#0
[348] (byte) play_remove_lines::w#1 ← -- (byte) play_remove_lines::w#4
[349] (byte) play_remove_lines::x#1 ← ++ (byte) play_remove_lines::x#2
[350] if((byte) play_remove_lines::x#1!=(const byte) PLAYFIELD_COLS#0-(byte) 1+(byte) 1) goto play_remove_lines::@2
to:play_remove_lines::@4
play_remove_lines::@4: scope:[play_remove_lines] from play_remove_lines::@3
[352] if((byte) play_remove_lines::full#2!=(byte) 1) goto play_remove_lines::@6
[351] if((byte) play_remove_lines::full#2!=(byte) 1) goto play_remove_lines::@6
to:play_remove_lines::@5
play_remove_lines::@5: scope:[play_remove_lines] from play_remove_lines::@4
[353] (byte) play_remove_lines::w#2 ← (byte) play_remove_lines::w#1 + (const byte) PLAYFIELD_COLS#0
[354] (byte) play_remove_lines::removed#1 ← ++ (byte) play_remove_lines::removed#11
[352] (byte) play_remove_lines::w#2 ← (byte) play_remove_lines::w#1 + (const byte) PLAYFIELD_COLS#0
[353] (byte) play_remove_lines::removed#1 ← ++ (byte) play_remove_lines::removed#11
to:play_remove_lines::@6
play_remove_lines::@6: scope:[play_remove_lines] from play_remove_lines::@4 play_remove_lines::@5
[355] (byte) play_remove_lines::removed#8 ← phi( play_remove_lines::@4/(byte) play_remove_lines::removed#11 play_remove_lines::@5/(byte) play_remove_lines::removed#1 )
[355] (byte) play_remove_lines::w#11 ← phi( play_remove_lines::@4/(byte) play_remove_lines::w#1 play_remove_lines::@5/(byte) play_remove_lines::w#2 )
[356] (byte) play_remove_lines::y#1 ← ++ (byte) play_remove_lines::y#8
[357] if((byte) play_remove_lines::y#1!=(const byte) PLAYFIELD_LINES#0-(byte) 1+(byte) 1) goto play_remove_lines::@1
[354] (byte) play_remove_lines::removed#8 ← phi( play_remove_lines::@4/(byte) play_remove_lines::removed#11 play_remove_lines::@5/(byte) play_remove_lines::removed#1 )
[354] (byte) play_remove_lines::w#11 ← phi( play_remove_lines::@4/(byte) play_remove_lines::w#1 play_remove_lines::@5/(byte) play_remove_lines::w#2 )
[355] (byte) play_remove_lines::y#1 ← ++ (byte) play_remove_lines::y#8
[356] if((byte) play_remove_lines::y#1!=(const byte) PLAYFIELD_LINES#0-(byte) 1+(byte) 1) goto play_remove_lines::@1
to:play_remove_lines::@7
play_remove_lines::@7: scope:[play_remove_lines] from play_remove_lines::@6 play_remove_lines::@8
[358] (byte) play_remove_lines::w#6 ← phi( play_remove_lines::@8/(byte) play_remove_lines::w#3 play_remove_lines::@6/(byte) play_remove_lines::w#11 )
[359] if((byte) play_remove_lines::w#6!=(byte) $ff) goto play_remove_lines::@8
[357] (byte) play_remove_lines::w#6 ← phi( play_remove_lines::@8/(byte) play_remove_lines::w#3 play_remove_lines::@6/(byte) play_remove_lines::w#11 )
[358] if((byte) play_remove_lines::w#6!=(byte) $ff) goto play_remove_lines::@8
to:play_remove_lines::@return
play_remove_lines::@return: scope:[play_remove_lines] from play_remove_lines::@7
[360] return
[359] return
to:@return
play_remove_lines::@8: scope:[play_remove_lines] from play_remove_lines::@7
[361] *((const byte[PLAYFIELD_LINES#0*PLAYFIELD_COLS#0]) playfield#0 + (byte) play_remove_lines::w#6) ← (byte) 0
[362] (byte) play_remove_lines::w#3 ← -- (byte) play_remove_lines::w#6
[360] *((const byte[PLAYFIELD_LINES#0*PLAYFIELD_COLS#0]) playfield#0 + (byte) play_remove_lines::w#6) ← (byte) 0
[361] (byte) play_remove_lines::w#3 ← -- (byte) play_remove_lines::w#6
to:play_remove_lines::@7
play_lock_current: scope:[play_lock_current] from play_move_down::@9
[363] (byte) play_lock_current::yp#0 ← (byte) current_ypos#11
[362] (byte) play_lock_current::yp#0 ← (byte) current_ypos#11
to:play_lock_current::@1
play_lock_current::@1: scope:[play_lock_current] from play_lock_current play_lock_current::@6
[364] (byte) play_lock_current::l#6 ← phi( play_lock_current/(byte) 0 play_lock_current::@6/(byte) play_lock_current::l#1 )
[364] (byte) play_lock_current::i#3 ← phi( play_lock_current/(byte) 0 play_lock_current::@6/(byte~) play_lock_current::i#7 )
[364] (byte) play_lock_current::yp#2 ← phi( play_lock_current/(byte) play_lock_current::yp#0 play_lock_current::@6/(byte) play_lock_current::yp#1 )
[365] (byte~) play_lock_current::$4 ← (byte) play_lock_current::yp#2 << (byte) 1
[366] (byte*) play_lock_current::playfield_line#0 ← *((const byte*[PLAYFIELD_LINES#0]) playfield_lines#0 + (byte~) play_lock_current::$4)
[367] (byte) play_lock_current::xp#0 ← (byte) current_xpos#14
[363] (byte) play_lock_current::l#6 ← phi( play_lock_current/(byte) 0 play_lock_current::@6/(byte) play_lock_current::l#1 )
[363] (byte) play_lock_current::i#3 ← phi( play_lock_current/(byte) 0 play_lock_current::@6/(byte~) play_lock_current::i#7 )
[363] (byte) play_lock_current::yp#2 ← phi( play_lock_current/(byte) play_lock_current::yp#0 play_lock_current::@6/(byte) play_lock_current::yp#1 )
[364] (byte~) play_lock_current::$4 ← (byte) play_lock_current::yp#2 << (byte) 1
[365] (byte*) play_lock_current::playfield_line#0 ← *((const byte*[PLAYFIELD_LINES#0]) playfield_lines#0 + (byte~) play_lock_current::$4)
[366] (byte) play_lock_current::xp#0 ← (byte) current_xpos#14
to:play_lock_current::@2
play_lock_current::@2: scope:[play_lock_current] from play_lock_current::@1 play_lock_current::@7
[368] (byte) play_lock_current::c#2 ← phi( play_lock_current::@1/(byte) 0 play_lock_current::@7/(byte) play_lock_current::c#1 )
[368] (byte) play_lock_current::xp#2 ← phi( play_lock_current::@1/(byte) play_lock_current::xp#0 play_lock_current::@7/(byte) play_lock_current::xp#1 )
[368] (byte) play_lock_current::i#2 ← phi( play_lock_current::@1/(byte) play_lock_current::i#3 play_lock_current::@7/(byte~) play_lock_current::i#9 )
[369] (byte) play_lock_current::i#1 ← ++ (byte) play_lock_current::i#2
[370] if(*((byte*) current_piece_gfx#13 + (byte) play_lock_current::i#2)==(byte) 0) goto play_lock_current::@3
[367] (byte) play_lock_current::c#2 ← phi( play_lock_current::@1/(byte) 0 play_lock_current::@7/(byte) play_lock_current::c#1 )
[367] (byte) play_lock_current::xp#2 ← phi( play_lock_current::@1/(byte) play_lock_current::xp#0 play_lock_current::@7/(byte) play_lock_current::xp#1 )
[367] (byte) play_lock_current::i#2 ← phi( play_lock_current::@1/(byte) play_lock_current::i#3 play_lock_current::@7/(byte~) play_lock_current::i#9 )
[368] (byte) play_lock_current::i#1 ← ++ (byte) play_lock_current::i#2
[369] if(*((byte*) current_piece_gfx#13 + (byte) play_lock_current::i#2)==(byte) 0) goto play_lock_current::@3
to:play_lock_current::@4
play_lock_current::@4: scope:[play_lock_current] from play_lock_current::@2
[371] *((byte*) play_lock_current::playfield_line#0 + (byte) play_lock_current::xp#2) ← (byte) current_piece_char#10
[370] *((byte*) play_lock_current::playfield_line#0 + (byte) play_lock_current::xp#2) ← (byte) current_piece_char#10
to:play_lock_current::@3
play_lock_current::@3: scope:[play_lock_current] from play_lock_current::@2 play_lock_current::@4
[372] (byte) play_lock_current::xp#1 ← ++ (byte) play_lock_current::xp#2
[373] (byte) play_lock_current::c#1 ← ++ (byte) play_lock_current::c#2
[374] if((byte) play_lock_current::c#1!=(byte) 4) goto play_lock_current::@7
[371] (byte) play_lock_current::xp#1 ← ++ (byte) play_lock_current::xp#2
[372] (byte) play_lock_current::c#1 ← ++ (byte) play_lock_current::c#2
[373] if((byte) play_lock_current::c#1!=(byte) 4) goto play_lock_current::@7
to:play_lock_current::@5
play_lock_current::@5: scope:[play_lock_current] from play_lock_current::@3
[375] (byte) play_lock_current::yp#1 ← ++ (byte) play_lock_current::yp#2
[376] (byte) play_lock_current::l#1 ← ++ (byte) play_lock_current::l#6
[377] if((byte) play_lock_current::l#1!=(byte) 4) goto play_lock_current::@6
[374] (byte) play_lock_current::yp#1 ← ++ (byte) play_lock_current::yp#2
[375] (byte) play_lock_current::l#1 ← ++ (byte) play_lock_current::l#6
[376] if((byte) play_lock_current::l#1!=(byte) 4) goto play_lock_current::@6
to:play_lock_current::@return
play_lock_current::@return: scope:[play_lock_current] from play_lock_current::@5
[378] return
[377] return
to:@return
play_lock_current::@6: scope:[play_lock_current] from play_lock_current::@5
[379] (byte~) play_lock_current::i#7 ← (byte) play_lock_current::i#1
[378] (byte~) play_lock_current::i#7 ← (byte) play_lock_current::i#1
to:play_lock_current::@1
play_lock_current::@7: scope:[play_lock_current] from play_lock_current::@3
[380] (byte~) play_lock_current::i#9 ← (byte) play_lock_current::i#1
[379] (byte~) play_lock_current::i#9 ← (byte) play_lock_current::i#1
to:play_lock_current::@2
keyboard_event_pressed: scope:[keyboard_event_pressed] from keyboard_event_scan::@1 keyboard_event_scan::@17 keyboard_event_scan::@2 keyboard_event_scan::@3 play_move_down::@1
[381] (byte) keyboard_event_pressed::keycode#5 ← phi( keyboard_event_scan::@1/(const byte) KEY_RSHIFT#0 keyboard_event_scan::@2/(const byte) KEY_CTRL#0 keyboard_event_scan::@17/(const byte) KEY_LSHIFT#0 keyboard_event_scan::@3/(const byte) KEY_COMMODORE#0 play_move_down::@1/(const byte) KEY_SPACE#0 )
[382] (byte~) keyboard_event_pressed::$0 ← (byte) keyboard_event_pressed::keycode#5 >> (byte) 3
[383] (byte) keyboard_event_pressed::row_bits#0 ← *((const byte[8]) keyboard_scan_values#0 + (byte~) keyboard_event_pressed::$0)
[384] (byte~) keyboard_event_pressed::$1 ← (byte) keyboard_event_pressed::keycode#5 & (byte) 7
[385] (byte) keyboard_event_pressed::return#11 ← (byte) keyboard_event_pressed::row_bits#0 & *((const byte[8]) keyboard_matrix_col_bitmask#0 + (byte~) keyboard_event_pressed::$1)
[380] (byte) keyboard_event_pressed::keycode#5 ← phi( keyboard_event_scan::@1/(const byte) KEY_RSHIFT#0 keyboard_event_scan::@2/(const byte) KEY_CTRL#0 keyboard_event_scan::@17/(const byte) KEY_LSHIFT#0 keyboard_event_scan::@3/(const byte) KEY_COMMODORE#0 play_move_down::@1/(const byte) KEY_SPACE#0 )
[381] (byte~) keyboard_event_pressed::$0 ← (byte) keyboard_event_pressed::keycode#5 >> (byte) 3
[382] (byte) keyboard_event_pressed::row_bits#0 ← *((const byte[8]) keyboard_scan_values#0 + (byte~) keyboard_event_pressed::$0)
[383] (byte~) keyboard_event_pressed::$1 ← (byte) keyboard_event_pressed::keycode#5 & (byte) 7
[384] (byte) keyboard_event_pressed::return#11 ← (byte) keyboard_event_pressed::row_bits#0 & *((const byte[8]) keyboard_matrix_col_bitmask#0 + (byte~) keyboard_event_pressed::$1)
to:keyboard_event_pressed::@return
keyboard_event_pressed::@return: scope:[keyboard_event_pressed] from keyboard_event_pressed
[386] return
[385] return
to:@return
keyboard_event_get: scope:[keyboard_event_get] from main::@19
[387] if((byte) keyboard_events_size#13==(byte) 0) goto keyboard_event_get::@return
[386] if((byte) keyboard_events_size#13==(byte) 0) goto keyboard_event_get::@return
to:keyboard_event_get::@1
keyboard_event_get::@1: scope:[keyboard_event_get] from keyboard_event_get
[388] (byte) keyboard_events_size#4 ← -- (byte) keyboard_events_size#13
[389] (byte) keyboard_event_get::return#1 ← *((const byte[8]) keyboard_events#0 + (byte) keyboard_events_size#4)
[387] (byte) keyboard_events_size#4 ← -- (byte) keyboard_events_size#13
[388] (byte) keyboard_event_get::return#1 ← *((const byte[8]) keyboard_events#0 + (byte) keyboard_events_size#4)
to:keyboard_event_get::@return
keyboard_event_get::@return: scope:[keyboard_event_get] from keyboard_event_get keyboard_event_get::@1
[390] (byte) keyboard_events_size#16 ← phi( keyboard_event_get/(byte) keyboard_events_size#13 keyboard_event_get::@1/(byte) keyboard_events_size#4 )
[390] (byte) keyboard_event_get::return#2 ← phi( keyboard_event_get/(byte) $ff keyboard_event_get::@1/(byte) keyboard_event_get::return#1 )
[391] return
[389] (byte) keyboard_events_size#16 ← phi( keyboard_event_get/(byte) keyboard_events_size#13 keyboard_event_get::@1/(byte) keyboard_events_size#4 )
[389] (byte) keyboard_event_get::return#2 ← phi( keyboard_event_get/(byte) $ff keyboard_event_get::@1/(byte) keyboard_event_get::return#1 )
[390] return
to:@return
keyboard_event_scan: scope:[keyboard_event_scan] from main::@18
[392] phi()
[391] phi()
to:keyboard_event_scan::@7
keyboard_event_scan::@7: scope:[keyboard_event_scan] from keyboard_event_scan keyboard_event_scan::@8
[393] (byte) keyboard_events_size#30 ← phi( keyboard_event_scan/(byte) keyboard_events_size#19 keyboard_event_scan::@8/(byte) keyboard_events_size#13 )
[393] (byte) keyboard_event_scan::keycode#11 ← phi( keyboard_event_scan/(byte) 0 keyboard_event_scan::@8/(byte) keyboard_event_scan::keycode#13 )
[393] (byte) keyboard_event_scan::row#2 ← phi( keyboard_event_scan/(byte) 0 keyboard_event_scan::@8/(byte) keyboard_event_scan::row#1 )
[394] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_event_scan::row#2
[395] call keyboard_matrix_read
[396] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0
[392] (byte) keyboard_events_size#30 ← phi( keyboard_event_scan/(byte) keyboard_events_size#19 keyboard_event_scan::@8/(byte) keyboard_events_size#13 )
[392] (byte) keyboard_event_scan::keycode#11 ← phi( keyboard_event_scan/(byte) 0 keyboard_event_scan::@8/(byte) keyboard_event_scan::keycode#13 )
[392] (byte) keyboard_event_scan::row#2 ← phi( keyboard_event_scan/(byte) 0 keyboard_event_scan::@8/(byte) keyboard_event_scan::row#1 )
[393] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_event_scan::row#2
[394] call keyboard_matrix_read
[395] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0
to:keyboard_event_scan::@19
keyboard_event_scan::@19: scope:[keyboard_event_scan] from keyboard_event_scan::@7
[397] (byte) keyboard_event_scan::row_scan#0 ← (byte) keyboard_matrix_read::return#2
[398] if((byte) keyboard_event_scan::row_scan#0!=*((const byte[8]) keyboard_scan_values#0 + (byte) keyboard_event_scan::row#2)) goto keyboard_event_scan::@9
[396] (byte) keyboard_event_scan::row_scan#0 ← (byte) keyboard_matrix_read::return#2
[397] if((byte) keyboard_event_scan::row_scan#0!=*((const byte[8]) keyboard_scan_values#0 + (byte) keyboard_event_scan::row#2)) goto keyboard_event_scan::@9
to:keyboard_event_scan::@16
keyboard_event_scan::@16: scope:[keyboard_event_scan] from keyboard_event_scan::@19
[399] (byte) keyboard_event_scan::keycode#1 ← (byte) keyboard_event_scan::keycode#11 + (byte) 8
[398] (byte) keyboard_event_scan::keycode#1 ← (byte) keyboard_event_scan::keycode#11 + (byte) 8
to:keyboard_event_scan::@8
keyboard_event_scan::@8: scope:[keyboard_event_scan] from keyboard_event_scan::@15 keyboard_event_scan::@16
[400] (byte) keyboard_events_size#13 ← phi( keyboard_event_scan::@15/(byte) keyboard_events_size#29 keyboard_event_scan::@16/(byte) keyboard_events_size#30 )
[400] (byte) keyboard_event_scan::keycode#13 ← phi( keyboard_event_scan::@15/(byte) keyboard_event_scan::keycode#14 keyboard_event_scan::@16/(byte) keyboard_event_scan::keycode#1 )
[401] (byte) keyboard_event_scan::row#1 ← ++ (byte) keyboard_event_scan::row#2
[402] if((byte) keyboard_event_scan::row#1!=(byte) 8) goto keyboard_event_scan::@7
[399] (byte) keyboard_events_size#13 ← phi( keyboard_event_scan::@15/(byte) keyboard_events_size#29 keyboard_event_scan::@16/(byte) keyboard_events_size#30 )
[399] (byte) keyboard_event_scan::keycode#13 ← phi( keyboard_event_scan::@15/(byte) keyboard_event_scan::keycode#14 keyboard_event_scan::@16/(byte) keyboard_event_scan::keycode#1 )
[400] (byte) keyboard_event_scan::row#1 ← ++ (byte) keyboard_event_scan::row#2
[401] if((byte) keyboard_event_scan::row#1!=(byte) 8) goto keyboard_event_scan::@7
to:keyboard_event_scan::@17
keyboard_event_scan::@17: scope:[keyboard_event_scan] from keyboard_event_scan::@8
[403] phi()
[404] call keyboard_event_pressed
[405] (byte) keyboard_event_pressed::return#0 ← (byte) keyboard_event_pressed::return#11
[402] phi()
[403] call keyboard_event_pressed
[404] (byte) keyboard_event_pressed::return#0 ← (byte) keyboard_event_pressed::return#11
to:keyboard_event_scan::@20
keyboard_event_scan::@20: scope:[keyboard_event_scan] from keyboard_event_scan::@17
[406] (byte~) keyboard_event_scan::$0 ← (byte) keyboard_event_pressed::return#0
[407] if((byte~) keyboard_event_scan::$0==(byte) 0) goto keyboard_event_scan::@1
[405] (byte~) keyboard_event_scan::$0 ← (byte) keyboard_event_pressed::return#0
[406] if((byte~) keyboard_event_scan::$0==(byte) 0) goto keyboard_event_scan::@1
to:keyboard_event_scan::@18
keyboard_event_scan::@18: scope:[keyboard_event_scan] from keyboard_event_scan::@20
[408] phi()
[407] phi()
to:keyboard_event_scan::@1
keyboard_event_scan::@1: scope:[keyboard_event_scan] from keyboard_event_scan::@18 keyboard_event_scan::@20
[409] phi()
[410] call keyboard_event_pressed
[411] (byte) keyboard_event_pressed::return#1 ← (byte) keyboard_event_pressed::return#11
[408] phi()
[409] call keyboard_event_pressed
[410] (byte) keyboard_event_pressed::return#1 ← (byte) keyboard_event_pressed::return#11
to:keyboard_event_scan::@21
keyboard_event_scan::@21: scope:[keyboard_event_scan] from keyboard_event_scan::@1
[412] (byte~) keyboard_event_scan::$3 ← (byte) keyboard_event_pressed::return#1
[413] if((byte~) keyboard_event_scan::$3==(byte) 0) goto keyboard_event_scan::@2
[411] (byte~) keyboard_event_scan::$3 ← (byte) keyboard_event_pressed::return#1
[412] if((byte~) keyboard_event_scan::$3==(byte) 0) goto keyboard_event_scan::@2
to:keyboard_event_scan::@4
keyboard_event_scan::@4: scope:[keyboard_event_scan] from keyboard_event_scan::@21
[414] phi()
[413] phi()
to:keyboard_event_scan::@2
keyboard_event_scan::@2: scope:[keyboard_event_scan] from keyboard_event_scan::@21 keyboard_event_scan::@4
[415] phi()
[416] call keyboard_event_pressed
[417] (byte) keyboard_event_pressed::return#2 ← (byte) keyboard_event_pressed::return#11
[414] phi()
[415] call keyboard_event_pressed
[416] (byte) keyboard_event_pressed::return#2 ← (byte) keyboard_event_pressed::return#11
to:keyboard_event_scan::@22
keyboard_event_scan::@22: scope:[keyboard_event_scan] from keyboard_event_scan::@2
[418] (byte~) keyboard_event_scan::$6 ← (byte) keyboard_event_pressed::return#2
[419] if((byte~) keyboard_event_scan::$6==(byte) 0) goto keyboard_event_scan::@3
[417] (byte~) keyboard_event_scan::$6 ← (byte) keyboard_event_pressed::return#2
[418] if((byte~) keyboard_event_scan::$6==(byte) 0) goto keyboard_event_scan::@3
to:keyboard_event_scan::@5
keyboard_event_scan::@5: scope:[keyboard_event_scan] from keyboard_event_scan::@22
[420] phi()
[419] phi()
to:keyboard_event_scan::@3
keyboard_event_scan::@3: scope:[keyboard_event_scan] from keyboard_event_scan::@22 keyboard_event_scan::@5
[421] phi()
[422] call keyboard_event_pressed
[423] (byte) keyboard_event_pressed::return#10 ← (byte) keyboard_event_pressed::return#11
[420] phi()
[421] call keyboard_event_pressed
[422] (byte) keyboard_event_pressed::return#10 ← (byte) keyboard_event_pressed::return#11
to:keyboard_event_scan::@23
keyboard_event_scan::@23: scope:[keyboard_event_scan] from keyboard_event_scan::@3
[424] (byte~) keyboard_event_scan::$9 ← (byte) keyboard_event_pressed::return#10
[425] if((byte~) keyboard_event_scan::$9==(byte) 0) goto keyboard_event_scan::@return
[423] (byte~) keyboard_event_scan::$9 ← (byte) keyboard_event_pressed::return#10
[424] if((byte~) keyboard_event_scan::$9==(byte) 0) goto keyboard_event_scan::@return
to:keyboard_event_scan::@6
keyboard_event_scan::@6: scope:[keyboard_event_scan] from keyboard_event_scan::@23
[426] phi()
[425] phi()
to:keyboard_event_scan::@return
keyboard_event_scan::@return: scope:[keyboard_event_scan] from keyboard_event_scan::@23 keyboard_event_scan::@6
[427] return
[426] return
to:@return
keyboard_event_scan::@9: scope:[keyboard_event_scan] from keyboard_event_scan::@10 keyboard_event_scan::@19
[428] (byte) keyboard_events_size#10 ← phi( keyboard_event_scan::@10/(byte) keyboard_events_size#29 keyboard_event_scan::@19/(byte) keyboard_events_size#30 )
[428] (byte) keyboard_event_scan::keycode#10 ← phi( keyboard_event_scan::@10/(byte) keyboard_event_scan::keycode#14 keyboard_event_scan::@19/(byte) keyboard_event_scan::keycode#11 )
[428] (byte) keyboard_event_scan::col#2 ← phi( keyboard_event_scan::@10/(byte) keyboard_event_scan::col#1 keyboard_event_scan::@19/(byte) 0 )
[429] (byte~) keyboard_event_scan::$15 ← (byte) keyboard_event_scan::row_scan#0 ^ *((const byte[8]) keyboard_scan_values#0 + (byte) keyboard_event_scan::row#2)
[430] (byte~) keyboard_event_scan::$16 ← (byte~) keyboard_event_scan::$15 & *((const byte[8]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_event_scan::col#2)
[431] if((byte~) keyboard_event_scan::$16==(byte) 0) goto keyboard_event_scan::@10
[427] (byte) keyboard_events_size#10 ← phi( keyboard_event_scan::@10/(byte) keyboard_events_size#29 keyboard_event_scan::@19/(byte) keyboard_events_size#30 )
[427] (byte) keyboard_event_scan::keycode#10 ← phi( keyboard_event_scan::@10/(byte) keyboard_event_scan::keycode#14 keyboard_event_scan::@19/(byte) keyboard_event_scan::keycode#11 )
[427] (byte) keyboard_event_scan::col#2 ← phi( keyboard_event_scan::@10/(byte) keyboard_event_scan::col#1 keyboard_event_scan::@19/(byte) 0 )
[428] (byte~) keyboard_event_scan::$15 ← (byte) keyboard_event_scan::row_scan#0 ^ *((const byte[8]) keyboard_scan_values#0 + (byte) keyboard_event_scan::row#2)
[429] (byte~) keyboard_event_scan::$16 ← (byte~) keyboard_event_scan::$15 & *((const byte[8]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_event_scan::col#2)
[430] if((byte~) keyboard_event_scan::$16==(byte) 0) goto keyboard_event_scan::@10
to:keyboard_event_scan::@12
keyboard_event_scan::@12: scope:[keyboard_event_scan] from keyboard_event_scan::@9
[432] if((byte) keyboard_events_size#10==(byte) 8) goto keyboard_event_scan::@10
[431] if((byte) keyboard_events_size#10==(byte) 8) goto keyboard_event_scan::@10
to:keyboard_event_scan::@13
keyboard_event_scan::@13: scope:[keyboard_event_scan] from keyboard_event_scan::@12
[433] (byte) keyboard_event_scan::event_type#0 ← (byte) keyboard_event_scan::row_scan#0 & *((const byte[8]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_event_scan::col#2)
[434] if((byte) keyboard_event_scan::event_type#0==(byte) 0) goto keyboard_event_scan::@11
[432] (byte) keyboard_event_scan::event_type#0 ← (byte) keyboard_event_scan::row_scan#0 & *((const byte[8]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_event_scan::col#2)
[433] if((byte) keyboard_event_scan::event_type#0==(byte) 0) goto keyboard_event_scan::@11
to:keyboard_event_scan::@14
keyboard_event_scan::@14: scope:[keyboard_event_scan] from keyboard_event_scan::@13
[435] *((const byte[8]) keyboard_events#0 + (byte) keyboard_events_size#10) ← (byte) keyboard_event_scan::keycode#10
[436] (byte) keyboard_events_size#2 ← ++ (byte) keyboard_events_size#10
[434] *((const byte[8]) keyboard_events#0 + (byte) keyboard_events_size#10) ← (byte) keyboard_event_scan::keycode#10
[435] (byte) keyboard_events_size#2 ← ++ (byte) keyboard_events_size#10
to:keyboard_event_scan::@10
keyboard_event_scan::@10: scope:[keyboard_event_scan] from keyboard_event_scan::@11 keyboard_event_scan::@12 keyboard_event_scan::@14 keyboard_event_scan::@9
[437] (byte) keyboard_events_size#29 ← phi( keyboard_event_scan::@9/(byte) keyboard_events_size#10 keyboard_event_scan::@11/(byte) keyboard_events_size#1 keyboard_event_scan::@12/(byte) keyboard_events_size#10 keyboard_event_scan::@14/(byte) keyboard_events_size#2 )
[438] (byte) keyboard_event_scan::keycode#14 ← ++ (byte) keyboard_event_scan::keycode#10
[439] (byte) keyboard_event_scan::col#1 ← ++ (byte) keyboard_event_scan::col#2
[440] if((byte) keyboard_event_scan::col#1!=(byte) 8) goto keyboard_event_scan::@9
[436] (byte) keyboard_events_size#29 ← phi( keyboard_event_scan::@9/(byte) keyboard_events_size#10 keyboard_event_scan::@11/(byte) keyboard_events_size#1 keyboard_event_scan::@12/(byte) keyboard_events_size#10 keyboard_event_scan::@14/(byte) keyboard_events_size#2 )
[437] (byte) keyboard_event_scan::keycode#14 ← ++ (byte) keyboard_event_scan::keycode#10
[438] (byte) keyboard_event_scan::col#1 ← ++ (byte) keyboard_event_scan::col#2
[439] if((byte) keyboard_event_scan::col#1!=(byte) 8) goto keyboard_event_scan::@9
to:keyboard_event_scan::@15
keyboard_event_scan::@15: scope:[keyboard_event_scan] from keyboard_event_scan::@10
[441] *((const byte[8]) keyboard_scan_values#0 + (byte) keyboard_event_scan::row#2) ← (byte) keyboard_event_scan::row_scan#0
[440] *((const byte[8]) keyboard_scan_values#0 + (byte) keyboard_event_scan::row#2) ← (byte) keyboard_event_scan::row_scan#0
to:keyboard_event_scan::@8
keyboard_event_scan::@11: scope:[keyboard_event_scan] from keyboard_event_scan::@13
[442] (byte~) keyboard_event_scan::$23 ← (byte) keyboard_event_scan::keycode#10 | (byte) $40
[443] *((const byte[8]) keyboard_events#0 + (byte) keyboard_events_size#10) ← (byte~) keyboard_event_scan::$23
[444] (byte) keyboard_events_size#1 ← ++ (byte) keyboard_events_size#10
[441] (byte~) keyboard_event_scan::$23 ← (byte) keyboard_event_scan::keycode#10 | (byte) $40
[442] *((const byte[8]) keyboard_events#0 + (byte) keyboard_events_size#10) ← (byte~) keyboard_event_scan::$23
[443] (byte) keyboard_events_size#1 ← ++ (byte) keyboard_events_size#10
to:keyboard_event_scan::@10
keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_event_scan::@7
[445] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0)
[446] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0)
[444] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0)
[445] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0)
to:keyboard_matrix_read::@return
keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matrix_read
[447] return
[446] return
to:@return
render_show: scope:[render_show] from main::@3
[448] if((byte) render_screen_show#16==(byte) 0) goto render_show::toD0181
[447] if((byte) render_screen_show#16==(byte) 0) goto render_show::toD0181
to:render_show::toD0182
render_show::toD0182: scope:[render_show] from render_show
[449] phi()
[448] phi()
to:render_show::@1
render_show::@1: scope:[render_show] from render_show::toD0181 render_show::toD0182
[450] (byte) render_show::d018val#3 ← phi( render_show::toD0181/(const byte) render_show::toD0181_return#0 render_show::toD0182/(const byte) render_show::toD0182_return#0 )
[451] *((const byte*) D018#0) ← (byte) render_show::d018val#3
[452] *((const byte*) BGCOL2#0) ← *((const byte[]) PIECES_COLORS_1#0 + (byte) level#10)
[453] *((const byte*) BGCOL3#0) ← *((const byte[]) PIECES_COLORS_2#0 + (byte) level#10)
[454] (byte) render_screen_showing#1 ← (byte) render_screen_show#16
[449] (byte) render_show::d018val#3 ← phi( render_show::toD0181/(const byte) render_show::toD0181_return#0 render_show::toD0182/(const byte) render_show::toD0182_return#0 )
[450] *((const byte*) D018#0) ← (byte) render_show::d018val#3
[451] *((const byte*) BGCOL2#0) ← *((const byte[]) PIECES_COLORS_1#0 + (byte) level#10)
[452] *((const byte*) BGCOL3#0) ← *((const byte[]) PIECES_COLORS_2#0 + (byte) level#10)
[453] (byte) render_screen_showing#1 ← (byte) render_screen_show#16
to:render_show::@return
render_show::@return: scope:[render_show] from render_show::@1
[455] return
[454] return
to:@return
render_show::toD0181: scope:[render_show] from render_show
[456] phi()
[455] phi()
to:render_show::@1
play_init: scope:[play_init] from main::@11
[457] phi()
[456] phi()
to:play_init::@1
play_init::@1: scope:[play_init] from play_init play_init::@1
[458] (byte) play_init::idx#2 ← phi( play_init/(byte) 0 play_init::@1/(byte) play_init::idx#1 )
[458] (byte*) play_init::pli#2 ← phi( play_init/(const byte[PLAYFIELD_LINES#0*PLAYFIELD_COLS#0]) playfield#0 play_init::@1/(byte*) play_init::pli#1 )
[458] (byte) play_init::j#2 ← phi( play_init/(byte) 0 play_init::@1/(byte) play_init::j#1 )
[459] (byte~) play_init::$4 ← (byte) play_init::j#2 << (byte) 1
[460] *((const byte*[PLAYFIELD_LINES#0]) playfield_lines#0 + (byte~) play_init::$4) ← (byte*) play_init::pli#2
[461] *((const byte[PLAYFIELD_LINES#0+1]) playfield_lines_idx#0 + (byte) play_init::j#2) ← (byte) play_init::idx#2
[462] (byte*) play_init::pli#1 ← (byte*) play_init::pli#2 + (const byte) PLAYFIELD_COLS#0
[463] (byte) play_init::idx#1 ← (byte) play_init::idx#2 + (const byte) PLAYFIELD_COLS#0
[464] (byte) play_init::j#1 ← ++ (byte) play_init::j#2
[465] if((byte) play_init::j#1!=(const byte) PLAYFIELD_LINES#0-(byte) 1+(byte) 1) goto play_init::@1
[457] (byte) play_init::idx#2 ← phi( play_init/(byte) 0 play_init::@1/(byte) play_init::idx#1 )
[457] (byte*) play_init::pli#2 ← phi( play_init/(const byte[PLAYFIELD_LINES#0*PLAYFIELD_COLS#0]) playfield#0 play_init::@1/(byte*) play_init::pli#1 )
[457] (byte) play_init::j#2 ← phi( play_init/(byte) 0 play_init::@1/(byte) play_init::j#1 )
[458] (byte~) play_init::$4 ← (byte) play_init::j#2 << (byte) 1
[459] *((const byte*[PLAYFIELD_LINES#0]) playfield_lines#0 + (byte~) play_init::$4) ← (byte*) play_init::pli#2
[460] *((const byte[PLAYFIELD_LINES#0+1]) playfield_lines_idx#0 + (byte) play_init::j#2) ← (byte) play_init::idx#2
[461] (byte*) play_init::pli#1 ← (byte*) play_init::pli#2 + (const byte) PLAYFIELD_COLS#0
[462] (byte) play_init::idx#1 ← (byte) play_init::idx#2 + (const byte) PLAYFIELD_COLS#0
[463] (byte) play_init::j#1 ← ++ (byte) play_init::j#2
[464] if((byte) play_init::j#1!=(const byte) PLAYFIELD_LINES#0-(byte) 1+(byte) 1) goto play_init::@1
to:play_init::@2
play_init::@2: scope:[play_init] from play_init::@1
[466] *((const byte[PLAYFIELD_LINES#0+1]) playfield_lines_idx#0+(const byte) PLAYFIELD_LINES#0) ← (const byte) PLAYFIELD_COLS#0*(const byte) PLAYFIELD_LINES#0
[467] (byte) current_movedown_slow#1 ← *((const byte[]) MOVEDOWN_SLOW_SPEEDS#0)
[465] *((const byte[PLAYFIELD_LINES#0+1]) playfield_lines_idx#0+(const byte) PLAYFIELD_LINES#0) ← (const byte) PLAYFIELD_COLS#0*(const byte) PLAYFIELD_LINES#0
[466] (byte) current_movedown_slow#1 ← *((const byte[]) MOVEDOWN_SLOW_SPEEDS#0)
to:play_init::@3
play_init::@3: scope:[play_init] from play_init::@2 play_init::@3
[468] (byte) play_init::b#2 ← phi( play_init::@2/(byte) 0 play_init::@3/(byte) play_init::b#1 )
[469] (byte~) play_init::$5 ← (byte) play_init::b#2 << (byte) 2
[470] *((const dword[5]) score_add_bcd#0 + (byte~) play_init::$5) ← *((const dword[]) SCORE_BASE_BCD#0 + (byte~) play_init::$5)
[471] (byte) play_init::b#1 ← ++ (byte) play_init::b#2
[472] if((byte) play_init::b#1!=(byte) 5) goto play_init::@3
[467] (byte) play_init::b#2 ← phi( play_init::@2/(byte) 0 play_init::@3/(byte) play_init::b#1 )
[468] (byte~) play_init::$5 ← (byte) play_init::b#2 << (byte) 2
[469] *((const dword[5]) score_add_bcd#0 + (byte~) play_init::$5) ← *((const dword[]) SCORE_BASE_BCD#0 + (byte~) play_init::$5)
[470] (byte) play_init::b#1 ← ++ (byte) play_init::b#2
[471] if((byte) play_init::b#1!=(byte) 5) goto play_init::@3
to:play_init::@return
play_init::@return: scope:[play_init] from play_init::@3
[473] return
[472] return
to:@return
sprites_irq_init: scope:[sprites_irq_init] from main::@10
asm { sei }
[475] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0
[474] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0
asm { ldaCIA1_INTERRUPT }
[477] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0
[478] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0
[479] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0
[480] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte) $7f
[481] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0
[482] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0
[483] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) sprites_irq()
[476] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0
[477] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0
[478] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0
[479] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte) $7f
[480] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0
[481] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0
[482] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) sprites_irq()
asm { cli }
to:sprites_irq_init::@return
sprites_irq_init::@return: scope:[sprites_irq_init] from sprites_irq_init
[485] return
[484] return
to:@return
sprites_init: scope:[sprites_init] from main::@9
[486] *((const byte*) SPRITES_ENABLE#0) ← (byte) $f
[487] *((const byte*) SPRITES_MC#0) ← (byte) 0
[488] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0)
[489] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0)
[485] *((const byte*) SPRITES_ENABLE#0) ← (byte) $f
[486] *((const byte*) SPRITES_MC#0) ← (byte) 0
[487] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0)
[488] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0)
to:sprites_init::@1
sprites_init::@1: scope:[sprites_init] from sprites_init sprites_init::@1
[490] (byte) sprites_init::xpos#2 ← phi( sprites_init/(byte)(number) $18+(number) $f*(number) 8 sprites_init::@1/(byte) sprites_init::xpos#1 )
[490] (byte) sprites_init::s#2 ← phi( sprites_init/(byte) 0 sprites_init::@1/(byte) sprites_init::s#1 )
[491] (byte) sprites_init::s2#0 ← (byte) sprites_init::s#2 << (byte) 1
[492] *((const byte*) SPRITES_XPOS#0 + (byte) sprites_init::s2#0) ← (byte) sprites_init::xpos#2
[493] *((const byte*) SPRITES_COLS#0 + (byte) sprites_init::s#2) ← (const byte) BLACK#0
[494] (byte) sprites_init::xpos#1 ← (byte) sprites_init::xpos#2 + (byte) $18
[495] (byte) sprites_init::s#1 ← ++ (byte) sprites_init::s#2
[496] if((byte) sprites_init::s#1!=(byte) 4) goto sprites_init::@1
[489] (byte) sprites_init::xpos#2 ← phi( sprites_init/(byte)(number) $18+(number) $f*(number) 8 sprites_init::@1/(byte) sprites_init::xpos#1 )
[489] (byte) sprites_init::s#2 ← phi( sprites_init/(byte) 0 sprites_init::@1/(byte) sprites_init::s#1 )
[490] (byte) sprites_init::s2#0 ← (byte) sprites_init::s#2 << (byte) 1
[491] *((const byte*) SPRITES_XPOS#0 + (byte) sprites_init::s2#0) ← (byte) sprites_init::xpos#2
[492] *((const byte*) SPRITES_COLS#0 + (byte) sprites_init::s#2) ← (const byte) BLACK#0
[493] (byte) sprites_init::xpos#1 ← (byte) sprites_init::xpos#2 + (byte) $18
[494] (byte) sprites_init::s#1 ← ++ (byte) sprites_init::s#2
[495] if((byte) sprites_init::s#1!=(byte) 4) goto sprites_init::@1
to:sprites_init::@return
sprites_init::@return: scope:[sprites_init] from sprites_init::@1
[497] return
[496] return
to:@return
render_init: scope:[render_init] from main::@8
[498] phi()
[497] phi()
to:render_init::vicSelectGfxBank1
render_init::vicSelectGfxBank1: scope:[render_init] from render_init
[499] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte) 3
[498] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte) 3
to:render_init::vicSelectGfxBank1_toDd001
render_init::vicSelectGfxBank1_toDd001: scope:[render_init] from render_init::vicSelectGfxBank1
[500] phi()
[499] phi()
to:render_init::vicSelectGfxBank1_@1
render_init::vicSelectGfxBank1_@1: scope:[render_init] from render_init::vicSelectGfxBank1_toDd001
[501] *((const byte*) CIA2_PORT_A#0) ← (const byte) render_init::vicSelectGfxBank1_toDd001_return#0
[500] *((const byte*) CIA2_PORT_A#0) ← (const byte) render_init::vicSelectGfxBank1_toDd001_return#0
to:render_init::@2
render_init::@2: scope:[render_init] from render_init::vicSelectGfxBank1_@1
[502] *((const byte*) D011#0) ← (const byte) VIC_ECM#0|(const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte) 3
[503] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0
[504] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0
[505] *((const byte*) BGCOL2#0) ← *((const byte[]) PIECES_COLORS_1#0)
[506] *((const byte*) BGCOL3#0) ← *((const byte[]) PIECES_COLORS_2#0)
[507] *((const byte*) BGCOL4#0) ← (const byte) GREY#0
[508] call render_screen_original
[501] *((const byte*) D011#0) ← (const byte) VIC_ECM#0|(const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte) 3
[502] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0
[503] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0
[504] *((const byte*) BGCOL2#0) ← *((const byte[]) PIECES_COLORS_1#0)
[505] *((const byte*) BGCOL3#0) ← *((const byte[]) PIECES_COLORS_2#0)
[506] *((const byte*) BGCOL4#0) ← (const byte) GREY#0
[507] call render_screen_original
to:render_init::@3
render_init::@3: scope:[render_init] from render_init::@2
[509] phi()
[510] call render_screen_original
[508] phi()
[509] call render_screen_original
to:render_init::@1
render_init::@1: scope:[render_init] from render_init::@1 render_init::@3
[511] (byte*) render_init::li_2#2 ← phi( render_init::@1/(byte*) render_init::li_2#1 render_init::@3/(const byte*) PLAYFIELD_SCREEN_2#0+(byte)(number) 2*(number) $28+(byte) $10 )
[511] (byte*) render_init::li_1#2 ← phi( render_init::@1/(byte*) render_init::li_1#1 render_init::@3/(const byte*) PLAYFIELD_SCREEN_1#0+(byte)(number) 2*(number) $28+(byte) $10 )
[511] (byte) render_init::i#2 ← phi( render_init::@1/(byte) render_init::i#1 render_init::@3/(byte) 0 )
[512] (byte~) render_init::$13 ← (byte) render_init::i#2 << (byte) 1
[513] *((const byte*[PLAYFIELD_LINES#0]) screen_lines_1#0 + (byte~) render_init::$13) ← (byte*) render_init::li_1#2
[514] *((const byte*[PLAYFIELD_LINES#0]) screen_lines_2#0 + (byte~) render_init::$13) ← (byte*) render_init::li_2#2
[515] (byte*) render_init::li_1#1 ← (byte*) render_init::li_1#2 + (byte) $28
[516] (byte*) render_init::li_2#1 ← (byte*) render_init::li_2#2 + (byte) $28
[517] (byte) render_init::i#1 ← ++ (byte) render_init::i#2
[518] if((byte) render_init::i#1!=(const byte) PLAYFIELD_LINES#0-(byte) 1+(byte) 1) goto render_init::@1
[510] (byte*) render_init::li_2#2 ← phi( render_init::@1/(byte*) render_init::li_2#1 render_init::@3/(const byte*) PLAYFIELD_SCREEN_2#0+(byte)(number) 2*(number) $28+(byte) $10 )
[510] (byte*) render_init::li_1#2 ← phi( render_init::@1/(byte*) render_init::li_1#1 render_init::@3/(const byte*) PLAYFIELD_SCREEN_1#0+(byte)(number) 2*(number) $28+(byte) $10 )
[510] (byte) render_init::i#2 ← phi( render_init::@1/(byte) render_init::i#1 render_init::@3/(byte) 0 )
[511] (byte~) render_init::$13 ← (byte) render_init::i#2 << (byte) 1
[512] *((const byte*[PLAYFIELD_LINES#0]) screen_lines_1#0 + (byte~) render_init::$13) ← (byte*) render_init::li_1#2
[513] *((const byte*[PLAYFIELD_LINES#0]) screen_lines_2#0 + (byte~) render_init::$13) ← (byte*) render_init::li_2#2
[514] (byte*) render_init::li_1#1 ← (byte*) render_init::li_1#2 + (byte) $28
[515] (byte*) render_init::li_2#1 ← (byte*) render_init::li_2#2 + (byte) $28
[516] (byte) render_init::i#1 ← ++ (byte) render_init::i#2
[517] if((byte) render_init::i#1!=(const byte) PLAYFIELD_LINES#0-(byte) 1+(byte) 1) goto render_init::@1
to:render_init::@return
render_init::@return: scope:[render_init] from render_init::@1
[519] return
[518] return
to:@return
render_screen_original: scope:[render_screen_original] from render_init::@2 render_init::@3
[520] (byte*) render_screen_original::screen#9 ← phi( render_init::@2/(const byte*) PLAYFIELD_SCREEN_1#0 render_init::@3/(const byte*) PLAYFIELD_SCREEN_2#0 )
[519] (byte*) render_screen_original::screen#9 ← phi( render_init::@2/(const byte*) PLAYFIELD_SCREEN_1#0 render_init::@3/(const byte*) PLAYFIELD_SCREEN_2#0 )
to:render_screen_original::@1
render_screen_original::@1: scope:[render_screen_original] from render_screen_original render_screen_original::@5
[521] (byte) render_screen_original::y#6 ← phi( render_screen_original/(byte) 0 render_screen_original::@5/(byte) render_screen_original::y#1 )
[521] (byte*) render_screen_original::ocols#4 ← phi( render_screen_original/(const byte*) PLAYFIELD_COLORS_ORIGINAL#0+(byte)(number) $20*(number) 2 render_screen_original::@5/(byte*) render_screen_original::ocols#1 )
[521] (byte*) render_screen_original::oscr#4 ← phi( render_screen_original/(const byte*) PLAYFIELD_SCREEN_ORIGINAL#0+(byte)(number) $20*(number) 2 render_screen_original::@5/(byte*) render_screen_original::oscr#1 )
[521] (byte*) render_screen_original::cols#7 ← phi( render_screen_original/(const byte*) COLS#0 render_screen_original::@5/(byte*) render_screen_original::cols#3 )
[521] (byte*) render_screen_original::screen#8 ← phi( render_screen_original/(byte*) render_screen_original::screen#9 render_screen_original::@5/(byte*) render_screen_original::screen#10 )
[520] (byte) render_screen_original::y#6 ← phi( render_screen_original/(byte) 0 render_screen_original::@5/(byte) render_screen_original::y#1 )
[520] (byte*) render_screen_original::ocols#4 ← phi( render_screen_original/(const byte*) PLAYFIELD_COLORS_ORIGINAL#0+(byte)(number) $20*(number) 2 render_screen_original::@5/(byte*) render_screen_original::ocols#1 )
[520] (byte*) render_screen_original::oscr#4 ← phi( render_screen_original/(const byte*) PLAYFIELD_SCREEN_ORIGINAL#0+(byte)(number) $20*(number) 2 render_screen_original::@5/(byte*) render_screen_original::oscr#1 )
[520] (byte*) render_screen_original::cols#7 ← phi( render_screen_original/(const byte*) COLS#0 render_screen_original::@5/(byte*) render_screen_original::cols#3 )
[520] (byte*) render_screen_original::screen#8 ← phi( render_screen_original/(byte*) render_screen_original::screen#9 render_screen_original::@5/(byte*) render_screen_original::screen#10 )
to:render_screen_original::@2
render_screen_original::@2: scope:[render_screen_original] from render_screen_original::@1 render_screen_original::@2
[522] (byte) render_screen_original::x#4 ← phi( render_screen_original::@1/(byte) 0 render_screen_original::@2/(byte) render_screen_original::x#1 )
[522] (byte*) render_screen_original::cols#4 ← phi( render_screen_original::@1/(byte*) render_screen_original::cols#7 render_screen_original::@2/(byte*) render_screen_original::cols#1 )
[522] (byte*) render_screen_original::screen#5 ← phi( render_screen_original::@1/(byte*) render_screen_original::screen#8 render_screen_original::@2/(byte*) render_screen_original::screen#2 )
[523] *((byte*) render_screen_original::screen#5) ← (const byte) render_screen_original::SPACE#0
[524] (byte*) render_screen_original::screen#2 ← ++ (byte*) render_screen_original::screen#5
[525] *((byte*) render_screen_original::cols#4) ← (const byte) BLACK#0
[526] (byte*) render_screen_original::cols#1 ← ++ (byte*) render_screen_original::cols#4
[527] (byte) render_screen_original::x#1 ← ++ (byte) render_screen_original::x#4
[528] if((byte) render_screen_original::x#1!=(byte) 4) goto render_screen_original::@2
[521] (byte) render_screen_original::x#4 ← phi( render_screen_original::@1/(byte) 0 render_screen_original::@2/(byte) render_screen_original::x#1 )
[521] (byte*) render_screen_original::cols#4 ← phi( render_screen_original::@1/(byte*) render_screen_original::cols#7 render_screen_original::@2/(byte*) render_screen_original::cols#1 )
[521] (byte*) render_screen_original::screen#5 ← phi( render_screen_original::@1/(byte*) render_screen_original::screen#8 render_screen_original::@2/(byte*) render_screen_original::screen#2 )
[522] *((byte*) render_screen_original::screen#5) ← (const byte) render_screen_original::SPACE#0
[523] (byte*) render_screen_original::screen#2 ← ++ (byte*) render_screen_original::screen#5
[524] *((byte*) render_screen_original::cols#4) ← (const byte) BLACK#0
[525] (byte*) render_screen_original::cols#1 ← ++ (byte*) render_screen_original::cols#4
[526] (byte) render_screen_original::x#1 ← ++ (byte) render_screen_original::x#4
[527] if((byte) render_screen_original::x#1!=(byte) 4) goto render_screen_original::@2
to:render_screen_original::@3
render_screen_original::@3: scope:[render_screen_original] from render_screen_original::@2 render_screen_original::@3
[529] (byte) render_screen_original::x#5 ← phi( render_screen_original::@2/(byte) render_screen_original::x#1 render_screen_original::@3/(byte) render_screen_original::x#2 )
[529] (byte*) render_screen_original::cols#5 ← phi( render_screen_original::@2/(byte*) render_screen_original::cols#1 render_screen_original::@3/(byte*) render_screen_original::cols#2 )
[529] (byte*) render_screen_original::ocols#2 ← phi( render_screen_original::@2/(byte*) render_screen_original::ocols#4 render_screen_original::@3/(byte*) render_screen_original::ocols#1 )
[529] (byte*) render_screen_original::screen#6 ← phi( render_screen_original::@2/(byte*) render_screen_original::screen#2 render_screen_original::@3/(byte*) render_screen_original::screen#3 )
[529] (byte*) render_screen_original::oscr#2 ← phi( render_screen_original::@2/(byte*) render_screen_original::oscr#4 render_screen_original::@3/(byte*) render_screen_original::oscr#1 )
[530] *((byte*) render_screen_original::screen#6) ← *((byte*) render_screen_original::oscr#2)
[531] (byte*) render_screen_original::screen#3 ← ++ (byte*) render_screen_original::screen#6
[532] (byte*) render_screen_original::oscr#1 ← ++ (byte*) render_screen_original::oscr#2
[533] *((byte*) render_screen_original::cols#5) ← *((byte*) render_screen_original::ocols#2)
[534] (byte*) render_screen_original::cols#2 ← ++ (byte*) render_screen_original::cols#5
[535] (byte*) render_screen_original::ocols#1 ← ++ (byte*) render_screen_original::ocols#2
[536] (byte) render_screen_original::x#2 ← ++ (byte) render_screen_original::x#5
[537] if((byte) render_screen_original::x#2!=(byte) $24) goto render_screen_original::@3
[528] (byte) render_screen_original::x#5 ← phi( render_screen_original::@2/(byte) render_screen_original::x#1 render_screen_original::@3/(byte) render_screen_original::x#2 )
[528] (byte*) render_screen_original::cols#5 ← phi( render_screen_original::@2/(byte*) render_screen_original::cols#1 render_screen_original::@3/(byte*) render_screen_original::cols#2 )
[528] (byte*) render_screen_original::ocols#2 ← phi( render_screen_original::@2/(byte*) render_screen_original::ocols#4 render_screen_original::@3/(byte*) render_screen_original::ocols#1 )
[528] (byte*) render_screen_original::screen#6 ← phi( render_screen_original::@2/(byte*) render_screen_original::screen#2 render_screen_original::@3/(byte*) render_screen_original::screen#3 )
[528] (byte*) render_screen_original::oscr#2 ← phi( render_screen_original::@2/(byte*) render_screen_original::oscr#4 render_screen_original::@3/(byte*) render_screen_original::oscr#1 )
[529] *((byte*) render_screen_original::screen#6) ← *((byte*) render_screen_original::oscr#2)
[530] (byte*) render_screen_original::screen#3 ← ++ (byte*) render_screen_original::screen#6
[531] (byte*) render_screen_original::oscr#1 ← ++ (byte*) render_screen_original::oscr#2
[532] *((byte*) render_screen_original::cols#5) ← *((byte*) render_screen_original::ocols#2)
[533] (byte*) render_screen_original::cols#2 ← ++ (byte*) render_screen_original::cols#5
[534] (byte*) render_screen_original::ocols#1 ← ++ (byte*) render_screen_original::ocols#2
[535] (byte) render_screen_original::x#2 ← ++ (byte) render_screen_original::x#5
[536] if((byte) render_screen_original::x#2!=(byte) $24) goto render_screen_original::@3
to:render_screen_original::@4
render_screen_original::@4: scope:[render_screen_original] from render_screen_original::@3 render_screen_original::@4
[538] (byte) render_screen_original::x#6 ← phi( render_screen_original::@3/(byte) render_screen_original::x#2 render_screen_original::@4/(byte) render_screen_original::x#3 )
[538] (byte*) render_screen_original::cols#6 ← phi( render_screen_original::@3/(byte*) render_screen_original::cols#2 render_screen_original::@4/(byte*) render_screen_original::cols#3 )
[538] (byte*) render_screen_original::screen#7 ← phi( render_screen_original::@3/(byte*) render_screen_original::screen#3 render_screen_original::@4/(byte*) render_screen_original::screen#10 )
[539] *((byte*) render_screen_original::screen#7) ← (const byte) render_screen_original::SPACE#0
[540] (byte*) render_screen_original::screen#10 ← ++ (byte*) render_screen_original::screen#7
[541] *((byte*) render_screen_original::cols#6) ← (const byte) BLACK#0
[542] (byte*) render_screen_original::cols#3 ← ++ (byte*) render_screen_original::cols#6
[543] (byte) render_screen_original::x#3 ← ++ (byte) render_screen_original::x#6
[544] if((byte) render_screen_original::x#3!=(byte) $28) goto render_screen_original::@4
[537] (byte) render_screen_original::x#6 ← phi( render_screen_original::@3/(byte) render_screen_original::x#2 render_screen_original::@4/(byte) render_screen_original::x#3 )
[537] (byte*) render_screen_original::cols#6 ← phi( render_screen_original::@3/(byte*) render_screen_original::cols#2 render_screen_original::@4/(byte*) render_screen_original::cols#3 )
[537] (byte*) render_screen_original::screen#7 ← phi( render_screen_original::@3/(byte*) render_screen_original::screen#3 render_screen_original::@4/(byte*) render_screen_original::screen#10 )
[538] *((byte*) render_screen_original::screen#7) ← (const byte) render_screen_original::SPACE#0
[539] (byte*) render_screen_original::screen#10 ← ++ (byte*) render_screen_original::screen#7
[540] *((byte*) render_screen_original::cols#6) ← (const byte) BLACK#0
[541] (byte*) render_screen_original::cols#3 ← ++ (byte*) render_screen_original::cols#6
[542] (byte) render_screen_original::x#3 ← ++ (byte) render_screen_original::x#6
[543] if((byte) render_screen_original::x#3!=(byte) $28) goto render_screen_original::@4
to:render_screen_original::@5
render_screen_original::@5: scope:[render_screen_original] from render_screen_original::@4
[545] (byte) render_screen_original::y#1 ← ++ (byte) render_screen_original::y#6
[546] if((byte) render_screen_original::y#1!=(byte) $19) goto render_screen_original::@1
[544] (byte) render_screen_original::y#1 ← ++ (byte) render_screen_original::y#6
[545] if((byte) render_screen_original::y#1!=(byte) $19) goto render_screen_original::@1
to:render_screen_original::@return
render_screen_original::@return: scope:[render_screen_original] from render_screen_original::@5
[547] return
[546] return
to:@return
sid_rnd_init: scope:[sid_rnd_init] from main
[548] *((const word*) SID_VOICE3_FREQ#0) ← (word) $ffff
[549] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0
[547] *((const word*) SID_VOICE3_FREQ#0) ← (word) $ffff
[548] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0
to:sid_rnd_init::@return
sid_rnd_init::@return: scope:[sid_rnd_init] from sid_rnd_init
[550] return
[549] return
to:@return
sprites_irq: scope:[sprites_irq] from
asm { cld }
[552] (byte) sprites_irq::ypos#0 ← (byte) irq_sprite_ypos#0
[553] *((const byte*) SPRITES_YPOS#0) ← (byte) sprites_irq::ypos#0
[554] *((const byte*) SPRITES_YPOS#0+(byte) 2) ← (byte) sprites_irq::ypos#0
[555] *((const byte*) SPRITES_YPOS#0+(byte) 4) ← (byte) sprites_irq::ypos#0
[556] *((const byte*) SPRITES_YPOS#0+(byte) 6) ← (byte) sprites_irq::ypos#0
[557] (byte~) sprites_irq::$0 ← (byte) irq_raster_next#0 + (byte) 1
[558] (byte) sprites_irq::raster_sprite_gfx_modify#0 ← (byte~) sprites_irq::$0
[551] (byte) sprites_irq::ypos#0 ← (byte) irq_sprite_ypos#0
[552] *((const byte*) SPRITES_YPOS#0) ← (byte) sprites_irq::ypos#0
[553] *((const byte*) SPRITES_YPOS#0+(byte) 2) ← (byte) sprites_irq::ypos#0
[554] *((const byte*) SPRITES_YPOS#0+(byte) 4) ← (byte) sprites_irq::ypos#0
[555] *((const byte*) SPRITES_YPOS#0+(byte) 6) ← (byte) sprites_irq::ypos#0
[556] (byte~) sprites_irq::$0 ← (byte) irq_raster_next#0 + (byte) 1
[557] (byte) sprites_irq::raster_sprite_gfx_modify#0 ← (byte~) sprites_irq::$0
to:sprites_irq::@8
sprites_irq::@8: scope:[sprites_irq] from sprites_irq sprites_irq::@8
[559] if(*((const byte*) RASTER#0)<(byte) sprites_irq::raster_sprite_gfx_modify#0) goto sprites_irq::@8
[558] if(*((const byte*) RASTER#0)<(byte) sprites_irq::raster_sprite_gfx_modify#0) goto sprites_irq::@8
to:sprites_irq::@9
sprites_irq::@9: scope:[sprites_irq] from sprites_irq::@8
[560] (byte) sprites_irq::ptr#0 ← (byte) irq_sprite_ptr#0
[561] if((byte) render_screen_showing#0==(byte) 0) goto sprites_irq::@1
[559] (byte) sprites_irq::ptr#0 ← (byte) irq_sprite_ptr#0
[560] if((byte) render_screen_showing#0==(byte) 0) goto sprites_irq::@1
to:sprites_irq::@10
sprites_irq::@10: scope:[sprites_irq] from sprites_irq::@9
[562] *((const byte*) PLAYFIELD_SPRITE_PTRS_2#0) ← (byte) sprites_irq::ptr#0
[563] (byte) sprites_irq::ptr#3 ← ++ (byte) sprites_irq::ptr#0
[564] *((const byte*) PLAYFIELD_SPRITE_PTRS_2#0+(byte) 1) ← (byte) sprites_irq::ptr#3
[565] *((const byte*) PLAYFIELD_SPRITE_PTRS_2#0+(byte) 2) ← (byte) sprites_irq::ptr#3
[566] (byte) sprites_irq::ptr#4 ← ++ (byte) sprites_irq::ptr#3
[567] *((const byte*) PLAYFIELD_SPRITE_PTRS_2#0+(byte) 3) ← (byte) sprites_irq::ptr#4
[561] *((const byte*) PLAYFIELD_SPRITE_PTRS_2#0) ← (byte) sprites_irq::ptr#0
[562] (byte) sprites_irq::ptr#3 ← ++ (byte) sprites_irq::ptr#0
[563] *((const byte*) PLAYFIELD_SPRITE_PTRS_2#0+(byte) 1) ← (byte) sprites_irq::ptr#3
[564] *((const byte*) PLAYFIELD_SPRITE_PTRS_2#0+(byte) 2) ← (byte) sprites_irq::ptr#3
[565] (byte) sprites_irq::ptr#4 ← ++ (byte) sprites_irq::ptr#3
[566] *((const byte*) PLAYFIELD_SPRITE_PTRS_2#0+(byte) 3) ← (byte) sprites_irq::ptr#4
to:sprites_irq::@2
sprites_irq::@2: scope:[sprites_irq] from sprites_irq::@1 sprites_irq::@10
[568] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0
[569] if((byte) irq_cnt#1==(byte) 9) goto sprites_irq::@3
[567] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0
[568] if((byte) irq_cnt#1==(byte) 9) goto sprites_irq::@3
to:sprites_irq::@6
sprites_irq::@6: scope:[sprites_irq] from sprites_irq::@2
[570] if((byte) irq_cnt#1==(byte) $a) goto sprites_irq::@4
[569] if((byte) irq_cnt#1==(byte) $a) goto sprites_irq::@4
to:sprites_irq::@7
sprites_irq::@7: scope:[sprites_irq] from sprites_irq::@6
[571] (byte) irq_raster_next#3 ← (byte) irq_raster_next#0 + (byte) $14
[572] (byte) irq_sprite_ypos#3 ← (byte) irq_sprite_ypos#0 + (byte) $15
[573] (byte) irq_sprite_ptr#3 ← (byte) irq_sprite_ptr#0 + (byte) 3
[570] (byte) irq_raster_next#3 ← (byte) irq_raster_next#0 + (byte) $14
[571] (byte) irq_sprite_ypos#3 ← (byte) irq_sprite_ypos#0 + (byte) $15
[572] (byte) irq_sprite_ptr#3 ← (byte) irq_sprite_ptr#0 + (byte) 3
to:sprites_irq::@5
sprites_irq::@5: scope:[sprites_irq] from sprites_irq::@11 sprites_irq::@4 sprites_irq::@7
[574] (byte) irq_sprite_ptr#11 ← phi( sprites_irq::@11/(byte) irq_sprite_ptr#1 sprites_irq::@4/(byte) irq_sprite_ptr#2 sprites_irq::@7/(byte) irq_sprite_ptr#3 )
[574] (byte) irq_sprite_ypos#11 ← phi( sprites_irq::@11/(byte) irq_sprite_ypos#1 sprites_irq::@4/(byte) irq_sprite_ypos#2 sprites_irq::@7/(byte) irq_sprite_ypos#3 )
[574] (byte) irq_cnt#3 ← phi( sprites_irq::@11/(byte) irq_cnt#1 sprites_irq::@4/(byte) irq_cnt#2 sprites_irq::@7/(byte) irq_cnt#1 )
[574] (byte) irq_raster_next#4 ← phi( sprites_irq::@11/(byte) irq_raster_next#1 sprites_irq::@4/(byte) irq_raster_next#2 sprites_irq::@7/(byte) irq_raster_next#3 )
[575] *((const byte*) RASTER#0) ← (byte) irq_raster_next#4
[576] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0
[573] (byte) irq_sprite_ptr#11 ← phi( sprites_irq::@11/(byte) irq_sprite_ptr#1 sprites_irq::@4/(byte) irq_sprite_ptr#2 sprites_irq::@7/(byte) irq_sprite_ptr#3 )
[573] (byte) irq_sprite_ypos#11 ← phi( sprites_irq::@11/(byte) irq_sprite_ypos#1 sprites_irq::@4/(byte) irq_sprite_ypos#2 sprites_irq::@7/(byte) irq_sprite_ypos#3 )
[573] (byte) irq_cnt#3 ← phi( sprites_irq::@11/(byte) irq_cnt#1 sprites_irq::@4/(byte) irq_cnt#2 sprites_irq::@7/(byte) irq_cnt#1 )
[573] (byte) irq_raster_next#4 ← phi( sprites_irq::@11/(byte) irq_raster_next#1 sprites_irq::@4/(byte) irq_raster_next#2 sprites_irq::@7/(byte) irq_raster_next#3 )
[574] *((const byte*) RASTER#0) ← (byte) irq_raster_next#4
[575] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0
to:sprites_irq::@return
sprites_irq::@return: scope:[sprites_irq] from sprites_irq::@5
[577] return
[576] return
to:@return
sprites_irq::@4: scope:[sprites_irq] from sprites_irq::@6
[578] (byte) irq_cnt#2 ← (byte) 0
[579] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0
[580] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte) $15
[581] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte) 3
[577] (byte) irq_cnt#2 ← (byte) 0
[578] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0
[579] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte) $15
[580] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte) 3
to:sprites_irq::@5
sprites_irq::@3: scope:[sprites_irq] from sprites_irq::@2
[582] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte) $15
[583] (byte) irq_sprite_ypos#1 ← (const byte) SPRITES_FIRST_YPOS#0
[581] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte) $15
[582] (byte) irq_sprite_ypos#1 ← (const byte) SPRITES_FIRST_YPOS#0
to:sprites_irq::toSpritePtr2
sprites_irq::toSpritePtr2: scope:[sprites_irq] from sprites_irq::@3
[584] phi()
[583] phi()
to:sprites_irq::@11
sprites_irq::@11: scope:[sprites_irq] from sprites_irq::toSpritePtr2
[585] (byte) irq_sprite_ptr#1 ← (const byte) sprites_irq::toSpritePtr2_return#0
[584] (byte) irq_sprite_ptr#1 ← (const byte) sprites_irq::toSpritePtr2_return#0
to:sprites_irq::@5
sprites_irq::@1: scope:[sprites_irq] from sprites_irq::@9
[586] *((const byte*) PLAYFIELD_SPRITE_PTRS_1#0) ← (byte) sprites_irq::ptr#0
[587] (byte) sprites_irq::ptr#1 ← ++ (byte) sprites_irq::ptr#0
[588] *((const byte*) PLAYFIELD_SPRITE_PTRS_1#0+(byte) 1) ← (byte) sprites_irq::ptr#1
[589] *((const byte*) PLAYFIELD_SPRITE_PTRS_1#0+(byte) 2) ← (byte) sprites_irq::ptr#1
[590] (byte) sprites_irq::ptr#2 ← ++ (byte) sprites_irq::ptr#1
[591] *((const byte*) PLAYFIELD_SPRITE_PTRS_1#0+(byte) 3) ← (byte) sprites_irq::ptr#2
[585] *((const byte*) PLAYFIELD_SPRITE_PTRS_1#0) ← (byte) sprites_irq::ptr#0
[586] (byte) sprites_irq::ptr#1 ← ++ (byte) sprites_irq::ptr#0
[587] *((const byte*) PLAYFIELD_SPRITE_PTRS_1#0+(byte) 1) ← (byte) sprites_irq::ptr#1
[588] *((const byte*) PLAYFIELD_SPRITE_PTRS_1#0+(byte) 2) ← (byte) sprites_irq::ptr#1
[589] (byte) sprites_irq::ptr#2 ← ++ (byte) sprites_irq::ptr#1
[590] *((const byte*) PLAYFIELD_SPRITE_PTRS_1#0+(byte) 3) ← (byte) sprites_irq::ptr#2
to:sprites_irq::@2

File diff suppressed because it is too large Load Diff

View File

@ -234,7 +234,7 @@
(byte~) current_piece_char#101 current_piece_char#101 zp ZP_BYTE:15 22.0
(byte) current_piece_char#16 current_piece_char zp ZP_BYTE:38 3.4324324324324325
(byte) current_piece_char#29 current_piece_char zp ZP_BYTE:38 6.0
(byte) current_piece_char#5 current_piece_char zp ZP_BYTE:38 0.25
(byte) current_piece_char#5 current_piece_char zp ZP_BYTE:38 0.25806451612903225
(byte) current_piece_char#68 current_piece_char#68 zp ZP_BYTE:15 48.285714285714285
(byte*) current_piece_gfx
(byte*~) current_piece_gfx#112 current_piece_gfx#112 zp ZP_WORD:36 2.0
@ -249,7 +249,7 @@
(byte*) current_piece_gfx#64 current_piece_gfx#64 zp ZP_WORD:36 48.285714285714285
(byte*) current_piece_gfx#7 current_piece_gfx zp ZP_WORD:25 4.0
(byte) current_xpos
(byte) current_xpos#100 current_xpos zp ZP_BYTE:43 0.3225806451612903
(byte) current_xpos#100 current_xpos zp ZP_BYTE:43 0.3333333333333333
(byte~) current_xpos#119 current_xpos#119 zp ZP_BYTE:14 1.3333333333333333
(byte~) current_xpos#120 current_xpos#120 zp ZP_BYTE:14 7.333333333333333
(byte) current_xpos#14 current_xpos zp ZP_BYTE:43 20.38181818181818
@ -266,14 +266,14 @@
(byte) current_ypos#19 current_ypos zp ZP_BYTE:24 1.7051282051282046
(byte) current_ypos#3 current_ypos zp ZP_BYTE:24 4.0
(byte) current_ypos#38 current_ypos zp ZP_BYTE:24 6.0
(byte) current_ypos#6 current_ypos zp ZP_BYTE:24 0.3333333333333333
(byte) current_ypos#6 current_ypos zp ZP_BYTE:24 0.3448275862068966
(byte~) current_ypos#98 reg byte x 1.0
(byte~) current_ypos#99 reg byte x 4.4
(byte) game_over
(byte) game_over#10 game_over zp ZP_BYTE:11 4.804347826086958
(byte) game_over#15 game_over zp ZP_BYTE:11 3.189189189189189
(byte) game_over#27 game_over zp ZP_BYTE:11 6.0
(byte) game_over#52 game_over zp ZP_BYTE:11 0.34782608695652173
(byte) game_over#52 game_over zp ZP_BYTE:11 0.36363636363636365
(byte) game_over#65 game_over zp ZP_BYTE:11 0.42857142857142855
(byte) irq_cnt
(byte) irq_cnt#0 irq_cnt zp ZP_BYTE:31 0.17391304347826086
@ -710,7 +710,7 @@
(byte) play_remove_lines::y#8 y zp ZP_BYTE:12 133.46666666666667
(void()) play_spawn_current()
(byte~) play_spawn_current::$1 reg byte a 4.0
(byte~) play_spawn_current::$7 $7 zp ZP_BYTE:46 0.06451612903225806
(byte~) play_spawn_current::$7 $7 zp ZP_BYTE:46 0.06666666666666667
(label) play_spawn_current::@1
(label) play_spawn_current::@2
(label) play_spawn_current::@3
@ -720,8 +720,7 @@
(byte) play_spawn_current::current_piece_idx
(byte) play_spawn_current::current_piece_idx#0 reg byte x 2.5
(byte) play_spawn_current::piece_idx
(byte) play_spawn_current::piece_idx#1 piece_idx zp ZP_BYTE:10 2002.0
(byte) play_spawn_current::piece_idx#2 piece_idx zp ZP_BYTE:10 100.5
(byte) play_spawn_current::piece_idx#1 piece_idx zp ZP_BYTE:10 100.5
(label) play_spawn_current::sid_rnd1
(byte) play_spawn_current::sid_rnd1_return
(byte) play_spawn_current::sid_rnd1_return#0 reg byte a 2002.0
@ -1098,7 +1097,7 @@ zp ZP_BYTE:7 [ level#33 level#10 level#17 level#19 level#21 ]
zp ZP_BYTE:8 [ current_movedown_slow#37 current_movedown_slow#14 current_movedown_slow#21 current_movedown_slow#1 current_movedown_slow#23 current_movedown_slow#66 current_movedown_slow#10 ]
zp ZP_BYTE:9 [ level_bcd#31 level_bcd#11 level_bcd#17 level_bcd#19 level_bcd#62 level_bcd#21 level_bcd#8 ]
reg byte x [ play_move_down::return#3 ]
zp ZP_BYTE:10 [ next_piece_idx#17 next_piece_idx#30 next_piece_idx#10 next_piece_idx#16 play_spawn_current::piece_idx#2 play_spawn_current::piece_idx#1 ]
zp ZP_BYTE:10 [ next_piece_idx#17 next_piece_idx#30 next_piece_idx#10 next_piece_idx#16 play_spawn_current::piece_idx#1 ]
zp ZP_BYTE:11 [ game_over#65 game_over#27 game_over#10 game_over#15 game_over#52 ]
reg byte x [ play_increase_level::b#2 play_increase_level::b#1 ]
zp ZP_BYTE:12 [ play_remove_lines::y#8 play_remove_lines::y#1 current_movedown_counter#16 current_movedown_counter#14 current_movedown_counter#12 ]

View File

@ -10,37 +10,18 @@ main: {
sta SCREEN
lda #' '
sta SCREEN+1
ldy #2
ldx #0
// loop byte
b3:
cpx #0
beq b4
lda #'+'
sta SCREEN,y
iny
ldy #0
ldx #2
b4:
inx
cpx #3
iny
cpy #3
bne b3
lda #' '
sta SCREEN,y
iny
sta SCREEN,x
inx
lda #<0
sta i1
sta i1+1
// loop word
b7:
lda i1
cmp #<0
bne !+
lda i1+1
cmp #>0
beq b8
!:
lda #'+'
sta SCREEN,y
iny
b8:
inc i1
bne !+
@ -53,4 +34,25 @@ main: {
cmp #<3
bne b7
rts
// loop word
b7:
lda i1
cmp #<0
bne !+
lda i1+1
cmp #>0
beq b8
!:
lda #'+'
sta SCREEN,x
inx
jmp b8
// loop byte
b3:
cpy #0
beq b4
lda #'+'
sta SCREEN,x
inx
jmp b4
}

View File

@ -15,39 +15,37 @@ main::@2: scope:[main] from main
to:main::@1
main::@1: scope:[main] from main::@2
[6] *((const byte*) SCREEN#0+(byte) 1) ← (byte) ' '
to:main::@3
main::@3: scope:[main] from main::@1 main::@4
[7] (byte) main::idx#10 ← phi( main::@1/(byte) 2 main::@4/(byte) main::idx#11 )
[7] (byte) main::i#2 ← phi( main::@1/(byte) 0 main::@4/(byte) main::i#1 )
[8] if((byte) 0==(byte) main::i#2) goto main::@4
to:main::@5
main::@5: scope:[main] from main::@3
[9] *((const byte*) SCREEN#0 + (byte) main::idx#10) ← (byte) '+'
[10] (byte) main::idx#4 ← ++ (byte) main::idx#10
to:main::@4
main::@4: scope:[main] from main::@3 main::@5
[11] (byte) main::idx#11 ← phi( main::@3/(byte) main::idx#10 main::@5/(byte) main::idx#4 )
[12] (byte) main::i#1 ← ++ (byte) main::i#2
[13] if((byte) main::i#1!=(byte) 3) goto main::@3
main::@4: scope:[main] from main::@1 main::@3 main::@5
[7] (byte) main::i#5 ← phi( main::@3/(byte) main::i#1 main::@1/(byte) 0 main::@5/(byte) main::i#1 )
[7] (byte) main::idx#10 ← phi( main::@3/(byte) main::idx#10 main::@1/(byte) 2 main::@5/(byte) main::idx#4 )
[8] (byte) main::i#1 ← ++ (byte) main::i#5
[9] if((byte) main::i#1!=(byte) 3) goto main::@3
to:main::@6
main::@6: scope:[main] from main::@4
[14] *((const byte*) SCREEN#0 + (byte) main::idx#11) ← (byte) ' '
[15] (byte) main::idx#5 ← ++ (byte) main::idx#11
to:main::@7
main::@7: scope:[main] from main::@6 main::@8
[16] (byte) main::idx#12 ← phi( main::@8/(byte) main::idx#17 main::@6/(byte) main::idx#5 )
[16] (word) main::i1#2 ← phi( main::@8/(word) main::i1#1 main::@6/(word) 0 )
[17] if((byte) 0==(word) main::i1#2) goto main::@8
to:main::@9
main::@9: scope:[main] from main::@7
[18] *((const byte*) SCREEN#0 + (byte) main::idx#12) ← (byte) '+'
[19] (byte) main::idx#6 ← ++ (byte) main::idx#12
[10] *((const byte*) SCREEN#0 + (byte) main::idx#10) ← (byte) ' '
[11] (byte) main::idx#21 ← ++ (byte) main::idx#10
to:main::@8
main::@8: scope:[main] from main::@7 main::@9
[20] (byte) main::idx#17 ← phi( main::@9/(byte) main::idx#6 main::@7/(byte) main::idx#12 )
[21] (word) main::i1#1 ← ++ (word) main::i1#2
[22] if((word) main::i1#1!=(byte) 3) goto main::@7
main::@8: scope:[main] from main::@6 main::@7 main::@9
[12] (word) main::i1#5 ← phi( main::@9/(word) main::i1#1 main::@7/(word) main::i1#1 main::@6/(word) 0 )
[12] (byte) main::idx#12 ← phi( main::@9/(byte) main::idx#6 main::@7/(byte) main::idx#12 main::@6/(byte) main::idx#21 )
[13] (word) main::i1#1 ← ++ (word) main::i1#5
[14] if((word) main::i1#1!=(byte) 3) goto main::@7
to:main::@return
main::@return: scope:[main] from main::@8
[23] return
[15] return
to:@return
main::@7: scope:[main] from main::@8
[16] if((byte) 0==(word) main::i1#1) goto main::@8
to:main::@9
main::@9: scope:[main] from main::@7
[17] *((const byte*) SCREEN#0 + (byte) main::idx#12) ← (byte) '+'
[18] (byte) main::idx#6 ← ++ (byte) main::idx#12
to:main::@8
main::@3: scope:[main] from main::@4
[19] if((byte) 0==(byte) main::i#1) goto main::@4
to:main::@5
main::@5: scope:[main] from main::@3
[20] *((const byte*) SCREEN#0 + (byte) main::idx#10) ← (byte) '+'
[21] (byte) main::idx#4 ← ++ (byte) main::idx#10
to:main::@4

File diff suppressed because it is too large Load Diff

View File

@ -15,21 +15,19 @@
(label) main::@9
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 6.6000000000000005
(byte) main::i#1 reg byte y 83.0
(byte) main::i#5 reg byte y 213.0
(word) main::i1
(word) main::i1#1 i1 zp ZP_WORD:2 16.5
(word) main::i1#2 i1 zp ZP_WORD:2 6.6000000000000005
(word) main::i1#1 i1 zp ZP_WORD:2 83.0
(word) main::i1#5 i1 zp ZP_WORD:2 213.0
(byte) main::idx
(byte) main::idx#10 reg byte y 14.666666666666666
(byte) main::idx#11 reg byte y 9.25
(byte) main::idx#12 reg byte y 15.333333333333332
(byte) main::idx#17 reg byte y 11.0
(byte) main::idx#4 reg byte y 22.0
(byte) main::idx#5 reg byte y 4.0
(byte) main::idx#6 reg byte y 22.0
(byte) main::idx#10 reg byte x 39.83333333333334
(byte) main::idx#12 reg byte x 47.400000000000006
(byte) main::idx#21 reg byte x 4.0
(byte) main::idx#4 reg byte x 22.0
(byte) main::idx#6 reg byte x 22.0
reg byte x [ main::i#2 main::i#1 ]
reg byte y [ main::idx#10 main::idx#11 main::idx#4 ]
zp ZP_WORD:2 [ main::i1#2 main::i1#1 ]
reg byte y [ main::idx#12 main::idx#17 main::idx#5 main::idx#6 ]
reg byte x [ main::idx#10 main::idx#4 ]
reg byte y [ main::i#5 main::i#1 ]
reg byte x [ main::idx#12 main::idx#6 main::idx#21 ]
zp ZP_WORD:2 [ main::i1#5 main::i1#1 ]

View File

@ -10,36 +10,26 @@ main: {
sta SCREEN
lda #' '
sta SCREEN+1
ldy #2
ldx #0
// loop byte
b3:
cpx #0
bne b4
ldx #2
ldy #0
b5:
lda #'0'
sta SCREEN,y
iny
b4:
sta SCREEN,x
inx
cpx #3
b4:
iny
cpy #3
bne b3
lda #' '
sta SCREEN,y
iny
sta SCREEN,x
inx
lda #<0
sta i1
sta i1+1
// loop word
b7:
lda i1+1
cmp #>0
bne b8
lda i1
cmp #<0
bne b8
b9:
lda #'0'
sta SCREEN,y
iny
sta SCREEN,x
inx
b8:
inc i1
bne !+
@ -52,4 +42,18 @@ main: {
cmp #<3
bne b7
rts
// loop word
b7:
lda i1+1
cmp #>0
bne b8
lda i1
cmp #<0
bne b8
jmp b9
// loop byte
b3:
cpy #0
bne b4
jmp b5
}

View File

@ -15,39 +15,39 @@ main::@2: scope:[main] from main
to:main::@1
main::@1: scope:[main] from main::@2
[6] *((const byte*) SCREEN#0+(byte) 1) ← (byte) ' '
to:main::@3
main::@3: scope:[main] from main::@1 main::@4
[7] (byte) main::idx#10 ← phi( main::@1/(byte) 2 main::@4/(byte) main::idx#11 )
[7] (byte) main::i#2 ← phi( main::@1/(byte) 0 main::@4/(byte) main::i#1 )
[8] if((byte) 0!=(byte) main::i#2) goto main::@4
to:main::@5
main::@5: scope:[main] from main::@3
[9] *((const byte*) SCREEN#0 + (byte) main::idx#10) ← (byte) '0'
[10] (byte) main::idx#4 ← ++ (byte) main::idx#10
main::@5: scope:[main] from main::@1 main::@3
[7] (byte) main::idx#18 ← phi( main::@3/(byte) main::idx#4 main::@1/(byte) 2 )
[7] (byte) main::i#6 ← phi( main::@3/(byte) main::i#1 main::@1/(byte) 0 )
[8] *((const byte*) SCREEN#0 + (byte) main::idx#18) ← (byte) '0'
[9] (byte) main::idx#4 ← ++ (byte) main::idx#18
to:main::@4
main::@4: scope:[main] from main::@3 main::@5
[11] (byte) main::idx#11 ← phi( main::@3/(byte) main::idx#10 main::@5/(byte) main::idx#4 )
[12] (byte) main::i#1 ← ++ (byte) main::i#2
[13] if((byte) main::i#1!=(byte) 3) goto main::@3
[10] (byte) main::i#5 ← phi( main::@3/(byte) main::i#1 main::@5/(byte) main::i#6 )
[11] (byte) main::i#1 ← ++ (byte) main::i#5
[12] if((byte) main::i#1!=(byte) 3) goto main::@3
to:main::@6
main::@6: scope:[main] from main::@4
[14] *((const byte*) SCREEN#0 + (byte) main::idx#11) ← (byte) ' '
[15] (byte) main::idx#5 ← ++ (byte) main::idx#11
to:main::@7
main::@7: scope:[main] from main::@6 main::@8
[16] (byte) main::idx#12 ← phi( main::@8/(byte) main::idx#17 main::@6/(byte) main::idx#5 )
[16] (word) main::i1#2 ← phi( main::@8/(word) main::i1#1 main::@6/(word) 0 )
[17] if((byte) 0!=(word) main::i1#2) goto main::@8
[13] *((const byte*) SCREEN#0 + (byte) main::idx#4) ← (byte) ' '
[14] (byte) main::idx#21 ← ++ (byte) main::idx#4
to:main::@9
main::@9: scope:[main] from main::@7
[18] *((const byte*) SCREEN#0 + (byte) main::idx#12) ← (byte) '0'
[19] (byte) main::idx#6 ← ++ (byte) main::idx#12
main::@9: scope:[main] from main::@6 main::@7
[15] (byte) main::idx#20 ← phi( main::@7/(byte) main::idx#6 main::@6/(byte) main::idx#21 )
[15] (word) main::i1#6 ← phi( main::@7/(word) main::i1#1 main::@6/(word) 0 )
[16] *((const byte*) SCREEN#0 + (byte) main::idx#20) ← (byte) '0'
[17] (byte) main::idx#6 ← ++ (byte) main::idx#20
to:main::@8
main::@8: scope:[main] from main::@7 main::@9
[20] (byte) main::idx#17 ← phi( main::@9/(byte) main::idx#6 main::@7/(byte) main::idx#12 )
[21] (word) main::i1#1 ← ++ (word) main::i1#2
[22] if((word) main::i1#1!=(byte) 3) goto main::@7
[18] (word) main::i1#5 ← phi( main::@9/(word) main::i1#6 main::@7/(word) main::i1#1 )
[19] (word) main::i1#1 ← ++ (word) main::i1#5
[20] if((word) main::i1#1!=(byte) 3) goto main::@7
to:main::@return
main::@return: scope:[main] from main::@8
[23] return
[21] return
to:@return
main::@7: scope:[main] from main::@8
[22] if((byte) 0!=(word) main::i1#1) goto main::@8
to:main::@9
main::@3: scope:[main] from main::@4
[23] if((byte) 0!=(byte) main::i#1) goto main::@4
to:main::@5

File diff suppressed because it is too large Load Diff

View File

@ -15,21 +15,21 @@
(label) main::@9
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 6.6000000000000005
(byte) main::i#1 reg byte y 168.33333333333331
(byte) main::i#5 reg byte y 213.0
(byte) main::i#6 reg byte y 37.33333333333333
(word) main::i1
(word) main::i1#1 i1 zp ZP_WORD:2 16.5
(word) main::i1#2 i1 zp ZP_WORD:2 6.6000000000000005
(word) main::i1#1 i1 zp ZP_WORD:2 168.33333333333331
(word) main::i1#5 i1 zp ZP_WORD:2 213.0
(word) main::i1#6 i1 zp ZP_WORD:2 37.33333333333333
(byte) main::idx
(byte) main::idx#10 reg byte y 14.666666666666666
(byte) main::idx#11 reg byte y 9.25
(byte) main::idx#12 reg byte y 15.333333333333332
(byte) main::idx#17 reg byte y 11.0
(byte) main::idx#4 reg byte y 22.0
(byte) main::idx#5 reg byte y 4.0
(byte) main::idx#6 reg byte y 22.0
(byte) main::idx#18 reg byte x 61.5
(byte) main::idx#20 reg byte x 62.5
(byte) main::idx#21 reg byte x 4.0
(byte) main::idx#4 reg byte x 19.33333333333333
(byte) main::idx#6 reg byte x 22.4
reg byte x [ main::i#2 main::i#1 ]
reg byte y [ main::idx#10 main::idx#11 main::idx#4 ]
zp ZP_WORD:2 [ main::i1#2 main::i1#1 ]
reg byte y [ main::idx#12 main::idx#17 main::idx#5 main::idx#6 ]
reg byte x [ main::idx#18 main::idx#4 ]
reg byte y [ main::i#5 main::i#6 main::i#1 ]
reg byte x [ main::idx#20 main::idx#6 main::idx#21 ]
zp ZP_WORD:2 [ main::i1#5 main::i1#6 main::i1#1 ]

View File

@ -7,11 +7,6 @@
main: {
ldx #0
ldy #-2
b1:
cpy #0
bne b2
lda #'0'
jmp b3
b2:
lda #'+'
b3:
@ -21,4 +16,9 @@ main: {
cpy #3
bne b1
rts
b1:
cpy #0
bne b2
lda #'0'
jmp b3
}

View File

@ -9,22 +9,23 @@
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::idx#2 ← phi( main/(byte) 0 main::@3/(byte) main::idx#1 )
[5] (signed byte) main::i#2 ← phi( main/(signed byte) -2 main::@3/(signed byte) main::i#1 )
[6] if((signed byte) 0!=(signed byte) main::i#2) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1
[7] phi()
to:main::@2
main::@2: scope:[main] from main main::@1
[5] (byte) main::idx#7 ← phi( main::@1/(byte) main::idx#1 main/(byte) 0 )
[5] (signed byte) main::i#7 ← phi( main::@1/(signed byte) main::i#1 main/(signed byte) -2 )
to:main::@3
main::@3: scope:[main] from main::@1 main::@2
[8] (byte) main::j#0 ← phi( main::@2/(byte) '+' main::@1/(byte) '0' )
[9] *((const byte*) SCREEN#0 + (byte) main::idx#2) ← (byte) main::j#0
[10] (byte) main::idx#1 ← ++ (byte) main::idx#2
[11] (signed byte) main::i#1 ← ++ (signed byte) main::i#2
[12] if((signed byte) main::i#1!=(signed byte) 3) goto main::@1
[6] (byte) main::idx#6 ← phi( main::@2/(byte) main::idx#7 main::@1/(byte) main::idx#1 )
[6] (signed byte) main::i#6 ← phi( main::@2/(signed byte) main::i#7 main::@1/(signed byte) main::i#1 )
[6] (byte) main::j#0 ← phi( main::@2/(byte) '+' main::@1/(byte) '0' )
[7] *((const byte*) SCREEN#0 + (byte) main::idx#6) ← (byte) main::j#0
[8] (byte) main::idx#1 ← ++ (byte) main::idx#6
[9] (signed byte) main::i#1 ← ++ (signed byte) main::i#6
[10] if((signed byte) main::i#1!=(signed byte) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[13] return
[11] return
to:@return
main::@1: scope:[main] from main::@3
[12] if((signed byte) 0!=(signed byte) main::i#1) goto main::@2
to:main::@3

View File

@ -114,12 +114,93 @@ Constant (const byte) main::$0 = '0'
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [14] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [16] if(main::i#1!=rangelast(-2,2)) goto main::@1 to (number) 3
GRAPH (NEW VERSIONS for main::i#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@4
[0] (byte) main::idx#2 ← phi( main/(const byte) main::idx#0 main::@4/(byte) main::idx#1 )
[0] (signed byte) main::i#2 ← phi( main/(const signed byte) main::i#0 main::@4/(signed byte) main::i#1 )
[1] if((signed byte) 0!=(signed byte) main::i#2) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1
to:main::@4
main::@3: scope:[main] from main::@1
to:main::@4
main::@4: scope:[main] from main::@2 main::@3
[2] (signed byte) main::i#6 ← phi( )
[2] (byte) main::j#0 ← phi( main::@2/(const byte) main::$1 main::@3/(const byte) main::$0 )
[3] *((const byte*) SCREEN#0 + (byte) main::idx#2) ← (byte) main::j#0
[4] (byte) main::idx#1 ← ++ (byte) main::idx#2
[5] (signed byte) main::i#1 ← ++ (signed byte) main::i#6
[6] if((signed byte) main::i#1!=(number) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@4
[7] return
to:@return
@1: scope:[] from @begin
[8] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
GRAPH (NEW VERSIONS for main::idx#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@4
[0] (byte) main::idx#2 ← phi( main/(const byte) main::idx#0 main::@4/(byte) main::idx#1 )
[0] (signed byte) main::i#2 ← phi( main/(const signed byte) main::i#0 main::@4/(signed byte) main::i#1 )
[1] if((signed byte) 0!=(signed byte) main::i#2) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1
(signed byte) main::i#7 ← phi( main::@1/(signed byte) main::i#2 )
to:main::@4
main::@3: scope:[main] from main::@1
(signed byte) main::i#8 ← phi( main::@1/(signed byte) main::i#2 )
to:main::@4
main::@4: scope:[main] from main::@2 main::@3
[2] (byte) main::idx#6 ← phi( )
[2] (signed byte) main::i#6 ← phi( main::@2/(signed byte) main::i#7 main::@3/(signed byte) main::i#8 )
[2] (byte) main::j#0 ← phi( main::@2/(const byte) main::$1 main::@3/(const byte) main::$0 )
[3] *((const byte*) SCREEN#0 + (byte) main::idx#6) ← (byte) main::j#0
[4] (byte) main::idx#1 ← ++ (byte) main::idx#6
[5] (signed byte) main::i#1 ← ++ (signed byte) main::i#6
[6] if((signed byte) main::i#1!=(number) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@4
[7] return
to:@return
@1: scope:[] from @begin
[8] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Successful SSA optimization Pass2LoopHeadConstantIdentification
Adding number conversion cast (snumber) 3 in if((signed byte) main::i#1!=(number) 3) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized signed number type (signed byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (signed byte) main::i#1 = (signed byte) main::i#2
Alias (byte) main::idx#1 = (byte) main::idx#2
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (signed byte) main::i#9 (const signed byte) main::i#0
Identical Phi Values (byte) main::idx#9 (const byte) main::idx#0
Successful SSA optimization Pass2IdenticalPhiElimination
Removing PHI-reference to removed block (main::@1_1) in block main::@3
Removing PHI-reference to removed block (main::@1_1) in block main::@3
if() condition always true - replacing block destination [12] if((signed byte) 0!=(const signed byte) main::i#0) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Alias (signed byte) main::i#1 = (signed byte) main::i#8
Alias (byte) main::idx#1 = (byte) main::idx#8
Successful SSA optimization Pass2AliasElimination
Inlining constant with var siblings (const byte) main::idx#0
Inlining constant with var siblings (const signed byte) main::i#0
Constant inlined main::i#0 = (signed byte) -2
@ -127,22 +208,26 @@ Constant inlined main::idx#0 = (byte) 0
Constant inlined main::$1 = (byte) '+'
Constant inlined main::$0 = (byte) '0'
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@8(between main::@4 and main::@1)
Added new block during phi lifting main::@8(between main::@1 and main::@2)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@3
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of main::@1_1
CALL GRAPH
Calls in [] to main:2
Created 3 initial phi equivalence classes
Coalesced [15] main::i#6 ← main::i#1
Coalesced [16] main::idx#6 ← main::idx#1
Created 5 initial phi equivalence classes
Coalesced [8] main::i#11 ← main::i#7
Coalesced [9] main::idx#11 ← main::idx#7
Coalesced [17] main::i#12 ← main::i#1
Coalesced [18] main::idx#12 ← main::idx#1
Coalesced (already) [19] main::i#10 ← main::i#1
Coalesced (already) [20] main::idx#10 ← main::idx#1
Coalesced down to 3 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@1_1
Culled Empty Block (label) main::@3
Culled Empty Block (label) main::@8
Renumbering block main::@4 to main::@3
@ -150,7 +235,6 @@ Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@2
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
@ -164,50 +248,53 @@ FINAL CONTROL FLOW GRAPH
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::idx#2 ← phi( main/(byte) 0 main::@3/(byte) main::idx#1 )
[5] (signed byte) main::i#2 ← phi( main/(signed byte) -2 main::@3/(signed byte) main::i#1 )
[6] if((signed byte) 0!=(signed byte) main::i#2) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1
[7] phi()
to:main::@2
main::@2: scope:[main] from main main::@1
[5] (byte) main::idx#7 ← phi( main::@1/(byte) main::idx#1 main/(byte) 0 )
[5] (signed byte) main::i#7 ← phi( main::@1/(signed byte) main::i#1 main/(signed byte) -2 )
to:main::@3
main::@3: scope:[main] from main::@1 main::@2
[8] (byte) main::j#0 ← phi( main::@2/(byte) '+' main::@1/(byte) '0' )
[9] *((const byte*) SCREEN#0 + (byte) main::idx#2) ← (byte) main::j#0
[10] (byte) main::idx#1 ← ++ (byte) main::idx#2
[11] (signed byte) main::i#1 ← ++ (signed byte) main::i#2
[12] if((signed byte) main::i#1!=(signed byte) 3) goto main::@1
[6] (byte) main::idx#6 ← phi( main::@2/(byte) main::idx#7 main::@1/(byte) main::idx#1 )
[6] (signed byte) main::i#6 ← phi( main::@2/(signed byte) main::i#7 main::@1/(signed byte) main::i#1 )
[6] (byte) main::j#0 ← phi( main::@2/(byte) '+' main::@1/(byte) '0' )
[7] *((const byte*) SCREEN#0 + (byte) main::idx#6) ← (byte) main::j#0
[8] (byte) main::idx#1 ← ++ (byte) main::idx#6
[9] (signed byte) main::i#1 ← ++ (signed byte) main::i#6
[10] if((signed byte) main::i#1!=(signed byte) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[13] return
[11] return
to:@return
main::@1: scope:[main] from main::@3
[12] if((signed byte) 0!=(signed byte) main::i#1) goto main::@2
to:main::@3
VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) main()
(signed byte) main::i
(signed byte) main::i#1 16.5
(signed byte) main::i#2 5.5
(signed byte) main::i#1 168.33333333333331
(signed byte) main::i#6 71.0
(signed byte) main::i#7 112.0
(byte) main::idx
(byte) main::idx#1 7.333333333333333
(byte) main::idx#2 6.6000000000000005
(byte) main::idx#1 75.75
(byte) main::idx#6 157.0
(byte) main::idx#7 112.0
(byte) main::j
(byte) main::j#0 11.0
(byte) main::j#0 101.0
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::idx#2 main::idx#1 ]
[ main::j#0 ]
[ main::i#6 main::i#7 main::i#1 ]
[ main::idx#6 main::idx#7 main::idx#1 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::idx#2 main::idx#1 ]
[ main::j#0 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::idx#2 main::idx#1 ]
Allocated zp ZP_BYTE:4 [ main::j#0 ]
[ main::i#6 main::i#7 main::i#1 ]
[ main::idx#6 main::idx#7 main::idx#1 ]
Allocated zp ZP_BYTE:2 [ main::j#0 ]
Allocated zp ZP_BYTE:3 [ main::i#6 main::i#7 main::i#1 ]
Allocated zp ZP_BYTE:4 [ main::idx#6 main::idx#7 main::idx#1 ]
INITIAL ASM
Target platform is c64basic
@ -238,79 +325,80 @@ bend_from_b1:
bend:
// main
main: {
.label j = 4
.label idx = 3
.label i = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::idx#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
.label j = 2
.label idx = 4
.label i = 3
// [5] phi from main to main::@2 [phi:main->main::@2]
b2_from_main:
// [5] phi (byte) main::idx#7 = (byte) 0 [phi:main->main::@2#0] -- vbuz1=vbuc1
lda #0
sta idx
// [5] phi (signed byte) main::i#2 = (signed byte) -2 [phi:main->main::@1#1] -- vbsz1=vbsc1
// [5] phi (signed byte) main::i#7 = (signed byte) -2 [phi:main->main::@2#1] -- vbsz1=vbsc1
lda #-2
sta i
jmp b1
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
// [5] phi (byte) main::idx#2 = (byte) main::idx#1 [phi:main::@3->main::@1#0] -- register_copy
// [5] phi (signed byte) main::i#2 = (signed byte) main::i#1 [phi:main::@3->main::@1#1] -- register_copy
jmp b1
// main::@1
b1:
// [6] if((signed byte) 0!=(signed byte) main::i#2) goto main::@2 -- vbsc1_neq_vbsz1_then_la1
lda #0
cmp i
bne b2_from_b1
// [8] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
b3_from_b1:
// [8] phi (byte) main::j#0 = (byte) '0' [phi:main::@1->main::@3#0] -- vbuz1=vbuc1
lda #'0'
sta j
jmp b3
// [7] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
jmp b2
// [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
// [5] phi (byte) main::idx#7 = (byte) main::idx#1 [phi:main::@1->main::@2#0] -- register_copy
// [5] phi (signed byte) main::i#7 = (signed byte) main::i#1 [phi:main::@1->main::@2#1] -- register_copy
jmp b2
// main::@2
b2:
// [8] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
// [6] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
b3_from_b2:
// [8] phi (byte) main::j#0 = (byte) '+' [phi:main::@2->main::@3#0] -- vbuz1=vbuc1
// [6] phi (byte) main::idx#6 = (byte) main::idx#7 [phi:main::@2->main::@3#0] -- register_copy
// [6] phi (signed byte) main::i#6 = (signed byte) main::i#7 [phi:main::@2->main::@3#1] -- register_copy
// [6] phi (byte) main::j#0 = (byte) '+' [phi:main::@2->main::@3#2] -- vbuz1=vbuc1
lda #'+'
sta j
jmp b3
// main::@3
b3:
// [9] *((const byte*) SCREEN#0 + (byte) main::idx#2) ← (byte) main::j#0 -- pbuc1_derefidx_vbuz1=vbuz2
// [7] *((const byte*) SCREEN#0 + (byte) main::idx#6) ← (byte) main::j#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda j
ldy idx
sta SCREEN,y
// [10] (byte) main::idx#1 ← ++ (byte) main::idx#2 -- vbuz1=_inc_vbuz1
// [8] (byte) main::idx#1 ← ++ (byte) main::idx#6 -- vbuz1=_inc_vbuz1
inc idx
// [11] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 -- vbsz1=_inc_vbsz1
// [9] (signed byte) main::i#1 ← ++ (signed byte) main::i#6 -- vbsz1=_inc_vbsz1
inc i
// [12] if((signed byte) main::i#1!=(signed byte) 3) goto main::@1 -- vbsz1_neq_vbsc1_then_la1
// [10] if((signed byte) main::i#1!=(signed byte) 3) goto main::@1 -- vbsz1_neq_vbsc1_then_la1
lda #3
cmp i
bne b1_from_b3
bne b1
jmp breturn
// main::@return
breturn:
// [13] return
// [11] return
rts
// main::@1
b1:
// [12] if((signed byte) 0!=(signed byte) main::i#1) goto main::@2 -- vbsc1_neq_vbsz1_then_la1
lda #0
cmp i
bne b2_from_b1
// [6] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
b3_from_b1:
// [6] phi (byte) main::idx#6 = (byte) main::idx#1 [phi:main::@1->main::@3#0] -- register_copy
// [6] phi (signed byte) main::i#6 = (signed byte) main::i#1 [phi:main::@1->main::@3#1] -- register_copy
// [6] phi (byte) main::j#0 = (byte) '0' [phi:main::@1->main::@3#2] -- vbuz1=vbuc1
lda #'0'
sta j
jmp b3
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::idx#2 main::idx#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::j#0 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:2 [ main::j#0 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::i#6 main::i#7 main::i#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::idx#6 main::idx#7 main::idx#1 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 22: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 13.93: zp ZP_BYTE:3 [ main::idx#2 main::idx#1 ] 11: zp ZP_BYTE:4 [ main::j#0 ]
Uplift Scope [main] 351.33: zp ZP_BYTE:3 [ main::i#6 main::i#7 main::i#1 ] 344.75: zp ZP_BYTE:4 [ main::idx#6 main::idx#7 main::idx#1 ] 101: zp ZP_BYTE:2 [ main::j#0 ]
Uplift Scope []
Uplifting [main] best 458 combination reg byte y [ main::i#2 main::i#1 ] reg byte x [ main::idx#2 main::idx#1 ] reg byte a [ main::j#0 ]
Uplifting [] best 458 combination
Uplifting [main] best 3218 combination reg byte y [ main::i#6 main::i#7 main::i#1 ] reg byte x [ main::idx#6 main::idx#7 main::idx#1 ] reg byte a [ main::j#0 ]
Uplifting [] best 3218 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -340,84 +428,82 @@ bend_from_b1:
bend:
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::idx#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
// [5] phi from main to main::@2 [phi:main->main::@2]
b2_from_main:
// [5] phi (byte) main::idx#7 = (byte) 0 [phi:main->main::@2#0] -- vbuxx=vbuc1
ldx #0
// [5] phi (signed byte) main::i#2 = (signed byte) -2 [phi:main->main::@1#1] -- vbsyy=vbsc1
// [5] phi (signed byte) main::i#7 = (signed byte) -2 [phi:main->main::@2#1] -- vbsyy=vbsc1
ldy #-2
jmp b1
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
// [5] phi (byte) main::idx#2 = (byte) main::idx#1 [phi:main::@3->main::@1#0] -- register_copy
// [5] phi (signed byte) main::i#2 = (signed byte) main::i#1 [phi:main::@3->main::@1#1] -- register_copy
jmp b1
// main::@1
b1:
// [6] if((signed byte) 0!=(signed byte) main::i#2) goto main::@2 -- vbsc1_neq_vbsyy_then_la1
cpy #0
bne b2_from_b1
// [8] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
b3_from_b1:
// [8] phi (byte) main::j#0 = (byte) '0' [phi:main::@1->main::@3#0] -- vbuaa=vbuc1
lda #'0'
jmp b3
// [7] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
jmp b2
// [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
// [5] phi (byte) main::idx#7 = (byte) main::idx#1 [phi:main::@1->main::@2#0] -- register_copy
// [5] phi (signed byte) main::i#7 = (signed byte) main::i#1 [phi:main::@1->main::@2#1] -- register_copy
jmp b2
// main::@2
b2:
// [8] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
// [6] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
b3_from_b2:
// [8] phi (byte) main::j#0 = (byte) '+' [phi:main::@2->main::@3#0] -- vbuaa=vbuc1
// [6] phi (byte) main::idx#6 = (byte) main::idx#7 [phi:main::@2->main::@3#0] -- register_copy
// [6] phi (signed byte) main::i#6 = (signed byte) main::i#7 [phi:main::@2->main::@3#1] -- register_copy
// [6] phi (byte) main::j#0 = (byte) '+' [phi:main::@2->main::@3#2] -- vbuaa=vbuc1
lda #'+'
jmp b3
// main::@3
b3:
// [9] *((const byte*) SCREEN#0 + (byte) main::idx#2) ← (byte) main::j#0 -- pbuc1_derefidx_vbuxx=vbuaa
// [7] *((const byte*) SCREEN#0 + (byte) main::idx#6) ← (byte) main::j#0 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
// [10] (byte) main::idx#1 ← ++ (byte) main::idx#2 -- vbuxx=_inc_vbuxx
// [8] (byte) main::idx#1 ← ++ (byte) main::idx#6 -- vbuxx=_inc_vbuxx
inx
// [11] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 -- vbsyy=_inc_vbsyy
// [9] (signed byte) main::i#1 ← ++ (signed byte) main::i#6 -- vbsyy=_inc_vbsyy
iny
// [12] if((signed byte) main::i#1!=(signed byte) 3) goto main::@1 -- vbsyy_neq_vbsc1_then_la1
// [10] if((signed byte) main::i#1!=(signed byte) 3) goto main::@1 -- vbsyy_neq_vbsc1_then_la1
cpy #3
bne b1_from_b3
bne b1
jmp breturn
// main::@return
breturn:
// [13] return
// [11] return
rts
// main::@1
b1:
// [12] if((signed byte) 0!=(signed byte) main::i#1) goto main::@2 -- vbsc1_neq_vbsyy_then_la1
cpy #0
bne b2_from_b1
// [6] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
b3_from_b1:
// [6] phi (byte) main::idx#6 = (byte) main::idx#1 [phi:main::@1->main::@3#0] -- register_copy
// [6] phi (signed byte) main::i#6 = (signed byte) main::i#1 [phi:main::@1->main::@3#1] -- register_copy
// [6] phi (byte) main::j#0 = (byte) '0' [phi:main::@1->main::@3#2] -- vbuaa=vbuc1
lda #'0'
jmp b3
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b3
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b2_from_b1 with b2
Replacing label b1_from_b3 with b1
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_b3:
Removing instruction b2_from_b1:
Removing instruction b3_from_b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b3_from_b1:
Removing instruction b2_from_main:
Removing instruction breturn:
Removing instruction b3_from_b1:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b1
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
@ -434,21 +520,23 @@ FINAL SYMBOL TABLE
(label) main::@3
(label) main::@return
(signed byte) main::i
(signed byte) main::i#1 reg byte y 16.5
(signed byte) main::i#2 reg byte y 5.5
(signed byte) main::i#1 reg byte y 168.33333333333331
(signed byte) main::i#6 reg byte y 71.0
(signed byte) main::i#7 reg byte y 112.0
(byte) main::idx
(byte) main::idx#1 reg byte x 7.333333333333333
(byte) main::idx#2 reg byte x 6.6000000000000005
(byte) main::idx#1 reg byte x 75.75
(byte) main::idx#6 reg byte x 157.0
(byte) main::idx#7 reg byte x 112.0
(byte) main::j
(byte) main::j#0 reg byte a 11.0
(byte) main::j#0 reg byte a 101.0
reg byte y [ main::i#2 main::i#1 ]
reg byte x [ main::idx#2 main::idx#1 ]
reg byte a [ main::j#0 ]
reg byte y [ main::i#6 main::i#7 main::i#1 ]
reg byte x [ main::idx#6 main::idx#7 main::idx#1 ]
FINAL ASSEMBLER
Score: 296
Score: 2546
// File Comments
// Tests using integer conditions in ternary operator
@ -468,48 +556,51 @@ Score: 296
// @end
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::idx#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
// [5] phi from main to main::@2 [phi:main->main::@2]
// [5] phi (byte) main::idx#7 = (byte) 0 [phi:main->main::@2#0] -- vbuxx=vbuc1
ldx #0
// [5] phi (signed byte) main::i#2 = (signed byte) -2 [phi:main->main::@1#1] -- vbsyy=vbsc1
// [5] phi (signed byte) main::i#7 = (signed byte) -2 [phi:main->main::@2#1] -- vbsyy=vbsc1
ldy #-2
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
// [5] phi (byte) main::idx#2 = (byte) main::idx#1 [phi:main::@3->main::@1#0] -- register_copy
// [5] phi (signed byte) main::i#2 = (signed byte) main::i#1 [phi:main::@3->main::@1#1] -- register_copy
// main::@1
b1:
// i?'+':'0'
// [6] if((signed byte) 0!=(signed byte) main::i#2) goto main::@2 -- vbsc1_neq_vbsyy_then_la1
cpy #0
bne b2
// [8] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
// [8] phi (byte) main::j#0 = (byte) '0' [phi:main::@1->main::@3#0] -- vbuaa=vbuc1
lda #'0'
jmp b3
// [7] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
// [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
// [5] phi (byte) main::idx#7 = (byte) main::idx#1 [phi:main::@1->main::@2#0] -- register_copy
// [5] phi (signed byte) main::i#7 = (signed byte) main::i#1 [phi:main::@1->main::@2#1] -- register_copy
// main::@2
b2:
// [8] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
// [8] phi (byte) main::j#0 = (byte) '+' [phi:main::@2->main::@3#0] -- vbuaa=vbuc1
// [6] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
// [6] phi (byte) main::idx#6 = (byte) main::idx#7 [phi:main::@2->main::@3#0] -- register_copy
// [6] phi (signed byte) main::i#6 = (signed byte) main::i#7 [phi:main::@2->main::@3#1] -- register_copy
// [6] phi (byte) main::j#0 = (byte) '+' [phi:main::@2->main::@3#2] -- vbuaa=vbuc1
lda #'+'
// main::@3
b3:
// SCREEN[idx++] = j
// [9] *((const byte*) SCREEN#0 + (byte) main::idx#2) ← (byte) main::j#0 -- pbuc1_derefidx_vbuxx=vbuaa
// [7] *((const byte*) SCREEN#0 + (byte) main::idx#6) ← (byte) main::j#0 -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
// SCREEN[idx++] = j;
// [10] (byte) main::idx#1 ← ++ (byte) main::idx#2 -- vbuxx=_inc_vbuxx
// [8] (byte) main::idx#1 ← ++ (byte) main::idx#6 -- vbuxx=_inc_vbuxx
inx
// for( signed byte i: -2..2)
// [11] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 -- vbsyy=_inc_vbsyy
// [9] (signed byte) main::i#1 ← ++ (signed byte) main::i#6 -- vbsyy=_inc_vbsyy
iny
// [12] if((signed byte) main::i#1!=(signed byte) 3) goto main::@1 -- vbsyy_neq_vbsc1_then_la1
// [10] if((signed byte) main::i#1!=(signed byte) 3) goto main::@1 -- vbsyy_neq_vbsc1_then_la1
cpy #3
bne b1
// main::@return
// }
// [13] return
// [11] return
rts
// main::@1
b1:
// i?'+':'0'
// [12] if((signed byte) 0!=(signed byte) main::i#1) goto main::@2 -- vbsc1_neq_vbsyy_then_la1
cpy #0
bne b2
// [6] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
// [6] phi (byte) main::idx#6 = (byte) main::idx#1 [phi:main::@1->main::@3#0] -- register_copy
// [6] phi (signed byte) main::i#6 = (signed byte) main::i#1 [phi:main::@1->main::@3#1] -- register_copy
// [6] phi (byte) main::j#0 = (byte) '0' [phi:main::@1->main::@3#2] -- vbuaa=vbuc1
lda #'0'
jmp b3
}
// File Data

View File

@ -9,14 +9,16 @@
(label) main::@3
(label) main::@return
(signed byte) main::i
(signed byte) main::i#1 reg byte y 16.5
(signed byte) main::i#2 reg byte y 5.5
(signed byte) main::i#1 reg byte y 168.33333333333331
(signed byte) main::i#6 reg byte y 71.0
(signed byte) main::i#7 reg byte y 112.0
(byte) main::idx
(byte) main::idx#1 reg byte x 7.333333333333333
(byte) main::idx#2 reg byte x 6.6000000000000005
(byte) main::idx#1 reg byte x 75.75
(byte) main::idx#6 reg byte x 157.0
(byte) main::idx#7 reg byte x 112.0
(byte) main::j
(byte) main::j#0 reg byte a 11.0
(byte) main::j#0 reg byte a 101.0
reg byte y [ main::i#2 main::i#1 ]
reg byte x [ main::idx#2 main::idx#1 ]
reg byte a [ main::j#0 ]
reg byte y [ main::i#6 main::i#7 main::i#1 ]
reg byte x [ main::idx#6 main::idx#7 main::idx#1 ]

View File

@ -9,6 +9,12 @@ main: {
ldx #2
lda #$80
sta a
b4:
txa
eor #$ff
sec
adc a
sta a
b1:
cpx a
bne b2
@ -23,11 +29,4 @@ main: {
sbc a
tax
jmp b1
b4:
txa
eor #$ff
sec
adc a
sta a
jmp b1
}

View File

@ -9,24 +9,25 @@
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@4
main::@4: scope:[main] from main main::@2
[5] (byte) main::b#10 ← phi( main::@2/(byte) main::b#11 main/(byte) 2 )
[5] (byte) main::a#13 ← phi( main::@2/(byte) main::a#1 main/(byte) $80 )
[6] (byte) main::a#1 ← (byte) main::a#13 - (byte) main::b#10
to:main::@1
main::@1: scope:[main] from main main::@4 main::@5
[5] (byte) main::b#2 ← phi( main/(byte) 2 main::@4/(byte) main::b#2 main::@5/(byte) main::b#1 )
[5] (byte) main::a#2 ← phi( main/(byte) $80 main::@4/(byte) main::a#1 main::@5/(byte) main::a#2 )
[6] if((byte) main::a#2!=(byte) main::b#2) goto main::@2
main::@1: scope:[main] from main::@4 main::@5
[7] (byte) main::b#11 ← phi( main::@4/(byte) main::b#10 main::@5/(byte) main::b#1 )
[8] if((byte) main::a#1!=(byte) main::b#11) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[7] *((const byte*) SCREEN#0) ← (byte) main::a#2
[9] *((const byte*) SCREEN#0) ← (byte) main::a#1
to:main::@return
main::@return: scope:[main] from main::@3
[8] return
[10] return
to:@return
main::@2: scope:[main] from main::@1
[9] if((byte) main::a#2>(byte) main::b#2) goto main::@4
[11] if((byte) main::a#1>(byte) main::b#11) goto main::@4
to:main::@5
main::@5: scope:[main] from main::@2
[10] (byte) main::b#1 ← (byte) main::b#2 - (byte) main::a#2
to:main::@1
main::@4: scope:[main] from main::@2
[11] (byte) main::a#1 ← (byte) main::a#2 - (byte) main::b#2
[12] (byte) main::b#1 ← (byte) main::b#11 - (byte) main::a#1
to:main::@1

View File

@ -111,26 +111,213 @@ Constant (const byte*) SCREEN#0 = (byte*) 1024
Constant (const byte) main::a#0 = $80
Constant (const byte) main::b#0 = 2
Successful SSA optimization Pass2ConstantIdentification
GRAPH (NEW VERSIONS for main::a#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@4 main::@8
[0] (byte) main::b#2 ← phi( main/(const byte) main::b#0 main::@4/(byte) main::b#2 main::@8/(byte) main::b#1 )
[0] (byte) main::a#2 ← phi( main/(const byte) main::a#0 main::@4/(byte) main::a#1 main::@8/(byte) main::a#7 )
[1] if((byte) main::a#2!=(byte) main::b#2) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1
(byte) main::a#8 ← phi( )
[2] if((byte) main::a#8>(byte) main::b#2) goto main::@4
to:main::@8
main::@3: scope:[main] from main::@1
(byte) main::a#9 ← phi( )
[3] *((const byte*) SCREEN#0) ← (byte) main::a#9
to:main::@return
main::@4: scope:[main] from main::@2
(byte) main::a#10 ← phi( )
[4] (byte) main::a#1 ← (byte) main::a#10 - (byte) main::b#2
to:main::@1
main::@8: scope:[main] from main::@2
(byte) main::a#7 ← phi( )
[5] (byte) main::b#1 ← (byte) main::b#2 - (byte) main::a#7
to:main::@1
main::@return: scope:[main] from main::@3
[6] return
to:@return
@1: scope:[] from @begin
[7] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
GRAPH (NEW VERSIONS for main::b#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@4 main::@8
[0] (byte) main::b#2 ← phi( main/(const byte) main::b#0 main::@4/(byte) main::b#6 main::@8/(byte) main::b#1 )
[0] (byte) main::a#2 ← phi( main/(const byte) main::a#0 main::@4/(byte) main::a#1 main::@8/(byte) main::a#7 )
[1] if((byte) main::a#2!=(byte) main::b#2) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1
(byte) main::b#7 ← phi( )
(byte) main::a#8 ← phi( main::@1/(byte) main::a#2 )
[2] if((byte) main::a#8>(byte) main::b#7) goto main::@4
to:main::@8
main::@3: scope:[main] from main::@1
(byte) main::a#9 ← phi( main::@1/(byte) main::a#2 )
[3] *((const byte*) SCREEN#0) ← (byte) main::a#9
to:main::@return
main::@4: scope:[main] from main::@2
(byte) main::b#6 ← phi( )
(byte) main::a#10 ← phi( main::@2/(byte) main::a#8 )
[4] (byte) main::a#1 ← (byte) main::a#10 - (byte) main::b#6
to:main::@1
main::@8: scope:[main] from main::@2
(byte) main::b#8 ← phi( )
(byte) main::a#7 ← phi( main::@2/(byte) main::a#8 )
[5] (byte) main::b#1 ← (byte) main::b#8 - (byte) main::a#7
to:main::@1
main::@return: scope:[main] from main::@3
[6] return
to:@return
@1: scope:[] from @begin
[7] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Successful SSA optimization Pass2LoopHeadConstantIdentification
Alias (byte) main::a#10 = (byte) main::a#8 (byte) main::a#7
Alias (byte) main::b#6 = (byte) main::b#7 (byte) main::b#8
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::a#11 (const byte) main::a#0
Identical Phi Values (byte) main::b#9 (const byte) main::b#0
Successful SSA optimization Pass2IdenticalPhiElimination
Removing PHI-reference to removed block (main::@1_1) in block main::@3
if() condition always true - replacing block destination [13] if((const byte) main::a#0!=(const byte) main::b#0) goto main::@2
Successful SSA optimization Pass2ConstantIfs
GRAPH (NEW VERSIONS for main::a#10)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1_1
main::@1: scope:[main] from main::@4 main::@8
[0] (byte) main::b#2 ← phi( main::@4/(byte) main::b#6 main::@8/(byte) main::b#1 )
[0] (byte) main::a#2 ← phi( main::@4/(byte) main::a#1 main::@8/(byte) main::a#12 )
[1] if((byte) main::a#2!=(byte) main::b#2) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1 main::@1_1
[2] (byte) main::b#6 ← phi( main::@1/(byte) main::b#2 main::@1_1/(const byte) main::b#0 )
[2] (byte) main::a#10 ← phi( main::@1/(byte) main::a#2 main::@1_1/(const byte) main::a#0 )
[3] if((byte) main::a#10>(byte) main::b#6) goto main::@4
to:main::@8
main::@3: scope:[main] from main::@1
[4] (byte) main::a#9 ← phi( main::@1/(byte) main::a#2 )
[5] *((const byte*) SCREEN#0) ← (byte) main::a#9
to:main::@return
main::@4: scope:[main] from main::@2
(byte) main::a#13 ← phi( )
[6] (byte) main::a#1 ← (byte) main::a#13 - (byte) main::b#6
to:main::@1
main::@8: scope:[main] from main::@2
(byte) main::a#12 ← phi( )
[7] (byte) main::b#1 ← (byte) main::b#6 - (byte) main::a#12
to:main::@1
main::@return: scope:[main] from main::@3
[8] return
to:@return
@1: scope:[] from @begin
[9] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
main::@1_1: scope:[main] from main
to:main::@2
GRAPH (NEW VERSIONS for main::b#6)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1_1
main::@1: scope:[main] from main::@4 main::@8
[0] (byte) main::b#2 ← phi( main::@4/(byte) main::b#10 main::@8/(byte) main::b#1 )
[0] (byte) main::a#2 ← phi( main::@4/(byte) main::a#1 main::@8/(byte) main::a#12 )
[1] if((byte) main::a#2!=(byte) main::b#2) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1 main::@1_1
[2] (byte) main::b#6 ← phi( main::@1/(byte) main::b#2 main::@1_1/(const byte) main::b#0 )
[2] (byte) main::a#10 ← phi( main::@1/(byte) main::a#2 main::@1_1/(const byte) main::a#0 )
[3] if((byte) main::a#10>(byte) main::b#6) goto main::@4
to:main::@8
main::@3: scope:[main] from main::@1
[4] (byte) main::a#9 ← phi( main::@1/(byte) main::a#2 )
[5] *((const byte*) SCREEN#0) ← (byte) main::a#9
to:main::@return
main::@4: scope:[main] from main::@2
(byte) main::b#10 ← phi( )
(byte) main::a#13 ← phi( main::@2/(byte) main::a#10 )
[6] (byte) main::a#1 ← (byte) main::a#13 - (byte) main::b#10
to:main::@1
main::@8: scope:[main] from main::@2
(byte) main::b#11 ← phi( )
(byte) main::a#12 ← phi( main::@2/(byte) main::a#10 )
[7] (byte) main::b#1 ← (byte) main::b#11 - (byte) main::a#12
to:main::@1
main::@return: scope:[main] from main::@3
[8] return
to:@return
@1: scope:[] from @begin
[9] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
main::@1_1: scope:[main] from main
to:main::@2
Successful SSA optimization Pass2LoopHeadConstantIdentification
Alias (byte) main::a#10 = (byte) main::a#2 (byte) main::a#9
Alias (byte) main::b#2 = (byte) main::b#6
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::a#14 (const byte) main::a#0
Identical Phi Values (byte) main::b#12 (const byte) main::b#0
Successful SSA optimization Pass2IdenticalPhiElimination
Removing PHI-reference to removed block (main::@2_1) in block main::@8
Removing PHI-reference to removed block (main::@2_1) in block main::@8
if() condition always true - replacing block destination [13] if((const byte) main::a#0>(const byte) main::b#0) goto main::@4
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::a#10 = (byte) main::a#12
Alias (byte) main::b#11 = (byte) main::b#2
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::a#10 (byte) main::a#1
Successful SSA optimization Pass2IdenticalPhiElimination
Inlining constant with var siblings (const byte) main::a#0
Inlining constant with var siblings (const byte) main::b#0
Constant inlined main::a#0 = (byte) $80
Constant inlined main::b#0 = (byte) 2
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@11(between main::@2 and main::@4)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1_1
Adding NOP phi() at start of main::@2_1
CALL GRAPH
Calls in [] to main:2
Created 2 initial phi equivalence classes
Coalesced (already) [12] main::a#8 ← main::a#2
Coalesced [13] main::b#7 ← main::b#1
Coalesced [15] main::a#7 ← main::a#1
Coalesced (already) [16] main::b#6 ← main::b#2
Created 3 initial phi equivalence classes
Coalesced [10] main::b#13 ← main::b#10
Coalesced [17] main::b#14 ← main::b#1
Coalesced [18] main::a#15 ← main::a#1
Coalesced (already) [19] main::b#15 ← main::b#11
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@1_1
Culled Empty Block (label) main::@2_1
Culled Empty Block (label) main::@11
Renumbering block main::@8 to main::@5
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
@ -149,26 +336,27 @@ FINAL CONTROL FLOW GRAPH
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@4
main::@4: scope:[main] from main main::@2
[5] (byte) main::b#10 ← phi( main::@2/(byte) main::b#11 main/(byte) 2 )
[5] (byte) main::a#13 ← phi( main::@2/(byte) main::a#1 main/(byte) $80 )
[6] (byte) main::a#1 ← (byte) main::a#13 - (byte) main::b#10
to:main::@1
main::@1: scope:[main] from main main::@4 main::@5
[5] (byte) main::b#2 ← phi( main/(byte) 2 main::@4/(byte) main::b#2 main::@5/(byte) main::b#1 )
[5] (byte) main::a#2 ← phi( main/(byte) $80 main::@4/(byte) main::a#1 main::@5/(byte) main::a#2 )
[6] if((byte) main::a#2!=(byte) main::b#2) goto main::@2
main::@1: scope:[main] from main::@4 main::@5
[7] (byte) main::b#11 ← phi( main::@4/(byte) main::b#10 main::@5/(byte) main::b#1 )
[8] if((byte) main::a#1!=(byte) main::b#11) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[7] *((const byte*) SCREEN#0) ← (byte) main::a#2
[9] *((const byte*) SCREEN#0) ← (byte) main::a#1
to:main::@return
main::@return: scope:[main] from main::@3
[8] return
[10] return
to:@return
main::@2: scope:[main] from main::@1
[9] if((byte) main::a#2>(byte) main::b#2) goto main::@4
[11] if((byte) main::a#1>(byte) main::b#11) goto main::@4
to:main::@5
main::@5: scope:[main] from main::@2
[10] (byte) main::b#1 ← (byte) main::b#2 - (byte) main::a#2
to:main::@1
main::@4: scope:[main] from main::@2
[11] (byte) main::a#1 ← (byte) main::a#2 - (byte) main::b#2
[12] (byte) main::b#1 ← (byte) main::b#11 - (byte) main::a#1
to:main::@1
@ -176,20 +364,21 @@ VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) main()
(byte) main::a
(byte) main::a#1 22.0
(byte) main::a#2 19.75
(byte) main::a#1 83.39999999999999
(byte) main::a#13 112.0
(byte) main::b
(byte) main::b#1 22.0
(byte) main::b#2 19.25
(byte) main::b#1 202.0
(byte) main::b#10 61.5
(byte) main::b#11 171.99999999999997
Initial phi equivalence classes
[ main::a#2 main::a#1 ]
[ main::b#2 main::b#1 ]
[ main::a#13 main::a#1 ]
[ main::b#10 main::b#11 main::b#1 ]
Complete equivalence classes
[ main::a#2 main::a#1 ]
[ main::b#2 main::b#1 ]
Allocated zp ZP_BYTE:2 [ main::a#2 main::a#1 ]
Allocated zp ZP_BYTE:3 [ main::b#2 main::b#1 ]
[ main::a#13 main::a#1 ]
[ main::b#10 main::b#11 main::b#1 ]
Allocated zp ZP_BYTE:2 [ main::a#13 main::a#1 ]
Allocated zp ZP_BYTE:3 [ main::b#10 main::b#11 main::b#1 ]
INITIAL ASM
Target platform is c64basic
@ -222,81 +411,85 @@ bend:
main: {
.label a = 2
.label b = 3
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::b#2 = (byte) 2 [phi:main->main::@1#0] -- vbuz1=vbuc1
// [5] phi from main to main::@4 [phi:main->main::@4]
b4_from_main:
// [5] phi (byte) main::b#10 = (byte) 2 [phi:main->main::@4#0] -- vbuz1=vbuc1
lda #2
sta b
// [5] phi (byte) main::a#2 = (byte) $80 [phi:main->main::@1#1] -- vbuz1=vbuc1
// [5] phi (byte) main::a#13 = (byte) $80 [phi:main->main::@4#1] -- vbuz1=vbuc1
lda #$80
sta a
jmp b4
// [5] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
b4_from_b2:
// [5] phi (byte) main::b#10 = (byte) main::b#11 [phi:main::@2->main::@4#0] -- register_copy
// [5] phi (byte) main::a#13 = (byte) main::a#1 [phi:main::@2->main::@4#1] -- register_copy
jmp b4
// main::@4
b4:
// [6] (byte) main::a#1 ← (byte) main::a#13 - (byte) main::b#10 -- vbuz1=vbuz1_minus_vbuz2
lda a
sec
sbc b
sta a
// [7] phi from main::@4 main::@5 to main::@1 [phi:main::@4/main::@5->main::@1]
b1_from_b4:
b1_from_b5:
// [7] phi (byte) main::b#11 = (byte) main::b#10 [phi:main::@4/main::@5->main::@1#0] -- register_copy
jmp b1
// main::@1
b1:
// [6] if((byte) main::a#2!=(byte) main::b#2) goto main::@2 -- vbuz1_neq_vbuz2_then_la1
// [8] if((byte) main::a#1!=(byte) main::b#11) goto main::@2 -- vbuz1_neq_vbuz2_then_la1
lda a
cmp b
bne b2
jmp b3
// main::@3
b3:
// [7] *((const byte*) SCREEN#0) ← (byte) main::a#2 -- _deref_pbuc1=vbuz1
// [9] *((const byte*) SCREEN#0) ← (byte) main::a#1 -- _deref_pbuc1=vbuz1
lda a
sta SCREEN
jmp breturn
// main::@return
breturn:
// [8] return
// [10] return
rts
// main::@2
b2:
// [9] if((byte) main::a#2>(byte) main::b#2) goto main::@4 -- vbuz1_gt_vbuz2_then_la1
// [11] if((byte) main::a#1>(byte) main::b#11) goto main::@4 -- vbuz1_gt_vbuz2_then_la1
lda b
cmp a
bcc b4
bcc b4_from_b2
jmp b5
// main::@5
b5:
// [10] (byte) main::b#1 ← (byte) main::b#2 - (byte) main::a#2 -- vbuz1=vbuz1_minus_vbuz2
// [12] (byte) main::b#1 ← (byte) main::b#11 - (byte) main::a#1 -- vbuz1=vbuz1_minus_vbuz2
lda b
sec
sbc a
sta b
// [5] phi from main::@4 main::@5 to main::@1 [phi:main::@4/main::@5->main::@1]
b1_from_b4:
b1_from_b5:
// [5] phi (byte) main::b#2 = (byte) main::b#2 [phi:main::@4/main::@5->main::@1#0] -- register_copy
// [5] phi (byte) main::a#2 = (byte) main::a#1 [phi:main::@4/main::@5->main::@1#1] -- register_copy
jmp b1
// main::@4
b4:
// [11] (byte) main::a#1 ← (byte) main::a#2 - (byte) main::b#2 -- vbuz1=vbuz1_minus_vbuz2
lda a
sec
sbc b
sta a
jmp b1_from_b4
jmp b1_from_b5
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [10] (byte) main::b#1 ← (byte) main::b#2 - (byte) main::a#2 [ main::a#2 main::b#1 ] ( main:2 [ main::a#2 main::b#1 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::a#2 main::a#1 ]
Statement [11] (byte) main::a#1 ← (byte) main::a#2 - (byte) main::b#2 [ main::b#2 main::a#1 ] ( main:2 [ main::b#2 main::a#1 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::b#2 main::b#1 ]
Statement [10] (byte) main::b#1 ← (byte) main::b#2 - (byte) main::a#2 [ main::a#2 main::b#1 ] ( main:2 [ main::a#2 main::b#1 ] ) always clobbers reg byte a
Statement [11] (byte) main::a#1 ← (byte) main::a#2 - (byte) main::b#2 [ main::b#2 main::a#1 ] ( main:2 [ main::b#2 main::a#1 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::a#2 main::a#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::b#2 main::b#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
Statement [6] (byte) main::a#1 ← (byte) main::a#13 - (byte) main::b#10 [ main::b#10 main::a#1 ] ( main:2 [ main::b#10 main::a#1 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::b#10 main::b#11 main::b#1 ]
Statement [12] (byte) main::b#1 ← (byte) main::b#11 - (byte) main::a#1 [ main::a#1 main::b#1 ] ( main:2 [ main::a#1 main::b#1 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::a#13 main::a#1 ]
Statement [6] (byte) main::a#1 ← (byte) main::a#13 - (byte) main::b#10 [ main::b#10 main::a#1 ] ( main:2 [ main::b#10 main::a#1 ] ) always clobbers reg byte a
Statement [12] (byte) main::b#1 ← (byte) main::b#11 - (byte) main::a#1 [ main::a#1 main::b#1 ] ( main:2 [ main::a#1 main::b#1 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::a#13 main::a#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::b#10 main::b#11 main::b#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 41.75: zp ZP_BYTE:2 [ main::a#2 main::a#1 ] 41.25: zp ZP_BYTE:3 [ main::b#2 main::b#1 ]
Uplift Scope [main] 435.5: zp ZP_BYTE:3 [ main::b#10 main::b#11 main::b#1 ] 195.4: zp ZP_BYTE:2 [ main::a#13 main::a#1 ]
Uplift Scope []
Uplifting [main] best 568 combination zp ZP_BYTE:2 [ main::a#2 main::a#1 ] reg byte x [ main::b#2 main::b#1 ]
Uplifting [] best 568 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::a#2 main::a#1 ]
Uplifting [main] best 568 combination zp ZP_BYTE:2 [ main::a#2 main::a#1 ]
Uplifting [main] best 3478 combination reg byte x [ main::b#10 main::b#11 main::b#1 ] zp ZP_BYTE:2 [ main::a#13 main::a#1 ]
Uplifting [] best 3478 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::a#13 main::a#1 ]
Uplifting [main] best 3478 combination zp ZP_BYTE:2 [ main::a#13 main::a#1 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -327,78 +520,86 @@ bend:
// main
main: {
.label a = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::b#2 = (byte) 2 [phi:main->main::@1#0] -- vbuxx=vbuc1
// [5] phi from main to main::@4 [phi:main->main::@4]
b4_from_main:
// [5] phi (byte) main::b#10 = (byte) 2 [phi:main->main::@4#0] -- vbuxx=vbuc1
ldx #2
// [5] phi (byte) main::a#2 = (byte) $80 [phi:main->main::@1#1] -- vbuz1=vbuc1
// [5] phi (byte) main::a#13 = (byte) $80 [phi:main->main::@4#1] -- vbuz1=vbuc1
lda #$80
sta a
jmp b1
// main::@1
b1:
// [6] if((byte) main::a#2!=(byte) main::b#2) goto main::@2 -- vbuz1_neq_vbuxx_then_la1
cpx a
bne b2
jmp b3
// main::@3
b3:
// [7] *((const byte*) SCREEN#0) ← (byte) main::a#2 -- _deref_pbuc1=vbuz1
lda a
sta SCREEN
jmp breturn
// main::@return
breturn:
// [8] return
rts
// main::@2
b2:
// [9] if((byte) main::a#2>(byte) main::b#2) goto main::@4 -- vbuz1_gt_vbuxx_then_la1
cpx a
bcc b4
jmp b5
// main::@5
b5:
// [10] (byte) main::b#1 ← (byte) main::b#2 - (byte) main::a#2 -- vbuxx=vbuxx_minus_vbuz1
txa
sec
sbc a
tax
// [5] phi from main::@4 main::@5 to main::@1 [phi:main::@4/main::@5->main::@1]
b1_from_b4:
b1_from_b5:
// [5] phi (byte) main::b#2 = (byte) main::b#2 [phi:main::@4/main::@5->main::@1#0] -- register_copy
// [5] phi (byte) main::a#2 = (byte) main::a#1 [phi:main::@4/main::@5->main::@1#1] -- register_copy
jmp b1
jmp b4
// [5] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
b4_from_b2:
// [5] phi (byte) main::b#10 = (byte) main::b#11 [phi:main::@2->main::@4#0] -- register_copy
// [5] phi (byte) main::a#13 = (byte) main::a#1 [phi:main::@2->main::@4#1] -- register_copy
jmp b4
// main::@4
b4:
// [11] (byte) main::a#1 ← (byte) main::a#2 - (byte) main::b#2 -- vbuz1=vbuz1_minus_vbuxx
// [6] (byte) main::a#1 ← (byte) main::a#13 - (byte) main::b#10 -- vbuz1=vbuz1_minus_vbuxx
txa
eor #$ff
sec
adc a
sta a
jmp b1_from_b4
// [7] phi from main::@4 main::@5 to main::@1 [phi:main::@4/main::@5->main::@1]
b1_from_b4:
b1_from_b5:
// [7] phi (byte) main::b#11 = (byte) main::b#10 [phi:main::@4/main::@5->main::@1#0] -- register_copy
jmp b1
// main::@1
b1:
// [8] if((byte) main::a#1!=(byte) main::b#11) goto main::@2 -- vbuz1_neq_vbuxx_then_la1
cpx a
bne b2
jmp b3
// main::@3
b3:
// [9] *((const byte*) SCREEN#0) ← (byte) main::a#1 -- _deref_pbuc1=vbuz1
lda a
sta SCREEN
jmp breturn
// main::@return
breturn:
// [10] return
rts
// main::@2
b2:
// [11] if((byte) main::a#1>(byte) main::b#11) goto main::@4 -- vbuz1_gt_vbuxx_then_la1
cpx a
bcc b4_from_b2
jmp b5
// main::@5
b5:
// [12] (byte) main::b#1 ← (byte) main::b#11 - (byte) main::a#1 -- vbuxx=vbuxx_minus_vbuz1
txa
sec
sbc a
tax
jmp b1_from_b5
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b4
Removing instruction jmp b1
Removing instruction jmp b3
Removing instruction jmp breturn
Removing instruction jmp b5
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1_from_b4 with b1_from_b5
Replacing label b4_from_b2 with b4
Replacing label b1_from_b5 with b1
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b4_from_b2:
Removing instruction b1_from_b4:
Removing instruction b1_from_b5:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b4_from_main:
Removing instruction b3:
Removing instruction breturn:
Removing instruction b5:
@ -406,12 +607,9 @@ Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Skipping double jump to b1 in jmp b1_from_b5
Succesful ASM optimization Pass5DoubleJumpElimination
Relabelling long label b1_from_b5 to b3
Succesful ASM optimization Pass5RelabelLongLabels
Removing instruction jmp b4
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Removing instruction b3:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
@ -428,18 +626,19 @@ FINAL SYMBOL TABLE
(label) main::@5
(label) main::@return
(byte) main::a
(byte) main::a#1 a zp ZP_BYTE:2 22.0
(byte) main::a#2 a zp ZP_BYTE:2 19.75
(byte) main::a#1 a zp ZP_BYTE:2 83.39999999999999
(byte) main::a#13 a zp ZP_BYTE:2 112.0
(byte) main::b
(byte) main::b#1 reg byte x 22.0
(byte) main::b#2 reg byte x 19.25
(byte) main::b#1 reg byte x 202.0
(byte) main::b#10 reg byte x 61.5
(byte) main::b#11 reg byte x 171.99999999999997
zp ZP_BYTE:2 [ main::a#2 main::a#1 ]
reg byte x [ main::b#2 main::b#1 ]
zp ZP_BYTE:2 [ main::a#13 main::a#1 ]
reg byte x [ main::b#10 main::b#11 main::b#1 ]
FINAL ASSEMBLER
Score: 463
Score: 2503
// File Comments
// Demonstrates a problem where wrong alive ranges result in clobbering an alive variable
@ -460,53 +659,54 @@ Score: 463
// main
main: {
.label a = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::b#2 = (byte) 2 [phi:main->main::@1#0] -- vbuxx=vbuc1
// [5] phi from main to main::@4 [phi:main->main::@4]
// [5] phi (byte) main::b#10 = (byte) 2 [phi:main->main::@4#0] -- vbuxx=vbuc1
ldx #2
// [5] phi (byte) main::a#2 = (byte) $80 [phi:main->main::@1#1] -- vbuz1=vbuc1
// [5] phi (byte) main::a#13 = (byte) $80 [phi:main->main::@4#1] -- vbuz1=vbuc1
lda #$80
sta a
// main::@1
b1:
// while (a!=b)
// [6] if((byte) main::a#2!=(byte) main::b#2) goto main::@2 -- vbuz1_neq_vbuxx_then_la1
cpx a
bne b2
// main::@3
// *SCREEN = a
// [7] *((const byte*) SCREEN#0) ← (byte) main::a#2 -- _deref_pbuc1=vbuz1
lda a
sta SCREEN
// main::@return
// }
// [8] return
rts
// main::@2
b2:
// if(a>b)
// [9] if((byte) main::a#2>(byte) main::b#2) goto main::@4 -- vbuz1_gt_vbuxx_then_la1
cpx a
bcc b4
// main::@5
// b = b-a
// [10] (byte) main::b#1 ← (byte) main::b#2 - (byte) main::a#2 -- vbuxx=vbuxx_minus_vbuz1
txa
sec
sbc a
tax
// [5] phi from main::@4 main::@5 to main::@1 [phi:main::@4/main::@5->main::@1]
// [5] phi (byte) main::b#2 = (byte) main::b#2 [phi:main::@4/main::@5->main::@1#0] -- register_copy
// [5] phi (byte) main::a#2 = (byte) main::a#1 [phi:main::@4/main::@5->main::@1#1] -- register_copy
jmp b1
// [5] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
// [5] phi (byte) main::b#10 = (byte) main::b#11 [phi:main::@2->main::@4#0] -- register_copy
// [5] phi (byte) main::a#13 = (byte) main::a#1 [phi:main::@2->main::@4#1] -- register_copy
// main::@4
b4:
// a = a-b
// [11] (byte) main::a#1 ← (byte) main::a#2 - (byte) main::b#2 -- vbuz1=vbuz1_minus_vbuxx
// [6] (byte) main::a#1 ← (byte) main::a#13 - (byte) main::b#10 -- vbuz1=vbuz1_minus_vbuxx
txa
eor #$ff
sec
adc a
sta a
// [7] phi from main::@4 main::@5 to main::@1 [phi:main::@4/main::@5->main::@1]
// [7] phi (byte) main::b#11 = (byte) main::b#10 [phi:main::@4/main::@5->main::@1#0] -- register_copy
// main::@1
b1:
// while (a!=b)
// [8] if((byte) main::a#1!=(byte) main::b#11) goto main::@2 -- vbuz1_neq_vbuxx_then_la1
cpx a
bne b2
// main::@3
// *SCREEN = a
// [9] *((const byte*) SCREEN#0) ← (byte) main::a#1 -- _deref_pbuc1=vbuz1
lda a
sta SCREEN
// main::@return
// }
// [10] return
rts
// main::@2
b2:
// if(a>b)
// [11] if((byte) main::a#1>(byte) main::b#11) goto main::@4 -- vbuz1_gt_vbuxx_then_la1
cpx a
bcc b4
// main::@5
// b = b-a
// [12] (byte) main::b#1 ← (byte) main::b#11 - (byte) main::a#1 -- vbuxx=vbuxx_minus_vbuz1
txa
sec
sbc a
tax
jmp b1
}
// File Data

View File

@ -11,11 +11,12 @@
(label) main::@5
(label) main::@return
(byte) main::a
(byte) main::a#1 a zp ZP_BYTE:2 22.0
(byte) main::a#2 a zp ZP_BYTE:2 19.75
(byte) main::a#1 a zp ZP_BYTE:2 83.39999999999999
(byte) main::a#13 a zp ZP_BYTE:2 112.0
(byte) main::b
(byte) main::b#1 reg byte x 22.0
(byte) main::b#2 reg byte x 19.25
(byte) main::b#1 reg byte x 202.0
(byte) main::b#10 reg byte x 61.5
(byte) main::b#11 reg byte x 171.99999999999997
zp ZP_BYTE:2 [ main::a#2 main::a#1 ]
reg byte x [ main::b#2 main::b#1 ]
zp ZP_BYTE:2 [ main::a#13 main::a#1 ]
reg byte x [ main::b#10 main::b#11 main::b#1 ]

View File

@ -79,18 +79,47 @@ fire: {
.label screen_2 = $c
.label buffer = 4
.label buffer_3 = 9
.label screen_4 = $c
.label buffer_7 = 9
.label screen_10 = $c
.label screen_15 = $c
lda screen
sta screen_10
sta screen_15
lda screen+1
sta screen_10+1
sta screen_15+1
lda #<BUFFER
sta buffer
lda #>BUFFER
sta buffer+1
b1:
b2:
ldy #$28-1
clc
lda (buffer),y
adc (buffer),y
ldy #$28
clc
adc (buffer),y
ldy #$29
clc
adc (buffer),y
lsr
lsr
cmp #2+1
bcc b4
sec
sbc #3
b4:
ldy #0
sta (buffer),y
lda (buffer),y
sta (screen_10),y
inc screen_2
bne !+
inc screen_2+1
!:
inc buffer
bne !+
inc buffer+1
!:
lda buffer+1
cmp #>BUFFER+$18*$28
bne b2
@ -135,37 +164,6 @@ fire: {
cmp #<BUFFER+$19*$28
bne b6
rts
b2:
ldy #$28-1
clc
lda (buffer),y
adc (buffer),y
ldy #$28
clc
adc (buffer),y
ldy #$29
clc
adc (buffer),y
lsr
lsr
cmp #2+1
bcc b4
sec
sbc #3
b4:
ldy #0
sta (buffer),y
lda (buffer),y
sta (screen_4),y
inc screen_2
bne !+
inc screen_2+1
!:
inc buffer
bne !+
inc buffer+1
!:
jmp b1
}
// Get a random number from the SID voice 3,
// Must be initialized with sid_rnd_init()

View File

@ -52,52 +52,54 @@ main::@3: scope:[main] from main::toD0182
to:main::@1
fire: scope:[fire] from main::@1 main::@2
[25] (byte*) fire::screen#0 ← phi( main::@1/(const byte*) SCREEN1#0 main::@2/(const byte*) SCREEN2#0 )
[26] (byte*~) fire::screen#10 ← (byte*) fire::screen#0
to:fire::@1
fire::@1: scope:[fire] from fire fire::@4
[27] (byte*) fire::screen#4 ← phi( fire/(byte*~) fire::screen#10 fire::@4/(byte*) fire::screen#2 )
[27] (byte*) fire::buffer#4 ← phi( fire/(const byte*) BUFFER#0 fire::@4/(byte*) fire::buffer#2 )
[28] if((byte*) fire::buffer#4!=(const byte*) BUFFER#0+(word)(number) $18*(number) $28) goto fire::@2
to:fire::@3
fire::@3: scope:[fire] from fire::@1
[29] (byte*) fire::screen#1 ← (byte*) fire::screen#0 + (word)(number) $18*(number) $28
to:fire::@6
fire::@6: scope:[fire] from fire::@3 fire::@7
[30] (byte*) fire::screen#5 ← phi( fire::@7/(byte*) fire::screen#3 fire::@3/(byte*) fire::screen#1 )
[30] (byte*) fire::buffer#7 ← phi( fire::@7/(byte*) fire::buffer#3 fire::@3/(const byte*) BUFFER#0+(word)(number) $18*(number) $28 )
[31] call sid_rnd
[32] (byte) sid_rnd::return#2 ← (byte) sid_rnd::return#0
to:fire::@7
fire::@7: scope:[fire] from fire::@6
[33] (byte~) fire::$10 ← (byte) sid_rnd::return#2
[34] (byte~) fire::$11 ← (byte~) fire::$10 >> (byte) 4
[35] (byte~) fire::$12 ← (byte) $30 + (byte~) fire::$11
[36] *((byte*) fire::buffer#7) ← (byte~) fire::$12
[37] *((byte*) fire::screen#5) ← *((byte*) fire::buffer#7)
[38] (byte*) fire::screen#3 ← ++ (byte*) fire::screen#5
[39] (byte*) fire::buffer#3 ← ++ (byte*) fire::buffer#7
[40] if((byte*) fire::buffer#3!=(const byte*) BUFFER#0+(word)(number) $19*(number) $28) goto fire::@6
to:fire::@return
fire::@return: scope:[fire] from fire::@7
[41] return
to:@return
fire::@2: scope:[fire] from fire::@1
[42] (byte~) fire::$4 ← *((byte*) fire::buffer#4 + (byte)(number) $28-(number) 1) + *((byte*) fire::buffer#4 + (byte)(number) $28-(number) 1)
[43] (byte~) fire::$5 ← (byte~) fire::$4 + *((byte*) fire::buffer#4 + (byte) $28)
[44] (byte~) fire::$6 ← (byte~) fire::$5 + *((byte*) fire::buffer#4 + (byte) $29)
[45] (byte) fire::c#0 ← (byte~) fire::$6 >> (byte) 2
[46] if((byte) fire::c#0<(byte) 2+(byte) 1) goto fire::@4
to:fire::@1_1
fire::@1_1: scope:[fire] from fire
[26] (byte*~) fire::screen#15 ← (byte*) fire::screen#0
to:fire::@2
fire::@2: scope:[fire] from fire::@1 fire::@1_1
[27] (byte*) fire::screen#10 ← phi( fire::@1/(byte*) fire::screen#2 fire::@1_1/(byte*~) fire::screen#15 )
[27] (byte*) fire::buffer#10 ← phi( fire::@1/(byte*) fire::buffer#2 fire::@1_1/(const byte*) BUFFER#0 )
[28] (byte~) fire::$4 ← *((byte*) fire::buffer#10 + (byte)(number) $28-(number) 1) + *((byte*) fire::buffer#10 + (byte)(number) $28-(number) 1)
[29] (byte~) fire::$5 ← (byte~) fire::$4 + *((byte*) fire::buffer#10 + (byte) $28)
[30] (byte~) fire::$6 ← (byte~) fire::$5 + *((byte*) fire::buffer#10 + (byte) $29)
[31] (byte) fire::c#0 ← (byte~) fire::$6 >> (byte) 2
[32] if((byte) fire::c#0<(byte) 2+(byte) 1) goto fire::@4
to:fire::@5
fire::@5: scope:[fire] from fire::@2
[47] (byte) fire::c#1 ← (byte) fire::c#0 - (byte) 3
[33] (byte) fire::c#1 ← (byte) fire::c#0 - (byte) 3
to:fire::@4
fire::@4: scope:[fire] from fire::@2 fire::@5
[48] (byte) fire::c#2 ← phi( fire::@2/(byte) fire::c#0 fire::@5/(byte) fire::c#1 )
[49] *((byte*) fire::buffer#4) ← (byte) fire::c#2
[50] *((byte*) fire::screen#4) ← *((byte*) fire::buffer#4)
[51] (byte*) fire::screen#2 ← ++ (byte*) fire::screen#4
[52] (byte*) fire::buffer#2 ← ++ (byte*) fire::buffer#4
[34] (byte) fire::c#2 ← phi( fire::@2/(byte) fire::c#0 fire::@5/(byte) fire::c#1 )
[35] *((byte*) fire::buffer#10) ← (byte) fire::c#2
[36] *((byte*) fire::screen#10) ← *((byte*) fire::buffer#10)
[37] (byte*) fire::screen#2 ← ++ (byte*) fire::screen#10
[38] (byte*) fire::buffer#2 ← ++ (byte*) fire::buffer#10
to:fire::@1
fire::@1: scope:[fire] from fire::@4
[39] if((byte*) fire::buffer#2!=(const byte*) BUFFER#0+(word)(number) $18*(number) $28) goto fire::@2
to:fire::@3
fire::@3: scope:[fire] from fire::@1
[40] (byte*) fire::screen#1 ← (byte*) fire::screen#0 + (word)(number) $18*(number) $28
to:fire::@6
fire::@6: scope:[fire] from fire::@3 fire::@7
[41] (byte*) fire::screen#5 ← phi( fire::@7/(byte*) fire::screen#3 fire::@3/(byte*) fire::screen#1 )
[41] (byte*) fire::buffer#7 ← phi( fire::@7/(byte*) fire::buffer#3 fire::@3/(const byte*) BUFFER#0+(word)(number) $18*(number) $28 )
[42] call sid_rnd
[43] (byte) sid_rnd::return#2 ← (byte) sid_rnd::return#0
to:fire::@7
fire::@7: scope:[fire] from fire::@6
[44] (byte~) fire::$10 ← (byte) sid_rnd::return#2
[45] (byte~) fire::$11 ← (byte~) fire::$10 >> (byte) 4
[46] (byte~) fire::$12 ← (byte) $30 + (byte~) fire::$11
[47] *((byte*) fire::buffer#7) ← (byte~) fire::$12
[48] *((byte*) fire::screen#5) ← *((byte*) fire::buffer#7)
[49] (byte*) fire::screen#3 ← ++ (byte*) fire::screen#5
[50] (byte*) fire::buffer#3 ← ++ (byte*) fire::buffer#7
[51] if((byte*) fire::buffer#3!=(const byte*) BUFFER#0+(word)(number) $19*(number) $28) goto fire::@6
to:fire::@return
fire::@return: scope:[fire] from fire::@7
[52] return
to:@return
sid_rnd: scope:[sid_rnd] from fire::@6
[53] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0)
to:sid_rnd::@return

File diff suppressed because it is too large Load Diff

View File

@ -49,6 +49,7 @@
(byte~) fire::$5 reg byte a 202.0
(byte~) fire::$6 reg byte a 202.0
(label) fire::@1
(label) fire::@1_1
(label) fire::@2
(label) fire::@3
(label) fire::@4
@ -57,9 +58,9 @@
(label) fire::@7
(label) fire::@return
(byte*) fire::buffer
(byte*) fire::buffer#2 buffer zp ZP_WORD:4 202.0
(byte*) fire::buffer#10 buffer zp ZP_WORD:4 73.45454545454545
(byte*) fire::buffer#2 buffer zp ZP_WORD:4 151.5
(byte*) fire::buffer#3 buffer#3 zp ZP_WORD:9 151.5
(byte*) fire::buffer#4 buffer zp ZP_WORD:4 75.75
(byte*) fire::buffer#7 buffer#7 zp ZP_WORD:9 44.888888888888886
(byte) fire::c
(byte) fire::c#0 reg byte a 202.0
@ -68,10 +69,10 @@
(byte*) fire::screen
(byte*) fire::screen#0 screen zp ZP_WORD:2 0.26666666666666666
(byte*) fire::screen#1 screen zp ZP_WORD:2 4.0
(byte*~) fire::screen#10 screen#10 zp ZP_WORD:12 4.0
(byte*) fire::screen#2 screen#2 zp ZP_WORD:12 101.0
(byte*) fire::screen#10 screen#10 zp ZP_WORD:12 30.5
(byte*~) fire::screen#15 screen#15 zp ZP_WORD:12 4.0
(byte*) fire::screen#2 screen#2 zp ZP_WORD:12 67.33333333333333
(byte*) fire::screen#3 screen zp ZP_WORD:2 67.33333333333333
(byte*) fire::screen#4 screen#4 zp ZP_WORD:12 27.727272727272727
(byte*) fire::screen#5 screen zp ZP_WORD:2 38.125
(byte*) fire::screenbase
(void()) main()
@ -167,7 +168,7 @@
reg byte a [ fire::c#2 fire::c#0 fire::c#1 ]
zp ZP_WORD:2 [ makecharset::font#2 makecharset::font#1 fire::screen#0 fire::screen#5 fire::screen#3 fire::screen#1 ]
zp ZP_WORD:4 [ makecharset::font1#2 makecharset::font1#1 fire::buffer#4 fire::buffer#2 ]
zp ZP_WORD:4 [ makecharset::font1#2 makecharset::font1#1 fire::buffer#10 fire::buffer#2 ]
zp ZP_BYTE:6 [ makecharset::c#7 makecharset::c#1 ]
zp ZP_BYTE:7 [ makecharset::i#6 makecharset::i#1 ]
reg byte x [ makecharset::bc#3 makecharset::bc#5 makecharset::bc#6 makecharset::bc#1 makecharset::bc#2 ]
@ -175,15 +176,15 @@ zp ZP_BYTE:8 [ makecharset::ii#2 makecharset::ii#1 ]
reg byte y [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ]
reg byte x [ fillscreen::fill#5 ]
zp ZP_WORD:9 [ fillscreen::i#2 fillscreen::i#1 fire::buffer#7 fire::buffer#3 ]
reg byte a [ fire::$4 ]
reg byte a [ fire::$5 ]
reg byte a [ fire::$6 ]
reg byte a [ sid_rnd::return#2 ]
reg byte a [ fire::$10 ]
reg byte a [ fire::$11 ]
reg byte a [ fire::$12 ]
reg byte a [ fire::$4 ]
reg byte a [ fire::$5 ]
reg byte a [ fire::$6 ]
reg byte a [ sid_rnd::return#0 ]
reg byte a [ makecharset::$8 ]
reg byte a [ makecharset::$9 ]
zp ZP_BYTE:11 [ makecharset::$10 ]
zp ZP_WORD:12 [ makecharset::$13 makecharset::$14 makecharset::$15 makecharset::$18 fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 fire::screen#4 fire::screen#10 fire::screen#2 ]
zp ZP_WORD:12 [ makecharset::$13 makecharset::$14 makecharset::$15 makecharset::$18 fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 fire::screen#10 fire::screen#2 fire::screen#15 ]

View File

@ -5,13 +5,15 @@
.label SCREEN = $400
main: {
ldx #0
b1:
cpx #$32
bcs b2
b3:
stx SCREEN
b2:
inx
cpx #$64
bcc b1
rts
b1:
cpx #$32
bcs b2
jmp b3
}

View File

@ -9,18 +9,19 @@
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 )
[6] if((byte) main::i#2>=(byte) $32) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[7] *((const byte*) SCREEN#0) ← (byte) main::i#2
main::@3: scope:[main] from main main::@1
[5] (byte) main::i#6 ← phi( main::@1/(byte) main::i#1 main/(byte) 0 )
[6] *((const byte*) SCREEN#0) ← (byte) main::i#6
to:main::@2
main::@2: scope:[main] from main::@1 main::@3
[8] (byte) main::i#1 ← ++ (byte) main::i#2
[7] (byte) main::i#5 ← phi( main::@1/(byte) main::i#1 main::@3/(byte) main::i#6 )
[8] (byte) main::i#1 ← ++ (byte) main::i#5
[9] if((byte) main::i#1<(byte) $64) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[10] return
to:@return
main::@1: scope:[main] from main::@2
[11] if((byte) main::i#1>=(byte) $32) goto main::@2
to:main::@3

View File

@ -84,22 +84,64 @@ Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) SCREEN#0 = (byte*) 1024
Constant (const byte) main::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
GRAPH (NEW VERSIONS for main::i#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@2
[0] (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@2/(byte) main::i#1 )
[1] if((byte) main::i#2>=(byte) $32) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1 main::@3
(byte) main::i#5 ← phi( )
[2] (byte) main::i#1 ← ++ (byte) main::i#5
[3] if((byte) main::i#1<(byte) $64) goto main::@1
to:main::@return
main::@3: scope:[main] from main::@1
(byte) main::i#6 ← phi( )
[4] *((const byte*) SCREEN#0) ← (byte) main::i#6
to:main::@2
main::@return: scope:[main] from main::@2
[5] return
to:@return
@1: scope:[] from @begin
[6] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Successful SSA optimization Pass2LoopHeadConstantIdentification
Alias (byte) main::i#1 = (byte) main::i#2
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::i#7 (const byte) main::i#0
Successful SSA optimization Pass2IdenticalPhiElimination
Removing PHI-reference to removed block (main::@1_1) in block main::@2
if() condition always false - eliminating [10] if((const byte) main::i#0>=(byte) $32) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Inlining constant with var siblings (const byte) main::i#0
Constant inlined main::i#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@5(between main::@2 and main::@1)
Added new block during phi lifting main::@5(between main::@1 and main::@2)
Added new block during phi lifting main::@6(between main::@1 and main::@3)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1_1
CALL GRAPH
Calls in [] to main:2
Created 1 initial phi equivalence classes
Coalesced [12] main::i#5 ← main::i#1
Created 2 initial phi equivalence classes
Coalesced [9] main::i#9 ← main::i#6
Coalesced [15] main::i#10 ← main::i#1
Coalesced (already) [16] main::i#8 ← main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@1_1
Culled Empty Block (label) main::@6
Culled Empty Block (label) main::@5
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
@ -118,35 +160,37 @@ FINAL CONTROL FLOW GRAPH
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 )
[6] if((byte) main::i#2>=(byte) $32) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[7] *((const byte*) SCREEN#0) ← (byte) main::i#2
main::@3: scope:[main] from main main::@1
[5] (byte) main::i#6 ← phi( main::@1/(byte) main::i#1 main/(byte) 0 )
[6] *((const byte*) SCREEN#0) ← (byte) main::i#6
to:main::@2
main::@2: scope:[main] from main::@1 main::@3
[8] (byte) main::i#1 ← ++ (byte) main::i#2
[7] (byte) main::i#5 ← phi( main::@1/(byte) main::i#1 main::@3/(byte) main::i#6 )
[8] (byte) main::i#1 ← ++ (byte) main::i#5
[9] if((byte) main::i#1<(byte) $64) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[10] return
to:@return
main::@1: scope:[main] from main::@2
[11] if((byte) main::i#1>=(byte) $32) goto main::@2
to:main::@3
VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 14.666666666666666
(byte) main::i#1 168.33333333333331
(byte) main::i#5 213.0
(byte) main::i#6 61.5
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::i#5 main::i#6 main::i#1 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
[ main::i#5 main::i#6 main::i#1 ]
Allocated zp ZP_BYTE:2 [ main::i#5 main::i#6 main::i#1 ]
INITIAL ASM
Target platform is c64basic
@ -177,54 +221,57 @@ bend:
// main
main: {
.label i = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
// [5] phi from main to main::@3 [phi:main->main::@3]
b3_from_main:
// [5] phi (byte) main::i#6 = (byte) 0 [phi:main->main::@3#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy
jmp b1
// main::@1
b1:
// [6] if((byte) main::i#2>=(byte) $32) goto main::@2 -- vbuz1_ge_vbuc1_then_la1
lda i
cmp #$32
bcs b2
jmp b3
// main::@3
b3:
// [7] *((const byte*) SCREEN#0) ← (byte) main::i#2 -- _deref_pbuc1=vbuz1
// [6] *((const byte*) SCREEN#0) ← (byte) main::i#6 -- _deref_pbuc1=vbuz1
lda i
sta SCREEN
// [7] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
b2_from_b1:
b2_from_b3:
// [7] phi (byte) main::i#5 = (byte) main::i#1 [phi:main::@1/main::@3->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [8] (byte) main::i#1 ← ++ (byte) main::i#5 -- vbuz1=_inc_vbuz1
inc i
// [9] if((byte) main::i#1<(byte) $64) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda i
cmp #$64
bcc b1_from_b2
bcc b1
jmp breturn
// main::@return
breturn:
// [10] return
rts
// main::@1
b1:
// [11] if((byte) main::i#1>=(byte) $32) goto main::@2 -- vbuz1_ge_vbuc1_then_la1
lda i
cmp #$32
bcs b2_from_b1
// [5] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
b3_from_b1:
// [5] phi (byte) main::i#6 = (byte) main::i#1 [phi:main::@1->main::@3#0] -- register_copy
jmp b3
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:2 [ main::i#5 main::i#6 main::i#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 31.17: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope [main] 442.83: zp ZP_BYTE:2 [ main::i#5 main::i#6 main::i#1 ]
Uplift Scope []
Uplifting [main] best 338 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 338 combination
Uplifting [main] best 1838 combination reg byte x [ main::i#5 main::i#6 main::i#1 ]
Uplifting [] best 1838 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -253,66 +300,67 @@ bend_from_b1:
bend:
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
// [5] phi from main to main::@3 [phi:main->main::@3]
b3_from_main:
// [5] phi (byte) main::i#6 = (byte) 0 [phi:main->main::@3#0] -- vbuxx=vbuc1
ldx #0
jmp b1
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy
jmp b1
// main::@1
b1:
// [6] if((byte) main::i#2>=(byte) $32) goto main::@2 -- vbuxx_ge_vbuc1_then_la1
cpx #$32
bcs b2
jmp b3
// main::@3
b3:
// [7] *((const byte*) SCREEN#0) ← (byte) main::i#2 -- _deref_pbuc1=vbuxx
// [6] *((const byte*) SCREEN#0) ← (byte) main::i#6 -- _deref_pbuc1=vbuxx
stx SCREEN
// [7] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
b2_from_b1:
b2_from_b3:
// [7] phi (byte) main::i#5 = (byte) main::i#1 [phi:main::@1/main::@3->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
// [8] (byte) main::i#1 ← ++ (byte) main::i#5 -- vbuxx=_inc_vbuxx
inx
// [9] if((byte) main::i#1<(byte) $64) goto main::@1 -- vbuxx_lt_vbuc1_then_la1
cpx #$64
bcc b1_from_b2
bcc b1
jmp breturn
// main::@return
breturn:
// [10] return
rts
// main::@1
b1:
// [11] if((byte) main::i#1>=(byte) $32) goto main::@2 -- vbuxx_ge_vbuc1_then_la1
cpx #$32
bcs b2_from_b1
// [5] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
b3_from_b1:
// [5] phi (byte) main::i#6 = (byte) main::i#1 [phi:main::@1->main::@3#0] -- register_copy
jmp b3
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b3
Removing instruction jmp b2
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1_from_b2 with b1
Replacing label b2_from_b1 with b2
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_b2:
Removing instruction b2_from_b1:
Removing instruction b2_from_b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b3:
Removing instruction b3_from_main:
Removing instruction breturn:
Removing instruction b3_from_b1:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
@ -328,14 +376,15 @@ FINAL SYMBOL TABLE
(label) main::@3
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 14.666666666666666
(byte) main::i#1 reg byte x 168.33333333333331
(byte) main::i#5 reg byte x 213.0
(byte) main::i#6 reg byte x 61.5
reg byte x [ main::i#2 main::i#1 ]
reg byte x [ main::i#5 main::i#6 main::i#1 ]
FINAL ASSEMBLER
Score: 176
Score: 1196
// File Comments
// Minimal if() test
@ -354,25 +403,20 @@ Score: 176
// @end
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
// [5] phi from main to main::@3 [phi:main->main::@3]
// [5] phi (byte) main::i#6 = (byte) 0 [phi:main->main::@3#0] -- vbuxx=vbuc1
ldx #0
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy
// main::@1
b1:
// if(i<50)
// [6] if((byte) main::i#2>=(byte) $32) goto main::@2 -- vbuxx_ge_vbuc1_then_la1
cpx #$32
bcs b2
// main::@3
b3:
// *SCREEN = i
// [7] *((const byte*) SCREEN#0) ← (byte) main::i#2 -- _deref_pbuc1=vbuxx
// [6] *((const byte*) SCREEN#0) ← (byte) main::i#6 -- _deref_pbuc1=vbuxx
stx SCREEN
// [7] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
// [7] phi (byte) main::i#5 = (byte) main::i#1 [phi:main::@1/main::@3->main::@2#0] -- register_copy
// main::@2
b2:
// while(++i<100)
// [8] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
// [8] (byte) main::i#1 ← ++ (byte) main::i#5 -- vbuxx=_inc_vbuxx
inx
// [9] if((byte) main::i#1<(byte) $64) goto main::@1 -- vbuxx_lt_vbuc1_then_la1
cpx #$64
@ -381,6 +425,15 @@ main: {
// }
// [10] return
rts
// main::@1
b1:
// if(i<50)
// [11] if((byte) main::i#1>=(byte) $32) goto main::@2 -- vbuxx_ge_vbuc1_then_la1
cpx #$32
bcs b2
// [5] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
// [5] phi (byte) main::i#6 = (byte) main::i#1 [phi:main::@1->main::@3#0] -- register_copy
jmp b3
}
// File Data

View File

@ -9,7 +9,8 @@
(label) main::@3
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 14.666666666666666
(byte) main::i#1 reg byte x 168.33333333333331
(byte) main::i#5 reg byte x 213.0
(byte) main::i#6 reg byte x 61.5
reg byte x [ main::i#2 main::i#1 ]
reg byte x [ main::i#5 main::i#6 main::i#1 ]

View File

@ -6,18 +6,9 @@
.label SCREEN = $400
main: {
lda #7
b1:
tax
sta SCREEN,x
tax
inx
cmp #7
bcc b3
sta SCREEN+7
// The condition-evaluation should increment i - even if when it is not met - x should end up in 0x0408
lda #'x'
sta SCREEN,x
sta SCREEN+8
rts
b3:
txa
jmp b1
}

View File

@ -9,19 +9,13 @@
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1_1
main::@1_1: scope:[main] from main
[5] *((const byte*) SCREEN#0+(byte) 7) ← (byte) 7
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::i#3 ← phi( main/(byte) 7 main::@3/(byte~) main::i#5 )
[6] *((const byte*) SCREEN#0 + (byte) main::i#3) ← (byte) main::i#3
[7] (byte) main::i#2 ← ++ (byte) main::i#3
[8] if((byte) main::i#3<(byte) 7) goto main::@3
to:main::@2
main::@2: scope:[main] from main::@1
[9] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) 'x'
main::@1: scope:[main] from main::@1_1
[6] *((const byte*) SCREEN#0+(byte) 8) ← (byte) 'x'
to:main::@return
main::@return: scope:[main] from main::@2
[10] return
main::@return: scope:[main] from main::@1
[7] return
to:@return
main::@3: scope:[main] from main::@1
[11] (byte~) main::i#5 ← (byte) main::i#2
to:main::@1

View File

@ -71,10 +71,60 @@ Constant (const byte) main::i#1 = 7
Successful SSA optimization Pass2ConstantIdentification
Eliminating unused constant (const byte) main::i#0
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) main::i#1
GRAPH (NEW VERSIONS for main::i#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@1
[0] (byte) main::i#3 ← phi( main/(const byte) main::i#1 main::@1/(byte) main::i#2 )
[1] *((const byte*) SCREEN#0 + (byte) main::i#3) ← (byte) main::i#3
[2] (byte) main::i#2 ← ++ (byte) main::i#3
[3] if((byte) main::i#3<(byte) 7) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
(byte) main::i#5 ← phi( )
[4] *((const byte*) SCREEN#0 + (byte) main::i#5) ← (byte) 'x'
to:main::@return
main::@return: scope:[main] from main::@2
[5] return
to:@return
@1: scope:[] from @begin
[6] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Successful SSA optimization Pass2LoopHeadConstantIdentification
Identical Phi Values (byte) main::i#6 (const byte) main::i#1
Successful SSA optimization Pass2IdenticalPhiElimination
Negating conditional jump and destination [11] if((const byte) main::i#1>=(byte) 7) goto main::@2
Successful SSA optimization Pass2ConditionalJumpSequenceImprovement
Constant right-side identified [10] (byte) main::i#7 ← ++ (const byte) main::i#1
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::i#7 = ++main::i#1
Successful SSA optimization Pass2ConstantIdentification
Removing PHI-reference to removed block (main::@1_1) in block main::@1
if() condition always true - replacing block destination [11] if((const byte) main::i#1>=(byte) 7) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating variable (byte) main::i#3 from unused block main::@1
Eliminating variable (byte) main::i#2 from unused block main::@1
Removing PHI-reference to removed block (main::@1) in block main::@2
Removing unused block main::@1
Successful SSA optimization Pass2EliminateUnusedBlocks
Identical Phi Values (byte) main::i#5 (const byte) main::i#7
Successful SSA optimization Pass2IdenticalPhiElimination
Inlining constant with different constant siblings (const byte) main::i#1
Inlining constant with different constant siblings (const byte) main::i#7
Constant inlined main::i#7 = ++(byte) 7
Constant inlined main::i#1 = (byte) 7
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@3(between main::@1 and main::@1)
Consolidated array index constant in *(SCREEN#0+++7)
Consolidated array index constant in *(SCREEN#0+7)
Successful SSA optimization Pass2ConstantAdditionElimination
Simplifying constant integer increment ++7
Successful SSA optimization Pass2ConstantSimplification
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
@ -83,10 +133,10 @@ Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to main:2
Created 1 initial phi equivalence classes
Not coalescing [12] main::i#5 ← main::i#2
Coalesced down to 2 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @2
Renumbering block main::@2 to main::@1
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
@ -104,40 +154,25 @@ FINAL CONTROL FLOW GRAPH
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1_1
main::@1_1: scope:[main] from main
[5] *((const byte*) SCREEN#0+(byte) 7) ← (byte) 7
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::i#3 ← phi( main/(byte) 7 main::@3/(byte~) main::i#5 )
[6] *((const byte*) SCREEN#0 + (byte) main::i#3) ← (byte) main::i#3
[7] (byte) main::i#2 ← ++ (byte) main::i#3
[8] if((byte) main::i#3<(byte) 7) goto main::@3
to:main::@2
main::@2: scope:[main] from main::@1
[9] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) 'x'
main::@1: scope:[main] from main::@1_1
[6] *((const byte*) SCREEN#0+(byte) 8) ← (byte) 'x'
to:main::@return
main::@return: scope:[main] from main::@2
[10] return
main::@return: scope:[main] from main::@1
[7] return
to:@return
main::@3: scope:[main] from main::@1
[11] (byte~) main::i#5 ← (byte) main::i#2
to:main::@1
VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) main()
(byte) main::i
(byte) main::i#2 12.0
(byte) main::i#3 18.333333333333332
(byte~) main::i#5 22.0
Initial phi equivalence classes
[ main::i#3 main::i#5 ]
Added variable main::i#2 to zero page equivalence class [ main::i#2 ]
Complete equivalence classes
[ main::i#3 main::i#5 ]
[ main::i#2 ]
Allocated zp ZP_BYTE:2 [ main::i#3 main::i#5 ]
Allocated zp ZP_BYTE:3 [ main::i#2 ]
INITIAL ASM
Target platform is c64basic
@ -168,65 +203,37 @@ bend_from_b1:
bend:
// main
main: {
.label i = 3
.label i_3 = 2
.label i_5 = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::i#3 = (byte) 7 [phi:main->main::@1#0] -- vbuz1=vbuc1
jmp b1_1
// main::@1_1
b1_1:
// [5] *((const byte*) SCREEN#0+(byte) 7) ← (byte) 7 -- _deref_pbuc1=vbuc2
lda #7
sta i_3
sta SCREEN+7
jmp b1
// main::@1
b1:
// [6] *((const byte*) SCREEN#0 + (byte) main::i#3) ← (byte) main::i#3 -- pbuc1_derefidx_vbuz1=vbuz1
ldy i_3
tya
sta SCREEN,y
// [7] (byte) main::i#2 ← ++ (byte) main::i#3 -- vbuz1=_inc_vbuz2
ldy i_3
iny
sty i
// [8] if((byte) main::i#3<(byte) 7) goto main::@3 -- vbuz1_lt_vbuc1_then_la1
lda i_3
cmp #7
bcc b3
jmp b2
// main::@2
b2:
// [9] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) 'x' -- pbuc1_derefidx_vbuz1=vbuc2
// [6] *((const byte*) SCREEN#0+(byte) 8) ← (byte) 'x' -- _deref_pbuc1=vbuc2
// The condition-evaluation should increment i - even if when it is not met - x should end up in 0x0408
lda #'x'
ldy i
sta SCREEN,y
sta SCREEN+8
jmp breturn
// main::@return
breturn:
// [10] return
// [7] return
rts
// main::@3
b3:
// [11] (byte~) main::i#5 ← (byte) main::i#2 -- vbuz1=vbuz2
lda i
sta i_5
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
// [5] phi (byte) main::i#3 = (byte~) main::i#5 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [9] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) 'x' [ ] ( main:2 [ ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::i#3 main::i#5 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::i#2 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Statement [5] *((const byte*) SCREEN#0+(byte) 7) ← (byte) 7 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [6] *((const byte*) SCREEN#0+(byte) 8) ← (byte) 'x' [ ] ( main:2 [ ] ) always clobbers reg byte a
REGISTER UPLIFT SCOPES
Uplift Scope [main] 40.33: zp ZP_BYTE:2 [ main::i#3 main::i#5 ] 12: zp ZP_BYTE:3 [ main::i#2 ]
Uplift Scope [main]
Uplift Scope []
Uplifting [main] best 313 combination reg byte a [ main::i#3 main::i#5 ] reg byte x [ main::i#2 ]
Uplifting [] best 313 combination
Uplifting [main] best 66 combination
Uplifting [] best 66 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -256,50 +263,32 @@ bend_from_b1:
bend:
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::i#3 = (byte) 7 [phi:main->main::@1#0] -- vbuaa=vbuc1
jmp b1_1
// main::@1_1
b1_1:
// [5] *((const byte*) SCREEN#0+(byte) 7) ← (byte) 7 -- _deref_pbuc1=vbuc2
lda #7
sta SCREEN+7
jmp b1
// main::@1
b1:
// [6] *((const byte*) SCREEN#0 + (byte) main::i#3) ← (byte) main::i#3 -- pbuc1_derefidx_vbuaa=vbuaa
tax
sta SCREEN,x
// [7] (byte) main::i#2 ← ++ (byte) main::i#3 -- vbuxx=_inc_vbuaa
tax
inx
// [8] if((byte) main::i#3<(byte) 7) goto main::@3 -- vbuaa_lt_vbuc1_then_la1
cmp #7
bcc b3
jmp b2
// main::@2
b2:
// [9] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) 'x' -- pbuc1_derefidx_vbuxx=vbuc2
// [6] *((const byte*) SCREEN#0+(byte) 8) ← (byte) 'x' -- _deref_pbuc1=vbuc2
// The condition-evaluation should increment i - even if when it is not met - x should end up in 0x0408
lda #'x'
sta SCREEN,x
sta SCREEN+8
jmp breturn
// main::@return
breturn:
// [10] return
// [7] return
rts
// main::@3
b3:
// [11] (byte~) main::i#5 ← (byte) main::i#2 -- vbuaa=vbuxx
txa
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
// [5] phi (byte) main::i#3 = (byte~) main::i#5 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1_1
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction b1_from_bbegin:
@ -308,10 +297,9 @@ Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b2:
Removing instruction b1_1:
Removing instruction b1:
Removing instruction breturn:
Removing instruction b1_from_b3:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
@ -327,20 +315,14 @@ FINAL SYMBOL TABLE
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@1_1
(label) main::@return
(byte) main::i
(byte) main::i#2 reg byte x 12.0
(byte) main::i#3 reg byte a 18.333333333333332
(byte~) main::i#5 reg byte a 22.0
reg byte a [ main::i#3 main::i#5 ]
reg byte x [ main::i#2 ]
FINAL ASSEMBLER
Score: 238
Score: 18
// File Comments
// Test a for()-loop where the condition has a side-effect
@ -360,39 +342,21 @@ Score: 238
// @end
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::i#3 = (byte) 7 [phi:main->main::@1#0] -- vbuaa=vbuc1
lda #7
// main::@1
b1:
// main::@1_1
// SCREEN[i] = i
// [6] *((const byte*) SCREEN#0 + (byte) main::i#3) ← (byte) main::i#3 -- pbuc1_derefidx_vbuaa=vbuaa
tax
sta SCREEN,x
// for(i=7;i++<7;)
// [7] (byte) main::i#2 ← ++ (byte) main::i#3 -- vbuxx=_inc_vbuaa
tax
inx
// [8] if((byte) main::i#3<(byte) 7) goto main::@3 -- vbuaa_lt_vbuc1_then_la1
cmp #7
bcc b3
// main::@2
// [5] *((const byte*) SCREEN#0+(byte) 7) ← (byte) 7 -- _deref_pbuc1=vbuc2
lda #7
sta SCREEN+7
// main::@1
// (SCREEN)[i] = 'x'
// [9] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) 'x' -- pbuc1_derefidx_vbuxx=vbuc2
// [6] *((const byte*) SCREEN#0+(byte) 8) ← (byte) 'x' -- _deref_pbuc1=vbuc2
// The condition-evaluation should increment i - even if when it is not met - x should end up in 0x0408
lda #'x'
sta SCREEN,x
sta SCREEN+8
// main::@return
// }
// [10] return
// [7] return
rts
// main::@3
b3:
// [11] (byte~) main::i#5 ← (byte) main::i#2 -- vbuaa=vbuxx
txa
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
// [5] phi (byte) main::i#3 = (byte~) main::i#5 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
}
// File Data

View File

@ -5,13 +5,7 @@
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@1_1
(label) main::@return
(byte) main::i
(byte) main::i#2 reg byte x 12.0
(byte) main::i#3 reg byte a 18.333333333333332
(byte~) main::i#5 reg byte a 22.0
reg byte a [ main::i#3 main::i#5 ]
reg byte x [ main::i#2 ]

View File

@ -18,14 +18,6 @@ memset: {
sta dst
lda #>str
sta dst+1
b1:
lda dst+1
cmp #>end
bne b2
lda dst
cmp #<end
bne b2
rts
b2:
lda #c
ldy #0
@ -34,5 +26,11 @@ memset: {
bne !+
inc dst+1
!:
jmp b1
lda dst+1
cmp #>end
bne b2
lda dst
cmp #<end
bne b2
rts
}

View File

@ -16,15 +16,15 @@ main::@return: scope:[main] from main
to:@return
memset: scope:[memset] from main
[7] phi()
to:memset::@2
memset::@2: scope:[memset] from memset memset::@1
[8] (byte*) memset::dst#4 ← phi( memset::@1/(byte*) memset::dst#1 memset/(byte*)(const void*) memset::str#0 )
[9] *((byte*) memset::dst#4) ← (const byte) memset::c#0
[10] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#4
to:memset::@1
memset::@1: scope:[memset] from memset memset::@2
[8] (byte*) memset::dst#2 ← phi( memset/(byte*)(const void*) memset::str#0 memset::@2/(byte*) memset::dst#1 )
[9] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2
memset::@1: scope:[memset] from memset::@2
[11] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@2
to:memset::@return
memset::@return: scope:[memset] from memset::@1
[10] return
[12] return
to:@return
memset::@2: scope:[memset] from memset::@1
[11] *((byte*) memset::dst#2) ← (const byte) memset::c#0
[12] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2
to:memset::@1

View File

@ -185,10 +185,54 @@ Constant right-side identified [2] (byte*) memset::end#0 ← (const byte*) memse
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) memset::end#0 = memset::$2+memset::num#0
Successful SSA optimization Pass2ConstantIdentification
GRAPH (NEW VERSIONS for memset::dst#2)
@begin: scope:[] from
to:@2
main: scope:[main] from @2
[0] call memset
to:main::@1
main::@1: scope:[main] from main
to:main::@return
main::@return: scope:[main] from main::@1
[1] return
to:@return
memset: scope:[memset] from main
to:memset::@2
memset::@1: scope:[memset] from memset::@4
to:memset::@return
memset::@2: scope:[memset] from memset
to:memset::@4
memset::@4: scope:[memset] from memset::@2 memset::@5
[2] (byte*) memset::dst#2 ← phi( memset::@2/(const byte*) memset::dst#0 memset::@5/(byte*) memset::dst#1 )
[3] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@5
to:memset::@1
memset::@5: scope:[memset] from memset::@4
(byte*) memset::dst#4 ← phi( )
[4] *((byte*) memset::dst#4) ← (const byte) memset::c#0
[5] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#4
to:memset::@4
memset::@return: scope:[memset] from memset::@1
[6] return
to:@return
@2: scope:[] from @begin
[7] call main
to:@3
@3: scope:[] from @2
to:@end
@end: scope:[] from @3
Successful SSA optimization Pass2LoopHeadConstantIdentification
Alias (byte*) memset::dst#1 = (byte*) memset::dst#2
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte*) memset::dst#5 (const byte*) memset::dst#0
Successful SSA optimization Pass2IdenticalPhiElimination
if() condition always true - replacing block destination [11] if((const byte*) memset::dst#0!=(const byte*) memset::end#0) goto memset::@5
Successful SSA optimization Pass2ConstantIfs
Inlining constant with var siblings (const byte*) memset::dst#0
Constant inlined memset::$2 = (byte*)(const void*) memset::str#0
Constant inlined memset::dst#0 = (byte*)(const void*) memset::str#0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting memset::@10(between memset::@4 and memset::@5)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
@ -197,18 +241,21 @@ Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of memset
Adding NOP phi() at start of memset::@2
Adding NOP phi() at start of memset::@4_1
Adding NOP phi() at start of memset::@1
CALL GRAPH
Calls in [] to main:2
Calls in [main] to memset:6
Created 1 initial phi equivalence classes
Coalesced [17] memset::dst#4 ← memset::dst#1
Coalesced [18] memset::dst#6 ← memset::dst#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@1
Culled Empty Block (label) memset::@2
Culled Empty Block (label) memset::@4_1
Culled Empty Block (label) memset::@1
Culled Empty Block (label) memset::@10
Renumbering block @2 to @1
Renumbering block memset::@4 to memset::@1
Renumbering block memset::@5 to memset::@2
@ -237,18 +284,18 @@ main::@return: scope:[main] from main
to:@return
memset: scope:[memset] from main
[7] phi()
to:memset::@2
memset::@2: scope:[memset] from memset memset::@1
[8] (byte*) memset::dst#4 ← phi( memset::@1/(byte*) memset::dst#1 memset/(byte*)(const void*) memset::str#0 )
[9] *((byte*) memset::dst#4) ← (const byte) memset::c#0
[10] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#4
to:memset::@1
memset::@1: scope:[memset] from memset memset::@2
[8] (byte*) memset::dst#2 ← phi( memset/(byte*)(const void*) memset::str#0 memset::@2/(byte*) memset::dst#1 )
[9] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2
memset::@1: scope:[memset] from memset::@2
[11] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@2
to:memset::@return
memset::@return: scope:[memset] from memset::@1
[10] return
[12] return
to:@return
memset::@2: scope:[memset] from memset::@1
[11] *((byte*) memset::dst#2) ← (const byte) memset::c#0
[12] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2
to:memset::@1
VARIABLE REGISTER WEIGHTS
@ -257,18 +304,18 @@ VARIABLE REGISTER WEIGHTS
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(byte) memset::c
(byte*) memset::dst
(byte*) memset::dst#1 22.0
(byte*) memset::dst#2 14.666666666666666
(byte*) memset::dst#1 16.5
(byte*) memset::dst#4 16.5
(byte*) memset::end
(word) memset::num
(void*) memset::return
(void*) memset::str
Initial phi equivalence classes
[ memset::dst#2 memset::dst#1 ]
[ memset::dst#4 memset::dst#1 ]
Complete equivalence classes
[ memset::dst#2 memset::dst#1 ]
Allocated zp ZP_WORD:2 [ memset::dst#2 memset::dst#1 ]
[ memset::dst#4 memset::dst#1 ]
Allocated zp ZP_WORD:2 [ memset::dst#4 memset::dst#1 ]
INITIAL ASM
Target platform is c64basic
@ -316,59 +363,60 @@ memset: {
.label str = SCREEN
.label end = str+num
.label dst = 2
// [8] phi from memset to memset::@1 [phi:memset->memset::@1]
b1_from_memset:
// [8] phi (byte*) memset::dst#2 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@1#0] -- pbuz1=pbuc1
// [8] phi from memset to memset::@2 [phi:memset->memset::@2]
b2_from_memset:
// [8] phi (byte*) memset::dst#4 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@2#0] -- pbuz1=pbuc1
lda #<str
sta dst
lda #>str
sta dst+1
jmp b1
// memset::@1
b1:
// [9] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1
lda dst+1
cmp #>end
bne b2
lda dst
cmp #<end
bne b2
jmp breturn
// memset::@return
breturn:
// [10] return
rts
jmp b2
// [8] phi from memset::@1 to memset::@2 [phi:memset::@1->memset::@2]
b2_from_b1:
// [8] phi (byte*) memset::dst#4 = (byte*) memset::dst#1 [phi:memset::@1->memset::@2#0] -- register_copy
jmp b2
// memset::@2
b2:
// [11] *((byte*) memset::dst#2) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1
// [9] *((byte*) memset::dst#4) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1
lda #c
ldy #0
sta (dst),y
// [12] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1
// [10] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#4 -- pbuz1=_inc_pbuz1
inc dst
bne !+
inc dst+1
!:
// [8] phi from memset::@2 to memset::@1 [phi:memset::@2->memset::@1]
b1_from_b2:
// [8] phi (byte*) memset::dst#2 = (byte*) memset::dst#1 [phi:memset::@2->memset::@1#0] -- register_copy
jmp b1
// memset::@1
b1:
// [11] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1
lda dst+1
cmp #>end
bne b2_from_b1
lda dst
cmp #<end
bne b2_from_b1
jmp breturn
// memset::@return
breturn:
// [12] return
rts
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [9] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2 [ memset::dst#2 ] ( main:2::memset:5 [ memset::dst#2 ] ) always clobbers reg byte a
Statement [11] *((byte*) memset::dst#2) ← (const byte) memset::c#0 [ memset::dst#2 ] ( main:2::memset:5 [ memset::dst#2 ] ) always clobbers reg byte a reg byte y
Potential registers zp ZP_WORD:2 [ memset::dst#2 memset::dst#1 ] : zp ZP_WORD:2 ,
Statement [9] *((byte*) memset::dst#4) ← (const byte) memset::c#0 [ memset::dst#4 ] ( main:2::memset:5 [ memset::dst#4 ] ) always clobbers reg byte a reg byte y
Statement [11] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@2 [ memset::dst#1 ] ( main:2::memset:5 [ memset::dst#1 ] ) always clobbers reg byte a
Potential registers zp ZP_WORD:2 [ memset::dst#4 memset::dst#1 ] : zp ZP_WORD:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [memset] 36.67: zp ZP_WORD:2 [ memset::dst#2 memset::dst#1 ]
Uplift Scope [memset] 33: zp ZP_WORD:2 [ memset::dst#4 memset::dst#1 ]
Uplift Scope [main]
Uplift Scope []
Uplifting [memset] best 598 combination zp ZP_WORD:2 [ memset::dst#2 memset::dst#1 ]
Uplifting [main] best 598 combination
Uplifting [] best 598 combination
Uplifting [memset] best 628 combination zp ZP_WORD:2 [ memset::dst#4 memset::dst#1 ]
Uplifting [main] best 628 combination
Uplifting [] best 628 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -415,43 +463,44 @@ memset: {
.label str = SCREEN
.label end = str+num
.label dst = 2
// [8] phi from memset to memset::@1 [phi:memset->memset::@1]
b1_from_memset:
// [8] phi (byte*) memset::dst#2 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@1#0] -- pbuz1=pbuc1
// [8] phi from memset to memset::@2 [phi:memset->memset::@2]
b2_from_memset:
// [8] phi (byte*) memset::dst#4 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@2#0] -- pbuz1=pbuc1
lda #<str
sta dst
lda #>str
sta dst+1
jmp b1
// memset::@1
b1:
// [9] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1
lda dst+1
cmp #>end
bne b2
lda dst
cmp #<end
bne b2
jmp breturn
// memset::@return
breturn:
// [10] return
rts
jmp b2
// [8] phi from memset::@1 to memset::@2 [phi:memset::@1->memset::@2]
b2_from_b1:
// [8] phi (byte*) memset::dst#4 = (byte*) memset::dst#1 [phi:memset::@1->memset::@2#0] -- register_copy
jmp b2
// memset::@2
b2:
// [11] *((byte*) memset::dst#2) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1
// [9] *((byte*) memset::dst#4) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1
lda #c
ldy #0
sta (dst),y
// [12] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1
// [10] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#4 -- pbuz1=_inc_pbuz1
inc dst
bne !+
inc dst+1
!:
// [8] phi from memset::@2 to memset::@1 [phi:memset::@2->memset::@1]
b1_from_b2:
// [8] phi (byte*) memset::dst#2 = (byte*) memset::dst#1 [phi:memset::@2->memset::@1#0] -- register_copy
jmp b1
// memset::@1
b1:
// [11] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1
lda dst+1
cmp #>end
bne b2_from_b1
lda dst
cmp #<end
bne b2_from_b1
jmp breturn
// memset::@return
breturn:
// [12] return
rts
}
// File Data
@ -459,24 +508,30 @@ ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp breturn
Removing instruction jmp b2
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b2_from_b1 with b2
Replacing label b2_from_b1 with b2
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b2_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction memset_from_main:
Removing instruction breturn:
Removing instruction b1_from_memset:
Removing instruction b2_from_memset:
Removing instruction b1:
Removing instruction breturn:
Removing instruction b1_from_b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
@ -495,8 +550,8 @@ FINAL SYMBOL TABLE
(byte) memset::c
(const byte) memset::c#0 c = (byte) 'c'
(byte*) memset::dst
(byte*) memset::dst#1 dst zp ZP_WORD:2 22.0
(byte*) memset::dst#2 dst zp ZP_WORD:2 14.666666666666666
(byte*) memset::dst#1 dst zp ZP_WORD:2 16.5
(byte*) memset::dst#4 dst zp ZP_WORD:2 16.5
(byte*) memset::end
(const byte*) memset::end#0 end = (byte*)(const void*) memset::str#0+(const word) memset::num#0
(word) memset::num
@ -505,11 +560,11 @@ FINAL SYMBOL TABLE
(void*) memset::str
(const void*) memset::str#0 str = (void*)(const byte*) SCREEN#0
zp ZP_WORD:2 [ memset::dst#2 memset::dst#1 ]
zp ZP_WORD:2 [ memset::dst#4 memset::dst#1 ]
FINAL ASSEMBLER
Score: 523
Score: 493
// File Comments
// Minimal classic for() loop - coded using while() to test optimization of loop heads
@ -545,16 +600,30 @@ memset: {
.label str = SCREEN
.label end = str+num
.label dst = 2
// [8] phi from memset to memset::@1 [phi:memset->memset::@1]
// [8] phi (byte*) memset::dst#2 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@1#0] -- pbuz1=pbuc1
// [8] phi from memset to memset::@2 [phi:memset->memset::@2]
// [8] phi (byte*) memset::dst#4 = (byte*)(const void*) memset::str#0 [phi:memset->memset::@2#0] -- pbuz1=pbuc1
lda #<str
sta dst
lda #>str
sta dst+1
// [8] phi from memset::@1 to memset::@2 [phi:memset::@1->memset::@2]
// [8] phi (byte*) memset::dst#4 = (byte*) memset::dst#1 [phi:memset::@1->memset::@2#0] -- register_copy
// memset::@2
b2:
// *dst = c
// [9] *((byte*) memset::dst#4) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1
lda #c
ldy #0
sta (dst),y
// dst++;
// [10] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#4 -- pbuz1=_inc_pbuz1
inc dst
bne !+
inc dst+1
!:
// memset::@1
b1:
// while(dst!=end)
// [9] if((byte*) memset::dst#2!=(const byte*) memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1
// [11] if((byte*) memset::dst#1!=(const byte*) memset::end#0) goto memset::@2 -- pbuz1_neq_pbuc1_then_la1
lda dst+1
cmp #>end
bne b2
@ -563,24 +632,8 @@ memset: {
bne b2
// memset::@return
// }
// [10] return
// [12] return
rts
// memset::@2
b2:
// *dst = c
// [11] *((byte*) memset::dst#2) ← (const byte) memset::c#0 -- _deref_pbuz1=vbuc1
lda #c
ldy #0
sta (dst),y
// dst++;
// [12] (byte*) memset::dst#1 ← ++ (byte*) memset::dst#2 -- pbuz1=_inc_pbuz1
inc dst
bne !+
inc dst+1
!:
// [8] phi from memset::@2 to memset::@1 [phi:memset::@2->memset::@1]
// [8] phi (byte*) memset::dst#2 = (byte*) memset::dst#1 [phi:memset::@2->memset::@1#0] -- register_copy
jmp b1
}
// File Data

View File

@ -12,8 +12,8 @@
(byte) memset::c
(const byte) memset::c#0 c = (byte) 'c'
(byte*) memset::dst
(byte*) memset::dst#1 dst zp ZP_WORD:2 22.0
(byte*) memset::dst#2 dst zp ZP_WORD:2 14.666666666666666
(byte*) memset::dst#1 dst zp ZP_WORD:2 16.5
(byte*) memset::dst#4 dst zp ZP_WORD:2 16.5
(byte*) memset::end
(const byte*) memset::end#0 end = (byte*)(const void*) memset::str#0+(const word) memset::num#0
(word) memset::num
@ -22,4 +22,4 @@
(void*) memset::str
(const void*) memset::str#0 str = (void*)(const byte*) SCREEN#0
zp ZP_WORD:2 [ memset::dst#2 memset::dst#1 ]
zp ZP_WORD:2 [ memset::dst#4 memset::dst#1 ]

View File

@ -5,13 +5,11 @@
.label SCREEN = $400
main: {
ldx #0
b1:
cpx #$64
bne b2
rts
b2:
txa
sta SCREEN,x
inx
jmp b1
cpx #$64
bne b2
rts
}

View File

@ -9,15 +9,15 @@
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@2
main::@2: scope:[main] from main main::@1
[5] (byte) main::i#4 ← phi( main::@1/(byte) main::i#1 main/(byte) 0 )
[6] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::i#4
[7] (byte) main::i#1 ← ++ (byte) main::i#4
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 )
[6] if((byte) main::i#2!=(byte) $64) goto main::@2
main::@1: scope:[main] from main::@2
[8] if((byte) main::i#1!=(byte) $64) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@1
[7] return
[9] return
to:@return
main::@2: scope:[main] from main::@1
[8] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) main::i#2
[9] (byte) main::i#1 ← ++ (byte) main::i#2
to:main::@1

View File

@ -69,21 +69,56 @@ Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) SCREEN#0 = (byte*) 1024
Constant (const byte) main::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
GRAPH (NEW VERSIONS for main::i#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@2
[0] (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@2/(byte) main::i#1 )
[1] if((byte) main::i#2!=(byte) $64) goto main::@2
to:main::@return
main::@2: scope:[main] from main::@1
(byte) main::i#4 ← phi( )
[2] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::i#4
[3] (byte) main::i#1 ← ++ (byte) main::i#4
to:main::@1
main::@return: scope:[main] from main::@1
[4] return
to:@return
@1: scope:[] from @begin
[5] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Successful SSA optimization Pass2LoopHeadConstantIdentification
Alias (byte) main::i#1 = (byte) main::i#2
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::i#5 (const byte) main::i#0
Successful SSA optimization Pass2IdenticalPhiElimination
if() condition always true - replacing block destination [9] if((const byte) main::i#0!=(byte) $64) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Inlining constant with var siblings (const byte) main::i#0
Constant inlined main::i#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@7(between main::@1 and main::@2)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1_1
CALL GRAPH
Calls in [] to main:2
Created 1 initial phi equivalence classes
Coalesced [11] main::i#4 ← main::i#1
Coalesced [12] main::i#6 ← main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@1_1
Culled Empty Block (label) main::@7
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
@ -101,32 +136,32 @@ FINAL CONTROL FLOW GRAPH
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@2
main::@2: scope:[main] from main main::@1
[5] (byte) main::i#4 ← phi( main::@1/(byte) main::i#1 main/(byte) 0 )
[6] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::i#4
[7] (byte) main::i#1 ← ++ (byte) main::i#4
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@2/(byte) main::i#1 )
[6] if((byte) main::i#2!=(byte) $64) goto main::@2
main::@1: scope:[main] from main::@2
[8] if((byte) main::i#1!=(byte) $64) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@1
[7] return
[9] return
to:@return
main::@2: scope:[main] from main::@1
[8] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) main::i#2
[9] (byte) main::i#1 ← ++ (byte) main::i#2
to:main::@1
VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) main()
(byte) main::i
(byte) main::i#1 22.0
(byte) main::i#2 18.333333333333332
(byte) main::i#1 16.5
(byte) main::i#4 22.0
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::i#4 main::i#1 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
[ main::i#4 main::i#1 ]
Allocated zp ZP_BYTE:2 [ main::i#4 main::i#1 ]
INITIAL ASM
Target platform is c64basic
@ -157,47 +192,48 @@ bend:
// main
main: {
.label i = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
// [5] phi from main to main::@2 [phi:main->main::@2]
b2_from_main:
// [5] phi (byte) main::i#4 = (byte) 0 [phi:main->main::@2#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
// main::@1
b1:
// [6] if((byte) main::i#2!=(byte) $64) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda #$64
cmp i
bne b2
jmp breturn
// main::@return
breturn:
// [7] return
rts
jmp b2
// [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
// [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@1->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [8] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) main::i#2 -- pbuc1_derefidx_vbuz1=vbuz1
// [6] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::i#4 -- pbuc1_derefidx_vbuz1=vbuz1
ldy i
tya
sta SCREEN,y
// [9] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [7] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuz1=_inc_vbuz1
inc i
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy
jmp b1
// main::@1
b1:
// [8] if((byte) main::i#1!=(byte) $64) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda #$64
cmp i
bne b2_from_b1
jmp breturn
// main::@return
breturn:
// [9] return
rts
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:2 [ main::i#4 main::i#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 40.33: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope [main] 38.5: zp ZP_BYTE:2 [ main::i#4 main::i#1 ]
Uplift Scope []
Uplifting [main] best 263 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 263 combination
Uplifting [main] best 293 combination reg byte x [ main::i#4 main::i#1 ]
Uplifting [] best 293 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -226,54 +262,60 @@ bend_from_b1:
bend:
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
// [5] phi from main to main::@2 [phi:main->main::@2]
b2_from_main:
// [5] phi (byte) main::i#4 = (byte) 0 [phi:main->main::@2#0] -- vbuxx=vbuc1
ldx #0
jmp b2
// [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
// [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@1->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [6] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::i#4 -- pbuc1_derefidx_vbuxx=vbuxx
txa
sta SCREEN,x
// [7] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuxx=_inc_vbuxx
inx
jmp b1
// main::@1
b1:
// [6] if((byte) main::i#2!=(byte) $64) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
// [8] if((byte) main::i#1!=(byte) $64) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #$64
bne b2
bne b2_from_b1
jmp breturn
// main::@return
breturn:
// [7] return
// [9] return
rts
// main::@2
b2:
// [8] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) main::i#2 -- pbuc1_derefidx_vbuxx=vbuxx
txa
sta SCREEN,x
// [9] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy
jmp b1
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b2
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b2_from_b1 with b2
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b2_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b2_from_main:
Removing instruction b1:
Removing instruction breturn:
Removing instruction b1_from_b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
@ -288,14 +330,14 @@ FINAL SYMBOL TABLE
(label) main::@2
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 22.0
(byte) main::i#2 reg byte x 18.333333333333332
(byte) main::i#1 reg byte x 16.5
(byte) main::i#4 reg byte x 22.0
reg byte x [ main::i#2 main::i#1 ]
reg byte x [ main::i#4 main::i#1 ]
FINAL ASSEMBLER
Score: 191
Score: 161
// File Comments
// Minimal classic while() loop
@ -314,31 +356,29 @@ Score: 191
// @end
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
// [5] phi from main to main::@2 [phi:main->main::@2]
// [5] phi (byte) main::i#4 = (byte) 0 [phi:main->main::@2#0] -- vbuxx=vbuc1
ldx #0
// [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
// [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@1->main::@2#0] -- register_copy
// main::@2
b2:
// SCREEN[i] = i
// [6] *((const byte*) SCREEN#0 + (byte) main::i#4) ← (byte) main::i#4 -- pbuc1_derefidx_vbuxx=vbuxx
txa
sta SCREEN,x
// i++;
// [7] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuxx=_inc_vbuxx
inx
// main::@1
b1:
// while(i!=100)
// [6] if((byte) main::i#2!=(byte) $64) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
// [8] if((byte) main::i#1!=(byte) $64) goto main::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #$64
bne b2
// main::@return
// }
// [7] return
// [9] return
rts
// main::@2
b2:
// SCREEN[i] = i
// [8] *((const byte*) SCREEN#0 + (byte) main::i#2) ← (byte) main::i#2 -- pbuc1_derefidx_vbuxx=vbuxx
txa
sta SCREEN,x
// i++;
// [9] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#0] -- register_copy
jmp b1
}
// File Data

View File

@ -8,7 +8,7 @@
(label) main::@2
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 22.0
(byte) main::i#2 reg byte x 18.333333333333332
(byte) main::i#1 reg byte x 16.5
(byte) main::i#4 reg byte x 22.0
reg byte x [ main::i#2 main::i#1 ]
reg byte x [ main::i#4 main::i#1 ]

View File

@ -4,19 +4,8 @@
.pc = $80d "Program"
.label SCREEN = $400
main: {
lda #7
b1:
tax
inx
cmp #7
bne b2
// The condition-evaluation should increment i - even if when it is not met
lda #'x'
sta SCREEN,x
sta SCREEN+8
rts
b2:
txa
sta SCREEN,x
txa
jmp b1
}

View File

@ -10,18 +10,9 @@
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::i#2 ← phi( main/(byte) 7 main::@2/(byte~) main::i#5 )
[6] (byte) main::i#1 ← ++ (byte) main::i#2
[7] if((byte) main::i#2!=(byte) 7) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[8] *((const byte*) SCREEN#0 + (byte) main::i#1) ← (byte) 'x'
main::@1: scope:[main] from main
[5] *((const byte*) SCREEN#0+(byte) 8) ← (byte) 'x'
to:main::@return
main::@return: scope:[main] from main::@3
[9] return
main::@return: scope:[main] from main::@1
[6] return
to:@return
main::@2: scope:[main] from main::@1
[10] *((const byte*) SCREEN#0 + (byte) main::i#1) ← (byte) main::i#1
[11] (byte~) main::i#5 ← (byte) main::i#1
to:main::@1

View File

@ -74,21 +74,78 @@ Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) SCREEN#0 = (byte*) 1024
Constant (const byte) main::i#0 = 7
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with var siblings (const byte) main::i#0
GRAPH (NEW VERSIONS for main::i#1)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@2
[0] (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@2/(byte) main::i#5 )
[1] (byte) main::i#1 ← ++ (byte) main::i#2
[2] if((byte) main::i#2!=(byte) 7) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1
(byte) main::i#5 ← phi( )
[3] *((const byte*) SCREEN#0 + (byte) main::i#5) ← (byte) main::i#5
to:main::@1
main::@3: scope:[main] from main::@1
(byte) main::i#6 ← phi( )
[4] *((const byte*) SCREEN#0 + (byte) main::i#6) ← (byte) 'x'
to:main::@return
main::@return: scope:[main] from main::@3
[5] return
to:@return
@1: scope:[] from @begin
[6] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Successful SSA optimization Pass2LoopHeadConstantIdentification
Alias (byte) main::i#2 = (byte) main::i#5
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::i#7 (const byte) main::i#0
Successful SSA optimization Pass2IdenticalPhiElimination
Constant right-side identified [10] (byte) main::i#8 ← ++ (const byte) main::i#0
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte) main::i#8 = ++main::i#0
Successful SSA optimization Pass2ConstantIdentification
Removing PHI-reference to removed block (main::@1_1) in block main::@2
if() condition always false - eliminating [11] if((const byte) main::i#0!=(byte) 7) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating variable (byte) main::i#1 from unused block main::@1
Eliminating variable (byte) main::i#2 from unused block main::@2
Removing PHI-reference to removed block (main::@1) in block main::@2
Removing PHI-reference to removed block (main::@1) in block main::@3
Removing unused block main::@1
Removing unused block main::@2
Successful SSA optimization Pass2EliminateUnusedBlocks
Identical Phi Values (byte) main::i#6 (const byte) main::i#8
Successful SSA optimization Pass2IdenticalPhiElimination
Inlining constant with different constant siblings (const byte) main::i#0
Inlining constant with different constant siblings (const byte) main::i#8
Constant inlined main::i#8 = ++(byte) 7
Constant inlined main::i#0 = (byte) 7
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in *(SCREEN#0+++7)
Successful SSA optimization Pass2ConstantAdditionElimination
Simplifying constant integer increment ++7
Successful SSA optimization Pass2ConstantSimplification
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1_1
CALL GRAPH
Calls in [] to main:2
Created 1 initial phi equivalence classes
Not coalescing [12] main::i#5 ← main::i#1
Coalesced down to 2 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@1_1
Renumbering block main::@3 to main::@1
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
@ -107,39 +164,21 @@ FINAL CONTROL FLOW GRAPH
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::i#2 ← phi( main/(byte) 7 main::@2/(byte~) main::i#5 )
[6] (byte) main::i#1 ← ++ (byte) main::i#2
[7] if((byte) main::i#2!=(byte) 7) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[8] *((const byte*) SCREEN#0 + (byte) main::i#1) ← (byte) 'x'
main::@1: scope:[main] from main
[5] *((const byte*) SCREEN#0+(byte) 8) ← (byte) 'x'
to:main::@return
main::@return: scope:[main] from main::@3
[9] return
main::@return: scope:[main] from main::@1
[6] return
to:@return
main::@2: scope:[main] from main::@1
[10] *((const byte*) SCREEN#0 + (byte) main::i#1) ← (byte) main::i#1
[11] (byte~) main::i#5 ← (byte) main::i#1
to:main::@1
VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) main()
(byte) main::i
(byte) main::i#1 15.333333333333332
(byte) main::i#2 16.5
(byte~) main::i#5 22.0
Initial phi equivalence classes
[ main::i#2 main::i#5 ]
Added variable main::i#1 to zero page equivalence class [ main::i#1 ]
Complete equivalence classes
[ main::i#2 main::i#5 ]
[ main::i#1 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#5 ]
Allocated zp ZP_BYTE:3 [ main::i#1 ]
INITIAL ASM
Target platform is c64basic
@ -169,65 +208,30 @@ bend_from_b1:
bend:
// main
main: {
.label i = 3
.label i_2 = 2
.label i_5 = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::i#2 = (byte) 7 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #7
sta i_2
jmp b1
// main::@1
b1:
// [6] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz2
ldy i_2
iny
sty i
// [7] if((byte) main::i#2!=(byte) 7) goto main::@2 -- vbuz1_neq_vbuc1_then_la1
lda #7
cmp i_2
bne b2
jmp b3
// main::@3
b3:
// [8] *((const byte*) SCREEN#0 + (byte) main::i#1) ← (byte) 'x' -- pbuc1_derefidx_vbuz1=vbuc2
// [5] *((const byte*) SCREEN#0+(byte) 8) ← (byte) 'x' -- _deref_pbuc1=vbuc2
// The condition-evaluation should increment i - even if when it is not met
lda #'x'
ldy i
sta SCREEN,y
sta SCREEN+8
jmp breturn
// main::@return
breturn:
// [9] return
// [6] return
rts
// main::@2
b2:
// [10] *((const byte*) SCREEN#0 + (byte) main::i#1) ← (byte) main::i#1 -- pbuc1_derefidx_vbuz1=vbuz1
ldy i
tya
sta SCREEN,y
// [11] (byte~) main::i#5 ← (byte) main::i#1 -- vbuz1=vbuz2
lda i
sta i_5
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
// [5] phi (byte) main::i#2 = (byte~) main::i#5 [phi:main::@2->main::@1#0] -- register_copy
jmp b1
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [8] *((const byte*) SCREEN#0 + (byte) main::i#1) ← (byte) 'x' [ ] ( main:2 [ ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#5 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::i#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Statement [5] *((const byte*) SCREEN#0+(byte) 8) ← (byte) 'x' [ ] ( main:2 [ ] ) always clobbers reg byte a
REGISTER UPLIFT SCOPES
Uplift Scope [main] 38.5: zp ZP_BYTE:2 [ main::i#2 main::i#5 ] 15.33: zp ZP_BYTE:3 [ main::i#1 ]
Uplift Scope [main]
Uplift Scope []
Uplifting [main] best 313 combination reg byte a [ main::i#2 main::i#5 ] reg byte x [ main::i#1 ]
Uplifting [] best 313 combination
Uplifting [main] best 57 combination
Uplifting [] best 57 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -256,42 +260,18 @@ bend_from_b1:
bend:
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::i#2 = (byte) 7 [phi:main->main::@1#0] -- vbuaa=vbuc1
lda #7
jmp b1
// main::@1
b1:
// [6] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuaa
tax
inx
// [7] if((byte) main::i#2!=(byte) 7) goto main::@2 -- vbuaa_neq_vbuc1_then_la1
cmp #7
bne b2
jmp b3
// main::@3
b3:
// [8] *((const byte*) SCREEN#0 + (byte) main::i#1) ← (byte) 'x' -- pbuc1_derefidx_vbuxx=vbuc2
// [5] *((const byte*) SCREEN#0+(byte) 8) ← (byte) 'x' -- _deref_pbuc1=vbuc2
// The condition-evaluation should increment i - even if when it is not met
lda #'x'
sta SCREEN,x
sta SCREEN+8
jmp breturn
// main::@return
breturn:
// [9] return
// [6] return
rts
// main::@2
b2:
// [10] *((const byte*) SCREEN#0 + (byte) main::i#1) ← (byte) main::i#1 -- pbuc1_derefidx_vbuxx=vbuxx
txa
sta SCREEN,x
// [11] (byte~) main::i#5 ← (byte) main::i#1 -- vbuaa=vbuxx
txa
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
// [5] phi (byte) main::i#2 = (byte~) main::i#5 [phi:main::@2->main::@1#0] -- register_copy
jmp b1
}
// File Data
@ -299,7 +279,6 @@ ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b3
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction b1_from_bbegin:
@ -308,10 +287,8 @@ Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b3:
Removing instruction b1:
Removing instruction breturn:
Removing instruction b1_from_b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
@ -327,20 +304,13 @@ FINAL SYMBOL TABLE
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 15.333333333333332
(byte) main::i#2 reg byte a 16.5
(byte~) main::i#5 reg byte a 22.0
reg byte a [ main::i#2 main::i#5 ]
reg byte x [ main::i#1 ]
FINAL ASSEMBLER
Score: 238
Score: 12
// File Comments
// Test a while()-loop where the condition has a side-effect
@ -359,39 +329,16 @@ Score: 238
// @end
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::i#2 = (byte) 7 [phi:main->main::@1#0] -- vbuaa=vbuc1
lda #7
// main::@1
b1:
// while(i++!=7)
// [6] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuaa
tax
inx
// [7] if((byte) main::i#2!=(byte) 7) goto main::@2 -- vbuaa_neq_vbuc1_then_la1
cmp #7
bne b2
// main::@3
// (SCREEN)[i] = 'x'
// [8] *((const byte*) SCREEN#0 + (byte) main::i#1) ← (byte) 'x' -- pbuc1_derefidx_vbuxx=vbuc2
// [5] *((const byte*) SCREEN#0+(byte) 8) ← (byte) 'x' -- _deref_pbuc1=vbuc2
// The condition-evaluation should increment i - even if when it is not met
lda #'x'
sta SCREEN,x
sta SCREEN+8
// main::@return
// }
// [9] return
// [6] return
rts
// main::@2
b2:
// SCREEN[i] = i
// [10] *((const byte*) SCREEN#0 + (byte) main::i#1) ← (byte) main::i#1 -- pbuc1_derefidx_vbuxx=vbuxx
txa
sta SCREEN,x
// [11] (byte~) main::i#5 ← (byte) main::i#1 -- vbuaa=vbuxx
txa
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
// [5] phi (byte) main::i#2 = (byte~) main::i#5 [phi:main::@2->main::@1#0] -- register_copy
jmp b1
}
// File Data

View File

@ -5,13 +5,6 @@
(const byte*) SCREEN#0 SCREEN = (byte*) 1024
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 15.333333333333332
(byte) main::i#2 reg byte a 16.5
(byte~) main::i#5 reg byte a 22.0
reg byte a [ main::i#2 main::i#5 ]
reg byte x [ main::i#1 ]

View File

@ -4,9 +4,7 @@
main: {
lda #0
ldx #$a
b1:
cpx #5+1
bcc b2
b3:
stx $ff
clc
adc $ff
@ -15,4 +13,8 @@ main: {
cpx #0
bne b1
rts
b1:
cpx #5+1
bcc b2
jmp b3
}

View File

@ -9,20 +9,20 @@
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::s#2 ← phi( main/(byte) 0 main::@2/(byte) main::s#4 )
[5] (byte) main::i#2 ← phi( main/(byte) $a main::@2/(byte) main::i#1 )
[6] if((byte) main::i#2<(byte) 5+(byte) 1) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[7] (byte) main::s#1 ← (byte) main::s#2 + (byte) main::i#2
main::@3: scope:[main] from main main::@1
[5] (byte) main::s#5 ← phi( main::@1/(byte) main::s#1 main/(byte) 0 )
[5] (byte) main::i#6 ← phi( main::@1/(byte) main::i#1 main/(byte) $a )
[6] (byte) main::s#1 ← (byte) main::s#5 + (byte) main::i#6
to:main::@2
main::@2: scope:[main] from main::@1 main::@3
[8] (byte) main::s#4 ← phi( main::@1/(byte) main::s#2 main::@3/(byte) main::s#1 )
[9] (byte) main::i#1 ← -- (byte) main::i#2
[10] if((byte) main::i#1>(byte) 0) goto main::@1
[7] (byte) main::i#5 ← phi( main::@1/(byte) main::i#1 main::@3/(byte) main::i#6 )
[8] (byte) main::i#1 ← -- (byte) main::i#5
[9] if((byte) main::i#1>(byte) 0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[11] return
[10] return
to:@return
main::@1: scope:[main] from main::@2
[11] if((byte) main::i#1<(byte) 5+(byte) 1) goto main::@2
to:main::@3

View File

@ -97,6 +97,68 @@ Constant (const byte) main::i#0 = $a
Constant (const byte) main::s#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Rewriting conditional comparison [5] if((byte) main::i#2<=(byte) 5) goto main::@2
GRAPH (NEW VERSIONS for main::i#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@2
[0] (byte) main::s#2 ← phi( main/(const byte) main::s#0 main::@2/(byte) main::s#4 )
[0] (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@2/(byte) main::i#1 )
[1] if((byte) main::i#2<(byte) 5+(number) 1) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1 main::@3
[2] (byte) main::i#5 ← phi( )
[2] (byte) main::s#4 ← phi( main::@1/(byte) main::s#2 main::@3/(byte) main::s#1 )
[3] (byte) main::i#1 ← -- (byte) main::i#5
[4] if((byte) main::i#1>(byte) 0) goto main::@1
to:main::@return
main::@3: scope:[main] from main::@1
(byte) main::i#6 ← phi( )
[5] (byte) main::s#1 ← (byte) main::s#2 + (byte) main::i#6
to:main::@2
main::@return: scope:[main] from main::@2
[6] return
to:@return
@1: scope:[] from @begin
[7] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
GRAPH (NEW VERSIONS for main::s#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@2
[0] (byte) main::s#2 ← phi( main/(const byte) main::s#0 main::@2/(byte) main::s#4 )
[0] (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@2/(byte) main::i#1 )
[1] if((byte) main::i#2<(byte) 5+(number) 1) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1 main::@3
[2] (byte) main::i#5 ← phi( main::@1/(byte) main::i#2 main::@3/(byte) main::i#6 )
[2] (byte) main::s#4 ← phi( main::@1/(byte) main::s#2 main::@3/(byte) main::s#1 )
[3] (byte) main::i#1 ← -- (byte) main::i#5
[4] if((byte) main::i#1>(byte) 0) goto main::@1
to:main::@return
main::@3: scope:[main] from main::@1
(byte) main::s#5 ← phi( )
(byte) main::i#6 ← phi( main::@1/(byte) main::i#2 )
[5] (byte) main::s#1 ← (byte) main::s#5 + (byte) main::i#6
to:main::@2
main::@return: scope:[main] from main::@2
[6] return
to:@return
@1: scope:[] from @begin
[7] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Successful SSA optimization Pass2LoopHeadConstantIdentification
Adding number conversion cast (unumber) 5+1 in if((byte) main::i#2<(byte) 5+(number) 1) goto main::@2
Adding number conversion cast (unumber) 1 in if((byte) main::i#2<(unumber)(byte) 5+(number) 1) goto main::@2
Successful SSA optimization PassNAddNumberTypeConversions
@ -105,30 +167,44 @@ Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) main::i#1 = (byte) main::i#2
Alias (byte) main::s#2 = (byte) main::s#4
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::i#7 (const byte) main::i#0
Identical Phi Values (byte) main::s#6 (const byte) main::s#0
Successful SSA optimization Pass2IdenticalPhiElimination
Removing PHI-reference to removed block (main::@1_1) in block main::@2
Removing PHI-reference to removed block (main::@1_1) in block main::@2
if() condition always false - eliminating [10] if((const byte) main::i#0<(byte) 5+(byte) 1) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Identical Phi Values (byte) main::s#2 (byte) main::s#1
Successful SSA optimization Pass2IdenticalPhiElimination
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte) main::s#0
Constant inlined main::i#0 = (byte) $a
Constant inlined main::s#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@5(between main::@2 and main::@1)
Added new block during phi lifting main::@6(between main::@1 and main::@2)
Added new block during phi lifting main::@5(between main::@1 and main::@2)
Added new block during phi lifting main::@6(between main::@1 and main::@3)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1_1
CALL GRAPH
Calls in [] to main:2
Created 3 initial phi equivalence classes
Coalesced [9] main::s#7 ← main::s#1
Coalesced [14] main::i#5 ← main::i#1
Coalesced [15] main::s#5 ← main::s#4
Coalesced (already) [16] main::s#6 ← main::s#2
Coalesced [9] main::i#9 ← main::i#6
Coalesced [15] main::i#10 ← main::i#1
Coalesced [16] main::s#7 ← main::s#1
Coalesced (already) [17] main::i#8 ← main::i#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@5
Culled Empty Block (label) main::@1_1
Culled Empty Block (label) main::@6
Culled Empty Block (label) main::@5
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
@ -146,43 +222,43 @@ FINAL CONTROL FLOW GRAPH
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::s#2 ← phi( main/(byte) 0 main::@2/(byte) main::s#4 )
[5] (byte) main::i#2 ← phi( main/(byte) $a main::@2/(byte) main::i#1 )
[6] if((byte) main::i#2<(byte) 5+(byte) 1) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[7] (byte) main::s#1 ← (byte) main::s#2 + (byte) main::i#2
main::@3: scope:[main] from main main::@1
[5] (byte) main::s#5 ← phi( main::@1/(byte) main::s#1 main/(byte) 0 )
[5] (byte) main::i#6 ← phi( main::@1/(byte) main::i#1 main/(byte) $a )
[6] (byte) main::s#1 ← (byte) main::s#5 + (byte) main::i#6
to:main::@2
main::@2: scope:[main] from main::@1 main::@3
[8] (byte) main::s#4 ← phi( main::@1/(byte) main::s#2 main::@3/(byte) main::s#1 )
[9] (byte) main::i#1 ← -- (byte) main::i#2
[10] if((byte) main::i#1>(byte) 0) goto main::@1
[7] (byte) main::i#5 ← phi( main::@1/(byte) main::i#1 main::@3/(byte) main::i#6 )
[8] (byte) main::i#1 ← -- (byte) main::i#5
[9] if((byte) main::i#1>(byte) 0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[11] return
[10] return
to:@return
main::@1: scope:[main] from main::@2
[11] if((byte) main::i#1<(byte) 5+(byte) 1) goto main::@2
to:main::@3
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 11.0
(byte) main::i#1 168.33333333333331
(byte) main::i#5 213.0
(byte) main::i#6 61.5
(byte) main::s
(byte) main::s#1 22.0
(byte) main::s#2 16.5
(byte) main::s#4 11.0
(byte) main::s#1 22.4
(byte) main::s#5 112.0
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::s#2 main::s#4 main::s#1 ]
[ main::s#5 main::s#1 ]
[ main::i#5 main::i#6 main::i#1 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::s#2 main::s#4 main::s#1 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::s#2 main::s#4 main::s#1 ]
[ main::s#5 main::s#1 ]
[ main::i#5 main::i#6 main::i#1 ]
Allocated zp ZP_BYTE:2 [ main::s#5 main::s#1 ]
Allocated zp ZP_BYTE:3 [ main::i#5 main::i#6 main::i#1 ]
INITIAL ASM
Target platform is c64basic
@ -210,69 +286,68 @@ bend_from_b1:
bend:
// main
main: {
.label i = 2
.label s = 3
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::s#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
.label i = 3
.label s = 2
// [5] phi from main to main::@3 [phi:main->main::@3]
b3_from_main:
// [5] phi (byte) main::s#5 = (byte) 0 [phi:main->main::@3#0] -- vbuz1=vbuc1
lda #0
sta s
// [5] phi (byte) main::i#2 = (byte) $a [phi:main->main::@1#1] -- vbuz1=vbuc1
// [5] phi (byte) main::i#6 = (byte) $a [phi:main->main::@3#1] -- vbuz1=vbuc1
lda #$a
sta i
jmp b1
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
// [5] phi (byte) main::s#2 = (byte) main::s#4 [phi:main::@2->main::@1#0] -- register_copy
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
jmp b1
// main::@1
b1:
// [6] if((byte) main::i#2<(byte) 5+(byte) 1) goto main::@2 -- vbuz1_lt_vbuc1_then_la1
lda i
cmp #5+1
bcc b2_from_b1
jmp b3
// main::@3
b3:
// [7] (byte) main::s#1 ← (byte) main::s#2 + (byte) main::i#2 -- vbuz1=vbuz1_plus_vbuz2
// [6] (byte) main::s#1 ← (byte) main::s#5 + (byte) main::i#6 -- vbuz1=vbuz1_plus_vbuz2
lda s
clc
adc i
sta s
// [8] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
// [7] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
b2_from_b1:
b2_from_b3:
// [8] phi (byte) main::s#4 = (byte) main::s#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
// [7] phi (byte) main::i#5 = (byte) main::i#1 [phi:main::@1/main::@3->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [9] (byte) main::i#1 ← -- (byte) main::i#2 -- vbuz1=_dec_vbuz1
// [8] (byte) main::i#1 ← -- (byte) main::i#5 -- vbuz1=_dec_vbuz1
dec i
// [10] if((byte) main::i#1>(byte) 0) goto main::@1 -- vbuz1_gt_0_then_la1
// [9] if((byte) main::i#1>(byte) 0) goto main::@1 -- vbuz1_gt_0_then_la1
lda i
bne b1_from_b2
bne b1
jmp breturn
// main::@return
breturn:
// [11] return
// [10] return
rts
// main::@1
b1:
// [11] if((byte) main::i#1<(byte) 5+(byte) 1) goto main::@2 -- vbuz1_lt_vbuc1_then_la1
lda i
cmp #5+1
bcc b2_from_b1
// [5] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
b3_from_b1:
// [5] phi (byte) main::s#5 = (byte) main::s#1 [phi:main::@1->main::@3#0] -- register_copy
// [5] phi (byte) main::i#6 = (byte) main::i#1 [phi:main::@1->main::@3#1] -- register_copy
jmp b3
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [7] (byte) main::s#1 ← (byte) main::s#2 + (byte) main::i#2 [ main::i#2 main::s#1 ] ( main:2 [ main::i#2 main::s#1 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Statement [7] (byte) main::s#1 ← (byte) main::s#2 + (byte) main::i#2 [ main::i#2 main::s#1 ] ( main:2 [ main::i#2 main::s#1 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::s#2 main::s#4 main::s#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Statement [6] (byte) main::s#1 ← (byte) main::s#5 + (byte) main::i#6 [ main::i#6 main::s#1 ] ( main:2 [ main::i#6 main::s#1 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::i#5 main::i#6 main::i#1 ]
Statement [6] (byte) main::s#1 ← (byte) main::s#5 + (byte) main::i#6 [ main::i#6 main::s#1 ] ( main:2 [ main::i#6 main::s#1 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::s#5 main::s#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::i#5 main::i#6 main::i#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 49.5: zp ZP_BYTE:3 [ main::s#2 main::s#4 main::s#1 ] 27.5: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope [main] 442.83: zp ZP_BYTE:3 [ main::i#5 main::i#6 main::i#1 ] 134.4: zp ZP_BYTE:2 [ main::s#5 main::s#1 ]
Uplift Scope []
Uplifting [main] best 398 combination reg byte a [ main::s#2 main::s#4 main::s#1 ] reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 398 combination
Uplifting [main] best 1898 combination reg byte x [ main::i#5 main::i#6 main::i#1 ] reg byte a [ main::s#5 main::s#1 ]
Uplifting [] best 1898 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -299,78 +374,72 @@ bend_from_b1:
bend:
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::s#2 = (byte) 0 [phi:main->main::@1#0] -- vbuaa=vbuc1
// [5] phi from main to main::@3 [phi:main->main::@3]
b3_from_main:
// [5] phi (byte) main::s#5 = (byte) 0 [phi:main->main::@3#0] -- vbuaa=vbuc1
lda #0
// [5] phi (byte) main::i#2 = (byte) $a [phi:main->main::@1#1] -- vbuxx=vbuc1
// [5] phi (byte) main::i#6 = (byte) $a [phi:main->main::@3#1] -- vbuxx=vbuc1
ldx #$a
jmp b1
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
// [5] phi (byte) main::s#2 = (byte) main::s#4 [phi:main::@2->main::@1#0] -- register_copy
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
jmp b1
// main::@1
b1:
// [6] if((byte) main::i#2<(byte) 5+(byte) 1) goto main::@2 -- vbuxx_lt_vbuc1_then_la1
cpx #5+1
bcc b2_from_b1
jmp b3
// main::@3
b3:
// [7] (byte) main::s#1 ← (byte) main::s#2 + (byte) main::i#2 -- vbuaa=vbuaa_plus_vbuxx
// [6] (byte) main::s#1 ← (byte) main::s#5 + (byte) main::i#6 -- vbuaa=vbuaa_plus_vbuxx
stx $ff
clc
adc $ff
// [8] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
// [7] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
b2_from_b1:
b2_from_b3:
// [8] phi (byte) main::s#4 = (byte) main::s#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
// [7] phi (byte) main::i#5 = (byte) main::i#1 [phi:main::@1/main::@3->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [9] (byte) main::i#1 ← -- (byte) main::i#2 -- vbuxx=_dec_vbuxx
// [8] (byte) main::i#1 ← -- (byte) main::i#5 -- vbuxx=_dec_vbuxx
dex
// [10] if((byte) main::i#1>(byte) 0) goto main::@1 -- vbuxx_gt_0_then_la1
// [9] if((byte) main::i#1>(byte) 0) goto main::@1 -- vbuxx_gt_0_then_la1
cpx #0
bne b1_from_b2
bne b1
jmp breturn
// main::@return
breturn:
// [11] return
// [10] return
rts
// main::@1
b1:
// [11] if((byte) main::i#1<(byte) 5+(byte) 1) goto main::@2 -- vbuxx_lt_vbuc1_then_la1
cpx #5+1
bcc b2_from_b1
// [5] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
b3_from_b1:
// [5] phi (byte) main::s#5 = (byte) main::s#1 [phi:main::@1->main::@3#0] -- register_copy
// [5] phi (byte) main::i#6 = (byte) main::i#1 [phi:main::@1->main::@3#1] -- register_copy
jmp b3
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b3
Removing instruction jmp b2
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b2_from_b1 with b2
Replacing label b1_from_b2 with b1
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_b2:
Removing instruction b2_from_b1:
Removing instruction b2_from_b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b3:
Removing instruction b3_from_main:
Removing instruction breturn:
Removing instruction b3_from_b1:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
@ -384,19 +453,19 @@ FINAL SYMBOL TABLE
(label) main::@3
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 11.0
(byte) main::i#1 reg byte x 168.33333333333331
(byte) main::i#5 reg byte x 213.0
(byte) main::i#6 reg byte x 61.5
(byte) main::s
(byte) main::s#1 reg byte a 22.0
(byte) main::s#2 reg byte a 16.5
(byte) main::s#4 reg byte a 11.0
(byte) main::s#1 reg byte a 22.4
(byte) main::s#5 reg byte a 112.0
reg byte x [ main::i#2 main::i#1 ]
reg byte a [ main::s#2 main::s#4 main::s#1 ]
reg byte a [ main::s#5 main::s#1 ]
reg byte x [ main::i#5 main::i#6 main::i#1 ]
FINAL ASSEMBLER
Score: 236
Score: 1256
// File Comments
// Upstart
@ -413,41 +482,43 @@ Score: 236
// @end
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::s#2 = (byte) 0 [phi:main->main::@1#0] -- vbuaa=vbuc1
// [5] phi from main to main::@3 [phi:main->main::@3]
// [5] phi (byte) main::s#5 = (byte) 0 [phi:main->main::@3#0] -- vbuaa=vbuc1
lda #0
// [5] phi (byte) main::i#2 = (byte) $a [phi:main->main::@1#1] -- vbuxx=vbuc1
// [5] phi (byte) main::i#6 = (byte) $a [phi:main->main::@3#1] -- vbuxx=vbuc1
ldx #$a
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
// [5] phi (byte) main::s#2 = (byte) main::s#4 [phi:main::@2->main::@1#0] -- register_copy
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
// main::@1
b1:
// if(i>5)
// [6] if((byte) main::i#2<(byte) 5+(byte) 1) goto main::@2 -- vbuxx_lt_vbuc1_then_la1
cpx #5+1
bcc b2
// main::@3
b3:
// s=s+i
// [7] (byte) main::s#1 ← (byte) main::s#2 + (byte) main::i#2 -- vbuaa=vbuaa_plus_vbuxx
// [6] (byte) main::s#1 ← (byte) main::s#5 + (byte) main::i#6 -- vbuaa=vbuaa_plus_vbuxx
stx $ff
clc
adc $ff
// [8] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
// [8] phi (byte) main::s#4 = (byte) main::s#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy
// [7] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2]
// [7] phi (byte) main::i#5 = (byte) main::i#1 [phi:main::@1/main::@3->main::@2#0] -- register_copy
// main::@2
b2:
// i--;
// [9] (byte) main::i#1 ← -- (byte) main::i#2 -- vbuxx=_dec_vbuxx
// [8] (byte) main::i#1 ← -- (byte) main::i#5 -- vbuxx=_dec_vbuxx
dex
// while (i>0)
// [10] if((byte) main::i#1>(byte) 0) goto main::@1 -- vbuxx_gt_0_then_la1
// [9] if((byte) main::i#1>(byte) 0) goto main::@1 -- vbuxx_gt_0_then_la1
cpx #0
bne b1
// main::@return
// }
// [11] return
// [10] return
rts
// main::@1
b1:
// if(i>5)
// [11] if((byte) main::i#1<(byte) 5+(byte) 1) goto main::@2 -- vbuxx_lt_vbuc1_then_la1
cpx #5+1
bcc b2
// [5] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
// [5] phi (byte) main::s#5 = (byte) main::s#1 [phi:main::@1->main::@3#0] -- register_copy
// [5] phi (byte) main::i#6 = (byte) main::i#1 [phi:main::@1->main::@3#1] -- register_copy
jmp b3
}
// File Data

View File

@ -7,12 +7,12 @@
(label) main::@3
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 11.0
(byte) main::i#1 reg byte x 168.33333333333331
(byte) main::i#5 reg byte x 213.0
(byte) main::i#6 reg byte x 61.5
(byte) main::s
(byte) main::s#1 reg byte a 22.0
(byte) main::s#2 reg byte a 16.5
(byte) main::s#4 reg byte a 11.0
(byte) main::s#1 reg byte a 22.4
(byte) main::s#5 reg byte a 112.0
reg byte x [ main::i#2 main::i#1 ]
reg byte a [ main::s#2 main::s#4 main::s#1 ]
reg byte a [ main::s#5 main::s#1 ]
reg byte x [ main::i#5 main::i#6 main::i#1 ]

View File

@ -25,15 +25,15 @@
// Plasma screen 2
.label SCREEN2 = $2c00
.const NUM_SQUARES = $30
.label heap_head = $18
.label SQUARES = 9
.label heap_head = 9
.label SQUARES = $13
.label print_char_cursor = 7
// Screen containing distance to center
.label SCREEN_DIST = $b
// Screen containing angle to center
.label SCREEN_ANGLE = $d
.label sin_offset_x = 2
.label sin_offset_y = $f
.label sin_offset_y = $11
bbegin:
lda #<$3e8
sta malloc.size
@ -105,10 +105,10 @@ main: {
doplasma: {
.label angle = 3
.label dist = 5
.label sin_x = $1a
.label sin_y = $11
.label sin_x = $13
.label sin_y = $f
.label screen = 7
.label y = $10
.label y = $12
lda SCREEN_ANGLE
sta angle
lda SCREEN_ANGLE+1
@ -188,7 +188,7 @@ doplasma: {
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(void* zeropage(3) str, byte register(X) c)
memset: {
.label end = $1a
.label end = $f
.label dst = 3
.label str = 3
lda str
@ -216,13 +216,13 @@ memset: {
}
// Make a plasma-friendly charset where the chars are randomly filled
make_plasma_charset: {
.label _4 = $10
.label _8 = $11
.label _9 = $11
.label s = $f
.label _4 = $12
.label _8 = $13
.label _9 = $13
.label s = $11
.label i = 2
.label c = 5
.label _16 = $11
.label _16 = $13
jsr sid_rnd_init
jsr print_cls
lda #<print_line_cursor
@ -350,17 +350,17 @@ sid_rnd_init: {
// Utilizes symmetry around the center
// init_angle_screen(byte* zeropage(3) screen)
init_angle_screen: {
.label _10 = $11
.label _10 = $18
.label screen = 3
.label screen_topline = 5
.label screen_bottomline = 3
.label xw = $14
.label xw = $13
.label yw = $16
.label angle_w = $11
.label ang_w = $13
.label x = $10
.label angle_w = $18
.label ang_w = $15
.label x = $12
.label xb = 2
.label y = $f
.label y = $11
lda screen
clc
adc #<$28*$c
@ -448,17 +448,17 @@ init_angle_screen: {
// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y)
// Finding the angle requires a binary search using CORDIC_ITERATIONS_16
// Returns the angle in hex-degrees (0=0, 0x8000=PI, 0x10000=2*PI)
// atan2_16(signed word zeropage($14) x, signed word zeropage($16) y)
// atan2_16(signed word zeropage($13) x, signed word zeropage($16) y)
atan2_16: {
.label _2 = 7
.label _7 = $1a
.label _7 = $f
.label yi = 7
.label xi = $1a
.label angle = $11
.label xi = $f
.label angle = $18
.label xd = 9
.label yd = $18
.label return = $11
.label x = $14
.label yd = $1a
.label return = $18
.label x = $13
.label y = $16
lda y+1
bmi !b1+
@ -640,11 +640,11 @@ atan2_16: {
init_dist_screen: {
.label screen = 3
.label screen_bottomline = 5
.label yds = $14
.label xds = $16
.label ds = $16
.label x = $f
.label xb = $10
.label yds = $16
.label xds = $18
.label ds = $18
.label x = $11
.label xb = $12
.label screen_topline = 3
.label y = 2
jsr init_squares
@ -735,16 +735,16 @@ init_dist_screen: {
// Find the (integer) square root of a word value
// If the square is not an integer then it returns the largest integer N where N*N <= val
// Uses a table of squares that must be initialized by calling init_squares()
// sqrt(word zeropage($16) val)
// sqrt(word zeropage($18) val)
sqrt: {
.label _1 = 7
.label _3 = 7
.label found = 7
.label val = $16
.label _1 = $f
.label _3 = $f
.label found = $f
.label val = $18
lda SQUARES
sta bsearch16u.items
sta bsearch16u.items_1
lda SQUARES+1
sta bsearch16u.items+1
sta bsearch16u.items_1+1
jsr bsearch16u
lda _3
sec
@ -763,46 +763,27 @@ sqrt: {
// - items - Pointer to the start of the array to search in
// - num - The number of items in the array
// Returns pointer to an entry in the array that matches the search key
// bsearch16u(word zeropage($16) key, word* zeropage(7) items, byte register(X) num)
// bsearch16u(word zeropage($18) key, word* zeropage($f) items, byte register(X) num)
bsearch16u: {
.label _2 = 7
.label pivot = $18
.label _2 = $f
.label pivot = $f
.label result = $1a
.label return = 7
.label items = 7
.label key = $16
.label return = $f
.label items = $f
.label key = $18
.label items_1 = 7
.label items_10 = 7
.label items_16 = 7
ldx #NUM_SQUARES
b3:
cpx #0
bne b4
ldy #1
lda (items),y
cmp key+1
bne !+
dey
lda (items),y
cmp key
beq b2
!:
bcc b2
lda _2
sec
sbc #<1*SIZEOF_WORD
sta _2
lda _2+1
sbc #>1*SIZEOF_WORD
sta _2+1
b2:
rts
b4:
txa
lsr
asl
clc
adc items
adc items_10
sta pivot
lda #0
adc items+1
adc items_10+1
sta pivot+1
sec
lda key
@ -816,38 +797,66 @@ bsearch16u: {
bne b6
lda result
bne b6
lda pivot
sta return
lda pivot+1
sta return+1
breturn:
rts
b6:
lda result+1
bmi b7
bmi b10
bne !+
lda result
beq b7
beq b10
!:
lda #1*SIZEOF_WORD
clc
adc pivot
adc items
sta items
lda #0
adc pivot+1
sta items+1
bcc !+
inc items+1
!:
dex
b7:
txa
lsr
tax
jmp b3
cpx #0
bne b9
ldy #1
lda (items),y
cmp key+1
bne !+
dey
lda (items),y
cmp key
beq breturn
!:
bcc breturn
lda _2
sec
sbc #<1*SIZEOF_WORD
sta _2
lda _2+1
sbc #>1*SIZEOF_WORD
sta _2+1
rts
b9:
lda items
sta items_16
lda items+1
sta items_16+1
jmp b4
b10:
lda items_10
sta items
lda items_10+1
sta items+1
jmp b7
}
// Find the square of a byte value
// Uses a table of squares that must be initialized by calling init_squares()
// sqr(byte register(A) val)
sqr: {
.label return = $16
.label return_2 = $14
.label return = $18
.label return_2 = $16
asl
tay
lda (SQUARES),y
@ -860,8 +869,8 @@ sqr: {
// Initialize squares table
// Uses iterative formula (x+1)^2 = x^2 + 2*x + 1
init_squares: {
.label squares = $11
.label sqr = $1a
.label squares = $1a
.label sqr = $18
lda #<NUM_SQUARES*SIZEOF_WORD
sta malloc.size
lda #>NUM_SQUARES*SIZEOF_WORD
@ -906,10 +915,10 @@ init_squares: {
}
// Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.
// malloc(word zeropage(9) size)
// malloc(word zeropage($13) size)
malloc: {
.label mem = 9
.label size = 9
.label mem = $13
.label size = $13
lda heap_head
sec
sbc mem

View File

@ -428,84 +428,87 @@ sqrt::@return: scope:[sqrt] from sqrt::@1
to:@return
bsearch16u: scope:[bsearch16u] from sqrt
[218] phi()
to:bsearch16u::@4
bsearch16u::@4: scope:[bsearch16u] from bsearch16u bsearch16u::@9
[219] (word*) bsearch16u::items#10 ← phi( bsearch16u::@9/(word*~) bsearch16u::items#16 bsearch16u/(word*) bsearch16u::items#1 )
[219] (byte) bsearch16u::num#10 ← phi( bsearch16u::@9/(byte) bsearch16u::num#0 bsearch16u/(const byte) NUM_SQUARES#3 )
[220] (byte~) bsearch16u::$6 ← (byte) bsearch16u::num#10 >> (byte) 1
[221] (byte~) bsearch16u::$16 ← (byte~) bsearch16u::$6 << (byte) 1
[222] (word*) bsearch16u::pivot#0 ← (word*) bsearch16u::items#10 + (byte~) bsearch16u::$16
[223] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0)
[224] if((signed word) bsearch16u::result#0!=(signed byte) 0) goto bsearch16u::@6
to:bsearch16u::@return
bsearch16u::@return: scope:[bsearch16u] from bsearch16u::@2 bsearch16u::@4
[225] (word*) bsearch16u::return#1 ← phi( bsearch16u::@4/(word*) bsearch16u::pivot#0 bsearch16u::@2/(word*) bsearch16u::return#2 )
[226] return
to:@return
bsearch16u::@6: scope:[bsearch16u] from bsearch16u::@4
[227] if((signed word) bsearch16u::result#0<=(signed byte) 0) goto bsearch16u::@10
to:bsearch16u::@8
bsearch16u::@8: scope:[bsearch16u] from bsearch16u::@6
[228] (word*) bsearch16u::items#0 ← (word*) bsearch16u::pivot#0 + (byte) 1*(const byte) SIZEOF_WORD
[229] (byte) bsearch16u::num#1 ← -- (byte) bsearch16u::num#10
to:bsearch16u::@7
bsearch16u::@7: scope:[bsearch16u] from bsearch16u::@10 bsearch16u::@8
[230] (word*) bsearch16u::items#11 ← phi( bsearch16u::@8/(word*) bsearch16u::items#0 bsearch16u::@10/(word*~) bsearch16u::items#19 )
[230] (byte) bsearch16u::num#5 ← phi( bsearch16u::@8/(byte) bsearch16u::num#1 bsearch16u::@10/(byte) bsearch16u::num#10 )
[231] (byte) bsearch16u::num#0 ← (byte) bsearch16u::num#5 >> (byte) 1
to:bsearch16u::@3
bsearch16u::@3: scope:[bsearch16u] from bsearch16u bsearch16u::@7
[219] (word*) bsearch16u::items#2 ← phi( bsearch16u/(word*) bsearch16u::items#1 bsearch16u::@7/(word*) bsearch16u::items#8 )
[219] (byte) bsearch16u::num#3 ← phi( bsearch16u/(const byte) NUM_SQUARES#3 bsearch16u::@7/(byte) bsearch16u::num#0 )
[220] if((byte) bsearch16u::num#3>(byte) 0) goto bsearch16u::@4
bsearch16u::@3: scope:[bsearch16u] from bsearch16u::@7
[232] if((byte) bsearch16u::num#0>(byte) 0) goto bsearch16u::@9
to:bsearch16u::@5
bsearch16u::@5: scope:[bsearch16u] from bsearch16u::@3
[221] if(*((word*) bsearch16u::items#2)<=(word) bsearch16u::key#0) goto bsearch16u::@2
[233] if(*((word*) bsearch16u::items#11)<=(word) bsearch16u::key#0) goto bsearch16u::@2
to:bsearch16u::@1
bsearch16u::@1: scope:[bsearch16u] from bsearch16u::@5
[222] (word*~) bsearch16u::$2 ← (word*) bsearch16u::items#2 - (byte) 1*(const byte) SIZEOF_WORD
[234] (word*~) bsearch16u::$2 ← (word*) bsearch16u::items#11 - (byte) 1*(const byte) SIZEOF_WORD
to:bsearch16u::@2
bsearch16u::@2: scope:[bsearch16u] from bsearch16u::@1 bsearch16u::@5
[223] (word*) bsearch16u::return#2 ← phi( bsearch16u::@5/(word*) bsearch16u::items#2 bsearch16u::@1/(word*~) bsearch16u::$2 )
[235] (word*) bsearch16u::return#2 ← phi( bsearch16u::@5/(word*) bsearch16u::items#11 bsearch16u::@1/(word*~) bsearch16u::$2 )
to:bsearch16u::@return
bsearch16u::@return: scope:[bsearch16u] from bsearch16u::@2 bsearch16u::@8
[224] (word*) bsearch16u::return#1 ← phi( bsearch16u::@8/(word*~) bsearch16u::return#6 bsearch16u::@2/(word*) bsearch16u::return#2 )
[225] return
to:@return
bsearch16u::@4: scope:[bsearch16u] from bsearch16u::@3
[226] (byte~) bsearch16u::$6 ← (byte) bsearch16u::num#3 >> (byte) 1
[227] (byte~) bsearch16u::$16 ← (byte~) bsearch16u::$6 << (byte) 1
[228] (word*) bsearch16u::pivot#0 ← (word*) bsearch16u::items#2 + (byte~) bsearch16u::$16
[229] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0)
[230] if((signed word) bsearch16u::result#0!=(signed byte) 0) goto bsearch16u::@6
to:bsearch16u::@8
bsearch16u::@8: scope:[bsearch16u] from bsearch16u::@4
[231] (word*~) bsearch16u::return#6 ← (word*) bsearch16u::pivot#0
to:bsearch16u::@return
bsearch16u::@6: scope:[bsearch16u] from bsearch16u::@4
[232] if((signed word) bsearch16u::result#0<=(signed byte) 0) goto bsearch16u::@7
to:bsearch16u::@9
bsearch16u::@9: scope:[bsearch16u] from bsearch16u::@6
[233] (word*) bsearch16u::items#0 ← (word*) bsearch16u::pivot#0 + (byte) 1*(const byte) SIZEOF_WORD
[234] (byte) bsearch16u::num#1 ← -- (byte) bsearch16u::num#3
bsearch16u::@9: scope:[bsearch16u] from bsearch16u::@3
[236] (word*~) bsearch16u::items#16 ← (word*) bsearch16u::items#11
to:bsearch16u::@4
bsearch16u::@10: scope:[bsearch16u] from bsearch16u::@6
[237] (word*~) bsearch16u::items#19 ← (word*) bsearch16u::items#10
to:bsearch16u::@7
bsearch16u::@7: scope:[bsearch16u] from bsearch16u::@6 bsearch16u::@9
[235] (word*) bsearch16u::items#8 ← phi( bsearch16u::@9/(word*) bsearch16u::items#0 bsearch16u::@6/(word*) bsearch16u::items#2 )
[235] (byte) bsearch16u::num#5 ← phi( bsearch16u::@9/(byte) bsearch16u::num#1 bsearch16u::@6/(byte) bsearch16u::num#3 )
[236] (byte) bsearch16u::num#0 ← (byte) bsearch16u::num#5 >> (byte) 1
to:bsearch16u::@3
sqr: scope:[sqr] from init_dist_screen::@4 init_dist_screen::@8
[237] (byte) sqr::val#2 ← phi( init_dist_screen::@4/(byte) sqr::val#0 init_dist_screen::@8/(byte) sqr::val#1 )
[238] (byte~) sqr::$0 ← (byte) sqr::val#2 << (byte) 1
[239] (word) sqr::return#0 ← *((word*)(void*) SQUARES#1 + (byte~) sqr::$0)
[238] (byte) sqr::val#2 ← phi( init_dist_screen::@4/(byte) sqr::val#0 init_dist_screen::@8/(byte) sqr::val#1 )
[239] (byte~) sqr::$0 ← (byte) sqr::val#2 << (byte) 1
[240] (word) sqr::return#0 ← *((word*)(void*) SQUARES#1 + (byte~) sqr::$0)
to:sqr::@return
sqr::@return: scope:[sqr] from sqr
[240] return
[241] return
to:@return
init_squares: scope:[init_squares] from init_dist_screen
[241] phi()
[242] call malloc
[242] phi()
[243] call malloc
to:init_squares::@2
init_squares::@2: scope:[init_squares] from init_squares
[243] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0
[244] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1
[244] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0
[245] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1
to:init_squares::@1
init_squares::@1: scope:[init_squares] from init_squares::@1 init_squares::@2
[245] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares::@2/(byte) 0 )
[245] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares::@2/(word*) init_squares::squares#0 )
[245] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares::@2/(byte) 0 )
[246] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[247] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[248] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[249] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[250] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[251] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[252] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
[246] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares::@2/(byte) 0 )
[246] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares::@2/(word*) init_squares::squares#0 )
[246] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares::@2/(byte) 0 )
[247] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[248] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[249] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[250] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[251] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[252] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[253] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
to:init_squares::@return
init_squares::@return: scope:[init_squares] from init_squares::@1
[253] return
[254] return
to:@return
malloc: scope:[malloc] from @1 @3 init_squares
[254] (word) malloc::size#3 ← phi( @1/(word) $3e8 @3/(word) $3e8 init_squares/(const byte) NUM_SQUARES#3*(const byte) SIZEOF_WORD )
[254] (byte*) heap_head#12 ← phi( @1/(const byte*) HEAP_TOP#0 @3/(byte*) heap_head#1 init_squares/(byte*) heap_head#1 )
[255] (byte*) malloc::mem#0 ← (byte*) heap_head#12 - (word) malloc::size#3
[256] (byte*) heap_head#1 ← (byte*) malloc::mem#0
[255] (word) malloc::size#3 ← phi( @1/(word) $3e8 @3/(word) $3e8 init_squares/(const byte) NUM_SQUARES#3*(const byte) SIZEOF_WORD )
[255] (byte*) heap_head#12 ← phi( @1/(const byte*) HEAP_TOP#0 @3/(byte*) heap_head#1 init_squares/(byte*) heap_head#1 )
[256] (byte*) malloc::mem#0 ← (byte*) heap_head#12 - (word) malloc::size#3
[257] (byte*) heap_head#1 ← (byte*) malloc::mem#0
to:malloc::@return
malloc::@return: scope:[malloc] from malloc
[257] return
[258] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -48,12 +48,12 @@
}}
(const byte) SIZEOF_WORD SIZEOF_WORD = (byte) 2
(word*) SQUARES
(void*) SQUARES#1 SQUARES zp ZP_WORD:9 0.03225806451612903
(void*) SQUARES#1 SQUARES zp ZP_WORD:19 0.03225806451612903
(word()) atan2_16((signed word) atan2_16::x , (signed word) atan2_16::y)
(signed word~) atan2_16::$2 $2 zp ZP_WORD:7 4.0
(byte~) atan2_16::$23 reg byte a 2002.0
(byte~) atan2_16::$24 reg byte a 2002.0
(signed word~) atan2_16::$7 $7 zp ZP_WORD:26 4.0
(signed word~) atan2_16::$7 $7 zp ZP_WORD:15 4.0
(label) atan2_16::@1
(label) atan2_16::@10
(label) atan2_16::@11
@ -77,27 +77,27 @@
(label) atan2_16::@9
(label) atan2_16::@return
(word) atan2_16::angle
(word) atan2_16::angle#1 angle zp ZP_WORD:17 3.0
(word) atan2_16::angle#11 angle zp ZP_WORD:17 4.0
(word) atan2_16::angle#12 angle zp ZP_WORD:17 190.66666666666666
(word) atan2_16::angle#13 angle zp ZP_WORD:17 1334.6666666666667
(word) atan2_16::angle#2 angle zp ZP_WORD:17 2002.0
(word) atan2_16::angle#3 angle zp ZP_WORD:17 2002.0
(word) atan2_16::angle#4 angle zp ZP_WORD:17 4.0
(word) atan2_16::angle#5 angle zp ZP_WORD:17 4.0
(word) atan2_16::angle#6 angle zp ZP_WORD:17 2004.0
(word) atan2_16::angle#1 angle zp ZP_WORD:24 3.0
(word) atan2_16::angle#11 angle zp ZP_WORD:24 4.0
(word) atan2_16::angle#12 angle zp ZP_WORD:24 190.66666666666666
(word) atan2_16::angle#13 angle zp ZP_WORD:24 1334.6666666666667
(word) atan2_16::angle#2 angle zp ZP_WORD:24 2002.0
(word) atan2_16::angle#3 angle zp ZP_WORD:24 2002.0
(word) atan2_16::angle#4 angle zp ZP_WORD:24 4.0
(word) atan2_16::angle#5 angle zp ZP_WORD:24 4.0
(word) atan2_16::angle#6 angle zp ZP_WORD:24 2004.0
(byte) atan2_16::i
(byte) atan2_16::i#1 reg byte x 1501.5
(byte) atan2_16::i#2 reg byte x 208.54166666666669
(word) atan2_16::return
(word) atan2_16::return#0 return zp ZP_WORD:17 34.99999999999999
(word) atan2_16::return#2 return zp ZP_WORD:17 202.0
(word) atan2_16::return#0 return zp ZP_WORD:24 34.99999999999999
(word) atan2_16::return#2 return zp ZP_WORD:24 202.0
(byte) atan2_16::shift
(byte) atan2_16::shift#1 reg byte y 20002.0
(byte) atan2_16::shift#2 reg byte y 8001.25
(byte~) atan2_16::shift#5 reg byte y 667.3333333333334
(signed word) atan2_16::x
(signed word) atan2_16::x#0 x zp ZP_WORD:20 2.8684210526315796
(signed word) atan2_16::x#0 x zp ZP_WORD:19 2.8684210526315796
(signed word) atan2_16::xd
(signed word) atan2_16::xd#1 xd zp ZP_WORD:9 6667.333333333333
(signed word~) atan2_16::xd#10 xd zp ZP_WORD:9 1001.0
@ -105,20 +105,20 @@
(signed word) atan2_16::xd#3 xd zp ZP_WORD:9 7668.333333333332
(signed word) atan2_16::xd#5 xd zp ZP_WORD:9 1001.0
(signed word) atan2_16::xi
(signed word) atan2_16::xi#0 xi zp ZP_WORD:26 6.0
(signed word) atan2_16::xi#1 xi zp ZP_WORD:26 500.5
(signed word~) atan2_16::xi#13 xi zp ZP_WORD:26 4.0
(signed word) atan2_16::xi#2 xi zp ZP_WORD:26 500.5
(signed word) atan2_16::xi#3 xi zp ZP_WORD:26 267.0666666666667
(signed word) atan2_16::xi#8 xi zp ZP_WORD:26 1001.0
(signed word) atan2_16::xi#0 xi zp ZP_WORD:15 6.0
(signed word) atan2_16::xi#1 xi zp ZP_WORD:15 500.5
(signed word~) atan2_16::xi#13 xi zp ZP_WORD:15 4.0
(signed word) atan2_16::xi#2 xi zp ZP_WORD:15 500.5
(signed word) atan2_16::xi#3 xi zp ZP_WORD:15 267.0666666666667
(signed word) atan2_16::xi#8 xi zp ZP_WORD:15 1001.0
(signed word) atan2_16::y
(signed word) atan2_16::y#0 y zp ZP_WORD:22 2.724999999999999
(signed word) atan2_16::yd
(signed word) atan2_16::yd#1 yd zp ZP_WORD:24 10001.0
(signed word~) atan2_16::yd#10 yd zp ZP_WORD:24 2002.0
(signed word) atan2_16::yd#2 yd zp ZP_WORD:24 2002.0
(signed word) atan2_16::yd#3 yd zp ZP_WORD:24 4601.0
(signed word) atan2_16::yd#5 yd zp ZP_WORD:24 2002.0
(signed word) atan2_16::yd#1 yd zp ZP_WORD:26 10001.0
(signed word~) atan2_16::yd#10 yd zp ZP_WORD:26 2002.0
(signed word) atan2_16::yd#2 yd zp ZP_WORD:26 2002.0
(signed word) atan2_16::yd#3 yd zp ZP_WORD:26 4601.0
(signed word) atan2_16::yd#5 yd zp ZP_WORD:26 2002.0
(signed word) atan2_16::yi
(signed word) atan2_16::yi#0 yi zp ZP_WORD:7 1.2000000000000002
(signed word) atan2_16::yi#1 yi zp ZP_WORD:7 667.3333333333334
@ -128,9 +128,10 @@
(signed word) atan2_16::yi#8 yi zp ZP_WORD:7 1001.0
(word*()) bsearch16u((word) bsearch16u::key , (word*) bsearch16u::items , (byte) bsearch16u::num)
(byte~) bsearch16u::$16 reg byte a 2002.0
(word*~) bsearch16u::$2 $2 zp ZP_WORD:7 4.0
(word*~) bsearch16u::$2 $2 zp ZP_WORD:15 4.0
(byte~) bsearch16u::$6 reg byte a 2002.0
(label) bsearch16u::@1
(label) bsearch16u::@10
(label) bsearch16u::@2
(label) bsearch16u::@3
(label) bsearch16u::@4
@ -141,26 +142,27 @@
(label) bsearch16u::@9
(label) bsearch16u::@return
(word*) bsearch16u::items
(word*) bsearch16u::items#0 items zp ZP_WORD:7 1001.0
(word*) bsearch16u::items#1 items zp ZP_WORD:7 2.0
(word*) bsearch16u::items#2 items zp ZP_WORD:7 334.5555555555556
(word*) bsearch16u::items#8 items zp ZP_WORD:7 1501.5
(word*) bsearch16u::items#0 items zp ZP_WORD:15 1001.0
(word*) bsearch16u::items#1 items#1 zp ZP_WORD:7 2.0
(word*) bsearch16u::items#10 items#10 zp ZP_WORD:7 429.2857142857143
(word*) bsearch16u::items#11 items zp ZP_WORD:15 752.25
(word*~) bsearch16u::items#16 items#16 zp ZP_WORD:7 2002.0
(word*~) bsearch16u::items#19 items zp ZP_WORD:15 2002.0
(word) bsearch16u::key
(word) bsearch16u::key#0 key zp ZP_WORD:22 0.26666666666666666
(word) bsearch16u::key#0 key zp ZP_WORD:24 0.23529411764705882
(byte) bsearch16u::num
(byte) bsearch16u::num#0 reg byte x 2002.0
(byte) bsearch16u::num#0 reg byte x 1001.0
(byte) bsearch16u::num#1 reg byte x 2002.0
(byte) bsearch16u::num#3 reg byte x 556.1111111111111
(byte) bsearch16u::num#10 reg byte x 444.8888888888889
(byte) bsearch16u::num#5 reg byte x 3003.0
(word*) bsearch16u::pivot
(word*) bsearch16u::pivot#0 pivot zp ZP_WORD:24 501.0
(word*) bsearch16u::pivot#0 pivot zp ZP_WORD:15 750.75
(signed word) bsearch16u::result
(signed word) bsearch16u::result#0 result zp ZP_WORD:26 1501.5
(word*) bsearch16u::return
(word*) bsearch16u::return#1 return zp ZP_WORD:7 2.0
(word*) bsearch16u::return#2 return zp ZP_WORD:7 6.0
(word*) bsearch16u::return#3 return zp ZP_WORD:7 4.0
(word*~) bsearch16u::return#6 return zp ZP_WORD:7 4.0
(word*) bsearch16u::return#1 return zp ZP_WORD:15 335.00000000000006
(word*) bsearch16u::return#2 return zp ZP_WORD:15 6.0
(word*) bsearch16u::return#3 return zp ZP_WORD:15 4.0
(void()) doplasma((byte*) doplasma::screen)
(byte~) doplasma::$2 reg byte a 2002.0
(label) doplasma::@1
@ -181,20 +183,20 @@
(byte*) doplasma::screen#5 screen zp ZP_WORD:7 200.83333333333334
(byte*) doplasma::screen#6 screen zp ZP_WORD:7 0.4
(byte*) doplasma::sin_x
(byte*) doplasma::sin_x#0 sin_x zp ZP_WORD:26 77.15384615384616
(byte*) doplasma::sin_x#0 sin_x zp ZP_WORD:19 77.15384615384616
(byte*) doplasma::sin_y
(byte*) doplasma::sin_y#0 sin_y zp ZP_WORD:17 83.58333333333334
(byte*) doplasma::sin_y#0 sin_y zp ZP_WORD:15 83.58333333333334
(byte) doplasma::x
(byte) doplasma::x#1 reg byte x 1501.5
(byte) doplasma::x#2 reg byte x 1668.3333333333335
(byte) doplasma::y
(byte) doplasma::y#1 y zp ZP_BYTE:16 151.5
(byte) doplasma::y#4 y zp ZP_BYTE:16 22.444444444444443
(byte) doplasma::y#1 y zp ZP_BYTE:18 151.5
(byte) doplasma::y#4 y zp ZP_BYTE:18 22.444444444444443
(byte*) heap_head
(byte*) heap_head#1 heap_head zp ZP_WORD:24 0.6000000000000001
(byte*) heap_head#12 heap_head zp ZP_WORD:24 6.0
(byte*) heap_head#1 heap_head zp ZP_WORD:9 0.6000000000000001
(byte*) heap_head#12 heap_head zp ZP_WORD:9 6.0
(void()) init_angle_screen((byte*) init_angle_screen::screen)
(word~) init_angle_screen::$10 $10 zp ZP_WORD:17 202.0
(word~) init_angle_screen::$10 $10 zp ZP_WORD:24 202.0
(byte~) init_angle_screen::$12 reg byte a 202.0
(byte~) init_angle_screen::$13 reg byte a 202.0
(byte~) init_angle_screen::$14 reg byte a 202.0
@ -207,9 +209,9 @@
(label) init_angle_screen::@4
(label) init_angle_screen::@return
(byte) init_angle_screen::ang_w
(byte) init_angle_screen::ang_w#0 ang_w zp ZP_BYTE:19 84.16666666666666
(byte) init_angle_screen::ang_w#0 ang_w zp ZP_BYTE:21 84.16666666666666
(word) init_angle_screen::angle_w
(word) init_angle_screen::angle_w#0 angle_w zp ZP_WORD:17 202.0
(word) init_angle_screen::angle_w#0 angle_w zp ZP_WORD:24 202.0
(byte*) init_angle_screen::screen
(byte*) init_angle_screen::screen#0 screen zp ZP_WORD:3 3.0
(byte*) init_angle_screen::screen_bottomline
@ -221,16 +223,16 @@
(byte*) init_angle_screen::screen_topline#1 screen_topline zp ZP_WORD:5 5.5
(byte*) init_angle_screen::screen_topline#5 screen_topline zp ZP_WORD:5 9.416666666666666
(byte) init_angle_screen::x
(byte) init_angle_screen::x#1 x zp ZP_BYTE:16 101.0
(byte) init_angle_screen::x#2 x zp ZP_BYTE:16 25.25
(byte) init_angle_screen::x#1 x zp ZP_BYTE:18 101.0
(byte) init_angle_screen::x#2 x zp ZP_BYTE:18 25.25
(byte) init_angle_screen::xb
(byte) init_angle_screen::xb#1 xb zp ZP_BYTE:2 101.0
(byte) init_angle_screen::xb#2 xb zp ZP_BYTE:2 19.238095238095237
(signed word) init_angle_screen::xw
(word) init_angle_screen::xw#0 xw zp ZP_WORD:20 33.666666666666664
(word) init_angle_screen::xw#0 xw zp ZP_WORD:19 33.666666666666664
(byte) init_angle_screen::y
(byte) init_angle_screen::y#1 y zp ZP_BYTE:15 16.5
(byte) init_angle_screen::y#4 y zp ZP_BYTE:15 4.730769230769231
(byte) init_angle_screen::y#1 y zp ZP_BYTE:17 16.5
(byte) init_angle_screen::y#4 y zp ZP_BYTE:17 4.730769230769231
(signed word) init_angle_screen::yw
(word) init_angle_screen::yw#0 yw zp ZP_WORD:22 50.5
(void()) init_dist_screen((byte*) init_dist_screen::screen)
@ -255,7 +257,7 @@
(byte) init_dist_screen::d
(byte) init_dist_screen::d#0 reg byte a 126.25
(word) init_dist_screen::ds
(word) init_dist_screen::ds#0 ds zp ZP_WORD:22 202.0
(word) init_dist_screen::ds#0 ds zp ZP_WORD:24 202.0
(byte*) init_dist_screen::screen
(byte*) init_dist_screen::screen#0 screen zp ZP_WORD:3 1.5
(byte*) init_dist_screen::screen_bottomline
@ -266,17 +268,17 @@
(byte*) init_dist_screen::screen_topline#1 screen_topline zp ZP_WORD:3 5.5
(byte*) init_dist_screen::screen_topline#10 screen_topline zp ZP_WORD:3 7.0625
(byte) init_dist_screen::x
(byte) init_dist_screen::x#1 x zp ZP_BYTE:15 101.0
(byte) init_dist_screen::x#2 x zp ZP_BYTE:15 26.578947368421055
(byte) init_dist_screen::x#1 x zp ZP_BYTE:17 101.0
(byte) init_dist_screen::x#2 x zp ZP_BYTE:17 26.578947368421055
(byte) init_dist_screen::x2
(byte) init_dist_screen::x2#0 reg byte a 202.0
(byte) init_dist_screen::xb
(byte) init_dist_screen::xb#1 xb zp ZP_BYTE:16 101.0
(byte) init_dist_screen::xb#2 xb zp ZP_BYTE:16 20.2
(byte) init_dist_screen::xb#1 xb zp ZP_BYTE:18 101.0
(byte) init_dist_screen::xb#2 xb zp ZP_BYTE:18 20.2
(byte) init_dist_screen::xd
(byte) init_dist_screen::xd#0 reg byte a 303.0
(word) init_dist_screen::xds
(word) init_dist_screen::xds#0 xds zp ZP_WORD:22 202.0
(word) init_dist_screen::xds#0 xds zp ZP_WORD:24 202.0
(byte) init_dist_screen::y
(byte) init_dist_screen::y#1 y zp ZP_BYTE:2 16.5
(byte) init_dist_screen::y#10 y zp ZP_BYTE:2 0.9705882352941178
@ -285,7 +287,7 @@
(byte) init_dist_screen::yd
(byte) init_dist_screen::yd#0 reg byte a 33.0
(word) init_dist_screen::yds
(word) init_dist_screen::yds#0 yds zp ZP_WORD:20 4.869565217391305
(word) init_dist_screen::yds#0 yds zp ZP_WORD:22 4.869565217391305
(void()) init_squares()
(byte~) init_squares::$3 reg byte a 22.0
(byte~) init_squares::$4 reg byte a 22.0
@ -296,12 +298,12 @@
(byte) init_squares::i#1 reg byte x 16.5
(byte) init_squares::i#2 reg byte x 5.5
(word) init_squares::sqr
(word) init_squares::sqr#1 sqr zp ZP_WORD:26 7.333333333333333
(word) init_squares::sqr#2 sqr zp ZP_WORD:26 6.6000000000000005
(word) init_squares::sqr#1 sqr zp ZP_WORD:24 7.333333333333333
(word) init_squares::sqr#2 sqr zp ZP_WORD:24 6.6000000000000005
(word*) init_squares::squares
(word*) init_squares::squares#0 squares zp ZP_WORD:17 4.0
(word*) init_squares::squares#1 squares zp ZP_WORD:17 3.6666666666666665
(word*) init_squares::squares#2 squares zp ZP_WORD:17 17.5
(word*) init_squares::squares#0 squares zp ZP_WORD:26 4.0
(word*) init_squares::squares#1 squares zp ZP_WORD:26 3.6666666666666665
(word*) init_squares::squares#2 squares zp ZP_WORD:26 17.5
(void()) main()
(label) main::@1
(label) main::@2
@ -340,12 +342,12 @@
(byte*) main::toD0182_screen
(void()) make_plasma_charset((byte*) make_plasma_charset::charset)
(byte~) make_plasma_charset::$11 reg byte a 22.0
(byte*~) make_plasma_charset::$16 $16 zp ZP_WORD:17 202.0
(byte*~) make_plasma_charset::$16 $16 zp ZP_WORD:19 202.0
(byte~) make_plasma_charset::$2 reg byte a 22.0
(byte~) make_plasma_charset::$3 reg byte a 2002.0
(byte~) make_plasma_charset::$4 $4 zp ZP_BYTE:16 2002.0
(word~) make_plasma_charset::$8 $8 zp ZP_WORD:17 202.0
(word~) make_plasma_charset::$9 $9 zp ZP_WORD:17 202.0
(byte~) make_plasma_charset::$4 $4 zp ZP_BYTE:18 2002.0
(word~) make_plasma_charset::$8 $8 zp ZP_WORD:19 202.0
(word~) make_plasma_charset::$9 $9 zp ZP_WORD:19 202.0
(label) make_plasma_charset::@1
(label) make_plasma_charset::@10
(label) make_plasma_charset::@11
@ -375,14 +377,14 @@
(byte) make_plasma_charset::ii#1 reg byte x 1501.5
(byte) make_plasma_charset::ii#2 reg byte x 375.375
(byte) make_plasma_charset::s
(byte) make_plasma_charset::s#0 s zp ZP_BYTE:15 56.22222222222223
(byte) make_plasma_charset::s#0 s zp ZP_BYTE:17 56.22222222222223
(void*()) malloc((word) malloc::size)
(label) malloc::@return
(byte*) malloc::mem
(byte*) malloc::mem#0 mem zp ZP_WORD:9 0.6666666666666666
(byte*) malloc::mem#0 mem zp ZP_WORD:19 0.6666666666666666
(void*) malloc::return
(word) malloc::size
(word) malloc::size#3 size zp ZP_WORD:9 2.0
(word) malloc::size#3 size zp ZP_WORD:19 2.0
(void*()) memset((void*) memset::str , (byte) memset::c , (word) memset::num)
(label) memset::@1
(label) memset::@2
@ -394,7 +396,7 @@
(byte*) memset::dst#2 dst zp ZP_WORD:3 17.5
(byte*~) memset::dst#3 dst zp ZP_WORD:3 4.0
(byte*) memset::end
(byte*) memset::end#0 end zp ZP_WORD:26 2.1666666666666665
(byte*) memset::end#0 end zp ZP_WORD:15 2.1666666666666665
(word) memset::num
(void*) memset::return
(void*) memset::str
@ -424,33 +426,33 @@
(byte) sin_offset_x#12 sin_offset_x zp ZP_BYTE:2 2.666666666666667
(byte) sin_offset_x#14 sin_offset_x zp ZP_BYTE:2 11.0
(byte) sin_offset_y
(byte) sin_offset_y#10 sin_offset_y zp ZP_BYTE:15 1.5294117647058825
(byte) sin_offset_y#12 sin_offset_y zp ZP_BYTE:15 3.0
(byte) sin_offset_y#14 sin_offset_y zp ZP_BYTE:15 11.0
(byte) sin_offset_y#10 sin_offset_y zp ZP_BYTE:17 1.5294117647058825
(byte) sin_offset_y#12 sin_offset_y zp ZP_BYTE:17 3.0
(byte) sin_offset_y#14 sin_offset_y zp ZP_BYTE:17 11.0
(word()) sqr((byte) sqr::val)
(byte~) sqr::$0 reg byte a 4.0
(label) sqr::@return
(word) sqr::return
(word) sqr::return#0 return zp ZP_WORD:22 28.5
(word) sqr::return#2 return#2 zp ZP_WORD:20 22.0
(word) sqr::return#3 return zp ZP_WORD:22 202.0
(word) sqr::return#0 return zp ZP_WORD:24 28.5
(word) sqr::return#2 return#2 zp ZP_WORD:22 22.0
(word) sqr::return#3 return zp ZP_WORD:24 202.0
(byte) sqr::val
(byte) sqr::val#0 reg byte a 22.0
(byte) sqr::val#1 reg byte a 202.0
(byte) sqr::val#2 reg byte a 114.0
(byte()) sqrt((word) sqrt::val)
(word~) sqrt::$1 $1 zp ZP_WORD:7 2.0
(word~) sqrt::$3 $3 zp ZP_WORD:7 4.0
(word~) sqrt::$1 $1 zp ZP_WORD:15 2.0
(word~) sqrt::$3 $3 zp ZP_WORD:15 4.0
(label) sqrt::@1
(label) sqrt::@return
(word*) sqrt::found
(word*) sqrt::found#0 found zp ZP_WORD:7 4.0
(word*) sqrt::found#0 found zp ZP_WORD:15 4.0
(byte) sqrt::return
(byte) sqrt::return#0 reg byte a 34.33333333333333
(byte) sqrt::return#2 reg byte a 202.0
(byte) sqrt::sq
(word) sqrt::val
(word) sqrt::val#0 val zp ZP_WORD:22 103.0
(word) sqrt::val#0 val zp ZP_WORD:24 103.0
reg byte x [ doplasma::x#2 doplasma::x#1 ]
reg byte x [ memset::c#3 ]
@ -463,42 +465,42 @@ zp ZP_WORD:3 [ init_dist_screen::screen_topline#10 init_dist_screen::screen_topl
zp ZP_WORD:5 [ init_dist_screen::screen_bottomline#10 init_dist_screen::screen_bottomline#1 init_dist_screen::screen_bottomline#0 init_angle_screen::screen_topline#5 init_angle_screen::screen_topline#0 init_angle_screen::screen_topline#1 make_plasma_charset::c#2 make_plasma_charset::c#1 doplasma::dist#4 doplasma::dist#0 doplasma::dist#1 ]
reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ]
reg byte a [ init_dist_screen::xd#0 init_dist_screen::$15 init_dist_screen::$13 ]
zp ZP_WORD:7 [ bsearch16u::return#1 bsearch16u::return#6 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#1 bsearch16u::items#8 bsearch16u::$2 bsearch16u::items#0 bsearch16u::return#3 sqrt::found#0 sqrt::$3 sqrt::$1 atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 print_char_cursor#49 print_char_cursor#18 print_char_cursor#1 doplasma::screen#5 doplasma::screen#6 doplasma::screen#2 ]
reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ]
zp ZP_WORD:7 [ bsearch16u::items#10 bsearch16u::items#16 bsearch16u::items#1 atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 print_char_cursor#49 print_char_cursor#18 print_char_cursor#1 doplasma::screen#5 doplasma::screen#6 doplasma::screen#2 ]
reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#10 bsearch16u::num#0 ]
reg byte a [ sqr::val#2 sqr::val#0 sqr::val#1 ]
reg byte x [ init_squares::i#2 init_squares::i#1 ]
zp ZP_WORD:9 [ malloc::size#3 malloc::mem#0 SQUARES#1 atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ]
zp ZP_WORD:9 [ heap_head#12 heap_head#1 atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ]
zp ZP_WORD:11 [ SCREEN_DIST#0 ]
zp ZP_WORD:13 [ SCREEN_ANGLE#0 ]
reg byte a [ doplasma::$2 ]
zp ZP_WORD:15 [ memset::end#0 doplasma::sin_y#0 bsearch16u::return#1 bsearch16u::pivot#0 bsearch16u::return#2 bsearch16u::items#11 bsearch16u::items#0 bsearch16u::items#19 bsearch16u::$2 bsearch16u::return#3 sqrt::found#0 sqrt::$3 sqrt::$1 atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ]
reg byte a [ make_plasma_charset::$2 ]
zp ZP_BYTE:15 [ make_plasma_charset::s#0 init_dist_screen::x#2 init_dist_screen::x#1 init_angle_screen::y#4 init_angle_screen::y#1 sin_offset_y#10 sin_offset_y#14 sin_offset_y#12 ]
zp ZP_BYTE:17 [ make_plasma_charset::s#0 init_dist_screen::x#2 init_dist_screen::x#1 init_angle_screen::y#4 init_angle_screen::y#1 sin_offset_y#10 sin_offset_y#14 sin_offset_y#12 ]
reg byte a [ sid_rnd::return#2 ]
reg byte a [ make_plasma_charset::$3 ]
zp ZP_BYTE:16 [ make_plasma_charset::$4 init_dist_screen::xb#2 init_dist_screen::xb#1 init_angle_screen::x#2 init_angle_screen::x#1 doplasma::y#4 doplasma::y#1 ]
zp ZP_WORD:17 [ make_plasma_charset::$8 make_plasma_charset::$9 make_plasma_charset::$16 doplasma::sin_y#0 init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::return#2 init_angle_screen::angle_w#0 init_angle_screen::$10 ]
zp ZP_BYTE:18 [ make_plasma_charset::$4 init_dist_screen::xb#2 init_dist_screen::xb#1 init_angle_screen::x#2 init_angle_screen::x#1 doplasma::y#4 doplasma::y#1 ]
reg byte a [ make_plasma_charset::$11 ]
reg byte a [ sid_rnd::return#0 ]
reg byte a [ init_angle_screen::$2 ]
reg byte a [ init_angle_screen::$3 ]
zp ZP_WORD:19 [ init_angle_screen::xw#0 atan2_16::x#0 make_plasma_charset::$8 make_plasma_charset::$9 make_plasma_charset::$16 doplasma::sin_x#0 malloc::size#3 malloc::mem#0 SQUARES#1 ]
reg byte a [ init_angle_screen::$6 ]
zp ZP_BYTE:19 [ init_angle_screen::ang_w#0 ]
zp ZP_BYTE:21 [ init_angle_screen::ang_w#0 ]
reg byte a [ init_angle_screen::$12 ]
reg byte a [ init_angle_screen::$13 ]
reg byte a [ init_angle_screen::$14 ]
reg byte a [ atan2_16::$24 ]
reg byte a [ atan2_16::$23 ]
reg byte a [ init_dist_screen::y2#0 ]
zp ZP_WORD:20 [ sqr::return#2 init_dist_screen::yds#0 init_angle_screen::xw#0 atan2_16::x#0 ]
zp ZP_WORD:22 [ sqr::return#2 init_dist_screen::yds#0 init_angle_screen::yw#0 atan2_16::y#0 ]
reg byte a [ init_dist_screen::x2#0 ]
zp ZP_WORD:22 [ sqr::return#3 init_dist_screen::xds#0 sqr::return#0 init_dist_screen::ds#0 sqrt::val#0 bsearch16u::key#0 init_angle_screen::yw#0 atan2_16::y#0 ]
zp ZP_WORD:24 [ sqr::return#3 init_dist_screen::xds#0 sqr::return#0 init_dist_screen::ds#0 sqrt::val#0 bsearch16u::key#0 init_squares::sqr#2 init_squares::sqr#1 atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::return#2 init_angle_screen::angle_w#0 init_angle_screen::$10 ]
reg byte a [ sqrt::return#2 ]
reg byte a [ init_dist_screen::d#0 ]
reg byte a [ sqrt::return#0 ]
reg byte a [ bsearch16u::$6 ]
reg byte a [ bsearch16u::$16 ]
zp ZP_WORD:24 [ bsearch16u::pivot#0 heap_head#12 heap_head#1 atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ]
zp ZP_WORD:26 [ bsearch16u::result#0 memset::end#0 doplasma::sin_x#0 init_squares::sqr#2 init_squares::sqr#1 atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ]
zp ZP_WORD:26 [ bsearch16u::result#0 init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ]
reg byte a [ sqr::$0 ]
reg byte a [ init_squares::$3 ]
reg byte a [ init_squares::$4 ]

View File

@ -18,10 +18,6 @@ lvaluevar: {
lda #>$400
sta screen+1
ldx #2
b1:
cpx #$a
bcc b2
rts
b2:
lda #b
ldy #0
@ -31,49 +27,43 @@ lvaluevar: {
inc screen+1
!:
inx
jmp b1
cpx #$a
bcc b2
rts
}
rvaluevar: {
.label screen2 = $400
.label screen = 2
ldy #0
lda #<$400
sta screen
lda #>$400
sta screen+1
ldx #2
b1:
cpx #$a
bcc b2
sty screen2
rts
b2:
ldy #0
lda (screen),y
tay
inc screen
bne !+
inc screen+1
!:
inx
jmp b1
cpx #$a
bcc b2
sta screen2
rts
}
rvalue: {
// A constant pointer
.label SCREEN = $400
.label screen2 = $400
// RValue constant array pointer constant index
lda SCREEN+1
ldx #2
b1:
b2:
lda SCREEN,x
inx
cpx #$a
bcc b2
sta screen2
rts
b2:
lda SCREEN,x
inx
jmp b1
}
lvalue: {
// A constant pointer
@ -85,13 +75,11 @@ lvalue: {
lda #2
sta SCREEN+1
tax
b1:
cpx #$a
bcc b2
rts
b2:
lda #3
sta SCREEN,x
inx
jmp b1
cpx #$a
bcc b2
rts
}

View File

@ -28,70 +28,68 @@ main::@return: scope:[main] from main::@3
to:@return
lvaluevar: scope:[lvaluevar] from main::@3
[13] phi()
to:lvaluevar::@2
lvaluevar::@2: scope:[lvaluevar] from lvaluevar lvaluevar::@1
[14] (byte*) lvaluevar::screen#4 ← phi( lvaluevar::@1/(byte*) lvaluevar::screen#1 lvaluevar/(byte*) 1024 )
[14] (byte) lvaluevar::i#4 ← phi( lvaluevar::@1/(byte) lvaluevar::i#1 lvaluevar/(byte) 2 )
[15] *((byte*) lvaluevar::screen#4) ← (const byte) lvaluevar::b#0
[16] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#4
[17] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#4
to:lvaluevar::@1
lvaluevar::@1: scope:[lvaluevar] from lvaluevar lvaluevar::@2
[14] (byte*) lvaluevar::screen#2 ← phi( lvaluevar/(byte*) 1024 lvaluevar::@2/(byte*) lvaluevar::screen#1 )
[14] (byte) lvaluevar::i#2 ← phi( lvaluevar/(byte) 2 lvaluevar::@2/(byte) lvaluevar::i#1 )
[15] if((byte) lvaluevar::i#2<(byte) $a) goto lvaluevar::@2
lvaluevar::@1: scope:[lvaluevar] from lvaluevar::@2
[18] if((byte) lvaluevar::i#1<(byte) $a) goto lvaluevar::@2
to:lvaluevar::@return
lvaluevar::@return: scope:[lvaluevar] from lvaluevar::@1
[16] return
[19] return
to:@return
lvaluevar::@2: scope:[lvaluevar] from lvaluevar::@1
[17] *((byte*) lvaluevar::screen#2) ← (const byte) lvaluevar::b#0
[18] (byte*) lvaluevar::screen#1 ← ++ (byte*) lvaluevar::screen#2
[19] (byte) lvaluevar::i#1 ← ++ (byte) lvaluevar::i#2
to:lvaluevar::@1
rvaluevar: scope:[rvaluevar] from main::@2
[20] phi()
to:rvaluevar::@2
rvaluevar::@2: scope:[rvaluevar] from rvaluevar rvaluevar::@1
[21] (byte*) rvaluevar::screen#4 ← phi( rvaluevar::@1/(byte*) rvaluevar::screen#1 rvaluevar/(byte*) 1024 )
[21] (byte) rvaluevar::i#4 ← phi( rvaluevar::@1/(byte) rvaluevar::i#1 rvaluevar/(byte) 2 )
[22] (byte) rvaluevar::b#1 ← *((byte*) rvaluevar::screen#4)
[23] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#4
[24] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#4
to:rvaluevar::@1
rvaluevar::@1: scope:[rvaluevar] from rvaluevar rvaluevar::@2
[21] (byte) rvaluevar::b#2 ← phi( rvaluevar/(byte) 0 rvaluevar::@2/(byte) rvaluevar::b#1 )
[21] (byte*) rvaluevar::screen#2 ← phi( rvaluevar/(byte*) 1024 rvaluevar::@2/(byte*) rvaluevar::screen#1 )
[21] (byte) rvaluevar::i#2 ← phi( rvaluevar/(byte) 2 rvaluevar::@2/(byte) rvaluevar::i#1 )
[22] if((byte) rvaluevar::i#2<(byte) $a) goto rvaluevar::@2
rvaluevar::@1: scope:[rvaluevar] from rvaluevar::@2
[25] if((byte) rvaluevar::i#1<(byte) $a) goto rvaluevar::@2
to:rvaluevar::@3
rvaluevar::@3: scope:[rvaluevar] from rvaluevar::@1
[23] *((const byte*) rvaluevar::screen2#0) ← (byte) rvaluevar::b#2
[26] *((const byte*) rvaluevar::screen2#0) ← (byte) rvaluevar::b#1
to:rvaluevar::@return
rvaluevar::@return: scope:[rvaluevar] from rvaluevar::@3
[24] return
[27] return
to:@return
rvaluevar::@2: scope:[rvaluevar] from rvaluevar::@1
[25] (byte) rvaluevar::b#1 ← *((byte*) rvaluevar::screen#2)
[26] (byte*) rvaluevar::screen#1 ← ++ (byte*) rvaluevar::screen#2
[27] (byte) rvaluevar::i#1 ← ++ (byte) rvaluevar::i#2
to:rvaluevar::@1
rvalue: scope:[rvalue] from main::@1
[28] (byte) rvalue::b#1 ← *((const byte[$400]) rvalue::SCREEN#0+(byte) 1)
[28] phi()
to:rvalue::@2
rvalue::@2: scope:[rvalue] from rvalue rvalue::@1
[29] (byte) rvalue::i#4 ← phi( rvalue::@1/(byte) rvalue::i#1 rvalue/(byte) 2 )
[30] (byte) rvalue::b#2 ← *((const byte[$400]) rvalue::SCREEN#0 + (byte) rvalue::i#4)
[31] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#4
to:rvalue::@1
rvalue::@1: scope:[rvalue] from rvalue rvalue::@2
[29] (byte) rvalue::b#3 ← phi( rvalue/(byte) rvalue::b#1 rvalue::@2/(byte) rvalue::b#2 )
[29] (byte) rvalue::i#2 ← phi( rvalue/(byte) 2 rvalue::@2/(byte) rvalue::i#1 )
[30] if((byte) rvalue::i#2<(byte) $a) goto rvalue::@2
rvalue::@1: scope:[rvalue] from rvalue::@2
[32] if((byte) rvalue::i#1<(byte) $a) goto rvalue::@2
to:rvalue::@3
rvalue::@3: scope:[rvalue] from rvalue::@1
[31] *((const byte*) rvalue::screen2#0) ← (byte) rvalue::b#3
[33] *((const byte*) rvalue::screen2#0) ← (byte) rvalue::b#2
to:rvalue::@return
rvalue::@return: scope:[rvalue] from rvalue::@3
[32] return
[34] return
to:@return
rvalue::@2: scope:[rvalue] from rvalue::@1
[33] (byte) rvalue::b#2 ← *((const byte[$400]) rvalue::SCREEN#0 + (byte) rvalue::i#2)
[34] (byte) rvalue::i#1 ← ++ (byte) rvalue::i#2
to:rvalue::@1
lvalue: scope:[lvalue] from main
[35] *((const byte[$400]) lvalue::SCREEN#0) ← (byte) 1
[36] *((const byte[$400]) lvalue::SCREEN#0+(byte) 1) ← (byte) 2
to:lvalue::@2
lvalue::@2: scope:[lvalue] from lvalue lvalue::@1
[37] (byte) lvalue::i#4 ← phi( lvalue::@1/(byte) lvalue::i#1 lvalue/(byte) 2 )
[38] *((const byte[$400]) lvalue::SCREEN#0 + (byte) lvalue::i#4) ← (byte) 3
[39] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#4
to:lvalue::@1
lvalue::@1: scope:[lvalue] from lvalue lvalue::@2
[37] (byte) lvalue::i#2 ← phi( lvalue/(byte) 2 lvalue::@2/(byte) lvalue::i#1 )
[38] if((byte) lvalue::i#2<(byte) $a) goto lvalue::@2
lvalue::@1: scope:[lvalue] from lvalue::@2
[40] if((byte) lvalue::i#1<(byte) $a) goto lvalue::@2
to:lvalue::@return
lvalue::@return: scope:[lvalue] from lvalue::@1
[39] return
[41] return
to:@return
lvalue::@2: scope:[lvalue] from lvalue::@1
[40] *((const byte[$400]) lvalue::SCREEN#0 + (byte) lvalue::i#2) ← (byte) 3
[41] (byte) lvalue::i#1 ← ++ (byte) lvalue::i#2
to:lvalue::@1

File diff suppressed because it is too large Load Diff

View File

@ -8,8 +8,8 @@
(byte[$400]) lvalue::SCREEN
(const byte[$400]) lvalue::SCREEN#0 SCREEN = (byte*) 1024
(byte) lvalue::i
(byte) lvalue::i#1 reg byte x 22.0
(byte) lvalue::i#2 reg byte x 14.666666666666666
(byte) lvalue::i#1 reg byte x 16.5
(byte) lvalue::i#4 reg byte x 16.5
(void()) lvaluevar()
(label) lvaluevar::@1
(label) lvaluevar::@2
@ -17,11 +17,11 @@
(byte) lvaluevar::b
(const byte) lvaluevar::b#0 b = (byte) 4
(byte) lvaluevar::i
(byte) lvaluevar::i#1 reg byte x 22.0
(byte) lvaluevar::i#2 reg byte x 8.25
(byte) lvaluevar::i#1 reg byte x 16.5
(byte) lvaluevar::i#4 reg byte x 7.333333333333333
(byte*) lvaluevar::screen
(byte*) lvaluevar::screen#1 screen zp ZP_WORD:2 11.0
(byte*) lvaluevar::screen#2 screen zp ZP_WORD:2 11.0
(byte*) lvaluevar::screen#1 screen zp ZP_WORD:2 7.333333333333333
(byte*) lvaluevar::screen#4 screen zp ZP_WORD:2 16.5
(void()) main()
(label) main::@1
(label) main::@2
@ -35,12 +35,10 @@
(byte[$400]) rvalue::SCREEN
(const byte[$400]) rvalue::SCREEN#0 SCREEN = (byte*) 1024
(byte) rvalue::b
(byte) rvalue::b#1 reg byte a 4.0
(byte) rvalue::b#2 reg byte a 11.0
(byte) rvalue::b#3 reg byte a 7.5
(byte) rvalue::b#2 reg byte a 4.333333333333333
(byte) rvalue::i
(byte) rvalue::i#1 reg byte x 22.0
(byte) rvalue::i#2 reg byte x 14.666666666666666
(byte) rvalue::i#1 reg byte x 16.5
(byte) rvalue::i#4 reg byte x 16.5
(byte*) rvalue::screen2
(const byte*) rvalue::screen2#0 screen2 = (byte*) 1024
(void()) rvaluevar()
@ -49,21 +47,20 @@
(label) rvaluevar::@3
(label) rvaluevar::@return
(byte) rvaluevar::b
(byte) rvaluevar::b#1 reg byte y 7.333333333333333
(byte) rvaluevar::b#2 reg byte y 6.5
(byte) rvaluevar::b#1 reg byte a 3.25
(byte) rvaluevar::i
(byte) rvaluevar::i#1 reg byte x 22.0
(byte) rvaluevar::i#2 reg byte x 8.25
(byte) rvaluevar::i#1 reg byte x 16.5
(byte) rvaluevar::i#4 reg byte x 7.333333333333333
(byte*) rvaluevar::screen
(byte*) rvaluevar::screen#1 screen zp ZP_WORD:2 11.0
(byte*) rvaluevar::screen#2 screen zp ZP_WORD:2 11.0
(byte*) rvaluevar::screen#1 screen zp ZP_WORD:2 7.333333333333333
(byte*) rvaluevar::screen#4 screen zp ZP_WORD:2 16.5
(byte*) rvaluevar::screen2
(const byte*) rvaluevar::screen2#0 screen2 = (byte*) 1024
reg byte x [ lvaluevar::i#2 lvaluevar::i#1 ]
reg byte x [ rvaluevar::i#2 rvaluevar::i#1 ]
zp ZP_WORD:2 [ rvaluevar::screen#2 rvaluevar::screen#1 lvaluevar::screen#2 lvaluevar::screen#1 ]
reg byte y [ rvaluevar::b#2 rvaluevar::b#1 ]
reg byte x [ rvalue::i#2 rvalue::i#1 ]
reg byte a [ rvalue::b#3 rvalue::b#1 rvalue::b#2 ]
reg byte x [ lvalue::i#2 lvalue::i#1 ]
reg byte x [ lvaluevar::i#4 lvaluevar::i#1 ]
reg byte x [ rvaluevar::i#4 rvaluevar::i#1 ]
zp ZP_WORD:2 [ rvaluevar::screen#4 rvaluevar::screen#1 lvaluevar::screen#4 lvaluevar::screen#1 ]
reg byte x [ rvalue::i#4 rvalue::i#1 ]
reg byte x [ lvalue::i#4 lvalue::i#1 ]
reg byte a [ rvaluevar::b#1 ]
reg byte a [ rvalue::b#2 ]

View File

@ -5,15 +5,12 @@
main: {
// A constant pointer
.label SCREEN = $400
lda #0
ldx #2
b1:
b2:
lda SCREEN,x
inx
cpx #$a
bcc b2
sta SCREEN+$3e7
rts
b2:
lda SCREEN,x
inx
jmp b1
}

View File

@ -9,19 +9,18 @@
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@2
main::@2: scope:[main] from main main::@1
[5] (byte) main::i#4 ← phi( main::@1/(byte) main::i#1 main/(byte) 2 )
[6] (byte) main::b#1 ← *((const byte[$400]) main::SCREEN#0 + (byte) main::i#4)
[7] (byte) main::i#1 ← ++ (byte) main::i#4
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::b#2 ← phi( main/(byte) 0 main::@2/(byte) main::b#1 )
[5] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte) main::i#1 )
[6] if((byte) main::i#2<(byte) $a) goto main::@2
main::@1: scope:[main] from main::@2
[8] if((byte) main::i#1<(byte) $a) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[7] *((const byte[$400]) main::SCREEN#0+(word) $3e7) ← (byte) main::b#2
[9] *((const byte[$400]) main::SCREEN#0+(word) $3e7) ← (byte) main::b#1
to:main::@return
main::@return: scope:[main] from main::@3
[8] return
[10] return
to:@return
main::@2: scope:[main] from main::@1
[9] (byte) main::b#1 ← *((const byte[$400]) main::SCREEN#0 + (byte) main::i#2)
[10] (byte) main::i#1 ← ++ (byte) main::i#2
to:main::@1

View File

@ -86,29 +86,103 @@ Constant (const byte) main::i#0 = 2
Successful SSA optimization Pass2ConstantIdentification
De-inlining pointer[w] to *(pointer+w) [10] *((const byte[$400]) main::SCREEN#0 + (word) $3e7) ← (byte) main::b#2
Successful SSA optimization Pass2DeInlineWordDerefIdx
Constant right-side identified [4] (byte*~) main::$1 ← (const byte[$400]) main::SCREEN#0 + (word) $3e7
GRAPH (NEW VERSIONS for main::i#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@2
[0] (byte) main::b#2 ← phi( main/(const byte) main::b#0 main::@2/(byte) main::b#1 )
[0] (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@2/(byte) main::i#1 )
[1] if((byte) main::i#2<(byte) $a) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1
(byte) main::i#4 ← phi( )
[2] (byte) main::b#1 ← *((const byte[$400]) main::SCREEN#0 + (byte) main::i#4)
[3] (byte) main::i#1 ← ++ (byte) main::i#4
to:main::@1
main::@3: scope:[main] from main::@1
[4] (byte*~) main::$1 ← (const byte[$400]) main::SCREEN#0 + (word) $3e7
[5] *((byte*~) main::$1) ← (byte) main::b#2
to:main::@return
main::@return: scope:[main] from main::@3
[6] return
to:@return
@1: scope:[] from @begin
[7] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
GRAPH (NEW VERSIONS for main::b#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@2
[0] (byte) main::b#2 ← phi( main/(const byte) main::b#0 main::@2/(byte) main::b#1 )
[0] (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@2/(byte) main::i#1 )
[1] if((byte) main::i#2<(byte) $a) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1
(byte) main::i#4 ← phi( main::@1/(byte) main::i#2 )
[2] (byte) main::b#1 ← *((const byte[$400]) main::SCREEN#0 + (byte) main::i#4)
[3] (byte) main::i#1 ← ++ (byte) main::i#4
to:main::@1
main::@3: scope:[main] from main::@1
(byte) main::b#4 ← phi( )
[4] (byte*~) main::$1 ← (const byte[$400]) main::SCREEN#0 + (word) $3e7
[5] *((byte*~) main::$1) ← (byte) main::b#4
to:main::@return
main::@return: scope:[main] from main::@3
[6] return
to:@return
@1: scope:[] from @begin
[7] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Successful SSA optimization Pass2LoopHeadConstantIdentification
Alias (byte) main::i#1 = (byte) main::i#2
Alias (byte) main::b#1 = (byte) main::b#2
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::i#5 (const byte) main::i#0
Identical Phi Values (byte) main::b#5 (const byte) main::b#0
Successful SSA optimization Pass2IdenticalPhiElimination
Constant right-side identified [6] (byte*~) main::$1 ← (const byte[$400]) main::SCREEN#0 + (word) $3e7
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant (const byte*) main::$1 = main::SCREEN#0+$3e7
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with var siblings (const byte) main::b#0
Removing PHI-reference to removed block (main::@1_1) in block main::@3
if() condition always true - replacing block destination [11] if((const byte) main::i#0<(byte) $a) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Eliminating unused constant (const byte) main::b#0
Successful SSA optimization PassNEliminateUnusedVars
Alias (byte) main::b#1 = (byte) main::b#4
Successful SSA optimization Pass2AliasElimination
Inlining constant with var siblings (const byte) main::i#0
Constant inlined main::$1 = (const byte[$400]) main::SCREEN#0+(word) $3e7
Constant inlined main::i#0 = (byte) 2
Constant inlined main::b#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@7(between main::@1 and main::@2)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1_1
CALL GRAPH
Calls in [] to main:2
Created 2 initial phi equivalence classes
Coalesced [12] main::i#4 ← main::i#1
Coalesced [13] main::b#4 ← main::b#1
Coalesced down to 2 phi equivalence classes
Created 1 initial phi equivalence classes
Coalesced [13] main::i#6 ← main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@1_1
Culled Empty Block (label) main::@7
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
@ -126,42 +200,40 @@ FINAL CONTROL FLOW GRAPH
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@2
main::@2: scope:[main] from main main::@1
[5] (byte) main::i#4 ← phi( main::@1/(byte) main::i#1 main/(byte) 2 )
[6] (byte) main::b#1 ← *((const byte[$400]) main::SCREEN#0 + (byte) main::i#4)
[7] (byte) main::i#1 ← ++ (byte) main::i#4
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::b#2 ← phi( main/(byte) 0 main::@2/(byte) main::b#1 )
[5] (byte) main::i#2 ← phi( main/(byte) 2 main::@2/(byte) main::i#1 )
[6] if((byte) main::i#2<(byte) $a) goto main::@2
main::@1: scope:[main] from main::@2
[8] if((byte) main::i#1<(byte) $a) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[7] *((const byte[$400]) main::SCREEN#0+(word) $3e7) ← (byte) main::b#2
[9] *((const byte[$400]) main::SCREEN#0+(word) $3e7) ← (byte) main::b#1
to:main::@return
main::@return: scope:[main] from main::@3
[8] return
[10] return
to:@return
main::@2: scope:[main] from main::@1
[9] (byte) main::b#1 ← *((const byte[$400]) main::SCREEN#0 + (byte) main::i#2)
[10] (byte) main::i#1 ← ++ (byte) main::i#2
to:main::@1
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte[$400]) main::SCREEN
(byte) main::b
(byte) main::b#1 11.0
(byte) main::b#2 6.5
(byte) main::b#1 4.333333333333333
(byte) main::i
(byte) main::i#1 22.0
(byte) main::i#2 14.666666666666666
(byte) main::i#1 16.5
(byte) main::i#4 16.5
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::b#2 main::b#1 ]
[ main::i#4 main::i#1 ]
Added variable main::b#1 to zero page equivalence class [ main::b#1 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::b#2 main::b#1 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::b#2 main::b#1 ]
[ main::i#4 main::i#1 ]
[ main::b#1 ]
Allocated zp ZP_BYTE:2 [ main::i#4 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::b#1 ]
INITIAL ASM
Target platform is c64basic
@ -194,58 +266,55 @@ main: {
.label SCREEN = $400
.label b = 3
.label i = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::b#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta b
// [5] phi (byte) main::i#2 = (byte) 2 [phi:main->main::@1#1] -- vbuz1=vbuc1
// [5] phi from main to main::@2 [phi:main->main::@2]
b2_from_main:
// [5] phi (byte) main::i#4 = (byte) 2 [phi:main->main::@2#0] -- vbuz1=vbuc1
lda #2
sta i
jmp b2
// [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
// [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@1->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [6] (byte) main::b#1 ← *((const byte[$400]) main::SCREEN#0 + (byte) main::i#4) -- vbuz1=pbuc1_derefidx_vbuz2
ldy i
lda SCREEN,y
sta b
// [7] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuz1=_inc_vbuz1
inc i
jmp b1
// main::@1
b1:
// [6] if((byte) main::i#2<(byte) $a) goto main::@2 -- vbuz1_lt_vbuc1_then_la1
// [8] if((byte) main::i#1<(byte) $a) goto main::@2 -- vbuz1_lt_vbuc1_then_la1
lda i
cmp #$a
bcc b2
bcc b2_from_b1
jmp b3
// main::@3
b3:
// [7] *((const byte[$400]) main::SCREEN#0+(word) $3e7) ← (byte) main::b#2 -- _deref_pbuc1=vbuz1
// [9] *((const byte[$400]) main::SCREEN#0+(word) $3e7) ← (byte) main::b#1 -- _deref_pbuc1=vbuz1
lda b
sta SCREEN+$3e7
jmp breturn
// main::@return
breturn:
// [8] return
// [10] return
rts
// main::@2
b2:
// [9] (byte) main::b#1 ← *((const byte[$400]) main::SCREEN#0 + (byte) main::i#2) -- vbuz1=pbuc1_derefidx_vbuz2
ldy i
lda SCREEN,y
sta b
// [10] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc i
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
// [5] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@2->main::@1#0] -- register_copy
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
jmp b1
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::b#2 main::b#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:2 [ main::i#4 main::i#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::b#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 36.67: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 17.5: zp ZP_BYTE:3 [ main::b#2 main::b#1 ]
Uplift Scope [main] 33: zp ZP_BYTE:2 [ main::i#4 main::i#1 ] 4.33: zp ZP_BYTE:3 [ main::b#1 ]
Uplift Scope []
Uplifting [main] best 265 combination reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::b#2 main::b#1 ]
Uplifting [] best 265 combination
Uplifting [main] best 275 combination reg byte x [ main::i#4 main::i#1 ] reg byte a [ main::b#1 ]
Uplifting [] best 275 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -275,63 +344,66 @@ bend:
main: {
// A constant pointer
.label SCREEN = $400
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::b#2 = (byte) 0 [phi:main->main::@1#0] -- vbuaa=vbuc1
lda #0
// [5] phi (byte) main::i#2 = (byte) 2 [phi:main->main::@1#1] -- vbuxx=vbuc1
// [5] phi from main to main::@2 [phi:main->main::@2]
b2_from_main:
// [5] phi (byte) main::i#4 = (byte) 2 [phi:main->main::@2#0] -- vbuxx=vbuc1
ldx #2
jmp b2
// [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
// [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@1->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [6] (byte) main::b#1 ← *((const byte[$400]) main::SCREEN#0 + (byte) main::i#4) -- vbuaa=pbuc1_derefidx_vbuxx
lda SCREEN,x
// [7] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuxx=_inc_vbuxx
inx
jmp b1
// main::@1
b1:
// [6] if((byte) main::i#2<(byte) $a) goto main::@2 -- vbuxx_lt_vbuc1_then_la1
// [8] if((byte) main::i#1<(byte) $a) goto main::@2 -- vbuxx_lt_vbuc1_then_la1
cpx #$a
bcc b2
bcc b2_from_b1
jmp b3
// main::@3
b3:
// [7] *((const byte[$400]) main::SCREEN#0+(word) $3e7) ← (byte) main::b#2 -- _deref_pbuc1=vbuaa
// [9] *((const byte[$400]) main::SCREEN#0+(word) $3e7) ← (byte) main::b#1 -- _deref_pbuc1=vbuaa
sta SCREEN+$3e7
jmp breturn
// main::@return
breturn:
// [8] return
// [10] return
rts
// main::@2
b2:
// [9] (byte) main::b#1 ← *((const byte[$400]) main::SCREEN#0 + (byte) main::i#2) -- vbuaa=pbuc1_derefidx_vbuxx
lda SCREEN,x
// [10] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
// [5] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@2->main::@1#0] -- register_copy
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
jmp b1
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b2
Removing instruction jmp b1
Removing instruction jmp b3
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b2_from_b1 with b2
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b2_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b2_from_main:
Removing instruction b1:
Removing instruction b3:
Removing instruction breturn:
Removing instruction b1_from_b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
@ -347,18 +419,17 @@ FINAL SYMBOL TABLE
(byte[$400]) main::SCREEN
(const byte[$400]) main::SCREEN#0 SCREEN = (byte*) 1024
(byte) main::b
(byte) main::b#1 reg byte a 11.0
(byte) main::b#2 reg byte a 6.5
(byte) main::b#1 reg byte a 4.333333333333333
(byte) main::i
(byte) main::i#1 reg byte x 22.0
(byte) main::i#2 reg byte x 14.666666666666666
(byte) main::i#1 reg byte x 16.5
(byte) main::i#4 reg byte x 16.5
reg byte x [ main::i#2 main::i#1 ]
reg byte a [ main::b#2 main::b#1 ]
reg byte x [ main::i#4 main::i#1 ]
reg byte a [ main::b#1 ]
FINAL ASSEMBLER
Score: 190
Score: 140
// File Comments
// Test all types of pointers
@ -378,37 +449,32 @@ Score: 190
main: {
// A constant pointer
.label SCREEN = $400
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::b#2 = (byte) 0 [phi:main->main::@1#0] -- vbuaa=vbuc1
lda #0
// [5] phi (byte) main::i#2 = (byte) 2 [phi:main->main::@1#1] -- vbuxx=vbuc1
// [5] phi from main to main::@2 [phi:main->main::@2]
// [5] phi (byte) main::i#4 = (byte) 2 [phi:main->main::@2#0] -- vbuxx=vbuc1
ldx #2
// [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
// [5] phi (byte) main::i#4 = (byte) main::i#1 [phi:main::@1->main::@2#0] -- register_copy
// main::@2
b2:
// b = SCREEN[i++]
// [6] (byte) main::b#1 ← *((const byte[$400]) main::SCREEN#0 + (byte) main::i#4) -- vbuaa=pbuc1_derefidx_vbuxx
lda SCREEN,x
// b = SCREEN[i++];
// [7] (byte) main::i#1 ← ++ (byte) main::i#4 -- vbuxx=_inc_vbuxx
inx
// main::@1
b1:
// while(i<10)
// [6] if((byte) main::i#2<(byte) $a) goto main::@2 -- vbuxx_lt_vbuc1_then_la1
// [8] if((byte) main::i#1<(byte) $a) goto main::@2 -- vbuxx_lt_vbuc1_then_la1
cpx #$a
bcc b2
// main::@3
// SCREEN[999] = b
// [7] *((const byte[$400]) main::SCREEN#0+(word) $3e7) ← (byte) main::b#2 -- _deref_pbuc1=vbuaa
// [9] *((const byte[$400]) main::SCREEN#0+(word) $3e7) ← (byte) main::b#1 -- _deref_pbuc1=vbuaa
sta SCREEN+$3e7
// main::@return
// }
// [8] return
// [10] return
rts
// main::@2
b2:
// b = SCREEN[i++]
// [9] (byte) main::b#1 ← *((const byte[$400]) main::SCREEN#0 + (byte) main::i#2) -- vbuaa=pbuc1_derefidx_vbuxx
lda SCREEN,x
// b = SCREEN[i++];
// [10] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
// [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
// [5] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@2->main::@1#0] -- register_copy
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
jmp b1
}
// File Data

View File

@ -9,11 +9,10 @@
(byte[$400]) main::SCREEN
(const byte[$400]) main::SCREEN#0 SCREEN = (byte*) 1024
(byte) main::b
(byte) main::b#1 reg byte a 11.0
(byte) main::b#2 reg byte a 6.5
(byte) main::b#1 reg byte a 4.333333333333333
(byte) main::i
(byte) main::i#1 reg byte x 22.0
(byte) main::i#2 reg byte x 14.666666666666666
(byte) main::i#1 reg byte x 16.5
(byte) main::i#4 reg byte x 16.5
reg byte x [ main::i#2 main::i#1 ]
reg byte a [ main::b#2 main::b#1 ]
reg byte x [ main::i#4 main::i#1 ]
reg byte a [ main::b#1 ]

View File

@ -5,22 +5,22 @@
main: {
.label SCREEN = $400
ldx #0
b1:
cpx #0
beq b2
cpx #1
beq b4
lda #'c'
jmp b3
b4:
lda #'b'
jmp b3
b2:
lda #'a'
b3:
b4:
sta SCREEN
inx
cpx #3
bne b1
rts
b1:
cpx #0
beq b2
cpx #1
beq b5
lda #'c'
jmp b4
b5:
lda #'b'
jmp b4
}

View File

@ -9,26 +9,29 @@
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::b#2 ← phi( main/(byte) 0 main::@3/(byte) main::b#1 )
[6] if((byte) main::b#2==(byte) 0) goto main::@3
to:main::@2
main::@2: scope:[main] from main::@1
[7] if((byte) main::b#2==(byte) 1) goto main::@4
to:main::@5
main::@4: scope:[main] from main::@2
[8] phi()
to:main::@5
main::@5: scope:[main] from main::@2 main::@4
[9] (byte~) main::$5 ← phi( main::@4/(byte) 'b' main::@2/(byte) 'c' )
to:main::@3
main::@3: scope:[main] from main::@1 main::@5
[10] (byte~) main::$7 ← phi( main::@1/(byte) 'a' main::@5/(byte~) main::$5 )
[11] *((const byte*) main::SCREEN#0) ← (byte~) main::$7
[12] (byte) main::b#1 ← ++ (byte) main::b#2
[13] if((byte) main::b#1!=(byte) 3) goto main::@1
main::@2: scope:[main] from main main::@1
[5] (byte) main::b#11 ← phi( main::@1/(byte) main::b#1 main/(byte) 0 )
to:main::@4
main::@4: scope:[main] from main::@2 main::@6
[6] (byte) main::b#10 ← phi( main::@2/(byte) main::b#11 main::@6/(byte) main::b#1 )
[6] (byte~) main::$7 ← phi( main::@2/(byte) 'a' main::@6/(byte~) main::$5 )
[7] *((const byte*) main::SCREEN#0) ← (byte~) main::$7
[8] (byte) main::b#1 ← ++ (byte) main::b#10
[9] if((byte) main::b#1!=(byte) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[14] return
main::@return: scope:[main] from main::@4
[10] return
to:@return
main::@1: scope:[main] from main::@4
[11] if((byte) main::b#1==(byte) 0) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[12] if((byte) main::b#1==(byte) 1) goto main::@5
to:main::@6
main::@5: scope:[main] from main::@3
[13] phi()
to:main::@6
main::@6: scope:[main] from main::@3 main::@5
[14] (byte~) main::$5 ← phi( main::@5/(byte) 'b' main::@3/(byte) 'c' )
to:main::@4

View File

@ -123,47 +123,98 @@ Constant (const byte) main::$2 = 'c'
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [18] main::b#1 ← ++ main::b#2 to ++
Resolved ranged comparison value [20] if(main::b#1!=rangelast(0,2)) goto main::@1 to (number) 3
GRAPH (NEW VERSIONS for main::b#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@4
[0] (byte) main::b#2 ← phi( main/(const byte) main::b#0 main::@4/(byte) main::b#1 )
[1] if((byte) main::b#2==(byte) 0) goto main::@2
to:main::@3
main::@2: scope:[main] from main::@1
to:main::@4
main::@3: scope:[main] from main::@1
(byte) main::b#9 ← phi( )
[2] if((byte) main::b#9==(byte) 1) goto main::@5
to:main::@6
main::@5: scope:[main] from main::@3
to:main::@7
main::@6: scope:[main] from main::@3
to:main::@7
main::@7: scope:[main] from main::@5 main::@6
[3] (byte~) main::$5 ← phi( main::@5/(const byte) main::$3 main::@6/(const byte) main::$2 )
to:main::@4
main::@4: scope:[main] from main::@2 main::@7
[4] (byte) main::b#10 ← phi( )
[4] (byte~) main::$7 ← phi( main::@2/(const byte) main::$6 main::@7/(byte~) main::$5 )
[5] *((const byte*) main::SCREEN#0) ← (byte~) main::$7
[6] (byte) main::b#1 ← ++ (byte) main::b#10
[7] if((byte) main::b#1!=(number) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@4
[8] return
to:@return
@1: scope:[] from @begin
[9] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Successful SSA optimization Pass2LoopHeadConstantIdentification
Adding number conversion cast (unumber) 3 in if((byte) main::b#1!=(number) 3) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) main::b#1 = (byte) main::b#2
Alias (byte) main::b#13 = (byte) main::b#9 (byte) main::b#14
Successful SSA optimization Pass2AliasElimination
Alias (byte) main::b#12 = (byte) main::b#13
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::b#15 (const byte) main::b#0
Successful SSA optimization Pass2IdenticalPhiElimination
Removing PHI-reference to removed block (main::@1_1) in block main::@3
if() condition always true - replacing block destination [15] if((const byte) main::b#0==(byte) 0) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::b#1 = (byte) main::b#12
Successful SSA optimization Pass2AliasElimination
Inlining constant with var siblings (const byte) main::b#0
Constant inlined main::$6 = (byte) 'a'
Constant inlined main::$3 = (byte) 'b'
Constant inlined main::b#0 = (byte) 0
Constant inlined main::$2 = (byte) 'c'
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@13(between main::@4 and main::@1)
Added new block during phi lifting main::@13(between main::@1 and main::@2)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1_1
Adding NOP phi() at start of main::@6
Adding NOP phi() at start of main::@5
Adding NOP phi() at start of main::@2
CALL GRAPH
Calls in [] to main:2
Created 3 initial phi equivalence classes
Coalesced [11] main::$9 ← main::$5
Coalesced [17] main::b#9 ← main::b#1
Created 4 initial phi equivalence classes
Coalesced [8] main::b#17 ← main::b#11
Coalesced [18] main::$9 ← main::$5
Coalesced [19] main::b#18 ← main::b#1
Coalesced (already) [21] main::b#16 ← main::b#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@1_1
Culled Empty Block (label) main::@6
Culled Empty Block (label) main::@13
Culled Empty Block (label) main::@2
Renumbering block main::@3 to main::@2
Renumbering block main::@4 to main::@3
Renumbering block main::@5 to main::@4
Renumbering block main::@7 to main::@5
Renumbering block main::@7 to main::@6
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@4
Adding NOP phi() at start of main::@5
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
@ -177,48 +228,52 @@ FINAL CONTROL FLOW GRAPH
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::b#2 ← phi( main/(byte) 0 main::@3/(byte) main::b#1 )
[6] if((byte) main::b#2==(byte) 0) goto main::@3
to:main::@2
main::@2: scope:[main] from main::@1
[7] if((byte) main::b#2==(byte) 1) goto main::@4
to:main::@5
main::@4: scope:[main] from main::@2
[8] phi()
to:main::@5
main::@5: scope:[main] from main::@2 main::@4
[9] (byte~) main::$5 ← phi( main::@4/(byte) 'b' main::@2/(byte) 'c' )
to:main::@3
main::@3: scope:[main] from main::@1 main::@5
[10] (byte~) main::$7 ← phi( main::@1/(byte) 'a' main::@5/(byte~) main::$5 )
[11] *((const byte*) main::SCREEN#0) ← (byte~) main::$7
[12] (byte) main::b#1 ← ++ (byte) main::b#2
[13] if((byte) main::b#1!=(byte) 3) goto main::@1
main::@2: scope:[main] from main main::@1
[5] (byte) main::b#11 ← phi( main::@1/(byte) main::b#1 main/(byte) 0 )
to:main::@4
main::@4: scope:[main] from main::@2 main::@6
[6] (byte) main::b#10 ← phi( main::@2/(byte) main::b#11 main::@6/(byte) main::b#1 )
[6] (byte~) main::$7 ← phi( main::@2/(byte) 'a' main::@6/(byte~) main::$5 )
[7] *((const byte*) main::SCREEN#0) ← (byte~) main::$7
[8] (byte) main::b#1 ← ++ (byte) main::b#10
[9] if((byte) main::b#1!=(byte) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[14] return
main::@return: scope:[main] from main::@4
[10] return
to:@return
main::@1: scope:[main] from main::@4
[11] if((byte) main::b#1==(byte) 0) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[12] if((byte) main::b#1==(byte) 1) goto main::@5
to:main::@6
main::@5: scope:[main] from main::@3
[13] phi()
to:main::@6
main::@6: scope:[main] from main::@3 main::@5
[14] (byte~) main::$5 ← phi( main::@5/(byte) 'b' main::@3/(byte) 'c' )
to:main::@4
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte~) main::$5 11.0
(byte~) main::$7 22.0
(byte~) main::$5 101.0
(byte~) main::$7 202.0
(byte*) main::SCREEN
(byte) main::b
(byte) main::b#1 16.5
(byte) main::b#2 6.285714285714286
(byte) main::b#1 100.99999999999999
(byte) main::b#10 106.5
(byte) main::b#11 112.0
Initial phi equivalence classes
[ main::b#2 main::b#1 ]
[ main::$7 main::$5 ]
[ main::b#10 main::b#11 main::b#1 ]
Complete equivalence classes
[ main::b#2 main::b#1 ]
[ main::$7 main::$5 ]
Allocated zp ZP_BYTE:2 [ main::b#2 main::b#1 ]
Allocated zp ZP_BYTE:3 [ main::$7 main::$5 ]
[ main::b#10 main::b#11 main::b#1 ]
Allocated zp ZP_BYTE:2 [ main::$7 main::$5 ]
Allocated zp ZP_BYTE:3 [ main::b#10 main::b#11 main::b#1 ]
INITIAL ASM
Target platform is c64basic
@ -248,90 +303,94 @@ bend:
// main
main: {
.label SCREEN = $400
.label _5 = 3
.label _7 = 3
.label b = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::b#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
.label _5 = 2
.label _7 = 2
.label b = 3
// [5] phi from main to main::@2 [phi:main->main::@2]
b2_from_main:
// [5] phi (byte) main::b#11 = (byte) 0 [phi:main->main::@2#0] -- vbuz1=vbuc1
lda #0
sta b
jmp b1
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
// [5] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
// main::@1
b1:
// [6] if((byte) main::b#2==(byte) 0) goto main::@3 -- vbuz1_eq_0_then_la1
lda b
cmp #0
beq b3_from_b1
jmp b2
// [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
// [5] phi (byte) main::b#11 = (byte) main::b#1 [phi:main::@1->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [7] if((byte) main::b#2==(byte) 1) goto main::@4 -- vbuz1_eq_vbuc1_then_la1
lda #1
cmp b
beq b4_from_b2
// [9] phi from main::@2 to main::@5 [phi:main::@2->main::@5]
b5_from_b2:
// [9] phi (byte~) main::$5 = (byte) 'c' [phi:main::@2->main::@5#0] -- vbuz1=vbuc1
lda #'c'
sta _5
jmp b5
// [8] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
// [6] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
b4_from_b2:
// [6] phi (byte) main::b#10 = (byte) main::b#11 [phi:main::@2->main::@4#0] -- register_copy
// [6] phi (byte~) main::$7 = (byte) 'a' [phi:main::@2->main::@4#1] -- vbuz1=vbuc1
lda #'a'
sta _7
jmp b4
// main::@4
b4:
// [9] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
b5_from_b4:
// [9] phi (byte~) main::$5 = (byte) 'b' [phi:main::@4->main::@5#0] -- vbuz1=vbuc1
lda #'b'
sta _5
jmp b5
// main::@5
b5:
// [10] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
b3_from_b5:
// [10] phi (byte~) main::$7 = (byte~) main::$5 [phi:main::@5->main::@3#0] -- register_copy
jmp b3
// [10] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
b3_from_b1:
// [10] phi (byte~) main::$7 = (byte) 'a' [phi:main::@1->main::@3#0] -- vbuz1=vbuc1
lda #'a'
sta _7
jmp b3
// main::@3
b3:
// [11] *((const byte*) main::SCREEN#0) ← (byte~) main::$7 -- _deref_pbuc1=vbuz1
// [7] *((const byte*) main::SCREEN#0) ← (byte~) main::$7 -- _deref_pbuc1=vbuz1
lda _7
sta SCREEN
// [12] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuz1=_inc_vbuz1
// [8] (byte) main::b#1 ← ++ (byte) main::b#10 -- vbuz1=_inc_vbuz1
inc b
// [13] if((byte) main::b#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [9] if((byte) main::b#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp b
bne b1_from_b3
bne b1
jmp breturn
// main::@return
breturn:
// [14] return
// [10] return
rts
// main::@1
b1:
// [11] if((byte) main::b#1==(byte) 0) goto main::@2 -- vbuz1_eq_0_then_la1
lda b
cmp #0
beq b2_from_b1
jmp b3
// main::@3
b3:
// [12] if((byte) main::b#1==(byte) 1) goto main::@5 -- vbuz1_eq_vbuc1_then_la1
lda #1
cmp b
beq b5_from_b3
// [14] phi from main::@3 to main::@6 [phi:main::@3->main::@6]
b6_from_b3:
// [14] phi (byte~) main::$5 = (byte) 'c' [phi:main::@3->main::@6#0] -- vbuz1=vbuc1
lda #'c'
sta _5
jmp b6
// [13] phi from main::@3 to main::@5 [phi:main::@3->main::@5]
b5_from_b3:
jmp b5
// main::@5
b5:
// [14] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
b6_from_b5:
// [14] phi (byte~) main::$5 = (byte) 'b' [phi:main::@5->main::@6#0] -- vbuz1=vbuc1
lda #'b'
sta _5
jmp b6
// main::@6
b6:
// [6] phi from main::@6 to main::@4 [phi:main::@6->main::@4]
b4_from_b6:
// [6] phi (byte) main::b#10 = (byte) main::b#1 [phi:main::@6->main::@4#0] -- register_copy
// [6] phi (byte~) main::$7 = (byte~) main::$5 [phi:main::@6->main::@4#1] -- register_copy
jmp b4
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::b#2 main::b#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::$7 main::$5 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:2 [ main::$7 main::$5 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::b#10 main::b#11 main::b#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 33: zp ZP_BYTE:3 [ main::$7 main::$5 ] 22.79: zp ZP_BYTE:2 [ main::b#2 main::b#1 ]
Uplift Scope [main] 319.5: zp ZP_BYTE:3 [ main::b#10 main::b#11 main::b#1 ] 303: zp ZP_BYTE:2 [ main::$7 main::$5 ]
Uplift Scope []
Uplifting [main] best 563 combination reg byte a [ main::$7 main::$5 ] reg byte x [ main::b#2 main::b#1 ]
Uplifting [] best 563 combination
Uplifting [main] best 4748 combination reg byte x [ main::b#10 main::b#11 main::b#1 ] reg byte a [ main::$7 main::$5 ]
Uplifting [] best 4748 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -360,107 +419,110 @@ bend:
// main
main: {
.label SCREEN = $400
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::b#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
// [5] phi from main to main::@2 [phi:main->main::@2]
b2_from_main:
// [5] phi (byte) main::b#11 = (byte) 0 [phi:main->main::@2#0] -- vbuxx=vbuc1
ldx #0
jmp b1
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
// [5] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
// main::@1
b1:
// [6] if((byte) main::b#2==(byte) 0) goto main::@3 -- vbuxx_eq_0_then_la1
cpx #0
beq b3_from_b1
jmp b2
// [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
// [5] phi (byte) main::b#11 = (byte) main::b#1 [phi:main::@1->main::@2#0] -- register_copy
jmp b2
// main::@2
b2:
// [7] if((byte) main::b#2==(byte) 1) goto main::@4 -- vbuxx_eq_vbuc1_then_la1
cpx #1
beq b4_from_b2
// [9] phi from main::@2 to main::@5 [phi:main::@2->main::@5]
b5_from_b2:
// [9] phi (byte~) main::$5 = (byte) 'c' [phi:main::@2->main::@5#0] -- vbuaa=vbuc1
lda #'c'
jmp b5
// [8] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
// [6] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
b4_from_b2:
// [6] phi (byte) main::b#10 = (byte) main::b#11 [phi:main::@2->main::@4#0] -- register_copy
// [6] phi (byte~) main::$7 = (byte) 'a' [phi:main::@2->main::@4#1] -- vbuaa=vbuc1
lda #'a'
jmp b4
// main::@4
b4:
// [9] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
b5_from_b4:
// [9] phi (byte~) main::$5 = (byte) 'b' [phi:main::@4->main::@5#0] -- vbuaa=vbuc1
lda #'b'
jmp b5
// main::@5
b5:
// [10] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
b3_from_b5:
// [10] phi (byte~) main::$7 = (byte~) main::$5 [phi:main::@5->main::@3#0] -- register_copy
jmp b3
// [10] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
b3_from_b1:
// [10] phi (byte~) main::$7 = (byte) 'a' [phi:main::@1->main::@3#0] -- vbuaa=vbuc1
lda #'a'
jmp b3
// main::@3
b3:
// [11] *((const byte*) main::SCREEN#0) ← (byte~) main::$7 -- _deref_pbuc1=vbuaa
// [7] *((const byte*) main::SCREEN#0) ← (byte~) main::$7 -- _deref_pbuc1=vbuaa
sta SCREEN
// [12] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuxx=_inc_vbuxx
// [8] (byte) main::b#1 ← ++ (byte) main::b#10 -- vbuxx=_inc_vbuxx
inx
// [13] if((byte) main::b#1!=(byte) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
// [9] if((byte) main::b#1!=(byte) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #3
bne b1_from_b3
bne b1
jmp breturn
// main::@return
breturn:
// [14] return
// [10] return
rts
// main::@1
b1:
// [11] if((byte) main::b#1==(byte) 0) goto main::@2 -- vbuxx_eq_0_then_la1
cpx #0
beq b2_from_b1
jmp b3
// main::@3
b3:
// [12] if((byte) main::b#1==(byte) 1) goto main::@5 -- vbuxx_eq_vbuc1_then_la1
cpx #1
beq b5_from_b3
// [14] phi from main::@3 to main::@6 [phi:main::@3->main::@6]
b6_from_b3:
// [14] phi (byte~) main::$5 = (byte) 'c' [phi:main::@3->main::@6#0] -- vbuaa=vbuc1
lda #'c'
jmp b6
// [13] phi from main::@3 to main::@5 [phi:main::@3->main::@5]
b5_from_b3:
jmp b5
// main::@5
b5:
// [14] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
b6_from_b5:
// [14] phi (byte~) main::$5 = (byte) 'b' [phi:main::@5->main::@6#0] -- vbuaa=vbuc1
lda #'b'
jmp b6
// main::@6
b6:
// [6] phi from main::@6 to main::@4 [phi:main::@6->main::@4]
b4_from_b6:
// [6] phi (byte) main::b#10 = (byte) main::b#1 [phi:main::@6->main::@4#0] -- register_copy
// [6] phi (byte~) main::$7 = (byte~) main::$5 [phi:main::@6->main::@4#1] -- register_copy
jmp b4
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp b4
Removing instruction jmp b5
Removing instruction jmp b3
Removing instruction jmp breturn
Removing instruction jmp b3
Removing instruction jmp b5
Removing instruction jmp b6
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b4_from_b2 with b4
Replacing label b1_from_b3 with b1
Replacing label b2_from_b1 with b2
Replacing label b5_from_b3 with b5
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_b3:
Removing instruction b2_from_b1:
Removing instruction b4_from_b2:
Removing instruction b5_from_b4:
Removing instruction b3_from_b5:
Removing instruction b5_from_b3:
Removing instruction b6_from_b5:
Removing instruction b4_from_b6:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b2:
Removing instruction b5_from_b2:
Removing instruction b2_from_main:
Removing instruction breturn:
Removing instruction b3:
Removing instruction b6_from_b3:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Skipping double jump to b3 in jmp b5
Skipping double jump to b4 in jmp b6
Succesful ASM optimization Pass5DoubleJumpElimination
Relabelling long label b3_from_b1 to b2
Succesful ASM optimization Pass5RelabelLongLabels
Removing instruction jmp b1
Removing instruction jmp b2
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Removing instruction b5:
Removing instruction b6:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
@ -468,26 +530,28 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(void()) main()
(byte~) main::$5 reg byte a 11.0
(byte~) main::$7 reg byte a 22.0
(byte~) main::$5 reg byte a 101.0
(byte~) main::$7 reg byte a 202.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@return
(byte*) main::SCREEN
(const byte*) main::SCREEN#0 SCREEN = (byte*) 1024
(byte) main::b
(byte) main::b#1 reg byte x 16.5
(byte) main::b#2 reg byte x 6.285714285714286
(byte) main::b#1 reg byte x 100.99999999999999
(byte) main::b#10 reg byte x 106.5
(byte) main::b#11 reg byte x 112.0
reg byte x [ main::b#2 main::b#1 ]
reg byte a [ main::$7 main::$5 ]
reg byte x [ main::b#10 main::b#11 main::b#1 ]
FINAL ASSEMBLER
Score: 341
Score: 3176
// File Comments
// Demonstrates error with nested ternary operator
@ -506,55 +570,58 @@ Score: 341
// main
main: {
.label SCREEN = $400
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::b#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
// [5] phi from main to main::@2 [phi:main->main::@2]
// [5] phi (byte) main::b#11 = (byte) 0 [phi:main->main::@2#0] -- vbuxx=vbuc1
ldx #0
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
// [5] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@3->main::@1#0] -- register_copy
// main::@1
b1:
// (b == 0) ? 'a' : ((b == 1) ? 'b' : 'c')
// [6] if((byte) main::b#2==(byte) 0) goto main::@3 -- vbuxx_eq_0_then_la1
cpx #0
beq b2
// [5] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
// [5] phi (byte) main::b#11 = (byte) main::b#1 [phi:main::@1->main::@2#0] -- register_copy
// main::@2
// (b == 1) ? 'b' : 'c'
// [7] if((byte) main::b#2==(byte) 1) goto main::@4 -- vbuxx_eq_vbuc1_then_la1
cpx #1
beq b4
// [9] phi from main::@2 to main::@5 [phi:main::@2->main::@5]
// [9] phi (byte~) main::$5 = (byte) 'c' [phi:main::@2->main::@5#0] -- vbuaa=vbuc1
lda #'c'
jmp b3
// [8] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
b2:
// [6] phi from main::@2 to main::@4 [phi:main::@2->main::@4]
// [6] phi (byte) main::b#10 = (byte) main::b#11 [phi:main::@2->main::@4#0] -- register_copy
// [6] phi (byte~) main::$7 = (byte) 'a' [phi:main::@2->main::@4#1] -- vbuaa=vbuc1
lda #'a'
// main::@4
b4:
// [9] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
// [9] phi (byte~) main::$5 = (byte) 'b' [phi:main::@4->main::@5#0] -- vbuaa=vbuc1
lda #'b'
// main::@5
// [10] phi from main::@5 to main::@3 [phi:main::@5->main::@3]
// [10] phi (byte~) main::$7 = (byte~) main::$5 [phi:main::@5->main::@3#0] -- register_copy
jmp b3
// [10] phi from main::@1 to main::@3 [phi:main::@1->main::@3]
b2:
// [10] phi (byte~) main::$7 = (byte) 'a' [phi:main::@1->main::@3#0] -- vbuaa=vbuc1
lda #'a'
// main::@3
b3:
// *SCREEN = (b == 0) ? 'a' : ((b == 1) ? 'b' : 'c')
// [11] *((const byte*) main::SCREEN#0) ← (byte~) main::$7 -- _deref_pbuc1=vbuaa
// [7] *((const byte*) main::SCREEN#0) ← (byte~) main::$7 -- _deref_pbuc1=vbuaa
sta SCREEN
// for ( byte b: 0..2 )
// [12] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuxx=_inc_vbuxx
// [8] (byte) main::b#1 ← ++ (byte) main::b#10 -- vbuxx=_inc_vbuxx
inx
// [13] if((byte) main::b#1!=(byte) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
// [9] if((byte) main::b#1!=(byte) 3) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #3
bne b1
// main::@return
// }
// [14] return
// [10] return
rts
// main::@1
b1:
// (b == 0) ? 'a' : ((b == 1) ? 'b' : 'c')
// [11] if((byte) main::b#1==(byte) 0) goto main::@2 -- vbuxx_eq_0_then_la1
cpx #0
beq b2
// main::@3
// (b == 1) ? 'b' : 'c'
// [12] if((byte) main::b#1==(byte) 1) goto main::@5 -- vbuxx_eq_vbuc1_then_la1
cpx #1
beq b5
// [14] phi from main::@3 to main::@6 [phi:main::@3->main::@6]
// [14] phi (byte~) main::$5 = (byte) 'c' [phi:main::@3->main::@6#0] -- vbuaa=vbuc1
lda #'c'
jmp b4
// [13] phi from main::@3 to main::@5 [phi:main::@3->main::@5]
// main::@5
b5:
// [14] phi from main::@5 to main::@6 [phi:main::@5->main::@6]
// [14] phi (byte~) main::$5 = (byte) 'b' [phi:main::@5->main::@6#0] -- vbuaa=vbuc1
lda #'b'
// main::@6
// [6] phi from main::@6 to main::@4 [phi:main::@6->main::@4]
// [6] phi (byte) main::b#10 = (byte) main::b#1 [phi:main::@6->main::@4#0] -- register_copy
// [6] phi (byte~) main::$7 = (byte~) main::$5 [phi:main::@6->main::@4#1] -- register_copy
jmp b4
}
// File Data

View File

@ -2,19 +2,21 @@
(label) @begin
(label) @end
(void()) main()
(byte~) main::$5 reg byte a 11.0
(byte~) main::$7 reg byte a 22.0
(byte~) main::$5 reg byte a 101.0
(byte~) main::$7 reg byte a 202.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@return
(byte*) main::SCREEN
(const byte*) main::SCREEN#0 SCREEN = (byte*) 1024
(byte) main::b
(byte) main::b#1 reg byte x 16.5
(byte) main::b#2 reg byte x 6.285714285714286
(byte) main::b#1 reg byte x 100.99999999999999
(byte) main::b#10 reg byte x 106.5
(byte) main::b#11 reg byte x 112.0
reg byte x [ main::b#2 main::b#1 ]
reg byte a [ main::$7 main::$5 ]
reg byte x [ main::b#10 main::b#11 main::b#1 ]

View File

@ -140,22 +140,24 @@ Print: {
done:
rts
}
// myprintf(byte* zeropage($d) str, word zeropage(2) w1, word zeropage(4) w2, word zeropage($17) w3)
// myprintf(byte* zeropage($f) str, word zeropage(2) w1, word zeropage(4) w2, word zeropage($17) w3)
myprintf: {
.label str = $d
.label str = $f
.label bDigits = $c
.label bLen = $b
.label b = $a
.label bArg = 7
.label return = $b
.label w1 = 2
.label w2 = 4
.label w3 = $17
.label w = $d
.label bFormat = 6
.label w = $f
.label bTrailing = 8
.label bLeadZero = 9
lda #0
ldy #0
lda (str),y
tax
tya
sta bLeadZero
sta bDigits
sta bTrailing
@ -164,19 +166,37 @@ myprintf: {
sta bLen
sta bArg
sta bFormat
b1:
ldy #0
lda (str),y
tax
lda bFormat
b2:
cpx #'%'
beq !b28+
jmp b28
!b28:
// default format
//w = (bArg == 0) ? w1 : ((bArg == 1) ? w2 : w3); -- "?" is the normal way, but error "sequence does not contain all blocks" -- https://gitlab.com/camelot/kickc/issues/185 [FIXED]
lda bArg
cmp #0
bne !b2+
jmp b2
!b2:
cpx #'0'
bne b3
bne !b29+
jmp b29
!b29:
lda #1
cmp bArg
bne !b30+
jmp b30
!b30:
lda w3
sta w
lda w3+1
sta w+1
b31:
inc bArg
lda #0
sta bLeadZero
lda #1
sta bDigits
lda #0
sta bTrailing
lda #1
sta bFormat
b27:
inc str
bne !+
@ -187,9 +207,21 @@ myprintf: {
cmp #0
bne b1
tya
ldy return
ldy bLen
sta strTemp,y
rts
b1:
ldy #0
lda (str),y
tax
lda bFormat
cmp #0
beq b2
cpx #'0'
bne b3
lda #1
sta bLeadZero
jmp b27
b3:
cpx #'1'
bcc b4
@ -340,32 +372,6 @@ myprintf: {
axs #'0'
stx bDigits
jmp b27
b2:
cpx #'%'
bne b28
// default format
//w = (bArg == 0) ? w1 : ((bArg == 1) ? w2 : w3); -- "?" is the normal way, but error "sequence does not contain all blocks" -- https://gitlab.com/camelot/kickc/issues/185 [FIXED]
lda bArg
cmp #0
beq b29
lda #1
cmp bArg
beq b30
lda w3
sta w
lda w3+1
sta w+1
b31:
inc bArg
lda #0
sta bLeadZero
lda #1
sta bDigits
lda #0
sta bTrailing
lda #1
sta bFormat
jmp b27
b30:
lda w2
sta w

View File

@ -96,350 +96,355 @@ myprintf: scope:[myprintf] from main::@3 main::@7
[54] (word) myprintf::w2#7 ← phi( main::@3/(word) myprintf::w2#0 main::@7/(word) myprintf::w2#1 )
[54] (word) myprintf::w1#6 ← phi( main::@3/(word) myprintf::w1#0 main::@7/(word) myprintf::w1#1 )
[54] (byte*) myprintf::str#5 ← phi( main::@3/(const string) main::str main::@7/(const string) main::str1 )
to:myprintf::@1
myprintf::@1: scope:[myprintf] from myprintf myprintf::@27
[55] (byte) myprintf::bLeadZero#10 ← phi( myprintf/(byte) 0 myprintf::@27/(byte) myprintf::bLeadZero#18 )
[55] (byte) myprintf::bDigits#14 ← phi( myprintf/(byte) 0 myprintf::@27/(byte) myprintf::bDigits#24 )
[55] (byte) myprintf::bTrailing#10 ← phi( myprintf/(byte) 0 myprintf::@27/(byte) myprintf::bTrailing#21 )
[55] (word) myprintf::w#10 ← phi( myprintf/(word) 0 myprintf::@27/(word) myprintf::w#17 )
[55] (byte) myprintf::bLen#14 ← phi( myprintf/(byte) 0 myprintf::@27/(byte) myprintf::return#0 )
[55] (byte) myprintf::bArg#12 ← phi( myprintf/(byte) 0 myprintf::@27/(byte) myprintf::bArg#10 )
[55] (byte) myprintf::bFormat#10 ← phi( myprintf/(byte) 0 myprintf::@27/(byte) myprintf::bFormat#4 )
[55] (byte*) myprintf::str#10 ← phi( myprintf/(byte*) myprintf::str#5 myprintf::@27/(byte*) myprintf::str#0 )
[56] (byte) myprintf::b#1 ← *((byte*) myprintf::str#10)
[57] if((byte) myprintf::bFormat#10==(byte) 0) goto myprintf::@2
to:myprintf::@33
myprintf::@33: scope:[myprintf] from myprintf::@1
[58] if((byte) myprintf::b#1!=(byte) '0') goto myprintf::@3
to:myprintf::@27
myprintf::@27: scope:[myprintf] from myprintf::@22 myprintf::@23 myprintf::@31 myprintf::@32 myprintf::@33 myprintf::@4
[59] (byte) myprintf::bLeadZero#18 ← phi( myprintf::@22/(byte) myprintf::bLeadZero#10 myprintf::@23/(byte) myprintf::bLeadZero#10 myprintf::@4/(byte) myprintf::bLeadZero#10 myprintf::@31/(byte) 0 myprintf::@32/(byte) myprintf::bLeadZero#10 myprintf::@33/(byte) 1 )
[59] (byte) myprintf::bDigits#24 ← phi( myprintf::@22/(byte) myprintf::bDigits#25 myprintf::@23/(byte) myprintf::bDigits#1 myprintf::@4/(byte) myprintf::bDigits#14 myprintf::@31/(byte) 1 myprintf::@32/(byte) myprintf::bDigits#14 myprintf::@33/(byte) myprintf::bDigits#14 )
[59] (byte) myprintf::bTrailing#21 ← phi( myprintf::@22/(byte) myprintf::bTrailing#10 myprintf::@23/(byte) myprintf::bTrailing#10 myprintf::@4/(byte) 1 myprintf::@31/(byte) 0 myprintf::@32/(byte) myprintf::bTrailing#10 myprintf::@33/(byte) myprintf::bTrailing#10 )
[59] (word) myprintf::w#17 ← phi( myprintf::@22/(word) myprintf::w#10 myprintf::@23/(word) myprintf::w#10 myprintf::@4/(word) myprintf::w#10 myprintf::@31/(word) myprintf::w#21 myprintf::@32/(word) myprintf::w#10 myprintf::@33/(word) myprintf::w#10 )
[59] (byte) myprintf::bArg#10 ← phi( myprintf::@22/(byte) myprintf::bArg#12 myprintf::@23/(byte) myprintf::bArg#12 myprintf::@4/(byte) myprintf::bArg#12 myprintf::@31/(byte) myprintf::bArg#1 myprintf::@32/(byte) myprintf::bArg#12 myprintf::@33/(byte) myprintf::bArg#12 )
[59] (byte) myprintf::return#0 ← phi( myprintf::@22/(byte) myprintf::bLen#28 myprintf::@23/(byte) myprintf::bLen#14 myprintf::@4/(byte) myprintf::bLen#14 myprintf::@31/(byte) myprintf::bLen#14 myprintf::@32/(byte) myprintf::bLen#7 myprintf::@33/(byte) myprintf::bLen#14 )
[59] (byte) myprintf::bFormat#4 ← phi( myprintf::@22/(byte) 0 myprintf::@23/(byte) myprintf::bFormat#10 myprintf::@4/(byte) myprintf::bFormat#10 myprintf::@31/(byte) 1 myprintf::@32/(byte) myprintf::bFormat#10 myprintf::@33/(byte) myprintf::bFormat#10 )
[60] (byte*) myprintf::str#0 ← ++ (byte*) myprintf::str#10
[61] if(*((byte*) myprintf::str#0)!=(byte) 0) goto myprintf::@1
to:myprintf::@38
myprintf::@38: scope:[myprintf] from myprintf::@27
[62] *((const byte[$64]) strTemp#0 + (byte) myprintf::return#0) ← (byte) 0
to:myprintf::@return
myprintf::@return: scope:[myprintf] from myprintf::@38
[63] return
to:@return
myprintf::@3: scope:[myprintf] from myprintf::@33
[64] if((byte) myprintf::b#1<(byte) '1') goto myprintf::@4
to:myprintf::@39
myprintf::@39: scope:[myprintf] from myprintf::@3
[65] if((byte) myprintf::b#1<=(byte) '9') goto myprintf::@23
to:myprintf::@4
myprintf::@4: scope:[myprintf] from myprintf::@3 myprintf::@39
[66] if((byte) myprintf::b#1!=(byte) '-') goto myprintf::@5
to:myprintf::@27
myprintf::@5: scope:[myprintf] from myprintf::@4
[67] if((byte) myprintf::b#1==(byte) 'c') goto myprintf::@6
to:myprintf::@24
myprintf::@24: scope:[myprintf] from myprintf::@5
[68] if((byte) myprintf::b#1==(byte) 'd') goto myprintf::@7
to:myprintf::@25
myprintf::@25: scope:[myprintf] from myprintf::@24
[69] if((byte) myprintf::b#1==(byte) 'x') goto myprintf::@26
to:myprintf::@40
myprintf::@40: scope:[myprintf] from myprintf::@25
[70] if((byte) myprintf::b#1==(byte) 'X') goto myprintf::@26
to:myprintf::@22
myprintf::@22: scope:[myprintf] from myprintf::@11 myprintf::@20 myprintf::@21 myprintf::@40 myprintf::@42 myprintf::@6
[71] (byte) myprintf::bDigits#25 ← phi( myprintf::@11/(byte) myprintf::bDigits#14 myprintf::@20/(byte) myprintf::bDigits#16 myprintf::@21/(byte) myprintf::bDigits#3 myprintf::@40/(byte) myprintf::bDigits#14 myprintf::@6/(byte) myprintf::bDigits#14 )
[71] (byte) myprintf::bLen#28 ← phi( myprintf::@11/(byte) myprintf::bLen#3 myprintf::@20/(byte) myprintf::bLen#24 myprintf::@21/(byte) myprintf::bLen#6 myprintf::@40/(byte) myprintf::bLen#14 myprintf::@6/(byte) myprintf::bLen#1 )
to:myprintf::@27
myprintf::@26: scope:[myprintf] from myprintf::@25 myprintf::@40
[72] (byte~) myprintf::$17 ← (byte)(word) myprintf::w#10
[73] (byte~) myprintf::$18 ← (byte~) myprintf::$17 >> (byte) 4
[74] (byte) myprintf::b#15 ← (byte~) myprintf::$18 & (byte) $f
[75] if((byte) myprintf::b#15<(byte) $a) goto myprintf::@8
to:myprintf::@9
myprintf::@8: scope:[myprintf] from myprintf::@26
[76] phi()
to:myprintf::@9
myprintf::@9: scope:[myprintf] from myprintf::@26 myprintf::@8
[77] (byte~) myprintf::$23 ← phi( myprintf::@8/(byte) '0' myprintf::@26/(byte) $57 )
[78] (byte~) myprintf::$24 ← (byte~) myprintf::$23 + (byte) myprintf::b#15
[79] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#14) ← (byte~) myprintf::$24
[80] (byte) myprintf::bLen#10 ← ++ (byte) myprintf::bLen#14
[81] (byte~) myprintf::$25 ← (byte)(word) myprintf::w#10
[82] (byte) myprintf::b#16 ← (byte~) myprintf::$25 & (byte) $f
[83] if((byte) myprintf::b#16<(byte) $a) goto myprintf::@10
to:myprintf::@11
myprintf::@10: scope:[myprintf] from myprintf::@9
[84] phi()
to:myprintf::@11
myprintf::@11: scope:[myprintf] from myprintf::@10 myprintf::@9
[85] (byte~) myprintf::$30 ← phi( myprintf::@10/(byte) '0' myprintf::@9/(byte) $57 )
[86] (byte~) myprintf::$31 ← (byte~) myprintf::$30 + (byte) myprintf::b#16
[87] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#10) ← (byte~) myprintf::$31
[88] (byte) myprintf::bLen#3 ← ++ (byte) myprintf::bLen#10
to:myprintf::@22
myprintf::@7: scope:[myprintf] from myprintf::@24
[89] (word) utoa::value#4 ← (word) myprintf::w#10
[90] call utoa
to:myprintf::@12
myprintf::@12: scope:[myprintf] from myprintf::@13 myprintf::@7
[91] (byte) myprintf::b#17 ← phi( myprintf::@13/(byte) myprintf::b#5 myprintf::@7/(byte) 1 )
[92] if(*((const byte[6]) myprintf::buf6#0 + (byte) myprintf::b#17)!=(byte) 0) goto myprintf::@13
to:myprintf::@14
myprintf::@14: scope:[myprintf] from myprintf::@12
[93] if((byte) myprintf::bTrailing#10!=(byte) 0) goto myprintf::@15
to:myprintf::@41
myprintf::@41: scope:[myprintf] from myprintf::@14
[94] if((byte) myprintf::bDigits#14>(byte) myprintf::b#17) goto myprintf::@16
to:myprintf::@15
myprintf::@15: scope:[myprintf] from myprintf::@14 myprintf::@18 myprintf::@41
[95] (byte) myprintf::bDigits#16 ← phi( myprintf::@14/(byte) myprintf::bDigits#14 myprintf::@18/(byte) myprintf::bDigits#2 )
[95] (byte) myprintf::bLen#23 ← phi( myprintf::@14/(byte) myprintf::bLen#14 myprintf::@18/(byte) myprintf::bLen#4 )
to:myprintf::@19
myprintf::@19: scope:[myprintf] from myprintf::@15 myprintf::@19
[96] (byte) myprintf::bLen#12 ← phi( myprintf::@15/(byte) myprintf::bLen#23 myprintf::@19/(byte) myprintf::bLen#24 )
[96] (byte) myprintf::digit#3 ← phi( myprintf::@15/(byte) 0 myprintf::@19/(byte) myprintf::digit#2 )
[97] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#12) ← *((const byte[6]) myprintf::buf6#0 + (byte) myprintf::digit#3)
[98] (byte) myprintf::bLen#24 ← ++ (byte) myprintf::bLen#12
[99] (byte) myprintf::digit#2 ← ++ (byte) myprintf::digit#3
[100] if((byte) myprintf::digit#2<(byte) myprintf::b#17) goto myprintf::@19
to:myprintf::@20
myprintf::@20: scope:[myprintf] from myprintf::@19
[101] if((byte) myprintf::bTrailing#10==(byte) 0) goto myprintf::@22
to:myprintf::@42
myprintf::@42: scope:[myprintf] from myprintf::@20
[102] if((byte) myprintf::bDigits#16<=(byte) myprintf::b#17) goto myprintf::@22
to:myprintf::@21
myprintf::@21: scope:[myprintf] from myprintf::@21 myprintf::@42
[103] (byte) myprintf::bDigits#8 ← phi( myprintf::@42/(byte) myprintf::bDigits#16 myprintf::@21/(byte) myprintf::bDigits#3 )
[103] (byte) myprintf::bLen#13 ← phi( myprintf::@42/(byte) myprintf::bLen#24 myprintf::@21/(byte) myprintf::bLen#6 )
[104] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#13) ← (byte) ' '
[105] (byte) myprintf::bLen#6 ← ++ (byte) myprintf::bLen#13
[106] (byte) myprintf::bDigits#3 ← -- (byte) myprintf::bDigits#8
[107] if((byte) myprintf::bDigits#3>(byte) myprintf::b#17) goto myprintf::@21
to:myprintf::@22
myprintf::@16: scope:[myprintf] from myprintf::@18 myprintf::@41
[108] (byte) myprintf::bDigits#10 ← phi( myprintf::@41/(byte) myprintf::bDigits#14 myprintf::@18/(byte) myprintf::bDigits#2 )
[108] (byte) myprintf::bLen#11 ← phi( myprintf::@41/(byte) myprintf::bLen#14 myprintf::@18/(byte) myprintf::bLen#4 )
[109] if((byte) myprintf::bLeadZero#10==(byte) 0) goto myprintf::@17
to:myprintf::@18
myprintf::@17: scope:[myprintf] from myprintf::@16
[110] phi()
to:myprintf::@18
myprintf::@18: scope:[myprintf] from myprintf::@16 myprintf::@17
[111] (byte~) myprintf::$41 ← phi( myprintf::@17/(byte) ' ' myprintf::@16/(byte) '0' )
[112] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#11) ← (byte~) myprintf::$41
[113] (byte) myprintf::bLen#4 ← ++ (byte) myprintf::bLen#11
[114] (byte) myprintf::bDigits#2 ← -- (byte) myprintf::bDigits#10
[115] if((byte) myprintf::bDigits#2>(byte) myprintf::b#17) goto myprintf::@16
to:myprintf::@15
myprintf::@13: scope:[myprintf] from myprintf::@12
[116] (byte) myprintf::b#5 ← ++ (byte) myprintf::b#17
to:myprintf::@12
myprintf::@6: scope:[myprintf] from myprintf::@5
[117] (byte~) myprintf::$49 ← (byte)(word) myprintf::w#10
[118] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#14) ← (byte~) myprintf::$49
[119] (byte) myprintf::bLen#1 ← ++ (byte) myprintf::bLen#14
to:myprintf::@22
myprintf::@23: scope:[myprintf] from myprintf::@39
[120] (byte) myprintf::bDigits#1 ← (byte) myprintf::b#1 - (byte) '0'
to:myprintf::@27
myprintf::@2: scope:[myprintf] from myprintf::@1
[121] if((byte) myprintf::b#1!=(byte) '%') goto myprintf::@28
to:myprintf::@1_1
myprintf::@1_1: scope:[myprintf] from myprintf
[55] (byte) myprintf::b#47 ← *((byte*) myprintf::str#5)
to:myprintf::@2
myprintf::@2: scope:[myprintf] from myprintf::@1 myprintf::@1_1
[56] (byte) myprintf::b#35 ← phi( myprintf::@1/(byte) myprintf::b#1 myprintf::@1_1/(byte) myprintf::b#47 )
[56] (byte) myprintf::bLeadZero#47 ← phi( myprintf::@1/(byte) myprintf::bLeadZero#10 myprintf::@1_1/(byte) 0 )
[56] (byte) myprintf::bDigits#47 ← phi( myprintf::@1/(byte) myprintf::bDigits#14 myprintf::@1_1/(byte) 0 )
[56] (byte) myprintf::bTrailing#46 ← phi( myprintf::@1/(byte) myprintf::bTrailing#10 myprintf::@1_1/(byte) 0 )
[56] (word) myprintf::w#45 ← phi( myprintf::@1/(word) myprintf::w#10 myprintf::@1_1/(word) 0 )
[56] (byte) myprintf::bLen#54 ← phi( myprintf::@1/(byte) myprintf::bLen#14 myprintf::@1_1/(byte) 0 )
[56] (byte) myprintf::bArg#48 ← phi( myprintf::@1/(byte) myprintf::bArg#10 myprintf::@1_1/(byte) 0 )
[56] (byte) myprintf::bFormat#22 ← phi( myprintf::@1/(byte) myprintf::bFormat#10 myprintf::@1_1/(byte) 0 )
[56] (byte*) myprintf::str#51 ← phi( myprintf::@1/(byte*) myprintf::str#0 myprintf::@1_1/(byte*) myprintf::str#5 )
[57] if((byte) myprintf::b#35!=(byte) '%') goto myprintf::@28
to:myprintf::@34
myprintf::@34: scope:[myprintf] from myprintf::@2
[122] if((byte) myprintf::bArg#12==(byte) 0) goto myprintf::@29
[58] if((byte) myprintf::bArg#48==(byte) 0) goto myprintf::@29
to:myprintf::@35
myprintf::@35: scope:[myprintf] from myprintf::@34
[123] if((byte) myprintf::bArg#12==(byte) 1) goto myprintf::@30
[59] if((byte) myprintf::bArg#48==(byte) 1) goto myprintf::@30
to:myprintf::@36
myprintf::@36: scope:[myprintf] from myprintf::@35
[124] (word~) myprintf::w#51 ← (word) myprintf::w3#7
[60] (word~) myprintf::w#92 ← (word) myprintf::w3#7
to:myprintf::@31
myprintf::@31: scope:[myprintf] from myprintf::@29 myprintf::@30 myprintf::@36
[125] (word) myprintf::w#21 ← phi( myprintf::@29/(word~) myprintf::w#49 myprintf::@30/(word~) myprintf::w#50 myprintf::@36/(word~) myprintf::w#51 )
[126] (byte) myprintf::bArg#1 ← ++ (byte) myprintf::bArg#12
[61] (word) myprintf::w#21 ← phi( myprintf::@29/(word~) myprintf::w#90 myprintf::@30/(word~) myprintf::w#91 myprintf::@36/(word~) myprintf::w#92 )
[62] (byte) myprintf::bArg#1 ← ++ (byte) myprintf::bArg#48
to:myprintf::@27
myprintf::@27: scope:[myprintf] from myprintf::@22 myprintf::@23 myprintf::@31 myprintf::@32 myprintf::@33 myprintf::@4
[63] (byte*) myprintf::str#47 ← phi( myprintf::@22/(byte*) myprintf::str#0 myprintf::@23/(byte*) myprintf::str#0 myprintf::@4/(byte*) myprintf::str#0 myprintf::@31/(byte*) myprintf::str#51 myprintf::@32/(byte*) myprintf::str#51 myprintf::@33/(byte*) myprintf::str#0 )
[63] (byte) myprintf::bLeadZero#10 ← phi( myprintf::@22/(byte) myprintf::bLeadZero#10 myprintf::@23/(byte) myprintf::bLeadZero#10 myprintf::@4/(byte) myprintf::bLeadZero#10 myprintf::@31/(byte) 0 myprintf::@32/(byte) myprintf::bLeadZero#47 myprintf::@33/(byte) 1 )
[63] (byte) myprintf::bDigits#14 ← phi( myprintf::@22/(byte) myprintf::bDigits#25 myprintf::@23/(byte) myprintf::bDigits#1 myprintf::@4/(byte) myprintf::bDigits#14 myprintf::@31/(byte) 1 myprintf::@32/(byte) myprintf::bDigits#47 myprintf::@33/(byte) myprintf::bDigits#14 )
[63] (byte) myprintf::bTrailing#10 ← phi( myprintf::@22/(byte) myprintf::bTrailing#10 myprintf::@23/(byte) myprintf::bTrailing#10 myprintf::@4/(byte) 1 myprintf::@31/(byte) 0 myprintf::@32/(byte) myprintf::bTrailing#46 myprintf::@33/(byte) myprintf::bTrailing#10 )
[63] (word) myprintf::w#10 ← phi( myprintf::@22/(word) myprintf::w#10 myprintf::@23/(word) myprintf::w#10 myprintf::@4/(word) myprintf::w#10 myprintf::@31/(word) myprintf::w#21 myprintf::@32/(word) myprintf::w#45 myprintf::@33/(word) myprintf::w#10 )
[63] (byte) myprintf::bArg#10 ← phi( myprintf::@22/(byte) myprintf::bArg#10 myprintf::@23/(byte) myprintf::bArg#10 myprintf::@4/(byte) myprintf::bArg#10 myprintf::@31/(byte) myprintf::bArg#1 myprintf::@32/(byte) myprintf::bArg#48 myprintf::@33/(byte) myprintf::bArg#10 )
[63] (byte) myprintf::bLen#14 ← phi( myprintf::@22/(byte) myprintf::bLen#28 myprintf::@23/(byte) myprintf::bLen#14 myprintf::@4/(byte) myprintf::bLen#14 myprintf::@31/(byte) myprintf::bLen#54 myprintf::@32/(byte) myprintf::bLen#7 myprintf::@33/(byte) myprintf::bLen#14 )
[63] (byte) myprintf::bFormat#10 ← phi( myprintf::@22/(byte) 0 myprintf::@23/(byte) myprintf::bFormat#10 myprintf::@4/(byte) myprintf::bFormat#10 myprintf::@31/(byte) 1 myprintf::@32/(byte) myprintf::bFormat#22 myprintf::@33/(byte) myprintf::bFormat#10 )
[64] (byte*) myprintf::str#0 ← ++ (byte*) myprintf::str#47
[65] if(*((byte*) myprintf::str#0)!=(byte) 0) goto myprintf::@1
to:myprintf::@38
myprintf::@38: scope:[myprintf] from myprintf::@27
[66] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#14) ← (byte) 0
to:myprintf::@return
myprintf::@return: scope:[myprintf] from myprintf::@38
[67] return
to:@return
myprintf::@1: scope:[myprintf] from myprintf::@27
[68] (byte) myprintf::b#1 ← *((byte*) myprintf::str#0)
[69] if((byte) myprintf::bFormat#10==(byte) 0) goto myprintf::@2
to:myprintf::@33
myprintf::@33: scope:[myprintf] from myprintf::@1
[70] if((byte) myprintf::b#1!=(byte) '0') goto myprintf::@3
to:myprintf::@27
myprintf::@3: scope:[myprintf] from myprintf::@33
[71] if((byte) myprintf::b#1<(byte) '1') goto myprintf::@4
to:myprintf::@39
myprintf::@39: scope:[myprintf] from myprintf::@3
[72] if((byte) myprintf::b#1<=(byte) '9') goto myprintf::@23
to:myprintf::@4
myprintf::@4: scope:[myprintf] from myprintf::@3 myprintf::@39
[73] if((byte) myprintf::b#1!=(byte) '-') goto myprintf::@5
to:myprintf::@27
myprintf::@5: scope:[myprintf] from myprintf::@4
[74] if((byte) myprintf::b#1==(byte) 'c') goto myprintf::@6
to:myprintf::@24
myprintf::@24: scope:[myprintf] from myprintf::@5
[75] if((byte) myprintf::b#1==(byte) 'd') goto myprintf::@7
to:myprintf::@25
myprintf::@25: scope:[myprintf] from myprintf::@24
[76] if((byte) myprintf::b#1==(byte) 'x') goto myprintf::@26
to:myprintf::@40
myprintf::@40: scope:[myprintf] from myprintf::@25
[77] if((byte) myprintf::b#1==(byte) 'X') goto myprintf::@26
to:myprintf::@22
myprintf::@22: scope:[myprintf] from myprintf::@11 myprintf::@20 myprintf::@21 myprintf::@40 myprintf::@42 myprintf::@6
[78] (byte) myprintf::bDigits#25 ← phi( myprintf::@11/(byte) myprintf::bDigits#14 myprintf::@20/(byte) myprintf::bDigits#16 myprintf::@21/(byte) myprintf::bDigits#3 myprintf::@40/(byte) myprintf::bDigits#14 myprintf::@6/(byte) myprintf::bDigits#14 )
[78] (byte) myprintf::bLen#28 ← phi( myprintf::@11/(byte) myprintf::bLen#3 myprintf::@20/(byte) myprintf::bLen#24 myprintf::@21/(byte) myprintf::bLen#6 myprintf::@40/(byte) myprintf::bLen#14 myprintf::@6/(byte) myprintf::bLen#1 )
to:myprintf::@27
myprintf::@26: scope:[myprintf] from myprintf::@25 myprintf::@40
[79] (byte~) myprintf::$17 ← (byte)(word) myprintf::w#10
[80] (byte~) myprintf::$18 ← (byte~) myprintf::$17 >> (byte) 4
[81] (byte) myprintf::b#15 ← (byte~) myprintf::$18 & (byte) $f
[82] if((byte) myprintf::b#15<(byte) $a) goto myprintf::@8
to:myprintf::@9
myprintf::@8: scope:[myprintf] from myprintf::@26
[83] phi()
to:myprintf::@9
myprintf::@9: scope:[myprintf] from myprintf::@26 myprintf::@8
[84] (byte~) myprintf::$23 ← phi( myprintf::@8/(byte) '0' myprintf::@26/(byte) $57 )
[85] (byte~) myprintf::$24 ← (byte~) myprintf::$23 + (byte) myprintf::b#15
[86] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#14) ← (byte~) myprintf::$24
[87] (byte) myprintf::bLen#10 ← ++ (byte) myprintf::bLen#14
[88] (byte~) myprintf::$25 ← (byte)(word) myprintf::w#10
[89] (byte) myprintf::b#16 ← (byte~) myprintf::$25 & (byte) $f
[90] if((byte) myprintf::b#16<(byte) $a) goto myprintf::@10
to:myprintf::@11
myprintf::@10: scope:[myprintf] from myprintf::@9
[91] phi()
to:myprintf::@11
myprintf::@11: scope:[myprintf] from myprintf::@10 myprintf::@9
[92] (byte~) myprintf::$30 ← phi( myprintf::@10/(byte) '0' myprintf::@9/(byte) $57 )
[93] (byte~) myprintf::$31 ← (byte~) myprintf::$30 + (byte) myprintf::b#16
[94] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#10) ← (byte~) myprintf::$31
[95] (byte) myprintf::bLen#3 ← ++ (byte) myprintf::bLen#10
to:myprintf::@22
myprintf::@7: scope:[myprintf] from myprintf::@24
[96] (word) utoa::value#4 ← (word) myprintf::w#10
[97] call utoa
to:myprintf::@12
myprintf::@12: scope:[myprintf] from myprintf::@13 myprintf::@7
[98] (byte) myprintf::b#17 ← phi( myprintf::@13/(byte) myprintf::b#5 myprintf::@7/(byte) 1 )
[99] if(*((const byte[6]) myprintf::buf6#0 + (byte) myprintf::b#17)!=(byte) 0) goto myprintf::@13
to:myprintf::@14
myprintf::@14: scope:[myprintf] from myprintf::@12
[100] if((byte) myprintf::bTrailing#10!=(byte) 0) goto myprintf::@15
to:myprintf::@41
myprintf::@41: scope:[myprintf] from myprintf::@14
[101] if((byte) myprintf::bDigits#14>(byte) myprintf::b#17) goto myprintf::@16
to:myprintf::@15
myprintf::@15: scope:[myprintf] from myprintf::@14 myprintf::@18 myprintf::@41
[102] (byte) myprintf::bDigits#16 ← phi( myprintf::@14/(byte) myprintf::bDigits#14 myprintf::@18/(byte) myprintf::bDigits#2 )
[102] (byte) myprintf::bLen#23 ← phi( myprintf::@14/(byte) myprintf::bLen#14 myprintf::@18/(byte) myprintf::bLen#4 )
to:myprintf::@19
myprintf::@19: scope:[myprintf] from myprintf::@15 myprintf::@19
[103] (byte) myprintf::bLen#12 ← phi( myprintf::@15/(byte) myprintf::bLen#23 myprintf::@19/(byte) myprintf::bLen#24 )
[103] (byte) myprintf::digit#3 ← phi( myprintf::@15/(byte) 0 myprintf::@19/(byte) myprintf::digit#2 )
[104] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#12) ← *((const byte[6]) myprintf::buf6#0 + (byte) myprintf::digit#3)
[105] (byte) myprintf::bLen#24 ← ++ (byte) myprintf::bLen#12
[106] (byte) myprintf::digit#2 ← ++ (byte) myprintf::digit#3
[107] if((byte) myprintf::digit#2<(byte) myprintf::b#17) goto myprintf::@19
to:myprintf::@20
myprintf::@20: scope:[myprintf] from myprintf::@19
[108] if((byte) myprintf::bTrailing#10==(byte) 0) goto myprintf::@22
to:myprintf::@42
myprintf::@42: scope:[myprintf] from myprintf::@20
[109] if((byte) myprintf::bDigits#16<=(byte) myprintf::b#17) goto myprintf::@22
to:myprintf::@21
myprintf::@21: scope:[myprintf] from myprintf::@21 myprintf::@42
[110] (byte) myprintf::bDigits#8 ← phi( myprintf::@42/(byte) myprintf::bDigits#16 myprintf::@21/(byte) myprintf::bDigits#3 )
[110] (byte) myprintf::bLen#13 ← phi( myprintf::@42/(byte) myprintf::bLen#24 myprintf::@21/(byte) myprintf::bLen#6 )
[111] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#13) ← (byte) ' '
[112] (byte) myprintf::bLen#6 ← ++ (byte) myprintf::bLen#13
[113] (byte) myprintf::bDigits#3 ← -- (byte) myprintf::bDigits#8
[114] if((byte) myprintf::bDigits#3>(byte) myprintf::b#17) goto myprintf::@21
to:myprintf::@22
myprintf::@16: scope:[myprintf] from myprintf::@18 myprintf::@41
[115] (byte) myprintf::bDigits#10 ← phi( myprintf::@41/(byte) myprintf::bDigits#14 myprintf::@18/(byte) myprintf::bDigits#2 )
[115] (byte) myprintf::bLen#11 ← phi( myprintf::@41/(byte) myprintf::bLen#14 myprintf::@18/(byte) myprintf::bLen#4 )
[116] if((byte) myprintf::bLeadZero#10==(byte) 0) goto myprintf::@17
to:myprintf::@18
myprintf::@17: scope:[myprintf] from myprintf::@16
[117] phi()
to:myprintf::@18
myprintf::@18: scope:[myprintf] from myprintf::@16 myprintf::@17
[118] (byte~) myprintf::$41 ← phi( myprintf::@17/(byte) ' ' myprintf::@16/(byte) '0' )
[119] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#11) ← (byte~) myprintf::$41
[120] (byte) myprintf::bLen#4 ← ++ (byte) myprintf::bLen#11
[121] (byte) myprintf::bDigits#2 ← -- (byte) myprintf::bDigits#10
[122] if((byte) myprintf::bDigits#2>(byte) myprintf::b#17) goto myprintf::@16
to:myprintf::@15
myprintf::@13: scope:[myprintf] from myprintf::@12
[123] (byte) myprintf::b#5 ← ++ (byte) myprintf::b#17
to:myprintf::@12
myprintf::@6: scope:[myprintf] from myprintf::@5
[124] (byte~) myprintf::$49 ← (byte)(word) myprintf::w#10
[125] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#14) ← (byte~) myprintf::$49
[126] (byte) myprintf::bLen#1 ← ++ (byte) myprintf::bLen#14
to:myprintf::@22
myprintf::@23: scope:[myprintf] from myprintf::@39
[127] (byte) myprintf::bDigits#1 ← (byte) myprintf::b#1 - (byte) '0'
to:myprintf::@27
myprintf::@30: scope:[myprintf] from myprintf::@35
[127] (word~) myprintf::w#50 ← (word) myprintf::w2#7
[128] (word~) myprintf::w#91 ← (word) myprintf::w2#7
to:myprintf::@31
myprintf::@29: scope:[myprintf] from myprintf::@34
[128] (word~) myprintf::w#49 ← (word) myprintf::w1#6
[129] (word~) myprintf::w#90 ← (word) myprintf::w1#6
to:myprintf::@31
myprintf::@28: scope:[myprintf] from myprintf::@2
[129] if((byte) myprintf::b#1<(byte) $41) goto myprintf::@32
[130] if((byte) myprintf::b#35<(byte) $41) goto myprintf::@32
to:myprintf::@43
myprintf::@43: scope:[myprintf] from myprintf::@28
[130] if((byte) myprintf::b#1>=(byte) $5a+(byte) 1) goto myprintf::@32
[131] if((byte) myprintf::b#35>=(byte) $5a+(byte) 1) goto myprintf::@32
to:myprintf::@37
myprintf::@37: scope:[myprintf] from myprintf::@43
[131] (byte) myprintf::b#6 ← (byte) myprintf::b#1 + (byte) $20
[132] (byte) myprintf::b#6 ← (byte) myprintf::b#35 + (byte) $20
to:myprintf::@32
myprintf::@32: scope:[myprintf] from myprintf::@28 myprintf::@37 myprintf::@43
[132] (byte) myprintf::b#25 ← phi( myprintf::@28/(byte) myprintf::b#1 myprintf::@37/(byte) myprintf::b#6 )
[133] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#14) ← (byte) myprintf::b#25
[134] (byte) myprintf::bLen#7 ← ++ (byte) myprintf::bLen#14
[133] (byte) myprintf::b#25 ← phi( myprintf::@28/(byte) myprintf::b#35 myprintf::@37/(byte) myprintf::b#6 )
[134] *((const byte[$64]) strTemp#0 + (byte) myprintf::bLen#54) ← (byte) myprintf::b#25
[135] (byte) myprintf::bLen#7 ← ++ (byte) myprintf::bLen#54
to:myprintf::@27
utoa: scope:[utoa] from myprintf::@7
[135] phi()
[136] phi()
to:utoa::@13
utoa::@13: scope:[utoa] from utoa
[136] if((word) utoa::value#4>=(word) $2710) goto utoa::@5
[137] if((word) utoa::value#4>=(word) $2710) goto utoa::@5
to:utoa::@1
utoa::@1: scope:[utoa] from utoa::@13 utoa::@9
[137] (byte*) utoa::dst#16 ← phi( utoa::@13/(const byte[6]) myprintf::buf6#0 utoa::@9/++(const byte[6]) myprintf::buf6#0 )
[137] (word) utoa::value#6 ← phi( utoa::@13/(word) utoa::value#4 utoa::@9/(word) utoa::value#0 )
[137] (byte) utoa::bStarted#5 ← phi( utoa::@13/(byte) 0 utoa::@9/(byte) 1 )
[138] if((byte) utoa::bStarted#5==(byte) 1) goto utoa::@6
[138] (byte*) utoa::dst#16 ← phi( utoa::@13/(const byte[6]) myprintf::buf6#0 utoa::@9/++(const byte[6]) myprintf::buf6#0 )
[138] (word) utoa::value#6 ← phi( utoa::@13/(word) utoa::value#4 utoa::@9/(word) utoa::value#0 )
[138] (byte) utoa::bStarted#5 ← phi( utoa::@13/(byte) 0 utoa::@9/(byte) 1 )
[139] if((byte) utoa::bStarted#5==(byte) 1) goto utoa::@6
to:utoa::@14
utoa::@14: scope:[utoa] from utoa::@1
[139] if((word) utoa::value#6>=(word) $3e8) goto utoa::@6
[140] if((word) utoa::value#6>=(word) $3e8) goto utoa::@6
to:utoa::@2
utoa::@2: scope:[utoa] from utoa::@10 utoa::@14
[140] (byte*) utoa::dst#10 ← phi( utoa::@14/(byte*) utoa::dst#16 utoa::@10/(byte*) utoa::dst#1 )
[140] (word) utoa::value#11 ← phi( utoa::@14/(word) utoa::value#6 utoa::@10/(word) utoa::value#1 )
[140] (byte) utoa::bStarted#6 ← phi( utoa::@14/(byte) utoa::bStarted#5 utoa::@10/(byte) 1 )
[141] if((byte) utoa::bStarted#6==(byte) 1) goto utoa::@7
[141] (byte*) utoa::dst#10 ← phi( utoa::@14/(byte*) utoa::dst#16 utoa::@10/(byte*) utoa::dst#1 )
[141] (word) utoa::value#11 ← phi( utoa::@14/(word) utoa::value#6 utoa::@10/(word) utoa::value#1 )
[141] (byte) utoa::bStarted#6 ← phi( utoa::@14/(byte) utoa::bStarted#5 utoa::@10/(byte) 1 )
[142] if((byte) utoa::bStarted#6==(byte) 1) goto utoa::@7
to:utoa::@15
utoa::@15: scope:[utoa] from utoa::@2
[142] if((word) utoa::value#11>=(byte) $64) goto utoa::@7
[143] if((word) utoa::value#11>=(byte) $64) goto utoa::@7
to:utoa::@3
utoa::@3: scope:[utoa] from utoa::@11 utoa::@15
[143] (byte*) utoa::dst#13 ← phi( utoa::@11/(byte*) utoa::dst#2 utoa::@15/(byte*) utoa::dst#10 )
[143] (word) utoa::value#10 ← phi( utoa::@11/(word) utoa::value#2 utoa::@15/(word) utoa::value#11 )
[143] (byte) utoa::bStarted#7 ← phi( utoa::@11/(byte) 1 utoa::@15/(byte) utoa::bStarted#6 )
[144] if((byte) utoa::bStarted#7==(byte) 1) goto utoa::@8
[144] (byte*) utoa::dst#13 ← phi( utoa::@11/(byte*) utoa::dst#2 utoa::@15/(byte*) utoa::dst#10 )
[144] (word) utoa::value#10 ← phi( utoa::@11/(word) utoa::value#2 utoa::@15/(word) utoa::value#11 )
[144] (byte) utoa::bStarted#7 ← phi( utoa::@11/(byte) 1 utoa::@15/(byte) utoa::bStarted#6 )
[145] if((byte) utoa::bStarted#7==(byte) 1) goto utoa::@8
to:utoa::@16
utoa::@16: scope:[utoa] from utoa::@3
[145] if((word) utoa::value#10>=(byte) $a) goto utoa::@8
[146] if((word) utoa::value#10>=(byte) $a) goto utoa::@8
to:utoa::@4
utoa::@4: scope:[utoa] from utoa::@12 utoa::@16
[146] (byte*) utoa::dst#12 ← phi( utoa::@12/(byte*) utoa::dst#4 utoa::@16/(byte*) utoa::dst#13 )
[146] (word) utoa::value#12 ← phi( utoa::@12/(word) utoa::value#3 utoa::@16/(word) utoa::value#10 )
[147] (byte~) utoa::$16 ← (byte)(word) utoa::value#12
[148] (byte~) utoa::$17 ← (byte) '0' + (byte~) utoa::$16
[149] *((byte*) utoa::dst#12) ← (byte~) utoa::$17
[150] (byte*) utoa::dst#3 ← ++ (byte*) utoa::dst#12
[151] *((byte*) utoa::dst#3) ← (byte) 0
[147] (byte*) utoa::dst#12 ← phi( utoa::@12/(byte*) utoa::dst#4 utoa::@16/(byte*) utoa::dst#13 )
[147] (word) utoa::value#12 ← phi( utoa::@12/(word) utoa::value#3 utoa::@16/(word) utoa::value#10 )
[148] (byte~) utoa::$16 ← (byte)(word) utoa::value#12
[149] (byte~) utoa::$17 ← (byte) '0' + (byte~) utoa::$16
[150] *((byte*) utoa::dst#12) ← (byte~) utoa::$17
[151] (byte*) utoa::dst#3 ← ++ (byte*) utoa::dst#12
[152] *((byte*) utoa::dst#3) ← (byte) 0
to:utoa::@return
utoa::@return: scope:[utoa] from utoa::@4
[152] return
[153] return
to:@return
utoa::@8: scope:[utoa] from utoa::@16 utoa::@3
[153] (byte*) append::dst#3 ← (byte*) utoa::dst#13
[154] (word) append::value#4 ← (word) utoa::value#10
[155] call append
[156] (word) append::return#10 ← (word) append::value#5
[154] (byte*) append::dst#3 ← (byte*) utoa::dst#13
[155] (word) append::value#4 ← (word) utoa::value#10
[156] call append
[157] (word) append::return#10 ← (word) append::value#5
to:utoa::@12
utoa::@12: scope:[utoa] from utoa::@8
[157] (word) utoa::value#3 ← (word) append::return#10
[158] (byte*) utoa::dst#4 ← ++ (byte*) utoa::dst#13
[158] (word) utoa::value#3 ← (word) append::return#10
[159] (byte*) utoa::dst#4 ← ++ (byte*) utoa::dst#13
to:utoa::@4
utoa::@7: scope:[utoa] from utoa::@15 utoa::@2
[159] (byte*) append::dst#2 ← (byte*) utoa::dst#10
[160] (word) append::value#3 ← (word) utoa::value#11
[161] call append
[162] (word) append::return#4 ← (word) append::value#5
[160] (byte*) append::dst#2 ← (byte*) utoa::dst#10
[161] (word) append::value#3 ← (word) utoa::value#11
[162] call append
[163] (word) append::return#4 ← (word) append::value#5
to:utoa::@11
utoa::@11: scope:[utoa] from utoa::@7
[163] (word) utoa::value#2 ← (word) append::return#4
[164] (byte*) utoa::dst#2 ← ++ (byte*) utoa::dst#10
[164] (word) utoa::value#2 ← (word) append::return#4
[165] (byte*) utoa::dst#2 ← ++ (byte*) utoa::dst#10
to:utoa::@3
utoa::@6: scope:[utoa] from utoa::@1 utoa::@14
[165] (byte*) append::dst#1 ← (byte*) utoa::dst#16
[166] (word) append::value#2 ← (word) utoa::value#6
[167] call append
[168] (word) append::return#3 ← (word) append::value#5
[166] (byte*) append::dst#1 ← (byte*) utoa::dst#16
[167] (word) append::value#2 ← (word) utoa::value#6
[168] call append
[169] (word) append::return#3 ← (word) append::value#5
to:utoa::@10
utoa::@10: scope:[utoa] from utoa::@6
[169] (word) utoa::value#1 ← (word) append::return#3
[170] (byte*) utoa::dst#1 ← ++ (byte*) utoa::dst#16
[170] (word) utoa::value#1 ← (word) append::return#3
[171] (byte*) utoa::dst#1 ← ++ (byte*) utoa::dst#16
to:utoa::@2
utoa::@5: scope:[utoa] from utoa::@13
[171] (word) append::value#1 ← (word) utoa::value#4
[172] call append
[173] (word) append::return#2 ← (word) append::value#5
[172] (word) append::value#1 ← (word) utoa::value#4
[173] call append
[174] (word) append::return#2 ← (word) append::value#5
to:utoa::@9
utoa::@9: scope:[utoa] from utoa::@5
[174] (word) utoa::value#0 ← (word) append::return#2
[175] (word) utoa::value#0 ← (word) append::return#2
to:utoa::@1
append: scope:[append] from utoa::@5 utoa::@6 utoa::@7 utoa::@8
[175] (word) append::sub#6 ← phi( utoa::@5/(word) $2710 utoa::@6/(word) $3e8 utoa::@7/(byte) $64 utoa::@8/(byte) $a )
[175] (word) append::value#8 ← phi( utoa::@5/(word) append::value#1 utoa::@6/(word) append::value#2 utoa::@7/(word) append::value#3 utoa::@8/(word) append::value#4 )
[175] (byte*) append::dst#4 ← phi( utoa::@5/(const byte[6]) myprintf::buf6#0 utoa::@6/(byte*) append::dst#1 utoa::@7/(byte*) append::dst#2 utoa::@8/(byte*) append::dst#3 )
[176] *((byte*) append::dst#4) ← (byte) '0'
[176] (word) append::sub#6 ← phi( utoa::@5/(word) $2710 utoa::@6/(word) $3e8 utoa::@7/(byte) $64 utoa::@8/(byte) $a )
[176] (word) append::value#8 ← phi( utoa::@5/(word) append::value#1 utoa::@6/(word) append::value#2 utoa::@7/(word) append::value#3 utoa::@8/(word) append::value#4 )
[176] (byte*) append::dst#4 ← phi( utoa::@5/(const byte[6]) myprintf::buf6#0 utoa::@6/(byte*) append::dst#1 utoa::@7/(byte*) append::dst#2 utoa::@8/(byte*) append::dst#3 )
[177] *((byte*) append::dst#4) ← (byte) '0'
to:append::@1
append::@1: scope:[append] from append append::@2
[177] (word) append::value#5 ← phi( append/(word) append::value#8 append::@2/(word) append::value#0 )
[178] if((word) append::value#5>=(word) append::sub#6) goto append::@2
[178] (word) append::value#5 ← phi( append/(word) append::value#8 append::@2/(word) append::value#0 )
[179] if((word) append::value#5>=(word) append::sub#6) goto append::@2
to:append::@return
append::@return: scope:[append] from append::@1
[179] return
[180] return
to:@return
append::@2: scope:[append] from append::@1
[180] *((byte*) append::dst#4) ← ++ *((byte*) append::dst#4)
[181] (word) append::value#0 ← (word) append::value#5 - (word) append::sub#6
[181] *((byte*) append::dst#4) ← ++ *((byte*) append::dst#4)
[182] (word) append::value#0 ← (word) append::value#5 - (word) append::sub#6
to:append::@1
div10: scope:[div10] from main::@6
[182] (word~) div10::$0 ← (word) div10::val#4 >> (byte) 1
[183] (word) div10::val#0 ← (word~) div10::$0 + (byte) 1
[184] (word~) div10::$2 ← (word) div10::val#0 << (byte) 1
[185] (word) div10::val#1 ← (word) div10::val#0 + (word~) div10::$2
[186] (word~) div10::$3 ← (word) div10::val#1 >> (byte) 4
[187] (word) div10::val#2 ← (word) div10::val#1 + (word~) div10::$3
[188] (word~) div10::$4 ← (word) div10::val#2 >> (byte) 8
[189] (word) div10::val#3 ← (word) div10::val#2 + (word~) div10::$4
[190] (word) div10::return#0 ← (word) div10::val#3 >> (byte) 4
[183] (word~) div10::$0 ← (word) div10::val#4 >> (byte) 1
[184] (word) div10::val#0 ← (word~) div10::$0 + (byte) 1
[185] (word~) div10::$2 ← (word) div10::val#0 << (byte) 1
[186] (word) div10::val#1 ← (word) div10::val#0 + (word~) div10::$2
[187] (word~) div10::$3 ← (word) div10::val#1 >> (byte) 4
[188] (word) div10::val#2 ← (word) div10::val#1 + (word~) div10::$3
[189] (word~) div10::$4 ← (word) div10::val#2 >> (byte) 8
[190] (word) div10::val#3 ← (word) div10::val#2 + (word~) div10::$4
[191] (word) div10::return#0 ← (word) div10::val#3 >> (byte) 4
to:div10::@return
div10::@return: scope:[div10] from div10
[191] return
[192] return
to:@return
div16u: scope:[div16u] from main::@2
[192] (word) divr16u::dividend#1 ← (word) div16u::dividend#0
[193] call divr16u
[194] (word) divr16u::return#2 ← (word) divr16u::return#0
[193] (word) divr16u::dividend#1 ← (word) div16u::dividend#0
[194] call divr16u
[195] (word) divr16u::return#2 ← (word) divr16u::return#0
to:div16u::@1
div16u::@1: scope:[div16u] from div16u
[195] (word) div16u::return#0 ← (word) divr16u::return#2
[196] (word) div16u::return#0 ← (word) divr16u::return#2
to:div16u::@return
div16u::@return: scope:[div16u] from div16u::@1
[196] return
[197] return
to:@return
divr16u: scope:[divr16u] from div16u
[197] phi()
[198] phi()
to:divr16u::@1
divr16u::@1: scope:[divr16u] from divr16u divr16u::@3
[198] (byte) divr16u::i#2 ← phi( divr16u/(byte) 0 divr16u::@3/(byte) divr16u::i#1 )
[198] (word) divr16u::quotient#3 ← phi( divr16u/(byte) 0 divr16u::@3/(word) divr16u::return#0 )
[198] (word) divr16u::dividend#2 ← phi( divr16u/(word) divr16u::dividend#1 divr16u::@3/(word) divr16u::dividend#0 )
[198] (word) divr16u::rem#4 ← phi( divr16u/(byte) 0 divr16u::@3/(word) divr16u::rem#9 )
[199] (word) divr16u::rem#0 ← (word) divr16u::rem#4 << (byte) 1
[200] (byte~) divr16u::$1 ← > (word) divr16u::dividend#2
[201] (byte~) divr16u::$2 ← (byte~) divr16u::$1 & (byte) $80
[202] if((byte~) divr16u::$2==(byte) 0) goto divr16u::@2
[199] (byte) divr16u::i#2 ← phi( divr16u/(byte) 0 divr16u::@3/(byte) divr16u::i#1 )
[199] (word) divr16u::quotient#3 ← phi( divr16u/(byte) 0 divr16u::@3/(word) divr16u::return#0 )
[199] (word) divr16u::dividend#2 ← phi( divr16u/(word) divr16u::dividend#1 divr16u::@3/(word) divr16u::dividend#0 )
[199] (word) divr16u::rem#4 ← phi( divr16u/(byte) 0 divr16u::@3/(word) divr16u::rem#9 )
[200] (word) divr16u::rem#0 ← (word) divr16u::rem#4 << (byte) 1
[201] (byte~) divr16u::$1 ← > (word) divr16u::dividend#2
[202] (byte~) divr16u::$2 ← (byte~) divr16u::$1 & (byte) $80
[203] if((byte~) divr16u::$2==(byte) 0) goto divr16u::@2
to:divr16u::@4
divr16u::@4: scope:[divr16u] from divr16u::@1
[203] (word) divr16u::rem#1 ← (word) divr16u::rem#0 | (byte) 1
[204] (word) divr16u::rem#1 ← (word) divr16u::rem#0 | (byte) 1
to:divr16u::@2
divr16u::@2: scope:[divr16u] from divr16u::@1 divr16u::@4
[204] (word) divr16u::rem#5 ← phi( divr16u::@1/(word) divr16u::rem#0 divr16u::@4/(word) divr16u::rem#1 )
[205] (word) divr16u::dividend#0 ← (word) divr16u::dividend#2 << (byte) 1
[206] (word) divr16u::quotient#1 ← (word) divr16u::quotient#3 << (byte) 1
[207] if((word) divr16u::rem#5<(const word) div16u::divisor#0) goto divr16u::@3
[205] (word) divr16u::rem#5 ← phi( divr16u::@1/(word) divr16u::rem#0 divr16u::@4/(word) divr16u::rem#1 )
[206] (word) divr16u::dividend#0 ← (word) divr16u::dividend#2 << (byte) 1
[207] (word) divr16u::quotient#1 ← (word) divr16u::quotient#3 << (byte) 1
[208] if((word) divr16u::rem#5<(const word) div16u::divisor#0) goto divr16u::@3
to:divr16u::@5
divr16u::@5: scope:[divr16u] from divr16u::@2
[208] (word) divr16u::quotient#2 ← ++ (word) divr16u::quotient#1
[209] (word) divr16u::rem#2 ← (word) divr16u::rem#5 - (const word) div16u::divisor#0
[209] (word) divr16u::quotient#2 ← ++ (word) divr16u::quotient#1
[210] (word) divr16u::rem#2 ← (word) divr16u::rem#5 - (const word) div16u::divisor#0
to:divr16u::@3
divr16u::@3: scope:[divr16u] from divr16u::@2 divr16u::@5
[210] (word) divr16u::return#0 ← phi( divr16u::@2/(word) divr16u::quotient#1 divr16u::@5/(word) divr16u::quotient#2 )
[210] (word) divr16u::rem#9 ← phi( divr16u::@2/(word) divr16u::rem#5 divr16u::@5/(word) divr16u::rem#2 )
[211] (byte) divr16u::i#1 ← ++ (byte) divr16u::i#2
[212] if((byte) divr16u::i#1!=(byte) $10) goto divr16u::@1
[211] (word) divr16u::return#0 ← phi( divr16u::@2/(word) divr16u::quotient#1 divr16u::@5/(word) divr16u::quotient#2 )
[211] (word) divr16u::rem#9 ← phi( divr16u::@2/(word) divr16u::rem#5 divr16u::@5/(word) divr16u::rem#2 )
[212] (byte) divr16u::i#1 ← ++ (byte) divr16u::i#2
[213] if((byte) divr16u::i#1!=(byte) $10) goto divr16u::@1
to:divr16u::@return
divr16u::@return: scope:[divr16u] from divr16u::@3
[213] return
[214] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -17,21 +17,21 @@
(byte*) append::dst#1 dst zp ZP_WORD:19 2.0
(byte*) append::dst#2 dst zp ZP_WORD:19 2.0
(byte*) append::dst#3 dst zp ZP_WORD:19 2.0
(byte*) append::dst#4 dst zp ZP_WORD:19 335.0
(byte*) append::dst#4 dst zp ZP_WORD:19 3335.0
(word) append::return
(word) append::return#10 return zp ZP_WORD:17 4.0
(word) append::return#2 return zp ZP_WORD:17 4.0
(word) append::return#3 return zp ZP_WORD:17 4.0
(word) append::return#4 return zp ZP_WORD:17 4.0
(word) append::sub
(word) append::sub#6 sub zp ZP_WORD:21 333.6666666666667
(word) append::sub#6 sub zp ZP_WORD:21 3333.6666666666665
(word) append::value
(word) append::value#0 value zp ZP_WORD:17 2002.0
(word) append::value#0 value zp ZP_WORD:17 20002.0
(word) append::value#1 value zp ZP_WORD:17 4.0
(word) append::value#2 value zp ZP_WORD:17 4.0
(word) append::value#3 value zp ZP_WORD:17 4.0
(word) append::value#4 value zp ZP_WORD:17 4.0
(word) append::value#5 value zp ZP_WORD:17 376.625
(word) append::value#5 value zp ZP_WORD:17 3751.625
(word) append::value#8 value zp ZP_WORD:17 5.0
(word()) div10((word) div10::val)
(word~) div10::$0 $0 zp ZP_WORD:19 4.0
@ -122,15 +122,15 @@
(word) main::v#1 v zp ZP_WORD:4 14.0
(word) main::v#2 v zp ZP_WORD:4 14.0
(byte()) myprintf((byte*) myprintf::dst , (byte*) myprintf::str , (word) myprintf::w1 , (word) myprintf::w2 , (word) myprintf::w3)
(byte~) myprintf::$17 reg byte a 202.0
(byte~) myprintf::$18 reg byte a 202.0
(byte~) myprintf::$23 reg byte a 101.0
(byte~) myprintf::$24 reg byte a 202.0
(byte~) myprintf::$25 reg byte a 202.0
(byte~) myprintf::$30 reg byte a 101.0
(byte~) myprintf::$31 reg byte a 202.0
(byte~) myprintf::$41 reg byte a 1001.0
(byte~) myprintf::$49 reg byte a 202.0
(byte~) myprintf::$17 reg byte a 2002.0
(byte~) myprintf::$18 reg byte a 2002.0
(byte~) myprintf::$23 reg byte a 1001.0
(byte~) myprintf::$24 reg byte a 2002.0
(byte~) myprintf::$25 reg byte a 2002.0
(byte~) myprintf::$30 reg byte a 1001.0
(byte~) myprintf::$31 reg byte a 2002.0
(byte~) myprintf::$41 reg byte a 10001.0
(byte~) myprintf::$49 reg byte a 2002.0
(label) myprintf::@1
(label) myprintf::@10
(label) myprintf::@11
@ -142,6 +142,7 @@
(label) myprintf::@17
(label) myprintf::@18
(label) myprintf::@19
(label) myprintf::@1_1
(label) myprintf::@2
(label) myprintf::@20
(label) myprintf::@21
@ -176,81 +177,84 @@
(label) myprintf::@9
(label) myprintf::@return
(byte) myprintf::b
(byte) myprintf::b#1 reg byte x 126.25000000000003
(byte) myprintf::b#15 reg byte x 75.75
(byte) myprintf::b#16 reg byte x 75.75
(byte) myprintf::b#17 b zp ZP_BYTE:10 248.31999999999996
(byte) myprintf::b#1 reg byte x 4223.444444444444
(byte) myprintf::b#15 reg byte x 750.75
(byte) myprintf::b#16 reg byte x 750.75
(byte) myprintf::b#17 b zp ZP_BYTE:10 2480.32
(byte) myprintf::b#25 reg byte x 303.0
(byte) myprintf::b#5 b zp ZP_BYTE:10 2002.0
(byte) myprintf::b#35 reg byte x 2627.0
(byte) myprintf::b#47 reg byte x 4.0
(byte) myprintf::b#5 b zp ZP_BYTE:10 20002.0
(byte) myprintf::b#6 reg byte x 202.0
(byte) myprintf::bArg
(byte) myprintf::bArg#1 bArg zp ZP_BYTE:7 202.0
(byte) myprintf::bArg#10 bArg zp ZP_BYTE:7 235.66666666666663
(byte) myprintf::bArg#12 bArg zp ZP_BYTE:7 12.283783783783784
(byte) myprintf::bArg#10 bArg zp ZP_BYTE:7 574.7777777777778
(byte) myprintf::bArg#48 bArg zp ZP_BYTE:7 743.2142857142856
(byte) myprintf::bDigits
(byte) myprintf::bDigits#1 bDigits zp ZP_BYTE:12 202.0
(byte) myprintf::bDigits#10 bDigits zp ZP_BYTE:12 350.5
(byte) myprintf::bDigits#14 bDigits zp ZP_BYTE:12 22.44444444444444
(byte) myprintf::bDigits#16 bDigits zp ZP_BYTE:12 175.625
(byte) myprintf::bDigits#2 bDigits zp ZP_BYTE:12 2002.0
(byte) myprintf::bDigits#24 bDigits zp ZP_BYTE:12 201.99999999999997
(byte) myprintf::bDigits#25 bDigits zp ZP_BYTE:12 1506.0
(byte) myprintf::bDigits#3 bDigits zp ZP_BYTE:12 2002.0
(byte) myprintf::bDigits#8 bDigits zp ZP_BYTE:12 701.0
(byte) myprintf::bDigits#1 bDigits zp ZP_BYTE:12 2002.0
(byte) myprintf::bDigits#10 bDigits zp ZP_BYTE:12 3500.5
(byte) myprintf::bDigits#14 bDigits zp ZP_BYTE:12 1002.8499999999998
(byte) myprintf::bDigits#16 bDigits zp ZP_BYTE:12 1750.625
(byte) myprintf::bDigits#2 bDigits zp ZP_BYTE:12 20002.0
(byte) myprintf::bDigits#25 bDigits zp ZP_BYTE:12 15006.0
(byte) myprintf::bDigits#3 bDigits zp ZP_BYTE:12 20002.0
(byte) myprintf::bDigits#47 bDigits zp ZP_BYTE:12 1262.75
(byte) myprintf::bDigits#8 bDigits zp ZP_BYTE:12 7001.0
(byte) myprintf::bFormat
(byte) myprintf::bFormat#10 bFormat zp ZP_BYTE:6 40.4
(byte) myprintf::bFormat#4 bFormat zp ZP_BYTE:6 168.33333333333331
(byte) myprintf::bFormat#10 bFormat zp ZP_BYTE:6 4410.9
(byte) myprintf::bFormat#22 bFormat zp ZP_BYTE:6 1262.75
(byte) myprintf::bLeadZero
(byte) myprintf::bLeadZero#10 bLeadZero zp ZP_BYTE:9 22.147058823529413
(byte) myprintf::bLeadZero#18 bLeadZero zp ZP_BYTE:9 168.33333333333331
(byte) myprintf::bLeadZero#10 bLeadZero zp ZP_BYTE:9 414.42857142857144
(byte) myprintf::bLeadZero#47 bLeadZero zp ZP_BYTE:9 1262.75
(byte) myprintf::bLen
(byte) myprintf::bLen#1 bLen zp ZP_BYTE:11 202.0
(byte) myprintf::bLen#10 reg byte y 37.875
(byte) myprintf::bLen#11 bLen zp ZP_BYTE:11 620.8
(byte) myprintf::bLen#12 bLen zp ZP_BYTE:11 1552.0
(byte) myprintf::bLen#13 bLen zp ZP_BYTE:11 1552.0
(byte) myprintf::bLen#14 bLen zp ZP_BYTE:11 33.666666666666664
(byte) myprintf::bLen#23 bLen zp ZP_BYTE:11 1203.0
(byte) myprintf::bLen#24 bLen zp ZP_BYTE:11 440.79999999999995
(byte) myprintf::bLen#28 bLen zp ZP_BYTE:11 1506.0
(byte) myprintf::bLen#3 bLen zp ZP_BYTE:11 202.0
(byte) myprintf::bLen#4 bLen zp ZP_BYTE:11 1001.0
(byte) myprintf::bLen#6 bLen zp ZP_BYTE:11 1001.0
(byte) myprintf::bLen#1 bLen zp ZP_BYTE:11 2002.0
(byte) myprintf::bLen#10 reg byte y 375.375
(byte) myprintf::bLen#11 bLen zp ZP_BYTE:11 6200.8
(byte) myprintf::bLen#12 bLen zp ZP_BYTE:11 15502.0
(byte) myprintf::bLen#13 bLen zp ZP_BYTE:11 15502.0
(byte) myprintf::bLen#14 bLen zp ZP_BYTE:11 1361.9032258064515
(byte) myprintf::bLen#23 bLen zp ZP_BYTE:11 12003.0
(byte) myprintf::bLen#24 bLen zp ZP_BYTE:11 4400.8
(byte) myprintf::bLen#28 bLen zp ZP_BYTE:11 15006.0
(byte) myprintf::bLen#3 bLen zp ZP_BYTE:11 2002.0
(byte) myprintf::bLen#4 bLen zp ZP_BYTE:11 10001.0
(byte) myprintf::bLen#54 bLen zp ZP_BYTE:11 735.9999999999999
(byte) myprintf::bLen#6 bLen zp ZP_BYTE:11 10001.0
(byte) myprintf::bLen#7 bLen zp ZP_BYTE:11 202.0
(byte) myprintf::bTrailing
(byte) myprintf::bTrailing#10 bTrailing zp ZP_BYTE:8 10.397058823529413
(byte) myprintf::bTrailing#21 bTrailing zp ZP_BYTE:8 168.33333333333331
(byte) myprintf::bTrailing#10 bTrailing zp ZP_BYTE:8 573.1746031746034
(byte) myprintf::bTrailing#46 bTrailing zp ZP_BYTE:8 1262.75
(byte[6]) myprintf::buf6
(const byte[6]) myprintf::buf6#0 buf6 = { fill( 6, 0) }
(byte) myprintf::digit
(byte) myprintf::digit#2 reg byte x 1501.5
(byte) myprintf::digit#3 reg byte x 1001.0
(byte) myprintf::digit#2 reg byte x 15001.5
(byte) myprintf::digit#3 reg byte x 10001.0
(byte*) myprintf::dst
(byte) myprintf::return
(byte) myprintf::return#0 return zp ZP_BYTE:11 236.3333333333333
(byte*) myprintf::str
(byte*) myprintf::str#0 str zp ZP_WORD:13 151.5
(byte*) myprintf::str#10 str zp ZP_WORD:13 4.0131578947368425
(byte*) myprintf::str#5 str zp ZP_WORD:13 2.0
(byte*) myprintf::str#0 str zp ZP_WORD:15 854.9677419354839
(byte*) myprintf::str#47 str zp ZP_WORD:15 23207.0
(byte*) myprintf::str#5 str zp ZP_WORD:15 2.0
(byte*) myprintf::str#51 str zp ZP_WORD:15 680.3333333333334
(word) myprintf::w
(word) myprintf::w#10 w zp ZP_WORD:15 10.397058823529413
(word) myprintf::w#17 w zp ZP_WORD:15 235.66666666666663
(word) myprintf::w#21 w zp ZP_WORD:15 202.0
(word~) myprintf::w#49 w zp ZP_WORD:15 202.0
(word~) myprintf::w#50 w zp ZP_WORD:15 202.0
(word~) myprintf::w#51 w zp ZP_WORD:15 202.0
(word) myprintf::w#10 w zp ZP_WORD:13 590.6666666666667
(word) myprintf::w#21 w zp ZP_WORD:13 202.0
(word) myprintf::w#45 w zp ZP_WORD:13 1262.75
(word~) myprintf::w#90 w zp ZP_WORD:13 202.0
(word~) myprintf::w#91 w zp ZP_WORD:13 202.0
(word~) myprintf::w#92 w zp ZP_WORD:13 202.0
(word) myprintf::w1
(word) myprintf::w1#0 w1 zp ZP_WORD:2 11.0
(word) myprintf::w1#1 w1 zp ZP_WORD:2 11.0
(word) myprintf::w1#6 w1 zp ZP_WORD:2 1.5569620253164556
(word) myprintf::w1#6 w1 zp ZP_WORD:2 1.5375
(word) myprintf::w2
(word) myprintf::w2#0 w2 zp ZP_WORD:4 22.0
(word) myprintf::w2#1 w2 zp ZP_WORD:4 22.0
(word) myprintf::w2#7 w2 zp ZP_WORD:4 1.5569620253164556
(word) myprintf::w2#7 w2 zp ZP_WORD:4 1.5375
(word) myprintf::w3
(word) myprintf::w3#0 w3 zp ZP_WORD:23 7.333333333333333
(word) myprintf::w3#1 w3 zp ZP_WORD:23 7.333333333333333
(word) myprintf::w3#7 w3 zp ZP_WORD:23 1.5569620253164556
(word) myprintf::w3#7 w3 zp ZP_WORD:23 1.5375
(byte[$64]) strTemp
(const byte[$64]) strTemp#0 strTemp = { fill( $64, 0) }
(void()) utoa((word) utoa::value , (byte*) utoa::dst)
@ -294,7 +298,7 @@
(word) utoa::value#12 value zp ZP_WORD:17 4.0
(word) utoa::value#2 value zp ZP_WORD:17 2.0
(word) utoa::value#3 value zp ZP_WORD:17 2.0
(word) utoa::value#4 value zp ZP_WORD:17 35.66666666666666
(word) utoa::value#4 value zp ZP_WORD:17 335.66666666666674
(word) utoa::value#6 value zp ZP_WORD:17 2.5
(byte*) zp1
(const byte*) zp1#0 zp1 = (byte*) 97
@ -303,22 +307,22 @@
zp ZP_WORD:2 [ main::u#11 main::u#2 myprintf::w1#6 myprintf::w1#0 myprintf::w1#1 div16u::dividend#0 main::u#15 main::u#4 div10::val#4 ]
zp ZP_WORD:4 [ myprintf::w2#7 myprintf::w2#0 myprintf::w2#1 main::v#1 main::v#2 div16u::return#2 div16u::return#0 div10::return#2 div10::return#0 divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 divr16u::return#2 div10::$4 div10::val#3 ]
zp ZP_BYTE:6 [ myprintf::bFormat#10 myprintf::bFormat#4 ]
zp ZP_BYTE:7 [ myprintf::bArg#12 myprintf::bArg#10 myprintf::bArg#1 ]
zp ZP_BYTE:8 [ myprintf::bTrailing#10 myprintf::bTrailing#21 ]
zp ZP_BYTE:9 [ myprintf::bLeadZero#10 myprintf::bLeadZero#18 ]
zp ZP_BYTE:6 [ myprintf::bFormat#22 myprintf::bFormat#10 ]
zp ZP_BYTE:7 [ myprintf::bArg#48 myprintf::bArg#10 myprintf::bArg#1 ]
zp ZP_BYTE:8 [ myprintf::bTrailing#46 myprintf::bTrailing#10 ]
zp ZP_BYTE:9 [ myprintf::bLeadZero#47 myprintf::bLeadZero#10 ]
reg byte a [ myprintf::$23 ]
reg byte a [ myprintf::$30 ]
zp ZP_BYTE:10 [ myprintf::b#17 myprintf::b#5 ]
reg byte x [ myprintf::digit#3 myprintf::digit#2 ]
zp ZP_BYTE:11 [ myprintf::bLen#11 myprintf::bLen#13 myprintf::bLen#12 myprintf::bLen#23 myprintf::bLen#14 myprintf::return#0 myprintf::bLen#28 myprintf::bLen#7 myprintf::bLen#3 myprintf::bLen#24 myprintf::bLen#6 myprintf::bLen#1 myprintf::bLen#4 ]
zp ZP_BYTE:12 [ myprintf::bDigits#10 myprintf::bDigits#8 myprintf::bDigits#14 myprintf::bDigits#24 myprintf::bDigits#25 myprintf::bDigits#1 myprintf::bDigits#16 myprintf::bDigits#3 myprintf::bDigits#2 ]
zp ZP_BYTE:11 [ myprintf::bLen#11 myprintf::bLen#13 myprintf::bLen#12 myprintf::bLen#23 myprintf::bLen#54 myprintf::bLen#14 myprintf::bLen#28 myprintf::bLen#7 myprintf::bLen#3 myprintf::bLen#24 myprintf::bLen#6 myprintf::bLen#1 myprintf::bLen#4 ]
zp ZP_BYTE:12 [ myprintf::bDigits#10 myprintf::bDigits#8 myprintf::bDigits#47 myprintf::bDigits#14 myprintf::bDigits#25 myprintf::bDigits#1 myprintf::bDigits#16 myprintf::bDigits#3 myprintf::bDigits#2 ]
reg byte a [ myprintf::$41 ]
reg byte x [ myprintf::b#25 myprintf::b#1 myprintf::b#6 ]
reg byte x [ myprintf::b#25 myprintf::b#35 myprintf::b#1 myprintf::b#47 myprintf::b#6 ]
reg byte x [ utoa::bStarted#7 utoa::bStarted#6 utoa::bStarted#5 ]
zp ZP_WORD:13 [ divr16u::dividend#2 divr16u::dividend#1 divr16u::dividend#0 myprintf::str#10 myprintf::str#5 myprintf::str#0 ]
zp ZP_WORD:13 [ divr16u::dividend#2 divr16u::dividend#1 divr16u::dividend#0 myprintf::w#45 myprintf::w#10 myprintf::w#21 myprintf::w#90 myprintf::w#91 myprintf::w#92 ]
reg byte x [ divr16u::i#2 divr16u::i#1 ]
zp ZP_WORD:15 [ main::$4 myprintf::w#10 myprintf::w#17 myprintf::w#21 myprintf::w#49 myprintf::w#50 myprintf::w#51 ]
zp ZP_WORD:15 [ main::$4 myprintf::str#47 myprintf::str#51 myprintf::str#0 myprintf::str#5 ]
zp ZP_WORD:17 [ main::$13 utoa::value#12 utoa::value#3 utoa::value#10 utoa::value#2 utoa::value#11 utoa::value#6 utoa::value#4 utoa::value#0 utoa::value#1 append::value#5 append::value#8 append::value#1 append::value#2 append::value#3 append::value#4 append::value#0 append::return#10 append::return#4 append::return#3 append::return#2 ]
reg byte a [ myprintf::$17 ]
reg byte a [ myprintf::$18 ]

View File

@ -30,8 +30,8 @@ main: {
.label BASE_CHARSET = $1000
.const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET)/4&$f
.const toD0182_return = (>(BASE_SCREEN&$3fff)*4)|(>BASE_CHARSET)/4&$f
.label _4 = $d
.label cyclecount = $d
.label _4 = $e
.label cyclecount = $e
jsr init_font_hex
lda #toD0181_return
sta D018
@ -57,9 +57,9 @@ main: {
rts
}
// Print a dword as HEX at a specific position
// print_dword_at(dword zeropage($d) dw)
// print_dword_at(dword zeropage($e) dw)
print_dword_at: {
.label dw = $d
.label dw = $e
lda dw+2
sta print_word_at.w
lda dw+3
@ -81,10 +81,10 @@ print_dword_at: {
rts
}
// Print a word as HEX at a specific position
// print_word_at(word zeropage(4) w, byte* zeropage(9) at)
// print_word_at(word zeropage(9) w, byte* zeropage(2) at)
print_word_at: {
.label w = 4
.label at = 9
.label w = 9
.label at = 2
lda w+1
sta print_byte_at.b
jsr print_byte_at
@ -101,10 +101,10 @@ print_word_at: {
rts
}
// Print a byte as HEX at a specific position
// print_byte_at(byte zeropage($c) b, byte* zeropage(9) at)
// print_byte_at(byte zeropage($d) b, byte* zeropage(2) at)
print_byte_at: {
.label b = $c
.label at = 9
.label b = $d
.label at = 2
lda b
lsr
lsr
@ -132,9 +132,9 @@ print_byte_at: {
rts
}
// Print a single char
// print_char_at(byte register(X) ch, byte* zeropage(2) at)
// print_char_at(byte register(X) ch, byte* zeropage(4) at)
print_char_at: {
.label at = 2
.label at = 4
txa
ldy #0
sta (at),y
@ -143,7 +143,7 @@ print_char_at: {
// Returns the processor clock time used since the beginning of an implementation defined era (normally the beginning of the program).
// This uses CIA #2 Timer A+B on the C64, and must be initialized using clock_start()
clock: {
.label return = $d
.label return = $e
lda #<$ffffffff
sec
sbc CIA2_TIMER_AB
@ -162,14 +162,14 @@ clock: {
// Populates 1000 bytes (a screen) with values representing the distance to the center.
// The actual value stored is distance*2 to increase precision
init_dist_screen: {
.label yds = $11
.label xds = $13
.label ds = $13
.label x = 6
.label xb = $b
.label screen_topline = 4
.label screen_bottomline = 9
.label y = $c
.label yds = $12
.label xds = $14
.label ds = $14
.label x = $b
.label xb = $c
.label screen_topline = 9
.label screen_bottomline = 2
.label y = $d
jsr init_squares
lda #<SCREEN+$28*$18
sta screen_bottomline
@ -259,12 +259,12 @@ init_dist_screen: {
// Find the (integer) square root of a word value
// If the square is not an integer then it returns the largest integer N where N*N <= val
// Uses a table of squares that must be initialized by calling init_squares()
// sqrt(word zeropage($13) val)
// sqrt(word zeropage($14) val)
sqrt: {
.label _1 = 2
.label _3 = 2
.label found = 2
.label val = $13
.label _1 = 6
.label _3 = 6
.label found = 6
.label val = $14
jsr bsearch16u
lda _3
sec
@ -283,50 +283,30 @@ sqrt: {
// - items - Pointer to the start of the array to search in
// - num - The number of items in the array
// Returns pointer to an entry in the array that matches the search key
// bsearch16u(word zeropage($13) key, word* zeropage(2) items, byte register(X) num)
// bsearch16u(word zeropage($14) key, word* zeropage(6) items, byte register(X) num)
bsearch16u: {
.label _2 = 2
.label pivot = $15
.label result = $17
.label return = 2
.label items = 2
.label key = $13
.label _2 = 6
.label pivot = 6
.label result = $16
.label return = 6
.label items = 6
.label key = $14
.label items_10 = 4
.label items_16 = 4
lda #<SQUARES
sta items
sta items_10
lda #>SQUARES
sta items+1
sta items_10+1
ldx #NUM_SQUARES
b3:
cpx #0
bne b4
ldy #1
lda (items),y
cmp key+1
bne !+
dey
lda (items),y
cmp key
beq b2
!:
bcc b2
lda _2
sec
sbc #<1*SIZEOF_WORD
sta _2
lda _2+1
sbc #>1*SIZEOF_WORD
sta _2+1
b2:
rts
b4:
txa
lsr
asl
clc
adc items
adc items_10
sta pivot
lda #0
adc items+1
adc items_10+1
sta pivot+1
sec
lda key
@ -340,38 +320,66 @@ bsearch16u: {
bne b6
lda result
bne b6
lda pivot
sta return
lda pivot+1
sta return+1
breturn:
rts
b6:
lda result+1
bmi b7
bmi b10
bne !+
lda result
beq b7
beq b10
!:
lda #1*SIZEOF_WORD
clc
adc pivot
adc items
sta items
lda #0
adc pivot+1
sta items+1
bcc !+
inc items+1
!:
dex
b7:
txa
lsr
tax
jmp b3
cpx #0
bne b9
ldy #1
lda (items),y
cmp key+1
bne !+
dey
lda (items),y
cmp key
beq breturn
!:
bcc breturn
lda _2
sec
sbc #<1*SIZEOF_WORD
sta _2
lda _2+1
sbc #>1*SIZEOF_WORD
sta _2+1
rts
b9:
lda items
sta items_16
lda items+1
sta items_16+1
jmp b4
b10:
lda items_10
sta items
lda items_10+1
sta items+1
jmp b7
}
// Find the square of a byte value
// Uses a table of squares that must be initialized by calling init_squares()
// sqr(byte register(A) val)
sqr: {
.label return = $13
.label return_2 = $11
.label return = $14
.label return_2 = $12
asl
tay
lda SQUARES,y
@ -384,7 +392,7 @@ sqr: {
// Uses iterative formula (x+1)^2 = x^2 + 2*x + 1
init_squares: {
.label squares = 9
.label sqr = 4
.label sqr = 6
jsr malloc
ldx #0
lda #<SQUARES
@ -454,15 +462,15 @@ clock_start: {
rts
}
// Make charset from proto chars
// init_font_hex(byte* zeropage(9) charset)
// init_font_hex(byte* zeropage($12) charset)
init_font_hex: {
.label _0 = $19
.label idx = $c
.label proto_lo = $11
.label charset = 9
.label c1 = $b
.label proto_hi = 4
.label c = 6
.label _0 = $18
.label idx = $d
.label proto_lo = $14
.label charset = $12
.label c1 = $c
.label proto_hi = 9
.label c = $b
lda #0
sta c
lda #<FONT_HEX_PROTO

View File

@ -185,129 +185,132 @@ sqrt::@return: scope:[sqrt] from sqrt::@1
to:@return
bsearch16u: scope:[bsearch16u] from sqrt
[96] phi()
to:bsearch16u::@4
bsearch16u::@4: scope:[bsearch16u] from bsearch16u bsearch16u::@9
[97] (word*) bsearch16u::items#10 ← phi( bsearch16u::@9/(word*~) bsearch16u::items#16 bsearch16u/(const word*) SQUARES#1 )
[97] (byte) bsearch16u::num#10 ← phi( bsearch16u::@9/(byte) bsearch16u::num#0 bsearch16u/(const byte) NUM_SQUARES#3 )
[98] (byte~) bsearch16u::$6 ← (byte) bsearch16u::num#10 >> (byte) 1
[99] (byte~) bsearch16u::$16 ← (byte~) bsearch16u::$6 << (byte) 1
[100] (word*) bsearch16u::pivot#0 ← (word*) bsearch16u::items#10 + (byte~) bsearch16u::$16
[101] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0)
[102] if((signed word) bsearch16u::result#0!=(signed byte) 0) goto bsearch16u::@6
to:bsearch16u::@return
bsearch16u::@return: scope:[bsearch16u] from bsearch16u::@2 bsearch16u::@4
[103] (word*) bsearch16u::return#1 ← phi( bsearch16u::@4/(word*) bsearch16u::pivot#0 bsearch16u::@2/(word*) bsearch16u::return#2 )
[104] return
to:@return
bsearch16u::@6: scope:[bsearch16u] from bsearch16u::@4
[105] if((signed word) bsearch16u::result#0<=(signed byte) 0) goto bsearch16u::@10
to:bsearch16u::@8
bsearch16u::@8: scope:[bsearch16u] from bsearch16u::@6
[106] (word*) bsearch16u::items#0 ← (word*) bsearch16u::pivot#0 + (byte) 1*(const byte) SIZEOF_WORD
[107] (byte) bsearch16u::num#1 ← -- (byte) bsearch16u::num#10
to:bsearch16u::@7
bsearch16u::@7: scope:[bsearch16u] from bsearch16u::@10 bsearch16u::@8
[108] (word*) bsearch16u::items#11 ← phi( bsearch16u::@8/(word*) bsearch16u::items#0 bsearch16u::@10/(word*~) bsearch16u::items#18 )
[108] (byte) bsearch16u::num#5 ← phi( bsearch16u::@8/(byte) bsearch16u::num#1 bsearch16u::@10/(byte) bsearch16u::num#10 )
[109] (byte) bsearch16u::num#0 ← (byte) bsearch16u::num#5 >> (byte) 1
to:bsearch16u::@3
bsearch16u::@3: scope:[bsearch16u] from bsearch16u bsearch16u::@7
[97] (word*) bsearch16u::items#2 ← phi( bsearch16u/(const word*) SQUARES#1 bsearch16u::@7/(word*) bsearch16u::items#8 )
[97] (byte) bsearch16u::num#3 ← phi( bsearch16u/(const byte) NUM_SQUARES#3 bsearch16u::@7/(byte) bsearch16u::num#0 )
[98] if((byte) bsearch16u::num#3>(byte) 0) goto bsearch16u::@4
bsearch16u::@3: scope:[bsearch16u] from bsearch16u::@7
[110] if((byte) bsearch16u::num#0>(byte) 0) goto bsearch16u::@9
to:bsearch16u::@5
bsearch16u::@5: scope:[bsearch16u] from bsearch16u::@3
[99] if(*((word*) bsearch16u::items#2)<=(word) bsearch16u::key#0) goto bsearch16u::@2
[111] if(*((word*) bsearch16u::items#11)<=(word) bsearch16u::key#0) goto bsearch16u::@2
to:bsearch16u::@1
bsearch16u::@1: scope:[bsearch16u] from bsearch16u::@5
[100] (word*~) bsearch16u::$2 ← (word*) bsearch16u::items#2 - (byte) 1*(const byte) SIZEOF_WORD
[112] (word*~) bsearch16u::$2 ← (word*) bsearch16u::items#11 - (byte) 1*(const byte) SIZEOF_WORD
to:bsearch16u::@2
bsearch16u::@2: scope:[bsearch16u] from bsearch16u::@1 bsearch16u::@5
[101] (word*) bsearch16u::return#2 ← phi( bsearch16u::@5/(word*) bsearch16u::items#2 bsearch16u::@1/(word*~) bsearch16u::$2 )
[113] (word*) bsearch16u::return#2 ← phi( bsearch16u::@5/(word*) bsearch16u::items#11 bsearch16u::@1/(word*~) bsearch16u::$2 )
to:bsearch16u::@return
bsearch16u::@return: scope:[bsearch16u] from bsearch16u::@2 bsearch16u::@8
[102] (word*) bsearch16u::return#1 ← phi( bsearch16u::@8/(word*~) bsearch16u::return#6 bsearch16u::@2/(word*) bsearch16u::return#2 )
[103] return
to:@return
bsearch16u::@4: scope:[bsearch16u] from bsearch16u::@3
[104] (byte~) bsearch16u::$6 ← (byte) bsearch16u::num#3 >> (byte) 1
[105] (byte~) bsearch16u::$16 ← (byte~) bsearch16u::$6 << (byte) 1
[106] (word*) bsearch16u::pivot#0 ← (word*) bsearch16u::items#2 + (byte~) bsearch16u::$16
[107] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0)
[108] if((signed word) bsearch16u::result#0!=(signed byte) 0) goto bsearch16u::@6
to:bsearch16u::@8
bsearch16u::@8: scope:[bsearch16u] from bsearch16u::@4
[109] (word*~) bsearch16u::return#6 ← (word*) bsearch16u::pivot#0
to:bsearch16u::@return
bsearch16u::@6: scope:[bsearch16u] from bsearch16u::@4
[110] if((signed word) bsearch16u::result#0<=(signed byte) 0) goto bsearch16u::@7
to:bsearch16u::@9
bsearch16u::@9: scope:[bsearch16u] from bsearch16u::@6
[111] (word*) bsearch16u::items#0 ← (word*) bsearch16u::pivot#0 + (byte) 1*(const byte) SIZEOF_WORD
[112] (byte) bsearch16u::num#1 ← -- (byte) bsearch16u::num#3
bsearch16u::@9: scope:[bsearch16u] from bsearch16u::@3
[114] (word*~) bsearch16u::items#16 ← (word*) bsearch16u::items#11
to:bsearch16u::@4
bsearch16u::@10: scope:[bsearch16u] from bsearch16u::@6
[115] (word*~) bsearch16u::items#18 ← (word*) bsearch16u::items#10
to:bsearch16u::@7
bsearch16u::@7: scope:[bsearch16u] from bsearch16u::@6 bsearch16u::@9
[113] (word*) bsearch16u::items#8 ← phi( bsearch16u::@9/(word*) bsearch16u::items#0 bsearch16u::@6/(word*) bsearch16u::items#2 )
[113] (byte) bsearch16u::num#5 ← phi( bsearch16u::@9/(byte) bsearch16u::num#1 bsearch16u::@6/(byte) bsearch16u::num#3 )
[114] (byte) bsearch16u::num#0 ← (byte) bsearch16u::num#5 >> (byte) 1
to:bsearch16u::@3
sqr: scope:[sqr] from init_dist_screen::@4 init_dist_screen::@8
[115] (byte) sqr::val#2 ← phi( init_dist_screen::@4/(byte) sqr::val#0 init_dist_screen::@8/(byte) sqr::val#1 )
[116] (byte~) sqr::$0 ← (byte) sqr::val#2 << (byte) 1
[117] (word) sqr::return#0 ← *((const word*) SQUARES#1 + (byte~) sqr::$0)
[116] (byte) sqr::val#2 ← phi( init_dist_screen::@4/(byte) sqr::val#0 init_dist_screen::@8/(byte) sqr::val#1 )
[117] (byte~) sqr::$0 ← (byte) sqr::val#2 << (byte) 1
[118] (word) sqr::return#0 ← *((const word*) SQUARES#1 + (byte~) sqr::$0)
to:sqr::@return
sqr::@return: scope:[sqr] from sqr
[118] return
[119] return
to:@return
init_squares: scope:[init_squares] from init_dist_screen
[119] phi()
[120] call malloc
[120] phi()
[121] call malloc
to:init_squares::@1
init_squares::@1: scope:[init_squares] from init_squares init_squares::@1
[121] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares/(byte) 0 )
[121] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares/(const word*) SQUARES#1 )
[121] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares/(byte) 0 )
[122] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[123] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[124] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[125] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[126] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[127] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[128] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
[122] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares/(byte) 0 )
[122] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares/(const word*) SQUARES#1 )
[122] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares/(byte) 0 )
[123] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[124] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[125] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[126] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[127] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[128] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[129] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
to:init_squares::@return
init_squares::@return: scope:[init_squares] from init_squares::@1
[129] return
[130] return
to:@return
malloc: scope:[malloc] from init_squares
[130] phi()
[131] phi()
to:malloc::@return
malloc::@return: scope:[malloc] from malloc
[131] return
[132] return
to:@return
clock_start: scope:[clock_start] from main::@1
[132] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0
[133] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0
[134] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff
[135] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0
[136] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0
[133] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_CONTINUOUS#0
[134] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0
[135] *((const dword*) CIA2_TIMER_AB#0) ← (dword) $ffffffff
[136] *((const byte*) CIA2_TIMER_B_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0|(const byte) CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A#0
[137] *((const byte*) CIA2_TIMER_A_CONTROL#0) ← (const byte) CIA_TIMER_CONTROL_START#0
to:clock_start::@return
clock_start::@return: scope:[clock_start] from clock_start
[137] return
[138] return
to:@return
init_font_hex: scope:[init_font_hex] from main
[138] phi()
[139] phi()
to:init_font_hex::@1
init_font_hex::@1: scope:[init_font_hex] from init_font_hex init_font_hex::@5
[139] (byte) init_font_hex::c#6 ← phi( init_font_hex/(byte) 0 init_font_hex::@5/(byte) init_font_hex::c#1 )
[139] (byte*) init_font_hex::proto_hi#6 ← phi( init_font_hex/(const byte[]) FONT_HEX_PROTO#0 init_font_hex::@5/(byte*) init_font_hex::proto_hi#1 )
[139] (byte*) init_font_hex::charset#5 ← phi( init_font_hex/(const byte*) CHARSET#0 init_font_hex::@5/(byte*) init_font_hex::charset#0 )
[140] (byte) init_font_hex::c#6 ← phi( init_font_hex/(byte) 0 init_font_hex::@5/(byte) init_font_hex::c#1 )
[140] (byte*) init_font_hex::proto_hi#6 ← phi( init_font_hex/(const byte[]) FONT_HEX_PROTO#0 init_font_hex::@5/(byte*) init_font_hex::proto_hi#1 )
[140] (byte*) init_font_hex::charset#5 ← phi( init_font_hex/(const byte*) CHARSET#0 init_font_hex::@5/(byte*) init_font_hex::charset#0 )
to:init_font_hex::@2
init_font_hex::@2: scope:[init_font_hex] from init_font_hex::@1 init_font_hex::@4
[140] (byte) init_font_hex::c1#4 ← phi( init_font_hex::@1/(byte) 0 init_font_hex::@4/(byte) init_font_hex::c1#1 )
[140] (byte*) init_font_hex::proto_lo#4 ← phi( init_font_hex::@1/(const byte[]) FONT_HEX_PROTO#0 init_font_hex::@4/(byte*) init_font_hex::proto_lo#1 )
[140] (byte*) init_font_hex::charset#2 ← phi( init_font_hex::@1/(byte*) init_font_hex::charset#5 init_font_hex::@4/(byte*) init_font_hex::charset#0 )
[141] *((byte*) init_font_hex::charset#2) ← (byte) 0
[141] (byte) init_font_hex::c1#4 ← phi( init_font_hex::@1/(byte) 0 init_font_hex::@4/(byte) init_font_hex::c1#1 )
[141] (byte*) init_font_hex::proto_lo#4 ← phi( init_font_hex::@1/(const byte[]) FONT_HEX_PROTO#0 init_font_hex::@4/(byte*) init_font_hex::proto_lo#1 )
[141] (byte*) init_font_hex::charset#2 ← phi( init_font_hex::@1/(byte*) init_font_hex::charset#5 init_font_hex::@4/(byte*) init_font_hex::charset#0 )
[142] *((byte*) init_font_hex::charset#2) ← (byte) 0
to:init_font_hex::@3
init_font_hex::@3: scope:[init_font_hex] from init_font_hex::@2 init_font_hex::@3
[142] (byte) init_font_hex::idx#5 ← phi( init_font_hex::@2/(byte) 1 init_font_hex::@3/(byte) init_font_hex::idx#2 )
[142] (byte) init_font_hex::i#2 ← phi( init_font_hex::@2/(byte) 0 init_font_hex::@3/(byte) init_font_hex::i#1 )
[143] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4
[144] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1
[145] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1
[146] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2
[147] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5
[148] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2
[149] if((byte) init_font_hex::i#1!=(byte) 5) goto init_font_hex::@3
[143] (byte) init_font_hex::idx#5 ← phi( init_font_hex::@2/(byte) 1 init_font_hex::@3/(byte) init_font_hex::idx#2 )
[143] (byte) init_font_hex::i#2 ← phi( init_font_hex::@2/(byte) 0 init_font_hex::@3/(byte) init_font_hex::i#1 )
[144] (byte~) init_font_hex::$0 ← *((byte*) init_font_hex::proto_hi#6 + (byte) init_font_hex::i#2) << (byte) 4
[145] (byte~) init_font_hex::$1 ← *((byte*) init_font_hex::proto_lo#4 + (byte) init_font_hex::i#2) << (byte) 1
[146] (byte~) init_font_hex::$2 ← (byte~) init_font_hex::$0 | (byte~) init_font_hex::$1
[147] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#5) ← (byte~) init_font_hex::$2
[148] (byte) init_font_hex::idx#2 ← ++ (byte) init_font_hex::idx#5
[149] (byte) init_font_hex::i#1 ← ++ (byte) init_font_hex::i#2
[150] if((byte) init_font_hex::i#1!=(byte) 5) goto init_font_hex::@3
to:init_font_hex::@4
init_font_hex::@4: scope:[init_font_hex] from init_font_hex::@3
[150] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0
[151] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2
[152] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0
[153] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5
[154] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8
[155] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4
[156] if((byte) init_font_hex::c1#1!=(byte) $10) goto init_font_hex::@2
[151] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#2) ← (byte) 0
[152] (byte) init_font_hex::idx#3 ← ++ (byte) init_font_hex::idx#2
[153] *((byte*) init_font_hex::charset#2 + (byte) init_font_hex::idx#3) ← (byte) 0
[154] (byte*) init_font_hex::proto_lo#1 ← (byte*) init_font_hex::proto_lo#4 + (byte) 5
[155] (byte*) init_font_hex::charset#0 ← (byte*) init_font_hex::charset#2 + (byte) 8
[156] (byte) init_font_hex::c1#1 ← ++ (byte) init_font_hex::c1#4
[157] if((byte) init_font_hex::c1#1!=(byte) $10) goto init_font_hex::@2
to:init_font_hex::@5
init_font_hex::@5: scope:[init_font_hex] from init_font_hex::@4
[157] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5
[158] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6
[159] if((byte) init_font_hex::c#1!=(byte) $10) goto init_font_hex::@1
[158] (byte*) init_font_hex::proto_hi#1 ← (byte*) init_font_hex::proto_hi#6 + (byte) 5
[159] (byte) init_font_hex::c#1 ← ++ (byte) init_font_hex::c#6
[160] if((byte) init_font_hex::c#1!=(byte) $10) goto init_font_hex::@1
to:init_font_hex::@return
init_font_hex::@return: scope:[init_font_hex] from init_font_hex::@5
[160] return
[161] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -38,9 +38,10 @@
(const word*) SQUARES#1 SQUARES = (word*)(const void*) malloc::return#0
(word*()) bsearch16u((word) bsearch16u::key , (word*) bsearch16u::items , (byte) bsearch16u::num)
(byte~) bsearch16u::$16 reg byte a 2002.0
(word*~) bsearch16u::$2 $2 zp ZP_WORD:2 4.0
(word*~) bsearch16u::$2 $2 zp ZP_WORD:6 4.0
(byte~) bsearch16u::$6 reg byte a 2002.0
(label) bsearch16u::@1
(label) bsearch16u::@10
(label) bsearch16u::@2
(label) bsearch16u::@3
(label) bsearch16u::@4
@ -51,30 +52,31 @@
(label) bsearch16u::@9
(label) bsearch16u::@return
(word*) bsearch16u::items
(word*) bsearch16u::items#0 items zp ZP_WORD:2 1001.0
(word*) bsearch16u::items#2 items zp ZP_WORD:2 334.33333333333337
(word*) bsearch16u::items#8 items zp ZP_WORD:2 1501.5
(word*) bsearch16u::items#0 items zp ZP_WORD:6 1001.0
(word*) bsearch16u::items#10 items#10 zp ZP_WORD:4 429.0
(word*) bsearch16u::items#11 items zp ZP_WORD:6 752.25
(word*~) bsearch16u::items#16 items#16 zp ZP_WORD:4 2002.0
(word*~) bsearch16u::items#18 items zp ZP_WORD:6 2002.0
(word) bsearch16u::key
(word) bsearch16u::key#0 key zp ZP_WORD:19 0.2857142857142857
(word) bsearch16u::key#0 key zp ZP_WORD:20 0.25
(byte) bsearch16u::num
(byte) bsearch16u::num#0 reg byte x 2002.0
(byte) bsearch16u::num#0 reg byte x 1001.0
(byte) bsearch16u::num#1 reg byte x 2002.0
(byte) bsearch16u::num#3 reg byte x 556.1111111111111
(byte) bsearch16u::num#10 reg byte x 444.8888888888889
(byte) bsearch16u::num#5 reg byte x 3003.0
(word*) bsearch16u::pivot
(word*) bsearch16u::pivot#0 pivot zp ZP_WORD:21 501.0
(word*) bsearch16u::pivot#0 pivot zp ZP_WORD:6 750.75
(signed word) bsearch16u::result
(signed word) bsearch16u::result#0 result zp ZP_WORD:23 1501.5
(signed word) bsearch16u::result#0 result zp ZP_WORD:22 1501.5
(word*) bsearch16u::return
(word*) bsearch16u::return#1 return zp ZP_WORD:2 2.0
(word*) bsearch16u::return#2 return zp ZP_WORD:2 6.0
(word*) bsearch16u::return#3 return zp ZP_WORD:2 4.0
(word*~) bsearch16u::return#6 return zp ZP_WORD:2 4.0
(word*) bsearch16u::return#1 return zp ZP_WORD:6 335.00000000000006
(word*) bsearch16u::return#2 return zp ZP_WORD:6 6.0
(word*) bsearch16u::return#3 return zp ZP_WORD:6 4.0
(dword()) clock()
(label) clock::@return
(dword) clock::return
(dword) clock::return#0 return zp ZP_DWORD:13 1.3333333333333333
(dword) clock::return#2 return zp ZP_DWORD:13 4.0
(dword) clock::return#0 return zp ZP_DWORD:14 1.3333333333333333
(dword) clock::return#2 return zp ZP_DWORD:14 4.0
(void()) clock_start()
(label) clock_start::@return
(byte*) heap_head
@ -99,37 +101,37 @@
(byte) init_dist_screen::d
(byte) init_dist_screen::d#0 reg byte a 126.25
(word) init_dist_screen::ds
(word) init_dist_screen::ds#0 ds zp ZP_WORD:19 202.0
(word) init_dist_screen::ds#0 ds zp ZP_WORD:20 202.0
(byte*) init_dist_screen::screen
(byte*) init_dist_screen::screen_bottomline
(byte*) init_dist_screen::screen_bottomline#1 screen_bottomline zp ZP_WORD:9 7.333333333333333
(byte*) init_dist_screen::screen_bottomline#10 screen_bottomline zp ZP_WORD:9 6.787878787878788
(byte*) init_dist_screen::screen_bottomline#1 screen_bottomline zp ZP_WORD:2 7.333333333333333
(byte*) init_dist_screen::screen_bottomline#10 screen_bottomline zp ZP_WORD:2 6.787878787878788
(byte*) init_dist_screen::screen_topline
(byte*) init_dist_screen::screen_topline#1 screen_topline zp ZP_WORD:4 5.5
(byte*) init_dist_screen::screen_topline#10 screen_topline zp ZP_WORD:4 7.0
(byte*) init_dist_screen::screen_topline#1 screen_topline zp ZP_WORD:9 5.5
(byte*) init_dist_screen::screen_topline#10 screen_topline zp ZP_WORD:9 7.0
(byte) init_dist_screen::x
(byte) init_dist_screen::x#1 x zp ZP_BYTE:6 101.0
(byte) init_dist_screen::x#2 x zp ZP_BYTE:6 26.578947368421055
(byte) init_dist_screen::x#1 x zp ZP_BYTE:11 101.0
(byte) init_dist_screen::x#2 x zp ZP_BYTE:11 26.578947368421055
(byte) init_dist_screen::x2
(byte) init_dist_screen::x2#0 reg byte a 202.0
(byte) init_dist_screen::xb
(byte) init_dist_screen::xb#1 xb zp ZP_BYTE:11 101.0
(byte) init_dist_screen::xb#2 xb zp ZP_BYTE:11 20.2
(byte) init_dist_screen::xb#1 xb zp ZP_BYTE:12 101.0
(byte) init_dist_screen::xb#2 xb zp ZP_BYTE:12 20.2
(byte) init_dist_screen::xd
(byte) init_dist_screen::xd#0 reg byte a 303.0
(word) init_dist_screen::xds
(word) init_dist_screen::xds#0 xds zp ZP_WORD:19 202.0
(word) init_dist_screen::xds#0 xds zp ZP_WORD:20 202.0
(byte) init_dist_screen::y
(byte) init_dist_screen::y#1 y zp ZP_BYTE:12 16.5
(byte) init_dist_screen::y#10 y zp ZP_BYTE:12 0.9705882352941178
(byte) init_dist_screen::y#1 y zp ZP_BYTE:13 16.5
(byte) init_dist_screen::y#10 y zp ZP_BYTE:13 0.9705882352941178
(byte) init_dist_screen::y2
(byte) init_dist_screen::y2#0 reg byte a 22.0
(byte) init_dist_screen::yd
(byte) init_dist_screen::yd#0 reg byte a 33.0
(word) init_dist_screen::yds
(word) init_dist_screen::yds#0 yds zp ZP_WORD:17 4.869565217391305
(word) init_dist_screen::yds#0 yds zp ZP_WORD:18 4.869565217391305
(void()) init_font_hex((byte*) init_font_hex::charset)
(byte~) init_font_hex::$0 $0 zp ZP_BYTE:25 1001.0
(byte~) init_font_hex::$0 $0 zp ZP_BYTE:24 1001.0
(byte~) init_font_hex::$1 reg byte a 2002.0
(byte~) init_font_hex::$2 reg byte a 2002.0
(label) init_font_hex::@1
@ -139,28 +141,28 @@
(label) init_font_hex::@5
(label) init_font_hex::@return
(byte) init_font_hex::c
(byte) init_font_hex::c#1 c zp ZP_BYTE:6 16.5
(byte) init_font_hex::c#6 c zp ZP_BYTE:6 1.1578947368421053
(byte) init_font_hex::c#1 c zp ZP_BYTE:11 16.5
(byte) init_font_hex::c#6 c zp ZP_BYTE:11 1.1578947368421053
(byte) init_font_hex::c1
(byte) init_font_hex::c1#1 c1 zp ZP_BYTE:11 151.5
(byte) init_font_hex::c1#4 c1 zp ZP_BYTE:11 13.466666666666667
(byte) init_font_hex::c1#1 c1 zp ZP_BYTE:12 151.5
(byte) init_font_hex::c1#4 c1 zp ZP_BYTE:12 13.466666666666667
(byte*) init_font_hex::charset
(byte*) init_font_hex::charset#0 charset zp ZP_WORD:9 35.5
(byte*) init_font_hex::charset#2 charset zp ZP_WORD:9 108.35714285714285
(byte*) init_font_hex::charset#5 charset zp ZP_WORD:9 22.0
(byte*) init_font_hex::charset#0 charset zp ZP_WORD:18 35.5
(byte*) init_font_hex::charset#2 charset zp ZP_WORD:18 108.35714285714285
(byte*) init_font_hex::charset#5 charset zp ZP_WORD:18 22.0
(byte) init_font_hex::i
(byte) init_font_hex::i#1 reg byte x 1501.5
(byte) init_font_hex::i#2 reg byte x 667.3333333333334
(byte) init_font_hex::idx
(byte) init_font_hex::idx#2 idx zp ZP_BYTE:12 551.0
(byte) init_font_hex::idx#2 idx zp ZP_BYTE:13 551.0
(byte) init_font_hex::idx#3 reg byte y 202.0
(byte) init_font_hex::idx#5 idx zp ZP_BYTE:12 600.5999999999999
(byte) init_font_hex::idx#5 idx zp ZP_BYTE:13 600.5999999999999
(byte*) init_font_hex::proto_hi
(byte*) init_font_hex::proto_hi#1 proto_hi zp ZP_WORD:4 7.333333333333333
(byte*) init_font_hex::proto_hi#6 proto_hi zp ZP_WORD:4 56.83333333333334
(byte*) init_font_hex::proto_hi#1 proto_hi zp ZP_WORD:9 7.333333333333333
(byte*) init_font_hex::proto_hi#6 proto_hi zp ZP_WORD:9 56.83333333333334
(byte*) init_font_hex::proto_lo
(byte*) init_font_hex::proto_lo#1 proto_lo zp ZP_WORD:17 50.5
(byte*) init_font_hex::proto_lo#4 proto_lo zp ZP_WORD:17 92.53846153846155
(byte*) init_font_hex::proto_lo#1 proto_lo zp ZP_WORD:20 50.5
(byte*) init_font_hex::proto_lo#4 proto_lo zp ZP_WORD:20 92.53846153846155
(void()) init_squares()
(byte~) init_squares::$3 reg byte a 22.0
(byte~) init_squares::$4 reg byte a 22.0
@ -170,13 +172,13 @@
(byte) init_squares::i#1 reg byte x 16.5
(byte) init_squares::i#2 reg byte x 5.5
(word) init_squares::sqr
(word) init_squares::sqr#1 sqr zp ZP_WORD:4 7.333333333333333
(word) init_squares::sqr#2 sqr zp ZP_WORD:4 6.6000000000000005
(word) init_squares::sqr#1 sqr zp ZP_WORD:6 7.333333333333333
(word) init_squares::sqr#2 sqr zp ZP_WORD:6 6.6000000000000005
(word*) init_squares::squares
(word*) init_squares::squares#1 squares zp ZP_WORD:9 3.6666666666666665
(word*) init_squares::squares#2 squares zp ZP_WORD:9 16.5
(void()) main()
(dword~) main::$4 $4 zp ZP_DWORD:13 4.0
(dword~) main::$4 $4 zp ZP_DWORD:14 4.0
(label) main::@1
(label) main::@2
(label) main::@3
@ -188,7 +190,7 @@
(byte*) main::BASE_SCREEN
(const byte*) main::BASE_SCREEN#0 BASE_SCREEN = (byte*) 1024
(dword) main::cyclecount
(dword) main::cyclecount#0 cyclecount zp ZP_DWORD:13 4.0
(dword) main::cyclecount#0 cyclecount zp ZP_DWORD:14 4.0
(label) main::toD0181
(word~) main::toD0181_$0
(number~) main::toD0181_$1
@ -231,19 +233,19 @@
(label) print_byte_at::@1
(label) print_byte_at::@return
(byte*) print_byte_at::at
(byte*) print_byte_at::at#0 at zp ZP_WORD:9 4.0
(byte*) print_byte_at::at#1 at zp ZP_WORD:9 4.0
(byte*) print_byte_at::at#2 at zp ZP_WORD:9 1.3333333333333333
(byte*) print_byte_at::at#0 at zp ZP_WORD:2 4.0
(byte*) print_byte_at::at#1 at zp ZP_WORD:2 4.0
(byte*) print_byte_at::at#2 at zp ZP_WORD:2 1.3333333333333333
(byte) print_byte_at::b
(byte) print_byte_at::b#0 b zp ZP_BYTE:12 2.0
(byte) print_byte_at::b#1 b zp ZP_BYTE:12 2.0
(byte) print_byte_at::b#2 b zp ZP_BYTE:12 1.6
(byte) print_byte_at::b#0 b zp ZP_BYTE:13 2.0
(byte) print_byte_at::b#1 b zp ZP_BYTE:13 2.0
(byte) print_byte_at::b#2 b zp ZP_BYTE:13 1.6
(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at)
(label) print_char_at::@return
(byte*) print_char_at::at
(byte*) print_char_at::at#0 at zp ZP_WORD:2 4.0
(byte*) print_char_at::at#1 at zp ZP_WORD:2 2.0
(byte*) print_char_at::at#2 at zp ZP_WORD:2 6.0
(byte*) print_char_at::at#0 at zp ZP_WORD:4 4.0
(byte*) print_char_at::at#1 at zp ZP_WORD:4 2.0
(byte*) print_char_at::at#2 at zp ZP_WORD:4 6.0
(byte) print_char_at::ch
(byte) print_char_at::ch#0 reg byte x 2.0
(byte) print_char_at::ch#1 reg byte x 4.0
@ -253,74 +255,74 @@
(label) print_dword_at::@return
(byte*) print_dword_at::at
(dword) print_dword_at::dw
(dword) print_dword_at::dw#0 dw zp ZP_DWORD:13 2.0
(dword) print_dword_at::dw#0 dw zp ZP_DWORD:14 2.0
(byte[]) print_hextab
(const byte[]) print_hextab#0 print_hextab = (string) "0123456789abcdef"
(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at)
(label) print_word_at::@1
(label) print_word_at::@return
(byte*) print_word_at::at
(byte*) print_word_at::at#2 at zp ZP_WORD:9 0.8
(byte*) print_word_at::at#2 at zp ZP_WORD:2 0.8
(word) print_word_at::w
(word) print_word_at::w#0 w zp ZP_WORD:4 4.0
(word) print_word_at::w#1 w zp ZP_WORD:4 4.0
(word) print_word_at::w#2 w zp ZP_WORD:4 2.0
(word) print_word_at::w#0 w zp ZP_WORD:9 4.0
(word) print_word_at::w#1 w zp ZP_WORD:9 4.0
(word) print_word_at::w#2 w zp ZP_WORD:9 2.0
(word()) sqr((byte) sqr::val)
(byte~) sqr::$0 reg byte a 4.0
(label) sqr::@return
(word) sqr::return
(word) sqr::return#0 return zp ZP_WORD:19 28.5
(word) sqr::return#2 return#2 zp ZP_WORD:17 22.0
(word) sqr::return#3 return zp ZP_WORD:19 202.0
(word) sqr::return#0 return zp ZP_WORD:20 28.5
(word) sqr::return#2 return#2 zp ZP_WORD:18 22.0
(word) sqr::return#3 return zp ZP_WORD:20 202.0
(byte) sqr::val
(byte) sqr::val#0 reg byte a 22.0
(byte) sqr::val#1 reg byte a 202.0
(byte) sqr::val#2 reg byte a 114.0
(byte()) sqrt((word) sqrt::val)
(word~) sqrt::$1 $1 zp ZP_WORD:2 2.0
(word~) sqrt::$3 $3 zp ZP_WORD:2 4.0
(word~) sqrt::$1 $1 zp ZP_WORD:6 2.0
(word~) sqrt::$3 $3 zp ZP_WORD:6 4.0
(label) sqrt::@1
(label) sqrt::@return
(word*) sqrt::found
(word*) sqrt::found#0 found zp ZP_WORD:2 4.0
(word*) sqrt::found#0 found zp ZP_WORD:6 4.0
(byte) sqrt::return
(byte) sqrt::return#0 reg byte a 34.33333333333333
(byte) sqrt::return#2 reg byte a 202.0
(byte) sqrt::sq
(word) sqrt::val
(word) sqrt::val#0 val zp ZP_WORD:19 103.0
(word) sqrt::val#0 val zp ZP_WORD:20 103.0
reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ]
zp ZP_WORD:2 [ init_dist_screen::screen_bottomline#10 init_dist_screen::screen_bottomline#1 print_word_at::at#2 print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ]
reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ]
reg byte a [ init_dist_screen::xd#0 init_dist_screen::$15 init_dist_screen::$13 ]
zp ZP_WORD:2 [ bsearch16u::return#1 bsearch16u::return#6 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#8 bsearch16u::$2 bsearch16u::items#0 bsearch16u::return#3 sqrt::found#0 sqrt::$3 sqrt::$1 print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ]
reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ]
zp ZP_WORD:4 [ bsearch16u::items#10 bsearch16u::items#16 print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ]
reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#10 bsearch16u::num#0 ]
reg byte a [ sqr::val#2 sqr::val#0 sqr::val#1 ]
zp ZP_WORD:6 [ init_squares::sqr#2 init_squares::sqr#1 bsearch16u::return#1 bsearch16u::pivot#0 bsearch16u::return#2 bsearch16u::items#11 bsearch16u::items#0 bsearch16u::items#18 bsearch16u::$2 bsearch16u::return#3 sqrt::found#0 sqrt::$3 sqrt::$1 ]
reg byte x [ init_squares::i#2 init_squares::i#1 ]
zp ZP_WORD:4 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 init_squares::sqr#2 init_squares::sqr#1 init_dist_screen::screen_topline#10 init_dist_screen::screen_topline#1 print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ]
zp ZP_BYTE:6 [ init_font_hex::c#6 init_font_hex::c#1 init_dist_screen::x#2 init_dist_screen::x#1 ]
zp ZP_WORD:9 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 init_squares::squares#2 init_squares::squares#1 init_dist_screen::screen_bottomline#10 init_dist_screen::screen_bottomline#1 print_word_at::at#2 print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ]
zp ZP_BYTE:11 [ init_font_hex::c1#4 init_font_hex::c1#1 init_dist_screen::xb#2 init_dist_screen::xb#1 ]
zp ZP_WORD:9 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 init_squares::squares#2 init_squares::squares#1 init_dist_screen::screen_topline#10 init_dist_screen::screen_topline#1 print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ]
zp ZP_BYTE:11 [ init_font_hex::c#6 init_font_hex::c#1 init_dist_screen::x#2 init_dist_screen::x#1 ]
zp ZP_BYTE:12 [ init_font_hex::c1#4 init_font_hex::c1#1 init_dist_screen::xb#2 init_dist_screen::xb#1 ]
reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ]
zp ZP_BYTE:12 [ init_font_hex::idx#5 init_font_hex::idx#2 init_dist_screen::y#10 init_dist_screen::y#1 print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ]
zp ZP_DWORD:13 [ clock::return#2 main::$4 clock::return#0 main::cyclecount#0 print_dword_at::dw#0 ]
zp ZP_BYTE:13 [ init_font_hex::idx#5 init_font_hex::idx#2 init_dist_screen::y#10 init_dist_screen::y#1 print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ]
zp ZP_DWORD:14 [ clock::return#2 main::$4 clock::return#0 main::cyclecount#0 print_dword_at::dw#0 ]
reg byte a [ print_byte_at::$0 ]
reg byte y [ print_byte_at::$2 ]
reg byte a [ init_dist_screen::y2#0 ]
zp ZP_WORD:17 [ sqr::return#2 init_dist_screen::yds#0 init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ]
zp ZP_WORD:18 [ sqr::return#2 init_dist_screen::yds#0 init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ]
reg byte a [ init_dist_screen::x2#0 ]
zp ZP_WORD:19 [ sqr::return#3 init_dist_screen::xds#0 sqr::return#0 init_dist_screen::ds#0 sqrt::val#0 bsearch16u::key#0 ]
zp ZP_WORD:20 [ sqr::return#3 init_dist_screen::xds#0 sqr::return#0 init_dist_screen::ds#0 sqrt::val#0 bsearch16u::key#0 init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ]
reg byte a [ sqrt::return#2 ]
reg byte a [ init_dist_screen::d#0 ]
reg byte a [ sqrt::return#0 ]
reg byte a [ bsearch16u::$6 ]
reg byte a [ bsearch16u::$16 ]
zp ZP_WORD:21 [ bsearch16u::pivot#0 ]
zp ZP_WORD:23 [ bsearch16u::result#0 ]
zp ZP_WORD:22 [ bsearch16u::result#0 ]
reg byte a [ sqr::$0 ]
reg byte a [ init_squares::$3 ]
reg byte a [ init_squares::$4 ]
zp ZP_BYTE:25 [ init_font_hex::$0 ]
zp ZP_BYTE:24 [ init_font_hex::$0 ]
reg byte a [ init_font_hex::$1 ]
reg byte a [ init_font_hex::$2 ]
reg byte y [ init_font_hex::idx#3 ]

View File

@ -24,17 +24,17 @@
.label heap_head = 2
.label SQUARES = 5
// Screen containing distance to center
.label SCREEN_DIST = $16
.label SCREEN_DIST = $1c
// Screen containing angle to center
.label SCREEN_ANGLE = $e
.label SCREEN_ANGLE = $10
// Array containing the bucket size for each of the distance buckets
.label BUCKET_SIZES = $10
.label BUCKET_SIZES = $12
// Buckets containing screen indices for each distance from the center.
// BUCKETS[dist] is an array of words containing screen indices.
// The size of the array BUCKETS[dist] is BUCKET_SIZES[dist]
.label BUCKETS = $12
.label BUCKETS = $14
// Current index into each bucket. Used while populating the buckets. (After population the end the values will be equal to the bucket sizes)
.label BUCKET_IDX = $18
.label BUCKET_IDX = $16
bbegin:
lda #<$3e8
sta malloc.size
@ -88,12 +88,12 @@ bbegin:
jsr main
rts
main: {
.label bucket = $14
.label bucket_size = $1b
.label bucket_idx = $1a
.label bucket = $18
.label bucket_size = $1f
.label bucket_idx = $1e
.label offset = $a
.label fill = $16
.label angle = $18
.label fill = $1a
.label angle = $1c
.label min_angle = 4
.label fill1 = $a
.label min_offset = $a
@ -228,25 +228,25 @@ main: {
jmp b6
}
// Initialize buckets containing indices of chars on the screen with specific distances to the center.
// init_buckets(byte* zeropage($16) screen)
// init_buckets(byte* zeropage($1c) screen)
init_buckets: {
.label _5 = 5
.label _9 = $22
.label _10 = $1c
.label _12 = $20
.label _13 = $22
.label screen = $16
.label _9 = $24
.label _10 = $20
.label _12 = $22
.label _13 = $24
.label screen = $1c
.label dist = 8
.label i1 = $a
.label i2 = $14
.label distance = $1a
.label bucket = $22
.label i2 = $18
.label distance = $1e
.label bucket = $24
.label dist_3 = 2
.label i4 = $1e
.label i4 = $1a
.label dist_5 = 2
.label _15 = 5
.label _16 = $20
.label _17 = $22
.label _16 = $22
.label _17 = $24
.label dist_8 = 2
ldy #0
// Init bucket sizes to 0
@ -430,19 +430,19 @@ malloc: {
}
// Populates 1000 bytes (a screen) with values representing the angle to the center.
// Utilizes symmetry around the center
// init_angle_screen(byte* zeropage($14) screen)
// init_angle_screen(byte* zeropage($18) screen)
init_angle_screen: {
.label _10 = $a
.label screen = $14
.label screen_topline = $1e
.label screen_bottomline = $14
.label xw = $20
.label yw = $22
.label screen = $18
.label screen_topline = $1a
.label screen_bottomline = $18
.label xw = $22
.label yw = $24
.label angle_w = $a
.label ang_w = $1b
.label ang_w = $1f
.label x = 4
.label xb = 7
.label y = $1a
.label y = $1e
lda screen
clc
adc #<$28*$c
@ -530,18 +530,18 @@ init_angle_screen: {
// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y)
// Finding the angle requires a binary search using CORDIC_ITERATIONS_16
// Returns the angle in hex-degrees (0=0, 0x8000=PI, 0x10000=2*PI)
// atan2_16(signed word zeropage($20) x, signed word zeropage($22) y)
// atan2_16(signed word zeropage($22) x, signed word zeropage($24) y)
atan2_16: {
.label _2 = 5
.label _7 = 8
.label yi = 5
.label xi = 8
.label angle = $a
.label xd = $1c
.label xd = $e
.label yd = $c
.label return = $a
.label x = $20
.label y = $22
.label x = $22
.label y = $24
lda y+1
bmi !b1+
jmp b1
@ -723,11 +723,11 @@ atan2_16: {
init_dist_screen: {
.label screen = 8
.label screen_bottomline = $a
.label yds = $1c
.label xds = $1e
.label ds = $1e
.label x = $1b
.label xb = $1a
.label yds = $20
.label xds = $22
.label ds = $22
.label x = $1f
.label xb = $1e
.label screen_topline = 8
.label y = 7
jsr init_squares
@ -818,16 +818,16 @@ init_dist_screen: {
// Find the (integer) square root of a word value
// If the square is not an integer then it returns the largest integer N where N*N <= val
// Uses a table of squares that must be initialized by calling init_squares()
// sqrt(word zeropage($1e) val)
// sqrt(word zeropage($22) val)
sqrt: {
.label _1 = $c
.label _3 = $c
.label found = $c
.label val = $1e
.label _1 = $e
.label _3 = $e
.label found = $e
.label val = $22
lda SQUARES
sta bsearch16u.items
sta bsearch16u.items_1
lda SQUARES+1
sta bsearch16u.items+1
sta bsearch16u.items_1+1
jsr bsearch16u
lda _3
sec
@ -846,46 +846,27 @@ sqrt: {
// - items - Pointer to the start of the array to search in
// - num - The number of items in the array
// Returns pointer to an entry in the array that matches the search key
// bsearch16u(word zeropage($1e) key, word* zeropage($c) items, byte register(X) num)
// bsearch16u(word zeropage($22) key, word* zeropage($e) items, byte register(X) num)
bsearch16u: {
.label _2 = $c
.label pivot = $20
.label result = $22
.label return = $c
.label items = $c
.label key = $1e
.label _2 = $e
.label pivot = $e
.label result = $24
.label return = $e
.label items = $e
.label key = $22
.label items_1 = $c
.label items_10 = $c
.label items_16 = $c
ldx #NUM_SQUARES
b3:
cpx #0
bne b4
ldy #1
lda (items),y
cmp key+1
bne !+
dey
lda (items),y
cmp key
beq b2
!:
bcc b2
lda _2
sec
sbc #<1*SIZEOF_WORD
sta _2
lda _2+1
sbc #>1*SIZEOF_WORD
sta _2+1
b2:
rts
b4:
txa
lsr
asl
clc
adc items
adc items_10
sta pivot
lda #0
adc items+1
adc items_10+1
sta pivot+1
sec
lda key
@ -899,38 +880,66 @@ bsearch16u: {
bne b6
lda result
bne b6
lda pivot
sta return
lda pivot+1
sta return+1
breturn:
rts
b6:
lda result+1
bmi b7
bmi b10
bne !+
lda result
beq b7
beq b10
!:
lda #1*SIZEOF_WORD
clc
adc pivot
adc items
sta items
lda #0
adc pivot+1
sta items+1
bcc !+
inc items+1
!:
dex
b7:
txa
lsr
tax
jmp b3
cpx #0
bne b9
ldy #1
lda (items),y
cmp key+1
bne !+
dey
lda (items),y
cmp key
beq breturn
!:
bcc breturn
lda _2
sec
sbc #<1*SIZEOF_WORD
sta _2
lda _2+1
sbc #>1*SIZEOF_WORD
sta _2+1
rts
b9:
lda items
sta items_16
lda items+1
sta items_16+1
jmp b4
b10:
lda items_10
sta items
lda items_10+1
sta items+1
jmp b7
}
// Find the square of a byte value
// Uses a table of squares that must be initialized by calling init_squares()
// sqr(byte register(A) val)
sqr: {
.label return = $1e
.label return_2 = $1c
.label return = $22
.label return_2 = $20
asl
tay
lda (SQUARES),y
@ -943,8 +952,8 @@ sqr: {
// Initialize squares table
// Uses iterative formula (x+1)^2 = x^2 + 2*x + 1
init_squares: {
.label squares = $14
.label sqr = $1c
.label squares = $1a
.label sqr = $18
lda #<NUM_SQUARES*SIZEOF_WORD
sta malloc.size
lda #>NUM_SQUARES*SIZEOF_WORD

View File

@ -415,75 +415,78 @@ sqrt::@return: scope:[sqrt] from sqrt::@1
to:@return
bsearch16u: scope:[bsearch16u] from sqrt
[220] phi()
to:bsearch16u::@4
bsearch16u::@4: scope:[bsearch16u] from bsearch16u bsearch16u::@9
[221] (word*) bsearch16u::items#10 ← phi( bsearch16u::@9/(word*~) bsearch16u::items#16 bsearch16u/(word*) bsearch16u::items#1 )
[221] (byte) bsearch16u::num#10 ← phi( bsearch16u::@9/(byte) bsearch16u::num#0 bsearch16u/(const byte) NUM_SQUARES#3 )
[222] (byte~) bsearch16u::$6 ← (byte) bsearch16u::num#10 >> (byte) 1
[223] (byte~) bsearch16u::$16 ← (byte~) bsearch16u::$6 << (byte) 1
[224] (word*) bsearch16u::pivot#0 ← (word*) bsearch16u::items#10 + (byte~) bsearch16u::$16
[225] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0)
[226] if((signed word) bsearch16u::result#0!=(signed byte) 0) goto bsearch16u::@6
to:bsearch16u::@return
bsearch16u::@return: scope:[bsearch16u] from bsearch16u::@2 bsearch16u::@4
[227] (word*) bsearch16u::return#1 ← phi( bsearch16u::@4/(word*) bsearch16u::pivot#0 bsearch16u::@2/(word*) bsearch16u::return#2 )
[228] return
to:@return
bsearch16u::@6: scope:[bsearch16u] from bsearch16u::@4
[229] if((signed word) bsearch16u::result#0<=(signed byte) 0) goto bsearch16u::@10
to:bsearch16u::@8
bsearch16u::@8: scope:[bsearch16u] from bsearch16u::@6
[230] (word*) bsearch16u::items#0 ← (word*) bsearch16u::pivot#0 + (byte) 1*(const byte) SIZEOF_WORD
[231] (byte) bsearch16u::num#1 ← -- (byte) bsearch16u::num#10
to:bsearch16u::@7
bsearch16u::@7: scope:[bsearch16u] from bsearch16u::@10 bsearch16u::@8
[232] (word*) bsearch16u::items#11 ← phi( bsearch16u::@8/(word*) bsearch16u::items#0 bsearch16u::@10/(word*~) bsearch16u::items#19 )
[232] (byte) bsearch16u::num#5 ← phi( bsearch16u::@8/(byte) bsearch16u::num#1 bsearch16u::@10/(byte) bsearch16u::num#10 )
[233] (byte) bsearch16u::num#0 ← (byte) bsearch16u::num#5 >> (byte) 1
to:bsearch16u::@3
bsearch16u::@3: scope:[bsearch16u] from bsearch16u bsearch16u::@7
[221] (word*) bsearch16u::items#2 ← phi( bsearch16u/(word*) bsearch16u::items#1 bsearch16u::@7/(word*) bsearch16u::items#8 )
[221] (byte) bsearch16u::num#3 ← phi( bsearch16u/(const byte) NUM_SQUARES#3 bsearch16u::@7/(byte) bsearch16u::num#0 )
[222] if((byte) bsearch16u::num#3>(byte) 0) goto bsearch16u::@4
bsearch16u::@3: scope:[bsearch16u] from bsearch16u::@7
[234] if((byte) bsearch16u::num#0>(byte) 0) goto bsearch16u::@9
to:bsearch16u::@5
bsearch16u::@5: scope:[bsearch16u] from bsearch16u::@3
[223] if(*((word*) bsearch16u::items#2)<=(word) bsearch16u::key#0) goto bsearch16u::@2
[235] if(*((word*) bsearch16u::items#11)<=(word) bsearch16u::key#0) goto bsearch16u::@2
to:bsearch16u::@1
bsearch16u::@1: scope:[bsearch16u] from bsearch16u::@5
[224] (word*~) bsearch16u::$2 ← (word*) bsearch16u::items#2 - (byte) 1*(const byte) SIZEOF_WORD
[236] (word*~) bsearch16u::$2 ← (word*) bsearch16u::items#11 - (byte) 1*(const byte) SIZEOF_WORD
to:bsearch16u::@2
bsearch16u::@2: scope:[bsearch16u] from bsearch16u::@1 bsearch16u::@5
[225] (word*) bsearch16u::return#2 ← phi( bsearch16u::@5/(word*) bsearch16u::items#2 bsearch16u::@1/(word*~) bsearch16u::$2 )
[237] (word*) bsearch16u::return#2 ← phi( bsearch16u::@5/(word*) bsearch16u::items#11 bsearch16u::@1/(word*~) bsearch16u::$2 )
to:bsearch16u::@return
bsearch16u::@return: scope:[bsearch16u] from bsearch16u::@2 bsearch16u::@8
[226] (word*) bsearch16u::return#1 ← phi( bsearch16u::@8/(word*~) bsearch16u::return#6 bsearch16u::@2/(word*) bsearch16u::return#2 )
[227] return
to:@return
bsearch16u::@4: scope:[bsearch16u] from bsearch16u::@3
[228] (byte~) bsearch16u::$6 ← (byte) bsearch16u::num#3 >> (byte) 1
[229] (byte~) bsearch16u::$16 ← (byte~) bsearch16u::$6 << (byte) 1
[230] (word*) bsearch16u::pivot#0 ← (word*) bsearch16u::items#2 + (byte~) bsearch16u::$16
[231] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0)
[232] if((signed word) bsearch16u::result#0!=(signed byte) 0) goto bsearch16u::@6
to:bsearch16u::@8
bsearch16u::@8: scope:[bsearch16u] from bsearch16u::@4
[233] (word*~) bsearch16u::return#6 ← (word*) bsearch16u::pivot#0
to:bsearch16u::@return
bsearch16u::@6: scope:[bsearch16u] from bsearch16u::@4
[234] if((signed word) bsearch16u::result#0<=(signed byte) 0) goto bsearch16u::@7
to:bsearch16u::@9
bsearch16u::@9: scope:[bsearch16u] from bsearch16u::@6
[235] (word*) bsearch16u::items#0 ← (word*) bsearch16u::pivot#0 + (byte) 1*(const byte) SIZEOF_WORD
[236] (byte) bsearch16u::num#1 ← -- (byte) bsearch16u::num#3
bsearch16u::@9: scope:[bsearch16u] from bsearch16u::@3
[238] (word*~) bsearch16u::items#16 ← (word*) bsearch16u::items#11
to:bsearch16u::@4
bsearch16u::@10: scope:[bsearch16u] from bsearch16u::@6
[239] (word*~) bsearch16u::items#19 ← (word*) bsearch16u::items#10
to:bsearch16u::@7
bsearch16u::@7: scope:[bsearch16u] from bsearch16u::@6 bsearch16u::@9
[237] (word*) bsearch16u::items#8 ← phi( bsearch16u::@9/(word*) bsearch16u::items#0 bsearch16u::@6/(word*) bsearch16u::items#2 )
[237] (byte) bsearch16u::num#5 ← phi( bsearch16u::@9/(byte) bsearch16u::num#1 bsearch16u::@6/(byte) bsearch16u::num#3 )
[238] (byte) bsearch16u::num#0 ← (byte) bsearch16u::num#5 >> (byte) 1
to:bsearch16u::@3
sqr: scope:[sqr] from init_dist_screen::@4 init_dist_screen::@8
[239] (byte) sqr::val#2 ← phi( init_dist_screen::@4/(byte) sqr::val#0 init_dist_screen::@8/(byte) sqr::val#1 )
[240] (byte~) sqr::$0 ← (byte) sqr::val#2 << (byte) 1
[241] (word) sqr::return#0 ← *((word*)(void*) SQUARES#1 + (byte~) sqr::$0)
[240] (byte) sqr::val#2 ← phi( init_dist_screen::@4/(byte) sqr::val#0 init_dist_screen::@8/(byte) sqr::val#1 )
[241] (byte~) sqr::$0 ← (byte) sqr::val#2 << (byte) 1
[242] (word) sqr::return#0 ← *((word*)(void*) SQUARES#1 + (byte~) sqr::$0)
to:sqr::@return
sqr::@return: scope:[sqr] from sqr
[242] return
[243] return
to:@return
init_squares: scope:[init_squares] from init_dist_screen
[243] phi()
[244] call malloc
[244] phi()
[245] call malloc
to:init_squares::@2
init_squares::@2: scope:[init_squares] from init_squares
[245] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0
[246] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1
[246] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0
[247] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1
to:init_squares::@1
init_squares::@1: scope:[init_squares] from init_squares::@1 init_squares::@2
[247] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares::@2/(byte) 0 )
[247] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares::@2/(word*) init_squares::squares#0 )
[247] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares::@2/(byte) 0 )
[248] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[249] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[250] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[251] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[252] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[253] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[254] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
[248] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares::@2/(byte) 0 )
[248] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares::@2/(word*) init_squares::squares#0 )
[248] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares::@2/(byte) 0 )
[249] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[250] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[251] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[252] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[253] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[254] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[255] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
to:init_squares::@return
init_squares::@return: scope:[init_squares] from init_squares::@1
[255] return
[256] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -11,11 +11,11 @@
(byte*) BORDERCOL
(const byte*) BORDERCOL#0 BORDERCOL = (byte*) 53280
(word*[]) BUCKETS
(void*) BUCKETS#0 BUCKETS zp ZP_WORD:18 0.02531645569620253
(void*) BUCKETS#0 BUCKETS zp ZP_WORD:20 0.02531645569620253
(byte[]) BUCKET_IDX
(void*) BUCKET_IDX#0 BUCKET_IDX zp ZP_WORD:24 0.0425531914893617
(void*) BUCKET_IDX#0 BUCKET_IDX zp ZP_WORD:22 0.0425531914893617
(byte[]) BUCKET_SIZES
(void*) BUCKET_SIZES#0 BUCKET_SIZES zp ZP_WORD:16 0.024691358024691357
(void*) BUCKET_SIZES#0 BUCKET_SIZES zp ZP_WORD:18 0.024691358024691357
(byte*) COLS
(const byte*) COLS#0 COLS = (byte*) 55296
(word[CORDIC_ITERATIONS_16#0]) CORDIC_ATAN2_ANGLES_16
@ -39,9 +39,9 @@
(byte*) RASTER
(const byte*) RASTER#0 RASTER = (byte*) 53266
(byte[]) SCREEN_ANGLE
(void*) SCREEN_ANGLE#0 SCREEN_ANGLE zp ZP_WORD:14 0.045454545454545456
(void*) SCREEN_ANGLE#0 SCREEN_ANGLE zp ZP_WORD:16 0.045454545454545456
(byte[]) SCREEN_DIST
(void*) SCREEN_DIST#0 SCREEN_DIST zp ZP_WORD:22 0.125
(void*) SCREEN_DIST#0 SCREEN_DIST zp ZP_WORD:28 0.125
(byte*) SCREEN_FILL
(const byte*) SCREEN_FILL#0 SCREEN_FILL = (byte*) 1024
(const byte) SIZEOF_BYTE SIZEOF_BYTE = (byte) 1
@ -97,13 +97,13 @@
(byte) atan2_16::shift#2 reg byte y 8001.25
(byte~) atan2_16::shift#5 reg byte y 667.3333333333334
(signed word) atan2_16::x
(signed word) atan2_16::x#0 x zp ZP_WORD:32 2.8684210526315796
(signed word) atan2_16::x#0 x zp ZP_WORD:34 2.8684210526315796
(signed word) atan2_16::xd
(signed word) atan2_16::xd#1 xd zp ZP_WORD:28 6667.333333333333
(signed word~) atan2_16::xd#10 xd zp ZP_WORD:28 1001.0
(signed word) atan2_16::xd#2 xd zp ZP_WORD:28 1001.0
(signed word) atan2_16::xd#3 xd zp ZP_WORD:28 7668.333333333332
(signed word) atan2_16::xd#5 xd zp ZP_WORD:28 1001.0
(signed word) atan2_16::xd#1 xd zp ZP_WORD:14 6667.333333333333
(signed word~) atan2_16::xd#10 xd zp ZP_WORD:14 1001.0
(signed word) atan2_16::xd#2 xd zp ZP_WORD:14 1001.0
(signed word) atan2_16::xd#3 xd zp ZP_WORD:14 7668.333333333332
(signed word) atan2_16::xd#5 xd zp ZP_WORD:14 1001.0
(signed word) atan2_16::xi
(signed word) atan2_16::xi#0 xi zp ZP_WORD:8 6.0
(signed word) atan2_16::xi#1 xi zp ZP_WORD:8 500.5
@ -112,7 +112,7 @@
(signed word) atan2_16::xi#3 xi zp ZP_WORD:8 267.0666666666667
(signed word) atan2_16::xi#8 xi zp ZP_WORD:8 1001.0
(signed word) atan2_16::y
(signed word) atan2_16::y#0 y zp ZP_WORD:34 2.724999999999999
(signed word) atan2_16::y#0 y zp ZP_WORD:36 2.724999999999999
(signed word) atan2_16::yd
(signed word) atan2_16::yd#1 yd zp ZP_WORD:12 10001.0
(signed word~) atan2_16::yd#10 yd zp ZP_WORD:12 2002.0
@ -128,9 +128,10 @@
(signed word) atan2_16::yi#8 yi zp ZP_WORD:5 1001.0
(word*()) bsearch16u((word) bsearch16u::key , (word*) bsearch16u::items , (byte) bsearch16u::num)
(byte~) bsearch16u::$16 reg byte a 2002.0
(word*~) bsearch16u::$2 $2 zp ZP_WORD:12 4.0
(word*~) bsearch16u::$2 $2 zp ZP_WORD:14 4.0
(byte~) bsearch16u::$6 reg byte a 2002.0
(label) bsearch16u::@1
(label) bsearch16u::@10
(label) bsearch16u::@2
(label) bsearch16u::@3
(label) bsearch16u::@4
@ -141,26 +142,27 @@
(label) bsearch16u::@9
(label) bsearch16u::@return
(word*) bsearch16u::items
(word*) bsearch16u::items#0 items zp ZP_WORD:12 1001.0
(word*) bsearch16u::items#1 items zp ZP_WORD:12 2.0
(word*) bsearch16u::items#2 items zp ZP_WORD:12 334.5555555555556
(word*) bsearch16u::items#8 items zp ZP_WORD:12 1501.5
(word*) bsearch16u::items#0 items zp ZP_WORD:14 1001.0
(word*) bsearch16u::items#1 items#1 zp ZP_WORD:12 2.0
(word*) bsearch16u::items#10 items#10 zp ZP_WORD:12 429.2857142857143
(word*) bsearch16u::items#11 items zp ZP_WORD:14 752.25
(word*~) bsearch16u::items#16 items#16 zp ZP_WORD:12 2002.0
(word*~) bsearch16u::items#19 items zp ZP_WORD:14 2002.0
(word) bsearch16u::key
(word) bsearch16u::key#0 key zp ZP_WORD:30 0.26666666666666666
(word) bsearch16u::key#0 key zp ZP_WORD:34 0.23529411764705882
(byte) bsearch16u::num
(byte) bsearch16u::num#0 reg byte x 2002.0
(byte) bsearch16u::num#0 reg byte x 1001.0
(byte) bsearch16u::num#1 reg byte x 2002.0
(byte) bsearch16u::num#3 reg byte x 556.1111111111111
(byte) bsearch16u::num#10 reg byte x 444.8888888888889
(byte) bsearch16u::num#5 reg byte x 3003.0
(word*) bsearch16u::pivot
(word*) bsearch16u::pivot#0 pivot zp ZP_WORD:32 501.0
(word*) bsearch16u::pivot#0 pivot zp ZP_WORD:14 750.75
(signed word) bsearch16u::result
(signed word) bsearch16u::result#0 result zp ZP_WORD:34 1501.5
(signed word) bsearch16u::result#0 result zp ZP_WORD:36 1501.5
(word*) bsearch16u::return
(word*) bsearch16u::return#1 return zp ZP_WORD:12 2.0
(word*) bsearch16u::return#2 return zp ZP_WORD:12 6.0
(word*) bsearch16u::return#3 return zp ZP_WORD:12 4.0
(word*~) bsearch16u::return#6 return zp ZP_WORD:12 4.0
(word*) bsearch16u::return#1 return zp ZP_WORD:14 335.00000000000006
(word*) bsearch16u::return#2 return zp ZP_WORD:14 6.0
(word*) bsearch16u::return#3 return zp ZP_WORD:14 4.0
(byte*) heap_head
(byte*) heap_head#1 heap_head zp ZP_WORD:2 0.2446808510638298
(byte*) heap_head#18 heap_head zp ZP_WORD:2 23.0
@ -178,19 +180,19 @@
(label) init_angle_screen::@4
(label) init_angle_screen::@return
(byte) init_angle_screen::ang_w
(byte) init_angle_screen::ang_w#0 ang_w zp ZP_BYTE:27 84.16666666666666
(byte) init_angle_screen::ang_w#0 ang_w zp ZP_BYTE:31 84.16666666666666
(word) init_angle_screen::angle_w
(word) init_angle_screen::angle_w#0 angle_w zp ZP_WORD:10 202.0
(byte*) init_angle_screen::screen
(byte*) init_angle_screen::screen#0 screen zp ZP_WORD:20 3.0
(byte*) init_angle_screen::screen#0 screen zp ZP_WORD:24 3.0
(byte*) init_angle_screen::screen_bottomline
(byte*) init_angle_screen::screen_bottomline#0 screen_bottomline zp ZP_WORD:20 4.0
(byte*) init_angle_screen::screen_bottomline#1 screen_bottomline zp ZP_WORD:20 7.333333333333333
(byte*) init_angle_screen::screen_bottomline#5 screen_bottomline zp ZP_WORD:20 9.040000000000001
(byte*) init_angle_screen::screen_bottomline#0 screen_bottomline zp ZP_WORD:24 4.0
(byte*) init_angle_screen::screen_bottomline#1 screen_bottomline zp ZP_WORD:24 7.333333333333333
(byte*) init_angle_screen::screen_bottomline#5 screen_bottomline zp ZP_WORD:24 9.040000000000001
(byte*) init_angle_screen::screen_topline
(byte*) init_angle_screen::screen_topline#0 screen_topline zp ZP_WORD:30 2.0
(byte*) init_angle_screen::screen_topline#1 screen_topline zp ZP_WORD:30 5.5
(byte*) init_angle_screen::screen_topline#5 screen_topline zp ZP_WORD:30 9.416666666666666
(byte*) init_angle_screen::screen_topline#0 screen_topline zp ZP_WORD:26 2.0
(byte*) init_angle_screen::screen_topline#1 screen_topline zp ZP_WORD:26 5.5
(byte*) init_angle_screen::screen_topline#5 screen_topline zp ZP_WORD:26 9.416666666666666
(byte) init_angle_screen::x
(byte) init_angle_screen::x#1 x zp ZP_BYTE:4 101.0
(byte) init_angle_screen::x#2 x zp ZP_BYTE:4 25.25
@ -198,22 +200,22 @@
(byte) init_angle_screen::xb#1 xb zp ZP_BYTE:7 101.0
(byte) init_angle_screen::xb#2 xb zp ZP_BYTE:7 19.238095238095237
(signed word) init_angle_screen::xw
(word) init_angle_screen::xw#0 xw zp ZP_WORD:32 33.666666666666664
(word) init_angle_screen::xw#0 xw zp ZP_WORD:34 33.666666666666664
(byte) init_angle_screen::y
(byte) init_angle_screen::y#1 y zp ZP_BYTE:26 16.5
(byte) init_angle_screen::y#4 y zp ZP_BYTE:26 4.730769230769231
(byte) init_angle_screen::y#1 y zp ZP_BYTE:30 16.5
(byte) init_angle_screen::y#4 y zp ZP_BYTE:30 4.730769230769231
(signed word) init_angle_screen::yw
(word) init_angle_screen::yw#0 yw zp ZP_WORD:34 50.5
(word) init_angle_screen::yw#0 yw zp ZP_WORD:36 50.5
(void()) init_buckets((byte*) init_buckets::screen)
(word~) init_buckets::$10 $10 zp ZP_WORD:28 11.0
(word~) init_buckets::$12 $12 zp ZP_WORD:32 22.0
(word~) init_buckets::$13 $13 zp ZP_WORD:34 22.0
(word~) init_buckets::$10 $10 zp ZP_WORD:32 11.0
(word~) init_buckets::$12 $12 zp ZP_WORD:34 22.0
(word~) init_buckets::$13 $13 zp ZP_WORD:36 22.0
(byte~) init_buckets::$14 reg byte a 22.0
(byte*~) init_buckets::$15 $15 zp ZP_WORD:5 22.0
(word**~) init_buckets::$16 $16 zp ZP_WORD:32 22.0
(word**~) init_buckets::$17 $17 zp ZP_WORD:34 22.0
(word**~) init_buckets::$16 $16 zp ZP_WORD:34 22.0
(word**~) init_buckets::$17 $17 zp ZP_WORD:36 22.0
(void*~) init_buckets::$5 $5 zp ZP_WORD:5 3.6666666666666665
(word~) init_buckets::$9 $9 zp ZP_WORD:34 22.0
(word~) init_buckets::$9 $9 zp ZP_WORD:36 22.0
(label) init_buckets::@1
(label) init_buckets::@2
(label) init_buckets::@3
@ -224,7 +226,7 @@
(label) init_buckets::@8
(label) init_buckets::@return
(word*) init_buckets::bucket
(word*) init_buckets::bucket#0 bucket zp ZP_WORD:34 7.333333333333333
(word*) init_buckets::bucket#0 bucket zp ZP_WORD:36 7.333333333333333
(byte*) init_buckets::dist
(byte*) init_buckets::dist#1 dist zp ZP_WORD:8 7.333333333333333
(byte*) init_buckets::dist#3 dist#3 zp ZP_WORD:2 7.333333333333333
@ -233,7 +235,7 @@
(byte*~) init_buckets::dist#6 dist zp ZP_WORD:8 4.0
(byte*~) init_buckets::dist#8 dist#8 zp ZP_WORD:2 4.0
(byte) init_buckets::distance
(byte) init_buckets::distance#0 distance zp ZP_BYTE:26 5.5
(byte) init_buckets::distance#0 distance zp ZP_BYTE:30 5.5
(byte) init_buckets::i
(byte) init_buckets::i#1 reg byte y 16.5
(byte) init_buckets::i#2 reg byte y 16.5
@ -241,16 +243,16 @@
(word) init_buckets::i1#1 i1 zp ZP_WORD:10 16.5
(word) init_buckets::i1#2 i1 zp ZP_WORD:10 7.333333333333333
(word) init_buckets::i2
(word) init_buckets::i2#1 i2 zp ZP_WORD:20 16.5
(word) init_buckets::i2#2 i2 zp ZP_WORD:20 5.5
(word) init_buckets::i2#1 i2 zp ZP_WORD:24 16.5
(word) init_buckets::i2#2 i2 zp ZP_WORD:24 5.5
(byte) init_buckets::i3
(byte) init_buckets::i3#1 reg byte y 16.5
(byte) init_buckets::i3#2 reg byte y 16.5
(word) init_buckets::i4
(word) init_buckets::i4#1 i4 zp ZP_WORD:30 16.5
(word) init_buckets::i4#2 i4 zp ZP_WORD:30 2.0
(word) init_buckets::i4#1 i4 zp ZP_WORD:26 16.5
(word) init_buckets::i4#2 i4 zp ZP_WORD:26 2.0
(byte*) init_buckets::screen
(byte*) init_buckets::screen#0 screen zp ZP_WORD:22 0.42500000000000004
(byte*) init_buckets::screen#0 screen zp ZP_WORD:28 0.42500000000000004
(void()) init_dist_screen((byte*) init_dist_screen::screen)
(byte~) init_dist_screen::$13 reg byte a 202.0
(byte~) init_dist_screen::$15 reg byte a 202.0
@ -273,7 +275,7 @@
(byte) init_dist_screen::d
(byte) init_dist_screen::d#0 reg byte a 126.25
(word) init_dist_screen::ds
(word) init_dist_screen::ds#0 ds zp ZP_WORD:30 202.0
(word) init_dist_screen::ds#0 ds zp ZP_WORD:34 202.0
(byte*) init_dist_screen::screen
(byte*) init_dist_screen::screen#0 screen zp ZP_WORD:8 1.5
(byte*) init_dist_screen::screen_bottomline
@ -284,17 +286,17 @@
(byte*) init_dist_screen::screen_topline#1 screen_topline zp ZP_WORD:8 5.5
(byte*) init_dist_screen::screen_topline#10 screen_topline zp ZP_WORD:8 7.0625
(byte) init_dist_screen::x
(byte) init_dist_screen::x#1 x zp ZP_BYTE:27 101.0
(byte) init_dist_screen::x#2 x zp ZP_BYTE:27 26.578947368421055
(byte) init_dist_screen::x#1 x zp ZP_BYTE:31 101.0
(byte) init_dist_screen::x#2 x zp ZP_BYTE:31 26.578947368421055
(byte) init_dist_screen::x2
(byte) init_dist_screen::x2#0 reg byte a 202.0
(byte) init_dist_screen::xb
(byte) init_dist_screen::xb#1 xb zp ZP_BYTE:26 101.0
(byte) init_dist_screen::xb#2 xb zp ZP_BYTE:26 20.2
(byte) init_dist_screen::xb#1 xb zp ZP_BYTE:30 101.0
(byte) init_dist_screen::xb#2 xb zp ZP_BYTE:30 20.2
(byte) init_dist_screen::xd
(byte) init_dist_screen::xd#0 reg byte a 303.0
(word) init_dist_screen::xds
(word) init_dist_screen::xds#0 xds zp ZP_WORD:30 202.0
(word) init_dist_screen::xds#0 xds zp ZP_WORD:34 202.0
(byte) init_dist_screen::y
(byte) init_dist_screen::y#1 y zp ZP_BYTE:7 16.5
(byte) init_dist_screen::y#10 y zp ZP_BYTE:7 0.9705882352941178
@ -303,7 +305,7 @@
(byte) init_dist_screen::yd
(byte) init_dist_screen::yd#0 reg byte a 33.0
(word) init_dist_screen::yds
(word) init_dist_screen::yds#0 yds zp ZP_WORD:28 4.869565217391305
(word) init_dist_screen::yds#0 yds zp ZP_WORD:32 4.869565217391305
(void()) init_squares()
(byte~) init_squares::$3 reg byte a 22.0
(byte~) init_squares::$4 reg byte a 22.0
@ -314,12 +316,12 @@
(byte) init_squares::i#1 reg byte x 16.5
(byte) init_squares::i#2 reg byte x 5.5
(word) init_squares::sqr
(word) init_squares::sqr#1 sqr zp ZP_WORD:28 7.333333333333333
(word) init_squares::sqr#2 sqr zp ZP_WORD:28 6.6000000000000005
(word) init_squares::sqr#1 sqr zp ZP_WORD:24 7.333333333333333
(word) init_squares::sqr#2 sqr zp ZP_WORD:24 6.6000000000000005
(word*) init_squares::squares
(word*) init_squares::squares#0 squares zp ZP_WORD:20 4.0
(word*) init_squares::squares#1 squares zp ZP_WORD:20 3.6666666666666665
(word*) init_squares::squares#2 squares zp ZP_WORD:20 17.5
(word*) init_squares::squares#0 squares zp ZP_WORD:26 4.0
(word*) init_squares::squares#1 squares zp ZP_WORD:26 3.6666666666666665
(word*) init_squares::squares#2 squares zp ZP_WORD:26 17.5
(void()) main()
(byte~) main::$21 reg byte a 22.0
(byte~) main::$22 reg byte a 202.0
@ -342,16 +344,16 @@
(label) main::@8
(label) main::@9
(byte*) main::angle
(byte*) main::angle#0 angle zp ZP_WORD:24 151.5
(byte*) main::angle#0 angle zp ZP_WORD:28 151.5
(word[]) main::bucket
(word[]) main::bucket#0 bucket zp ZP_WORD:20 6.588235294117648
(word[]) main::bucket#0 bucket zp ZP_WORD:24 6.588235294117648
(byte) main::bucket_idx
(byte) main::bucket_idx#1 bucket_idx zp ZP_BYTE:26 11.0
(byte) main::bucket_idx#6 bucket_idx zp ZP_BYTE:26 2.64
(byte) main::bucket_idx#1 bucket_idx zp ZP_BYTE:30 11.0
(byte) main::bucket_idx#6 bucket_idx zp ZP_BYTE:30 2.64
(byte) main::bucket_size
(byte) main::bucket_size#0 bucket_size zp ZP_BYTE:27 7.6875
(byte) main::bucket_size#0 bucket_size zp ZP_BYTE:31 7.6875
(byte*) main::fill
(byte*) main::fill#0 fill zp ZP_WORD:22 202.0
(byte*) main::fill#0 fill zp ZP_WORD:26 202.0
(byte*) main::fill1
(byte*) main::fill1#0 fill1 zp ZP_WORD:10 22.0
(byte) main::i
@ -381,26 +383,26 @@
(byte~) sqr::$0 reg byte a 4.0
(label) sqr::@return
(word) sqr::return
(word) sqr::return#0 return zp ZP_WORD:30 28.5
(word) sqr::return#2 return#2 zp ZP_WORD:28 22.0
(word) sqr::return#3 return zp ZP_WORD:30 202.0
(word) sqr::return#0 return zp ZP_WORD:34 28.5
(word) sqr::return#2 return#2 zp ZP_WORD:32 22.0
(word) sqr::return#3 return zp ZP_WORD:34 202.0
(byte) sqr::val
(byte) sqr::val#0 reg byte a 22.0
(byte) sqr::val#1 reg byte a 202.0
(byte) sqr::val#2 reg byte a 114.0
(byte()) sqrt((word) sqrt::val)
(word~) sqrt::$1 $1 zp ZP_WORD:12 2.0
(word~) sqrt::$3 $3 zp ZP_WORD:12 4.0
(word~) sqrt::$1 $1 zp ZP_WORD:14 2.0
(word~) sqrt::$3 $3 zp ZP_WORD:14 4.0
(label) sqrt::@1
(label) sqrt::@return
(word*) sqrt::found
(word*) sqrt::found#0 found zp ZP_WORD:12 4.0
(word*) sqrt::found#0 found zp ZP_WORD:14 4.0
(byte) sqrt::return
(byte) sqrt::return#0 reg byte a 34.33333333333333
(byte) sqrt::return#2 reg byte a 202.0
(byte) sqrt::sq
(word) sqrt::val
(word) sqrt::val#0 val zp ZP_WORD:30 103.0
(word) sqrt::val#0 val zp ZP_WORD:34 103.0
reg byte x [ main::i#2 main::i#1 ]
reg byte y [ init_buckets::i#2 init_buckets::i#1 ]
@ -415,40 +417,41 @@ zp ZP_WORD:8 [ init_dist_screen::screen_topline#10 init_dist_screen::screen_topl
zp ZP_WORD:10 [ init_dist_screen::screen_bottomline#10 init_dist_screen::screen_bottomline#1 init_dist_screen::screen_bottomline#0 atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::return#2 init_angle_screen::angle_w#0 init_angle_screen::$10 init_buckets::i1#2 init_buckets::i1#1 main::min_offset#2 main::min_offset#8 main::offset#0 main::min_offset#10 main::fill1#0 ]
reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ]
reg byte a [ init_dist_screen::xd#0 init_dist_screen::$15 init_dist_screen::$13 ]
zp ZP_WORD:12 [ bsearch16u::return#1 bsearch16u::return#6 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#1 bsearch16u::items#8 bsearch16u::$2 bsearch16u::items#0 bsearch16u::return#3 sqrt::found#0 sqrt::$3 sqrt::$1 atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ]
reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ]
zp ZP_WORD:12 [ bsearch16u::items#10 bsearch16u::items#16 bsearch16u::items#1 atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ]
zp ZP_WORD:14 [ bsearch16u::return#1 bsearch16u::pivot#0 bsearch16u::return#2 bsearch16u::items#11 bsearch16u::items#0 bsearch16u::items#19 bsearch16u::$2 bsearch16u::return#3 sqrt::found#0 sqrt::$3 sqrt::$1 atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ]
reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#10 bsearch16u::num#0 ]
reg byte a [ sqr::val#2 sqr::val#0 sqr::val#1 ]
reg byte x [ init_squares::i#2 init_squares::i#1 ]
zp ZP_WORD:14 [ SCREEN_ANGLE#0 ]
zp ZP_WORD:16 [ BUCKET_SIZES#0 ]
zp ZP_WORD:18 [ BUCKETS#0 ]
zp ZP_WORD:16 [ SCREEN_ANGLE#0 ]
zp ZP_WORD:18 [ BUCKET_SIZES#0 ]
zp ZP_WORD:20 [ BUCKETS#0 ]
zp ZP_WORD:22 [ BUCKET_IDX#0 ]
reg byte a [ main::$21 ]
zp ZP_WORD:20 [ main::bucket#0 init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 init_angle_screen::screen_bottomline#5 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 init_angle_screen::screen#0 init_buckets::i2#2 init_buckets::i2#1 ]
zp ZP_WORD:24 [ main::bucket#0 init_squares::sqr#2 init_squares::sqr#1 init_angle_screen::screen_bottomline#5 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 init_angle_screen::screen#0 init_buckets::i2#2 init_buckets::i2#1 ]
reg byte a [ main::$22 ]
zp ZP_WORD:22 [ main::fill#0 SCREEN_DIST#0 init_buckets::screen#0 ]
zp ZP_WORD:24 [ main::angle#0 BUCKET_IDX#0 ]
zp ZP_BYTE:26 [ init_buckets::distance#0 init_dist_screen::xb#2 init_dist_screen::xb#1 init_angle_screen::y#4 init_angle_screen::y#1 main::bucket_idx#6 main::bucket_idx#1 ]
zp ZP_WORD:26 [ main::fill#0 init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 init_angle_screen::screen_topline#5 init_angle_screen::screen_topline#0 init_angle_screen::screen_topline#1 init_buckets::i4#2 init_buckets::i4#1 ]
zp ZP_WORD:28 [ main::angle#0 SCREEN_DIST#0 init_buckets::screen#0 ]
zp ZP_BYTE:30 [ init_buckets::distance#0 init_dist_screen::xb#2 init_dist_screen::xb#1 init_angle_screen::y#4 init_angle_screen::y#1 main::bucket_idx#6 main::bucket_idx#1 ]
reg byte a [ init_buckets::$14 ]
reg byte a [ init_angle_screen::$2 ]
reg byte a [ init_angle_screen::$3 ]
reg byte a [ init_angle_screen::$6 ]
zp ZP_BYTE:27 [ init_angle_screen::ang_w#0 main::bucket_size#0 init_dist_screen::x#2 init_dist_screen::x#1 ]
zp ZP_BYTE:31 [ init_angle_screen::ang_w#0 main::bucket_size#0 init_dist_screen::x#2 init_dist_screen::x#1 ]
reg byte a [ init_angle_screen::$12 ]
reg byte a [ init_angle_screen::$13 ]
reg byte a [ init_angle_screen::$14 ]
reg byte a [ atan2_16::$24 ]
reg byte a [ atan2_16::$23 ]
reg byte a [ init_dist_screen::y2#0 ]
zp ZP_WORD:28 [ sqr::return#2 init_dist_screen::yds#0 init_buckets::$10 init_squares::sqr#2 init_squares::sqr#1 atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ]
zp ZP_WORD:32 [ sqr::return#2 init_dist_screen::yds#0 init_buckets::$10 ]
reg byte a [ init_dist_screen::x2#0 ]
zp ZP_WORD:30 [ sqr::return#3 init_dist_screen::xds#0 sqr::return#0 init_dist_screen::ds#0 sqrt::val#0 bsearch16u::key#0 init_angle_screen::screen_topline#5 init_angle_screen::screen_topline#0 init_angle_screen::screen_topline#1 init_buckets::i4#2 init_buckets::i4#1 ]
zp ZP_WORD:34 [ sqr::return#3 init_dist_screen::xds#0 sqr::return#0 init_dist_screen::ds#0 sqrt::val#0 bsearch16u::key#0 init_angle_screen::xw#0 atan2_16::x#0 init_buckets::$12 init_buckets::$16 ]
reg byte a [ sqrt::return#2 ]
reg byte a [ init_dist_screen::d#0 ]
reg byte a [ sqrt::return#0 ]
reg byte a [ bsearch16u::$6 ]
reg byte a [ bsearch16u::$16 ]
zp ZP_WORD:32 [ bsearch16u::pivot#0 init_angle_screen::xw#0 atan2_16::x#0 init_buckets::$12 init_buckets::$16 ]
zp ZP_WORD:34 [ bsearch16u::result#0 init_angle_screen::yw#0 atan2_16::y#0 init_buckets::$9 init_buckets::$13 init_buckets::$17 init_buckets::bucket#0 ]
zp ZP_WORD:36 [ bsearch16u::result#0 init_angle_screen::yw#0 atan2_16::y#0 init_buckets::$9 init_buckets::$13 init_buckets::$17 init_buckets::bucket#0 ]
reg byte a [ sqr::$0 ]
reg byte a [ init_squares::$3 ]
reg byte a [ init_squares::$4 ]

View File

@ -12,12 +12,12 @@
// Char to fill with
.const FILL_CHAR = '@'
.const NUM_SQUARES = $30
.label heap_head = $f
.label SQUARES = $11
.label heap_head = $d
.label SQUARES = $13
// Screen containing distance to center
.label SCREEN_DIST = $b
.label SCREEN_DIST = $f
// Screen containing angle to center
.label SCREEN_ANGLE = $d
.label SCREEN_ANGLE = $11
bbegin:
lda #<$3e8
sta malloc.size
@ -44,15 +44,15 @@ bbegin:
jsr main
rts
main: {
.label dist = 9
.label angle = $14
.label fill = 7
.label dist_angle = $1a
.label min_dist_angle = $16
.label min_dist_angle_3 = $1a
.label min_fill = $18
.label min_dist_angle_7 = $1a
.label min_dist_angle_8 = $1a
.label dist = $b
.label angle = $d
.label fill = 9
.label dist_angle = 2
.label min_dist_angle = $18
.label min_dist_angle_3 = 2
.label min_fill = $1a
.label min_dist_angle_7 = 2
.label min_dist_angle_8 = 2
lda SCREEN_DIST
sta init_dist_screen.screen
lda SCREEN_DIST+1
@ -161,19 +161,19 @@ main: {
}
// Populates 1000 bytes (a screen) with values representing the angle to the center.
// Utilizes symmetry around the center
// init_angle_screen(byte* zeropage(7) screen)
// init_angle_screen(byte* zeropage(9) screen)
init_angle_screen: {
.label _10 = $18
.label screen = 7
.label screen_topline = 9
.label screen_bottomline = 7
.label xw = $f
.label yw = $11
.label angle_w = $18
.label ang_w = $13
.label x = 5
.label xb = 6
.label y = 2
.label _10 = $1a
.label screen = 9
.label screen_topline = $b
.label screen_bottomline = 9
.label xw = $13
.label yw = $16
.label angle_w = $1a
.label ang_w = $15
.label x = 7
.label xb = 8
.label y = 4
lda screen
clc
adc #<$28*$c
@ -261,18 +261,18 @@ init_angle_screen: {
// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y)
// Finding the angle requires a binary search using CORDIC_ITERATIONS_16
// Returns the angle in hex-degrees (0=0, 0x8000=PI, 0x10000=2*PI)
// atan2_16(signed word zeropage($f) x, signed word zeropage($11) y)
// atan2_16(signed word zeropage($13) x, signed word zeropage($16) y)
atan2_16: {
.label _2 = $14
.label _7 = $16
.label yi = $14
.label xi = $16
.label angle = $18
.label xd = 3
.label yd = $1a
.label return = $18
.label x = $f
.label y = $11
.label _2 = $d
.label _7 = $18
.label yi = $d
.label xi = $18
.label angle = $1a
.label xd = 5
.label yd = 2
.label return = $1a
.label x = $13
.label y = $16
lda y+1
bmi !b1+
jmp b1
@ -449,17 +449,17 @@ atan2_16: {
}
// Populates 1000 bytes (a screen) with values representing the distance to the center.
// The actual value stored is distance*2 to increase precision
// init_dist_screen(byte* zeropage(3) screen)
// init_dist_screen(byte* zeropage(5) screen)
init_dist_screen: {
.label screen = 3
.label screen_bottomline = 7
.label yds = $14
.label xds = $16
.label ds = $16
.label x = 5
.label xb = 6
.label screen_topline = 3
.label y = 2
.label screen = 5
.label screen_bottomline = 9
.label yds = $16
.label xds = $18
.label ds = $18
.label x = 7
.label xb = 8
.label screen_topline = 5
.label y = 4
jsr init_squares
lda screen
clc
@ -548,16 +548,16 @@ init_dist_screen: {
// Find the (integer) square root of a word value
// If the square is not an integer then it returns the largest integer N where N*N <= val
// Uses a table of squares that must be initialized by calling init_squares()
// sqrt(word zeropage($16) val)
// sqrt(word zeropage($18) val)
sqrt: {
.label _1 = 9
.label _3 = 9
.label found = 9
.label val = $16
.label _1 = $d
.label _3 = $d
.label found = $d
.label val = $18
lda SQUARES
sta bsearch16u.items
sta bsearch16u.items_1
lda SQUARES+1
sta bsearch16u.items+1
sta bsearch16u.items_1+1
jsr bsearch16u
lda _3
sec
@ -576,46 +576,27 @@ sqrt: {
// - items - Pointer to the start of the array to search in
// - num - The number of items in the array
// Returns pointer to an entry in the array that matches the search key
// bsearch16u(word zeropage($16) key, word* zeropage(9) items, byte register(X) num)
// bsearch16u(word zeropage($18) key, word* zeropage($d) items, byte register(X) num)
bsearch16u: {
.label _2 = 9
.label pivot = $18
.label _2 = $d
.label pivot = $d
.label result = $1a
.label return = 9
.label items = 9
.label key = $16
.label return = $d
.label items = $d
.label key = $18
.label items_1 = $b
.label items_10 = $b
.label items_16 = $b
ldx #NUM_SQUARES
b3:
cpx #0
bne b4
ldy #1
lda (items),y
cmp key+1
bne !+
dey
lda (items),y
cmp key
beq b2
!:
bcc b2
lda _2
sec
sbc #<1*SIZEOF_WORD
sta _2
lda _2+1
sbc #>1*SIZEOF_WORD
sta _2+1
b2:
rts
b4:
txa
lsr
asl
clc
adc items
adc items_10
sta pivot
lda #0
adc items+1
adc items_10+1
sta pivot+1
sec
lda key
@ -629,38 +610,66 @@ bsearch16u: {
bne b6
lda result
bne b6
lda pivot
sta return
lda pivot+1
sta return+1
breturn:
rts
b6:
lda result+1
bmi b7
bmi b10
bne !+
lda result
beq b7
beq b10
!:
lda #1*SIZEOF_WORD
clc
adc pivot
adc items
sta items
lda #0
adc pivot+1
sta items+1
bcc !+
inc items+1
!:
dex
b7:
txa
lsr
tax
jmp b3
cpx #0
bne b9
ldy #1
lda (items),y
cmp key+1
bne !+
dey
lda (items),y
cmp key
beq breturn
!:
bcc breturn
lda _2
sec
sbc #<1*SIZEOF_WORD
sta _2
lda _2+1
sbc #>1*SIZEOF_WORD
sta _2+1
rts
b9:
lda items
sta items_16
lda items+1
sta items_16+1
jmp b4
b10:
lda items_10
sta items
lda items_10+1
sta items+1
jmp b7
}
// Find the square of a byte value
// Uses a table of squares that must be initialized by calling init_squares()
// sqr(byte register(A) val)
sqr: {
.label return = $16
.label return_2 = $14
.label return = $18
.label return_2 = $16
asl
tay
lda (SQUARES),y
@ -673,8 +682,8 @@ sqr: {
// Initialize squares table
// Uses iterative formula (x+1)^2 = x^2 + 2*x + 1
init_squares: {
.label squares = 9
.label sqr = 7
.label squares = $b
.label sqr = 9
lda #<NUM_SQUARES*SIZEOF_WORD
sta malloc.size
lda #>NUM_SQUARES*SIZEOF_WORD
@ -719,10 +728,10 @@ init_squares: {
}
// Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.
// malloc(word zeropage($11) size)
// malloc(word zeropage($13) size)
malloc: {
.label mem = $11
.label size = $11
.label mem = $13
.label size = $13
lda heap_head
sec
sbc mem

View File

@ -304,84 +304,87 @@ sqrt::@return: scope:[sqrt] from sqrt::@1
to:@return
bsearch16u: scope:[bsearch16u] from sqrt
[154] phi()
to:bsearch16u::@4
bsearch16u::@4: scope:[bsearch16u] from bsearch16u bsearch16u::@9
[155] (word*) bsearch16u::items#10 ← phi( bsearch16u::@9/(word*~) bsearch16u::items#16 bsearch16u/(word*) bsearch16u::items#1 )
[155] (byte) bsearch16u::num#10 ← phi( bsearch16u::@9/(byte) bsearch16u::num#0 bsearch16u/(const byte) NUM_SQUARES#3 )
[156] (byte~) bsearch16u::$6 ← (byte) bsearch16u::num#10 >> (byte) 1
[157] (byte~) bsearch16u::$16 ← (byte~) bsearch16u::$6 << (byte) 1
[158] (word*) bsearch16u::pivot#0 ← (word*) bsearch16u::items#10 + (byte~) bsearch16u::$16
[159] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0)
[160] if((signed word) bsearch16u::result#0!=(signed byte) 0) goto bsearch16u::@6
to:bsearch16u::@return
bsearch16u::@return: scope:[bsearch16u] from bsearch16u::@2 bsearch16u::@4
[161] (word*) bsearch16u::return#1 ← phi( bsearch16u::@4/(word*) bsearch16u::pivot#0 bsearch16u::@2/(word*) bsearch16u::return#2 )
[162] return
to:@return
bsearch16u::@6: scope:[bsearch16u] from bsearch16u::@4
[163] if((signed word) bsearch16u::result#0<=(signed byte) 0) goto bsearch16u::@10
to:bsearch16u::@8
bsearch16u::@8: scope:[bsearch16u] from bsearch16u::@6
[164] (word*) bsearch16u::items#0 ← (word*) bsearch16u::pivot#0 + (byte) 1*(const byte) SIZEOF_WORD
[165] (byte) bsearch16u::num#1 ← -- (byte) bsearch16u::num#10
to:bsearch16u::@7
bsearch16u::@7: scope:[bsearch16u] from bsearch16u::@10 bsearch16u::@8
[166] (word*) bsearch16u::items#11 ← phi( bsearch16u::@8/(word*) bsearch16u::items#0 bsearch16u::@10/(word*~) bsearch16u::items#19 )
[166] (byte) bsearch16u::num#5 ← phi( bsearch16u::@8/(byte) bsearch16u::num#1 bsearch16u::@10/(byte) bsearch16u::num#10 )
[167] (byte) bsearch16u::num#0 ← (byte) bsearch16u::num#5 >> (byte) 1
to:bsearch16u::@3
bsearch16u::@3: scope:[bsearch16u] from bsearch16u bsearch16u::@7
[155] (word*) bsearch16u::items#2 ← phi( bsearch16u/(word*) bsearch16u::items#1 bsearch16u::@7/(word*) bsearch16u::items#8 )
[155] (byte) bsearch16u::num#3 ← phi( bsearch16u/(const byte) NUM_SQUARES#3 bsearch16u::@7/(byte) bsearch16u::num#0 )
[156] if((byte) bsearch16u::num#3>(byte) 0) goto bsearch16u::@4
bsearch16u::@3: scope:[bsearch16u] from bsearch16u::@7
[168] if((byte) bsearch16u::num#0>(byte) 0) goto bsearch16u::@9
to:bsearch16u::@5
bsearch16u::@5: scope:[bsearch16u] from bsearch16u::@3
[157] if(*((word*) bsearch16u::items#2)<=(word) bsearch16u::key#0) goto bsearch16u::@2
[169] if(*((word*) bsearch16u::items#11)<=(word) bsearch16u::key#0) goto bsearch16u::@2
to:bsearch16u::@1
bsearch16u::@1: scope:[bsearch16u] from bsearch16u::@5
[158] (word*~) bsearch16u::$2 ← (word*) bsearch16u::items#2 - (byte) 1*(const byte) SIZEOF_WORD
[170] (word*~) bsearch16u::$2 ← (word*) bsearch16u::items#11 - (byte) 1*(const byte) SIZEOF_WORD
to:bsearch16u::@2
bsearch16u::@2: scope:[bsearch16u] from bsearch16u::@1 bsearch16u::@5
[159] (word*) bsearch16u::return#2 ← phi( bsearch16u::@5/(word*) bsearch16u::items#2 bsearch16u::@1/(word*~) bsearch16u::$2 )
[171] (word*) bsearch16u::return#2 ← phi( bsearch16u::@5/(word*) bsearch16u::items#11 bsearch16u::@1/(word*~) bsearch16u::$2 )
to:bsearch16u::@return
bsearch16u::@return: scope:[bsearch16u] from bsearch16u::@2 bsearch16u::@8
[160] (word*) bsearch16u::return#1 ← phi( bsearch16u::@8/(word*~) bsearch16u::return#6 bsearch16u::@2/(word*) bsearch16u::return#2 )
[161] return
to:@return
bsearch16u::@4: scope:[bsearch16u] from bsearch16u::@3
[162] (byte~) bsearch16u::$6 ← (byte) bsearch16u::num#3 >> (byte) 1
[163] (byte~) bsearch16u::$16 ← (byte~) bsearch16u::$6 << (byte) 1
[164] (word*) bsearch16u::pivot#0 ← (word*) bsearch16u::items#2 + (byte~) bsearch16u::$16
[165] (signed word) bsearch16u::result#0 ← (signed word)(word) bsearch16u::key#0 - (signed word)*((word*) bsearch16u::pivot#0)
[166] if((signed word) bsearch16u::result#0!=(signed byte) 0) goto bsearch16u::@6
to:bsearch16u::@8
bsearch16u::@8: scope:[bsearch16u] from bsearch16u::@4
[167] (word*~) bsearch16u::return#6 ← (word*) bsearch16u::pivot#0
to:bsearch16u::@return
bsearch16u::@6: scope:[bsearch16u] from bsearch16u::@4
[168] if((signed word) bsearch16u::result#0<=(signed byte) 0) goto bsearch16u::@7
to:bsearch16u::@9
bsearch16u::@9: scope:[bsearch16u] from bsearch16u::@6
[169] (word*) bsearch16u::items#0 ← (word*) bsearch16u::pivot#0 + (byte) 1*(const byte) SIZEOF_WORD
[170] (byte) bsearch16u::num#1 ← -- (byte) bsearch16u::num#3
bsearch16u::@9: scope:[bsearch16u] from bsearch16u::@3
[172] (word*~) bsearch16u::items#16 ← (word*) bsearch16u::items#11
to:bsearch16u::@4
bsearch16u::@10: scope:[bsearch16u] from bsearch16u::@6
[173] (word*~) bsearch16u::items#19 ← (word*) bsearch16u::items#10
to:bsearch16u::@7
bsearch16u::@7: scope:[bsearch16u] from bsearch16u::@6 bsearch16u::@9
[171] (word*) bsearch16u::items#8 ← phi( bsearch16u::@9/(word*) bsearch16u::items#0 bsearch16u::@6/(word*) bsearch16u::items#2 )
[171] (byte) bsearch16u::num#5 ← phi( bsearch16u::@9/(byte) bsearch16u::num#1 bsearch16u::@6/(byte) bsearch16u::num#3 )
[172] (byte) bsearch16u::num#0 ← (byte) bsearch16u::num#5 >> (byte) 1
to:bsearch16u::@3
sqr: scope:[sqr] from init_dist_screen::@4 init_dist_screen::@8
[173] (byte) sqr::val#2 ← phi( init_dist_screen::@4/(byte) sqr::val#0 init_dist_screen::@8/(byte) sqr::val#1 )
[174] (byte~) sqr::$0 ← (byte) sqr::val#2 << (byte) 1
[175] (word) sqr::return#0 ← *((word*)(void*) SQUARES#1 + (byte~) sqr::$0)
[174] (byte) sqr::val#2 ← phi( init_dist_screen::@4/(byte) sqr::val#0 init_dist_screen::@8/(byte) sqr::val#1 )
[175] (byte~) sqr::$0 ← (byte) sqr::val#2 << (byte) 1
[176] (word) sqr::return#0 ← *((word*)(void*) SQUARES#1 + (byte~) sqr::$0)
to:sqr::@return
sqr::@return: scope:[sqr] from sqr
[176] return
[177] return
to:@return
init_squares: scope:[init_squares] from init_dist_screen
[177] phi()
[178] call malloc
[178] phi()
[179] call malloc
to:init_squares::@2
init_squares::@2: scope:[init_squares] from init_squares
[179] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0
[180] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1
[180] (void*) SQUARES#1 ← (void*)(byte*) malloc::mem#0
[181] (word*) init_squares::squares#0 ← (word*)(void*) SQUARES#1
to:init_squares::@1
init_squares::@1: scope:[init_squares] from init_squares::@1 init_squares::@2
[181] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares::@2/(byte) 0 )
[181] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares::@2/(word*) init_squares::squares#0 )
[181] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares::@2/(byte) 0 )
[182] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[183] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[184] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[185] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[186] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[187] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[188] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
[182] (byte) init_squares::i#2 ← phi( init_squares::@1/(byte) init_squares::i#1 init_squares::@2/(byte) 0 )
[182] (word*) init_squares::squares#2 ← phi( init_squares::@1/(word*) init_squares::squares#1 init_squares::@2/(word*) init_squares::squares#0 )
[182] (word) init_squares::sqr#2 ← phi( init_squares::@1/(word) init_squares::sqr#1 init_squares::@2/(byte) 0 )
[183] *((word*) init_squares::squares#2) ← (word) init_squares::sqr#2
[184] (word*) init_squares::squares#1 ← (word*) init_squares::squares#2 + (const byte) SIZEOF_WORD
[185] (byte~) init_squares::$3 ← (byte) init_squares::i#2 << (byte) 1
[186] (byte~) init_squares::$4 ← (byte~) init_squares::$3 + (byte) 1
[187] (word) init_squares::sqr#1 ← (word) init_squares::sqr#2 + (byte~) init_squares::$4
[188] (byte) init_squares::i#1 ← ++ (byte) init_squares::i#2
[189] if((byte) init_squares::i#1!=(const byte) NUM_SQUARES#3-(byte) 1+(byte) 1) goto init_squares::@1
to:init_squares::@return
init_squares::@return: scope:[init_squares] from init_squares::@1
[189] return
[190] return
to:@return
malloc: scope:[malloc] from @1 @3 init_squares
[190] (word) malloc::size#3 ← phi( @1/(word) $3e8 @3/(word) $3e8 init_squares/(const byte) NUM_SQUARES#3*(const byte) SIZEOF_WORD )
[190] (byte*) heap_head#12 ← phi( @1/(const byte*) HEAP_TOP#0 @3/(byte*) heap_head#1 init_squares/(byte*) heap_head#1 )
[191] (byte*) malloc::mem#0 ← (byte*) heap_head#12 - (word) malloc::size#3
[192] (byte*) heap_head#1 ← (byte*) malloc::mem#0
[191] (word) malloc::size#3 ← phi( @1/(word) $3e8 @3/(word) $3e8 init_squares/(const byte) NUM_SQUARES#3*(const byte) SIZEOF_WORD )
[191] (byte*) heap_head#12 ← phi( @1/(const byte*) HEAP_TOP#0 @3/(byte*) heap_head#1 init_squares/(byte*) heap_head#1 )
[192] (byte*) malloc::mem#0 ← (byte*) heap_head#12 - (word) malloc::size#3
[193] (byte*) heap_head#1 ← (byte*) malloc::mem#0
to:malloc::@return
malloc::@return: scope:[malloc] from malloc
[193] return
[194] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -21,19 +21,19 @@
(const byte) RADIX::HEXADECIMAL HEXADECIMAL = (number) $10
(const byte) RADIX::OCTAL OCTAL = (number) 8
(byte*) SCREEN_ANGLE
(void*) SCREEN_ANGLE#0 SCREEN_ANGLE zp ZP_WORD:13 0.08695652173913043
(void*) SCREEN_ANGLE#0 SCREEN_ANGLE zp ZP_WORD:17 0.08695652173913043
(byte*) SCREEN_DIST
(void*) SCREEN_DIST#0 SCREEN_DIST zp ZP_WORD:11 0.08
(void*) SCREEN_DIST#0 SCREEN_DIST zp ZP_WORD:15 0.08
(byte*) SCREEN_FILL
(const byte*) SCREEN_FILL#0 SCREEN_FILL = (byte*) 1024
(const byte) SIZEOF_WORD SIZEOF_WORD = (byte) 2
(word*) SQUARES
(void*) SQUARES#1 SQUARES zp ZP_WORD:17 0.03225806451612903
(void*) SQUARES#1 SQUARES zp ZP_WORD:19 0.03225806451612903
(word()) atan2_16((signed word) atan2_16::x , (signed word) atan2_16::y)
(signed word~) atan2_16::$2 $2 zp ZP_WORD:20 4.0
(signed word~) atan2_16::$2 $2 zp ZP_WORD:13 4.0
(byte~) atan2_16::$23 reg byte a 2002.0
(byte~) atan2_16::$24 reg byte a 2002.0
(signed word~) atan2_16::$7 $7 zp ZP_WORD:22 4.0
(signed word~) atan2_16::$7 $7 zp ZP_WORD:24 4.0
(label) atan2_16::@1
(label) atan2_16::@10
(label) atan2_16::@11
@ -57,60 +57,61 @@
(label) atan2_16::@9
(label) atan2_16::@return
(word) atan2_16::angle
(word) atan2_16::angle#1 angle zp ZP_WORD:24 3.0
(word) atan2_16::angle#11 angle zp ZP_WORD:24 4.0
(word) atan2_16::angle#12 angle zp ZP_WORD:24 190.66666666666666
(word) atan2_16::angle#13 angle zp ZP_WORD:24 1334.6666666666667
(word) atan2_16::angle#2 angle zp ZP_WORD:24 2002.0
(word) atan2_16::angle#3 angle zp ZP_WORD:24 2002.0
(word) atan2_16::angle#4 angle zp ZP_WORD:24 4.0
(word) atan2_16::angle#5 angle zp ZP_WORD:24 4.0
(word) atan2_16::angle#6 angle zp ZP_WORD:24 2004.0
(word) atan2_16::angle#1 angle zp ZP_WORD:26 3.0
(word) atan2_16::angle#11 angle zp ZP_WORD:26 4.0
(word) atan2_16::angle#12 angle zp ZP_WORD:26 190.66666666666666
(word) atan2_16::angle#13 angle zp ZP_WORD:26 1334.6666666666667
(word) atan2_16::angle#2 angle zp ZP_WORD:26 2002.0
(word) atan2_16::angle#3 angle zp ZP_WORD:26 2002.0
(word) atan2_16::angle#4 angle zp ZP_WORD:26 4.0
(word) atan2_16::angle#5 angle zp ZP_WORD:26 4.0
(word) atan2_16::angle#6 angle zp ZP_WORD:26 2004.0
(byte) atan2_16::i
(byte) atan2_16::i#1 reg byte x 1501.5
(byte) atan2_16::i#2 reg byte x 208.54166666666669
(word) atan2_16::return
(word) atan2_16::return#0 return zp ZP_WORD:24 34.99999999999999
(word) atan2_16::return#2 return zp ZP_WORD:24 202.0
(word) atan2_16::return#0 return zp ZP_WORD:26 34.99999999999999
(word) atan2_16::return#2 return zp ZP_WORD:26 202.0
(byte) atan2_16::shift
(byte) atan2_16::shift#1 reg byte y 20002.0
(byte) atan2_16::shift#2 reg byte y 8001.25
(byte~) atan2_16::shift#5 reg byte y 667.3333333333334
(signed word) atan2_16::x
(signed word) atan2_16::x#0 x zp ZP_WORD:15 2.8684210526315796
(signed word) atan2_16::x#0 x zp ZP_WORD:19 2.8684210526315796
(signed word) atan2_16::xd
(signed word) atan2_16::xd#1 xd zp ZP_WORD:3 6667.333333333333
(signed word~) atan2_16::xd#10 xd zp ZP_WORD:3 1001.0
(signed word) atan2_16::xd#2 xd zp ZP_WORD:3 1001.0
(signed word) atan2_16::xd#3 xd zp ZP_WORD:3 7668.333333333332
(signed word) atan2_16::xd#5 xd zp ZP_WORD:3 1001.0
(signed word) atan2_16::xd#1 xd zp ZP_WORD:5 6667.333333333333
(signed word~) atan2_16::xd#10 xd zp ZP_WORD:5 1001.0
(signed word) atan2_16::xd#2 xd zp ZP_WORD:5 1001.0
(signed word) atan2_16::xd#3 xd zp ZP_WORD:5 7668.333333333332
(signed word) atan2_16::xd#5 xd zp ZP_WORD:5 1001.0
(signed word) atan2_16::xi
(signed word) atan2_16::xi#0 xi zp ZP_WORD:22 6.0
(signed word) atan2_16::xi#1 xi zp ZP_WORD:22 500.5
(signed word~) atan2_16::xi#13 xi zp ZP_WORD:22 4.0
(signed word) atan2_16::xi#2 xi zp ZP_WORD:22 500.5
(signed word) atan2_16::xi#3 xi zp ZP_WORD:22 267.0666666666667
(signed word) atan2_16::xi#8 xi zp ZP_WORD:22 1001.0
(signed word) atan2_16::xi#0 xi zp ZP_WORD:24 6.0
(signed word) atan2_16::xi#1 xi zp ZP_WORD:24 500.5
(signed word~) atan2_16::xi#13 xi zp ZP_WORD:24 4.0
(signed word) atan2_16::xi#2 xi zp ZP_WORD:24 500.5
(signed word) atan2_16::xi#3 xi zp ZP_WORD:24 267.0666666666667
(signed word) atan2_16::xi#8 xi zp ZP_WORD:24 1001.0
(signed word) atan2_16::y
(signed word) atan2_16::y#0 y zp ZP_WORD:17 2.724999999999999
(signed word) atan2_16::y#0 y zp ZP_WORD:22 2.724999999999999
(signed word) atan2_16::yd
(signed word) atan2_16::yd#1 yd zp ZP_WORD:26 10001.0
(signed word~) atan2_16::yd#10 yd zp ZP_WORD:26 2002.0
(signed word) atan2_16::yd#2 yd zp ZP_WORD:26 2002.0
(signed word) atan2_16::yd#3 yd zp ZP_WORD:26 4601.0
(signed word) atan2_16::yd#5 yd zp ZP_WORD:26 2002.0
(signed word) atan2_16::yd#1 yd zp ZP_WORD:2 10001.0
(signed word~) atan2_16::yd#10 yd zp ZP_WORD:2 2002.0
(signed word) atan2_16::yd#2 yd zp ZP_WORD:2 2002.0
(signed word) atan2_16::yd#3 yd zp ZP_WORD:2 4601.0
(signed word) atan2_16::yd#5 yd zp ZP_WORD:2 2002.0
(signed word) atan2_16::yi
(signed word) atan2_16::yi#0 yi zp ZP_WORD:20 1.2000000000000002
(signed word) atan2_16::yi#1 yi zp ZP_WORD:20 667.3333333333334
(signed word~) atan2_16::yi#16 yi zp ZP_WORD:20 4.0
(signed word) atan2_16::yi#2 yi zp ZP_WORD:20 667.3333333333334
(signed word) atan2_16::yi#3 yi zp ZP_WORD:20 353.4117647058823
(signed word) atan2_16::yi#8 yi zp ZP_WORD:20 1001.0
(signed word) atan2_16::yi#0 yi zp ZP_WORD:13 1.2000000000000002
(signed word) atan2_16::yi#1 yi zp ZP_WORD:13 667.3333333333334
(signed word~) atan2_16::yi#16 yi zp ZP_WORD:13 4.0
(signed word) atan2_16::yi#2 yi zp ZP_WORD:13 667.3333333333334
(signed word) atan2_16::yi#3 yi zp ZP_WORD:13 353.4117647058823
(signed word) atan2_16::yi#8 yi zp ZP_WORD:13 1001.0
(word*()) bsearch16u((word) bsearch16u::key , (word*) bsearch16u::items , (byte) bsearch16u::num)
(byte~) bsearch16u::$16 reg byte a 2002.0
(word*~) bsearch16u::$2 $2 zp ZP_WORD:9 4.0
(word*~) bsearch16u::$2 $2 zp ZP_WORD:13 4.0
(byte~) bsearch16u::$6 reg byte a 2002.0
(label) bsearch16u::@1
(label) bsearch16u::@10
(label) bsearch16u::@2
(label) bsearch16u::@3
(label) bsearch16u::@4
@ -121,31 +122,32 @@
(label) bsearch16u::@9
(label) bsearch16u::@return
(word*) bsearch16u::items
(word*) bsearch16u::items#0 items zp ZP_WORD:9 1001.0
(word*) bsearch16u::items#1 items zp ZP_WORD:9 2.0
(word*) bsearch16u::items#2 items zp ZP_WORD:9 334.5555555555556
(word*) bsearch16u::items#8 items zp ZP_WORD:9 1501.5
(word*) bsearch16u::items#0 items zp ZP_WORD:13 1001.0
(word*) bsearch16u::items#1 items#1 zp ZP_WORD:11 2.0
(word*) bsearch16u::items#10 items#10 zp ZP_WORD:11 429.2857142857143
(word*) bsearch16u::items#11 items zp ZP_WORD:13 752.25
(word*~) bsearch16u::items#16 items#16 zp ZP_WORD:11 2002.0
(word*~) bsearch16u::items#19 items zp ZP_WORD:13 2002.0
(word) bsearch16u::key
(word) bsearch16u::key#0 key zp ZP_WORD:22 0.26666666666666666
(word) bsearch16u::key#0 key zp ZP_WORD:24 0.23529411764705882
(byte) bsearch16u::num
(byte) bsearch16u::num#0 reg byte x 2002.0
(byte) bsearch16u::num#0 reg byte x 1001.0
(byte) bsearch16u::num#1 reg byte x 2002.0
(byte) bsearch16u::num#3 reg byte x 556.1111111111111
(byte) bsearch16u::num#10 reg byte x 444.8888888888889
(byte) bsearch16u::num#5 reg byte x 3003.0
(word*) bsearch16u::pivot
(word*) bsearch16u::pivot#0 pivot zp ZP_WORD:24 501.0
(word*) bsearch16u::pivot#0 pivot zp ZP_WORD:13 750.75
(signed word) bsearch16u::result
(signed word) bsearch16u::result#0 result zp ZP_WORD:26 1501.5
(word*) bsearch16u::return
(word*) bsearch16u::return#1 return zp ZP_WORD:9 2.0
(word*) bsearch16u::return#2 return zp ZP_WORD:9 6.0
(word*) bsearch16u::return#3 return zp ZP_WORD:9 4.0
(word*~) bsearch16u::return#6 return zp ZP_WORD:9 4.0
(word*) bsearch16u::return#1 return zp ZP_WORD:13 335.00000000000006
(word*) bsearch16u::return#2 return zp ZP_WORD:13 6.0
(word*) bsearch16u::return#3 return zp ZP_WORD:13 4.0
(byte*) heap_head
(byte*) heap_head#1 heap_head zp ZP_WORD:15 0.6000000000000001
(byte*) heap_head#12 heap_head zp ZP_WORD:15 6.0
(byte*) heap_head#1 heap_head zp ZP_WORD:13 0.6000000000000001
(byte*) heap_head#12 heap_head zp ZP_WORD:13 6.0
(void()) init_angle_screen((byte*) init_angle_screen::screen)
(word~) init_angle_screen::$10 $10 zp ZP_WORD:24 202.0
(word~) init_angle_screen::$10 $10 zp ZP_WORD:26 202.0
(byte~) init_angle_screen::$12 reg byte a 202.0
(byte~) init_angle_screen::$13 reg byte a 202.0
(byte~) init_angle_screen::$14 reg byte a 202.0
@ -158,32 +160,32 @@
(label) init_angle_screen::@4
(label) init_angle_screen::@return
(byte) init_angle_screen::ang_w
(byte) init_angle_screen::ang_w#0 ang_w zp ZP_BYTE:19 84.16666666666666
(byte) init_angle_screen::ang_w#0 ang_w zp ZP_BYTE:21 84.16666666666666
(word) init_angle_screen::angle_w
(word) init_angle_screen::angle_w#0 angle_w zp ZP_WORD:24 202.0
(word) init_angle_screen::angle_w#0 angle_w zp ZP_WORD:26 202.0
(byte*) init_angle_screen::screen
(byte*) init_angle_screen::screen#0 screen zp ZP_WORD:7 3.0
(byte*) init_angle_screen::screen#0 screen zp ZP_WORD:9 3.0
(byte*) init_angle_screen::screen_bottomline
(byte*) init_angle_screen::screen_bottomline#0 screen_bottomline zp ZP_WORD:7 4.0
(byte*) init_angle_screen::screen_bottomline#1 screen_bottomline zp ZP_WORD:7 7.333333333333333
(byte*) init_angle_screen::screen_bottomline#5 screen_bottomline zp ZP_WORD:7 9.040000000000001
(byte*) init_angle_screen::screen_bottomline#0 screen_bottomline zp ZP_WORD:9 4.0
(byte*) init_angle_screen::screen_bottomline#1 screen_bottomline zp ZP_WORD:9 7.333333333333333
(byte*) init_angle_screen::screen_bottomline#5 screen_bottomline zp ZP_WORD:9 9.040000000000001
(byte*) init_angle_screen::screen_topline
(byte*) init_angle_screen::screen_topline#0 screen_topline zp ZP_WORD:9 2.0
(byte*) init_angle_screen::screen_topline#1 screen_topline zp ZP_WORD:9 5.5
(byte*) init_angle_screen::screen_topline#5 screen_topline zp ZP_WORD:9 9.416666666666666
(byte*) init_angle_screen::screen_topline#0 screen_topline zp ZP_WORD:11 2.0
(byte*) init_angle_screen::screen_topline#1 screen_topline zp ZP_WORD:11 5.5
(byte*) init_angle_screen::screen_topline#5 screen_topline zp ZP_WORD:11 9.416666666666666
(byte) init_angle_screen::x
(byte) init_angle_screen::x#1 x zp ZP_BYTE:5 101.0
(byte) init_angle_screen::x#2 x zp ZP_BYTE:5 25.25
(byte) init_angle_screen::x#1 x zp ZP_BYTE:7 101.0
(byte) init_angle_screen::x#2 x zp ZP_BYTE:7 25.25
(byte) init_angle_screen::xb
(byte) init_angle_screen::xb#1 xb zp ZP_BYTE:6 101.0
(byte) init_angle_screen::xb#2 xb zp ZP_BYTE:6 19.238095238095237
(byte) init_angle_screen::xb#1 xb zp ZP_BYTE:8 101.0
(byte) init_angle_screen::xb#2 xb zp ZP_BYTE:8 19.238095238095237
(signed word) init_angle_screen::xw
(word) init_angle_screen::xw#0 xw zp ZP_WORD:15 33.666666666666664
(word) init_angle_screen::xw#0 xw zp ZP_WORD:19 33.666666666666664
(byte) init_angle_screen::y
(byte) init_angle_screen::y#1 y zp ZP_BYTE:2 16.5
(byte) init_angle_screen::y#4 y zp ZP_BYTE:2 4.730769230769231
(byte) init_angle_screen::y#1 y zp ZP_BYTE:4 16.5
(byte) init_angle_screen::y#4 y zp ZP_BYTE:4 4.730769230769231
(signed word) init_angle_screen::yw
(word) init_angle_screen::yw#0 yw zp ZP_WORD:17 50.5
(word) init_angle_screen::yw#0 yw zp ZP_WORD:22 50.5
(void()) init_dist_screen((byte*) init_dist_screen::screen)
(byte~) init_dist_screen::$13 reg byte a 202.0
(byte~) init_dist_screen::$15 reg byte a 202.0
@ -206,37 +208,37 @@
(byte) init_dist_screen::d
(byte) init_dist_screen::d#0 reg byte a 126.25
(word) init_dist_screen::ds
(word) init_dist_screen::ds#0 ds zp ZP_WORD:22 202.0
(word) init_dist_screen::ds#0 ds zp ZP_WORD:24 202.0
(byte*) init_dist_screen::screen
(byte*) init_dist_screen::screen#0 screen zp ZP_WORD:3 1.5
(byte*) init_dist_screen::screen#0 screen zp ZP_WORD:5 1.5
(byte*) init_dist_screen::screen_bottomline
(byte*) init_dist_screen::screen_bottomline#0 screen_bottomline zp ZP_WORD:7 4.0
(byte*) init_dist_screen::screen_bottomline#1 screen_bottomline zp ZP_WORD:7 7.333333333333333
(byte*) init_dist_screen::screen_bottomline#10 screen_bottomline zp ZP_WORD:7 6.848484848484849
(byte*) init_dist_screen::screen_bottomline#0 screen_bottomline zp ZP_WORD:9 4.0
(byte*) init_dist_screen::screen_bottomline#1 screen_bottomline zp ZP_WORD:9 7.333333333333333
(byte*) init_dist_screen::screen_bottomline#10 screen_bottomline zp ZP_WORD:9 6.848484848484849
(byte*) init_dist_screen::screen_topline
(byte*) init_dist_screen::screen_topline#1 screen_topline zp ZP_WORD:3 5.5
(byte*) init_dist_screen::screen_topline#10 screen_topline zp ZP_WORD:3 7.0625
(byte*) init_dist_screen::screen_topline#1 screen_topline zp ZP_WORD:5 5.5
(byte*) init_dist_screen::screen_topline#10 screen_topline zp ZP_WORD:5 7.0625
(byte) init_dist_screen::x
(byte) init_dist_screen::x#1 x zp ZP_BYTE:5 101.0
(byte) init_dist_screen::x#2 x zp ZP_BYTE:5 26.578947368421055
(byte) init_dist_screen::x#1 x zp ZP_BYTE:7 101.0
(byte) init_dist_screen::x#2 x zp ZP_BYTE:7 26.578947368421055
(byte) init_dist_screen::x2
(byte) init_dist_screen::x2#0 reg byte a 202.0
(byte) init_dist_screen::xb
(byte) init_dist_screen::xb#1 xb zp ZP_BYTE:6 101.0
(byte) init_dist_screen::xb#2 xb zp ZP_BYTE:6 20.2
(byte) init_dist_screen::xb#1 xb zp ZP_BYTE:8 101.0
(byte) init_dist_screen::xb#2 xb zp ZP_BYTE:8 20.2
(byte) init_dist_screen::xd
(byte) init_dist_screen::xd#0 reg byte a 303.0
(word) init_dist_screen::xds
(word) init_dist_screen::xds#0 xds zp ZP_WORD:22 202.0
(word) init_dist_screen::xds#0 xds zp ZP_WORD:24 202.0
(byte) init_dist_screen::y
(byte) init_dist_screen::y#1 y zp ZP_BYTE:2 16.5
(byte) init_dist_screen::y#10 y zp ZP_BYTE:2 0.9705882352941178
(byte) init_dist_screen::y#1 y zp ZP_BYTE:4 16.5
(byte) init_dist_screen::y#10 y zp ZP_BYTE:4 0.9705882352941178
(byte) init_dist_screen::y2
(byte) init_dist_screen::y2#0 reg byte a 22.0
(byte) init_dist_screen::yd
(byte) init_dist_screen::yd#0 reg byte a 33.0
(word) init_dist_screen::yds
(word) init_dist_screen::yds#0 yds zp ZP_WORD:20 4.869565217391305
(word) init_dist_screen::yds#0 yds zp ZP_WORD:22 4.869565217391305
(void()) init_squares()
(byte~) init_squares::$3 reg byte a 22.0
(byte~) init_squares::$4 reg byte a 22.0
@ -247,12 +249,12 @@
(byte) init_squares::i#1 reg byte x 16.5
(byte) init_squares::i#2 reg byte x 5.5
(word) init_squares::sqr
(word) init_squares::sqr#1 sqr zp ZP_WORD:7 7.333333333333333
(word) init_squares::sqr#2 sqr zp ZP_WORD:7 6.6000000000000005
(word) init_squares::sqr#1 sqr zp ZP_WORD:9 7.333333333333333
(word) init_squares::sqr#2 sqr zp ZP_WORD:9 6.6000000000000005
(word*) init_squares::squares
(word*) init_squares::squares#0 squares zp ZP_WORD:9 4.0
(word*) init_squares::squares#1 squares zp ZP_WORD:9 3.6666666666666665
(word*) init_squares::squares#2 squares zp ZP_WORD:9 17.5
(word*) init_squares::squares#0 squares zp ZP_WORD:11 4.0
(word*) init_squares::squares#1 squares zp ZP_WORD:11 3.6666666666666665
(word*) init_squares::squares#2 squares zp ZP_WORD:11 17.5
(void()) main()
(label) main::@1
(label) main::@10
@ -267,97 +269,97 @@
(label) main::@9
(label) main::@return
(byte*) main::angle
(byte*) main::angle#0 angle zp ZP_WORD:20 22.0
(byte*) main::angle#1 angle zp ZP_WORD:20 50.5
(byte*) main::angle#2 angle zp ZP_WORD:20 34.888888888888886
(byte*) main::angle#0 angle zp ZP_WORD:13 22.0
(byte*) main::angle#1 angle zp ZP_WORD:13 50.5
(byte*) main::angle#2 angle zp ZP_WORD:13 34.888888888888886
(byte*) main::dist
(byte*) main::dist#0 dist zp ZP_WORD:9 11.0
(byte*) main::dist#1 dist zp ZP_WORD:9 40.4
(byte*) main::dist#2 dist zp ZP_WORD:9 39.25
(byte*) main::dist#0 dist zp ZP_WORD:11 11.0
(byte*) main::dist#1 dist zp ZP_WORD:11 40.4
(byte*) main::dist#2 dist zp ZP_WORD:11 39.25
(word) main::dist_angle
(word) main::dist_angle#0 dist_angle zp ZP_WORD:26 101.0
(word) main::dist_angle#0 dist_angle zp ZP_WORD:2 101.0
(byte*) main::fill
(byte*) main::fill#1 fill zp ZP_WORD:7 101.0
(byte*) main::fill#2 fill zp ZP_WORD:7 40.4
(byte*) main::fill#1 fill zp ZP_WORD:9 101.0
(byte*) main::fill#2 fill zp ZP_WORD:9 40.4
(word) main::min_dist_angle
(word) main::min_dist_angle#2 min_dist_angle zp ZP_WORD:22 101.0
(word) main::min_dist_angle#3 min_dist_angle#3 zp ZP_WORD:26 83.0
(word~) main::min_dist_angle#6 min_dist_angle zp ZP_WORD:22 202.0
(word~) main::min_dist_angle#7 min_dist_angle#7 zp ZP_WORD:26 202.0
(word~) main::min_dist_angle#8 min_dist_angle#8 zp ZP_WORD:26 202.0
(word) main::min_dist_angle#2 min_dist_angle zp ZP_WORD:24 101.0
(word) main::min_dist_angle#3 min_dist_angle#3 zp ZP_WORD:2 83.0
(word~) main::min_dist_angle#6 min_dist_angle zp ZP_WORD:24 202.0
(word~) main::min_dist_angle#7 min_dist_angle#7 zp ZP_WORD:2 202.0
(word~) main::min_dist_angle#8 min_dist_angle#8 zp ZP_WORD:2 202.0
(byte*) main::min_fill
(byte*~) main::min_fill#10 min_fill zp ZP_WORD:24 202.0
(byte*) main::min_fill#2 min_fill zp ZP_WORD:24 59.285714285714285
(byte*) main::min_fill#5 min_fill zp ZP_WORD:24 50.5
(byte*~) main::min_fill#10 min_fill zp ZP_WORD:26 202.0
(byte*) main::min_fill#2 min_fill zp ZP_WORD:26 59.285714285714285
(byte*) main::min_fill#5 min_fill zp ZP_WORD:26 50.5
(void*()) malloc((word) malloc::size)
(label) malloc::@return
(byte*) malloc::mem
(byte*) malloc::mem#0 mem zp ZP_WORD:17 0.6666666666666666
(byte*) malloc::mem#0 mem zp ZP_WORD:19 0.6666666666666666
(void*) malloc::return
(word) malloc::size
(word) malloc::size#3 size zp ZP_WORD:17 2.0
(word) malloc::size#3 size zp ZP_WORD:19 2.0
(word()) sqr((byte) sqr::val)
(byte~) sqr::$0 reg byte a 4.0
(label) sqr::@return
(word) sqr::return
(word) sqr::return#0 return zp ZP_WORD:22 28.5
(word) sqr::return#2 return#2 zp ZP_WORD:20 22.0
(word) sqr::return#3 return zp ZP_WORD:22 202.0
(word) sqr::return#0 return zp ZP_WORD:24 28.5
(word) sqr::return#2 return#2 zp ZP_WORD:22 22.0
(word) sqr::return#3 return zp ZP_WORD:24 202.0
(byte) sqr::val
(byte) sqr::val#0 reg byte a 22.0
(byte) sqr::val#1 reg byte a 202.0
(byte) sqr::val#2 reg byte a 114.0
(byte()) sqrt((word) sqrt::val)
(word~) sqrt::$1 $1 zp ZP_WORD:9 2.0
(word~) sqrt::$3 $3 zp ZP_WORD:9 4.0
(word~) sqrt::$1 $1 zp ZP_WORD:13 2.0
(word~) sqrt::$3 $3 zp ZP_WORD:13 4.0
(label) sqrt::@1
(label) sqrt::@return
(word*) sqrt::found
(word*) sqrt::found#0 found zp ZP_WORD:9 4.0
(word*) sqrt::found#0 found zp ZP_WORD:13 4.0
(byte) sqrt::return
(byte) sqrt::return#0 reg byte a 34.33333333333333
(byte) sqrt::return#2 reg byte a 202.0
(byte) sqrt::sq
(word) sqrt::val
(word) sqrt::val#0 val zp ZP_WORD:22 103.0
(word) sqrt::val#0 val zp ZP_WORD:24 103.0
reg byte x [ atan2_16::i#2 atan2_16::i#1 ]
reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ]
zp ZP_BYTE:2 [ init_dist_screen::y#10 init_dist_screen::y#1 init_angle_screen::y#4 init_angle_screen::y#1 ]
zp ZP_WORD:3 [ init_dist_screen::screen_topline#10 init_dist_screen::screen_topline#1 init_dist_screen::screen#0 atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ]
zp ZP_WORD:2 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 main::min_dist_angle#3 main::min_dist_angle#7 main::min_dist_angle#8 main::dist_angle#0 ]
zp ZP_BYTE:4 [ init_dist_screen::y#10 init_dist_screen::y#1 init_angle_screen::y#4 init_angle_screen::y#1 ]
zp ZP_WORD:5 [ init_dist_screen::screen_topline#10 init_dist_screen::screen_topline#1 init_dist_screen::screen#0 atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ]
reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ]
zp ZP_BYTE:5 [ init_dist_screen::x#2 init_dist_screen::x#1 init_angle_screen::x#2 init_angle_screen::x#1 ]
zp ZP_BYTE:6 [ init_dist_screen::xb#2 init_dist_screen::xb#1 init_angle_screen::xb#2 init_angle_screen::xb#1 ]
zp ZP_BYTE:7 [ init_dist_screen::x#2 init_dist_screen::x#1 init_angle_screen::x#2 init_angle_screen::x#1 ]
zp ZP_BYTE:8 [ init_dist_screen::xb#2 init_dist_screen::xb#1 init_angle_screen::xb#2 init_angle_screen::xb#1 ]
reg byte a [ init_dist_screen::xd#0 init_dist_screen::$15 init_dist_screen::$13 ]
reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ]
reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#10 bsearch16u::num#0 ]
reg byte a [ sqr::val#2 sqr::val#0 sqr::val#1 ]
zp ZP_WORD:7 [ init_squares::sqr#2 init_squares::sqr#1 init_dist_screen::screen_bottomline#10 init_dist_screen::screen_bottomline#1 init_dist_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#5 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 init_angle_screen::screen#0 main::fill#2 main::fill#1 ]
zp ZP_WORD:9 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 bsearch16u::return#1 bsearch16u::return#6 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#1 bsearch16u::items#8 bsearch16u::$2 bsearch16u::items#0 bsearch16u::return#3 sqrt::found#0 sqrt::$3 sqrt::$1 init_angle_screen::screen_topline#5 init_angle_screen::screen_topline#0 init_angle_screen::screen_topline#1 main::dist#2 main::dist#0 main::dist#1 ]
zp ZP_WORD:9 [ init_squares::sqr#2 init_squares::sqr#1 init_dist_screen::screen_bottomline#10 init_dist_screen::screen_bottomline#1 init_dist_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#5 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 init_angle_screen::screen#0 main::fill#2 main::fill#1 ]
zp ZP_WORD:11 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 bsearch16u::items#10 bsearch16u::items#16 bsearch16u::items#1 init_angle_screen::screen_topline#5 init_angle_screen::screen_topline#0 init_angle_screen::screen_topline#1 main::dist#2 main::dist#0 main::dist#1 ]
reg byte x [ init_squares::i#2 init_squares::i#1 ]
zp ZP_WORD:11 [ SCREEN_DIST#0 ]
zp ZP_WORD:13 [ SCREEN_ANGLE#0 ]
zp ZP_WORD:13 [ heap_head#12 heap_head#1 bsearch16u::return#1 bsearch16u::pivot#0 bsearch16u::return#2 bsearch16u::items#11 bsearch16u::items#0 bsearch16u::items#19 bsearch16u::$2 bsearch16u::return#3 sqrt::found#0 sqrt::$3 sqrt::$1 atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 main::angle#2 main::angle#0 main::angle#1 ]
zp ZP_WORD:15 [ SCREEN_DIST#0 ]
zp ZP_WORD:17 [ SCREEN_ANGLE#0 ]
reg byte a [ init_angle_screen::$2 ]
reg byte a [ init_angle_screen::$3 ]
zp ZP_WORD:15 [ init_angle_screen::xw#0 atan2_16::x#0 heap_head#12 heap_head#1 ]
zp ZP_WORD:19 [ init_angle_screen::xw#0 atan2_16::x#0 malloc::size#3 malloc::mem#0 SQUARES#1 ]
reg byte a [ init_angle_screen::$6 ]
zp ZP_WORD:17 [ init_angle_screen::yw#0 atan2_16::y#0 malloc::size#3 malloc::mem#0 SQUARES#1 ]
zp ZP_BYTE:19 [ init_angle_screen::ang_w#0 ]
zp ZP_BYTE:21 [ init_angle_screen::ang_w#0 ]
reg byte a [ init_angle_screen::$12 ]
reg byte a [ init_angle_screen::$13 ]
reg byte a [ init_angle_screen::$14 ]
reg byte a [ atan2_16::$24 ]
reg byte a [ atan2_16::$23 ]
reg byte a [ init_dist_screen::y2#0 ]
zp ZP_WORD:20 [ sqr::return#2 init_dist_screen::yds#0 atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 main::angle#2 main::angle#0 main::angle#1 ]
zp ZP_WORD:22 [ sqr::return#2 init_dist_screen::yds#0 init_angle_screen::yw#0 atan2_16::y#0 ]
reg byte a [ init_dist_screen::x2#0 ]
zp ZP_WORD:22 [ sqr::return#3 init_dist_screen::xds#0 sqr::return#0 init_dist_screen::ds#0 sqrt::val#0 bsearch16u::key#0 atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 main::min_dist_angle#2 main::min_dist_angle#6 ]
zp ZP_WORD:24 [ sqr::return#3 init_dist_screen::xds#0 sqr::return#0 init_dist_screen::ds#0 sqrt::val#0 bsearch16u::key#0 atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 main::min_dist_angle#2 main::min_dist_angle#6 ]
reg byte a [ sqrt::return#2 ]
reg byte a [ init_dist_screen::d#0 ]
reg byte a [ sqrt::return#0 ]
reg byte a [ bsearch16u::$6 ]
reg byte a [ bsearch16u::$16 ]
zp ZP_WORD:24 [ bsearch16u::pivot#0 atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::return#2 init_angle_screen::angle_w#0 init_angle_screen::$10 main::min_fill#5 main::min_fill#2 main::min_fill#10 ]
zp ZP_WORD:26 [ bsearch16u::result#0 atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 main::min_dist_angle#3 main::min_dist_angle#7 main::min_dist_angle#8 main::dist_angle#0 ]
zp ZP_WORD:26 [ bsearch16u::result#0 atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 atan2_16::return#0 atan2_16::angle#5 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::return#2 init_angle_screen::angle_w#0 init_angle_screen::$10 main::min_fill#5 main::min_fill#2 main::min_fill#10 ]
reg byte a [ sqr::$0 ]
reg byte a [ init_squares::$3 ]
reg byte a [ init_squares::$4 ]

View File

@ -4,24 +4,26 @@
.pc = $80d "Program"
main: {
.label screen = $400
ldy #0
ldx #0
b1:
cpx #5+1
bcs b2
txa
ldy #0
b4:
tya
sec
sbc #5
sta screen,y
iny
b3:
sta screen,x
inx
cpx #$b
b3:
iny
cpy #$b
bne b1
rts
b1:
cpy #5+1
bcs b2
jmp b4
b2:
txa
sta screen,y
iny
tya
sta screen,x
inx
jmp b3
}

View File

@ -9,26 +9,27 @@
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::idx#3 ← phi( main/(byte) 0 main::@3/(byte) main::idx#6 )
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@3/(byte) main::i#1 )
[6] if((byte) main::i#2>=(byte) 5+(byte) 1) goto main::@2
to:main::@4
main::@4: scope:[main] from main::@1
[7] (byte~) main::$1 ← (byte) main::i#2 - (byte) 5
[8] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte~) main::$1
[9] (byte) main::idx#2 ← ++ (byte) main::idx#3
main::@4: scope:[main] from main main::@1
[5] (byte) main::idx#8 ← phi( main::@1/(byte) main::idx#3 main/(byte) 0 )
[5] (byte) main::i#7 ← phi( main::@1/(byte) main::i#1 main/(byte) 0 )
[6] (byte~) main::$1 ← (byte) main::i#7 - (byte) 5
[7] *((const byte*) main::screen#0 + (byte) main::idx#8) ← (byte~) main::$1
[8] (byte) main::idx#2 ← ++ (byte) main::idx#8
to:main::@3
main::@3: scope:[main] from main::@2 main::@4
[10] (byte) main::idx#6 ← phi( main::@2/(byte) main::idx#1 main::@4/(byte) main::idx#2 )
[11] (byte) main::i#1 ← ++ (byte) main::i#2
[12] if((byte) main::i#1!=(byte) $b) goto main::@1
[9] (byte) main::i#8 ← phi( main::@2/(byte) main::i#1 main::@4/(byte) main::i#7 )
[9] (byte) main::idx#3 ← phi( main::@2/(byte) main::idx#1 main::@4/(byte) main::idx#2 )
[10] (byte) main::i#1 ← ++ (byte) main::i#8
[11] if((byte) main::i#1!=(byte) $b) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[13] return
[12] return
to:@return
main::@1: scope:[main] from main::@3
[13] if((byte) main::i#1>=(byte) 5+(byte) 1) goto main::@2
to:main::@4
main::@2: scope:[main] from main::@1
[14] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte) main::i#2
[14] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte) main::i#1
[15] (byte) main::idx#1 ← ++ (byte) main::idx#3
to:main::@3

View File

@ -110,6 +110,83 @@ Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [14] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [16] if(main::i#1!=rangelast(0,$a)) goto main::@1 to (number) $b
Rewriting conditional comparison [5] if((byte) main::i#2>(byte) 5) goto main::@2
GRAPH (NEW VERSIONS for main::i#2)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@3
[0] (byte) main::idx#3 ← phi( main/(const byte) main::idx#0 main::@3/(byte) main::idx#6 )
[0] (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@3/(byte) main::i#1 )
[1] if((byte) main::i#2>=(byte) 5+(number) 1) goto main::@2
to:main::@4
main::@2: scope:[main] from main::@1
(byte) main::i#6 ← phi( )
[2] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte) main::i#6
[3] (byte) main::idx#1 ← ++ (byte) main::idx#3
to:main::@3
main::@4: scope:[main] from main::@1
(byte) main::i#7 ← phi( )
[4] (byte~) main::$1 ← (byte) main::i#7 - (byte) 5
[5] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte~) main::$1
[6] (byte) main::idx#2 ← ++ (byte) main::idx#3
to:main::@3
main::@3: scope:[main] from main::@2 main::@4
[7] (byte) main::i#8 ← phi( )
[7] (byte) main::idx#6 ← phi( main::@2/(byte) main::idx#1 main::@4/(byte) main::idx#2 )
[8] (byte) main::i#1 ← ++ (byte) main::i#8
[9] if((byte) main::i#1!=(number) $b) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[10] return
to:@return
@1: scope:[] from @begin
[11] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
GRAPH (NEW VERSIONS for main::idx#3)
@begin: scope:[] from
to:@1
main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@3
[0] (byte) main::idx#3 ← phi( main/(const byte) main::idx#0 main::@3/(byte) main::idx#6 )
[0] (byte) main::i#2 ← phi( main/(const byte) main::i#0 main::@3/(byte) main::i#1 )
[1] if((byte) main::i#2>=(byte) 5+(number) 1) goto main::@2
to:main::@4
main::@2: scope:[main] from main::@1
(byte) main::idx#7 ← phi( )
(byte) main::i#6 ← phi( main::@1/(byte) main::i#2 )
[2] *((const byte*) main::screen#0 + (byte) main::idx#7) ← (byte) main::i#6
[3] (byte) main::idx#1 ← ++ (byte) main::idx#7
to:main::@3
main::@4: scope:[main] from main::@1
(byte) main::idx#8 ← phi( )
(byte) main::i#7 ← phi( main::@1/(byte) main::i#2 )
[4] (byte~) main::$1 ← (byte) main::i#7 - (byte) 5
[5] *((const byte*) main::screen#0 + (byte) main::idx#8) ← (byte~) main::$1
[6] (byte) main::idx#2 ← ++ (byte) main::idx#8
to:main::@3
main::@3: scope:[main] from main::@2 main::@4
[7] (byte) main::i#8 ← phi( main::@2/(byte) main::i#6 main::@4/(byte) main::i#7 )
[7] (byte) main::idx#6 ← phi( main::@2/(byte) main::idx#1 main::@4/(byte) main::idx#2 )
[8] (byte) main::i#1 ← ++ (byte) main::i#8
[9] if((byte) main::i#1!=(number) $b) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[10] return
to:@return
@1: scope:[] from @begin
[11] call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Successful SSA optimization Pass2LoopHeadConstantIdentification
Adding number conversion cast (unumber) 5+1 in if((byte) main::i#2>=(byte) 5+(number) 1) goto main::@2
Adding number conversion cast (unumber) 1 in if((byte) main::i#2>=(unumber)(byte) 5+(number) 1) goto main::@2
Adding number conversion cast (unumber) $b in if((byte) main::i#1!=(number) $b) goto main::@1
@ -121,27 +198,44 @@ Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 1
Finalized unsigned number type (byte) $b
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) main::i#1 = (byte) main::i#2
Alias (byte) main::idx#3 = (byte) main::idx#6
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::i#9 (const byte) main::i#0
Identical Phi Values (byte) main::idx#9 (const byte) main::idx#0
Successful SSA optimization Pass2IdenticalPhiElimination
Removing PHI-reference to removed block (main::@1_1) in block main::@2
Removing PHI-reference to removed block (main::@1_1) in block main::@2
if() condition always false - eliminating [15] if((const byte) main::i#0>=(byte) 5+(byte) 1) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Alias (byte) main::i#1 = (byte) main::i#6
Alias (byte) main::idx#3 = (byte) main::idx#7
Successful SSA optimization Pass2AliasElimination
Inlining constant with var siblings (const byte) main::idx#0
Inlining constant with var siblings (const byte) main::i#0
Constant inlined main::i#0 = (byte) 0
Constant inlined main::idx#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@7(between main::@3 and main::@1)
Added new block during phi lifting main::@7(between main::@1 and main::@4)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1_1
CALL GRAPH
Calls in [] to main:2
Created 3 initial phi equivalence classes
Coalesced [11] main::idx#9 ← main::idx#2
Coalesced [16] main::i#6 ← main::i#1
Coalesced [17] main::idx#7 ← main::idx#6
Coalesced [20] main::idx#8 ← main::idx#1
Created 4 initial phi equivalence classes
Coalesced [11] main::idx#12 ← main::idx#2
Coalesced [12] main::i#12 ← main::i#7
Coalesced [18] main::i#10 ← main::i#1
Coalesced [19] main::idx#10 ← main::idx#3
Coalesced [22] main::idx#11 ← main::idx#1
Coalesced (already) [23] main::i#11 ← main::i#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@1_1
Culled Empty Block (label) main::@7
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
@ -160,27 +254,28 @@ FINAL CONTROL FLOW GRAPH
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::idx#3 ← phi( main/(byte) 0 main::@3/(byte) main::idx#6 )
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@3/(byte) main::i#1 )
[6] if((byte) main::i#2>=(byte) 5+(byte) 1) goto main::@2
to:main::@4
main::@4: scope:[main] from main::@1
[7] (byte~) main::$1 ← (byte) main::i#2 - (byte) 5
[8] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte~) main::$1
[9] (byte) main::idx#2 ← ++ (byte) main::idx#3
main::@4: scope:[main] from main main::@1
[5] (byte) main::idx#8 ← phi( main::@1/(byte) main::idx#3 main/(byte) 0 )
[5] (byte) main::i#7 ← phi( main::@1/(byte) main::i#1 main/(byte) 0 )
[6] (byte~) main::$1 ← (byte) main::i#7 - (byte) 5
[7] *((const byte*) main::screen#0 + (byte) main::idx#8) ← (byte~) main::$1
[8] (byte) main::idx#2 ← ++ (byte) main::idx#8
to:main::@3
main::@3: scope:[main] from main::@2 main::@4
[10] (byte) main::idx#6 ← phi( main::@2/(byte) main::idx#1 main::@4/(byte) main::idx#2 )
[11] (byte) main::i#1 ← ++ (byte) main::i#2
[12] if((byte) main::i#1!=(byte) $b) goto main::@1
[9] (byte) main::i#8 ← phi( main::@2/(byte) main::i#1 main::@4/(byte) main::i#7 )
[9] (byte) main::idx#3 ← phi( main::@2/(byte) main::idx#1 main::@4/(byte) main::idx#2 )
[10] (byte) main::i#1 ← ++ (byte) main::i#8
[11] if((byte) main::i#1!=(byte) $b) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[13] return
[12] return
to:@return
main::@1: scope:[main] from main::@3
[13] if((byte) main::i#1>=(byte) 5+(byte) 1) goto main::@2
to:main::@4
main::@2: scope:[main] from main::@1
[14] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte) main::i#2
[14] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte) main::i#1
[15] (byte) main::idx#1 ← ++ (byte) main::idx#3
to:main::@3
@ -189,25 +284,26 @@ VARIABLE REGISTER WEIGHTS
(void()) main()
(byte~) main::$1 22.0
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 6.875
(byte) main::i#1 121.2
(byte) main::i#7 30.75
(byte) main::i#8 213.0
(byte) main::idx
(byte) main::idx#1 22.0
(byte) main::idx#1 202.0
(byte) main::idx#2 22.0
(byte) main::idx#3 11.0
(byte) main::idx#6 11.0
(byte) main::idx#3 83.0
(byte) main::idx#8 40.99999999999999
(byte*) main::screen
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::idx#3 main::idx#6 main::idx#1 main::idx#2 ]
[ main::idx#8 main::idx#3 main::idx#1 main::idx#2 ]
[ main::i#8 main::i#7 main::i#1 ]
Added variable main::$1 to zero page equivalence class [ main::$1 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::idx#3 main::idx#6 main::idx#1 main::idx#2 ]
[ main::idx#8 main::idx#3 main::idx#1 main::idx#2 ]
[ main::i#8 main::i#7 main::i#1 ]
[ main::$1 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::idx#3 main::idx#6 main::idx#1 main::idx#2 ]
Allocated zp ZP_BYTE:2 [ main::idx#8 main::idx#3 main::idx#1 main::idx#2 ]
Allocated zp ZP_BYTE:3 [ main::i#8 main::i#7 main::i#1 ]
Allocated zp ZP_BYTE:4 [ main::$1 ]
INITIAL ASM
@ -239,62 +335,62 @@ bend:
main: {
.label screen = $400
.label _1 = 4
.label idx = 3
.label i = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::idx#3 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
.label idx = 2
.label i = 3
// [5] phi from main to main::@4 [phi:main->main::@4]
b4_from_main:
// [5] phi (byte) main::idx#8 = (byte) 0 [phi:main->main::@4#0] -- vbuz1=vbuc1
lda #0
sta idx
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#1] -- vbuz1=vbuc1
// [5] phi (byte) main::i#7 = (byte) 0 [phi:main->main::@4#1] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
// [5] phi (byte) main::idx#3 = (byte) main::idx#6 [phi:main::@3->main::@1#0] -- register_copy
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#1] -- register_copy
jmp b1
// main::@1
b1:
// [6] if((byte) main::i#2>=(byte) 5+(byte) 1) goto main::@2 -- vbuz1_ge_vbuc1_then_la1
lda i
cmp #5+1
bcs b2
jmp b4
// main::@4
b4:
// [7] (byte~) main::$1 ← (byte) main::i#2 - (byte) 5 -- vbuz1=vbuz2_minus_vbuc1
// [6] (byte~) main::$1 ← (byte) main::i#7 - (byte) 5 -- vbuz1=vbuz2_minus_vbuc1
lax i
axs #5
stx _1
// [8] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte~) main::$1 -- pbuc1_derefidx_vbuz1=vbuz2
// [7] *((const byte*) main::screen#0 + (byte) main::idx#8) ← (byte~) main::$1 -- pbuc1_derefidx_vbuz1=vbuz2
lda _1
ldy idx
sta screen,y
// [9] (byte) main::idx#2 ← ++ (byte) main::idx#3 -- vbuz1=_inc_vbuz1
// [8] (byte) main::idx#2 ← ++ (byte) main::idx#8 -- vbuz1=_inc_vbuz1
inc idx
// [10] phi from main::@2 main::@4 to main::@3 [phi:main::@2/main::@4->main::@3]
// [9] phi from main::@2 main::@4 to main::@3 [phi:main::@2/main::@4->main::@3]
b3_from_b2:
b3_from_b4:
// [10] phi (byte) main::idx#6 = (byte) main::idx#1 [phi:main::@2/main::@4->main::@3#0] -- register_copy
// [9] phi (byte) main::i#8 = (byte) main::i#1 [phi:main::@2/main::@4->main::@3#0] -- register_copy
// [9] phi (byte) main::idx#3 = (byte) main::idx#1 [phi:main::@2/main::@4->main::@3#1] -- register_copy
jmp b3
// main::@3
b3:
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [10] (byte) main::i#1 ← ++ (byte) main::i#8 -- vbuz1=_inc_vbuz1
inc i
// [12] if((byte) main::i#1!=(byte) $b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [11] if((byte) main::i#1!=(byte) $b) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #$b
cmp i
bne b1_from_b3
bne b1
jmp breturn
// main::@return
breturn:
// [13] return
// [12] return
rts
// main::@1
b1:
// [13] if((byte) main::i#1>=(byte) 5+(byte) 1) goto main::@2 -- vbuz1_ge_vbuc1_then_la1
lda i
cmp #5+1
bcs b2
// [5] phi from main::@1 to main::@4 [phi:main::@1->main::@4]
b4_from_b1:
// [5] phi (byte) main::idx#8 = (byte) main::idx#3 [phi:main::@1->main::@4#0] -- register_copy
// [5] phi (byte) main::i#7 = (byte) main::i#1 [phi:main::@1->main::@4#1] -- register_copy
jmp b4
// main::@2
b2:
// [14] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte) main::i#2 -- pbuc1_derefidx_vbuz1=vbuz2
// [14] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte) main::i#1 -- pbuc1_derefidx_vbuz1=vbuz2
lda i
ldy idx
sta screen,y
@ -305,16 +401,16 @@ main: {
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::idx#3 main::idx#6 main::idx#1 main::idx#2 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:2 [ main::idx#8 main::idx#3 main::idx#1 main::idx#2 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::i#8 main::i#7 main::i#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::$1 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 66: zp ZP_BYTE:3 [ main::idx#3 main::idx#6 main::idx#1 main::idx#2 ] 23.38: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 22: zp ZP_BYTE:4 [ main::$1 ]
Uplift Scope [main] 364.95: zp ZP_BYTE:3 [ main::i#8 main::i#7 main::i#1 ] 348: zp ZP_BYTE:2 [ main::idx#8 main::idx#3 main::idx#1 main::idx#2 ] 22: zp ZP_BYTE:4 [ main::$1 ]
Uplift Scope []
Uplifting [main] best 568 combination reg byte y [ main::idx#3 main::idx#6 main::idx#1 main::idx#2 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$1 ]
Uplifting [] best 568 combination
Uplifting [main] best 3148 combination reg byte y [ main::i#8 main::i#7 main::i#1 ] reg byte x [ main::idx#8 main::idx#3 main::idx#1 main::idx#2 ] reg byte a [ main::$1 ]
Uplifting [] best 3148 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -343,58 +439,58 @@ bend:
// main
main: {
.label screen = $400
// [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
// [5] phi (byte) main::idx#3 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1
ldy #0
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1
// [5] phi from main to main::@4 [phi:main->main::@4]
b4_from_main:
// [5] phi (byte) main::idx#8 = (byte) 0 [phi:main->main::@4#0] -- vbuxx=vbuc1
ldx #0
jmp b1
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
// [5] phi (byte) main::idx#3 = (byte) main::idx#6 [phi:main::@3->main::@1#0] -- register_copy
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#1] -- register_copy
jmp b1
// main::@1
b1:
// [6] if((byte) main::i#2>=(byte) 5+(byte) 1) goto main::@2 -- vbuxx_ge_vbuc1_then_la1
cpx #5+1
bcs b2
// [5] phi (byte) main::i#7 = (byte) 0 [phi:main->main::@4#1] -- vbuyy=vbuc1
ldy #0
jmp b4
// main::@4
b4:
// [7] (byte~) main::$1 ← (byte) main::i#2 - (byte) 5 -- vbuaa=vbuxx_minus_vbuc1
txa
// [6] (byte~) main::$1 ← (byte) main::i#7 - (byte) 5 -- vbuaa=vbuyy_minus_vbuc1
tya
sec
sbc #5
// [8] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte~) main::$1 -- pbuc1_derefidx_vbuyy=vbuaa
sta screen,y
// [9] (byte) main::idx#2 ← ++ (byte) main::idx#3 -- vbuyy=_inc_vbuyy
iny
// [10] phi from main::@2 main::@4 to main::@3 [phi:main::@2/main::@4->main::@3]
// [7] *((const byte*) main::screen#0 + (byte) main::idx#8) ← (byte~) main::$1 -- pbuc1_derefidx_vbuxx=vbuaa
sta screen,x
// [8] (byte) main::idx#2 ← ++ (byte) main::idx#8 -- vbuxx=_inc_vbuxx
inx
// [9] phi from main::@2 main::@4 to main::@3 [phi:main::@2/main::@4->main::@3]
b3_from_b2:
b3_from_b4:
// [10] phi (byte) main::idx#6 = (byte) main::idx#1 [phi:main::@2/main::@4->main::@3#0] -- register_copy
// [9] phi (byte) main::i#8 = (byte) main::i#1 [phi:main::@2/main::@4->main::@3#0] -- register_copy
// [9] phi (byte) main::idx#3 = (byte) main::idx#1 [phi:main::@2/main::@4->main::@3#1] -- register_copy
jmp b3
// main::@3
b3:
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
// [12] if((byte) main::i#1!=(byte) $b) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$b
bne b1_from_b3
// [10] (byte) main::i#1 ← ++ (byte) main::i#8 -- vbuyy=_inc_vbuyy
iny
// [11] if((byte) main::i#1!=(byte) $b) goto main::@1 -- vbuyy_neq_vbuc1_then_la1
cpy #$b
bne b1
jmp breturn
// main::@return
breturn:
// [13] return
// [12] return
rts
// main::@1
b1:
// [13] if((byte) main::i#1>=(byte) 5+(byte) 1) goto main::@2 -- vbuyy_ge_vbuc1_then_la1
cpy #5+1
bcs b2
// [5] phi from main::@1 to main::@4 [phi:main::@1->main::@4]
b4_from_b1:
// [5] phi (byte) main::idx#8 = (byte) main::idx#3 [phi:main::@1->main::@4#0] -- register_copy
// [5] phi (byte) main::i#7 = (byte) main::i#1 [phi:main::@1->main::@4#1] -- register_copy
jmp b4
// main::@2
b2:
// [14] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte) main::i#2 -- pbuc1_derefidx_vbuyy=vbuxx
txa
sta screen,y
// [15] (byte) main::idx#1 ← ++ (byte) main::idx#3 -- vbuyy=_inc_vbuyy
iny
// [14] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte) main::i#1 -- pbuc1_derefidx_vbuxx=vbuyy
tya
sta screen,x
// [15] (byte) main::idx#1 ← ++ (byte) main::idx#3 -- vbuxx=_inc_vbuxx
inx
jmp b3_from_b2
}
// File Data
@ -402,31 +498,26 @@ main: {
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b4
Removing instruction jmp b3
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1_from_b3 with b1
Replacing label b3_from_b2 with b3
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_b3:
Removing instruction b3_from_b2:
Removing instruction b3_from_b4:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b4:
Removing instruction b4_from_main:
Removing instruction breturn:
Removing instruction b4_from_b1:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
@ -442,23 +533,24 @@ FINAL SYMBOL TABLE
(label) main::@4
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 6.875
(byte) main::i#1 reg byte y 121.2
(byte) main::i#7 reg byte y 30.75
(byte) main::i#8 reg byte y 213.0
(byte) main::idx
(byte) main::idx#1 reg byte y 22.0
(byte) main::idx#2 reg byte y 22.0
(byte) main::idx#3 reg byte y 11.0
(byte) main::idx#6 reg byte y 11.0
(byte) main::idx#1 reg byte x 202.0
(byte) main::idx#2 reg byte x 22.0
(byte) main::idx#3 reg byte x 83.0
(byte) main::idx#8 reg byte x 40.99999999999999
(byte*) main::screen
(const byte*) main::screen#0 screen = (byte*) 1024
reg byte x [ main::i#2 main::i#1 ]
reg byte y [ main::idx#3 main::idx#6 main::idx#1 main::idx#2 ]
reg byte x [ main::idx#8 main::idx#3 main::idx#1 main::idx#2 ]
reg byte y [ main::i#8 main::i#7 main::i#1 ]
reg byte a [ main::$1 ]
FINAL ASSEMBLER
Score: 406
Score: 2506
// File Comments
// Tests statement sequence locality of if(cond) { stmt1; } else { stmt2; }
@ -477,55 +569,58 @@ Score: 406
// main
main: {
.label screen = $400
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::idx#3 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1
ldy #0
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#1] -- vbuxx=vbuc1
// [5] phi from main to main::@4 [phi:main->main::@4]
// [5] phi (byte) main::idx#8 = (byte) 0 [phi:main->main::@4#0] -- vbuxx=vbuc1
ldx #0
// [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
// [5] phi (byte) main::idx#3 = (byte) main::idx#6 [phi:main::@3->main::@1#0] -- register_copy
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#1] -- register_copy
// main::@1
b1:
// if(i>5)
// [6] if((byte) main::i#2>=(byte) 5+(byte) 1) goto main::@2 -- vbuxx_ge_vbuc1_then_la1
cpx #5+1
bcs b2
// [5] phi (byte) main::i#7 = (byte) 0 [phi:main->main::@4#1] -- vbuyy=vbuc1
ldy #0
// main::@4
b4:
// i-5
// [7] (byte~) main::$1 ← (byte) main::i#2 - (byte) 5 -- vbuaa=vbuxx_minus_vbuc1
txa
// [6] (byte~) main::$1 ← (byte) main::i#7 - (byte) 5 -- vbuaa=vbuyy_minus_vbuc1
tya
sec
sbc #5
// screen[idx++] = i-5
// [8] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte~) main::$1 -- pbuc1_derefidx_vbuyy=vbuaa
sta screen,y
// [7] *((const byte*) main::screen#0 + (byte) main::idx#8) ← (byte~) main::$1 -- pbuc1_derefidx_vbuxx=vbuaa
sta screen,x
// screen[idx++] = i-5;
// [9] (byte) main::idx#2 ← ++ (byte) main::idx#3 -- vbuyy=_inc_vbuyy
iny
// [10] phi from main::@2 main::@4 to main::@3 [phi:main::@2/main::@4->main::@3]
// [10] phi (byte) main::idx#6 = (byte) main::idx#1 [phi:main::@2/main::@4->main::@3#0] -- register_copy
// [8] (byte) main::idx#2 ← ++ (byte) main::idx#8 -- vbuxx=_inc_vbuxx
inx
// [9] phi from main::@2 main::@4 to main::@3 [phi:main::@2/main::@4->main::@3]
// [9] phi (byte) main::i#8 = (byte) main::i#1 [phi:main::@2/main::@4->main::@3#0] -- register_copy
// [9] phi (byte) main::idx#3 = (byte) main::idx#1 [phi:main::@2/main::@4->main::@3#1] -- register_copy
// main::@3
b3:
// for(byte i: 0..10)
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
// [12] if((byte) main::i#1!=(byte) $b) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #$b
// [10] (byte) main::i#1 ← ++ (byte) main::i#8 -- vbuyy=_inc_vbuyy
iny
// [11] if((byte) main::i#1!=(byte) $b) goto main::@1 -- vbuyy_neq_vbuc1_then_la1
cpy #$b
bne b1
// main::@return
// }
// [13] return
// [12] return
rts
// main::@1
b1:
// if(i>5)
// [13] if((byte) main::i#1>=(byte) 5+(byte) 1) goto main::@2 -- vbuyy_ge_vbuc1_then_la1
cpy #5+1
bcs b2
// [5] phi from main::@1 to main::@4 [phi:main::@1->main::@4]
// [5] phi (byte) main::idx#8 = (byte) main::idx#3 [phi:main::@1->main::@4#0] -- register_copy
// [5] phi (byte) main::i#7 = (byte) main::i#1 [phi:main::@1->main::@4#1] -- register_copy
jmp b4
// main::@2
b2:
// screen[idx++] = i
// [14] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte) main::i#2 -- pbuc1_derefidx_vbuyy=vbuxx
txa
sta screen,y
// [14] *((const byte*) main::screen#0 + (byte) main::idx#3) ← (byte) main::i#1 -- pbuc1_derefidx_vbuxx=vbuyy
tya
sta screen,x
// screen[idx++] = i;
// [15] (byte) main::idx#1 ← ++ (byte) main::idx#3 -- vbuyy=_inc_vbuyy
iny
// [15] (byte) main::idx#1 ← ++ (byte) main::idx#3 -- vbuxx=_inc_vbuxx
inx
jmp b3
}
// File Data

View File

@ -9,16 +9,17 @@
(label) main::@4
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 16.5
(byte) main::i#2 reg byte x 6.875
(byte) main::i#1 reg byte y 121.2
(byte) main::i#7 reg byte y 30.75
(byte) main::i#8 reg byte y 213.0
(byte) main::idx
(byte) main::idx#1 reg byte y 22.0
(byte) main::idx#2 reg byte y 22.0
(byte) main::idx#3 reg byte y 11.0
(byte) main::idx#6 reg byte y 11.0
(byte) main::idx#1 reg byte x 202.0
(byte) main::idx#2 reg byte x 22.0
(byte) main::idx#3 reg byte x 83.0
(byte) main::idx#8 reg byte x 40.99999999999999
(byte*) main::screen
(const byte*) main::screen#0 screen = (byte*) 1024
reg byte x [ main::i#2 main::i#1 ]
reg byte y [ main::idx#3 main::idx#6 main::idx#1 main::idx#2 ]
reg byte x [ main::idx#8 main::idx#3 main::idx#1 main::idx#2 ]
reg byte y [ main::i#8 main::i#7 main::i#1 ]
reg byte a [ main::$1 ]

Some files were not shown because too many files have changed in this diff Show More