1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-20 02:32:36 +00:00

Implemented inline casting - allowing for improved ASM when doing no-op casting.

This commit is contained in:
jespergravgaard 2018-01-21 23:24:28 +01:00
parent eab2e64154
commit 1646f9d3ff
18 changed files with 2210 additions and 2175 deletions

View File

@ -180,6 +180,7 @@ public class Compiler {
optimizations.add(new Pass2ConstantAdditionElimination(program));
optimizations.add(new Pass2FixWordConstructors(program));
optimizations.add(new PassNEliminateUnusedVars(program));
optimizations.add(new Pass2NopCastElimination(program));
pass2OptimizeSSA(optimizations);
// Constant inlining optimizations - as the last step to ensure that constant identification has been completed

View File

@ -222,23 +222,36 @@ public class AsmFragmentInstanceSpec {
if(value instanceof Variable) {
Variable variable = (Variable) value;
SymbolType varType = variable.getType();
// Find the register
Registers.Register register = variable.getAllocation();
// Find value if it is already bound
for(String name : bindings.keySet()) {
Value bound = bindings.get(name);
if(bound instanceof Variable) {
Registers.Register boundRegister = ((Variable) bound).getAllocation();
if(boundRegister != null && boundRegister.equals(register)) {
if(SymbolTypeInference.typeMatch(((Variable) bound).getType(), variable.getType())) {
return name;
}
}
}
}
SymbolType varType = ((Variable) value).getType();
// Examine if the register is already bound - and reuse it
String bound = findBound(varType, register);
if(bound != null) return bound;
// Bind the register
String name = getTypePrefix(varType) + getRegisterName(register);
bindings.put(name, value);
return name;
} else if(value instanceof CastValue) {
CastValue castVal = (CastValue) value;
SymbolType toType = castVal.getToType();
value = castVal.getValue();
// Assume cast value is a var-ref
value = program.getSymbolInfos().getVariable((VariableRef) value);
// Find the register
Variable variable = (Variable) value;
Registers.Register register = variable.getAllocation();
// Examine if the register is already bound (with the cast to type) - and reuse it
String bound = findBound(toType, register);
if(bound != null) {
String name = getTypePrefix(toType) + getRegisterName(register);
return name;
} else {
// Bind the register
String name = getTypePrefix(toType) + getRegisterName(register);
bindings.put(name, value);
return name;
}
} else if(value instanceof ConstantVar || value instanceof ConstantValue) {
SymbolType constType;
if(value instanceof ConstantVar) {
@ -257,6 +270,22 @@ public class AsmFragmentInstanceSpec {
throw new RuntimeException("Binding of value type not supported " + value);
}
private String findBound(SymbolType varType, Registers.Register register) {
// Find value if it is already bound
for(String name : bindings.keySet()) {
Value bound = bindings.get(name);
if(bound instanceof Variable) {
Registers.Register boundRegister = ((Variable) bound).getAllocation();
if(boundRegister != null && boundRegister.equals(register)) {
if(SymbolTypeInference.typeMatch(((Variable) bound).getType(), varType)) {
return name;
}
}
}
}
return null;
}
/**
* Get the symbol type part of the binding name (eg. vbu/pws/...)
*

View File

@ -0,0 +1,45 @@
package dk.camelot64.kickc.model;
/** A Cast that requires no actual operation.
* The types have the same size and the code will execute as if the value already had the type cast to.
* Examples: byte to/from signed byte, word to/from sighed word.
*/
public class CastValue implements RValue {
/** The type cast to. */
private SymbolType toType;
/** The value being cast. */
private RValue value;
public CastValue(SymbolType toType, RValue value) {
this.toType = toType;
this.value = value;
}
public SymbolType getToType() {
return toType;
}
public void setToType(SymbolType toType) {
this.toType = toType;
}
public RValue getValue() {
return value;
}
public void setValue(RValue value) {
this.value = value;
}
@Override
public String toString(Program program) {
return "("+ toType.toString()+")"+ value.toString(program);
}
@Override
public String toString() {
return toString(null);
}
}

View File

@ -298,9 +298,11 @@ public class SymbolTypeInference {
return new SymbolTypeArray(((ConstantArrayList) rValue).getElementType());
} else if(rValue instanceof ConstantArrayFilled) {
return new SymbolTypeArray(((ConstantArrayFilled) rValue).getElementType(), ((ConstantArrayFilled) rValue).getSize());
} else if(rValue instanceof CastValue) {
return ((CastValue) rValue).getToType();
}
if(type == null) {
throw new RuntimeException("Cannot infer type for " + rValue);
throw new RuntimeException("Cannot infer type for " + rValue.toString());
}
return type;
}

View File

@ -0,0 +1,65 @@
package dk.camelot64.kickc.passes;
import dk.camelot64.kickc.model.*;
import java.util.LinkedHashMap;
import java.util.ListIterator;
/**
* Compiler Pass eliminating cast assignments that has no effect (byte to/from signed byte, word to/from signed word)
*/
public class Pass2NopCastElimination extends Pass2SsaOptimization {
public Pass2NopCastElimination(Program program) {
super(program);
}
/**
* Eliminate cast assignments that has no effect (byte to/from signed byte, word to/from signed word)
*/
@Override
public boolean step() {
LinkedHashMap<SymbolRef, RValue> castAliasses = new LinkedHashMap<>();
for(ControlFlowBlock block : getGraph().getAllBlocks()) {
ListIterator<Statement> stmtIt = block.getStatements().listIterator();
while(stmtIt.hasNext()) {
Statement stmt = stmtIt.next();
if(stmt instanceof StatementAssignment) {
StatementAssignment assignment = (StatementAssignment) stmt;
if(assignment.getlValue() instanceof VariableRef && assignment.getrValue1()==null && assignment.getOperator()!=null ) {
// It is a simple cast assignment - check if it is no-op
SymbolType rValType = SymbolTypeInference.inferType(getScope(), assignment.getrValue2());
boolean isSimpleCast = false;
SymbolType toType = null;
if(SymbolType.isByte(rValType) && Operator.CAST_SBYTE.equals(assignment.getOperator())) {
isSimpleCast = true;
toType = SymbolType.SBYTE;
} else if(SymbolType.isSByte(rValType) && Operator.CAST_BYTE.equals(assignment.getOperator())) {
isSimpleCast = true;
toType = SymbolType.BYTE;
} else if(SymbolType.isWord(rValType) && Operator.CAST_SWORD.equals(assignment.getOperator())) {
isSimpleCast = true;
toType = SymbolType.SWORD;
} else if(SymbolType.isSWord(rValType) && Operator.CAST_WORD.equals(assignment.getOperator())) {
isSimpleCast = true;
toType = SymbolType.WORD;
}
if(isSimpleCast) {
getLog().append("Eliminating Noop Cast "+assignment.toString(getProgram(), false));
// Add the alias for replacement
castAliasses.put((VariableRef) assignment.getlValue(), new CastValue(toType, assignment.getrValue2()));
// Remove the assignment
stmtIt.remove();
}
}
}
}
}
replaceVariables(castAliasses);
deleteSymbols(castAliasses.keySet());
return (castAliasses.size() > 0);
}
}

View File

@ -39,7 +39,7 @@ public class Pass3PhiLifting {
if(!(phiRValue.getrValue() instanceof ConstantValue)) {
LabelRef predecessorRef = phiRValue.getPredecessor();
ControlFlowBlock predecessorBlock = graph.getBlock(predecessorRef);
VariableRef rValVarRef = (VariableRef) phiRValue.getrValue();
//VariableRef rValVarRef = (VariableRef) phiRValue.getrValue();
Variable newVar;
if(phiVariable.getVariable().isVersion()) {
Variable lValVar = program.getScope().getVariable(phiVariable.getVariable());

View File

@ -371,6 +371,8 @@ public class Pass4CodeGeneration {
if(rValue instanceof VariableRef) {
VariableRef rValueRef = (VariableRef) rValue;
return program.getSymbolInfos().getVariable(rValueRef).getAllocation();
} else if(rValue instanceof CastValue) {
return getRegister(((CastValue) rValue).getValue());
} else {
return null;
}

View File

@ -94,6 +94,8 @@ public class PassNVariableReferenceInfos extends Pass2Base {
used.addAll(getReferenced(value));
}
return used;
} else if(rValue instanceof CastValue) {
return getReferenced(((CastValue) rValue).getValue());
} else {
throw new RuntimeException("Unhandled RValue type " + rValue);
}

View File

@ -14,31 +14,29 @@ main::@1: scope:[main] from main main::@1
[5] (byte) main::b#2 ← phi( main/(byte/signed byte/word/signed word) 0 main::@1/(byte) main::b#1 ) [ main::b#2 ] ( main:2 [ main::b#2 ] )
[6] (byte) main::b2#0 ← (byte/word/signed word) 200 - (byte) main::b#2 [ main::b#2 main::b2#0 ] ( main:2 [ main::b#2 main::b2#0 ] )
[7] *((const byte*) SCREEN#0 + (byte) main::b#2) ← (byte) main::b2#0 [ main::b#2 ] ( main:2 [ main::b#2 ] )
[8] (signed byte~) main::$1 ← ((signed byte)) (byte) main::b#2 [ main::b#2 main::$1 ] ( main:2 [ main::b#2 main::$1 ] )
[9] (signed byte) main::sb#0 ← - (signed byte~) main::$1 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] )
[10] (byte~) main::$3 ← ((byte)) (signed byte) main::sb#0 [ main::b#2 main::$3 ] ( main:2 [ main::b#2 main::$3 ] )
[11] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte~) main::$3 [ main::b#2 ] ( main:2 [ main::b#2 ] )
[12] (byte) main::b#1 ← ++ (byte) main::b#2 [ main::b#1 ] ( main:2 [ main::b#1 ] )
[13] if((byte) main::b#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::b#1 ] ( main:2 [ main::b#1 ] )
[8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] )
[9] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte)(signed byte) main::sb#0 [ main::b#2 ] ( main:2 [ main::b#2 ] )
[10] (byte) main::b#1 ← ++ (byte) main::b#2 [ main::b#1 ] ( main:2 [ main::b#1 ] )
[11] if((byte) main::b#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::b#1 ] ( main:2 [ main::b#1 ] )
to:main::@2
main::@2: scope:[main] from main::@1
[14] phi() [ ] ( main:2 [ ] )
[15] call w param-assignment [ ] ( main:2 [ ] )
[12] phi() [ ] ( main:2 [ ] )
[13] call w param-assignment [ ] ( main:2 [ ] )
to:main::@return
main::@return: scope:[main] from main::@2
[16] return [ ] ( main:2 [ ] )
[14] return [ ] ( main:2 [ ] )
to:@return
w: scope:[w] from main::@2
[17] phi() [ ] ( main:2::w:15 [ ] )
[15] phi() [ ] ( main:2::w:13 [ ] )
to:w::@1
w::@1: scope:[w] from w w::@1
[18] (byte) w::i#2 ← phi( w/(byte/signed byte/word/signed word) 0 w::@1/(byte) w::i#1 ) [ w::i#2 ] ( main:2::w:15 [ w::i#2 ] )
[19] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] )
[20] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] )
[21] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:15 [ w::i#2 ] )
[22] (byte) w::i#1 ← ++ (byte) w::i#2 [ w::i#1 ] ( main:2::w:15 [ w::i#1 ] )
[23] if((byte) w::i#1!=(byte/signed byte/word/signed word) 11) goto w::@1 [ w::i#1 ] ( main:2::w:15 [ w::i#1 ] )
[16] (byte) w::i#2 ← phi( w/(byte/signed byte/word/signed word) 0 w::@1/(byte) w::i#1 ) [ w::i#2 ] ( main:2::w:13 [ w::i#2 ] )
[17] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] )
[18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] )
[19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:13 [ w::i#2 ] )
[20] (byte) w::i#1 ← ++ (byte) w::i#2 [ w::i#1 ] ( main:2::w:13 [ w::i#1 ] )
[21] if((byte) w::i#1!=(byte/signed byte/word/signed word) 11) goto w::@1 [ w::i#1 ] ( main:2::w:13 [ w::i#1 ] )
to:w::@return
w::@return: scope:[w] from w::@1
[24] return [ ] ( main:2::w:15 [ ] )
[22] return [ ] ( main:2::w:13 [ ] )
to:@return

View File

@ -427,6 +427,9 @@ Multiple usages for variable. Not optimizing sub-constant (byte) main::b#2
Multiple usages for variable. Not optimizing sub-constant (byte) w::i#2
Multiple usages for variable. Not optimizing sub-constant (byte) w::i#2
Multiple usages for variable. Not optimizing sub-constant (byte) w::i#2
Eliminating Noop Cast (signed byte~) main::$1 ← ((signed byte)) (byte) main::b#2
Eliminating Noop Cast (byte~) main::$3 ← ((byte)) (signed byte) main::sb#0
Succesful SSA optimization Pass2NopCastElimination
Multiple usages for variable. Not optimizing sub-constant (byte) main::b#2
Multiple usages for variable. Not optimizing sub-constant (byte) main::b#2
Multiple usages for variable. Not optimizing sub-constant (byte) w::i#2
@ -457,15 +460,14 @@ Adding NOP phi() at start of main::@2
Adding NOP phi() at start of w
CALL GRAPH
Calls in [] to main:2
Calls in [main] to w:15
Calls in [main] to w:13
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Created 2 initial phi equivalence classes
Coalesced [17] main::b#3 ← main::b#1
Coalesced [26] w::i#3 ← w::i#1
Coalesced [15] main::b#3 ← main::b#1
Coalesced [24] w::i#3 ← w::i#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) main::@4
Culled Empty Block (label) w::@3
@ -479,7 +481,6 @@ Adding NOP phi() at start of w
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
@ -498,33 +499,31 @@ main::@1: scope:[main] from main main::@1
[5] (byte) main::b#2 ← phi( main/(byte/signed byte/word/signed word) 0 main::@1/(byte) main::b#1 ) [ main::b#2 ] ( main:2 [ main::b#2 ] )
[6] (byte) main::b2#0 ← (byte/word/signed word) 200 - (byte) main::b#2 [ main::b#2 main::b2#0 ] ( main:2 [ main::b#2 main::b2#0 ] )
[7] *((const byte*) SCREEN#0 + (byte) main::b#2) ← (byte) main::b2#0 [ main::b#2 ] ( main:2 [ main::b#2 ] )
[8] (signed byte~) main::$1 ← ((signed byte)) (byte) main::b#2 [ main::b#2 main::$1 ] ( main:2 [ main::b#2 main::$1 ] )
[9] (signed byte) main::sb#0 ← - (signed byte~) main::$1 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] )
[10] (byte~) main::$3 ← ((byte)) (signed byte) main::sb#0 [ main::b#2 main::$3 ] ( main:2 [ main::b#2 main::$3 ] )
[11] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte~) main::$3 [ main::b#2 ] ( main:2 [ main::b#2 ] )
[12] (byte) main::b#1 ← ++ (byte) main::b#2 [ main::b#1 ] ( main:2 [ main::b#1 ] )
[13] if((byte) main::b#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::b#1 ] ( main:2 [ main::b#1 ] )
[8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] )
[9] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte)(signed byte) main::sb#0 [ main::b#2 ] ( main:2 [ main::b#2 ] )
[10] (byte) main::b#1 ← ++ (byte) main::b#2 [ main::b#1 ] ( main:2 [ main::b#1 ] )
[11] if((byte) main::b#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::b#1 ] ( main:2 [ main::b#1 ] )
to:main::@2
main::@2: scope:[main] from main::@1
[14] phi() [ ] ( main:2 [ ] )
[15] call w param-assignment [ ] ( main:2 [ ] )
[12] phi() [ ] ( main:2 [ ] )
[13] call w param-assignment [ ] ( main:2 [ ] )
to:main::@return
main::@return: scope:[main] from main::@2
[16] return [ ] ( main:2 [ ] )
[14] return [ ] ( main:2 [ ] )
to:@return
w: scope:[w] from main::@2
[17] phi() [ ] ( main:2::w:15 [ ] )
[15] phi() [ ] ( main:2::w:13 [ ] )
to:w::@1
w::@1: scope:[w] from w w::@1
[18] (byte) w::i#2 ← phi( w/(byte/signed byte/word/signed word) 0 w::@1/(byte) w::i#1 ) [ w::i#2 ] ( main:2::w:15 [ w::i#2 ] )
[19] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] )
[20] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] )
[21] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:15 [ w::i#2 ] )
[22] (byte) w::i#1 ← ++ (byte) w::i#2 [ w::i#1 ] ( main:2::w:15 [ w::i#1 ] )
[23] if((byte) w::i#1!=(byte/signed byte/word/signed word) 11) goto w::@1 [ w::i#1 ] ( main:2::w:15 [ w::i#1 ] )
[16] (byte) w::i#2 ← phi( w/(byte/signed byte/word/signed word) 0 w::@1/(byte) w::i#1 ) [ w::i#2 ] ( main:2::w:13 [ w::i#2 ] )
[17] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] )
[18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] )
[19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:13 [ w::i#2 ] )
[20] (byte) w::i#1 ← ++ (byte) w::i#2 [ w::i#1 ] ( main:2::w:13 [ w::i#1 ] )
[21] if((byte) w::i#1!=(byte/signed byte/word/signed word) 11) goto w::@1 [ w::i#1 ] ( main:2::w:13 [ w::i#1 ] )
to:w::@return
w::@return: scope:[w] from w::@1
[24] return [ ] ( main:2::w:15 [ ] )
[22] return [ ] ( main:2::w:13 [ ] )
to:@return
DOMINATORS
@ -563,15 +562,13 @@ VARIABLE REGISTER WEIGHTS
(byte*) SCREEN3
(byte*) SCREEN4
(void()) main()
(signed byte~) main::$1 22.0
(byte~) main::$3 22.0
(byte) main::b
(byte) main::b#1 16.5
(byte) main::b#2 9.428571428571429
(byte) main::b#2 11.0
(byte) main::b2
(byte) main::b2#0 22.0
(signed byte) main::sb
(signed byte) main::sb#0 22.0
(signed byte) main::sb#0 11.0
(void()) w()
(byte) w::b
(byte) w::b2
@ -586,25 +583,19 @@ Initial phi equivalence classes
[ main::b#2 main::b#1 ]
[ w::i#2 w::i#1 ]
Added variable main::b2#0 to zero page equivalence class [ main::b2#0 ]
Added variable main::$1 to zero page equivalence class [ main::$1 ]
Added variable main::sb#0 to zero page equivalence class [ main::sb#0 ]
Added variable main::$3 to zero page equivalence class [ main::$3 ]
Added variable w::b2#0 to zero page equivalence class [ w::b2#0 ]
Complete equivalence classes
[ main::b#2 main::b#1 ]
[ w::i#2 w::i#1 ]
[ main::b2#0 ]
[ main::$1 ]
[ main::sb#0 ]
[ main::$3 ]
[ w::b2#0 ]
Allocated zp ZP_BYTE:2 [ main::b#2 main::b#1 ]
Allocated zp ZP_BYTE:3 [ w::i#2 w::i#1 ]
Allocated zp ZP_BYTE:4 [ main::b2#0 ]
Allocated zp ZP_BYTE:5 [ main::$1 ]
Allocated zp ZP_BYTE:6 [ main::sb#0 ]
Allocated zp ZP_BYTE:7 [ main::$3 ]
Allocated zp ZP_BYTE:8 [ w::b2#0 ]
Allocated zp ZP_BYTE:5 [ main::sb#0 ]
Allocated zp ZP_BYTE:6 [ w::b2#0 ]
INITIAL ASM
//SEG0 Basic Upstart
@ -634,10 +625,8 @@ bend_from_b2:
bend:
//SEG9 main
main: {
.label _1 = 5
.label _3 = 7
.label b2 = 4
.label sb = 6
.label sb = 5
.label b = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
@ -660,116 +649,108 @@ main: {
lda b2
ldy b
sta SCREEN,y
//SEG17 [8] (signed byte~) main::$1 ← ((signed byte)) (byte) main::b#2 [ main::b#2 main::$1 ] ( main:2 [ main::b#2 main::$1 ] ) -- vbsz1=_sbyte_vbuz2
//SEG17 [8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] ) -- vbsz1=_neg_vbsz2
lda b
sta _1
//SEG18 [9] (signed byte) main::sb#0 ← - (signed byte~) main::$1 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] ) -- vbsz1=_neg_vbsz2
lda _1
eor #$ff
clc
adc #1
sta sb
//SEG19 [10] (byte~) main::$3 ← ((byte)) (signed byte) main::sb#0 [ main::b#2 main::$3 ] ( main:2 [ main::b#2 main::$3 ] ) -- vbuz1=_byte_vbsz2
//SEG18 [9] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte)(signed byte) main::sb#0 [ main::b#2 ] ( main:2 [ main::b#2 ] ) -- pbuc1_derefidx_vbuz1=vbuz2
lda sb
sta _3
//SEG20 [11] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte~) main::$3 [ main::b#2 ] ( main:2 [ main::b#2 ] ) -- pbuc1_derefidx_vbuz1=vbuz2
lda _3
ldy b
sta SCREEN2,y
//SEG21 [12] (byte) main::b#1 ← ++ (byte) main::b#2 [ main::b#1 ] ( main:2 [ main::b#1 ] ) -- vbuz1=_inc_vbuz1
//SEG19 [10] (byte) main::b#1 ← ++ (byte) main::b#2 [ main::b#1 ] ( main:2 [ main::b#1 ] ) -- vbuz1=_inc_vbuz1
inc b
//SEG22 [13] if((byte) main::b#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::b#1 ] ( main:2 [ main::b#1 ] ) -- vbuz1_neq_vbuc1_then_la1
//SEG20 [11] if((byte) main::b#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::b#1 ] ( main:2 [ main::b#1 ] ) -- vbuz1_neq_vbuc1_then_la1
lda b
cmp #$65
bne b1_from_b1
//SEG23 [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG21 [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
jmp b2
//SEG24 main::@2
//SEG22 main::@2
b2:
//SEG25 [15] call w param-assignment [ ] ( main:2 [ ] )
//SEG26 [17] phi from main::@2 to w [phi:main::@2->w]
//SEG23 [13] call w param-assignment [ ] ( main:2 [ ] )
//SEG24 [15] phi from main::@2 to w [phi:main::@2->w]
w_from_b2:
jsr w
jmp breturn
//SEG27 main::@return
//SEG25 main::@return
breturn:
//SEG28 [16] return [ ] ( main:2 [ ] )
//SEG26 [14] return [ ] ( main:2 [ ] )
rts
}
//SEG29 w
//SEG27 w
w: {
.const w1 = $514
.const w2 = $4e2
.const b = w1-w2
.label b2 = 8
.label b2 = 6
.label i = 3
//SEG30 [18] phi from w to w::@1 [phi:w->w::@1]
//SEG28 [16] phi from w to w::@1 [phi:w->w::@1]
b1_from_w:
//SEG31 [18] phi (byte) w::i#2 = (byte/signed byte/word/signed word) 0 [phi:w->w::@1#0] -- vbuz1=vbuc1
//SEG29 [16] phi (byte) w::i#2 = (byte/signed byte/word/signed word) 0 [phi:w->w::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG32 [18] phi from w::@1 to w::@1 [phi:w::@1->w::@1]
//SEG30 [16] phi from w::@1 to w::@1 [phi:w::@1->w::@1]
b1_from_b1:
//SEG33 [18] phi (byte) w::i#2 = (byte) w::i#1 [phi:w::@1->w::@1#0] -- register_copy
//SEG31 [16] phi (byte) w::i#2 = (byte) w::i#1 [phi:w::@1->w::@1#0] -- register_copy
jmp b1
//SEG34 w::@1
//SEG32 w::@1
b1:
//SEG35 [19] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] ) -- vbuz1=vbuc1_plus_vbuz2
//SEG33 [17] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] ) -- vbuz1=vbuc1_plus_vbuz2
lda #$578-$546
clc
adc i
sta b2
//SEG36 [20] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] ) -- pbuc1_derefidx_vbuz1=vbuc2
//SEG34 [18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] ) -- pbuc1_derefidx_vbuz1=vbuc2
ldy i
lda #b
sta SCREEN3,y
//SEG37 [21] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:15 [ w::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuz2
//SEG35 [19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:13 [ w::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuz2
lda b2
ldy i
sta SCREEN4,y
//SEG38 [22] (byte) w::i#1 ← ++ (byte) w::i#2 [ w::i#1 ] ( main:2::w:15 [ w::i#1 ] ) -- vbuz1=_inc_vbuz1
//SEG36 [20] (byte) w::i#1 ← ++ (byte) w::i#2 [ w::i#1 ] ( main:2::w:13 [ w::i#1 ] ) -- vbuz1=_inc_vbuz1
inc i
//SEG39 [23] if((byte) w::i#1!=(byte/signed byte/word/signed word) 11) goto w::@1 [ w::i#1 ] ( main:2::w:15 [ w::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1
//SEG37 [21] if((byte) w::i#1!=(byte/signed byte/word/signed word) 11) goto w::@1 [ w::i#1 ] ( main:2::w:13 [ w::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1
lda i
cmp #$b
bne b1_from_b1
jmp breturn
//SEG40 w::@return
//SEG38 w::@return
breturn:
//SEG41 [24] return [ ] ( main:2::w:15 [ ] )
//SEG39 [22] return [ ] ( main:2::w:13 [ ] )
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] (byte) main::b2#0 ← (byte/word/signed word) 200 - (byte) main::b#2 [ main::b#2 main::b2#0 ] ( main:2 [ main::b#2 main::b2#0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::b#2 main::b#1 ]
Statement [9] (signed byte) main::sb#0 ← - (signed byte~) main::$1 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] ) always clobbers reg byte a
Statement [19] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] ) always clobbers reg byte a
Statement [8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] ) always clobbers reg byte a
Statement [17] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ w::i#2 w::i#1 ]
Statement [20] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:8 [ w::b2#0 ]
Statement [21] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:15 [ w::i#2 ] ) always clobbers reg byte a
Statement [18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ w::b2#0 ]
Statement [19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:13 [ w::i#2 ] ) always clobbers reg byte a
Statement [6] (byte) main::b2#0 ← (byte/word/signed word) 200 - (byte) main::b#2 [ main::b#2 main::b2#0 ] ( main:2 [ main::b#2 main::b2#0 ] ) always clobbers reg byte a
Statement [9] (signed byte) main::sb#0 ← - (signed byte~) main::$1 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] ) always clobbers reg byte a
Statement [19] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] ) always clobbers reg byte a
Statement [20] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] ) always clobbers reg byte a
Statement [21] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:15 [ w::i#2 ] ) always clobbers reg byte a
Statement [8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] ) always clobbers reg byte a
Statement [17] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] ) always clobbers reg byte a
Statement [18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] ) always clobbers reg byte a
Statement [19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:13 [ w::i#2 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ main::b#2 main::b#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ w::i#2 w::i#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::b2#0 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 [ main::$1 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:6 [ main::sb#0 ] : zp ZP_BYTE:6 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:7 [ main::$3 ] : zp ZP_BYTE:7 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:8 [ w::b2#0 ] : zp ZP_BYTE:8 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 [ main::sb#0 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:6 [ w::b2#0 ] : zp ZP_BYTE:6 , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 25.93: zp ZP_BYTE:2 [ main::b#2 main::b#1 ] 22: zp ZP_BYTE:4 [ main::b2#0 ] 22: zp ZP_BYTE:5 [ main::$1 ] 22: zp ZP_BYTE:6 [ main::sb#0 ] 22: zp ZP_BYTE:7 [ main::$3 ]
Uplift Scope [w] 30.25: zp ZP_BYTE:3 [ w::i#2 w::i#1 ] 11: zp ZP_BYTE:8 [ w::b2#0 ]
Uplift Scope [main] 27.5: zp ZP_BYTE:2 [ main::b#2 main::b#1 ] 22: zp ZP_BYTE:4 [ main::b2#0 ] 11: zp ZP_BYTE:5 [ main::sb#0 ]
Uplift Scope [w] 30.25: zp ZP_BYTE:3 [ w::i#2 w::i#1 ] 11: zp ZP_BYTE:6 [ w::b2#0 ]
Uplift Scope []
Uplifting [main] best 1016 combination reg byte x [ main::b#2 main::b#1 ] reg byte a [ main::b2#0 ] reg byte a [ main::$1 ] reg byte a [ main::sb#0 ] reg byte a [ main::$3 ]
Uplifting [main] best 1016 combination reg byte x [ main::b#2 main::b#1 ] reg byte a [ main::b2#0 ] reg byte a [ main::sb#0 ]
Uplifting [w] best 836 combination reg byte y [ w::i#2 w::i#1 ] reg byte x [ w::b2#0 ]
Uplifting [] best 836 combination
@ -819,71 +800,69 @@ main: {
adc #$c8+1
//SEG16 [7] *((const byte*) SCREEN#0 + (byte) main::b#2) ← (byte) main::b2#0 [ main::b#2 ] ( main:2 [ main::b#2 ] ) -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
//SEG17 [8] (signed byte~) main::$1 ← ((signed byte)) (byte) main::b#2 [ main::b#2 main::$1 ] ( main:2 [ main::b#2 main::$1 ] ) -- vbsaa=_sbyte_vbuxx
//SEG17 [8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] ) -- vbsaa=_neg_vbsxx
txa
//SEG18 [9] (signed byte) main::sb#0 ← - (signed byte~) main::$1 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] ) -- vbsaa=_neg_vbsaa
eor #$ff
clc
adc #1
//SEG19 [10] (byte~) main::$3 ← ((byte)) (signed byte) main::sb#0 [ main::b#2 main::$3 ] ( main:2 [ main::b#2 main::$3 ] ) -- vbuaa=_byte_vbsaa
//SEG20 [11] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte~) main::$3 [ main::b#2 ] ( main:2 [ main::b#2 ] ) -- pbuc1_derefidx_vbuxx=vbuaa
//SEG18 [9] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte)(signed byte) main::sb#0 [ main::b#2 ] ( main:2 [ main::b#2 ] ) -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN2,x
//SEG21 [12] (byte) main::b#1 ← ++ (byte) main::b#2 [ main::b#1 ] ( main:2 [ main::b#1 ] ) -- vbuxx=_inc_vbuxx
//SEG19 [10] (byte) main::b#1 ← ++ (byte) main::b#2 [ main::b#1 ] ( main:2 [ main::b#1 ] ) -- vbuxx=_inc_vbuxx
inx
//SEG22 [13] if((byte) main::b#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::b#1 ] ( main:2 [ main::b#1 ] ) -- vbuxx_neq_vbuc1_then_la1
//SEG20 [11] if((byte) main::b#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::b#1 ] ( main:2 [ main::b#1 ] ) -- vbuxx_neq_vbuc1_then_la1
cpx #$65
bne b1_from_b1
//SEG23 [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG21 [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
b2_from_b1:
jmp b2
//SEG24 main::@2
//SEG22 main::@2
b2:
//SEG25 [15] call w param-assignment [ ] ( main:2 [ ] )
//SEG26 [17] phi from main::@2 to w [phi:main::@2->w]
//SEG23 [13] call w param-assignment [ ] ( main:2 [ ] )
//SEG24 [15] phi from main::@2 to w [phi:main::@2->w]
w_from_b2:
jsr w
jmp breturn
//SEG27 main::@return
//SEG25 main::@return
breturn:
//SEG28 [16] return [ ] ( main:2 [ ] )
//SEG26 [14] return [ ] ( main:2 [ ] )
rts
}
//SEG29 w
//SEG27 w
w: {
.const w1 = $514
.const w2 = $4e2
.const b = w1-w2
//SEG30 [18] phi from w to w::@1 [phi:w->w::@1]
//SEG28 [16] phi from w to w::@1 [phi:w->w::@1]
b1_from_w:
//SEG31 [18] phi (byte) w::i#2 = (byte/signed byte/word/signed word) 0 [phi:w->w::@1#0] -- vbuyy=vbuc1
//SEG29 [16] phi (byte) w::i#2 = (byte/signed byte/word/signed word) 0 [phi:w->w::@1#0] -- vbuyy=vbuc1
ldy #0
jmp b1
//SEG32 [18] phi from w::@1 to w::@1 [phi:w::@1->w::@1]
//SEG30 [16] phi from w::@1 to w::@1 [phi:w::@1->w::@1]
b1_from_b1:
//SEG33 [18] phi (byte) w::i#2 = (byte) w::i#1 [phi:w::@1->w::@1#0] -- register_copy
//SEG31 [16] phi (byte) w::i#2 = (byte) w::i#1 [phi:w::@1->w::@1#0] -- register_copy
jmp b1
//SEG34 w::@1
//SEG32 w::@1
b1:
//SEG35 [19] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] ) -- vbuxx=vbuc1_plus_vbuyy
//SEG33 [17] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] ) -- vbuxx=vbuc1_plus_vbuyy
tya
clc
adc #$578-$546
tax
//SEG36 [20] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] ) -- pbuc1_derefidx_vbuyy=vbuc2
//SEG34 [18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] ) -- pbuc1_derefidx_vbuyy=vbuc2
lda #b
sta SCREEN3,y
//SEG37 [21] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:15 [ w::i#2 ] ) -- pbuc1_derefidx_vbuyy=vbuxx
//SEG35 [19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:13 [ w::i#2 ] ) -- pbuc1_derefidx_vbuyy=vbuxx
txa
sta SCREEN4,y
//SEG38 [22] (byte) w::i#1 ← ++ (byte) w::i#2 [ w::i#1 ] ( main:2::w:15 [ w::i#1 ] ) -- vbuyy=_inc_vbuyy
//SEG36 [20] (byte) w::i#1 ← ++ (byte) w::i#2 [ w::i#1 ] ( main:2::w:13 [ w::i#1 ] ) -- vbuyy=_inc_vbuyy
iny
//SEG39 [23] if((byte) w::i#1!=(byte/signed byte/word/signed word) 11) goto w::@1 [ w::i#1 ] ( main:2::w:15 [ w::i#1 ] ) -- vbuyy_neq_vbuc1_then_la1
//SEG37 [21] if((byte) w::i#1!=(byte/signed byte/word/signed word) 11) goto w::@1 [ w::i#1 ] ( main:2::w:13 [ w::i#1 ] ) -- vbuyy_neq_vbuc1_then_la1
cpy #$b
bne b1_from_b1
jmp breturn
//SEG40 w::@return
//SEG38 w::@return
breturn:
//SEG41 [24] return [ ] ( main:2::w:15 [ ] )
//SEG39 [22] return [ ] ( main:2::w:13 [ ] )
rts
}
@ -932,18 +911,16 @@ FINAL SYMBOL TABLE
(byte*) SCREEN4
(const byte*) SCREEN4#0 SCREEN4 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 40*(byte/signed byte/word/signed word) 9
(void()) main()
(signed byte~) main::$1 reg byte a 22.0
(byte~) main::$3 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@return
(byte) main::b
(byte) main::b#1 reg byte x 16.5
(byte) main::b#2 reg byte x 9.428571428571429
(byte) main::b#2 reg byte x 11.0
(byte) main::b2
(byte) main::b2#0 reg byte a 22.0
(signed byte) main::sb
(signed byte) main::sb#0 reg byte a 22.0
(signed byte) main::sb#0 reg byte a 11.0
(void()) w()
(label) w::@1
(label) w::@return
@ -962,9 +939,7 @@ FINAL SYMBOL TABLE
reg byte x [ main::b#2 main::b#1 ]
reg byte y [ w::i#2 w::i#1 ]
reg byte a [ main::b2#0 ]
reg byte a [ main::$1 ]
reg byte a [ main::sb#0 ]
reg byte a [ main::$3 ]
reg byte x [ w::b2#0 ]
@ -1004,59 +979,57 @@ main: {
adc #$c8+1
//SEG16 [7] *((const byte*) SCREEN#0 + (byte) main::b#2) ← (byte) main::b2#0 [ main::b#2 ] ( main:2 [ main::b#2 ] ) -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
//SEG17 [8] (signed byte~) main::$1 ← ((signed byte)) (byte) main::b#2 [ main::b#2 main::$1 ] ( main:2 [ main::b#2 main::$1 ] ) -- vbsaa=_sbyte_vbuxx
//SEG17 [8] (signed byte) main::sb#0 ← - (signed byte)(byte) main::b#2 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] ) -- vbsaa=_neg_vbsxx
txa
//SEG18 [9] (signed byte) main::sb#0 ← - (signed byte~) main::$1 [ main::b#2 main::sb#0 ] ( main:2 [ main::b#2 main::sb#0 ] ) -- vbsaa=_neg_vbsaa
eor #$ff
clc
adc #1
//SEG19 [10] (byte~) main::$3 ← ((byte)) (signed byte) main::sb#0 [ main::b#2 main::$3 ] ( main:2 [ main::b#2 main::$3 ] ) -- vbuaa=_byte_vbsaa
//SEG20 [11] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte~) main::$3 [ main::b#2 ] ( main:2 [ main::b#2 ] ) -- pbuc1_derefidx_vbuxx=vbuaa
//SEG18 [9] *((const byte*) SCREEN2#0 + (byte) main::b#2) ← (byte)(signed byte) main::sb#0 [ main::b#2 ] ( main:2 [ main::b#2 ] ) -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN2,x
//SEG21 [12] (byte) main::b#1 ← ++ (byte) main::b#2 [ main::b#1 ] ( main:2 [ main::b#1 ] ) -- vbuxx=_inc_vbuxx
//SEG19 [10] (byte) main::b#1 ← ++ (byte) main::b#2 [ main::b#1 ] ( main:2 [ main::b#1 ] ) -- vbuxx=_inc_vbuxx
inx
//SEG22 [13] if((byte) main::b#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::b#1 ] ( main:2 [ main::b#1 ] ) -- vbuxx_neq_vbuc1_then_la1
//SEG20 [11] if((byte) main::b#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::b#1 ] ( main:2 [ main::b#1 ] ) -- vbuxx_neq_vbuc1_then_la1
cpx #$65
bne b1
//SEG23 [14] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG24 main::@2
//SEG25 [15] call w param-assignment [ ] ( main:2 [ ] )
//SEG26 [17] phi from main::@2 to w [phi:main::@2->w]
//SEG21 [12] phi from main::@1 to main::@2 [phi:main::@1->main::@2]
//SEG22 main::@2
//SEG23 [13] call w param-assignment [ ] ( main:2 [ ] )
//SEG24 [15] phi from main::@2 to w [phi:main::@2->w]
jsr w
//SEG27 main::@return
//SEG28 [16] return [ ] ( main:2 [ ] )
//SEG25 main::@return
//SEG26 [14] return [ ] ( main:2 [ ] )
rts
}
//SEG29 w
//SEG27 w
w: {
.const w1 = $514
.const w2 = $4e2
.const b = w1-w2
//SEG30 [18] phi from w to w::@1 [phi:w->w::@1]
//SEG31 [18] phi (byte) w::i#2 = (byte/signed byte/word/signed word) 0 [phi:w->w::@1#0] -- vbuyy=vbuc1
//SEG28 [16] phi from w to w::@1 [phi:w->w::@1]
//SEG29 [16] phi (byte) w::i#2 = (byte/signed byte/word/signed word) 0 [phi:w->w::@1#0] -- vbuyy=vbuc1
ldy #0
//SEG32 [18] phi from w::@1 to w::@1 [phi:w::@1->w::@1]
//SEG33 [18] phi (byte) w::i#2 = (byte) w::i#1 [phi:w::@1->w::@1#0] -- register_copy
//SEG34 w::@1
//SEG30 [16] phi from w::@1 to w::@1 [phi:w::@1->w::@1]
//SEG31 [16] phi (byte) w::i#2 = (byte) w::i#1 [phi:w::@1->w::@1#0] -- register_copy
//SEG32 w::@1
b1:
//SEG35 [19] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] ) -- vbuxx=vbuc1_plus_vbuyy
//SEG33 [17] (byte) w::b2#0 ← (word/signed word) 1400-(word/signed word) 1350 + (byte) w::i#2 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] ) -- vbuxx=vbuc1_plus_vbuyy
tya
clc
adc #$578-$546
tax
//SEG36 [20] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:15 [ w::i#2 w::b2#0 ] ) -- pbuc1_derefidx_vbuyy=vbuc2
//SEG34 [18] *((const byte*) SCREEN3#0 + (byte) w::i#2) ← (const byte) w::b#0 [ w::i#2 w::b2#0 ] ( main:2::w:13 [ w::i#2 w::b2#0 ] ) -- pbuc1_derefidx_vbuyy=vbuc2
lda #b
sta SCREEN3,y
//SEG37 [21] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:15 [ w::i#2 ] ) -- pbuc1_derefidx_vbuyy=vbuxx
//SEG35 [19] *((const byte*) SCREEN4#0 + (byte) w::i#2) ← (byte) w::b2#0 [ w::i#2 ] ( main:2::w:13 [ w::i#2 ] ) -- pbuc1_derefidx_vbuyy=vbuxx
txa
sta SCREEN4,y
//SEG38 [22] (byte) w::i#1 ← ++ (byte) w::i#2 [ w::i#1 ] ( main:2::w:15 [ w::i#1 ] ) -- vbuyy=_inc_vbuyy
//SEG36 [20] (byte) w::i#1 ← ++ (byte) w::i#2 [ w::i#1 ] ( main:2::w:13 [ w::i#1 ] ) -- vbuyy=_inc_vbuyy
iny
//SEG39 [23] if((byte) w::i#1!=(byte/signed byte/word/signed word) 11) goto w::@1 [ w::i#1 ] ( main:2::w:15 [ w::i#1 ] ) -- vbuyy_neq_vbuc1_then_la1
//SEG37 [21] if((byte) w::i#1!=(byte/signed byte/word/signed word) 11) goto w::@1 [ w::i#1 ] ( main:2::w:13 [ w::i#1 ] ) -- vbuyy_neq_vbuc1_then_la1
cpy #$b
bne b1
//SEG40 w::@return
//SEG41 [24] return [ ] ( main:2::w:15 [ ] )
//SEG38 w::@return
//SEG39 [22] return [ ] ( main:2::w:13 [ ] )
rts
}

View File

@ -10,18 +10,16 @@
(byte*) SCREEN4
(const byte*) SCREEN4#0 SCREEN4 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 40*(byte/signed byte/word/signed word) 9
(void()) main()
(signed byte~) main::$1 reg byte a 22.0
(byte~) main::$3 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@return
(byte) main::b
(byte) main::b#1 reg byte x 16.5
(byte) main::b#2 reg byte x 9.428571428571429
(byte) main::b#2 reg byte x 11.0
(byte) main::b2
(byte) main::b2#0 reg byte a 22.0
(signed byte) main::sb
(signed byte) main::sb#0 reg byte a 22.0
(signed byte) main::sb#0 reg byte a 11.0
(void()) w()
(label) w::@1
(label) w::@return
@ -40,7 +38,5 @@
reg byte x [ main::b#2 main::b#1 ]
reg byte y [ w::i#2 w::i#1 ]
reg byte a [ main::b2#0 ]
reg byte a [ main::$1 ]
reg byte a [ main::sb#0 ]
reg byte a [ main::$3 ]
reg byte x [ w::b2#0 ]

View File

@ -19,8 +19,7 @@ main::@return: scope:[main] from main::@1
[7] return [ ] ( main:2 [ ] )
to:@return
main::@2: scope:[main] from main::@1
[8] (byte~) main::$2 ← ((byte)) (signed byte) main::i#2 [ main::i#2 main::j#2 main::$2 ] ( main:2 [ main::i#2 main::j#2 main::$2 ] )
[9] *((const byte*) main::screen#0 + (byte) main::j#2) ← (byte~) main::$2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] )
[10] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 [ main::j#2 main::i#1 ] ( main:2 [ main::j#2 main::i#1 ] )
[11] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#1 main::j#1 ] ( main:2 [ main::i#1 main::j#1 ] )
[8] *((const byte*) main::screen#0 + (byte) main::j#2) ← (byte)(signed byte) main::i#2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] )
[9] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 [ main::j#2 main::i#1 ] ( main:2 [ main::j#2 main::i#1 ] )
[10] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#1 main::j#1 ] ( main:2 [ main::i#1 main::j#1 ] )
to:main::@1

View File

@ -174,6 +174,8 @@ Constant (const byte*) main::screen#0 = ((byte*))1024
Constant (const byte) main::j#0 = 0
Constant (const signed byte) main::i#0 = -127
Succesful SSA optimization Pass2ConstantIdentification
Eliminating Noop Cast (byte~) main::$2 ← ((byte)) (signed byte) main::i#2
Succesful SSA optimization Pass2NopCastElimination
OPTIMIZING CONTROL FLOW GRAPH
Inlining constant with var siblings (const byte) main::j#0
Inlining constant with var siblings (const byte) main::j#0
@ -194,10 +196,9 @@ Calls in [] to main:2
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Created 2 initial phi equivalence classes
Coalesced [12] main::i#4 ← main::i#1
Coalesced [13] main::j#4 ← main::j#1
Coalesced [11] main::i#4 ← main::i#1
Coalesced [12] main::j#4 ← main::j#1
Coalesced down to 2 phi equivalence classes
Block Sequence Planned @begin @1 @end main main::@1 main::@return main::@2
Adding NOP phi() at start of @begin
@ -207,7 +208,6 @@ Adding NOP phi() at start of main
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
@ -231,10 +231,9 @@ main::@return: scope:[main] from main::@1
[7] return [ ] ( main:2 [ ] )
to:@return
main::@2: scope:[main] from main::@1
[8] (byte~) main::$2 ← ((byte)) (signed byte) main::i#2 [ main::i#2 main::j#2 main::$2 ] ( main:2 [ main::i#2 main::j#2 main::$2 ] )
[9] *((const byte*) main::screen#0 + (byte) main::j#2) ← (byte~) main::$2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] )
[10] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 [ main::j#2 main::i#1 ] ( main:2 [ main::j#2 main::i#1 ] )
[11] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#1 main::j#1 ] ( main:2 [ main::i#1 main::j#1 ] )
[8] *((const byte*) main::screen#0 + (byte) main::j#2) ← (byte)(signed byte) main::i#2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] )
[9] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 [ main::j#2 main::i#1 ] ( main:2 [ main::j#2 main::i#1 ] )
[10] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#1 main::j#1 ] ( main:2 [ main::i#1 main::j#1 ] )
to:main::@1
DOMINATORS
@ -260,26 +259,22 @@ Loop head: main::@1 tails: main::@2 blocks: main::@2 main::@1 depth: 1
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte~) main::$2 22.0
(signed byte) main::i
(signed byte) main::i#1 11.0
(signed byte) main::i#2 11.0
(byte) main::j
(byte) main::j#1 22.0
(byte) main::j#2 6.6000000000000005
(byte) main::j#2 8.25
(byte*) main::screen
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#2 main::j#1 ]
Added variable main::$2 to zero page equivalence class [ main::$2 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ main::j#2 main::j#1 ]
[ main::$2 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:3 [ main::j#2 main::j#1 ]
Allocated zp ZP_BYTE:4 [ main::$2 ]
INITIAL ASM
//SEG0 Basic Upstart
@ -306,7 +301,6 @@ bend:
//SEG9 main
main: {
.const screen = $400
.label _2 = 4
.label i = 2
.label j = 3
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
@ -335,21 +329,18 @@ main: {
rts
//SEG17 main::@2
b2:
//SEG18 [8] (byte~) main::$2 ← ((byte)) (signed byte) main::i#2 [ main::i#2 main::j#2 main::$2 ] ( main:2 [ main::i#2 main::j#2 main::$2 ] ) -- vbuz1=_byte_vbsz2
//SEG18 [8] *((const byte*) main::screen#0 + (byte) main::j#2) ← (byte)(signed byte) main::i#2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] ) -- pbuc1_derefidx_vbuz1=vbuz2
lda i
sta _2
//SEG19 [9] *((const byte*) main::screen#0 + (byte) main::j#2) ← (byte~) main::$2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] ) -- pbuc1_derefidx_vbuz1=vbuz2
lda _2
ldy j
sta screen,y
//SEG20 [10] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 [ main::j#2 main::i#1 ] ( main:2 [ main::j#2 main::i#1 ] ) -- vbsz1=_inc_vbsz1
//SEG19 [9] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 [ main::j#2 main::i#1 ] ( main:2 [ main::j#2 main::i#1 ] ) -- vbsz1=_inc_vbsz1
inc i
//SEG21 [11] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#1 main::j#1 ] ( main:2 [ main::i#1 main::j#1 ] ) -- vbuz1=_inc_vbuz1
//SEG20 [10] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#1 main::j#1 ] ( main:2 [ main::i#1 main::j#1 ] ) -- vbuz1=_inc_vbuz1
inc j
//SEG22 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG21 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
//SEG23 [5] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@1#0] -- register_copy
//SEG24 [5] phi (signed byte) main::i#2 = (signed byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
//SEG22 [5] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@1#0] -- register_copy
//SEG23 [5] phi (signed byte) main::i#2 = (signed byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
jmp b1
}
@ -357,16 +348,17 @@ REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] if((signed byte) main::i#2<(byte/signed byte/word/signed word) 127) goto main::@2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::j#2 main::j#1 ]
Statement [8] *((const byte*) main::screen#0 + (byte) main::j#2) ← (byte)(signed byte) main::i#2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] ) always clobbers reg byte a
Statement [6] if((signed byte) main::i#2<(byte/signed byte/word/signed word) 127) goto main::@2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] ) always clobbers reg byte a
Statement [8] *((const byte*) main::screen#0 + (byte) main::j#2) ← (byte)(signed byte) main::i#2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] ) 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::j#2 main::j#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::$2 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 28.6: zp ZP_BYTE:3 [ main::j#2 main::j#1 ] 22: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 22: zp ZP_BYTE:4 [ main::$2 ]
Uplift Scope [main] 30.25: zp ZP_BYTE:3 [ main::j#2 main::j#1 ] 22: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope []
Uplifting [main] best 388 combination reg byte y [ main::j#2 main::j#1 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$2 ]
Uplifting [main] best 388 combination reg byte y [ main::j#2 main::j#1 ] reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 388 combination
ASSEMBLER BEFORE OPTIMIZATION
@ -418,18 +410,17 @@ main: {
rts
//SEG17 main::@2
b2:
//SEG18 [8] (byte~) main::$2 ← ((byte)) (signed byte) main::i#2 [ main::i#2 main::j#2 main::$2 ] ( main:2 [ main::i#2 main::j#2 main::$2 ] ) -- vbuaa=_byte_vbsxx
//SEG18 [8] *((const byte*) main::screen#0 + (byte) main::j#2) ← (byte)(signed byte) main::i#2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] ) -- pbuc1_derefidx_vbuyy=vbuxx
txa
//SEG19 [9] *((const byte*) main::screen#0 + (byte) main::j#2) ← (byte~) main::$2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] ) -- pbuc1_derefidx_vbuyy=vbuaa
sta screen,y
//SEG20 [10] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 [ main::j#2 main::i#1 ] ( main:2 [ main::j#2 main::i#1 ] ) -- vbsxx=_inc_vbsxx
//SEG19 [9] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 [ main::j#2 main::i#1 ] ( main:2 [ main::j#2 main::i#1 ] ) -- vbsxx=_inc_vbsxx
inx
//SEG21 [11] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#1 main::j#1 ] ( main:2 [ main::i#1 main::j#1 ] ) -- vbuyy=_inc_vbuyy
//SEG20 [10] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#1 main::j#1 ] ( main:2 [ main::i#1 main::j#1 ] ) -- vbuyy=_inc_vbuyy
iny
//SEG22 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG21 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
b1_from_b2:
//SEG23 [5] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@1#0] -- register_copy
//SEG24 [5] phi (signed byte) main::i#2 = (signed byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
//SEG22 [5] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@1#0] -- register_copy
//SEG23 [5] phi (signed byte) main::i#2 = (signed byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
jmp b1
}
@ -456,7 +447,6 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(void()) main()
(byte~) main::$2 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@return
@ -465,13 +455,12 @@ FINAL SYMBOL TABLE
(signed byte) main::i#2 reg byte x 11.0
(byte) main::j
(byte) main::j#1 reg byte y 22.0
(byte) main::j#2 reg byte y 6.6000000000000005
(byte) main::j#2 reg byte y 8.25
(byte*) main::screen
(const byte*) main::screen#0 screen = ((byte*))(word/signed word) 1024
reg byte x [ main::i#2 main::i#1 ]
reg byte y [ main::j#2 main::j#1 ]
reg byte a [ main::$2 ]
FINAL ASSEMBLER
@ -513,17 +502,16 @@ main: {
rts
//SEG17 main::@2
b2:
//SEG18 [8] (byte~) main::$2 ← ((byte)) (signed byte) main::i#2 [ main::i#2 main::j#2 main::$2 ] ( main:2 [ main::i#2 main::j#2 main::$2 ] ) -- vbuaa=_byte_vbsxx
//SEG18 [8] *((const byte*) main::screen#0 + (byte) main::j#2) ← (byte)(signed byte) main::i#2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] ) -- pbuc1_derefidx_vbuyy=vbuxx
txa
//SEG19 [9] *((const byte*) main::screen#0 + (byte) main::j#2) ← (byte~) main::$2 [ main::i#2 main::j#2 ] ( main:2 [ main::i#2 main::j#2 ] ) -- pbuc1_derefidx_vbuyy=vbuaa
sta screen,y
//SEG20 [10] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 [ main::j#2 main::i#1 ] ( main:2 [ main::j#2 main::i#1 ] ) -- vbsxx=_inc_vbsxx
//SEG19 [9] (signed byte) main::i#1 ← ++ (signed byte) main::i#2 [ main::j#2 main::i#1 ] ( main:2 [ main::j#2 main::i#1 ] ) -- vbsxx=_inc_vbsxx
inx
//SEG21 [11] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#1 main::j#1 ] ( main:2 [ main::i#1 main::j#1 ] ) -- vbuyy=_inc_vbuyy
//SEG20 [10] (byte) main::j#1 ← ++ (byte) main::j#2 [ main::i#1 main::j#1 ] ( main:2 [ main::i#1 main::j#1 ] ) -- vbuyy=_inc_vbuyy
iny
//SEG22 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG23 [5] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@1#0] -- register_copy
//SEG24 [5] phi (signed byte) main::i#2 = (signed byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
//SEG21 [5] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
//SEG22 [5] phi (byte) main::j#2 = (byte) main::j#1 [phi:main::@2->main::@1#0] -- register_copy
//SEG23 [5] phi (signed byte) main::i#2 = (signed byte) main::i#1 [phi:main::@2->main::@1#1] -- register_copy
jmp b1
}

View File

@ -2,7 +2,6 @@
(label) @begin
(label) @end
(void()) main()
(byte~) main::$2 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@return
@ -11,10 +10,9 @@
(signed byte) main::i#2 reg byte x 11.0
(byte) main::j
(byte) main::j#1 reg byte y 22.0
(byte) main::j#2 reg byte y 6.6000000000000005
(byte) main::j#2 reg byte y 8.25
(byte*) main::screen
(const byte*) main::screen#0 screen = ((byte*))(word/signed word) 1024
reg byte x [ main::i#2 main::i#1 ]
reg byte y [ main::j#2 main::j#1 ]
reg byte a [ main::$2 ]

View File

@ -239,29 +239,26 @@ print_sbyte: {
rts
}
signed_multiply: {
.label _13 = $e
.label m = 6
.label return = 6
.label b = 3
.label return = 6
tya
ldx b
jsr multiply
cpy #0
bpl b1
lda m+1
ldx b
stx $ff
sec
sbc $ff
sbc b
sta m+1
b1:
lda b
cmp #0
bpl b2
lda m+1
sty _13
sty $ff
sec
sbc _13
sbc $ff
sta m+1
b2:
rts

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -95,13 +95,13 @@
(word()) multiply((byte) multiply::a , (byte) multiply::b)
(label) multiply::@return
(byte) multiply::a
(byte) multiply::a#0 reg byte a 2.0
(byte) multiply::a#1 reg byte a 101.0
(byte) multiply::a#2 reg byte a 105.0
(byte~) multiply::a#4 reg byte a 2.0
(byte) multiply::b
(byte) multiply::b#0 reg byte x 4.0
(byte) multiply::b#1 reg byte x 202.0
(byte) multiply::b#2 reg byte x 52.5
(byte~) multiply::b#4 reg byte x 4.0
(byte*) multiply::memA
(const byte*) multiply::memA#0 memA = ((byte*))(byte/word/signed word) 254
(byte*) multiply::memB
@ -179,12 +179,12 @@
(label) print_byte::@1
(label) print_byte::@return
(byte) print_byte::b
(byte) print_byte::b#0 reg byte x 4.0
(byte) print_byte::b#1 reg byte x 4.0
(byte) print_byte::b#2 reg byte x 4.0
(byte) print_byte::b#3 reg byte x 4.0
(byte) print_byte::b#4 reg byte x 4.0
(byte) print_byte::b#5 reg byte x 3.5
(byte~) print_byte::b#9 reg byte x 4.0
(byte[]) print_byte::hextab
(const string) print_byte::hextab#0 hextab = (string) "0123456789abcdef"
(void()) print_char((byte) print_char::ch)
@ -212,7 +212,7 @@
(signed byte) print_sbyte::b#1 reg byte x 4.0
(signed byte) print_sbyte::b#2 reg byte x 4.0
(signed byte) print_sbyte::b#3 reg byte x 2.5
(signed byte) print_sbyte::b#4 reg byte x 6.0
(signed byte) print_sbyte::b#4 reg byte x 4.0
(void()) print_str((byte*) print_str::str)
(label) print_str::@1
(label) print_str::@2
@ -231,24 +231,22 @@
(signed word) print_sword::w#1 w zp ZP_WORD:6 4.0
(signed word) print_sword::w#2 w zp ZP_WORD:6 4.0
(signed word) print_sword::w#3 w zp ZP_WORD:6 2.5
(signed word) print_sword::w#4 w zp ZP_WORD:6 6.0
(signed word) print_sword::w#4 w zp ZP_WORD:6 4.0
(void()) print_word((word) print_word::w)
(label) print_word::@1
(label) print_word::@return
(word) print_word::w
(word) print_word::w#0 w zp ZP_WORD:6 4.0
(word) print_word::w#1 w zp ZP_WORD:6 4.0
(word~) print_word::w#11 w zp ZP_WORD:6 4.0
(word) print_word::w#2 w zp ZP_WORD:6 4.0
(word) print_word::w#3 w zp ZP_WORD:6 4.0
(word) print_word::w#4 w zp ZP_WORD:6 4.0
(word) print_word::w#5 w zp ZP_WORD:6 4.666666666666666
(signed word()) signed_multiply((signed byte) signed_multiply::a , (signed byte) signed_multiply::b)
(byte~) signed_multiply::$12 reg byte a 2.0
(byte~) signed_multiply::$13 $13 zp ZP_BYTE:14 4.0
(byte~) signed_multiply::$12 reg byte a 4.0
(byte/signed byte/word/signed word~) signed_multiply::$16 reg byte a 4.0
(byte/signed byte/word/signed word~) signed_multiply::$17 reg byte a 4.0
(byte~) signed_multiply::$6 reg byte a 2.0
(byte~) signed_multiply::$7 reg byte x 4.0
(byte~) signed_multiply::$6 reg byte a 4.0
(label) signed_multiply::@1
(label) signed_multiply::@2
(label) signed_multiply::@3
@ -256,17 +254,16 @@
(label) signed_multiply::@6
(label) signed_multiply::@return
(signed byte) signed_multiply::a
(signed byte) signed_multiply::a#0 reg byte y 7.133333333333335
(signed byte) signed_multiply::a#0 reg byte y 7.357142857142858
(signed byte) signed_multiply::b
(signed byte) signed_multiply::b#0 b zp ZP_BYTE:3 8.916666666666664
(signed byte) signed_multiply::b#0 b zp ZP_BYTE:3 9.363636363636363
(word) signed_multiply::m
(word) signed_multiply::m#0 m zp ZP_WORD:6 1.6
(word) signed_multiply::m#0 m zp ZP_WORD:6 2.0
(word) signed_multiply::m#1 m zp ZP_WORD:6 4.0
(word) signed_multiply::m#2 m zp ZP_WORD:6 4.0
(word) signed_multiply::m#4 m zp ZP_WORD:6 6.0
(word) signed_multiply::m#5 m zp ZP_WORD:6 2.0
(word) signed_multiply::m#4 m zp ZP_WORD:6 1.3333333333333333
(word) signed_multiply::m#5 m zp ZP_WORD:6 2.5
(signed word) signed_multiply::return
(signed word) signed_multiply::return#0 return zp ZP_WORD:6 34.33333333333333
(signed word) signed_multiply::return#2 return zp ZP_WORD:6 202.0
(void()) signed_multiply_error((signed byte) signed_multiply_error::a , (signed byte) signed_multiply_error::b , (signed word) signed_multiply_error::ms , (signed word) signed_multiply_error::ma)
(label) signed_multiply_error::@1
@ -357,13 +354,13 @@
zp ZP_BYTE:2 [ signed_multiply_results_compare::a#6 signed_multiply_results_compare::a#1 multiply_results_compare::a#6 multiply_results_compare::a#1 init_multiply::x_2#3 init_multiply::x_2#2 init_multiply::x_2#1 init_multiply::dir#2 init_multiply::dir#3 slow_signed_multiply::a#0 signed_multiply_error::b#0 slow_multiply::a#0 multiply_error::b#0 ]
zp ZP_BYTE:3 [ signed_multiply_results_compare::b#2 signed_multiply_results_compare::b#1 multiply_results_compare::b#2 multiply_results_compare::b#1 signed_multiply::b#0 ]
zp ZP_WORD:4 [ line_cursor#20 line_cursor#40 line_cursor#27 line_cursor#1 multiply_tables_compare::kc_sqr#2 multiply_tables_compare::kc_sqr#1 init_multiply::sqr1_lo#2 init_multiply::sqr1_lo#1 init_multiply::sqr2_lo#2 init_multiply::sqr2_lo#1 print_cls::sc#2 print_cls::sc#1 ]
zp ZP_WORD:6 [ print_str::str#14 print_str::str#16 print_str::str#0 print_sword::w#4 print_sword::w#3 print_sword::w#1 print_sword::w#2 print_sword::w#0 print_word::w#5 print_word::w#3 print_word::w#4 print_word::w#1 print_word::w#2 print_word::w#0 signed_multiply::m#4 signed_multiply::m#5 signed_multiply::m#1 signed_multiply::m#0 signed_multiply::m#2 slow_signed_multiply::m#5 slow_signed_multiply::return#0 slow_signed_multiply::m#3 slow_signed_multiply::m#1 slow_signed_multiply::m#2 slow_multiply::return#0 slow_multiply::m#3 slow_multiply::m#1 init_multiply::sqr1_hi#2 init_multiply::sqr1_hi#1 init_multiply::sqr2_hi#2 init_multiply::sqr2_hi#1 slow_signed_multiply::return#2 signed_multiply::return#2 signed_multiply_results_compare::ma#0 multiply::return#2 signed_multiply::return#0 multiply::return#0 slow_multiply::return#2 multiply::return#3 multiply_results_compare::ma#0 ]
reg byte x [ print_byte::b#5 print_byte::b#3 print_byte::b#4 print_byte::b#0 print_byte::b#1 print_byte::b#2 ]
zp ZP_WORD:6 [ print_str::str#14 print_str::str#16 print_str::str#0 print_sword::w#4 print_sword::w#3 print_sword::w#1 print_sword::w#2 print_sword::w#0 print_word::w#5 print_word::w#3 print_word::w#4 print_word::w#1 print_word::w#2 print_word::w#11 signed_multiply::m#4 signed_multiply::m#5 signed_multiply::m#1 signed_multiply::m#0 signed_multiply::m#2 slow_signed_multiply::m#5 slow_signed_multiply::return#0 slow_signed_multiply::m#3 slow_signed_multiply::m#1 slow_signed_multiply::m#2 slow_multiply::return#0 slow_multiply::m#3 slow_multiply::m#1 init_multiply::sqr1_hi#2 init_multiply::sqr1_hi#1 init_multiply::sqr2_hi#2 init_multiply::sqr2_hi#1 slow_signed_multiply::return#2 signed_multiply::return#2 signed_multiply_results_compare::ma#0 multiply::return#2 multiply::return#0 slow_multiply::return#2 multiply::return#3 multiply_results_compare::ma#0 ]
reg byte x [ print_byte::b#5 print_byte::b#3 print_byte::b#4 print_byte::b#9 print_byte::b#1 print_byte::b#2 ]
reg byte a [ print_char::ch#4 print_char::ch#2 print_char::ch#3 ]
zp ZP_WORD:8 [ char_cursor#75 char_cursor#124 char_cursor#123 char_cursor#119 char_cursor#135 char_cursor#27 char_cursor#118 char_cursor#17 char_cursor#117 char_cursor#172 char_cursor#176 char_cursor#1 char_cursor#121 char_cursor#197 init_multiply::sqr#3 init_multiply::sqr#4 init_multiply::sqr#1 init_multiply::sqr#2 signed_multiply_results_compare::ms#0 ]
reg byte x [ print_sbyte::b#4 print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#2 print_sbyte::b#0 ]
reg byte a [ multiply::a#2 multiply::a#1 multiply::a#0 ]
reg byte x [ multiply::b#2 multiply::b#1 multiply::b#0 ]
reg byte a [ multiply::a#2 multiply::a#1 multiply::a#4 ]
reg byte x [ multiply::b#2 multiply::b#1 multiply::b#4 ]
reg byte y [ slow_signed_multiply::i#2 slow_signed_multiply::i#1 ]
reg byte y [ slow_signed_multiply::j#2 slow_signed_multiply::j#1 ]
reg byte y [ slow_multiply::i#2 slow_multiply::i#1 ]
@ -377,10 +374,8 @@ zp ZP_WORD:12 [ signed_multiply_error::ma#0 multiply_error::ma#0 ]
reg byte a [ print_byte::$0 ]
reg byte a [ print_byte::$2 ]
reg byte a [ signed_multiply::$6 ]
reg byte x [ signed_multiply::$7 ]
reg byte a [ signed_multiply::$16 ]
reg byte a [ signed_multiply::$12 ]
zp ZP_BYTE:14 [ signed_multiply::$13 ]
reg byte a [ signed_multiply::$17 ]
reg byte x [ slow_multiply::b#0 ]
reg byte x [ multiply_error::a#0 ]