1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-04-08 14:37:40 +00:00

Pointers to noargs functions working pretty well. Closes #120

This commit is contained in:
jespergravgaard 2019-04-07 11:08:39 +02:00
parent ca9453346b
commit a334855da8
51 changed files with 2929 additions and 1574 deletions

View File

@ -249,7 +249,7 @@ public class Compiler {
optimizations.add(new Pass2NopCastElimination(program));
optimizations.add(new Pass2EliminateUnusedBlocks(program));
optimizations.add(new Pass2RangeResolving(program));
// optimizations.add(new Pass2ConstantCallPointerIdentification(program));
optimizations.add(new Pass2ConstantCallPointerIdentification(program));
pass2Execute(optimizations);
}

View File

@ -34,21 +34,19 @@ public class Pass2ConstantCallPointerIdentification extends Pass2SsaOptimization
RValue pointer = ((PointerDereferenceSimple) procedure).getPointer();
ProcedureRef constProcedureRef = findConstProcedure(pointer);
if(constProcedureRef != null) {
statementsIt.remove();
StatementCall call = new StatementCall(callPointer.getlValue(), constProcedureRef.getFullName(), callPointer.getParameters(), callPointer.getSource(), callPointer.getComments());
call.setProcedure(constProcedureRef);
call.setIndex(callPointer.getIndex());
block.setCallSuccessor(constProcedureRef.getLabelRef());
statementsIt.add(call);
getLog().append("Replacing constant pointer function " + call.toString(getProgram(), false));
replacePointerCall(callPointer, constProcedureRef, statementsIt, block);
optimized = true;
}
} else if(procedure instanceof ConstantRef) {
ConstantVar procedureVariable = getScope().getConstant((ConstantRef) procedure);
SymbolType procedureVariableType = procedureVariable.getType();
if(procedureVariableType instanceof SymbolTypePointer) {
if(((SymbolTypePointer) procedureVariableType).getElementType() instanceof SymbolTypeProcedure) {
optimized = true;
throw new RuntimeException("not implemented!");
ProcedureRef constProcedureRef = findConstProcedure(procedure);
if(constProcedureRef != null) {
replacePointerCall(callPointer, constProcedureRef, statementsIt, block);
optimized = true;
}
}
}
}
@ -58,6 +56,30 @@ public class Pass2ConstantCallPointerIdentification extends Pass2SsaOptimization
return optimized;
}
/**
* Replace a pointer-based call to a constant procedure with a classic procedure call
* @param callPointer The call to replace
* @param constProcedureRef The constant procedure pointed to
* @param statementsIt The statement iterator currently pointing to the pointer-based call
* @param block The block containing the call
*/
private void replacePointerCall(StatementCallPointer callPointer, ProcedureRef constProcedureRef, ListIterator<Statement> statementsIt, ControlFlowBlock block) {
statementsIt.remove();
StatementCall call = new StatementCall(callPointer.getlValue(), constProcedureRef.getFullName(), callPointer.getParameters(), callPointer.getSource(), callPointer.getComments());
call.setProcedure(constProcedureRef);
call.setIndex(callPointer.getIndex());
block.setCallSuccessor(constProcedureRef.getLabelRef());
statementsIt.add(call);
getLog().append("Replacing constant pointer function " + call.toString(getProgram(), false));
}
/**
* Examine whither the passed RValue represents a constant procedure pointer.
* If it does returns the procedure pointed to
*
* @param procedurePointer The potential procedure pointer
* @return The procedure pointed to
*/
private ProcedureRef findConstProcedure(RValue procedurePointer) {
if(procedurePointer instanceof ConstantRef) {
ConstantVar constant = getScope().getConstant((ConstantRef) procedurePointer);

View File

@ -1,6 +1,7 @@
package dk.camelot64.kickc.passes;
import dk.camelot64.kickc.model.*;
import dk.camelot64.kickc.model.symbols.VariableVersion;
import dk.camelot64.kickc.model.values.VariableRef;
import dk.camelot64.kickc.model.statements.StatementAssignment;
import dk.camelot64.kickc.model.symbols.Variable;
@ -28,6 +29,28 @@ public class Pass4LiveRangeEquivalenceClassesFinalize extends Pass2Base {
getLog().append(liveRangeEquivalenceClass.toString());
}
// Add all versions of volatile variables to the same equivalence class
for(Variable variable : getSymbols().getAllVariables(true)) {
if(variable.isVersioned() && variable.isDeclaredVolatile()) {
// Found a volatile non-versioned variable
for(Variable otherVariable : variable.getScope().getAllVariables(false)) {
if(otherVariable.isVersioned()) {
if(((VariableVersion)otherVariable).getVersionOf().equals(((VariableVersion)variable).getVersionOf())) {
// They share the same main variable
LiveRangeEquivalenceClass varEC = liveRangeEquivalenceClassSet.getOrCreateEquivalenceClass(variable.getRef());
LiveRangeEquivalenceClass otherEC = liveRangeEquivalenceClassSet.getOrCreateEquivalenceClass(otherVariable.getRef());
if(!varEC.equals(otherEC)) {
getLog().append("Coalescing volatile variable equivalence classes " + varEC.toString() + " and " + otherEC.toString());
liveRangeEquivalenceClassSet.consolidate(varEC, otherEC);
}
}
}
}
}
}
// Add all other variables one by one to an available equivalence class - or create a new one
EquivalenceClassAdder equivalenceClassAdder = new EquivalenceClassAdder(liveRangeEquivalenceClassSet);
equivalenceClassAdder.visitGraph(getGraph());

View File

@ -42,6 +42,16 @@ public class TestPrograms {
compileAndCompare("pointer-pointer-1" );
}
@Test
public void testFunctionPointerNoargCall10() throws IOException, URISyntaxException {
compileAndCompare("function-pointer-noarg-call-10");
}
@Test
public void testFunctionPointerNoargCall9() throws IOException, URISyntaxException {
compileAndCompare("function-pointer-noarg-call-9");
}
@Test
public void testFunctionPointerNoargCall8() throws IOException, URISyntaxException {
compileAndCompare("function-pointer-noarg-call-8");

View File

@ -0,0 +1,30 @@
// Tests calling into different function pointers which call a common sub-method
void main() {
do10(&hello);
do10(&world);
}
void do10(void()* fn) {
for( byte i: 0..9)
(*fn)();
}
void hello() {
print("hello @");
}
void world() {
print("world @");
}
const byte* SCREEN = $0400;
volatile byte idx = 0;
void print(byte* msg) {
byte i=0;
do {
SCREEN[idx++] = msg[i++];
} while(msg[i]!='@');
}

View File

@ -0,0 +1,19 @@
// Tests calling into a function pointer which modifies global volatile
const byte* SCREEN = $0400;
volatile byte idx = 0;
void main() {
void()* f = &fn1;
(*f)();
SCREEN[idx] = 'a';
(*f)();
SCREEN[idx] = 'a';
}
void fn1() {
idx++;
}

View File

@ -195,18 +195,15 @@ interrupt(HARDWARE_CLOBBER)(void()) irq()
Initial phi equivalence classes
[ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ]
Added variable irq_raster_next#0 to zero page equivalence class [ irq_raster_next#0 ]
Added variable irq_raster_next#1 to zero page equivalence class [ irq_raster_next#1 ]
Coalescing volatile variable equivalence classes [ irq_raster_next#0 ] and [ irq_raster_next#1 ]
Added variable irq::$0 to zero page equivalence class [ irq::$0 ]
Complete equivalence classes
[ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ]
[ irq_raster_next#0 ]
[ irq_raster_next#1 ]
[ irq_raster_next#0 irq_raster_next#1 ]
[ irq::$0 ]
Allocated zp ZP_BYTE:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ]
Allocated zp ZP_BYTE:3 [ irq_raster_next#0 ]
Allocated zp ZP_BYTE:4 [ irq_raster_next#1 ]
Allocated zp ZP_BYTE:5 [ irq::$0 ]
Allocated zp ZP_BYTE:3 [ irq_raster_next#0 irq_raster_next#1 ]
Allocated zp ZP_BYTE:4 [ irq::$0 ]
INITIAL ASM
//SEG0 File Comments
@ -221,7 +218,6 @@ INITIAL ASM
.const BLACK = 0
.label KERNEL_IRQ = $314
.label irq_raster_next = 3
.label irq_raster_next_1 = 4
//SEG3 @begin
bbegin:
jmp b1
@ -257,7 +253,7 @@ main: {
}
//SEG15 irq
irq: {
.label _0 = 5
.label _0 = 4
.label raster_next = 2
//SEG16 entry interrupt(HARDWARE_CLOBBER)
sta rega+1
@ -266,13 +262,13 @@ irq: {
//SEG17 [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2
lda #DARK_GREY
sta BORDERCOL
//SEG18 [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) $15 -- vbuz1=vbuz2_plus_vbuc1
//SEG18 [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) $15 -- vbuz1=vbuz1_plus_vbuc1
lax irq_raster_next
axs #-[$15]
stx irq_raster_next_1
stx irq_raster_next
//SEG19 [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuz1=vbuz2
// Setup next interrupt
lda irq_raster_next_1
lda irq_raster_next
sta raster_next
//SEG20 [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuz2_band_vbuc1
lda #7
@ -321,23 +317,19 @@ Statement [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/sign
Statement [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( [ ] ) always clobbers reg byte a
Statement [16] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y
Potential registers zp ZP_BYTE:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ irq_raster_next#0 ] : zp ZP_BYTE:3 ,
Potential registers zp ZP_BYTE:4 [ irq_raster_next#1 ] : zp ZP_BYTE:4 ,
Potential registers zp ZP_BYTE:5 [ irq::$0 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ irq_raster_next#0 irq_raster_next#1 ] : zp ZP_BYTE:3 ,
Potential registers zp ZP_BYTE:4 [ irq::$0 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [irq] 12.67: zp ZP_BYTE:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] 4: zp ZP_BYTE:5 [ irq::$0 ]
Uplift Scope [] 4: zp ZP_BYTE:3 [ irq_raster_next#0 ] 4: zp ZP_BYTE:4 [ irq_raster_next#1 ]
Uplift Scope [irq] 12.67: zp ZP_BYTE:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] 4: zp ZP_BYTE:4 [ irq::$0 ]
Uplift Scope [] 8: zp ZP_BYTE:3 [ irq_raster_next#0 irq_raster_next#1 ]
Uplift Scope [main]
Uplifting [irq] best 246 combination reg byte x [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] reg byte a [ irq::$0 ]
Uplifting [] best 246 combination zp ZP_BYTE:3 [ irq_raster_next#0 ] zp ZP_BYTE:4 [ irq_raster_next#1 ]
Uplifting [] best 246 combination zp ZP_BYTE:3 [ irq_raster_next#0 irq_raster_next#1 ]
Uplifting [main] best 246 combination
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ irq_raster_next#0 ]
Uplifting [] best 246 combination zp ZP_BYTE:3 [ irq_raster_next#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ irq_raster_next#1 ]
Uplifting [] best 246 combination zp ZP_BYTE:4 [ irq_raster_next#1 ]
Coalescing zero page register with common assignment [ zp ZP_BYTE:3 [ irq_raster_next#0 ] ] with [ zp ZP_BYTE:4 [ irq_raster_next#1 ] ] - score: 1
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ irq_raster_next#0 irq_raster_next#1 ]
Uplifting [] best 246 combination zp ZP_BYTE:3 [ irq_raster_next#0 irq_raster_next#1 ]
Allocated (was zp ZP_BYTE:3) zp ZP_BYTE:2 [ irq_raster_next#0 irq_raster_next#1 ]
Interrupt procedure irq clobbers AXCNZ
Removing interrupt register storage sty regy+1 in SEG16 entry interrupt(HARDWARE_CLOBBER)

View File

@ -62,10 +62,10 @@
.const IRQ_RASTER_FIRST = SPRITES_FIRST_YPOS+$13
.const toSpritePtr1_return = PLAYFIELD_SPRITES>>6
.label render_screen_showing = 5
.label irq_raster_next = 4
.label irq_sprite_ypos = 6
.label irq_sprite_ptr = 7
.label irq_cnt = 8
.label irq_raster_next = 6
.label irq_sprite_ypos = 7
.label irq_sprite_ptr = 8
.label irq_cnt = 9
.label sin_idx = 2
bbegin:
// The screen currently being showed to the user. $00 for screen 1 / $40 for screen 2.
@ -223,7 +223,7 @@ sprites_init: {
// Utilizes duplicated gfx in the sprites to allow for some leeway in updating the sprite pointers
sprites_irq: {
.const toSpritePtr2_return = PLAYFIELD_SPRITES>>6
.label raster_sprite_gfx_modify = 9
.label raster_sprite_gfx_modify = 4
sta rega+1
stx regx+1
//(*BGCOL)++;

View File

@ -2032,29 +2032,24 @@ Initial phi equivalence classes
[ sprites_init::s#2 sprites_init::s#1 ]
[ sprites_init::xpos#2 sprites_init::xpos#1 ]
[ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
Added variable render_screen_showing#0 to zero page equivalence class [ render_screen_showing#0 ]
Added variable irq_raster_next#0 to zero page equivalence class [ irq_raster_next#0 ]
Added variable irq_sprite_ypos#0 to zero page equivalence class [ irq_sprite_ypos#0 ]
Added variable irq_sprite_ptr#0 to zero page equivalence class [ irq_sprite_ptr#0 ]
Added variable irq_cnt#0 to zero page equivalence class [ irq_cnt#0 ]
Coalescing volatile variable equivalence classes [ irq_raster_next#0 ] and [ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
Coalescing volatile variable equivalence classes [ irq_sprite_ypos#0 ] and [ irq_sprite_ypos#1 ]
Coalescing volatile variable equivalence classes [ irq_sprite_ypos#0 irq_sprite_ypos#1 ] and [ irq_sprite_ypos#2 ]
Coalescing volatile variable equivalence classes [ irq_sprite_ypos#0 irq_sprite_ypos#1 irq_sprite_ypos#2 ] and [ irq_sprite_ypos#3 ]
Coalescing volatile variable equivalence classes [ irq_sprite_ptr#0 ] and [ irq_sprite_ptr#1 ]
Coalescing volatile variable equivalence classes [ irq_sprite_ptr#0 irq_sprite_ptr#1 ] and [ irq_sprite_ptr#2 ]
Coalescing volatile variable equivalence classes [ irq_sprite_ptr#0 irq_sprite_ptr#1 irq_sprite_ptr#2 ] and [ irq_sprite_ptr#3 ]
Coalescing volatile variable equivalence classes [ irq_cnt#0 ] and [ irq_cnt#1 ]
Coalescing volatile variable equivalence classes [ irq_cnt#0 irq_cnt#1 ] and [ irq_cnt#2 ]
Added variable main::s2#0 to zero page equivalence class [ main::s2#0 ]
Added variable main::$6 to zero page equivalence class [ main::$6 ]
Added variable loop::$1 to zero page equivalence class [ loop::$1 ]
Added variable sprites_init::s2#0 to zero page equivalence class [ sprites_init::s2#0 ]
Added variable sprites_irq::ypos#0 to zero page equivalence class [ sprites_irq::ypos#0 ]
Added variable sprites_irq::$0 to zero page equivalence class [ sprites_irq::$0 ]
Added variable sprites_irq::raster_sprite_gfx_modify#0 to zero page equivalence class [ sprites_irq::raster_sprite_gfx_modify#0 ]
Added variable sprites_irq::ptr#0 to zero page equivalence class [ sprites_irq::ptr#0 ]
Added variable sprites_irq::ptr#3 to zero page equivalence class [ sprites_irq::ptr#3 ]
Added variable sprites_irq::ptr#4 to zero page equivalence class [ sprites_irq::ptr#4 ]
Added variable irq_cnt#1 to zero page equivalence class [ irq_cnt#1 ]
Added variable irq_sprite_ypos#3 to zero page equivalence class [ irq_sprite_ypos#3 ]
Added variable irq_sprite_ptr#3 to zero page equivalence class [ irq_sprite_ptr#3 ]
Added variable irq_cnt#2 to zero page equivalence class [ irq_cnt#2 ]
Added variable irq_sprite_ypos#2 to zero page equivalence class [ irq_sprite_ypos#2 ]
Added variable irq_sprite_ptr#2 to zero page equivalence class [ irq_sprite_ptr#2 ]
Added variable irq_sprite_ypos#1 to zero page equivalence class [ irq_sprite_ypos#1 ]
Added variable irq_sprite_ptr#1 to zero page equivalence class [ irq_sprite_ptr#1 ]
Added variable sprites_irq::ptr#1 to zero page equivalence class [ sprites_irq::ptr#1 ]
Added variable sprites_irq::ptr#2 to zero page equivalence class [ sprites_irq::ptr#2 ]
Complete equivalence classes
@ -2066,30 +2061,21 @@ Complete equivalence classes
[ loop::idx#2 loop::idx#0 loop::idx#1 ]
[ sprites_init::s#2 sprites_init::s#1 ]
[ sprites_init::xpos#2 sprites_init::xpos#1 ]
[ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
[ sprites_irq::raster_sprite_gfx_modify#0 ]
[ render_screen_showing#0 ]
[ irq_raster_next#0 ]
[ irq_sprite_ypos#0 ]
[ irq_sprite_ptr#0 ]
[ irq_cnt#0 ]
[ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
[ irq_sprite_ypos#0 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ]
[ irq_sprite_ptr#0 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ]
[ irq_cnt#0 irq_cnt#1 irq_cnt#2 ]
[ main::s2#0 ]
[ main::$6 ]
[ loop::$1 ]
[ sprites_init::s2#0 ]
[ sprites_irq::ypos#0 ]
[ sprites_irq::$0 ]
[ sprites_irq::raster_sprite_gfx_modify#0 ]
[ sprites_irq::ptr#0 ]
[ sprites_irq::ptr#3 ]
[ sprites_irq::ptr#4 ]
[ irq_cnt#1 ]
[ irq_sprite_ypos#3 ]
[ irq_sprite_ptr#3 ]
[ irq_cnt#2 ]
[ irq_sprite_ypos#2 ]
[ irq_sprite_ptr#2 ]
[ irq_sprite_ypos#1 ]
[ irq_sprite_ptr#1 ]
[ sprites_irq::ptr#1 ]
[ sprites_irq::ptr#2 ]
Allocated zp ZP_BYTE:2 [ main::s#2 main::s#1 ]
@ -2100,32 +2086,23 @@ Allocated zp ZP_BYTE:6 [ loop::s#2 loop::s#1 ]
Allocated zp ZP_BYTE:7 [ loop::idx#2 loop::idx#0 loop::idx#1 ]
Allocated zp ZP_BYTE:8 [ sprites_init::s#2 sprites_init::s#1 ]
Allocated zp ZP_BYTE:9 [ sprites_init::xpos#2 sprites_init::xpos#1 ]
Allocated zp ZP_BYTE:10 [ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
Allocated zp ZP_BYTE:10 [ sprites_irq::raster_sprite_gfx_modify#0 ]
Allocated zp ZP_BYTE:11 [ render_screen_showing#0 ]
Allocated zp ZP_BYTE:12 [ irq_raster_next#0 ]
Allocated zp ZP_BYTE:13 [ irq_sprite_ypos#0 ]
Allocated zp ZP_BYTE:14 [ irq_sprite_ptr#0 ]
Allocated zp ZP_BYTE:15 [ irq_cnt#0 ]
Allocated zp ZP_BYTE:12 [ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
Allocated zp ZP_BYTE:13 [ irq_sprite_ypos#0 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ]
Allocated zp ZP_BYTE:14 [ irq_sprite_ptr#0 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ]
Allocated zp ZP_BYTE:15 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ]
Allocated zp ZP_BYTE:16 [ main::s2#0 ]
Allocated zp ZP_BYTE:17 [ main::$6 ]
Allocated zp ZP_BYTE:18 [ loop::$1 ]
Allocated zp ZP_BYTE:19 [ sprites_init::s2#0 ]
Allocated zp ZP_BYTE:20 [ sprites_irq::ypos#0 ]
Allocated zp ZP_BYTE:21 [ sprites_irq::$0 ]
Allocated zp ZP_BYTE:22 [ sprites_irq::raster_sprite_gfx_modify#0 ]
Allocated zp ZP_BYTE:23 [ sprites_irq::ptr#0 ]
Allocated zp ZP_BYTE:24 [ sprites_irq::ptr#3 ]
Allocated zp ZP_BYTE:25 [ sprites_irq::ptr#4 ]
Allocated zp ZP_BYTE:26 [ irq_cnt#1 ]
Allocated zp ZP_BYTE:27 [ irq_sprite_ypos#3 ]
Allocated zp ZP_BYTE:28 [ irq_sprite_ptr#3 ]
Allocated zp ZP_BYTE:29 [ irq_cnt#2 ]
Allocated zp ZP_BYTE:30 [ irq_sprite_ypos#2 ]
Allocated zp ZP_BYTE:31 [ irq_sprite_ptr#2 ]
Allocated zp ZP_BYTE:32 [ irq_sprite_ypos#1 ]
Allocated zp ZP_BYTE:33 [ irq_sprite_ptr#1 ]
Allocated zp ZP_BYTE:34 [ sprites_irq::ptr#1 ]
Allocated zp ZP_BYTE:35 [ sprites_irq::ptr#2 ]
Allocated zp ZP_BYTE:22 [ sprites_irq::ptr#0 ]
Allocated zp ZP_BYTE:23 [ sprites_irq::ptr#3 ]
Allocated zp ZP_BYTE:24 [ sprites_irq::ptr#4 ]
Allocated zp ZP_BYTE:25 [ sprites_irq::ptr#1 ]
Allocated zp ZP_BYTE:26 [ sprites_irq::ptr#2 ]
INITIAL ASM
//SEG0 File Comments
@ -2199,18 +2176,6 @@ INITIAL ASM
.label irq_sprite_ypos = $d
.label irq_sprite_ptr = $e
.label irq_cnt = $f
.label irq_cnt_1 = $1a
.label irq_raster_next_1 = $a
.label irq_sprite_ypos_1 = $20
.label irq_sprite_ptr_1 = $21
.label irq_cnt_2 = $1d
.label irq_raster_next_2 = $a
.label irq_sprite_ypos_2 = $1e
.label irq_sprite_ptr_2 = $1f
.label irq_raster_next_3 = $a
.label irq_sprite_ypos_3 = $1b
.label irq_sprite_ptr_3 = $1c
.label irq_raster_next_4 = $a
.label sin_idx = 5
//SEG3 @begin
bbegin:
@ -2589,12 +2554,12 @@ sprites_irq: {
.const toSpritePtr2_return = PLAYFIELD_SPRITES>>6
.label _0 = $15
.label ypos = $14
.label raster_sprite_gfx_modify = $16
.label ptr = $17
.label ptr_1 = $22
.label ptr_2 = $23
.label ptr_3 = $18
.label ptr_4 = $19
.label raster_sprite_gfx_modify = $a
.label ptr = $16
.label ptr_1 = $19
.label ptr_2 = $1a
.label ptr_3 = $17
.label ptr_4 = $18
//SEG128 entry interrupt(HARDWARE_CLOBBER)
sta rega+1
stx regx+1
@ -2670,36 +2635,34 @@ sprites_irq: {
jmp b2
//SEG149 sprites_irq::@2
b2:
//SEG150 [90] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz2
ldy irq_cnt
iny
sty irq_cnt_1
//SEG150 [90] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz1
inc irq_cnt
//SEG151 [91] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 9) goto sprites_irq::@3 -- vbuz1_eq_vbuc1_then_la1
lda #9
cmp irq_cnt_1
cmp irq_cnt
beq b3
jmp b6
//SEG152 sprites_irq::@6
b6:
//SEG153 [92] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) $a) goto sprites_irq::@4 -- vbuz1_eq_vbuc1_then_la1
lda #$a
cmp irq_cnt_1
cmp irq_cnt
beq b4
jmp b7
//SEG154 sprites_irq::@7
b7:
//SEG155 [93] (byte) irq_raster_next#3 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) $14 -- vbuz1=vbuz2_plus_vbuc1
//SEG155 [93] (byte) irq_raster_next#3 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) $14 -- vbuz1=vbuz1_plus_vbuc1
lax irq_raster_next
axs #-[$14]
stx irq_raster_next_3
//SEG156 [94] (byte) irq_sprite_ypos#3 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) $15 -- vbuz1=vbuz2_plus_vbuc1
stx irq_raster_next
//SEG156 [94] (byte) irq_sprite_ypos#3 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) $15 -- vbuz1=vbuz1_plus_vbuc1
lax irq_sprite_ypos
axs #-[$15]
stx irq_sprite_ypos_3
//SEG157 [95] (byte) irq_sprite_ptr#3 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz2_plus_vbuc1
stx irq_sprite_ypos
//SEG157 [95] (byte) irq_sprite_ptr#3 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz1_plus_vbuc1
lax irq_sprite_ptr
axs #-[3]
stx irq_sprite_ptr_3
stx irq_sprite_ptr
//SEG158 [96] phi from sprites_irq::@11 sprites_irq::@4 sprites_irq::@7 to sprites_irq::@5 [phi:sprites_irq::@11/sprites_irq::@4/sprites_irq::@7->sprites_irq::@5]
b5_from_b11:
b5_from_b4:
@ -2710,7 +2673,7 @@ sprites_irq: {
b5:
//SEG161 [97] *((const byte*) RASTER#0) ← (byte) irq_raster_next#4 -- _deref_pbuc1=vbuz1
// Setup next interrupt
lda irq_raster_next_4
lda irq_raster_next
sta RASTER
//SEG162 [98] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2
// Acknowledge the IRQ and setup the next one
@ -2731,28 +2694,28 @@ sprites_irq: {
b4:
//SEG166 [100] (byte) irq_cnt#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta irq_cnt_2
sta irq_cnt
//SEG167 [101] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1
lda #IRQ_RASTER_FIRST
sta irq_raster_next_2
//SEG168 [102] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) $15 -- vbuz1=vbuz2_plus_vbuc1
sta irq_raster_next
//SEG168 [102] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) $15 -- vbuz1=vbuz1_plus_vbuc1
lax irq_sprite_ypos
axs #-[$15]
stx irq_sprite_ypos_2
//SEG169 [103] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz2_plus_vbuc1
stx irq_sprite_ypos
//SEG169 [103] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz1_plus_vbuc1
lax irq_sprite_ptr
axs #-[3]
stx irq_sprite_ptr_2
stx irq_sprite_ptr
jmp b5_from_b4
//SEG170 sprites_irq::@3
b3:
//SEG171 [104] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) $15 -- vbuz1=vbuz2_plus_vbuc1
//SEG171 [104] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) $15 -- vbuz1=vbuz1_plus_vbuc1
lax irq_raster_next
axs #-[$15]
stx irq_raster_next_1
stx irq_raster_next
//SEG172 [105] (byte) irq_sprite_ypos#1 ← (const byte) SPRITES_FIRST_YPOS#0 -- vbuz1=vbuc1
lda #SPRITES_FIRST_YPOS
sta irq_sprite_ypos_1
sta irq_sprite_ypos
//SEG173 [106] phi from sprites_irq::@3 to sprites_irq::toSpritePtr2 [phi:sprites_irq::@3->sprites_irq::toSpritePtr2]
toSpritePtr2_from_b3:
jmp toSpritePtr2
@ -2763,7 +2726,7 @@ sprites_irq: {
b11:
//SEG176 [107] (byte) irq_sprite_ptr#1 ← (const byte) sprites_irq::toSpritePtr2_return#0 -- vbuz1=vbuc1
lda #toSpritePtr2_return
sta irq_sprite_ptr_1
sta irq_sprite_ptr
jmp b5_from_b11
//SEG177 sprites_irq::@1
b1:
@ -2864,8 +2827,7 @@ Statement [68] *((const byte*) SPRITES_COLS#0 + (byte) sprites_init::s#2) ← (c
Statement [69] (byte) sprites_init::xpos#1 ← (byte) sprites_init::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) $18 [ sprites_init::s#2 sprites_init::xpos#1 ] ( main:11::sprites_init:19 [ sprites_init::s#2 sprites_init::xpos#1 ] ) always clobbers reg byte a
Statement [81] if(*((const byte*) RASTER#0)<(byte) sprites_irq::raster_sprite_gfx_modify#0) goto sprites_irq::@8 [ render_screen_showing#0 irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 sprites_irq::raster_sprite_gfx_modify#0 ] ( [ render_screen_showing#0 irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 sprites_irq::raster_sprite_gfx_modify#0 ] ) always clobbers reg byte a
Statement [83] if((byte) render_screen_showing#0==(byte/signed byte/word/signed word/dword/signed dword) 0) goto sprites_irq::@1 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 sprites_irq::ptr#0 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 sprites_irq::ptr#0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:23 [ sprites_irq::ptr#0 ]
Statement [90] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ) always clobbers reg byte y
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:22 [ sprites_irq::ptr#0 ]
Statement [91] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 9) goto sprites_irq::@3 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ) always clobbers reg byte a
Statement [92] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) $a) goto sprites_irq::@4 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 ] ) always clobbers reg byte a
Statement [93] (byte) irq_raster_next#3 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) $14 [ irq_sprite_ypos#0 irq_sprite_ptr#0 irq_raster_next#3 ] ( [ irq_sprite_ypos#0 irq_sprite_ptr#0 irq_raster_next#3 ] ) always clobbers reg byte a reg byte x
@ -2920,7 +2882,6 @@ Statement [68] *((const byte*) SPRITES_COLS#0 + (byte) sprites_init::s#2) ← (c
Statement [69] (byte) sprites_init::xpos#1 ← (byte) sprites_init::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) $18 [ sprites_init::s#2 sprites_init::xpos#1 ] ( main:11::sprites_init:19 [ sprites_init::s#2 sprites_init::xpos#1 ] ) always clobbers reg byte a
Statement [81] if(*((const byte*) RASTER#0)<(byte) sprites_irq::raster_sprite_gfx_modify#0) goto sprites_irq::@8 [ render_screen_showing#0 irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 sprites_irq::raster_sprite_gfx_modify#0 ] ( [ render_screen_showing#0 irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 sprites_irq::raster_sprite_gfx_modify#0 ] ) always clobbers reg byte a
Statement [83] if((byte) render_screen_showing#0==(byte/signed byte/word/signed word/dword/signed dword) 0) goto sprites_irq::@1 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 sprites_irq::ptr#0 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 sprites_irq::ptr#0 ] ) always clobbers reg byte a
Statement [90] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ) always clobbers reg byte y
Statement [91] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 9) goto sprites_irq::@3 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ) always clobbers reg byte a
Statement [92] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) $a) goto sprites_irq::@4 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 ] ) always clobbers reg byte a
Statement [93] (byte) irq_raster_next#3 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) $14 [ irq_sprite_ypos#0 irq_sprite_ptr#0 irq_raster_next#3 ] ( [ irq_sprite_ypos#0 irq_sprite_ptr#0 irq_raster_next#3 ] ) always clobbers reg byte a reg byte x
@ -2944,115 +2905,79 @@ Potential registers zp ZP_BYTE:6 [ loop::s#2 loop::s#1 ] : zp ZP_BYTE:6 , reg by
Potential registers zp ZP_BYTE:7 [ loop::idx#2 loop::idx#0 loop::idx#1 ] : zp ZP_BYTE:7 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:8 [ sprites_init::s#2 sprites_init::s#1 ] : zp ZP_BYTE:8 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:9 [ sprites_init::xpos#2 sprites_init::xpos#1 ] : zp ZP_BYTE:9 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:10 [ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ] : zp ZP_BYTE:10 ,
Potential registers zp ZP_BYTE:10 [ sprites_irq::raster_sprite_gfx_modify#0 ] : zp ZP_BYTE:10 ,
Potential registers zp ZP_BYTE:11 [ render_screen_showing#0 ] : zp ZP_BYTE:11 ,
Potential registers zp ZP_BYTE:12 [ irq_raster_next#0 ] : zp ZP_BYTE:12 ,
Potential registers zp ZP_BYTE:13 [ irq_sprite_ypos#0 ] : zp ZP_BYTE:13 ,
Potential registers zp ZP_BYTE:14 [ irq_sprite_ptr#0 ] : zp ZP_BYTE:14 ,
Potential registers zp ZP_BYTE:15 [ irq_cnt#0 ] : zp ZP_BYTE:15 ,
Potential registers zp ZP_BYTE:12 [ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ] : zp ZP_BYTE:12 ,
Potential registers zp ZP_BYTE:13 [ irq_sprite_ypos#0 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ] : zp ZP_BYTE:13 ,
Potential registers zp ZP_BYTE:14 [ irq_sprite_ptr#0 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ] : zp ZP_BYTE:14 ,
Potential registers zp ZP_BYTE:15 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ] : zp ZP_BYTE:15 ,
Potential registers zp ZP_BYTE:16 [ main::s2#0 ] : zp ZP_BYTE:16 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:17 [ main::$6 ] : zp ZP_BYTE:17 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:18 [ loop::$1 ] : zp ZP_BYTE:18 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:19 [ sprites_init::s2#0 ] : zp ZP_BYTE:19 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:20 [ sprites_irq::ypos#0 ] : zp ZP_BYTE:20 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:21 [ sprites_irq::$0 ] : zp ZP_BYTE:21 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:22 [ sprites_irq::raster_sprite_gfx_modify#0 ] : zp ZP_BYTE:22 ,
Potential registers zp ZP_BYTE:23 [ sprites_irq::ptr#0 ] : zp ZP_BYTE:23 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:24 [ sprites_irq::ptr#3 ] : zp ZP_BYTE:24 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:25 [ sprites_irq::ptr#4 ] : zp ZP_BYTE:25 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:26 [ irq_cnt#1 ] : zp ZP_BYTE:26 ,
Potential registers zp ZP_BYTE:27 [ irq_sprite_ypos#3 ] : zp ZP_BYTE:27 ,
Potential registers zp ZP_BYTE:28 [ irq_sprite_ptr#3 ] : zp ZP_BYTE:28 ,
Potential registers zp ZP_BYTE:29 [ irq_cnt#2 ] : zp ZP_BYTE:29 ,
Potential registers zp ZP_BYTE:30 [ irq_sprite_ypos#2 ] : zp ZP_BYTE:30 ,
Potential registers zp ZP_BYTE:31 [ irq_sprite_ptr#2 ] : zp ZP_BYTE:31 ,
Potential registers zp ZP_BYTE:32 [ irq_sprite_ypos#1 ] : zp ZP_BYTE:32 ,
Potential registers zp ZP_BYTE:33 [ irq_sprite_ptr#1 ] : zp ZP_BYTE:33 ,
Potential registers zp ZP_BYTE:34 [ sprites_irq::ptr#1 ] : zp ZP_BYTE:34 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:35 [ sprites_irq::ptr#2 ] : zp ZP_BYTE:35 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:22 [ sprites_irq::ptr#0 ] : zp ZP_BYTE:22 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:23 [ sprites_irq::ptr#3 ] : zp ZP_BYTE:23 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:24 [ sprites_irq::ptr#4 ] : zp ZP_BYTE:24 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:25 [ sprites_irq::ptr#1 ] : zp ZP_BYTE:25 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:26 [ sprites_irq::ptr#2 ] : zp ZP_BYTE:26 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [loop] 227.25: zp ZP_BYTE:6 [ loop::s#2 loop::s#1 ] 202: zp ZP_BYTE:18 [ loop::$1 ] 194: zp ZP_BYTE:7 [ loop::idx#2 loop::idx#0 loop::idx#1 ]
Uplift Scope [] 25.67: zp ZP_BYTE:5 [ sin_idx#10 sin_idx#3 ] 20: zp ZP_BYTE:27 [ irq_sprite_ypos#3 ] 20: zp ZP_BYTE:28 [ irq_sprite_ptr#3 ] 20: zp ZP_BYTE:29 [ irq_cnt#2 ] 20: zp ZP_BYTE:30 [ irq_sprite_ypos#2 ] 20: zp ZP_BYTE:31 [ irq_sprite_ptr#2 ] 20: zp ZP_BYTE:32 [ irq_sprite_ypos#1 ] 20: zp ZP_BYTE:33 [ irq_sprite_ptr#1 ] 11.67: zp ZP_BYTE:10 [ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ] 3: zp ZP_BYTE:26 [ irq_cnt#1 ] 0.4: zp ZP_BYTE:11 [ render_screen_showing#0 ] 0.31: zp ZP_BYTE:12 [ irq_raster_next#0 ] 0.28: zp ZP_BYTE:13 [ irq_sprite_ypos#0 ] 0.26: zp ZP_BYTE:14 [ irq_sprite_ptr#0 ] 0.17: zp ZP_BYTE:15 [ irq_cnt#0 ]
Uplift Scope [] 60.28: zp ZP_BYTE:13 [ irq_sprite_ypos#0 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ] 60.26: zp ZP_BYTE:14 [ irq_sprite_ptr#0 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ] 25.67: zp ZP_BYTE:5 [ sin_idx#10 sin_idx#3 ] 23.17: zp ZP_BYTE:15 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ] 11.97: zp ZP_BYTE:12 [ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ] 0.4: zp ZP_BYTE:11 [ render_screen_showing#0 ]
Uplift Scope [main] 23.1: zp ZP_BYTE:2 [ main::s#2 main::s#1 ] 22: zp ZP_BYTE:17 [ main::$6 ] 16.5: zp ZP_BYTE:16 [ main::s2#0 ] 11: zp ZP_BYTE:4 [ main::ypos#2 main::ypos#1 ] 9.62: zp ZP_BYTE:3 [ main::xpos#2 main::xpos#1 ]
Uplift Scope [sprites_init] 25.3: zp ZP_BYTE:8 [ sprites_init::s#2 sprites_init::s#1 ] 22: zp ZP_BYTE:19 [ sprites_init::s2#0 ] 15.58: zp ZP_BYTE:9 [ sprites_init::xpos#2 sprites_init::xpos#1 ]
Uplift Scope [sprites_irq] 6.5: zp ZP_BYTE:22 [ sprites_irq::raster_sprite_gfx_modify#0 ] 4: zp ZP_BYTE:21 [ sprites_irq::$0 ] 4: zp ZP_BYTE:25 [ sprites_irq::ptr#4 ] 4: zp ZP_BYTE:35 [ sprites_irq::ptr#2 ] 2.67: zp ZP_BYTE:24 [ sprites_irq::ptr#3 ] 2.67: zp ZP_BYTE:34 [ sprites_irq::ptr#1 ] 2.5: zp ZP_BYTE:20 [ sprites_irq::ypos#0 ] 2.5: zp ZP_BYTE:23 [ sprites_irq::ptr#0 ]
Uplift Scope [sprites_irq] 6.5: zp ZP_BYTE:10 [ sprites_irq::raster_sprite_gfx_modify#0 ] 4: zp ZP_BYTE:21 [ sprites_irq::$0 ] 4: zp ZP_BYTE:24 [ sprites_irq::ptr#4 ] 4: zp ZP_BYTE:26 [ sprites_irq::ptr#2 ] 2.67: zp ZP_BYTE:23 [ sprites_irq::ptr#3 ] 2.67: zp ZP_BYTE:25 [ sprites_irq::ptr#1 ] 2.5: zp ZP_BYTE:20 [ sprites_irq::ypos#0 ] 2.5: zp ZP_BYTE:22 [ sprites_irq::ptr#0 ]
Uplift Scope [sprites_irq_init]
Uplifting [loop] best 9613 combination zp ZP_BYTE:6 [ loop::s#2 loop::s#1 ] reg byte a [ loop::$1 ] reg byte x [ loop::idx#2 loop::idx#0 loop::idx#1 ]
Uplifting [] best 9613 combination zp ZP_BYTE:5 [ sin_idx#10 sin_idx#3 ] zp ZP_BYTE:27 [ irq_sprite_ypos#3 ] zp ZP_BYTE:28 [ irq_sprite_ptr#3 ] zp ZP_BYTE:29 [ irq_cnt#2 ] zp ZP_BYTE:30 [ irq_sprite_ypos#2 ] zp ZP_BYTE:31 [ irq_sprite_ptr#2 ] zp ZP_BYTE:32 [ irq_sprite_ypos#1 ] zp ZP_BYTE:33 [ irq_sprite_ptr#1 ] zp ZP_BYTE:10 [ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ] zp ZP_BYTE:26 [ irq_cnt#1 ] zp ZP_BYTE:11 [ render_screen_showing#0 ] zp ZP_BYTE:12 [ irq_raster_next#0 ] zp ZP_BYTE:13 [ irq_sprite_ypos#0 ] zp ZP_BYTE:14 [ irq_sprite_ptr#0 ] zp ZP_BYTE:15 [ irq_cnt#0 ]
Uplifting [main] best 9333 combination reg byte y [ main::s#2 main::s#1 ] reg byte a [ main::$6 ] reg byte x [ main::s2#0 ] zp ZP_BYTE:4 [ main::ypos#2 main::ypos#1 ] zp ZP_BYTE:3 [ main::xpos#2 main::xpos#1 ]
Uplifting [loop] best 9610 combination zp ZP_BYTE:6 [ loop::s#2 loop::s#1 ] reg byte a [ loop::$1 ] reg byte x [ loop::idx#2 loop::idx#0 loop::idx#1 ]
Uplifting [] best 9610 combination zp ZP_BYTE:13 [ irq_sprite_ypos#0 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ] zp ZP_BYTE:14 [ irq_sprite_ptr#0 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ] zp ZP_BYTE:5 [ sin_idx#10 sin_idx#3 ] zp ZP_BYTE:15 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ] zp ZP_BYTE:12 [ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ] zp ZP_BYTE:11 [ render_screen_showing#0 ]
Uplifting [main] best 9330 combination reg byte y [ main::s#2 main::s#1 ] reg byte a [ main::$6 ] reg byte x [ main::s2#0 ] zp ZP_BYTE:4 [ main::ypos#2 main::ypos#1 ] zp ZP_BYTE:3 [ main::xpos#2 main::xpos#1 ]
Limited combination testing to 100 combinations of 324 possible.
Uplifting [sprites_init] best 9163 combination reg byte y [ sprites_init::s#2 sprites_init::s#1 ] reg byte x [ sprites_init::s2#0 ] zp ZP_BYTE:9 [ sprites_init::xpos#2 sprites_init::xpos#1 ]
Uplifting [sprites_irq] best 9139 combination zp ZP_BYTE:22 [ sprites_irq::raster_sprite_gfx_modify#0 ] reg byte x [ sprites_irq::$0 ] reg byte a [ sprites_irq::ptr#4 ] reg byte a [ sprites_irq::ptr#2 ] reg byte a [ sprites_irq::ptr#3 ] zp ZP_BYTE:34 [ sprites_irq::ptr#1 ] zp ZP_BYTE:20 [ sprites_irq::ypos#0 ] zp ZP_BYTE:23 [ sprites_irq::ptr#0 ]
Uplifting [sprites_init] best 9160 combination reg byte y [ sprites_init::s#2 sprites_init::s#1 ] reg byte x [ sprites_init::s2#0 ] zp ZP_BYTE:9 [ sprites_init::xpos#2 sprites_init::xpos#1 ]
Uplifting [sprites_irq] best 9136 combination zp ZP_BYTE:10 [ sprites_irq::raster_sprite_gfx_modify#0 ] reg byte x [ sprites_irq::$0 ] reg byte a [ sprites_irq::ptr#4 ] reg byte a [ sprites_irq::ptr#2 ] reg byte a [ sprites_irq::ptr#3 ] zp ZP_BYTE:25 [ sprites_irq::ptr#1 ] zp ZP_BYTE:20 [ sprites_irq::ypos#0 ] zp ZP_BYTE:22 [ sprites_irq::ptr#0 ]
Limited combination testing to 100 combinations of 12288 possible.
Uplifting [sprites_irq_init] best 9139 combination
Uplifting [sprites_irq_init] best 9136 combination
Attempting to uplift remaining variables inzp ZP_BYTE:6 [ loop::s#2 loop::s#1 ]
Uplifting [loop] best 9139 combination zp ZP_BYTE:6 [ loop::s#2 loop::s#1 ]
Uplifting [loop] best 9136 combination zp ZP_BYTE:6 [ loop::s#2 loop::s#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:13 [ irq_sprite_ypos#0 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ]
Uplifting [] best 9136 combination zp ZP_BYTE:13 [ irq_sprite_ypos#0 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ]
Attempting to uplift remaining variables inzp ZP_BYTE:14 [ irq_sprite_ptr#0 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ]
Uplifting [] best 9136 combination zp ZP_BYTE:14 [ irq_sprite_ptr#0 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ]
Attempting to uplift remaining variables inzp ZP_BYTE:5 [ sin_idx#10 sin_idx#3 ]
Uplifting [] best 9139 combination zp ZP_BYTE:5 [ sin_idx#10 sin_idx#3 ]
Attempting to uplift remaining variables inzp ZP_BYTE:27 [ irq_sprite_ypos#3 ]
Uplifting [] best 9139 combination zp ZP_BYTE:27 [ irq_sprite_ypos#3 ]
Attempting to uplift remaining variables inzp ZP_BYTE:28 [ irq_sprite_ptr#3 ]
Uplifting [] best 9139 combination zp ZP_BYTE:28 [ irq_sprite_ptr#3 ]
Attempting to uplift remaining variables inzp ZP_BYTE:29 [ irq_cnt#2 ]
Uplifting [] best 9139 combination zp ZP_BYTE:29 [ irq_cnt#2 ]
Attempting to uplift remaining variables inzp ZP_BYTE:30 [ irq_sprite_ypos#2 ]
Uplifting [] best 9139 combination zp ZP_BYTE:30 [ irq_sprite_ypos#2 ]
Attempting to uplift remaining variables inzp ZP_BYTE:31 [ irq_sprite_ptr#2 ]
Uplifting [] best 9139 combination zp ZP_BYTE:31 [ irq_sprite_ptr#2 ]
Attempting to uplift remaining variables inzp ZP_BYTE:32 [ irq_sprite_ypos#1 ]
Uplifting [] best 9139 combination zp ZP_BYTE:32 [ irq_sprite_ypos#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:33 [ irq_sprite_ptr#1 ]
Uplifting [] best 9139 combination zp ZP_BYTE:33 [ irq_sprite_ptr#1 ]
Uplifting [] best 9136 combination zp ZP_BYTE:5 [ sin_idx#10 sin_idx#3 ]
Attempting to uplift remaining variables inzp ZP_BYTE:15 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ]
Uplifting [] best 9136 combination zp ZP_BYTE:15 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ]
Attempting to uplift remaining variables inzp ZP_BYTE:9 [ sprites_init::xpos#2 sprites_init::xpos#1 ]
Uplifting [sprites_init] best 9139 combination zp ZP_BYTE:9 [ sprites_init::xpos#2 sprites_init::xpos#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:10 [ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
Uplifting [] best 9139 combination zp ZP_BYTE:10 [ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
Uplifting [sprites_init] best 9136 combination zp ZP_BYTE:9 [ sprites_init::xpos#2 sprites_init::xpos#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:12 [ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
Uplifting [] best 9136 combination zp ZP_BYTE:12 [ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ main::ypos#2 main::ypos#1 ]
Uplifting [main] best 9139 combination zp ZP_BYTE:4 [ main::ypos#2 main::ypos#1 ]
Uplifting [main] best 9136 combination zp ZP_BYTE:4 [ main::ypos#2 main::ypos#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ main::xpos#2 main::xpos#1 ]
Uplifting [main] best 9139 combination zp ZP_BYTE:3 [ main::xpos#2 main::xpos#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:22 [ sprites_irq::raster_sprite_gfx_modify#0 ]
Uplifting [sprites_irq] best 9139 combination zp ZP_BYTE:22 [ sprites_irq::raster_sprite_gfx_modify#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:26 [ irq_cnt#1 ]
Uplifting [] best 9139 combination zp ZP_BYTE:26 [ irq_cnt#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:34 [ sprites_irq::ptr#1 ]
Uplifting [sprites_irq] best 9127 combination reg byte x [ sprites_irq::ptr#1 ]
Uplifting [main] best 9136 combination zp ZP_BYTE:3 [ main::xpos#2 main::xpos#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:10 [ sprites_irq::raster_sprite_gfx_modify#0 ]
Uplifting [sprites_irq] best 9136 combination zp ZP_BYTE:10 [ sprites_irq::raster_sprite_gfx_modify#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:25 [ sprites_irq::ptr#1 ]
Uplifting [sprites_irq] best 9124 combination reg byte x [ sprites_irq::ptr#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:20 [ sprites_irq::ypos#0 ]
Uplifting [sprites_irq] best 9112 combination reg byte a [ sprites_irq::ypos#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:23 [ sprites_irq::ptr#0 ]
Uplifting [sprites_irq] best 9097 combination reg byte x [ sprites_irq::ptr#0 ]
Uplifting [sprites_irq] best 9109 combination reg byte a [ sprites_irq::ypos#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:22 [ sprites_irq::ptr#0 ]
Uplifting [sprites_irq] best 9094 combination reg byte x [ sprites_irq::ptr#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:11 [ render_screen_showing#0 ]
Uplifting [] best 9097 combination zp ZP_BYTE:11 [ render_screen_showing#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:12 [ irq_raster_next#0 ]
Uplifting [] best 9097 combination zp ZP_BYTE:12 [ irq_raster_next#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:13 [ irq_sprite_ypos#0 ]
Uplifting [] best 9097 combination zp ZP_BYTE:13 [ irq_sprite_ypos#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:14 [ irq_sprite_ptr#0 ]
Uplifting [] best 9097 combination zp ZP_BYTE:14 [ irq_sprite_ptr#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:15 [ irq_cnt#0 ]
Uplifting [] best 9097 combination zp ZP_BYTE:15 [ irq_cnt#0 ]
Coalescing zero page register with common assignment [ zp ZP_BYTE:10 [ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ] ] with [ zp ZP_BYTE:12 [ irq_raster_next#0 ] ] - score: 2
Coalescing zero page register with common assignment [ zp ZP_BYTE:13 [ irq_sprite_ypos#0 ] ] with [ zp ZP_BYTE:27 [ irq_sprite_ypos#3 ] ] - score: 1
Coalescing zero page register with common assignment [ zp ZP_BYTE:13 [ irq_sprite_ypos#0 irq_sprite_ypos#3 ] ] with [ zp ZP_BYTE:30 [ irq_sprite_ypos#2 ] ] - score: 1
Coalescing zero page register with common assignment [ zp ZP_BYTE:14 [ irq_sprite_ptr#0 ] ] with [ zp ZP_BYTE:28 [ irq_sprite_ptr#3 ] ] - score: 1
Coalescing zero page register with common assignment [ zp ZP_BYTE:14 [ irq_sprite_ptr#0 irq_sprite_ptr#3 ] ] with [ zp ZP_BYTE:31 [ irq_sprite_ptr#2 ] ] - score: 1
Coalescing zero page register with common assignment [ zp ZP_BYTE:15 [ irq_cnt#0 ] ] with [ zp ZP_BYTE:26 [ irq_cnt#1 ] ] - score: 1
Uplifting [] best 9094 combination zp ZP_BYTE:11 [ render_screen_showing#0 ]
Coalescing zero page register [ zp ZP_BYTE:3 [ main::xpos#2 main::xpos#1 ] ] with [ zp ZP_BYTE:5 [ sin_idx#10 sin_idx#3 ] ]
Coalescing zero page register [ zp ZP_BYTE:3 [ main::xpos#2 main::xpos#1 sin_idx#10 sin_idx#3 ] ] with [ zp ZP_BYTE:9 [ sprites_init::xpos#2 sprites_init::xpos#1 ] ]
Coalescing zero page register [ zp ZP_BYTE:4 [ main::ypos#2 main::ypos#1 ] ] with [ zp ZP_BYTE:6 [ loop::s#2 loop::s#1 ] ]
Coalescing zero page register [ zp ZP_BYTE:13 [ irq_sprite_ypos#0 irq_sprite_ypos#3 irq_sprite_ypos#2 ] ] with [ zp ZP_BYTE:32 [ irq_sprite_ypos#1 ] ]
Coalescing zero page register [ zp ZP_BYTE:14 [ irq_sprite_ptr#0 irq_sprite_ptr#3 irq_sprite_ptr#2 ] ] with [ zp ZP_BYTE:33 [ irq_sprite_ptr#1 ] ]
Coalescing zero page register [ zp ZP_BYTE:15 [ irq_cnt#0 irq_cnt#1 ] ] with [ zp ZP_BYTE:29 [ irq_cnt#2 ] ]
Allocated (was zp ZP_BYTE:3) zp ZP_BYTE:2 [ main::xpos#2 main::xpos#1 sin_idx#10 sin_idx#3 sprites_init::xpos#2 sprites_init::xpos#1 ]
Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:3 [ main::ypos#2 main::ypos#1 loop::s#2 loop::s#1 ]
Allocated (was zp ZP_BYTE:10) zp ZP_BYTE:4 [ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 irq_raster_next#0 ]
Allocated (was zp ZP_BYTE:10) zp ZP_BYTE:4 [ sprites_irq::raster_sprite_gfx_modify#0 ]
Allocated (was zp ZP_BYTE:11) zp ZP_BYTE:5 [ render_screen_showing#0 ]
Allocated (was zp ZP_BYTE:13) zp ZP_BYTE:6 [ irq_sprite_ypos#0 irq_sprite_ypos#3 irq_sprite_ypos#2 irq_sprite_ypos#1 ]
Allocated (was zp ZP_BYTE:14) zp ZP_BYTE:7 [ irq_sprite_ptr#0 irq_sprite_ptr#3 irq_sprite_ptr#2 irq_sprite_ptr#1 ]
Allocated (was zp ZP_BYTE:15) zp ZP_BYTE:8 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ]
Allocated (was zp ZP_BYTE:22) zp ZP_BYTE:9 [ sprites_irq::raster_sprite_gfx_modify#0 ]
Allocated (was zp ZP_BYTE:12) zp ZP_BYTE:6 [ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
Allocated (was zp ZP_BYTE:13) zp ZP_BYTE:7 [ irq_sprite_ypos#0 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ]
Allocated (was zp ZP_BYTE:14) zp ZP_BYTE:8 [ irq_sprite_ptr#0 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ]
Allocated (was zp ZP_BYTE:15) zp ZP_BYTE:9 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ]
Interrupt procedure sprites_irq clobbers AXCNZV
Removing interrupt register storage sty regy+1 in SEG128 entry interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage regy: in SEG164 [99] return - exit interrupt(HARDWARE_CLOBBER)
@ -3126,10 +3051,10 @@ ASSEMBLER BEFORE OPTIMIZATION
.const IRQ_RASTER_FIRST = SPRITES_FIRST_YPOS+$13
.const toSpritePtr1_return = PLAYFIELD_SPRITES>>6
.label render_screen_showing = 5
.label irq_raster_next = 4
.label irq_sprite_ypos = 6
.label irq_sprite_ptr = 7
.label irq_cnt = 8
.label irq_raster_next = 6
.label irq_sprite_ypos = 7
.label irq_sprite_ptr = 8
.label irq_cnt = 9
.label sin_idx = 2
//SEG3 @begin
bbegin:
@ -3484,7 +3409,7 @@ sprites_init: {
// Utilizes duplicated gfx in the sprites to allow for some leeway in updating the sprite pointers
sprites_irq: {
.const toSpritePtr2_return = PLAYFIELD_SPRITES>>6
.label raster_sprite_gfx_modify = 9
.label raster_sprite_gfx_modify = 4
//SEG128 entry interrupt(HARDWARE_CLOBBER)
sta rega+1
stx regx+1
@ -3931,25 +3856,25 @@ FINAL SYMBOL TABLE
(byte) current_ypos
(byte) game_over
(byte) irq_cnt
(byte) irq_cnt#0 irq_cnt zp ZP_BYTE:8 0.17391304347826086
(byte) irq_cnt#1 irq_cnt zp ZP_BYTE:8 3.0
(byte) irq_cnt#2 irq_cnt zp ZP_BYTE:8 20.0
(byte) irq_cnt#0 irq_cnt zp ZP_BYTE:9 0.17391304347826086
(byte) irq_cnt#1 irq_cnt zp ZP_BYTE:9 3.0
(byte) irq_cnt#2 irq_cnt zp ZP_BYTE:9 20.0
(byte) irq_raster_next
(byte) irq_raster_next#0 irq_raster_next zp ZP_BYTE:4 0.3076923076923077
(byte) irq_raster_next#1 irq_raster_next zp ZP_BYTE:4 1.0
(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:4 1.3333333333333333
(byte) irq_raster_next#3 irq_raster_next zp ZP_BYTE:4 1.3333333333333333
(byte) irq_raster_next#4 irq_raster_next zp ZP_BYTE:4 8.0
(byte) irq_raster_next#0 irq_raster_next zp ZP_BYTE:6 0.3076923076923077
(byte) irq_raster_next#1 irq_raster_next zp ZP_BYTE:6 1.0
(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:6 1.3333333333333333
(byte) irq_raster_next#3 irq_raster_next zp ZP_BYTE:6 1.3333333333333333
(byte) irq_raster_next#4 irq_raster_next zp ZP_BYTE:6 8.0
(byte) irq_sprite_ptr
(byte) irq_sprite_ptr#0 irq_sprite_ptr zp ZP_BYTE:7 0.25806451612903225
(byte) irq_sprite_ptr#1 irq_sprite_ptr zp ZP_BYTE:7 20.0
(byte) irq_sprite_ptr#2 irq_sprite_ptr zp ZP_BYTE:7 20.0
(byte) irq_sprite_ptr#3 irq_sprite_ptr zp ZP_BYTE:7 20.0
(byte) irq_sprite_ptr#0 irq_sprite_ptr zp ZP_BYTE:8 0.25806451612903225
(byte) irq_sprite_ptr#1 irq_sprite_ptr zp ZP_BYTE:8 20.0
(byte) irq_sprite_ptr#2 irq_sprite_ptr zp ZP_BYTE:8 20.0
(byte) irq_sprite_ptr#3 irq_sprite_ptr zp ZP_BYTE:8 20.0
(byte) irq_sprite_ypos
(byte) irq_sprite_ypos#0 irq_sprite_ypos zp ZP_BYTE:6 0.27586206896551724
(byte) irq_sprite_ypos#1 irq_sprite_ypos zp ZP_BYTE:6 20.0
(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:6 20.0
(byte) irq_sprite_ypos#3 irq_sprite_ypos zp ZP_BYTE:6 20.0
(byte) irq_sprite_ypos#0 irq_sprite_ypos zp ZP_BYTE:7 0.27586206896551724
(byte) irq_sprite_ypos#1 irq_sprite_ypos zp ZP_BYTE:7 20.0
(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:7 20.0
(byte) irq_sprite_ypos#3 irq_sprite_ypos zp ZP_BYTE:7 20.0
(byte) level
(byte) level_bcd
(word) lines_bcd
@ -4061,7 +3986,7 @@ interrupt(HARDWARE_CLOBBER)(void()) sprites_irq()
(byte) sprites_irq::ptr#3 reg byte a 2.6666666666666665
(byte) sprites_irq::ptr#4 reg byte a 4.0
(byte) sprites_irq::raster_sprite_gfx_modify
(byte) sprites_irq::raster_sprite_gfx_modify#0 raster_sprite_gfx_modify zp ZP_BYTE:9 6.5
(byte) sprites_irq::raster_sprite_gfx_modify#0 raster_sprite_gfx_modify zp ZP_BYTE:4 6.5
(label) sprites_irq::toSpritePtr2
(word~) sprites_irq::toSpritePtr2_$0
(word~) sprites_irq::toSpritePtr2_$1
@ -4086,18 +4011,18 @@ zp ZP_BYTE:2 [ main::xpos#2 main::xpos#1 sin_idx#10 sin_idx#3 sprites_init::xpos
zp ZP_BYTE:3 [ main::ypos#2 main::ypos#1 loop::s#2 loop::s#1 ]
reg byte x [ loop::idx#2 loop::idx#0 loop::idx#1 ]
reg byte y [ sprites_init::s#2 sprites_init::s#1 ]
zp ZP_BYTE:4 [ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 irq_raster_next#0 ]
zp ZP_BYTE:4 [ sprites_irq::raster_sprite_gfx_modify#0 ]
zp ZP_BYTE:5 [ render_screen_showing#0 ]
zp ZP_BYTE:6 [ irq_sprite_ypos#0 irq_sprite_ypos#3 irq_sprite_ypos#2 irq_sprite_ypos#1 ]
zp ZP_BYTE:7 [ irq_sprite_ptr#0 irq_sprite_ptr#3 irq_sprite_ptr#2 irq_sprite_ptr#1 ]
zp ZP_BYTE:8 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ]
zp ZP_BYTE:6 [ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
zp ZP_BYTE:7 [ irq_sprite_ypos#0 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ]
zp ZP_BYTE:8 [ irq_sprite_ptr#0 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ]
zp ZP_BYTE:9 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ]
reg byte x [ main::s2#0 ]
reg byte a [ main::$6 ]
reg byte a [ loop::$1 ]
reg byte x [ sprites_init::s2#0 ]
reg byte a [ sprites_irq::ypos#0 ]
reg byte x [ sprites_irq::$0 ]
zp ZP_BYTE:9 [ sprites_irq::raster_sprite_gfx_modify#0 ]
reg byte x [ sprites_irq::ptr#0 ]
reg byte a [ sprites_irq::ptr#3 ]
reg byte a [ sprites_irq::ptr#4 ]
@ -4175,10 +4100,10 @@ Score: 7310
.const IRQ_RASTER_FIRST = SPRITES_FIRST_YPOS+$13
.const toSpritePtr1_return = PLAYFIELD_SPRITES>>6
.label render_screen_showing = 5
.label irq_raster_next = 4
.label irq_sprite_ypos = 6
.label irq_sprite_ptr = 7
.label irq_cnt = 8
.label irq_raster_next = 6
.label irq_sprite_ypos = 7
.label irq_sprite_ptr = 8
.label irq_cnt = 9
.label sin_idx = 2
//SEG3 @begin
bbegin:
@ -4461,7 +4386,7 @@ sprites_init: {
// Utilizes duplicated gfx in the sprites to allow for some leeway in updating the sprite pointers
sprites_irq: {
.const toSpritePtr2_return = PLAYFIELD_SPRITES>>6
.label raster_sprite_gfx_modify = 9
.label raster_sprite_gfx_modify = 4
//SEG128 entry interrupt(HARDWARE_CLOBBER)
sta rega+1
stx regx+1

View File

@ -140,25 +140,25 @@
(byte) current_ypos
(byte) game_over
(byte) irq_cnt
(byte) irq_cnt#0 irq_cnt zp ZP_BYTE:8 0.17391304347826086
(byte) irq_cnt#1 irq_cnt zp ZP_BYTE:8 3.0
(byte) irq_cnt#2 irq_cnt zp ZP_BYTE:8 20.0
(byte) irq_cnt#0 irq_cnt zp ZP_BYTE:9 0.17391304347826086
(byte) irq_cnt#1 irq_cnt zp ZP_BYTE:9 3.0
(byte) irq_cnt#2 irq_cnt zp ZP_BYTE:9 20.0
(byte) irq_raster_next
(byte) irq_raster_next#0 irq_raster_next zp ZP_BYTE:4 0.3076923076923077
(byte) irq_raster_next#1 irq_raster_next zp ZP_BYTE:4 1.0
(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:4 1.3333333333333333
(byte) irq_raster_next#3 irq_raster_next zp ZP_BYTE:4 1.3333333333333333
(byte) irq_raster_next#4 irq_raster_next zp ZP_BYTE:4 8.0
(byte) irq_raster_next#0 irq_raster_next zp ZP_BYTE:6 0.3076923076923077
(byte) irq_raster_next#1 irq_raster_next zp ZP_BYTE:6 1.0
(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:6 1.3333333333333333
(byte) irq_raster_next#3 irq_raster_next zp ZP_BYTE:6 1.3333333333333333
(byte) irq_raster_next#4 irq_raster_next zp ZP_BYTE:6 8.0
(byte) irq_sprite_ptr
(byte) irq_sprite_ptr#0 irq_sprite_ptr zp ZP_BYTE:7 0.25806451612903225
(byte) irq_sprite_ptr#1 irq_sprite_ptr zp ZP_BYTE:7 20.0
(byte) irq_sprite_ptr#2 irq_sprite_ptr zp ZP_BYTE:7 20.0
(byte) irq_sprite_ptr#3 irq_sprite_ptr zp ZP_BYTE:7 20.0
(byte) irq_sprite_ptr#0 irq_sprite_ptr zp ZP_BYTE:8 0.25806451612903225
(byte) irq_sprite_ptr#1 irq_sprite_ptr zp ZP_BYTE:8 20.0
(byte) irq_sprite_ptr#2 irq_sprite_ptr zp ZP_BYTE:8 20.0
(byte) irq_sprite_ptr#3 irq_sprite_ptr zp ZP_BYTE:8 20.0
(byte) irq_sprite_ypos
(byte) irq_sprite_ypos#0 irq_sprite_ypos zp ZP_BYTE:6 0.27586206896551724
(byte) irq_sprite_ypos#1 irq_sprite_ypos zp ZP_BYTE:6 20.0
(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:6 20.0
(byte) irq_sprite_ypos#3 irq_sprite_ypos zp ZP_BYTE:6 20.0
(byte) irq_sprite_ypos#0 irq_sprite_ypos zp ZP_BYTE:7 0.27586206896551724
(byte) irq_sprite_ypos#1 irq_sprite_ypos zp ZP_BYTE:7 20.0
(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:7 20.0
(byte) irq_sprite_ypos#3 irq_sprite_ypos zp ZP_BYTE:7 20.0
(byte) level
(byte) level_bcd
(word) lines_bcd
@ -270,7 +270,7 @@ interrupt(HARDWARE_CLOBBER)(void()) sprites_irq()
(byte) sprites_irq::ptr#3 reg byte a 2.6666666666666665
(byte) sprites_irq::ptr#4 reg byte a 4.0
(byte) sprites_irq::raster_sprite_gfx_modify
(byte) sprites_irq::raster_sprite_gfx_modify#0 raster_sprite_gfx_modify zp ZP_BYTE:9 6.5
(byte) sprites_irq::raster_sprite_gfx_modify#0 raster_sprite_gfx_modify zp ZP_BYTE:4 6.5
(label) sprites_irq::toSpritePtr2
(word~) sprites_irq::toSpritePtr2_$0
(word~) sprites_irq::toSpritePtr2_$1
@ -295,18 +295,18 @@ zp ZP_BYTE:2 [ main::xpos#2 main::xpos#1 sin_idx#10 sin_idx#3 sprites_init::xpos
zp ZP_BYTE:3 [ main::ypos#2 main::ypos#1 loop::s#2 loop::s#1 ]
reg byte x [ loop::idx#2 loop::idx#0 loop::idx#1 ]
reg byte y [ sprites_init::s#2 sprites_init::s#1 ]
zp ZP_BYTE:4 [ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 irq_raster_next#0 ]
zp ZP_BYTE:4 [ sprites_irq::raster_sprite_gfx_modify#0 ]
zp ZP_BYTE:5 [ render_screen_showing#0 ]
zp ZP_BYTE:6 [ irq_sprite_ypos#0 irq_sprite_ypos#3 irq_sprite_ypos#2 irq_sprite_ypos#1 ]
zp ZP_BYTE:7 [ irq_sprite_ptr#0 irq_sprite_ptr#3 irq_sprite_ptr#2 irq_sprite_ptr#1 ]
zp ZP_BYTE:8 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ]
zp ZP_BYTE:6 [ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
zp ZP_BYTE:7 [ irq_sprite_ypos#0 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ]
zp ZP_BYTE:8 [ irq_sprite_ptr#0 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ]
zp ZP_BYTE:9 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ]
reg byte x [ main::s2#0 ]
reg byte a [ main::$6 ]
reg byte a [ loop::$1 ]
reg byte x [ sprites_init::s2#0 ]
reg byte a [ sprites_irq::ypos#0 ]
reg byte x [ sprites_irq::$0 ]
zp ZP_BYTE:9 [ sprites_irq::raster_sprite_gfx_modify#0 ]
reg byte x [ sprites_irq::ptr#0 ]
reg byte a [ sprites_irq::ptr#3 ]
reg byte a [ sprites_irq::ptr#4 ]

View File

@ -128,10 +128,10 @@
.const toSpritePtr1_return = PLAYFIELD_SPRITES>>6
.label keyboard_events_size = $23
.label render_screen_showing = $25
.label irq_raster_next = $24
.label irq_sprite_ypos = $26
.label irq_sprite_ptr = $27
.label irq_cnt = $28
.label irq_raster_next = $26
.label irq_sprite_ypos = $27
.label irq_sprite_ptr = $28
.label irq_cnt = $29
.label current_movedown_slow = $18
.label current_ypos = $10
.label current_xpos = $20
@ -575,11 +575,11 @@ render_playfield: {
// Perform any movement of the current piece
// key_event is the next keyboard_event() og $ff if no keyboard event is pending
// Returns a byte signaling whether rendering is needed. (0 no render, >0 render needed)
// play_movement(byte zeropage($29) key_event)
// play_movement(byte zeropage($2a) key_event)
play_movement: {
.label render = 9
.label return = 9
.label key_event = $29
.label key_event = $2a
lda key_event
jsr play_move_down
txa
@ -661,7 +661,7 @@ play_collision: {
.label piece_gfx = 5
.label ypos2 = $b
.label playfield_line = 7
.label i = $2a
.label i = $2b
.label col = $f
.label l = $d
.label i_2 = $e
@ -920,7 +920,7 @@ sid_rnd: {
// play_update_score(byte register(X) removed)
play_update_score: {
.label lines_before = 4
.label add_bcd = $2b
.label add_bcd = $2c
cpx #0
beq breturn
lda lines_bcd
@ -1614,7 +1614,7 @@ sid_rnd_init: {
// Utilizes duplicated gfx in the sprites to allow for some leeway in updating the sprite pointers
sprites_irq: {
.const toSpritePtr2_return = PLAYFIELD_SPRITES>>6
.label raster_sprite_gfx_modify = $2f
.label raster_sprite_gfx_modify = $24
sta rega+1
stx regx+1
//(*BGCOL)++;

File diff suppressed because it is too large Load Diff

View File

@ -377,25 +377,25 @@
(byte) game_over#52 game_over zp ZP_BYTE:34 0.3333333333333333
(byte) game_over#65 game_over zp ZP_BYTE:34 0.4
(byte) irq_cnt
(byte) irq_cnt#0 irq_cnt zp ZP_BYTE:40 0.17391304347826086
(byte) irq_cnt#1 irq_cnt zp ZP_BYTE:40 3.0
(byte) irq_cnt#2 irq_cnt zp ZP_BYTE:40 20.0
(byte) irq_cnt#0 irq_cnt zp ZP_BYTE:41 0.17391304347826086
(byte) irq_cnt#1 irq_cnt zp ZP_BYTE:41 3.0
(byte) irq_cnt#2 irq_cnt zp ZP_BYTE:41 20.0
(byte) irq_raster_next
(byte) irq_raster_next#0 irq_raster_next zp ZP_BYTE:36 0.3076923076923077
(byte) irq_raster_next#1 irq_raster_next zp ZP_BYTE:36 1.0
(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:36 1.3333333333333333
(byte) irq_raster_next#3 irq_raster_next zp ZP_BYTE:36 1.3333333333333333
(byte) irq_raster_next#4 irq_raster_next zp ZP_BYTE:36 8.0
(byte) irq_raster_next#0 irq_raster_next zp ZP_BYTE:38 0.3076923076923077
(byte) irq_raster_next#1 irq_raster_next zp ZP_BYTE:38 1.0
(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:38 1.3333333333333333
(byte) irq_raster_next#3 irq_raster_next zp ZP_BYTE:38 1.3333333333333333
(byte) irq_raster_next#4 irq_raster_next zp ZP_BYTE:38 8.0
(byte) irq_sprite_ptr
(byte) irq_sprite_ptr#0 irq_sprite_ptr zp ZP_BYTE:39 0.25806451612903225
(byte) irq_sprite_ptr#1 irq_sprite_ptr zp ZP_BYTE:39 20.0
(byte) irq_sprite_ptr#2 irq_sprite_ptr zp ZP_BYTE:39 20.0
(byte) irq_sprite_ptr#3 irq_sprite_ptr zp ZP_BYTE:39 20.0
(byte) irq_sprite_ptr#0 irq_sprite_ptr zp ZP_BYTE:40 0.25806451612903225
(byte) irq_sprite_ptr#1 irq_sprite_ptr zp ZP_BYTE:40 20.0
(byte) irq_sprite_ptr#2 irq_sprite_ptr zp ZP_BYTE:40 20.0
(byte) irq_sprite_ptr#3 irq_sprite_ptr zp ZP_BYTE:40 20.0
(byte) irq_sprite_ypos
(byte) irq_sprite_ypos#0 irq_sprite_ypos zp ZP_BYTE:38 0.27586206896551724
(byte) irq_sprite_ypos#1 irq_sprite_ypos zp ZP_BYTE:38 20.0
(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:38 20.0
(byte) irq_sprite_ypos#3 irq_sprite_ypos zp ZP_BYTE:38 20.0
(byte) irq_sprite_ypos#0 irq_sprite_ypos zp ZP_BYTE:39 0.27586206896551724
(byte) irq_sprite_ypos#1 irq_sprite_ypos zp ZP_BYTE:39 20.0
(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:39 20.0
(byte) irq_sprite_ypos#3 irq_sprite_ypos zp ZP_BYTE:39 20.0
(byte[]) keyboard_char_keycodes
(byte()) keyboard_event_get()
(label) keyboard_event_get::@1
@ -578,7 +578,7 @@
(byte) play_collision::col#2 col zp ZP_BYTE:15 6375.75
(byte~) play_collision::col#9 col zp ZP_BYTE:15 2002.0
(byte) play_collision::i
(byte) play_collision::i#1 i zp ZP_BYTE:42 1615.6153846153845
(byte) play_collision::i#1 i zp ZP_BYTE:43 1615.6153846153845
(byte~) play_collision::i#11 i#11 zp ZP_BYTE:14 2002.0
(byte~) play_collision::i#13 i#13 zp ZP_BYTE:14 20002.0
(byte) play_collision::i#2 i#2 zp ZP_BYTE:14 15502.0
@ -765,7 +765,7 @@
(label) play_movement::@4
(label) play_movement::@return
(byte) play_movement::key_event
(byte) play_movement::key_event#0 key_event zp ZP_BYTE:41 8.916666666666664
(byte) play_movement::key_event#0 key_event zp ZP_BYTE:42 8.916666666666664
(byte) play_movement::render
(byte) play_movement::render#1 render zp ZP_BYTE:9 1.0
(byte) play_movement::render#2 render zp ZP_BYTE:9 0.8
@ -837,7 +837,7 @@
(label) play_update_score::@2
(label) play_update_score::@return
(dword) play_update_score::add_bcd
(dword) play_update_score::add_bcd#0 add_bcd zp ZP_DWORD:43 1.3333333333333333
(dword) play_update_score::add_bcd#0 add_bcd zp ZP_DWORD:44 1.3333333333333333
(byte) play_update_score::lines_after
(byte) play_update_score::lines_after#0 reg byte a 4.0
(byte) play_update_score::lines_before
@ -1166,7 +1166,7 @@ interrupt(HARDWARE_CLOBBER)(void()) sprites_irq()
(byte) sprites_irq::ptr#3 reg byte a 2.6666666666666665
(byte) sprites_irq::ptr#4 reg byte a 4.0
(byte) sprites_irq::raster_sprite_gfx_modify
(byte) sprites_irq::raster_sprite_gfx_modify#0 raster_sprite_gfx_modify zp ZP_BYTE:47 6.5
(byte) sprites_irq::raster_sprite_gfx_modify#0 raster_sprite_gfx_modify zp ZP_BYTE:36 6.5
(label) sprites_irq::toSpritePtr2
(word~) sprites_irq::toSpritePtr2_$0
(word~) sprites_irq::toSpritePtr2_$1
@ -1240,14 +1240,15 @@ reg byte x [ play_init::b#2 play_init::b#1 ]
reg byte y [ sprites_init::s#2 sprites_init::s#1 ]
reg byte x [ render_init::i#2 render_init::i#1 ]
reg byte x [ render_screen_original::x#6 render_screen_original::x#5 render_screen_original::x#4 render_screen_original::x#1 render_screen_original::x#2 render_screen_original::x#3 ]
zp ZP_BYTE:36 [ irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 irq_raster_next#0 ]
zp ZP_BYTE:36 [ sprites_irq::raster_sprite_gfx_modify#0 ]
zp ZP_BYTE:37 [ render_screen_showing#0 render_screen_showing#1 ]
zp ZP_BYTE:38 [ irq_sprite_ypos#0 irq_sprite_ypos#3 irq_sprite_ypos#2 irq_sprite_ypos#1 ]
zp ZP_BYTE:39 [ irq_sprite_ptr#0 irq_sprite_ptr#3 irq_sprite_ptr#2 irq_sprite_ptr#1 ]
zp ZP_BYTE:40 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ]
zp ZP_BYTE:38 [ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
zp ZP_BYTE:39 [ irq_sprite_ypos#0 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ]
zp ZP_BYTE:40 [ irq_sprite_ptr#0 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ]
zp ZP_BYTE:41 [ irq_cnt#0 irq_cnt#1 irq_cnt#2 ]
reg byte x [ keyboard_event_get::return#3 ]
reg byte x [ main::key_event#0 ]
zp ZP_BYTE:41 [ play_movement::key_event#0 ]
zp ZP_BYTE:42 [ play_movement::key_event#0 ]
reg byte a [ play_movement::return#3 ]
reg byte a [ main::render#1 ]
reg byte a [ render_bcd::$5 ]
@ -1273,7 +1274,7 @@ reg byte x [ play_move_rotate::$5 ]
reg byte a [ play_collision::return#14 ]
reg byte a [ play_move_rotate::$2 ]
reg byte x [ play_move_rotate::$7 ]
zp ZP_BYTE:42 [ play_collision::i#1 ]
zp ZP_BYTE:43 [ play_collision::i#1 ]
reg byte a [ play_collision::$7 ]
reg byte a [ play_collision::return#13 ]
reg byte a [ play_move_leftright::$4 ]
@ -1294,7 +1295,7 @@ reg byte a [ play_spawn_current::$6 ]
reg byte a [ sid_rnd::return#0 ]
reg byte a [ play_update_score::$2 ]
reg byte a [ play_update_score::$4 ]
zp ZP_DWORD:43 [ play_update_score::add_bcd#0 ]
zp ZP_DWORD:44 [ play_update_score::add_bcd#0 ]
reg byte a [ play_update_score::$5 ]
reg byte a [ play_update_score::lines_after#0 ]
reg byte a [ play_increase_level::$1 ]
@ -1325,7 +1326,6 @@ reg byte a [ render_init::$13 ]
reg byte a [ render_init::$14 ]
reg byte a [ sprites_irq::ypos#0 ]
reg byte x [ sprites_irq::$0 ]
zp ZP_BYTE:47 [ sprites_irq::raster_sprite_gfx_modify#0 ]
reg byte x [ sprites_irq::ptr#0 ]
reg byte a [ sprites_irq::ptr#3 ]
reg byte a [ sprites_irq::ptr#4 ]

View File

@ -0,0 +1,73 @@
// Tests calling into different function pointers which call a common sub-method
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
.label SCREEN = $400
.label idx = 7
bbegin:
lda #0
sta idx
jsr main
rts
main: {
lda #<hello
sta do10.fn
lda #>hello
sta do10.fn+1
jsr do10
lda #<world
sta do10.fn
lda #>world
sta do10.fn+1
jsr do10
rts
}
// do10(void()* zeropage(2) fn)
do10: {
.label i = 4
.label fn = 2
lda #0
sta i
b1:
jsr bi_fn
inc i
lda #$a
cmp i
bne b1
rts
bi_fn:
jmp (fn)
}
world: {
lda #<msg
sta print.msg
lda #>msg
sta print.msg+1
jsr print
rts
msg: .text "world @"
}
// print(byte* zeropage(5) msg)
print: {
.label msg = 5
ldy #0
b1:
lda (msg),y
ldx idx
sta SCREEN,x
inc idx
iny
lda (msg),y
cmp #'@'
bne b1
rts
}
hello: {
lda #<msg
sta print.msg
lda #>msg
sta print.msg+1
jsr print
rts
msg: .text "hello @"
}

View File

@ -0,0 +1,63 @@
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) idx#16 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:@2
@2: scope:[] from @1
[2] phi()
[3] call main
to:@end
@end: scope:[] from @2
[4] phi()
main: scope:[main] from @2
[5] phi()
[6] call do10
to:main::@1
main::@1: scope:[main] from main
[7] phi()
[8] call do10
to:main::@return
main::@return: scope:[main] from main::@1
[9] return
to:@return
do10: scope:[do10] from main main::@1
[10] (void()*) do10::fn#3 ← phi( main/&(void()) hello() main::@1/&(void()) world() )
to:do10::@1
do10::@1: scope:[do10] from do10 do10::@1
[11] (byte) do10::i#2 ← phi( do10/(byte/signed byte/word/signed word/dword/signed dword) 0 do10::@1/(byte) do10::i#1 )
[12] call *((void()*) do10::fn#3)
[13] (byte) do10::i#1 ← ++ (byte) do10::i#2
[14] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1
to:do10::@return
do10::@return: scope:[do10] from do10::@1
[15] return
to:@return
world: scope:[world] from
[16] phi()
[17] call print
to:world::@return
world::@return: scope:[world] from world
[18] return
to:@return
print: scope:[print] from hello world
[19] (byte*) print::msg#3 ← phi( hello/(const string) hello::msg world/(const string) world::msg )
to:print::@1
print::@1: scope:[print] from print print::@1
[20] (byte) idx#11 ← phi( print/(byte) idx#16 print::@1/(byte) idx#12 )
[20] (byte) print::i#2 ← phi( print/(byte/signed byte/word/signed word/dword/signed dword) 0 print::@1/(byte) print::i#1 )
[21] *((const byte*) SCREEN#0 + (byte) idx#11) ← *((byte*) print::msg#3 + (byte) print::i#2)
[22] (byte) idx#12 ← ++ (byte) idx#11
[23] (byte) print::i#1 ← ++ (byte) print::i#2
[24] if(*((byte*) print::msg#3 + (byte) print::i#1)!=(byte) '@') goto print::@1
to:print::@return
print::@return: scope:[print] from print::@1
[25] return
to:@return
hello: scope:[hello] from
[26] phi()
[27] call print
to:hello::@return
hello::@return: scope:[hello] from hello
[28] return
to:@return

View File

@ -0,0 +1,960 @@
Resolved forward reference hello to (void()) hello()
Resolved forward reference world to (void()) world()
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
to:@4
main: scope:[main] from @5
(void()*~) main::$0 ← & (void()) hello()
(void()*) do10::fn#0 ← (void()*~) main::$0
call do10
to:main::@1
main::@1: scope:[main] from main
(void()*~) main::$2 ← & (void()) world()
(void()*) do10::fn#1 ← (void()*~) main::$2
call do10
to:main::@2
main::@2: scope:[main] from main::@1
to:main::@return
main::@return: scope:[main] from main::@2
return
to:@return
do10: scope:[do10] from main main::@1
(void()*) do10::fn#3 ← phi( main/(void()*) do10::fn#0 main::@1/(void()*) do10::fn#1 )
(byte) do10::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:do10::@1
do10::@1: scope:[do10] from do10 do10::@1
(byte) do10::i#2 ← phi( do10/(byte) do10::i#0 do10::@1/(byte) do10::i#1 )
(void()*) do10::fn#2 ← phi( do10/(void()*) do10::fn#3 do10::@1/(void()*) do10::fn#2 )
call *((void()*) do10::fn#2)
(byte) do10::i#1 ← (byte) do10::i#2 + rangenext(0,9)
(bool~) do10::$1 ← (byte) do10::i#1 != rangelast(0,9)
if((bool~) do10::$1) goto do10::@1
to:do10::@return
do10::@return: scope:[do10] from do10::@1
return
to:@return
hello: scope:[hello] from
(byte) idx#13 ← phi( @5/(byte) idx#16 )
(byte*) print::msg#0 ← (const string) hello::msg
call print
to:hello::@1
hello::@1: scope:[hello] from hello
(byte) idx#7 ← phi( hello/(byte) idx#6 )
(byte) idx#0 ← (byte) idx#7
to:hello::@return
hello::@return: scope:[hello] from hello::@1
(byte) idx#8 ← phi( hello::@1/(byte) idx#0 )
(byte) idx#1 ← (byte) idx#8
return
to:@return
world: scope:[world] from
(byte) idx#14 ← phi( @5/(byte) idx#16 )
(byte*) print::msg#1 ← (const string) world::msg
call print
to:world::@1
world::@1: scope:[world] from world
(byte) idx#9 ← phi( world/(byte) idx#6 )
(byte) idx#2 ← (byte) idx#9
to:world::@return
world::@return: scope:[world] from world::@1
(byte) idx#10 ← phi( world::@1/(byte) idx#2 )
(byte) idx#3 ← (byte) idx#10
return
to:@return
@4: scope:[] from @begin
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) $400
(byte) idx#4 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:@5
print: scope:[print] from hello world
(byte) idx#15 ← phi( hello/(byte) idx#13 world/(byte) idx#14 )
(byte*) print::msg#3 ← phi( hello/(byte*) print::msg#0 world/(byte*) print::msg#1 )
(byte) print::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:print::@1
print::@1: scope:[print] from print print::@1
(byte) idx#11 ← phi( print/(byte) idx#15 print::@1/(byte) idx#5 )
(byte) print::i#2 ← phi( print/(byte) print::i#0 print::@1/(byte) print::i#1 )
(byte*) print::msg#2 ← phi( print/(byte*) print::msg#3 print::@1/(byte*) print::msg#2 )
*((byte*) SCREEN#0 + (byte) idx#11) ← *((byte*) print::msg#2 + (byte) print::i#2)
(byte) idx#5 ← ++ (byte) idx#11
(byte) print::i#1 ← ++ (byte) print::i#2
(bool~) print::$0 ← *((byte*) print::msg#2 + (byte) print::i#1) != (byte) '@'
if((bool~) print::$0) goto print::@1
to:print::@return
print::@return: scope:[print] from print::@1
(byte) idx#12 ← phi( print::@1/(byte) idx#5 )
(byte) idx#6 ← (byte) idx#12
return
to:@return
@5: scope:[] from @4
(byte) idx#16 ← phi( @4/(byte) idx#4 )
call main
to:@6
@6: scope:[] from @5
to:@end
@end: scope:[] from @6
SYMBOL TABLE SSA
(label) @4
(label) @5
(label) @6
(label) @begin
(label) @end
(byte*) SCREEN
(byte*) SCREEN#0
(void()) do10((void()*) do10::fn)
(bool~) do10::$1
(label) do10::@1
(label) do10::@return
(void()*) do10::fn
(void()*) do10::fn#0
(void()*) do10::fn#1
(void()*) do10::fn#2
(void()*) do10::fn#3
(byte) do10::i
(byte) do10::i#0
(byte) do10::i#1
(byte) do10::i#2
(void()) hello()
(label) hello::@1
(label) hello::@return
(const string) hello::msg = (string) "hello @"
(byte) idx
(byte) idx#0
(byte) idx#1
(byte) idx#10
(byte) idx#11
(byte) idx#12
(byte) idx#13
(byte) idx#14
(byte) idx#15
(byte) idx#16
(byte) idx#2
(byte) idx#3
(byte) idx#4
(byte) idx#5
(byte) idx#6
(byte) idx#7
(byte) idx#8
(byte) idx#9
(void()) main()
(void()*~) main::$0
(void()*~) main::$2
(label) main::@1
(label) main::@2
(label) main::@return
(void()) print((byte*) print::msg)
(bool~) print::$0
(label) print::@1
(label) print::@return
(byte) print::i
(byte) print::i#0
(byte) print::i#1
(byte) print::i#2
(byte*) print::msg
(byte*) print::msg#0
(byte*) print::msg#1
(byte*) print::msg#2
(byte*) print::msg#3
(void()) world()
(label) world::@1
(label) world::@return
(const string) world::msg = (string) "world @"
Culled Empty Block (label) main::@2
Culled Empty Block (label) @6
Successful SSA optimization Pass2CullEmptyBlocks
Alias (void()*) do10::fn#0 = (void()*~) main::$0
Alias (void()*) do10::fn#1 = (void()*~) main::$2
Alias (byte) idx#0 = (byte) idx#7 (byte) idx#8 (byte) idx#1
Alias (byte) idx#10 = (byte) idx#2 (byte) idx#9 (byte) idx#3
Alias (byte) idx#12 = (byte) idx#5 (byte) idx#6
Alias (byte) idx#16 = (byte) idx#4
Successful SSA optimization Pass2AliasElimination
Self Phi Eliminated (void()*) do10::fn#2
Self Phi Eliminated (byte*) print::msg#2
Successful SSA optimization Pass2SelfPhiElimination
Redundant Phi (void()*) do10::fn#2 (void()*) do10::fn#3
Redundant Phi (byte) idx#13 (byte) idx#16
Redundant Phi (byte) idx#0 (byte) idx#12
Redundant Phi (byte) idx#14 (byte) idx#16
Redundant Phi (byte) idx#10 (byte) idx#12
Redundant Phi (byte*) print::msg#2 (byte*) print::msg#3
Successful SSA optimization Pass2RedundantPhiElimination
Redundant Phi (byte) idx#15 (byte) idx#16
Successful SSA optimization Pass2RedundantPhiElimination
Simple Condition (bool~) do10::$1 [13] if((byte) do10::i#1!=rangelast(0,9)) goto do10::@1
Simple Condition (bool~) print::$0 [40] if(*((byte*) print::msg#3 + (byte) print::i#1)!=(byte) '@') goto print::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const void()*) do10::fn#0 = &hello
Constant (const void()*) do10::fn#1 = &world
Constant (const byte) do10::i#0 = 0
Constant (const byte*) print::msg#0 = hello::msg
Constant (const byte*) print::msg#1 = world::msg
Constant (const byte*) SCREEN#0 = ((byte*))$400
Constant (const byte) print::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value do10::i#1 ← ++ do10::i#2 to ++
Resolved ranged comparison value if(do10::i#1!=rangelast(0,9)) goto do10::@1 to (byte/signed byte/word/signed word/dword/signed dword) $a
Culled Empty Block (label) hello::@1
Culled Empty Block (label) world::@1
Successful SSA optimization Pass2CullEmptyBlocks
Inlining constant with var siblings (const void()*) do10::fn#0
Inlining constant with var siblings (const void()*) do10::fn#1
Inlining constant with var siblings (const byte) do10::i#0
Inlining constant with var siblings (const byte*) print::msg#0
Inlining constant with var siblings (const byte*) print::msg#1
Inlining constant with var siblings (const byte) print::i#0
Constant inlined do10::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined print::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined do10::fn#1 = &(void()) world()
Constant inlined do10::fn#0 = &(void()) hello()
Constant inlined print::msg#1 = (const string) world::msg
Constant inlined print::msg#0 = (const string) hello::msg
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting do10::@3(between do10::@1 and do10::@1)
Added new block during phi lifting print::@3(between print::@1 and print::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @5
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1
Adding NOP phi() at start of world
Adding NOP phi() at start of hello
CALL GRAPH
Calls in [] to main:3
Calls in [main] to do10:6 do10:8
Calls in [world] to print:18
Calls in [hello] to print:31
Created 5 initial phi equivalence classes
Coalesced [16] do10::i#3 ← do10::i#1
Coalesced [21] idx#17 ← idx#16
Coalesced [28] print::i#3 ← print::i#1
Coalesced [29] idx#18 ← idx#12
Coalesced down to 5 phi equivalence classes
Culled Empty Block (label) do10::@3
Culled Empty Block (label) print::@3
Renumbering block @4 to @1
Renumbering block @5 to @2
Adding NOP phi() at start of @begin
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
Adding NOP phi() at start of world
Adding NOP phi() at start of hello
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) idx#16 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:@2
@2: scope:[] from @1
[2] phi()
[3] call main
to:@end
@end: scope:[] from @2
[4] phi()
main: scope:[main] from @2
[5] phi()
[6] call do10
to:main::@1
main::@1: scope:[main] from main
[7] phi()
[8] call do10
to:main::@return
main::@return: scope:[main] from main::@1
[9] return
to:@return
do10: scope:[do10] from main main::@1
[10] (void()*) do10::fn#3 ← phi( main/&(void()) hello() main::@1/&(void()) world() )
to:do10::@1
do10::@1: scope:[do10] from do10 do10::@1
[11] (byte) do10::i#2 ← phi( do10/(byte/signed byte/word/signed word/dword/signed dword) 0 do10::@1/(byte) do10::i#1 )
[12] call *((void()*) do10::fn#3)
[13] (byte) do10::i#1 ← ++ (byte) do10::i#2
[14] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1
to:do10::@return
do10::@return: scope:[do10] from do10::@1
[15] return
to:@return
world: scope:[world] from
[16] phi()
[17] call print
to:world::@return
world::@return: scope:[world] from world
[18] return
to:@return
print: scope:[print] from hello world
[19] (byte*) print::msg#3 ← phi( hello/(const string) hello::msg world/(const string) world::msg )
to:print::@1
print::@1: scope:[print] from print print::@1
[20] (byte) idx#11 ← phi( print/(byte) idx#16 print::@1/(byte) idx#12 )
[20] (byte) print::i#2 ← phi( print/(byte/signed byte/word/signed word/dword/signed dword) 0 print::@1/(byte) print::i#1 )
[21] *((const byte*) SCREEN#0 + (byte) idx#11) ← *((byte*) print::msg#3 + (byte) print::i#2)
[22] (byte) idx#12 ← ++ (byte) idx#11
[23] (byte) print::i#1 ← ++ (byte) print::i#2
[24] if(*((byte*) print::msg#3 + (byte) print::i#1)!=(byte) '@') goto print::@1
to:print::@return
print::@return: scope:[print] from print::@1
[25] return
to:@return
hello: scope:[hello] from
[26] phi()
[27] call print
to:hello::@return
hello::@return: scope:[hello] from hello
[28] return
to:@return
VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) do10((void()*) do10::fn)
(void()*) do10::fn
(void()*) do10::fn#3
(byte) do10::i
(byte) do10::i#1 16.5
(byte) do10::i#2 11.0
(void()) hello()
(byte) idx
(byte) idx#11 17.5
(byte) idx#12 7.333333333333333
(byte) idx#16 1.3333333333333333
(void()) main()
(void()) print((byte*) print::msg)
(byte) print::i
(byte) print::i#1 16.5
(byte) print::i#2 11.0
(byte*) print::msg
(byte*) print::msg#3 3.6666666666666665
(void()) world()
Initial phi equivalence classes
[ do10::fn#3 ]
[ do10::i#2 do10::i#1 ]
[ print::msg#3 ]
[ print::i#2 print::i#1 ]
[ idx#11 idx#16 idx#12 ]
Complete equivalence classes
[ do10::fn#3 ]
[ do10::i#2 do10::i#1 ]
[ print::msg#3 ]
[ print::i#2 print::i#1 ]
[ idx#11 idx#16 idx#12 ]
Allocated zp ZP_WORD:2 [ do10::fn#3 ]
Allocated zp ZP_BYTE:4 [ do10::i#2 do10::i#1 ]
Allocated zp ZP_WORD:5 [ print::msg#3 ]
Allocated zp ZP_BYTE:7 [ print::i#2 print::i#1 ]
Allocated zp ZP_BYTE:8 [ idx#11 idx#16 idx#12 ]
INITIAL ASM
//SEG0 File Comments
// Tests calling into different function pointers which call a common sub-method
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
.label idx = 8
//SEG3 @begin
bbegin:
jmp b1
//SEG4 @1
b1:
//SEG5 [1] (byte) idx#16 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta idx
//SEG6 [2] phi from @1 to @2 [phi:@1->@2]
b2_from_b1:
jmp b2
//SEG7 @2
b2:
//SEG8 [3] call main
//SEG9 [5] phi from @2 to main [phi:@2->main]
main_from_b2:
jsr main
//SEG10 [4] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG11 @end
bend:
//SEG12 main
main: {
//SEG13 [6] call do10
//SEG14 [10] phi from main to do10 [phi:main->do10]
do10_from_main:
//SEG15 [10] phi (void()*) do10::fn#3 = &(void()) hello() [phi:main->do10#0] -- pprz1=pprc1
lda #<hello
sta do10.fn
lda #>hello
sta do10.fn+1
jsr do10
//SEG16 [7] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG17 main::@1
b1:
//SEG18 [8] call do10
//SEG19 [10] phi from main::@1 to do10 [phi:main::@1->do10]
do10_from_b1:
//SEG20 [10] phi (void()*) do10::fn#3 = &(void()) world() [phi:main::@1->do10#0] -- pprz1=pprc1
lda #<world
sta do10.fn
lda #>world
sta do10.fn+1
jsr do10
jmp breturn
//SEG21 main::@return
breturn:
//SEG22 [9] return
rts
}
//SEG23 do10
// do10(void()* zeropage(2) fn)
do10: {
.label i = 4
.label fn = 2
//SEG24 [11] phi from do10 to do10::@1 [phi:do10->do10::@1]
b1_from_do10:
//SEG25 [11] phi (byte) do10::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:do10->do10::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG26 [11] phi from do10::@1 to do10::@1 [phi:do10::@1->do10::@1]
b1_from_b1:
//SEG27 [11] phi (byte) do10::i#2 = (byte) do10::i#1 [phi:do10::@1->do10::@1#0] -- register_copy
jmp b1
//SEG28 do10::@1
b1:
//SEG29 [12] call *((void()*) do10::fn#3)
jsr bi_fn
//SEG30 [13] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG31 [14] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1 -- vbuz1_neq_vbuc1_then_la1
lda #$a
cmp i
bne b1_from_b1
jmp breturn
//SEG32 do10::@return
breturn:
//SEG33 [15] return
rts
bi_fn:
jmp (fn)
}
//SEG34 world
world: {
//SEG35 [17] call print
//SEG36 [19] phi from world to print [phi:world->print]
print_from_world:
//SEG37 [19] phi (byte*) print::msg#3 = (const string) world::msg [phi:world->print#0] -- pbuz1=pbuc1
lda #<msg
sta print.msg
lda #>msg
sta print.msg+1
jsr print
jmp breturn
//SEG38 world::@return
breturn:
//SEG39 [18] return
rts
msg: .text "world @"
}
//SEG40 print
// print(byte* zeropage(5) msg)
print: {
.label i = 7
.label msg = 5
//SEG41 [20] phi from print to print::@1 [phi:print->print::@1]
b1_from_print:
//SEG42 [20] phi (byte) idx#11 = (byte) idx#16 [phi:print->print::@1#0] -- register_copy
//SEG43 [20] phi (byte) print::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:print->print::@1#1] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG44 [20] phi from print::@1 to print::@1 [phi:print::@1->print::@1]
b1_from_b1:
//SEG45 [20] phi (byte) idx#11 = (byte) idx#12 [phi:print::@1->print::@1#0] -- register_copy
//SEG46 [20] phi (byte) print::i#2 = (byte) print::i#1 [phi:print::@1->print::@1#1] -- register_copy
jmp b1
//SEG47 print::@1
b1:
//SEG48 [21] *((const byte*) SCREEN#0 + (byte) idx#11) ← *((byte*) print::msg#3 + (byte) print::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuz3
ldx idx
ldy i
lda (msg),y
sta SCREEN,x
//SEG49 [22] (byte) idx#12 ← ++ (byte) idx#11 -- vbuz1=_inc_vbuz1
inc idx
//SEG50 [23] (byte) print::i#1 ← ++ (byte) print::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG51 [24] if(*((byte*) print::msg#3 + (byte) print::i#1)!=(byte) '@') goto print::@1 -- pbuz1_derefidx_vbuz2_neq_vbuc1_then_la1
ldy i
lda (msg),y
cmp #'@'
bne b1_from_b1
jmp breturn
//SEG52 print::@return
breturn:
//SEG53 [25] return
rts
}
//SEG54 hello
hello: {
//SEG55 [27] call print
//SEG56 [19] phi from hello to print [phi:hello->print]
print_from_hello:
//SEG57 [19] phi (byte*) print::msg#3 = (const string) hello::msg [phi:hello->print#0] -- pbuz1=pbuc1
lda #<msg
sta print.msg
lda #>msg
sta print.msg+1
jsr print
jmp breturn
//SEG58 hello::@return
breturn:
//SEG59 [28] return
rts
msg: .text "hello @"
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] (byte) idx#16 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a
Statement [12] call *((void()*) do10::fn#3) [ do10::fn#3 do10::i#2 ] ( main:3::do10:6 [ do10::fn#3 do10::i#2 ] main:3::do10:8 [ do10::fn#3 do10::i#2 ] ) always clobbers reg byte a reg byte x reg byte y
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ do10::i#2 do10::i#1 ]
Removing always clobbered register reg byte x as potential for zp ZP_BYTE:4 [ do10::i#2 do10::i#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:4 [ do10::i#2 do10::i#1 ]
Statement [14] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1 [ do10::fn#3 do10::i#1 ] ( main:3::do10:6 [ do10::fn#3 do10::i#1 ] main:3::do10:8 [ do10::fn#3 do10::i#1 ] ) always clobbers reg byte a
Statement [21] *((const byte*) SCREEN#0 + (byte) idx#11) ← *((byte*) print::msg#3 + (byte) print::i#2) [ print::msg#3 print::i#2 idx#11 ] ( print:17 [ print::msg#3 print::i#2 idx#11 ] print:27 [ print::msg#3 print::i#2 idx#11 ] ) always clobbers reg byte a reg byte x
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:7 [ print::i#2 print::i#1 ]
Removing always clobbered register reg byte x as potential for zp ZP_BYTE:7 [ print::i#2 print::i#1 ]
Statement [24] if(*((byte*) print::msg#3 + (byte) print::i#1)!=(byte) '@') goto print::@1 [ print::msg#3 print::i#1 idx#12 ] ( print:17 [ print::msg#3 print::i#1 idx#12 ] print:27 [ print::msg#3 print::i#1 idx#12 ] ) always clobbers reg byte a
Statement [1] (byte) idx#16 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a
Statement [12] call *((void()*) do10::fn#3) [ do10::fn#3 do10::i#2 ] ( main:3::do10:6 [ do10::fn#3 do10::i#2 ] main:3::do10:8 [ do10::fn#3 do10::i#2 ] ) always clobbers reg byte a reg byte x reg byte y
Statement [14] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1 [ do10::fn#3 do10::i#1 ] ( main:3::do10:6 [ do10::fn#3 do10::i#1 ] main:3::do10:8 [ do10::fn#3 do10::i#1 ] ) always clobbers reg byte a
Statement [21] *((const byte*) SCREEN#0 + (byte) idx#11) ← *((byte*) print::msg#3 + (byte) print::i#2) [ print::msg#3 print::i#2 idx#11 ] ( print:17 [ print::msg#3 print::i#2 idx#11 ] print:27 [ print::msg#3 print::i#2 idx#11 ] ) always clobbers reg byte a reg byte x
Statement [24] if(*((byte*) print::msg#3 + (byte) print::i#1)!=(byte) '@') goto print::@1 [ print::msg#3 print::i#1 idx#12 ] ( print:17 [ print::msg#3 print::i#1 idx#12 ] print:27 [ print::msg#3 print::i#1 idx#12 ] ) always clobbers reg byte a
Potential registers zp ZP_WORD:2 [ do10::fn#3 ] : zp ZP_WORD:2 ,
Potential registers zp ZP_BYTE:4 [ do10::i#2 do10::i#1 ] : zp ZP_BYTE:4 ,
Potential registers zp ZP_WORD:5 [ print::msg#3 ] : zp ZP_WORD:5 ,
Potential registers zp ZP_BYTE:7 [ print::i#2 print::i#1 ] : zp ZP_BYTE:7 , reg byte y ,
Potential registers zp ZP_BYTE:8 [ idx#11 idx#16 idx#12 ] : zp ZP_BYTE:8 ,
REGISTER UPLIFT SCOPES
Uplift Scope [print] 27.5: zp ZP_BYTE:7 [ print::i#2 print::i#1 ] 3.67: zp ZP_WORD:5 [ print::msg#3 ]
Uplift Scope [do10] 27.5: zp ZP_BYTE:4 [ do10::i#2 do10::i#1 ] 0: zp ZP_WORD:2 [ do10::fn#3 ]
Uplift Scope [] 26.17: zp ZP_BYTE:8 [ idx#11 idx#16 idx#12 ]
Uplift Scope [main]
Uplift Scope [hello]
Uplift Scope [world]
Uplifting [print] best 898 combination reg byte y [ print::i#2 print::i#1 ] zp ZP_WORD:5 [ print::msg#3 ]
Uplifting [do10] best 898 combination zp ZP_BYTE:4 [ do10::i#2 do10::i#1 ] zp ZP_WORD:2 [ do10::fn#3 ]
Uplifting [] best 898 combination zp ZP_BYTE:8 [ idx#11 idx#16 idx#12 ]
Uplifting [main] best 898 combination
Uplifting [hello] best 898 combination
Uplifting [world] best 898 combination
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ do10::i#2 do10::i#1 ]
Uplifting [do10] best 898 combination zp ZP_BYTE:4 [ do10::i#2 do10::i#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:8 [ idx#11 idx#16 idx#12 ]
Uplifting [] best 898 combination zp ZP_BYTE:8 [ idx#11 idx#16 idx#12 ]
Allocated (was zp ZP_BYTE:8) zp ZP_BYTE:7 [ idx#11 idx#16 idx#12 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
// Tests calling into different function pointers which call a common sub-method
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
.label idx = 7
//SEG3 @begin
bbegin:
jmp b1
//SEG4 @1
b1:
//SEG5 [1] (byte) idx#16 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta idx
//SEG6 [2] phi from @1 to @2 [phi:@1->@2]
b2_from_b1:
jmp b2
//SEG7 @2
b2:
//SEG8 [3] call main
//SEG9 [5] phi from @2 to main [phi:@2->main]
main_from_b2:
jsr main
//SEG10 [4] phi from @2 to @end [phi:@2->@end]
bend_from_b2:
jmp bend
//SEG11 @end
bend:
//SEG12 main
main: {
//SEG13 [6] call do10
//SEG14 [10] phi from main to do10 [phi:main->do10]
do10_from_main:
//SEG15 [10] phi (void()*) do10::fn#3 = &(void()) hello() [phi:main->do10#0] -- pprz1=pprc1
lda #<hello
sta do10.fn
lda #>hello
sta do10.fn+1
jsr do10
//SEG16 [7] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
jmp b1
//SEG17 main::@1
b1:
//SEG18 [8] call do10
//SEG19 [10] phi from main::@1 to do10 [phi:main::@1->do10]
do10_from_b1:
//SEG20 [10] phi (void()*) do10::fn#3 = &(void()) world() [phi:main::@1->do10#0] -- pprz1=pprc1
lda #<world
sta do10.fn
lda #>world
sta do10.fn+1
jsr do10
jmp breturn
//SEG21 main::@return
breturn:
//SEG22 [9] return
rts
}
//SEG23 do10
// do10(void()* zeropage(2) fn)
do10: {
.label i = 4
.label fn = 2
//SEG24 [11] phi from do10 to do10::@1 [phi:do10->do10::@1]
b1_from_do10:
//SEG25 [11] phi (byte) do10::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:do10->do10::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG26 [11] phi from do10::@1 to do10::@1 [phi:do10::@1->do10::@1]
b1_from_b1:
//SEG27 [11] phi (byte) do10::i#2 = (byte) do10::i#1 [phi:do10::@1->do10::@1#0] -- register_copy
jmp b1
//SEG28 do10::@1
b1:
//SEG29 [12] call *((void()*) do10::fn#3)
jsr bi_fn
//SEG30 [13] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG31 [14] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1 -- vbuz1_neq_vbuc1_then_la1
lda #$a
cmp i
bne b1_from_b1
jmp breturn
//SEG32 do10::@return
breturn:
//SEG33 [15] return
rts
bi_fn:
jmp (fn)
}
//SEG34 world
world: {
//SEG35 [17] call print
//SEG36 [19] phi from world to print [phi:world->print]
print_from_world:
//SEG37 [19] phi (byte*) print::msg#3 = (const string) world::msg [phi:world->print#0] -- pbuz1=pbuc1
lda #<msg
sta print.msg
lda #>msg
sta print.msg+1
jsr print
jmp breturn
//SEG38 world::@return
breturn:
//SEG39 [18] return
rts
msg: .text "world @"
}
//SEG40 print
// print(byte* zeropage(5) msg)
print: {
.label msg = 5
//SEG41 [20] phi from print to print::@1 [phi:print->print::@1]
b1_from_print:
//SEG42 [20] phi (byte) idx#11 = (byte) idx#16 [phi:print->print::@1#0] -- register_copy
//SEG43 [20] phi (byte) print::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:print->print::@1#1] -- vbuyy=vbuc1
ldy #0
jmp b1
//SEG44 [20] phi from print::@1 to print::@1 [phi:print::@1->print::@1]
b1_from_b1:
//SEG45 [20] phi (byte) idx#11 = (byte) idx#12 [phi:print::@1->print::@1#0] -- register_copy
//SEG46 [20] phi (byte) print::i#2 = (byte) print::i#1 [phi:print::@1->print::@1#1] -- register_copy
jmp b1
//SEG47 print::@1
b1:
//SEG48 [21] *((const byte*) SCREEN#0 + (byte) idx#11) ← *((byte*) print::msg#3 + (byte) print::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuyy
lda (msg),y
ldx idx
sta SCREEN,x
//SEG49 [22] (byte) idx#12 ← ++ (byte) idx#11 -- vbuz1=_inc_vbuz1
inc idx
//SEG50 [23] (byte) print::i#1 ← ++ (byte) print::i#2 -- vbuyy=_inc_vbuyy
iny
//SEG51 [24] if(*((byte*) print::msg#3 + (byte) print::i#1)!=(byte) '@') goto print::@1 -- pbuz1_derefidx_vbuyy_neq_vbuc1_then_la1
lda (msg),y
cmp #'@'
bne b1_from_b1
jmp breturn
//SEG52 print::@return
breturn:
//SEG53 [25] return
rts
}
//SEG54 hello
hello: {
//SEG55 [27] call print
//SEG56 [19] phi from hello to print [phi:hello->print]
print_from_hello:
//SEG57 [19] phi (byte*) print::msg#3 = (const string) hello::msg [phi:hello->print#0] -- pbuz1=pbuc1
lda #<msg
sta print.msg
lda #>msg
sta print.msg+1
jsr print
jmp breturn
//SEG58 hello::@return
breturn:
//SEG59 [28] return
rts
msg: .text "hello @"
}
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp b2
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1_from_b1 with b1
Replacing label b1_from_b1 with b1
Removing instruction b1:
Removing instruction b2_from_b1:
Removing instruction main_from_b2:
Removing instruction bend_from_b2:
Removing instruction b1_from_main:
Removing instruction do10_from_b1:
Removing instruction b1_from_b1:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction b2:
Removing instruction bend:
Removing instruction do10_from_main:
Removing instruction b1:
Removing instruction breturn:
Removing instruction b1_from_do10:
Removing instruction breturn:
Removing instruction print_from_world:
Removing instruction breturn:
Removing instruction b1_from_print:
Removing instruction breturn:
Removing instruction print_from_hello:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Adding RTS to root block
Succesful ASM optimization Pass5AddMainRts
Removing instruction jmp b1
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
FINAL SYMBOL TABLE
(label) @1
(label) @2
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) $400
(void()) do10((void()*) do10::fn)
(label) do10::@1
(label) do10::@return
(void()*) do10::fn
(void()*) do10::fn#3 fn zp ZP_WORD:2
(byte) do10::i
(byte) do10::i#1 i zp ZP_BYTE:4 16.5
(byte) do10::i#2 i zp ZP_BYTE:4 11.0
(void()) hello()
(label) hello::@return
(const string) hello::msg msg = (string) "hello @"
(byte) idx
(byte) idx#11 idx zp ZP_BYTE:7 17.5
(byte) idx#12 idx zp ZP_BYTE:7 7.333333333333333
(byte) idx#16 idx zp ZP_BYTE:7 1.3333333333333333
(void()) main()
(label) main::@1
(label) main::@return
(void()) print((byte*) print::msg)
(label) print::@1
(label) print::@return
(byte) print::i
(byte) print::i#1 reg byte y 16.5
(byte) print::i#2 reg byte y 11.0
(byte*) print::msg
(byte*) print::msg#3 msg zp ZP_WORD:5 3.6666666666666665
(void()) world()
(label) world::@return
(const string) world::msg msg = (string) "world @"
zp ZP_WORD:2 [ do10::fn#3 ]
zp ZP_BYTE:4 [ do10::i#2 do10::i#1 ]
zp ZP_WORD:5 [ print::msg#3 ]
reg byte y [ print::i#2 print::i#1 ]
zp ZP_BYTE:7 [ idx#11 idx#16 idx#12 ]
FINAL ASSEMBLER
Score: 676
//SEG0 File Comments
// Tests calling into different function pointers which call a common sub-method
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
.label idx = 7
//SEG3 @begin
bbegin:
//SEG4 @1
//SEG5 [1] (byte) idx#16 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta idx
//SEG6 [2] phi from @1 to @2 [phi:@1->@2]
//SEG7 @2
//SEG8 [3] call main
//SEG9 [5] phi from @2 to main [phi:@2->main]
jsr main
rts
//SEG10 [4] phi from @2 to @end [phi:@2->@end]
//SEG11 @end
//SEG12 main
main: {
//SEG13 [6] call do10
//SEG14 [10] phi from main to do10 [phi:main->do10]
//SEG15 [10] phi (void()*) do10::fn#3 = &(void()) hello() [phi:main->do10#0] -- pprz1=pprc1
lda #<hello
sta do10.fn
lda #>hello
sta do10.fn+1
jsr do10
//SEG16 [7] phi from main to main::@1 [phi:main->main::@1]
//SEG17 main::@1
//SEG18 [8] call do10
//SEG19 [10] phi from main::@1 to do10 [phi:main::@1->do10]
//SEG20 [10] phi (void()*) do10::fn#3 = &(void()) world() [phi:main::@1->do10#0] -- pprz1=pprc1
lda #<world
sta do10.fn
lda #>world
sta do10.fn+1
jsr do10
//SEG21 main::@return
//SEG22 [9] return
rts
}
//SEG23 do10
// do10(void()* zeropage(2) fn)
do10: {
.label i = 4
.label fn = 2
//SEG24 [11] phi from do10 to do10::@1 [phi:do10->do10::@1]
//SEG25 [11] phi (byte) do10::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:do10->do10::@1#0] -- vbuz1=vbuc1
lda #0
sta i
//SEG26 [11] phi from do10::@1 to do10::@1 [phi:do10::@1->do10::@1]
//SEG27 [11] phi (byte) do10::i#2 = (byte) do10::i#1 [phi:do10::@1->do10::@1#0] -- register_copy
//SEG28 do10::@1
b1:
//SEG29 [12] call *((void()*) do10::fn#3)
jsr bi_fn
//SEG30 [13] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG31 [14] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1 -- vbuz1_neq_vbuc1_then_la1
lda #$a
cmp i
bne b1
//SEG32 do10::@return
//SEG33 [15] return
rts
bi_fn:
jmp (fn)
}
//SEG34 world
world: {
//SEG35 [17] call print
//SEG36 [19] phi from world to print [phi:world->print]
//SEG37 [19] phi (byte*) print::msg#3 = (const string) world::msg [phi:world->print#0] -- pbuz1=pbuc1
lda #<msg
sta print.msg
lda #>msg
sta print.msg+1
jsr print
//SEG38 world::@return
//SEG39 [18] return
rts
msg: .text "world @"
}
//SEG40 print
// print(byte* zeropage(5) msg)
print: {
.label msg = 5
//SEG41 [20] phi from print to print::@1 [phi:print->print::@1]
//SEG42 [20] phi (byte) idx#11 = (byte) idx#16 [phi:print->print::@1#0] -- register_copy
//SEG43 [20] phi (byte) print::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:print->print::@1#1] -- vbuyy=vbuc1
ldy #0
//SEG44 [20] phi from print::@1 to print::@1 [phi:print::@1->print::@1]
//SEG45 [20] phi (byte) idx#11 = (byte) idx#12 [phi:print::@1->print::@1#0] -- register_copy
//SEG46 [20] phi (byte) print::i#2 = (byte) print::i#1 [phi:print::@1->print::@1#1] -- register_copy
//SEG47 print::@1
b1:
//SEG48 [21] *((const byte*) SCREEN#0 + (byte) idx#11) ← *((byte*) print::msg#3 + (byte) print::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuyy
lda (msg),y
ldx idx
sta SCREEN,x
//SEG49 [22] (byte) idx#12 ← ++ (byte) idx#11 -- vbuz1=_inc_vbuz1
inc idx
//SEG50 [23] (byte) print::i#1 ← ++ (byte) print::i#2 -- vbuyy=_inc_vbuyy
iny
//SEG51 [24] if(*((byte*) print::msg#3 + (byte) print::i#1)!=(byte) '@') goto print::@1 -- pbuz1_derefidx_vbuyy_neq_vbuc1_then_la1
lda (msg),y
cmp #'@'
bne b1
//SEG52 print::@return
//SEG53 [25] return
rts
}
//SEG54 hello
hello: {
//SEG55 [27] call print
//SEG56 [19] phi from hello to print [phi:hello->print]
//SEG57 [19] phi (byte*) print::msg#3 = (const string) hello::msg [phi:hello->print#0] -- pbuz1=pbuc1
lda #<msg
sta print.msg
lda #>msg
sta print.msg+1
jsr print
//SEG58 hello::@return
//SEG59 [28] return
rts
msg: .text "hello @"
}

View File

@ -0,0 +1,41 @@
(label) @1
(label) @2
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) $400
(void()) do10((void()*) do10::fn)
(label) do10::@1
(label) do10::@return
(void()*) do10::fn
(void()*) do10::fn#3 fn zp ZP_WORD:2
(byte) do10::i
(byte) do10::i#1 i zp ZP_BYTE:4 16.5
(byte) do10::i#2 i zp ZP_BYTE:4 11.0
(void()) hello()
(label) hello::@return
(const string) hello::msg msg = (string) "hello @"
(byte) idx
(byte) idx#11 idx zp ZP_BYTE:7 17.5
(byte) idx#12 idx zp ZP_BYTE:7 7.333333333333333
(byte) idx#16 idx zp ZP_BYTE:7 1.3333333333333333
(void()) main()
(label) main::@1
(label) main::@return
(void()) print((byte*) print::msg)
(label) print::@1
(label) print::@return
(byte) print::i
(byte) print::i#1 reg byte y 16.5
(byte) print::i#2 reg byte y 11.0
(byte*) print::msg
(byte*) print::msg#3 msg zp ZP_WORD:5 3.6666666666666665
(void()) world()
(label) world::@return
(const string) world::msg msg = (string) "world @"
zp ZP_WORD:2 [ do10::fn#3 ]
zp ZP_BYTE:4 [ do10::i#2 do10::i#1 ]
zp ZP_WORD:5 [ print::msg#3 ]
reg byte y [ print::i#2 print::i#1 ]
zp ZP_BYTE:7 [ idx#11 idx#16 idx#12 ]

View File

@ -3,23 +3,20 @@
:BasicUpstart(main)
.pc = $80d "Program"
main: {
.label i = 2
lda #0
sta i
b2:
inc i
lda i
clc
adc #1
jsr getfn
jsr getfn.return
jsr fn1
jmp b2
}
// getfn(byte register(A) b)
getfn: {
.label return = fn1
rts
}
fn1: {
.label BORDERCOL = $d020
inc BORDERCOL
rts
}
// getfn(byte register(A) b)
getfn: {
rts
}

View File

@ -19,17 +19,18 @@ main::@2: scope:[main] from main::@1
[8] call getfn
to:main::@3
main::@3: scope:[main] from main::@2
[9] call (const void()*) getfn::return#1
[9] phi()
[10] call fn1
to:main::@1
getfn: scope:[getfn] from main::@2
[10] phi()
to:getfn::@return
getfn::@return: scope:[getfn] from getfn
[11] return
to:@return
fn1: scope:[fn1] from
[12] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0)
fn1: scope:[fn1] from main::@3
[11] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0)
to:fn1::@return
fn1::@return: scope:[fn1] from fn1
[13] return
[12] return
to:@return
getfn: scope:[getfn] from main::@2
[13] phi()
to:getfn::@return
getfn::@return: scope:[getfn] from getfn
[14] return
to:@return

View File

@ -101,23 +101,26 @@ if() condition always true - replacing block destination [1] if(true) goto main:
Successful SSA optimization Pass2ConstantIfs
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Replacing constant pointer function call fn1
Successful SSA optimization Pass2ConstantCallPointerIdentification
Successful SSA optimization PassNEliminateUnusedVars
Successful SSA optimization PassNEliminateUnusedVars
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with different constant siblings (const void()*) getfn::return#0
Constant inlined main::$1 = (const void()*) getfn::return#1
Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined getfn::return#0 = (const void()*) getfn::return#1
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@7
Adding NOP phi() at start of getfn
CALL GRAPH
Calls in [] to main:2
Calls in [main] to getfn:8
Calls in [main] to getfn:8 fn1:10
Created 1 initial phi equivalence classes
Coalesced [10] main::i#5 ← main::i#1
Coalesced [11] main::i#5 ← main::i#1
Coalesced down to 1 phi equivalence classes
Renumbering block @3 to @1
Renumbering block main::@7 to main::@3
@ -125,6 +128,7 @@ 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::@3
Adding NOP phi() at start of getfn
FINAL CONTROL FLOW GRAPH
@ -149,19 +153,20 @@ main::@2: scope:[main] from main::@1
[8] call getfn
to:main::@3
main::@3: scope:[main] from main::@2
[9] call (const void()*) getfn::return#1
[9] phi()
[10] call fn1
to:main::@1
getfn: scope:[getfn] from main::@2
[10] phi()
to:getfn::@return
getfn::@return: scope:[getfn] from getfn
[11] return
to:@return
fn1: scope:[fn1] from
[12] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0)
fn1: scope:[fn1] from main::@3
[11] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0)
to:fn1::@return
fn1::@return: scope:[fn1] from fn1
[13] return
[12] return
to:@return
getfn: scope:[getfn] from main::@2
[13] phi()
to:getfn::@return
getfn::@return: scope:[getfn] from getfn
[14] return
to:@return
@ -174,7 +179,7 @@ VARIABLE REGISTER WEIGHTS
(void()*) getfn::return
(void()) main()
(byte) main::i
(byte) main::i#1 8.25
(byte) main::i#1 6.6000000000000005
(byte) main::i#2 22.0
Initial phi equivalence classes
@ -230,63 +235,57 @@ main: {
lda i
sta getfn.b
//SEG17 [8] call getfn
//SEG18 [10] phi from main::@2 to getfn [phi:main::@2->getfn]
//SEG18 [13] phi from main::@2 to getfn [phi:main::@2->getfn]
getfn_from_b2:
jsr getfn
//SEG19 [9] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
b3_from_b2:
jmp b3
//SEG19 main::@3
//SEG20 main::@3
b3:
//SEG20 [9] call (const void()*) getfn::return#1
jsr getfn.return
//SEG21 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG21 [10] call fn1
jsr fn1
//SEG22 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
//SEG22 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG23 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
}
//SEG23 getfn
// getfn(byte zeropage(3) b)
getfn: {
.label return = fn1
.label b = 3
jmp breturn
//SEG24 getfn::@return
breturn:
//SEG25 [11] return
rts
}
//SEG26 fn1
//SEG24 fn1
fn1: {
.label BORDERCOL = $d020
//SEG27 [12] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG25 [11] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
jmp breturn
//SEG28 fn1::@return
//SEG26 fn1::@return
breturn:
//SEG29 [13] return
//SEG27 [12] return
rts
}
//SEG28 getfn
// getfn(byte zeropage(3) b)
getfn: {
.label b = 3
jmp breturn
//SEG29 getfn::@return
breturn:
//SEG30 [14] return
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [9] call (const void()*) getfn::return#1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a reg byte x reg byte y
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 x as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Statement [9] call (const void()*) getfn::return#1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a reg byte x reg byte y
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 ,
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 [ getfn::b#0 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [getfn] 110: zp ZP_BYTE:3 [ getfn::b#0 ]
Uplift Scope [main] 30.25: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope [main] 28.6: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope [fn1]
Uplift Scope []
Uplifting [getfn] best 352 combination reg byte a [ getfn::b#0 ]
Uplifting [main] best 352 combination zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplifting [fn1] best 352 combination
Uplifting [] best 352 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplifting [main] best 352 combination zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplifting [getfn] best 379 combination reg byte a [ getfn::b#0 ]
Uplifting [main] best 309 combination reg byte a [ main::i#2 main::i#1 ]
Uplifting [fn1] best 309 combination
Uplifting [] best 309 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
@ -314,55 +313,54 @@ bend_from_b1:
bend:
//SEG10 main
main: {
.label i = 2
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuaa=vbuc1
lda #0
sta i
jmp b1
//SEG13 main::@1
b1:
jmp b2
//SEG14 main::@2
b2:
//SEG15 [6] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG16 [7] (byte) getfn::b#0 ← (byte) main::i#1 -- vbuaa=vbuz1
lda i
//SEG15 [6] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuaa=_inc_vbuaa
clc
adc #1
//SEG16 [7] (byte) getfn::b#0 ← (byte) main::i#1
//SEG17 [8] call getfn
//SEG18 [10] phi from main::@2 to getfn [phi:main::@2->getfn]
//SEG18 [13] phi from main::@2 to getfn [phi:main::@2->getfn]
getfn_from_b2:
jsr getfn
//SEG19 [9] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
b3_from_b2:
jmp b3
//SEG19 main::@3
//SEG20 main::@3
b3:
//SEG20 [9] call (const void()*) getfn::return#1
jsr getfn.return
//SEG21 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG21 [10] call fn1
jsr fn1
//SEG22 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
//SEG22 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG23 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
}
//SEG23 getfn
// getfn(byte register(A) b)
getfn: {
.label return = fn1
jmp breturn
//SEG24 getfn::@return
breturn:
//SEG25 [11] return
rts
}
//SEG26 fn1
//SEG24 fn1
fn1: {
.label BORDERCOL = $d020
//SEG27 [12] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG25 [11] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
jmp breturn
//SEG28 fn1::@return
//SEG26 fn1::@return
breturn:
//SEG29 [13] return
//SEG27 [12] return
rts
}
//SEG28 getfn
// getfn(byte register(A) b)
getfn: {
jmp breturn
//SEG29 getfn::@return
breturn:
//SEG30 [14] return
rts
}
@ -381,6 +379,7 @@ Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1:
Removing instruction b3_from_b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
Removing instruction b1_from_main:
@ -409,21 +408,20 @@ FINAL SYMBOL TABLE
(byte) getfn::b
(byte) getfn::b#0 reg byte a 110.0
(void()*) getfn::return
(const void()*) getfn::return#1 return = &(void()) fn1()
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(byte) main::i
(byte) main::i#1 i zp ZP_BYTE:2 8.25
(byte) main::i#2 i zp ZP_BYTE:2 22.0
(byte) main::i#1 reg byte a 6.6000000000000005
(byte) main::i#2 reg byte a 22.0
zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
reg byte a [ main::i#2 main::i#1 ]
reg byte a [ getfn::b#0 ]
FINAL ASSEMBLER
Score: 244
Score: 174
//SEG0 File Comments
// Tests creating, assigning returning and calling pointers to non-args no-return functions
@ -441,43 +439,41 @@ Score: 244
//SEG9 @end
//SEG10 main
main: {
.label i = 2
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
//SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuaa=vbuc1
lda #0
sta i
//SEG13 main::@1
//SEG14 main::@2
b2:
//SEG15 [6] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG16 [7] (byte) getfn::b#0 ← (byte) main::i#1 -- vbuaa=vbuz1
lda i
//SEG15 [6] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuaa=_inc_vbuaa
clc
adc #1
//SEG16 [7] (byte) getfn::b#0 ← (byte) main::i#1
//SEG17 [8] call getfn
//SEG18 [10] phi from main::@2 to getfn [phi:main::@2->getfn]
//SEG18 [13] phi from main::@2 to getfn [phi:main::@2->getfn]
jsr getfn
//SEG19 main::@3
//SEG20 [9] call (const void()*) getfn::return#1
jsr getfn.return
//SEG21 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG22 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG19 [9] phi from main::@2 to main::@3 [phi:main::@2->main::@3]
//SEG20 main::@3
//SEG21 [10] call fn1
jsr fn1
//SEG22 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG23 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
jmp b2
}
//SEG23 getfn
// getfn(byte register(A) b)
getfn: {
.label return = fn1
//SEG24 getfn::@return
//SEG25 [11] return
rts
}
//SEG26 fn1
//SEG24 fn1
fn1: {
.label BORDERCOL = $d020
//SEG27 [12] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG25 [11] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
//SEG28 fn1::@return
//SEG29 [13] return
//SEG26 fn1::@return
//SEG27 [12] return
rts
}
//SEG28 getfn
// getfn(byte register(A) b)
getfn: {
//SEG29 getfn::@return
//SEG30 [14] return
rts
}

View File

@ -10,14 +10,13 @@
(byte) getfn::b
(byte) getfn::b#0 reg byte a 110.0
(void()*) getfn::return
(const void()*) getfn::return#1 return = &(void()) fn1()
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(byte) main::i
(byte) main::i#1 i zp ZP_BYTE:2 8.25
(byte) main::i#2 i zp ZP_BYTE:2 22.0
(byte) main::i#1 reg byte a 6.6000000000000005
(byte) main::i#2 reg byte a 22.0
zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
reg byte a [ main::i#2 main::i#1 ]
reg byte a [ getfn::b#0 ]

View File

@ -3,14 +3,13 @@
:BasicUpstart(main)
.pc = $80d "Program"
main: {
.label cls = fn1
.label cols = 2
lda #<$d800
sta cols
lda #>$d800
sta cols+1
b1:
jsr cls
jsr fn1
ldy #0
lda (cols),y
clc

View File

@ -12,7 +12,7 @@ main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@1
[5] (byte*) main::cols#2 ← phi( main/((byte*))(word/dword/signed dword) $d800 main::@1/(byte*) main::cols#1 )
[6] call *((const void()*) main::cls#0)
[6] call fn1
[7] *((byte*) main::cols#2) ← ++ *((byte*) main::cols#2)
[8] (byte*) main::cols#1 ← ++ (byte*) main::cols#2
[9] if((byte*) main::cols#1<(word/dword/signed dword) $d800+(word/signed word/dword/signed dword) $3e8) goto main::@1
@ -20,7 +20,7 @@ main::@1: scope:[main] from main main::@1
main::@return: scope:[main] from main::@1
[10] return
to:@return
fn1: scope:[fn1] from
fn1: scope:[fn1] from main::@1
[11] phi()
to:fn1::@1
fn1::@1: scope:[fn1] from fn1 fn1::@1

View File

@ -87,6 +87,9 @@ Constant (const word/dword/signed dword) main::$2 = $d800+$3e8
Constant (const byte*) fn1::screen#0 = ((byte*))$400
Constant (const word/signed word/dword/signed dword) fn1::$0 = $400+$3e8
Successful SSA optimization Pass2ConstantIdentification
Replacing constant pointer function call fn1
Successful SSA optimization Pass2ConstantCallPointerIdentification
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte*) main::cols#0
Inlining constant with var siblings (const byte*) fn1::screen#0
Constant inlined fn1::screen#0 = ((byte*))(word/signed word/dword/signed dword) $400
@ -103,6 +106,7 @@ Adding NOP phi() at start of main
Adding NOP phi() at start of fn1
CALL GRAPH
Calls in [] to main:2
Calls in [main] to fn1:6
Created 2 initial phi equivalence classes
Coalesced [11] main::cols#3 ← main::cols#1
@ -132,7 +136,7 @@ main: scope:[main] from @1
to:main::@1
main::@1: scope:[main] from main main::@1
[5] (byte*) main::cols#2 ← phi( main/((byte*))(word/dword/signed dword) $d800 main::@1/(byte*) main::cols#1 )
[6] call *((const void()*) main::cls#0)
[6] call fn1
[7] *((byte*) main::cols#2) ← ++ *((byte*) main::cols#2)
[8] (byte*) main::cols#1 ← ++ (byte*) main::cols#2
[9] if((byte*) main::cols#1<(word/dword/signed dword) $d800+(word/signed word/dword/signed dword) $3e8) goto main::@1
@ -140,7 +144,7 @@ main::@1: scope:[main] from main main::@1
main::@return: scope:[main] from main::@1
[10] return
to:@return
fn1: scope:[fn1] from
fn1: scope:[fn1] from main::@1
[11] phi()
to:fn1::@1
fn1::@1: scope:[fn1] from fn1 fn1::@1
@ -157,8 +161,8 @@ fn1::@return: scope:[fn1] from fn1::@1
VARIABLE REGISTER WEIGHTS
(void()) fn1()
(byte*) fn1::screen
(byte*) fn1::screen#1 16.5
(byte*) fn1::screen#2 22.0
(byte*) fn1::screen#1 151.5
(byte*) fn1::screen#2 202.0
(void()) main()
(void()*) main::cls
(byte*) main::cols
@ -200,7 +204,6 @@ bend_from_b1:
bend:
//SEG10 main
main: {
.label cls = fn1
.label cols = 2
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
@ -216,21 +219,23 @@ main: {
jmp b1
//SEG15 main::@1
b1:
//SEG16 [6] call *((const void()*) main::cls#0)
jsr cls
//SEG17 [7] *((byte*) main::cols#2) ← ++ *((byte*) main::cols#2) -- _deref_pbuz1=_inc__deref_pbuz1
//SEG16 [6] call fn1
//SEG17 [11] phi from main::@1 to fn1 [phi:main::@1->fn1]
fn1_from_b1:
jsr fn1
//SEG18 [7] *((byte*) main::cols#2) ← ++ *((byte*) main::cols#2) -- _deref_pbuz1=_inc__deref_pbuz1
ldy #0
lda (cols),y
clc
adc #1
ldy #0
sta (cols),y
//SEG18 [8] (byte*) main::cols#1 ← ++ (byte*) main::cols#2 -- pbuz1=_inc_pbuz1
//SEG19 [8] (byte*) main::cols#1 ← ++ (byte*) main::cols#2 -- pbuz1=_inc_pbuz1
inc cols
bne !+
inc cols+1
!:
//SEG19 [9] if((byte*) main::cols#1<(word/dword/signed dword) $d800+(word/signed word/dword/signed dword) $3e8) goto main::@1 -- pbuz1_lt_vwuc1_then_la1
//SEG20 [9] if((byte*) main::cols#1<(word/dword/signed dword) $d800+(word/signed word/dword/signed dword) $3e8) goto main::@1 -- pbuz1_lt_vwuc1_then_la1
lda cols+1
cmp #>$d800+$3e8
bcc b1_from_b1
@ -240,41 +245,41 @@ main: {
bcc b1_from_b1
!:
jmp breturn
//SEG20 main::@return
//SEG21 main::@return
breturn:
//SEG21 [10] return
//SEG22 [10] return
rts
}
//SEG22 fn1
//SEG23 fn1
fn1: {
.label screen = 4
//SEG23 [12] phi from fn1 to fn1::@1 [phi:fn1->fn1::@1]
//SEG24 [12] phi from fn1 to fn1::@1 [phi:fn1->fn1::@1]
b1_from_fn1:
//SEG24 [12] phi (byte*) fn1::screen#2 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:fn1->fn1::@1#0] -- pbuz1=pbuc1
//SEG25 [12] phi (byte*) fn1::screen#2 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:fn1->fn1::@1#0] -- pbuz1=pbuc1
lda #<$400
sta screen
lda #>$400
sta screen+1
jmp b1
//SEG25 [12] phi from fn1::@1 to fn1::@1 [phi:fn1::@1->fn1::@1]
//SEG26 [12] phi from fn1::@1 to fn1::@1 [phi:fn1::@1->fn1::@1]
b1_from_b1:
//SEG26 [12] phi (byte*) fn1::screen#2 = (byte*) fn1::screen#1 [phi:fn1::@1->fn1::@1#0] -- register_copy
//SEG27 [12] phi (byte*) fn1::screen#2 = (byte*) fn1::screen#1 [phi:fn1::@1->fn1::@1#0] -- register_copy
jmp b1
//SEG27 fn1::@1
//SEG28 fn1::@1
b1:
//SEG28 [13] *((byte*) fn1::screen#2) ← ++ *((byte*) fn1::screen#2) -- _deref_pbuz1=_inc__deref_pbuz1
//SEG29 [13] *((byte*) fn1::screen#2) ← ++ *((byte*) fn1::screen#2) -- _deref_pbuz1=_inc__deref_pbuz1
ldy #0
lda (screen),y
clc
adc #1
ldy #0
sta (screen),y
//SEG29 [14] (byte*) fn1::screen#1 ← ++ (byte*) fn1::screen#2 -- pbuz1=_inc_pbuz1
//SEG30 [14] (byte*) fn1::screen#1 ← ++ (byte*) fn1::screen#2 -- pbuz1=_inc_pbuz1
inc screen
bne !+
inc screen+1
!:
//SEG30 [15] if((byte*) fn1::screen#1<(word/signed word/dword/signed dword) $400+(word/signed word/dword/signed dword) $3e8) goto fn1::@1 -- pbuz1_lt_vwuc1_then_la1
//SEG31 [15] if((byte*) fn1::screen#1<(word/signed word/dword/signed dword) $400+(word/signed word/dword/signed dword) $3e8) goto fn1::@1 -- pbuz1_lt_vwuc1_then_la1
lda screen+1
cmp #>$400+$3e8
bcc b1_from_b1
@ -284,29 +289,28 @@ fn1: {
bcc b1_from_b1
!:
jmp breturn
//SEG31 fn1::@return
//SEG32 fn1::@return
breturn:
//SEG32 [16] return
//SEG33 [16] return
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] call *((const void()*) main::cls#0) [ main::cols#2 ] ( main:2 [ main::cols#2 ] ) always clobbers reg byte a reg byte x reg byte y
Statement [7] *((byte*) main::cols#2) ← ++ *((byte*) main::cols#2) [ main::cols#2 ] ( main:2 [ main::cols#2 ] ) always clobbers reg byte a reg byte y
Statement [9] if((byte*) main::cols#1<(word/dword/signed dword) $d800+(word/signed word/dword/signed dword) $3e8) goto main::@1 [ main::cols#1 ] ( main:2 [ main::cols#1 ] ) always clobbers reg byte a
Statement [13] *((byte*) fn1::screen#2) ← ++ *((byte*) fn1::screen#2) [ fn1::screen#2 ] ( [ fn1::screen#2 ] ) always clobbers reg byte a reg byte y
Statement [15] if((byte*) fn1::screen#1<(word/signed word/dword/signed dword) $400+(word/signed word/dword/signed dword) $3e8) goto fn1::@1 [ fn1::screen#1 ] ( [ fn1::screen#1 ] ) always clobbers reg byte a
Statement [13] *((byte*) fn1::screen#2) ← ++ *((byte*) fn1::screen#2) [ fn1::screen#2 ] ( main:2::fn1:6 [ main::cols#2 fn1::screen#2 ] ) always clobbers reg byte a reg byte y
Statement [15] if((byte*) fn1::screen#1<(word/signed word/dword/signed dword) $400+(word/signed word/dword/signed dword) $3e8) goto fn1::@1 [ fn1::screen#1 ] ( main:2::fn1:6 [ main::cols#2 fn1::screen#1 ] ) always clobbers reg byte a
Potential registers zp ZP_WORD:2 [ main::cols#2 main::cols#1 ] : zp ZP_WORD:2 ,
Potential registers zp ZP_WORD:4 [ fn1::screen#2 fn1::screen#1 ] : zp ZP_WORD:4 ,
REGISTER UPLIFT SCOPES
Uplift Scope [fn1] 38.5: zp ZP_WORD:4 [ fn1::screen#2 fn1::screen#1 ]
Uplift Scope [fn1] 353.5: zp ZP_WORD:4 [ fn1::screen#2 fn1::screen#1 ]
Uplift Scope [main] 31.17: zp ZP_WORD:2 [ main::cols#2 main::cols#1 ]
Uplift Scope []
Uplifting [fn1] best 1454 combination zp ZP_WORD:4 [ fn1::screen#2 fn1::screen#1 ]
Uplifting [main] best 1454 combination zp ZP_WORD:2 [ main::cols#2 main::cols#1 ]
Uplifting [] best 1454 combination
Uplifting [fn1] best 7565 combination zp ZP_WORD:4 [ fn1::screen#2 fn1::screen#1 ]
Uplifting [main] best 7565 combination zp ZP_WORD:2 [ main::cols#2 main::cols#1 ]
Uplifting [] best 7565 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
@ -334,7 +338,6 @@ bend_from_b1:
bend:
//SEG10 main
main: {
.label cls = fn1
.label cols = 2
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
@ -350,21 +353,23 @@ main: {
jmp b1
//SEG15 main::@1
b1:
//SEG16 [6] call *((const void()*) main::cls#0)
jsr cls
//SEG17 [7] *((byte*) main::cols#2) ← ++ *((byte*) main::cols#2) -- _deref_pbuz1=_inc__deref_pbuz1
//SEG16 [6] call fn1
//SEG17 [11] phi from main::@1 to fn1 [phi:main::@1->fn1]
fn1_from_b1:
jsr fn1
//SEG18 [7] *((byte*) main::cols#2) ← ++ *((byte*) main::cols#2) -- _deref_pbuz1=_inc__deref_pbuz1
ldy #0
lda (cols),y
clc
adc #1
ldy #0
sta (cols),y
//SEG18 [8] (byte*) main::cols#1 ← ++ (byte*) main::cols#2 -- pbuz1=_inc_pbuz1
//SEG19 [8] (byte*) main::cols#1 ← ++ (byte*) main::cols#2 -- pbuz1=_inc_pbuz1
inc cols
bne !+
inc cols+1
!:
//SEG19 [9] if((byte*) main::cols#1<(word/dword/signed dword) $d800+(word/signed word/dword/signed dword) $3e8) goto main::@1 -- pbuz1_lt_vwuc1_then_la1
//SEG20 [9] if((byte*) main::cols#1<(word/dword/signed dword) $d800+(word/signed word/dword/signed dword) $3e8) goto main::@1 -- pbuz1_lt_vwuc1_then_la1
lda cols+1
cmp #>$d800+$3e8
bcc b1_from_b1
@ -374,41 +379,41 @@ main: {
bcc b1_from_b1
!:
jmp breturn
//SEG20 main::@return
//SEG21 main::@return
breturn:
//SEG21 [10] return
//SEG22 [10] return
rts
}
//SEG22 fn1
//SEG23 fn1
fn1: {
.label screen = 4
//SEG23 [12] phi from fn1 to fn1::@1 [phi:fn1->fn1::@1]
//SEG24 [12] phi from fn1 to fn1::@1 [phi:fn1->fn1::@1]
b1_from_fn1:
//SEG24 [12] phi (byte*) fn1::screen#2 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:fn1->fn1::@1#0] -- pbuz1=pbuc1
//SEG25 [12] phi (byte*) fn1::screen#2 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:fn1->fn1::@1#0] -- pbuz1=pbuc1
lda #<$400
sta screen
lda #>$400
sta screen+1
jmp b1
//SEG25 [12] phi from fn1::@1 to fn1::@1 [phi:fn1::@1->fn1::@1]
//SEG26 [12] phi from fn1::@1 to fn1::@1 [phi:fn1::@1->fn1::@1]
b1_from_b1:
//SEG26 [12] phi (byte*) fn1::screen#2 = (byte*) fn1::screen#1 [phi:fn1::@1->fn1::@1#0] -- register_copy
//SEG27 [12] phi (byte*) fn1::screen#2 = (byte*) fn1::screen#1 [phi:fn1::@1->fn1::@1#0] -- register_copy
jmp b1
//SEG27 fn1::@1
//SEG28 fn1::@1
b1:
//SEG28 [13] *((byte*) fn1::screen#2) ← ++ *((byte*) fn1::screen#2) -- _deref_pbuz1=_inc__deref_pbuz1
//SEG29 [13] *((byte*) fn1::screen#2) ← ++ *((byte*) fn1::screen#2) -- _deref_pbuz1=_inc__deref_pbuz1
ldy #0
lda (screen),y
clc
adc #1
ldy #0
sta (screen),y
//SEG29 [14] (byte*) fn1::screen#1 ← ++ (byte*) fn1::screen#2 -- pbuz1=_inc_pbuz1
//SEG30 [14] (byte*) fn1::screen#1 ← ++ (byte*) fn1::screen#2 -- pbuz1=_inc_pbuz1
inc screen
bne !+
inc screen+1
!:
//SEG30 [15] if((byte*) fn1::screen#1<(word/signed word/dword/signed dword) $400+(word/signed word/dword/signed dword) $3e8) goto fn1::@1 -- pbuz1_lt_vwuc1_then_la1
//SEG31 [15] if((byte*) fn1::screen#1<(word/signed word/dword/signed dword) $400+(word/signed word/dword/signed dword) $3e8) goto fn1::@1 -- pbuz1_lt_vwuc1_then_la1
lda screen+1
cmp #>$400+$3e8
bcc b1_from_b1
@ -418,9 +423,9 @@ fn1: {
bcc b1_from_b1
!:
jmp breturn
//SEG31 fn1::@return
//SEG32 fn1::@return
breturn:
//SEG32 [16] return
//SEG33 [16] return
rts
}
@ -444,6 +449,7 @@ Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Removing instruction b1_from_b1:
Removing instruction fn1_from_b1:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
@ -469,13 +475,12 @@ FINAL SYMBOL TABLE
(label) fn1::@1
(label) fn1::@return
(byte*) fn1::screen
(byte*) fn1::screen#1 screen zp ZP_WORD:4 16.5
(byte*) fn1::screen#2 screen zp ZP_WORD:4 22.0
(byte*) fn1::screen#1 screen zp ZP_WORD:4 151.5
(byte*) fn1::screen#2 screen zp ZP_WORD:4 202.0
(void()) main()
(label) main::@1
(label) main::@return
(void()*) main::cls
(const void()*) main::cls#0 cls = &(void()) fn1()
(byte*) main::cols
(byte*) main::cols#1 cols zp ZP_WORD:2 16.5
(byte*) main::cols#2 cols zp ZP_WORD:2 14.666666666666666
@ -485,7 +490,7 @@ zp ZP_WORD:4 [ fn1::screen#2 fn1::screen#1 ]
FINAL ASSEMBLER
Score: 1222
Score: 6343
//SEG0 File Comments
// Tests calling into a function pointer with local variables
@ -503,7 +508,6 @@ Score: 1222
//SEG9 @end
//SEG10 main
main: {
.label cls = fn1
.label cols = 2
//SEG11 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG12 [5] phi (byte*) main::cols#2 = ((byte*))(word/dword/signed dword) $d800 [phi:main->main::@1#0] -- pbuz1=pbuc1
@ -515,20 +519,21 @@ main: {
//SEG14 [5] phi (byte*) main::cols#2 = (byte*) main::cols#1 [phi:main::@1->main::@1#0] -- register_copy
//SEG15 main::@1
b1:
//SEG16 [6] call *((const void()*) main::cls#0)
jsr cls
//SEG17 [7] *((byte*) main::cols#2) ← ++ *((byte*) main::cols#2) -- _deref_pbuz1=_inc__deref_pbuz1
//SEG16 [6] call fn1
//SEG17 [11] phi from main::@1 to fn1 [phi:main::@1->fn1]
jsr fn1
//SEG18 [7] *((byte*) main::cols#2) ← ++ *((byte*) main::cols#2) -- _deref_pbuz1=_inc__deref_pbuz1
ldy #0
lda (cols),y
clc
adc #1
sta (cols),y
//SEG18 [8] (byte*) main::cols#1 ← ++ (byte*) main::cols#2 -- pbuz1=_inc_pbuz1
//SEG19 [8] (byte*) main::cols#1 ← ++ (byte*) main::cols#2 -- pbuz1=_inc_pbuz1
inc cols
bne !+
inc cols+1
!:
//SEG19 [9] if((byte*) main::cols#1<(word/dword/signed dword) $d800+(word/signed word/dword/signed dword) $3e8) goto main::@1 -- pbuz1_lt_vwuc1_then_la1
//SEG20 [9] if((byte*) main::cols#1<(word/dword/signed dword) $d800+(word/signed word/dword/signed dword) $3e8) goto main::@1 -- pbuz1_lt_vwuc1_then_la1
lda cols+1
cmp #>$d800+$3e8
bcc b1
@ -537,35 +542,35 @@ main: {
cmp #<$d800+$3e8
bcc b1
!:
//SEG20 main::@return
//SEG21 [10] return
//SEG21 main::@return
//SEG22 [10] return
rts
}
//SEG22 fn1
//SEG23 fn1
fn1: {
.label screen = 4
//SEG23 [12] phi from fn1 to fn1::@1 [phi:fn1->fn1::@1]
//SEG24 [12] phi (byte*) fn1::screen#2 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:fn1->fn1::@1#0] -- pbuz1=pbuc1
//SEG24 [12] phi from fn1 to fn1::@1 [phi:fn1->fn1::@1]
//SEG25 [12] phi (byte*) fn1::screen#2 = ((byte*))(word/signed word/dword/signed dword) $400 [phi:fn1->fn1::@1#0] -- pbuz1=pbuc1
lda #<$400
sta screen
lda #>$400
sta screen+1
//SEG25 [12] phi from fn1::@1 to fn1::@1 [phi:fn1::@1->fn1::@1]
//SEG26 [12] phi (byte*) fn1::screen#2 = (byte*) fn1::screen#1 [phi:fn1::@1->fn1::@1#0] -- register_copy
//SEG27 fn1::@1
//SEG26 [12] phi from fn1::@1 to fn1::@1 [phi:fn1::@1->fn1::@1]
//SEG27 [12] phi (byte*) fn1::screen#2 = (byte*) fn1::screen#1 [phi:fn1::@1->fn1::@1#0] -- register_copy
//SEG28 fn1::@1
b1:
//SEG28 [13] *((byte*) fn1::screen#2) ← ++ *((byte*) fn1::screen#2) -- _deref_pbuz1=_inc__deref_pbuz1
//SEG29 [13] *((byte*) fn1::screen#2) ← ++ *((byte*) fn1::screen#2) -- _deref_pbuz1=_inc__deref_pbuz1
ldy #0
lda (screen),y
clc
adc #1
sta (screen),y
//SEG29 [14] (byte*) fn1::screen#1 ← ++ (byte*) fn1::screen#2 -- pbuz1=_inc_pbuz1
//SEG30 [14] (byte*) fn1::screen#1 ← ++ (byte*) fn1::screen#2 -- pbuz1=_inc_pbuz1
inc screen
bne !+
inc screen+1
!:
//SEG30 [15] if((byte*) fn1::screen#1<(word/signed word/dword/signed dword) $400+(word/signed word/dword/signed dword) $3e8) goto fn1::@1 -- pbuz1_lt_vwuc1_then_la1
//SEG31 [15] if((byte*) fn1::screen#1<(word/signed word/dword/signed dword) $400+(word/signed word/dword/signed dword) $3e8) goto fn1::@1 -- pbuz1_lt_vwuc1_then_la1
lda screen+1
cmp #>$400+$3e8
bcc b1
@ -574,8 +579,8 @@ fn1: {
cmp #<$400+$3e8
bcc b1
!:
//SEG31 fn1::@return
//SEG32 [16] return
//SEG32 fn1::@return
//SEG33 [16] return
rts
}

View File

@ -5,13 +5,12 @@
(label) fn1::@1
(label) fn1::@return
(byte*) fn1::screen
(byte*) fn1::screen#1 screen zp ZP_WORD:4 16.5
(byte*) fn1::screen#2 screen zp ZP_WORD:4 22.0
(byte*) fn1::screen#1 screen zp ZP_WORD:4 151.5
(byte*) fn1::screen#2 screen zp ZP_WORD:4 202.0
(void()) main()
(label) main::@1
(label) main::@return
(void()*) main::cls
(const void()*) main::cls#0 cls = &(void()) fn1()
(byte*) main::cols
(byte*) main::cols#1 cols zp ZP_WORD:2 16.5
(byte*) main::cols#2 cols zp ZP_WORD:2 14.666666666666666

View File

@ -10,7 +10,6 @@ bbegin:
jsr main
rts
main: {
.label f = hello
jsr do10
rts
}
@ -19,7 +18,7 @@ do10: {
lda #0
sta i
b1:
jsr main.f
jsr hello
inc i
lda #$a
cmp i

View File

@ -22,18 +22,18 @@ do10: scope:[do10] from main
to:do10::@1
do10::@1: scope:[do10] from do10 do10::@1
[9] (byte) do10::i#2 ← phi( do10/(byte/signed byte/word/signed word/dword/signed dword) 0 do10::@1/(byte) do10::i#1 )
[10] call *((const void()*) main::f#0)
[10] call hello
[11] (byte) do10::i#1 ← ++ (byte) do10::i#2
[12] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1
to:do10::@return
do10::@return: scope:[do10] from do10::@1
[13] return
to:@return
hello: scope:[hello] from
[14] phi()
hello: scope:[hello] from do10::@1
[14] (byte~) idx#7 ← (byte) idx#0
to:hello::@1
hello::@1: scope:[hello] from hello hello::@1
[15] (byte) idx#3 ← phi( hello/(byte) idx#0 hello::@1/(byte) idx#1 )
[15] (byte) idx#3 ← phi( hello/(byte~) idx#7 hello::@1/(byte) idx#1 )
[15] (byte) hello::i#2 ← phi( hello/(byte/signed byte/word/signed word/dword/signed dword) 0 hello::@1/(byte) hello::i#1 )
[16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2)
[17] (byte) idx#1 ← ++ (byte) idx#3

View File

@ -132,12 +132,15 @@ Constant (const void()*) do10::fn#0 = main::f#0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value do10::i#1 ← ++ do10::i#2 to ++
Resolved ranged comparison value if(do10::i#1!=rangelast(0,9)) goto do10::@1 to (byte/signed byte/word/signed word/dword/signed dword) $a
Replacing constant pointer function call hello
Successful SSA optimization Pass2ConstantCallPointerIdentification
Successful SSA optimization PassNEliminateUnusedVars
Successful SSA optimization PassNEliminateUnusedVars
Inlining constant with var siblings (const byte) do10::i#0
Inlining constant with var siblings (const byte) hello::i#0
Constant inlined $0 = (const byte[]) msg#0
Constant inlined hello::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined do10::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0
Constant inlined do10::fn#0 = (const void()*) main::f#0
Constant inlined $0 = (const byte[]) msg#0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting do10::@3(between do10::@1 and do10::@1)
Added new block during phi lifting hello::@3(between hello::@1 and hello::@1)
@ -149,13 +152,14 @@ Adding NOP phi() at start of do10
CALL GRAPH
Calls in [] to main:3
Calls in [main] to do10:6
Calls in [do10] to hello:10
Created 3 initial phi equivalence classes
Coalesced [14] do10::i#3 ← do10::i#1
Coalesced [15] idx#7 ← idx#0
Not coalescing [15] idx#7 ← idx#0
Coalesced [22] hello::i#3 ← hello::i#1
Coalesced [23] idx#8 ← idx#1
Coalesced down to 3 phi equivalence classes
Coalesced down to 4 phi equivalence classes
Culled Empty Block (label) do10::@3
Culled Empty Block (label) hello::@3
Renumbering block @2 to @1
@ -165,7 +169,6 @@ 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 do10
Adding NOP phi() at start of hello
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
@ -192,18 +195,18 @@ do10: scope:[do10] from main
to:do10::@1
do10::@1: scope:[do10] from do10 do10::@1
[9] (byte) do10::i#2 ← phi( do10/(byte/signed byte/word/signed word/dword/signed dword) 0 do10::@1/(byte) do10::i#1 )
[10] call *((const void()*) main::f#0)
[10] call hello
[11] (byte) do10::i#1 ← ++ (byte) do10::i#2
[12] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1
to:do10::@return
do10::@return: scope:[do10] from do10::@1
[13] return
to:@return
hello: scope:[hello] from
[14] phi()
hello: scope:[hello] from do10::@1
[14] (byte~) idx#7 ← (byte) idx#0
to:hello::@1
hello::@1: scope:[hello] from hello hello::@1
[15] (byte) idx#3 ← phi( hello/(byte) idx#0 hello::@1/(byte) idx#1 )
[15] (byte) idx#3 ← phi( hello/(byte~) idx#7 hello::@1/(byte) idx#1 )
[15] (byte) hello::i#2 ← phi( hello/(byte/signed byte/word/signed word/dword/signed dword) 0 hello::@1/(byte) hello::i#1 )
[16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2)
[17] (byte) idx#1 ← ++ (byte) idx#3
@ -224,12 +227,13 @@ VARIABLE REGISTER WEIGHTS
(byte) do10::i#2 11.0
(void()) hello()
(byte) hello::i
(byte) hello::i#1 16.5
(byte) hello::i#2 11.0
(byte) hello::i#1 151.5
(byte) hello::i#2 101.0
(byte) idx
(byte) idx#0 4.0
(byte) idx#1 7.333333333333333
(byte) idx#3 17.5
(byte) idx#0 0.26666666666666666
(byte) idx#1 67.33333333333333
(byte) idx#3 152.5
(byte~) idx#7 4.0
(void()) main()
(void()*) main::f
(byte[]) msg
@ -237,14 +241,15 @@ VARIABLE REGISTER WEIGHTS
Initial phi equivalence classes
[ do10::i#2 do10::i#1 ]
[ hello::i#2 hello::i#1 ]
[ idx#3 idx#0 idx#1 ]
[ idx#3 idx#7 idx#1 ]
Coalescing volatile variable equivalence classes [ idx#0 ] and [ idx#3 idx#7 idx#1 ]
Complete equivalence classes
[ do10::i#2 do10::i#1 ]
[ hello::i#2 hello::i#1 ]
[ idx#3 idx#0 idx#1 ]
[ idx#0 idx#3 idx#7 idx#1 ]
Allocated zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Allocated zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ]
Allocated zp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ]
Allocated zp ZP_BYTE:4 [ idx#0 idx#3 idx#7 idx#1 ]
INITIAL ASM
//SEG0 File Comments
@ -280,7 +285,6 @@ bend_from_b2:
bend:
//SEG12 main
main: {
.label f = hello
//SEG13 [6] call do10
//SEG14 [8] phi from main to do10 [phi:main->do10]
do10_from_main:
@ -306,8 +310,8 @@ do10: {
jmp b1
//SEG22 do10::@1
b1:
//SEG23 [10] call *((const void()*) main::f#0)
jsr main.f
//SEG23 [10] call hello
jsr hello
//SEG24 [11] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG25 [12] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1 -- vbuz1_neq_vbuc1_then_la1
@ -323,77 +327,73 @@ do10: {
//SEG28 hello
hello: {
.label i = 3
//SEG29 [15] phi from hello to hello::@1 [phi:hello->hello::@1]
//SEG29 [14] (byte~) idx#7 ← (byte) idx#0
//SEG30 [15] phi from hello to hello::@1 [phi:hello->hello::@1]
b1_from_hello:
//SEG30 [15] phi (byte) idx#3 = (byte) idx#0 [phi:hello->hello::@1#0] -- register_copy
//SEG31 [15] phi (byte) hello::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:hello->hello::@1#1] -- vbuz1=vbuc1
//SEG31 [15] phi (byte) idx#3 = (byte~) idx#7 [phi:hello->hello::@1#0] -- register_copy
//SEG32 [15] phi (byte) hello::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:hello->hello::@1#1] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG32 [15] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
//SEG33 [15] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
b1_from_b1:
//SEG33 [15] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy
//SEG34 [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy
//SEG34 [15] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy
//SEG35 [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy
jmp b1
//SEG35 hello::@1
//SEG36 hello::@1
b1:
//SEG36 [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2
//SEG37 [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2
ldy i
lda msg,y
ldy idx
sta SCREEN,y
//SEG37 [17] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
//SEG38 [17] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
inc idx
//SEG38 [18] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuz1=_inc_vbuz1
//SEG39 [18] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG39 [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 -- pbuc1_derefidx_vbuz1_neq_vbuc2_then_la1
//SEG40 [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 -- pbuc1_derefidx_vbuz1_neq_vbuc2_then_la1
lda #'@'
ldy i
cmp msg,y
bne b1_from_b1
jmp breturn
//SEG40 hello::@return
//SEG41 hello::@return
breturn:
//SEG41 [20] return
//SEG42 [20] return
rts
}
msg: .text "hello @"
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] (byte) idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a
Statement [10] call *((const void()*) main::f#0) [ do10::i#2 ] ( main:3::do10:6 [ do10::i#2 ] ) always clobbers reg byte a reg byte x reg byte y
Statement [1] (byte) idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ idx#0 ] ( ) always clobbers reg byte a
Statement [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) [ idx#0 hello::i#2 idx#3 ] ( main:3::do10:6::hello:10 [ do10::i#2 idx#0 hello::i#2 idx#3 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Removing always clobbered register reg byte x as potential for zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Statement [12] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1 [ do10::i#1 ] ( main:3::do10:6 [ do10::i#1 ] ) always clobbers reg byte a
Statement [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) [ hello::i#2 idx#3 ] ( [ hello::i#2 idx#3 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ]
Statement [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 [ hello::i#1 idx#1 ] ( [ hello::i#1 idx#1 ] ) always clobbers reg byte a
Statement [1] (byte) idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a
Statement [10] call *((const void()*) main::f#0) [ do10::i#2 ] ( main:3::do10:6 [ do10::i#2 ] ) always clobbers reg byte a reg byte x reg byte y
Statement [12] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1 [ do10::i#1 ] ( main:3::do10:6 [ do10::i#1 ] ) always clobbers reg byte a
Statement [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) [ hello::i#2 idx#3 ] ( [ hello::i#2 idx#3 ] ) always clobbers reg byte a reg byte y
Statement [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 [ hello::i#1 idx#1 ] ( [ hello::i#1 idx#1 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ] : zp ZP_BYTE:2 ,
Statement [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 [ idx#0 hello::i#1 idx#1 ] ( main:3::do10:6::hello:10 [ do10::i#2 idx#0 hello::i#1 idx#1 ] ) always clobbers reg byte a
Statement [1] (byte) idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ idx#0 ] ( ) always clobbers reg byte a
Statement [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) [ idx#0 hello::i#2 idx#3 ] ( main:3::do10:6::hello:10 [ do10::i#2 idx#0 hello::i#2 idx#3 ] ) always clobbers reg byte a reg byte y
Statement [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 [ idx#0 hello::i#1 idx#1 ] ( main:3::do10:6::hello:10 [ do10::i#2 idx#0 hello::i#1 idx#1 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ] : zp ZP_BYTE:2 , reg byte x ,
Potential registers zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ] : zp ZP_BYTE:3 , reg byte x ,
Potential registers zp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ] : zp ZP_BYTE:4 ,
Potential registers zp ZP_BYTE:4 [ idx#0 idx#3 idx#7 idx#1 ] : zp ZP_BYTE:4 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 28.83: zp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ]
Uplift Scope [hello] 252.5: zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ]
Uplift Scope [] 224.1: zp ZP_BYTE:4 [ idx#0 idx#3 idx#7 idx#1 ]
Uplift Scope [do10] 27.5: zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Uplift Scope [hello] 27.5: zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ]
Uplift Scope [main]
Uplifting [] best 914 combination zp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ]
Uplifting [do10] best 914 combination zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Uplifting [hello] best 794 combination reg byte x [ hello::i#2 hello::i#1 ]
Uplifting [main] best 794 combination
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ]
Uplifting [] best 794 combination zp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ]
Uplifting [hello] best 4349 combination reg byte x [ hello::i#2 hello::i#1 ]
Uplifting [] best 4349 combination zp ZP_BYTE:4 [ idx#0 idx#3 idx#7 idx#1 ]
Uplifting [do10] best 4349 combination zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Uplifting [main] best 4349 combination
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ idx#0 idx#3 idx#7 idx#1 ]
Uplifting [] best 4349 combination zp ZP_BYTE:4 [ idx#0 idx#3 idx#7 idx#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Uplifting [do10] best 794 combination zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:3 [ idx#3 idx#0 idx#1 ]
Uplifting [do10] best 4349 combination zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:3 [ idx#0 idx#3 idx#7 idx#1 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
@ -429,7 +429,6 @@ bend_from_b2:
bend:
//SEG12 main
main: {
.label f = hello
//SEG13 [6] call do10
//SEG14 [8] phi from main to do10 [phi:main->do10]
do10_from_main:
@ -455,8 +454,8 @@ do10: {
jmp b1
//SEG22 do10::@1
b1:
//SEG23 [10] call *((const void()*) main::f#0)
jsr main.f
//SEG23 [10] call hello
jsr hello
//SEG24 [11] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG25 [12] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1 -- vbuz1_neq_vbuc1_then_la1
@ -471,35 +470,36 @@ do10: {
}
//SEG28 hello
hello: {
//SEG29 [15] phi from hello to hello::@1 [phi:hello->hello::@1]
//SEG29 [14] (byte~) idx#7 ← (byte) idx#0
//SEG30 [15] phi from hello to hello::@1 [phi:hello->hello::@1]
b1_from_hello:
//SEG30 [15] phi (byte) idx#3 = (byte) idx#0 [phi:hello->hello::@1#0] -- register_copy
//SEG31 [15] phi (byte) hello::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:hello->hello::@1#1] -- vbuxx=vbuc1
//SEG31 [15] phi (byte) idx#3 = (byte~) idx#7 [phi:hello->hello::@1#0] -- register_copy
//SEG32 [15] phi (byte) hello::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:hello->hello::@1#1] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG32 [15] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
//SEG33 [15] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
b1_from_b1:
//SEG33 [15] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy
//SEG34 [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy
//SEG34 [15] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy
//SEG35 [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy
jmp b1
//SEG35 hello::@1
//SEG36 hello::@1
b1:
//SEG36 [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx
//SEG37 [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx
lda msg,x
ldy idx
sta SCREEN,y
//SEG37 [17] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
//SEG38 [17] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
inc idx
//SEG38 [18] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuxx=_inc_vbuxx
//SEG39 [18] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG39 [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 -- pbuc1_derefidx_vbuxx_neq_vbuc2_then_la1
//SEG40 [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 -- pbuc1_derefidx_vbuxx_neq_vbuc2_then_la1
lda msg,x
cmp #'@'
bne b1_from_b1
jmp breturn
//SEG40 hello::@return
//SEG41 hello::@return
breturn:
//SEG41 [20] return
//SEG42 [20] return
rts
}
msg: .text "hello @"
@ -556,26 +556,26 @@ FINAL SYMBOL TABLE
(label) hello::@1
(label) hello::@return
(byte) hello::i
(byte) hello::i#1 reg byte x 16.5
(byte) hello::i#2 reg byte x 11.0
(byte) hello::i#1 reg byte x 151.5
(byte) hello::i#2 reg byte x 101.0
(byte) idx
(byte) idx#0 idx zp ZP_BYTE:3 4.0
(byte) idx#1 idx zp ZP_BYTE:3 7.333333333333333
(byte) idx#3 idx zp ZP_BYTE:3 17.5
(byte) idx#0 idx zp ZP_BYTE:3 0.26666666666666666
(byte) idx#1 idx zp ZP_BYTE:3 67.33333333333333
(byte) idx#3 idx zp ZP_BYTE:3 152.5
(byte~) idx#7 idx zp ZP_BYTE:3 4.0
(void()) main()
(label) main::@return
(void()*) main::f
(const void()*) main::f#0 f = &(void()) hello()
(byte[]) msg
(const byte[]) msg#0 msg = (string) "hello @"
zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
reg byte x [ hello::i#2 hello::i#1 ]
zp ZP_BYTE:3 [ idx#3 idx#0 idx#1 ]
zp ZP_BYTE:3 [ idx#0 idx#3 idx#7 idx#1 ]
FINAL ASSEMBLER
Score: 581
Score: 3326
//SEG0 File Comments
// Tests calling into a function pointer with local variables
@ -602,7 +602,6 @@ bbegin:
//SEG11 @end
//SEG12 main
main: {
.label f = hello
//SEG13 [6] call do10
//SEG14 [8] phi from main to do10 [phi:main->do10]
jsr do10
@ -621,8 +620,8 @@ do10: {
//SEG21 [9] phi (byte) do10::i#2 = (byte) do10::i#1 [phi:do10::@1->do10::@1#0] -- register_copy
//SEG22 do10::@1
b1:
//SEG23 [10] call *((const void()*) main::f#0)
jsr main.f
//SEG23 [10] call hello
jsr hello
//SEG24 [11] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1
inc i
//SEG25 [12] if((byte) do10::i#1!=(byte/signed byte/word/signed word/dword/signed dword) $a) goto do10::@1 -- vbuz1_neq_vbuc1_then_la1
@ -635,29 +634,30 @@ do10: {
}
//SEG28 hello
hello: {
//SEG29 [15] phi from hello to hello::@1 [phi:hello->hello::@1]
//SEG30 [15] phi (byte) idx#3 = (byte) idx#0 [phi:hello->hello::@1#0] -- register_copy
//SEG31 [15] phi (byte) hello::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:hello->hello::@1#1] -- vbuxx=vbuc1
//SEG29 [14] (byte~) idx#7 ← (byte) idx#0
//SEG30 [15] phi from hello to hello::@1 [phi:hello->hello::@1]
//SEG31 [15] phi (byte) idx#3 = (byte~) idx#7 [phi:hello->hello::@1#0] -- register_copy
//SEG32 [15] phi (byte) hello::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:hello->hello::@1#1] -- vbuxx=vbuc1
ldx #0
//SEG32 [15] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
//SEG33 [15] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy
//SEG34 [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy
//SEG35 hello::@1
//SEG33 [15] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
//SEG34 [15] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy
//SEG35 [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy
//SEG36 hello::@1
b1:
//SEG36 [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx
//SEG37 [16] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((const byte[]) msg#0 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx
lda msg,x
ldy idx
sta SCREEN,y
//SEG37 [17] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
//SEG38 [17] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
inc idx
//SEG38 [18] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuxx=_inc_vbuxx
//SEG39 [18] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuxx=_inc_vbuxx
inx
//SEG39 [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 -- pbuc1_derefidx_vbuxx_neq_vbuc2_then_la1
//SEG40 [19] if(*((const byte[]) msg#0 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 -- pbuc1_derefidx_vbuxx_neq_vbuc2_then_la1
lda msg,x
cmp #'@'
bne b1
//SEG40 hello::@return
//SEG41 [20] return
//SEG41 hello::@return
//SEG42 [20] return
rts
}
msg: .text "hello @"

View File

@ -15,19 +15,19 @@
(label) hello::@1
(label) hello::@return
(byte) hello::i
(byte) hello::i#1 reg byte x 16.5
(byte) hello::i#2 reg byte x 11.0
(byte) hello::i#1 reg byte x 151.5
(byte) hello::i#2 reg byte x 101.0
(byte) idx
(byte) idx#0 idx zp ZP_BYTE:3 4.0
(byte) idx#1 idx zp ZP_BYTE:3 7.333333333333333
(byte) idx#3 idx zp ZP_BYTE:3 17.5
(byte) idx#0 idx zp ZP_BYTE:3 0.26666666666666666
(byte) idx#1 idx zp ZP_BYTE:3 67.33333333333333
(byte) idx#3 idx zp ZP_BYTE:3 152.5
(byte~) idx#7 idx zp ZP_BYTE:3 4.0
(void()) main()
(label) main::@return
(void()*) main::f
(const void()*) main::f#0 f = &(void()) hello()
(byte[]) msg
(const byte[]) msg#0 msg = (string) "hello @"
zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
reg byte x [ hello::i#2 hello::i#1 ]
zp ZP_BYTE:3 [ idx#3 idx#0 idx#1 ]
zp ZP_BYTE:3 [ idx#0 idx#3 idx#7 idx#1 ]

View File

@ -299,22 +299,17 @@ Initial phi equivalence classes
[ do10::i#2 do10::i#1 ]
[ hello::i#2 hello::i#1 ]
[ idx#3 idx#0 idx#1 ]
Added variable msg#10 to zero page equivalence class [ msg#10 ]
Added variable msg#0 to zero page equivalence class [ msg#0 ]
Added variable msg#1 to zero page equivalence class [ msg#1 ]
Coalescing volatile variable equivalence classes [ msg#0 ] and [ msg#1 ]
Coalescing volatile variable equivalence classes [ msg#0 msg#1 ] and [ msg#10 ]
Complete equivalence classes
[ do10::i#2 do10::i#1 ]
[ hello::i#2 hello::i#1 ]
[ idx#3 idx#0 idx#1 ]
[ msg#10 ]
[ msg#0 ]
[ msg#1 ]
[ msg#0 msg#1 msg#10 ]
Allocated zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Allocated zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ]
Allocated zp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ]
Allocated zp ZP_WORD:5 [ msg#10 ]
Allocated zp ZP_WORD:7 [ msg#0 ]
Allocated zp ZP_WORD:9 [ msg#1 ]
Allocated zp ZP_WORD:5 [ msg#0 msg#1 msg#10 ]
INITIAL ASM
//SEG0 File Comments
@ -325,10 +320,8 @@ INITIAL ASM
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
.label msg = 7
.label msg_1 = 9
.label msg = 5
.label idx = 4
.label msg_10 = 5
//SEG3 @begin
bbegin:
jmp b1
@ -336,9 +329,9 @@ bbegin:
b1:
//SEG5 [1] (byte*) msg#10 ← (byte*) 0 -- pbuz1=pbuc1
lda #<0
sta msg_10
sta msg
lda #>0
sta msg_10+1
sta msg+1
//SEG6 [2] (byte) idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta idx
@ -371,9 +364,9 @@ main: {
b1:
//SEG17 [8] (byte*) msg#1 ← (const byte[]) msg2#0 -- pbuz1=pbuc1
lda #<msg2
sta msg_1
sta msg
lda #>msg2
sta msg_1+1
sta msg+1
//SEG18 [9] call do10
//SEG19 [11] phi from main::@1 to do10 [phi:main::@1->do10]
do10_from_b1:
@ -433,7 +426,7 @@ hello: {
//SEG41 [19] *((const byte*) SCREEN#0 + (byte) idx#3) ← *((byte*) msg#10 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuz3
ldx idx
ldy i
lda (msg_10),y
lda (msg),y
sta SCREEN,x
//SEG42 [20] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
inc idx
@ -441,7 +434,7 @@ hello: {
inc i
//SEG44 [22] if(*((byte*) msg#10 + (byte) hello::i#1)!=(byte) '@') goto hello::@1 -- pbuz1_derefidx_vbuz2_neq_vbuc1_then_la1
ldy i
lda (msg_10),y
lda (msg),y
cmp #'@'
bne b1_from_b1
jmp breturn
@ -478,17 +471,15 @@ Statement [22] if(*((byte*) msg#10 + (byte) hello::i#1)!=(byte) '@') goto hello:
Potential registers zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ] : zp ZP_BYTE:2 ,
Potential registers zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ] : zp ZP_BYTE:3 , reg byte y ,
Potential registers zp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ] : zp ZP_BYTE:4 ,
Potential registers zp ZP_WORD:5 [ msg#10 ] : zp ZP_WORD:5 ,
Potential registers zp ZP_WORD:7 [ msg#0 ] : zp ZP_WORD:7 ,
Potential registers zp ZP_WORD:9 [ msg#1 ] : zp ZP_WORD:9 ,
Potential registers zp ZP_WORD:5 [ msg#0 msg#1 msg#10 ] : zp ZP_WORD:5 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 28.83: zp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ] 20: zp ZP_WORD:7 [ msg#0 ] 20: zp ZP_WORD:9 [ msg#1 ] 4: zp ZP_WORD:5 [ msg#10 ]
Uplift Scope [] 44: zp ZP_WORD:5 [ msg#0 msg#1 msg#10 ] 28.83: zp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ]
Uplift Scope [do10] 27.5: zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Uplift Scope [hello] 27.5: zp ZP_BYTE:3 [ hello::i#2 hello::i#1 ]
Uplift Scope [main]
Uplifting [] best 973 combination zp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ] zp ZP_WORD:7 [ msg#0 ] zp ZP_WORD:9 [ msg#1 ] zp ZP_WORD:5 [ msg#10 ]
Uplifting [] best 973 combination zp ZP_WORD:5 [ msg#0 msg#1 msg#10 ] zp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ]
Uplifting [do10] best 973 combination zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Uplifting [hello] best 853 combination reg byte y [ hello::i#2 hello::i#1 ]
Uplifting [main] best 853 combination
@ -496,10 +487,8 @@ Attempting to uplift remaining variables inzp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ]
Uplifting [] best 853 combination zp ZP_BYTE:4 [ idx#3 idx#0 idx#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Uplifting [do10] best 853 combination zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
Coalescing zero page register [ zp ZP_WORD:5 [ msg#10 ] ] with [ zp ZP_WORD:7 [ msg#0 ] ]
Coalescing zero page register [ zp ZP_WORD:5 [ msg#10 msg#0 ] ] with [ zp ZP_WORD:9 [ msg#1 ] ]
Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:3 [ idx#3 idx#0 idx#1 ]
Allocated (was zp ZP_WORD:5) zp ZP_WORD:4 [ msg#10 msg#0 msg#1 ]
Allocated (was zp ZP_WORD:5) zp ZP_WORD:4 [ msg#0 msg#1 msg#10 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
@ -712,7 +701,7 @@ FINAL SYMBOL TABLE
zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
reg byte y [ hello::i#2 hello::i#1 ]
zp ZP_BYTE:3 [ idx#3 idx#0 idx#1 ]
zp ZP_WORD:4 [ msg#10 msg#0 msg#1 ]
zp ZP_WORD:4 [ msg#0 msg#1 msg#10 ]
FINAL ASSEMBLER

View File

@ -38,4 +38,4 @@
zp ZP_BYTE:2 [ do10::i#2 do10::i#1 ]
reg byte y [ hello::i#2 hello::i#1 ]
zp ZP_BYTE:3 [ idx#3 idx#0 idx#1 ]
zp ZP_WORD:4 [ msg#10 msg#0 msg#1 ]
zp ZP_WORD:4 [ msg#0 msg#1 msg#10 ]

View File

@ -0,0 +1,26 @@
// Tests calling into a function pointer which modifies global volatile
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
.label SCREEN = $400
.label idx = 2
bbegin:
lda #0
sta idx
jsr main
rts
main: {
jsr fn1
lda #'a'
ldy idx
sta SCREEN,y
jsr fn1
lda #'a'
ldy idx
sta SCREEN,y
rts
}
fn1: {
inc idx
rts
}

View File

@ -0,0 +1,25 @@
@begin: scope:[] from
[0] (byte) idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
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()
[5] call fn1
[6] *((const byte*) SCREEN#0 + (byte) idx#0) ← (byte) 'a'
[7] call fn1
[8] *((const byte*) SCREEN#0 + (byte) idx#0) ← (byte) 'a'
to:main::@return
main::@return: scope:[main] from main
[9] return
to:@return
fn1: scope:[fn1] from main
[10] (byte) idx#1 ← ++ (byte) idx#0
to:fn1::@return
fn1::@return: scope:[fn1] from fn1
[11] return
to:@return

View File

@ -0,0 +1,357 @@
Resolved forward reference fn1 to (void()) fn1()
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte*) SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) $400
(byte) idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
to:@2
main: scope:[main] from @2
(byte) idx#3 ← phi( @2/(byte) idx#6 )
(void()*~) main::$0 ← & (void()) fn1()
(void()*) main::f#0 ← (void()*~) main::$0
call *((void()*) main::f#0)
*((byte*) SCREEN#0 + (byte) idx#3) ← (byte) 'a'
call *((void()*) main::f#0)
*((byte*) SCREEN#0 + (byte) idx#3) ← (byte) 'a'
to:main::@return
main::@return: scope:[main] from main
return
to:@return
fn1: scope:[fn1] from
(byte) idx#4 ← phi( @2/(byte) idx#6 )
(byte) idx#1 ← ++ (byte) idx#4
to:fn1::@return
fn1::@return: scope:[fn1] from fn1
(byte) idx#5 ← phi( fn1/(byte) idx#1 )
(byte) idx#2 ← (byte) idx#5
return
to:@return
@2: scope:[] from @begin
(byte) idx#6 ← phi( @begin/(byte) idx#0 )
call main
to:@3
@3: scope:[] from @2
to:@end
@end: scope:[] from @3
SYMBOL TABLE SSA
(label) @2
(label) @3
(label) @begin
(label) @end
(byte*) SCREEN
(byte*) SCREEN#0
(void()) fn1()
(label) fn1::@return
(byte) idx
(byte) idx#0
(byte) idx#1
(byte) idx#2
(byte) idx#3
(byte) idx#4
(byte) idx#5
(byte) idx#6
(void()) main()
(void()*~) main::$0
(label) main::@return
(void()*) main::f
(void()*) main::f#0
Culled Empty Block (label) @3
Successful SSA optimization Pass2CullEmptyBlocks
Alias (void()*) main::f#0 = (void()*~) main::$0
Alias (byte) idx#1 = (byte) idx#5 (byte) idx#2
Alias (byte) idx#0 = (byte) idx#6
Successful SSA optimization Pass2AliasElimination
Redundant Phi (byte) idx#3 (byte) idx#0
Redundant Phi (byte) idx#4 (byte) idx#0
Successful SSA optimization Pass2RedundantPhiElimination
Constant (const byte*) SCREEN#0 = ((byte*))$400
Constant (const void()*) main::f#0 = &fn1
Successful SSA optimization Pass2ConstantIdentification
Replacing constant pointer function call fn1
Replacing constant pointer function call fn1
Successful SSA optimization Pass2ConstantCallPointerIdentification
Successful SSA optimization PassNEliminateUnusedVars
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to main:2
Calls in [main] to fn1:5 fn1:7
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Renumbering block @2 to @1
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] (byte) idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0
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()
[5] call fn1
[6] *((const byte*) SCREEN#0 + (byte) idx#0) ← (byte) 'a'
[7] call fn1
[8] *((const byte*) SCREEN#0 + (byte) idx#0) ← (byte) 'a'
to:main::@return
main::@return: scope:[main] from main
[9] return
to:@return
fn1: scope:[fn1] from main
[10] (byte) idx#1 ← ++ (byte) idx#0
to:fn1::@return
fn1::@return: scope:[fn1] from fn1
[11] return
to:@return
VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) fn1()
(byte) idx
(byte) idx#0 1.0
(byte) idx#1 20.0
(void()) main()
(void()*) main::f
Initial phi equivalence classes
Coalescing volatile variable equivalence classes [ idx#0 ] and [ idx#1 ]
Complete equivalence classes
[ idx#0 idx#1 ]
Allocated zp ZP_BYTE:2 [ idx#0 idx#1 ]
INITIAL ASM
//SEG0 File Comments
// Tests calling into a function pointer which modifies global volatile
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
.label idx = 2
//SEG3 @begin
bbegin:
//SEG4 [0] (byte) idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta idx
//SEG5 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG6 @1
b1:
//SEG7 [2] call main
//SEG8 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG9 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG10 @end
bend:
//SEG11 main
main: {
//SEG12 [5] call fn1
jsr fn1
//SEG13 [6] *((const byte*) SCREEN#0 + (byte) idx#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'a'
ldy idx
sta SCREEN,y
//SEG14 [7] call fn1
jsr fn1
//SEG15 [8] *((const byte*) SCREEN#0 + (byte) idx#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'a'
ldy idx
sta SCREEN,y
jmp breturn
//SEG16 main::@return
breturn:
//SEG17 [9] return
rts
}
//SEG18 fn1
fn1: {
//SEG19 [10] (byte) idx#1 ← ++ (byte) idx#0 -- vbuz1=_inc_vbuz1
inc idx
jmp breturn
//SEG20 fn1::@return
breturn:
//SEG21 [11] return
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte) idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ idx#0 ] ( ) always clobbers reg byte a
Statement [6] *((const byte*) SCREEN#0 + (byte) idx#0) ← (byte) 'a' [ idx#0 ] ( main:2 [ idx#0 ] ) always clobbers reg byte a reg byte y
Statement [8] *((const byte*) SCREEN#0 + (byte) idx#0) ← (byte) 'a' [ ] ( main:2 [ ] ) always clobbers reg byte a reg byte y
Potential registers zp ZP_BYTE:2 [ idx#0 idx#1 ] : zp ZP_BYTE:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 21: zp ZP_BYTE:2 [ idx#0 idx#1 ]
Uplift Scope [main]
Uplift Scope [fn1]
Uplifting [] best 72 combination zp ZP_BYTE:2 [ idx#0 idx#1 ]
Uplifting [main] best 72 combination
Uplifting [fn1] best 72 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ idx#0 idx#1 ]
Uplifting [] best 72 combination zp ZP_BYTE:2 [ idx#0 idx#1 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
// Tests calling into a function pointer which modifies global volatile
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
.label idx = 2
//SEG3 @begin
bbegin:
//SEG4 [0] (byte) idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta idx
//SEG5 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG6 @1
b1:
//SEG7 [2] call main
//SEG8 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG9 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG10 @end
bend:
//SEG11 main
main: {
//SEG12 [5] call fn1
jsr fn1
//SEG13 [6] *((const byte*) SCREEN#0 + (byte) idx#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'a'
ldy idx
sta SCREEN,y
//SEG14 [7] call fn1
jsr fn1
//SEG15 [8] *((const byte*) SCREEN#0 + (byte) idx#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'a'
ldy idx
sta SCREEN,y
jmp breturn
//SEG16 main::@return
breturn:
//SEG17 [9] return
rts
}
//SEG18 fn1
fn1: {
//SEG19 [10] (byte) idx#1 ← ++ (byte) idx#0 -- vbuz1=_inc_vbuz1
inc idx
jmp breturn
//SEG20 fn1::@return
breturn:
//SEG21 [11] return
rts
}
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp breturn
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction b1_from_bbegin:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction b1:
Removing instruction bend:
Removing instruction breturn:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Adding RTS to root block
Succesful ASM optimization Pass5AddMainRts
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) $400
(void()) fn1()
(label) fn1::@return
(byte) idx
(byte) idx#0 idx zp ZP_BYTE:2 1.0
(byte) idx#1 idx zp ZP_BYTE:2 20.0
(void()) main()
(label) main::@return
(void()*) main::f
zp ZP_BYTE:2 [ idx#0 idx#1 ]
FINAL ASSEMBLER
Score: 66
//SEG0 File Comments
// Tests calling into a function pointer which modifies global volatile
//SEG1 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(bbegin)
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label SCREEN = $400
.label idx = 2
//SEG3 @begin
bbegin:
//SEG4 [0] (byte) idx#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta idx
//SEG5 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG6 @1
//SEG7 [2] call main
//SEG8 [4] phi from @1 to main [phi:@1->main]
jsr main
rts
//SEG9 [3] phi from @1 to @end [phi:@1->@end]
//SEG10 @end
//SEG11 main
main: {
//SEG12 [5] call fn1
jsr fn1
//SEG13 [6] *((const byte*) SCREEN#0 + (byte) idx#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'a'
ldy idx
sta SCREEN,y
//SEG14 [7] call fn1
jsr fn1
//SEG15 [8] *((const byte*) SCREEN#0 + (byte) idx#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'a'
ldy idx
sta SCREEN,y
//SEG16 main::@return
//SEG17 [9] return
rts
}
//SEG18 fn1
fn1: {
//SEG19 [10] (byte) idx#1 ← ++ (byte) idx#0 -- vbuz1=_inc_vbuz1
inc idx
//SEG20 fn1::@return
//SEG21 [11] return
rts
}

View File

@ -0,0 +1,15 @@
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) $400
(void()) fn1()
(label) fn1::@return
(byte) idx
(byte) idx#0 idx zp ZP_BYTE:2 1.0
(byte) idx#1 idx zp ZP_BYTE:2 20.0
(void()) main()
(label) main::@return
(void()*) main::f
zp ZP_BYTE:2 [ idx#0 idx#1 ]

View File

@ -3,8 +3,7 @@
:BasicUpstart(main)
.pc = $80d "Program"
main: {
.label f = fn1
jsr f
jsr fn1
rts
}
fn1: {

View File

@ -8,14 +8,15 @@
@end: scope:[] from @1
[3] phi()
main: scope:[main] from @1
[4] call *((const void()*) main::f#0)
[4] phi()
[5] call fn1
to:main::@return
main::@return: scope:[main] from main
[5] return
[6] return
to:@return
fn1: scope:[fn1] from
[6] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0)
fn1: scope:[fn1] from main
[7] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0)
to:fn1::@return
fn1::@return: scope:[fn1] from fn1
[7] return
[8] return
to:@return

View File

@ -47,11 +47,16 @@ Successful SSA optimization Pass2AliasElimination
Constant (const void()*) main::f#0 = &fn1
Constant (const byte*) fn1::BORDERCOL#0 = ((byte*))$d020
Successful SSA optimization Pass2ConstantIdentification
Replacing constant pointer function call fn1
Successful SSA optimization Pass2ConstantCallPointerIdentification
Successful SSA optimization PassNEliminateUnusedVars
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to main:2
Calls in [main] to fn1:5
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
@ -59,6 +64,7 @@ Renumbering block @2 to @1
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
@ -71,16 +77,17 @@ FINAL CONTROL FLOW GRAPH
@end: scope:[] from @1
[3] phi()
main: scope:[main] from @1
[4] call *((const void()*) main::f#0)
[4] phi()
[5] call fn1
to:main::@return
main::@return: scope:[main] from main
[5] return
[6] return
to:@return
fn1: scope:[fn1] from
[6] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0)
fn1: scope:[fn1] from main
[7] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0)
to:fn1::@return
fn1::@return: scope:[fn1] from fn1
[7] return
[8] return
to:@return
@ -109,37 +116,37 @@ b1_from_bbegin:
//SEG5 @1
b1:
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.label f = fn1
//SEG10 [4] call *((const void()*) main::f#0)
jsr f
//SEG11 [5] call fn1
jsr fn1
jmp breturn
//SEG11 main::@return
//SEG12 main::@return
breturn:
//SEG12 [5] return
//SEG13 [6] return
rts
}
//SEG13 fn1
//SEG14 fn1
fn1: {
.label BORDERCOL = $d020
//SEG14 [6] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG15 [7] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
jmp breturn
//SEG15 fn1::@return
//SEG16 fn1::@return
breturn:
//SEG16 [7] return
//SEG17 [8] return
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] call *((const void()*) main::f#0) [ ] ( main:2 [ ] ) always clobbers reg byte a reg byte x reg byte y
REGISTER UPLIFT SCOPES
Uplift Scope [main]
@ -166,32 +173,33 @@ b1_from_bbegin:
//SEG5 @1
b1:
//SEG6 [2] call main
//SEG7 [4] phi from @1 to main [phi:@1->main]
main_from_b1:
jsr main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG8 @end
//SEG9 @end
bend:
//SEG9 main
//SEG10 main
main: {
.label f = fn1
//SEG10 [4] call *((const void()*) main::f#0)
jsr f
//SEG11 [5] call fn1
jsr fn1
jmp breturn
//SEG11 main::@return
//SEG12 main::@return
breturn:
//SEG12 [5] return
//SEG13 [6] return
rts
}
//SEG13 fn1
//SEG14 fn1
fn1: {
.label BORDERCOL = $d020
//SEG14 [6] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG15 [7] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
jmp breturn
//SEG15 fn1::@return
//SEG16 fn1::@return
breturn:
//SEG16 [7] return
//SEG17 [8] return
rts
}
@ -203,6 +211,7 @@ Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction b1_from_bbegin:
Removing instruction b1:
Removing instruction main_from_b1:
Removing instruction bend_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction bend:
@ -226,7 +235,6 @@ FINAL SYMBOL TABLE
(void()) main()
(label) main::@return
(void()*) main::f
(const void()*) main::f#0 f = &(void()) fn1()
@ -244,24 +252,24 @@ Score: 24
//SEG4 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG5 @1
//SEG6 [2] call main
//SEG7 [3] phi from @1 to @end [phi:@1->@end]
//SEG8 @end
//SEG9 main
//SEG7 [4] phi from @1 to main [phi:@1->main]
//SEG8 [3] phi from @1 to @end [phi:@1->@end]
//SEG9 @end
//SEG10 main
main: {
.label f = fn1
//SEG10 [4] call *((const void()*) main::f#0)
jsr f
//SEG11 main::@return
//SEG12 [5] return
//SEG11 [5] call fn1
jsr fn1
//SEG12 main::@return
//SEG13 [6] return
rts
}
//SEG13 fn1
//SEG14 fn1
fn1: {
.label BORDERCOL = $d020
//SEG14 [6] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
//SEG15 [7] *((const byte*) fn1::BORDERCOL#0) ← ++ *((const byte*) fn1::BORDERCOL#0) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
//SEG15 fn1::@return
//SEG16 [7] return
//SEG16 fn1::@return
//SEG17 [8] return
rts
}

View File

@ -8,5 +8,4 @@
(void()) main()
(label) main::@return
(void()*) main::f
(const void()*) main::f#0 f = &(void()) fn1()

View File

@ -122,12 +122,10 @@ VARIABLE REGISTER WEIGHTS
Initial phi equivalence classes
[ x#5 x#0 x#1 ]
Added variable x#2 to zero page equivalence class [ x#2 ]
Coalescing volatile variable equivalence classes [ x#5 x#0 x#1 ] and [ x#2 ]
Complete equivalence classes
[ x#5 x#0 x#1 ]
[ x#2 ]
Allocated zp ZP_BYTE:2 [ x#5 x#0 x#1 ]
Allocated zp ZP_BYTE:3 [ x#2 ]
[ x#5 x#0 x#1 x#2 ]
Allocated zp ZP_BYTE:2 [ x#5 x#0 x#1 x#2 ]
INITIAL ASM
//SEG0 File Comments
@ -138,7 +136,6 @@ INITIAL ASM
.pc = $80d "Program"
//SEG2 Global Constants & labels
.label x = 2
.label x_2 = 3
//SEG3 @begin
bbegin:
//SEG4 [0] (byte) x#0 ← (byte/signed byte/word/signed word/dword/signed dword) $c -- vbuz1=vbuc1
@ -178,7 +175,7 @@ main: {
b2:
//SEG18 [8] (byte) x#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta x_2
sta x
jmp breturn
//SEG19 main::@return
breturn:
@ -190,20 +187,16 @@ REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte) x#0 ← (byte/signed byte/word/signed word/dword/signed dword) $c [ x#0 ] ( ) always clobbers reg byte a
Statement [7] if((byte) x#1<(byte/signed byte/word/signed word/dword/signed dword) $32) goto main::@1 [ x#1 ] ( main:2 [ x#1 ] ) always clobbers reg byte a
Statement [8] (byte) x#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ x#5 x#0 x#1 ] : zp ZP_BYTE:2 ,
Potential registers zp ZP_BYTE:3 [ x#2 ] : zp ZP_BYTE:3 ,
Potential registers zp ZP_BYTE:2 [ x#5 x#0 x#1 x#2 ] : zp ZP_BYTE:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 41.83: zp ZP_BYTE:2 [ x#5 x#0 x#1 ] 20: zp ZP_BYTE:3 [ x#2 ]
Uplift Scope [] 61.83: zp ZP_BYTE:2 [ x#5 x#0 x#1 x#2 ]
Uplift Scope [main]
Uplifting [] best 216 combination zp ZP_BYTE:2 [ x#5 x#0 x#1 ] zp ZP_BYTE:3 [ x#2 ]
Uplifting [] best 216 combination zp ZP_BYTE:2 [ x#5 x#0 x#1 x#2 ]
Uplifting [main] best 216 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ x#5 x#0 x#1 ]
Uplifting [] best 216 combination zp ZP_BYTE:2 [ x#5 x#0 x#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ x#2 ]
Uplifting [] best 216 combination zp ZP_BYTE:3 [ x#2 ]
Coalescing zero page register [ zp ZP_BYTE:2 [ x#5 x#0 x#1 ] ] with [ zp ZP_BYTE:3 [ x#2 ] ]
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ x#5 x#0 x#1 x#2 ]
Uplifting [] best 216 combination zp ZP_BYTE:2 [ x#5 x#0 x#1 x#2 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments

View File

@ -138,19 +138,13 @@ interrupt(KERNEL_MIN)(void()) irq()
(void()) main()
Initial phi equivalence classes
Added variable col1#0 to zero page equivalence class [ col1#0 ]
Added variable col2#0 to zero page equivalence class [ col2#0 ]
Added variable col1#1 to zero page equivalence class [ col1#1 ]
Added variable col2#1 to zero page equivalence class [ col2#1 ]
Coalescing volatile variable equivalence classes [ col1#0 ] and [ col1#1 ]
Coalescing volatile variable equivalence classes [ col2#0 ] and [ col2#1 ]
Complete equivalence classes
[ col1#0 ]
[ col2#0 ]
[ col1#1 ]
[ col2#1 ]
Allocated zp ZP_BYTE:2 [ col1#0 ]
Allocated zp ZP_BYTE:3 [ col2#0 ]
Allocated zp ZP_BYTE:4 [ col1#1 ]
Allocated zp ZP_BYTE:5 [ col2#1 ]
[ col1#0 col1#1 ]
[ col2#0 col2#1 ]
Allocated zp ZP_BYTE:2 [ col1#0 col1#1 ]
Allocated zp ZP_BYTE:3 [ col2#0 col2#1 ]
INITIAL ASM
//SEG0 File Comments
@ -164,8 +158,6 @@ INITIAL ASM
.label SCREEN = $400
.label col1 = 2
.label col2 = 3
.label col1_1 = 4
.label col2_1 = 5
//SEG3 @begin
bbegin:
//SEG4 [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
@ -205,17 +197,13 @@ irq: {
//SEG17 [7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28) ← (byte) col1#0 -- _deref_pbuc1=vbuz1
lda col1
sta SCREEN+$28
//SEG18 [8] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz2
ldy col1
iny
sty col1_1
//SEG18 [8] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz1
inc col1
//SEG19 [9] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $29) ← (byte) col2#0 -- _deref_pbuc1=vbuz1
lda col2
sta SCREEN+$29
//SEG20 [10] (byte) col2#1 ← ++ (byte) col2#0 -- vbuz1=_inc_vbuz2
ldy col2
iny
sty col2_1
//SEG20 [10] (byte) col2#1 ← ++ (byte) col2#0 -- vbuz1=_inc_vbuz1
inc col2
jmp breturn
//SEG21 irq::@return
breturn:
@ -228,32 +216,22 @@ Statement [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed
Statement [1] (byte) col2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 [ ] ( ) always clobbers reg byte a
Statement [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [7] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28) ← (byte) col1#0 [ col1#0 col2#0 ] ( [ col1#0 col2#0 ] ) always clobbers reg byte a
Statement [8] (byte) col1#1 ← ++ (byte) col1#0 [ col2#0 ] ( [ col2#0 ] ) always clobbers reg byte y
Statement [9] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $29) ← (byte) col2#0 [ col2#0 ] ( [ col2#0 ] ) always clobbers reg byte a
Statement [10] (byte) col2#1 ← ++ (byte) col2#0 [ ] ( [ ] ) always clobbers reg byte y
Potential registers zp ZP_BYTE:2 [ col1#0 ] : zp ZP_BYTE:2 ,
Potential registers zp ZP_BYTE:3 [ col2#0 ] : zp ZP_BYTE:3 ,
Potential registers zp ZP_BYTE:4 [ col1#1 ] : zp ZP_BYTE:4 ,
Potential registers zp ZP_BYTE:5 [ col2#1 ] : zp ZP_BYTE:5 ,
Potential registers zp ZP_BYTE:2 [ col1#0 col1#1 ] : zp ZP_BYTE:2 ,
Potential registers zp ZP_BYTE:3 [ col2#0 col2#1 ] : zp ZP_BYTE:3 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 20: zp ZP_BYTE:4 [ col1#1 ] 20: zp ZP_BYTE:5 [ col2#1 ] 6: zp ZP_BYTE:2 [ col1#0 ] 2: zp ZP_BYTE:3 [ col2#0 ]
Uplift Scope [] 26: zp ZP_BYTE:2 [ col1#0 col1#1 ] 22: zp ZP_BYTE:3 [ col2#0 col2#1 ]
Uplift Scope [main]
Uplift Scope [irq]
Uplifting [] best 79 combination zp ZP_BYTE:4 [ col1#1 ] zp ZP_BYTE:5 [ col2#1 ] zp ZP_BYTE:2 [ col1#0 ] zp ZP_BYTE:3 [ col2#0 ]
Uplifting [main] best 79 combination
Uplifting [irq] best 79 combination
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ col1#1 ]
Uplifting [] best 79 combination zp ZP_BYTE:4 [ col1#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:5 [ col2#1 ]
Uplifting [] best 79 combination zp ZP_BYTE:5 [ col2#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ col1#0 ]
Uplifting [] best 79 combination zp ZP_BYTE:2 [ col1#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ col2#0 ]
Uplifting [] best 79 combination zp ZP_BYTE:3 [ col2#0 ]
Coalescing zero page register with common assignment [ zp ZP_BYTE:2 [ col1#0 ] ] with [ zp ZP_BYTE:4 [ col1#1 ] ] - score: 1
Coalescing zero page register with common assignment [ zp ZP_BYTE:3 [ col2#0 ] ] with [ zp ZP_BYTE:5 [ col2#1 ] ] - score: 1
Uplifting [] best 73 combination zp ZP_BYTE:2 [ col1#0 col1#1 ] zp ZP_BYTE:3 [ col2#0 col2#1 ]
Uplifting [main] best 73 combination
Uplifting [irq] best 73 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ col1#0 col1#1 ]
Uplifting [] best 73 combination zp ZP_BYTE:2 [ col1#0 col1#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ col2#0 col2#1 ]
Uplifting [] best 73 combination zp ZP_BYTE:3 [ col2#0 col2#1 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments

View File

@ -283,22 +283,19 @@ Initial phi equivalence classes
[ main::x#6 main::x#1 ]
[ main::y#4 main::y#1 ]
[ main::a#2 main::a#1 ]
Added variable col1#0 to zero page equivalence class [ col1#0 ]
Coalescing volatile variable equivalence classes [ col1#0 ] and [ col1#1 ]
Added variable main::$1 to zero page equivalence class [ main::$1 ]
Added variable col1#1 to zero page equivalence class [ col1#1 ]
Complete equivalence classes
[ main::x#6 main::x#1 ]
[ main::y#4 main::y#1 ]
[ main::a#2 main::a#1 ]
[ col1#0 ]
[ col1#0 col1#1 ]
[ main::$1 ]
[ col1#1 ]
Allocated zp ZP_BYTE:2 [ main::x#6 main::x#1 ]
Allocated zp ZP_BYTE:3 [ main::y#4 main::y#1 ]
Allocated zp ZP_BYTE:4 [ main::a#2 main::a#1 ]
Allocated zp ZP_BYTE:5 [ col1#0 ]
Allocated zp ZP_BYTE:5 [ col1#0 col1#1 ]
Allocated zp ZP_BYTE:6 [ main::$1 ]
Allocated zp ZP_BYTE:7 [ col1#1 ]
INITIAL ASM
//SEG0 File Comments
@ -312,7 +309,6 @@ INITIAL ASM
.label IRQ_STATUS = $d019
.label SCREEN = $400
.label col1 = 5
.label col1_1 = 7
//SEG3 @begin
bbegin:
//SEG4 [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
@ -430,10 +426,8 @@ irq: {
//SEG43 [19] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28) ← (byte) col1#0 -- _deref_pbuc1=vbuz1
lda col1
sta SCREEN+$28
//SEG44 [20] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz2
ldy col1
iny
sty col1_1
//SEG44 [20] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz1
inc col1
jmp breturn
//SEG45 irq::@return
breturn:
@ -451,37 +445,31 @@ Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ ma
Statement [17] *((const byte*) IRQ_STATUS#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ col1#0 ] ( [ col1#0 ] ) always clobbers reg byte a
Statement asm { lda$dc0d } always clobbers reg byte a
Statement [19] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28) ← (byte) col1#0 [ col1#0 ] ( [ col1#0 ] ) always clobbers reg byte a
Statement [20] (byte) col1#1 ← ++ (byte) col1#0 [ ] ( [ ] ) always clobbers reg byte y
Statement [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a
Statement [4] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [8] (byte~) main::$1 ← (byte) main::a#2 + (byte) main::y#4 [ main::x#6 main::y#4 main::a#2 main::$1 ] ( main:2 [ main::x#6 main::y#4 main::a#2 main::$1 ] ) always clobbers reg byte a
Statement [17] *((const byte*) IRQ_STATUS#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ col1#0 ] ( [ col1#0 ] ) always clobbers reg byte a
Statement asm { lda$dc0d } always clobbers reg byte a
Statement [19] *((const byte*) SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) $28) ← (byte) col1#0 [ col1#0 ] ( [ col1#0 ] ) always clobbers reg byte a
Statement [20] (byte) col1#1 ← ++ (byte) col1#0 [ ] ( [ ] ) always clobbers reg byte y
Potential registers zp ZP_BYTE:2 [ main::x#6 main::x#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ main::y#4 main::y#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::a#2 main::a#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 [ col1#0 ] : zp ZP_BYTE:5 ,
Potential registers zp ZP_BYTE:5 [ col1#0 col1#1 ] : zp ZP_BYTE:5 ,
Potential registers zp ZP_BYTE:6 [ main::$1 ] : zp ZP_BYTE:6 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:7 [ col1#1 ] : zp ZP_BYTE:7 ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 25,002.5: zp ZP_BYTE:4 [ main::a#2 main::a#1 ] 20,002: zp ZP_BYTE:6 [ main::$1 ] 3,502: zp ZP_BYTE:3 [ main::y#4 main::y#1 ] 1,194.67: zp ZP_BYTE:2 [ main::x#6 main::x#1 ]
Uplift Scope [] 20: zp ZP_BYTE:7 [ col1#1 ] 2: zp ZP_BYTE:5 [ col1#0 ]
Uplift Scope [] 22: zp ZP_BYTE:5 [ col1#0 col1#1 ]
Uplift Scope [irq]
Uplifting [main] best 323340 combination reg byte y [ main::a#2 main::a#1 ] reg byte a [ main::$1 ] zp ZP_BYTE:3 [ main::y#4 main::y#1 ] reg byte x [ main::x#6 main::x#1 ]
Uplifting [main] best 323337 combination reg byte y [ main::a#2 main::a#1 ] reg byte a [ main::$1 ] zp ZP_BYTE:3 [ main::y#4 main::y#1 ] reg byte x [ main::x#6 main::x#1 ]
Limited combination testing to 100 combinations of 108 possible.
Uplifting [] best 323340 combination zp ZP_BYTE:7 [ col1#1 ] zp ZP_BYTE:5 [ col1#0 ]
Uplifting [irq] best 323340 combination
Uplifting [] best 323337 combination zp ZP_BYTE:5 [ col1#0 col1#1 ]
Uplifting [irq] best 323337 combination
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ main::y#4 main::y#1 ]
Uplifting [main] best 323340 combination zp ZP_BYTE:3 [ main::y#4 main::y#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:7 [ col1#1 ]
Uplifting [] best 323340 combination zp ZP_BYTE:7 [ col1#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:5 [ col1#0 ]
Uplifting [] best 323340 combination zp ZP_BYTE:5 [ col1#0 ]
Coalescing zero page register with common assignment [ zp ZP_BYTE:5 [ col1#0 ] ] with [ zp ZP_BYTE:7 [ col1#1 ] ] - score: 1
Uplifting [main] best 323337 combination zp ZP_BYTE:3 [ main::y#4 main::y#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:5 [ col1#0 col1#1 ]
Uplifting [] best 323337 combination zp ZP_BYTE:5 [ col1#0 col1#1 ]
Allocated (was zp ZP_BYTE:3) zp ZP_BYTE:2 [ main::y#4 main::y#1 ]
Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:3 [ col1#0 col1#1 ]

View File

@ -703,18 +703,16 @@ interrupt(KERNEL_MIN)(void()) table_driven_irq()
Initial phi equivalence classes
[ irq_idx#4 irq_idx#0 irq_idx#1 ]
Coalescing volatile variable equivalence classes [ irq_idx#4 irq_idx#0 irq_idx#1 ] and [ irq_idx#2 ]
Added variable table_driven_irq::idx#0 to zero page equivalence class [ table_driven_irq::idx#0 ]
Added variable table_driven_irq::val#0 to zero page equivalence class [ table_driven_irq::val#0 ]
Added variable irq_idx#2 to zero page equivalence class [ irq_idx#2 ]
Complete equivalence classes
[ irq_idx#4 irq_idx#0 irq_idx#1 ]
[ irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
[ table_driven_irq::idx#0 ]
[ table_driven_irq::val#0 ]
[ irq_idx#2 ]
Allocated zp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 ]
Allocated zp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
Allocated zp ZP_BYTE:3 [ table_driven_irq::idx#0 ]
Allocated zp ZP_BYTE:4 [ table_driven_irq::val#0 ]
Allocated zp ZP_BYTE:5 [ irq_idx#2 ]
INITIAL ASM
//SEG0 File Comments
@ -743,7 +741,6 @@ INITIAL ASM
.const VIC_SIZE = $30
.const IRQ_CHANGE_NEXT = $7f
.label irq_idx = 2
.label irq_idx_2 = 5
//SEG3 @begin
bbegin:
jmp b1
@ -856,7 +853,7 @@ table_driven_irq: {
b6:
//SEG38 [24] (byte) irq_idx#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta irq_idx_2
sta irq_idx
jmp breturn
//SEG39 table_driven_irq::@return
breturn:
@ -909,24 +906,20 @@ Statement [21] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ tab
Statement [24] (byte) irq_idx#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [26] *((const byte*) SCREEN#0+-(const byte) VIC_SIZE#0+(word/signed word/dword/signed dword) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 [ irq_idx#1 ] ( [ irq_idx#1 ] ) always clobbers reg byte a
Statement [27] *((const byte*) VIC_BASE#0 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 [ irq_idx#1 ] ( [ irq_idx#1 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 ] : zp ZP_BYTE:2 ,
Potential registers zp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ] : zp ZP_BYTE:2 ,
Potential registers zp ZP_BYTE:3 [ table_driven_irq::idx#0 ] : zp ZP_BYTE:3 , reg byte a , reg byte x ,
Potential registers zp ZP_BYTE:4 [ table_driven_irq::val#0 ] : zp ZP_BYTE:4 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 [ irq_idx#2 ] : zp ZP_BYTE:5 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 29.6: zp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 ] 20: zp ZP_BYTE:5 [ irq_idx#2 ]
Uplift Scope [] 49.6: zp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
Uplift Scope [table_driven_irq] 11: zp ZP_BYTE:3 [ table_driven_irq::idx#0 ] 6.17: zp ZP_BYTE:4 [ table_driven_irq::val#0 ]
Uplift Scope [main]
Uplifting [] best 928 combination zp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 ] zp ZP_BYTE:5 [ irq_idx#2 ]
Uplifting [] best 928 combination zp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
Uplifting [table_driven_irq] best 762 combination reg byte a [ table_driven_irq::idx#0 ] reg byte x [ table_driven_irq::val#0 ]
Uplifting [main] best 762 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 ]
Uplifting [] best 762 combination zp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:5 [ irq_idx#2 ]
Uplifting [] best 762 combination zp ZP_BYTE:5 [ irq_idx#2 ]
Coalescing zero page register [ zp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 ] ] with [ zp ZP_BYTE:5 [ irq_idx#2 ] ]
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
Uplifting [] best 762 combination zp ZP_BYTE:2 [ irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments

View File

@ -251,16 +251,11 @@ interrupt(KERNEL_MIN)(void()) irq()
(void()) main()
Initial phi equivalence classes
Added variable framedone#11 to zero page equivalence class [ framedone#11 ]
Added variable framedone#0 to zero page equivalence class [ framedone#0 ]
Added variable framedone#3 to zero page equivalence class [ framedone#3 ]
Coalescing volatile variable equivalence classes [ framedone#0 ] and [ framedone#3 ]
Coalescing volatile variable equivalence classes [ framedone#0 framedone#3 ] and [ framedone#11 ]
Complete equivalence classes
[ framedone#11 ]
[ framedone#0 ]
[ framedone#3 ]
Allocated zp ZP_BOOL:2 [ framedone#11 ]
Allocated zp ZP_BOOL:3 [ framedone#0 ]
Allocated zp ZP_BOOL:4 [ framedone#3 ]
[ framedone#0 framedone#3 framedone#11 ]
Allocated zp ZP_BOOL:2 [ framedone#0 framedone#3 framedone#11 ]
INITIAL ASM
//SEG0 File Comments
@ -280,9 +275,7 @@ INITIAL ASM
.label BGCOL = $d020
.label CIA1_INTERRUPT = $dc0d
.const CIA_INTERRUPT_CLEAR = $7f
.label framedone = 3
.label framedone_3 = 4
.label framedone_11 = 2
.label framedone = 2
//SEG3 @begin
bbegin:
jmp b1
@ -290,7 +283,7 @@ bbegin:
b1:
//SEG5 [1] (bool) framedone#11 ← false -- vboz1=vboc1
lda #0
sta framedone_11
sta framedone
//SEG6 [2] phi from @1 to @2 [phi:@1->@2]
b2_from_b1:
jmp b2
@ -364,7 +357,7 @@ irq: {
b2:
//SEG29 [17] (bool) framedone#3 ← false -- vboz1=vboc1
lda #0
sta framedone_3
sta framedone
jmp b1
//SEG30 irq::@1
b1:
@ -389,20 +382,16 @@ Statement [13] (bool) framedone#0 ← true [ ] ( main:3 [ ] ) always clobbers re
Statement [15] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( [ ] ) always clobbers reg byte a
Statement [16] if(*((const byte*) RASTER#0)<=(byte/signed byte/word/signed word/dword/signed dword) $32) goto irq::@1 [ ] ( [ ] ) always clobbers reg byte a
Statement [17] (bool) framedone#3 ← false [ ] ( [ ] ) always clobbers reg byte a
Potential registers zp ZP_BOOL:2 [ framedone#11 ] : zp ZP_BOOL:2 ,
Potential registers zp ZP_BOOL:3 [ framedone#0 ] : zp ZP_BOOL:3 ,
Potential registers zp ZP_BOOL:4 [ framedone#3 ] : zp ZP_BOOL:4 ,
Potential registers zp ZP_BOOL:2 [ framedone#0 framedone#3 framedone#11 ] : zp ZP_BOOL:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 110: zp ZP_BOOL:3 [ framedone#0 ] 20: zp ZP_BOOL:2 [ framedone#11 ] 20: zp ZP_BOOL:4 [ framedone#3 ]
Uplift Scope [] 150: zp ZP_BOOL:2 [ framedone#0 framedone#3 framedone#11 ]
Uplift Scope [main]
Uplift Scope [irq]
Uplifting [] best 1370 combination zp ZP_BOOL:3 [ framedone#0 ] zp ZP_BOOL:2 [ framedone#11 ] zp ZP_BOOL:4 [ framedone#3 ]
Uplifting [] best 1370 combination zp ZP_BOOL:2 [ framedone#0 framedone#3 framedone#11 ]
Uplifting [main] best 1370 combination
Uplifting [irq] best 1370 combination
Coalescing zero page register [ zp ZP_BOOL:2 [ framedone#11 ] ] with [ zp ZP_BOOL:3 [ framedone#0 ] ]
Coalescing zero page register [ zp ZP_BOOL:2 [ framedone#11 framedone#0 ] ] with [ zp ZP_BOOL:4 [ framedone#3 ] ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
@ -575,7 +564,7 @@ interrupt(KERNEL_MIN)(void()) irq()
(label) main::@1
(label) main::@2
zp ZP_BOOL:2 [ framedone#11 framedone#0 framedone#3 ]
zp ZP_BOOL:2 [ framedone#0 framedone#3 framedone#11 ]
FINAL ASSEMBLER

View File

@ -32,4 +32,4 @@ interrupt(KERNEL_MIN)(void()) irq()
(label) main::@1
(label) main::@2
zp ZP_BOOL:2 [ framedone#11 framedone#0 framedone#3 ]
zp ZP_BOOL:2 [ framedone#0 framedone#3 framedone#11 ]

View File

@ -201,12 +201,10 @@ interrupt(KERNEL_MIN)(void()) irq()
Initial phi equivalence classes
[ col#12 col#0 col#1 ]
Added variable col#3 to zero page equivalence class [ col#3 ]
Coalescing volatile variable equivalence classes [ col#12 col#0 col#1 ] and [ col#3 ]
Complete equivalence classes
[ col#12 col#0 col#1 ]
[ col#3 ]
Allocated zp ZP_BYTE:2 [ col#12 col#0 col#1 ]
Allocated zp ZP_BYTE:3 [ col#3 ]
[ col#12 col#0 col#1 col#3 ]
Allocated zp ZP_BYTE:2 [ col#12 col#0 col#1 col#3 ]
INITIAL ASM
//SEG0 File Comments
@ -219,7 +217,6 @@ INITIAL ASM
.label KERNEL_IRQ = $314
.label BGCOL = $d020
.label col = 2
.label col_3 = 3
//SEG3 @begin
bbegin:
//SEG4 [0] (byte) col#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
@ -284,10 +281,8 @@ irq: {
jmp b1
//SEG25 irq::@1
b1:
//SEG26 [11] (byte) col#3 ← ++ (byte) col#0 -- vbuz1=_inc_vbuz2
ldy col
iny
sty col_3
//SEG26 [11] (byte) col#3 ← ++ (byte) col#0 -- vbuz1=_inc_vbuz1
inc col
jmp breturn
//SEG27 irq::@return
breturn:
@ -303,23 +298,18 @@ Statement [7] (byte) col#1 ← (byte/signed byte/word/signed word/dword/signed d
Statement asm { lda$dc0d } always clobbers reg byte a
Statement [9] *((const byte*) BGCOL#0) ← (byte) col#0 [ col#0 ] ( [ col#0 ] ) always clobbers reg byte a
Statement [10] if((byte) col#0==(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@return [ col#0 ] ( [ col#0 ] ) always clobbers reg byte a
Statement [11] (byte) col#3 ← ++ (byte) col#0 [ ] ( [ ] ) always clobbers reg byte y
Potential registers zp ZP_BYTE:2 [ col#12 col#0 col#1 ] : zp ZP_BYTE:2 ,
Potential registers zp ZP_BYTE:3 [ col#3 ] : zp ZP_BYTE:3 ,
Potential registers zp ZP_BYTE:2 [ col#12 col#0 col#1 col#3 ] : zp ZP_BYTE:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 137.67: zp ZP_BYTE:2 [ col#12 col#0 col#1 ] 20: zp ZP_BYTE:3 [ col#3 ]
Uplift Scope [] 157.67: zp ZP_BYTE:2 [ col#12 col#0 col#1 col#3 ]
Uplift Scope [main]
Uplift Scope [irq]
Uplifting [] best 1824 combination zp ZP_BYTE:2 [ col#12 col#0 col#1 ] zp ZP_BYTE:3 [ col#3 ]
Uplifting [main] best 1824 combination
Uplifting [irq] best 1824 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ col#12 col#0 col#1 ]
Uplifting [] best 1824 combination zp ZP_BYTE:2 [ col#12 col#0 col#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ col#3 ]
Uplifting [] best 1824 combination zp ZP_BYTE:3 [ col#3 ]
Coalescing zero page register with common assignment [ zp ZP_BYTE:2 [ col#12 col#0 col#1 ] ] with [ zp ZP_BYTE:3 [ col#3 ] ] - score: 1
Uplifting [] best 1821 combination zp ZP_BYTE:2 [ col#12 col#0 col#1 col#3 ]
Uplifting [main] best 1821 combination
Uplifting [irq] best 1821 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ col#12 col#0 col#1 col#3 ]
Uplifting [] best 1821 combination zp ZP_BYTE:2 [ col#12 col#0 col#1 col#3 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments

View File

@ -34,14 +34,11 @@
.label YSIN = $2100
// The address of the sprite pointers on the current screen (screen+$3f8).
.label PLEX_SCREEN_PTR = $400+$3f8
.label plex_show_idx = 8
.label plex_sprite_idx = 7
.label plex_sprite_msb = $a
.label plex_sprite_idx_1 = $d
.label plex_free_next = $e
.label framedone = 2
.label plex_free_next_27 = 9
.label plex_free_next_31 = 9
.label plex_show_idx = 7
.label plex_sprite_idx = 6
.label plex_sprite_msb = 8
.label plex_free_next = 9
.label framedone = $a
bbegin:
// The index in the PLEX tables of the next sprite to show
lda #0
@ -53,7 +50,7 @@ bbegin:
sta plex_sprite_msb
// The index of the sprite that is free next. Since sprites are used round-robin this moves forward each time a sprite is shown.
lda #0
sta plex_free_next_31
sta plex_free_next
lda #1
sta framedone
jsr main
@ -66,7 +63,7 @@ main: {
}
// The raster loop
loop: {
.label sin_idx = 3
.label sin_idx = 2
lda #0
sta sin_idx
b2:
@ -113,7 +110,7 @@ loop: {
plexSort: {
.label nxt_idx = $b
.label nxt_y = $c
.label m = 4
.label m = 3
lda #0
sta m
b1:
@ -145,7 +142,7 @@ plexSort: {
// Prepare for showing the sprites
lda #0
sta plex_show_idx
sta plex_sprite_idx_1
sta plex_sprite_idx
lda #1
sta plex_sprite_msb
ldx #0
@ -166,7 +163,7 @@ plexSort: {
}
// Initialize the program
init: {
.label xp = 5
.label xp = 4
lda #VIC_DEN|VIC_RSEL|3
sta D011
jsr plexInit
@ -231,7 +228,7 @@ plexInit: {
rts
}
plex_irq: {
.label _4 = $f
.label _4 = $d
lda #WHITE
sta BORDERCOL
b3:
@ -268,8 +265,8 @@ plex_irq: {
// Show the next sprite.
// plexSort() prepares showing the sprites
plexShowSprite: {
.label _7 = 7
.label plex_sprite_idx2 = $f
.label _7 = 6
.label plex_sprite_idx2 = $d
.label plexFreeAdd1__2 = 9
lda plex_sprite_idx
asl
@ -281,9 +278,9 @@ plexShowSprite: {
sta SPRITES_YPOS,y
clc
adc #$15
ldy plex_free_next_27
ldy plex_free_next
sta PLEX_FREE_YPOS,y
ldx plex_free_next_27
ldx plex_free_next
inx
lda #7
sax plexFreeAdd1__2

View File

@ -2327,17 +2327,17 @@ Initial phi equivalence classes
[ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 ]
[ plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
[ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 ]
Coalescing volatile variable equivalence classes [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 ] and [ plex_show_idx#1 ]
Coalescing volatile variable equivalence classes [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 ] and [ plex_sprite_idx#1 ]
Coalescing volatile variable equivalence classes [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 ] and [ plex_sprite_msb#1 ]
Coalescing volatile variable equivalence classes [ plex_free_next#0 ] and [ plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
Coalescing volatile variable equivalence classes [ framedone#3 ] and [ framedone#12 framedone#19 framedone#5 ]
Added variable plexSort::nxt_idx#0 to zero page equivalence class [ plexSort::nxt_idx#0 ]
Added variable plexSort::nxt_y#0 to zero page equivalence class [ plexSort::nxt_y#0 ]
Added variable plexSort::s#2 to zero page equivalence class [ plexSort::s#2 ]
Added variable plex_show_idx#1 to zero page equivalence class [ plex_show_idx#1 ]
Added variable plex_sprite_idx#1 to zero page equivalence class [ plex_sprite_idx#1 ]
Added variable plex_sprite_msb#1 to zero page equivalence class [ plex_sprite_msb#1 ]
Added variable plex_free_next#0 to zero page equivalence class [ plex_free_next#0 ]
Added variable init::$7 to zero page equivalence class [ init::$7 ]
Added variable plex_irq::plexFreeNextYpos1_return#0 to zero page equivalence class [ plex_irq::plexFreeNextYpos1_return#0 ]
Added variable plex_irq::$4 to zero page equivalence class [ plex_irq::$4 ]
Added variable framedone#3 to zero page equivalence class [ framedone#3 ]
Added variable plexShowSprite::plex_sprite_idx2#0 to zero page equivalence class [ plexShowSprite::plex_sprite_idx2#0 ]
Added variable plexShowSprite::plexFreeAdd1_ypos#0 to zero page equivalence class [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Added variable plexShowSprite::plexFreeAdd1_$0#0 to zero page equivalence class [ plexShowSprite::plexFreeAdd1_$0#0 ]
@ -2348,7 +2348,6 @@ Added variable plexShowSprite::$4 to zero page equivalence class [ plexShowSprit
Added variable plexShowSprite::$10 to zero page equivalence class [ plexShowSprite::$10 ]
Added variable plexShowSprite::$6 to zero page equivalence class [ plexShowSprite::$6 ]
Complete equivalence classes
[ framedone#12 framedone#19 framedone#5 ]
[ loop::sin_idx#6 loop::sin_idx#1 ]
[ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
[ loop::sy#2 loop::sy#1 ]
@ -2359,21 +2358,17 @@ Complete equivalence classes
[ init::xp#2 init::xp#1 ]
[ init::ss#2 init::ss#1 ]
[ plexInit::i#2 plexInit::i#1 ]
[ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 ]
[ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 ]
[ plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
[ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 ]
[ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 plex_sprite_idx#1 ]
[ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ]
[ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ]
[ plex_free_next#0 plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
[ framedone#3 framedone#12 framedone#19 framedone#5 ]
[ plexSort::nxt_idx#0 ]
[ plexSort::nxt_y#0 ]
[ plexSort::s#2 ]
[ plex_show_idx#1 ]
[ plex_sprite_idx#1 ]
[ plex_sprite_msb#1 ]
[ plex_free_next#0 ]
[ init::$7 ]
[ plex_irq::plexFreeNextYpos1_return#0 ]
[ plex_irq::$4 ]
[ framedone#3 ]
[ plexShowSprite::plex_sprite_idx2#0 ]
[ plexShowSprite::plexFreeAdd1_ypos#0 ]
[ plexShowSprite::plexFreeAdd1_$0#0 ]
@ -2383,41 +2378,36 @@ Complete equivalence classes
[ plexShowSprite::$4 ]
[ plexShowSprite::$10 ]
[ plexShowSprite::$6 ]
Allocated zp ZP_BOOL:2 [ framedone#12 framedone#19 framedone#5 ]
Allocated zp ZP_BYTE:3 [ loop::sin_idx#6 loop::sin_idx#1 ]
Allocated zp ZP_BYTE:4 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
Allocated zp ZP_BYTE:5 [ loop::sy#2 loop::sy#1 ]
Allocated zp ZP_BYTE:6 [ plexSort::m#2 plexSort::m#1 ]
Allocated zp ZP_BYTE:7 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
Allocated zp ZP_BYTE:8 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
Allocated zp ZP_BYTE:9 [ init::sx#2 init::sx#1 ]
Allocated zp ZP_WORD:10 [ init::xp#2 init::xp#1 ]
Allocated zp ZP_BYTE:12 [ init::ss#2 init::ss#1 ]
Allocated zp ZP_BYTE:13 [ plexInit::i#2 plexInit::i#1 ]
Allocated zp ZP_BYTE:14 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 ]
Allocated zp ZP_BYTE:15 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 ]
Allocated zp ZP_BYTE:16 [ plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
Allocated zp ZP_BYTE:17 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 ]
Allocated zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Allocated zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
Allocated zp ZP_BYTE:4 [ loop::sy#2 loop::sy#1 ]
Allocated zp ZP_BYTE:5 [ plexSort::m#2 plexSort::m#1 ]
Allocated zp ZP_BYTE:6 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
Allocated zp ZP_BYTE:7 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
Allocated zp ZP_BYTE:8 [ init::sx#2 init::sx#1 ]
Allocated zp ZP_WORD:9 [ init::xp#2 init::xp#1 ]
Allocated zp ZP_BYTE:11 [ init::ss#2 init::ss#1 ]
Allocated zp ZP_BYTE:12 [ plexInit::i#2 plexInit::i#1 ]
Allocated zp ZP_BYTE:13 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 plex_sprite_idx#1 ]
Allocated zp ZP_BYTE:14 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ]
Allocated zp ZP_BYTE:15 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ]
Allocated zp ZP_BYTE:16 [ plex_free_next#0 plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
Allocated zp ZP_BOOL:17 [ framedone#3 framedone#12 framedone#19 framedone#5 ]
Allocated zp ZP_BYTE:18 [ plexSort::nxt_idx#0 ]
Allocated zp ZP_BYTE:19 [ plexSort::nxt_y#0 ]
Allocated zp ZP_BYTE:20 [ plexSort::s#2 ]
Allocated zp ZP_BYTE:21 [ plex_show_idx#1 ]
Allocated zp ZP_BYTE:22 [ plex_sprite_idx#1 ]
Allocated zp ZP_BYTE:23 [ plex_sprite_msb#1 ]
Allocated zp ZP_BYTE:24 [ plex_free_next#0 ]
Allocated zp ZP_BYTE:25 [ init::$7 ]
Allocated zp ZP_BYTE:26 [ plex_irq::plexFreeNextYpos1_return#0 ]
Allocated zp ZP_BYTE:27 [ plex_irq::$4 ]
Allocated zp ZP_BOOL:28 [ framedone#3 ]
Allocated zp ZP_BYTE:29 [ plexShowSprite::plex_sprite_idx2#0 ]
Allocated zp ZP_BYTE:30 [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Allocated zp ZP_BYTE:31 [ plexShowSprite::plexFreeAdd1_$0#0 ]
Allocated zp ZP_BYTE:32 [ plexShowSprite::plexFreeAdd1_$1#0 ]
Allocated zp ZP_BYTE:33 [ plexShowSprite::xpos_idx#0 ]
Allocated zp ZP_BYTE:34 [ plexShowSprite::$3 ]
Allocated zp ZP_BYTE:35 [ plexShowSprite::$4 ]
Allocated zp ZP_BYTE:36 [ plexShowSprite::$10 ]
Allocated zp ZP_BYTE:37 [ plexShowSprite::$6 ]
Allocated zp ZP_BYTE:21 [ init::$7 ]
Allocated zp ZP_BYTE:22 [ plex_irq::plexFreeNextYpos1_return#0 ]
Allocated zp ZP_BYTE:23 [ plex_irq::$4 ]
Allocated zp ZP_BYTE:24 [ plexShowSprite::plex_sprite_idx2#0 ]
Allocated zp ZP_BYTE:25 [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Allocated zp ZP_BYTE:26 [ plexShowSprite::plexFreeAdd1_$0#0 ]
Allocated zp ZP_BYTE:27 [ plexShowSprite::plexFreeAdd1_$1#0 ]
Allocated zp ZP_BYTE:28 [ plexShowSprite::xpos_idx#0 ]
Allocated zp ZP_BYTE:29 [ plexShowSprite::$3 ]
Allocated zp ZP_BYTE:30 [ plexShowSprite::$4 ]
Allocated zp ZP_BYTE:31 [ plexShowSprite::$10 ]
Allocated zp ZP_BYTE:32 [ plexShowSprite::$6 ]
INITIAL ASM
//SEG0 File Comments
@ -2459,19 +2449,11 @@ INITIAL ASM
.label YSIN = $2100
// The address of the sprite pointers on the current screen (screen+$3f8).
.label PLEX_SCREEN_PTR = $400+$3f8
.label plex_show_idx = $f
.label plex_sprite_idx = $e
.label plex_sprite_msb = $11
.label plex_show_idx_1 = $15
.label plex_sprite_idx_1 = $16
.label plex_sprite_msb_1 = $17
.label plex_free_next = $18
.label framedone = $1c
.label framedone_5 = 2
.label framedone_12 = 2
.label plex_free_next_27 = $10
.label plex_free_next_31 = $10
.label framedone_19 = 2
.label plex_show_idx = $e
.label plex_sprite_idx = $d
.label plex_sprite_msb = $f
.label plex_free_next = $10
.label framedone = $11
//SEG3 @begin
bbegin:
jmp b1
@ -2495,7 +2477,7 @@ b2:
//SEG9 [4] (byte) plex_free_next#31 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
// The index of the sprite that is free next. Since sprites are used round-robin this moves forward each time a sprite is shown.
lda #0
sta plex_free_next_31
sta plex_free_next
jmp b3
//SEG10 @3
b3:
@ -2506,7 +2488,7 @@ b3:
b4:
//SEG14 [7] (bool) framedone#19 ← true -- vboz1=vboc1
lda #1
sta framedone_19
sta framedone
//SEG15 [8] phi from @4 to @5 [phi:@4->@5]
b5_from_b4:
jmp b5
@ -2543,9 +2525,9 @@ main: {
//SEG29 loop
// The raster loop
loop: {
.label y_idx = 4
.label sy = 5
.label sin_idx = 3
.label y_idx = 3
.label sy = 4
.label sin_idx = 2
//SEG30 [17] phi from loop to loop::@1 [phi:loop->loop::@1]
b1_from_loop:
//SEG31 [17] phi (byte) loop::sin_idx#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop->loop::@1#0] -- vbuz1=vbuc1
@ -2559,7 +2541,7 @@ loop: {
//SEG34 loop::@2
b2:
//SEG35 [18] if((bool) framedone#12) goto loop::@3 -- vboz1_then_la1
lda framedone_12
lda framedone
cmp #0
bne b3
jmp b2
@ -2619,7 +2601,7 @@ loop: {
sta BORDERCOL
//SEG57 [30] (bool) framedone#5 ← false -- vboz1=vboc1
lda #0
sta framedone_5
sta framedone
//SEG58 [31] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) $7f -- _deref_pbuc1=_deref_pbuc1_band_vbuc2
lda #$7f
and VIC_CONTROL
@ -2646,10 +2628,10 @@ loop: {
plexSort: {
.label nxt_idx = $12
.label nxt_y = $13
.label m = 6
.label s = 7
.label m = 5
.label s = 6
.label s_2 = $14
.label plexFreePrepare1_s = 8
.label plexFreePrepare1_s = 7
//SEG64 [34] phi from plexSort to plexSort::@1 [phi:plexSort->plexSort::@1]
b1_from_plexSort:
//SEG65 [34] phi (byte) plexSort::m#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort->plexSort::@1#0] -- vbuz1=vbuc1
@ -2725,13 +2707,13 @@ plexSort: {
//SEG87 [47] (byte) plex_show_idx#1 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
// Prepare for showing the sprites
lda #0
sta plex_show_idx_1
sta plex_show_idx
//SEG88 [48] (byte) plex_sprite_idx#1 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta plex_sprite_idx_1
sta plex_sprite_idx
//SEG89 [49] (byte) plex_sprite_msb#1 ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuc1
lda #1
sta plex_sprite_msb_1
sta plex_sprite_msb
//SEG90 [50] phi from plexSort::@5 to plexSort::plexFreePrepare1 [phi:plexSort::@5->plexSort::plexFreePrepare1]
plexFreePrepare1_from_b5:
jmp plexFreePrepare1
@ -2783,10 +2765,10 @@ plexSort: {
//SEG106 init
// Initialize the program
init: {
.label _7 = $19
.label xp = $a
.label sx = 9
.label ss = $c
.label _7 = $15
.label xp = 9
.label sx = 8
.label ss = $b
//SEG107 [58] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2
lda #VIC_DEN|VIC_RSEL|3
sta D011
@ -2900,7 +2882,7 @@ init: {
//SEG142 plexInit
// Initialize the multiplexer data structures
plexInit: {
.label i = $d
.label i = $c
//SEG143 [80] phi from plexInit to plexInit::plexSetScreen1 [phi:plexInit->plexInit::plexSetScreen1]
plexSetScreen1_from_plexInit:
jmp plexSetScreen1
@ -2936,8 +2918,8 @@ plexInit: {
}
//SEG155 plex_irq
plex_irq: {
.label _4 = $1b
.label plexFreeNextYpos1_return = $1a
.label _4 = $17
.label plexFreeNextYpos1_return = $16
//SEG156 entry interrupt(KERNEL_MIN)
//SEG157 [86] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2
lda #WHITE
@ -3018,17 +3000,17 @@ plex_irq: {
// Show the next sprite.
// plexSort() prepares showing the sprites
plexShowSprite: {
.label _3 = $22
.label _4 = $23
.label _6 = $25
.label _7 = $e
.label _10 = $24
.label plex_sprite_idx2 = $1d
.label plexFreeAdd1_ypos = $1e
.label plexFreeAdd1__0 = $1f
.label plexFreeAdd1__1 = $20
.label _3 = $1d
.label _4 = $1e
.label _6 = $20
.label _7 = $d
.label _10 = $1f
.label plex_sprite_idx2 = $18
.label plexFreeAdd1_ypos = $19
.label plexFreeAdd1__0 = $1a
.label plexFreeAdd1__1 = $1b
.label plexFreeAdd1__2 = $10
.label xpos_idx = $21
.label xpos_idx = $1c
//SEG184 [99] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#25 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1
lda plex_sprite_idx
asl
@ -3051,10 +3033,10 @@ plexShowSprite: {
stx plexFreeAdd1__0
//SEG189 [103] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#27) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda plexFreeAdd1__0
ldy plex_free_next_27
ldy plex_free_next
sta PLEX_FREE_YPOS,y
//SEG190 [104] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#27 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_plus_1
ldy plex_free_next_27
ldy plex_free_next
iny
sty plexFreeAdd1__1
//SEG191 [105] (byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuz2_band_vbuc1
@ -3175,38 +3157,38 @@ Statement [3] (byte) plex_sprite_msb#0 ← (byte/signed byte/word/signed word/dw
Statement [4] (byte) plex_free_next#31 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a
Statement [7] (bool) framedone#19 ← true [ framedone#19 ] ( ) always clobbers reg byte a
Statement [18] if((bool) framedone#12) goto loop::@3 [ framedone#12 loop::sin_idx#6 ] ( main:9::loop:14 [ framedone#12 loop::sin_idx#6 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ loop::sin_idx#6 loop::sin_idx#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Statement [19] *((const byte*) BORDERCOL#0) ← (const byte) RED#0 [ loop::sin_idx#6 ] ( main:9::loop:14 [ loop::sin_idx#6 ] ) always clobbers reg byte a
Statement [22] *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + (byte) loop::sy#2) ← *((const byte*) YSIN#0 + (byte) loop::y_idx#2) [ loop::sin_idx#6 loop::y_idx#2 loop::sy#2 ] ( main:9::loop:14 [ loop::sin_idx#6 loop::y_idx#2 loop::sy#2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ loop::sy#2 loop::sy#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ loop::sy#2 loop::sy#1 ]
Statement [23] (byte) loop::y_idx#1 ← (byte) loop::y_idx#2 + (byte/signed byte/word/signed word/dword/signed dword) 8 [ loop::sin_idx#6 loop::sy#2 loop::y_idx#1 ] ( main:9::loop:14 [ loop::sin_idx#6 loop::sy#2 loop::y_idx#1 ] ) always clobbers reg byte a
Statement [29] *((const byte*) BORDERCOL#0) ← (const byte) GREEN#0 [ loop::sin_idx#1 ] ( main:9::loop:14 [ loop::sin_idx#1 ] ) always clobbers reg byte a
Statement [30] (bool) framedone#5 ← false [ framedone#5 loop::sin_idx#1 ] ( main:9::loop:14 [ framedone#5 loop::sin_idx#1 ] ) always clobbers reg byte a
Statement [31] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) $7f [ framedone#5 loop::sin_idx#1 ] ( main:9::loop:14 [ framedone#5 loop::sin_idx#1 ] ) always clobbers reg byte a
Statement [32] *((const byte*) RASTER#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ framedone#5 loop::sin_idx#1 ] ( main:9::loop:14 [ framedone#5 loop::sin_idx#1 ] ) always clobbers reg byte a
Statement [40] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) plexSort::s#3) ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#3) [ plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#3 ] ( main:9::loop:14::plexSort:28 [ loop::sin_idx#1 plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#3 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ plexSort::m#2 plexSort::m#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ plexSort::m#2 plexSort::m#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:18 [ plexSort::nxt_idx#0 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:19 [ plexSort::nxt_y#0 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:7 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
Statement [44] *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#2) ← (byte) plexSort::nxt_idx#0 [ plexSort::m#2 ] ( main:9::loop:14::plexSort:28 [ loop::sin_idx#1 plexSort::m#2 ] ) always clobbers reg byte a
Statement [47] (byte) plex_show_idx#1 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:9::loop:14::plexSort:28 [ loop::sin_idx#1 ] ) always clobbers reg byte a
Statement [48] (byte) plex_sprite_idx#1 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:9::loop:14::plexSort:28 [ loop::sin_idx#1 ] ) always clobbers reg byte a
Statement [49] (byte) plex_sprite_msb#1 ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ ] ( main:9::loop:14::plexSort:28 [ loop::sin_idx#1 ] ) always clobbers reg byte a
Statement [52] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plexSort::plexFreePrepare1_s#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ plexSort::plexFreePrepare1_s#2 ] ( main:9::loop:14::plexSort:28 [ loop::sin_idx#1 plexSort::plexFreePrepare1_s#2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:8 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:7 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
Statement [55] (byte) plex_free_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:9::loop:14::plexSort:28 [ loop::sin_idx#1 ] ) always clobbers reg byte a
Statement [57] if((byte) plexSort::nxt_y#0<*((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plexSort::s#1))) goto plexSort::@3 [ plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#1 ] ( main:9::loop:14::plexSort:28 [ loop::sin_idx#1 plexSort::m#2 plexSort::nxt_idx#0 plexSort::nxt_y#0 plexSort::s#1 ] ) always clobbers reg byte a
Statement [58] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:9::init:12 [ framedone#19 ] ) always clobbers reg byte a
Statement [61] *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + (byte) init::sx#2) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) $40 [ init::sx#2 init::xp#2 ] ( main:9::init:12 [ framedone#19 init::sx#2 init::xp#2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ init::sx#2 init::sx#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:8 [ init::sx#2 init::sx#1 ]
Statement [62] (byte~) init::$7 ← (byte) init::sx#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init::sx#2 init::xp#2 init::$7 ] ( main:9::init:12 [ framedone#19 init::sx#2 init::xp#2 init::$7 ] ) always clobbers reg byte a
Statement [63] *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte~) init::$7) ← (word) init::xp#2 [ init::sx#2 init::xp#2 ] ( main:9::init:12 [ framedone#19 init::sx#2 init::xp#2 ] ) always clobbers reg byte a
Statement [64] (word) init::xp#1 ← (word) init::xp#2 + (byte/signed byte/word/signed word/dword/signed dword) 9 [ init::sx#2 init::xp#1 ] ( main:9::init:12 [ framedone#19 init::sx#2 init::xp#1 ] ) always clobbers reg byte a
Statement [67] *((const byte*) SPRITES_ENABLE#0) ← (byte/word/signed word/dword/signed dword) $ff [ ] ( main:9::init:12 [ framedone#19 ] ) always clobbers reg byte a
Statement [69] *((const byte*) SPRITES_COLS#0 + (byte) init::ss#2) ← (const byte) GREEN#0 [ init::ss#2 ] ( main:9::init:12 [ framedone#19 init::ss#2 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:12 [ init::ss#2 init::ss#1 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:11 [ init::ss#2 init::ss#1 ]
Statement [73] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 [ ] ( main:9::init:12 [ framedone#19 ] ) always clobbers reg byte a
Statement [74] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:9::init:12 [ framedone#19 ] ) always clobbers reg byte a
Statement [75] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:9::init:12 [ framedone#19 ] ) always clobbers reg byte a
@ -3214,25 +3196,25 @@ Statement [76] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void(
Statement [86] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 [ plex_show_idx#0 plex_sprite_idx#0 plex_sprite_msb#0 plex_free_next#31 ] ( [ plex_show_idx#0 plex_sprite_idx#0 plex_sprite_msb#0 plex_free_next#31 ] ) always clobbers reg byte a
Statement [89] (byte) plex_irq::plexFreeNextYpos1_return#0 ← *((const byte[8]) PLEX_FREE_YPOS#0 + (byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0) [ plexShowSprite::$7 plex_show_idx#16 plexShowSprite::plexFreeAdd1_$2#0 plex_sprite_msb#17 plex_irq::plexFreeNextYpos1_return#0 ] ( [ plexShowSprite::$7 plex_show_idx#16 plexShowSprite::plexFreeAdd1_$2#0 plex_sprite_msb#17 plex_irq::plexFreeNextYpos1_return#0 ] ) always clobbers reg byte y
Statement [91] if((byte) plex_show_idx#16<(const byte) PLEX_COUNT#0) goto plex_irq::@7 [ plexShowSprite::$7 plex_show_idx#16 plexShowSprite::plexFreeAdd1_$2#0 plex_sprite_msb#17 plex_irq::plexFreeNextYpos1_return#0 plex_irq::$4 ] ( [ plexShowSprite::$7 plex_show_idx#16 plexShowSprite::plexFreeAdd1_$2#0 plex_sprite_msb#17 plex_irq::plexFreeNextYpos1_return#0 plex_irq::$4 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:26 [ plex_irq::plexFreeNextYpos1_return#0 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:27 [ plex_irq::$4 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:22 [ plex_irq::plexFreeNextYpos1_return#0 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:23 [ plex_irq::$4 ]
Statement [92] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ plex_show_idx#16 plex_irq::plexFreeNextYpos1_return#0 ] ( [ plex_show_idx#16 plex_irq::plexFreeNextYpos1_return#0 ] ) always clobbers reg byte a
Statement [93] if((byte) plex_show_idx#16<(const byte) PLEX_COUNT#0) goto plex_irq::@1 [ plex_irq::plexFreeNextYpos1_return#0 ] ( [ plex_irq::plexFreeNextYpos1_return#0 ] ) always clobbers reg byte a
Statement [94] (bool) framedone#3 ← true [ ] ( [ ] ) always clobbers reg byte a
Statement [95] *((const byte*) BORDERCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [99] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#25 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a
Statement [100] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#27)) [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_ypos#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_ypos#0 ] ) always clobbers reg byte x reg byte y
Removing always clobbered register reg byte x as potential for zp ZP_BYTE:29 [ plexShowSprite::plex_sprite_idx2#0 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:29 [ plexShowSprite::plex_sprite_idx2#0 ]
Removing always clobbered register reg byte x as potential for zp ZP_BYTE:24 [ plexShowSprite::plex_sprite_idx2#0 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:24 [ plexShowSprite::plex_sprite_idx2#0 ]
Statement [103] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#27) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte y
Statement [105] (byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::plex_sprite_idx2#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:29 [ plexShowSprite::plex_sprite_idx2#0 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:24 [ plexShowSprite::plex_sprite_idx2#0 ]
Statement [106] *((const byte*) PLEX_SCREEN_PTR#0 + (byte) plex_sprite_idx#25) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#27)) [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::plex_sprite_idx2#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a reg byte x reg byte y
Statement [107] (byte) plexShowSprite::xpos_idx#0 ← *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#27) << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 ] ) always clobbers reg byte a
Statement [108] (byte~) plexShowSprite::$3 ← < *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0) [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$3 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::xpos_idx#0 plexShowSprite::$3 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:33 [ plexShowSprite::xpos_idx#0 ]
Removing always clobbered register reg byte a as potential for zp ZP_BYTE:28 [ plexShowSprite::xpos_idx#0 ]
Statement [109] *((const byte*) SPRITES_XPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$3 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::xpos_idx#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::xpos_idx#0 ] ) always clobbers reg byte y
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:33 [ plexShowSprite::xpos_idx#0 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:28 [ plexShowSprite::xpos_idx#0 ]
Statement [110] (byte~) plexShowSprite::$4 ← > *((const word[PLEX_COUNT#0]) PLEX_XPOS#0 + (byte) plexShowSprite::xpos_idx#0) [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::$4 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::$4 ] ) always clobbers reg byte a
Statement [112] (byte/word/dword~) plexShowSprite::$10 ← (byte/word/signed word/dword/signed dword) $ff ^ (byte) plex_sprite_msb#29 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::$10 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::$10 ] ) always clobbers reg byte a
Statement [113] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) & (byte/word/dword~) plexShowSprite::$10 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 ] ) always clobbers reg byte a
@ -3283,7 +3265,7 @@ Statement [95] *((const byte*) BORDERCOL#0) ← (byte/signed byte/word/signed wo
Statement [99] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#25 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a
Statement [100] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte[PLEX_COUNT#0]) PLEX_YPOS#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#27)) [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_ypos#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_ypos#0 ] ) always clobbers reg byte x reg byte y
Statement [101] *((const byte*) SPRITES_YPOS#0 + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_ypos#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 plexShowSprite::plexFreeAdd1_ypos#0 ] ) always clobbers reg byte y
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:30 [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Removing always clobbered register reg byte y as potential for zp ZP_BYTE:25 [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Statement [103] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#27) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_free_next#27 plex_sprite_msb#29 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte y
Statement [105] (byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::plex_sprite_idx2#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a
Statement [106] *((const byte*) PLEX_SCREEN_PTR#0 + (byte) plex_sprite_idx#25) ← *((const byte[PLEX_COUNT#0]) PLEX_PTR#0 + *((const byte[PLEX_COUNT#0]) PLEX_SORTED_IDX#0 + (byte) plex_show_idx#27)) [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::plex_sprite_idx2#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 plexShowSprite::plex_sprite_idx2#0 ] ) always clobbers reg byte a reg byte x reg byte y
@ -3353,123 +3335,106 @@ Statement [115] (byte/word/dword~) plexShowSprite::$7 ← (byte/signed word/word
Statement [118] if((byte) plex_sprite_msb#27!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto plexShowSprite::@return [ plexShowSprite::$7 plex_show_idx#16 plexShowSprite::plexFreeAdd1_$2#0 plex_sprite_msb#27 ] ( plexShowSprite:88 [ plexShowSprite::$7 plex_show_idx#16 plexShowSprite::plexFreeAdd1_$2#0 plex_sprite_msb#27 ] ) always clobbers reg byte a
Statement [119] (byte) plex_sprite_msb#4 ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ plexShowSprite::$7 plex_show_idx#16 plexShowSprite::plexFreeAdd1_$2#0 plex_sprite_msb#4 ] ( plexShowSprite:88 [ plexShowSprite::$7 plex_show_idx#16 plexShowSprite::plexFreeAdd1_$2#0 plex_sprite_msb#4 ] ) always clobbers reg byte a
Statement [122] *((const byte*) SPRITES_XMSB#0) ← *((const byte*) SPRITES_XMSB#0) | (byte) plex_sprite_msb#29 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 ] ( plexShowSprite:88 [ plex_sprite_idx#25 plex_show_idx#27 plex_sprite_msb#29 plexShowSprite::plexFreeAdd1_$2#0 ] ) always clobbers reg byte a
Potential registers zp ZP_BOOL:2 [ framedone#12 framedone#19 framedone#5 ] : zp ZP_BOOL:2 ,
Potential registers zp ZP_BYTE:3 [ loop::sin_idx#6 loop::sin_idx#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ] : zp ZP_BYTE:4 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 [ loop::sy#2 loop::sy#1 ] : zp ZP_BYTE:5 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:6 [ plexSort::m#2 plexSort::m#1 ] : zp ZP_BYTE:6 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:7 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] : zp ZP_BYTE:7 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:8 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] : zp ZP_BYTE:8 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:9 [ init::sx#2 init::sx#1 ] : zp ZP_BYTE:9 , reg byte x , reg byte y ,
Potential registers zp ZP_WORD:10 [ init::xp#2 init::xp#1 ] : zp ZP_WORD:10 ,
Potential registers zp ZP_BYTE:12 [ init::ss#2 init::ss#1 ] : zp ZP_BYTE:12 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:13 [ plexInit::i#2 plexInit::i#1 ] : zp ZP_BYTE:13 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:14 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 ] : zp ZP_BYTE:14 ,
Potential registers zp ZP_BYTE:15 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 ] : zp ZP_BYTE:15 ,
Potential registers zp ZP_BYTE:16 [ plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ] : zp ZP_BYTE:16 ,
Potential registers zp ZP_BYTE:17 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 ] : zp ZP_BYTE:17 ,
Potential registers zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ] : zp ZP_BYTE:3 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ loop::sy#2 loop::sy#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 [ plexSort::m#2 plexSort::m#1 ] : zp ZP_BYTE:5 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:6 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] : zp ZP_BYTE:6 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:7 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] : zp ZP_BYTE:7 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:8 [ init::sx#2 init::sx#1 ] : zp ZP_BYTE:8 , reg byte x , reg byte y ,
Potential registers zp ZP_WORD:9 [ init::xp#2 init::xp#1 ] : zp ZP_WORD:9 ,
Potential registers zp ZP_BYTE:11 [ init::ss#2 init::ss#1 ] : zp ZP_BYTE:11 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:12 [ plexInit::i#2 plexInit::i#1 ] : zp ZP_BYTE:12 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:13 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 plex_sprite_idx#1 ] : zp ZP_BYTE:13 ,
Potential registers zp ZP_BYTE:14 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ] : zp ZP_BYTE:14 ,
Potential registers zp ZP_BYTE:15 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ] : zp ZP_BYTE:15 ,
Potential registers zp ZP_BYTE:16 [ plex_free_next#0 plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ] : zp ZP_BYTE:16 ,
Potential registers zp ZP_BOOL:17 [ framedone#3 framedone#12 framedone#19 framedone#5 ] : zp ZP_BOOL:17 ,
Potential registers zp ZP_BYTE:18 [ plexSort::nxt_idx#0 ] : zp ZP_BYTE:18 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:19 [ plexSort::nxt_y#0 ] : zp ZP_BYTE:19 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:20 [ plexSort::s#2 ] : zp ZP_BYTE:20 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:21 [ plex_show_idx#1 ] : zp ZP_BYTE:21 ,
Potential registers zp ZP_BYTE:22 [ plex_sprite_idx#1 ] : zp ZP_BYTE:22 ,
Potential registers zp ZP_BYTE:23 [ plex_sprite_msb#1 ] : zp ZP_BYTE:23 ,
Potential registers zp ZP_BYTE:24 [ plex_free_next#0 ] : zp ZP_BYTE:24 ,
Potential registers zp ZP_BYTE:25 [ init::$7 ] : zp ZP_BYTE:25 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:26 [ plex_irq::plexFreeNextYpos1_return#0 ] : zp ZP_BYTE:26 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:27 [ plex_irq::$4 ] : zp ZP_BYTE:27 , reg byte x , reg byte y ,
Potential registers zp ZP_BOOL:28 [ framedone#3 ] : zp ZP_BOOL:28 ,
Potential registers zp ZP_BYTE:29 [ plexShowSprite::plex_sprite_idx2#0 ] : zp ZP_BYTE:29 ,
Potential registers zp ZP_BYTE:30 [ plexShowSprite::plexFreeAdd1_ypos#0 ] : zp ZP_BYTE:30 , reg byte a , reg byte x ,
Potential registers zp ZP_BYTE:31 [ plexShowSprite::plexFreeAdd1_$0#0 ] : zp ZP_BYTE:31 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:32 [ plexShowSprite::plexFreeAdd1_$1#0 ] : zp ZP_BYTE:32 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:33 [ plexShowSprite::xpos_idx#0 ] : zp ZP_BYTE:33 , reg byte x ,
Potential registers zp ZP_BYTE:34 [ plexShowSprite::$3 ] : zp ZP_BYTE:34 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:35 [ plexShowSprite::$4 ] : zp ZP_BYTE:35 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:36 [ plexShowSprite::$10 ] : zp ZP_BYTE:36 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:37 [ plexShowSprite::$6 ] : zp ZP_BYTE:37 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:21 [ init::$7 ] : zp ZP_BYTE:21 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:22 [ plex_irq::plexFreeNextYpos1_return#0 ] : zp ZP_BYTE:22 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:23 [ plex_irq::$4 ] : zp ZP_BYTE:23 , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:24 [ plexShowSprite::plex_sprite_idx2#0 ] : zp ZP_BYTE:24 ,
Potential registers zp ZP_BYTE:25 [ plexShowSprite::plexFreeAdd1_ypos#0 ] : zp ZP_BYTE:25 , reg byte a , reg byte x ,
Potential registers zp ZP_BYTE:26 [ plexShowSprite::plexFreeAdd1_$0#0 ] : zp ZP_BYTE:26 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:27 [ plexShowSprite::plexFreeAdd1_$1#0 ] : zp ZP_BYTE:27 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:28 [ plexShowSprite::xpos_idx#0 ] : zp ZP_BYTE:28 , reg byte x ,
Potential registers zp ZP_BYTE:29 [ plexShowSprite::$3 ] : zp ZP_BYTE:29 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:30 [ plexShowSprite::$4 ] : zp ZP_BYTE:30 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:31 [ plexShowSprite::$10 ] : zp ZP_BYTE:31 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:32 [ plexShowSprite::$6 ] : zp ZP_BYTE:32 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [plexSort] 3,622.83: zp ZP_BYTE:7 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] 303: zp ZP_BYTE:8 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] 202: zp ZP_BYTE:20 [ plexSort::s#2 ] 193.58: zp ZP_BYTE:6 [ plexSort::m#2 plexSort::m#1 ] 150.38: zp ZP_BYTE:19 [ plexSort::nxt_y#0 ] 30.3: zp ZP_BYTE:18 [ plexSort::nxt_idx#0 ]
Uplift Scope [loop] 252.5: zp ZP_BYTE:5 [ loop::sy#2 loop::sy#1 ] 246.33: zp ZP_BYTE:4 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ] 6.81: zp ZP_BYTE:3 [ loop::sin_idx#6 loop::sin_idx#1 ]
Uplift Scope [] 65: zp ZP_BOOL:2 [ framedone#12 framedone#19 framedone#5 ] 20: zp ZP_BYTE:21 [ plex_show_idx#1 ] 20: zp ZP_BYTE:22 [ plex_sprite_idx#1 ] 20: zp ZP_BYTE:23 [ plex_sprite_msb#1 ] 20: zp ZP_BYTE:24 [ plex_free_next#0 ] 20: zp ZP_BOOL:28 [ framedone#3 ] 14.09: zp ZP_BYTE:17 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 ] 7.88: zp ZP_BYTE:16 [ plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ] 7.27: zp ZP_BYTE:15 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 ] 6.2: zp ZP_BYTE:14 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 ]
Uplift Scope [init] 33: zp ZP_BYTE:12 [ init::ss#2 init::ss#1 ] 25.3: zp ZP_BYTE:9 [ init::sx#2 init::sx#1 ] 22: zp ZP_BYTE:25 [ init::$7 ] 15.58: zp ZP_WORD:10 [ init::xp#2 init::xp#1 ]
Uplift Scope [plexInit] 38.5: zp ZP_BYTE:13 [ plexInit::i#2 plexInit::i#1 ]
Uplift Scope [plexShowSprite] 4: zp ZP_BYTE:31 [ plexShowSprite::plexFreeAdd1_$0#0 ] 4: zp ZP_BYTE:32 [ plexShowSprite::plexFreeAdd1_$1#0 ] 4: zp ZP_BYTE:34 [ plexShowSprite::$3 ] 4: zp ZP_BYTE:35 [ plexShowSprite::$4 ] 4: zp ZP_BYTE:36 [ plexShowSprite::$10 ] 4: zp ZP_BYTE:37 [ plexShowSprite::$6 ] 3: zp ZP_BYTE:30 [ plexShowSprite::plexFreeAdd1_ypos#0 ] 2: zp ZP_BYTE:33 [ plexShowSprite::xpos_idx#0 ] 0.6: zp ZP_BYTE:29 [ plexShowSprite::plex_sprite_idx2#0 ]
Uplift Scope [plex_irq] 11: zp ZP_BYTE:27 [ plex_irq::$4 ] 4: zp ZP_BYTE:26 [ plex_irq::plexFreeNextYpos1_return#0 ]
Uplift Scope [plexSort] 3,622.83: zp ZP_BYTE:6 [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] 303: zp ZP_BYTE:7 [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] 202: zp ZP_BYTE:20 [ plexSort::s#2 ] 193.58: zp ZP_BYTE:5 [ plexSort::m#2 plexSort::m#1 ] 150.38: zp ZP_BYTE:19 [ plexSort::nxt_y#0 ] 30.3: zp ZP_BYTE:18 [ plexSort::nxt_idx#0 ]
Uplift Scope [loop] 252.5: zp ZP_BYTE:4 [ loop::sy#2 loop::sy#1 ] 246.33: zp ZP_BYTE:3 [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ] 6.81: zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Uplift Scope [] 85: zp ZP_BOOL:17 [ framedone#3 framedone#12 framedone#19 framedone#5 ] 34.09: zp ZP_BYTE:15 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ] 27.88: zp ZP_BYTE:16 [ plex_free_next#0 plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ] 27.27: zp ZP_BYTE:14 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ] 26.2: zp ZP_BYTE:13 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 plex_sprite_idx#1 ]
Uplift Scope [init] 33: zp ZP_BYTE:11 [ init::ss#2 init::ss#1 ] 25.3: zp ZP_BYTE:8 [ init::sx#2 init::sx#1 ] 22: zp ZP_BYTE:21 [ init::$7 ] 15.58: zp ZP_WORD:9 [ init::xp#2 init::xp#1 ]
Uplift Scope [plexInit] 38.5: zp ZP_BYTE:12 [ plexInit::i#2 plexInit::i#1 ]
Uplift Scope [plexShowSprite] 4: zp ZP_BYTE:26 [ plexShowSprite::plexFreeAdd1_$0#0 ] 4: zp ZP_BYTE:27 [ plexShowSprite::plexFreeAdd1_$1#0 ] 4: zp ZP_BYTE:29 [ plexShowSprite::$3 ] 4: zp ZP_BYTE:30 [ plexShowSprite::$4 ] 4: zp ZP_BYTE:31 [ plexShowSprite::$10 ] 4: zp ZP_BYTE:32 [ plexShowSprite::$6 ] 3: zp ZP_BYTE:25 [ plexShowSprite::plexFreeAdd1_ypos#0 ] 2: zp ZP_BYTE:28 [ plexShowSprite::xpos_idx#0 ] 0.6: zp ZP_BYTE:24 [ plexShowSprite::plex_sprite_idx2#0 ]
Uplift Scope [plex_irq] 11: zp ZP_BYTE:23 [ plex_irq::$4 ] 4: zp ZP_BYTE:22 [ plex_irq::plexFreeNextYpos1_return#0 ]
Uplift Scope [main]
Uplifting [plexSort] best 60876 combination reg byte x [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] reg byte x [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] zp ZP_BYTE:20 [ plexSort::s#2 ] zp ZP_BYTE:6 [ plexSort::m#2 plexSort::m#1 ] zp ZP_BYTE:19 [ plexSort::nxt_y#0 ] zp ZP_BYTE:18 [ plexSort::nxt_idx#0 ]
Uplifting [plexSort] best 60876 combination reg byte x [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] reg byte x [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] zp ZP_BYTE:20 [ plexSort::s#2 ] zp ZP_BYTE:5 [ plexSort::m#2 plexSort::m#1 ] zp ZP_BYTE:19 [ plexSort::nxt_y#0 ] zp ZP_BYTE:18 [ plexSort::nxt_idx#0 ]
Limited combination testing to 10 combinations of 972 possible.
Uplifting [loop] best 58946 combination reg byte y [ loop::sy#2 loop::sy#1 ] reg byte x [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ] zp ZP_BYTE:3 [ loop::sin_idx#6 loop::sin_idx#1 ]
Uplifting [loop] best 58946 combination reg byte y [ loop::sy#2 loop::sy#1 ] reg byte x [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ] zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Limited combination testing to 10 combinations of 27 possible.
Uplifting [] best 58946 combination zp ZP_BOOL:2 [ framedone#12 framedone#19 framedone#5 ] zp ZP_BYTE:21 [ plex_show_idx#1 ] zp ZP_BYTE:22 [ plex_sprite_idx#1 ] zp ZP_BYTE:23 [ plex_sprite_msb#1 ] zp ZP_BYTE:24 [ plex_free_next#0 ] zp ZP_BOOL:28 [ framedone#3 ] zp ZP_BYTE:17 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 ] zp ZP_BYTE:16 [ plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ] zp ZP_BYTE:15 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 ] zp ZP_BYTE:14 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 ]
Uplifting [init] best 58696 combination reg byte x [ init::ss#2 init::ss#1 ] reg byte x [ init::sx#2 init::sx#1 ] zp ZP_BYTE:25 [ init::$7 ] zp ZP_WORD:10 [ init::xp#2 init::xp#1 ]
Uplifting [] best 58946 combination zp ZP_BOOL:17 [ framedone#3 framedone#12 framedone#19 framedone#5 ] zp ZP_BYTE:15 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ] zp ZP_BYTE:16 [ plex_free_next#0 plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ] zp ZP_BYTE:14 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ] zp ZP_BYTE:13 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 plex_sprite_idx#1 ]
Uplifting [init] best 58696 combination reg byte x [ init::ss#2 init::ss#1 ] reg byte x [ init::sx#2 init::sx#1 ] zp ZP_BYTE:21 [ init::$7 ] zp ZP_WORD:9 [ init::xp#2 init::xp#1 ]
Limited combination testing to 10 combinations of 36 possible.
Uplifting [plexInit] best 58576 combination reg byte x [ plexInit::i#2 plexInit::i#1 ]
Uplifting [plexShowSprite] best 58566 combination reg byte a [ plexShowSprite::plexFreeAdd1_$0#0 ] reg byte x [ plexShowSprite::plexFreeAdd1_$1#0 ] zp ZP_BYTE:34 [ plexShowSprite::$3 ] zp ZP_BYTE:35 [ plexShowSprite::$4 ] zp ZP_BYTE:36 [ plexShowSprite::$10 ] zp ZP_BYTE:37 [ plexShowSprite::$6 ] zp ZP_BYTE:30 [ plexShowSprite::plexFreeAdd1_ypos#0 ] zp ZP_BYTE:33 [ plexShowSprite::xpos_idx#0 ] zp ZP_BYTE:29 [ plexShowSprite::plex_sprite_idx2#0 ]
Uplifting [plexShowSprite] best 58566 combination reg byte a [ plexShowSprite::plexFreeAdd1_$0#0 ] reg byte x [ plexShowSprite::plexFreeAdd1_$1#0 ] zp ZP_BYTE:29 [ plexShowSprite::$3 ] zp ZP_BYTE:30 [ plexShowSprite::$4 ] zp ZP_BYTE:31 [ plexShowSprite::$10 ] zp ZP_BYTE:32 [ plexShowSprite::$6 ] zp ZP_BYTE:25 [ plexShowSprite::plexFreeAdd1_ypos#0 ] zp ZP_BYTE:28 [ plexShowSprite::xpos_idx#0 ] zp ZP_BYTE:24 [ plexShowSprite::plex_sprite_idx2#0 ]
Limited combination testing to 10 combinations of 24576 possible.
Uplifting [plex_irq] best 58503 combination zp ZP_BYTE:27 [ plex_irq::$4 ] reg byte x [ plex_irq::plexFreeNextYpos1_return#0 ]
Uplifting [plex_irq] best 58503 combination zp ZP_BYTE:23 [ plex_irq::$4 ] reg byte x [ plex_irq::plexFreeNextYpos1_return#0 ]
Uplifting [main] best 58503 combination
Attempting to uplift remaining variables inzp ZP_BYTE:20 [ plexSort::s#2 ]
Uplifting [plexSort] best 57903 combination reg byte x [ plexSort::s#2 ]
Attempting to uplift remaining variables inzp ZP_BYTE:6 [ plexSort::m#2 plexSort::m#1 ]
Uplifting [plexSort] best 57903 combination zp ZP_BYTE:6 [ plexSort::m#2 plexSort::m#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:5 [ plexSort::m#2 plexSort::m#1 ]
Uplifting [plexSort] best 57903 combination zp ZP_BYTE:5 [ plexSort::m#2 plexSort::m#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:19 [ plexSort::nxt_y#0 ]
Uplifting [plexSort] best 57903 combination zp ZP_BYTE:19 [ plexSort::nxt_y#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:15 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ]
Uplifting [] best 57903 combination zp ZP_BYTE:15 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:18 [ plexSort::nxt_idx#0 ]
Uplifting [plexSort] best 57903 combination zp ZP_BYTE:18 [ plexSort::nxt_idx#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:25 [ init::$7 ]
Attempting to uplift remaining variables inzp ZP_BYTE:16 [ plex_free_next#0 plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
Uplifting [] best 57903 combination zp ZP_BYTE:16 [ plex_free_next#0 plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:14 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ]
Uplifting [] best 57903 combination zp ZP_BYTE:14 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:13 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 plex_sprite_idx#1 ]
Uplifting [] best 57903 combination zp ZP_BYTE:13 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 plex_sprite_idx#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:21 [ init::$7 ]
Uplifting [init] best 57863 combination reg byte a [ init::$7 ]
Attempting to uplift remaining variables inzp ZP_BYTE:21 [ plex_show_idx#1 ]
Uplifting [] best 57863 combination zp ZP_BYTE:21 [ plex_show_idx#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:22 [ plex_sprite_idx#1 ]
Uplifting [] best 57863 combination zp ZP_BYTE:22 [ plex_sprite_idx#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:23 [ plex_sprite_msb#1 ]
Uplifting [] best 57863 combination zp ZP_BYTE:23 [ plex_sprite_msb#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:24 [ plex_free_next#0 ]
Uplifting [] best 57863 combination zp ZP_BYTE:24 [ plex_free_next#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:17 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 ]
Uplifting [] best 57863 combination zp ZP_BYTE:17 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 ]
Attempting to uplift remaining variables inzp ZP_BYTE:27 [ plex_irq::$4 ]
Uplifting [plex_irq] best 57863 combination zp ZP_BYTE:27 [ plex_irq::$4 ]
Attempting to uplift remaining variables inzp ZP_BYTE:16 [ plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
Uplifting [] best 57863 combination zp ZP_BYTE:16 [ plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:15 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 ]
Uplifting [] best 57863 combination zp ZP_BYTE:15 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 ]
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ loop::sin_idx#6 loop::sin_idx#1 ]
Uplifting [loop] best 57863 combination zp ZP_BYTE:3 [ loop::sin_idx#6 loop::sin_idx#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:14 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 ]
Uplifting [] best 57863 combination zp ZP_BYTE:14 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 ]
Attempting to uplift remaining variables inzp ZP_BYTE:34 [ plexShowSprite::$3 ]
Attempting to uplift remaining variables inzp ZP_BYTE:23 [ plex_irq::$4 ]
Uplifting [plex_irq] best 57863 combination zp ZP_BYTE:23 [ plex_irq::$4 ]
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Uplifting [loop] best 57863 combination zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:29 [ plexShowSprite::$3 ]
Uplifting [plexShowSprite] best 57857 combination reg byte a [ plexShowSprite::$3 ]
Attempting to uplift remaining variables inzp ZP_BYTE:35 [ plexShowSprite::$4 ]
Attempting to uplift remaining variables inzp ZP_BYTE:30 [ plexShowSprite::$4 ]
Uplifting [plexShowSprite] best 57851 combination reg byte a [ plexShowSprite::$4 ]
Attempting to uplift remaining variables inzp ZP_BYTE:36 [ plexShowSprite::$10 ]
Attempting to uplift remaining variables inzp ZP_BYTE:31 [ plexShowSprite::$10 ]
Uplifting [plexShowSprite] best 57845 combination reg byte a [ plexShowSprite::$10 ]
Attempting to uplift remaining variables inzp ZP_BYTE:37 [ plexShowSprite::$6 ]
Attempting to uplift remaining variables inzp ZP_BYTE:32 [ plexShowSprite::$6 ]
Uplifting [plexShowSprite] best 57839 combination reg byte x [ plexShowSprite::$6 ]
Attempting to uplift remaining variables inzp ZP_BYTE:30 [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:25 [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Uplifting [plexShowSprite] best 57830 combination reg byte a [ plexShowSprite::plexFreeAdd1_ypos#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:33 [ plexShowSprite::xpos_idx#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:28 [ plexShowSprite::xpos_idx#0 ]
Uplifting [plexShowSprite] best 57823 combination reg byte x [ plexShowSprite::xpos_idx#0 ]
Attempting to uplift remaining variables inzp ZP_BYTE:29 [ plexShowSprite::plex_sprite_idx2#0 ]
Uplifting [plexShowSprite] best 57823 combination zp ZP_BYTE:29 [ plexShowSprite::plex_sprite_idx2#0 ]
Coalescing zero page register [ zp ZP_BOOL:2 [ framedone#12 framedone#19 framedone#5 ] ] with [ zp ZP_BOOL:28 [ framedone#3 ] ]
Coalescing zero page register [ zp ZP_BYTE:15 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 ] ] with [ zp ZP_BYTE:21 [ plex_show_idx#1 ] ]
Coalescing zero page register [ zp ZP_BYTE:17 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 ] ] with [ zp ZP_BYTE:23 [ plex_sprite_msb#1 ] ]
Coalescing zero page register [ zp ZP_BYTE:27 [ plex_irq::$4 ] ] with [ zp ZP_BYTE:29 [ plexShowSprite::plex_sprite_idx2#0 ] ]
Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:4 [ plexSort::m#2 plexSort::m#1 ]
Allocated (was zp ZP_WORD:10) zp ZP_WORD:5 [ init::xp#2 init::xp#1 ]
Allocated (was zp ZP_BYTE:14) zp ZP_BYTE:7 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 ]
Allocated (was zp ZP_BYTE:15) zp ZP_BYTE:8 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ]
Allocated (was zp ZP_BYTE:16) zp ZP_BYTE:9 [ plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
Allocated (was zp ZP_BYTE:17) zp ZP_BYTE:10 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:24 [ plexShowSprite::plex_sprite_idx2#0 ]
Uplifting [plexShowSprite] best 57823 combination zp ZP_BYTE:24 [ plexShowSprite::plex_sprite_idx2#0 ]
Coalescing zero page register [ zp ZP_BYTE:23 [ plex_irq::$4 ] ] with [ zp ZP_BYTE:24 [ plexShowSprite::plex_sprite_idx2#0 ] ]
Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:3 [ plexSort::m#2 plexSort::m#1 ]
Allocated (was zp ZP_WORD:9) zp ZP_WORD:4 [ init::xp#2 init::xp#1 ]
Allocated (was zp ZP_BYTE:13) zp ZP_BYTE:6 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 plex_sprite_idx#1 ]
Allocated (was zp ZP_BYTE:14) zp ZP_BYTE:7 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ]
Allocated (was zp ZP_BYTE:15) zp ZP_BYTE:8 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ]
Allocated (was zp ZP_BYTE:16) zp ZP_BYTE:9 [ plex_free_next#0 plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
Allocated (was zp ZP_BOOL:17) zp ZP_BOOL:10 [ framedone#3 framedone#12 framedone#19 framedone#5 ]
Allocated (was zp ZP_BYTE:18) zp ZP_BYTE:11 [ plexSort::nxt_idx#0 ]
Allocated (was zp ZP_BYTE:19) zp ZP_BYTE:12 [ plexSort::nxt_y#0 ]
Allocated (was zp ZP_BYTE:22) zp ZP_BYTE:13 [ plex_sprite_idx#1 ]
Allocated (was zp ZP_BYTE:24) zp ZP_BYTE:14 [ plex_free_next#0 ]
Allocated (was zp ZP_BYTE:27) zp ZP_BYTE:15 [ plex_irq::$4 plexShowSprite::plex_sprite_idx2#0 ]
Allocated (was zp ZP_BYTE:23) zp ZP_BYTE:13 [ plex_irq::$4 plexShowSprite::plex_sprite_idx2#0 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
@ -3511,14 +3476,11 @@ ASSEMBLER BEFORE OPTIMIZATION
.label YSIN = $2100
// The address of the sprite pointers on the current screen (screen+$3f8).
.label PLEX_SCREEN_PTR = $400+$3f8
.label plex_show_idx = 8
.label plex_sprite_idx = 7
.label plex_sprite_msb = $a
.label plex_sprite_idx_1 = $d
.label plex_free_next = $e
.label framedone = 2
.label plex_free_next_27 = 9
.label plex_free_next_31 = 9
.label plex_show_idx = 7
.label plex_sprite_idx = 6
.label plex_sprite_msb = 8
.label plex_free_next = 9
.label framedone = $a
//SEG3 @begin
bbegin:
jmp b1
@ -3542,7 +3504,7 @@ b2:
//SEG9 [4] (byte) plex_free_next#31 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
// The index of the sprite that is free next. Since sprites are used round-robin this moves forward each time a sprite is shown.
lda #0
sta plex_free_next_31
sta plex_free_next
jmp b3
//SEG10 @3
b3:
@ -3590,7 +3552,7 @@ main: {
//SEG29 loop
// The raster loop
loop: {
.label sin_idx = 3
.label sin_idx = 2
//SEG30 [17] phi from loop to loop::@1 [phi:loop->loop::@1]
b1_from_loop:
//SEG31 [17] phi (byte) loop::sin_idx#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop->loop::@1#0] -- vbuz1=vbuc1
@ -3685,7 +3647,7 @@ loop: {
plexSort: {
.label nxt_idx = $b
.label nxt_y = $c
.label m = 4
.label m = 3
//SEG64 [34] phi from plexSort to plexSort::@1 [phi:plexSort->plexSort::@1]
b1_from_plexSort:
//SEG65 [34] phi (byte) plexSort::m#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort->plexSort::@1#0] -- vbuz1=vbuc1
@ -3758,7 +3720,7 @@ plexSort: {
sta plex_show_idx
//SEG88 [48] (byte) plex_sprite_idx#1 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta plex_sprite_idx_1
sta plex_sprite_idx
//SEG89 [49] (byte) plex_sprite_msb#1 ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuc1
lda #1
sta plex_sprite_msb
@ -3809,7 +3771,7 @@ plexSort: {
//SEG106 init
// Initialize the program
init: {
.label xp = 5
.label xp = 4
//SEG107 [58] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2
lda #VIC_DEN|VIC_RSEL|3
sta D011
@ -3948,7 +3910,7 @@ plexInit: {
}
//SEG155 plex_irq
plex_irq: {
.label _4 = $f
.label _4 = $d
//SEG156 entry interrupt(KERNEL_MIN)
//SEG157 [86] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2
lda #WHITE
@ -4026,8 +3988,8 @@ plex_irq: {
// Show the next sprite.
// plexSort() prepares showing the sprites
plexShowSprite: {
.label _7 = 7
.label plex_sprite_idx2 = $f
.label _7 = 6
.label plex_sprite_idx2 = $d
.label plexFreeAdd1__2 = 9
//SEG184 [99] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#25 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1
lda plex_sprite_idx
@ -4047,10 +4009,10 @@ plexShowSprite: {
clc
adc #$15
//SEG189 [103] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#27) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy plex_free_next_27
ldy plex_free_next
sta PLEX_FREE_YPOS,y
//SEG190 [104] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#27 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuz1_plus_1
ldx plex_free_next_27
ldx plex_free_next
inx
//SEG191 [105] (byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuxx_band_vbuc1
lda #7
@ -4414,10 +4376,10 @@ FINAL SYMBOL TABLE
(byte*) YSIN
(const byte*) YSIN#0 YSIN = ((byte*))(word/signed word/dword/signed dword) $2100
(bool) framedone
(bool) framedone#12 framedone zp ZP_BOOL:2 57.0
(bool) framedone#19 framedone zp ZP_BOOL:2 0.6666666666666666
(bool) framedone#3 framedone zp ZP_BOOL:2 20.0
(bool) framedone#5 framedone zp ZP_BOOL:2 7.333333333333333
(bool) framedone#12 framedone zp ZP_BOOL:10 57.0
(bool) framedone#19 framedone zp ZP_BOOL:10 0.6666666666666666
(bool) framedone#3 framedone zp ZP_BOOL:10 20.0
(bool) framedone#5 framedone zp ZP_BOOL:10 7.333333333333333
(void()) init()
(byte~) init::$7 reg byte a 22.0
(label) init::@1
@ -4432,8 +4394,8 @@ FINAL SYMBOL TABLE
(byte) init::sx#1 reg byte x 16.5
(byte) init::sx#2 reg byte x 8.8
(word) init::xp
(word) init::xp#1 xp zp ZP_WORD:5 7.333333333333333
(word) init::xp#2 xp zp ZP_WORD:5 8.25
(word) init::xp#1 xp zp ZP_WORD:4 7.333333333333333
(word) init::xp#2 xp zp ZP_WORD:4 8.25
(void()) loop()
(label) loop::@1
(label) loop::@2
@ -4442,8 +4404,8 @@ FINAL SYMBOL TABLE
(label) loop::@5
(label) loop::@6
(byte) loop::sin_idx
(byte) loop::sin_idx#1 sin_idx zp ZP_BYTE:3 3.142857142857143
(byte) loop::sin_idx#6 sin_idx zp ZP_BYTE:3 3.666666666666667
(byte) loop::sin_idx#1 sin_idx zp ZP_BYTE:2 3.142857142857143
(byte) loop::sin_idx#6 sin_idx zp ZP_BYTE:2 3.666666666666667
(byte) loop::sy
(byte) loop::sy#1 reg byte y 151.5
(byte) loop::sy#2 reg byte y 101.0
@ -4469,7 +4431,7 @@ FINAL SYMBOL TABLE
(byte~) plexShowSprite::$3 reg byte a 4.0
(byte~) plexShowSprite::$4 reg byte a 4.0
(byte/signed word/word/dword/signed dword~) plexShowSprite::$6 reg byte x 4.0
(byte/word/dword~) plexShowSprite::$7 $7 zp ZP_BYTE:7 1.0833333333333333
(byte/word/dword~) plexShowSprite::$7 $7 zp ZP_BYTE:6 1.0833333333333333
(label) plexShowSprite::@1
(label) plexShowSprite::@2
(label) plexShowSprite::@3
@ -4486,7 +4448,7 @@ FINAL SYMBOL TABLE
(byte) plexShowSprite::plexFreeAdd1_ypos
(byte) plexShowSprite::plexFreeAdd1_ypos#0 reg byte a 3.0
(byte) plexShowSprite::plex_sprite_idx2
(byte) plexShowSprite::plex_sprite_idx2#0 plex_sprite_idx2 zp ZP_BYTE:15 0.6000000000000001
(byte) plexShowSprite::plex_sprite_idx2#0 plex_sprite_idx2 zp ZP_BYTE:13 0.6000000000000001
(byte) plexShowSprite::xpos_idx
(byte) plexShowSprite::xpos_idx#0 reg byte x 2.0
(byte) plexShowSprite::ypos
@ -4500,8 +4462,8 @@ FINAL SYMBOL TABLE
(label) plexSort::@7
(label) plexSort::@return
(byte) plexSort::m
(byte) plexSort::m#1 m zp ZP_BYTE:4 151.5
(byte) plexSort::m#2 m zp ZP_BYTE:4 42.08333333333333
(byte) plexSort::m#1 m zp ZP_BYTE:3 151.5
(byte) plexSort::m#2 m zp ZP_BYTE:3 42.08333333333333
(byte) plexSort::nxt_idx
(byte) plexSort::nxt_idx#0 nxt_idx zp ZP_BYTE:11 30.299999999999997
(byte) plexSort::nxt_y
@ -4519,11 +4481,11 @@ FINAL SYMBOL TABLE
(byte) plexSort::s#3 reg byte x 2052.5
(byte~) plexSort::s#6 reg byte x 202.0
(byte) plex_free_next
(byte) plex_free_next#0 plex_free_next zp ZP_BYTE:14 20.0
(byte) plex_free_next#27 plex_free_next#27 zp ZP_BYTE:9 2.8333333333333335
(byte) plex_free_next#31 plex_free_next#31 zp ZP_BYTE:9 4.0
(byte) plex_free_next#0 plex_free_next zp ZP_BYTE:9 20.0
(byte) plex_free_next#27 plex_free_next zp ZP_BYTE:9 2.8333333333333335
(byte) plex_free_next#31 plex_free_next zp ZP_BYTE:9 4.0
interrupt(KERNEL_MIN)(void()) plex_irq()
(byte/signed word/word/dword/signed dword~) plex_irq::$4 $4 zp ZP_BYTE:15 11.0
(byte/signed word/word/dword/signed dword~) plex_irq::$4 $4 zp ZP_BYTE:13 11.0
(label) plex_irq::@1
(label) plex_irq::@2
(label) plex_irq::@3
@ -4537,45 +4499,43 @@ interrupt(KERNEL_MIN)(void()) plex_irq()
(byte) plex_irq::plexFreeNextYpos1_return#0 reg byte x 4.0
(byte) plex_irq::rasterY
(byte) plex_show_idx
(byte) plex_show_idx#0 plex_show_idx zp ZP_BYTE:8 4.0
(byte) plex_show_idx#1 plex_show_idx zp ZP_BYTE:8 20.0
(byte) plex_show_idx#16 plex_show_idx zp ZP_BYTE:8 2.1666666666666665
(byte) plex_show_idx#27 plex_show_idx zp ZP_BYTE:8 1.1052631578947367
(byte) plex_show_idx#0 plex_show_idx zp ZP_BYTE:7 4.0
(byte) plex_show_idx#1 plex_show_idx zp ZP_BYTE:7 20.0
(byte) plex_show_idx#16 plex_show_idx zp ZP_BYTE:7 2.1666666666666665
(byte) plex_show_idx#27 plex_show_idx zp ZP_BYTE:7 1.1052631578947367
(byte) plex_sprite_idx
(byte) plex_sprite_idx#0 plex_sprite_idx zp ZP_BYTE:7 4.0
(byte) plex_sprite_idx#1 plex_sprite_idx#1 zp ZP_BYTE:13 20.0
(byte) plex_sprite_idx#25 plex_sprite_idx zp ZP_BYTE:7 1.1176470588235294
(byte) plex_sprite_idx#0 plex_sprite_idx zp ZP_BYTE:6 4.0
(byte) plex_sprite_idx#1 plex_sprite_idx zp ZP_BYTE:6 20.0
(byte) plex_sprite_idx#25 plex_sprite_idx zp ZP_BYTE:6 1.1176470588235294
(byte) plex_sprite_msb
(byte) plex_sprite_msb#0 plex_sprite_msb zp ZP_BYTE:10 4.0
(byte) plex_sprite_msb#1 plex_sprite_msb zp ZP_BYTE:10 20.0
(byte) plex_sprite_msb#17 plex_sprite_msb zp ZP_BYTE:10 2.142857142857143
(byte) plex_sprite_msb#27 plex_sprite_msb zp ZP_BYTE:10 3.0
(byte) plex_sprite_msb#29 plex_sprite_msb zp ZP_BYTE:10 0.95
(byte) plex_sprite_msb#4 plex_sprite_msb zp ZP_BYTE:10 4.0
(byte) plex_sprite_msb#0 plex_sprite_msb zp ZP_BYTE:8 4.0
(byte) plex_sprite_msb#1 plex_sprite_msb zp ZP_BYTE:8 20.0
(byte) plex_sprite_msb#17 plex_sprite_msb zp ZP_BYTE:8 2.142857142857143
(byte) plex_sprite_msb#27 plex_sprite_msb zp ZP_BYTE:8 3.0
(byte) plex_sprite_msb#29 plex_sprite_msb zp ZP_BYTE:8 0.95
(byte) plex_sprite_msb#4 plex_sprite_msb zp ZP_BYTE:8 4.0
zp ZP_BOOL:2 [ framedone#12 framedone#19 framedone#5 framedone#3 ]
zp ZP_BYTE:3 [ loop::sin_idx#6 loop::sin_idx#1 ]
zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
reg byte x [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
reg byte y [ loop::sy#2 loop::sy#1 ]
zp ZP_BYTE:4 [ plexSort::m#2 plexSort::m#1 ]
zp ZP_BYTE:3 [ plexSort::m#2 plexSort::m#1 ]
reg byte x [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
reg byte x [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
reg byte x [ init::sx#2 init::sx#1 ]
zp ZP_WORD:5 [ init::xp#2 init::xp#1 ]
zp ZP_WORD:4 [ init::xp#2 init::xp#1 ]
reg byte x [ init::ss#2 init::ss#1 ]
reg byte x [ plexInit::i#2 plexInit::i#1 ]
zp ZP_BYTE:7 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 ]
zp ZP_BYTE:8 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ]
zp ZP_BYTE:9 [ plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
zp ZP_BYTE:10 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ]
zp ZP_BYTE:6 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 plex_sprite_idx#1 ]
zp ZP_BYTE:7 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ]
zp ZP_BYTE:8 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ]
zp ZP_BYTE:9 [ plex_free_next#0 plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
zp ZP_BOOL:10 [ framedone#3 framedone#12 framedone#19 framedone#5 ]
zp ZP_BYTE:11 [ plexSort::nxt_idx#0 ]
zp ZP_BYTE:12 [ plexSort::nxt_y#0 ]
reg byte x [ plexSort::s#2 ]
zp ZP_BYTE:13 [ plex_sprite_idx#1 ]
zp ZP_BYTE:14 [ plex_free_next#0 ]
reg byte a [ init::$7 ]
reg byte x [ plex_irq::plexFreeNextYpos1_return#0 ]
zp ZP_BYTE:15 [ plex_irq::$4 plexShowSprite::plex_sprite_idx2#0 ]
zp ZP_BYTE:13 [ plex_irq::$4 plexShowSprite::plex_sprite_idx2#0 ]
reg byte a [ plexShowSprite::plexFreeAdd1_ypos#0 ]
reg byte a [ plexShowSprite::plexFreeAdd1_$0#0 ]
reg byte x [ plexShowSprite::plexFreeAdd1_$1#0 ]
@ -4628,14 +4588,11 @@ Score: 47278
.label YSIN = $2100
// The address of the sprite pointers on the current screen (screen+$3f8).
.label PLEX_SCREEN_PTR = $400+$3f8
.label plex_show_idx = 8
.label plex_sprite_idx = 7
.label plex_sprite_msb = $a
.label plex_sprite_idx_1 = $d
.label plex_free_next = $e
.label framedone = 2
.label plex_free_next_27 = 9
.label plex_free_next_31 = 9
.label plex_show_idx = 7
.label plex_sprite_idx = 6
.label plex_sprite_msb = 8
.label plex_free_next = 9
.label framedone = $a
//SEG3 @begin
bbegin:
//SEG4 @1
@ -4654,7 +4611,7 @@ bbegin:
//SEG9 [4] (byte) plex_free_next#31 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
// The index of the sprite that is free next. Since sprites are used round-robin this moves forward each time a sprite is shown.
lda #0
sta plex_free_next_31
sta plex_free_next
//SEG10 @3
//SEG11 kickasm(location (const byte*) YSIN#0) {{ .var min = 50 .var max = 250-21 .var ampl = max-min; .for(var i=0;i<256;i++) .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256))) }}
//SEG12 kickasm(location (const byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff)) .for (var y=0; y<21; y++) .for (var x=0;x<3; x++) .byte pic.getSinglecolorByte(x,y) }}
@ -4687,7 +4644,7 @@ main: {
//SEG29 loop
// The raster loop
loop: {
.label sin_idx = 3
.label sin_idx = 2
//SEG30 [17] phi from loop to loop::@1 [phi:loop->loop::@1]
//SEG31 [17] phi (byte) loop::sin_idx#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:loop->loop::@1#0] -- vbuz1=vbuc1
lda #0
@ -4768,7 +4725,7 @@ loop: {
plexSort: {
.label nxt_idx = $b
.label nxt_y = $c
.label m = 4
.label m = 3
//SEG64 [34] phi from plexSort to plexSort::@1 [phi:plexSort->plexSort::@1]
//SEG65 [34] phi (byte) plexSort::m#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:plexSort->plexSort::@1#0] -- vbuz1=vbuc1
lda #0
@ -4825,7 +4782,7 @@ plexSort: {
lda #0
sta plex_show_idx
//SEG88 [48] (byte) plex_sprite_idx#1 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
sta plex_sprite_idx_1
sta plex_sprite_idx
//SEG89 [49] (byte) plex_sprite_msb#1 ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuc1
lda #1
sta plex_sprite_msb
@ -4864,7 +4821,7 @@ plexSort: {
//SEG106 init
// Initialize the program
init: {
.label xp = 5
.label xp = 4
//SEG107 [58] *((const byte*) D011#0) ← (const byte) VIC_DEN#0|(const byte) VIC_RSEL#0|(byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2
lda #VIC_DEN|VIC_RSEL|3
sta D011
@ -4978,7 +4935,7 @@ plexInit: {
}
//SEG155 plex_irq
plex_irq: {
.label _4 = $f
.label _4 = $d
//SEG156 entry interrupt(KERNEL_MIN)
//SEG157 [86] *((const byte*) BORDERCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2
lda #WHITE
@ -5043,8 +5000,8 @@ plex_irq: {
// Show the next sprite.
// plexSort() prepares showing the sprites
plexShowSprite: {
.label _7 = 7
.label plex_sprite_idx2 = $f
.label _7 = 6
.label plex_sprite_idx2 = $d
.label plexFreeAdd1__2 = 9
//SEG184 [99] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#25 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1
lda plex_sprite_idx
@ -5062,10 +5019,10 @@ plexShowSprite: {
clc
adc #$15
//SEG189 [103] *((const byte[8]) PLEX_FREE_YPOS#0 + (byte) plex_free_next#27) ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$0#0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy plex_free_next_27
ldy plex_free_next
sta PLEX_FREE_YPOS,y
//SEG190 [104] (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 ← (byte) plex_free_next#27 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuz1_plus_1
ldx plex_free_next_27
ldx plex_free_next
inx
//SEG191 [105] (byte/word/dword) plexShowSprite::plexFreeAdd1_$2#0 ← (byte/signed word/word/dword/signed dword) plexShowSprite::plexFreeAdd1_$1#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuxx_band_vbuc1
lda #7

View File

@ -124,10 +124,10 @@
(byte*) YSIN
(const byte*) YSIN#0 YSIN = ((byte*))(word/signed word/dword/signed dword) $2100
(bool) framedone
(bool) framedone#12 framedone zp ZP_BOOL:2 57.0
(bool) framedone#19 framedone zp ZP_BOOL:2 0.6666666666666666
(bool) framedone#3 framedone zp ZP_BOOL:2 20.0
(bool) framedone#5 framedone zp ZP_BOOL:2 7.333333333333333
(bool) framedone#12 framedone zp ZP_BOOL:10 57.0
(bool) framedone#19 framedone zp ZP_BOOL:10 0.6666666666666666
(bool) framedone#3 framedone zp ZP_BOOL:10 20.0
(bool) framedone#5 framedone zp ZP_BOOL:10 7.333333333333333
(void()) init()
(byte~) init::$7 reg byte a 22.0
(label) init::@1
@ -142,8 +142,8 @@
(byte) init::sx#1 reg byte x 16.5
(byte) init::sx#2 reg byte x 8.8
(word) init::xp
(word) init::xp#1 xp zp ZP_WORD:5 7.333333333333333
(word) init::xp#2 xp zp ZP_WORD:5 8.25
(word) init::xp#1 xp zp ZP_WORD:4 7.333333333333333
(word) init::xp#2 xp zp ZP_WORD:4 8.25
(void()) loop()
(label) loop::@1
(label) loop::@2
@ -152,8 +152,8 @@
(label) loop::@5
(label) loop::@6
(byte) loop::sin_idx
(byte) loop::sin_idx#1 sin_idx zp ZP_BYTE:3 3.142857142857143
(byte) loop::sin_idx#6 sin_idx zp ZP_BYTE:3 3.666666666666667
(byte) loop::sin_idx#1 sin_idx zp ZP_BYTE:2 3.142857142857143
(byte) loop::sin_idx#6 sin_idx zp ZP_BYTE:2 3.666666666666667
(byte) loop::sy
(byte) loop::sy#1 reg byte y 151.5
(byte) loop::sy#2 reg byte y 101.0
@ -179,7 +179,7 @@
(byte~) plexShowSprite::$3 reg byte a 4.0
(byte~) plexShowSprite::$4 reg byte a 4.0
(byte/signed word/word/dword/signed dword~) plexShowSprite::$6 reg byte x 4.0
(byte/word/dword~) plexShowSprite::$7 $7 zp ZP_BYTE:7 1.0833333333333333
(byte/word/dword~) plexShowSprite::$7 $7 zp ZP_BYTE:6 1.0833333333333333
(label) plexShowSprite::@1
(label) plexShowSprite::@2
(label) plexShowSprite::@3
@ -196,7 +196,7 @@
(byte) plexShowSprite::plexFreeAdd1_ypos
(byte) plexShowSprite::plexFreeAdd1_ypos#0 reg byte a 3.0
(byte) plexShowSprite::plex_sprite_idx2
(byte) plexShowSprite::plex_sprite_idx2#0 plex_sprite_idx2 zp ZP_BYTE:15 0.6000000000000001
(byte) plexShowSprite::plex_sprite_idx2#0 plex_sprite_idx2 zp ZP_BYTE:13 0.6000000000000001
(byte) plexShowSprite::xpos_idx
(byte) plexShowSprite::xpos_idx#0 reg byte x 2.0
(byte) plexShowSprite::ypos
@ -210,8 +210,8 @@
(label) plexSort::@7
(label) plexSort::@return
(byte) plexSort::m
(byte) plexSort::m#1 m zp ZP_BYTE:4 151.5
(byte) plexSort::m#2 m zp ZP_BYTE:4 42.08333333333333
(byte) plexSort::m#1 m zp ZP_BYTE:3 151.5
(byte) plexSort::m#2 m zp ZP_BYTE:3 42.08333333333333
(byte) plexSort::nxt_idx
(byte) plexSort::nxt_idx#0 nxt_idx zp ZP_BYTE:11 30.299999999999997
(byte) plexSort::nxt_y
@ -229,11 +229,11 @@
(byte) plexSort::s#3 reg byte x 2052.5
(byte~) plexSort::s#6 reg byte x 202.0
(byte) plex_free_next
(byte) plex_free_next#0 plex_free_next zp ZP_BYTE:14 20.0
(byte) plex_free_next#27 plex_free_next#27 zp ZP_BYTE:9 2.8333333333333335
(byte) plex_free_next#31 plex_free_next#31 zp ZP_BYTE:9 4.0
(byte) plex_free_next#0 plex_free_next zp ZP_BYTE:9 20.0
(byte) plex_free_next#27 plex_free_next zp ZP_BYTE:9 2.8333333333333335
(byte) plex_free_next#31 plex_free_next zp ZP_BYTE:9 4.0
interrupt(KERNEL_MIN)(void()) plex_irq()
(byte/signed word/word/dword/signed dword~) plex_irq::$4 $4 zp ZP_BYTE:15 11.0
(byte/signed word/word/dword/signed dword~) plex_irq::$4 $4 zp ZP_BYTE:13 11.0
(label) plex_irq::@1
(label) plex_irq::@2
(label) plex_irq::@3
@ -247,45 +247,43 @@ interrupt(KERNEL_MIN)(void()) plex_irq()
(byte) plex_irq::plexFreeNextYpos1_return#0 reg byte x 4.0
(byte) plex_irq::rasterY
(byte) plex_show_idx
(byte) plex_show_idx#0 plex_show_idx zp ZP_BYTE:8 4.0
(byte) plex_show_idx#1 plex_show_idx zp ZP_BYTE:8 20.0
(byte) plex_show_idx#16 plex_show_idx zp ZP_BYTE:8 2.1666666666666665
(byte) plex_show_idx#27 plex_show_idx zp ZP_BYTE:8 1.1052631578947367
(byte) plex_show_idx#0 plex_show_idx zp ZP_BYTE:7 4.0
(byte) plex_show_idx#1 plex_show_idx zp ZP_BYTE:7 20.0
(byte) plex_show_idx#16 plex_show_idx zp ZP_BYTE:7 2.1666666666666665
(byte) plex_show_idx#27 plex_show_idx zp ZP_BYTE:7 1.1052631578947367
(byte) plex_sprite_idx
(byte) plex_sprite_idx#0 plex_sprite_idx zp ZP_BYTE:7 4.0
(byte) plex_sprite_idx#1 plex_sprite_idx#1 zp ZP_BYTE:13 20.0
(byte) plex_sprite_idx#25 plex_sprite_idx zp ZP_BYTE:7 1.1176470588235294
(byte) plex_sprite_idx#0 plex_sprite_idx zp ZP_BYTE:6 4.0
(byte) plex_sprite_idx#1 plex_sprite_idx zp ZP_BYTE:6 20.0
(byte) plex_sprite_idx#25 plex_sprite_idx zp ZP_BYTE:6 1.1176470588235294
(byte) plex_sprite_msb
(byte) plex_sprite_msb#0 plex_sprite_msb zp ZP_BYTE:10 4.0
(byte) plex_sprite_msb#1 plex_sprite_msb zp ZP_BYTE:10 20.0
(byte) plex_sprite_msb#17 plex_sprite_msb zp ZP_BYTE:10 2.142857142857143
(byte) plex_sprite_msb#27 plex_sprite_msb zp ZP_BYTE:10 3.0
(byte) plex_sprite_msb#29 plex_sprite_msb zp ZP_BYTE:10 0.95
(byte) plex_sprite_msb#4 plex_sprite_msb zp ZP_BYTE:10 4.0
(byte) plex_sprite_msb#0 plex_sprite_msb zp ZP_BYTE:8 4.0
(byte) plex_sprite_msb#1 plex_sprite_msb zp ZP_BYTE:8 20.0
(byte) plex_sprite_msb#17 plex_sprite_msb zp ZP_BYTE:8 2.142857142857143
(byte) plex_sprite_msb#27 plex_sprite_msb zp ZP_BYTE:8 3.0
(byte) plex_sprite_msb#29 plex_sprite_msb zp ZP_BYTE:8 0.95
(byte) plex_sprite_msb#4 plex_sprite_msb zp ZP_BYTE:8 4.0
zp ZP_BOOL:2 [ framedone#12 framedone#19 framedone#5 framedone#3 ]
zp ZP_BYTE:3 [ loop::sin_idx#6 loop::sin_idx#1 ]
zp ZP_BYTE:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
reg byte x [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
reg byte y [ loop::sy#2 loop::sy#1 ]
zp ZP_BYTE:4 [ plexSort::m#2 plexSort::m#1 ]
zp ZP_BYTE:3 [ plexSort::m#2 plexSort::m#1 ]
reg byte x [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ]
reg byte x [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ]
reg byte x [ init::sx#2 init::sx#1 ]
zp ZP_WORD:5 [ init::xp#2 init::xp#1 ]
zp ZP_WORD:4 [ init::xp#2 init::xp#1 ]
reg byte x [ init::ss#2 init::ss#1 ]
reg byte x [ plexInit::i#2 plexInit::i#1 ]
zp ZP_BYTE:7 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 ]
zp ZP_BYTE:8 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ]
zp ZP_BYTE:9 [ plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
zp ZP_BYTE:10 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ]
zp ZP_BYTE:6 [ plex_sprite_idx#25 plex_sprite_idx#0 plexShowSprite::$7 plex_sprite_idx#1 ]
zp ZP_BYTE:7 [ plex_show_idx#27 plex_show_idx#0 plex_show_idx#16 plex_show_idx#1 ]
zp ZP_BYTE:8 [ plex_sprite_msb#29 plex_sprite_msb#0 plex_sprite_msb#17 plex_sprite_msb#27 plex_sprite_msb#4 plex_sprite_msb#1 ]
zp ZP_BYTE:9 [ plex_free_next#0 plex_free_next#27 plex_free_next#31 plexShowSprite::plexFreeAdd1_$2#0 ]
zp ZP_BOOL:10 [ framedone#3 framedone#12 framedone#19 framedone#5 ]
zp ZP_BYTE:11 [ plexSort::nxt_idx#0 ]
zp ZP_BYTE:12 [ plexSort::nxt_y#0 ]
reg byte x [ plexSort::s#2 ]
zp ZP_BYTE:13 [ plex_sprite_idx#1 ]
zp ZP_BYTE:14 [ plex_free_next#0 ]
reg byte a [ init::$7 ]
reg byte x [ plex_irq::plexFreeNextYpos1_return#0 ]
zp ZP_BYTE:15 [ plex_irq::$4 plexShowSprite::plex_sprite_idx2#0 ]
zp ZP_BYTE:13 [ plex_irq::$4 plexShowSprite::plex_sprite_idx2#0 ]
reg byte a [ plexShowSprite::plexFreeAdd1_ypos#0 ]
reg byte a [ plexShowSprite::plexFreeAdd1_$0#0 ]
reg byte x [ plexShowSprite::plexFreeAdd1_$1#0 ]

View File

@ -203,15 +203,11 @@ interrupt(KERNEL_MIN)(void()) irq()
Initial phi equivalence classes
[ col#14 col#0 col#1 ]
Added variable col#4 to zero page equivalence class [ col#4 ]
Added variable col#3 to zero page equivalence class [ col#3 ]
Coalescing volatile variable equivalence classes [ col#14 col#0 col#1 ] and [ col#3 ]
Coalescing volatile variable equivalence classes [ col#14 col#0 col#1 col#3 ] and [ col#4 ]
Complete equivalence classes
[ col#14 col#0 col#1 ]
[ col#4 ]
[ col#3 ]
Allocated zp ZP_BYTE:2 [ col#14 col#0 col#1 ]
Allocated zp ZP_BYTE:3 [ col#4 ]
Allocated zp ZP_BYTE:4 [ col#3 ]
[ col#14 col#0 col#1 col#3 col#4 ]
Allocated zp ZP_BYTE:2 [ col#14 col#0 col#1 col#3 col#4 ]
INITIAL ASM
//SEG0 File Comments
@ -225,8 +221,6 @@ INITIAL ASM
.label KERNEL_IRQ = $314
.label BGCOL = $d020
.label col = 2
.label col_3 = 4
.label col_4 = 3
//SEG3 @begin
bbegin:
//SEG4 [0] (byte) col#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
@ -291,11 +285,11 @@ irq: {
jmp b2
//SEG25 irq::@2
b2:
//SEG26 [11] (byte) col#4 ← (byte) col#0 + (byte/signed byte/word/signed word/dword/signed dword) 2 -- vbuz1=vbuz2_plus_2
//SEG26 [11] (byte) col#4 ← (byte) col#0 + (byte/signed byte/word/signed word/dword/signed dword) 2 -- vbuz1=vbuz1_plus_2
lda col
clc
adc #2
sta col_4
sta col
jmp breturn
//SEG27 irq::@return
breturn:
@ -303,10 +297,8 @@ irq: {
jmp $ea81
//SEG29 irq::@1
b1:
//SEG30 [13] (byte) col#3 ← ++ (byte) col#0 -- vbuz1=_inc_vbuz2
ldy col
iny
sty col_3
//SEG30 [13] (byte) col#3 ← ++ (byte) col#0 -- vbuz1=_inc_vbuz1
inc col
jmp breturn
}
@ -319,27 +311,18 @@ Statement asm { lda$dc0d } always clobbers reg byte a
Statement [9] *((const byte*) BGCOL#0) ← (byte) col#0 [ col#0 ] ( [ col#0 ] ) always clobbers reg byte a
Statement [10] if((byte) col#0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 [ col#0 ] ( [ col#0 ] ) always clobbers reg byte a
Statement [11] (byte) col#4 ← (byte) col#0 + (byte/signed byte/word/signed word/dword/signed dword) 2 [ ] ( [ ] ) always clobbers reg byte a
Statement [13] (byte) col#3 ← ++ (byte) col#0 [ ] ( [ ] ) always clobbers reg byte y
Potential registers zp ZP_BYTE:2 [ col#14 col#0 col#1 ] : zp ZP_BYTE:2 ,
Potential registers zp ZP_BYTE:3 [ col#4 ] : zp ZP_BYTE:3 ,
Potential registers zp ZP_BYTE:4 [ col#3 ] : zp ZP_BYTE:4 ,
Potential registers zp ZP_BYTE:2 [ col#14 col#0 col#1 col#3 col#4 ] : zp ZP_BYTE:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 138: zp ZP_BYTE:2 [ col#14 col#0 col#1 ] 20: zp ZP_BYTE:3 [ col#4 ] 20: zp ZP_BYTE:4 [ col#3 ]
Uplift Scope [] 178: zp ZP_BYTE:2 [ col#14 col#0 col#1 col#3 col#4 ]
Uplift Scope [main]
Uplift Scope [irq]
Uplifting [] best 1837 combination zp ZP_BYTE:2 [ col#14 col#0 col#1 ] zp ZP_BYTE:3 [ col#4 ] zp ZP_BYTE:4 [ col#3 ]
Uplifting [main] best 1837 combination
Uplifting [irq] best 1837 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ col#14 col#0 col#1 ]
Uplifting [] best 1837 combination zp ZP_BYTE:2 [ col#14 col#0 col#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ col#4 ]
Uplifting [] best 1837 combination zp ZP_BYTE:3 [ col#4 ]
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ col#3 ]
Uplifting [] best 1837 combination zp ZP_BYTE:4 [ col#3 ]
Coalescing zero page register with common assignment [ zp ZP_BYTE:2 [ col#14 col#0 col#1 ] ] with [ zp ZP_BYTE:3 [ col#4 ] ] - score: 1
Coalescing zero page register with common assignment [ zp ZP_BYTE:2 [ col#14 col#0 col#1 col#4 ] ] with [ zp ZP_BYTE:4 [ col#3 ] ] - score: 1
Uplifting [] best 1834 combination zp ZP_BYTE:2 [ col#14 col#0 col#1 col#3 col#4 ]
Uplifting [main] best 1834 combination
Uplifting [irq] best 1834 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ col#14 col#0 col#1 col#3 col#4 ]
Uplifting [] best 1834 combination zp ZP_BYTE:2 [ col#14 col#0 col#1 col#3 col#4 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
@ -495,7 +478,7 @@ interrupt(KERNEL_MIN)(void()) irq()
(label) main::@2
(label) main::@3
zp ZP_BYTE:2 [ col#14 col#0 col#1 col#4 col#3 ]
zp ZP_BYTE:2 [ col#14 col#0 col#1 col#3 col#4 ]
FINAL ASSEMBLER

View File

@ -20,4 +20,4 @@ interrupt(KERNEL_MIN)(void()) irq()
(label) main::@2
(label) main::@3
zp ZP_BYTE:2 [ col#14 col#0 col#1 col#4 col#3 ]
zp ZP_BYTE:2 [ col#14 col#0 col#1 col#3 col#4 ]