1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2026-04-24 06:24:14 +00:00

Fixed volatile support.

This commit is contained in:
jespergravgaard
2019-12-25 17:04:08 +01:00
parent 0c19d01afd
commit 23a91ef3d3
105 changed files with 7022 additions and 9826 deletions
@@ -225,9 +225,8 @@ public class VariableBuilder {
if(hasDirective(Directive.FormMa.class))
// the __ma directive forces multiple-assignment
return false;
else if(isNoModify())
// (volatile) no-modify variables must be load/store
// TODO: Change to isVolatile()!
else if(isVolatile())
// volatile variables must be load/store
return false;
else
// All others are single-static-assignment (by default)
@@ -265,9 +265,6 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
this.visitDeclTypes(ctx.declTypes());
String varName = ctx.NAME().getText();
VariableBuilder varBuilder = new VariableBuilder(varName, getCurrentScope(), true, declVarType, null, declVarDirectives, currentDataSegment);
// TODO: const parameter pointer should be no-modify!
//if(varBuilder.hasDirective(Directive.Const.class))
// throw new CompileError("Error! Const parameters not supported " + varName + " in " + getCurrentScope().getFullName() + "()");
Variable param = varBuilder.build();
exitDeclTypes();
return param;
@@ -37,7 +37,7 @@ public class Pass1EarlyConstantIdentification extends Pass1Base {
List<Statement> removeStmt = new ArrayList<>();
for(Variable variable : getProgram().getScope().getAllVariables(true)) {
SymbolVariableRef variableRef = variable.getRef();
if(!variable.isNoModify() && !variable.isAnyVolatile() && !variableRef.isIntermediate()) {
if(!variable.isKindConstant() && !variable.isAnyVolatile() && !variableRef.isIntermediate()) {
if(variable.getScope() instanceof StructDefinition)
// Skip structs
continue;
@@ -82,8 +82,8 @@ public class Pass1GenerateSingleStaticAssignmentForm extends Pass1Base {
private void versionAssignment(VariableRef lValueRef, ProgramValue programLValue, StatementSource source) {
Variable assignedVar = getScope().getVariable(lValueRef);
if(assignedVar.isKindPhiMaster()) {
if(assignedVar.isNoModify())
throw new InternalError("Error! Constants can not be versioned ", source);
if(assignedVar.isVolatile())
throw new InternalError("Error! Volatiles can not be versioned ", source);
Variable version = assignedVar.createVersion();
programLValue.set(version.getRef());
}
@@ -157,7 +157,7 @@ public class Pass1GenerateSingleStaticAssignmentForm extends Pass1Base {
if(rValueVar.isKindPhiMaster()) {
// rValue needs versioning - look for version in statements
Variable rSymbol = rValueVar;
if(rSymbol.isNoModify()) {
if(rSymbol.isKindConstant()) {
// A constant - find the single created version
Scope scope = rSymbol.getScope();
Collection<Variable> versions = scope.getVersions(rSymbol);
@@ -4,7 +4,10 @@ import dk.camelot64.kickc.model.CompileError;
import dk.camelot64.kickc.model.Program;
import dk.camelot64.kickc.model.iterator.ProgramValueIterator;
import dk.camelot64.kickc.model.symbols.*;
import dk.camelot64.kickc.model.values.*;
import dk.camelot64.kickc.model.values.LabelRef;
import dk.camelot64.kickc.model.values.SymbolRef;
import dk.camelot64.kickc.model.values.SymbolVariableRef;
import dk.camelot64.kickc.model.values.Value;
import java.util.ArrayList;
import java.util.Collection;
@@ -70,12 +73,7 @@ public class Pass1UnwindBlockScopes extends Pass1Base {
}
} else if(symbol instanceof Variable) {
Variable variable = (Variable) symbol;
if(variable.isKindConstant()) {
String name = findLocalName(procedure, symbol);
Variable unwound = Variable.createCopy(name, procedure, (Variable) symbol);
procedure.add(unwound);
unwoundSymbols.put(symbol.getRef(), unwound.getRef());
} else if(variable.isKindPhiMaster() || variable.isKindConstant()) {
if(variable.isKindPhiMaster() || variable.isKindConstant() || variable.isKindLoadStore()) {
String name = findLocalName(procedure, symbol);
Variable unwound = Variable.createCopy(name, procedure, (Variable) symbol);
procedure.add(unwound);
@@ -2524,11 +2524,6 @@ public class TestPrograms {
compileAndCompare("const-word-pointer");
}
@Test
public void testConstParam1() throws IOException, URISyntaxException {
assertError("const-param-1", "Error! Const parameters not supported", false);
}
@Test
public void testConstParam() throws IOException, URISyntaxException {
compileAndCompare("const-param");
-17
View File
@@ -1,17 +0,0 @@
void main() {
char *maze = 0xa000;
word width=40;
word height=25;
ShowMaze(maze, width, height);
}
const char* SCREEN = 0x0400;
void ShowMaze(const char *maze, word width, word height) {
char* s = SCREEN;
char* m = maze;
for( word i=0;i<width-1; i++)
for( word j=0;j<width-1; j++)
*s++ = *m++;
}
+7 -8
View File
@@ -2,7 +2,7 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) frame_cnt#0 ← (byte) 1
[1] (byte) frame_cnt ← (byte) 1
to:@2
@2: scope:[] from @1
[2] phi()
@@ -64,7 +64,7 @@ main::@6: scope:[main] from main::@12 main::@3
to:main::@4
main::@4: scope:[main] from main::@12 main::@6
[26] (byte) main::vy#8 ← phi( main::@12/(byte) main::vy#2 main::@6/(byte) main::vy#1 )
[27] *((const byte*) plots_per_frame + (byte) frame_cnt#0) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt#0)
[27] *((const byte*) plots_per_frame + (byte) frame_cnt) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt)
to:main::@1
(void()) bitmap_plot((word) bitmap_plot::x , (byte) bitmap_plot::y)
@@ -176,16 +176,15 @@ bitmap_init::@return: scope:[bitmap_init] from bitmap_init::@4
interrupt(HARDWARE_CLOBBER)(void()) irq()
irq: scope:[irq] from
[80] *((const byte*) BGCOL) ← (const byte) WHITE
[81] if((byte) 0==(byte) frame_cnt#0) goto irq::@1
[81] if((byte) 0==(byte) frame_cnt) goto irq::@1
to:irq::@2
irq::@2: scope:[irq] from irq
[82] (byte) frame_cnt#1 ← ++ (byte) frame_cnt#0
[82] (byte) frame_cnt ← ++ (byte) frame_cnt
to:irq::@1
irq::@1: scope:[irq] from irq irq::@2
[83] (byte) frame_cnt#10 ← phi( irq/(byte) frame_cnt#0 irq::@2/(byte) frame_cnt#1 )
[84] *((const byte*) BGCOL) ← (const byte) BLACK
[85] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[83] *((const byte*) BGCOL) ← (const byte) BLACK
[84] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
to:irq::@return
irq::@return: scope:[irq] from irq::@1
[86] return
[85] return
to:@return
+133 -209
View File
@@ -220,7 +220,6 @@ bitmap_plot::@return: scope:[bitmap_plot] from bitmap_plot
(void()) main()
main: scope:[main] from @17
(byte) frame_cnt#21 ← phi( @17/(byte) frame_cnt#9 )
(byte*) bitmap_screen#12 ← phi( @17/(byte*) bitmap_screen#14 )
(byte*) bitmap_gfx#13 ← phi( @17/(byte*) bitmap_gfx#15 )
(byte*) bitmap_init::gfx#0 ← (const byte*) BITMAP
@@ -228,7 +227,6 @@ main: scope:[main] from @17
call bitmap_init
to:main::@12
main::@12: scope:[main] from main
(byte) frame_cnt#20 ← phi( main/(byte) frame_cnt#21 )
(byte*) bitmap_screen#8 ← phi( main/(byte*) bitmap_screen#2 )
(byte*) bitmap_gfx#8 ← phi( main/(byte*) bitmap_gfx#2 )
(byte*) bitmap_gfx#3 ← (byte*) bitmap_gfx#8
@@ -238,7 +236,6 @@ main::@12: scope:[main] from main
call bitmap_clear
to:main::@13
main::@13: scope:[main] from main::@12
(byte) frame_cnt#19 ← phi( main::@12/(byte) frame_cnt#20 )
(byte*) bitmap_screen#32 ← phi( main::@12/(byte*) bitmap_screen#3 )
(byte*) bitmap_gfx#33 ← phi( main::@12/(byte*) bitmap_gfx#3 )
*((const byte*) D011) ← (const byte) VIC_BMM|(const byte) VIC_DEN|(const byte) VIC_RSEL|(number) 3
@@ -246,7 +243,6 @@ main::@13: scope:[main] from main::@12
(byte*) main::toD0181_gfx#0 ← (const byte*) BITMAP
to:main::toD0181
main::toD0181: scope:[main] from main::@13
(byte) frame_cnt#18 ← phi( main::@13/(byte) frame_cnt#19 )
(byte*) bitmap_screen#30 ← phi( main::@13/(byte*) bitmap_screen#32 )
(byte*) bitmap_gfx#31 ← phi( main::@13/(byte*) bitmap_gfx#33 )
(byte*) main::toD0181_gfx#1 ← phi( main::@13/(byte*) main::toD0181_gfx#0 )
@@ -263,14 +259,12 @@ main::toD0181: scope:[main] from main::@13
(byte) main::toD0181_return#0 ← (number~) main::toD0181_$8
to:main::toD0181_@return
main::toD0181_@return: scope:[main] from main::toD0181
(byte) frame_cnt#17 ← phi( main::toD0181/(byte) frame_cnt#18 )
(byte*) bitmap_screen#25 ← phi( main::toD0181/(byte*) bitmap_screen#30 )
(byte*) bitmap_gfx#26 ← phi( main::toD0181/(byte*) bitmap_gfx#31 )
(byte) main::toD0181_return#2 ← phi( main::toD0181/(byte) main::toD0181_return#0 )
(byte) main::toD0181_return#1 ← (byte) main::toD0181_return#2
to:main::@11
main::@11: scope:[main] from main::toD0181_@return
(byte) frame_cnt#16 ← phi( main::toD0181_@return/(byte) frame_cnt#17 )
(byte*) bitmap_screen#21 ← phi( main::toD0181_@return/(byte*) bitmap_screen#25 )
(byte*) bitmap_gfx#22 ← phi( main::toD0181_@return/(byte*) bitmap_gfx#26 )
(byte) main::toD0181_return#3 ← phi( main::toD0181_@return/(byte) main::toD0181_return#1 )
@@ -279,7 +273,6 @@ main::@11: scope:[main] from main::toD0181_@return
call init_irq
to:main::@14
main::@14: scope:[main] from main::@11
(byte) frame_cnt#15 ← phi( main::@11/(byte) frame_cnt#16 )
(byte*) bitmap_screen#17 ← phi( main::@11/(byte*) bitmap_screen#21 )
(byte*) bitmap_gfx#18 ← phi( main::@11/(byte*) bitmap_gfx#22 )
(word) main::x#0 ← (number) 0
@@ -288,7 +281,6 @@ main::@14: scope:[main] from main::@11
(byte) main::vy#0 ← (number) 1
to:main::@1
main::@1: scope:[main] from main::@14 main::@5
(byte) frame_cnt#14 ← phi( main::@14/(byte) frame_cnt#15 main::@5/(byte) frame_cnt#3 )
(byte) main::vy#6 ← phi( main::@14/(byte) main::vy#0 main::@5/(byte) main::vy#8 )
(word) main::vx#5 ← phi( main::@14/(word) main::vx#0 main::@5/(word) main::vx#6 )
(byte*) bitmap_screen#13 ← phi( main::@14/(byte*) bitmap_screen#17 main::@5/(byte*) bitmap_screen#18 )
@@ -300,7 +292,6 @@ main::@1: scope:[main] from main::@14 main::@5
main::@2: scope:[main] from main::@1
(byte*) bitmap_screen#31 ← phi( main::@1/(byte*) bitmap_screen#13 )
(byte*) bitmap_gfx#32 ← phi( main::@1/(byte*) bitmap_gfx#14 )
(byte) frame_cnt#13 ← phi( main::@1/(byte) frame_cnt#14 )
(byte) main::vy#4 ← phi( main::@1/(byte) main::vy#6 )
(word) main::vx#4 ← phi( main::@1/(word) main::vx#5 )
(byte) main::y#2 ← phi( main::@1/(byte) main::y#5 )
@@ -312,7 +303,6 @@ main::@2: scope:[main] from main::@1
main::@15: scope:[main] from main::@2
(byte*) bitmap_screen#26 ← phi( main::@2/(byte*) bitmap_screen#31 )
(byte*) bitmap_gfx#27 ← phi( main::@2/(byte*) bitmap_gfx#32 )
(byte) frame_cnt#11 ← phi( main::@2/(byte) frame_cnt#13 )
(byte) main::vy#2 ← phi( main::@2/(byte) main::vy#4 )
(byte) main::y#3 ← phi( main::@2/(byte) main::y#2 )
(word) main::vx#2 ← phi( main::@2/(word) main::vx#4 )
@@ -331,7 +321,6 @@ main::@4: scope:[main] from main::@15 main::@8
(byte*) bitmap_gfx#23 ← phi( main::@15/(byte*) bitmap_gfx#27 main::@8/(byte*) bitmap_gfx#28 )
(word) main::x#6 ← phi( main::@15/(word) main::x#1 main::@8/(word) main::x#8 )
(byte) main::vy#5 ← phi( main::@15/(byte) main::vy#2 main::@8/(byte) main::vy#7 )
(byte) frame_cnt#7 ← phi( main::@15/(byte) frame_cnt#11 main::@8/(byte) frame_cnt#12 )
(byte) main::y#4 ← phi( main::@15/(byte) main::y#1 main::@8/(byte) main::y#6 )
(bool~) main::$10 ← (byte) main::y#4 == (number) $c7
(bool~) main::$11 ← (byte) main::y#4 == (number) 0
@@ -344,7 +333,6 @@ main::@8: scope:[main] from main::@15
(byte*) bitmap_gfx#28 ← phi( main::@15/(byte*) bitmap_gfx#27 )
(word) main::x#8 ← phi( main::@15/(word) main::x#1 )
(byte) main::vy#7 ← phi( main::@15/(byte) main::vy#2 )
(byte) frame_cnt#12 ← phi( main::@15/(byte) frame_cnt#11 )
(byte) main::y#6 ← phi( main::@15/(byte) main::y#1 )
(word) main::vx#3 ← phi( main::@15/(word) main::vx#2 )
(word~) main::$9 ← - (word) main::vx#3
@@ -357,8 +345,7 @@ main::@5: scope:[main] from main::@4 main::@9
(byte*) bitmap_gfx#19 ← phi( main::@4/(byte*) bitmap_gfx#23 main::@9/(byte*) bitmap_gfx#24 )
(byte) main::y#7 ← phi( main::@4/(byte) main::y#4 main::@9/(byte) main::y#8 )
(word) main::x#5 ← phi( main::@4/(word) main::x#6 main::@9/(word) main::x#7 )
(byte) frame_cnt#3phi( main::@4/(byte) frame_cnt#7 main::@9/(byte) frame_cnt#8 )
*((const byte*) plots_per_frame + (byte) frame_cnt#3) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt#3)
*((const byte*) plots_per_frame + (byte) frame_cnt)++ *((const byte*) plots_per_frame + (byte) frame_cnt)
to:main::@1
main::@9: scope:[main] from main::@4
(word) main::vx#8 ← phi( main::@4/(word) main::vx#7 )
@@ -366,7 +353,6 @@ main::@9: scope:[main] from main::@4
(byte*) bitmap_gfx#24 ← phi( main::@4/(byte*) bitmap_gfx#23 )
(byte) main::y#8 ← phi( main::@4/(byte) main::y#4 )
(word) main::x#7 ← phi( main::@4/(word) main::x#6 )
(byte) frame_cnt#8 ← phi( main::@4/(byte) frame_cnt#7 )
(byte) main::vy#3 ← phi( main::@4/(byte) main::vy#5 )
(byte~) main::$14 ← - (byte) main::vy#3
(byte) main::vy#1 ← (byte~) main::$14
@@ -381,7 +367,7 @@ main::@return: scope:[main] from main::@1
@15: scope:[] from @8
(byte*) bitmap_screen#19 ← phi( @8/(byte*) bitmap_screen#0 )
(byte*) bitmap_gfx#20 ← phi( @8/(byte*) bitmap_gfx#0 )
(byte) frame_cnt#0 ← (number) 1
(byte) frame_cnt ← (number) 1
to:@17
(void()) init_irq()
@@ -402,30 +388,24 @@ init_irq::@return: scope:[init_irq] from init_irq
interrupt(HARDWARE_CLOBBER)(void()) irq()
irq: scope:[irq] from
(byte) frame_cnt#4 ← phi( @17/(byte) frame_cnt#9 )
*((const byte*) BGCOL) ← (const byte) WHITE
(bool~) irq::$1 ← (number) 0 != (byte) frame_cnt#4
(bool~) irq::$1 ← (number) 0 != (byte) frame_cnt
(bool~) irq::$0 ← ! (bool~) irq::$1
if((bool~) irq::$0) goto irq::@1
to:irq::@2
irq::@1: scope:[irq] from irq irq::@2
(byte) frame_cnt#10 ← phi( irq/(byte) frame_cnt#4 irq::@2/(byte) frame_cnt#1 )
*((const byte*) BGCOL) ← (const byte) BLACK
*((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
to:irq::@return
irq::@2: scope:[irq] from irq
(byte) frame_cnt#5phi( irq/(byte) frame_cnt#4 )
(byte) frame_cnt#1 ← ++ (byte) frame_cnt#5
(byte) frame_cnt ← ++ (byte) frame_cnt
to:irq::@1
irq::@return: scope:[irq] from irq::@1
(byte) frame_cnt#6 ← phi( irq::@1/(byte) frame_cnt#10 )
(byte) frame_cnt#2 ← (byte) frame_cnt#6
return
to:@return
@17: scope:[] from @15
(byte*) bitmap_screen#14 ← phi( @15/(byte*) bitmap_screen#19 )
(byte*) bitmap_gfx#15 ← phi( @15/(byte*) bitmap_gfx#20 )
(byte) frame_cnt#9 ← phi( @15/(byte) frame_cnt#0 )
call main
to:@18
@18: scope:[] from @17
@@ -620,29 +600,7 @@ SYMBOL TABLE SSA
(byte*) bitmap_screen#7
(byte*) bitmap_screen#8
(byte*) bitmap_screen#9
(byte) frame_cnt
(byte) frame_cnt#0
(byte) frame_cnt#1
(byte) frame_cnt#10
(byte) frame_cnt#11
(byte) frame_cnt#12
(byte) frame_cnt#13
(byte) frame_cnt#14
(byte) frame_cnt#15
(byte) frame_cnt#16
(byte) frame_cnt#17
(byte) frame_cnt#18
(byte) frame_cnt#19
(byte) frame_cnt#2
(byte) frame_cnt#20
(byte) frame_cnt#21
(byte) frame_cnt#3
(byte) frame_cnt#4
(byte) frame_cnt#5
(byte) frame_cnt#6
(byte) frame_cnt#7
(byte) frame_cnt#8
(byte) frame_cnt#9
(byte) frame_cnt loadstore
(void()) init_irq()
(label) init_irq::@return
interrupt(HARDWARE_CLOBBER)(void()) irq()
@@ -825,10 +783,10 @@ Adding number conversion cast (unumber) $13f in (bool~) main::$5 ← (word) main
Adding number conversion cast (unumber) 0 in (bool~) main::$6 ← (word) main::x#1 == (number) 0
Adding number conversion cast (unumber) $c7 in (bool~) main::$10 ← (byte) main::y#4 == (number) $c7
Adding number conversion cast (unumber) 0 in (bool~) main::$11 ← (byte) main::y#4 == (number) 0
Adding number conversion cast (unumber) 1 in (byte) frame_cnt#0 ← (number) 1
Adding number conversion cast (unumber) 1 in (byte) frame_cnt ← (number) 1
Adding number conversion cast (unumber) $80 in *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) | (number) $80
Adding number conversion cast (unumber) 0 in *((const byte*) RASTER) ← (number) 0
Adding number conversion cast (unumber) 0 in (bool~) irq::$1 ← (number) 0 != (byte) frame_cnt#4
Adding number conversion cast (unumber) 0 in (bool~) irq::$1 ← (number) 0 != (byte) frame_cnt
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte*~) memset::$2 ← (byte*)(void*) memset::str#3
Inlining cast (byte*) memset::dst#0 ← (byte*)(void*) memset::str#3
@@ -842,7 +800,7 @@ Inlining cast (word) main::x#0 ← (unumber)(number) 0
Inlining cast (byte) main::y#0 ← (unumber)(number) 0
Inlining cast (word) main::vx#0 ← (unumber)(number) 1
Inlining cast (byte) main::vy#0 ← (unumber)(number) 1
Inlining cast (byte) frame_cnt#0 ← (unumber)(number) 1
Inlining cast (byte) frame_cnt ← (unumber)(number) 1
Inlining cast *((const byte*) RASTER) ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 0
@@ -936,7 +894,7 @@ Successful SSA optimization PassNAddTypeConversionAssignment
Inversing boolean not [2] (bool~) memset::$1 ← (word) memset::num#2 <= (byte) 0 from [1] (bool~) memset::$0 ← (word) memset::num#2 > (byte) 0
Inversing boolean not [31] (bool~) bitmap_init::$1 ← (byte) bitmap_init::bits#1 != (byte) 0 from [30] (bool~) bitmap_init::$0 ← (byte) bitmap_init::bits#1 == (byte) 0
Inversing boolean not [51] (bool~) bitmap_init::$9 ← (byte~) bitmap_init::$7 != (byte) 7 from [50] (bool~) bitmap_init::$8 ← (byte~) bitmap_init::$7 == (byte) 7
Inversing boolean not [172] (bool~) irq::$0 ← (byte) 0 == (byte) frame_cnt#4 from [171] (bool~) irq::$1 ← (byte) 0 != (byte) frame_cnt#4
Inversing boolean not [171] (bool~) irq::$0 ← (byte) 0 == (byte) frame_cnt from [170] (bool~) irq::$1 ← (byte) 0 != (byte) frame_cnt
Successful SSA optimization Pass2UnaryNotSimplification
Alias (void*) memset::return#0 = (void*) memset::str#2 (void*) memset::return#4 (void*) memset::return#1
Alias (void*) memset::str#3 = (void*) memset::str#4
@@ -964,7 +922,6 @@ Alias (byte*) bitmap_screen#11 = (byte*) bitmap_screen#6 (byte*) bitmap_screen#2
Alias (byte) bitmap_clear::col#0 = (byte~) bitmap_clear::$1
Alias (byte*) bitmap_gfx#12 = (byte*) bitmap_gfx#7
Alias (byte*) bitmap_plot::plotter#0 = (byte*~) bitmap_plot::$0
Alias (byte) frame_cnt#15 = (byte) frame_cnt#20 (byte) frame_cnt#21 (byte) frame_cnt#19 (byte) frame_cnt#18 (byte) frame_cnt#17 (byte) frame_cnt#16
Alias (byte*) bitmap_gfx#18 = (byte*) bitmap_gfx#3 (byte*) bitmap_gfx#8 (byte*) bitmap_gfx#33 (byte*) bitmap_gfx#31 (byte*) bitmap_gfx#26 (byte*) bitmap_gfx#22
Alias (byte*) bitmap_screen#17 = (byte*) bitmap_screen#3 (byte*) bitmap_screen#8 (byte*) bitmap_screen#32 (byte*) bitmap_screen#30 (byte*) bitmap_screen#25 (byte*) bitmap_screen#21
Alias (byte*) main::toD0181_screen#0 = (byte*) main::toD0181_screen#1
@@ -974,14 +931,12 @@ Alias (word) main::x#2 = (word) main::x#4 (word) main::x#3
Alias (byte) main::y#2 = (byte) main::y#5 (byte) main::y#3
Alias (word) main::vx#2 = (word) main::vx#4 (word) main::vx#5 (word) main::vx#3
Alias (byte) main::vy#2 = (byte) main::vy#4 (byte) main::vy#6 (byte) main::vy#7
Alias (byte) frame_cnt#11 = (byte) frame_cnt#13 (byte) frame_cnt#14 (byte) frame_cnt#12
Alias (byte*) bitmap_gfx#14 = (byte*) bitmap_gfx#32 (byte*) bitmap_gfx#27 (byte*) bitmap_gfx#28 (byte*) bitmap_gfx#9 (byte*) bitmap_gfx#4
Alias (byte*) bitmap_screen#13 = (byte*) bitmap_screen#31 (byte*) bitmap_screen#26 (byte*) bitmap_screen#27 (byte*) bitmap_screen#9 (byte*) bitmap_screen#4
Alias (byte) main::y#1 = (byte) main::y#6
Alias (word) main::x#1 = (word) main::x#8
Alias (word) main::vx#1 = (word~) main::$9
Alias (byte) main::vy#3 = (byte) main::vy#5
Alias (byte) frame_cnt#7 = (byte) frame_cnt#8
Alias (word) main::x#6 = (word) main::x#7
Alias (byte) main::y#4 = (byte) main::y#8
Alias (byte*) bitmap_gfx#23 = (byte*) bitmap_gfx#24
@@ -990,9 +945,6 @@ Alias (word) main::vx#7 = (word) main::vx#8
Alias (byte) main::vy#1 = (byte~) main::$14
Alias (byte*) bitmap_gfx#0 = (byte*) bitmap_gfx#20 (byte*) bitmap_gfx#15
Alias (byte*) bitmap_screen#0 = (byte*) bitmap_screen#19 (byte*) bitmap_screen#14
Alias (byte) frame_cnt#4 = (byte) frame_cnt#5
Alias (byte) frame_cnt#10 = (byte) frame_cnt#6 (byte) frame_cnt#2
Alias (byte) frame_cnt#0 = (byte) frame_cnt#9
Alias (byte*) bitmap_gfx#10 = (byte*) bitmap_gfx#5
Alias (byte*) bitmap_screen#10 = (byte*) bitmap_screen#5
Successful SSA optimization Pass2AliasElimination
@@ -1004,7 +956,6 @@ Alias (byte) bitmap_init::y#2 = (byte) bitmap_init::y#3
Alias (byte*) bitmap_gfx#11 = (byte*) bitmap_gfx#16
Alias (byte*) bitmap_screen#11 = (byte*) bitmap_screen#15
Alias (byte) main::y#1 = (byte) main::y#4 (byte) main::y#7
Alias (byte) frame_cnt#11 = (byte) frame_cnt#7 (byte) frame_cnt#3
Alias (byte) main::vy#2 = (byte) main::vy#3
Alias (word) main::x#1 = (word) main::x#6 (word) main::x#5
Alias (byte*) bitmap_gfx#14 = (byte*) bitmap_gfx#23 (byte*) bitmap_gfx#19
@@ -1029,13 +980,10 @@ Identical Phi Values (byte) bitmap_plot::y#1 (byte) bitmap_plot::y#0
Identical Phi Values (word) bitmap_plot::x#1 (word) bitmap_plot::x#0
Identical Phi Values (byte*) bitmap_gfx#13 (byte*) bitmap_gfx#0
Identical Phi Values (byte*) bitmap_screen#12 (byte*) bitmap_screen#0
Identical Phi Values (byte) frame_cnt#15 (byte) frame_cnt#0
Identical Phi Values (byte*) bitmap_gfx#18 (byte*) bitmap_gfx#11
Identical Phi Values (byte*) bitmap_screen#17 (byte*) bitmap_screen#11
Identical Phi Values (byte*) bitmap_gfx#14 (byte*) bitmap_gfx#18
Identical Phi Values (byte*) bitmap_screen#13 (byte*) bitmap_screen#17
Identical Phi Values (byte) frame_cnt#11 (byte) frame_cnt#15
Identical Phi Values (byte) frame_cnt#4 (byte) frame_cnt#0
Identical Phi Values (byte*) bitmap_gfx#10 (byte*) bitmap_gfx#14
Identical Phi Values (byte*) bitmap_screen#10 (byte*) bitmap_screen#13
Successful SSA optimization Pass2IdenticalPhiElimination
@@ -1049,7 +997,7 @@ Simple Condition (bool~) bitmap_init::$1 [32] if((byte) bitmap_init::bits#1!=(by
Simple Condition (bool~) bitmap_init::$2 [36] if((byte) bitmap_init::x#1!=rangelast(0,$ff)) goto bitmap_init::@1
Simple Condition (bool~) bitmap_init::$9 [52] if((byte~) bitmap_init::$7!=(byte) 7) goto bitmap_init::@6
Simple Condition (bool~) bitmap_init::$11 [56] if((byte) bitmap_init::y#1!=rangelast(0,$ff)) goto bitmap_init::@5
Simple Condition (bool~) irq::$0 [173] if((byte) 0==(byte) frame_cnt#0) goto irq::@1
Simple Condition (bool~) irq::$0 [172] if((byte) 0==(byte) frame_cnt) goto irq::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Rewriting ! if()-condition to reversed if() [137] (bool~) main::$8 ← ! (bool~) main::$7
Rewriting || if()-condition to two if()s [136] (bool~) main::$7 ← (bool~) main::$5 || (bool~) main::$6
@@ -1116,11 +1064,11 @@ Alias (byte) bitmap_clear::col#0 = (byte~) bitmap_clear::$0
Successful SSA optimization Pass2AliasElimination
Simple Condition (bool~) main::$5 [64] if((word) main::x#1==(word) $13f) goto main::@8
Simple Condition (bool~) main::$10 [68] if((byte) main::y#1==(byte) $c7) goto main::@9
Simple Condition (bool~) main::$6 [92] if((word) main::x#1==(byte) 0) goto main::@8
Simple Condition (bool~) main::$11 [93] if((byte) main::y#1==(byte) 0) goto main::@9
Simple Condition (bool~) main::$6 [91] if((word) main::x#1==(byte) 0) goto main::@8
Simple Condition (bool~) main::$11 [92] if((byte) main::y#1==(byte) 0) goto main::@9
Successful SSA optimization Pass2ConditionalJumpSimplification
Negating conditional jump and destination [92] if((word) main::x#1!=(byte) 0) goto main::@4
Negating conditional jump and destination [93] if((byte) main::y#1!=(byte) 0) goto main::@5
Negating conditional jump and destination [91] if((word) main::x#1!=(byte) 0) goto main::@4
Negating conditional jump and destination [92] if((byte) main::y#1!=(byte) 0) goto main::@5
Successful SSA optimization Pass2ConditionalJumpSequenceImprovement
Constant right-side identified [31] (byte) bitmap_clear::col#0 ← (const byte) bitmap_clear::fgcol#0 * (byte) $10
Constant right-side identified [47] (word~) main::toD0181_$1 ← (const word) main::toD0181_$0 & (word) $3fff
@@ -1203,7 +1151,6 @@ Added new block during phi lifting bitmap_init::@11(between bitmap_init::@6 and
Added new block during phi lifting bitmap_init::@12(between bitmap_init::@5 and bitmap_init::@6)
Added new block during phi lifting main::@18(between main::@16 and main::@4)
Added new block during phi lifting main::@19(between main::@17 and main::@5)
Added new block during phi lifting irq::@3(between irq and irq::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @8
Adding NOP phi() at start of @17
@@ -1226,7 +1173,7 @@ Calls in [] to main:4
Calls in [main] to bitmap_init:8 bitmap_clear:10 init_irq:15 bitmap_plot:20
Calls in [bitmap_clear] to memset:57 memset:59
Created 17 initial phi equivalence classes
Created 16 initial phi equivalence classes
Coalesced [26] main::vx#11 ← main::vx#1
Coalesced [31] main::vy#11 ← main::vy#1
Coalesced [34] main::x#9 ← main::x#1
@@ -1243,9 +1190,7 @@ Coalesced (already) [99] bitmap_init::yoffs#6 ← bitmap_init::yoffs#2
Coalesced [100] bitmap_init::bits#5 ← bitmap_init::bits#4
Coalesced [101] bitmap_init::x#5 ← bitmap_init::x#1
Coalesced [102] bitmap_init::bits#6 ← bitmap_init::bits#1
Coalesced [106] frame_cnt#23 ← frame_cnt#1
Coalesced [111] frame_cnt#22 ← frame_cnt#0
Coalesced down to 13 phi equivalence classes
Coalesced down to 12 phi equivalence classes
Culled Empty Block (label) @8
Culled Empty Block (label) @18
Culled Empty Block (label) main::toD0181_@return
@@ -1259,7 +1204,6 @@ Culled Empty Block (label) bitmap_init::@4
Culled Empty Block (label) bitmap_init::@11
Culled Empty Block (label) bitmap_init::@12
Culled Empty Block (label) bitmap_init::@9
Culled Empty Block (label) irq::@3
Renumbering block @15 to @1
Renumbering block @17 to @2
Renumbering block memset::@2 to memset::@1
@@ -1295,7 +1239,7 @@ FINAL CONTROL FLOW GRAPH
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) frame_cnt#0 ← (byte) 1
[1] (byte) frame_cnt ← (byte) 1
to:@2
@2: scope:[] from @1
[2] phi()
@@ -1357,7 +1301,7 @@ main::@6: scope:[main] from main::@12 main::@3
to:main::@4
main::@4: scope:[main] from main::@12 main::@6
[26] (byte) main::vy#8 ← phi( main::@12/(byte) main::vy#2 main::@6/(byte) main::vy#1 )
[27] *((const byte*) plots_per_frame + (byte) frame_cnt#0) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt#0)
[27] *((const byte*) plots_per_frame + (byte) frame_cnt) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt)
to:main::@1
(void()) bitmap_plot((word) bitmap_plot::x , (byte) bitmap_plot::y)
@@ -1469,18 +1413,17 @@ bitmap_init::@return: scope:[bitmap_init] from bitmap_init::@4
interrupt(HARDWARE_CLOBBER)(void()) irq()
irq: scope:[irq] from
[80] *((const byte*) BGCOL) ← (const byte) WHITE
[81] if((byte) 0==(byte) frame_cnt#0) goto irq::@1
[81] if((byte) 0==(byte) frame_cnt) goto irq::@1
to:irq::@2
irq::@2: scope:[irq] from irq
[82] (byte) frame_cnt#1 ← ++ (byte) frame_cnt#0
[82] (byte) frame_cnt ← ++ (byte) frame_cnt
to:irq::@1
irq::@1: scope:[irq] from irq irq::@2
[83] (byte) frame_cnt#10 ← phi( irq/(byte) frame_cnt#0 irq::@2/(byte) frame_cnt#1 )
[84] *((const byte*) BGCOL) ← (const byte) BLACK
[85] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[83] *((const byte*) BGCOL) ← (const byte) BLACK
[84] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
to:irq::@return
irq::@return: scope:[irq] from irq::@1
[86] return
[85] return
to:@return
@@ -1522,10 +1465,7 @@ VARIABLE REGISTER WEIGHTS
(byte) bitmap_plot::y
(byte) bitmap_plot::y#0 15.0
(byte*) bitmap_screen
(byte) frame_cnt
(byte) frame_cnt#0 1.1111111111111112
(byte) frame_cnt#1 4.0
(byte) frame_cnt#10 40.0
(byte) frame_cnt loadstore 1.1538461538461537
(void()) init_irq()
interrupt(HARDWARE_CLOBBER)(void()) irq()
(void()) main()
@@ -1574,7 +1514,7 @@ Initial phi equivalence classes
[ bitmap_init::x#2 bitmap_init::x#1 ]
[ bitmap_init::y#2 bitmap_init::y#1 ]
[ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ]
[ frame_cnt#10 frame_cnt#0 frame_cnt#1 ]
Added variable frame_cnt to live range equivalence class [ frame_cnt ]
Added variable bitmap_plot::x#0 to live range equivalence class [ bitmap_plot::x#0 ]
Added variable bitmap_plot::y#0 to live range equivalence class [ bitmap_plot::y#0 ]
Added variable bitmap_plot::plotter#0 to live range equivalence class [ bitmap_plot::plotter#0 ]
@@ -1599,7 +1539,7 @@ Complete equivalence classes
[ bitmap_init::x#2 bitmap_init::x#1 ]
[ bitmap_init::y#2 bitmap_init::y#1 ]
[ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ]
[ frame_cnt#10 frame_cnt#0 frame_cnt#1 ]
[ frame_cnt ]
[ bitmap_plot::x#0 ]
[ bitmap_plot::y#0 ]
[ bitmap_plot::plotter#0 ]
@@ -1623,7 +1563,7 @@ Allocated zp[1]:15 [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1
Allocated zp[1]:16 [ bitmap_init::x#2 bitmap_init::x#1 ]
Allocated zp[1]:17 [ bitmap_init::y#2 bitmap_init::y#1 ]
Allocated zp[2]:18 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ]
Allocated zp[1]:20 [ frame_cnt#10 frame_cnt#0 frame_cnt#1 ]
Allocated zp[1]:20 [ frame_cnt ]
Allocated zp[2]:21 [ bitmap_plot::x#0 ]
Allocated zp[1]:23 [ bitmap_plot::y#0 ]
Allocated zp[2]:24 [ bitmap_plot::plotter#0 ]
@@ -1685,7 +1625,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte) frame_cnt#0 ← (byte) 1 -- vbuz1=vbuc1
// [1] (byte) frame_cnt ← (byte) 1 -- vbuz1=vbuc1
// Counts frames - updated by the IRQ
lda #1
sta.z frame_cnt
@@ -1853,7 +1793,7 @@ main: {
jmp __b4
// main::@4
__b4:
// [27] *((const byte*) plots_per_frame + (byte) frame_cnt#0) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt#0) -- pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
// [27] *((const byte*) plots_per_frame + (byte) frame_cnt) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt) -- pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
ldx.z frame_cnt
inc plots_per_frame,x
// [13] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
@@ -2211,33 +2151,29 @@ irq: {
// [80] *((const byte*) BGCOL) ← (const byte) WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
sta BGCOL
// [81] if((byte) 0==(byte) frame_cnt#0) goto irq::@1 -- vbuc1_eq_vbuz1_then_la1
// [81] if((byte) 0==(byte) frame_cnt) goto irq::@1 -- vbuc1_eq_vbuz1_then_la1
lda #0
cmp.z frame_cnt
beq __b1_from_irq
beq __b1
jmp __b2
// irq::@2
__b2:
// [82] (byte) frame_cnt#1 ← ++ (byte) frame_cnt#0 -- vbuz1=_inc_vbuz1
// [82] (byte) frame_cnt ← ++ (byte) frame_cnt -- vbuz1=_inc_vbuz1
inc.z frame_cnt
// [83] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
__b1_from_irq:
__b1_from___b2:
// [83] phi (byte) frame_cnt#10 = (byte) frame_cnt#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy
jmp __b1
// irq::@1
__b1:
// [84] *((const byte*) BGCOL) ← (const byte) BLACK -- _deref_pbuc1=vbuc2
// [83] *((const byte*) BGCOL) ← (const byte) BLACK -- _deref_pbuc1=vbuc2
lda #BLACK
sta BGCOL
// [85] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// [84] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// Acknowledge the IRQ
lda #IRQ_RASTER
sta IRQ_STATUS
jmp __breturn
// irq::@return
__breturn:
// [86] return - exit interrupt(HARDWARE_CLOBBER)
// [85] return - exit interrupt(HARDWARE_CLOBBER)
rega:
lda #00
regx:
@@ -2255,86 +2191,86 @@ irq: {
REGISTER UPLIFT POTENTIAL REGISTERS
Equivalence Class zp[1]:34 [ bitmap_init::$4 ] has ALU potential.
Statement [1] (byte) frame_cnt#0 ← (byte) 1 [ frame_cnt#0 ] ( [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [9] *((const byte*) D011) ← (const byte) VIC_BMM|(const byte) VIC_DEN|(const byte) VIC_RSEL|(byte) 3 [ frame_cnt#0 ] ( main:3 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [11] *((const byte*) D018) ← (const byte) main::toD0181_return#0 [ frame_cnt#0 ] ( main:3 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [14] (word) bitmap_plot::x#0 ← (word) main::x#2 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 ] ( main:3 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 ] ) always clobbers reg byte a
Statement [1] (byte) frame_cnt ← (byte) 1 [ frame_cnt ] ( [ frame_cnt ] ) always clobbers reg byte a
Statement [9] *((const byte*) D011) ← (const byte) VIC_BMM|(const byte) VIC_DEN|(const byte) VIC_RSEL|(byte) 3 [ frame_cnt ] ( main:3 [ frame_cnt ] ) always clobbers reg byte a
Statement [11] *((const byte*) D018) ← (const byte) main::toD0181_return#0 [ frame_cnt ] ( main:3 [ frame_cnt ] ) always clobbers reg byte a
Statement [14] (word) bitmap_plot::x#0 ← (word) main::x#2 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 ] ( main:3 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:4 [ main::y#2 main::y#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:7 [ main::vy#2 main::vy#8 main::vy#1 ]
Statement [17] (word) main::x#1 ← (word) main::x#2 + (word) main::vx#2 [ frame_cnt#0 main::y#2 main::vx#2 main::vy#2 main::x#1 ] ( main:3 [ frame_cnt#0 main::y#2 main::vx#2 main::vy#2 main::x#1 ] ) always clobbers reg byte a
Statement [18] (byte) main::y#1 ← (byte) main::y#2 + (byte) main::vy#2 [ frame_cnt#0 main::vx#2 main::vy#2 main::x#1 main::y#1 ] ( main:3 [ frame_cnt#0 main::vx#2 main::vy#2 main::x#1 main::y#1 ] ) always clobbers reg byte a
Statement [19] if((word) main::x#1==(word) $13f) goto main::@5 [ frame_cnt#0 main::vx#2 main::vy#2 main::x#1 main::y#1 ] ( main:3 [ frame_cnt#0 main::vx#2 main::vy#2 main::x#1 main::y#1 ] ) always clobbers reg byte a
Statement [20] if((word) main::x#1!=(byte) 0) goto main::@3 [ frame_cnt#0 main::vx#2 main::vy#2 main::x#1 main::y#1 ] ( main:3 [ frame_cnt#0 main::vx#2 main::vy#2 main::x#1 main::y#1 ] ) always clobbers reg byte a
Statement [21] (word) main::vx#1 ← - (word) main::vx#2 [ frame_cnt#0 main::vy#2 main::x#1 main::y#1 main::vx#1 ] ( main:3 [ frame_cnt#0 main::vy#2 main::x#1 main::y#1 main::vx#1 ] ) always clobbers reg byte a
Statement [25] (byte) main::vy#1 ← - (byte) main::vy#2 [ frame_cnt#0 main::x#1 main::y#1 main::vx#6 main::vy#1 ] ( main:3 [ frame_cnt#0 main::x#1 main::y#1 main::vx#6 main::vy#1 ] ) always clobbers reg byte a
Statement [27] *((const byte*) plots_per_frame + (byte) frame_cnt#0) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt#0) [ frame_cnt#0 main::x#1 main::y#1 main::vx#6 main::vy#8 ] ( main:3 [ frame_cnt#0 main::x#1 main::y#1 main::vx#6 main::vy#8 ] ) always clobbers reg byte x
Statement [17] (word) main::x#1 ← (word) main::x#2 + (word) main::vx#2 [ frame_cnt main::y#2 main::vx#2 main::vy#2 main::x#1 ] ( main:3 [ frame_cnt main::y#2 main::vx#2 main::vy#2 main::x#1 ] ) always clobbers reg byte a
Statement [18] (byte) main::y#1 ← (byte) main::y#2 + (byte) main::vy#2 [ frame_cnt main::vx#2 main::vy#2 main::x#1 main::y#1 ] ( main:3 [ frame_cnt main::vx#2 main::vy#2 main::x#1 main::y#1 ] ) always clobbers reg byte a
Statement [19] if((word) main::x#1==(word) $13f) goto main::@5 [ frame_cnt main::vx#2 main::vy#2 main::x#1 main::y#1 ] ( main:3 [ frame_cnt main::vx#2 main::vy#2 main::x#1 main::y#1 ] ) always clobbers reg byte a
Statement [20] if((word) main::x#1!=(byte) 0) goto main::@3 [ frame_cnt main::vx#2 main::vy#2 main::x#1 main::y#1 ] ( main:3 [ frame_cnt main::vx#2 main::vy#2 main::x#1 main::y#1 ] ) always clobbers reg byte a
Statement [21] (word) main::vx#1 ← - (word) main::vx#2 [ frame_cnt main::vy#2 main::x#1 main::y#1 main::vx#1 ] ( main:3 [ frame_cnt main::vy#2 main::x#1 main::y#1 main::vx#1 ] ) always clobbers reg byte a
Statement [25] (byte) main::vy#1 ← - (byte) main::vy#2 [ frame_cnt main::x#1 main::y#1 main::vx#6 main::vy#1 ] ( main:3 [ frame_cnt main::x#1 main::y#1 main::vx#6 main::vy#1 ] ) always clobbers reg byte a
Statement [27] *((const byte*) plots_per_frame + (byte) frame_cnt) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt) [ frame_cnt main::x#1 main::y#1 main::vx#6 main::vy#8 ] ( main:3 [ frame_cnt main::x#1 main::y#1 main::vx#6 main::vy#8 ] ) always clobbers reg byte x
Removing always clobbered register reg byte x as potential for zp[1]:4 [ main::y#2 main::y#1 ]
Removing always clobbered register reg byte x as potential for zp[1]:7 [ main::vy#2 main::vy#8 main::vy#1 ]
Statement [28] (word) bitmap_plot::plotter#0 ← *((const byte*) bitmap_plot_yhi + (byte) bitmap_plot::y#0) w= *((const byte*) bitmap_plot_ylo + (byte) bitmap_plot::y#0) [ bitmap_plot::x#0 bitmap_plot::plotter#0 ] ( main:3::bitmap_plot:16 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 bitmap_plot::plotter#0 ] ) always clobbers reg byte a
Statement [29] (word~) bitmap_plot::$1 ← (word) bitmap_plot::x#0 & (word) $fff8 [ bitmap_plot::x#0 bitmap_plot::plotter#0 bitmap_plot::$1 ] ( main:3::bitmap_plot:16 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 bitmap_plot::plotter#0 bitmap_plot::$1 ] ) always clobbers reg byte a
Statement [30] (byte*) bitmap_plot::plotter#1 ← (byte*)(word) bitmap_plot::plotter#0 + (word~) bitmap_plot::$1 [ bitmap_plot::x#0 bitmap_plot::plotter#1 ] ( main:3::bitmap_plot:16 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 bitmap_plot::plotter#1 ] ) always clobbers reg byte a
Statement [31] (byte~) bitmap_plot::$2 ← < (word) bitmap_plot::x#0 [ bitmap_plot::plotter#1 bitmap_plot::$2 ] ( main:3::bitmap_plot:16 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::plotter#1 bitmap_plot::$2 ] ) always clobbers reg byte a
Statement [32] *((byte*) bitmap_plot::plotter#1) ← *((byte*) bitmap_plot::plotter#1) | *((const byte*) bitmap_plot_bit + (byte~) bitmap_plot::$2) [ ] ( main:3::bitmap_plot:16 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 ] ) always clobbers reg byte a reg byte y
Statement [28] (word) bitmap_plot::plotter#0 ← *((const byte*) bitmap_plot_yhi + (byte) bitmap_plot::y#0) w= *((const byte*) bitmap_plot_ylo + (byte) bitmap_plot::y#0) [ bitmap_plot::x#0 bitmap_plot::plotter#0 ] ( main:3::bitmap_plot:16 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 bitmap_plot::plotter#0 ] ) always clobbers reg byte a
Statement [29] (word~) bitmap_plot::$1 ← (word) bitmap_plot::x#0 & (word) $fff8 [ bitmap_plot::x#0 bitmap_plot::plotter#0 bitmap_plot::$1 ] ( main:3::bitmap_plot:16 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 bitmap_plot::plotter#0 bitmap_plot::$1 ] ) always clobbers reg byte a
Statement [30] (byte*) bitmap_plot::plotter#1 ← (byte*)(word) bitmap_plot::plotter#0 + (word~) bitmap_plot::$1 [ bitmap_plot::x#0 bitmap_plot::plotter#1 ] ( main:3::bitmap_plot:16 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 bitmap_plot::plotter#1 ] ) always clobbers reg byte a
Statement [31] (byte~) bitmap_plot::$2 ← < (word) bitmap_plot::x#0 [ bitmap_plot::plotter#1 bitmap_plot::$2 ] ( main:3::bitmap_plot:16 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::plotter#1 bitmap_plot::$2 ] ) always clobbers reg byte a
Statement [32] *((byte*) bitmap_plot::plotter#1) ← *((byte*) bitmap_plot::plotter#1) | *((const byte*) bitmap_plot_bit + (byte~) bitmap_plot::$2) [ ] ( main:3::bitmap_plot:16 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte y as potential for zp[1]:4 [ main::y#2 main::y#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:7 [ main::vy#2 main::vy#8 main::vy#1 ]
Statement [35] *((const byte*) PROCPORT_DDR) ← (const byte) PROCPORT_DDR_MEMORY_MASK [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [36] *((const byte*) PROCPORT) ← (const byte) PROCPORT_RAM_IO [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [37] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [38] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) | (byte) $80 [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [39] *((const byte*) RASTER) ← (byte) 0 [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [40] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [41] *((const void()**) HARDWARE_IRQ) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [50] if((word) memset::num#2<=(byte) 0) goto memset::@return [ memset::num#2 memset::str#3 memset::c#4 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt#0 memset::num#2 memset::str#3 memset::c#4 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt#0 memset::num#2 memset::str#3 memset::c#4 ] ) always clobbers reg byte a
Statement [35] *((const byte*) PROCPORT_DDR) ← (const byte) PROCPORT_DDR_MEMORY_MASK [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [36] *((const byte*) PROCPORT) ← (const byte) PROCPORT_RAM_IO [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [37] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [38] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) | (byte) $80 [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [39] *((const byte*) RASTER) ← (byte) 0 [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [40] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [41] *((const void()**) HARDWARE_IRQ) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [50] if((word) memset::num#2<=(byte) 0) goto memset::@return [ memset::num#2 memset::str#3 memset::c#4 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt memset::num#2 memset::str#3 memset::c#4 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt memset::num#2 memset::str#3 memset::c#4 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:12 [ memset::c#4 ]
Statement [51] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 [ memset::str#3 memset::c#4 memset::end#0 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt#0 memset::str#3 memset::c#4 memset::end#0 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt#0 memset::str#3 memset::c#4 memset::end#0 ] ) always clobbers reg byte a
Statement [52] (byte*) memset::dst#4 ← (byte*)(void*) memset::str#3 [ memset::c#4 memset::end#0 memset::dst#4 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt#0 memset::c#4 memset::end#0 memset::dst#4 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt#0 memset::c#4 memset::end#0 memset::dst#4 ] ) always clobbers reg byte a
Statement [54] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 [ memset::c#4 memset::end#0 memset::dst#2 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt#0 memset::c#4 memset::end#0 memset::dst#2 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt#0 memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a
Statement [56] *((byte*) memset::dst#2) ← (byte) memset::c#4 [ memset::c#4 memset::end#0 memset::dst#2 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt#0 memset::c#4 memset::end#0 memset::dst#2 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt#0 memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a reg byte y
Statement [51] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 [ memset::str#3 memset::c#4 memset::end#0 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt memset::str#3 memset::c#4 memset::end#0 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt memset::str#3 memset::c#4 memset::end#0 ] ) always clobbers reg byte a
Statement [52] (byte*) memset::dst#4 ← (byte*)(void*) memset::str#3 [ memset::c#4 memset::end#0 memset::dst#4 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt memset::c#4 memset::end#0 memset::dst#4 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt memset::c#4 memset::end#0 memset::dst#4 ] ) always clobbers reg byte a
Statement [54] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 [ memset::c#4 memset::end#0 memset::dst#2 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt memset::c#4 memset::end#0 memset::dst#2 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a
Statement [56] *((byte*) memset::dst#2) ← (byte) memset::c#4 [ memset::c#4 memset::end#0 memset::dst#2 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt memset::c#4 memset::end#0 memset::dst#2 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte y as potential for zp[1]:12 [ memset::c#4 ]
Statement [75] (byte*) bitmap_init::yoffs#1 ← (byte*) bitmap_init::yoffs#2 + (word)(number) $28*(number) 8 [ bitmap_init::y#2 bitmap_init::yoffs#1 ] ( main:3::bitmap_init:6 [ frame_cnt#0 bitmap_init::y#2 bitmap_init::yoffs#1 ] ) always clobbers reg byte a
Statement [75] (byte*) bitmap_init::yoffs#1 ← (byte*) bitmap_init::yoffs#2 + (word)(number) $28*(number) 8 [ bitmap_init::y#2 bitmap_init::yoffs#1 ] ( main:3::bitmap_init:6 [ frame_cnt bitmap_init::y#2 bitmap_init::yoffs#1 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:17 [ bitmap_init::y#2 bitmap_init::y#1 ]
Statement [80] *((const byte*) BGCOL) ← (const byte) WHITE [ frame_cnt#0 ] ( [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [81] if((byte) 0==(byte) frame_cnt#0) goto irq::@1 [ frame_cnt#0 ] ( [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [84] *((const byte*) BGCOL) ← (const byte) BLACK [ ] ( [ ] ) always clobbers reg byte a
Statement [85] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ ] ( [ ] ) always clobbers reg byte a
Statement [86] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y
Statement [1] (byte) frame_cnt#0 ← (byte) 1 [ frame_cnt#0 ] ( [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [9] *((const byte*) D011) ← (const byte) VIC_BMM|(const byte) VIC_DEN|(const byte) VIC_RSEL|(byte) 3 [ frame_cnt#0 ] ( main:3 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [11] *((const byte*) D018) ← (const byte) main::toD0181_return#0 [ frame_cnt#0 ] ( main:3 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [14] (word) bitmap_plot::x#0 ← (word) main::x#2 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 ] ( main:3 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 ] ) always clobbers reg byte a
Statement [17] (word) main::x#1 ← (word) main::x#2 + (word) main::vx#2 [ frame_cnt#0 main::y#2 main::vx#2 main::vy#2 main::x#1 ] ( main:3 [ frame_cnt#0 main::y#2 main::vx#2 main::vy#2 main::x#1 ] ) always clobbers reg byte a
Statement [18] (byte) main::y#1 ← (byte) main::y#2 + (byte) main::vy#2 [ frame_cnt#0 main::vx#2 main::vy#2 main::x#1 main::y#1 ] ( main:3 [ frame_cnt#0 main::vx#2 main::vy#2 main::x#1 main::y#1 ] ) always clobbers reg byte a
Statement [19] if((word) main::x#1==(word) $13f) goto main::@5 [ frame_cnt#0 main::vx#2 main::vy#2 main::x#1 main::y#1 ] ( main:3 [ frame_cnt#0 main::vx#2 main::vy#2 main::x#1 main::y#1 ] ) always clobbers reg byte a
Statement [20] if((word) main::x#1!=(byte) 0) goto main::@3 [ frame_cnt#0 main::vx#2 main::vy#2 main::x#1 main::y#1 ] ( main:3 [ frame_cnt#0 main::vx#2 main::vy#2 main::x#1 main::y#1 ] ) always clobbers reg byte a
Statement [21] (word) main::vx#1 ← - (word) main::vx#2 [ frame_cnt#0 main::vy#2 main::x#1 main::y#1 main::vx#1 ] ( main:3 [ frame_cnt#0 main::vy#2 main::x#1 main::y#1 main::vx#1 ] ) always clobbers reg byte a
Statement [23] if((byte) main::y#1==(byte) $c7) goto main::@6 [ frame_cnt#0 main::vy#2 main::x#1 main::y#1 main::vx#6 ] ( main:3 [ frame_cnt#0 main::vy#2 main::x#1 main::y#1 main::vx#6 ] ) always clobbers reg byte a
Statement [24] if((byte) main::y#1!=(byte) 0) goto main::@4 [ frame_cnt#0 main::vy#2 main::x#1 main::y#1 main::vx#6 ] ( main:3 [ frame_cnt#0 main::vy#2 main::x#1 main::y#1 main::vx#6 ] ) always clobbers reg byte a
Statement [25] (byte) main::vy#1 ← - (byte) main::vy#2 [ frame_cnt#0 main::x#1 main::y#1 main::vx#6 main::vy#1 ] ( main:3 [ frame_cnt#0 main::x#1 main::y#1 main::vx#6 main::vy#1 ] ) always clobbers reg byte a
Statement [27] *((const byte*) plots_per_frame + (byte) frame_cnt#0) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt#0) [ frame_cnt#0 main::x#1 main::y#1 main::vx#6 main::vy#8 ] ( main:3 [ frame_cnt#0 main::x#1 main::y#1 main::vx#6 main::vy#8 ] ) always clobbers reg byte x
Statement [28] (word) bitmap_plot::plotter#0 ← *((const byte*) bitmap_plot_yhi + (byte) bitmap_plot::y#0) w= *((const byte*) bitmap_plot_ylo + (byte) bitmap_plot::y#0) [ bitmap_plot::x#0 bitmap_plot::plotter#0 ] ( main:3::bitmap_plot:16 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 bitmap_plot::plotter#0 ] ) always clobbers reg byte a
Statement [29] (word~) bitmap_plot::$1 ← (word) bitmap_plot::x#0 & (word) $fff8 [ bitmap_plot::x#0 bitmap_plot::plotter#0 bitmap_plot::$1 ] ( main:3::bitmap_plot:16 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 bitmap_plot::plotter#0 bitmap_plot::$1 ] ) always clobbers reg byte a
Statement [30] (byte*) bitmap_plot::plotter#1 ← (byte*)(word) bitmap_plot::plotter#0 + (word~) bitmap_plot::$1 [ bitmap_plot::x#0 bitmap_plot::plotter#1 ] ( main:3::bitmap_plot:16 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 bitmap_plot::plotter#1 ] ) always clobbers reg byte a
Statement [31] (byte~) bitmap_plot::$2 ← < (word) bitmap_plot::x#0 [ bitmap_plot::plotter#1 bitmap_plot::$2 ] ( main:3::bitmap_plot:16 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::plotter#1 bitmap_plot::$2 ] ) always clobbers reg byte a
Statement [32] *((byte*) bitmap_plot::plotter#1) ← *((byte*) bitmap_plot::plotter#1) | *((const byte*) bitmap_plot_bit + (byte~) bitmap_plot::$2) [ ] ( main:3::bitmap_plot:16 [ frame_cnt#0 main::x#2 main::y#2 main::vx#2 main::vy#2 ] ) always clobbers reg byte a reg byte y
Statement [35] *((const byte*) PROCPORT_DDR) ← (const byte) PROCPORT_DDR_MEMORY_MASK [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [36] *((const byte*) PROCPORT) ← (const byte) PROCPORT_RAM_IO [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [37] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [38] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) | (byte) $80 [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [39] *((const byte*) RASTER) ← (byte) 0 [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [40] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [41] *((const void()**) HARDWARE_IRQ) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() [ ] ( main:3::init_irq:12 [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [50] if((word) memset::num#2<=(byte) 0) goto memset::@return [ memset::num#2 memset::str#3 memset::c#4 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt#0 memset::num#2 memset::str#3 memset::c#4 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt#0 memset::num#2 memset::str#3 memset::c#4 ] ) always clobbers reg byte a
Statement [51] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 [ memset::str#3 memset::c#4 memset::end#0 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt#0 memset::str#3 memset::c#4 memset::end#0 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt#0 memset::str#3 memset::c#4 memset::end#0 ] ) always clobbers reg byte a
Statement [52] (byte*) memset::dst#4 ← (byte*)(void*) memset::str#3 [ memset::c#4 memset::end#0 memset::dst#4 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt#0 memset::c#4 memset::end#0 memset::dst#4 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt#0 memset::c#4 memset::end#0 memset::dst#4 ] ) always clobbers reg byte a
Statement [54] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 [ memset::c#4 memset::end#0 memset::dst#2 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt#0 memset::c#4 memset::end#0 memset::dst#2 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt#0 memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a
Statement [56] *((byte*) memset::dst#2) ← (byte) memset::c#4 [ memset::c#4 memset::end#0 memset::dst#2 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt#0 memset::c#4 memset::end#0 memset::dst#2 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt#0 memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a reg byte y
Statement [68] (byte~) bitmap_init::$7 ← (byte) bitmap_init::y#2 & (byte) 7 [ bitmap_init::y#2 bitmap_init::yoffs#2 bitmap_init::$7 ] ( main:3::bitmap_init:6 [ frame_cnt#0 bitmap_init::y#2 bitmap_init::yoffs#2 bitmap_init::$7 ] ) always clobbers reg byte a
Statement [75] (byte*) bitmap_init::yoffs#1 ← (byte*) bitmap_init::yoffs#2 + (word)(number) $28*(number) 8 [ bitmap_init::y#2 bitmap_init::yoffs#1 ] ( main:3::bitmap_init:6 [ frame_cnt#0 bitmap_init::y#2 bitmap_init::yoffs#1 ] ) always clobbers reg byte a
Statement [80] *((const byte*) BGCOL) ← (const byte) WHITE [ frame_cnt#0 ] ( [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [81] if((byte) 0==(byte) frame_cnt#0) goto irq::@1 [ frame_cnt#0 ] ( [ frame_cnt#0 ] ) always clobbers reg byte a
Statement [84] *((const byte*) BGCOL) ← (const byte) BLACK [ ] ( [ ] ) always clobbers reg byte a
Statement [85] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ ] ( [ ] ) always clobbers reg byte a
Statement [86] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y
Statement [80] *((const byte*) BGCOL) ← (const byte) WHITE [ frame_cnt ] ( [ frame_cnt ] ) always clobbers reg byte a
Statement [81] if((byte) 0==(byte) frame_cnt) goto irq::@1 [ ] ( [ ] ) always clobbers reg byte a
Statement [83] *((const byte*) BGCOL) ← (const byte) BLACK [ ] ( [ ] ) always clobbers reg byte a
Statement [84] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ ] ( [ ] ) always clobbers reg byte a
Statement [85] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y
Statement [1] (byte) frame_cnt ← (byte) 1 [ frame_cnt ] ( [ frame_cnt ] ) always clobbers reg byte a
Statement [9] *((const byte*) D011) ← (const byte) VIC_BMM|(const byte) VIC_DEN|(const byte) VIC_RSEL|(byte) 3 [ frame_cnt ] ( main:3 [ frame_cnt ] ) always clobbers reg byte a
Statement [11] *((const byte*) D018) ← (const byte) main::toD0181_return#0 [ frame_cnt ] ( main:3 [ frame_cnt ] ) always clobbers reg byte a
Statement [14] (word) bitmap_plot::x#0 ← (word) main::x#2 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 ] ( main:3 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 ] ) always clobbers reg byte a
Statement [17] (word) main::x#1 ← (word) main::x#2 + (word) main::vx#2 [ frame_cnt main::y#2 main::vx#2 main::vy#2 main::x#1 ] ( main:3 [ frame_cnt main::y#2 main::vx#2 main::vy#2 main::x#1 ] ) always clobbers reg byte a
Statement [18] (byte) main::y#1 ← (byte) main::y#2 + (byte) main::vy#2 [ frame_cnt main::vx#2 main::vy#2 main::x#1 main::y#1 ] ( main:3 [ frame_cnt main::vx#2 main::vy#2 main::x#1 main::y#1 ] ) always clobbers reg byte a
Statement [19] if((word) main::x#1==(word) $13f) goto main::@5 [ frame_cnt main::vx#2 main::vy#2 main::x#1 main::y#1 ] ( main:3 [ frame_cnt main::vx#2 main::vy#2 main::x#1 main::y#1 ] ) always clobbers reg byte a
Statement [20] if((word) main::x#1!=(byte) 0) goto main::@3 [ frame_cnt main::vx#2 main::vy#2 main::x#1 main::y#1 ] ( main:3 [ frame_cnt main::vx#2 main::vy#2 main::x#1 main::y#1 ] ) always clobbers reg byte a
Statement [21] (word) main::vx#1 ← - (word) main::vx#2 [ frame_cnt main::vy#2 main::x#1 main::y#1 main::vx#1 ] ( main:3 [ frame_cnt main::vy#2 main::x#1 main::y#1 main::vx#1 ] ) always clobbers reg byte a
Statement [23] if((byte) main::y#1==(byte) $c7) goto main::@6 [ frame_cnt main::vy#2 main::x#1 main::y#1 main::vx#6 ] ( main:3 [ frame_cnt main::vy#2 main::x#1 main::y#1 main::vx#6 ] ) always clobbers reg byte a
Statement [24] if((byte) main::y#1!=(byte) 0) goto main::@4 [ frame_cnt main::vy#2 main::x#1 main::y#1 main::vx#6 ] ( main:3 [ frame_cnt main::vy#2 main::x#1 main::y#1 main::vx#6 ] ) always clobbers reg byte a
Statement [25] (byte) main::vy#1 ← - (byte) main::vy#2 [ frame_cnt main::x#1 main::y#1 main::vx#6 main::vy#1 ] ( main:3 [ frame_cnt main::x#1 main::y#1 main::vx#6 main::vy#1 ] ) always clobbers reg byte a
Statement [27] *((const byte*) plots_per_frame + (byte) frame_cnt) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt) [ frame_cnt main::x#1 main::y#1 main::vx#6 main::vy#8 ] ( main:3 [ frame_cnt main::x#1 main::y#1 main::vx#6 main::vy#8 ] ) always clobbers reg byte x
Statement [28] (word) bitmap_plot::plotter#0 ← *((const byte*) bitmap_plot_yhi + (byte) bitmap_plot::y#0) w= *((const byte*) bitmap_plot_ylo + (byte) bitmap_plot::y#0) [ bitmap_plot::x#0 bitmap_plot::plotter#0 ] ( main:3::bitmap_plot:16 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 bitmap_plot::plotter#0 ] ) always clobbers reg byte a
Statement [29] (word~) bitmap_plot::$1 ← (word) bitmap_plot::x#0 & (word) $fff8 [ bitmap_plot::x#0 bitmap_plot::plotter#0 bitmap_plot::$1 ] ( main:3::bitmap_plot:16 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 bitmap_plot::plotter#0 bitmap_plot::$1 ] ) always clobbers reg byte a
Statement [30] (byte*) bitmap_plot::plotter#1 ← (byte*)(word) bitmap_plot::plotter#0 + (word~) bitmap_plot::$1 [ bitmap_plot::x#0 bitmap_plot::plotter#1 ] ( main:3::bitmap_plot:16 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::x#0 bitmap_plot::plotter#1 ] ) always clobbers reg byte a
Statement [31] (byte~) bitmap_plot::$2 ← < (word) bitmap_plot::x#0 [ bitmap_plot::plotter#1 bitmap_plot::$2 ] ( main:3::bitmap_plot:16 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 bitmap_plot::plotter#1 bitmap_plot::$2 ] ) always clobbers reg byte a
Statement [32] *((byte*) bitmap_plot::plotter#1) ← *((byte*) bitmap_plot::plotter#1) | *((const byte*) bitmap_plot_bit + (byte~) bitmap_plot::$2) [ ] ( main:3::bitmap_plot:16 [ frame_cnt main::x#2 main::y#2 main::vx#2 main::vy#2 ] ) always clobbers reg byte a reg byte y
Statement [35] *((const byte*) PROCPORT_DDR) ← (const byte) PROCPORT_DDR_MEMORY_MASK [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [36] *((const byte*) PROCPORT) ← (const byte) PROCPORT_RAM_IO [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [37] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [38] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) | (byte) $80 [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [39] *((const byte*) RASTER) ← (byte) 0 [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [40] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [41] *((const void()**) HARDWARE_IRQ) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() [ ] ( main:3::init_irq:12 [ frame_cnt ] ) always clobbers reg byte a
Statement [50] if((word) memset::num#2<=(byte) 0) goto memset::@return [ memset::num#2 memset::str#3 memset::c#4 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt memset::num#2 memset::str#3 memset::c#4 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt memset::num#2 memset::str#3 memset::c#4 ] ) always clobbers reg byte a
Statement [51] (byte*) memset::end#0 ← (byte*)(void*) memset::str#3 + (word) memset::num#2 [ memset::str#3 memset::c#4 memset::end#0 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt memset::str#3 memset::c#4 memset::end#0 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt memset::str#3 memset::c#4 memset::end#0 ] ) always clobbers reg byte a
Statement [52] (byte*) memset::dst#4 ← (byte*)(void*) memset::str#3 [ memset::c#4 memset::end#0 memset::dst#4 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt memset::c#4 memset::end#0 memset::dst#4 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt memset::c#4 memset::end#0 memset::dst#4 ] ) always clobbers reg byte a
Statement [54] if((byte*) memset::dst#2!=(byte*) memset::end#0) goto memset::@3 [ memset::c#4 memset::end#0 memset::dst#2 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt memset::c#4 memset::end#0 memset::dst#2 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a
Statement [56] *((byte*) memset::dst#2) ← (byte) memset::c#4 [ memset::c#4 memset::end#0 memset::dst#2 ] ( main:3::bitmap_clear:8::memset:45 [ frame_cnt memset::c#4 memset::end#0 memset::dst#2 ] main:3::bitmap_clear:8::memset:47 [ frame_cnt memset::c#4 memset::end#0 memset::dst#2 ] ) always clobbers reg byte a reg byte y
Statement [68] (byte~) bitmap_init::$7 ← (byte) bitmap_init::y#2 & (byte) 7 [ bitmap_init::y#2 bitmap_init::yoffs#2 bitmap_init::$7 ] ( main:3::bitmap_init:6 [ frame_cnt bitmap_init::y#2 bitmap_init::yoffs#2 bitmap_init::$7 ] ) always clobbers reg byte a
Statement [75] (byte*) bitmap_init::yoffs#1 ← (byte*) bitmap_init::yoffs#2 + (word)(number) $28*(number) 8 [ bitmap_init::y#2 bitmap_init::yoffs#1 ] ( main:3::bitmap_init:6 [ frame_cnt bitmap_init::y#2 bitmap_init::yoffs#1 ] ) always clobbers reg byte a
Statement [80] *((const byte*) BGCOL) ← (const byte) WHITE [ frame_cnt ] ( [ frame_cnt ] ) always clobbers reg byte a
Statement [81] if((byte) 0==(byte) frame_cnt) goto irq::@1 [ ] ( [ ] ) always clobbers reg byte a
Statement [83] *((const byte*) BGCOL) ← (const byte) BLACK [ ] ( [ ] ) always clobbers reg byte a
Statement [84] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ ] ( [ ] ) always clobbers reg byte a
Statement [85] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y
Potential registers zp[2]:2 [ main::x#2 main::x#1 ] : zp[2]:2 ,
Potential registers zp[1]:4 [ main::y#2 main::y#1 ] : zp[1]:4 ,
Potential registers zp[2]:5 [ main::vx#2 main::vx#6 main::vx#1 ] : zp[2]:5 ,
@@ -2347,7 +2283,7 @@ Potential registers zp[1]:15 [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_in
Potential registers zp[1]:16 [ bitmap_init::x#2 bitmap_init::x#1 ] : zp[1]:16 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:17 [ bitmap_init::y#2 bitmap_init::y#1 ] : zp[1]:17 , reg byte x , reg byte y ,
Potential registers zp[2]:18 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] : zp[2]:18 ,
Potential registers zp[1]:20 [ frame_cnt#10 frame_cnt#0 frame_cnt#1 ] : zp[1]:20 ,
Potential registers zp[1]:20 [ frame_cnt ] : zp[1]:20 ,
Potential registers zp[2]:21 [ bitmap_plot::x#0 ] : zp[2]:21 ,
Potential registers zp[1]:23 [ bitmap_plot::y#0 ] : zp[1]:23 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[2]:24 [ bitmap_plot::plotter#0 ] : zp[2]:24 ,
@@ -2364,8 +2300,8 @@ REGISTER UPLIFT SCOPES
Uplift Scope [bitmap_init] 39.88: zp[2]:18 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] 34.83: zp[1]:15 [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] 22: zp[1]:16 [ bitmap_init::x#2 bitmap_init::x#1 ] 22: zp[1]:17 [ bitmap_init::y#2 bitmap_init::y#1 ] 22: zp[1]:34 [ bitmap_init::$4 ] 22: zp[1]:35 [ bitmap_init::$5 ] 22: zp[1]:36 [ bitmap_init::$6 ] 5.5: zp[1]:33 [ bitmap_init::$7 ]
Uplift Scope [main] 42.17: zp[1]:7 [ main::vy#2 main::vy#8 main::vy#1 ] 33: zp[2]:5 [ main::vx#2 main::vx#6 main::vx#1 ] 12.25: zp[2]:2 [ main::x#2 main::x#1 ] 11: zp[1]:4 [ main::y#2 main::y#1 ]
Uplift Scope [memset] 41.33: zp[2]:13 [ memset::dst#2 memset::dst#4 memset::dst#1 ] 2.17: zp[2]:31 [ memset::end#0 ] 2: zp[2]:8 [ memset::num#2 ] 1.38: zp[1]:12 [ memset::c#4 ] 0: zp[2]:10 [ memset::str#3 ]
Uplift Scope [] 45.11: zp[1]:20 [ frame_cnt#10 frame_cnt#0 frame_cnt#1 ]
Uplift Scope [bitmap_plot] 15: zp[1]:23 [ bitmap_plot::y#0 ] 4: zp[2]:26 [ bitmap_plot::$1 ] 4: zp[1]:30 [ bitmap_plot::$2 ] 3: zp[2]:21 [ bitmap_plot::x#0 ] 3: zp[2]:28 [ bitmap_plot::plotter#1 ] 1: zp[2]:24 [ bitmap_plot::plotter#0 ]
Uplift Scope [] 1.15: zp[1]:20 [ frame_cnt ]
Uplift Scope [bitmap_clear]
Uplift Scope [init_irq]
Uplift Scope [irq]
@@ -2374,13 +2310,11 @@ Uplifting [bitmap_init] best 4371 combination zp[2]:18 [ bitmap_init::yoffs#2 bi
Limited combination testing to 100 combinations of 15360 possible.
Uplifting [main] best 4371 combination zp[1]:7 [ main::vy#2 main::vy#8 main::vy#1 ] zp[2]:5 [ main::vx#2 main::vx#6 main::vx#1 ] zp[2]:2 [ main::x#2 main::x#1 ] zp[1]:4 [ main::y#2 main::y#1 ]
Uplifting [memset] best 4355 combination zp[2]:13 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:31 [ memset::end#0 ] zp[2]:8 [ memset::num#2 ] reg byte x [ memset::c#4 ] zp[2]:10 [ memset::str#3 ]
Uplifting [] best 4355 combination zp[1]:20 [ frame_cnt#10 frame_cnt#0 frame_cnt#1 ]
Uplifting [bitmap_plot] best 4318 combination reg byte x [ bitmap_plot::y#0 ] zp[2]:26 [ bitmap_plot::$1 ] reg byte a [ bitmap_plot::$2 ] zp[2]:21 [ bitmap_plot::x#0 ] zp[2]:28 [ bitmap_plot::plotter#1 ] zp[2]:24 [ bitmap_plot::plotter#0 ]
Uplifting [] best 4318 combination zp[1]:20 [ frame_cnt ]
Uplifting [bitmap_clear] best 4318 combination
Uplifting [init_irq] best 4318 combination
Uplifting [irq] best 4318 combination
Attempting to uplift remaining variables inzp[1]:20 [ frame_cnt#10 frame_cnt#0 frame_cnt#1 ]
Uplifting [] best 4318 combination zp[1]:20 [ frame_cnt#10 frame_cnt#0 frame_cnt#1 ]
Attempting to uplift remaining variables inzp[1]:7 [ main::vy#2 main::vy#8 main::vy#1 ]
Uplifting [main] best 4318 combination zp[1]:7 [ main::vy#2 main::vy#8 main::vy#1 ]
Attempting to uplift remaining variables inzp[1]:35 [ bitmap_init::$5 ]
@@ -2391,6 +2325,8 @@ Attempting to uplift remaining variables inzp[1]:4 [ main::y#2 main::y#1 ]
Uplifting [main] best 4198 combination zp[1]:4 [ main::y#2 main::y#1 ]
Attempting to uplift remaining variables inzp[1]:33 [ bitmap_init::$7 ]
Uplifting [bitmap_init] best 4198 combination zp[1]:33 [ bitmap_init::$7 ]
Attempting to uplift remaining variables inzp[1]:20 [ frame_cnt ]
Uplifting [] best 4198 combination zp[1]:20 [ frame_cnt ]
Coalescing zero page register [ zp[2]:2 [ main::x#2 main::x#1 ] ] with [ zp[2]:21 [ bitmap_plot::x#0 ] ] - score: 1
Coalescing zero page register [ zp[2]:8 [ memset::num#2 ] ] with [ zp[2]:31 [ memset::end#0 ] ] - score: 1
Coalescing zero page register [ zp[2]:10 [ memset::str#3 ] ] with [ zp[2]:13 [ memset::dst#2 memset::dst#4 memset::dst#1 ] ] - score: 1
@@ -2402,17 +2338,17 @@ Coalescing zero page register [ zp[1]:33 [ bitmap_init::$7 ] ] with [ zp[1]:4 [
Allocated (was zp[1]:7) zp[1]:2 [ main::vy#2 main::vy#8 main::vy#1 ]
Allocated (was zp[2]:8) zp[2]:3 [ memset::num#2 memset::end#0 main::x#2 main::x#1 bitmap_plot::x#0 ]
Allocated (was zp[2]:10) zp[2]:5 [ memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 main::vx#2 main::vx#6 main::vx#1 ]
Allocated (was zp[1]:20) zp[1]:7 [ frame_cnt#10 frame_cnt#0 frame_cnt#1 ]
Allocated (was zp[1]:20) zp[1]:7 [ frame_cnt ]
Allocated (was zp[2]:24) zp[2]:8 [ bitmap_plot::plotter#0 bitmap_plot::plotter#1 bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ]
Allocated (was zp[2]:26) zp[2]:10 [ bitmap_plot::$1 ]
Allocated (was zp[1]:33) zp[1]:12 [ bitmap_init::$7 main::y#2 main::y#1 ]
Interrupt procedure irq clobbers ACNZ
Removing interrupt register storage stx regx+1 in CHU154 entry interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage sty regy+1 in CHU154 entry interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage regx: in CHU165 [86] return - exit interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage ldx #00 in CHU165 [86] return - exit interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage regy: in CHU165 [86] return - exit interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage ldy #00 in CHU165 [86] return - exit interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage regx: in CHU163 [85] return - exit interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage ldx #00 in CHU163 [85] return - exit interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage regy: in CHU163 [85] return - exit interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage ldy #00 in CHU163 [85] return - exit interrupt(HARDWARE_CLOBBER)
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -2462,7 +2398,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte) frame_cnt#0 ← (byte) 1 -- vbuz1=vbuc1
// [1] (byte) frame_cnt ← (byte) 1 -- vbuz1=vbuc1
// Counts frames - updated by the IRQ
lda #1
sta.z frame_cnt
@@ -2625,7 +2561,7 @@ main: {
jmp __b4
// main::@4
__b4:
// [27] *((const byte*) plots_per_frame + (byte) frame_cnt#0) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt#0) -- pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
// [27] *((const byte*) plots_per_frame + (byte) frame_cnt) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt) -- pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
ldx.z frame_cnt
inc plots_per_frame,x
// [13] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
@@ -2945,33 +2881,29 @@ irq: {
// [80] *((const byte*) BGCOL) ← (const byte) WHITE -- _deref_pbuc1=vbuc2
lda #WHITE
sta BGCOL
// [81] if((byte) 0==(byte) frame_cnt#0) goto irq::@1 -- vbuc1_eq_vbuz1_then_la1
// [81] if((byte) 0==(byte) frame_cnt) goto irq::@1 -- vbuc1_eq_vbuz1_then_la1
lda #0
cmp.z frame_cnt
beq __b1_from_irq
beq __b1
jmp __b2
// irq::@2
__b2:
// [82] (byte) frame_cnt#1 ← ++ (byte) frame_cnt#0 -- vbuz1=_inc_vbuz1
// [82] (byte) frame_cnt ← ++ (byte) frame_cnt -- vbuz1=_inc_vbuz1
inc.z frame_cnt
// [83] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
__b1_from_irq:
__b1_from___b2:
// [83] phi (byte) frame_cnt#10 = (byte) frame_cnt#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy
jmp __b1
// irq::@1
__b1:
// [84] *((const byte*) BGCOL) ← (const byte) BLACK -- _deref_pbuc1=vbuc2
// [83] *((const byte*) BGCOL) ← (const byte) BLACK -- _deref_pbuc1=vbuc2
lda #BLACK
sta BGCOL
// [85] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// [84] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// Acknowledge the IRQ
lda #IRQ_RASTER
sta IRQ_STATUS
jmp __breturn
// irq::@return
__breturn:
// [86] return - exit interrupt(HARDWARE_CLOBBER)
// [85] return - exit interrupt(HARDWARE_CLOBBER)
rega:
lda #00
rti
@@ -3034,7 +2966,6 @@ Replacing label __b6_from___b1 with __b2
Replacing label __b1_from___b2 with __b1
Replacing label __b4_from___b3 with __b4
Replacing label __b3_from___b4 with __b3
Replacing label __b1_from_irq with __b1
Removing instruction __bbegin:
Removing instruction __b2_from___b1:
Removing instruction main_from___b2:
@@ -3059,8 +2990,6 @@ Removing instruction __b2_from___b6:
Removing instruction __b3_from___b4:
Removing instruction __b4_from___b3:
Removing instruction __b4_from___b5:
Removing instruction __b1_from_irq:
Removing instruction __b1_from___b2:
Removing instruction __breturn:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b2:
@@ -3172,10 +3101,7 @@ FINAL SYMBOL TABLE
(const byte*) bitmap_plot_yhi[(number) $100] = { fill( $100, 0) }
(const byte*) bitmap_plot_ylo[(number) $100] = { fill( $100, 0) }
(byte*) bitmap_screen
(byte) frame_cnt
(byte) frame_cnt#0 frame_cnt zp[1]:7 1.1111111111111112
(byte) frame_cnt#1 frame_cnt zp[1]:7 4.0
(byte) frame_cnt#10 frame_cnt zp[1]:7 40.0
(byte) frame_cnt loadstore zp[1]:7 1.1538461538461537
(void()) init_irq()
(label) init_irq::@return
interrupt(HARDWARE_CLOBBER)(void()) irq()
@@ -3241,7 +3167,7 @@ reg byte x [ memset::c#4 ]
reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ]
reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ]
reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ]
zp[1]:7 [ frame_cnt#10 frame_cnt#0 frame_cnt#1 ]
zp[1]:7 [ frame_cnt ]
reg byte x [ bitmap_plot::y#0 ]
zp[2]:8 [ bitmap_plot::plotter#0 bitmap_plot::plotter#1 bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ]
zp[2]:10 [ bitmap_plot::$1 ]
@@ -3301,7 +3227,7 @@ Score: 3177
// @1
__b1:
// frame_cnt = 1
// [1] (byte) frame_cnt#0 ← (byte) 1 -- vbuz1=vbuc1
// [1] (byte) frame_cnt ← (byte) 1 -- vbuz1=vbuc1
// Counts frames - updated by the IRQ
lda #1
sta.z frame_cnt
@@ -3437,7 +3363,7 @@ main: {
// main::@4
__b4:
// plots_per_frame[frame_cnt]++;
// [27] *((const byte*) plots_per_frame + (byte) frame_cnt#0) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt#0) -- pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
// [27] *((const byte*) plots_per_frame + (byte) frame_cnt) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt) -- pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
ldx.z frame_cnt
inc plots_per_frame,x
// [13] phi from main::@4 to main::@1 [phi:main::@4->main::@1]
@@ -3757,30 +3683,28 @@ irq: {
lda #WHITE
sta BGCOL
// if(frame_cnt)
// [81] if((byte) 0==(byte) frame_cnt#0) goto irq::@1 -- vbuc1_eq_vbuz1_then_la1
// [81] if((byte) 0==(byte) frame_cnt) goto irq::@1 -- vbuc1_eq_vbuz1_then_la1
lda #0
cmp.z frame_cnt
beq __b1
// irq::@2
// frame_cnt++;
// [82] (byte) frame_cnt#1 ← ++ (byte) frame_cnt#0 -- vbuz1=_inc_vbuz1
// [82] (byte) frame_cnt ← ++ (byte) frame_cnt -- vbuz1=_inc_vbuz1
inc.z frame_cnt
// [83] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
// [83] phi (byte) frame_cnt#10 = (byte) frame_cnt#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy
// irq::@1
__b1:
// *BGCOL = BLACK
// [84] *((const byte*) BGCOL) ← (const byte) BLACK -- _deref_pbuc1=vbuc2
// [83] *((const byte*) BGCOL) ← (const byte) BLACK -- _deref_pbuc1=vbuc2
lda #BLACK
sta BGCOL
// *IRQ_STATUS = IRQ_RASTER
// [85] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// [84] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// Acknowledge the IRQ
lda #IRQ_RASTER
sta IRQ_STATUS
// irq::@return
// }
// [86] return - exit interrupt(HARDWARE_CLOBBER)
// [85] return - exit interrupt(HARDWARE_CLOBBER)
rega:
lda #00
rti
+2 -5
View File
@@ -75,10 +75,7 @@
(const byte*) bitmap_plot_yhi[(number) $100] = { fill( $100, 0) }
(const byte*) bitmap_plot_ylo[(number) $100] = { fill( $100, 0) }
(byte*) bitmap_screen
(byte) frame_cnt
(byte) frame_cnt#0 frame_cnt zp[1]:7 1.1111111111111112
(byte) frame_cnt#1 frame_cnt zp[1]:7 4.0
(byte) frame_cnt#10 frame_cnt zp[1]:7 40.0
(byte) frame_cnt loadstore zp[1]:7 1.1538461538461537
(void()) init_irq()
(label) init_irq::@return
interrupt(HARDWARE_CLOBBER)(void()) irq()
@@ -144,7 +141,7 @@ reg byte x [ memset::c#4 ]
reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ]
reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ]
reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ]
zp[1]:7 [ frame_cnt#10 frame_cnt#0 frame_cnt#1 ]
zp[1]:7 [ frame_cnt ]
reg byte x [ bitmap_plot::y#0 ]
zp[2]:8 [ bitmap_plot::plotter#0 bitmap_plot::plotter#1 bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ]
zp[2]:10 [ bitmap_plot::$1 ]
+1 -1
View File
@@ -43,9 +43,9 @@
.const SIZEOF_SIGNED_WORD = 2
.label BITMAP = $2000
.label SCREEN = $400
.label frame_cnt = $12
// Remainder after unsigned 16-bit division
.label rem16u = $c
.label frame_cnt = $12
__b1:
// Counts frames - updated by the IRQ
lda #1
+7 -8
View File
@@ -2,7 +2,7 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) frame_cnt#0 ← (byte) 1
[1] (byte) frame_cnt ← (byte) 1
to:@2
@2: scope:[] from @1
[2] phi()
@@ -84,7 +84,7 @@ main::@13: scope:[main] from main::@3
to:main::@4
main::@4: scope:[main] from main::@13 main::@3
[46] (word) main::idx_y#10 ← phi( main::@13/(word) main::idx_y#1 main::@3/(byte) 0 )
[47] *((const byte*) plots_per_frame + (byte) frame_cnt#0) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt#0)
[47] *((const byte*) plots_per_frame + (byte) frame_cnt) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt)
to:main::@1
(void()) bitmap_plot((word) bitmap_plot::x , (byte) bitmap_plot::y)
@@ -446,16 +446,15 @@ divr16u::@return: scope:[divr16u] from divr16u::@6
interrupt(HARDWARE_CLOBBER)(void()) irq()
irq: scope:[irq] from
[224] *((const byte*) BGCOL) ← (const byte) WHITE
[225] if((byte) 0==(byte) frame_cnt#0) goto irq::@1
[225] if((byte) 0==(byte) frame_cnt) goto irq::@1
to:irq::@2
irq::@2: scope:[irq] from irq
[226] (byte) frame_cnt#1 ← ++ (byte) frame_cnt#0
[226] (byte) frame_cnt ← ++ (byte) frame_cnt
to:irq::@1
irq::@1: scope:[irq] from irq irq::@2
[227] (byte) frame_cnt#10 ← phi( irq/(byte) frame_cnt#0 irq::@2/(byte) frame_cnt#1 )
[228] *((const byte*) BGCOL) ← (const byte) BLACK
[229] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[227] *((const byte*) BGCOL) ← (const byte) BLACK
[228] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
to:irq::@return
irq::@return: scope:[irq] from irq::@1
[230] return
[229] return
to:@return
File diff suppressed because it is too large Load Diff
+2 -5
View File
@@ -129,10 +129,7 @@
(word) divr16u::return#0 return zp[2]:16 5.285714285714286
(word) divr16u::return#2 return zp[2]:16 4.0
(word) divr16u::return#3 return zp[2]:16 4.0
(byte) frame_cnt
(byte) frame_cnt#0 frame_cnt zp[1]:18 0.6382978723404255
(byte) frame_cnt#1 frame_cnt zp[1]:18 4.0
(byte) frame_cnt#10 frame_cnt zp[1]:18 40.0
(byte) frame_cnt loadstore zp[1]:18 0.6521739130434783
(void()) init_irq()
(label) init_irq::@return
interrupt(HARDWARE_CLOBBER)(void()) irq()
@@ -379,7 +376,7 @@ zp[2]:12 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u
zp[2]:14 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 sin16s_gen2::i#2 sin16s_gen2::i#1 memset::num#2 memset::end#0 main::idx_y#3 main::idx_y#10 main::idx_y#1 ]
zp[2]:16 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 divr16u::return#2 divr16u::return#3 div32u16u::quotient_lo#0 sin16s_gen2::sintab#2 sin16s_gen2::sintab#0 ]
reg byte x [ divr16u::i#2 divr16u::i#1 ]
zp[1]:18 [ frame_cnt#10 frame_cnt#0 frame_cnt#1 ]
zp[1]:18 [ frame_cnt ]
reg byte alu [ main::$7 ]
reg byte alu [ main::$12 ]
reg byte x [ bitmap_plot::y#0 ]
+1 -1
View File
@@ -44,9 +44,9 @@
.const SIZEOF_SIGNED_WORD = 2
.label BITMAP = $2000
.label SCREEN = $400
.label frame_cnt = $12
// Remainder after unsigned 16-bit division
.label rem16u = $15
.label frame_cnt = $12
__b1:
// Counts frames - updated by the IRQ
lda #1
+7 -8
View File
@@ -2,7 +2,7 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) frame_cnt#0 ← (byte) 1
[1] (byte) frame_cnt ← (byte) 1
to:@2
@2: scope:[] from @1
[2] phi()
@@ -72,7 +72,7 @@ main::@13: scope:[main] from main::@12
[40] call bitmap_plot
to:main::@14
main::@14: scope:[main] from main::@13
[41] *((const byte*) plots_per_frame + (byte) frame_cnt#0) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt#0)
[41] *((const byte*) plots_per_frame + (byte) frame_cnt) ← ++ *((const byte*) plots_per_frame + (byte) frame_cnt)
[42] (word) main::idx_x#1 ← (word) main::idx_x#11 + (byte) main::r_add#10
[43] if((word) main::idx_x#1<(word) $200) goto main::@16
to:main::@3
@@ -465,16 +465,15 @@ divr16u::@return: scope:[divr16u] from divr16u::@6
interrupt(HARDWARE_CLOBBER)(void()) irq()
irq: scope:[irq] from
[233] *((const byte*) BGCOL) ← (const byte) WHITE
[234] if((byte) 0==(byte) frame_cnt#0) goto irq::@1
[234] if((byte) 0==(byte) frame_cnt) goto irq::@1
to:irq::@2
irq::@2: scope:[irq] from irq
[235] (byte) frame_cnt#1 ← ++ (byte) frame_cnt#0
[235] (byte) frame_cnt ← ++ (byte) frame_cnt
to:irq::@1
irq::@1: scope:[irq] from irq irq::@2
[236] (byte) frame_cnt#2 ← phi( irq/(byte) frame_cnt#0 irq::@2/(byte) frame_cnt#1 )
[237] *((const byte*) BGCOL) ← (const byte) BLACK
[238] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[236] *((const byte*) BGCOL) ← (const byte) BLACK
[237] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
to:irq::@return
irq::@return: scope:[irq] from irq::@1
[239] return
[238] return
to:@return
File diff suppressed because it is too large Load Diff
+2 -5
View File
@@ -130,10 +130,7 @@
(word) divr16u::return#0 return zp[2]:16 5.285714285714286
(word) divr16u::return#2 return zp[2]:16 4.0
(word) divr16u::return#3 return zp[2]:16 4.0
(byte) frame_cnt
(byte) frame_cnt#0 frame_cnt zp[1]:18 0.5454545454545455
(byte) frame_cnt#1 frame_cnt zp[1]:18 4.0
(byte) frame_cnt#2 frame_cnt zp[1]:18 40.0
(byte) frame_cnt loadstore zp[1]:18 0.5555555555555556
(void()) init_irq()
(label) init_irq::@return
interrupt(HARDWARE_CLOBBER)(void()) irq()
@@ -393,7 +390,7 @@ reg byte x [ mulu16_sel::select#5 ]
zp[2]:14 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 sin16s_gen2::i#2 sin16s_gen2::i#1 memset::str#3 memset::dst#2 memset::dst#4 memset::dst#1 main::idx_y#3 main::idx_y#10 main::idx_y#1 ]
zp[2]:16 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 divr16u::return#2 divr16u::return#3 div32u16u::quotient_lo#0 sin16s_gen2::sintab#2 sin16s_gen2::sintab#0 ]
reg byte x [ divr16u::i#2 divr16u::i#1 ]
zp[1]:18 [ frame_cnt#2 frame_cnt#0 frame_cnt#1 ]
zp[1]:18 [ frame_cnt ]
reg byte x [ bitmap_plot::y#0 ]
zp[2]:19 [ bitmap_plot::plotter#0 bitmap_plot::plotter#1 main::$13 main::$14 main::y#0 mulu16_sel::v1#5 mulu16_sel::v1#3 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 sin16s::x3#0 sin16s::x2#0 sin16s::x4#0 mulu16_sel::return#1 mulu16_sel::return#10 mul16u::b#0 ]
reg byte a [ bitmap_plot::$2 ]
+3 -3
View File
@@ -2,7 +2,7 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) irq_raster_next#0 ← (byte) 0
[1] (byte) irq_raster_next ← (byte) 0
to:@2
@2: scope:[] from @1
[2] phi()
@@ -22,8 +22,8 @@ main::@return: scope:[main] from main
interrupt(HARDWARE_CLOBBER)(void()) irq()
irq: scope:[irq] from
[7] *((const byte*) BORDERCOL) ← (const byte) DARK_GREY
[8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte) $15
[9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1
[8] (byte) irq_raster_next ← (byte) irq_raster_next + (byte) $15
[9] (byte) irq::raster_next#0 ← (byte) irq_raster_next
[10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte) 7
[11] if((byte~) irq::$0!=(byte) 0) goto irq::@1
to:irq::@2
+36 -61
View File
@@ -16,38 +16,32 @@ main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
(byte) irq_raster_next#0 ← (number) 0
(byte) irq_raster_next ← (number) 0
to:@2
interrupt(HARDWARE_CLOBBER)(void()) irq()
irq: scope:[irq] from
(byte) irq_raster_next#3 ← phi( @2/(byte) irq_raster_next#5 )
*((const byte*) BORDERCOL) ← (const byte) DARK_GREY
(byte) irq_raster_next#1 ← (byte) irq_raster_next#3 + (number) $15
(byte) irq::raster_next#0 ← (byte) irq_raster_next#1
(byte) irq_raster_next ← (byte) irq_raster_next + (number) $15
(byte) irq::raster_next#0 ← (byte) irq_raster_next
(number~) irq::$0 ← (byte) irq::raster_next#0 & (number) 7
(bool~) irq::$1 ← (number~) irq::$0 == (number) 0
(bool~) irq::$2 ← ! (bool~) irq::$1
if((bool~) irq::$2) goto irq::@1
to:irq::@2
irq::@1: scope:[irq] from irq irq::@2
(byte) irq_raster_next#6 ← phi( irq/(byte) irq_raster_next#1 irq::@2/(byte) irq_raster_next#7 )
(byte) irq::raster_next#2 ← phi( irq/(byte) irq::raster_next#0 irq::@2/(byte) irq::raster_next#1 )
*((const byte*) RASTER) ← (byte) irq::raster_next#2
*((const byte*) BORDERCOL) ← (const byte) BLACK
to:irq::@return
irq::@2: scope:[irq] from irq
(byte) irq_raster_next#7 ← phi( irq/(byte) irq_raster_next#1 )
(byte) irq::raster_next#3 ← phi( irq/(byte) irq::raster_next#0 )
(byte) irq::raster_next#1 ← (byte) irq::raster_next#3 - (number) 1
to:irq::@1
irq::@return: scope:[irq] from irq::@1
(byte) irq_raster_next#4 ← phi( irq::@1/(byte) irq_raster_next#6 )
(byte) irq_raster_next#2 ← (byte) irq_raster_next#4
return
to:@return
@2: scope:[] from @1
(byte) irq_raster_next#5 ← phi( @1/(byte) irq_raster_next#0 )
call main
to:@3
@3: scope:[] from @2
@@ -77,26 +71,18 @@ interrupt(HARDWARE_CLOBBER)(void()) irq()
(byte) irq::raster_next#1
(byte) irq::raster_next#2
(byte) irq::raster_next#3
(byte) irq_raster_next
(byte) irq_raster_next#0
(byte) irq_raster_next#1
(byte) irq_raster_next#2
(byte) irq_raster_next#3
(byte) irq_raster_next#4
(byte) irq_raster_next#5
(byte) irq_raster_next#6
(byte) irq_raster_next#7
(byte) irq_raster_next loadstore
(void()) main()
(label) main::@return
Adding number conversion cast (unumber) 0 in (byte) irq_raster_next#0 ← (number) 0
Adding number conversion cast (unumber) $15 in (byte) irq_raster_next#1 ← (byte) irq_raster_next#3 + (number) $15
Adding number conversion cast (unumber) 0 in (byte) irq_raster_next ← (number) 0
Adding number conversion cast (unumber) $15 in (byte) irq_raster_next ← (byte) irq_raster_next + (number) $15
Adding number conversion cast (unumber) 7 in (number~) irq::$0 ← (byte) irq::raster_next#0 & (number) 7
Adding number conversion cast (unumber) irq::$0 in (number~) irq::$0 ← (byte) irq::raster_next#0 & (unumber)(number) 7
Adding number conversion cast (unumber) 0 in (bool~) irq::$1 ← (unumber~) irq::$0 == (number) 0
Adding number conversion cast (unumber) 1 in (byte) irq::raster_next#1 ← (byte) irq::raster_next#3 - (number) 1
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) irq_raster_next#0 ← (unumber)(number) 0
Inlining cast (byte) irq_raster_next ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (void()**) 788
Simplifying constant pointer cast (byte*) 53280
@@ -114,18 +100,11 @@ Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) irq::$0 ← (byte) irq::raster_next#0 & (byte) 7
Inversing boolean not [9] (bool~) irq::$2 ← (byte~) irq::$0 != (byte) 0 from [8] (bool~) irq::$1 ← (byte~) irq::$0 == (byte) 0
Inversing boolean not [8] (bool~) irq::$2 ← (byte~) irq::$0 != (byte) 0 from [7] (bool~) irq::$1 ← (byte~) irq::$0 == (byte) 0
Successful SSA optimization Pass2UnaryNotSimplification
Alias (byte) irq::raster_next#0 = (byte) irq::raster_next#3
Alias (byte) irq_raster_next#1 = (byte) irq_raster_next#7
Alias (byte) irq_raster_next#2 = (byte) irq_raster_next#4 (byte) irq_raster_next#6
Alias (byte) irq_raster_next#0 = (byte) irq_raster_next#5
Successful SSA optimization Pass2AliasElimination
Alias (byte) irq_raster_next#1 = (byte) irq_raster_next#2
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) irq_raster_next#3 (byte) irq_raster_next#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) irq::$2 [10] if((byte~) irq::$0!=(byte) 0) goto irq::@1
Simple Condition (bool~) irq::$2 [9] if((byte~) irq::$0!=(byte) 0) goto irq::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Added new block during phi lifting irq::@3(between irq and irq::@1)
Adding NOP phi() at start of @begin
@@ -150,7 +129,7 @@ FINAL CONTROL FLOW GRAPH
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) irq_raster_next#0 ← (byte) 0
[1] (byte) irq_raster_next ← (byte) 0
to:@2
@2: scope:[] from @1
[2] phi()
@@ -170,8 +149,8 @@ main::@return: scope:[main] from main
interrupt(HARDWARE_CLOBBER)(void()) irq()
irq: scope:[irq] from
[7] *((const byte*) BORDERCOL) ← (const byte) DARK_GREY
[8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte) $15
[9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1
[8] (byte) irq_raster_next ← (byte) irq_raster_next + (byte) $15
[9] (byte) irq::raster_next#0 ← (byte) irq_raster_next
[10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte) 7
[11] if((byte~) irq::$0!=(byte) 0) goto irq::@1
to:irq::@2
@@ -195,21 +174,19 @@ interrupt(HARDWARE_CLOBBER)(void()) irq()
(byte) irq::raster_next#0 2.6666666666666665
(byte) irq::raster_next#1 4.0
(byte) irq::raster_next#2 6.0
(byte) irq_raster_next
(byte) irq_raster_next#0 4.0
(byte) irq_raster_next#1 4.0
(byte) irq_raster_next loadstore 8.0
(void()) main()
Initial phi equivalence classes
[ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ]
Coalescing volatile variable equivalence classes [ irq_raster_next#0 ] and [ irq_raster_next#1 ]
Added variable irq_raster_next to live range equivalence class [ irq_raster_next ]
Added variable irq::$0 to live range 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 ]
[ irq::$0 ]
Allocated zp[1]:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ]
Allocated zp[1]:3 [ irq_raster_next#0 irq_raster_next#1 ]
Allocated zp[1]:3 [ irq_raster_next ]
Allocated zp[1]:4 [ irq::$0 ]
INITIAL ASM
@@ -231,7 +208,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte) irq_raster_next#0 ← (byte) 0 -- vbuz1=vbuc1
// [1] (byte) irq_raster_next ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z irq_raster_next
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -270,11 +247,11 @@ irq: {
// [7] *((const byte*) BORDERCOL) ← (const byte) DARK_GREY -- _deref_pbuc1=vbuc2
lda #DARK_GREY
sta BORDERCOL
// [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte) $15 -- vbuz1=vbuz1_plus_vbuc1
// [8] (byte) irq_raster_next ← (byte) irq_raster_next + (byte) $15 -- vbuz1=vbuz1_plus_vbuc1
lax.z irq_raster_next
axs #-[$15]
stx.z irq_raster_next
// [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuz1=vbuz2
// [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next -- vbuz1=vbuz2
// Setup next interrupt
lda.z irq_raster_next
sta.z raster_next
@@ -319,27 +296,27 @@ irq: {
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] (byte) irq_raster_next#0 ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [1] (byte) irq_raster_next ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [5] *((const void()**) KERNEL_IRQ) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [7] *((const byte*) BORDERCOL) ← (const byte) DARK_GREY [ irq_raster_next#0 ] ( [ irq_raster_next#0 ] ) always clobbers reg byte a
Statement [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte) $15 [ irq_raster_next#1 ] ( [ irq_raster_next#1 ] ) always clobbers reg byte a reg byte x
Statement [7] *((const byte*) BORDERCOL) ← (const byte) DARK_GREY [ ] ( [ ] ) always clobbers reg byte a
Statement [8] (byte) irq_raster_next ← (byte) irq_raster_next + (byte) $15 [ irq_raster_next ] ( [ irq_raster_next ] ) always clobbers reg byte a reg byte x
Statement [15] *((const byte*) BORDERCOL) ← (const byte) BLACK [ ] ( [ ] ) always clobbers reg byte a
Statement [16] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y
Potential registers zp[1]:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:3 [ irq_raster_next#0 irq_raster_next#1 ] : zp[1]:3 ,
Potential registers zp[1]:3 [ irq_raster_next ] : zp[1]:3 ,
Potential registers zp[1]:4 [ irq::$0 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [irq] 12.67: zp[1]:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] 4: zp[1]:4 [ irq::$0 ]
Uplift Scope [] 8: zp[1]:3 [ irq_raster_next#0 irq_raster_next#1 ]
Uplift Scope [] 8: zp[1]:3 [ irq_raster_next ]
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[1]:3 [ irq_raster_next#0 irq_raster_next#1 ]
Uplifting [] best 246 combination zp[1]:3 [ irq_raster_next ]
Uplifting [main] best 246 combination
Attempting to uplift remaining variables inzp[1]:3 [ irq_raster_next#0 irq_raster_next#1 ]
Uplifting [] best 246 combination zp[1]:3 [ irq_raster_next#0 irq_raster_next#1 ]
Allocated (was zp[1]:3) zp[1]:2 [ irq_raster_next#0 irq_raster_next#1 ]
Attempting to uplift remaining variables inzp[1]:3 [ irq_raster_next ]
Uplifting [] best 246 combination zp[1]:3 [ irq_raster_next ]
Allocated (was zp[1]:3) zp[1]:2 [ irq_raster_next ]
Interrupt procedure irq clobbers AXCNZ
Removing interrupt register storage sty regy+1 in CHU16 entry interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage regy: in CHU30 [16] return - exit interrupt(HARDWARE_CLOBBER)
@@ -363,7 +340,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte) irq_raster_next#0 ← (byte) 0 -- vbuz1=vbuc1
// [1] (byte) irq_raster_next ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z irq_raster_next
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -399,11 +376,11 @@ irq: {
// [7] *((const byte*) BORDERCOL) ← (const byte) DARK_GREY -- _deref_pbuc1=vbuc2
lda #DARK_GREY
sta BORDERCOL
// [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte) $15 -- vbuz1=vbuz1_plus_vbuc1
// [8] (byte) irq_raster_next ← (byte) irq_raster_next + (byte) $15 -- vbuz1=vbuz1_plus_vbuc1
lax.z irq_raster_next
axs #-[$15]
stx.z irq_raster_next
// [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuxx=vbuz1
// [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next -- vbuxx=vbuz1
// Setup next interrupt
ldx.z irq_raster_next
// [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte) 7 -- vbuaa=vbuxx_band_vbuc1
@@ -488,14 +465,12 @@ interrupt(HARDWARE_CLOBBER)(void()) irq()
(byte) irq::raster_next#0 reg byte x 2.6666666666666665
(byte) irq::raster_next#1 reg byte x 4.0
(byte) irq::raster_next#2 reg byte x 6.0
(byte) irq_raster_next
(byte) irq_raster_next#0 irq_raster_next zp[1]:2 4.0
(byte) irq_raster_next#1 irq_raster_next zp[1]:2 4.0
(byte) irq_raster_next loadstore zp[1]:2 8.0
(void()) main()
(label) main::@return
reg byte x [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ]
zp[1]:2 [ irq_raster_next#0 irq_raster_next#1 ]
zp[1]:2 [ irq_raster_next ]
reg byte a [ irq::$0 ]
@@ -518,7 +493,7 @@ Score: 159
// @1
__b1:
// irq_raster_next = 0
// [1] (byte) irq_raster_next#0 ← (byte) 0 -- vbuz1=vbuc1
// [1] (byte) irq_raster_next ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z irq_raster_next
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -551,12 +526,12 @@ irq: {
lda #DARK_GREY
sta BORDERCOL
// irq_raster_next += 21
// [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte) $15 -- vbuz1=vbuz1_plus_vbuc1
// [8] (byte) irq_raster_next ← (byte) irq_raster_next + (byte) $15 -- vbuz1=vbuz1_plus_vbuc1
lax.z irq_raster_next
axs #-[$15]
stx.z irq_raster_next
// raster_next = irq_raster_next
// [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuxx=vbuz1
// [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next -- vbuxx=vbuz1
// Setup next interrupt
// raster_next&7
// [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte) 7 -- vbuaa=vbuxx_band_vbuc1
+2 -4
View File
@@ -16,12 +16,10 @@ interrupt(HARDWARE_CLOBBER)(void()) irq()
(byte) irq::raster_next#0 reg byte x 2.6666666666666665
(byte) irq::raster_next#1 reg byte x 4.0
(byte) irq::raster_next#2 reg byte x 6.0
(byte) irq_raster_next
(byte) irq_raster_next#0 irq_raster_next zp[1]:2 4.0
(byte) irq_raster_next#1 irq_raster_next zp[1]:2 4.0
(byte) irq_raster_next loadstore zp[1]:2 8.0
(void()) main()
(label) main::@return
reg byte x [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ]
zp[1]:2 [ irq_raster_next#0 irq_raster_next#1 ]
zp[1]:2 [ irq_raster_next ]
reg byte a [ irq::$0 ]
+6 -6
View File
@@ -57,11 +57,11 @@
.const IRQ_RASTER_FIRST = SPRITES_FIRST_YPOS+$13
.label SIN_SPRITE = $2800
.const toSpritePtr1_return = PLAYFIELD_SPRITES/$40
.label render_screen_showing = 5
.label irq_raster_next = 6
.label irq_sprite_ypos = 7
.label irq_sprite_ptr = 8
.label irq_cnt = 9
.label render_screen_showing = 4
.label irq_raster_next = 5
.label irq_sprite_ypos = 6
.label irq_sprite_ptr = 7
.label irq_cnt = 8
.label sin_idx = 3
__b1:
// The screen currently being showed to the user. 0x00 for screen 1 / 0x20 for screen 2.
@@ -219,7 +219,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/$40
.label raster_sprite_gfx_modify = 4
.label raster_sprite_gfx_modify = 9
sta rega+1
stx regx+1
//(*BGCOL)++;
+34 -38
View File
@@ -2,7 +2,7 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) render_screen_showing#0 ← (byte) 0
[1] (byte) render_screen_showing ← (byte) 0
kickasm(location (const byte*) PLAYFIELD_SPRITES) {{ .var sprites = LoadPicture("playfield-sprites.png", List().add($010101, $000000))
// Put the sprites into memory
.for(var sy=0;sy<10;sy++) {
@@ -20,15 +20,15 @@
}}
to:@2
@2: scope:[] from @1
[3] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST
[4] (byte) irq_sprite_ypos#0 ← (const byte) SPRITES_FIRST_YPOS+(byte) $15
[3] (byte) irq_raster_next ← (const byte) IRQ_RASTER_FIRST
[4] (byte) irq_sprite_ypos ← (const byte) SPRITES_FIRST_YPOS+(byte) $15
to:toSpritePtr1
toSpritePtr1: scope:[] from @2
[5] phi()
to:@5
@5: scope:[] from toSpritePtr1
[6] (byte) irq_sprite_ptr#0 ← (const byte) toSpritePtr1_return#0+(byte) 3
[7] (byte) irq_cnt#0 ← (byte) 0
[6] (byte) irq_sprite_ptr ← (const byte) toSpritePtr1_return#0+(byte) 3
[7] (byte) irq_cnt ← (byte) 0
to:@3
@3: scope:[] from @5
kickasm(location (const byte*) SIN_SPRITE) {{ .fill $40, $ff
@@ -164,20 +164,20 @@ sprites_init::@return: scope:[sprites_init] from sprites_init::@1
interrupt(HARDWARE_CLOBBER)(void()) sprites_irq()
sprites_irq: scope:[sprites_irq] from
asm { cld }
[73] (byte) sprites_irq::ypos#0 ← (byte) irq_sprite_ypos#0
[73] (byte) sprites_irq::ypos#0 ← (byte) irq_sprite_ypos
[74] *((const byte*) SPRITES_YPOS) ← (byte) sprites_irq::ypos#0
[75] *((const byte*) SPRITES_YPOS+(byte) 2) ← (byte) sprites_irq::ypos#0
[76] *((const byte*) SPRITES_YPOS+(byte) 4) ← (byte) sprites_irq::ypos#0
[77] *((const byte*) SPRITES_YPOS+(byte) 6) ← (byte) sprites_irq::ypos#0
[78] (byte~) sprites_irq::$0 ← (byte) irq_raster_next#0 + (byte) 1
[79] (byte) sprites_irq::raster_sprite_gfx_modify#0 ← (byte~) sprites_irq::$0
[78] (byte~) sprites_irq::$0 ← (byte) irq_raster_next + (byte) 1
[79] (byte) sprites_irq::raster_sprite_gfx_modify ← (byte~) sprites_irq::$0
to:sprites_irq::@8
sprites_irq::@8: scope:[sprites_irq] from sprites_irq sprites_irq::@8
[80] if(*((const byte*) RASTER)<(byte) sprites_irq::raster_sprite_gfx_modify#0) goto sprites_irq::@8
[80] if(*((const byte*) RASTER)<(byte) sprites_irq::raster_sprite_gfx_modify) goto sprites_irq::@8
to:sprites_irq::@9
sprites_irq::@9: scope:[sprites_irq] from sprites_irq::@8
[81] (byte) sprites_irq::ptr#0 ← (byte) irq_sprite_ptr#0
[82] if((byte) render_screen_showing#0==(byte) 0) goto sprites_irq::@1
[81] (byte) sprites_irq::ptr#0 ← (byte) irq_sprite_ptr
[82] if((byte) render_screen_showing==(byte) 0) goto sprites_irq::@1
to:sprites_irq::@10
sprites_irq::@10: scope:[sprites_irq] from sprites_irq::@9
[83] *((const byte*) PLAYFIELD_SPRITE_PTRS_2) ← (byte) sprites_irq::ptr#0
@@ -188,49 +188,45 @@ sprites_irq::@10: scope:[sprites_irq] from sprites_irq::@9
[88] *((const byte*) PLAYFIELD_SPRITE_PTRS_2+(byte) 3) ← (byte) sprites_irq::ptr#4
to:sprites_irq::@2
sprites_irq::@2: scope:[sprites_irq] from sprites_irq::@1 sprites_irq::@10
[89] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0
[90] if((byte) irq_cnt#1==(byte) 9) goto sprites_irq::@3
[89] (byte) irq_cnt ← ++ (byte) irq_cnt
[90] if((byte) irq_cnt==(byte) 9) goto sprites_irq::@3
to:sprites_irq::@6
sprites_irq::@6: scope:[sprites_irq] from sprites_irq::@2
[91] if((byte) irq_cnt#1==(byte) $a) goto sprites_irq::@4
[91] if((byte) irq_cnt==(byte) $a) goto sprites_irq::@4
to:sprites_irq::@7
sprites_irq::@7: scope:[sprites_irq] from sprites_irq::@6
[92] (byte) irq_raster_next#3 ← (byte) irq_raster_next#0 + (byte) $14
[93] (byte) irq_sprite_ypos#3 ← (byte) irq_sprite_ypos#0 + (byte) $15
[94] (byte) irq_sprite_ptr#3 ← (byte) irq_sprite_ptr#0 + (byte) 3
[92] (byte) irq_raster_next ← (byte) irq_raster_next + (byte) $14
[93] (byte) irq_sprite_ypos ← (byte) irq_sprite_ypos + (byte) $15
[94] (byte) irq_sprite_ptr ← (byte) irq_sprite_ptr + (byte) 3
to:sprites_irq::@5
sprites_irq::@5: scope:[sprites_irq] from sprites_irq::@11 sprites_irq::@4 sprites_irq::@7
[95] (byte) irq_sprite_ptr#11 ← phi( sprites_irq::@11/(byte) irq_sprite_ptr#1 sprites_irq::@4/(byte) irq_sprite_ptr#2 sprites_irq::@7/(byte) irq_sprite_ptr#3 )
[95] (byte) irq_sprite_ypos#11 ← phi( sprites_irq::@11/(byte) irq_sprite_ypos#1 sprites_irq::@4/(byte) irq_sprite_ypos#2 sprites_irq::@7/(byte) irq_sprite_ypos#3 )
[95] (byte) irq_cnt#3 ← phi( sprites_irq::@11/(byte) irq_cnt#1 sprites_irq::@4/(byte) irq_cnt#2 sprites_irq::@7/(byte) irq_cnt#1 )
[95] (byte) irq_raster_next#4 ← phi( sprites_irq::@11/(byte) irq_raster_next#1 sprites_irq::@4/(byte) irq_raster_next#2 sprites_irq::@7/(byte) irq_raster_next#3 )
[96] *((const byte*) RASTER) ← (byte) irq_raster_next#4
[97] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[95] *((const byte*) RASTER) ← (byte) irq_raster_next
[96] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
to:sprites_irq::@return
sprites_irq::@return: scope:[sprites_irq] from sprites_irq::@5
[98] return
[97] return
to:@return
sprites_irq::@4: scope:[sprites_irq] from sprites_irq::@6
[99] (byte) irq_cnt#2 ← (byte) 0
[100] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST
[101] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte) $15
[102] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte) 3
[98] (byte) irq_cnt ← (byte) 0
[99] (byte) irq_raster_next ← (const byte) IRQ_RASTER_FIRST
[100] (byte) irq_sprite_ypos ← (byte) irq_sprite_ypos + (byte) $15
[101] (byte) irq_sprite_ptr ← (byte) irq_sprite_ptr + (byte) 3
to:sprites_irq::@5
sprites_irq::@3: scope:[sprites_irq] from sprites_irq::@2
[103] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte) $15
[104] (byte) irq_sprite_ypos#1 ← (const byte) SPRITES_FIRST_YPOS
[102] (byte) irq_raster_next ← (byte) irq_raster_next + (byte) $15
[103] (byte) irq_sprite_ypos ← (const byte) SPRITES_FIRST_YPOS
to:sprites_irq::toSpritePtr2
sprites_irq::toSpritePtr2: scope:[sprites_irq] from sprites_irq::@3
[105] phi()
[104] phi()
to:sprites_irq::@11
sprites_irq::@11: scope:[sprites_irq] from sprites_irq::toSpritePtr2
[106] (byte) irq_sprite_ptr#1 ← (const byte) sprites_irq::toSpritePtr2_return#0
[105] (byte) irq_sprite_ptr ← (const byte) sprites_irq::toSpritePtr2_return#0
to:sprites_irq::@5
sprites_irq::@1: scope:[sprites_irq] from sprites_irq::@9
[107] *((const byte*) PLAYFIELD_SPRITE_PTRS_1) ← (byte) sprites_irq::ptr#0
[108] (byte) sprites_irq::ptr#1 ← ++ (byte) sprites_irq::ptr#0
[109] *((const byte*) PLAYFIELD_SPRITE_PTRS_1+(byte) 1) ← (byte) sprites_irq::ptr#1
[110] *((const byte*) PLAYFIELD_SPRITE_PTRS_1+(byte) 2) ← (byte) sprites_irq::ptr#1
[111] (byte) sprites_irq::ptr#2 ← ++ (byte) sprites_irq::ptr#1
[112] *((const byte*) PLAYFIELD_SPRITE_PTRS_1+(byte) 3) ← (byte) sprites_irq::ptr#2
[106] *((const byte*) PLAYFIELD_SPRITE_PTRS_1) ← (byte) sprites_irq::ptr#0
[107] (byte) sprites_irq::ptr#1 ← ++ (byte) sprites_irq::ptr#0
[108] *((const byte*) PLAYFIELD_SPRITE_PTRS_1+(byte) 1) ← (byte) sprites_irq::ptr#1
[109] *((const byte*) PLAYFIELD_SPRITE_PTRS_1+(byte) 2) ← (byte) sprites_irq::ptr#1
[110] (byte) sprites_irq::ptr#2 ← ++ (byte) sprites_irq::ptr#1
[111] *((const byte*) PLAYFIELD_SPRITE_PTRS_1+(byte) 3) ← (byte) sprites_irq::ptr#2
to:sprites_irq::@2
File diff suppressed because it is too large Load Diff
+12 -33
View File
@@ -43,29 +43,10 @@
(const byte*) SPRITES_YPOS = (byte*) 53249
(const word) SPRITE_PTRS = (number) $3f8
(const byte*) VIC_CONTROL = (byte*) 53265
(byte) irq_cnt
(byte) irq_cnt#0 irq_cnt zp[1]:9 0.17391304347826086
(byte) irq_cnt#1 irq_cnt zp[1]:9 1.0
(byte) irq_cnt#2 irq_cnt zp[1]:9 1.0
(byte) irq_cnt#3 irq_cnt zp[1]:9 60.0
(byte) irq_raster_next
(byte) irq_raster_next#0 irq_raster_next zp[1]:6 0.3076923076923077
(byte) irq_raster_next#1 irq_raster_next zp[1]:6 1.0
(byte) irq_raster_next#2 irq_raster_next zp[1]:6 1.3333333333333333
(byte) irq_raster_next#3 irq_raster_next zp[1]:6 1.3333333333333333
(byte) irq_raster_next#4 irq_raster_next zp[1]:6 8.0
(byte) irq_sprite_ptr
(byte) irq_sprite_ptr#0 irq_sprite_ptr zp[1]:8 0.25806451612903225
(byte) irq_sprite_ptr#1 irq_sprite_ptr zp[1]:8 4.0
(byte) irq_sprite_ptr#11 irq_sprite_ptr zp[1]:8 60.0
(byte) irq_sprite_ptr#2 irq_sprite_ptr zp[1]:8 4.0
(byte) irq_sprite_ptr#3 irq_sprite_ptr zp[1]:8 4.0
(byte) irq_sprite_ypos
(byte) irq_sprite_ypos#0 irq_sprite_ypos zp[1]:7 0.27586206896551724
(byte) irq_sprite_ypos#1 irq_sprite_ypos zp[1]:7 1.3333333333333333
(byte) irq_sprite_ypos#11 irq_sprite_ypos zp[1]:7 60.0
(byte) irq_sprite_ypos#2 irq_sprite_ypos zp[1]:7 2.0
(byte) irq_sprite_ypos#3 irq_sprite_ypos zp[1]:7 2.0
(byte) irq_cnt loadstore zp[1]:8 6.0
(byte) irq_raster_next loadstore zp[1]:5 1.0
(byte) irq_sprite_ptr loadstore zp[1]:7 1.5555555555555558
(byte) irq_sprite_ypos loadstore zp[1]:6 14.0
(void()) loop()
(byte~) loop::$1 reg byte a 202.0
(label) loop::@1
@@ -116,8 +97,7 @@
(byte) main::ypos
(byte) main::ypos#1 ypos zp[1]:2 7.333333333333333
(byte) main::ypos#2 ypos zp[1]:2 3.666666666666667
(byte) render_screen_showing
(byte) render_screen_showing#0 render_screen_showing zp[1]:5 0.4
(byte) render_screen_showing loadstore zp[1]:4 0.4
(byte) sin_idx
(byte) sin_idx#10 sin_idx zp[1]:3 3.666666666666667
(byte) sin_idx#3 sin_idx zp[1]:3 22.0
@@ -152,8 +132,7 @@ interrupt(HARDWARE_CLOBBER)(void()) sprites_irq()
(byte) sprites_irq::ptr#2 reg byte a 4.0
(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[1]:4 6.5
(byte) sprites_irq::raster_sprite_gfx_modify loadstore zp[1]:9 6.5
(label) sprites_irq::toSpritePtr2
(byte) sprites_irq::toSpritePtr2_return
(const byte) sprites_irq::toSpritePtr2_return#0 toSpritePtr2_return = (byte)(word)(const byte*) PLAYFIELD_SPRITES/(byte) $40
@@ -172,18 +151,18 @@ zp[1]:2 [ loop::s#2 loop::s#1 main::ypos#2 main::ypos#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[1]:3 [ sprites_init::xpos#2 sprites_init::xpos#1 sin_idx#10 sin_idx#3 main::xpos#2 main::xpos#1 ]
zp[1]:4 [ sprites_irq::raster_sprite_gfx_modify#0 ]
zp[1]:5 [ render_screen_showing#0 ]
zp[1]:6 [ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
zp[1]:7 [ irq_sprite_ypos#0 irq_sprite_ypos#11 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ]
zp[1]:8 [ irq_sprite_ptr#0 irq_sprite_ptr#11 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ]
zp[1]:9 [ irq_cnt#0 irq_cnt#3 irq_cnt#1 irq_cnt#2 ]
zp[1]:4 [ render_screen_showing ]
zp[1]:5 [ irq_raster_next ]
zp[1]:6 [ irq_sprite_ypos ]
zp[1]:7 [ irq_sprite_ptr ]
zp[1]:8 [ irq_cnt ]
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[1]:9 [ sprites_irq::raster_sprite_gfx_modify ]
reg byte x [ sprites_irq::ptr#0 ]
reg byte a [ sprites_irq::ptr#3 ]
reg byte a [ sprites_irq::ptr#4 ]
+93 -93
View File
@@ -118,55 +118,55 @@
// Right side collision (cell beyond the right side of the playfield)
.const COLLISION_RIGHT = 8
.const toSpritePtr1_return = PLAYFIELD_SPRITES/$40
.label render_screen_showing = $1a
.label irq_raster_next = $1b
.label irq_sprite_ypos = $1c
.label irq_sprite_ptr = $1d
.label irq_cnt = $1e
// Keyboard event buffer size. The number of events currently in the event buffer
.label keyboard_events_size = $13
.label render_screen_showing = 2
.label score_bcd = 3
.label irq_raster_next = $1c
.label irq_sprite_ypos = $1d
.label irq_sprite_ptr = $1e
.label irq_cnt = $1f
.label keyboard_events_size = $12
.label score_bcd = 2
// The rate of moving down the current piece (number of frames between moves if movedown is not forced)
.label current_movedown_slow = 8
.label current_ypos = $18
.label current_movedown_slow = 7
.label current_ypos = $17
// Position of top left corner of current moving piece on the playfield
.label current_xpos = $2b
.label current_xpos = $2a
// The curent piece orientation - each piece have 4 orientations (00/0x10/0x20/0x30).
// The orientation chooses one of the 4 sub-graphics of the piece.
.label current_orientation = $11
.label current_orientation = $10
// Pointer to the current piece in the current orientation. Updated each time current_orientation is updated.
.label current_piece_gfx = $19
.label current_piece_gfx = $18
// The char of the current piece
.label current_piece_char = $26
.label current_piece_char = $25
// Current level BCD-format
.label level_bcd = 9
.label level_bcd = 8
// The current moving piece. Points to the start of the piece definition.
.label current_piece = $2c
.label current_piece = $2b
// Is the game over?
.label game_over = $b
.label game_over = $a
// The index of the next moving piece. (0-6)
.label next_piece_idx = $a
.label next_piece_idx = 9
// Current level in normal (non-BCD) format
.label level = 7
.label level = 6
// The screen currently being rendered to. 0x00 for screen 1 / 0x20 for screen 2.
.label render_screen_render = $15
.label render_screen_render = $14
// The screen currently to show next to the user. 0x00 for screen 1 / 0x20 for screen 2.
// Show showing screen 1 and rendering to screen 2
.label render_screen_show = $14
.label render_screen_show = $13
// Counts up to the next movedown of current piece
.label current_movedown_counter = $c
.label current_movedown_counter = $b
// Current number of cleared lines in BCD-format
.label lines_bcd = $16
.label lines_bcd = $15
// The current moving piece. Points to the start of the piece definition.
.label current_piece_1 = $22
.label current_piece_1 = $21
// The screen currently being rendered to. 0x00 for screen 1 / 0x20 for screen 2.
.label render_screen_render_1 = $d
.label render_screen_render_1 = $c
// Position of top left corner of current moving piece on the playfield
.label current_xpos_1 = $e
.label current_xpos_1 = $d
// Pointer to the current piece in the current orientation. Updated each time current_orientation is updated.
.label current_piece_gfx_1 = $24
.label current_piece_gfx_1 = $23
// The char of the current piece
.label current_piece_char_1 = $f
.label current_piece_char_1 = $e
__b1:
// The screen currently being showed to the user. 0x00 for screen 1 / 0x20 for screen 2.
lda #0
@@ -300,7 +300,7 @@ render_score: {
.const score_offset = $28*5+$1c
.const lines_offset = $28*1+$16
.const level_offset = $28*$13+$1f
.label screen = $24
.label screen = $23
lda.z render_screen_render
cmp #0
beq __b1
@@ -366,12 +366,12 @@ render_score: {
// - offset: offset on the screen
// - bcd: The BCD-value to render
// - only_low: if non-zero only renders the low digit
// render_bcd(byte* zeropage($24) screen, word zeropage($22) offset, byte register(X) bcd, byte register(Y) only_low)
// render_bcd(byte* zeropage($23) screen, word zeropage($21) offset, byte register(X) bcd, byte register(Y) only_low)
render_bcd: {
.const ZERO_CHAR = $35
.label screen = $24
.label screen_pos = $22
.label offset = $22
.label screen = $23
.label screen_pos = $21
.label offset = $21
lda.z screen_pos
clc
adc.z screen
@@ -407,10 +407,10 @@ render_bcd: {
render_next: {
// Find the screen area
.const next_area_offset = $28*$c+$18+4
.label next_piece_char = $21
.label next_piece_gfx = $24
.label screen_next_area = $22
.label l = $d
.label next_piece_char = $20
.label next_piece_gfx = $23
.label screen_next_area = $21
.label l = $c
cmp #0
beq __b1
lda #<PLAYFIELD_SCREEN_2+next_area_offset
@@ -478,11 +478,11 @@ render_next: {
// Render the current moving piece at position (current_xpos, current_ypos)
// Ignores cases where parts of the tetromino is outside the playfield (sides/bottom) since the movement collision routine prevents this.
render_moving: {
.label ypos = $10
.label screen_line = $22
.label xpos = $21
.label i = $20
.label l = $12
.label ypos = $f
.label screen_line = $21
.label xpos = $20
.label i = $1f
.label l = $11
stx.z ypos
lda #0
sta.z l
@@ -532,11 +532,11 @@ render_moving: {
}
// Render the static playfield on the screen (all pieces already locked into place)
render_playfield: {
.label screen_line = $24
.label screen_line = $23
// Do not render the top 2 lines.
.label i = $f
.label c = $10
.label l = $e
.label i = $e
.label c = $f
.label l = $d
lda #PLAYFIELD_COLS*2
sta.z i
lda #2
@@ -576,11 +576,11 @@ render_playfield: {
// Perform any movement of the current piece
// key_event is the next keyboard_event() og 0xff if no keyboard event is pending
// Returns a byte signaling whether rendering is needed. (0 no render, >0 render needed)
// play_movement(byte zeropage($20) key_event)
// play_movement(byte zeropage($1f) key_event)
play_movement: {
.label render = $12
.label return = $12
.label key_event = $20
.label render = $11
.label return = $11
.label key_event = $1f
lda.z key_event
jsr play_move_down
txa
@@ -607,7 +607,7 @@ play_movement: {
// play_move_rotate(byte register(A) key_event)
play_move_rotate: {
// Handle keyboard events
.label orientation = $20
.label orientation = $1f
cmp #KEY_Z
beq __b1
cmp #KEY_X
@@ -652,17 +652,17 @@ play_move_rotate: {
}
// Test if there is a collision between the current piece moved to (x, y) and anything on the playfield or the playfield boundaries
// Returns information about the type of the collision detected
// play_collision(byte zeropage($21) xpos, byte zeropage($d) ypos, byte register(X) orientation)
// play_collision(byte zeropage($20) xpos, byte zeropage($c) ypos, byte register(X) orientation)
play_collision: {
.label xpos = $21
.label ypos = $d
.label piece_gfx = $22
.label yp = $d
.label playfield_line = $24
.label i = $2f
.label xp = $10
.label l = $e
.label i_1 = $f
.label xpos = $20
.label ypos = $c
.label piece_gfx = $21
.label yp = $c
.label playfield_line = $23
.label i = $2e
.label xp = $f
.label l = $d
.label i_1 = $e
txa
clc
adc.z piece_gfx
@@ -858,10 +858,10 @@ play_move_down: {
// Spawn a new piece
// Moves the next piece into the current and spawns a new next piece
play_spawn_current: {
.label __7 = $2e
.label __7 = $2d
// Spawn a new next piece
// Pick a random piece (0-6)
.label piece_idx = $a
.label piece_idx = 9
// Move next piece into current
ldx.z next_piece_idx
txa
@@ -905,8 +905,8 @@ play_spawn_current: {
// Update the score based on the number of lines removed
// play_update_score(byte register(X) removed)
play_update_score: {
.label lines_before = $26
.label add_bcd = $27
.label lines_before = $25
.label add_bcd = $26
cpx #0
beq __breturn
lda.z lines_bcd
@@ -1011,11 +1011,11 @@ play_increase_level: {
// Whenever a full line is detected the writing cursor is instructed to write to the same line once more.
// Returns the number of lines removed
play_remove_lines: {
.label c = $2b
.label x = $e
.label y = $c
.label removed = $d
.label full = $f
.label c = $2a
.label x = $d
.label y = $b
.label removed = $c
.label full = $e
lda #0
sta.z removed
sta.z y
@@ -1067,12 +1067,12 @@ play_remove_lines: {
}
// Lock the current piece onto the playfield
play_lock_current: {
.label yp = $18
.label playfield_line = $2c
.label xp = $12
.label i = $2f
.label l = $10
.label i_1 = $11
.label yp = $17
.label playfield_line = $2b
.label xp = $11
.label i = $2e
.label l = $f
.label i_1 = $10
lda #0
sta.z l
sta.z i_1
@@ -1120,10 +1120,10 @@ play_lock_current: {
}
// Determine if a specific key is currently pressed based on the last keyboard_event_scan()
// Returns 0 is not pressed and non-0 if pressed
// keyboard_event_pressed(byte zeropage($12) keycode)
// keyboard_event_pressed(byte zeropage($11) keycode)
keyboard_event_pressed: {
.label row_bits = $2e
.label keycode = $12
.label row_bits = $2d
.label keycode = $11
lda.z keycode
lsr
lsr
@@ -1158,9 +1158,9 @@ keyboard_event_get: {
// Handles debounce and only generates events when the status of a key changes.
// Also stores current status of modifiers in keyboard_modifiers.
keyboard_event_scan: {
.label row_scan = $2f
.label keycode = $21
.label row = $20
.label row_scan = $2e
.label keycode = $20
.label row = $1f
lda #0
sta.z keycode
sta.z row
@@ -1274,9 +1274,9 @@ render_show: {
}
// Initialize play data tables
play_init: {
.label pli = $22
.label pli = $21
// Initialize the playfield line pointers;
.label idx = $14
.label idx = $13
lda #0
sta.z idx
lda #<playfield
@@ -1366,7 +1366,7 @@ sprites_irq_init: {
}
// Setup the sprites
sprites_init: {
.label xpos = $15
.label xpos = $14
lda #$f
sta SPRITES_ENABLE
lda #0
@@ -1396,8 +1396,8 @@ sprites_init: {
render_init: {
.const vicSelectGfxBank1_toDd001_return = 3
// Initialize the screen line pointers;
.label li_1 = $16
.label li_2 = $2c
.label li_1 = $15
.label li_2 = $2b
lda #3
sta CIA2_PORT_A_DDR
lda #vicSelectGfxBank1_toDd001_return
@@ -1466,14 +1466,14 @@ render_init: {
}
// Copy the original screen data to the passed screen
// Also copies colors to 0xd800
// render_screen_original(byte* zeropage($24) screen)
// render_screen_original(byte* zeropage($23) screen)
render_screen_original: {
.const SPACE = 0
.label screen = $24
.label cols = $2c
.label oscr = $19
.label ocols = $22
.label y = $18
.label screen = $23
.label cols = $2b
.label oscr = $18
.label ocols = $21
.label y = $17
lda #0
sta.z y
lda #<PLAYFIELD_COLORS_ORIGINAL+$20*2
@@ -1573,7 +1573,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/$40
.label raster_sprite_gfx_modify = $1b
.label raster_sprite_gfx_modify = $2f
sta rega+1
stx regx+1
//(*BGCOL)++;
+35 -40
View File
@@ -2,7 +2,7 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) render_screen_showing#0 ← (byte) 0
[1] (byte) render_screen_showing ← (byte) 0
[2] (dword) score_bcd#0 ← (byte) 0
kickasm(location (const byte*) PLAYFIELD_CHARSET) {{ .fill 8,$00 // Place a filled char at the start of the charset
.import binary "playfield-screen.imap"
@@ -37,15 +37,15 @@
}}
to:@3
@3: scope:[] from @2
[7] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST
[8] (byte) irq_sprite_ypos#0 ← (const byte) SPRITES_FIRST_YPOS+(byte) $15
[7] (byte) irq_raster_next ← (const byte) IRQ_RASTER_FIRST
[8] (byte) irq_sprite_ypos ← (const byte) SPRITES_FIRST_YPOS+(byte) $15
to:toSpritePtr1
toSpritePtr1: scope:[] from @3
[9] phi()
to:@5
@5: scope:[] from toSpritePtr1
[10] (byte) irq_sprite_ptr#0 ← (const byte) toSpritePtr1_return#0+(byte) 3
[11] (byte) irq_cnt#0 ← (byte) 0
[10] (byte) irq_sprite_ptr ← (const byte) toSpritePtr1_return#0+(byte) 3
[11] (byte) irq_cnt ← (byte) 0
to:@4
@4: scope:[] from @5
[12] phi()
@@ -109,7 +109,6 @@ main::@1: scope:[main] from main::@17 main::@25 main::@6
[40] (word) lines_bcd#19 ← phi( main::@6/(word) lines_bcd#15 main::@17/(byte) 0 main::@25/(word) lines_bcd#15 )
[40] (byte) current_movedown_counter#16 ← phi( main::@6/(byte) current_movedown_counter#14 main::@17/(byte) 0 main::@25/(byte) current_movedown_counter#14 )
[40] (byte) keyboard_events_size#19 ← phi( main::@6/(byte) keyboard_events_size#16 main::@17/(byte) 0 main::@25/(byte) keyboard_events_size#16 )
[40] (byte) render_screen_showing#13 ← phi( main::@6/(byte) render_screen_showing#1 main::@17/(byte) render_screen_showing#0 main::@25/(byte) render_screen_showing#1 )
[40] (byte) next_piece_idx#10 ← phi( main::@6/(byte) next_piece_idx#16 main::@17/(byte) play_spawn_current::piece_idx#2 main::@25/(byte) next_piece_idx#16 )
[40] (byte) game_over#10 ← phi( main::@6/(byte) game_over#15 main::@17/(byte) game_over#52 main::@25/(byte) game_over#15 )
[40] (byte) current_ypos#11 ← phi( main::@6/(byte) current_ypos#19 main::@17/(byte) current_ypos#6 main::@25/(byte) current_ypos#19 )
@@ -1020,7 +1019,7 @@ render_show::@1: scope:[render_show] from render_show::toD0181 render_show::toD
[451] *((const byte*) D018) ← (byte) render_show::d018val#3
[452] *((const byte*) BGCOL2) ← *((const byte*) PIECES_COLORS_1 + (byte) level#10)
[453] *((const byte*) BGCOL3) ← *((const byte*) PIECES_COLORS_2 + (byte) level#10)
[454] (byte) render_screen_showing#1 ← (byte) render_screen_show#16
[454] (byte) render_screen_showing ← (byte) render_screen_show#16
to:render_show::@return
render_show::@return: scope:[render_show] from render_show::@1
[455] return
@@ -1209,20 +1208,20 @@ sid_rnd_init::@return: scope:[sid_rnd_init] from sid_rnd_init
interrupt(HARDWARE_CLOBBER)(void()) sprites_irq()
sprites_irq: scope:[sprites_irq] from
asm { cld }
[552] (byte) sprites_irq::ypos#0 ← (byte) irq_sprite_ypos#0
[552] (byte) sprites_irq::ypos#0 ← (byte) irq_sprite_ypos
[553] *((const byte*) SPRITES_YPOS) ← (byte) sprites_irq::ypos#0
[554] *((const byte*) SPRITES_YPOS+(byte) 2) ← (byte) sprites_irq::ypos#0
[555] *((const byte*) SPRITES_YPOS+(byte) 4) ← (byte) sprites_irq::ypos#0
[556] *((const byte*) SPRITES_YPOS+(byte) 6) ← (byte) sprites_irq::ypos#0
[557] (byte~) sprites_irq::$0 ← (byte) irq_raster_next#0 + (byte) 1
[558] (byte) sprites_irq::raster_sprite_gfx_modify#0 ← (byte~) sprites_irq::$0
[557] (byte~) sprites_irq::$0 ← (byte) irq_raster_next + (byte) 1
[558] (byte) sprites_irq::raster_sprite_gfx_modify ← (byte~) sprites_irq::$0
to:sprites_irq::@8
sprites_irq::@8: scope:[sprites_irq] from sprites_irq sprites_irq::@8
[559] if(*((const byte*) RASTER)<(byte) sprites_irq::raster_sprite_gfx_modify#0) goto sprites_irq::@8
[559] if(*((const byte*) RASTER)<(byte) sprites_irq::raster_sprite_gfx_modify) goto sprites_irq::@8
to:sprites_irq::@9
sprites_irq::@9: scope:[sprites_irq] from sprites_irq::@8
[560] (byte) sprites_irq::ptr#0 ← (byte) irq_sprite_ptr#0
[561] if((byte) render_screen_showing#0==(byte) 0) goto sprites_irq::@1
[560] (byte) sprites_irq::ptr#0 ← (byte) irq_sprite_ptr
[561] if((byte) render_screen_showing==(byte) 0) goto sprites_irq::@1
to:sprites_irq::@10
sprites_irq::@10: scope:[sprites_irq] from sprites_irq::@9
[562] *((const byte*) PLAYFIELD_SPRITE_PTRS_2) ← (byte) sprites_irq::ptr#0
@@ -1233,49 +1232,45 @@ sprites_irq::@10: scope:[sprites_irq] from sprites_irq::@9
[567] *((const byte*) PLAYFIELD_SPRITE_PTRS_2+(byte) 3) ← (byte) sprites_irq::ptr#4
to:sprites_irq::@2
sprites_irq::@2: scope:[sprites_irq] from sprites_irq::@1 sprites_irq::@10
[568] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0
[569] if((byte) irq_cnt#1==(byte) 9) goto sprites_irq::@3
[568] (byte) irq_cnt ← ++ (byte) irq_cnt
[569] if((byte) irq_cnt==(byte) 9) goto sprites_irq::@3
to:sprites_irq::@6
sprites_irq::@6: scope:[sprites_irq] from sprites_irq::@2
[570] if((byte) irq_cnt#1==(byte) $a) goto sprites_irq::@4
[570] if((byte) irq_cnt==(byte) $a) goto sprites_irq::@4
to:sprites_irq::@7
sprites_irq::@7: scope:[sprites_irq] from sprites_irq::@6
[571] (byte) irq_raster_next#3 ← (byte) irq_raster_next#0 + (byte) $14
[572] (byte) irq_sprite_ypos#3 ← (byte) irq_sprite_ypos#0 + (byte) $15
[573] (byte) irq_sprite_ptr#3 ← (byte) irq_sprite_ptr#0 + (byte) 3
[571] (byte) irq_raster_next ← (byte) irq_raster_next + (byte) $14
[572] (byte) irq_sprite_ypos ← (byte) irq_sprite_ypos + (byte) $15
[573] (byte) irq_sprite_ptr ← (byte) irq_sprite_ptr + (byte) 3
to:sprites_irq::@5
sprites_irq::@5: scope:[sprites_irq] from sprites_irq::@11 sprites_irq::@4 sprites_irq::@7
[574] (byte) irq_sprite_ptr#11 ← phi( sprites_irq::@11/(byte) irq_sprite_ptr#1 sprites_irq::@4/(byte) irq_sprite_ptr#2 sprites_irq::@7/(byte) irq_sprite_ptr#3 )
[574] (byte) irq_sprite_ypos#11 ← phi( sprites_irq::@11/(byte) irq_sprite_ypos#1 sprites_irq::@4/(byte) irq_sprite_ypos#2 sprites_irq::@7/(byte) irq_sprite_ypos#3 )
[574] (byte) irq_cnt#3 ← phi( sprites_irq::@11/(byte) irq_cnt#1 sprites_irq::@4/(byte) irq_cnt#2 sprites_irq::@7/(byte) irq_cnt#1 )
[574] (byte) irq_raster_next#4 ← phi( sprites_irq::@11/(byte) irq_raster_next#1 sprites_irq::@4/(byte) irq_raster_next#2 sprites_irq::@7/(byte) irq_raster_next#3 )
[575] *((const byte*) RASTER) ← (byte) irq_raster_next#4
[576] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[574] *((const byte*) RASTER) ← (byte) irq_raster_next
[575] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
to:sprites_irq::@return
sprites_irq::@return: scope:[sprites_irq] from sprites_irq::@5
[577] return
[576] return
to:@return
sprites_irq::@4: scope:[sprites_irq] from sprites_irq::@6
[578] (byte) irq_cnt#2 ← (byte) 0
[579] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST
[580] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte) $15
[581] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte) 3
[577] (byte) irq_cnt ← (byte) 0
[578] (byte) irq_raster_next ← (const byte) IRQ_RASTER_FIRST
[579] (byte) irq_sprite_ypos ← (byte) irq_sprite_ypos + (byte) $15
[580] (byte) irq_sprite_ptr ← (byte) irq_sprite_ptr + (byte) 3
to:sprites_irq::@5
sprites_irq::@3: scope:[sprites_irq] from sprites_irq::@2
[582] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte) $15
[583] (byte) irq_sprite_ypos#1 ← (const byte) SPRITES_FIRST_YPOS
[581] (byte) irq_raster_next ← (byte) irq_raster_next + (byte) $15
[582] (byte) irq_sprite_ypos ← (const byte) SPRITES_FIRST_YPOS
to:sprites_irq::toSpritePtr2
sprites_irq::toSpritePtr2: scope:[sprites_irq] from sprites_irq::@3
[584] phi()
[583] phi()
to:sprites_irq::@11
sprites_irq::@11: scope:[sprites_irq] from sprites_irq::toSpritePtr2
[585] (byte) irq_sprite_ptr#1 ← (const byte) sprites_irq::toSpritePtr2_return#0
[584] (byte) irq_sprite_ptr ← (const byte) sprites_irq::toSpritePtr2_return#0
to:sprites_irq::@5
sprites_irq::@1: scope:[sprites_irq] from sprites_irq::@9
[586] *((const byte*) PLAYFIELD_SPRITE_PTRS_1) ← (byte) sprites_irq::ptr#0
[587] (byte) sprites_irq::ptr#1 ← ++ (byte) sprites_irq::ptr#0
[588] *((const byte*) PLAYFIELD_SPRITE_PTRS_1+(byte) 1) ← (byte) sprites_irq::ptr#1
[589] *((const byte*) PLAYFIELD_SPRITE_PTRS_1+(byte) 2) ← (byte) sprites_irq::ptr#1
[590] (byte) sprites_irq::ptr#2 ← ++ (byte) sprites_irq::ptr#1
[591] *((const byte*) PLAYFIELD_SPRITE_PTRS_1+(byte) 3) ← (byte) sprites_irq::ptr#2
[585] *((const byte*) PLAYFIELD_SPRITE_PTRS_1) ← (byte) sprites_irq::ptr#0
[586] (byte) sprites_irq::ptr#1 ← ++ (byte) sprites_irq::ptr#0
[587] *((const byte*) PLAYFIELD_SPRITE_PTRS_1+(byte) 1) ← (byte) sprites_irq::ptr#1
[588] *((const byte*) PLAYFIELD_SPRITE_PTRS_1+(byte) 2) ← (byte) sprites_irq::ptr#1
[589] (byte) sprites_irq::ptr#2 ← ++ (byte) sprites_irq::ptr#1
[590] *((const byte*) PLAYFIELD_SPRITE_PTRS_1+(byte) 3) ← (byte) sprites_irq::ptr#2
to:sprites_irq::@2
File diff suppressed because it is too large Load Diff
+303 -326
View File
@@ -99,107 +99,88 @@
(const byte) VIC_ECM = (number) $40
(const byte) VIC_RSEL = (number) 8
(byte) current_movedown_counter
(byte) current_movedown_counter#12 current_movedown_counter zp[1]:12 0.5333333333333333
(byte) current_movedown_counter#14 current_movedown_counter zp[1]:12 3.081081081081081
(byte) current_movedown_counter#16 current_movedown_counter zp[1]:12 8.769230769230768
(byte) current_movedown_counter#12 current_movedown_counter zp[1]:11 0.5333333333333333
(byte) current_movedown_counter#14 current_movedown_counter zp[1]:11 3.081081081081081
(byte) current_movedown_counter#16 current_movedown_counter zp[1]:11 8.769230769230768
(const byte) current_movedown_fast = (number) $a
(byte) current_movedown_slow
(byte) current_movedown_slow#1 current_movedown_slow zp[1]:8 0.17391304347826086
(byte) current_movedown_slow#10 current_movedown_slow zp[1]:8 4.0
(byte) current_movedown_slow#14 current_movedown_slow zp[1]:8 2.214285714285714
(byte) current_movedown_slow#21 current_movedown_slow zp[1]:8 3.135135135135135
(byte) current_movedown_slow#23 current_movedown_slow zp[1]:8 1.1428571428571428
(byte) current_movedown_slow#37 current_movedown_slow zp[1]:8 6.0
(byte) current_movedown_slow#65 current_movedown_slow zp[1]:8 0.26666666666666666
(byte) current_movedown_slow#1 current_movedown_slow zp[1]:7 0.17391304347826086
(byte) current_movedown_slow#10 current_movedown_slow zp[1]:7 4.0
(byte) current_movedown_slow#14 current_movedown_slow zp[1]:7 2.214285714285714
(byte) current_movedown_slow#21 current_movedown_slow zp[1]:7 3.135135135135135
(byte) current_movedown_slow#23 current_movedown_slow zp[1]:7 1.1428571428571428
(byte) current_movedown_slow#37 current_movedown_slow zp[1]:7 6.0
(byte) current_movedown_slow#65 current_movedown_slow zp[1]:7 0.26666666666666666
(byte) current_orientation
(byte) current_orientation#13 current_orientation zp[1]:17 3.189189189189189
(byte) current_orientation#17 current_orientation zp[1]:17 5.523809523809523
(byte) current_orientation#20 current_orientation zp[1]:17 0.36734693877551017
(byte) current_orientation#25 current_orientation zp[1]:17 1.3333333333333333
(byte) current_orientation#37 current_orientation zp[1]:17 4.0
(byte) current_orientation#7 current_orientation zp[1]:17 3.0
(byte) current_orientation#13 current_orientation zp[1]:16 3.189189189189189
(byte) current_orientation#17 current_orientation zp[1]:16 5.523809523809523
(byte) current_orientation#20 current_orientation zp[1]:16 0.36734693877551017
(byte) current_orientation#25 current_orientation zp[1]:16 1.3333333333333333
(byte) current_orientation#37 current_orientation zp[1]:16 4.0
(byte) current_orientation#7 current_orientation zp[1]:16 3.0
(byte*) current_piece
(byte*) current_piece#10 current_piece zp[2]:44 3.243243243243243
(byte*) current_piece#101 current_piece zp[2]:44 2.0
(byte*) current_piece#15 current_piece zp[2]:44 1.5897435897435892
(byte*) current_piece#17 current_piece_1 zp[2]:34 12.0
(byte*) current_piece#28 current_piece zp[2]:44 6.0
(byte*) current_piece#92 current_piece zp[2]:44 2.0
(byte*) current_piece#95 current_piece_1 zp[2]:34 4.0
(byte*) current_piece#96 current_piece_1 zp[2]:34 4.0
(byte*) current_piece#97 current_piece_1 zp[2]:34 4.0
(byte*) current_piece#98 current_piece_1 zp[2]:34 4.0
(byte*) current_piece#99 current_piece_1 zp[2]:34 4.0
(byte*) current_piece#10 current_piece zp[2]:43 3.243243243243243
(byte*) current_piece#101 current_piece zp[2]:43 2.0
(byte*) current_piece#15 current_piece zp[2]:43 1.5897435897435892
(byte*) current_piece#17 current_piece_1 zp[2]:33 12.0
(byte*) current_piece#28 current_piece zp[2]:43 6.0
(byte*) current_piece#92 current_piece zp[2]:43 2.0
(byte*) current_piece#95 current_piece_1 zp[2]:33 4.0
(byte*) current_piece#96 current_piece_1 zp[2]:33 4.0
(byte*) current_piece#97 current_piece_1 zp[2]:33 4.0
(byte*) current_piece#98 current_piece_1 zp[2]:33 4.0
(byte*) current_piece#99 current_piece_1 zp[2]:33 4.0
(byte) current_piece_char
(byte) current_piece_char#10 current_piece_char zp[1]:38 183.9818181818182
(byte) current_piece_char#100 current_piece_char_1 zp[1]:15 22.0
(byte) current_piece_char#16 current_piece_char zp[1]:38 3.4324324324324325
(byte) current_piece_char#29 current_piece_char zp[1]:38 6.0
(byte) current_piece_char#5 current_piece_char zp[1]:38 0.25
(byte) current_piece_char#68 current_piece_char_1 zp[1]:15 48.285714285714285
(byte) current_piece_char#99 current_piece_char_1 zp[1]:15 4.0
(byte) current_piece_char#10 current_piece_char zp[1]:37 183.9818181818182
(byte) current_piece_char#100 current_piece_char_1 zp[1]:14 22.0
(byte) current_piece_char#16 current_piece_char zp[1]:37 3.4324324324324325
(byte) current_piece_char#29 current_piece_char zp[1]:37 6.0
(byte) current_piece_char#5 current_piece_char zp[1]:37 0.25
(byte) current_piece_char#68 current_piece_char_1 zp[1]:14 48.285714285714285
(byte) current_piece_char#99 current_piece_char_1 zp[1]:14 4.0
(byte*) current_piece_gfx
(byte*) current_piece_gfx#111 current_piece_gfx_1 zp[2]:36 2.0
(byte*) current_piece_gfx#112 current_piece_gfx_1 zp[2]:36 11.0
(byte*) current_piece_gfx#116 current_piece_gfx zp[2]:25 4.0
(byte*) current_piece_gfx#123 current_piece_gfx zp[2]:25 4.0
(byte*) current_piece_gfx#13 current_piece_gfx zp[2]:25 183.9818181818182
(byte*) current_piece_gfx#18 current_piece_gfx zp[2]:25 6.047619047619047
(byte*) current_piece_gfx#20 current_piece_gfx zp[2]:25 0.37037037037037035
(byte*) current_piece_gfx#21 current_piece_gfx zp[2]:25 1.3333333333333333
(byte*) current_piece_gfx#35 current_piece_gfx zp[2]:25 6.0
(byte*) current_piece_gfx#64 current_piece_gfx_1 zp[2]:36 48.285714285714285
(byte*) current_piece_gfx#7 current_piece_gfx zp[2]:25 4.0
(byte*) current_piece_gfx#111 current_piece_gfx_1 zp[2]:35 2.0
(byte*) current_piece_gfx#112 current_piece_gfx_1 zp[2]:35 11.0
(byte*) current_piece_gfx#116 current_piece_gfx zp[2]:24 4.0
(byte*) current_piece_gfx#123 current_piece_gfx zp[2]:24 4.0
(byte*) current_piece_gfx#13 current_piece_gfx zp[2]:24 183.9818181818182
(byte*) current_piece_gfx#18 current_piece_gfx zp[2]:24 6.047619047619047
(byte*) current_piece_gfx#20 current_piece_gfx zp[2]:24 0.37037037037037035
(byte*) current_piece_gfx#21 current_piece_gfx zp[2]:24 1.3333333333333333
(byte*) current_piece_gfx#35 current_piece_gfx zp[2]:24 6.0
(byte*) current_piece_gfx#64 current_piece_gfx_1 zp[2]:35 48.285714285714285
(byte*) current_piece_gfx#7 current_piece_gfx zp[2]:24 4.0
(byte) current_xpos
(byte) current_xpos#100 current_xpos zp[1]:43 0.3225806451612903
(byte) current_xpos#118 current_xpos_1 zp[1]:14 1.3333333333333333
(byte) current_xpos#119 current_xpos_1 zp[1]:14 7.333333333333333
(byte) current_xpos#14 current_xpos zp[1]:43 20.38181818181818
(byte) current_xpos#19 current_xpos zp[1]:43 6.047619047619047
(byte) current_xpos#22 current_xpos zp[1]:43 0.7999999999999999
(byte) current_xpos#26 current_xpos zp[1]:43 0.4666666666666666
(byte) current_xpos#43 current_xpos zp[1]:43 6.0
(byte) current_xpos#59 current_xpos_1 zp[1]:14 5.428571428571429
(byte) current_xpos#6 current_xpos zp[1]:43 4.0
(byte) current_xpos#8 current_xpos zp[1]:43 4.0
(byte) current_xpos#100 current_xpos zp[1]:42 0.3225806451612903
(byte) current_xpos#118 current_xpos_1 zp[1]:13 1.3333333333333333
(byte) current_xpos#119 current_xpos_1 zp[1]:13 7.333333333333333
(byte) current_xpos#14 current_xpos zp[1]:42 20.38181818181818
(byte) current_xpos#19 current_xpos zp[1]:42 6.047619047619047
(byte) current_xpos#22 current_xpos zp[1]:42 0.7999999999999999
(byte) current_xpos#26 current_xpos zp[1]:42 0.4666666666666666
(byte) current_xpos#43 current_xpos zp[1]:42 6.0
(byte) current_xpos#59 current_xpos_1 zp[1]:13 5.428571428571429
(byte) current_xpos#6 current_xpos zp[1]:42 4.0
(byte) current_xpos#8 current_xpos zp[1]:42 4.0
(byte) current_ypos
(byte) current_ypos#11 current_ypos zp[1]:24 3.297297297297297
(byte) current_ypos#11 current_ypos zp[1]:23 3.297297297297297
(byte) current_ypos#13 reg byte x 15.0
(byte) current_ypos#19 current_ypos zp[1]:24 1.7051282051282046
(byte) current_ypos#3 current_ypos zp[1]:24 4.0
(byte) current_ypos#38 current_ypos zp[1]:24 6.0
(byte) current_ypos#6 current_ypos zp[1]:24 0.3333333333333333
(byte) current_ypos#19 current_ypos zp[1]:23 1.7051282051282046
(byte) current_ypos#3 current_ypos zp[1]:23 4.0
(byte) current_ypos#38 current_ypos zp[1]:23 6.0
(byte) current_ypos#6 current_ypos zp[1]:23 0.3333333333333333
(byte) current_ypos#97 reg byte x 1.0
(byte) current_ypos#98 reg byte x 4.4
(byte) game_over
(byte) game_over#10 game_over zp[1]:11 4.804347826086958
(byte) game_over#15 game_over zp[1]:11 3.189189189189189
(byte) game_over#27 game_over zp[1]:11 6.0
(byte) game_over#52 game_over zp[1]:11 0.34782608695652173
(byte) game_over#65 game_over zp[1]:11 0.42857142857142855
(byte) irq_cnt
(byte) irq_cnt#0 irq_cnt zp[1]:31 0.17391304347826086
(byte) irq_cnt#1 irq_cnt zp[1]:31 1.0
(byte) irq_cnt#2 irq_cnt zp[1]:31 1.0
(byte) irq_cnt#3 irq_cnt zp[1]:31 60.0
(byte) irq_raster_next
(byte) irq_raster_next#0 irq_raster_next zp[1]:28 0.3076923076923077
(byte) irq_raster_next#1 irq_raster_next zp[1]:28 1.0
(byte) irq_raster_next#2 irq_raster_next zp[1]:28 1.3333333333333333
(byte) irq_raster_next#3 irq_raster_next zp[1]:28 1.3333333333333333
(byte) irq_raster_next#4 irq_raster_next zp[1]:28 8.0
(byte) irq_sprite_ptr
(byte) irq_sprite_ptr#0 irq_sprite_ptr zp[1]:30 0.25806451612903225
(byte) irq_sprite_ptr#1 irq_sprite_ptr zp[1]:30 4.0
(byte) irq_sprite_ptr#11 irq_sprite_ptr zp[1]:30 60.0
(byte) irq_sprite_ptr#2 irq_sprite_ptr zp[1]:30 4.0
(byte) irq_sprite_ptr#3 irq_sprite_ptr zp[1]:30 4.0
(byte) irq_sprite_ypos
(byte) irq_sprite_ypos#0 irq_sprite_ypos zp[1]:29 0.27586206896551724
(byte) irq_sprite_ypos#1 irq_sprite_ypos zp[1]:29 1.3333333333333333
(byte) irq_sprite_ypos#11 irq_sprite_ypos zp[1]:29 60.0
(byte) irq_sprite_ypos#2 irq_sprite_ypos zp[1]:29 2.0
(byte) irq_sprite_ypos#3 irq_sprite_ypos zp[1]:29 2.0
(byte) game_over#10 game_over zp[1]:10 4.804347826086958
(byte) game_over#15 game_over zp[1]:10 3.189189189189189
(byte) game_over#27 game_over zp[1]:10 6.0
(byte) game_over#52 game_over zp[1]:10 0.34782608695652173
(byte) game_over#65 game_over zp[1]:10 0.42857142857142855
(byte) irq_cnt loadstore zp[1]:30 6.0
(byte) irq_raster_next loadstore zp[1]:27 1.0
(byte) irq_sprite_ptr loadstore zp[1]:29 1.5555555555555558
(byte) irq_sprite_ypos loadstore zp[1]:28 14.0
(byte()) keyboard_event_get()
(label) keyboard_event_get::@1
(label) keyboard_event_get::@return
@@ -212,7 +193,7 @@
(byte~) keyboard_event_pressed::$1 reg byte a 4.0
(label) keyboard_event_pressed::@return
(byte) keyboard_event_pressed::keycode
(byte) keyboard_event_pressed::keycode#5 keycode zp[1]:18 1.3333333333333333
(byte) keyboard_event_pressed::keycode#5 keycode zp[1]:17 1.3333333333333333
(byte) keyboard_event_pressed::return
(byte) keyboard_event_pressed::return#0 reg byte a 4.0
(byte) keyboard_event_pressed::return#1 reg byte a 4.0
@@ -221,7 +202,7 @@
(byte) keyboard_event_pressed::return#12 reg byte a 4.0
(byte) keyboard_event_pressed::return#2 reg byte a 4.0
(byte) keyboard_event_pressed::row_bits
(byte) keyboard_event_pressed::row_bits#0 row_bits zp[1]:46 2.0
(byte) keyboard_event_pressed::row_bits#0 row_bits zp[1]:45 2.0
(void()) keyboard_event_scan()
(byte~) keyboard_event_scan::$0 reg byte a 4.0
(byte~) keyboard_event_scan::$15 reg byte a 20002.0
@@ -260,27 +241,27 @@
(byte) keyboard_event_scan::event_type
(byte) keyboard_event_scan::event_type#0 reg byte a 20002.0
(byte) keyboard_event_scan::keycode
(byte) keyboard_event_scan::keycode#1 keycode zp[1]:33 2002.0
(byte) keyboard_event_scan::keycode#10 keycode zp[1]:33 3154.230769230769
(byte) keyboard_event_scan::keycode#11 keycode zp[1]:33 500.5
(byte) keyboard_event_scan::keycode#13 keycode zp[1]:33 1001.0
(byte) keyboard_event_scan::keycode#14 keycode zp[1]:33 5250.75
(byte) keyboard_event_scan::keycode#1 keycode zp[1]:32 2002.0
(byte) keyboard_event_scan::keycode#10 keycode zp[1]:32 3154.230769230769
(byte) keyboard_event_scan::keycode#11 keycode zp[1]:32 500.5
(byte) keyboard_event_scan::keycode#13 keycode zp[1]:32 1001.0
(byte) keyboard_event_scan::keycode#14 keycode zp[1]:32 5250.75
(byte) keyboard_event_scan::row
(byte) keyboard_event_scan::row#1 row zp[1]:32 1501.5
(byte) keyboard_event_scan::row#2 row zp[1]:32 600.24
(byte) keyboard_event_scan::row#1 row zp[1]:31 1501.5
(byte) keyboard_event_scan::row#2 row zp[1]:31 600.24
(byte) keyboard_event_scan::row_scan
(byte) keyboard_event_scan::row_scan#0 row_scan zp[1]:47 1278.0555555555554
(byte) keyboard_event_scan::row_scan#0 row_scan zp[1]:46 1278.0555555555554
(const byte*) keyboard_events[(number) 8] = { fill( 8, 0) }
(byte) keyboard_events_size
(byte) keyboard_events_size#1 keyboard_events_size zp[1]:19 20002.0
(byte) keyboard_events_size#10 keyboard_events_size zp[1]:19 8100.9000000000015
(byte) keyboard_events_size#13 keyboard_events_size zp[1]:19 97.06451612903226
(byte) keyboard_events_size#16 keyboard_events_size zp[1]:19 4.461538461538461
(byte) keyboard_events_size#19 keyboard_events_size zp[1]:19 18.999999999999996
(byte) keyboard_events_size#2 keyboard_events_size zp[1]:19 20002.0
(byte) keyboard_events_size#29 keyboard_events_size zp[1]:19 10201.2
(byte) keyboard_events_size#30 keyboard_events_size zp[1]:19 429.2857142857143
(byte) keyboard_events_size#4 keyboard_events_size zp[1]:19 3.0
(byte) keyboard_events_size#1 keyboard_events_size zp[1]:18 20002.0
(byte) keyboard_events_size#10 keyboard_events_size zp[1]:18 8100.9000000000015
(byte) keyboard_events_size#13 keyboard_events_size zp[1]:18 97.06451612903226
(byte) keyboard_events_size#16 keyboard_events_size zp[1]:18 4.461538461538461
(byte) keyboard_events_size#19 keyboard_events_size zp[1]:18 18.999999999999996
(byte) keyboard_events_size#2 keyboard_events_size zp[1]:18 20002.0
(byte) keyboard_events_size#29 keyboard_events_size zp[1]:18 10201.2
(byte) keyboard_events_size#30 keyboard_events_size zp[1]:18 429.2857142857143
(byte) keyboard_events_size#4 keyboard_events_size zp[1]:18 3.0
(const byte*) keyboard_matrix_col_bitmask[(number) 8] = { (byte) 1, (byte) 2, (byte) 4, (byte) 8, (byte) $10, (byte) $20, (byte) $40, (byte) $80 }
(byte()) keyboard_matrix_read((byte) keyboard_matrix_read::rowid)
(label) keyboard_matrix_read::@return
@@ -294,25 +275,25 @@
(byte) keyboard_modifiers
(const byte*) keyboard_scan_values[(number) 8] = { fill( 8, 0) }
(byte) level
(byte) level#10 level zp[1]:7 1.909090909090909
(byte) level#17 level zp[1]:7 3.135135135135135
(byte) level#19 level zp[1]:7 1.1428571428571428
(byte) level#21 level zp[1]:7 0.4444444444444444
(byte) level#33 level zp[1]:7 6.0
(byte) level#10 level zp[1]:6 1.909090909090909
(byte) level#17 level zp[1]:6 3.135135135135135
(byte) level#19 level zp[1]:6 1.1428571428571428
(byte) level#21 level zp[1]:6 0.4444444444444444
(byte) level#33 level zp[1]:6 6.0
(byte) level_bcd
(byte) level_bcd#11 level_bcd zp[1]:9 2.0
(byte) level_bcd#17 level_bcd zp[1]:9 1.9999999999999998
(byte) level_bcd#19 level_bcd zp[1]:9 1.1428571428571428
(byte) level_bcd#21 level_bcd zp[1]:9 2.6666666666666665
(byte) level_bcd#31 level_bcd zp[1]:9 6.0
(byte) level_bcd#62 level_bcd zp[1]:9 0.6000000000000001
(byte) level_bcd#8 level_bcd zp[1]:9 4.0
(byte) level_bcd#11 level_bcd zp[1]:8 2.0
(byte) level_bcd#17 level_bcd zp[1]:8 1.9999999999999998
(byte) level_bcd#19 level_bcd zp[1]:8 1.1428571428571428
(byte) level_bcd#21 level_bcd zp[1]:8 2.6666666666666665
(byte) level_bcd#31 level_bcd zp[1]:8 6.0
(byte) level_bcd#62 level_bcd zp[1]:8 0.6000000000000001
(byte) level_bcd#8 level_bcd zp[1]:8 4.0
(word) lines_bcd
(word) lines_bcd#15 lines_bcd zp[2]:22 2.0338983050847457
(word) lines_bcd#17 lines_bcd zp[2]:22 1.1428571428571428
(word) lines_bcd#19 lines_bcd zp[2]:22 2.4400000000000004
(word) lines_bcd#26 lines_bcd zp[2]:22 6.0
(word) lines_bcd#29 lines_bcd zp[2]:22 1.0
(word) lines_bcd#15 lines_bcd zp[2]:21 2.0338983050847457
(word) lines_bcd#17 lines_bcd zp[2]:21 1.1428571428571428
(word) lines_bcd#19 lines_bcd zp[2]:21 2.4400000000000004
(word) lines_bcd#26 lines_bcd zp[2]:21 6.0
(word) lines_bcd#29 lines_bcd zp[2]:21 1.0
(void()) main()
(label) main::@1
(label) main::@10
@@ -344,11 +325,11 @@
(byte) main::render
(byte) main::render#1 reg byte a 202.0
(byte) next_piece_idx
(byte) next_piece_idx#10 next_piece_idx zp[1]:10 2.608695652173914
(byte) next_piece_idx#10 next_piece_idx zp[1]:9 2.608695652173914
(byte) next_piece_idx#12 reg byte x 3.4
(byte) next_piece_idx#16 next_piece_idx zp[1]:10 3.4324324324324325
(byte) next_piece_idx#17 next_piece_idx zp[1]:10 6.0
(byte) next_piece_idx#30 next_piece_idx zp[1]:10 6.0
(byte) next_piece_idx#16 next_piece_idx zp[1]:9 3.4324324324324325
(byte) next_piece_idx#17 next_piece_idx zp[1]:9 6.0
(byte) next_piece_idx#30 next_piece_idx zp[1]:9 6.0
(byte) next_piece_idx#76 reg byte x 4.0
(byte) next_piece_idx#77 reg byte x 22.0
(byte()) play_collision((byte) play_collision::xpos , (byte) play_collision::ypos , (byte) play_collision::orientation)
@@ -369,14 +350,14 @@
(byte) play_collision::c#1 reg byte x 10001.0
(byte) play_collision::c#2 reg byte x 2222.4444444444443
(byte) play_collision::i
(byte) play_collision::i#1 i zp[1]:47 1615.6153846153845
(byte) play_collision::i#10 i_1 zp[1]:15 2002.0
(byte) play_collision::i#12 i_1 zp[1]:15 20002.0
(byte) play_collision::i#2 i_1 zp[1]:15 15502.0
(byte) play_collision::i#3 i_1 zp[1]:15 500.5
(byte) play_collision::i#1 i zp[1]:46 1615.6153846153845
(byte) play_collision::i#10 i_1 zp[1]:14 2002.0
(byte) play_collision::i#12 i_1 zp[1]:14 20002.0
(byte) play_collision::i#2 i_1 zp[1]:14 15502.0
(byte) play_collision::i#3 i_1 zp[1]:14 500.5
(byte) play_collision::l
(byte) play_collision::l#1 l zp[1]:14 1001.0
(byte) play_collision::l#6 l zp[1]:14 117.76470588235294
(byte) play_collision::l#1 l zp[1]:13 1001.0
(byte) play_collision::l#6 l zp[1]:13 117.76470588235294
(byte) play_collision::orientation
(byte) play_collision::orientation#0 reg byte x 2.0
(byte) play_collision::orientation#1 reg byte x 2.0
@@ -384,9 +365,9 @@
(byte) play_collision::orientation#3 reg byte x 2.0
(byte) play_collision::orientation#5 reg byte x 10.0
(byte*) play_collision::piece_gfx
(byte*) play_collision::piece_gfx#0 piece_gfx zp[2]:34 476.3333333333333
(byte*) play_collision::piece_gfx#0 piece_gfx zp[2]:33 476.3333333333333
(byte*) play_collision::playfield_line
(byte*) play_collision::playfield_line#0 playfield_line zp[2]:36 785.8571428571429
(byte*) play_collision::playfield_line#0 playfield_line zp[2]:35 785.8571428571429
(byte) play_collision::return
(byte) play_collision::return#0 reg byte a 4.0
(byte) play_collision::return#1 reg byte a 4.0
@@ -395,26 +376,26 @@
(byte) play_collision::return#14 reg byte a 4.0
(byte) play_collision::return#15 reg byte a 1.4285714285714284
(byte) play_collision::xp
(byte) play_collision::xp#1 xp zp[1]:16 5000.5
(byte) play_collision::xp#2 xp zp[1]:16 6375.75
(byte) play_collision::xp#8 xp zp[1]:16 2002.0
(byte) play_collision::xp#1 xp zp[1]:15 5000.5
(byte) play_collision::xp#2 xp zp[1]:15 6375.75
(byte) play_collision::xp#8 xp zp[1]:15 2002.0
(byte) play_collision::xpos
(byte) play_collision::xpos#0 xpos zp[1]:33 1.3333333333333333
(byte) play_collision::xpos#1 xpos zp[1]:33 1.0
(byte) play_collision::xpos#2 xpos zp[1]:33 1.0
(byte) play_collision::xpos#3 xpos zp[1]:33 1.0
(byte) play_collision::xpos#4 xpos zp[1]:33 1.3333333333333333
(byte) play_collision::xpos#6 xpos zp[1]:33 45.95454545454545
(byte) play_collision::xpos#0 xpos zp[1]:32 1.3333333333333333
(byte) play_collision::xpos#1 xpos zp[1]:32 1.0
(byte) play_collision::xpos#2 xpos zp[1]:32 1.0
(byte) play_collision::xpos#3 xpos zp[1]:32 1.0
(byte) play_collision::xpos#4 xpos zp[1]:32 1.3333333333333333
(byte) play_collision::xpos#6 xpos zp[1]:32 45.95454545454545
(byte) play_collision::yp
(byte) play_collision::yp#0 yp zp[1]:13 6.0
(byte) play_collision::yp#1 yp zp[1]:13 500.5
(byte) play_collision::yp#2 yp zp[1]:13 812.875
(byte) play_collision::yp#0 yp zp[1]:12 6.0
(byte) play_collision::yp#1 yp zp[1]:12 500.5
(byte) play_collision::yp#2 yp zp[1]:12 812.875
(byte) play_collision::ypos
(byte) play_collision::ypos#0 ypos zp[1]:13 1.0
(byte) play_collision::ypos#1 ypos zp[1]:13 1.3333333333333333
(byte) play_collision::ypos#2 ypos zp[1]:13 1.3333333333333333
(byte) play_collision::ypos#3 ypos zp[1]:13 1.3333333333333333
(byte) play_collision::ypos#4 ypos zp[1]:13 2.0
(byte) play_collision::ypos#0 ypos zp[1]:12 1.0
(byte) play_collision::ypos#1 ypos zp[1]:12 1.3333333333333333
(byte) play_collision::ypos#2 ypos zp[1]:12 1.3333333333333333
(byte) play_collision::ypos#3 ypos zp[1]:12 1.3333333333333333
(byte) play_collision::ypos#4 ypos zp[1]:12 2.0
(void()) play_increase_level()
(byte~) play_increase_level::$1 reg byte a 4.0
(byte~) play_increase_level::$5 reg byte a 4004.0
@@ -439,14 +420,14 @@
(byte) play_init::b#1 reg byte x 16.5
(byte) play_init::b#2 reg byte x 11.0
(byte) play_init::idx
(byte) play_init::idx#1 idx zp[1]:20 7.333333333333333
(byte) play_init::idx#2 idx zp[1]:20 6.6000000000000005
(byte) play_init::idx#1 idx zp[1]:19 7.333333333333333
(byte) play_init::idx#2 idx zp[1]:19 6.6000000000000005
(byte) play_init::j
(byte) play_init::j#1 reg byte y 16.5
(byte) play_init::j#2 reg byte y 7.333333333333333
(byte*) play_init::pli
(byte*) play_init::pli#1 pli zp[2]:34 5.5
(byte*) play_init::pli#2 pli zp[2]:34 8.25
(byte*) play_init::pli#1 pli zp[2]:33 5.5
(byte*) play_init::pli#2 pli zp[2]:33 8.25
(void()) play_lock_current()
(byte~) play_lock_current::$4 reg byte a 2002.0
(label) play_lock_current::@1
@@ -461,24 +442,24 @@
(byte) play_lock_current::c#1 reg byte x 10001.0
(byte) play_lock_current::c#2 reg byte x 4000.4
(byte) play_lock_current::i
(byte) play_lock_current::i#1 i zp[1]:47 2333.6666666666665
(byte) play_lock_current::i#2 i_1 zp[1]:17 15502.0
(byte) play_lock_current::i#3 i_1 zp[1]:17 500.5
(byte) play_lock_current::i#7 i_1 zp[1]:17 2002.0
(byte) play_lock_current::i#9 i_1 zp[1]:17 20002.0
(byte) play_lock_current::i#1 i zp[1]:46 2333.6666666666665
(byte) play_lock_current::i#2 i_1 zp[1]:16 15502.0
(byte) play_lock_current::i#3 i_1 zp[1]:16 500.5
(byte) play_lock_current::i#7 i_1 zp[1]:16 2002.0
(byte) play_lock_current::i#9 i_1 zp[1]:16 20002.0
(byte) play_lock_current::l
(byte) play_lock_current::l#1 l zp[1]:16 1001.0
(byte) play_lock_current::l#6 l zp[1]:16 154.0
(byte) play_lock_current::l#1 l zp[1]:15 1001.0
(byte) play_lock_current::l#6 l zp[1]:15 154.0
(byte*) play_lock_current::playfield_line
(byte*) play_lock_current::playfield_line#0 playfield_line zp[2]:44 1100.2
(byte*) play_lock_current::playfield_line#0 playfield_line zp[2]:43 1100.2
(byte) play_lock_current::xp
(byte) play_lock_current::xp#0 xp zp[1]:18 2002.0
(byte) play_lock_current::xp#1 xp zp[1]:18 5000.5
(byte) play_lock_current::xp#2 xp zp[1]:18 7751.0
(byte) play_lock_current::xp#0 xp zp[1]:17 2002.0
(byte) play_lock_current::xp#1 xp zp[1]:17 5000.5
(byte) play_lock_current::xp#2 xp zp[1]:17 7751.0
(byte) play_lock_current::yp
(byte) play_lock_current::yp#0 yp zp[1]:24 4.0
(byte) play_lock_current::yp#1 yp zp[1]:24 500.5
(byte) play_lock_current::yp#2 yp zp[1]:24 250.41666666666669
(byte) play_lock_current::yp#0 yp zp[1]:23 4.0
(byte) play_lock_current::yp#1 yp zp[1]:23 500.5
(byte) play_lock_current::yp#2 yp zp[1]:23 250.41666666666669
(byte()) play_move_down((byte) play_move_down::key_event)
(byte~) play_move_down::$12 reg byte a 4.0
(byte~) play_move_down::$2 reg byte a 4.0
@@ -543,9 +524,9 @@
(byte) play_move_rotate::key_event
(byte) play_move_rotate::key_event#0 reg byte a 3.0
(byte) play_move_rotate::orientation
(byte) play_move_rotate::orientation#1 orientation zp[1]:32 4.0
(byte) play_move_rotate::orientation#2 orientation zp[1]:32 4.0
(byte) play_move_rotate::orientation#3 orientation zp[1]:32 0.8888888888888888
(byte) play_move_rotate::orientation#1 orientation zp[1]:31 4.0
(byte) play_move_rotate::orientation#2 orientation zp[1]:31 4.0
(byte) play_move_rotate::orientation#3 orientation zp[1]:31 0.8888888888888888
(byte) play_move_rotate::return
(byte) play_move_rotate::return#0 reg byte a 4.0
(byte) play_move_rotate::return#2 reg byte a 0.6666666666666666
@@ -558,13 +539,13 @@
(label) play_movement::@4
(label) play_movement::@return
(byte) play_movement::key_event
(byte) play_movement::key_event#0 key_event zp[1]:32 9.727272727272727
(byte) play_movement::key_event#0 key_event zp[1]:31 9.727272727272727
(byte) play_movement::render
(byte) play_movement::render#1 render zp[1]:18 1.0
(byte) play_movement::render#2 render zp[1]:18 0.8
(byte) play_movement::render#1 render zp[1]:17 1.0
(byte) play_movement::render#2 render zp[1]:17 0.8
(byte) play_movement::return
(byte) play_movement::return#0 return zp[1]:18 4.0
(byte) play_movement::return#2 return zp[1]:18 34.99999999999999
(byte) play_movement::return#0 return zp[1]:17 4.0
(byte) play_movement::return#2 return zp[1]:17 34.99999999999999
(byte) play_movement::return#3 reg byte a 202.0
(byte()) play_remove_lines()
(label) play_remove_lines::@1
@@ -578,18 +559,18 @@
(label) play_remove_lines::@9
(label) play_remove_lines::@return
(byte) play_remove_lines::c
(byte) play_remove_lines::c#0 c zp[1]:43 6000.6
(byte) play_remove_lines::c#0 c zp[1]:42 6000.6
(byte) play_remove_lines::full
(byte) play_remove_lines::full#2 full zp[1]:15 4200.6
(byte) play_remove_lines::full#4 full zp[1]:15 4000.4
(byte) play_remove_lines::full#2 full zp[1]:14 4200.6
(byte) play_remove_lines::full#4 full zp[1]:14 4000.4
(byte) play_remove_lines::r
(byte) play_remove_lines::r#1 reg byte y 1500.2142857142858
(byte) play_remove_lines::r#2 reg byte y 15502.0
(byte) play_remove_lines::r#3 reg byte y 2002.0
(byte) play_remove_lines::removed
(byte) play_remove_lines::removed#1 removed zp[1]:13 2002.0
(byte) play_remove_lines::removed#11 removed zp[1]:13 231.0
(byte) play_remove_lines::removed#8 removed zp[1]:13 333.8888888888889
(byte) play_remove_lines::removed#1 removed zp[1]:12 2002.0
(byte) play_remove_lines::removed#11 removed zp[1]:12 231.0
(byte) play_remove_lines::removed#8 removed zp[1]:12 333.8888888888889
(byte) play_remove_lines::return
(byte) play_remove_lines::return#0 reg byte a 4.0
(byte) play_remove_lines::w
@@ -601,14 +582,14 @@
(byte) play_remove_lines::w#4 reg byte x 4429.142857142857
(byte) play_remove_lines::w#6 reg byte x 1668.3333333333335
(byte) play_remove_lines::x
(byte) play_remove_lines::x#1 x zp[1]:14 15001.5
(byte) play_remove_lines::x#2 x zp[1]:14 2500.25
(byte) play_remove_lines::x#1 x zp[1]:13 15001.5
(byte) play_remove_lines::x#2 x zp[1]:13 2500.25
(byte) play_remove_lines::y
(byte) play_remove_lines::y#1 y zp[1]:12 1501.5
(byte) play_remove_lines::y#8 y zp[1]:12 133.46666666666667
(byte) play_remove_lines::y#1 y zp[1]:11 1501.5
(byte) play_remove_lines::y#8 y zp[1]:11 133.46666666666667
(void()) play_spawn_current()
(byte~) play_spawn_current::$1 reg byte a 4.0
(byte~) play_spawn_current::$7 zp[1]:46 0.06451612903225806
(byte~) play_spawn_current::$7 zp[1]:45 0.06451612903225806
(label) play_spawn_current::@1
(label) play_spawn_current::@2
(label) play_spawn_current::@3
@@ -618,8 +599,8 @@
(byte) play_spawn_current::current_piece_idx
(byte) play_spawn_current::current_piece_idx#0 reg byte x 2.5
(byte) play_spawn_current::piece_idx
(byte) play_spawn_current::piece_idx#1 piece_idx zp[1]:10 2002.0
(byte) play_spawn_current::piece_idx#2 piece_idx zp[1]:10 100.5
(byte) play_spawn_current::piece_idx#1 piece_idx zp[1]:9 2002.0
(byte) play_spawn_current::piece_idx#2 piece_idx zp[1]:9 100.5
(label) play_spawn_current::sid_rnd1
(byte) play_spawn_current::sid_rnd1_return
(byte) play_spawn_current::sid_rnd1_return#0 reg byte a 2002.0
@@ -631,11 +612,11 @@
(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[4]:39 1.3333333333333333
(dword) play_update_score::add_bcd#0 add_bcd zp[4]:38 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
(byte) play_update_score::lines_before#0 lines_before zp[1]:38 0.4444444444444444
(byte) play_update_score::lines_before#0 lines_before zp[1]:37 0.4444444444444444
(byte) play_update_score::removed
(byte) play_update_score::removed#0 reg byte x 1.1428571428571428
(const byte*) playfield[(const byte) PLAYFIELD_LINES*(const byte) PLAYFIELD_COLS] = { fill( PLAYFIELD_LINES*PLAYFIELD_COLS, 0) }
@@ -659,21 +640,21 @@
(byte) render_bcd::bcd#5 reg byte x 4.0
(byte) render_bcd::bcd#6 reg byte x 2.0
(word) render_bcd::offset
(word) render_bcd::offset#6 offset zp[2]:34 2.0
(word) render_bcd::offset#6 offset zp[2]:33 2.0
(byte) render_bcd::only_low
(byte) render_bcd::only_low#6 reg byte y 1.0
(byte*) render_bcd::screen
(byte*) render_bcd::screen#0 screen zp[2]:36 2.0
(byte*) render_bcd::screen#1 screen zp[2]:36 2.0
(byte*) render_bcd::screen#2 screen zp[2]:36 2.0
(byte*) render_bcd::screen#3 screen zp[2]:36 4.0
(byte*) render_bcd::screen#4 screen zp[2]:36 4.0
(byte*) render_bcd::screen#5 screen zp[2]:36 2.0
(byte*) render_bcd::screen#6 screen zp[2]:36 14.0
(byte*) render_bcd::screen#0 screen zp[2]:35 2.0
(byte*) render_bcd::screen#1 screen zp[2]:35 2.0
(byte*) render_bcd::screen#2 screen zp[2]:35 2.0
(byte*) render_bcd::screen#3 screen zp[2]:35 4.0
(byte*) render_bcd::screen#4 screen zp[2]:35 4.0
(byte*) render_bcd::screen#5 screen zp[2]:35 2.0
(byte*) render_bcd::screen#6 screen zp[2]:35 14.0
(byte*) render_bcd::screen_pos
(byte*) render_bcd::screen_pos#0 screen_pos zp[2]:34 1.6
(byte*) render_bcd::screen_pos#2 screen_pos zp[2]:34 4.0
(byte*) render_bcd::screen_pos#3 screen_pos zp[2]:34 2.0
(byte*) render_bcd::screen_pos#0 screen_pos zp[2]:33 1.6
(byte*) render_bcd::screen_pos#2 screen_pos zp[2]:33 4.0
(byte*) render_bcd::screen_pos#3 screen_pos zp[2]:33 2.0
(void()) render_init()
(byte~) render_init::$5 reg byte x 16.5
(label) render_init::@1
@@ -684,11 +665,11 @@
(byte) render_init::i#1 reg byte y 16.5
(byte) render_init::i#2 reg byte y 5.5
(byte*) render_init::li_1
(byte*) render_init::li_1#1 li_1 zp[2]:22 5.5
(byte*) render_init::li_1#2 li_1 zp[2]:22 8.25
(byte*) render_init::li_1#1 li_1 zp[2]:21 5.5
(byte*) render_init::li_1#2 li_1 zp[2]:21 8.25
(byte*) render_init::li_2
(byte*) render_init::li_2#1 li_2 zp[2]:44 7.333333333333333
(byte*) render_init::li_2#2 li_2 zp[2]:44 6.6000000000000005
(byte*) render_init::li_2#1 li_2 zp[2]:43 7.333333333333333
(byte*) render_init::li_2#2 li_2 zp[2]:43 6.6000000000000005
(label) render_init::vicSelectGfxBank1
(label) render_init::vicSelectGfxBank1_@1
(byte*) render_init::vicSelectGfxBank1_gfx
@@ -713,24 +694,24 @@
(byte) render_moving::current_cell
(byte) render_moving::current_cell#0 reg byte a 1001.0
(byte) render_moving::i
(byte) render_moving::i#1 i zp[1]:32 202.0
(byte) render_moving::i#2 i zp[1]:32 500.5
(byte) render_moving::i#3 i zp[1]:32 50.5
(byte) render_moving::i#4 i zp[1]:32 1552.0
(byte) render_moving::i#8 i zp[1]:32 300.75
(byte) render_moving::i#1 i zp[1]:31 202.0
(byte) render_moving::i#2 i zp[1]:31 500.5
(byte) render_moving::i#3 i zp[1]:31 50.5
(byte) render_moving::i#4 i zp[1]:31 1552.0
(byte) render_moving::i#8 i zp[1]:31 300.75
(byte) render_moving::l
(byte) render_moving::l#1 l zp[1]:18 151.5
(byte) render_moving::l#4 l zp[1]:18 11.882352941176471
(byte) render_moving::l#1 l zp[1]:17 151.5
(byte) render_moving::l#4 l zp[1]:17 11.882352941176471
(byte*) render_moving::screen_line
(byte*) render_moving::screen_line#0 screen_line zp[2]:34 110.19999999999999
(byte*) render_moving::screen_line#0 screen_line zp[2]:33 110.19999999999999
(byte) render_moving::xpos
(byte) render_moving::xpos#0 xpos zp[1]:33 202.0
(byte) render_moving::xpos#1 xpos zp[1]:33 667.3333333333334
(byte) render_moving::xpos#2 xpos zp[1]:33 620.8
(byte) render_moving::xpos#0 xpos zp[1]:32 202.0
(byte) render_moving::xpos#1 xpos zp[1]:32 667.3333333333334
(byte) render_moving::xpos#2 xpos zp[1]:32 620.8
(byte) render_moving::ypos
(byte) render_moving::ypos#0 ypos zp[1]:16 4.0
(byte) render_moving::ypos#1 ypos zp[1]:16 67.33333333333333
(byte) render_moving::ypos#2 ypos zp[1]:16 25.375
(byte) render_moving::ypos#0 ypos zp[1]:15 4.0
(byte) render_moving::ypos#1 ypos zp[1]:15 67.33333333333333
(byte) render_moving::ypos#2 ypos zp[1]:15 25.375
(void()) render_next()
(byte~) render_next::$6 reg byte y 1.0
(label) render_next::@1
@@ -748,22 +729,22 @@
(byte) render_next::cell
(byte) render_next::cell#0 reg byte a 1001.0
(byte) render_next::l
(byte) render_next::l#1 l zp[1]:13 151.5
(byte) render_next::l#7 l zp[1]:13 18.363636363636363
(byte) render_next::l#1 l zp[1]:12 151.5
(byte) render_next::l#7 l zp[1]:12 18.363636363636363
(const word) render_next::next_area_offset = (word)(number) $28*(number) $c+(number) $18+(number) 4
(byte) render_next::next_piece_char
(byte) render_next::next_piece_char#0 next_piece_char zp[1]:33 66.86666666666667
(byte) render_next::next_piece_char#0 next_piece_char zp[1]:32 66.86666666666667
(byte*) render_next::next_piece_gfx
(byte*) render_next::next_piece_gfx#1 next_piece_gfx zp[2]:36 210.29999999999998
(byte*) render_next::next_piece_gfx#2 next_piece_gfx zp[2]:36 1552.0
(byte*) render_next::next_piece_gfx#3 next_piece_gfx zp[2]:36 204.0
(byte*) render_next::next_piece_gfx#9 next_piece_gfx zp[2]:36 4.0
(byte*) render_next::next_piece_gfx#1 next_piece_gfx zp[2]:35 210.29999999999998
(byte*) render_next::next_piece_gfx#2 next_piece_gfx zp[2]:35 1552.0
(byte*) render_next::next_piece_gfx#3 next_piece_gfx zp[2]:35 204.0
(byte*) render_next::next_piece_gfx#9 next_piece_gfx zp[2]:35 4.0
(byte*) render_next::screen_next_area
(byte*) render_next::screen_next_area#10 screen_next_area zp[2]:34 204.0
(byte*) render_next::screen_next_area#11 screen_next_area zp[2]:34 0.5
(byte*) render_next::screen_next_area#3 screen_next_area zp[2]:34 701.0
(byte*) render_next::screen_next_area#4 screen_next_area zp[2]:34 67.33333333333333
(byte*) render_next::screen_next_area#5 screen_next_area zp[2]:34 684.1666666666667
(byte*) render_next::screen_next_area#10 screen_next_area zp[2]:33 204.0
(byte*) render_next::screen_next_area#11 screen_next_area zp[2]:33 0.5
(byte*) render_next::screen_next_area#3 screen_next_area zp[2]:33 701.0
(byte*) render_next::screen_next_area#4 screen_next_area zp[2]:33 67.33333333333333
(byte*) render_next::screen_next_area#5 screen_next_area zp[2]:33 684.1666666666667
(void()) render_playfield()
(byte~) render_playfield::$0 reg byte a 202.0
(byte~) render_playfield::$3 reg byte a 202.0
@@ -772,19 +753,19 @@
(label) render_playfield::@3
(label) render_playfield::@return
(byte) render_playfield::c
(byte) render_playfield::c#1 c zp[1]:16 1501.5
(byte) render_playfield::c#2 c zp[1]:16 500.5
(byte) render_playfield::c#1 c zp[1]:15 1501.5
(byte) render_playfield::c#2 c zp[1]:15 500.5
(byte) render_playfield::i
(byte) render_playfield::i#1 i zp[1]:15 420.59999999999997
(byte) render_playfield::i#2 i zp[1]:15 1034.6666666666667
(byte) render_playfield::i#3 i zp[1]:15 50.5
(byte) render_playfield::i#1 i zp[1]:14 420.59999999999997
(byte) render_playfield::i#2 i zp[1]:14 1034.6666666666667
(byte) render_playfield::i#3 i zp[1]:14 50.5
(byte) render_playfield::l
(byte) render_playfield::l#1 l zp[1]:14 151.5
(byte) render_playfield::l#2 l zp[1]:14 30.299999999999997
(byte) render_playfield::l#1 l zp[1]:13 151.5
(byte) render_playfield::l#2 l zp[1]:13 30.299999999999997
(byte*) render_playfield::screen_line
(byte*) render_playfield::screen_line#0 screen_line zp[2]:36 202.0
(byte*) render_playfield::screen_line#1 screen_line zp[2]:36 500.5
(byte*) render_playfield::screen_line#2 screen_line zp[2]:36 1552.0
(byte*) render_playfield::screen_line#0 screen_line zp[2]:35 202.0
(byte*) render_playfield::screen_line#1 screen_line zp[2]:35 500.5
(byte*) render_playfield::screen_line#2 screen_line zp[2]:35 1552.0
(void()) render_score()
(label) render_score::@1
(label) render_score::@2
@@ -799,7 +780,7 @@
(const byte*) render_score::score_bytes = (byte*)&(dword) score_bcd
(const word) render_score::score_offset = (word)(number) $28*(number) 5+(number) $1c
(byte*) render_score::screen
(byte*) render_score::screen#3 screen zp[2]:36 0.75
(byte*) render_score::screen#3 screen zp[2]:35 0.75
(void()) render_screen_original((byte*) render_screen_original::screen)
(label) render_screen_original::@1
(label) render_screen_original::@2
@@ -809,30 +790,30 @@
(label) render_screen_original::@return
(const byte) render_screen_original::SPACE = (byte) 0
(byte*) render_screen_original::cols
(byte*) render_screen_original::cols#1 cols zp[2]:44 101.0
(byte*) render_screen_original::cols#2 cols zp[2]:44 75.75
(byte*) render_screen_original::cols#3 cols zp[2]:44 42.599999999999994
(byte*) render_screen_original::cols#4 cols zp[2]:44 78.5
(byte*) render_screen_original::cols#5 cols zp[2]:44 80.8
(byte*) render_screen_original::cols#6 cols zp[2]:44 101.0
(byte*) render_screen_original::cols#7 cols zp[2]:44 22.0
(byte*) render_screen_original::cols#1 cols zp[2]:43 101.0
(byte*) render_screen_original::cols#2 cols zp[2]:43 75.75
(byte*) render_screen_original::cols#3 cols zp[2]:43 42.599999999999994
(byte*) render_screen_original::cols#4 cols zp[2]:43 78.5
(byte*) render_screen_original::cols#5 cols zp[2]:43 80.8
(byte*) render_screen_original::cols#6 cols zp[2]:43 101.0
(byte*) render_screen_original::cols#7 cols zp[2]:43 22.0
(byte*) render_screen_original::ocols
(byte*) render_screen_original::ocols#1 ocols zp[2]:34 17.75
(byte*) render_screen_original::ocols#2 ocols zp[2]:34 67.33333333333333
(byte*) render_screen_original::ocols#4 ocols zp[2]:34 14.0
(byte*) render_screen_original::ocols#1 ocols zp[2]:33 17.75
(byte*) render_screen_original::ocols#2 ocols zp[2]:33 67.33333333333333
(byte*) render_screen_original::ocols#4 ocols zp[2]:33 14.0
(byte*) render_screen_original::oscr
(byte*) render_screen_original::oscr#1 oscr zp[2]:25 14.2
(byte*) render_screen_original::oscr#2 oscr zp[2]:25 134.66666666666666
(byte*) render_screen_original::oscr#4 oscr zp[2]:25 14.0
(byte*) render_screen_original::oscr#1 oscr zp[2]:24 14.2
(byte*) render_screen_original::oscr#2 oscr zp[2]:24 134.66666666666666
(byte*) render_screen_original::oscr#4 oscr zp[2]:24 14.0
(byte*) render_screen_original::screen
(byte*) render_screen_original::screen#10 screen zp[2]:36 30.42857142857143
(byte*) render_screen_original::screen#2 screen zp[2]:36 60.599999999999994
(byte*) render_screen_original::screen#3 screen zp[2]:36 43.285714285714285
(byte*) render_screen_original::screen#5 screen zp[2]:36 157.0
(byte*) render_screen_original::screen#6 screen zp[2]:36 202.0
(byte*) render_screen_original::screen#7 screen zp[2]:36 202.0
(byte*) render_screen_original::screen#8 screen zp[2]:36 24.0
(byte*) render_screen_original::screen#9 screen zp[2]:36 2.0
(byte*) render_screen_original::screen#10 screen zp[2]:35 30.42857142857143
(byte*) render_screen_original::screen#2 screen zp[2]:35 60.599999999999994
(byte*) render_screen_original::screen#3 screen zp[2]:35 43.285714285714285
(byte*) render_screen_original::screen#5 screen zp[2]:35 157.0
(byte*) render_screen_original::screen#6 screen zp[2]:35 202.0
(byte*) render_screen_original::screen#7 screen zp[2]:35 202.0
(byte*) render_screen_original::screen#8 screen zp[2]:35 24.0
(byte*) render_screen_original::screen#9 screen zp[2]:35 2.0
(byte) render_screen_original::x
(byte) render_screen_original::x#1 reg byte x 202.0
(byte) render_screen_original::x#2 reg byte x 202.0
@@ -841,24 +822,21 @@
(byte) render_screen_original::x#5 reg byte x 43.285714285714285
(byte) render_screen_original::x#6 reg byte x 60.599999999999994
(byte) render_screen_original::y
(byte) render_screen_original::y#1 y zp[1]:24 16.5
(byte) render_screen_original::y#6 y zp[1]:24 0.9166666666666666
(byte) render_screen_original::y#1 y zp[1]:23 16.5
(byte) render_screen_original::y#6 y zp[1]:23 0.9166666666666666
(byte) render_screen_render
(byte) render_screen_render#11 render_screen_render zp[1]:21 3.25
(byte) render_screen_render#11 render_screen_render zp[1]:20 3.25
(byte) render_screen_render#15 reg byte a 13.0
(byte) render_screen_render#18 render_screen_render zp[1]:21 4.8076923076923075
(byte) render_screen_render#18 render_screen_render zp[1]:20 4.8076923076923075
(byte) render_screen_render#22 reg byte x 8.615384615384615
(byte) render_screen_render#33 render_screen_render_1 zp[1]:13 5.333333333333333
(byte) render_screen_render#33 render_screen_render_1 zp[1]:12 5.333333333333333
(byte) render_screen_render#63 reg byte x 22.0
(byte) render_screen_render#64 render_screen_render_1 zp[1]:13 5.5
(byte) render_screen_render#64 render_screen_render_1 zp[1]:12 5.5
(byte) render_screen_render#65 reg byte a 11.0
(byte) render_screen_show
(byte) render_screen_show#13 render_screen_show zp[1]:20 4.333333333333333
(byte) render_screen_show#16 render_screen_show zp[1]:20 5.474999999999999
(byte) render_screen_showing
(byte) render_screen_showing#0 render_screen_showing zp[1]:2 0.1276595744680851
(byte) render_screen_showing#1 render_screen_showing zp[1]:2 3.8000000000000003
(byte) render_screen_showing#13 render_screen_showing zp[1]:2 1140.0
(byte) render_screen_show#13 render_screen_show zp[1]:19 4.333333333333333
(byte) render_screen_show#16 render_screen_show zp[1]:19 5.474999999999999
(byte) render_screen_showing loadstore zp[1]:26 0.6000000000000001
(void()) render_screen_swap()
(label) render_screen_swap::@return
(void()) render_show()
@@ -878,12 +856,12 @@
(byte*) render_show::toD0182_screen
(const dword*) score_add_bcd[(number) 5] = { fill( 5, 0) }
(dword) score_bcd
(dword) score_bcd#0 score_bcd zp[4]:3 0.1111111111111111
(dword) score_bcd#13 score_bcd zp[4]:3 3.135135135135135
(dword) score_bcd#15 score_bcd zp[4]:3 1.1428571428571428
(dword) score_bcd#17 score_bcd zp[4]:3 2.3921568627450975
(dword) score_bcd#23 score_bcd zp[4]:3 6.0
(dword) score_bcd#26 score_bcd zp[4]:3 0.8571428571428571
(dword) score_bcd#0 score_bcd zp[4]:2 0.1111111111111111
(dword) score_bcd#13 score_bcd zp[4]:2 3.135135135135135
(dword) score_bcd#15 score_bcd zp[4]:2 1.1428571428571428
(dword) score_bcd#17 score_bcd zp[4]:2 2.3921568627450975
(dword) score_bcd#23 score_bcd zp[4]:2 6.0
(dword) score_bcd#26 score_bcd zp[4]:2 0.8571428571428571
(const byte**) screen_lines_1[(const byte) PLAYFIELD_LINES] = { fill( PLAYFIELD_LINES, 0) }
(const byte**) screen_lines_2[(const byte) PLAYFIELD_LINES] = { fill( PLAYFIELD_LINES, 0) }
(void()) sid_rnd_init()
@@ -897,8 +875,8 @@
(byte) sprites_init::s2
(byte) sprites_init::s2#0 reg byte x 22.0
(byte) sprites_init::xpos
(byte) sprites_init::xpos#1 xpos zp[1]:21 7.333333333333333
(byte) sprites_init::xpos#2 xpos zp[1]:21 8.25
(byte) sprites_init::xpos#1 xpos zp[1]:20 7.333333333333333
(byte) sprites_init::xpos#2 xpos zp[1]:20 8.25
interrupt(HARDWARE_CLOBBER)(void()) sprites_irq()
(byte~) sprites_irq::$0 reg byte x 4.0
(label) sprites_irq::@1
@@ -919,8 +897,7 @@ interrupt(HARDWARE_CLOBBER)(void()) sprites_irq()
(byte) sprites_irq::ptr#2 reg byte a 4.0
(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[1]:27 6.5
(byte) sprites_irq::raster_sprite_gfx_modify loadstore zp[1]:47 6.5
(label) sprites_irq::toSpritePtr2
(byte) sprites_irq::toSpritePtr2_return
(const byte) sprites_irq::toSpritePtr2_return#0 toSpritePtr2_return = (byte)(word)(const byte*) PLAYFIELD_SPRITES/(byte) $40
@@ -934,7 +911,6 @@ interrupt(HARDWARE_CLOBBER)(void()) sprites_irq()
(const byte) toSpritePtr1_return#0 toSpritePtr1_return = (byte)(word)(const byte*) PLAYFIELD_SPRITES/(byte) $40
(byte*) toSpritePtr1_sprite
zp[1]:2 [ render_screen_showing#13 render_screen_showing#1 render_screen_showing#0 ]
reg byte y [ render_bcd::only_low#6 ]
reg byte x [ render_bcd::bcd#6 render_bcd::bcd#0 render_bcd::bcd#1 render_bcd::bcd#2 render_bcd::bcd#3 render_bcd::bcd#4 render_bcd::bcd#5 ]
reg byte a [ render_screen_render#15 render_screen_render#65 ]
@@ -949,46 +925,46 @@ reg byte x [ play_collision::c#2 play_collision::c#1 ]
reg byte a [ play_collision::return#15 ]
reg byte a [ play_move_leftright::return#2 ]
reg byte x [ play_move_down::movedown#6 play_move_down::movedown#7 play_move_down::movedown#10 play_move_down::movedown#2 play_move_down::movedown#3 ]
zp[4]:3 [ score_bcd#23 score_bcd#17 score_bcd#13 score_bcd#0 score_bcd#15 score_bcd#26 ]
zp[1]:7 [ level#33 level#10 level#17 level#19 level#21 ]
zp[1]:8 [ current_movedown_slow#37 current_movedown_slow#14 current_movedown_slow#21 current_movedown_slow#1 current_movedown_slow#23 current_movedown_slow#65 current_movedown_slow#10 ]
zp[1]:9 [ level_bcd#31 level_bcd#11 level_bcd#17 level_bcd#19 level_bcd#62 level_bcd#21 level_bcd#8 ]
zp[4]:2 [ score_bcd#23 score_bcd#17 score_bcd#13 score_bcd#0 score_bcd#15 score_bcd#26 ]
zp[1]:6 [ level#33 level#10 level#17 level#19 level#21 ]
zp[1]:7 [ current_movedown_slow#37 current_movedown_slow#14 current_movedown_slow#21 current_movedown_slow#1 current_movedown_slow#23 current_movedown_slow#65 current_movedown_slow#10 ]
zp[1]:8 [ level_bcd#31 level_bcd#11 level_bcd#17 level_bcd#19 level_bcd#62 level_bcd#21 level_bcd#8 ]
reg byte x [ play_move_down::return#3 ]
zp[1]:10 [ next_piece_idx#17 next_piece_idx#30 next_piece_idx#10 next_piece_idx#16 play_spawn_current::piece_idx#2 play_spawn_current::piece_idx#1 ]
zp[1]:11 [ game_over#65 game_over#27 game_over#10 game_over#15 game_over#52 ]
zp[1]:9 [ next_piece_idx#17 next_piece_idx#30 next_piece_idx#10 next_piece_idx#16 play_spawn_current::piece_idx#2 play_spawn_current::piece_idx#1 ]
zp[1]:10 [ game_over#65 game_over#27 game_over#10 game_over#15 game_over#52 ]
reg byte x [ play_increase_level::b#2 play_increase_level::b#1 ]
zp[1]:12 [ play_remove_lines::y#8 play_remove_lines::y#1 current_movedown_counter#16 current_movedown_counter#14 current_movedown_counter#12 ]
zp[1]:13 [ play_remove_lines::removed#11 play_remove_lines::removed#8 play_remove_lines::removed#1 play_collision::yp#2 play_collision::yp#0 play_collision::ypos#0 play_collision::ypos#1 play_collision::ypos#2 play_collision::ypos#3 play_collision::ypos#4 play_collision::yp#1 render_screen_render#33 render_screen_render#64 render_next::l#7 render_next::l#1 ]
zp[1]:11 [ play_remove_lines::y#8 play_remove_lines::y#1 current_movedown_counter#16 current_movedown_counter#14 current_movedown_counter#12 ]
zp[1]:12 [ play_remove_lines::removed#11 play_remove_lines::removed#8 play_remove_lines::removed#1 play_collision::yp#2 play_collision::yp#0 play_collision::ypos#0 play_collision::ypos#1 play_collision::ypos#2 play_collision::ypos#3 play_collision::ypos#4 play_collision::yp#1 render_screen_render#33 render_screen_render#64 render_next::l#7 render_next::l#1 ]
reg byte y [ play_remove_lines::r#2 play_remove_lines::r#3 play_remove_lines::r#1 ]
zp[1]:14 [ play_remove_lines::x#2 play_remove_lines::x#1 play_collision::l#6 play_collision::l#1 render_playfield::l#2 render_playfield::l#1 current_xpos#59 current_xpos#118 current_xpos#119 ]
zp[1]:15 [ play_remove_lines::full#4 play_remove_lines::full#2 play_collision::i#2 play_collision::i#3 play_collision::i#10 play_collision::i#12 render_playfield::i#2 render_playfield::i#3 render_playfield::i#1 current_piece_char#68 current_piece_char#99 current_piece_char#100 ]
zp[1]:13 [ play_remove_lines::x#2 play_remove_lines::x#1 play_collision::l#6 play_collision::l#1 render_playfield::l#2 render_playfield::l#1 current_xpos#59 current_xpos#118 current_xpos#119 ]
zp[1]:14 [ play_remove_lines::full#4 play_remove_lines::full#2 play_collision::i#2 play_collision::i#3 play_collision::i#10 play_collision::i#12 render_playfield::i#2 render_playfield::i#3 render_playfield::i#1 current_piece_char#68 current_piece_char#99 current_piece_char#100 ]
reg byte x [ play_remove_lines::w#6 play_remove_lines::w#3 play_remove_lines::w#4 play_remove_lines::w#12 play_remove_lines::w#11 play_remove_lines::w#1 play_remove_lines::w#2 ]
zp[1]:16 [ play_lock_current::l#6 play_lock_current::l#1 play_collision::xp#2 play_collision::xp#8 play_collision::xp#1 render_playfield::c#2 render_playfield::c#1 render_moving::ypos#2 render_moving::ypos#0 render_moving::ypos#1 ]
zp[1]:17 [ play_lock_current::i#2 play_lock_current::i#3 play_lock_current::i#7 play_lock_current::i#9 current_orientation#37 current_orientation#13 current_orientation#17 current_orientation#20 current_orientation#25 current_orientation#7 ]
zp[1]:15 [ play_lock_current::l#6 play_lock_current::l#1 play_collision::xp#2 play_collision::xp#8 play_collision::xp#1 render_playfield::c#2 render_playfield::c#1 render_moving::ypos#2 render_moving::ypos#0 render_moving::ypos#1 ]
zp[1]:16 [ play_lock_current::i#2 play_lock_current::i#3 play_lock_current::i#7 play_lock_current::i#9 current_orientation#37 current_orientation#13 current_orientation#17 current_orientation#20 current_orientation#25 current_orientation#7 ]
reg byte x [ play_lock_current::c#2 play_lock_current::c#1 ]
zp[1]:18 [ keyboard_event_pressed::keycode#5 play_lock_current::xp#2 play_lock_current::xp#0 play_lock_current::xp#1 play_movement::return#2 play_movement::render#1 play_movement::return#0 play_movement::render#2 render_moving::l#4 render_moving::l#1 ]
zp[1]:17 [ keyboard_event_pressed::keycode#5 play_lock_current::xp#2 play_lock_current::xp#0 play_lock_current::xp#1 play_movement::return#2 play_movement::render#1 play_movement::return#0 play_movement::render#2 render_moving::l#4 render_moving::l#1 ]
reg byte x [ keyboard_event_get::return#2 keyboard_event_get::return#1 ]
reg byte x [ keyboard_event_scan::col#2 keyboard_event_scan::col#1 ]
zp[1]:19 [ keyboard_events_size#10 keyboard_events_size#30 keyboard_events_size#19 keyboard_events_size#16 keyboard_events_size#13 keyboard_events_size#4 keyboard_events_size#29 keyboard_events_size#1 keyboard_events_size#2 ]
zp[1]:18 [ keyboard_events_size#10 keyboard_events_size#30 keyboard_events_size#19 keyboard_events_size#16 keyboard_events_size#13 keyboard_events_size#4 keyboard_events_size#29 keyboard_events_size#1 keyboard_events_size#2 ]
reg byte a [ render_show::d018val#3 ]
reg byte y [ play_init::j#2 play_init::j#1 ]
zp[1]:20 [ play_init::idx#2 play_init::idx#1 render_screen_show#16 render_screen_show#13 ]
zp[1]:19 [ play_init::idx#2 play_init::idx#1 render_screen_show#16 render_screen_show#13 ]
reg byte x [ play_init::b#2 play_init::b#1 ]
reg byte y [ sprites_init::s#2 sprites_init::s#1 ]
zp[1]:21 [ sprites_init::xpos#2 sprites_init::xpos#1 render_screen_render#18 render_screen_render#11 ]
zp[1]:20 [ sprites_init::xpos#2 sprites_init::xpos#1 render_screen_render#18 render_screen_render#11 ]
reg byte y [ render_init::i#2 render_init::i#1 ]
zp[2]:22 [ render_init::li_1#2 render_init::li_1#1 lines_bcd#26 lines_bcd#19 lines_bcd#15 lines_bcd#17 lines_bcd#29 ]
zp[1]:24 [ render_screen_original::y#6 render_screen_original::y#1 current_ypos#38 current_ypos#3 current_ypos#11 current_ypos#19 current_ypos#6 play_lock_current::yp#2 play_lock_current::yp#0 play_lock_current::yp#1 ]
zp[2]:25 [ render_screen_original::oscr#2 render_screen_original::oscr#4 render_screen_original::oscr#1 current_piece_gfx#35 current_piece_gfx#13 current_piece_gfx#18 current_piece_gfx#123 current_piece_gfx#20 current_piece_gfx#21 current_piece_gfx#7 current_piece_gfx#116 ]
zp[2]:21 [ render_init::li_1#2 render_init::li_1#1 lines_bcd#26 lines_bcd#19 lines_bcd#15 lines_bcd#17 lines_bcd#29 ]
zp[1]:23 [ render_screen_original::y#6 render_screen_original::y#1 current_ypos#38 current_ypos#3 current_ypos#11 current_ypos#19 current_ypos#6 play_lock_current::yp#2 play_lock_current::yp#0 play_lock_current::yp#1 ]
zp[2]:24 [ render_screen_original::oscr#2 render_screen_original::oscr#4 render_screen_original::oscr#1 current_piece_gfx#35 current_piece_gfx#13 current_piece_gfx#18 current_piece_gfx#123 current_piece_gfx#20 current_piece_gfx#21 current_piece_gfx#7 current_piece_gfx#116 ]
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[1]:27 [ sprites_irq::raster_sprite_gfx_modify#0 ]
zp[1]:28 [ irq_raster_next#0 irq_raster_next#4 irq_raster_next#1 irq_raster_next#2 irq_raster_next#3 ]
zp[1]:29 [ irq_sprite_ypos#0 irq_sprite_ypos#11 irq_sprite_ypos#1 irq_sprite_ypos#2 irq_sprite_ypos#3 ]
zp[1]:30 [ irq_sprite_ptr#0 irq_sprite_ptr#11 irq_sprite_ptr#1 irq_sprite_ptr#2 irq_sprite_ptr#3 ]
zp[1]:31 [ irq_cnt#0 irq_cnt#3 irq_cnt#1 irq_cnt#2 ]
zp[1]:26 [ render_screen_showing ]
zp[1]:27 [ irq_raster_next ]
zp[1]:28 [ irq_sprite_ypos ]
zp[1]:29 [ irq_sprite_ptr ]
zp[1]:30 [ irq_cnt ]
reg byte x [ keyboard_event_get::return#3 ]
reg byte x [ main::key_event#0 ]
zp[1]:32 [ play_movement::key_event#0 keyboard_event_scan::row#2 keyboard_event_scan::row#1 play_move_rotate::orientation#3 play_move_rotate::orientation#1 play_move_rotate::orientation#2 render_moving::i#4 render_moving::i#3 render_moving::i#8 render_moving::i#2 render_moving::i#1 ]
zp[1]:31 [ play_movement::key_event#0 keyboard_event_scan::row#2 keyboard_event_scan::row#1 play_move_rotate::orientation#3 play_move_rotate::orientation#1 play_move_rotate::orientation#2 render_moving::i#4 render_moving::i#3 render_moving::i#8 render_moving::i#2 render_moving::i#1 ]
reg byte a [ play_movement::return#3 ]
reg byte a [ main::render#1 ]
reg byte a [ render_bcd::$5 ]
@@ -996,11 +972,11 @@ reg byte a [ render_bcd::$6 ]
reg byte a [ render_bcd::$3 ]
reg byte a [ render_bcd::$4 ]
reg byte y [ render_next::$6 ]
zp[1]:33 [ render_next::next_piece_char#0 keyboard_event_scan::keycode#10 keyboard_event_scan::keycode#11 keyboard_event_scan::keycode#13 keyboard_event_scan::keycode#14 keyboard_event_scan::keycode#1 play_collision::xpos#6 play_collision::xpos#0 play_collision::xpos#1 play_collision::xpos#2 play_collision::xpos#3 play_collision::xpos#4 render_moving::xpos#2 render_moving::xpos#0 render_moving::xpos#1 ]
zp[1]:32 [ render_next::next_piece_char#0 keyboard_event_scan::keycode#10 keyboard_event_scan::keycode#11 keyboard_event_scan::keycode#13 keyboard_event_scan::keycode#14 keyboard_event_scan::keycode#1 play_collision::xpos#6 play_collision::xpos#0 play_collision::xpos#1 play_collision::xpos#2 play_collision::xpos#3 play_collision::xpos#4 render_moving::xpos#2 render_moving::xpos#0 render_moving::xpos#1 ]
reg byte a [ render_next::cell#0 ]
reg byte a [ render_moving::$1 ]
reg byte a [ render_moving::$6 ]
zp[2]:34 [ render_moving::screen_line#0 render_screen_original::ocols#2 render_screen_original::ocols#4 render_screen_original::ocols#1 play_init::pli#2 play_init::pli#1 current_piece#17 current_piece#95 current_piece#96 current_piece#97 current_piece#98 current_piece#99 play_collision::piece_gfx#0 render_next::screen_next_area#5 render_next::screen_next_area#10 render_next::screen_next_area#4 render_next::screen_next_area#11 render_next::screen_next_area#3 render_bcd::offset#6 render_bcd::screen_pos#3 render_bcd::screen_pos#0 render_bcd::screen_pos#2 ]
zp[2]:33 [ render_moving::screen_line#0 render_screen_original::ocols#2 render_screen_original::ocols#4 render_screen_original::ocols#1 play_init::pli#2 play_init::pli#1 current_piece#17 current_piece#95 current_piece#96 current_piece#97 current_piece#98 current_piece#99 play_collision::piece_gfx#0 render_next::screen_next_area#5 render_next::screen_next_area#10 render_next::screen_next_area#4 render_next::screen_next_area#11 render_next::screen_next_area#3 render_bcd::offset#6 render_bcd::screen_pos#3 render_bcd::screen_pos#0 render_bcd::screen_pos#2 ]
reg byte a [ render_moving::current_cell#0 ]
reg byte a [ render_playfield::$0 ]
reg byte a [ render_playfield::$3 ]
@@ -1017,7 +993,7 @@ reg byte a [ play_collision::return#14 ]
reg byte a [ play_move_rotate::$2 ]
reg byte x [ play_move_rotate::$7 ]
reg byte a [ play_collision::$14 ]
zp[2]:36 [ play_collision::playfield_line#0 render_screen_original::screen#7 render_screen_original::screen#6 render_screen_original::screen#5 render_screen_original::screen#8 render_screen_original::screen#9 render_screen_original::screen#10 render_screen_original::screen#2 render_screen_original::screen#3 render_playfield::screen_line#2 render_playfield::screen_line#0 render_playfield::screen_line#1 current_piece_gfx#64 current_piece_gfx#111 current_piece_gfx#112 render_next::next_piece_gfx#2 render_next::next_piece_gfx#3 render_next::next_piece_gfx#1 render_next::next_piece_gfx#9 render_score::screen#3 render_bcd::screen#6 render_bcd::screen#0 render_bcd::screen#1 render_bcd::screen#2 render_bcd::screen#3 render_bcd::screen#4 render_bcd::screen#5 ]
zp[2]:35 [ play_collision::playfield_line#0 render_screen_original::screen#7 render_screen_original::screen#6 render_screen_original::screen#5 render_screen_original::screen#8 render_screen_original::screen#9 render_screen_original::screen#10 render_screen_original::screen#2 render_screen_original::screen#3 render_playfield::screen_line#2 render_playfield::screen_line#0 render_playfield::screen_line#1 current_piece_gfx#64 current_piece_gfx#111 current_piece_gfx#112 render_next::next_piece_gfx#2 render_next::next_piece_gfx#3 render_next::next_piece_gfx#1 render_next::next_piece_gfx#9 render_score::screen#3 render_bcd::screen#6 render_bcd::screen#0 render_bcd::screen#1 render_bcd::screen#2 render_bcd::screen#3 render_bcd::screen#4 render_bcd::screen#5 ]
reg byte a [ play_collision::$5 ]
reg byte a [ play_collision::return#13 ]
reg byte a [ play_move_leftright::$4 ]
@@ -1035,23 +1011,23 @@ reg byte a [ play_collision::return#10 ]
reg byte a [ play_spawn_current::$1 ]
reg byte a [ play_spawn_current::sid_rnd1_return#0 ]
reg byte a [ play_update_score::$2 ]
zp[1]:38 [ play_update_score::lines_before#0 current_piece_char#29 current_piece_char#10 current_piece_char#16 current_piece_char#5 ]
zp[1]:37 [ play_update_score::lines_before#0 current_piece_char#29 current_piece_char#10 current_piece_char#16 current_piece_char#5 ]
reg byte a [ play_update_score::$9 ]
zp[4]:39 [ play_update_score::add_bcd#0 ]
zp[4]:38 [ play_update_score::add_bcd#0 ]
reg byte a [ play_update_score::$4 ]
reg byte a [ play_update_score::lines_after#0 ]
reg byte a [ play_increase_level::$1 ]
reg byte a [ play_increase_level::$5 ]
zp[1]:43 [ play_remove_lines::c#0 current_xpos#43 current_xpos#14 current_xpos#19 current_xpos#100 current_xpos#22 current_xpos#26 current_xpos#6 current_xpos#8 ]
zp[1]:42 [ play_remove_lines::c#0 current_xpos#43 current_xpos#14 current_xpos#19 current_xpos#100 current_xpos#22 current_xpos#26 current_xpos#6 current_xpos#8 ]
reg byte a [ play_lock_current::$4 ]
zp[2]:44 [ play_lock_current::playfield_line#0 render_screen_original::cols#6 render_screen_original::cols#5 render_screen_original::cols#4 render_screen_original::cols#7 render_screen_original::cols#3 render_screen_original::cols#1 render_screen_original::cols#2 render_init::li_2#2 render_init::li_2#1 current_piece#28 current_piece#10 current_piece#15 current_piece#101 current_piece#92 ]
zp[2]:43 [ play_lock_current::playfield_line#0 render_screen_original::cols#6 render_screen_original::cols#5 render_screen_original::cols#4 render_screen_original::cols#7 render_screen_original::cols#3 render_screen_original::cols#1 render_screen_original::cols#2 render_init::li_2#2 render_init::li_2#1 current_piece#28 current_piece#10 current_piece#15 current_piece#101 current_piece#92 ]
reg byte a [ keyboard_event_pressed::$0 ]
zp[1]:46 [ keyboard_event_pressed::row_bits#0 play_spawn_current::$7 ]
zp[1]:45 [ keyboard_event_pressed::row_bits#0 play_spawn_current::$7 ]
reg byte a [ keyboard_event_pressed::$1 ]
reg byte a [ keyboard_event_pressed::return#11 ]
reg byte x [ keyboard_matrix_read::rowid#0 ]
reg byte a [ keyboard_matrix_read::return#2 ]
zp[1]:47 [ keyboard_event_scan::row_scan#0 play_lock_current::i#1 play_collision::i#1 ]
zp[1]:46 [ keyboard_event_scan::row_scan#0 play_lock_current::i#1 play_collision::i#1 ]
reg byte a [ keyboard_event_pressed::return#0 ]
reg byte a [ keyboard_event_scan::$0 ]
reg byte a [ keyboard_event_pressed::return#1 ]
@@ -1071,6 +1047,7 @@ reg byte x [ sprites_init::s2#0 ]
reg byte x [ render_init::$5 ]
reg byte a [ sprites_irq::ypos#0 ]
reg byte x [ sprites_irq::$0 ]
zp[1]:47 [ sprites_irq::raster_sprite_gfx_modify ]
reg byte x [ sprites_irq::ptr#0 ]
reg byte a [ sprites_irq::ptr#3 ]
reg byte a [ sprites_irq::ptr#4 ]
+14 -15
View File
@@ -2,7 +2,7 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte*) sample#0 ← (const byte*) SAMPLE
[1] (byte*) sample ← (const byte*) SAMPLE
to:@2
@2: scope:[] from @1
[2] phi()
@@ -30,33 +30,32 @@ interrupt(HARDWARE_ALL)(void()) nmi2()
nmi2: scope:[nmi2] from
[14] *((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL)
asm { ldaCIA2_INTERRUPT }
[16] (byte~) nmi2::$1 ← *((byte*) sample#0) >> (byte) 4
[16] (byte~) nmi2::$1 ← *((byte*) sample) >> (byte) 4
[17] *((const byte*) SID_VOLUME) ← (byte~) nmi2::$1
[18] (byte*) sample#1 ← ++ (byte*) sample#0
[19] (byte~) nmi2::$2 ← > (byte*) sample#1
[18] (byte*) sample ← ++ (byte*) sample
[19] (byte~) nmi2::$2 ← > (byte*) sample
[20] if((byte~) nmi2::$2!=>(const byte*) SAMPLE+(word) $6100) goto nmi2::@1
to:nmi2::@2
nmi2::@2: scope:[nmi2] from nmi2
[21] (byte*) sample#2 ← (const byte*) SAMPLE
[21] (byte*) sample ← (const byte*) SAMPLE
to:nmi2::@1
nmi2::@1: scope:[nmi2] from nmi2 nmi2::@2
[22] (byte*) sample#3 ← phi( nmi2/(byte*) sample#1 nmi2::@2/(byte*) sample#2 )
[23] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi()
[24] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL)
[22] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi()
[23] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL)
to:nmi2::@return
nmi2::@return: scope:[nmi2] from nmi2::@1
[25] return
[24] return
to:@return
interrupt(HARDWARE_ALL)(void()) nmi()
nmi: scope:[nmi] from
[26] *((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL)
[25] *((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL)
asm { ldaCIA2_INTERRUPT }
[28] (byte~) nmi::$1 ← *((byte*) sample#0) & (byte) $f
[29] *((const byte*) SID_VOLUME) ← (byte~) nmi::$1
[30] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2()
[31] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL)
[27] (byte~) nmi::$1 ← *((byte*) sample) & (byte) $f
[28] *((const byte*) SID_VOLUME) ← (byte~) nmi::$1
[29] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2()
[30] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL)
to:nmi::@return
nmi::@return: scope:[nmi] from nmi
[32] return
[31] return
to:@return
+90 -138
View File
@@ -11,7 +11,7 @@ CONTROL FLOW GRAPH SSA
@begin: scope:[] from
to:@4
@4: scope:[] from @begin
(byte*) sample#0 ← (const byte*) SAMPLE
(byte*) sample ← (const byte*) SAMPLE
to:@7
(void()) main()
@@ -31,10 +31,9 @@ main::@return: scope:[main] from main
interrupt(HARDWARE_ALL)(void()) nmi()
nmi: scope:[nmi] from
(byte*) sample#4 ← phi( @7/(byte*) sample#7 )
*((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL)
asm { ldaCIA2_INTERRUPT }
(number~) nmi::$1 ← *((byte*) sample#4) & (number) $f
(number~) nmi::$1 ← *((byte*) sample) & (number) $f
*((const byte*) SID_VOLUME) ← (number~) nmi::$1
*((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2()
*((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL)
@@ -45,32 +44,27 @@ nmi::@return: scope:[nmi] from nmi
interrupt(HARDWARE_ALL)(void()) nmi2()
nmi2: scope:[nmi2] from
(byte*) sample#5 ← phi( @7/(byte*) sample#7 )
*((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL)
asm { ldaCIA2_INTERRUPT }
(byte~) nmi2::$1 ← *((byte*) sample#5) >> (number) 4
(byte~) nmi2::$1 ← *((byte*) sample) >> (number) 4
*((const byte*) SID_VOLUME) ← (byte~) nmi2::$1
(byte*) sample#1 ← ++ (byte*) sample#5
(byte~) nmi2::$2 ← > (byte*) sample#1
(byte*) sample ← ++ (byte*) sample
(byte~) nmi2::$2 ← > (byte*) sample
(bool~) nmi2::$3 ← (byte~) nmi2::$2 == >(const byte*) SAMPLE+(number) $6100
(bool~) nmi2::$4 ← ! (bool~) nmi2::$3
if((bool~) nmi2::$4) goto nmi2::@1
to:nmi2::@2
nmi2::@1: scope:[nmi2] from nmi2 nmi2::@2
(byte*) sample#8 ← phi( nmi2/(byte*) sample#1 nmi2::@2/(byte*) sample#2 )
*((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi()
*((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL)
to:nmi2::@return
nmi2::@2: scope:[nmi2] from nmi2
(byte*) sample#2 ← (const byte*) SAMPLE
(byte*) sample ← (const byte*) SAMPLE
to:nmi2::@1
nmi2::@return: scope:[nmi2] from nmi2::@1
(byte*) sample#6 ← phi( nmi2::@1/(byte*) sample#8 )
(byte*) sample#3 ← (byte*) sample#6
return
to:@return
@7: scope:[] from @4
(byte*) sample#7 ← phi( @4/(byte*) sample#0 )
call main
to:@8
@8: scope:[] from @7
@@ -105,23 +99,14 @@ interrupt(HARDWARE_ALL)(void()) nmi2()
(label) nmi2::@1
(label) nmi2::@2
(label) nmi2::@return
(byte*) sample
(byte*) sample#0
(byte*) sample#1
(byte*) sample#2
(byte*) sample#3
(byte*) sample#4
(byte*) sample#5
(byte*) sample#6
(byte*) sample#7
(byte*) sample#8
(byte*) sample loadstore
Adding number conversion cast (unumber) $88 in *((const word*) CIA2_TIMER_A) ← (number) $88
Adding number conversion cast (unumber) $81 in *((const byte*) CIA2_INTERRUPT) ← (number) $81
Adding number conversion cast (unumber) 1 in *((const byte*) CIA2_TIMER_A_CONTROL) ← (number) 1
Adding number conversion cast (unumber) $f in (number~) nmi::$1 ← *((byte*) sample#4) & (number) $f
Adding number conversion cast (unumber) nmi::$1 in (number~) nmi::$1 ← *((byte*) sample#4) & (unumber)(number) $f
Adding number conversion cast (unumber) 4 in (byte~) nmi2::$1 ← *((byte*) sample#5) >> (number) 4
Adding number conversion cast (unumber) $f in (number~) nmi::$1 ← *((byte*) sample) & (number) $f
Adding number conversion cast (unumber) nmi::$1 in (number~) nmi::$1 ← *((byte*) sample) & (unumber)(number) $f
Adding number conversion cast (unumber) 4 in (byte~) nmi2::$1 ← *((byte*) sample) >> (number) 4
Adding number conversion cast (unumber) $6100 in (bool~) nmi2::$3 ← (byte~) nmi2::$2 == >(const byte*) SAMPLE+(number) $6100
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *((const word*) CIA2_TIMER_A) ← (unumber)(number) $88
@@ -148,18 +133,11 @@ Finalized unsigned number type (byte) $f
Finalized unsigned number type (byte) 4
Finalized unsigned number type (word) $6100
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to byte in (unumber~) nmi::$1 ← *((byte*) sample#4) & (byte) $f
Inversing boolean not [26] (bool~) nmi2::$4 ← (byte~) nmi2::$2 != >(const byte*) SAMPLE+(word) $6100 from [25] (bool~) nmi2::$3 ← (byte~) nmi2::$2 == >(const byte*) SAMPLE+(word) $6100
Inferred type updated to byte in (unumber~) nmi::$1 ← *((byte*) sample) & (byte) $f
Inversing boolean not [24] (bool~) nmi2::$4 ← (byte~) nmi2::$2 != >(const byte*) SAMPLE+(word) $6100 from [23] (bool~) nmi2::$3 ← (byte~) nmi2::$2 == >(const byte*) SAMPLE+(word) $6100
Successful SSA optimization Pass2UnaryNotSimplification
Alias (byte*) sample#3 = (byte*) sample#6 (byte*) sample#8
Alias (byte*) sample#0 = (byte*) sample#7
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte*) sample#4 (byte*) sample#0
Identical Phi Values (byte*) sample#5 (byte*) sample#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) nmi2::$4 [27] if((byte~) nmi2::$2!=>(const byte*) SAMPLE+(word) $6100) goto nmi2::@1
Simple Condition (bool~) nmi2::$4 [25] if((byte~) nmi2::$2!=>(const byte*) SAMPLE+(word) $6100) goto nmi2::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Added new block during phi lifting nmi2::@3(between nmi2 and nmi2::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @7
Adding NOP phi() at start of @8
@@ -167,12 +145,9 @@ Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:3
Created 1 initial phi equivalence classes
Coalesced [23] sample#10 ← sample#2
Coalesced [28] sample#9 ← sample#1
Coalesced down to 1 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @8
Culled Empty Block (label) nmi2::@3
Renumbering block @4 to @1
Renumbering block @7 to @2
Adding NOP phi() at start of @begin
@@ -184,7 +159,7 @@ FINAL CONTROL FLOW GRAPH
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte*) sample#0 ← (const byte*) SAMPLE
[1] (byte*) sample ← (const byte*) SAMPLE
to:@2
@2: scope:[] from @1
[2] phi()
@@ -212,35 +187,34 @@ interrupt(HARDWARE_ALL)(void()) nmi2()
nmi2: scope:[nmi2] from
[14] *((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL)
asm { ldaCIA2_INTERRUPT }
[16] (byte~) nmi2::$1 ← *((byte*) sample#0) >> (byte) 4
[16] (byte~) nmi2::$1 ← *((byte*) sample) >> (byte) 4
[17] *((const byte*) SID_VOLUME) ← (byte~) nmi2::$1
[18] (byte*) sample#1 ← ++ (byte*) sample#0
[19] (byte~) nmi2::$2 ← > (byte*) sample#1
[18] (byte*) sample ← ++ (byte*) sample
[19] (byte~) nmi2::$2 ← > (byte*) sample
[20] if((byte~) nmi2::$2!=>(const byte*) SAMPLE+(word) $6100) goto nmi2::@1
to:nmi2::@2
nmi2::@2: scope:[nmi2] from nmi2
[21] (byte*) sample#2 ← (const byte*) SAMPLE
[21] (byte*) sample ← (const byte*) SAMPLE
to:nmi2::@1
nmi2::@1: scope:[nmi2] from nmi2 nmi2::@2
[22] (byte*) sample#3 ← phi( nmi2/(byte*) sample#1 nmi2::@2/(byte*) sample#2 )
[23] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi()
[24] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL)
[22] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi()
[23] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL)
to:nmi2::@return
nmi2::@return: scope:[nmi2] from nmi2::@1
[25] return
[24] return
to:@return
interrupt(HARDWARE_ALL)(void()) nmi()
nmi: scope:[nmi] from
[26] *((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL)
[25] *((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL)
asm { ldaCIA2_INTERRUPT }
[28] (byte~) nmi::$1 ← *((byte*) sample#0) & (byte) $f
[29] *((const byte*) SID_VOLUME) ← (byte~) nmi::$1
[30] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2()
[31] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL)
[27] (byte~) nmi::$1 ← *((byte*) sample) & (byte) $f
[28] *((const byte*) SID_VOLUME) ← (byte~) nmi::$1
[29] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2()
[30] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL)
to:nmi::@return
nmi::@return: scope:[nmi] from nmi
[32] return
[31] return
to:@return
@@ -251,24 +225,19 @@ interrupt(HARDWARE_ALL)(void()) nmi()
interrupt(HARDWARE_ALL)(void()) nmi2()
(byte~) nmi2::$1 4.0
(byte~) nmi2::$2 4.0
(byte*) sample
(byte*) sample#0 1.3333333333333333
(byte*) sample#1 2.0
(byte*) sample#2 4.0
(byte*) sample#3 40.0
(byte*) sample loadstore 2.8
Initial phi equivalence classes
[ sample#3 sample#1 sample#2 ]
Coalescing volatile variable equivalence classes [ sample#0 ] and [ sample#3 sample#1 sample#2 ]
Added variable sample to live range equivalence class [ sample ]
Added variable nmi2::$1 to live range equivalence class [ nmi2::$1 ]
Added variable nmi2::$2 to live range equivalence class [ nmi2::$2 ]
Added variable nmi::$1 to live range equivalence class [ nmi::$1 ]
Complete equivalence classes
[ sample#0 sample#3 sample#1 sample#2 ]
[ sample ]
[ nmi2::$1 ]
[ nmi2::$2 ]
[ nmi::$1 ]
Allocated zp[2]:2 [ sample#0 sample#3 sample#1 sample#2 ]
Allocated zp[2]:2 [ sample ]
Allocated zp[1]:4 [ nmi2::$1 ]
Allocated zp[1]:5 [ nmi2::$2 ]
Allocated zp[1]:6 [ nmi::$1 ]
@@ -304,7 +273,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte*) sample#0 ← (const byte*) SAMPLE -- pbuz1=pbuc1
// [1] (byte*) sample ← (const byte*) SAMPLE -- pbuz1=pbuc1
lda #<SAMPLE
sta.z sample
lda #>SAMPLE
@@ -376,7 +345,7 @@ nmi2: {
inc BORDERCOL
// asm { ldaCIA2_INTERRUPT }
lda CIA2_INTERRUPT
// [16] (byte~) nmi2::$1 ← *((byte*) sample#0) >> (byte) 4 -- vbuz1=_deref_pbuz2_ror_4
// [16] (byte~) nmi2::$1 ← *((byte*) sample) >> (byte) 4 -- vbuz1=_deref_pbuz2_ror_4
ldy #0
lda (sample),y
lsr
@@ -387,44 +356,40 @@ nmi2: {
// [17] *((const byte*) SID_VOLUME) ← (byte~) nmi2::$1 -- _deref_pbuc1=vbuz1
lda.z __1
sta SID_VOLUME
// [18] (byte*) sample#1 ← ++ (byte*) sample#0 -- pbuz1=_inc_pbuz1
// [18] (byte*) sample ← ++ (byte*) sample -- pbuz1=_inc_pbuz1
inc.z sample
bne !+
inc.z sample+1
!:
// [19] (byte~) nmi2::$2 ← > (byte*) sample#1 -- vbuz1=_hi_pbuz2
// [19] (byte~) nmi2::$2 ← > (byte*) sample -- vbuz1=_hi_pbuz2
lda.z sample+1
sta.z __2
// [20] if((byte~) nmi2::$2!=>(const byte*) SAMPLE+(word) $6100) goto nmi2::@1 -- vbuz1_neq_vbuc1_then_la1
lda #>SAMPLE+$6100
cmp.z __2
bne __b1_from_nmi2
bne __b1
jmp __b2
// nmi2::@2
__b2:
// [21] (byte*) sample#2 ← (const byte*) SAMPLE -- pbuz1=pbuc1
// [21] (byte*) sample ← (const byte*) SAMPLE -- pbuz1=pbuc1
lda #<SAMPLE
sta.z sample
lda #>SAMPLE
sta.z sample+1
// [22] phi from nmi2 nmi2::@2 to nmi2::@1 [phi:nmi2/nmi2::@2->nmi2::@1]
__b1_from_nmi2:
__b1_from___b2:
// [22] phi (byte*) sample#3 = (byte*) sample#1 [phi:nmi2/nmi2::@2->nmi2::@1#0] -- register_copy
jmp __b1
// nmi2::@1
__b1:
// [23] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi() -- _deref_pptc1=pprc2
// [22] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi() -- _deref_pptc1=pprc2
lda #<nmi
sta KERNEL_NMI
lda #>nmi
sta KERNEL_NMI+1
// [24] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL) -- _deref_pbuc1=_dec__deref_pbuc1
// [23] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL) -- _deref_pbuc1=_dec__deref_pbuc1
dec BORDERCOL
jmp __breturn
// nmi2::@return
__breturn:
// [25] return - exit interrupt(HARDWARE_ALL)
// [24] return - exit interrupt(HARDWARE_ALL)
rega:
lda #00
regx:
@@ -440,29 +405,29 @@ nmi: {
sta rega+1
stx regx+1
sty regy+1
// [26] *((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL) -- _deref_pbuc1=_inc__deref_pbuc1
// [25] *((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
// asm { ldaCIA2_INTERRUPT }
lda CIA2_INTERRUPT
// [28] (byte~) nmi::$1 ← *((byte*) sample#0) & (byte) $f -- vbuz1=_deref_pbuz2_band_vbuc1
// [27] (byte~) nmi::$1 ← *((byte*) sample) & (byte) $f -- vbuz1=_deref_pbuz2_band_vbuc1
lda #$f
ldy #0
and (sample),y
sta.z __1
// [29] *((const byte*) SID_VOLUME) ← (byte~) nmi::$1 -- _deref_pbuc1=vbuz1
// [28] *((const byte*) SID_VOLUME) ← (byte~) nmi::$1 -- _deref_pbuc1=vbuz1
lda.z __1
sta SID_VOLUME
// [30] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2() -- _deref_pptc1=pprc2
// [29] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2() -- _deref_pptc1=pprc2
lda #<nmi2
sta KERNEL_NMI
lda #>nmi2
sta KERNEL_NMI+1
// [31] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL) -- _deref_pbuc1=_dec__deref_pbuc1
// [30] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL) -- _deref_pbuc1=_dec__deref_pbuc1
dec BORDERCOL
jmp __breturn
// nmi::@return
__breturn:
// [32] return - exit interrupt(HARDWARE_ALL)
// [31] return - exit interrupt(HARDWARE_ALL)
rega:
lda #00
regx:
@@ -476,7 +441,7 @@ SAMPLE:
.import binary "moments_sample.bin"
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] (byte*) sample#0 ← (const byte*) SAMPLE [ ] ( [ ] ) always clobbers reg byte a
Statement [1] (byte*) sample ← (const byte*) SAMPLE [ ] ( [ ] ) always clobbers reg byte a
Statement asm { lda#$ff sta$d406 sta$d40d sta$d414 lda#$49 sta$d404 sta$d40b sta$d412 } always clobbers reg byte a
Statement [7] *((const byte*) CIA2_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [8] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi() [ ] ( main:3 [ ] ) always clobbers reg byte a
@@ -484,28 +449,28 @@ Statement [9] *((const word*) CIA2_TIMER_A) ← (byte) $88 [ ] ( main:3 [ ] ) al
Statement [10] *((const byte*) CIA2_INTERRUPT) ← (byte) $81 [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [11] *((const byte*) CIA2_TIMER_A_CONTROL) ← (byte) 1 [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement asm { ldaCIA2_INTERRUPT } always clobbers reg byte a
Statement [16] (byte~) nmi2::$1 ← *((byte*) sample#0) >> (byte) 4 [ sample#0 nmi2::$1 ] ( [ sample#0 nmi2::$1 ] ) always clobbers reg byte a reg byte y
Statement [21] (byte*) sample#2 ← (const byte*) SAMPLE [ sample#2 ] ( [ sample#2 ] ) always clobbers reg byte a
Statement [23] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi() [ ] ( [ ] ) always clobbers reg byte a
Statement [25] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y
Statement [16] (byte~) nmi2::$1 ← *((byte*) sample) >> (byte) 4 [ nmi2::$1 ] ( [ nmi2::$1 ] ) always clobbers reg byte a reg byte y
Statement [21] (byte*) sample ← (const byte*) SAMPLE [ ] ( [ ] ) always clobbers reg byte a
Statement [22] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi() [ ] ( [ ] ) always clobbers reg byte a
Statement [24] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y
Statement asm { ldaCIA2_INTERRUPT } always clobbers reg byte a
Statement [28] (byte~) nmi::$1 ← *((byte*) sample#0) & (byte) $f [ nmi::$1 ] ( [ nmi::$1 ] ) always clobbers reg byte a reg byte y
Statement [30] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2() [ ] ( [ ] ) always clobbers reg byte a
Statement [32] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y
Potential registers zp[2]:2 [ sample#0 sample#3 sample#1 sample#2 ] : zp[2]:2 ,
Statement [27] (byte~) nmi::$1 ← *((byte*) sample) & (byte) $f [ nmi::$1 ] ( [ nmi::$1 ] ) always clobbers reg byte a reg byte y
Statement [29] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2() [ ] ( [ ] ) always clobbers reg byte a
Statement [31] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y
Potential registers zp[2]:2 [ sample ] : zp[2]:2 ,
Potential registers zp[1]:4 [ nmi2::$1 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:5 [ nmi2::$2 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:6 [ nmi::$1 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 47.33: zp[2]:2 [ sample#0 sample#3 sample#1 sample#2 ]
Uplift Scope [nmi2] 4: zp[1]:4 [ nmi2::$1 ] 4: zp[1]:5 [ nmi2::$2 ]
Uplift Scope [nmi] 4: zp[1]:6 [ nmi::$1 ]
Uplift Scope [] 2.8: zp[2]:2 [ sample ]
Uplift Scope [main]
Uplifting [] best 546 combination zp[2]:2 [ sample#0 sample#3 sample#1 sample#2 ]
Uplifting [nmi2] best 534 combination reg byte a [ nmi2::$1 ] reg byte a [ nmi2::$2 ]
Uplifting [nmi] best 528 combination reg byte a [ nmi::$1 ]
Uplifting [] best 528 combination zp[2]:2 [ sample ]
Uplifting [main] best 528 combination
ASSEMBLER BEFORE OPTIMIZATION
@@ -538,7 +503,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte*) sample#0 ← (const byte*) SAMPLE -- pbuz1=pbuc1
// [1] (byte*) sample ← (const byte*) SAMPLE -- pbuz1=pbuc1
lda #<SAMPLE
sta.z sample
lda #>SAMPLE
@@ -608,7 +573,7 @@ nmi2: {
inc BORDERCOL
// asm { ldaCIA2_INTERRUPT }
lda CIA2_INTERRUPT
// [16] (byte~) nmi2::$1 ← *((byte*) sample#0) >> (byte) 4 -- vbuaa=_deref_pbuz1_ror_4
// [16] (byte~) nmi2::$1 ← *((byte*) sample) >> (byte) 4 -- vbuaa=_deref_pbuz1_ror_4
ldy #0
lda (sample),y
lsr
@@ -617,42 +582,38 @@ nmi2: {
lsr
// [17] *((const byte*) SID_VOLUME) ← (byte~) nmi2::$1 -- _deref_pbuc1=vbuaa
sta SID_VOLUME
// [18] (byte*) sample#1 ← ++ (byte*) sample#0 -- pbuz1=_inc_pbuz1
// [18] (byte*) sample ← ++ (byte*) sample -- pbuz1=_inc_pbuz1
inc.z sample
bne !+
inc.z sample+1
!:
// [19] (byte~) nmi2::$2 ← > (byte*) sample#1 -- vbuaa=_hi_pbuz1
// [19] (byte~) nmi2::$2 ← > (byte*) sample -- vbuaa=_hi_pbuz1
lda.z sample+1
// [20] if((byte~) nmi2::$2!=>(const byte*) SAMPLE+(word) $6100) goto nmi2::@1 -- vbuaa_neq_vbuc1_then_la1
cmp #>SAMPLE+$6100
bne __b1_from_nmi2
bne __b1
jmp __b2
// nmi2::@2
__b2:
// [21] (byte*) sample#2 ← (const byte*) SAMPLE -- pbuz1=pbuc1
// [21] (byte*) sample ← (const byte*) SAMPLE -- pbuz1=pbuc1
lda #<SAMPLE
sta.z sample
lda #>SAMPLE
sta.z sample+1
// [22] phi from nmi2 nmi2::@2 to nmi2::@1 [phi:nmi2/nmi2::@2->nmi2::@1]
__b1_from_nmi2:
__b1_from___b2:
// [22] phi (byte*) sample#3 = (byte*) sample#1 [phi:nmi2/nmi2::@2->nmi2::@1#0] -- register_copy
jmp __b1
// nmi2::@1
__b1:
// [23] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi() -- _deref_pptc1=pprc2
// [22] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi() -- _deref_pptc1=pprc2
lda #<nmi
sta KERNEL_NMI
lda #>nmi
sta KERNEL_NMI+1
// [24] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL) -- _deref_pbuc1=_dec__deref_pbuc1
// [23] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL) -- _deref_pbuc1=_dec__deref_pbuc1
dec BORDERCOL
jmp __breturn
// nmi2::@return
__breturn:
// [25] return - exit interrupt(HARDWARE_ALL)
// [24] return - exit interrupt(HARDWARE_ALL)
rega:
lda #00
regx:
@@ -667,27 +628,27 @@ nmi: {
sta rega+1
stx regx+1
sty regy+1
// [26] *((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL) -- _deref_pbuc1=_inc__deref_pbuc1
// [25] *((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
// asm { ldaCIA2_INTERRUPT }
lda CIA2_INTERRUPT
// [28] (byte~) nmi::$1 ← *((byte*) sample#0) & (byte) $f -- vbuaa=_deref_pbuz1_band_vbuc1
// [27] (byte~) nmi::$1 ← *((byte*) sample) & (byte) $f -- vbuaa=_deref_pbuz1_band_vbuc1
lda #$f
ldy #0
and (sample),y
// [29] *((const byte*) SID_VOLUME) ← (byte~) nmi::$1 -- _deref_pbuc1=vbuaa
// [28] *((const byte*) SID_VOLUME) ← (byte~) nmi::$1 -- _deref_pbuc1=vbuaa
sta SID_VOLUME
// [30] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2() -- _deref_pptc1=pprc2
// [29] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2() -- _deref_pptc1=pprc2
lda #<nmi2
sta KERNEL_NMI
lda #>nmi2
sta KERNEL_NMI+1
// [31] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL) -- _deref_pbuc1=_dec__deref_pbuc1
// [30] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL) -- _deref_pbuc1=_dec__deref_pbuc1
dec BORDERCOL
jmp __breturn
// nmi::@return
__breturn:
// [32] return - exit interrupt(HARDWARE_ALL)
// [31] return - exit interrupt(HARDWARE_ALL)
rega:
lda #00
regx:
@@ -711,12 +672,9 @@ Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Replacing label __b1_from_nmi2 with __b1
Removing instruction __bbegin:
Removing instruction __b2_from___b1:
Removing instruction __bend_from___b2:
Removing instruction __b1_from_nmi2:
Removing instruction __b1_from___b2:
Removing instruction __breturn:
Removing instruction __breturn:
Succesful ASM optimization Pass5RedundantLabelElimination
@@ -753,13 +711,9 @@ interrupt(HARDWARE_ALL)(void()) nmi2()
(label) nmi2::@1
(label) nmi2::@2
(label) nmi2::@return
(byte*) sample
(byte*) sample#0 sample zp[2]:2 1.3333333333333333
(byte*) sample#1 sample zp[2]:2 2.0
(byte*) sample#2 sample zp[2]:2 4.0
(byte*) sample#3 sample zp[2]:2 40.0
(byte*) sample loadstore zp[2]:2 2.8
zp[2]:2 [ sample#0 sample#3 sample#1 sample#2 ]
zp[2]:2 [ sample ]
reg byte a [ nmi2::$1 ]
reg byte a [ nmi2::$2 ]
reg byte a [ nmi::$1 ]
@@ -796,7 +750,7 @@ Score: 483
// @1
__b1:
// sample = SAMPLE
// [1] (byte*) sample#0 ← (const byte*) SAMPLE -- pbuz1=pbuc1
// [1] (byte*) sample ← (const byte*) SAMPLE -- pbuz1=pbuc1
lda #<SAMPLE
sta.z sample
lda #>SAMPLE
@@ -870,7 +824,7 @@ nmi2: {
// asm { ldaCIA2_INTERRUPT }
lda CIA2_INTERRUPT
// *sample >> 4
// [16] (byte~) nmi2::$1 ← *((byte*) sample#0) >> (byte) 4 -- vbuaa=_deref_pbuz1_ror_4
// [16] (byte~) nmi2::$1 ← *((byte*) sample) >> (byte) 4 -- vbuaa=_deref_pbuz1_ror_4
ldy #0
lda (sample),y
lsr
@@ -881,13 +835,13 @@ nmi2: {
// [17] *((const byte*) SID_VOLUME) ← (byte~) nmi2::$1 -- _deref_pbuc1=vbuaa
sta SID_VOLUME
// sample++;
// [18] (byte*) sample#1 ← ++ (byte*) sample#0 -- pbuz1=_inc_pbuz1
// [18] (byte*) sample ← ++ (byte*) sample -- pbuz1=_inc_pbuz1
inc.z sample
bne !+
inc.z sample+1
!:
// >sample
// [19] (byte~) nmi2::$2 ← > (byte*) sample#1 -- vbuaa=_hi_pbuz1
// [19] (byte~) nmi2::$2 ← > (byte*) sample -- vbuaa=_hi_pbuz1
lda.z sample+1
// if (>sample == >(SAMPLE+$6100))
// [20] if((byte~) nmi2::$2!=>(const byte*) SAMPLE+(word) $6100) goto nmi2::@1 -- vbuaa_neq_vbuc1_then_la1
@@ -895,27 +849,25 @@ nmi2: {
bne __b1
// nmi2::@2
// sample = SAMPLE
// [21] (byte*) sample#2 ← (const byte*) SAMPLE -- pbuz1=pbuc1
// [21] (byte*) sample ← (const byte*) SAMPLE -- pbuz1=pbuc1
lda #<SAMPLE
sta.z sample
lda #>SAMPLE
sta.z sample+1
// [22] phi from nmi2 nmi2::@2 to nmi2::@1 [phi:nmi2/nmi2::@2->nmi2::@1]
// [22] phi (byte*) sample#3 = (byte*) sample#1 [phi:nmi2/nmi2::@2->nmi2::@1#0] -- register_copy
// nmi2::@1
__b1:
// *KERNEL_NMI = &nmi
// [23] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi() -- _deref_pptc1=pprc2
// [22] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi() -- _deref_pptc1=pprc2
lda #<nmi
sta KERNEL_NMI
lda #>nmi
sta KERNEL_NMI+1
// (*BORDERCOL)--;
// [24] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL) -- _deref_pbuc1=_dec__deref_pbuc1
// [23] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL) -- _deref_pbuc1=_dec__deref_pbuc1
dec BORDERCOL
// nmi2::@return
// }
// [25] return - exit interrupt(HARDWARE_ALL)
// [24] return - exit interrupt(HARDWARE_ALL)
rega:
lda #00
regx:
@@ -931,31 +883,31 @@ nmi: {
stx regx+1
sty regy+1
// (*BORDERCOL)++;
// [26] *((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL) -- _deref_pbuc1=_inc__deref_pbuc1
// [25] *((const byte*) BORDERCOL) ← ++ *((const byte*) BORDERCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BORDERCOL
// asm
// asm { ldaCIA2_INTERRUPT }
lda CIA2_INTERRUPT
// *sample & $0f
// [28] (byte~) nmi::$1 ← *((byte*) sample#0) & (byte) $f -- vbuaa=_deref_pbuz1_band_vbuc1
// [27] (byte~) nmi::$1 ← *((byte*) sample) & (byte) $f -- vbuaa=_deref_pbuz1_band_vbuc1
lda #$f
ldy #0
and (sample),y
// *SID_VOLUME = *sample & $0f
// [29] *((const byte*) SID_VOLUME) ← (byte~) nmi::$1 -- _deref_pbuc1=vbuaa
// [28] *((const byte*) SID_VOLUME) ← (byte~) nmi::$1 -- _deref_pbuc1=vbuaa
sta SID_VOLUME
// *KERNEL_NMI = &nmi2
// [30] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2() -- _deref_pptc1=pprc2
// [29] *((const void()**) KERNEL_NMI) ← &interrupt(HARDWARE_ALL)(void()) nmi2() -- _deref_pptc1=pprc2
lda #<nmi2
sta KERNEL_NMI
lda #>nmi2
sta KERNEL_NMI+1
// (*BORDERCOL)--;
// [31] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL) -- _deref_pbuc1=_dec__deref_pbuc1
// [30] *((const byte*) BORDERCOL) ← -- *((const byte*) BORDERCOL) -- _deref_pbuc1=_dec__deref_pbuc1
dec BORDERCOL
// nmi::@return
// }
// [32] return - exit interrupt(HARDWARE_ALL)
// [31] return - exit interrupt(HARDWARE_ALL)
rega:
lda #00
regx:
@@ -22,13 +22,9 @@ interrupt(HARDWARE_ALL)(void()) nmi2()
(label) nmi2::@1
(label) nmi2::@2
(label) nmi2::@return
(byte*) sample
(byte*) sample#0 sample zp[2]:2 1.3333333333333333
(byte*) sample#1 sample zp[2]:2 2.0
(byte*) sample#2 sample zp[2]:2 4.0
(byte*) sample#3 sample zp[2]:2 40.0
(byte*) sample loadstore zp[2]:2 2.8
zp[2]:2 [ sample#0 sample#3 sample#1 sample#2 ]
zp[2]:2 [ sample ]
reg byte a [ nmi2::$1 ]
reg byte a [ nmi2::$2 ]
reg byte a [ nmi::$1 ]
@@ -2,7 +2,7 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) idx#16 ← (byte) 0
[1] (byte) idx ← (byte) 0
to:@2
@2: scope:[] from @1
[2] phi()
@@ -52,10 +52,9 @@ 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) 0 print::@1/(byte) print::i#1 )
[21] *((const byte*) SCREEN + (byte) idx#11) ← *((byte*) print::msg#3 + (byte) print::i#2)
[22] (byte) idx#12 ← ++ (byte) idx#11
[21] *((const byte*) SCREEN + (byte) idx) ← *((byte*) print::msg#3 + (byte) print::i#2)
[22] (byte) idx ← ++ (byte) idx
[23] (byte) print::i#1 ← ++ (byte) print::i#2
[24] if((byte) 0!=*((byte*) print::msg#3 + (byte) print::i#1)) goto print::@1
to:print::@return
+47 -105
View File
@@ -28,33 +28,23 @@ do10::@return: scope:[do10] from do10::@1
(void()) hello()
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
(void()) world()
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
@@ -73,32 +63,27 @@ main::@return: scope:[main] from main::@2
return
to:@return
@4: scope:[] from @begin
(byte) idx#4 ← (number) 0
(byte) idx ← (number) 0
to:@5
(void()) print((byte*) print::msg)
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 ← (number) 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 )
*((const byte*) SCREEN + (byte) idx#11) ← *((byte*) print::msg#2 + (byte) print::i#2)
(byte) idx#5 ← ++ (byte) idx#11
*((const byte*) SCREEN + (byte) idx) ← *((byte*) print::msg#2 + (byte) print::i#2)
(byte) idx ← ++ (byte) idx
(byte) print::i#1 ← ++ (byte) print::i#2
(bool~) print::$0 ← (number) 0 != *((byte*) print::msg#2 + (byte) print::i#1)
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
@@ -129,24 +114,7 @@ SYMBOL TABLE SSA
(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
(byte) idx loadstore
(void()) main()
(label) main::@1
(label) main::@2
@@ -169,11 +137,11 @@ SYMBOL TABLE SSA
(label) world::@return
(const string) world::msg[] = (string) "world "
Adding number conversion cast (unumber) 0 in (byte) idx#4 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) idx ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) print::i#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (bool~) print::$0 ← (number) 0 != *((byte*) print::msg#2 + (byte) print::i#1)
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) idx#4 ← (unumber)(number) 0
Inlining cast (byte) idx ← (unumber)(number) 0
Inlining cast (byte) print::i#0 ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
@@ -185,22 +153,11 @@ Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
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
Identical Phi Values (void()*) do10::fn#2 (void()*) do10::fn#3
Identical Phi Values (byte) idx#13 (byte) idx#16
Identical Phi Values (byte) idx#0 (byte) idx#12
Identical Phi Values (byte) idx#14 (byte) idx#16
Identical Phi Values (byte) idx#10 (byte) idx#12
Identical Phi Values (byte*) print::msg#2 (byte*) print::msg#3
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values (byte) idx#15 (byte) idx#16
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) do10::$1 [6] if((byte) do10::i#1!=rangelast(0,9)) goto do10::@1
Simple Condition (bool~) print::$0 [37] if((byte) 0!=*((byte*) print::msg#3 + (byte) print::i#1)) goto print::@1
Simple Condition (bool~) print::$0 [27] if((byte) 0!=*((byte*) print::msg#3 + (byte) print::i#1)) goto print::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte) do10::i#0 = 0
Constant (const byte*) print::msg#0 = hello::msg
@@ -247,14 +204,12 @@ CALL GRAPH
Calls in [] to main:3
Calls in [main] to do10:7 do10:9
Calls in [world] to print:20
Calls in [hello] to print:34
Calls in [hello] to print:32
Created 5 initial phi equivalence classes
Created 4 initial phi equivalence classes
Coalesced [18] do10::i#3 ← do10::i#1
Coalesced [24] idx#17 ← idx#16
Coalesced [31] print::i#3 ← print::i#1
Coalesced [32] idx#18 ← idx#12
Coalesced down to 5 phi equivalence classes
Coalesced [30] print::i#3 ← print::i#1
Coalesced down to 4 phi equivalence classes
Culled Empty Block (label) @6
Culled Empty Block (label) main::@2
Culled Empty Block (label) do10::@3
@@ -276,7 +231,7 @@ FINAL CONTROL FLOW GRAPH
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) idx#16 ← (byte) 0
[1] (byte) idx ← (byte) 0
to:@2
@2: scope:[] from @1
[2] phi()
@@ -326,10 +281,9 @@ 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) 0 print::@1/(byte) print::i#1 )
[21] *((const byte*) SCREEN + (byte) idx#11) ← *((byte*) print::msg#3 + (byte) print::i#2)
[22] (byte) idx#12 ← ++ (byte) idx#11
[21] *((const byte*) SCREEN + (byte) idx) ← *((byte*) print::msg#3 + (byte) print::i#2)
[22] (byte) idx ← ++ (byte) idx
[23] (byte) print::i#1 ← ++ (byte) print::i#2
[24] if((byte) 0!=*((byte*) print::msg#3 + (byte) print::i#1)) goto print::@1
to:print::@return
@@ -355,10 +309,7 @@ VARIABLE REGISTER WEIGHTS
(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
(byte) idx loadstore 5.0
(void()) main()
(void()) print((byte*) print::msg)
(byte) print::i
@@ -373,18 +324,18 @@ Initial phi equivalence classes
[ do10::i#2 do10::i#1 ]
[ print::msg#3 ]
[ print::i#2 print::i#1 ]
[ idx#11 idx#16 idx#12 ]
Added variable idx to live range equivalence class [ idx ]
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 ]
[ idx ]
Allocated zp[2]:2 [ do10::fn#3 ]
Allocated zp[1]:4 [ do10::i#2 do10::i#1 ]
Allocated zp[2]:5 [ print::msg#3 ]
Allocated zp[1]:7 [ print::i#2 print::i#1 ]
Allocated zp[1]:8 [ idx#11 idx#16 idx#12 ]
Allocated zp[1]:8 [ idx ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -402,7 +353,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte) idx#16 ← (byte) 0 -- vbuz1=vbuc1
// [1] (byte) idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z idx
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -509,24 +460,22 @@ print: {
.label msg = 5
// [20] phi from print to print::@1 [phi:print->print::@1]
__b1_from_print:
// [20] phi (byte) idx#11 = (byte) idx#16 [phi:print->print::@1#0] -- register_copy
// [20] phi (byte) print::i#2 = (byte) 0 [phi:print->print::@1#1] -- vbuz1=vbuc1
// [20] phi (byte) print::i#2 = (byte) 0 [phi:print->print::@1#0] -- vbuz1=vbuc1
lda #0
sta.z i
jmp __b1
// [20] phi from print::@1 to print::@1 [phi:print::@1->print::@1]
__b1_from___b1:
// [20] phi (byte) idx#11 = (byte) idx#12 [phi:print::@1->print::@1#0] -- register_copy
// [20] phi (byte) print::i#2 = (byte) print::i#1 [phi:print::@1->print::@1#1] -- register_copy
// [20] phi (byte) print::i#2 = (byte) print::i#1 [phi:print::@1->print::@1#0] -- register_copy
jmp __b1
// print::@1
__b1:
// [21] *((const byte*) SCREEN + (byte) idx#11) ← *((byte*) print::msg#3 + (byte) print::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuz3
// [21] *((const byte*) SCREEN + (byte) idx) ← *((byte*) print::msg#3 + (byte) print::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuz3
ldx.z idx
ldy.z i
lda (msg),y
sta SCREEN,x
// [22] (byte) idx#12 ← ++ (byte) idx#11 -- vbuz1=_inc_vbuz1
// [22] (byte) idx ← ++ (byte) idx -- vbuz1=_inc_vbuz1
inc.z idx
// [23] (byte) print::i#1 ← ++ (byte) print::i#2 -- vbuz1=_inc_vbuz1
inc.z i
@@ -563,46 +512,46 @@ hello: {
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] (byte) idx#16 ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [1] (byte) idx ← (byte) 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[1]:4 [ do10::i#2 do10::i#1 ]
Removing always clobbered register reg byte x as potential for zp[1]:4 [ do10::i#2 do10::i#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:4 [ do10::i#2 do10::i#1 ]
Statement [14] if((byte) do10::i#1!=(byte) $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 + (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 [21] *((const byte*) SCREEN + (byte) idx) ← *((byte*) print::msg#3 + (byte) print::i#2) [ print::msg#3 print::i#2 ] ( print:17 [ print::msg#3 print::i#2 ] print:27 [ print::msg#3 print::i#2 ] ) always clobbers reg byte a reg byte x
Removing always clobbered register reg byte a as potential for zp[1]:7 [ print::i#2 print::i#1 ]
Removing always clobbered register reg byte x as potential for zp[1]:7 [ print::i#2 print::i#1 ]
Statement [24] if((byte) 0!=*((byte*) print::msg#3 + (byte) print::i#1)) 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) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [24] if((byte) 0!=*((byte*) print::msg#3 + (byte) print::i#1)) goto print::@1 [ idx print::msg#3 print::i#1 ] ( print:17 [ idx print::msg#3 print::i#1 ] print:27 [ idx print::msg#3 print::i#1 ] ) always clobbers reg byte a
Statement [1] (byte) idx ← (byte) 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) $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 + (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) 0!=*((byte*) print::msg#3 + (byte) print::i#1)) 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 [21] *((const byte*) SCREEN + (byte) idx) ← *((byte*) print::msg#3 + (byte) print::i#2) [ print::msg#3 print::i#2 ] ( print:17 [ print::msg#3 print::i#2 ] print:27 [ print::msg#3 print::i#2 ] ) always clobbers reg byte a reg byte x
Statement [24] if((byte) 0!=*((byte*) print::msg#3 + (byte) print::i#1)) goto print::@1 [ idx print::msg#3 print::i#1 ] ( print:17 [ idx print::msg#3 print::i#1 ] print:27 [ idx print::msg#3 print::i#1 ] ) always clobbers reg byte a
Potential registers zp[2]:2 [ do10::fn#3 ] : zp[2]:2 ,
Potential registers zp[1]:4 [ do10::i#2 do10::i#1 ] : zp[1]:4 ,
Potential registers zp[2]:5 [ print::msg#3 ] : zp[2]:5 ,
Potential registers zp[1]:7 [ print::i#2 print::i#1 ] : zp[1]:7 , reg byte y ,
Potential registers zp[1]:8 [ idx#11 idx#16 idx#12 ] : zp[1]:8 ,
Potential registers zp[1]:8 [ idx ] : zp[1]:8 ,
REGISTER UPLIFT SCOPES
Uplift Scope [print] 27.5: zp[1]:7 [ print::i#2 print::i#1 ] 3.67: zp[2]:5 [ print::msg#3 ]
Uplift Scope [do10] 27.5: zp[1]:4 [ do10::i#2 do10::i#1 ] 0: zp[2]:2 [ do10::fn#3 ]
Uplift Scope [] 26.17: zp[1]:8 [ idx#11 idx#16 idx#12 ]
Uplift Scope [] 5: zp[1]:8 [ idx ]
Uplift Scope [hello]
Uplift Scope [world]
Uplift Scope [main]
Uplifting [print] best 898 combination reg byte y [ print::i#2 print::i#1 ] zp[2]:5 [ print::msg#3 ]
Uplifting [do10] best 898 combination zp[1]:4 [ do10::i#2 do10::i#1 ] zp[2]:2 [ do10::fn#3 ]
Uplifting [] best 898 combination zp[1]:8 [ idx#11 idx#16 idx#12 ]
Uplifting [] best 898 combination zp[1]:8 [ idx ]
Uplifting [hello] best 898 combination
Uplifting [world] best 898 combination
Uplifting [main] best 898 combination
Attempting to uplift remaining variables inzp[1]:4 [ do10::i#2 do10::i#1 ]
Uplifting [do10] best 898 combination zp[1]:4 [ do10::i#2 do10::i#1 ]
Attempting to uplift remaining variables inzp[1]:8 [ idx#11 idx#16 idx#12 ]
Uplifting [] best 898 combination zp[1]:8 [ idx#11 idx#16 idx#12 ]
Allocated (was zp[1]:8) zp[1]:7 [ idx#11 idx#16 idx#12 ]
Attempting to uplift remaining variables inzp[1]:8 [ idx ]
Uplifting [] best 898 combination zp[1]:8 [ idx ]
Allocated (was zp[1]:8) zp[1]:7 [ idx ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -619,7 +568,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte) idx#16 ← (byte) 0 -- vbuz1=vbuc1
// [1] (byte) idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z idx
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -725,22 +674,20 @@ print: {
.label msg = 5
// [20] phi from print to print::@1 [phi:print->print::@1]
__b1_from_print:
// [20] phi (byte) idx#11 = (byte) idx#16 [phi:print->print::@1#0] -- register_copy
// [20] phi (byte) print::i#2 = (byte) 0 [phi:print->print::@1#1] -- vbuyy=vbuc1
// [20] phi (byte) print::i#2 = (byte) 0 [phi:print->print::@1#0] -- vbuyy=vbuc1
ldy #0
jmp __b1
// [20] phi from print::@1 to print::@1 [phi:print::@1->print::@1]
__b1_from___b1:
// [20] phi (byte) idx#11 = (byte) idx#12 [phi:print::@1->print::@1#0] -- register_copy
// [20] phi (byte) print::i#2 = (byte) print::i#1 [phi:print::@1->print::@1#1] -- register_copy
// [20] phi (byte) print::i#2 = (byte) print::i#1 [phi:print::@1->print::@1#0] -- register_copy
jmp __b1
// print::@1
__b1:
// [21] *((const byte*) SCREEN + (byte) idx#11) ← *((byte*) print::msg#3 + (byte) print::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuyy
// [21] *((const byte*) SCREEN + (byte) idx) ← *((byte*) print::msg#3 + (byte) print::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuyy
lda (msg),y
ldx.z idx
sta SCREEN,x
// [22] (byte) idx#12 ← ++ (byte) idx#11 -- vbuz1=_inc_vbuz1
// [22] (byte) idx ← ++ (byte) idx -- vbuz1=_inc_vbuz1
inc.z idx
// [23] (byte) print::i#1 ← ++ (byte) print::i#2 -- vbuyy=_inc_vbuyy
iny
@@ -837,10 +784,7 @@ FINAL SYMBOL TABLE
(void()) hello()
(label) hello::@return
(const string) hello::msg[] = (string) "hello "
(byte) idx
(byte) idx#11 idx zp[1]:7 17.5
(byte) idx#12 idx zp[1]:7 7.333333333333333
(byte) idx#16 idx zp[1]:7 1.3333333333333333
(byte) idx loadstore zp[1]:7 5.0
(void()) main()
(label) main::@1
(label) main::@return
@@ -860,7 +804,7 @@ zp[2]:2 [ do10::fn#3 ]
zp[1]:4 [ do10::i#2 do10::i#1 ]
zp[2]:5 [ print::msg#3 ]
reg byte y [ print::i#2 print::i#1 ]
zp[1]:7 [ idx#11 idx#16 idx#12 ]
zp[1]:7 [ idx ]
FINAL ASSEMBLER
@@ -879,7 +823,7 @@ Score: 676
// @1
__b1:
// idx = 0
// [1] (byte) idx#16 ← (byte) 0 -- vbuz1=vbuc1
// [1] (byte) idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z idx
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -970,21 +914,19 @@ world: {
print: {
.label msg = 5
// [20] phi from print to print::@1 [phi:print->print::@1]
// [20] phi (byte) idx#11 = (byte) idx#16 [phi:print->print::@1#0] -- register_copy
// [20] phi (byte) print::i#2 = (byte) 0 [phi:print->print::@1#1] -- vbuyy=vbuc1
// [20] phi (byte) print::i#2 = (byte) 0 [phi:print->print::@1#0] -- vbuyy=vbuc1
ldy #0
// [20] phi from print::@1 to print::@1 [phi:print::@1->print::@1]
// [20] phi (byte) idx#11 = (byte) idx#12 [phi:print::@1->print::@1#0] -- register_copy
// [20] phi (byte) print::i#2 = (byte) print::i#1 [phi:print::@1->print::@1#1] -- register_copy
// [20] phi (byte) print::i#2 = (byte) print::i#1 [phi:print::@1->print::@1#0] -- register_copy
// print::@1
__b1:
// SCREEN[idx++] = msg[i++]
// [21] *((const byte*) SCREEN + (byte) idx#11) ← *((byte*) print::msg#3 + (byte) print::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuyy
// [21] *((const byte*) SCREEN + (byte) idx) ← *((byte*) print::msg#3 + (byte) print::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuyy
lda (msg),y
ldx.z idx
sta SCREEN,x
// SCREEN[idx++] = msg[i++];
// [22] (byte) idx#12 ← ++ (byte) idx#11 -- vbuz1=_inc_vbuz1
// [22] (byte) idx ← ++ (byte) idx -- vbuz1=_inc_vbuz1
inc.z idx
// [23] (byte) print::i#1 ← ++ (byte) print::i#2 -- vbuyy=_inc_vbuyy
iny
@@ -14,10 +14,7 @@
(void()) hello()
(label) hello::@return
(const string) hello::msg[] = (string) "hello "
(byte) idx
(byte) idx#11 idx zp[1]:7 17.5
(byte) idx#12 idx zp[1]:7 7.333333333333333
(byte) idx#16 idx zp[1]:7 1.3333333333333333
(byte) idx loadstore zp[1]:7 5.0
(void()) main()
(label) main::@1
(label) main::@return
@@ -37,4 +34,4 @@ zp[2]:2 [ do10::fn#3 ]
zp[1]:4 [ do10::i#2 do10::i#1 ]
zp[2]:5 [ print::msg#3 ]
reg byte y [ print::i#2 print::i#1 ]
zp[1]:7 [ idx#11 idx#16 idx#12 ]
zp[1]:7 [ idx ]
@@ -2,7 +2,7 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) idx#0 ← (byte) 0
[1] (byte) idx ← (byte) 0
to:@2
@2: scope:[] from @1
[2] phi()
@@ -36,13 +36,12 @@ do10::@return: scope:[do10] from do10::@1
(void()) hello()
hello: scope:[hello] from do10::@1
[14] (byte) idx#7 ← (byte) idx#0
[14] phi()
to:hello::@1
hello::@1: scope:[hello] from hello hello::@1
[15] (byte) idx#3 ← phi( hello/(byte) idx#7 hello::@1/(byte) idx#1 )
[15] (byte) hello::i#2 ← phi( hello/(byte) 0 hello::@1/(byte) hello::i#1 )
[16] *((const byte*) SCREEN + (byte) idx#3) ← *((const byte*) msg + (byte) hello::i#2)
[17] (byte) idx#1 ← ++ (byte) idx#3
[16] *((const byte*) SCREEN + (byte) idx) ← *((const byte*) msg + (byte) hello::i#2)
[17] (byte) idx ← ++ (byte) idx
[18] (byte) hello::i#1 ← ++ (byte) hello::i#2
[19] if((byte) 0!=*((const byte*) msg + (byte) hello::i#1)) goto hello::@1
to:hello::@return
+59 -88
View File
@@ -25,26 +25,22 @@ do10::@return: scope:[do10] from do10::@1
return
to:@return
@1: scope:[] from @begin
(byte) idx#0 ← (number) 0
(byte) idx ← (number) 0
to:@3
(void()) hello()
hello: scope:[hello] from
(byte) idx#5 ← phi( @3/(byte) idx#6 )
(byte) hello::i#0 ← (number) 0
to:hello::@1
hello::@1: scope:[hello] from hello hello::@1
(byte) idx#3 ← phi( hello/(byte) idx#5 hello::@1/(byte) idx#1 )
(byte) hello::i#2 ← phi( hello/(byte) hello::i#0 hello::@1/(byte) hello::i#1 )
*((const byte*) SCREEN + (byte) idx#3) ← *((const byte*) msg + (byte) hello::i#2)
(byte) idx#1 ← ++ (byte) idx#3
*((const byte*) SCREEN + (byte) idx) ← *((const byte*) msg + (byte) hello::i#2)
(byte) idx ← ++ (byte) idx
(byte) hello::i#1 ← ++ (byte) hello::i#2
(bool~) hello::$0 ← (number) 0 != *((const byte*) msg + (byte) hello::i#1)
if((bool~) hello::$0) goto hello::@1
to:hello::@return
hello::@return: scope:[hello] from hello::@1
(byte) idx#4 ← phi( hello::@1/(byte) idx#1 )
(byte) idx#2 ← (byte) idx#4
return
to:@return
@@ -59,7 +55,6 @@ main::@return: scope:[main] from main::@1
return
to:@return
@3: scope:[] from @1
(byte) idx#6 ← phi( @1/(byte) idx#0 )
call main
to:@4
@4: scope:[] from @3
@@ -93,25 +88,18 @@ SYMBOL TABLE SSA
(byte) hello::i#0
(byte) hello::i#1
(byte) hello::i#2
(byte) idx
(byte) idx#0
(byte) idx#1
(byte) idx#2
(byte) idx#3
(byte) idx#4
(byte) idx#5
(byte) idx#6
(byte) idx loadstore
(void()) main()
(label) main::@1
(label) main::@return
(const void()*) main::f = &(void()) hello()
(const byte*) msg[] = (string) "hello "
Adding number conversion cast (unumber) 0 in (byte) idx#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) idx ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) hello::i#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (bool~) hello::$0 ← (number) 0 != *((const byte*) msg + (byte) hello::i#1)
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) idx#0 ← (unumber)(number) 0
Inlining cast (byte) idx ← (unumber)(number) 0
Inlining cast (byte) hello::i#0 ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
@@ -123,15 +111,11 @@ Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) idx#1 = (byte) idx#4 (byte) idx#2
Alias (byte) idx#0 = (byte) idx#6
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (void()*) do10::fn#2 (void()*) do10::fn#0
Identical Phi Values (void()*) do10::fn#1 (void()*) do10::fn#2
Identical Phi Values (byte) idx#5 (byte) idx#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) do10::$1 [6] if((byte) do10::i#1!=rangelast(0,9)) goto do10::@1
Simple Condition (bool~) hello::$0 [16] if((byte) 0!=*((const byte*) msg + (byte) hello::i#1)) goto hello::@1
Simple Condition (bool~) hello::$0 [15] if((byte) 0!=*((const byte*) msg + (byte) hello::i#1)) goto hello::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte) do10::i#0 = 0
Constant (const byte) hello::i#0 = 0
@@ -165,17 +149,16 @@ 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 do10
Adding NOP phi() at start of hello
CALL GRAPH
Calls in [] to main:3
Calls in [main] to do10:7
Calls in [do10] to hello:12
Created 3 initial phi equivalence classes
Created 2 initial phi equivalence classes
Coalesced [16] do10::i#3 ← do10::i#1
Not coalescing [17] idx#7 ← idx#0
Coalesced [24] hello::i#3 ← hello::i#1
Coalesced [25] idx#8 ← idx#1
Coalesced down to 4 phi equivalence classes
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) main::@1
Culled Empty Block (label) do10::@3
@@ -186,13 +169,14 @@ 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
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) idx#0 ← (byte) 0
[1] (byte) idx ← (byte) 0
to:@2
@2: scope:[] from @1
[2] phi()
@@ -226,13 +210,12 @@ do10::@return: scope:[do10] from do10::@1
(void()) hello()
hello: scope:[hello] from do10::@1
[14] (byte) idx#7 ← (byte) idx#0
[14] phi()
to:hello::@1
hello::@1: scope:[hello] from hello hello::@1
[15] (byte) idx#3 ← phi( hello/(byte) idx#7 hello::@1/(byte) idx#1 )
[15] (byte) hello::i#2 ← phi( hello/(byte) 0 hello::@1/(byte) hello::i#1 )
[16] *((const byte*) SCREEN + (byte) idx#3) ← *((const byte*) msg + (byte) hello::i#2)
[17] (byte) idx#1 ← ++ (byte) idx#3
[16] *((const byte*) SCREEN + (byte) idx) ← *((const byte*) msg + (byte) hello::i#2)
[17] (byte) idx ← ++ (byte) idx
[18] (byte) hello::i#1 ← ++ (byte) hello::i#2
[19] if((byte) 0!=*((const byte*) msg + (byte) hello::i#1)) goto hello::@1
to:hello::@return
@@ -251,25 +234,20 @@ VARIABLE REGISTER WEIGHTS
(byte) hello::i
(byte) hello::i#1 151.5
(byte) hello::i#2 101.0
(byte) idx
(byte) idx#0 0.26666666666666666
(byte) idx#1 67.33333333333333
(byte) idx#3 152.5
(byte) idx#7 4.0
(byte) idx loadstore 21.78571428571429
(void()) main()
Initial phi equivalence classes
[ do10::i#2 do10::i#1 ]
[ hello::i#2 hello::i#1 ]
[ idx#3 idx#7 idx#1 ]
Coalescing volatile variable equivalence classes [ idx#0 ] and [ idx#3 idx#7 idx#1 ]
Added variable idx to live range equivalence class [ idx ]
Complete equivalence classes
[ do10::i#2 do10::i#1 ]
[ hello::i#2 hello::i#1 ]
[ idx#0 idx#3 idx#7 idx#1 ]
[ idx ]
Allocated zp[1]:2 [ do10::i#2 do10::i#1 ]
Allocated zp[1]:3 [ hello::i#2 hello::i#1 ]
Allocated zp[1]:4 [ idx#0 idx#3 idx#7 idx#1 ]
Allocated zp[1]:4 [ idx ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -287,7 +265,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte) idx#0 ← (byte) 0 -- vbuz1=vbuc1
// [1] (byte) idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z idx
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -332,6 +310,8 @@ do10: {
// do10::@1
__b1:
// [10] call hello
// [14] phi from do10::@1 to hello [phi:do10::@1->hello]
hello_from___b1:
jsr hello
// [11] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1
inc.z i
@@ -348,27 +328,24 @@ do10: {
// hello
hello: {
.label i = 3
// [14] (byte) idx#7 ← (byte) idx#0
// [15] phi from hello to hello::@1 [phi:hello->hello::@1]
__b1_from_hello:
// [15] phi (byte) idx#3 = (byte) idx#7 [phi:hello->hello::@1#0] -- register_copy
// [15] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#1] -- vbuz1=vbuc1
// [15] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#0] -- vbuz1=vbuc1
lda #0
sta.z i
jmp __b1
// [15] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
__b1_from___b1:
// [15] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy
// [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy
// [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#0] -- register_copy
jmp __b1
// hello::@1
__b1:
// [16] *((const byte*) SCREEN + (byte) idx#3) ← *((const byte*) msg + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2
// [16] *((const byte*) SCREEN + (byte) idx) ← *((const byte*) msg + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz2
ldy.z i
lda msg,y
ldy.z idx
sta SCREEN,y
// [17] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
// [17] (byte) idx ← ++ (byte) idx -- vbuz1=_inc_vbuz1
inc.z idx
// [18] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuz1=_inc_vbuz1
inc.z i
@@ -388,35 +365,35 @@ hello: {
.byte 0
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] (byte) idx#0 ← (byte) 0 [ idx#0 ] ( [ idx#0 ] ) always clobbers reg byte a
Statement [16] *((const byte*) SCREEN + (byte) idx#3) ← *((const byte*) msg + (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 [1] (byte) idx ← (byte) 0 [ idx ] ( [ idx ] ) always clobbers reg byte a
Statement [16] *((const byte*) SCREEN + (byte) idx) ← *((const byte*) msg + (byte) hello::i#2) [ hello::i#2 ] ( main:3::do10:6::hello:10 [ do10::i#2 hello::i#2 ] ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte a as potential for zp[1]:2 [ do10::i#2 do10::i#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:2 [ do10::i#2 do10::i#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:3 [ hello::i#2 hello::i#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:3 [ hello::i#2 hello::i#1 ]
Statement [19] if((byte) 0!=*((const byte*) msg + (byte) hello::i#1)) 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) 0 [ idx#0 ] ( [ idx#0 ] ) always clobbers reg byte a
Statement [16] *((const byte*) SCREEN + (byte) idx#3) ← *((const byte*) msg + (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((byte) 0!=*((const byte*) msg + (byte) hello::i#1)) 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 [19] if((byte) 0!=*((const byte*) msg + (byte) hello::i#1)) goto hello::@1 [ idx hello::i#1 ] ( main:3::do10:6::hello:10 [ do10::i#2 idx hello::i#1 ] ) always clobbers reg byte a
Statement [1] (byte) idx ← (byte) 0 [ idx ] ( [ idx ] ) always clobbers reg byte a
Statement [16] *((const byte*) SCREEN + (byte) idx) ← *((const byte*) msg + (byte) hello::i#2) [ hello::i#2 ] ( main:3::do10:6::hello:10 [ do10::i#2 hello::i#2 ] ) always clobbers reg byte a reg byte y
Statement [19] if((byte) 0!=*((const byte*) msg + (byte) hello::i#1)) goto hello::@1 [ idx hello::i#1 ] ( main:3::do10:6::hello:10 [ do10::i#2 idx hello::i#1 ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ do10::i#2 do10::i#1 ] : zp[1]:2 , reg byte x ,
Potential registers zp[1]:3 [ hello::i#2 hello::i#1 ] : zp[1]:3 , reg byte x ,
Potential registers zp[1]:4 [ idx#0 idx#3 idx#7 idx#1 ] : zp[1]:4 ,
Potential registers zp[1]:4 [ idx ] : zp[1]:4 ,
REGISTER UPLIFT SCOPES
Uplift Scope [hello] 252.5: zp[1]:3 [ hello::i#2 hello::i#1 ]
Uplift Scope [] 224.1: zp[1]:4 [ idx#0 idx#3 idx#7 idx#1 ]
Uplift Scope [do10] 27.5: zp[1]:2 [ do10::i#2 do10::i#1 ]
Uplift Scope [] 21.79: zp[1]:4 [ idx ]
Uplift Scope [main]
Uplifting [hello] best 4349 combination reg byte x [ hello::i#2 hello::i#1 ]
Uplifting [] best 4349 combination zp[1]:4 [ idx#0 idx#3 idx#7 idx#1 ]
Uplifting [do10] best 4349 combination zp[1]:2 [ do10::i#2 do10::i#1 ]
Uplifting [main] best 4349 combination
Attempting to uplift remaining variables inzp[1]:4 [ idx#0 idx#3 idx#7 idx#1 ]
Uplifting [] best 4349 combination zp[1]:4 [ idx#0 idx#3 idx#7 idx#1 ]
Uplifting [hello] best 4295 combination reg byte x [ hello::i#2 hello::i#1 ]
Uplifting [do10] best 4295 combination zp[1]:2 [ do10::i#2 do10::i#1 ]
Uplifting [] best 4295 combination zp[1]:4 [ idx ]
Uplifting [main] best 4295 combination
Attempting to uplift remaining variables inzp[1]:2 [ do10::i#2 do10::i#1 ]
Uplifting [do10] best 4349 combination zp[1]:2 [ do10::i#2 do10::i#1 ]
Allocated (was zp[1]:4) zp[1]:3 [ idx#0 idx#3 idx#7 idx#1 ]
Uplifting [do10] best 4295 combination zp[1]:2 [ do10::i#2 do10::i#1 ]
Attempting to uplift remaining variables inzp[1]:4 [ idx ]
Uplifting [] best 4295 combination zp[1]:4 [ idx ]
Allocated (was zp[1]:4) zp[1]:3 [ idx ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -433,7 +410,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte) idx#0 ← (byte) 0 -- vbuz1=vbuc1
// [1] (byte) idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z idx
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -478,6 +455,8 @@ do10: {
// do10::@1
__b1:
// [10] call hello
// [14] phi from do10::@1 to hello [phi:do10::@1->hello]
hello_from___b1:
jsr hello
// [11] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1
inc.z i
@@ -493,25 +472,22 @@ do10: {
}
// hello
hello: {
// [14] (byte) idx#7 ← (byte) idx#0
// [15] phi from hello to hello::@1 [phi:hello->hello::@1]
__b1_from_hello:
// [15] phi (byte) idx#3 = (byte) idx#7 [phi:hello->hello::@1#0] -- register_copy
// [15] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#1] -- vbuxx=vbuc1
// [15] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#0] -- vbuxx=vbuc1
ldx #0
jmp __b1
// [15] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
__b1_from___b1:
// [15] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy
// [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy
// [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#0] -- register_copy
jmp __b1
// hello::@1
__b1:
// [16] *((const byte*) SCREEN + (byte) idx#3) ← *((const byte*) msg + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx
// [16] *((const byte*) SCREEN + (byte) idx) ← *((const byte*) msg + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx
lda msg,x
ldy.z idx
sta SCREEN,y
// [17] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
// [17] (byte) idx ← ++ (byte) idx -- vbuz1=_inc_vbuz1
inc.z idx
// [18] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuxx=_inc_vbuxx
inx
@@ -547,6 +523,7 @@ Removing instruction __b2_from___b1:
Removing instruction main_from___b2:
Removing instruction __bend_from___b2:
Removing instruction __b1_from___b1:
Removing instruction hello_from___b1:
Removing instruction __b1_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b2:
@@ -583,22 +560,18 @@ FINAL SYMBOL TABLE
(byte) hello::i
(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[1]:3 0.26666666666666666
(byte) idx#1 idx zp[1]:3 67.33333333333333
(byte) idx#3 idx zp[1]:3 152.5
(byte) idx#7 idx zp[1]:3 4.0
(byte) idx loadstore zp[1]:3 21.78571428571429
(void()) main()
(label) main::@return
(const byte*) msg[] = (string) "hello "
zp[1]:2 [ do10::i#2 do10::i#1 ]
reg byte x [ hello::i#2 hello::i#1 ]
zp[1]:3 [ idx#0 idx#3 idx#7 idx#1 ]
zp[1]:3 [ idx ]
FINAL ASSEMBLER
Score: 3326
Score: 3272
// File Comments
// Tests calling into a function pointer with local variables
@@ -613,7 +586,7 @@ Score: 3326
// @1
__b1:
// idx = 0
// [1] (byte) idx#0 ← (byte) 0 -- vbuz1=vbuc1
// [1] (byte) idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z idx
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -648,6 +621,7 @@ do10: {
__b1:
// (*fn)()
// [10] call hello
// [14] phi from do10::@1 to hello [phi:do10::@1->hello]
jsr hello
// for( byte i: 0..9)
// [11] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1
@@ -663,23 +637,20 @@ do10: {
}
// hello
hello: {
// [14] (byte) idx#7 ← (byte) idx#0
// [15] phi from hello to hello::@1 [phi:hello->hello::@1]
// [15] phi (byte) idx#3 = (byte) idx#7 [phi:hello->hello::@1#0] -- register_copy
// [15] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#1] -- vbuxx=vbuc1
// [15] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#0] -- vbuxx=vbuc1
ldx #0
// [15] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
// [15] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy
// [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy
// [15] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#0] -- register_copy
// hello::@1
__b1:
// SCREEN[idx++] = msg[i++]
// [16] *((const byte*) SCREEN + (byte) idx#3) ← *((const byte*) msg + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx
// [16] *((const byte*) SCREEN + (byte) idx) ← *((const byte*) msg + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx
lda msg,x
ldy.z idx
sta SCREEN,y
// SCREEN[idx++] = msg[i++];
// [17] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
// [17] (byte) idx ← ++ (byte) idx -- vbuz1=_inc_vbuz1
inc.z idx
// [18] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuxx=_inc_vbuxx
inx
@@ -16,15 +16,11 @@
(byte) hello::i
(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[1]:3 0.26666666666666666
(byte) idx#1 idx zp[1]:3 67.33333333333333
(byte) idx#3 idx zp[1]:3 152.5
(byte) idx#7 idx zp[1]:3 4.0
(byte) idx loadstore zp[1]:3 21.78571428571429
(void()) main()
(label) main::@return
(const byte*) msg[] = (string) "hello "
zp[1]:2 [ do10::i#2 do10::i#1 ]
reg byte x [ hello::i#2 hello::i#1 ]
zp[1]:3 [ idx#0 idx#3 idx#7 idx#1 ]
zp[1]:3 [ idx ]
@@ -2,8 +2,8 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte*) msg#0 ← (byte*) 0
[2] (byte) idx#0 ← (byte) 0
[1] (byte*) msg ← (byte*) 0
[2] (byte) idx ← (byte) 0
to:@2
@2: scope:[] from @1
[3] phi()
@@ -14,11 +14,11 @@
(void()) main()
main: scope:[main] from @2
[6] (byte*) msg#1 ← (const byte*) msg1
[6] (byte*) msg ← (const byte*) msg1
[7] call do10
to:main::@1
main::@1: scope:[main] from main
[8] (byte*) msg#2 ← (const byte*) msg2
[8] (byte*) msg ← (const byte*) msg2
[9] call do10
to:main::@return
main::@return: scope:[main] from main::@1
@@ -41,15 +41,14 @@ do10::@return: scope:[do10] from do10::@1
(void()) hello()
hello: scope:[hello] from do10::@1
[17] (byte) idx#7 ← (byte) idx#0
[17] phi()
to:hello::@1
hello::@1: scope:[hello] from hello hello::@1
[18] (byte) idx#3 ← phi( hello/(byte) idx#7 hello::@1/(byte) idx#1 )
[18] (byte) hello::i#2 ← phi( hello/(byte) 0 hello::@1/(byte) hello::i#1 )
[19] *((const byte*) SCREEN + (byte) idx#3) ← *((byte*) msg#0 + (byte) hello::i#2)
[20] (byte) idx#1 ← ++ (byte) idx#3
[19] *((const byte*) SCREEN + (byte) idx) ← *((byte*) msg + (byte) hello::i#2)
[20] (byte) idx ← ++ (byte) idx
[21] (byte) hello::i#1 ← ++ (byte) hello::i#2
[22] if((byte) 0!=*((byte*) msg#0 + (byte) hello::i#1)) goto hello::@1
[22] if((byte) 0!=*((byte*) msg + (byte) hello::i#1)) goto hello::@1
to:hello::@return
hello::@return: scope:[hello] from hello::@1
[23] return
+95 -156
View File
@@ -25,59 +25,46 @@ do10::@return: scope:[do10] from do10::@1
return
to:@return
@1: scope:[] from @begin
(byte*) msg#0 ← (byte*) 0
(byte) idx#0 ← (number) 0
(byte*) msg ← (byte*) 0
(byte) idx ← (number) 0
to:@3
(void()) hello()
hello: scope:[hello] from
(byte) idx#5 ← phi( @3/(byte) idx#6 )
(byte*) msg#8 ← phi( @3/(byte*) msg#10 )
(byte) hello::i#0 ← (number) 0
to:hello::@1
hello::@1: scope:[hello] from hello hello::@1
(byte) idx#3 ← phi( hello/(byte) idx#5 hello::@1/(byte) idx#1 )
(byte) hello::i#2 ← phi( hello/(byte) hello::i#0 hello::@1/(byte) hello::i#1 )
(byte*) msg#5 ← phi( hello/(byte*) msg#8 hello::@1/(byte*) msg#5 )
*((const byte*) SCREEN + (byte) idx#3) ← *((byte*) msg#5 + (byte) hello::i#2)
(byte) idx#1 ← ++ (byte) idx#3
*((const byte*) SCREEN + (byte) idx) ← *((byte*) msg + (byte) hello::i#2)
(byte) idx ← ++ (byte) idx
(byte) hello::i#1 ← ++ (byte) hello::i#2
(bool~) hello::$0 ← (number) 0 != *((byte*) msg#5 + (byte) hello::i#1)
(bool~) hello::$0 ← (number) 0 != *((byte*) msg + (byte) hello::i#1)
if((bool~) hello::$0) goto hello::@1
to:hello::@return
hello::@return: scope:[hello] from hello::@1
(byte) idx#4 ← phi( hello::@1/(byte) idx#1 )
(byte) idx#2 ← (byte) idx#4
return
to:@return
(void()) main()
main: scope:[main] from @3
(byte*) msg#1 ← (const byte*) msg1
(byte*) msg ← (const byte*) msg1
(void()*) do10::fn#0 ← (const void()*) main::f
call do10
to:main::@1
main::@1: scope:[main] from main
(byte*) msg#2 ← (const byte*) msg2
(byte*) msg ← (const byte*) msg2
(void()*) do10::fn#1 ← (const void()*) main::f
call do10
to:main::@2
main::@2: scope:[main] from main::@1
(byte*) msg#9 ← phi( main::@1/(byte*) msg#2 )
to:main::@return
main::@return: scope:[main] from main::@2
(byte*) msg#6 ← phi( main::@2/(byte*) msg#9 )
(byte*) msg#3 ← (byte*) msg#6
return
to:@return
@3: scope:[] from @1
(byte) idx#6 ← phi( @1/(byte) idx#0 )
(byte*) msg#10 ← phi( @1/(byte*) msg#0 )
call main
to:@4
@4: scope:[] from @3
(byte*) msg#7 ← phi( @3/(byte*) msg#3 )
(byte*) msg#4 ← (byte*) msg#7
to:@end
@end: scope:[] from @4
@@ -109,39 +96,21 @@ SYMBOL TABLE SSA
(byte) hello::i#0
(byte) hello::i#1
(byte) hello::i#2
(byte) idx
(byte) idx#0
(byte) idx#1
(byte) idx#2
(byte) idx#3
(byte) idx#4
(byte) idx#5
(byte) idx#6
(byte) idx loadstore
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@return
(const void()*) main::f = &(void()) hello()
(byte*) msg
(byte*) msg#0
(byte*) msg#1
(byte*) msg#10
(byte*) msg#2
(byte*) msg#3
(byte*) msg#4
(byte*) msg#5
(byte*) msg#6
(byte*) msg#7
(byte*) msg#8
(byte*) msg#9
(byte*) msg loadstore
(const byte*) msg1[] = (string) "hello "
(const byte*) msg2[] = (string) "world "
Adding number conversion cast (unumber) 0 in (byte) idx#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) idx ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) hello::i#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (bool~) hello::$0 ← (number) 0 != *((byte*) msg#5 + (byte) hello::i#1)
Adding number conversion cast (unumber) 0 in (bool~) hello::$0 ← (number) 0 != *((byte*) msg + (byte) hello::i#1)
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) idx#0 ← (unumber)(number) 0
Inlining cast (byte) idx ← (unumber)(number) 0
Inlining cast (byte) hello::i#0 ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
@@ -153,20 +122,10 @@ Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) idx#1 = (byte) idx#4 (byte) idx#2
Alias (byte*) msg#2 = (byte*) msg#9 (byte*) msg#6 (byte*) msg#3
Alias (byte*) msg#0 = (byte*) msg#10
Alias (byte) idx#0 = (byte) idx#6
Alias (byte*) msg#4 = (byte*) msg#7
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (void()*) do10::fn#2 (void()*) do10::fn#3
Identical Phi Values (byte*) msg#8 (byte*) msg#0
Identical Phi Values (byte) idx#5 (byte) idx#0
Identical Phi Values (byte*) msg#5 (byte*) msg#8
Identical Phi Values (byte*) msg#4 (byte*) msg#2
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) do10::$1 [6] if((byte) do10::i#1!=rangelast(0,9)) goto do10::@1
Simple Condition (bool~) hello::$0 [17] if((byte) 0!=*((byte*) msg#0 + (byte) hello::i#1)) goto hello::@1
Simple Condition (bool~) hello::$0 [16] if((byte) 0!=*((byte*) msg + (byte) hello::i#1)) goto hello::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte) do10::i#0 = 0
Constant (const byte) hello::i#0 = 0
@@ -204,17 +163,16 @@ Adding NOP phi() at start of @4
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@2
Adding NOP phi() at start of do10
Adding NOP phi() at start of hello
CALL GRAPH
Calls in [] to main:4
Calls in [main] to do10:8 do10:10
Calls in [do10] to hello:15
Created 3 initial phi equivalence classes
Created 2 initial phi equivalence classes
Coalesced [19] do10::i#3 ← do10::i#1
Not coalescing [20] idx#7 ← idx#0
Coalesced [27] hello::i#3 ← hello::i#1
Coalesced [28] idx#8 ← idx#1
Coalesced down to 4 phi equivalence classes
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) main::@2
Culled Empty Block (label) do10::@3
@@ -224,14 +182,15 @@ 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 do10
Adding NOP phi() at start of hello
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte*) msg#0 ← (byte*) 0
[2] (byte) idx#0 ← (byte) 0
[1] (byte*) msg ← (byte*) 0
[2] (byte) idx ← (byte) 0
to:@2
@2: scope:[] from @1
[3] phi()
@@ -242,11 +201,11 @@ FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from @2
[6] (byte*) msg#1 ← (const byte*) msg1
[6] (byte*) msg ← (const byte*) msg1
[7] call do10
to:main::@1
main::@1: scope:[main] from main
[8] (byte*) msg#2 ← (const byte*) msg2
[8] (byte*) msg ← (const byte*) msg2
[9] call do10
to:main::@return
main::@return: scope:[main] from main::@1
@@ -269,15 +228,14 @@ do10::@return: scope:[do10] from do10::@1
(void()) hello()
hello: scope:[hello] from do10::@1
[17] (byte) idx#7 ← (byte) idx#0
[17] phi()
to:hello::@1
hello::@1: scope:[hello] from hello hello::@1
[18] (byte) idx#3 ← phi( hello/(byte) idx#7 hello::@1/(byte) idx#1 )
[18] (byte) hello::i#2 ← phi( hello/(byte) 0 hello::@1/(byte) hello::i#1 )
[19] *((const byte*) SCREEN + (byte) idx#3) ← *((byte*) msg#0 + (byte) hello::i#2)
[20] (byte) idx#1 ← ++ (byte) idx#3
[19] *((const byte*) SCREEN + (byte) idx) ← *((byte*) msg + (byte) hello::i#2)
[20] (byte) idx ← ++ (byte) idx
[21] (byte) hello::i#1 ← ++ (byte) hello::i#2
[22] if((byte) 0!=*((byte*) msg#0 + (byte) hello::i#1)) goto hello::@1
[22] if((byte) 0!=*((byte*) msg + (byte) hello::i#1)) goto hello::@1
to:hello::@return
hello::@return: scope:[hello] from hello::@1
[23] return
@@ -294,33 +252,24 @@ VARIABLE REGISTER WEIGHTS
(byte) hello::i
(byte) hello::i#1 151.5
(byte) hello::i#2 101.0
(byte) idx
(byte) idx#0 0.2222222222222222
(byte) idx#1 67.33333333333333
(byte) idx#3 152.5
(byte) idx#7 4.0
(byte) idx loadstore 17.941176470588236
(void()) main()
(byte*) msg
(byte*) msg#0 10.736842105263158
(byte*) msg#1 20.0
(byte*) msg#2 20.0
(byte*) msg loadstore 14.857142857142858
Initial phi equivalence classes
[ do10::i#2 do10::i#1 ]
[ hello::i#2 hello::i#1 ]
[ idx#3 idx#7 idx#1 ]
Coalescing volatile variable equivalence classes [ msg#0 ] and [ msg#1 ]
Coalescing volatile variable equivalence classes [ msg#0 msg#1 ] and [ msg#2 ]
Coalescing volatile variable equivalence classes [ idx#0 ] and [ idx#3 idx#7 idx#1 ]
Added variable msg to live range equivalence class [ msg ]
Added variable idx to live range equivalence class [ idx ]
Complete equivalence classes
[ do10::i#2 do10::i#1 ]
[ hello::i#2 hello::i#1 ]
[ msg#0 msg#1 msg#2 ]
[ idx#0 idx#3 idx#7 idx#1 ]
[ msg ]
[ idx ]
Allocated zp[1]:2 [ do10::i#2 do10::i#1 ]
Allocated zp[1]:3 [ hello::i#2 hello::i#1 ]
Allocated zp[2]:4 [ msg#0 msg#1 msg#2 ]
Allocated zp[1]:6 [ idx#0 idx#3 idx#7 idx#1 ]
Allocated zp[2]:4 [ msg ]
Allocated zp[1]:6 [ idx ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -339,12 +288,12 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte*) msg#0 ← (byte*) 0 -- pbuz1=pbuc1
// [1] (byte*) msg ← (byte*) 0 -- pbuz1=pbuc1
lda #<0
sta.z msg
lda #>0
sta.z msg+1
// [2] (byte) idx#0 ← (byte) 0 -- vbuz1=vbuc1
// [2] (byte) idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z idx
// [3] phi from @1 to @2 [phi:@1->@2]
@@ -361,7 +310,7 @@ __bend_from___b2:
__bend:
// main
main: {
// [6] (byte*) msg#1 ← (const byte*) msg1 -- pbuz1=pbuc1
// [6] (byte*) msg ← (const byte*) msg1 -- pbuz1=pbuc1
lda #<msg1
sta.z msg
lda #>msg1
@@ -373,7 +322,7 @@ main: {
jmp __b1
// main::@1
__b1:
// [8] (byte*) msg#2 ← (const byte*) msg2 -- pbuz1=pbuc1
// [8] (byte*) msg ← (const byte*) msg2 -- pbuz1=pbuc1
lda #<msg2
sta.z msg
lda #>msg2
@@ -404,6 +353,8 @@ do10: {
// do10::@1
__b1:
// [13] call hello
// [17] phi from do10::@1 to hello [phi:do10::@1->hello]
hello_from___b1:
jsr hello
// [14] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1
inc.z i
@@ -420,31 +371,28 @@ do10: {
// hello
hello: {
.label i = 3
// [17] (byte) idx#7 ← (byte) idx#0
// [18] phi from hello to hello::@1 [phi:hello->hello::@1]
__b1_from_hello:
// [18] phi (byte) idx#3 = (byte) idx#7 [phi:hello->hello::@1#0] -- register_copy
// [18] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#1] -- vbuz1=vbuc1
// [18] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#0] -- vbuz1=vbuc1
lda #0
sta.z i
jmp __b1
// [18] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
__b1_from___b1:
// [18] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy
// [18] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy
// [18] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#0] -- register_copy
jmp __b1
// hello::@1
__b1:
// [19] *((const byte*) SCREEN + (byte) idx#3) ← *((byte*) msg#0 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuz3
// [19] *((const byte*) SCREEN + (byte) idx) ← *((byte*) msg + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuz3
ldx.z idx
ldy.z i
lda (msg),y
sta SCREEN,x
// [20] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
// [20] (byte) idx ← ++ (byte) idx -- vbuz1=_inc_vbuz1
inc.z idx
// [21] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuz1=_inc_vbuz1
inc.z i
// [22] if((byte) 0!=*((byte*) msg#0 + (byte) hello::i#1)) goto hello::@1 -- vbuc1_neq_pbuz1_derefidx_vbuz2_then_la1
// [22] if((byte) 0!=*((byte*) msg + (byte) hello::i#1)) goto hello::@1 -- vbuc1_neq_pbuz1_derefidx_vbuz2_then_la1
ldy.z i
lda (msg),y
cmp #0
@@ -462,43 +410,43 @@ hello: {
.byte 0
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] (byte*) msg#0 ← (byte*) 0 [ msg#0 ] ( [ msg#0 ] ) always clobbers reg byte a
Statement [2] (byte) idx#0 ← (byte) 0 [ msg#0 idx#0 ] ( [ msg#0 idx#0 ] ) always clobbers reg byte a
Statement [6] (byte*) msg#1 ← (const byte*) msg1 [ msg#0 idx#0 ] ( main:4 [ msg#0 idx#0 ] ) always clobbers reg byte a
Statement [8] (byte*) msg#2 ← (const byte*) msg2 [ msg#0 idx#0 ] ( main:4 [ msg#0 idx#0 ] ) always clobbers reg byte a
Statement [19] *((const byte*) SCREEN + (byte) idx#3) ← *((byte*) msg#0 + (byte) hello::i#2) [ msg#0 idx#0 hello::i#2 idx#3 ] ( main:4::do10:7::hello:13 [ do10::i#2 msg#0 idx#0 hello::i#2 idx#3 ] main:4::do10:9::hello:13 [ do10::i#2 msg#0 idx#0 hello::i#2 idx#3 ] ) always clobbers reg byte a reg byte x
Statement [1] (byte*) msg ← (byte*) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [2] (byte) idx ← (byte) 0 [ idx ] ( [ idx ] ) always clobbers reg byte a
Statement [6] (byte*) msg ← (const byte*) msg1 [ msg idx ] ( main:4 [ msg idx ] ) always clobbers reg byte a
Statement [8] (byte*) msg ← (const byte*) msg2 [ msg idx ] ( main:4 [ msg idx ] ) always clobbers reg byte a
Statement [19] *((const byte*) SCREEN + (byte) idx) ← *((byte*) msg + (byte) hello::i#2) [ msg hello::i#2 ] ( main:4::do10:7::hello:13 [ do10::i#2 msg hello::i#2 ] main:4::do10:9::hello:13 [ do10::i#2 msg hello::i#2 ] ) always clobbers reg byte a reg byte x
Removing always clobbered register reg byte a as potential for zp[1]:2 [ do10::i#2 do10::i#1 ]
Removing always clobbered register reg byte x as potential for zp[1]:2 [ do10::i#2 do10::i#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:3 [ hello::i#2 hello::i#1 ]
Removing always clobbered register reg byte x as potential for zp[1]:3 [ hello::i#2 hello::i#1 ]
Statement [22] if((byte) 0!=*((byte*) msg#0 + (byte) hello::i#1)) goto hello::@1 [ msg#0 idx#0 hello::i#1 idx#1 ] ( main:4::do10:7::hello:13 [ do10::i#2 msg#0 idx#0 hello::i#1 idx#1 ] main:4::do10:9::hello:13 [ do10::i#2 msg#0 idx#0 hello::i#1 idx#1 ] ) always clobbers reg byte a
Statement [1] (byte*) msg#0 ← (byte*) 0 [ msg#0 ] ( [ msg#0 ] ) always clobbers reg byte a
Statement [2] (byte) idx#0 ← (byte) 0 [ msg#0 idx#0 ] ( [ msg#0 idx#0 ] ) always clobbers reg byte a
Statement [6] (byte*) msg#1 ← (const byte*) msg1 [ msg#0 idx#0 ] ( main:4 [ msg#0 idx#0 ] ) always clobbers reg byte a
Statement [8] (byte*) msg#2 ← (const byte*) msg2 [ msg#0 idx#0 ] ( main:4 [ msg#0 idx#0 ] ) always clobbers reg byte a
Statement [19] *((const byte*) SCREEN + (byte) idx#3) ← *((byte*) msg#0 + (byte) hello::i#2) [ msg#0 idx#0 hello::i#2 idx#3 ] ( main:4::do10:7::hello:13 [ do10::i#2 msg#0 idx#0 hello::i#2 idx#3 ] main:4::do10:9::hello:13 [ do10::i#2 msg#0 idx#0 hello::i#2 idx#3 ] ) always clobbers reg byte a reg byte x
Statement [22] if((byte) 0!=*((byte*) msg#0 + (byte) hello::i#1)) goto hello::@1 [ msg#0 idx#0 hello::i#1 idx#1 ] ( main:4::do10:7::hello:13 [ do10::i#2 msg#0 idx#0 hello::i#1 idx#1 ] main:4::do10:9::hello:13 [ do10::i#2 msg#0 idx#0 hello::i#1 idx#1 ] ) always clobbers reg byte a
Statement [22] if((byte) 0!=*((byte*) msg + (byte) hello::i#1)) goto hello::@1 [ msg idx hello::i#1 ] ( main:4::do10:7::hello:13 [ do10::i#2 msg idx hello::i#1 ] main:4::do10:9::hello:13 [ do10::i#2 msg idx hello::i#1 ] ) always clobbers reg byte a
Statement [1] (byte*) msg ← (byte*) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [2] (byte) idx ← (byte) 0 [ idx ] ( [ idx ] ) always clobbers reg byte a
Statement [6] (byte*) msg ← (const byte*) msg1 [ msg idx ] ( main:4 [ msg idx ] ) always clobbers reg byte a
Statement [8] (byte*) msg ← (const byte*) msg2 [ msg idx ] ( main:4 [ msg idx ] ) always clobbers reg byte a
Statement [19] *((const byte*) SCREEN + (byte) idx) ← *((byte*) msg + (byte) hello::i#2) [ msg hello::i#2 ] ( main:4::do10:7::hello:13 [ do10::i#2 msg hello::i#2 ] main:4::do10:9::hello:13 [ do10::i#2 msg hello::i#2 ] ) always clobbers reg byte a reg byte x
Statement [22] if((byte) 0!=*((byte*) msg + (byte) hello::i#1)) goto hello::@1 [ msg idx hello::i#1 ] ( main:4::do10:7::hello:13 [ do10::i#2 msg idx hello::i#1 ] main:4::do10:9::hello:13 [ do10::i#2 msg idx hello::i#1 ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ do10::i#2 do10::i#1 ] : zp[1]:2 , reg byte y ,
Potential registers zp[1]:3 [ hello::i#2 hello::i#1 ] : zp[1]:3 , reg byte y ,
Potential registers zp[2]:4 [ msg#0 msg#1 msg#2 ] : zp[2]:4 ,
Potential registers zp[1]:6 [ idx#0 idx#3 idx#7 idx#1 ] : zp[1]:6 ,
Potential registers zp[2]:4 [ msg ] : zp[2]:4 ,
Potential registers zp[1]:6 [ idx ] : zp[1]:6 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 224.06: zp[1]:6 [ idx#0 idx#3 idx#7 idx#1 ] 50.74: zp[2]:4 [ msg#0 msg#1 msg#2 ]
Uplift Scope [hello] 252.5: zp[1]:3 [ hello::i#2 hello::i#1 ]
Uplift Scope [] 17.94: zp[1]:6 [ idx ] 14.86: zp[2]:4 [ msg ]
Uplift Scope [do10] 27.5: zp[1]:2 [ do10::i#2 do10::i#1 ]
Uplift Scope [main]
Uplifting [] best 5788 combination zp[1]:6 [ idx#0 idx#3 idx#7 idx#1 ] zp[2]:4 [ msg#0 msg#1 msg#2 ]
Uplifting [hello] best 4588 combination reg byte y [ hello::i#2 hello::i#1 ]
Uplifting [do10] best 4588 combination zp[1]:2 [ do10::i#2 do10::i#1 ]
Uplifting [main] best 4588 combination
Attempting to uplift remaining variables inzp[1]:6 [ idx#0 idx#3 idx#7 idx#1 ]
Uplifting [] best 4588 combination zp[1]:6 [ idx#0 idx#3 idx#7 idx#1 ]
Uplifting [hello] best 4534 combination reg byte y [ hello::i#2 hello::i#1 ]
Uplifting [] best 4534 combination zp[1]:6 [ idx ] zp[2]:4 [ msg ]
Uplifting [do10] best 4534 combination zp[1]:2 [ do10::i#2 do10::i#1 ]
Uplifting [main] best 4534 combination
Attempting to uplift remaining variables inzp[1]:2 [ do10::i#2 do10::i#1 ]
Uplifting [do10] best 4588 combination zp[1]:2 [ do10::i#2 do10::i#1 ]
Allocated (was zp[2]:4) zp[2]:3 [ msg#0 msg#1 msg#2 ]
Allocated (was zp[1]:6) zp[1]:5 [ idx#0 idx#3 idx#7 idx#1 ]
Uplifting [do10] best 4534 combination zp[1]:2 [ do10::i#2 do10::i#1 ]
Attempting to uplift remaining variables inzp[1]:6 [ idx ]
Uplifting [] best 4534 combination zp[1]:6 [ idx ]
Allocated (was zp[2]:4) zp[2]:3 [ msg ]
Allocated (was zp[1]:6) zp[1]:5 [ idx ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -516,12 +464,12 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte*) msg#0 ← (byte*) 0 -- pbuz1=pbuc1
// [1] (byte*) msg ← (byte*) 0 -- pbuz1=pbuc1
lda #<0
sta.z msg
lda #>0
sta.z msg+1
// [2] (byte) idx#0 ← (byte) 0 -- vbuz1=vbuc1
// [2] (byte) idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z idx
// [3] phi from @1 to @2 [phi:@1->@2]
@@ -538,7 +486,7 @@ __bend_from___b2:
__bend:
// main
main: {
// [6] (byte*) msg#1 ← (const byte*) msg1 -- pbuz1=pbuc1
// [6] (byte*) msg ← (const byte*) msg1 -- pbuz1=pbuc1
lda #<msg1
sta.z msg
lda #>msg1
@@ -550,7 +498,7 @@ main: {
jmp __b1
// main::@1
__b1:
// [8] (byte*) msg#2 ← (const byte*) msg2 -- pbuz1=pbuc1
// [8] (byte*) msg ← (const byte*) msg2 -- pbuz1=pbuc1
lda #<msg2
sta.z msg
lda #>msg2
@@ -581,6 +529,8 @@ do10: {
// do10::@1
__b1:
// [13] call hello
// [17] phi from do10::@1 to hello [phi:do10::@1->hello]
hello_from___b1:
jsr hello
// [14] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1
inc.z i
@@ -596,29 +546,26 @@ do10: {
}
// hello
hello: {
// [17] (byte) idx#7 ← (byte) idx#0
// [18] phi from hello to hello::@1 [phi:hello->hello::@1]
__b1_from_hello:
// [18] phi (byte) idx#3 = (byte) idx#7 [phi:hello->hello::@1#0] -- register_copy
// [18] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#1] -- vbuyy=vbuc1
// [18] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#0] -- vbuyy=vbuc1
ldy #0
jmp __b1
// [18] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
__b1_from___b1:
// [18] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy
// [18] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy
// [18] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#0] -- register_copy
jmp __b1
// hello::@1
__b1:
// [19] *((const byte*) SCREEN + (byte) idx#3) ← *((byte*) msg#0 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuyy
// [19] *((const byte*) SCREEN + (byte) idx) ← *((byte*) msg + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuyy
lda (msg),y
ldx.z idx
sta SCREEN,x
// [20] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
// [20] (byte) idx ← ++ (byte) idx -- vbuz1=_inc_vbuz1
inc.z idx
// [21] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuyy=_inc_vbuyy
iny
// [22] if((byte) 0!=*((byte*) msg#0 + (byte) hello::i#1)) goto hello::@1 -- vbuc1_neq_pbuz1_derefidx_vbuyy_then_la1
// [22] if((byte) 0!=*((byte*) msg + (byte) hello::i#1)) goto hello::@1 -- vbuc1_neq_pbuz1_derefidx_vbuyy_then_la1
lda (msg),y
cmp #0
bne __b1_from___b1
@@ -655,6 +602,7 @@ Removing instruction __bbegin:
Removing instruction __b2_from___b1:
Removing instruction __bend_from___b2:
Removing instruction __b1_from___b1:
Removing instruction hello_from___b1:
Removing instruction __b1_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b2:
@@ -693,29 +641,22 @@ FINAL SYMBOL TABLE
(byte) hello::i
(byte) hello::i#1 reg byte y 151.5
(byte) hello::i#2 reg byte y 101.0
(byte) idx
(byte) idx#0 idx zp[1]:5 0.2222222222222222
(byte) idx#1 idx zp[1]:5 67.33333333333333
(byte) idx#3 idx zp[1]:5 152.5
(byte) idx#7 idx zp[1]:5 4.0
(byte) idx loadstore zp[1]:5 17.941176470588236
(void()) main()
(label) main::@1
(label) main::@return
(byte*) msg
(byte*) msg#0 msg zp[2]:3 10.736842105263158
(byte*) msg#1 msg zp[2]:3 20.0
(byte*) msg#2 msg zp[2]:3 20.0
(byte*) msg loadstore zp[2]:3 14.857142857142858
(const byte*) msg1[] = (string) "hello "
(const byte*) msg2[] = (string) "world "
zp[1]:2 [ do10::i#2 do10::i#1 ]
reg byte y [ hello::i#2 hello::i#1 ]
zp[2]:3 [ msg#0 msg#1 msg#2 ]
zp[1]:5 [ idx#0 idx#3 idx#7 idx#1 ]
zp[2]:3 [ msg ]
zp[1]:5 [ idx ]
FINAL ASSEMBLER
Score: 3558
Score: 3504
// File Comments
// Tests calling into a function pointer with local variables
@@ -731,12 +672,12 @@ Score: 3558
// @1
__b1:
// msg
// [1] (byte*) msg#0 ← (byte*) 0 -- pbuz1=pbuc1
// [1] (byte*) msg ← (byte*) 0 -- pbuz1=pbuc1
lda #<0
sta.z msg
sta.z msg+1
// idx = 0
// [2] (byte) idx#0 ← (byte) 0 -- vbuz1=vbuc1
// [2] (byte) idx ← (byte) 0 -- vbuz1=vbuc1
sta.z idx
// [3] phi from @1 to @2 [phi:@1->@2]
// @2
@@ -748,7 +689,7 @@ __b1:
// main
main: {
// msg = msg1
// [6] (byte*) msg#1 ← (const byte*) msg1 -- pbuz1=pbuc1
// [6] (byte*) msg ← (const byte*) msg1 -- pbuz1=pbuc1
lda #<msg1
sta.z msg
lda #>msg1
@@ -759,7 +700,7 @@ main: {
jsr do10
// main::@1
// msg = msg2
// [8] (byte*) msg#2 ← (const byte*) msg2 -- pbuz1=pbuc1
// [8] (byte*) msg ← (const byte*) msg2 -- pbuz1=pbuc1
lda #<msg2
sta.z msg
lda #>msg2
@@ -786,6 +727,7 @@ do10: {
__b1:
// (*fn)()
// [13] call hello
// [17] phi from do10::@1 to hello [phi:do10::@1->hello]
jsr hello
// for( byte i: 0..9)
// [14] (byte) do10::i#1 ← ++ (byte) do10::i#2 -- vbuz1=_inc_vbuz1
@@ -801,28 +743,25 @@ do10: {
}
// hello
hello: {
// [17] (byte) idx#7 ← (byte) idx#0
// [18] phi from hello to hello::@1 [phi:hello->hello::@1]
// [18] phi (byte) idx#3 = (byte) idx#7 [phi:hello->hello::@1#0] -- register_copy
// [18] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#1] -- vbuyy=vbuc1
// [18] phi (byte) hello::i#2 = (byte) 0 [phi:hello->hello::@1#0] -- vbuyy=vbuc1
ldy #0
// [18] phi from hello::@1 to hello::@1 [phi:hello::@1->hello::@1]
// [18] phi (byte) idx#3 = (byte) idx#1 [phi:hello::@1->hello::@1#0] -- register_copy
// [18] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#1] -- register_copy
// [18] phi (byte) hello::i#2 = (byte) hello::i#1 [phi:hello::@1->hello::@1#0] -- register_copy
// hello::@1
__b1:
// SCREEN[idx++] = msg[i++]
// [19] *((const byte*) SCREEN + (byte) idx#3) ← *((byte*) msg#0 + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuyy
// [19] *((const byte*) SCREEN + (byte) idx) ← *((byte*) msg + (byte) hello::i#2) -- pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuyy
lda (msg),y
ldx.z idx
sta SCREEN,x
// SCREEN[idx++] = msg[i++];
// [20] (byte) idx#1 ← ++ (byte) idx#3 -- vbuz1=_inc_vbuz1
// [20] (byte) idx ← ++ (byte) idx -- vbuz1=_inc_vbuz1
inc.z idx
// [21] (byte) hello::i#1 ← ++ (byte) hello::i#2 -- vbuyy=_inc_vbuyy
iny
// while(msg[i])
// [22] if((byte) 0!=*((byte*) msg#0 + (byte) hello::i#1)) goto hello::@1 -- vbuc1_neq_pbuz1_derefidx_vbuyy_then_la1
// [22] if((byte) 0!=*((byte*) msg + (byte) hello::i#1)) goto hello::@1 -- vbuc1_neq_pbuz1_derefidx_vbuyy_then_la1
lda (msg),y
cmp #0
bne __b1
+4 -11
View File
@@ -16,22 +16,15 @@
(byte) hello::i
(byte) hello::i#1 reg byte y 151.5
(byte) hello::i#2 reg byte y 101.0
(byte) idx
(byte) idx#0 idx zp[1]:5 0.2222222222222222
(byte) idx#1 idx zp[1]:5 67.33333333333333
(byte) idx#3 idx zp[1]:5 152.5
(byte) idx#7 idx zp[1]:5 4.0
(byte) idx loadstore zp[1]:5 17.941176470588236
(void()) main()
(label) main::@1
(label) main::@return
(byte*) msg
(byte*) msg#0 msg zp[2]:3 10.736842105263158
(byte*) msg#1 msg zp[2]:3 20.0
(byte*) msg#2 msg zp[2]:3 20.0
(byte*) msg loadstore zp[2]:3 14.857142857142858
(const byte*) msg1[] = (string) "hello "
(const byte*) msg2[] = (string) "world "
zp[1]:2 [ do10::i#2 do10::i#1 ]
reg byte y [ hello::i#2 hello::i#1 ]
zp[2]:3 [ msg#0 msg#1 msg#2 ]
zp[1]:5 [ idx#0 idx#3 idx#7 idx#1 ]
zp[2]:3 [ msg ]
zp[1]:5 [ idx ]
@@ -1,5 +1,5 @@
@begin: scope:[] from
[0] (byte) idx#0 ← (byte) 0
[0] (byte) idx ← (byte) 0
to:@1
@1: scope:[] from @begin
[1] phi()
@@ -12,9 +12,9 @@
main: scope:[main] from @1
[4] phi()
[5] call fn1
[6] *((const byte*) SCREEN + (byte) idx#0) ← (byte) 'a'
[6] *((const byte*) SCREEN + (byte) idx) ← (byte) 'a'
[7] call fn1
[8] *((const byte*) SCREEN + (byte) idx#0) ← (byte) 'a'
[8] *((const byte*) SCREEN + (byte) idx) ← (byte) 'a'
to:main::@return
main::@return: scope:[main] from main
[9] return
@@ -22,7 +22,7 @@ main::@return: scope:[main] from main
(void()) fn1()
fn1: scope:[fn1] from main
[10] (byte) idx#1 ← ++ (byte) idx#0
[10] (byte) idx ← ++ (byte) idx
to:fn1::@return
fn1::@return: scope:[fn1] from fn1
[11] return
+39 -61
View File
@@ -3,33 +3,28 @@ Culled Empty Block (label) @1
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte) idx#0 ← (number) 0
(byte) idx ← (number) 0
to:@2
(void()) fn1()
fn1: scope:[fn1] from
(byte) idx#3phi( @2/(byte) idx#6 )
(byte) idx#1 ← ++ (byte) idx#3
(byte) idx ← ++ (byte) idx
to:fn1::@return
fn1::@return: scope:[fn1] from fn1
(byte) idx#4 ← phi( fn1/(byte) idx#1 )
(byte) idx#2 ← (byte) idx#4
return
to:@return
(void()) main()
main: scope:[main] from @2
(byte) idx#5 ← phi( @2/(byte) idx#6 )
call *((const void()*) main::f)
*((const byte*) SCREEN + (byte) idx#5) ← (byte) 'a'
*((const byte*) SCREEN + (byte) idx) ← (byte) 'a'
call *((const void()*) main::f)
*((const byte*) SCREEN + (byte) idx#5) ← (byte) 'a'
*((const byte*) SCREEN + (byte) idx) ← (byte) 'a'
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@2: scope:[] from @begin
(byte) idx#6 ← phi( @begin/(byte) idx#0 )
call main
to:@3
@3: scope:[] from @2
@@ -44,35 +39,22 @@ SYMBOL TABLE SSA
(const byte*) SCREEN = (byte*)(number) $400
(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
(byte) idx loadstore
(void()) main()
(label) main::@return
(const void()*) main::f = &(void()) fn1()
Adding number conversion cast (unumber) 0 in (byte) idx#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) idx ← (number) 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) idx#0 ← (unumber)(number) 0
Inlining cast (byte) idx ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) idx#1 = (byte) idx#4 (byte) idx#2
Alias (byte) idx#0 = (byte) idx#6
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) idx#3 (byte) idx#0
Identical Phi Values (byte) idx#5 (byte) idx#0
Successful SSA optimization Pass2IdenticalPhiElimination
Replacing constant pointer function [7] call fn1
Replacing constant pointer function [9] call fn1
Replacing constant pointer function [3] call fn1
Replacing constant pointer function [5] call fn1
Successful SSA optimization Pass2ConstantCallPointerIdentification
Eliminating unused constant (const void()*) main::f
Successful SSA optimization PassNEliminateUnusedVars
@@ -94,7 +76,7 @@ Adding NOP phi() at start of main
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] (byte) idx#0 ← (byte) 0
[0] (byte) idx ← (byte) 0
to:@1
@1: scope:[] from @begin
[1] phi()
@@ -107,9 +89,9 @@ FINAL CONTROL FLOW GRAPH
main: scope:[main] from @1
[4] phi()
[5] call fn1
[6] *((const byte*) SCREEN + (byte) idx#0) ← (byte) 'a'
[6] *((const byte*) SCREEN + (byte) idx) ← (byte) 'a'
[7] call fn1
[8] *((const byte*) SCREEN + (byte) idx#0) ← (byte) 'a'
[8] *((const byte*) SCREEN + (byte) idx) ← (byte) 'a'
to:main::@return
main::@return: scope:[main] from main
[9] return
@@ -117,7 +99,7 @@ main::@return: scope:[main] from main
(void()) fn1()
fn1: scope:[fn1] from main
[10] (byte) idx#1 ← ++ (byte) idx#0
[10] (byte) idx ← ++ (byte) idx
to:fn1::@return
fn1::@return: scope:[fn1] from fn1
[11] return
@@ -126,16 +108,14 @@ fn1::@return: scope:[fn1] from fn1
VARIABLE REGISTER WEIGHTS
(void()) fn1()
(byte) idx
(byte) idx#0 1.0
(byte) idx#1 20.0
(byte) idx loadstore 2.5
(void()) main()
Initial phi equivalence classes
Coalescing volatile variable equivalence classes [ idx#0 ] and [ idx#1 ]
Added variable idx to live range equivalence class [ idx ]
Complete equivalence classes
[ idx#0 idx#1 ]
Allocated zp[1]:2 [ idx#0 idx#1 ]
[ idx ]
Allocated zp[1]:2 [ idx ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -150,7 +130,7 @@ Target platform is c64basic / MOS6502X
.label idx = 2
// @begin
__bbegin:
// [0] (byte) idx#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z idx
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -171,13 +151,13 @@ __bend:
main: {
// [5] call fn1
jsr fn1
// [6] *((const byte*) SCREEN + (byte) idx#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
// [6] *((const byte*) SCREEN + (byte) idx) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'a'
ldy.z idx
sta SCREEN,y
// [7] call fn1
jsr fn1
// [8] *((const byte*) SCREEN + (byte) idx#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
// [8] *((const byte*) SCREEN + (byte) idx) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'a'
ldy.z idx
sta SCREEN,y
@@ -189,7 +169,7 @@ main: {
}
// fn1
fn1: {
// [10] (byte) idx#1 ← ++ (byte) idx#0 -- vbuz1=_inc_vbuz1
// [10] (byte) idx ← ++ (byte) idx -- vbuz1=_inc_vbuz1
inc.z idx
jmp __breturn
// fn1::@return
@@ -200,21 +180,21 @@ fn1: {
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte) idx#0 ← (byte) 0 [ idx#0 ] ( [ idx#0 ] ) always clobbers reg byte a
Statement [6] *((const byte*) SCREEN + (byte) idx#0) ← (byte) 'a' [ idx#0 ] ( main:2 [ idx#0 ] ) always clobbers reg byte a reg byte y
Statement [8] *((const byte*) SCREEN + (byte) idx#0) ← (byte) 'a' [ ] ( main:2 [ ] ) always clobbers reg byte a reg byte y
Potential registers zp[1]:2 [ idx#0 idx#1 ] : zp[1]:2 ,
Statement [0] (byte) idx ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [6] *((const byte*) SCREEN + (byte) idx) ← (byte) 'a' [ ] ( main:2 [ ] ) always clobbers reg byte a reg byte y
Statement [8] *((const byte*) SCREEN + (byte) idx) ← (byte) 'a' [ ] ( main:2 [ ] ) always clobbers reg byte a reg byte y
Potential registers zp[1]:2 [ idx ] : zp[1]:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 21: zp[1]:2 [ idx#0 idx#1 ]
Uplift Scope [] 2.5: zp[1]:2 [ idx ]
Uplift Scope [fn1]
Uplift Scope [main]
Uplifting [] best 72 combination zp[1]:2 [ idx#0 idx#1 ]
Uplifting [] best 72 combination zp[1]:2 [ idx ]
Uplifting [fn1] best 72 combination
Uplifting [main] best 72 combination
Attempting to uplift remaining variables inzp[1]:2 [ idx#0 idx#1 ]
Uplifting [] best 72 combination zp[1]:2 [ idx#0 idx#1 ]
Attempting to uplift remaining variables inzp[1]:2 [ idx ]
Uplifting [] best 72 combination zp[1]:2 [ idx ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -228,7 +208,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label idx = 2
// @begin
__bbegin:
// [0] (byte) idx#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z idx
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -249,13 +229,13 @@ __bend:
main: {
// [5] call fn1
jsr fn1
// [6] *((const byte*) SCREEN + (byte) idx#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
// [6] *((const byte*) SCREEN + (byte) idx) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'a'
ldy.z idx
sta SCREEN,y
// [7] call fn1
jsr fn1
// [8] *((const byte*) SCREEN + (byte) idx#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
// [8] *((const byte*) SCREEN + (byte) idx) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'a'
ldy.z idx
sta SCREEN,y
@@ -267,7 +247,7 @@ main: {
}
// fn1
fn1: {
// [10] (byte) idx#1 ← ++ (byte) idx#0 -- vbuz1=_inc_vbuz1
// [10] (byte) idx ← ++ (byte) idx -- vbuz1=_inc_vbuz1
inc.z idx
jmp __breturn
// fn1::@return
@@ -302,13 +282,11 @@ FINAL SYMBOL TABLE
(const byte*) SCREEN = (byte*) 1024
(void()) fn1()
(label) fn1::@return
(byte) idx
(byte) idx#0 idx zp[1]:2 1.0
(byte) idx#1 idx zp[1]:2 20.0
(byte) idx loadstore zp[1]:2 2.5
(void()) main()
(label) main::@return
zp[1]:2 [ idx#0 idx#1 ]
zp[1]:2 [ idx ]
FINAL ASSEMBLER
@@ -326,7 +304,7 @@ Score: 66
// @begin
__bbegin:
// idx = 0
// [0] (byte) idx#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z idx
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -343,7 +321,7 @@ main: {
// [5] call fn1
jsr fn1
// SCREEN[idx] = 'a'
// [6] *((const byte*) SCREEN + (byte) idx#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
// [6] *((const byte*) SCREEN + (byte) idx) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'a'
ldy.z idx
sta SCREEN,y
@@ -351,7 +329,7 @@ main: {
// [7] call fn1
jsr fn1
// SCREEN[idx] = 'a'
// [8] *((const byte*) SCREEN + (byte) idx#0) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
// [8] *((const byte*) SCREEN + (byte) idx) ← (byte) 'a' -- pbuc1_derefidx_vbuz1=vbuc2
lda #'a'
ldy.z idx
sta SCREEN,y
@@ -363,7 +341,7 @@ main: {
// fn1
fn1: {
// idx++;
// [10] (byte) idx#1 ← ++ (byte) idx#0 -- vbuz1=_inc_vbuz1
// [10] (byte) idx ← ++ (byte) idx -- vbuz1=_inc_vbuz1
inc.z idx
// fn1::@return
// }
@@ -4,10 +4,8 @@
(const byte*) SCREEN = (byte*) 1024
(void()) fn1()
(label) fn1::@return
(byte) idx
(byte) idx#0 idx zp[1]:2 1.0
(byte) idx#1 idx zp[1]:2 20.0
(byte) idx loadstore zp[1]:2 2.5
(void()) main()
(label) main::@return
zp[1]:2 [ idx#0 idx#1 ]
zp[1]:2 [ idx ]
+5 -6
View File
@@ -1,5 +1,5 @@
@begin: scope:[] from
[0] (byte) x#0 ← (byte) $c
[0] (byte) x ← (byte) $c
to:@1
@1: scope:[] from @begin
[1] phi()
@@ -13,13 +13,12 @@ main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@1
[5] (byte) x#5phi( main/(byte) x#0 main::@1/(byte) x#1 )
[6] (byte) x#1 ← ++ (byte) x#5
[7] if((byte) x#1<(byte) $32) goto main::@1
[5] (byte) x ← ++ (byte) x
[6] if((byte) x<(byte) $32) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
[8] (byte) x#2 ← (byte) 0
[7] (byte) x ← (byte) 0
to:main::@return
main::@return: scope:[main] from main::@2
[9] return
[8] return
to:@return
+50 -100
View File
@@ -5,34 +5,27 @@ Culled Empty Block (label) main::@6
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte) x#0 ← (number) $c
(byte) x ← (number) $c
to:@1
(void()) main()
main: scope:[main] from @1
(byte) x#8 ← phi( @1/(byte) x#9 )
to:main::@1
main::@1: scope:[main] from main main::@1
(byte) x#5phi( main/(byte) x#8 main::@1/(byte) x#1 )
(byte) x#1 ← ++ (byte) x#5
(bool~) main::$0 ← (byte) x#1 < (number) $32
(byte) x ← ++ (byte) x
(bool~) main::$0 ← (byte) x < (number) $32
if((bool~) main::$0) goto main::@1
to:main::@3
main::@3: scope:[main] from main::@1
(byte) x#2 ← (number) 0
(byte) x ← (number) 0
to:main::@return
main::@return: scope:[main] from main::@3
(byte) x#6 ← phi( main::@3/(byte) x#2 )
(byte) x#3 ← (byte) x#6
return
to:@return
@1: scope:[] from @begin
(byte) x#9 ← phi( @begin/(byte) x#0 )
call main
to:@2
@2: scope:[] from @1
(byte) x#7 ← phi( @1/(byte) x#3 )
(byte) x#4 ← (byte) x#7
to:@end
@end: scope:[] from @2
@@ -46,24 +39,14 @@ SYMBOL TABLE SSA
(label) main::@1
(label) main::@3
(label) main::@return
(byte) x
(byte) x#0
(byte) x#1
(byte) x#2
(byte) x#3
(byte) x#4
(byte) x#5
(byte) x#6
(byte) x#7
(byte) x#8
(byte) x#9
(byte) x loadstore
Adding number conversion cast (unumber) $c in (byte) x#0 ← (number) $c
Adding number conversion cast (unumber) $32 in (bool~) main::$0 ← (byte) x#1 < (number) $32
Adding number conversion cast (unumber) 0 in (byte) x#2 ← (number) 0
Adding number conversion cast (unumber) $c in (byte) x ← (number) $c
Adding number conversion cast (unumber) $32 in (bool~) main::$0 ← (byte) x < (number) $32
Adding number conversion cast (unumber) 0 in (byte) x ← (number) 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) x#0 ← (unumber)(number) $c
Inlining cast (byte) x#2 ← (unumber)(number) 0
Inlining cast (byte) x ← (unumber)(number) $c
Inlining cast (byte) x ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant integer cast $c
Simplifying constant integer cast $32
@@ -73,28 +56,18 @@ Finalized unsigned number type (byte) $c
Finalized unsigned number type (byte) $32
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) x#2 = (byte) x#6 (byte) x#3
Alias (byte) x#0 = (byte) x#9
Alias (byte) x#4 = (byte) x#7
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) x#8 (byte) x#0
Identical Phi Values (byte) x#4 (byte) x#2
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$0 [5] if((byte) x#1<(byte) $32) goto main::@1
Simple Condition (bool~) main::$0 [3] if((byte) x<(byte) $32) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Added new block during phi lifting main::@7(between main::@1 and main::@1)
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to main:2
Created 1 initial phi equivalence classes
Coalesced [5] x#10 ← x#0
Coalesced [11] x#11 ← x#1
Coalesced down to 1 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@7
Renumbering block main::@3 to main::@2
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
@@ -102,7 +75,7 @@ Adding NOP phi() at start of main
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] (byte) x#0 ← (byte) $c
[0] (byte) x ← (byte) $c
to:@1
@1: scope:[] from @begin
[1] phi()
@@ -116,32 +89,26 @@ main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@1
[5] (byte) x#5phi( main/(byte) x#0 main::@1/(byte) x#1 )
[6] (byte) x#1 ← ++ (byte) x#5
[7] if((byte) x#1<(byte) $32) goto main::@1
[5] (byte) x ← ++ (byte) x
[6] if((byte) x<(byte) $32) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
[8] (byte) x#2 ← (byte) 0
[7] (byte) x ← (byte) 0
to:main::@return
main::@return: scope:[main] from main::@2
[9] return
[8] return
to:@return
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) x
(byte) x#0 1.3333333333333333
(byte) x#1 16.5
(byte) x#2 20.0
(byte) x#5 24.0
(byte) x loadstore 37.0
Initial phi equivalence classes
[ x#5 x#0 x#1 ]
Coalescing volatile variable equivalence classes [ x#5 x#0 x#1 ] and [ x#2 ]
Added variable x to live range equivalence class [ x ]
Complete equivalence classes
[ x#5 x#0 x#1 x#2 ]
Allocated zp[1]:2 [ x#5 x#0 x#1 x#2 ]
[ x ]
Allocated zp[1]:2 [ x ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -155,7 +122,7 @@ Target platform is c64basic / MOS6502X
.label x = 2
// @begin
__bbegin:
// [0] (byte) x#0 ← (byte) $c -- vbuz1=vbuc1
// [0] (byte) x ← (byte) $c -- vbuz1=vbuc1
lda #$c
sta.z x
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -174,47 +141,43 @@ __bend_from___b1:
__bend:
// main
main: {
// [5] phi from main main::@1 to main::@1 [phi:main/main::@1->main::@1]
__b1_from_main:
__b1_from___b1:
// [5] phi (byte) x#5 = (byte) x#0 [phi:main/main::@1->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [6] (byte) x#1 ← ++ (byte) x#5 -- vbuz1=_inc_vbuz1
// [5] (byte) x ← ++ (byte) x -- vbuz1=_inc_vbuz1
inc.z x
// [7] if((byte) x#1<(byte) $32) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
// [6] if((byte) x<(byte) $32) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z x
cmp #$32
bcc __b1_from___b1
bcc __b1
jmp __b2
// main::@2
__b2:
// [8] (byte) x#2 ← (byte) 0 -- vbuz1=vbuc1
// [7] (byte) x ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z x
jmp __breturn
// main::@return
__breturn:
// [9] return
// [8] return
rts
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte) x#0 ← (byte) $c [ x#0 ] ( [ x#0 ] ) always clobbers reg byte a
Statement [7] if((byte) x#1<(byte) $32) goto main::@1 [ x#1 ] ( main:2 [ x#1 ] ) always clobbers reg byte a
Statement [8] (byte) x#2 ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ x#5 x#0 x#1 x#2 ] : zp[1]:2 ,
Statement [0] (byte) x ← (byte) $c [ ] ( [ ] ) always clobbers reg byte a
Statement [6] if((byte) x<(byte) $32) goto main::@1 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [7] (byte) x ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ x ] : zp[1]:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 61.83: zp[1]:2 [ x#5 x#0 x#1 x#2 ]
Uplift Scope [] 37: zp[1]:2 [ x ]
Uplift Scope [main]
Uplifting [] best 216 combination zp[1]:2 [ x#5 x#0 x#1 x#2 ]
Uplifting [] best 216 combination zp[1]:2 [ x ]
Uplifting [main] best 216 combination
Attempting to uplift remaining variables inzp[1]:2 [ x#5 x#0 x#1 x#2 ]
Uplifting [] best 216 combination zp[1]:2 [ x#5 x#0 x#1 x#2 ]
Attempting to uplift remaining variables inzp[1]:2 [ x ]
Uplifting [] best 216 combination zp[1]:2 [ x ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -227,7 +190,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label x = 2
// @begin
__bbegin:
// [0] (byte) x#0 ← (byte) $c -- vbuz1=vbuc1
// [0] (byte) x ← (byte) $c -- vbuz1=vbuc1
lda #$c
sta.z x
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -246,29 +209,25 @@ __bend_from___b1:
__bend:
// main
main: {
// [5] phi from main main::@1 to main::@1 [phi:main/main::@1->main::@1]
__b1_from_main:
__b1_from___b1:
// [5] phi (byte) x#5 = (byte) x#0 [phi:main/main::@1->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [6] (byte) x#1 ← ++ (byte) x#5 -- vbuz1=_inc_vbuz1
// [5] (byte) x ← ++ (byte) x -- vbuz1=_inc_vbuz1
inc.z x
// [7] if((byte) x#1<(byte) $32) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
// [6] if((byte) x<(byte) $32) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z x
cmp #$32
bcc __b1_from___b1
bcc __b1
jmp __b2
// main::@2
__b2:
// [8] (byte) x#2 ← (byte) 0 -- vbuz1=vbuc1
// [7] (byte) x ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z x
jmp __breturn
// main::@return
__breturn:
// [9] return
// [8] return
rts
}
// File Data
@@ -280,12 +239,9 @@ Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b1_from___b1 with __b1
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Removing instruction __b1_from_main:
Removing instruction __b1_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1:
Removing instruction __bend:
@@ -303,13 +259,9 @@ FINAL SYMBOL TABLE
(label) main::@1
(label) main::@2
(label) main::@return
(byte) x
(byte) x#0 x zp[1]:2 1.3333333333333333
(byte) x#1 x zp[1]:2 16.5
(byte) x#2 x zp[1]:2 20.0
(byte) x#5 x zp[1]:2 24.0
(byte) x loadstore zp[1]:2 37.0
zp[1]:2 [ x#5 x#0 x#1 x#2 ]
zp[1]:2 [ x ]
FINAL ASSEMBLER
@@ -326,7 +278,7 @@ Score: 153
// @begin
__bbegin:
// x = 12
// [0] (byte) x#0 ← (byte) $c -- vbuz1=vbuc1
// [0] (byte) x ← (byte) $c -- vbuz1=vbuc1
lda #$c
sta.z x
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -339,25 +291,23 @@ __bbegin:
// @end
// main
main: {
// [5] phi from main main::@1 to main::@1 [phi:main/main::@1->main::@1]
// [5] phi (byte) x#5 = (byte) x#0 [phi:main/main::@1->main::@1#0] -- register_copy
// main::@1
__b1:
// while(++x<50)
// [6] (byte) x#1 ← ++ (byte) x#5 -- vbuz1=_inc_vbuz1
// [5] (byte) x ← ++ (byte) x -- vbuz1=_inc_vbuz1
inc.z x
// [7] if((byte) x#1<(byte) $32) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
// [6] if((byte) x<(byte) $32) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z x
cmp #$32
bcc __b1
// main::@2
// x = 0
// [8] (byte) x#2 ← (byte) 0 -- vbuz1=vbuc1
// [7] (byte) x ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z x
// main::@return
// }
// [9] return
// [8] return
rts
}
// File Data
+2 -6
View File
@@ -5,10 +5,6 @@
(label) main::@1
(label) main::@2
(label) main::@return
(byte) x
(byte) x#0 x zp[1]:2 1.3333333333333333
(byte) x#1 x zp[1]:2 16.5
(byte) x#2 x zp[1]:2 20.0
(byte) x#5 x zp[1]:2 24.0
(byte) x loadstore zp[1]:2 37.0
zp[1]:2 [ x#5 x#0 x#1 x#2 ]
zp[1]:2 [ x ]
@@ -1,6 +1,6 @@
@begin: scope:[] from
[0] (byte) col1#0 ← (byte) 0
[1] (byte) col2#0 ← (byte) 8
[0] (byte) col1 ← (byte) 0
[1] (byte) col2 ← (byte) 8
to:@1
@1: scope:[] from @begin
[2] phi()
@@ -19,10 +19,10 @@ main::@return: scope:[main] from main
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
[7] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0
[8] (byte) col1#1 ← ++ (byte) col1#0
[9] *((const byte*) SCREEN+(byte) $29) ← (byte) col2#0
[10] (byte) col2#1 ← ++ (byte) col2#0
[7] *((const byte*) SCREEN+(byte) $28) ← (byte) col1
[8] (byte) col1 ← ++ (byte) col1
[9] *((const byte*) SCREEN+(byte) $29) ← (byte) col2
[10] (byte) col2 ← ++ (byte) col2
to:irq::@return
irq::@return: scope:[irq] from irq
[11] return
@@ -3,8 +3,8 @@ Culled Empty Block (label) @1
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte) col1#0 ← (number) 0
(byte) col2#0 ← (number) 8
(byte) col1 ← (number) 0
(byte) col2 ← (number) 8
to:@2
(void()) main()
@@ -17,23 +17,15 @@ main::@return: scope:[main] from main
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
(byte) col2#3 ← phi( @2/(byte) col2#5 )
(byte) col1#3phi( @2/(byte) col1#5 )
*((const byte*) SCREEN + (number) $28) ← (byte) col1#3
(byte) col1#1 ← ++ (byte) col1#3
*((const byte*) SCREEN + (number) $29) ← (byte) col2#3
(byte) col2#1 ← ++ (byte) col2#3
*((const byte*) SCREEN + (number) $28) ← (byte) col1
(byte) col1 ← ++ (byte) col1
*((const byte*) SCREEN + (number) $29) ← (byte) col2
(byte) col2 ← ++ (byte) col2
to:irq::@return
irq::@return: scope:[irq] from irq
(byte) col2#4 ← phi( irq/(byte) col2#1 )
(byte) col1#4 ← phi( irq/(byte) col1#1 )
(byte) col1#2 ← (byte) col1#4
(byte) col2#2 ← (byte) col2#4
return
to:@return
@2: scope:[] from @begin
(byte) col2#5 ← phi( @begin/(byte) col2#0 )
(byte) col1#5 ← phi( @begin/(byte) col1#0 )
call main
to:@3
@3: scope:[] from @2
@@ -47,32 +39,20 @@ SYMBOL TABLE SSA
(label) @end
(const void()**) KERNEL_IRQ = (void()**)(number) $314
(const byte*) SCREEN = (byte*)(number) $400
(byte) col1
(byte) col1#0
(byte) col1#1
(byte) col1#2
(byte) col1#3
(byte) col1#4
(byte) col1#5
(byte) col2
(byte) col2#0
(byte) col2#1
(byte) col2#2
(byte) col2#3
(byte) col2#4
(byte) col2#5
(byte) col1 loadstore
(byte) col2 loadstore
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@return
(void()) main()
(label) main::@return
Adding number conversion cast (unumber) 0 in (byte) col1#0 ← (number) 0
Adding number conversion cast (unumber) 8 in (byte) col2#0 ← (number) 8
Adding number conversion cast (unumber) $28 in *((const byte*) SCREEN + (number) $28) ← (byte) col1#3
Adding number conversion cast (unumber) $29 in *((const byte*) SCREEN + (number) $29) ← (byte) col2#3
Adding number conversion cast (unumber) 0 in (byte) col1 ← (number) 0
Adding number conversion cast (unumber) 8 in (byte) col2 ← (number) 8
Adding number conversion cast (unumber) $28 in *((const byte*) SCREEN + (number) $28) ← (byte) col1
Adding number conversion cast (unumber) $29 in *((const byte*) SCREEN + (number) $29) ← (byte) col2
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) col1#0 ← (unumber)(number) 0
Inlining cast (byte) col2#0 ← (unumber)(number) 8
Inlining cast (byte) col1 ← (unumber)(number) 0
Inlining cast (byte) col2 ← (unumber)(number) 8
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (void()**) 788
Simplifying constant pointer cast (byte*) 1024
@@ -86,14 +66,6 @@ Finalized unsigned number type (byte) 8
Finalized unsigned number type (byte) $28
Finalized unsigned number type (byte) $29
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) col1#1 = (byte) col1#4 (byte) col1#2
Alias (byte) col2#1 = (byte) col2#4 (byte) col2#2
Alias (byte) col1#0 = (byte) col1#5
Alias (byte) col2#0 = (byte) col2#5
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) col1#3 (byte) col1#0
Identical Phi Values (byte) col2#3 (byte) col2#0
Successful SSA optimization Pass2IdenticalPhiElimination
Consolidated array index constant in *(SCREEN+$28)
Consolidated array index constant in *(SCREEN+$29)
Successful SSA optimization Pass2ConstantAdditionElimination
@@ -112,8 +84,8 @@ Adding NOP phi() at start of @end
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] (byte) col1#0 ← (byte) 0
[1] (byte) col2#0 ← (byte) 8
[0] (byte) col1 ← (byte) 0
[1] (byte) col2 ← (byte) 8
to:@1
@1: scope:[] from @begin
[2] phi()
@@ -132,10 +104,10 @@ main::@return: scope:[main] from main
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
[7] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0
[8] (byte) col1#1 ← ++ (byte) col1#0
[9] *((const byte*) SCREEN+(byte) $29) ← (byte) col2#0
[10] (byte) col2#1 ← ++ (byte) col2#0
[7] *((const byte*) SCREEN+(byte) $28) ← (byte) col1
[8] (byte) col1 ← ++ (byte) col1
[9] *((const byte*) SCREEN+(byte) $29) ← (byte) col2
[10] (byte) col2 ← ++ (byte) col2
to:irq::@return
irq::@return: scope:[irq] from irq
[11] return
@@ -143,23 +115,19 @@ irq::@return: scope:[irq] from irq
VARIABLE REGISTER WEIGHTS
(byte) col1
(byte) col1#0 6.0
(byte) col1#1 20.0
(byte) col2
(byte) col2#0 2.0
(byte) col2#1 20.0
(byte) col1 loadstore 80.0
(byte) col2 loadstore 4.0
interrupt(KERNEL_MIN)(void()) irq()
(void()) main()
Initial phi equivalence classes
Coalescing volatile variable equivalence classes [ col1#0 ] and [ col1#1 ]
Coalescing volatile variable equivalence classes [ col2#0 ] and [ col2#1 ]
Added variable col1 to live range equivalence class [ col1 ]
Added variable col2 to live range equivalence class [ col2 ]
Complete equivalence classes
[ col1#0 col1#1 ]
[ col2#0 col2#1 ]
Allocated zp[1]:2 [ col1#0 col1#1 ]
Allocated zp[1]:3 [ col2#0 col2#1 ]
[ col1 ]
[ col2 ]
Allocated zp[1]:2 [ col1 ]
Allocated zp[1]:3 [ col2 ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -176,10 +144,10 @@ Target platform is c64basic / MOS6502X
.label col2 = 3
// @begin
__bbegin:
// [0] (byte) col1#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col1 ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col1
// [1] (byte) col2#0 ← (byte) 8 -- vbuz1=vbuc1
// [1] (byte) col2 ← (byte) 8 -- vbuz1=vbuc1
lda #8
sta.z col2
// [2] phi from @begin to @1 [phi:@begin->@1]
@@ -210,15 +178,15 @@ main: {
// irq
irq: {
// entry interrupt(KERNEL_MIN)
// [7] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0 -- _deref_pbuc1=vbuz1
// [7] *((const byte*) SCREEN+(byte) $28) ← (byte) col1 -- _deref_pbuc1=vbuz1
lda.z col1
sta SCREEN+$28
// [8] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz1
// [8] (byte) col1 ← ++ (byte) col1 -- vbuz1=_inc_vbuz1
inc.z col1
// [9] *((const byte*) SCREEN+(byte) $29) ← (byte) col2#0 -- _deref_pbuc1=vbuz1
// [9] *((const byte*) SCREEN+(byte) $29) ← (byte) col2 -- _deref_pbuc1=vbuz1
lda.z col2
sta SCREEN+$29
// [10] (byte) col2#1 ← ++ (byte) col2#0 -- vbuz1=_inc_vbuz1
// [10] (byte) col2 ← ++ (byte) col2 -- vbuz1=_inc_vbuz1
inc.z col2
jmp __breturn
// irq::@return
@@ -229,26 +197,26 @@ irq: {
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte) col1#0 ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [1] (byte) col2#0 ← (byte) 8 [ ] ( [ ] ) always clobbers reg byte a
Statement [0] (byte) col1 ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [1] (byte) col2 ← (byte) 8 [ ] ( [ ] ) always clobbers reg byte a
Statement [5] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [7] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0 [ col1#0 col2#0 ] ( [ col1#0 col2#0 ] ) always clobbers reg byte a
Statement [9] *((const byte*) SCREEN+(byte) $29) ← (byte) col2#0 [ col2#0 ] ( [ col2#0 ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ col1#0 col1#1 ] : zp[1]:2 ,
Potential registers zp[1]:3 [ col2#0 col2#1 ] : zp[1]:3 ,
Statement [7] *((const byte*) SCREEN+(byte) $28) ← (byte) col1 [ col2 ] ( [ col2 ] ) always clobbers reg byte a
Statement [9] *((const byte*) SCREEN+(byte) $29) ← (byte) col2 [ ] ( [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ col1 ] : zp[1]:2 ,
Potential registers zp[1]:3 [ col2 ] : zp[1]:3 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 26: zp[1]:2 [ col1#0 col1#1 ] 22: zp[1]:3 [ col2#0 col2#1 ]
Uplift Scope [] 80: zp[1]:2 [ col1 ] 4: zp[1]:3 [ col2 ]
Uplift Scope [main]
Uplift Scope [irq]
Uplifting [] best 73 combination zp[1]:2 [ col1#0 col1#1 ] zp[1]:3 [ col2#0 col2#1 ]
Uplifting [] best 73 combination zp[1]:2 [ col1 ] zp[1]:3 [ col2 ]
Uplifting [main] best 73 combination
Uplifting [irq] best 73 combination
Attempting to uplift remaining variables inzp[1]:2 [ col1#0 col1#1 ]
Uplifting [] best 73 combination zp[1]:2 [ col1#0 col1#1 ]
Attempting to uplift remaining variables inzp[1]:3 [ col2#0 col2#1 ]
Uplifting [] best 73 combination zp[1]:3 [ col2#0 col2#1 ]
Attempting to uplift remaining variables inzp[1]:2 [ col1 ]
Uplifting [] best 73 combination zp[1]:2 [ col1 ]
Attempting to uplift remaining variables inzp[1]:3 [ col2 ]
Uplifting [] best 73 combination zp[1]:3 [ col2 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -264,10 +232,10 @@ ASSEMBLER BEFORE OPTIMIZATION
.label col2 = 3
// @begin
__bbegin:
// [0] (byte) col1#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col1 ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col1
// [1] (byte) col2#0 ← (byte) 8 -- vbuz1=vbuc1
// [1] (byte) col2 ← (byte) 8 -- vbuz1=vbuc1
lda #8
sta.z col2
// [2] phi from @begin to @1 [phi:@begin->@1]
@@ -298,15 +266,15 @@ main: {
// irq
irq: {
// entry interrupt(KERNEL_MIN)
// [7] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0 -- _deref_pbuc1=vbuz1
// [7] *((const byte*) SCREEN+(byte) $28) ← (byte) col1 -- _deref_pbuc1=vbuz1
lda.z col1
sta SCREEN+$28
// [8] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz1
// [8] (byte) col1 ← ++ (byte) col1 -- vbuz1=_inc_vbuz1
inc.z col1
// [9] *((const byte*) SCREEN+(byte) $29) ← (byte) col2#0 -- _deref_pbuc1=vbuz1
// [9] *((const byte*) SCREEN+(byte) $29) ← (byte) col2 -- _deref_pbuc1=vbuz1
lda.z col2
sta SCREEN+$29
// [10] (byte) col2#1 ← ++ (byte) col2#0 -- vbuz1=_inc_vbuz1
// [10] (byte) col2 ← ++ (byte) col2 -- vbuz1=_inc_vbuz1
inc.z col2
jmp __breturn
// irq::@return
@@ -339,19 +307,15 @@ FINAL SYMBOL TABLE
(label) @end
(const void()**) KERNEL_IRQ = (void()**) 788
(const byte*) SCREEN = (byte*) 1024
(byte) col1
(byte) col1#0 col1 zp[1]:2 6.0
(byte) col1#1 col1 zp[1]:2 20.0
(byte) col2
(byte) col2#0 col2 zp[1]:3 2.0
(byte) col2#1 col2 zp[1]:3 20.0
(byte) col1 loadstore zp[1]:2 80.0
(byte) col2 loadstore zp[1]:3 4.0
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@return
(void()) main()
(label) main::@return
zp[1]:2 [ col1#0 col1#1 ]
zp[1]:3 [ col2#0 col2#1 ]
zp[1]:2 [ col1 ]
zp[1]:3 [ col2 ]
FINAL ASSEMBLER
@@ -371,11 +335,11 @@ Score: 67
// @begin
__bbegin:
// col1 = 0
// [0] (byte) col1#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col1 ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col1
// col2 = 8
// [1] (byte) col2#0 ← (byte) 8 -- vbuz1=vbuc1
// [1] (byte) col2 ← (byte) 8 -- vbuz1=vbuc1
lda #8
sta.z col2
// [2] phi from @begin to @1 [phi:@begin->@1]
@@ -402,18 +366,18 @@ main: {
irq: {
// entry interrupt(KERNEL_MIN)
// SCREEN[40] = col1++
// [7] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0 -- _deref_pbuc1=vbuz1
// [7] *((const byte*) SCREEN+(byte) $28) ← (byte) col1 -- _deref_pbuc1=vbuz1
lda.z col1
sta SCREEN+$28
// SCREEN[40] = col1++;
// [8] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz1
// [8] (byte) col1 ← ++ (byte) col1 -- vbuz1=_inc_vbuz1
inc.z col1
// SCREEN[41] = col2++
// [9] *((const byte*) SCREEN+(byte) $29) ← (byte) col2#0 -- _deref_pbuc1=vbuz1
// [9] *((const byte*) SCREEN+(byte) $29) ← (byte) col2 -- _deref_pbuc1=vbuz1
lda.z col2
sta SCREEN+$29
// SCREEN[41] = col2++;
// [10] (byte) col2#1 ← ++ (byte) col2#0 -- vbuz1=_inc_vbuz1
// [10] (byte) col2 ← ++ (byte) col2 -- vbuz1=_inc_vbuz1
inc.z col2
// irq::@return
// }
@@ -3,16 +3,12 @@
(label) @end
(const void()**) KERNEL_IRQ = (void()**) 788
(const byte*) SCREEN = (byte*) 1024
(byte) col1
(byte) col1#0 col1 zp[1]:2 6.0
(byte) col1#1 col1 zp[1]:2 20.0
(byte) col2
(byte) col2#0 col2 zp[1]:3 2.0
(byte) col2#1 col2 zp[1]:3 20.0
(byte) col1 loadstore zp[1]:2 80.0
(byte) col2 loadstore zp[1]:3 4.0
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@return
(void()) main()
(label) main::@return
zp[1]:2 [ col1#0 col1#1 ]
zp[1]:3 [ col2#0 col2#1 ]
zp[1]:2 [ col1 ]
zp[1]:3 [ col2 ]
@@ -1,5 +1,5 @@
@begin: scope:[] from
[0] (byte) col1#0 ← (byte) 0
[0] (byte) col1 ← (byte) 0
to:@1
@1: scope:[] from @begin
[1] phi()
@@ -41,8 +41,8 @@ interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
[17] *((const byte*) IRQ_STATUS) ← (byte) 1
asm { lda$dc0d }
[19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0
[20] (byte) col1#1 ← ++ (byte) col1#0
[19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1
[20] (byte) col1 ← ++ (byte) col1
to:irq::@return
irq::@return: scope:[irq] from irq
[21] return
@@ -8,7 +8,7 @@ Culled Empty Block (label) @1
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte) col1#0 ← (number) 0
(byte) col1 ← (number) 0
to:@2
(void()) main()
@@ -59,19 +59,15 @@ main::@return: scope:[main] from main::@1
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
(byte) col1#3 ← phi( @2/(byte) col1#5 )
*((const byte*) IRQ_STATUS) ← (number) 1
asm { lda$dc0d }
*((const byte*) SCREEN + (number) $28) ← (byte) col1#3
(byte) col1#1 ← ++ (byte) col1#3
*((const byte*) SCREEN + (number) $28) ← (byte) col1
(byte) col1 ← ++ (byte) col1
to:irq::@return
irq::@return: scope:[irq] from irq
(byte) col1#4 ← phi( irq/(byte) col1#1 )
(byte) col1#2 ← (byte) col1#4
return
to:@return
@2: scope:[] from @begin
(byte) col1#5 ← phi( @begin/(byte) col1#0 )
call main
to:@3
@3: scope:[] from @2
@@ -86,13 +82,7 @@ SYMBOL TABLE SSA
(const byte*) IRQ_STATUS = (byte*)(number) $d019
(const void()**) KERNEL_IRQ = (void()**)(number) $314
(const byte*) SCREEN = (byte*)(number) $400
(byte) col1
(byte) col1#0
(byte) col1#1
(byte) col1#2
(byte) col1#3
(byte) col1#4
(byte) col1#5
(byte) col1 loadstore
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@return
(void()) main()
@@ -127,11 +117,11 @@ interrupt(KERNEL_MIN)(void()) irq()
(byte) main::y#3
(byte) main::y#4
Adding number conversion cast (unumber) 0 in (byte) col1#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) col1 ← (number) 0
Adding number conversion cast (unumber) 1 in *((const byte*) IRQ_STATUS) ← (number) 1
Adding number conversion cast (unumber) $28 in *((const byte*) SCREEN + (number) $28) ← (byte) col1#3
Adding number conversion cast (unumber) $28 in *((const byte*) SCREEN + (number) $28) ← (byte) col1
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) col1#0 ← (unumber)(number) 0
Inlining cast (byte) col1 ← (unumber)(number) 0
Inlining cast *((const byte*) IRQ_STATUS) ← (unumber)(number) 1
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (void()**) 788
@@ -147,12 +137,9 @@ Finalized unsigned number type (byte) $28
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) main::y#2 = (byte) main::y#3
Alias (byte) main::x#2 = (byte) main::x#5 (byte) main::x#3
Alias (byte) col1#1 = (byte) col1#4 (byte) col1#2
Alias (byte) col1#0 = (byte) col1#5
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) main::y#2 (byte) main::y#4
Identical Phi Values (byte) main::x#2 (byte) main::x#4
Identical Phi Values (byte) col1#3 (byte) col1#0
Successful SSA optimization Pass2IdenticalPhiElimination
Identical Phi Values (byte) main::x#4 (byte) main::x#6
Successful SSA optimization Pass2IdenticalPhiElimination
@@ -229,7 +216,7 @@ Adding NOP phi() at start of main::@6
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] (byte) col1#0 ← (byte) 0
[0] (byte) col1 ← (byte) 0
to:@1
@1: scope:[] from @begin
[1] phi()
@@ -271,8 +258,8 @@ interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
[17] *((const byte*) IRQ_STATUS) ← (byte) 1
asm { lda$dc0d }
[19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0
[20] (byte) col1#1 ← ++ (byte) col1#0
[19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1
[20] (byte) col1 ← ++ (byte) col1
to:irq::@return
irq::@return: scope:[irq] from irq
[21] return
@@ -280,9 +267,7 @@ irq::@return: scope:[irq] from irq
VARIABLE REGISTER WEIGHTS
(byte) col1
(byte) col1#0 2.0
(byte) col1#1 20.0
(byte) col1 loadstore 4.0
interrupt(KERNEL_MIN)(void()) irq()
(void()) main()
(byte~) main::$0 20002.0
@@ -300,18 +285,18 @@ Initial phi equivalence classes
[ main::x#6 main::x#1 ]
[ main::y#4 main::y#1 ]
[ main::a#2 main::a#1 ]
Coalescing volatile variable equivalence classes [ col1#0 ] and [ col1#1 ]
Added variable col1 to live range equivalence class [ col1 ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Complete equivalence classes
[ main::x#6 main::x#1 ]
[ main::y#4 main::y#1 ]
[ main::a#2 main::a#1 ]
[ col1#0 col1#1 ]
[ col1 ]
[ main::$0 ]
Allocated zp[1]:2 [ main::x#6 main::x#1 ]
Allocated zp[1]:3 [ main::y#4 main::y#1 ]
Allocated zp[1]:4 [ main::a#2 main::a#1 ]
Allocated zp[1]:5 [ col1#0 col1#1 ]
Allocated zp[1]:5 [ col1 ]
Allocated zp[1]:6 [ main::$0 ]
INITIAL ASM
@@ -329,7 +314,7 @@ Target platform is c64basic / MOS6502X
.label col1 = 5
// @begin
__bbegin:
// [0] (byte) col1#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col1 ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col1
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -441,10 +426,10 @@ irq: {
sta IRQ_STATUS
// asm { lda$dc0d }
lda $dc0d
// [19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0 -- _deref_pbuc1=vbuz1
// [19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1 -- _deref_pbuc1=vbuz1
lda.z col1
sta SCREEN+$28
// [20] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz1
// [20] (byte) col1 ← ++ (byte) col1 -- vbuz1=_inc_vbuz1
inc.z col1
jmp __breturn
// irq::@return
@@ -455,42 +440,42 @@ irq: {
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte) col1#0 ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [0] (byte) col1 ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [8] (byte~) main::$0 ← (byte) main::a#2 + (byte) main::y#4 [ main::x#6 main::y#4 main::a#2 main::$0 ] ( main:2 [ main::x#6 main::y#4 main::a#2 main::$0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::x#6 main::x#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::y#4 main::y#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:4 [ main::a#2 main::a#1 ]
Statement [17] *((const byte*) IRQ_STATUS) ← (byte) 1 [ col1#0 ] ( [ col1#0 ] ) always clobbers reg byte a
Statement [17] *((const byte*) IRQ_STATUS) ← (byte) 1 [ col1 ] ( [ col1 ] ) always clobbers reg byte a
Statement asm { lda$dc0d } always clobbers reg byte a
Statement [19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0 [ col1#0 ] ( [ col1#0 ] ) always clobbers reg byte a
Statement [0] (byte) col1#0 ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1 [ ] ( [ ] ) always clobbers reg byte a
Statement [0] (byte) col1 ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [8] (byte~) main::$0 ← (byte) main::a#2 + (byte) main::y#4 [ main::x#6 main::y#4 main::a#2 main::$0 ] ( main:2 [ main::x#6 main::y#4 main::a#2 main::$0 ] ) always clobbers reg byte a
Statement [17] *((const byte*) IRQ_STATUS) ← (byte) 1 [ col1#0 ] ( [ col1#0 ] ) always clobbers reg byte a
Statement [17] *((const byte*) IRQ_STATUS) ← (byte) 1 [ col1 ] ( [ col1 ] ) always clobbers reg byte a
Statement asm { lda$dc0d } always clobbers reg byte a
Statement [19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0 [ col1#0 ] ( [ col1#0 ] ) always clobbers reg byte a
Statement [19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1 [ ] ( [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::x#6 main::x#1 ] : zp[1]:2 , reg byte x , reg byte y ,
Potential registers zp[1]:3 [ main::y#4 main::y#1 ] : zp[1]:3 , reg byte x , reg byte y ,
Potential registers zp[1]:4 [ main::a#2 main::a#1 ] : zp[1]:4 , reg byte x , reg byte y ,
Potential registers zp[1]:5 [ col1#0 col1#1 ] : zp[1]:5 ,
Potential registers zp[1]:5 [ col1 ] : zp[1]:5 ,
Potential registers zp[1]:6 [ main::$0 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 25,002.5: zp[1]:4 [ main::a#2 main::a#1 ] 20,002: zp[1]:6 [ main::$0 ] 3,502: zp[1]:3 [ main::y#4 main::y#1 ] 1,194.67: zp[1]:2 [ main::x#6 main::x#1 ]
Uplift Scope [] 22: zp[1]:5 [ col1#0 col1#1 ]
Uplift Scope [] 4: zp[1]:5 [ col1 ]
Uplift Scope [irq]
Uplifting [main] best 323337 combination reg byte y [ main::a#2 main::a#1 ] reg byte a [ main::$0 ] zp[1]: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 323337 combination zp[1]:5 [ col1#0 col1#1 ]
Uplifting [] best 323337 combination zp[1]:5 [ col1 ]
Uplifting [irq] best 323337 combination
Attempting to uplift remaining variables inzp[1]:3 [ main::y#4 main::y#1 ]
Uplifting [main] best 323337 combination zp[1]:3 [ main::y#4 main::y#1 ]
Attempting to uplift remaining variables inzp[1]:5 [ col1#0 col1#1 ]
Uplifting [] best 323337 combination zp[1]:5 [ col1#0 col1#1 ]
Attempting to uplift remaining variables inzp[1]:5 [ col1 ]
Uplifting [] best 323337 combination zp[1]:5 [ col1 ]
Allocated (was zp[1]:3) zp[1]:2 [ main::y#4 main::y#1 ]
Allocated (was zp[1]:5) zp[1]:3 [ col1#0 col1#1 ]
Allocated (was zp[1]:5) zp[1]:3 [ col1 ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -506,7 +491,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label col1 = 3
// @begin
__bbegin:
// [0] (byte) col1#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col1 ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col1
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -608,10 +593,10 @@ irq: {
sta IRQ_STATUS
// asm { lda$dc0d }
lda $dc0d
// [19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0 -- _deref_pbuc1=vbuz1
// [19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1 -- _deref_pbuc1=vbuz1
lda.z col1
sta SCREEN+$28
// [20] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz1
// [20] (byte) col1 ← ++ (byte) col1 -- vbuz1=_inc_vbuz1
inc.z col1
jmp __breturn
// irq::@return
@@ -672,9 +657,7 @@ FINAL SYMBOL TABLE
(const byte*) IRQ_STATUS = (byte*) 53273
(const void()**) KERNEL_IRQ = (void()**) 788
(const byte*) SCREEN = (byte*) 1024
(byte) col1
(byte) col1#0 col1 zp[1]:3 2.0
(byte) col1#1 col1 zp[1]:3 20.0
(byte) col1 loadstore zp[1]:3 4.0
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@return
(void()) main()
@@ -698,7 +681,7 @@ interrupt(KERNEL_MIN)(void()) irq()
reg byte x [ main::x#6 main::x#1 ]
zp[1]:2 [ main::y#4 main::y#1 ]
reg byte y [ main::a#2 main::a#1 ]
zp[1]:3 [ col1#0 col1#1 ]
zp[1]:3 [ col1 ]
reg byte a [ main::$0 ]
@@ -719,7 +702,7 @@ Score: 223704
// @begin
__bbegin:
// col1 = 0
// [0] (byte) col1#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col1 ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col1
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -806,11 +789,11 @@ irq: {
// asm { lda$dc0d }
lda $dc0d
// SCREEN[40] = col1++
// [19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1#0 -- _deref_pbuc1=vbuz1
// [19] *((const byte*) SCREEN+(byte) $28) ← (byte) col1 -- _deref_pbuc1=vbuz1
lda.z col1
sta SCREEN+$28
// SCREEN[40] = col1++;
// [20] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz1
// [20] (byte) col1 ← ++ (byte) col1 -- vbuz1=_inc_vbuz1
inc.z col1
// irq::@return
// }
@@ -4,9 +4,7 @@
(const byte*) IRQ_STATUS = (byte*) 53273
(const void()**) KERNEL_IRQ = (void()**) 788
(const byte*) SCREEN = (byte*) 1024
(byte) col1
(byte) col1#0 col1 zp[1]:3 2.0
(byte) col1#1 col1 zp[1]:3 20.0
(byte) col1 loadstore zp[1]:3 4.0
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@return
(void()) main()
@@ -30,5 +28,5 @@ interrupt(KERNEL_MIN)(void()) irq()
reg byte x [ main::x#6 main::x#1 ]
zp[1]:2 [ main::y#4 main::y#1 ]
reg byte y [ main::a#2 main::a#1 ]
zp[1]:3 [ col1#0 col1#1 ]
zp[1]:3 [ col1 ]
reg byte a [ main::$0 ]
+13 -15
View File
@@ -2,7 +2,7 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) irq_idx#0 ← (byte) 0
[1] (byte) irq_idx ← (byte) 0
to:@2
@2: scope:[] from @1
[2] phi()
@@ -31,30 +31,28 @@ table_driven_irq: scope:[table_driven_irq] from
[14] phi()
to:table_driven_irq::@1
table_driven_irq::@1: scope:[table_driven_irq] from table_driven_irq table_driven_irq::@2 table_driven_irq::@3
[15] (byte) irq_idx#4 ← phi( table_driven_irq/(byte) irq_idx#0 table_driven_irq::@2/(byte) irq_idx#1 table_driven_irq::@3/(byte) irq_idx#1 )
[16] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx#4)
[17] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx#4)
[18] (byte) irq_idx#1 ← ++ (byte) irq_idx#4
[19] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE) goto table_driven_irq::@2
[15] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx)
[16] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx)
[17] (byte) irq_idx ← ++ (byte) irq_idx
[18] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE) goto table_driven_irq::@2
to:table_driven_irq::@4
table_driven_irq::@4: scope:[table_driven_irq] from table_driven_irq::@1
[20] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE+(byte) 8) goto table_driven_irq::@3
[19] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE+(byte) 8) goto table_driven_irq::@3
to:table_driven_irq::@5
table_driven_irq::@5: scope:[table_driven_irq] from table_driven_irq::@4
[21] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[22] *((const byte*) RASTER) ← (byte) table_driven_irq::val#0
[23] if((byte) table_driven_irq::val#0>=*((const byte*) RASTER)) goto table_driven_irq::@return
[20] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[21] *((const byte*) RASTER) ← (byte) table_driven_irq::val#0
[22] if((byte) table_driven_irq::val#0>=*((const byte*) RASTER)) goto table_driven_irq::@return
to:table_driven_irq::@6
table_driven_irq::@6: scope:[table_driven_irq] from table_driven_irq::@5
[24] (byte) irq_idx#2 ← (byte) 0
[23] (byte) irq_idx ← (byte) 0
to:table_driven_irq::@return
table_driven_irq::@return: scope:[table_driven_irq] from table_driven_irq::@5 table_driven_irq::@6
[25] (byte) irq_idx#3 ← phi( table_driven_irq::@5/(byte) irq_idx#1 table_driven_irq::@6/(byte) irq_idx#2 )
[26] return
[24] return
to:@return
table_driven_irq::@3: scope:[table_driven_irq] from table_driven_irq::@4
[27] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0
[25] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0
to:table_driven_irq::@1
table_driven_irq::@2: scope:[table_driven_irq] from table_driven_irq::@1
[28] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0
[26] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0
to:table_driven_irq::@1
+105 -182
View File
@@ -30,36 +30,31 @@ main::@return: scope:[main] from main
return
to:@return
@5: scope:[] from @begin
(byte) irq_idx#0 ← (number) 0
(byte) irq_idx ← (number) 0
to:@6
interrupt(KERNEL_MIN)(void()) table_driven_irq()
table_driven_irq: scope:[table_driven_irq] from
(byte) irq_idx#6 ← phi( @6/(byte) irq_idx#9 )
to:table_driven_irq::@1
table_driven_irq::@1: scope:[table_driven_irq] from table_driven_irq table_driven_irq::@8
(byte) irq_idx#4 ← phi( table_driven_irq/(byte) irq_idx#6 table_driven_irq::@8/(byte) irq_idx#7 )
(byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx#4)
(byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx#4)
(byte) irq_idx#1 ← ++ (byte) irq_idx#4
(byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx)
(byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx)
(byte) irq_idx ← ++ (byte) irq_idx
(bool~) table_driven_irq::$0 ← (byte) table_driven_irq::idx#0 < (const byte) VIC_SIZE
if((bool~) table_driven_irq::$0) goto table_driven_irq::@2
to:table_driven_irq::@9
table_driven_irq::@2: scope:[table_driven_irq] from table_driven_irq::@1
(byte) irq_idx#11 ← phi( table_driven_irq::@1/(byte) irq_idx#1 )
(byte) table_driven_irq::idx#1 ← phi( table_driven_irq::@1/(byte) table_driven_irq::idx#0 )
(byte) table_driven_irq::val#1 ← phi( table_driven_irq::@1/(byte) table_driven_irq::val#0 )
*((const byte*) VIC_BASE + (byte) table_driven_irq::idx#1) ← (byte) table_driven_irq::val#1
to:table_driven_irq::@8
table_driven_irq::@9: scope:[table_driven_irq] from table_driven_irq::@1
(byte) irq_idx#10 ← phi( table_driven_irq::@1/(byte) irq_idx#1 )
(byte) table_driven_irq::val#4 ← phi( table_driven_irq::@1/(byte) table_driven_irq::val#0 )
(byte) table_driven_irq::idx#2 ← phi( table_driven_irq::@1/(byte) table_driven_irq::idx#0 )
(bool~) table_driven_irq::$1 ← (byte) table_driven_irq::idx#2 < (const byte) VIC_SIZE+(number) 8
if((bool~) table_driven_irq::$1) goto table_driven_irq::@3
to:table_driven_irq::@10
table_driven_irq::@3: scope:[table_driven_irq] from table_driven_irq::@9
(byte) irq_idx#12 ← phi( table_driven_irq::@9/(byte) irq_idx#10 )
(byte) table_driven_irq::val#2 ← phi( table_driven_irq::@9/(byte) table_driven_irq::val#4 )
(byte) table_driven_irq::idx#3 ← phi( table_driven_irq::@9/(byte) table_driven_irq::idx#2 )
(number~) table_driven_irq::$4 ← (byte) table_driven_irq::idx#3 + (number) $3f8
@@ -67,7 +62,6 @@ table_driven_irq::@3: scope:[table_driven_irq] from table_driven_irq::@9
*((const byte*) SCREEN + (number~) table_driven_irq::$5) ← (byte) table_driven_irq::val#2
to:table_driven_irq::@8
table_driven_irq::@10: scope:[table_driven_irq] from table_driven_irq::@9
(byte) irq_idx#8 ← phi( table_driven_irq::@9/(byte) irq_idx#10 )
(byte) table_driven_irq::val#3 ← phi( table_driven_irq::@9/(byte) table_driven_irq::val#4 )
*((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
*((const byte*) RASTER) ← (byte) table_driven_irq::val#3
@@ -76,19 +70,15 @@ table_driven_irq::@10: scope:[table_driven_irq] from table_driven_irq::@9
if((bool~) table_driven_irq::$3) goto table_driven_irq::@return
to:table_driven_irq::@11
table_driven_irq::@11: scope:[table_driven_irq] from table_driven_irq::@10
(byte) irq_idx#2 ← (number) 0
(byte) irq_idx ← (number) 0
to:table_driven_irq::@return
table_driven_irq::@return: scope:[table_driven_irq] from table_driven_irq::@10 table_driven_irq::@11 table_driven_irq::@8
(byte) irq_idx#5 ← phi( table_driven_irq::@10/(byte) irq_idx#8 table_driven_irq::@11/(byte) irq_idx#2 table_driven_irq::@8/(byte) irq_idx#7 )
(byte) irq_idx#3 ← (byte) irq_idx#5
return
to:@return
table_driven_irq::@8: scope:[table_driven_irq] from table_driven_irq::@2 table_driven_irq::@3
(byte) irq_idx#7 ← phi( table_driven_irq::@2/(byte) irq_idx#11 table_driven_irq::@3/(byte) irq_idx#12 )
if(true) goto table_driven_irq::@1
to:table_driven_irq::@return
@6: scope:[] from @5
(byte) irq_idx#9 ← phi( @5/(byte) irq_idx#0 )
call main
to:@7
@7: scope:[] from @6
@@ -115,20 +105,7 @@ SYMBOL TABLE SSA
(const byte*) VIC_BASE = (byte*)(number) $d000
(const byte*) VIC_CONTROL = (byte*)(number) $d011
(const byte) VIC_SIZE = (number) $30
(byte) irq_idx
(byte) irq_idx#0
(byte) irq_idx#1
(byte) irq_idx#10
(byte) irq_idx#11
(byte) irq_idx#12
(byte) irq_idx#2
(byte) irq_idx#3
(byte) irq_idx#4
(byte) irq_idx#5
(byte) irq_idx#6
(byte) irq_idx#7
(byte) irq_idx#8
(byte) irq_idx#9
(byte) irq_idx loadstore
(void()) main()
(label) main::@return
interrupt(KERNEL_MIN)(void()) table_driven_irq()
@@ -160,17 +137,17 @@ interrupt(KERNEL_MIN)(void()) table_driven_irq()
Adding number conversion cast (unumber) $7f in *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (number) $7f
Adding number conversion cast (unumber) $60 in *((const byte*) RASTER) ← (number) $60
Adding number conversion cast (unumber) 0 in (byte) irq_idx#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) irq_idx ← (number) 0
Adding number conversion cast (unumber) VIC_SIZE+8 in (bool~) table_driven_irq::$1 ← (byte) table_driven_irq::idx#2 < (const byte) VIC_SIZE+(number) 8
Adding number conversion cast (unumber) 8 in (bool~) table_driven_irq::$1 ← (byte) table_driven_irq::idx#2 < (unumber)(const byte) VIC_SIZE+(number) 8
Adding number conversion cast (unumber) $3f8 in (number~) table_driven_irq::$4 ← (byte) table_driven_irq::idx#3 + (number) $3f8
Adding number conversion cast (unumber) table_driven_irq::$4 in (number~) table_driven_irq::$4 ← (byte) table_driven_irq::idx#3 + (unumber)(number) $3f8
Adding number conversion cast (unumber) table_driven_irq::$5 in (number~) table_driven_irq::$5 ← (unumber~) table_driven_irq::$4 - (const byte) VIC_SIZE
Adding number conversion cast (unumber) 0 in (byte) irq_idx#2 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) irq_idx ← (number) 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *((const byte*) RASTER) ← (unumber)(number) $60
Inlining cast (byte) irq_idx#0 ← (unumber)(number) 0
Inlining cast (byte) irq_idx#2 ← (unumber)(number) 0
Inlining cast (byte) irq_idx ← (unumber)(number) 0
Inlining cast (byte) irq_idx ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 53266
Simplifying constant pointer cast (byte*) 53265
@@ -217,26 +194,18 @@ Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to word in (unumber~) table_driven_irq::$4 ← (byte) table_driven_irq::idx#3 + (word) $3f8
Inferred type updated to word in (unumber~) table_driven_irq::$5 ← (word~) table_driven_irq::$4 - (const byte) VIC_SIZE
Inversing boolean not [30] (bool~) table_driven_irq::$3 ← (byte) table_driven_irq::val#3 >= *((const byte*) RASTER) from [29] (bool~) table_driven_irq::$2 ← (byte) table_driven_irq::val#3 < *((const byte*) RASTER)
Inversing boolean not [28] (bool~) table_driven_irq::$3 ← (byte) table_driven_irq::val#3 >= *((const byte*) RASTER) from [27] (bool~) table_driven_irq::$2 ← (byte) table_driven_irq::val#3 < *((const byte*) RASTER)
Successful SSA optimization Pass2UnaryNotSimplification
Alias (byte) table_driven_irq::val#0 = (byte) table_driven_irq::val#1 (byte) table_driven_irq::val#4 (byte) table_driven_irq::val#2 (byte) table_driven_irq::val#3
Alias (byte) table_driven_irq::idx#0 = (byte) table_driven_irq::idx#1 (byte) table_driven_irq::idx#2 (byte) table_driven_irq::idx#3
Alias (byte) irq_idx#1 = (byte) irq_idx#11 (byte) irq_idx#10 (byte) irq_idx#12 (byte) irq_idx#8
Alias (byte) irq_idx#3 = (byte) irq_idx#5
Alias (byte) irq_idx#0 = (byte) irq_idx#9
Successful SSA optimization Pass2AliasElimination
Alias (byte) irq_idx#1 = (byte) irq_idx#7
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) irq_idx#6 (byte) irq_idx#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) table_driven_irq::$0 [16] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE) goto table_driven_irq::@2
Simple Condition (bool~) table_driven_irq::$1 [21] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE+(byte) 8) goto table_driven_irq::@3
Simple Condition (bool~) table_driven_irq::$3 [31] if((byte) table_driven_irq::val#0>=*((const byte*) RASTER)) goto table_driven_irq::@return
Simple Condition (bool~) table_driven_irq::$0 [14] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE) goto table_driven_irq::@2
Simple Condition (bool~) table_driven_irq::$1 [19] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE+(byte) 8) goto table_driven_irq::@3
Simple Condition (bool~) table_driven_irq::$3 [29] if((byte) table_driven_irq::val#0>=*((const byte*) RASTER)) goto table_driven_irq::@return
Successful SSA optimization Pass2ConditionalJumpSimplification
Removing PHI-reference to removed block (table_driven_irq::@8) in block table_driven_irq::@return
if() condition always true - replacing block destination [37] if(true) goto table_driven_irq::@1
if() condition always true - replacing block destination [32] if(true) goto table_driven_irq::@1
Successful SSA optimization Pass2ConstantIfs
De-inlining pointer[w] to *(pointer+w) [25] *((const byte*) SCREEN + (word~) table_driven_irq::$5) ← (byte) table_driven_irq::val#0
De-inlining pointer[w] to *(pointer+w) [23] *((const byte*) SCREEN + (word~) table_driven_irq::$5) ← (byte) table_driven_irq::val#0
Successful SSA optimization Pass2DeInlineWordDerefIdx
Consolidated constant in assignment table_driven_irq::$6
Successful SSA optimization Pass2ConstantAdditionElimination
@@ -246,26 +215,22 @@ Consolidated constant in assignment table_driven_irq::$6
Successful SSA optimization Pass2ConstantAdditionElimination
Alias (byte) table_driven_irq::idx#0 = (word~) table_driven_irq::$5
Successful SSA optimization Pass2AliasElimination
Converting *(pointer+n) to pointer[n] [19] *((byte*~) table_driven_irq::$6) ← (byte) table_driven_irq::val#0 -- *(SCREEN+-VIC_SIZE+$3f8 + table_driven_irq::idx#0)
Converting *(pointer+n) to pointer[n] [18] *((byte*~) table_driven_irq::$6) ← (byte) table_driven_irq::val#0 -- *(SCREEN+-VIC_SIZE+$3f8 + table_driven_irq::idx#0)
Successful SSA optimization Pass2InlineDerefIdx
Eliminating unused variable (byte*~) table_driven_irq::$6 and assignment [17] (byte*~) table_driven_irq::$6 ← (const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0
Eliminating unused variable (byte*~) table_driven_irq::$6 and assignment [16] (byte*~) table_driven_irq::$6 ← (const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0
Successful SSA optimization PassNEliminateUnusedVars
Added new block during phi lifting table_driven_irq::@14(between table_driven_irq::@10 and table_driven_irq::@return)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @6
Adding NOP phi() at start of @7
Adding NOP phi() at start of @end
Adding NOP phi() at start of table_driven_irq
Adding NOP phi() at start of table_driven_irq::@8
CALL GRAPH
Calls in [] to main:3
Created 2 initial phi equivalence classes
Coalesced [15] irq_idx#13 ← irq_idx#0
Coalesced [26] irq_idx#16 ← irq_idx#2
Coalesced [29] irq_idx#15 ← irq_idx#1
Coalesced [31] irq_idx#14 ← irq_idx#1
Coalesced down to 1 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @7
Culled Empty Block (label) table_driven_irq::@14
Culled Empty Block (label) table_driven_irq::@8
Renumbering block @5 to @1
Renumbering block @6 to @2
@@ -282,7 +247,7 @@ FINAL CONTROL FLOW GRAPH
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) irq_idx#0 ← (byte) 0
[1] (byte) irq_idx ← (byte) 0
to:@2
@2: scope:[] from @1
[2] phi()
@@ -311,42 +276,35 @@ table_driven_irq: scope:[table_driven_irq] from
[14] phi()
to:table_driven_irq::@1
table_driven_irq::@1: scope:[table_driven_irq] from table_driven_irq table_driven_irq::@2 table_driven_irq::@3
[15] (byte) irq_idx#4 ← phi( table_driven_irq/(byte) irq_idx#0 table_driven_irq::@2/(byte) irq_idx#1 table_driven_irq::@3/(byte) irq_idx#1 )
[16] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx#4)
[17] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx#4)
[18] (byte) irq_idx#1 ← ++ (byte) irq_idx#4
[19] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE) goto table_driven_irq::@2
[15] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx)
[16] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx)
[17] (byte) irq_idx ← ++ (byte) irq_idx
[18] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE) goto table_driven_irq::@2
to:table_driven_irq::@4
table_driven_irq::@4: scope:[table_driven_irq] from table_driven_irq::@1
[20] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE+(byte) 8) goto table_driven_irq::@3
[19] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE+(byte) 8) goto table_driven_irq::@3
to:table_driven_irq::@5
table_driven_irq::@5: scope:[table_driven_irq] from table_driven_irq::@4
[21] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[22] *((const byte*) RASTER) ← (byte) table_driven_irq::val#0
[23] if((byte) table_driven_irq::val#0>=*((const byte*) RASTER)) goto table_driven_irq::@return
[20] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[21] *((const byte*) RASTER) ← (byte) table_driven_irq::val#0
[22] if((byte) table_driven_irq::val#0>=*((const byte*) RASTER)) goto table_driven_irq::@return
to:table_driven_irq::@6
table_driven_irq::@6: scope:[table_driven_irq] from table_driven_irq::@5
[24] (byte) irq_idx#2 ← (byte) 0
[23] (byte) irq_idx ← (byte) 0
to:table_driven_irq::@return
table_driven_irq::@return: scope:[table_driven_irq] from table_driven_irq::@5 table_driven_irq::@6
[25] (byte) irq_idx#3 ← phi( table_driven_irq::@5/(byte) irq_idx#1 table_driven_irq::@6/(byte) irq_idx#2 )
[26] return
[24] return
to:@return
table_driven_irq::@3: scope:[table_driven_irq] from table_driven_irq::@4
[27] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0
[25] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0
to:table_driven_irq::@1
table_driven_irq::@2: scope:[table_driven_irq] from table_driven_irq::@1
[28] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0
[26] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0
to:table_driven_irq::@1
VARIABLE REGISTER WEIGHTS
(byte) irq_idx
(byte) irq_idx#0 4.0
(byte) irq_idx#1 4.375
(byte) irq_idx#2 4.0
(byte) irq_idx#3 40.0
(byte) irq_idx#4 19.0
(byte) irq_idx loadstore 6.857142857142857
(void()) main()
interrupt(KERNEL_MIN)(void()) table_driven_irq()
(byte) table_driven_irq::idx
@@ -355,14 +313,14 @@ interrupt(KERNEL_MIN)(void()) table_driven_irq()
(byte) table_driven_irq::val#0 6.166666666666666
Initial phi equivalence classes
[ irq_idx#3 irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
Added variable irq_idx to live range equivalence class [ irq_idx ]
Added variable table_driven_irq::idx#0 to live range equivalence class [ table_driven_irq::idx#0 ]
Added variable table_driven_irq::val#0 to live range equivalence class [ table_driven_irq::val#0 ]
Complete equivalence classes
[ irq_idx#3 irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
[ irq_idx ]
[ table_driven_irq::idx#0 ]
[ table_driven_irq::val#0 ]
Allocated zp[1]:2 [ irq_idx#3 irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
Allocated zp[1]:2 [ irq_idx ]
Allocated zp[1]:3 [ table_driven_irq::idx#0 ]
Allocated zp[1]:4 [ table_driven_irq::val#0 ]
@@ -399,7 +357,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte) irq_idx#0 ← (byte) 0 -- vbuz1=vbuc1
// [1] (byte) irq_idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z irq_idx
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -457,127 +415,118 @@ table_driven_irq: {
.label idx = 3
.label val = 4
// entry interrupt(KERNEL_MIN)
// [15] phi from table_driven_irq table_driven_irq::@2 table_driven_irq::@3 to table_driven_irq::@1 [phi:table_driven_irq/table_driven_irq::@2/table_driven_irq::@3->table_driven_irq::@1]
__b1_from_table_driven_irq:
__b1_from___b2:
__b1_from___b3:
// [15] phi (byte) irq_idx#4 = (byte) irq_idx#0 [phi:table_driven_irq/table_driven_irq::@2/table_driven_irq::@3->table_driven_irq::@1#0] -- register_copy
jmp __b1
// table_driven_irq::@1
__b1:
// [16] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx#4) -- vbuz1=pbuc1_derefidx_vbuz2
// [15] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx) -- vbuz1=pbuc1_derefidx_vbuz2
ldy.z irq_idx
lda IRQ_CHANGE_IDX,y
sta.z idx
// [17] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx#4) -- vbuz1=pbuc1_derefidx_vbuz2
// [16] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx) -- vbuz1=pbuc1_derefidx_vbuz2
ldy.z irq_idx
lda IRQ_CHANGE_VAL,y
sta.z val
// [18] (byte) irq_idx#1 ← ++ (byte) irq_idx#4 -- vbuz1=_inc_vbuz1
// [17] (byte) irq_idx ← ++ (byte) irq_idx -- vbuz1=_inc_vbuz1
inc.z irq_idx
// [19] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE) goto table_driven_irq::@2 -- vbuz1_lt_vbuc1_then_la1
// [18] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE) goto table_driven_irq::@2 -- vbuz1_lt_vbuc1_then_la1
lda.z idx
cmp #VIC_SIZE
bcc __b2
jmp __b4
// table_driven_irq::@4
__b4:
// [20] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE+(byte) 8) goto table_driven_irq::@3 -- vbuz1_lt_vbuc1_then_la1
// [19] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE+(byte) 8) goto table_driven_irq::@3 -- vbuz1_lt_vbuc1_then_la1
lda.z idx
cmp #VIC_SIZE+8
bcc __b3
jmp __b5
// table_driven_irq::@5
__b5:
// [21] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// [20] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
lda #IRQ_RASTER
sta IRQ_STATUS
// [22] *((const byte*) RASTER) ← (byte) table_driven_irq::val#0 -- _deref_pbuc1=vbuz1
// [21] *((const byte*) RASTER) ← (byte) table_driven_irq::val#0 -- _deref_pbuc1=vbuz1
lda.z val
sta RASTER
// [23] if((byte) table_driven_irq::val#0>=*((const byte*) RASTER)) goto table_driven_irq::@return -- vbuz1_ge__deref_pbuc1_then_la1
// [22] if((byte) table_driven_irq::val#0>=*((const byte*) RASTER)) goto table_driven_irq::@return -- vbuz1_ge__deref_pbuc1_then_la1
lda RASTER
ldy.z val
sta.z $ff
cpy.z $ff
bcs __breturn_from___b5
bcs __breturn
jmp __b6
// table_driven_irq::@6
__b6:
// [24] (byte) irq_idx#2 ← (byte) 0 -- vbuz1=vbuc1
// [23] (byte) irq_idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z irq_idx
// [25] phi from table_driven_irq::@5 table_driven_irq::@6 to table_driven_irq::@return [phi:table_driven_irq::@5/table_driven_irq::@6->table_driven_irq::@return]
__breturn_from___b5:
__breturn_from___b6:
// [25] phi (byte) irq_idx#3 = (byte) irq_idx#1 [phi:table_driven_irq::@5/table_driven_irq::@6->table_driven_irq::@return#0] -- register_copy
jmp __breturn
// table_driven_irq::@return
__breturn:
// [26] return - exit interrupt(KERNEL_MIN)
// [24] return - exit interrupt(KERNEL_MIN)
jmp $ea81
// table_driven_irq::@3
__b3:
// [27] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 -- pbuc1_derefidx_vbuz1=vbuz2
// [25] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z val
ldy.z idx
sta SCREEN+-VIC_SIZE+$3f8,y
jmp __b1_from___b3
jmp __b1
// table_driven_irq::@2
__b2:
// [28] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 -- pbuc1_derefidx_vbuz1=vbuz2
// [26] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z val
ldy.z idx
sta VIC_BASE,y
jmp __b1_from___b2
jmp __b1
}
// File Data
IRQ_CHANGE_IDX: .byte $20, $21, IRQ_CHANGE_NEXT, $20, $21, IRQ_CHANGE_NEXT, $20, $21, IRQ_CHANGE_NEXT, $20, $21, IRQ_CHANGE_NEXT
IRQ_CHANGE_VAL: .byte $b, $b, $63, 0, 0, $80, 7, 7, $83, 0, 0, $60
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] (byte) irq_idx#0 ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [1] (byte) irq_idx ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [6] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [7] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [8] *((const byte*) RASTER) ← (byte) $60 [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [9] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [10] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [11] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) table_driven_irq() [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [16] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx#4) [ irq_idx#4 table_driven_irq::idx#0 ] ( [ irq_idx#4 table_driven_irq::idx#0 ] ) always clobbers reg byte y
Statement [17] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx#4) [ irq_idx#4 table_driven_irq::idx#0 table_driven_irq::val#0 ] ( [ irq_idx#4 table_driven_irq::idx#0 table_driven_irq::val#0 ] ) always clobbers reg byte y
Statement [15] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx) [ irq_idx table_driven_irq::idx#0 ] ( [ irq_idx table_driven_irq::idx#0 ] ) always clobbers reg byte y
Statement [16] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx) [ table_driven_irq::idx#0 table_driven_irq::val#0 ] ( [ table_driven_irq::idx#0 table_driven_irq::val#0 ] ) always clobbers reg byte y
Removing always clobbered register reg byte y as potential for zp[1]:3 [ table_driven_irq::idx#0 ]
Statement [21] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ irq_idx#1 table_driven_irq::val#0 ] ( [ irq_idx#1 table_driven_irq::val#0 ] ) always clobbers reg byte a
Statement [20] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ table_driven_irq::val#0 ] ( [ table_driven_irq::val#0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:4 [ table_driven_irq::val#0 ]
Statement [24] (byte) irq_idx#2 ← (byte) 0 [ irq_idx#2 ] ( [ irq_idx#2 ] ) always clobbers reg byte a
Statement [27] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $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 [28] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 [ irq_idx#1 ] ( [ irq_idx#1 ] ) always clobbers reg byte a
Statement [1] (byte) irq_idx#0 ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [23] (byte) irq_idx ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [25] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 [ irq_idx ] ( [ irq_idx ] ) always clobbers reg byte a
Statement [26] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 [ irq_idx ] ( [ irq_idx ] ) always clobbers reg byte a
Statement [1] (byte) irq_idx ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [6] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [7] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [8] *((const byte*) RASTER) ← (byte) $60 [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [9] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [10] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [11] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) table_driven_irq() [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [16] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx#4) [ irq_idx#4 table_driven_irq::idx#0 ] ( [ irq_idx#4 table_driven_irq::idx#0 ] ) always clobbers reg byte y
Statement [17] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx#4) [ irq_idx#4 table_driven_irq::idx#0 table_driven_irq::val#0 ] ( [ irq_idx#4 table_driven_irq::idx#0 table_driven_irq::val#0 ] ) always clobbers reg byte y
Statement [21] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ irq_idx#1 table_driven_irq::val#0 ] ( [ irq_idx#1 table_driven_irq::val#0 ] ) always clobbers reg byte a
Statement [24] (byte) irq_idx#2 ← (byte) 0 [ irq_idx#2 ] ( [ irq_idx#2 ] ) always clobbers reg byte a
Statement [27] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $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 [28] *((const byte*) VIC_BASE + (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[1]:2 [ irq_idx#3 irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ] : zp[1]:2 ,
Statement [15] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx) [ irq_idx table_driven_irq::idx#0 ] ( [ irq_idx table_driven_irq::idx#0 ] ) always clobbers reg byte y
Statement [16] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx) [ table_driven_irq::idx#0 table_driven_irq::val#0 ] ( [ table_driven_irq::idx#0 table_driven_irq::val#0 ] ) always clobbers reg byte y
Statement [20] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ table_driven_irq::val#0 ] ( [ table_driven_irq::val#0 ] ) always clobbers reg byte a
Statement [23] (byte) irq_idx ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [25] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 [ irq_idx ] ( [ irq_idx ] ) always clobbers reg byte a
Statement [26] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 [ irq_idx ] ( [ irq_idx ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ irq_idx ] : zp[1]:2 ,
Potential registers zp[1]:3 [ table_driven_irq::idx#0 ] : zp[1]:3 , reg byte a , reg byte x ,
Potential registers zp[1]:4 [ table_driven_irq::val#0 ] : zp[1]:4 , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 71.38: zp[1]:2 [ irq_idx#3 irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
Uplift Scope [table_driven_irq] 11: zp[1]:3 [ table_driven_irq::idx#0 ] 6.17: zp[1]:4 [ table_driven_irq::val#0 ]
Uplift Scope [] 6.86: zp[1]:2 [ irq_idx ]
Uplift Scope [main]
Uplifting [] best 928 combination zp[1]:2 [ irq_idx#3 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 [] best 762 combination zp[1]:2 [ irq_idx ]
Uplifting [main] best 762 combination
Attempting to uplift remaining variables inzp[1]:2 [ irq_idx#3 irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
Uplifting [] best 762 combination zp[1]:2 [ irq_idx#3 irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
Attempting to uplift remaining variables inzp[1]:2 [ irq_idx ]
Uplifting [] best 762 combination zp[1]:2 [ irq_idx ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -611,7 +560,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (byte) irq_idx#0 ← (byte) 0 -- vbuz1=vbuc1
// [1] (byte) irq_idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z irq_idx
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -667,73 +616,64 @@ main: {
// table_driven_irq
table_driven_irq: {
// entry interrupt(KERNEL_MIN)
// [15] phi from table_driven_irq table_driven_irq::@2 table_driven_irq::@3 to table_driven_irq::@1 [phi:table_driven_irq/table_driven_irq::@2/table_driven_irq::@3->table_driven_irq::@1]
__b1_from_table_driven_irq:
__b1_from___b2:
__b1_from___b3:
// [15] phi (byte) irq_idx#4 = (byte) irq_idx#0 [phi:table_driven_irq/table_driven_irq::@2/table_driven_irq::@3->table_driven_irq::@1#0] -- register_copy
jmp __b1
// table_driven_irq::@1
__b1:
// [16] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx#4) -- vbuaa=pbuc1_derefidx_vbuz1
// [15] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx) -- vbuaa=pbuc1_derefidx_vbuz1
ldy.z irq_idx
lda IRQ_CHANGE_IDX,y
// [17] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx#4) -- vbuxx=pbuc1_derefidx_vbuz1
// [16] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx) -- vbuxx=pbuc1_derefidx_vbuz1
ldy.z irq_idx
ldx IRQ_CHANGE_VAL,y
// [18] (byte) irq_idx#1 ← ++ (byte) irq_idx#4 -- vbuz1=_inc_vbuz1
// [17] (byte) irq_idx ← ++ (byte) irq_idx -- vbuz1=_inc_vbuz1
inc.z irq_idx
// [19] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE) goto table_driven_irq::@2 -- vbuaa_lt_vbuc1_then_la1
// [18] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE) goto table_driven_irq::@2 -- vbuaa_lt_vbuc1_then_la1
cmp #VIC_SIZE
bcc __b2
jmp __b4
// table_driven_irq::@4
__b4:
// [20] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE+(byte) 8) goto table_driven_irq::@3 -- vbuaa_lt_vbuc1_then_la1
// [19] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE+(byte) 8) goto table_driven_irq::@3 -- vbuaa_lt_vbuc1_then_la1
cmp #VIC_SIZE+8
bcc __b3
jmp __b5
// table_driven_irq::@5
__b5:
// [21] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// [20] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
lda #IRQ_RASTER
sta IRQ_STATUS
// [22] *((const byte*) RASTER) ← (byte) table_driven_irq::val#0 -- _deref_pbuc1=vbuxx
// [21] *((const byte*) RASTER) ← (byte) table_driven_irq::val#0 -- _deref_pbuc1=vbuxx
stx RASTER
// [23] if((byte) table_driven_irq::val#0>=*((const byte*) RASTER)) goto table_driven_irq::@return -- vbuxx_ge__deref_pbuc1_then_la1
// [22] if((byte) table_driven_irq::val#0>=*((const byte*) RASTER)) goto table_driven_irq::@return -- vbuxx_ge__deref_pbuc1_then_la1
ldy RASTER
sty.z $ff
cpx.z $ff
bcs __breturn_from___b5
bcs __breturn
jmp __b6
// table_driven_irq::@6
__b6:
// [24] (byte) irq_idx#2 ← (byte) 0 -- vbuz1=vbuc1
// [23] (byte) irq_idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z irq_idx
// [25] phi from table_driven_irq::@5 table_driven_irq::@6 to table_driven_irq::@return [phi:table_driven_irq::@5/table_driven_irq::@6->table_driven_irq::@return]
__breturn_from___b5:
__breturn_from___b6:
// [25] phi (byte) irq_idx#3 = (byte) irq_idx#1 [phi:table_driven_irq::@5/table_driven_irq::@6->table_driven_irq::@return#0] -- register_copy
jmp __breturn
// table_driven_irq::@return
__breturn:
// [26] return - exit interrupt(KERNEL_MIN)
// [24] return - exit interrupt(KERNEL_MIN)
jmp $ea81
// table_driven_irq::@3
__b3:
// [27] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 -- pbuc1_derefidx_vbuaa=vbuxx
// [25] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 -- pbuc1_derefidx_vbuaa=vbuxx
tay
txa
sta SCREEN+-VIC_SIZE+$3f8,y
jmp __b1_from___b3
jmp __b1
// table_driven_irq::@2
__b2:
// [28] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 -- pbuc1_derefidx_vbuaa=vbuxx
// [26] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 -- pbuc1_derefidx_vbuaa=vbuxx
tay
txa
sta VIC_BASE,y
jmp __b1_from___b2
jmp __b1
}
// File Data
IRQ_CHANGE_IDX: .byte $20, $21, IRQ_CHANGE_NEXT, $20, $21, IRQ_CHANGE_NEXT, $20, $21, IRQ_CHANGE_NEXT, $20, $21, IRQ_CHANGE_NEXT
@@ -754,17 +694,9 @@ Removing instruction lda #IRQ_RASTER
Removing instruction ldy.z irq_idx
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __bbegin with __b1
Replacing label __breturn_from___b5 with __breturn
Replacing label __b1_from___b3 with __b1
Replacing label __b1_from___b2 with __b1
Removing instruction __bbegin:
Removing instruction __b2_from___b1:
Removing instruction __bend_from___b2:
Removing instruction __b1_from_table_driven_irq:
Removing instruction __b1_from___b2:
Removing instruction __b1_from___b3:
Removing instruction __breturn_from___b5:
Removing instruction __breturn_from___b6:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b2:
Removing instruction __bend:
@@ -800,12 +732,7 @@ FINAL SYMBOL TABLE
(const byte*) VIC_BASE = (byte*) 53248
(const byte*) VIC_CONTROL = (byte*) 53265
(const byte) VIC_SIZE = (number) $30
(byte) irq_idx
(byte) irq_idx#0 irq_idx zp[1]:2 4.0
(byte) irq_idx#1 irq_idx zp[1]:2 4.375
(byte) irq_idx#2 irq_idx zp[1]:2 4.0
(byte) irq_idx#3 irq_idx zp[1]:2 40.0
(byte) irq_idx#4 irq_idx zp[1]:2 19.0
(byte) irq_idx loadstore zp[1]:2 6.857142857142857
(void()) main()
(label) main::@return
interrupt(KERNEL_MIN)(void()) table_driven_irq()
@@ -821,7 +748,7 @@ interrupt(KERNEL_MIN)(void()) table_driven_irq()
(byte) table_driven_irq::val
(byte) table_driven_irq::val#0 reg byte x 6.166666666666666
zp[1]:2 [ irq_idx#3 irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
zp[1]:2 [ irq_idx ]
reg byte a [ table_driven_irq::idx#0 ]
reg byte x [ table_driven_irq::val#0 ]
@@ -859,7 +786,7 @@ Score: 604
// @1
__b1:
// irq_idx = 0
// [1] (byte) irq_idx#0 ← (byte) 0 -- vbuz1=vbuc1
// [1] (byte) irq_idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z irq_idx
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -916,39 +843,37 @@ main: {
// table_driven_irq
table_driven_irq: {
// entry interrupt(KERNEL_MIN)
// [15] phi from table_driven_irq table_driven_irq::@2 table_driven_irq::@3 to table_driven_irq::@1 [phi:table_driven_irq/table_driven_irq::@2/table_driven_irq::@3->table_driven_irq::@1]
// [15] phi (byte) irq_idx#4 = (byte) irq_idx#0 [phi:table_driven_irq/table_driven_irq::@2/table_driven_irq::@3->table_driven_irq::@1#0] -- register_copy
// table_driven_irq::@1
__b1:
// idx = IRQ_CHANGE_IDX[irq_idx]
// [16] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx#4) -- vbuaa=pbuc1_derefidx_vbuz1
// [15] (byte) table_driven_irq::idx#0 ← *((const byte*) IRQ_CHANGE_IDX + (byte) irq_idx) -- vbuaa=pbuc1_derefidx_vbuz1
ldy.z irq_idx
lda IRQ_CHANGE_IDX,y
// val = IRQ_CHANGE_VAL[irq_idx]
// [17] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx#4) -- vbuxx=pbuc1_derefidx_vbuz1
// [16] (byte) table_driven_irq::val#0 ← *((const byte*) IRQ_CHANGE_VAL + (byte) irq_idx) -- vbuxx=pbuc1_derefidx_vbuz1
ldx IRQ_CHANGE_VAL,y
// irq_idx++;
// [18] (byte) irq_idx#1 ← ++ (byte) irq_idx#4 -- vbuz1=_inc_vbuz1
// [17] (byte) irq_idx ← ++ (byte) irq_idx -- vbuz1=_inc_vbuz1
inc.z irq_idx
// if (idx < VIC_SIZE)
// [19] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE) goto table_driven_irq::@2 -- vbuaa_lt_vbuc1_then_la1
// [18] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE) goto table_driven_irq::@2 -- vbuaa_lt_vbuc1_then_la1
cmp #VIC_SIZE
bcc __b2
// table_driven_irq::@4
// if (idx < VIC_SIZE + 8)
// [20] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE+(byte) 8) goto table_driven_irq::@3 -- vbuaa_lt_vbuc1_then_la1
// [19] if((byte) table_driven_irq::idx#0<(const byte) VIC_SIZE+(byte) 8) goto table_driven_irq::@3 -- vbuaa_lt_vbuc1_then_la1
cmp #VIC_SIZE+8
bcc __b3
// table_driven_irq::@5
// *IRQ_STATUS = IRQ_RASTER
// [21] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// [20] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
lda #IRQ_RASTER
sta IRQ_STATUS
// *RASTER = val
// [22] *((const byte*) RASTER) ← (byte) table_driven_irq::val#0 -- _deref_pbuc1=vbuxx
// [21] *((const byte*) RASTER) ← (byte) table_driven_irq::val#0 -- _deref_pbuc1=vbuxx
stx RASTER
// if (val < *RASTER)
// [23] if((byte) table_driven_irq::val#0>=*((const byte*) RASTER)) goto table_driven_irq::@return -- vbuxx_ge__deref_pbuc1_then_la1
// [22] if((byte) table_driven_irq::val#0>=*((const byte*) RASTER)) goto table_driven_irq::@return -- vbuxx_ge__deref_pbuc1_then_la1
ldy RASTER
sty.z $ff
cpx.z $ff
@@ -957,19 +882,17 @@ table_driven_irq: {
!__ea81:
// table_driven_irq::@6
// irq_idx = 0
// [24] (byte) irq_idx#2 ← (byte) 0 -- vbuz1=vbuc1
// [23] (byte) irq_idx ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z irq_idx
// [25] phi from table_driven_irq::@5 table_driven_irq::@6 to table_driven_irq::@return [phi:table_driven_irq::@5/table_driven_irq::@6->table_driven_irq::@return]
// [25] phi (byte) irq_idx#3 = (byte) irq_idx#1 [phi:table_driven_irq::@5/table_driven_irq::@6->table_driven_irq::@return#0] -- register_copy
// table_driven_irq::@return
// }
// [26] return - exit interrupt(KERNEL_MIN)
// [24] return - exit interrupt(KERNEL_MIN)
jmp $ea81
// table_driven_irq::@3
__b3:
// SCREEN[idx + $3f8 - VIC_SIZE] = val
// [27] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 -- pbuc1_derefidx_vbuaa=vbuxx
// [25] *((const byte*) SCREEN+-(const byte) VIC_SIZE+(word) $3f8 + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 -- pbuc1_derefidx_vbuaa=vbuxx
tay
txa
sta SCREEN+-VIC_SIZE+$3f8,y
@@ -977,7 +900,7 @@ table_driven_irq: {
// table_driven_irq::@2
__b2:
// VIC_BASE[idx] = val
// [28] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 -- pbuc1_derefidx_vbuaa=vbuxx
// [26] *((const byte*) VIC_BASE + (byte) table_driven_irq::idx#0) ← (byte) table_driven_irq::val#0 -- pbuc1_derefidx_vbuaa=vbuxx
tay
txa
sta VIC_BASE,y
+2 -7
View File
@@ -16,12 +16,7 @@
(const byte*) VIC_BASE = (byte*) 53248
(const byte*) VIC_CONTROL = (byte*) 53265
(const byte) VIC_SIZE = (number) $30
(byte) irq_idx
(byte) irq_idx#0 irq_idx zp[1]:2 4.0
(byte) irq_idx#1 irq_idx zp[1]:2 4.375
(byte) irq_idx#2 irq_idx zp[1]:2 4.0
(byte) irq_idx#3 irq_idx zp[1]:2 40.0
(byte) irq_idx#4 irq_idx zp[1]:2 19.0
(byte) irq_idx loadstore zp[1]:2 6.857142857142857
(void()) main()
(label) main::@return
interrupt(KERNEL_MIN)(void()) table_driven_irq()
@@ -37,6 +32,6 @@ interrupt(KERNEL_MIN)(void()) table_driven_irq()
(byte) table_driven_irq::val
(byte) table_driven_irq::val#0 reg byte x 6.166666666666666
zp[1]:2 [ irq_idx#3 irq_idx#4 irq_idx#0 irq_idx#1 irq_idx#2 ]
zp[1]:2 [ irq_idx ]
reg byte a [ table_driven_irq::idx#0 ]
reg byte x [ table_driven_irq::val#0 ]
+3 -3
View File
@@ -38,13 +38,13 @@ main: {
lda #>irq
sta KERNEL_IRQ+1
cli
__b2:
__b1:
lda RASTER
cmp #$14
bcs __b2
bcs __b1
lda #1
sta.z framedone
jmp __b2
jmp __b1
}
irq: {
inc BGCOL
+10 -14
View File
@@ -2,7 +2,7 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (bool) framedone#11 ← false
[1] (bool) framedone ← false
to:@2
@2: scope:[] from @1
[2] phi()
@@ -21,29 +21,25 @@ main: scope:[main] from @2
[10] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
asm { cli }
to:main::@1
main::@1: scope:[main] from main main::@2 main::@3
[12] (bool) framedone#1 ← phi( main/(bool) framedone#11 main::@2/(bool) framedone#1 main::@3/(bool) framedone#0 )
main::@1: scope:[main] from main main::@1 main::@2
[12] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
[13] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1
to:main::@3
main::@3: scope:[main] from main::@2
[14] (bool) framedone#0 ← true
[13] (bool) framedone ← true
to:main::@1
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
[15] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
[16] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[17] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1
[14] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
[15] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[16] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1
to:irq::@2
irq::@2: scope:[irq] from irq
[18] (bool) framedone#3 ← false
[17] (bool) framedone ← false
to:irq::@1
irq::@1: scope:[irq] from irq irq::@2
[19] (bool) framedone#10 ← phi( irq/(bool) framedone#11 irq::@2/(bool) framedone#3 )
[20] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL)
[18] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL)
to:irq::@return
irq::@return: scope:[irq] from irq::@1
[21] return
[19] return
to:@return
+92 -188
View File
@@ -12,7 +12,6 @@ CONTROL FLOW GRAPH SSA
(void()) main()
main: scope:[main] from @2
(bool) framedone#12 ← phi( @2/(bool) framedone#11 )
asm { sei }
*((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR
*((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (number) $7f
@@ -22,30 +21,25 @@ main: scope:[main] from @2
asm { cli }
to:main::@1
main::@1: scope:[main] from main main::@2 main::@7
(bool) framedone#9 ← phi( main/(bool) framedone#12 main::@2/(bool) framedone#13 main::@7/(bool) framedone#0 )
if(true) goto main::@2
to:main::@return
main::@2: scope:[main] from main::@1
(bool) framedone#13 ← phi( main::@1/(bool) framedone#9 )
(bool~) main::$0 ← *((const byte*) RASTER) < (number) $14
(bool~) main::$1 ← ! (bool~) main::$0
if((bool~) main::$1) goto main::@1
to:main::@7
main::@7: scope:[main] from main::@2
(bool) framedone#0 ← true
(bool) framedone ← true
to:main::@1
main::@return: scope:[main] from main::@1
(bool) framedone#6 ← phi( main::@1/(bool) framedone#9 )
(bool) framedone#1 ← (bool) framedone#6
return
to:@return
@1: scope:[] from @begin
(bool) framedone#2 ← false
(bool) framedone ← false
to:@2
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
(bool) framedone#14 ← phi( @2/(bool) framedone#11 )
*((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
*((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
(bool~) irq::$1 ← *((const byte*) RASTER) > (number) $32
@@ -53,24 +47,18 @@ irq: scope:[irq] from
if((bool~) irq::$2) goto irq::@1
to:irq::@2
irq::@1: scope:[irq] from irq irq::@2
(bool) framedone#10 ← phi( irq/(bool) framedone#14 irq::@2/(bool) framedone#3 )
*((const byte*) BGCOL) ← -- *((const byte*) BGCOL)
to:irq::@return
irq::@2: scope:[irq] from irq
(bool) framedone#3 ← false
(bool) framedone ← false
to:irq::@1
irq::@return: scope:[irq] from irq::@1
(bool) framedone#7 ← phi( irq::@1/(bool) framedone#10 )
(bool) framedone#4 ← (bool) framedone#7
return
to:@return
@2: scope:[] from @1
(bool) framedone#11 ← phi( @1/(bool) framedone#2 )
call main
to:@3
@3: scope:[] from @2
(bool) framedone#8 ← phi( @2/(bool) framedone#1 )
(bool) framedone#5 ← (bool) framedone#8
to:@end
@end: scope:[] from @3
@@ -89,22 +77,7 @@ SYMBOL TABLE SSA
(const void()**) KERNEL_IRQ = (void()**)(number) $314
(const byte*) RASTER = (byte*)(number) $d012
(const byte*) VIC_CONTROL = (byte*)(number) $d011
(bool) framedone
(bool) framedone#0
(bool) framedone#1
(bool) framedone#10
(bool) framedone#11
(bool) framedone#12
(bool) framedone#13
(bool) framedone#14
(bool) framedone#2
(bool) framedone#3
(bool) framedone#4
(bool) framedone#5
(bool) framedone#6
(bool) framedone#7
(bool) framedone#8
(bool) framedone#9
(bool) framedone loadstore
interrupt(KERNEL_MIN)(void()) irq()
(bool~) irq::$1
(bool~) irq::$2
@@ -143,24 +116,15 @@ Finalized unsigned number type (byte) $fd
Finalized unsigned number type (byte) $14
Finalized unsigned number type (byte) $32
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inversing boolean not [12] (bool~) main::$1 ← *((const byte*) RASTER) >= (byte) $14 from [11] (bool~) main::$0 ← *((const byte*) RASTER) < (byte) $14
Inversing boolean not [23] (bool~) irq::$2 ← *((const byte*) RASTER) <= (byte) $32 from [22] (bool~) irq::$1 ← *((const byte*) RASTER) > (byte) $32
Inversing boolean not [9] (bool~) main::$1 ← *((const byte*) RASTER) >= (byte) $14 from [8] (bool~) main::$0 ← *((const byte*) RASTER) < (byte) $14
Inversing boolean not [17] (bool~) irq::$2 ← *((const byte*) RASTER) <= (byte) $32 from [16] (bool~) irq::$1 ← *((const byte*) RASTER) > (byte) $32
Successful SSA optimization Pass2UnaryNotSimplification
Alias (bool) framedone#1 = (bool) framedone#13 (bool) framedone#9 (bool) framedone#6
Alias (bool) framedone#10 = (bool) framedone#7 (bool) framedone#4
Alias (bool) framedone#11 = (bool) framedone#2
Alias (bool) framedone#5 = (bool) framedone#8
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (bool) framedone#12 (bool) framedone#11
Identical Phi Values (bool) framedone#14 (bool) framedone#11
Identical Phi Values (bool) framedone#5 (bool) framedone#1
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$1 [13] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1
Simple Condition (bool~) irq::$2 [24] if(*((const byte*) RASTER)<=(byte) $32) goto irq::@1
Simple Condition (bool~) main::$1 [10] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1
Simple Condition (bool~) irq::$2 [18] if(*((const byte*) RASTER)<=(byte) $32) goto irq::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
if() condition always true - replacing block destination [9] if(true) goto main::@2
if() condition always true - replacing block destination [7] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Rewriting conditional comparison [24] if(*((const byte*) RASTER)<=(byte) $32) goto irq::@1
Rewriting conditional comparison [18] if(*((const byte*) RASTER)<=(byte) $32) goto irq::@1
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Adding number conversion cast (unumber) $32+1 in if(*((const byte*) RASTER)<(byte) $32+(number) 1) goto irq::@1
@@ -171,26 +135,20 @@ Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting main::@9(between main::@2 and main::@1)
Added new block during phi lifting irq::@3(between irq and irq::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@1
CALL GRAPH
Calls in [] to main:3
Created 2 initial phi equivalence classes
Coalesced [13] framedone#15 ← framedone#11
Coalesced [17] framedone#17 ← framedone#0
Coalesced (already) [18] framedone#16 ← framedone#1
Coalesced [23] framedone#19 ← framedone#3
Coalesced [27] framedone#18 ← framedone#11
Coalesced down to 1 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@9
Culled Empty Block (label) irq::@3
Renumbering block main::@7 to main::@3
Culled Empty Block (label) main::@1
Renumbering block main::@2 to main::@1
Renumbering block main::@7 to main::@2
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
@@ -200,7 +158,7 @@ FINAL CONTROL FLOW GRAPH
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (bool) framedone#11 ← false
[1] (bool) framedone ← false
to:@2
@2: scope:[] from @1
[2] phi()
@@ -219,49 +177,40 @@ main: scope:[main] from @2
[10] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
asm { cli }
to:main::@1
main::@1: scope:[main] from main main::@2 main::@3
[12] (bool) framedone#1 ← phi( main/(bool) framedone#11 main::@2/(bool) framedone#1 main::@3/(bool) framedone#0 )
main::@1: scope:[main] from main main::@1 main::@2
[12] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
[13] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1
to:main::@3
main::@3: scope:[main] from main::@2
[14] (bool) framedone#0 ← true
[13] (bool) framedone ← true
to:main::@1
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
[15] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
[16] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[17] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1
[14] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL)
[15] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[16] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1
to:irq::@2
irq::@2: scope:[irq] from irq
[18] (bool) framedone#3 ← false
[17] (bool) framedone ← false
to:irq::@1
irq::@1: scope:[irq] from irq irq::@2
[19] (bool) framedone#10 ← phi( irq/(bool) framedone#11 irq::@2/(bool) framedone#3 )
[20] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL)
[18] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL)
to:irq::@return
irq::@return: scope:[irq] from irq::@1
[21] return
[19] return
to:@return
VARIABLE REGISTER WEIGHTS
(bool) framedone
(bool) framedone#0 22.0
(bool) framedone#1 107.5
(bool) framedone#10 40.0
(bool) framedone#11 0.5
(bool) framedone#3 4.0
(bool) framedone loadstore 150.0
interrupt(KERNEL_MIN)(void()) irq()
(void()) main()
Initial phi equivalence classes
[ framedone#10 framedone#1 framedone#11 framedone#0 framedone#3 ]
Added variable framedone to live range equivalence class [ framedone ]
Complete equivalence classes
[ framedone#10 framedone#1 framedone#11 framedone#0 framedone#3 ]
Allocated zp[1]:2 [ framedone#10 framedone#1 framedone#11 framedone#0 framedone#3 ]
[ framedone ]
Allocated zp[1]:2 [ framedone ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -288,7 +237,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (bool) framedone#11 ← false -- vboz1=vboc1
// [1] (bool) framedone ← false -- vboz1=vboc1
lda #0
sta.z framedone
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -331,88 +280,76 @@ main: {
sta KERNEL_IRQ+1
// asm { cli }
cli
// [12] phi from main main::@2 main::@3 to main::@1 [phi:main/main::@2/main::@3->main::@1]
__b1_from_main:
__b1_from___b2:
__b1_from___b3:
// [12] phi (bool) framedone#1 = (bool) framedone#11 [phi:main/main::@2/main::@3->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [12] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 -- _deref_pbuc1_ge_vbuc2_then_la1
lda RASTER
cmp #$14
bcs __b1
jmp __b2
// main::@2
__b2:
// [13] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 -- _deref_pbuc1_ge_vbuc2_then_la1
lda RASTER
cmp #$14
bcs __b1_from___b2
jmp __b3
// main::@3
__b3:
// [14] (bool) framedone#0 ← true -- vboz1=vboc1
// [13] (bool) framedone ← true -- vboz1=vboc1
lda #1
sta.z framedone
jmp __b1_from___b3
jmp __b1
}
// irq
irq: {
// entry interrupt(KERNEL_MIN)
// [15] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
// [14] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
// [16] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// [15] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
lda #IRQ_RASTER
sta IRQ_STATUS
// [17] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 -- _deref_pbuc1_lt_vbuc2_then_la1
// [16] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 -- _deref_pbuc1_lt_vbuc2_then_la1
lda RASTER
cmp #$32+1
bcc __b1_from_irq
bcc __b1
jmp __b2
// irq::@2
__b2:
// [18] (bool) framedone#3 ← false -- vboz1=vboc1
// [17] (bool) framedone ← false -- vboz1=vboc1
lda #0
sta.z framedone
// [19] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
__b1_from_irq:
__b1_from___b2:
// [19] phi (bool) framedone#10 = (bool) framedone#11 [phi:irq/irq::@2->irq::@1#0] -- register_copy
jmp __b1
// irq::@1
__b1:
// [20] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1
// [18] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1
dec BGCOL
jmp __breturn
// irq::@return
__breturn:
// [21] return - exit interrupt(KERNEL_MIN)
// [19] return - exit interrupt(KERNEL_MIN)
jmp $ea81
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] (bool) framedone#11 ← false [ framedone#11 ] ( [ framedone#11 ] ) always clobbers reg byte a
Statement [6] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [ framedone#11 ] ( main:3 [ framedone#11 ] ) always clobbers reg byte a
Statement [7] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f [ framedone#11 ] ( main:3 [ framedone#11 ] ) always clobbers reg byte a
Statement [8] *((const byte*) RASTER) ← (byte) $fd [ framedone#11 ] ( main:3 [ framedone#11 ] ) always clobbers reg byte a
Statement [9] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER [ framedone#11 ] ( main:3 [ framedone#11 ] ) always clobbers reg byte a
Statement [10] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ framedone#11 ] ( main:3 [ framedone#11 ] ) always clobbers reg byte a
Statement [13] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 [ framedone#1 ] ( main:3 [ framedone#1 ] ) always clobbers reg byte a
Statement [14] (bool) framedone#0 ← true [ framedone#0 ] ( main:3 [ framedone#0 ] ) always clobbers reg byte a
Statement [16] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ framedone#11 ] ( [ framedone#11 ] ) always clobbers reg byte a
Statement [17] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 [ framedone#11 ] ( [ framedone#11 ] ) always clobbers reg byte a
Statement [18] (bool) framedone#3 ← false [ framedone#3 ] ( [ framedone#3 ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ framedone#10 framedone#1 framedone#11 framedone#0 framedone#3 ] : zp[1]:2 ,
Statement [1] (bool) framedone ← false [ ] ( [ ] ) always clobbers reg byte a
Statement [6] *((const byte*) CIA1_INTERRUPT) ← (const byte) CIA_INTERRUPT_CLEAR [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [7] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [8] *((const byte*) RASTER) ← (byte) $fd [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [9] *((const byte*) IRQ_ENABLE) ← (const byte) IRQ_RASTER [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [10] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [12] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [13] (bool) framedone ← true [ ] ( main:3 [ ] ) always clobbers reg byte a
Statement [15] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER [ ] ( [ ] ) always clobbers reg byte a
Statement [16] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 [ ] ( [ ] ) always clobbers reg byte a
Statement [17] (bool) framedone ← false [ ] ( [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ framedone ] : zp[1]:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 174: zp[1]:2 [ framedone#10 framedone#1 framedone#11 framedone#0 framedone#3 ]
Uplift Scope [] 150: zp[1]:2 [ framedone ]
Uplift Scope [main]
Uplift Scope [irq]
Uplifting [] best 1694 combination zp[1]:2 [ framedone#10 framedone#1 framedone#11 framedone#0 framedone#3 ]
Uplifting [main] best 1694 combination
Uplifting [irq] best 1694 combination
Attempting to uplift remaining variables inzp[1]:2 [ framedone#10 framedone#1 framedone#11 framedone#0 framedone#3 ]
Uplifting [] best 1694 combination zp[1]:2 [ framedone#10 framedone#1 framedone#11 framedone#0 framedone#3 ]
Uplifting [] best 1367 combination zp[1]:2 [ framedone ]
Uplifting [main] best 1367 combination
Uplifting [irq] best 1367 combination
Attempting to uplift remaining variables inzp[1]:2 [ framedone ]
Uplifting [] best 1367 combination zp[1]:2 [ framedone ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -438,7 +375,7 @@ __bbegin:
jmp __b1
// @1
__b1:
// [1] (bool) framedone#11 ← false -- vboz1=vboc1
// [1] (bool) framedone ← false -- vboz1=vboc1
lda #0
sta.z framedone
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -481,60 +418,48 @@ main: {
sta KERNEL_IRQ+1
// asm { cli }
cli
// [12] phi from main main::@2 main::@3 to main::@1 [phi:main/main::@2/main::@3->main::@1]
__b1_from_main:
__b1_from___b2:
__b1_from___b3:
// [12] phi (bool) framedone#1 = (bool) framedone#11 [phi:main/main::@2/main::@3->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [12] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 -- _deref_pbuc1_ge_vbuc2_then_la1
lda RASTER
cmp #$14
bcs __b1
jmp __b2
// main::@2
__b2:
// [13] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 -- _deref_pbuc1_ge_vbuc2_then_la1
lda RASTER
cmp #$14
bcs __b1_from___b2
jmp __b3
// main::@3
__b3:
// [14] (bool) framedone#0 ← true -- vboz1=vboc1
// [13] (bool) framedone ← true -- vboz1=vboc1
lda #1
sta.z framedone
jmp __b1_from___b3
jmp __b1
}
// irq
irq: {
// entry interrupt(KERNEL_MIN)
// [15] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
// [14] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
// [16] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// [15] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
lda #IRQ_RASTER
sta IRQ_STATUS
// [17] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 -- _deref_pbuc1_lt_vbuc2_then_la1
// [16] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 -- _deref_pbuc1_lt_vbuc2_then_la1
lda RASTER
cmp #$32+1
bcc __b1_from_irq
bcc __b1
jmp __b2
// irq::@2
__b2:
// [18] (bool) framedone#3 ← false -- vboz1=vboc1
// [17] (bool) framedone ← false -- vboz1=vboc1
lda #0
sta.z framedone
// [19] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
__b1_from_irq:
__b1_from___b2:
// [19] phi (bool) framedone#10 = (bool) framedone#11 [phi:irq/irq::@2->irq::@1#0] -- register_copy
jmp __b1
// irq::@1
__b1:
// [20] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1
// [18] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1
dec BGCOL
jmp __breturn
// irq::@return
__breturn:
// [21] return - exit interrupt(KERNEL_MIN)
// [19] return - exit interrupt(KERNEL_MIN)
jmp $ea81
}
// File Data
@@ -545,28 +470,18 @@ Removing instruction jmp __b2
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp __b2
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Replacing label __b1_from___b2 with __b2
Replacing label __b1_from___b3 with __b2
Replacing label __b1_from_irq with __b1
Removing instruction __bbegin:
Removing instruction __b2_from___b1:
Removing instruction __bend_from___b2:
Removing instruction __b1_from_main:
Removing instruction __b1_from___b2:
Removing instruction __b1_from___b3:
Removing instruction __b1:
Removing instruction __b1_from_irq:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b2:
Removing instruction __bend:
Removing instruction __b3:
Removing instruction __b2:
Removing instruction __b2:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
@@ -587,12 +502,7 @@ FINAL SYMBOL TABLE
(const void()**) KERNEL_IRQ = (void()**) 788
(const byte*) RASTER = (byte*) 53266
(const byte*) VIC_CONTROL = (byte*) 53265
(bool) framedone
(bool) framedone#0 framedone zp[1]:2 22.0
(bool) framedone#1 framedone zp[1]:2 107.5
(bool) framedone#10 framedone zp[1]:2 40.0
(bool) framedone#11 framedone zp[1]:2 0.5
(bool) framedone#3 framedone zp[1]:2 4.0
(bool) framedone loadstore zp[1]:2 150.0
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@1
(label) irq::@2
@@ -600,9 +510,8 @@ interrupt(KERNEL_MIN)(void()) irq()
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
zp[1]:2 [ framedone#10 framedone#1 framedone#11 framedone#0 framedone#3 ]
zp[1]:2 [ framedone ]
FINAL ASSEMBLER
@@ -630,7 +539,7 @@ Score: 1025
// @1
__b1:
// framedone = false
// [1] (bool) framedone#11 ← false -- vboz1=vboc1
// [1] (bool) framedone ← false -- vboz1=vboc1
lda #0
sta.z framedone
// [2] phi from @1 to @2 [phi:@1->@2]
@@ -675,53 +584,48 @@ main: {
// asm
// asm { cli }
cli
// [12] phi from main main::@2 main::@3 to main::@1 [phi:main/main::@2/main::@3->main::@1]
// [12] phi (bool) framedone#1 = (bool) framedone#11 [phi:main/main::@2/main::@3->main::@1#0] -- register_copy
// main::@1
// main::@2
__b2:
__b1:
// if(*RASTER<20)
// [13] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 -- _deref_pbuc1_ge_vbuc2_then_la1
// [12] if(*((const byte*) RASTER)>=(byte) $14) goto main::@1 -- _deref_pbuc1_ge_vbuc2_then_la1
lda RASTER
cmp #$14
bcs __b2
// main::@3
bcs __b1
// main::@2
// framedone = true
// [14] (bool) framedone#0 ← true -- vboz1=vboc1
// [13] (bool) framedone ← true -- vboz1=vboc1
lda #1
sta.z framedone
jmp __b2
jmp __b1
}
// irq
irq: {
// entry interrupt(KERNEL_MIN)
// (*BGCOL)++;
// [15] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
// [14] *((const byte*) BGCOL) ← ++ *((const byte*) BGCOL) -- _deref_pbuc1=_inc__deref_pbuc1
inc BGCOL
// *IRQ_STATUS = IRQ_RASTER
// [16] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
// [15] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER -- _deref_pbuc1=vbuc2
lda #IRQ_RASTER
sta IRQ_STATUS
// if (*RASTER>50)
// [17] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 -- _deref_pbuc1_lt_vbuc2_then_la1
// [16] if(*((const byte*) RASTER)<(byte) $32+(byte) 1) goto irq::@1 -- _deref_pbuc1_lt_vbuc2_then_la1
lda RASTER
cmp #$32+1
bcc __b1
// irq::@2
// framedone = false
// [18] (bool) framedone#3 ← false -- vboz1=vboc1
// [17] (bool) framedone ← false -- vboz1=vboc1
lda #0
sta.z framedone
// [19] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
// [19] phi (bool) framedone#10 = (bool) framedone#11 [phi:irq/irq::@2->irq::@1#0] -- register_copy
// irq::@1
__b1:
// (*BGCOL)--;
// [20] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1
// [18] *((const byte*) BGCOL) ← -- *((const byte*) BGCOL) -- _deref_pbuc1=_dec__deref_pbuc1
dec BGCOL
// irq::@return
// }
// [21] return - exit interrupt(KERNEL_MIN)
// [19] return - exit interrupt(KERNEL_MIN)
jmp $ea81
}
// File Data
+2 -8
View File
@@ -11,12 +11,7 @@
(const void()**) KERNEL_IRQ = (void()**) 788
(const byte*) RASTER = (byte*) 53266
(const byte*) VIC_CONTROL = (byte*) 53265
(bool) framedone
(bool) framedone#0 framedone zp[1]:2 22.0
(bool) framedone#1 framedone zp[1]:2 107.5
(bool) framedone#10 framedone zp[1]:2 40.0
(bool) framedone#11 framedone zp[1]:2 0.5
(bool) framedone#3 framedone zp[1]:2 4.0
(bool) framedone loadstore zp[1]:2 150.0
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@1
(label) irq::@2
@@ -24,6 +19,5 @@ interrupt(KERNEL_MIN)(void()) irq()
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
zp[1]:2 [ framedone#10 framedone#1 framedone#11 framedone#0 framedone#3 ]
zp[1]:2 [ framedone ]
@@ -15,13 +15,13 @@ main: {
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
__b2:
__b1:
lda.z col
cmp #$a+1
bcc __b2
bcc __b1
lda #0
sta.z col
jmp __b2
jmp __b1
}
irq: {
lda $dc0d
+8 -12
View File
@@ -1,5 +1,5 @@
@begin: scope:[] from
[0] (byte) col#0 ← (byte) 0
[0] (byte) col ← (byte) 0
to:@1
@1: scope:[] from @begin
[1] phi()
@@ -12,26 +12,22 @@
main: scope:[main] from @1
[4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
to:main::@1
main::@1: scope:[main] from main main::@2 main::@3
[5] (byte) col#12 ← phi( main/(byte) col#0 main::@2/(byte) col#12 main::@3/(byte) col#1 )
main::@1: scope:[main] from main main::@1 main::@2
[5] if((byte) col<(byte) $a+(byte) 1) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
[6] if((byte) col#12<(byte) $a+(byte) 1) goto main::@1
to:main::@3
main::@3: scope:[main] from main::@2
[7] (byte) col#1 ← (byte) 0
[6] (byte) col ← (byte) 0
to:main::@1
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
asm { lda$dc0d }
[9] *((const byte*) BGCOL) ← (byte) col#0
[10] if((byte) col#0==(byte) 0) goto irq::@return
[8] *((const byte*) BGCOL) ← (byte) col
[9] if((byte) col==(byte) 0) goto irq::@return
to:irq::@1
irq::@1: scope:[irq] from irq
[11] (byte) col#3 ← ++ (byte) col#0
[10] (byte) col ← ++ (byte) col
to:irq::@return
irq::@return: scope:[irq] from irq irq::@1
[12] (byte) col#10 ← phi( irq/(byte) col#0 irq::@1/(byte) col#3 )
[13] return
[11] return
to:@return
+90 -187
View File
@@ -9,58 +9,46 @@ Culled Empty Block (label) irq::@1
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte) col#0 ← (number) 0
(byte) col ← (number) 0
to:@2
(void()) main()
main: scope:[main] from @2
(byte) col#14 ← phi( @2/(byte) col#13 )
*((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
to:main::@1
main::@1: scope:[main] from main main::@2 main::@7
(byte) col#12 ← phi( main/(byte) col#14 main::@2/(byte) col#6 main::@7/(byte) col#1 )
if(true) goto main::@2
to:main::@return
main::@2: scope:[main] from main::@1
(byte) col#6 ← phi( main::@1/(byte) col#12 )
(bool~) main::$0 ← (byte) col#6 > (number) $a
(bool~) main::$0 ← (byte) col > (number) $a
(bool~) main::$1 ← ! (bool~) main::$0
if((bool~) main::$1) goto main::@1
to:main::@7
main::@7: scope:[main] from main::@2
(byte) col#1 ← (number) 0
(byte) col ← (number) 0
to:main::@1
main::@return: scope:[main] from main::@1
(byte) col#7 ← phi( main::@1/(byte) col#12 )
(byte) col#2 ← (byte) col#7
return
to:@return
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
(byte) col#8 ← phi( @2/(byte) col#13 )
asm { lda$dc0d }
*((const byte*) BGCOL) ← (byte) col#8
(bool~) irq::$0 ← (byte) col#8 != (number) 0
*((const byte*) BGCOL) ← (byte) col
(bool~) irq::$0 ← (byte) col != (number) 0
(bool~) irq::$1 ← ! (bool~) irq::$0
if((bool~) irq::$1) goto irq::@return
to:irq::@2
irq::@2: scope:[irq] from irq
(byte) col#9phi( irq/(byte) col#8 )
(byte) col#3 ← ++ (byte) col#9
(byte) col ← ++ (byte) col
to:irq::@return
irq::@return: scope:[irq] from irq irq::@2
(byte) col#10 ← phi( irq/(byte) col#8 irq::@2/(byte) col#3 )
(byte) col#4 ← (byte) col#10
return
to:@return
@2: scope:[] from @begin
(byte) col#13 ← phi( @begin/(byte) col#0 )
call main
to:@3
@3: scope:[] from @2
(byte) col#11 ← phi( @2/(byte) col#2 )
(byte) col#5 ← (byte) col#11
to:@end
@end: scope:[] from @3
@@ -71,22 +59,7 @@ SYMBOL TABLE SSA
(label) @end
(const byte*) BGCOL = (byte*)(number) $d020
(const void()**) KERNEL_IRQ = (void()**)(number) $314
(byte) col
(byte) col#0
(byte) col#1
(byte) col#10
(byte) col#11
(byte) col#12
(byte) col#13
(byte) col#14
(byte) col#2
(byte) col#3
(byte) col#4
(byte) col#5
(byte) col#6
(byte) col#7
(byte) col#8
(byte) col#9
(byte) col loadstore
interrupt(KERNEL_MIN)(void()) irq()
(bool~) irq::$0
(bool~) irq::$1
@@ -100,13 +73,13 @@ interrupt(KERNEL_MIN)(void()) irq()
(label) main::@7
(label) main::@return
Adding number conversion cast (unumber) 0 in (byte) col#0 ← (number) 0
Adding number conversion cast (unumber) $a in (bool~) main::$0 ← (byte) col#6 > (number) $a
Adding number conversion cast (unumber) 0 in (byte) col#1 ← (number) 0
Adding number conversion cast (unumber) 0 in (bool~) irq::$0 ← (byte) col#8 != (number) 0
Adding number conversion cast (unumber) 0 in (byte) col ← (number) 0
Adding number conversion cast (unumber) $a in (bool~) main::$0 ← (byte) col > (number) $a
Adding number conversion cast (unumber) 0 in (byte) col ← (number) 0
Adding number conversion cast (unumber) 0 in (bool~) irq::$0 ← (byte) col != (number) 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) col#0 ← (unumber)(number) 0
Inlining cast (byte) col#1 ← (unumber)(number) 0
Inlining cast (byte) col ← (unumber)(number) 0
Inlining cast (byte) col ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (void()**) 788
Simplifying constant pointer cast (byte*) 53280
@@ -120,62 +93,46 @@ Finalized unsigned number type (byte) $a
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inversing boolean not [7] (bool~) main::$1 ← (byte) col#6 <= (byte) $a from [6] (bool~) main::$0 ← (byte) col#6 > (byte) $a
Inversing boolean not [17] (bool~) irq::$1 ← (byte) col#8 == (byte) 0 from [16] (bool~) irq::$0 ← (byte) col#8 != (byte) 0
Inversing boolean not [4] (bool~) main::$1 ← (byte) col <= (byte) $a from [3] (bool~) main::$0 ← (byte) col > (byte) $a
Inversing boolean not [11] (bool~) irq::$1 ← (byte) col == (byte) 0 from [10] (bool~) irq::$0 ← (byte) col != (byte) 0
Successful SSA optimization Pass2UnaryNotSimplification
Alias (byte) col#12 = (byte) col#6 (byte) col#7 (byte) col#2
Alias (byte) col#8 = (byte) col#9
Alias (byte) col#10 = (byte) col#4
Alias (byte) col#0 = (byte) col#13
Alias (byte) col#11 = (byte) col#5
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) col#14 (byte) col#0
Identical Phi Values (byte) col#8 (byte) col#0
Identical Phi Values (byte) col#11 (byte) col#12
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$1 [8] if((byte) col#12<=(byte) $a) goto main::@1
Simple Condition (bool~) irq::$1 [18] if((byte) col#0==(byte) 0) goto irq::@return
Simple Condition (bool~) main::$1 [5] if((byte) col<=(byte) $a) goto main::@1
Simple Condition (bool~) irq::$1 [12] if((byte) col==(byte) 0) goto irq::@return
Successful SSA optimization Pass2ConditionalJumpSimplification
if() condition always true - replacing block destination [4] if(true) goto main::@2
if() condition always true - replacing block destination [2] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Rewriting conditional comparison [8] if((byte) col#12<=(byte) $a) goto main::@1
Rewriting conditional comparison [5] if((byte) col<=(byte) $a) goto main::@1
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Adding number conversion cast (unumber) $a+1 in if((byte) col#12<(byte) $a+(number) 1) goto main::@1
Adding number conversion cast (unumber) 1 in if((byte) col#12<(unumber)(byte) $a+(number) 1) goto main::@1
Adding number conversion cast (unumber) $a+1 in if((byte) col<(byte) $a+(number) 1) goto main::@1
Adding number conversion cast (unumber) 1 in if((byte) col<(unumber)(byte) $a+(number) 1) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast (byte) $a+(unumber)(number) 1
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting main::@9(between main::@2 and main::@1)
Added new block during phi lifting irq::@3(between irq and irq::@return)
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@1
CALL GRAPH
Calls in [] to main:2
Created 2 initial phi equivalence classes
Coalesced [6] col#15 ← col#0
Coalesced [10] col#17 ← col#1
Coalesced (already) [11] col#16 ← col#12
Coalesced [16] col#19 ← col#3
Coalesced [19] col#18 ← col#0
Coalesced down to 1 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@9
Culled Empty Block (label) irq::@3
Culled Empty Block (label) main::@1
Renumbering block @2 to @1
Renumbering block main::@7 to main::@3
Renumbering block main::@2 to main::@1
Renumbering block main::@7 to main::@2
Renumbering block irq::@2 to irq::@1
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] (byte) col#0 ← (byte) 0
[0] (byte) col ← (byte) 0
to:@1
@1: scope:[] from @begin
[1] phi()
@@ -188,46 +145,37 @@ FINAL CONTROL FLOW GRAPH
main: scope:[main] from @1
[4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
to:main::@1
main::@1: scope:[main] from main main::@2 main::@3
[5] (byte) col#12 ← phi( main/(byte) col#0 main::@2/(byte) col#12 main::@3/(byte) col#1 )
main::@1: scope:[main] from main main::@1 main::@2
[5] if((byte) col<(byte) $a+(byte) 1) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
[6] if((byte) col#12<(byte) $a+(byte) 1) goto main::@1
to:main::@3
main::@3: scope:[main] from main::@2
[7] (byte) col#1 ← (byte) 0
[6] (byte) col ← (byte) 0
to:main::@1
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
asm { lda$dc0d }
[9] *((const byte*) BGCOL) ← (byte) col#0
[10] if((byte) col#0==(byte) 0) goto irq::@return
[8] *((const byte*) BGCOL) ← (byte) col
[9] if((byte) col==(byte) 0) goto irq::@return
to:irq::@1
irq::@1: scope:[irq] from irq
[11] (byte) col#3 ← ++ (byte) col#0
[10] (byte) col ← ++ (byte) col
to:irq::@return
irq::@return: scope:[irq] from irq irq::@1
[12] (byte) col#10 ← phi( irq/(byte) col#0 irq::@1/(byte) col#3 )
[13] return
[11] return
to:@return
VARIABLE REGISTER WEIGHTS
(byte) col
(byte) col#0 1.9999999999999998
(byte) col#1 22.0
(byte) col#10 40.0
(byte) col#12 158.0
(byte) col#3 4.0
(byte) col loadstore 17.428571428571427
interrupt(KERNEL_MIN)(void()) irq()
(void()) main()
Initial phi equivalence classes
[ col#10 col#12 col#0 col#1 col#3 ]
Added variable col to live range equivalence class [ col ]
Complete equivalence classes
[ col#10 col#12 col#0 col#1 col#3 ]
Allocated zp[1]:2 [ col#10 col#12 col#0 col#1 col#3 ]
[ col ]
Allocated zp[1]:2 [ col ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -243,7 +191,7 @@ Target platform is c64basic / MOS6502X
.label col = 2
// @begin
__bbegin:
// [0] (byte) col#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -265,78 +213,66 @@ main: {
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
// [5] phi from main main::@2 main::@3 to main::@1 [phi:main/main::@2/main::@3->main::@1]
__b1_from_main:
__b1_from___b2:
__b1_from___b3:
// [5] phi (byte) col#12 = (byte) col#0 [phi:main/main::@2/main::@3->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [5] if((byte) col<(byte) $a+(byte) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z col
cmp #$a+1
bcc __b1
jmp __b2
// main::@2
__b2:
// [6] if((byte) col#12<(byte) $a+(byte) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z col
cmp #$a+1
bcc __b1_from___b2
jmp __b3
// main::@3
__b3:
// [7] (byte) col#1 ← (byte) 0 -- vbuz1=vbuc1
// [6] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
jmp __b1_from___b3
jmp __b1
}
// irq
irq: {
// entry interrupt(KERNEL_MIN)
// asm { lda$dc0d }
lda $dc0d
// [9] *((const byte*) BGCOL) ← (byte) col#0 -- _deref_pbuc1=vbuz1
// [8] *((const byte*) BGCOL) ← (byte) col -- _deref_pbuc1=vbuz1
lda.z col
sta BGCOL
// [10] if((byte) col#0==(byte) 0) goto irq::@return -- vbuz1_eq_0_then_la1
// [9] if((byte) col==(byte) 0) goto irq::@return -- vbuz1_eq_0_then_la1
lda.z col
cmp #0
beq __breturn_from_irq
beq __breturn
jmp __b1
// irq::@1
__b1:
// [11] (byte) col#3 ← ++ (byte) col#0 -- vbuz1=_inc_vbuz1
// [10] (byte) col ← ++ (byte) col -- vbuz1=_inc_vbuz1
inc.z col
// [12] phi from irq irq::@1 to irq::@return [phi:irq/irq::@1->irq::@return]
__breturn_from_irq:
__breturn_from___b1:
// [12] phi (byte) col#10 = (byte) col#0 [phi:irq/irq::@1->irq::@return#0] -- register_copy
jmp __breturn
// irq::@return
__breturn:
// [13] return - exit interrupt(KERNEL_MIN)
// [11] return - exit interrupt(KERNEL_MIN)
jmp $ea81
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte) col#0 ← (byte) 0 [ col#0 ] ( [ col#0 ] ) always clobbers reg byte a
Statement [4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ col#0 ] ( main:2 [ col#0 ] ) always clobbers reg byte a
Statement [6] if((byte) col#12<(byte) $a+(byte) 1) goto main::@1 [ col#12 ] ( main:2 [ col#12 ] ) always clobbers reg byte a
Statement [7] (byte) col#1 ← (byte) 0 [ col#1 ] ( main:2 [ col#1 ] ) always clobbers reg byte a
Statement [0] (byte) col ← (byte) 0 [ col ] ( [ col ] ) always clobbers reg byte a
Statement [4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ col ] ( main:2 [ col ] ) always clobbers reg byte a
Statement [5] if((byte) col<(byte) $a+(byte) 1) goto main::@1 [ col ] ( main:2 [ col ] ) always clobbers reg byte a
Statement [6] (byte) col ← (byte) 0 [ col ] ( main:2 [ col ] ) always clobbers reg byte a
Statement asm { lda$dc0d } always clobbers reg byte a
Statement [9] *((const byte*) BGCOL) ← (byte) col#0 [ col#0 ] ( [ col#0 ] ) always clobbers reg byte a
Statement [10] if((byte) col#0==(byte) 0) goto irq::@return [ col#0 ] ( [ col#0 ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ col#10 col#12 col#0 col#1 col#3 ] : zp[1]:2 ,
Statement [8] *((const byte*) BGCOL) ← (byte) col [ col ] ( [ col ] ) always clobbers reg byte a
Statement [9] if((byte) col==(byte) 0) goto irq::@return [ ] ( [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ col ] : zp[1]:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 226: zp[1]:2 [ col#10 col#12 col#0 col#1 col#3 ]
Uplift Scope [] 17.43: zp[1]:2 [ col ]
Uplift Scope [main]
Uplift Scope [irq]
Uplifting [] best 1521 combination zp[1]:2 [ col#10 col#12 col#0 col#1 col#3 ]
Uplifting [main] best 1521 combination
Uplifting [irq] best 1521 combination
Attempting to uplift remaining variables inzp[1]:2 [ col#10 col#12 col#0 col#1 col#3 ]
Uplifting [] best 1521 combination zp[1]:2 [ col#10 col#12 col#0 col#1 col#3 ]
Uplifting [] best 1194 combination zp[1]:2 [ col ]
Uplifting [main] best 1194 combination
Uplifting [irq] best 1194 combination
Attempting to uplift remaining variables inzp[1]:2 [ col ]
Uplifting [] best 1194 combination zp[1]:2 [ col ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -351,7 +287,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label col = 2
// @begin
__bbegin:
// [0] (byte) col#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -373,54 +309,42 @@ main: {
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
// [5] phi from main main::@2 main::@3 to main::@1 [phi:main/main::@2/main::@3->main::@1]
__b1_from_main:
__b1_from___b2:
__b1_from___b3:
// [5] phi (byte) col#12 = (byte) col#0 [phi:main/main::@2/main::@3->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [5] if((byte) col<(byte) $a+(byte) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z col
cmp #$a+1
bcc __b1
jmp __b2
// main::@2
__b2:
// [6] if((byte) col#12<(byte) $a+(byte) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z col
cmp #$a+1
bcc __b1_from___b2
jmp __b3
// main::@3
__b3:
// [7] (byte) col#1 ← (byte) 0 -- vbuz1=vbuc1
// [6] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
jmp __b1_from___b3
jmp __b1
}
// irq
irq: {
// entry interrupt(KERNEL_MIN)
// asm { lda$dc0d }
lda $dc0d
// [9] *((const byte*) BGCOL) ← (byte) col#0 -- _deref_pbuc1=vbuz1
// [8] *((const byte*) BGCOL) ← (byte) col -- _deref_pbuc1=vbuz1
lda.z col
sta BGCOL
// [10] if((byte) col#0==(byte) 0) goto irq::@return -- vbuz1_eq_0_then_la1
// [9] if((byte) col==(byte) 0) goto irq::@return -- vbuz1_eq_0_then_la1
lda.z col
cmp #0
beq __breturn_from_irq
beq __breturn
jmp __b1
// irq::@1
__b1:
// [11] (byte) col#3 ← ++ (byte) col#0 -- vbuz1=_inc_vbuz1
// [10] (byte) col ← ++ (byte) col -- vbuz1=_inc_vbuz1
inc.z col
// [12] phi from irq irq::@1 to irq::@return [phi:irq/irq::@1->irq::@return]
__breturn_from_irq:
__breturn_from___b1:
// [12] phi (byte) col#10 = (byte) col#0 [phi:irq/irq::@1->irq::@return#0] -- register_copy
jmp __breturn
// irq::@return
__breturn:
// [13] return - exit interrupt(KERNEL_MIN)
// [11] return - exit interrupt(KERNEL_MIN)
jmp $ea81
}
// File Data
@@ -430,25 +354,15 @@ Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b1_from___b2 with __b2
Replacing label __b1_from___b3 with __b2
Replacing label __breturn_from_irq with __breturn
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Removing instruction __b1_from_main:
Removing instruction __b1_from___b2:
Removing instruction __b1_from___b3:
Removing instruction __b1:
Removing instruction __breturn_from_irq:
Removing instruction __breturn_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1:
Removing instruction __bend:
Removing instruction __b3:
Removing instruction __b2:
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination
Skipping double jump to $ea81 in beq __breturn
@@ -465,21 +379,15 @@ FINAL SYMBOL TABLE
(label) @end
(const byte*) BGCOL = (byte*) 53280
(const void()**) KERNEL_IRQ = (void()**) 788
(byte) col
(byte) col#0 col zp[1]:2 1.9999999999999998
(byte) col#1 col zp[1]:2 22.0
(byte) col#10 col zp[1]:2 40.0
(byte) col#12 col zp[1]:2 158.0
(byte) col#3 col zp[1]:2 4.0
(byte) col loadstore zp[1]:2 17.428571428571427
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@1
(label) irq::@return
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
zp[1]:2 [ col#10 col#12 col#0 col#1 col#3 ]
zp[1]:2 [ col ]
FINAL ASSEMBLER
@@ -498,7 +406,7 @@ Score: 888
// @begin
__bbegin:
// col = 0
// [0] (byte) col#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -516,22 +424,19 @@ main: {
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
// [5] phi from main main::@2 main::@3 to main::@1 [phi:main/main::@2/main::@3->main::@1]
// [5] phi (byte) col#12 = (byte) col#0 [phi:main/main::@2/main::@3->main::@1#0] -- register_copy
// main::@1
// main::@2
__b2:
__b1:
// if(col>10)
// [6] if((byte) col#12<(byte) $a+(byte) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
// [5] if((byte) col<(byte) $a+(byte) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z col
cmp #$a+1
bcc __b2
// main::@3
bcc __b1
// main::@2
// col = 0
// [7] (byte) col#1 ← (byte) 0 -- vbuz1=vbuc1
// [6] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
jmp __b2
jmp __b1
}
// irq
irq: {
@@ -540,11 +445,11 @@ irq: {
// asm { lda$dc0d }
lda $dc0d
// *BGCOL = col
// [9] *((const byte*) BGCOL) ← (byte) col#0 -- _deref_pbuc1=vbuz1
// [8] *((const byte*) BGCOL) ← (byte) col -- _deref_pbuc1=vbuz1
lda.z col
sta BGCOL
// if(col!=0)
// [10] if((byte) col#0==(byte) 0) goto irq::@return -- vbuz1_eq_0_then_la1
// [9] if((byte) col==(byte) 0) goto irq::@return -- vbuz1_eq_0_then_la1
lda.z col
cmp #0
bne !__ea81+
@@ -552,13 +457,11 @@ irq: {
!__ea81:
// irq::@1
// col++;
// [11] (byte) col#3 ← ++ (byte) col#0 -- vbuz1=_inc_vbuz1
// [10] (byte) col ← ++ (byte) col -- vbuz1=_inc_vbuz1
inc.z col
// [12] phi from irq irq::@1 to irq::@return [phi:irq/irq::@1->irq::@return]
// [12] phi (byte) col#10 = (byte) col#0 [phi:irq/irq::@1->irq::@return#0] -- register_copy
// irq::@return
// }
// [13] return - exit interrupt(KERNEL_MIN)
// [11] return - exit interrupt(KERNEL_MIN)
jmp $ea81
}
// File Data
@@ -3,18 +3,12 @@
(label) @end
(const byte*) BGCOL = (byte*) 53280
(const void()**) KERNEL_IRQ = (void()**) 788
(byte) col
(byte) col#0 col zp[1]:2 1.9999999999999998
(byte) col#1 col zp[1]:2 22.0
(byte) col#10 col zp[1]:2 40.0
(byte) col#12 col zp[1]:2 158.0
(byte) col#3 col zp[1]:2 4.0
(byte) col loadstore zp[1]:2 17.428571428571427
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@1
(label) irq::@return
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
zp[1]:2 [ col#10 col#12 col#0 col#1 col#3 ]
zp[1]:2 [ col ]
@@ -33,10 +33,10 @@
.label SPRITE = $2000
// The address of the sprite pointers on the current screen (screen+$3f8).
.label PLEX_SCREEN_PTR = $400+$3f8
.label plex_show_idx = 7
.label plex_sprite_idx = 6
.label plex_sprite_msb = 9
.label plex_free_next = 8
.label plex_show_idx = 6
.label plex_sprite_idx = 7
.label plex_sprite_msb = 8
.label plex_free_next = 9
.label framedone = $a
__b1:
// The index in the PLEX tables of the next sprite to show
@@ -232,7 +232,7 @@ plex_irq: {
sta BORDERCOL
__b3:
jsr plexShowSprite
ldy.z plexShowSprite.plexFreeAdd1___2
ldy.z plex_free_next
ldx PLEX_FREE_YPOS,y
lda RASTER
clc
@@ -262,8 +262,6 @@ plex_irq: {
// Show the next sprite.
// plexSort() prepares showing the sprites
plexShowSprite: {
.label __6 = 6
.label plexFreeAdd1___2 = 8
.label plex_sprite_idx2 = $d
lda.z plex_sprite_idx
asl
@@ -279,8 +277,9 @@ plexShowSprite: {
sta PLEX_FREE_YPOS,y
ldx.z plex_free_next
inx
lda #7
sax.z plexFreeAdd1___2
txa
and #7
sta.z plex_free_next
ldx.z plex_show_idx
ldy PLEX_SORTED_IDX,x
lda PLEX_PTR,y
@@ -303,8 +302,9 @@ plexShowSprite: {
__b2:
ldx.z plex_sprite_idx
inx
lda #7
sax.z __6
txa
and #7
sta.z plex_sprite_idx
inc.z plex_show_idx
asl.z plex_sprite_msb
lda.z plex_sprite_msb
@@ -2,12 +2,12 @@
[0] phi()
to:@1
@1: scope:[] from @begin
[1] (byte) plex_show_idx#0 ← (byte) 0
[2] (byte) plex_sprite_idx#0 ← (byte) 0
[3] (byte) plex_sprite_msb#0 ← (byte) 1
[1] (byte) plex_show_idx ← (byte) 0
[2] (byte) plex_sprite_idx ← (byte) 0
[3] (byte) plex_sprite_msb ← (byte) 1
to:@2
@2: scope:[] from @1
[4] (byte) plex_free_next#31 ← (byte) 0
[4] (byte) plex_free_next ← (byte) 0
to:@3
@3: scope:[] from @2
kickasm(location (const byte*) SPRITE) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff))
@@ -17,7 +17,7 @@
}}
to:@4
@4: scope:[] from @3
[6] (bool) framedone#17 ← true
[6] (bool) framedone ← true
to:@5
@5: scope:[] from @4
[7] phi()
@@ -45,14 +45,9 @@ loop: scope:[loop] from main::@1
to:loop::@1
loop::@1: scope:[loop] from loop loop::@6
[16] (byte) loop::sin_idx#6 ← phi( loop/(byte) 0 loop::@6/(byte) loop::sin_idx#1 )
[16] (byte) plex_free_next#10 ← phi( loop/(byte) plex_free_next#31 loop::@6/(byte) plex_free_next#0 )
[16] (byte) plex_sprite_msb#11 ← phi( loop/(byte) plex_sprite_msb#0 loop::@6/(byte) plex_sprite_msb#1 )
[16] (byte) plex_sprite_idx#10 ← phi( loop/(byte) plex_sprite_idx#0 loop::@6/(byte) plex_sprite_idx#1 )
[16] (byte) plex_show_idx#10 ← phi( loop/(byte) plex_show_idx#0 loop::@6/(byte) plex_show_idx#1 )
[16] (bool) framedone#12 ← phi( loop/(bool) framedone#17 loop::@6/(bool) framedone#5 )
to:loop::@2
loop::@2: scope:[loop] from loop::@1 loop::@2
[17] if((bool) framedone#12) goto loop::@3
[17] if((bool) framedone) goto loop::@3
to:loop::@2
loop::@3: scope:[loop] from loop::@2
[18] *((const byte*) BORDERCOL) ← (const byte) RED
@@ -73,7 +68,7 @@ loop::@5: scope:[loop] from loop::@4
to:loop::@6
loop::@6: scope:[loop] from loop::@5
[28] *((const byte*) BORDERCOL) ← (const byte) GREEN
[29] (bool) framedone#5 ← false
[29] (bool) framedone ← false
[30] *((const byte*) VIC_CONTROL) ← *((const byte*) VIC_CONTROL) & (byte) $7f
[31] *((const byte*) RASTER) ← (byte) 0
to:loop::@1
@@ -109,9 +104,9 @@ plexSort::@2: scope:[plexSort] from plexSort::@1 plexSort::@4
[46] if((byte) plexSort::m#1!=(const byte) PLEX_COUNT-(byte) 2+(byte) 1) goto plexSort::@1
to:plexSort::@6
plexSort::@6: scope:[plexSort] from plexSort::@2
[47] (byte) plex_show_idx#1 ← (byte) 0
[48] (byte) plex_sprite_idx#1 ← (byte) 0
[49] (byte) plex_sprite_msb#1 ← (byte) 1
[47] (byte) plex_show_idx ← (byte) 0
[48] (byte) plex_sprite_idx ← (byte) 0
[49] (byte) plex_sprite_msb ← (byte) 1
to:plexSort::plexFreePrepare1
plexSort::plexFreePrepare1: scope:[plexSort] from plexSort::@6
[50] phi()
@@ -123,7 +118,7 @@ plexSort::plexFreePrepare1_@1: scope:[plexSort] from plexSort::plexFreePrepare1
[54] if((byte) plexSort::plexFreePrepare1_s#1!=(byte) 8) goto plexSort::plexFreePrepare1_@1
to:plexSort::plexFreePrepare1_@2
plexSort::plexFreePrepare1_@2: scope:[plexSort] from plexSort::plexFreePrepare1_@1
[55] (byte) plex_free_next#0 ← (byte) 0
[55] (byte) plex_free_next ← (byte) 0
to:plexSort::@return
plexSort::@return: scope:[plexSort] from plexSort::plexFreePrepare1_@2
[56] return
@@ -187,55 +182,52 @@ plex_irq: scope:[plex_irq] from
[85] *((const byte*) BORDERCOL) ← (const byte) WHITE
to:plex_irq::@3
plex_irq::@3: scope:[plex_irq] from plex_irq plex_irq::@7
[86] (byte) plex_sprite_msb#28 ← phi( plex_irq/(byte) plex_sprite_msb#0 plex_irq::@7/(byte) plex_sprite_msb#17 )
[86] (byte) plex_free_next#27 ← phi( plex_irq/(byte) plex_free_next#31 plex_irq::@7/(byte~) plexShowSprite::plexFreeAdd1_$2 )
[86] (byte) plex_show_idx#27 ← phi( plex_irq/(byte) plex_show_idx#0 plex_irq::@7/(byte) plex_show_idx#16 )
[86] (byte) plex_sprite_idx#25 ← phi( plex_irq/(byte) plex_sprite_idx#0 plex_irq::@7/(byte~) plexShowSprite::$6 )
[86] phi()
[87] call plexShowSprite
to:plex_irq::plexFreeNextYpos1
plex_irq::plexFreeNextYpos1: scope:[plex_irq] from plex_irq::@3
[88] (byte) plex_irq::plexFreeNextYpos1_return#0 ← *((const byte*) PLEX_FREE_YPOS + (byte~) plexShowSprite::plexFreeAdd1_$2)
[88] (byte) plex_irq::plexFreeNextYpos1_return#0 ← *((const byte*) PLEX_FREE_YPOS + (byte) plex_free_next)
to:plex_irq::@6
plex_irq::@6: scope:[plex_irq] from plex_irq::plexFreeNextYpos1
[89] (byte~) plex_irq::$4 ← *((const byte*) RASTER) + (byte) 2
[90] if((byte) plex_show_idx#16>=(const byte) PLEX_COUNT) goto plex_irq::@4
[90] if((byte) plex_show_idx>=(const byte) PLEX_COUNT) goto plex_irq::@4
to:plex_irq::@7
plex_irq::@7: scope:[plex_irq] from plex_irq::@6
[91] if((byte) plex_irq::plexFreeNextYpos1_return#0<(byte~) plex_irq::$4) goto plex_irq::@3
to:plex_irq::@4
plex_irq::@4: scope:[plex_irq] from plex_irq::@6 plex_irq::@7
[92] *((const byte*) IRQ_STATUS) ← (const byte) IRQ_RASTER
[93] if((byte) plex_show_idx#16<(const byte) PLEX_COUNT) goto plex_irq::@1
[93] if((byte) plex_show_idx<(const byte) PLEX_COUNT) goto plex_irq::@1
to:plex_irq::@5
plex_irq::@5: scope:[plex_irq] from plex_irq::@4
[94] (bool) framedone#3 ← true
[94] (bool) framedone ← true
to:plex_irq::@2
plex_irq::@2: scope:[plex_irq] from plex_irq::@1 plex_irq::@5
[95] (bool) framedone#10 ← phi( plex_irq::@1/(bool) framedone#17 plex_irq::@5/(bool) framedone#3 )
[96] *((const byte*) BORDERCOL) ← (byte) 0
[95] *((const byte*) BORDERCOL) ← (byte) 0
to:plex_irq::@return
plex_irq::@return: scope:[plex_irq] from plex_irq::@2
[97] return
[96] return
to:@return
plex_irq::@1: scope:[plex_irq] from plex_irq::@4
[98] *((const byte*) RASTER) ← (byte) plex_irq::plexFreeNextYpos1_return#0
[97] *((const byte*) RASTER) ← (byte) plex_irq::plexFreeNextYpos1_return#0
to:plex_irq::@2
(void()) plexShowSprite()
plexShowSprite: scope:[plexShowSprite] from plex_irq::@3
[99] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx#25 << (byte) 1
[100] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte*) PLEX_YPOS + *((const byte*) PLEX_SORTED_IDX + (byte) plex_show_idx#27))
[101] *((const byte*) SPRITES_YPOS + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0
[98] (byte) plexShowSprite::plex_sprite_idx2#0 ← (byte) plex_sprite_idx << (byte) 1
[99] (byte) plexShowSprite::plexFreeAdd1_ypos#0 ← *((const byte*) PLEX_YPOS + *((const byte*) PLEX_SORTED_IDX + (byte) plex_show_idx))
[100] *((const byte*) SPRITES_YPOS + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte) plexShowSprite::plexFreeAdd1_ypos#0
to:plexShowSprite::plexFreeAdd1
plexShowSprite::plexFreeAdd1: scope:[plexShowSprite] from plexShowSprite
[102] (byte~) plexShowSprite::plexFreeAdd1_$0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte) $15
[103] *((const byte*) PLEX_FREE_YPOS + (byte) plex_free_next#27) ← (byte~) plexShowSprite::plexFreeAdd1_$0
[104] (byte~) plexShowSprite::plexFreeAdd1_$1 ← (byte) plex_free_next#27 + (byte) 1
[105] (byte~) plexShowSprite::plexFreeAdd1_$2 ← (byte~) plexShowSprite::plexFreeAdd1_$1 & (byte) 7
[101] (byte~) plexShowSprite::plexFreeAdd1_$0 ← (byte) plexShowSprite::plexFreeAdd1_ypos#0 + (byte) $15
[102] *((const byte*) PLEX_FREE_YPOS + (byte) plex_free_next) ← (byte~) plexShowSprite::plexFreeAdd1_$0
[103] (byte~) plexShowSprite::plexFreeAdd1_$1 ← (byte) plex_free_next + (byte) 1
[104] (byte~) plexShowSprite::plexFreeAdd1_$2 ← (byte~) plexShowSprite::plexFreeAdd1_$1 & (byte) 7
[105] (byte) plex_free_next ← (byte~) plexShowSprite::plexFreeAdd1_$2
to:plexShowSprite::@5
plexShowSprite::@5: scope:[plexShowSprite] from plexShowSprite::plexFreeAdd1
[106] *((const byte*) PLEX_SCREEN_PTR#0 + (byte) plex_sprite_idx#25) ← *((const byte*) PLEX_PTR + *((const byte*) PLEX_SORTED_IDX + (byte) plex_show_idx#27))
[107] (byte) plexShowSprite::xpos_idx#0 ← *((const byte*) PLEX_SORTED_IDX + (byte) plex_show_idx#27)
[106] *((const byte*) PLEX_SCREEN_PTR#0 + (byte) plex_sprite_idx) ← *((const byte*) PLEX_PTR + *((const byte*) PLEX_SORTED_IDX + (byte) plex_show_idx))
[107] (byte) plexShowSprite::xpos_idx#0 ← *((const byte*) PLEX_SORTED_IDX + (byte) plex_show_idx)
[108] (byte~) plexShowSprite::$11 ← (byte) plexShowSprite::xpos_idx#0 << (byte) 1
[109] (byte~) plexShowSprite::$2 ← < *((const word*) PLEX_XPOS + (byte~) plexShowSprite::$11)
[110] *((const byte*) SPRITES_XPOS + (byte) plexShowSprite::plex_sprite_idx2#0) ← (byte~) plexShowSprite::$2
@@ -243,23 +235,23 @@ plexShowSprite::@5: scope:[plexShowSprite] from plexShowSprite::plexFreeAdd1
[112] if((byte~) plexShowSprite::$3!=(byte) 0) goto plexShowSprite::@1
to:plexShowSprite::@3
plexShowSprite::@3: scope:[plexShowSprite] from plexShowSprite::@5
[113] (byte~) plexShowSprite::$9 ← (byte) $ff ^ (byte) plex_sprite_msb#28
[113] (byte~) plexShowSprite::$9 ← (byte) $ff ^ (byte) plex_sprite_msb
[114] *((const byte*) SPRITES_XMSB) ← *((const byte*) SPRITES_XMSB) & (byte~) plexShowSprite::$9
to:plexShowSprite::@2
plexShowSprite::@2: scope:[plexShowSprite] from plexShowSprite::@1 plexShowSprite::@3
[115] (byte~) plexShowSprite::$5 ← (byte) plex_sprite_idx#25 + (byte) 1
[115] (byte~) plexShowSprite::$5 ← (byte) plex_sprite_idx + (byte) 1
[116] (byte~) plexShowSprite::$6 ← (byte~) plexShowSprite::$5 & (byte) 7
[117] (byte) plex_show_idx#16 ← ++ (byte) plex_show_idx#27
[118] (byte) plex_sprite_msb#3 ← (byte) plex_sprite_msb#28 << (byte) 1
[119] if((byte) plex_sprite_msb#3!=(byte) 0) goto plexShowSprite::@return
[117] (byte) plex_sprite_idx ← (byte~) plexShowSprite::$6
[118] (byte) plex_show_idx ← ++ (byte) plex_show_idx
[119] (byte) plex_sprite_msb ← (byte) plex_sprite_msb << (byte) 1
[120] if((byte) plex_sprite_msb!=(byte) 0) goto plexShowSprite::@return
to:plexShowSprite::@4
plexShowSprite::@4: scope:[plexShowSprite] from plexShowSprite::@2
[120] (byte) plex_sprite_msb#4 ← (byte) 1
[121] (byte) plex_sprite_msb ← (byte) 1
to:plexShowSprite::@return
plexShowSprite::@return: scope:[plexShowSprite] from plexShowSprite::@2 plexShowSprite::@4
[121] (byte) plex_sprite_msb#17 ← phi( plexShowSprite::@2/(byte) plex_sprite_msb#3 plexShowSprite::@4/(byte) plex_sprite_msb#4 )
[122] return
to:@return
plexShowSprite::@1: scope:[plexShowSprite] from plexShowSprite::@5
[123] *((const byte*) SPRITES_XMSB) ← *((const byte*) SPRITES_XMSB) | (byte) plex_sprite_msb#28
[123] *((const byte*) SPRITES_XMSB) ← *((const byte*) SPRITES_XMSB) | (byte) plex_sprite_msb
to:plexShowSprite::@2
File diff suppressed because it is too large Load Diff
@@ -40,12 +40,7 @@
.for(var i=0;i<256;i++)
.byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256)))
}}
(bool) framedone
(bool) framedone#10 framedone zp[1]:10 40.0
(bool) framedone#12 framedone zp[1]:10 57.0
(bool) framedone#17 framedone zp[1]:10 0.375
(bool) framedone#3 framedone zp[1]:10 4.0
(bool) framedone#5 framedone zp[1]:10 7.333333333333333
(bool) framedone loadstore zp[1]:10 10.545454545454545
(void()) init()
(byte~) init::$5 reg byte a 22.0
(label) init::@1
@@ -96,7 +91,7 @@
(byte~) plexShowSprite::$2 reg byte a 4.0
(byte~) plexShowSprite::$3 reg byte a 4.0
(byte~) plexShowSprite::$5 reg byte x 4.0
(byte~) plexShowSprite::$6 zp[1]:6 1.0833333333333333
(byte~) plexShowSprite::$6 reg byte a 4.0
(byte~) plexShowSprite::$9 reg byte a 4.0
(label) plexShowSprite::@1
(label) plexShowSprite::@2
@@ -107,11 +102,11 @@
(label) plexShowSprite::plexFreeAdd1
(byte~) plexShowSprite::plexFreeAdd1_$0 reg byte a 4.0
(byte~) plexShowSprite::plexFreeAdd1_$1 reg byte x 4.0
(byte~) plexShowSprite::plexFreeAdd1_$2 zp[1]:8 1.0
(byte~) plexShowSprite::plexFreeAdd1_$2 reg byte a 4.0
(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[1]:13 0.5454545454545454
(byte) plexShowSprite::plex_sprite_idx2#0 plex_sprite_idx2 zp[1]:13 0.5
(byte) plexShowSprite::xpos_idx
(byte) plexShowSprite::xpos_idx#0 reg byte a 4.0
(byte) plexShowSprite::ypos
@@ -142,11 +137,7 @@
(byte) plexSort::s#2 reg byte x 202.0
(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[1]:8 1.8571428571428572
(byte) plex_free_next#10 plex_free_next zp[1]:8 130.0
(byte) plex_free_next#27 plex_free_next zp[1]:8 2.8333333333333335
(byte) plex_free_next#31 plex_free_next zp[1]:8 0.6666666666666666
(byte) plex_free_next loadstore zp[1]:9 0.6774193548387095
interrupt(KERNEL_MIN)(void()) plex_irq()
(byte~) plex_irq::$4 zp[1]:13 11.0
(label) plex_irq::@1
@@ -161,25 +152,9 @@ interrupt(KERNEL_MIN)(void()) plex_irq()
(byte) plex_irq::plexFreeNextYpos1_return
(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[1]:7 0.5
(byte) plex_show_idx#1 plex_show_idx zp[1]:7 0.8666666666666666
(byte) plex_show_idx#10 plex_show_idx zp[1]:7 130.0
(byte) plex_show_idx#16 plex_show_idx zp[1]:7 2.1666666666666665
(byte) plex_show_idx#27 plex_show_idx zp[1]:7 1.05
(byte) plex_sprite_idx
(byte) plex_sprite_idx#0 plex_sprite_idx zp[1]:6 0.5454545454545454
(byte) plex_sprite_idx#1 plex_sprite_idx zp[1]:6 0.9285714285714286
(byte) plex_sprite_idx#10 plex_sprite_idx zp[1]:6 130.0
(byte) plex_sprite_idx#25 plex_sprite_idx zp[1]:6 1.0555555555555558
(byte) plex_sprite_msb
(byte) plex_sprite_msb#0 plex_sprite_msb zp[1]:9 0.6000000000000001
(byte) plex_sprite_msb#1 plex_sprite_msb zp[1]:9 1.0
(byte) plex_sprite_msb#11 plex_sprite_msb zp[1]:9 130.0
(byte) plex_sprite_msb#17 plex_sprite_msb zp[1]:9 2.142857142857143
(byte) plex_sprite_msb#28 plex_sprite_msb zp[1]:9 0.9047619047619048
(byte) plex_sprite_msb#3 plex_sprite_msb zp[1]:9 3.0
(byte) plex_sprite_msb#4 plex_sprite_msb zp[1]:9 4.0
(byte) plex_show_idx loadstore zp[1]:6 1.2272727272727273
(byte) plex_sprite_idx loadstore zp[1]:7 0.3870967741935484
(byte) plex_sprite_msb loadstore zp[1]:8 0.6153846153846154
zp[1]:2 [ loop::sin_idx#6 loop::sin_idx#1 ]
reg byte x [ loop::y_idx#2 loop::y_idx#1 loop::y_idx#4 ]
@@ -191,11 +166,11 @@ reg byte x [ init::sx#2 init::sx#1 ]
zp[2]: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[1]:6 [ plex_sprite_idx#25 plex_sprite_idx#10 plex_sprite_idx#0 plex_sprite_idx#1 plexShowSprite::$6 ]
zp[1]:7 [ plex_show_idx#27 plex_show_idx#10 plex_show_idx#0 plex_show_idx#1 plex_show_idx#16 ]
zp[1]:8 [ plex_free_next#27 plex_free_next#10 plex_free_next#31 plex_free_next#0 plexShowSprite::plexFreeAdd1_$2 ]
zp[1]:9 [ plex_sprite_msb#28 plex_sprite_msb#11 plex_sprite_msb#0 plex_sprite_msb#1 plex_sprite_msb#17 plex_sprite_msb#3 plex_sprite_msb#4 ]
zp[1]:10 [ framedone#10 framedone#12 framedone#17 framedone#5 framedone#3 ]
zp[1]:6 [ plex_show_idx ]
zp[1]:7 [ plex_sprite_idx ]
zp[1]:8 [ plex_sprite_msb ]
zp[1]:9 [ plex_free_next ]
zp[1]:10 [ framedone ]
zp[1]:11 [ plexSort::nxt_idx#0 ]
zp[1]:12 [ plexSort::nxt_y#0 ]
reg byte x [ plexSort::s#2 ]
@@ -205,9 +180,11 @@ zp[1]:13 [ plexShowSprite::plex_sprite_idx2#0 plex_irq::$4 ]
reg byte a [ plexShowSprite::plexFreeAdd1_ypos#0 ]
reg byte a [ plexShowSprite::plexFreeAdd1_$0 ]
reg byte x [ plexShowSprite::plexFreeAdd1_$1 ]
reg byte a [ plexShowSprite::plexFreeAdd1_$2 ]
reg byte a [ plexShowSprite::xpos_idx#0 ]
reg byte x [ plexShowSprite::$11 ]
reg byte a [ plexShowSprite::$2 ]
reg byte a [ plexShowSprite::$3 ]
reg byte a [ plexShowSprite::$9 ]
reg byte x [ plexShowSprite::$5 ]
reg byte a [ plexShowSprite::$6 ]
+1 -4
View File
@@ -5,16 +5,13 @@
.label SCREEN = $400
main: {
lda #'a'
sta.z print.c
jsr print
lda #'b'
sta.z print.c
jsr print
rts
}
// print(byte register(A) c)
print: {
.label c = 2
lda.z c
sta SCREEN
rts
}
+5 -4
View File
@@ -10,11 +10,11 @@
(void()) main()
main: scope:[main] from @1
[4] (byte) print::c ← (byte) 'a'
[4] phi()
[5] call print
to:main::@1
main::@1: scope:[main] from main
[6] (byte) print::c ← (byte) 'b'
[6] phi()
[7] call print
to:main::@return
main::@return: scope:[main] from main::@1
@@ -23,8 +23,9 @@ main::@return: scope:[main] from main::@1
(void()) print((byte) print::c)
print: scope:[print] from main main::@1
[9] *((const byte*) SCREEN) ← (byte) print::c
[9] (byte) print::c#2 ← phi( main/(byte) 'a' main::@1/(byte) 'b' )
[10] *((const byte*) SCREEN) ← (byte) print::c#2
to:print::@return
print::@return: scope:[print] from print
[10] return
[11] return
to:@return
+86 -53
View File
@@ -6,11 +6,11 @@ CONTROL FLOW GRAPH SSA
(void()) main()
main: scope:[main] from @2
(byte) print::c ← (byte) 'a'
(byte) print::c#0 ← (byte) 'a'
call print
to:main::@1
main::@1: scope:[main] from main
(byte) print::c ← (byte) 'b'
(byte) print::c#1 ← (byte) 'b'
call print
to:main::@2
main::@2: scope:[main] from main::@1
@@ -21,7 +21,8 @@ main::@return: scope:[main] from main::@2
(void()) print((byte) print::c)
print: scope:[print] from main main::@1
*((const byte*) SCREEN) ← (byte) print::c
(byte) print::c#2 ← phi( main/(byte) print::c#0 main::@1/(byte) print::c#1 )
*((const byte*) SCREEN) ← (byte) print::c#2
to:print::@return
print::@return: scope:[print] from print
return
@@ -45,27 +46,42 @@ SYMBOL TABLE SSA
(label) main::@return
(void()) print((byte) print::c)
(label) print::@return
(byte) print::c loadstore
(byte) print::c
(byte) print::c#0
(byte) print::c#1
(byte) print::c#2
Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
Constant (const byte) print::c#0 = 'a'
Constant (const byte) print::c#1 = 'b'
Successful SSA optimization Pass2ConstantIdentification
Inlining constant with var siblings (const byte) print::c#0
Inlining constant with var siblings (const byte) print::c#1
Constant inlined print::c#0 = (byte) 'a'
Constant inlined print::c#1 = (byte) 'b'
Successful SSA optimization Pass2ConstantInlining
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
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::@1
Adding NOP phi() at start of main::@2
CALL GRAPH
Calls in [] to main:2
Calls in [main] to print:6 print:8
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Created 1 initial phi equivalence classes
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@2
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
Adding NOP phi() at start of main::@1
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
@@ -80,11 +96,11 @@ FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from @1
[4] (byte) print::c ← (byte) 'a'
[4] phi()
[5] call print
to:main::@1
main::@1: scope:[main] from main
[6] (byte) print::c ← (byte) 'b'
[6] phi()
[7] call print
to:main::@return
main::@return: scope:[main] from main::@1
@@ -93,23 +109,25 @@ main::@return: scope:[main] from main::@1
(void()) print((byte) print::c)
print: scope:[print] from main main::@1
[9] *((const byte*) SCREEN) ← (byte) print::c
[9] (byte) print::c#2 ← phi( main/(byte) 'a' main::@1/(byte) 'b' )
[10] *((const byte*) SCREEN) ← (byte) print::c#2
to:print::@return
print::@return: scope:[print] from print
[10] return
[11] return
to:@return
VARIABLE REGISTER WEIGHTS
(void()) main()
(void()) print((byte) print::c)
(byte) print::c loadstore 3.0
(byte) print::c
(byte) print::c#2 2.0
Initial phi equivalence classes
Added variable print::c to live range equivalence class [ print::c ]
[ print::c#2 ]
Complete equivalence classes
[ print::c ]
Allocated zp[1]:2 [ print::c ]
[ print::c#2 ]
Allocated zp[1]:2 [ print::c#2 ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -129,6 +147,8 @@ __b1_from___bbegin:
// @1
__b1:
// [2] call main
// [4] phi from @1 to main [phi:@1->main]
main_from___b1:
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
@@ -137,18 +157,24 @@ __bend_from___b1:
__bend:
// main
main: {
// [4] (byte) print::c ← (byte) 'a' -- vbuz1=vbuc1
// [5] call print
// [9] phi from main to print [phi:main->print]
print_from_main:
// [9] phi (byte) print::c#2 = (byte) 'a' [phi:main->print#0] -- vbuz1=vbuc1
lda #'a'
sta.z print.c
// [5] call print
jsr print
// [6] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
jmp __b1
// main::@1
__b1:
// [6] (byte) print::c ← (byte) 'b' -- vbuz1=vbuc1
// [7] call print
// [9] phi from main::@1 to print [phi:main::@1->print]
print_from___b1:
// [9] phi (byte) print::c#2 = (byte) 'b' [phi:main::@1->print#0] -- vbuz1=vbuc1
lda #'b'
sta.z print.c
// [7] call print
jsr print
jmp __breturn
// main::@return
@@ -157,35 +183,31 @@ main: {
rts
}
// print
// print(byte zeropage(2) c)
print: {
.label c = 2
// [9] *((const byte*) SCREEN) ← (byte) print::c -- _deref_pbuc1=vbuz1
// [10] *((const byte*) SCREEN) ← (byte) print::c#2 -- _deref_pbuc1=vbuz1
lda.z c
sta SCREEN
jmp __breturn
// print::@return
__breturn:
// [10] return
// [11] return
rts
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte) print::c ← (byte) 'a' [ print::c ] ( main:2 [ print::c ] ) always clobbers reg byte a
Statement [6] (byte) print::c ← (byte) 'b' [ print::c ] ( main:2 [ print::c ] ) always clobbers reg byte a
Statement [9] *((const byte*) SCREEN) ← (byte) print::c [ ] ( main:2::print:5 [ ] main:2::print:7 [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ print::c ] : zp[1]:2 ,
Potential registers zp[1]:2 [ print::c#2 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [print] 3: zp[1]:2 [ print::c ]
Uplift Scope [print] 2: zp[1]:2 [ print::c#2 ]
Uplift Scope [main]
Uplift Scope []
Uplifting [print] best 62 combination zp[1]:2 [ print::c ]
Uplifting [main] best 62 combination
Uplifting [] best 62 combination
Attempting to uplift remaining variables inzp[1]:2 [ print::c ]
Uplifting [print] best 62 combination zp[1]:2 [ print::c ]
Uplifting [print] best 53 combination reg byte a [ print::c#2 ]
Uplifting [main] best 53 combination
Uplifting [] best 53 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -204,6 +226,8 @@ __b1_from___bbegin:
// @1
__b1:
// [2] call main
// [4] phi from @1 to main [phi:@1->main]
main_from___b1:
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
@@ -212,18 +236,22 @@ __bend_from___b1:
__bend:
// main
main: {
// [4] (byte) print::c ← (byte) 'a' -- vbuz1=vbuc1
lda #'a'
sta.z print.c
// [5] call print
// [9] phi from main to print [phi:main->print]
print_from_main:
// [9] phi (byte) print::c#2 = (byte) 'a' [phi:main->print#0] -- vbuaa=vbuc1
lda #'a'
jsr print
// [6] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
jmp __b1
// main::@1
__b1:
// [6] (byte) print::c ← (byte) 'b' -- vbuz1=vbuc1
lda #'b'
sta.z print.c
// [7] call print
// [9] phi from main::@1 to print [phi:main::@1->print]
print_from___b1:
// [9] phi (byte) print::c#2 = (byte) 'b' [phi:main::@1->print#0] -- vbuaa=vbuc1
lda #'b'
jsr print
jmp __breturn
// main::@return
@@ -232,15 +260,14 @@ main: {
rts
}
// print
// print(byte register(A) c)
print: {
.label c = 2
// [9] *((const byte*) SCREEN) ← (byte) print::c -- _deref_pbuc1=vbuz1
lda.z c
// [10] *((const byte*) SCREEN) ← (byte) print::c#2 -- _deref_pbuc1=vbuaa
sta SCREEN
jmp __breturn
// print::@return
__breturn:
// [10] return
// [11] return
rts
}
// File Data
@@ -255,9 +282,13 @@ Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Removing instruction __b1_from_main:
Removing instruction print_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction print_from_main:
Removing instruction __b1:
Removing instruction __breturn:
Removing instruction __breturn:
@@ -278,13 +309,14 @@ FINAL SYMBOL TABLE
(label) main::@return
(void()) print((byte) print::c)
(label) print::@return
(byte) print::c loadstore zp[1]:2 3.0
(byte) print::c
(byte) print::c#2 reg byte a 2.0
zp[1]:2 [ print::c ]
reg byte a [ print::c#2 ]
FINAL ASSEMBLER
Score: 41
Score: 32
// File Comments
// Test that a nomodify parameter works
@@ -298,22 +330,24 @@ Score: 41
// [1] phi from @begin to @1 [phi:@begin->@1]
// @1
// [2] call main
// [4] phi from @1 to main [phi:@1->main]
// [3] phi from @1 to @end [phi:@1->@end]
// @end
// main
main: {
// print('a')
// [4] (byte) print::c ← (byte) 'a' -- vbuz1=vbuc1
lda #'a'
sta.z print.c
// [5] call print
// [9] phi from main to print [phi:main->print]
// [9] phi (byte) print::c#2 = (byte) 'a' [phi:main->print#0] -- vbuaa=vbuc1
lda #'a'
jsr print
// [6] phi from main to main::@1 [phi:main->main::@1]
// main::@1
// print('b')
// [6] (byte) print::c ← (byte) 'b' -- vbuz1=vbuc1
lda #'b'
sta.z print.c
// [7] call print
// [9] phi from main::@1 to print [phi:main::@1->print]
// [9] phi (byte) print::c#2 = (byte) 'b' [phi:main::@1->print#0] -- vbuaa=vbuc1
lda #'b'
jsr print
// main::@return
// }
@@ -321,15 +355,14 @@ main: {
rts
}
// print
// print(byte register(A) c)
print: {
.label c = 2
// *SCREEN = c
// [9] *((const byte*) SCREEN) ← (byte) print::c -- _deref_pbuc1=vbuz1
lda.z c
// [10] *((const byte*) SCREEN) ← (byte) print::c#2 -- _deref_pbuc1=vbuaa
sta SCREEN
// print::@return
// }
// [10] return
// [11] return
rts
}
// File Data
+3 -2
View File
@@ -7,6 +7,7 @@
(label) main::@return
(void()) print((byte) print::c)
(label) print::@return
(byte) print::c loadstore zp[1]:2 3.0
(byte) print::c
(byte) print::c#2 reg byte a 2.0
zp[1]:2 [ print::c ]
reg byte a [ print::c#2 ]
+11 -12
View File
@@ -10,28 +10,27 @@
(void()) main()
main: scope:[main] from @1
[4] (byte) main::i#0 ← (byte) 0
[4] (byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@2/(byte) main::i#1 )
[6] (byte) sub1::i#0 ← (byte) main::i#2
[7] call sub1
[8] (byte) sub1::return#0 ← (byte) sub1::return#1
[5] (byte) sub1::i#0 ← (byte) main::i
[6] call sub1
[7] (byte) sub1::return#0 ← (byte) sub1::return#1
to:main::@2
main::@2: scope:[main] from main::@1
[9] (byte~) main::$0 ← (byte) sub1::return#0
[10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0
[11] (byte) main::i#1 ← ++ (byte) main::i#2
[12] if((byte) main::i#1!=(byte) 3) goto main::@1
[8] (byte~) main::$0 ← (byte) sub1::return#0
[9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0
[10] (byte) main::i ← ++ (byte) main::i
[11] if((byte) main::i!=(byte) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[13] return
[12] return
to:@return
(byte()) sub1((byte) sub1::i)
sub1: scope:[sub1] from main::@1
[14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
[13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
to:sub1::@return
sub1::@return: scope:[sub1] from sub1
[15] return
[14] return
to:@return
+77 -108
View File
@@ -8,21 +8,19 @@ CONTROL FLOW GRAPH SSA
(void()) main()
main: scope:[main] from @2
(byte) main::i#0 ← (byte) 0
(byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@3
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@3/(byte) main::i#1 )
(byte) sub1::i#0 ← (byte) main::i#2
(byte) sub1::i#0 ← (byte) main::i
call sub1
(byte) sub1::return#0 ← (byte) sub1::return#2
to:main::@3
main::@3: scope:[main] from main::@1
(byte) main::i#3 ← phi( main::@1/(byte) main::i#2 )
(byte) sub1::return#3 ← phi( main::@1/(byte) sub1::return#0 )
(byte~) main::$0 ← (byte) sub1::return#3
*((const byte*) main::SCREEN + (byte) main::i#3) ← (byte~) main::$0
(byte) main::i#1 ← (byte) main::i#3 + rangenext(0,2)
(bool~) main::$1 ← (byte) main::i#1 != rangelast(0,2)
*((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0
(byte) main::i ← (byte) main::i + rangenext(0,2)
(bool~) main::$1 ← (byte) main::i != rangelast(0,2)
if((bool~) main::$1) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
@@ -59,11 +57,7 @@ SYMBOL TABLE SSA
(label) main::@3
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i#3
(byte) main::i loadstore
(byte()) sub1((byte) sub1::i)
(byte~) sub1::$0
(label) sub1::@return
@@ -80,36 +74,31 @@ SYMBOL TABLE SSA
Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
Alias (byte) sub1::return#0 = (byte) sub1::return#3
Alias (byte) main::i#2 = (byte) main::i#3
Alias (byte) sub1::return#1 = (byte~) sub1::$0 (byte) sub1::return#4 (byte) sub1::return#2
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) sub1::i#1 (byte) sub1::i#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$1 [10] if((byte) main::i#1!=rangelast(0,2)) goto main::@1
Simple Condition (bool~) main::$1 [9] if((byte) main::i!=rangelast(0,2)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Resolved ranged next value [8] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [10] if(main::i#1!=rangelast(0,2)) goto main::@1 to (number) 3
Adding number conversion cast (unumber) 3 in if((byte) main::i#1!=(number) 3) goto main::@1
Resolved ranged next value [7] main::i ← ++ main::i to ++
Resolved ranged comparison value [9] if(main::i!=rangelast(0,2)) goto main::@1 to (number) 3
Adding number conversion cast (unumber) 3 in if((byte) main::i!=(number) 3) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting main::@4(between main::@3 and main::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:2
Calls in [main] to sub1:9
Calls in [main] to sub1:7
Created 1 initial phi equivalence classes
Coalesced [6] main::i#4 ← main::i#0
Coalesced [16] main::i#5 ← main::i#1
Coalesced down to 1 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@4
Renumbering block @2 to @1
Renumbering block main::@3 to main::@2
Adding NOP phi() at start of @begin
@@ -129,40 +118,36 @@ FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from @1
[4] (byte) main::i#0 ← (byte) 0
[4] (byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@2/(byte) main::i#1 )
[6] (byte) sub1::i#0 ← (byte) main::i#2
[7] call sub1
[8] (byte) sub1::return#0 ← (byte) sub1::return#1
[5] (byte) sub1::i#0 ← (byte) main::i
[6] call sub1
[7] (byte) sub1::return#0 ← (byte) sub1::return#1
to:main::@2
main::@2: scope:[main] from main::@1
[9] (byte~) main::$0 ← (byte) sub1::return#0
[10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0
[11] (byte) main::i#1 ← ++ (byte) main::i#2
[12] if((byte) main::i#1!=(byte) 3) goto main::@1
[8] (byte~) main::$0 ← (byte) sub1::return#0
[9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0
[10] (byte) main::i ← ++ (byte) main::i
[11] if((byte) main::i!=(byte) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[13] return
[12] return
to:@return
(byte()) sub1((byte) sub1::i)
sub1: scope:[sub1] from main::@1
[14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
[13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
to:sub1::@return
sub1::@return: scope:[sub1] from sub1
[15] return
[14] return
to:@return
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte~) main::$0 22.0
(byte) main::i
(byte) main::i#0 4.0
(byte) main::i#1 16.5
(byte) main::i#2 7.666666666666666
(byte) main::i loadstore 8.142857142857142
(byte()) sub1((byte) sub1::i)
(byte) sub1::i
(byte) sub1::i#0 15.0
@@ -171,18 +156,18 @@ VARIABLE REGISTER WEIGHTS
(byte) sub1::return#1 4.333333333333333
Initial phi equivalence classes
[ main::i#2 main::i#0 main::i#1 ]
Added variable main::i to live range equivalence class [ main::i ]
Added variable sub1::i#0 to live range equivalence class [ sub1::i#0 ]
Added variable sub1::return#0 to live range equivalence class [ sub1::return#0 ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Added variable sub1::return#1 to live range equivalence class [ sub1::return#1 ]
Complete equivalence classes
[ main::i#2 main::i#0 main::i#1 ]
[ main::i ]
[ sub1::i#0 ]
[ sub1::return#0 ]
[ main::$0 ]
[ sub1::return#1 ]
Allocated zp[1]:4 [ main::i#2 main::i#0 main::i#1 ]
Allocated zp[1]:4 [ main::i ]
Allocated zp[1]:6 [ sub1::i#0 ]
Allocated zp[1]:7 [ sub1::return#0 ]
Allocated zp[1]:8 [ main::$0 ]
@@ -214,46 +199,42 @@ __bend:
// main
main: {
.label SCREEN = $400
.label __0 = 8
.label i = 4
// [4] (byte) main::i#0 ← (byte) 0 -- vbuz1=vbuc1
.label __0 = 8
// [4] (byte) main::i ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z i
// [5] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1]
__b1_from_main:
__b1_from___b2:
// [5] phi (byte) main::i#2 = (byte) main::i#0 [phi:main/main::@2->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [6] (byte) sub1::i#0 ← (byte) main::i#2 -- vbuz1=vbuz2
// [5] (byte) sub1::i#0 ← (byte) main::i -- vbuz1=vbuz2
lda.z i
sta.z sub1.i
// [7] call sub1
// [6] call sub1
jsr sub1
// [8] (byte) sub1::return#0 ← (byte) sub1::return#1 -- vbuz1=vbuz2
// [7] (byte) sub1::return#0 ← (byte) sub1::return#1 -- vbuz1=vbuz2
lda.z sub1.return_1
sta.z sub1.return
jmp __b2
// main::@2
__b2:
// [9] (byte~) main::$0 ← (byte) sub1::return#0 -- vbuz1=vbuz2
// [8] (byte~) main::$0 ← (byte) sub1::return#0 -- vbuz1=vbuz2
lda.z sub1.return
sta.z __0
// [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuz2
// [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z __0
ldy.z i
sta SCREEN,y
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [10] (byte) main::i ← ++ (byte) main::i -- vbuz1=_inc_vbuz1
inc.z i
// [12] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [11] if((byte) main::i!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp.z i
bne __b1_from___b2
bne __b1
jmp __breturn
// main::@return
__breturn:
// [13] return
// [12] return
rts
}
// sub1
@@ -262,39 +243,39 @@ sub1: {
.label i = 6
.label return = 7
.label return_1 = 9
// [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuz1=vbuz2_plus_vbuz2
// [13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuz1=vbuz2_plus_vbuz2
lda.z i
asl
sta.z return_1
jmp __breturn
// sub1::@return
__breturn:
// [15] return
// [14] return
rts
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte) main::i#0 ← (byte) 0 [ main::i#0 ] ( main:2 [ main::i#0 ] ) always clobbers reg byte a
Statement [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte y
Statement [12] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a
Statement [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 [ sub1::return#1 ] ( main:2::sub1:7 [ main::i#2 sub1::return#1 ] ) always clobbers reg byte a
Potential registers zp[1]:4 [ main::i#2 main::i#0 main::i#1 ] : zp[1]:4 ,
Statement [4] (byte) main::i ← (byte) 0 [ main::i ] ( main:2 [ main::i ] ) always clobbers reg byte a
Statement [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 [ ] ( main:2 [ ] ) always clobbers reg byte y
Statement [11] if((byte) main::i!=(byte) 3) goto main::@1 [ main::i ] ( main:2 [ main::i ] ) always clobbers reg byte a
Statement [13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 [ sub1::return#1 ] ( main:2::sub1:6 [ main::i sub1::return#1 ] ) always clobbers reg byte a
Potential registers zp[1]:4 [ main::i ] : zp[1]:4 ,
Potential registers zp[1]:6 [ sub1::i#0 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:7 [ sub1::return#0 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:8 [ main::$0 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:9 [ sub1::return#1 ] : zp[1]:9 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 28.17: zp[1]:4 [ main::i#2 main::i#0 main::i#1 ] 22: zp[1]:8 [ main::$0 ]
Uplift Scope [sub1] 22: zp[1]:7 [ sub1::return#0 ] 15: zp[1]:6 [ sub1::i#0 ] 4.33: zp[1]:9 [ sub1::return#1 ]
Uplift Scope [main] 22: zp[1]:8 [ main::$0 ] 8.14: zp[1]:4 [ main::i ]
Uplift Scope []
Uplifting [main] best 545 combination zp[1]:4 [ main::i#2 main::i#0 main::i#1 ] reg byte a [ main::$0 ]
Uplifting [sub1] best 419 combination reg byte a [ sub1::return#0 ] reg byte a [ sub1::i#0 ] reg byte a [ sub1::return#1 ]
Uplifting [] best 419 combination
Attempting to uplift remaining variables inzp[1]:4 [ main::i#2 main::i#0 main::i#1 ]
Uplifting [main] best 419 combination zp[1]:4 [ main::i#2 main::i#0 main::i#1 ]
Uplifting [sub1] best 452 combination reg byte a [ sub1::return#0 ] reg byte a [ sub1::i#0 ] reg byte a [ sub1::return#1 ]
Uplifting [main] best 392 combination reg byte a [ main::$0 ] zp[1]:4 [ main::i ]
Uplifting [] best 392 combination
Attempting to uplift remaining variables inzp[1]:4 [ main::i ]
Uplifting [main] best 392 combination zp[1]:4 [ main::i ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -322,49 +303,45 @@ __bend:
main: {
.label SCREEN = $400
.label i = 4
// [4] (byte) main::i#0 ← (byte) 0 -- vbuz1=vbuc1
// [4] (byte) main::i ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z i
// [5] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1]
__b1_from_main:
__b1_from___b2:
// [5] phi (byte) main::i#2 = (byte) main::i#0 [phi:main/main::@2->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [6] (byte) sub1::i#0 ← (byte) main::i#2 -- vbuaa=vbuz1
// [5] (byte) sub1::i#0 ← (byte) main::i -- vbuaa=vbuz1
lda.z i
// [7] call sub1
// [6] call sub1
jsr sub1
// [8] (byte) sub1::return#0 ← (byte) sub1::return#1
// [7] (byte) sub1::return#0 ← (byte) sub1::return#1
jmp __b2
// main::@2
__b2:
// [9] (byte~) main::$0 ← (byte) sub1::return#0
// [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
// [8] (byte~) main::$0 ← (byte) sub1::return#0
// [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy.z i
sta SCREEN,y
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [10] (byte) main::i ← ++ (byte) main::i -- vbuz1=_inc_vbuz1
inc.z i
// [12] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [11] if((byte) main::i!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp.z i
bne __b1_from___b2
bne __b1
jmp __breturn
// main::@return
__breturn:
// [13] return
// [12] return
rts
}
// sub1
// sub1(byte register(A) i)
sub1: {
// [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
// [13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
asl
jmp __breturn
// sub1::@return
__breturn:
// [15] return
// [14] return
rts
}
// File Data
@@ -378,12 +355,9 @@ Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Replacing label __b1_from___b2 with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Removing instruction __b1_from_main:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b2:
@@ -406,10 +380,7 @@ FINAL SYMBOL TABLE
(label) main::@2
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(byte) main::i
(byte) main::i#0 i zp[1]:4 4.0
(byte) main::i#1 i zp[1]:4 16.5
(byte) main::i#2 i zp[1]:4 7.666666666666666
(byte) main::i loadstore zp[1]:4 8.142857142857142
(byte()) sub1((byte) sub1::i)
(label) sub1::@return
(byte) sub1::i
@@ -418,7 +389,7 @@ FINAL SYMBOL TABLE
(byte) sub1::return#0 reg byte a 22.0
(byte) sub1::return#1 reg byte a 4.333333333333333
zp[1]:4 [ main::i#2 main::i#0 main::i#1 ]
zp[1]:4 [ main::i ]
reg byte a [ sub1::i#0 ]
reg byte a [ sub1::return#0 ]
reg byte a [ main::$0 ]
@@ -446,46 +417,44 @@ main: {
.label SCREEN = $400
.label i = 4
// for( volatile byte i : 0..2)
// [4] (byte) main::i#0 ← (byte) 0 -- vbuz1=vbuc1
// [4] (byte) main::i ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z i
// [5] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1]
// [5] phi (byte) main::i#2 = (byte) main::i#0 [phi:main/main::@2->main::@1#0] -- register_copy
// main::@1
__b1:
// sub1(i)
// [6] (byte) sub1::i#0 ← (byte) main::i#2 -- vbuaa=vbuz1
// [5] (byte) sub1::i#0 ← (byte) main::i -- vbuaa=vbuz1
lda.z i
// [7] call sub1
// [6] call sub1
jsr sub1
// [8] (byte) sub1::return#0 ← (byte) sub1::return#1
// [7] (byte) sub1::return#0 ← (byte) sub1::return#1
// main::@2
// [9] (byte~) main::$0 ← (byte) sub1::return#0
// [8] (byte~) main::$0 ← (byte) sub1::return#0
// SCREEN[i] = sub1(i)
// [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
// [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy.z i
sta SCREEN,y
// for( volatile byte i : 0..2)
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [10] (byte) main::i ← ++ (byte) main::i -- vbuz1=_inc_vbuz1
inc.z i
// [12] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [11] if((byte) main::i!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp.z i
bne __b1
// main::@return
// }
// [13] return
// [12] return
rts
}
// sub1
// sub1(byte register(A) i)
sub1: {
// i+i
// [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
// [13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
asl
// sub1::@return
// }
// [15] return
// [14] return
rts
}
// File Data
+2 -5
View File
@@ -7,10 +7,7 @@
(label) main::@2
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(byte) main::i
(byte) main::i#0 i zp[1]:4 4.0
(byte) main::i#1 i zp[1]:4 16.5
(byte) main::i#2 i zp[1]:4 7.666666666666666
(byte) main::i loadstore zp[1]:4 8.142857142857142
(byte()) sub1((byte) sub1::i)
(label) sub1::@return
(byte) sub1::i
@@ -19,7 +16,7 @@
(byte) sub1::return#0 reg byte a 22.0
(byte) sub1::return#1 reg byte a 4.333333333333333
zp[1]:4 [ main::i#2 main::i#0 main::i#1 ]
zp[1]:4 [ main::i ]
reg byte a [ sub1::i#0 ]
reg byte a [ sub1::return#0 ]
reg byte a [ main::$0 ]
+11 -12
View File
@@ -10,28 +10,27 @@
(void()) main()
main: scope:[main] from @1
[4] (byte) main::i#0 ← (byte) 0
[4] (byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@2/(byte) main::i#1 )
[6] (byte) sub1::i#0 ← (byte) main::i#2
[7] call sub1
[8] (byte) sub1::return#0 ← (byte) sub1::return#1
[5] (byte) sub1::i#0 ← (byte) main::i
[6] call sub1
[7] (byte) sub1::return#0 ← (byte) sub1::return#1
to:main::@2
main::@2: scope:[main] from main::@1
[9] (byte~) main::$0 ← (byte) sub1::return#0
[10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0
[11] (byte) main::i#1 ← ++ (byte) main::i#2
[12] if((byte) main::i#1!=(byte) 3) goto main::@1
[8] (byte~) main::$0 ← (byte) sub1::return#0
[9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0
[10] (byte) main::i ← ++ (byte) main::i
[11] if((byte) main::i!=(byte) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[13] return
[12] return
to:@return
(byte()) sub1((byte) sub1::i)
sub1: scope:[sub1] from main::@1
[14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
[13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
to:sub1::@return
sub1::@return: scope:[sub1] from sub1
[15] return
[14] return
to:@return
+77 -108
View File
@@ -8,21 +8,19 @@ CONTROL FLOW GRAPH SSA
(void()) main()
main: scope:[main] from @2
(byte) main::i#0 ← (byte) 0
(byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@3
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@3/(byte) main::i#1 )
(byte) sub1::i#0 ← (byte) main::i#2
(byte) sub1::i#0 ← (byte) main::i
call sub1
(byte) sub1::return#0 ← (byte) sub1::return#2
to:main::@3
main::@3: scope:[main] from main::@1
(byte) main::i#3 ← phi( main::@1/(byte) main::i#2 )
(byte) sub1::return#3 ← phi( main::@1/(byte) sub1::return#0 )
(byte~) main::$0 ← (byte) sub1::return#3
*((const byte*) main::SCREEN + (byte) main::i#3) ← (byte~) main::$0
(byte) main::i#1 ← (byte) main::i#3 + rangenext(0,2)
(bool~) main::$1 ← (byte) main::i#1 != rangelast(0,2)
*((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0
(byte) main::i ← (byte) main::i + rangenext(0,2)
(bool~) main::$1 ← (byte) main::i != rangelast(0,2)
if((bool~) main::$1) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
@@ -59,11 +57,7 @@ SYMBOL TABLE SSA
(label) main::@3
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i#3
(byte) main::i loadstore
(byte()) sub1((byte) sub1::i)
(byte~) sub1::$0
(label) sub1::@return
@@ -80,36 +74,31 @@ SYMBOL TABLE SSA
Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
Alias (byte) sub1::return#0 = (byte) sub1::return#3
Alias (byte) main::i#2 = (byte) main::i#3
Alias (byte) sub1::return#1 = (byte~) sub1::$0 (byte) sub1::return#4 (byte) sub1::return#2
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) sub1::i#1 (byte) sub1::i#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$1 [10] if((byte) main::i#1!=rangelast(0,2)) goto main::@1
Simple Condition (bool~) main::$1 [9] if((byte) main::i!=rangelast(0,2)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Resolved ranged next value [8] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [10] if(main::i#1!=rangelast(0,2)) goto main::@1 to (number) 3
Adding number conversion cast (unumber) 3 in if((byte) main::i#1!=(number) 3) goto main::@1
Resolved ranged next value [7] main::i ← ++ main::i to ++
Resolved ranged comparison value [9] if(main::i!=rangelast(0,2)) goto main::@1 to (number) 3
Adding number conversion cast (unumber) 3 in if((byte) main::i!=(number) 3) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting main::@4(between main::@3 and main::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:2
Calls in [main] to sub1:9
Calls in [main] to sub1:7
Created 1 initial phi equivalence classes
Coalesced [6] main::i#4 ← main::i#0
Coalesced [16] main::i#5 ← main::i#1
Coalesced down to 1 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@4
Renumbering block @2 to @1
Renumbering block main::@3 to main::@2
Adding NOP phi() at start of @begin
@@ -129,40 +118,36 @@ FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from @1
[4] (byte) main::i#0 ← (byte) 0
[4] (byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@2/(byte) main::i#1 )
[6] (byte) sub1::i#0 ← (byte) main::i#2
[7] call sub1
[8] (byte) sub1::return#0 ← (byte) sub1::return#1
[5] (byte) sub1::i#0 ← (byte) main::i
[6] call sub1
[7] (byte) sub1::return#0 ← (byte) sub1::return#1
to:main::@2
main::@2: scope:[main] from main::@1
[9] (byte~) main::$0 ← (byte) sub1::return#0
[10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0
[11] (byte) main::i#1 ← ++ (byte) main::i#2
[12] if((byte) main::i#1!=(byte) 3) goto main::@1
[8] (byte~) main::$0 ← (byte) sub1::return#0
[9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0
[10] (byte) main::i ← ++ (byte) main::i
[11] if((byte) main::i!=(byte) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[13] return
[12] return
to:@return
(byte()) sub1((byte) sub1::i)
sub1: scope:[sub1] from main::@1
[14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
[13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
to:sub1::@return
sub1::@return: scope:[sub1] from sub1
[15] return
[14] return
to:@return
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte~) main::$0 22.0
(byte) main::i
(byte) main::i#0 4.0
(byte) main::i#1 16.5
(byte) main::i#2 7.666666666666666
(byte) main::i loadstore 8.142857142857142
(byte()) sub1((byte) sub1::i)
(byte) sub1::i
(byte) sub1::i#0 15.0
@@ -171,18 +156,18 @@ VARIABLE REGISTER WEIGHTS
(byte) sub1::return#1 4.333333333333333
Initial phi equivalence classes
[ main::i#2 main::i#0 main::i#1 ]
Added variable main::i to live range equivalence class [ main::i ]
Added variable sub1::i#0 to live range equivalence class [ sub1::i#0 ]
Added variable sub1::return#0 to live range equivalence class [ sub1::return#0 ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Added variable sub1::return#1 to live range equivalence class [ sub1::return#1 ]
Complete equivalence classes
[ main::i#2 main::i#0 main::i#1 ]
[ main::i ]
[ sub1::i#0 ]
[ sub1::return#0 ]
[ main::$0 ]
[ sub1::return#1 ]
Allocated zp[1]:5 [ main::i#2 main::i#0 main::i#1 ]
Allocated zp[1]:5 [ main::i ]
Allocated zp[1]:6 [ sub1::i#0 ]
Allocated zp[1]:7 [ sub1::return#0 ]
Allocated zp[1]:8 [ main::$0 ]
@@ -214,46 +199,42 @@ __bend:
// main
main: {
.label SCREEN = $400
.label __0 = 8
.label i = 5
// [4] (byte) main::i#0 ← (byte) 0 -- vbuz1=vbuc1
.label __0 = 8
// [4] (byte) main::i ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z i
// [5] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1]
__b1_from_main:
__b1_from___b2:
// [5] phi (byte) main::i#2 = (byte) main::i#0 [phi:main/main::@2->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [6] (byte) sub1::i#0 ← (byte) main::i#2 -- vbuz1=vbuz2
// [5] (byte) sub1::i#0 ← (byte) main::i -- vbuz1=vbuz2
lda.z i
sta.z sub1.i
// [7] call sub1
// [6] call sub1
jsr sub1
// [8] (byte) sub1::return#0 ← (byte) sub1::return#1 -- vbuz1=vbuz2
// [7] (byte) sub1::return#0 ← (byte) sub1::return#1 -- vbuz1=vbuz2
lda.z sub1.return_1
sta.z sub1.return
jmp __b2
// main::@2
__b2:
// [9] (byte~) main::$0 ← (byte) sub1::return#0 -- vbuz1=vbuz2
// [8] (byte~) main::$0 ← (byte) sub1::return#0 -- vbuz1=vbuz2
lda.z sub1.return
sta.z __0
// [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuz2
// [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z __0
ldy.z i
sta SCREEN,y
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [10] (byte) main::i ← ++ (byte) main::i -- vbuz1=_inc_vbuz1
inc.z i
// [12] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [11] if((byte) main::i!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp.z i
bne __b1_from___b2
bne __b1
jmp __breturn
// main::@return
__breturn:
// [13] return
// [12] return
rts
}
// sub1
@@ -262,39 +243,39 @@ sub1: {
.label i = 6
.label return = 7
.label return_1 = 9
// [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuz1=vbuz2_plus_vbuz2
// [13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuz1=vbuz2_plus_vbuz2
lda.z i
asl
sta.z return_1
jmp __breturn
// sub1::@return
__breturn:
// [15] return
// [14] return
rts
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte) main::i#0 ← (byte) 0 [ main::i#0 ] ( main:2 [ main::i#0 ] ) always clobbers reg byte a
Statement [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte y
Statement [12] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a
Statement [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 [ sub1::return#1 ] ( main:2::sub1:7 [ main::i#2 sub1::return#1 ] ) always clobbers reg byte a
Potential registers zp[1]:5 [ main::i#2 main::i#0 main::i#1 ] : zp[1]:5 ,
Statement [4] (byte) main::i ← (byte) 0 [ main::i ] ( main:2 [ main::i ] ) always clobbers reg byte a
Statement [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 [ ] ( main:2 [ ] ) always clobbers reg byte y
Statement [11] if((byte) main::i!=(byte) 3) goto main::@1 [ main::i ] ( main:2 [ main::i ] ) always clobbers reg byte a
Statement [13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 [ sub1::return#1 ] ( main:2::sub1:6 [ main::i sub1::return#1 ] ) always clobbers reg byte a
Potential registers zp[1]:5 [ main::i ] : zp[1]:5 ,
Potential registers zp[1]:6 [ sub1::i#0 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:7 [ sub1::return#0 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:8 [ main::$0 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:9 [ sub1::return#1 ] : zp[1]:9 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 28.17: zp[1]:5 [ main::i#2 main::i#0 main::i#1 ] 22: zp[1]:8 [ main::$0 ]
Uplift Scope [sub1] 22: zp[1]:7 [ sub1::return#0 ] 15: zp[1]:6 [ sub1::i#0 ] 4.33: zp[1]:9 [ sub1::return#1 ]
Uplift Scope [main] 22: zp[1]:8 [ main::$0 ] 8.14: zp[1]:5 [ main::i ]
Uplift Scope []
Uplifting [main] best 545 combination zp[1]:5 [ main::i#2 main::i#0 main::i#1 ] reg byte a [ main::$0 ]
Uplifting [sub1] best 419 combination reg byte a [ sub1::return#0 ] reg byte a [ sub1::i#0 ] reg byte a [ sub1::return#1 ]
Uplifting [] best 419 combination
Attempting to uplift remaining variables inzp[1]:5 [ main::i#2 main::i#0 main::i#1 ]
Uplifting [main] best 419 combination zp[1]:5 [ main::i#2 main::i#0 main::i#1 ]
Uplifting [sub1] best 452 combination reg byte a [ sub1::return#0 ] reg byte a [ sub1::i#0 ] reg byte a [ sub1::return#1 ]
Uplifting [main] best 392 combination reg byte a [ main::$0 ] zp[1]:5 [ main::i ]
Uplifting [] best 392 combination
Attempting to uplift remaining variables inzp[1]:5 [ main::i ]
Uplifting [main] best 392 combination zp[1]:5 [ main::i ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -322,49 +303,45 @@ __bend:
main: {
.label SCREEN = $400
.label i = 5
// [4] (byte) main::i#0 ← (byte) 0 -- vbuz1=vbuc1
// [4] (byte) main::i ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z i
// [5] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1]
__b1_from_main:
__b1_from___b2:
// [5] phi (byte) main::i#2 = (byte) main::i#0 [phi:main/main::@2->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [6] (byte) sub1::i#0 ← (byte) main::i#2 -- vbuaa=vbuz1
// [5] (byte) sub1::i#0 ← (byte) main::i -- vbuaa=vbuz1
lda.z i
// [7] call sub1
// [6] call sub1
jsr sub1
// [8] (byte) sub1::return#0 ← (byte) sub1::return#1
// [7] (byte) sub1::return#0 ← (byte) sub1::return#1
jmp __b2
// main::@2
__b2:
// [9] (byte~) main::$0 ← (byte) sub1::return#0
// [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
// [8] (byte~) main::$0 ← (byte) sub1::return#0
// [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy.z i
sta SCREEN,y
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [10] (byte) main::i ← ++ (byte) main::i -- vbuz1=_inc_vbuz1
inc.z i
// [12] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [11] if((byte) main::i!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp.z i
bne __b1_from___b2
bne __b1
jmp __breturn
// main::@return
__breturn:
// [13] return
// [12] return
rts
}
// sub1
// sub1(byte register(A) i)
sub1: {
// [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
// [13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
asl
jmp __breturn
// sub1::@return
__breturn:
// [15] return
// [14] return
rts
}
// File Data
@@ -378,12 +355,9 @@ Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Replacing label __b1_from___b2 with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Removing instruction __b1_from_main:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b2:
@@ -406,10 +380,7 @@ FINAL SYMBOL TABLE
(label) main::@2
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(byte) main::i
(byte) main::i#0 i zp[1]:5 4.0
(byte) main::i#1 i zp[1]:5 16.5
(byte) main::i#2 i zp[1]:5 7.666666666666666
(byte) main::i loadstore zp[1]:5 8.142857142857142
(byte()) sub1((byte) sub1::i)
(label) sub1::@return
(byte) sub1::i
@@ -418,7 +389,7 @@ FINAL SYMBOL TABLE
(byte) sub1::return#0 reg byte a 22.0
(byte) sub1::return#1 reg byte a 4.333333333333333
zp[1]:5 [ main::i#2 main::i#0 main::i#1 ]
zp[1]:5 [ main::i ]
reg byte a [ sub1::i#0 ]
reg byte a [ sub1::return#0 ]
reg byte a [ main::$0 ]
@@ -446,46 +417,44 @@ main: {
.label SCREEN = $400
.label i = 5
// for( volatile byte i : 0..2)
// [4] (byte) main::i#0 ← (byte) 0 -- vbuz1=vbuc1
// [4] (byte) main::i ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z i
// [5] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1]
// [5] phi (byte) main::i#2 = (byte) main::i#0 [phi:main/main::@2->main::@1#0] -- register_copy
// main::@1
__b1:
// sub1(i)
// [6] (byte) sub1::i#0 ← (byte) main::i#2 -- vbuaa=vbuz1
// [5] (byte) sub1::i#0 ← (byte) main::i -- vbuaa=vbuz1
lda.z i
// [7] call sub1
// [6] call sub1
jsr sub1
// [8] (byte) sub1::return#0 ← (byte) sub1::return#1
// [7] (byte) sub1::return#0 ← (byte) sub1::return#1
// main::@2
// [9] (byte~) main::$0 ← (byte) sub1::return#0
// [8] (byte~) main::$0 ← (byte) sub1::return#0
// SCREEN[i] = sub1(i)
// [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
// [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy.z i
sta SCREEN,y
// for( volatile byte i : 0..2)
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [10] (byte) main::i ← ++ (byte) main::i -- vbuz1=_inc_vbuz1
inc.z i
// [12] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [11] if((byte) main::i!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp.z i
bne __b1
// main::@return
// }
// [13] return
// [12] return
rts
}
// sub1
// sub1(byte register(A) i)
sub1: {
// i+i
// [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
// [13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
asl
// sub1::@return
// }
// [15] return
// [14] return
rts
}
// File Data
+2 -5
View File
@@ -7,10 +7,7 @@
(label) main::@2
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(byte) main::i
(byte) main::i#0 i zp[1]:5 4.0
(byte) main::i#1 i zp[1]:5 16.5
(byte) main::i#2 i zp[1]:5 7.666666666666666
(byte) main::i loadstore zp[1]:5 8.142857142857142
(byte()) sub1((byte) sub1::i)
(label) sub1::@return
(byte) sub1::i
@@ -19,7 +16,7 @@
(byte) sub1::return#0 reg byte a 22.0
(byte) sub1::return#1 reg byte a 4.333333333333333
zp[1]:5 [ main::i#2 main::i#0 main::i#1 ]
zp[1]:5 [ main::i ]
reg byte a [ sub1::i#0 ]
reg byte a [ sub1::return#0 ]
reg byte a [ main::$0 ]
+19 -20
View File
@@ -10,44 +10,43 @@
(void()) main()
main: scope:[main] from @1
[4] (byte) main::i#0 ← (byte) 0
[4] (byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@3/(byte) main::i#1 )
[6] (byte) sub1::i#0 ← (byte) main::i#2
[7] call sub1
[8] (byte) sub1::return#0 ← (byte) sub1::return#1
[5] (byte) sub1::i#0 ← (byte) main::i
[6] call sub1
[7] (byte) sub1::return#0 ← (byte) sub1::return#1
to:main::@2
main::@2: scope:[main] from main::@1
[9] (byte~) main::$0 ← (byte) sub1::return#0
[10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0
[11] (byte) sub2::i#0 ← (byte) main::i#2
[12] call sub2
[13] (byte) sub2::return#0 ← (byte) sub2::return#1
[8] (byte~) main::$0 ← (byte) sub1::return#0
[9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0
[10] (byte) sub2::i#0 ← (byte) main::i
[11] call sub2
[12] (byte) sub2::return#0 ← (byte) sub2::return#1
to:main::@3
main::@3: scope:[main] from main::@2
[14] (byte~) main::$1 ← (byte) sub2::return#0
[15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i#2) ← (byte~) main::$1
[16] (byte) main::i#1 ← ++ (byte) main::i#2
[17] if((byte) main::i#1!=(byte) 3) goto main::@1
[13] (byte~) main::$1 ← (byte) sub2::return#0
[14] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i) ← (byte~) main::$1
[15] (byte) main::i ← ++ (byte) main::i
[16] if((byte) main::i!=(byte) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[18] return
[17] return
to:@return
(byte()) sub2((byte) sub2::i)
sub2: scope:[sub2] from main::@2
[19] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0
[20] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0
[18] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0
[19] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0
to:sub2::@return
sub2::@return: scope:[sub2] from sub2
[21] return
[20] return
to:@return
(byte()) sub1((byte) sub1::i)
sub1: scope:[sub1] from main::@1
[22] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
[21] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
to:sub1::@return
sub1::@return: scope:[sub1] from sub1
[23] return
[22] return
to:@return
+123 -156
View File
@@ -10,30 +10,27 @@ CONTROL FLOW GRAPH SSA
(void()) main()
main: scope:[main] from @3
(byte) main::i#0 ← (byte) 0
(byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@4
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@4/(byte) main::i#1 )
(byte) sub1::i#0 ← (byte) main::i#2
(byte) sub1::i#0 ← (byte) main::i
call sub1
(byte) sub1::return#0 ← (byte) sub1::return#2
to:main::@3
main::@3: scope:[main] from main::@1
(byte) main::i#3 ← phi( main::@1/(byte) main::i#2 )
(byte) sub1::return#3 ← phi( main::@1/(byte) sub1::return#0 )
(byte~) main::$0 ← (byte) sub1::return#3
*((const byte*) main::SCREEN + (byte) main::i#3) ← (byte~) main::$0
(byte) sub2::i#0 ← (byte) main::i#3
*((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0
(byte) sub2::i#0 ← (byte) main::i
call sub2
(byte) sub2::return#0 ← (byte) sub2::return#2
to:main::@4
main::@4: scope:[main] from main::@3
(byte) main::i#4 ← phi( main::@3/(byte) main::i#3 )
(byte) sub2::return#3 ← phi( main::@3/(byte) sub2::return#0 )
(byte~) main::$1 ← (byte) sub2::return#3
*((const byte*) main::SCREEN+(number) $28 + (byte) main::i#4) ← (byte~) main::$1
(byte) main::i#1 ← (byte) main::i#4 + rangenext(0,2)
(bool~) main::$2 ← (byte) main::i#1 != rangelast(0,2)
*((const byte*) main::SCREEN+(number) $28 + (byte) main::i) ← (byte~) main::$1
(byte) main::i ← (byte) main::i + rangenext(0,2)
(bool~) main::$2 ← (byte) main::i != rangelast(0,2)
if((bool~) main::$2) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@4
@@ -85,12 +82,7 @@ SYMBOL TABLE SSA
(label) main::@4
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i#3
(byte) main::i#4
(byte) main::i loadstore
(byte()) sub1((byte) sub1::i)
(byte~) sub1::$0
(label) sub1::@return
@@ -117,7 +109,7 @@ SYMBOL TABLE SSA
(byte) sub2::return#3
(byte) sub2::return#4
Adding number conversion cast (unumber) $28 in *((const byte*) main::SCREEN+(number) $28 + (byte) main::i#4) ← (byte~) main::$1
Adding number conversion cast (unumber) $28 in *((const byte*) main::SCREEN+(number) $28 + (byte) main::i) ← (byte~) main::$1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast $28
@@ -125,7 +117,6 @@ Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) $28
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) sub1::return#0 = (byte) sub1::return#3
Alias (byte) main::i#2 = (byte) main::i#3 (byte) main::i#4
Alias (byte) sub2::return#0 = (byte) sub2::return#3
Alias (byte) sub1::return#1 = (byte~) sub1::$0 (byte) sub1::return#4 (byte) sub1::return#2
Alias (byte) sub2::return#1 = (byte~) sub2::$1 (byte) sub2::return#4 (byte) sub2::return#2
@@ -133,31 +124,27 @@ Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) sub1::i#1 (byte) sub1::i#0
Identical Phi Values (byte) sub2::i#1 (byte) sub2::i#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$2 [16] if((byte) main::i#1!=rangelast(0,2)) goto main::@1
Simple Condition (bool~) main::$2 [15] if((byte) main::i!=rangelast(0,2)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Resolved ranged next value [14] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [16] if(main::i#1!=rangelast(0,2)) goto main::@1 to (number) 3
Adding number conversion cast (unumber) 3 in if((byte) main::i#1!=(number) 3) goto main::@1
Resolved ranged next value [13] main::i ← ++ main::i to ++
Resolved ranged comparison value [15] if(main::i!=rangelast(0,2)) goto main::@1 to (number) 3
Adding number conversion cast (unumber) 3 in if((byte) main::i!=(number) 3) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting main::@5(between main::@4 and main::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @3
Adding NOP phi() at start of @4
Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:2
Calls in [main] to sub1:9 sub2:14
Calls in [main] to sub1:7 sub2:12
Created 1 initial phi equivalence classes
Coalesced [6] main::i#5 ← main::i#0
Coalesced [21] main::i#6 ← main::i#1
Coalesced down to 1 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) main::@5
Renumbering block @3 to @1
Renumbering block main::@3 to main::@2
Renumbering block main::@4 to main::@3
@@ -178,46 +165,45 @@ FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from @1
[4] (byte) main::i#0 ← (byte) 0
[4] (byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@3/(byte) main::i#1 )
[6] (byte) sub1::i#0 ← (byte) main::i#2
[7] call sub1
[8] (byte) sub1::return#0 ← (byte) sub1::return#1
[5] (byte) sub1::i#0 ← (byte) main::i
[6] call sub1
[7] (byte) sub1::return#0 ← (byte) sub1::return#1
to:main::@2
main::@2: scope:[main] from main::@1
[9] (byte~) main::$0 ← (byte) sub1::return#0
[10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0
[11] (byte) sub2::i#0 ← (byte) main::i#2
[12] call sub2
[13] (byte) sub2::return#0 ← (byte) sub2::return#1
[8] (byte~) main::$0 ← (byte) sub1::return#0
[9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0
[10] (byte) sub2::i#0 ← (byte) main::i
[11] call sub2
[12] (byte) sub2::return#0 ← (byte) sub2::return#1
to:main::@3
main::@3: scope:[main] from main::@2
[14] (byte~) main::$1 ← (byte) sub2::return#0
[15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i#2) ← (byte~) main::$1
[16] (byte) main::i#1 ← ++ (byte) main::i#2
[17] if((byte) main::i#1!=(byte) 3) goto main::@1
[13] (byte~) main::$1 ← (byte) sub2::return#0
[14] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i) ← (byte~) main::$1
[15] (byte) main::i ← ++ (byte) main::i
[16] if((byte) main::i!=(byte) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
[18] return
[17] return
to:@return
(byte()) sub2((byte) sub2::i)
sub2: scope:[sub2] from main::@2
[19] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0
[20] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0
[18] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0
[19] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0
to:sub2::@return
sub2::@return: scope:[sub2] from sub2
[21] return
[20] return
to:@return
(byte()) sub1((byte) sub1::i)
sub1: scope:[sub1] from main::@1
[22] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
[21] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
to:sub1::@return
sub1::@return: scope:[sub1] from sub1
[23] return
[22] return
to:@return
@@ -225,10 +211,7 @@ VARIABLE REGISTER WEIGHTS
(void()) main()
(byte~) main::$0 22.0
(byte~) main::$1 22.0
(byte) main::i
(byte) main::i#0 4.0
(byte) main::i#1 16.5
(byte) main::i#2 6.181818181818182
(byte) main::i loadstore 6.583333333333334
(byte()) sub1((byte) sub1::i)
(byte) sub1::i
(byte) sub1::i#0 15.0
@@ -244,7 +227,7 @@ VARIABLE REGISTER WEIGHTS
(byte) sub2::return#1 4.333333333333333
Initial phi equivalence classes
[ main::i#2 main::i#0 main::i#1 ]
Added variable main::i to live range equivalence class [ main::i ]
Added variable sub1::i#0 to live range equivalence class [ sub1::i#0 ]
Added variable sub1::return#0 to live range equivalence class [ sub1::return#0 ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
@@ -255,7 +238,7 @@ Added variable sub2::$0 to live range equivalence class [ sub2::$0 ]
Added variable sub2::return#1 to live range equivalence class [ sub2::return#1 ]
Added variable sub1::return#1 to live range equivalence class [ sub1::return#1 ]
Complete equivalence classes
[ main::i#2 main::i#0 main::i#1 ]
[ main::i ]
[ sub1::i#0 ]
[ sub1::return#0 ]
[ main::$0 ]
@@ -265,7 +248,7 @@ Complete equivalence classes
[ sub2::$0 ]
[ sub2::return#1 ]
[ sub1::return#1 ]
Allocated zp[1]:8 [ main::i#2 main::i#0 main::i#1 ]
Allocated zp[1]:8 [ main::i ]
Allocated zp[1]:9 [ sub1::i#0 ]
Allocated zp[1]:10 [ sub1::return#0 ]
Allocated zp[1]:11 [ main::$0 ]
@@ -302,65 +285,61 @@ __bend:
// main
main: {
.label SCREEN = $400
.label i = 8
.label __0 = $b
.label __1 = $e
.label i = 8
// [4] (byte) main::i#0 ← (byte) 0 -- vbuz1=vbuc1
// [4] (byte) main::i ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z i
// [5] phi from main main::@3 to main::@1 [phi:main/main::@3->main::@1]
__b1_from_main:
__b1_from___b3:
// [5] phi (byte) main::i#2 = (byte) main::i#0 [phi:main/main::@3->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [6] (byte) sub1::i#0 ← (byte) main::i#2 -- vbuz1=vbuz2
// [5] (byte) sub1::i#0 ← (byte) main::i -- vbuz1=vbuz2
lda.z i
sta.z sub1.i
// [7] call sub1
// [6] call sub1
jsr sub1
// [8] (byte) sub1::return#0 ← (byte) sub1::return#1 -- vbuz1=vbuz2
// [7] (byte) sub1::return#0 ← (byte) sub1::return#1 -- vbuz1=vbuz2
lda.z sub1.return_1
sta.z sub1.return
jmp __b2
// main::@2
__b2:
// [9] (byte~) main::$0 ← (byte) sub1::return#0 -- vbuz1=vbuz2
// [8] (byte~) main::$0 ← (byte) sub1::return#0 -- vbuz1=vbuz2
lda.z sub1.return
sta.z __0
// [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuz2
// [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z __0
ldy.z i
sta SCREEN,y
// [11] (byte) sub2::i#0 ← (byte) main::i#2 -- vbuz1=vbuz2
// [10] (byte) sub2::i#0 ← (byte) main::i -- vbuz1=vbuz2
lda.z i
sta.z sub2.i
// [12] call sub2
// [11] call sub2
jsr sub2
// [13] (byte) sub2::return#0 ← (byte) sub2::return#1 -- vbuz1=vbuz2
// [12] (byte) sub2::return#0 ← (byte) sub2::return#1 -- vbuz1=vbuz2
lda.z sub2.return_1
sta.z sub2.return
jmp __b3
// main::@3
__b3:
// [14] (byte~) main::$1 ← (byte) sub2::return#0 -- vbuz1=vbuz2
// [13] (byte~) main::$1 ← (byte) sub2::return#0 -- vbuz1=vbuz2
lda.z sub2.return
sta.z __1
// [15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i#2) ← (byte~) main::$1 -- pbuc1_derefidx_vbuz1=vbuz2
// [14] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i) ← (byte~) main::$1 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z __1
ldy.z i
sta SCREEN+$28,y
// [16] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [15] (byte) main::i ← ++ (byte) main::i -- vbuz1=_inc_vbuz1
inc.z i
// [17] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [16] if((byte) main::i!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp.z i
bne __b1_from___b3
bne __b1
jmp __breturn
// main::@return
__breturn:
// [18] return
// [17] return
rts
}
// sub2
@@ -370,11 +349,11 @@ sub2: {
.label i = $c
.label return = $d
.label return_1 = $10
// [19] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0 -- vbuz1=vbuz2_plus_vbuz2
// [18] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0 -- vbuz1=vbuz2_plus_vbuz2
lda.z i
asl
sta.z __0
// [20] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0 -- vbuz1=vbuz2_plus_vbuz3
// [19] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0 -- vbuz1=vbuz2_plus_vbuz3
lda.z __0
clc
adc.z i
@@ -382,7 +361,7 @@ sub2: {
jmp __breturn
// sub2::@return
__breturn:
// [21] return
// [20] return
rts
}
// sub1
@@ -391,35 +370,35 @@ sub1: {
.label i = 9
.label return = $a
.label return_1 = $11
// [22] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuz1=vbuz2_plus_vbuz2
// [21] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuz1=vbuz2_plus_vbuz2
lda.z i
asl
sta.z return_1
jmp __breturn
// sub1::@return
__breturn:
// [23] return
// [22] return
rts
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte) main::i#0 ← (byte) 0 [ main::i#0 ] ( main:2 [ main::i#0 ] ) always clobbers reg byte a
Statement [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte y
Statement [15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i#2) ← (byte~) main::$1 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte y
Statement [17] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a
Statement [19] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0 [ sub2::i#0 sub2::$0 ] ( main:2::sub2:12 [ main::i#2 sub2::i#0 sub2::$0 ] ) always clobbers reg byte a
Statement [4] (byte) main::i ← (byte) 0 [ main::i ] ( main:2 [ main::i ] ) always clobbers reg byte a
Statement [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 [ main::i ] ( main:2 [ main::i ] ) always clobbers reg byte y
Statement [14] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i) ← (byte~) main::$1 [ ] ( main:2 [ ] ) always clobbers reg byte y
Statement [16] if((byte) main::i!=(byte) 3) goto main::@1 [ main::i ] ( main:2 [ main::i ] ) always clobbers reg byte a
Statement [18] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0 [ sub2::i#0 sub2::$0 ] ( main:2::sub2:11 [ main::i sub2::i#0 sub2::$0 ] ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:12 [ sub2::i#0 ]
Statement [20] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0 [ sub2::return#1 ] ( main:2::sub2:12 [ main::i#2 sub2::return#1 ] ) always clobbers reg byte a
Statement [22] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 [ sub1::return#1 ] ( main:2::sub1:7 [ main::i#2 sub1::return#1 ] ) always clobbers reg byte a
Statement [4] (byte) main::i#0 ← (byte) 0 [ main::i#0 ] ( main:2 [ main::i#0 ] ) always clobbers reg byte a
Statement [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte y
Statement [15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i#2) ← (byte~) main::$1 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte y
Statement [17] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a
Statement [19] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0 [ sub2::i#0 sub2::$0 ] ( main:2::sub2:12 [ main::i#2 sub2::i#0 sub2::$0 ] ) always clobbers reg byte a
Statement [20] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0 [ sub2::return#1 ] ( main:2::sub2:12 [ main::i#2 sub2::return#1 ] ) always clobbers reg byte a
Statement [22] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 [ sub1::return#1 ] ( main:2::sub1:7 [ main::i#2 sub1::return#1 ] ) always clobbers reg byte a
Potential registers zp[1]:8 [ main::i#2 main::i#0 main::i#1 ] : zp[1]:8 ,
Statement [19] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0 [ sub2::return#1 ] ( main:2::sub2:11 [ main::i sub2::return#1 ] ) always clobbers reg byte a
Statement [21] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 [ sub1::return#1 ] ( main:2::sub1:6 [ main::i sub1::return#1 ] ) always clobbers reg byte a
Statement [4] (byte) main::i ← (byte) 0 [ main::i ] ( main:2 [ main::i ] ) always clobbers reg byte a
Statement [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 [ main::i ] ( main:2 [ main::i ] ) always clobbers reg byte y
Statement [14] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i) ← (byte~) main::$1 [ ] ( main:2 [ ] ) always clobbers reg byte y
Statement [16] if((byte) main::i!=(byte) 3) goto main::@1 [ main::i ] ( main:2 [ main::i ] ) always clobbers reg byte a
Statement [18] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0 [ sub2::i#0 sub2::$0 ] ( main:2::sub2:11 [ main::i sub2::i#0 sub2::$0 ] ) always clobbers reg byte a
Statement [19] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0 [ sub2::return#1 ] ( main:2::sub2:11 [ main::i sub2::return#1 ] ) always clobbers reg byte a
Statement [21] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 [ sub1::return#1 ] ( main:2::sub1:6 [ main::i sub1::return#1 ] ) always clobbers reg byte a
Potential registers zp[1]:8 [ main::i ] : zp[1]:8 ,
Potential registers zp[1]:9 [ sub1::i#0 ] : zp[1]:9 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:10 [ sub1::return#0 ] : zp[1]:10 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:11 [ main::$0 ] : zp[1]:11 , reg byte a , reg byte x , reg byte y ,
@@ -431,18 +410,18 @@ Potential registers zp[1]:16 [ sub2::return#1 ] : zp[1]:16 , reg byte a , reg by
Potential registers zp[1]:17 [ sub1::return#1 ] : zp[1]:17 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 26.68: zp[1]:8 [ main::i#2 main::i#0 main::i#1 ] 22: zp[1]:11 [ main::$0 ] 22: zp[1]:14 [ main::$1 ]
Uplift Scope [main] 22: zp[1]:11 [ main::$0 ] 22: zp[1]:14 [ main::$1 ] 6.58: zp[1]:8 [ main::i ]
Uplift Scope [sub1] 22: zp[1]:10 [ sub1::return#0 ] 15: zp[1]:9 [ sub1::i#0 ] 4.33: zp[1]:17 [ sub1::return#1 ]
Uplift Scope [sub2] 22: zp[1]:13 [ sub2::return#0 ] 8.5: zp[1]:12 [ sub2::i#0 ] 4.33: zp[1]:16 [ sub2::return#1 ] 4: zp[1]:15 [ sub2::$0 ]
Uplift Scope []
Uplifting [main] best 893 combination zp[1]:8 [ main::i#2 main::i#0 main::i#1 ] reg byte a [ main::$0 ] reg byte a [ main::$1 ]
Uplifting [sub1] best 767 combination reg byte a [ sub1::return#0 ] reg byte a [ sub1::i#0 ] reg byte a [ sub1::return#1 ]
Uplifting [sub2] best 640 combination reg byte a [ sub2::return#0 ] reg byte x [ sub2::i#0 ] reg byte a [ sub2::return#1 ] reg byte a [ sub2::$0 ]
Uplifting [main] best 866 combination reg byte a [ main::$0 ] reg byte a [ main::$1 ] zp[1]:8 [ main::i ]
Uplifting [sub1] best 740 combination reg byte a [ sub1::return#0 ] reg byte a [ sub1::i#0 ] reg byte a [ sub1::return#1 ]
Uplifting [sub2] best 613 combination reg byte a [ sub2::return#0 ] reg byte x [ sub2::i#0 ] reg byte a [ sub2::return#1 ] reg byte a [ sub2::$0 ]
Limited combination testing to 100 combinations of 192 possible.
Uplifting [] best 640 combination
Attempting to uplift remaining variables inzp[1]:8 [ main::i#2 main::i#0 main::i#1 ]
Uplifting [main] best 640 combination zp[1]:8 [ main::i#2 main::i#0 main::i#1 ]
Uplifting [] best 613 combination
Attempting to uplift remaining variables inzp[1]:8 [ main::i ]
Uplifting [main] best 613 combination zp[1]:8 [ main::i ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -470,77 +449,73 @@ __bend:
main: {
.label SCREEN = $400
.label i = 8
// [4] (byte) main::i#0 ← (byte) 0 -- vbuz1=vbuc1
// [4] (byte) main::i ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z i
// [5] phi from main main::@3 to main::@1 [phi:main/main::@3->main::@1]
__b1_from_main:
__b1_from___b3:
// [5] phi (byte) main::i#2 = (byte) main::i#0 [phi:main/main::@3->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [6] (byte) sub1::i#0 ← (byte) main::i#2 -- vbuaa=vbuz1
// [5] (byte) sub1::i#0 ← (byte) main::i -- vbuaa=vbuz1
lda.z i
// [7] call sub1
// [6] call sub1
jsr sub1
// [8] (byte) sub1::return#0 ← (byte) sub1::return#1
// [7] (byte) sub1::return#0 ← (byte) sub1::return#1
jmp __b2
// main::@2
__b2:
// [9] (byte~) main::$0 ← (byte) sub1::return#0
// [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
// [8] (byte~) main::$0 ← (byte) sub1::return#0
// [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy.z i
sta SCREEN,y
// [11] (byte) sub2::i#0 ← (byte) main::i#2 -- vbuxx=vbuz1
// [10] (byte) sub2::i#0 ← (byte) main::i -- vbuxx=vbuz1
ldx.z i
// [12] call sub2
// [11] call sub2
jsr sub2
// [13] (byte) sub2::return#0 ← (byte) sub2::return#1
// [12] (byte) sub2::return#0 ← (byte) sub2::return#1
jmp __b3
// main::@3
__b3:
// [14] (byte~) main::$1 ← (byte) sub2::return#0
// [15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i#2) ← (byte~) main::$1 -- pbuc1_derefidx_vbuz1=vbuaa
// [13] (byte~) main::$1 ← (byte) sub2::return#0
// [14] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i) ← (byte~) main::$1 -- pbuc1_derefidx_vbuz1=vbuaa
ldy.z i
sta SCREEN+$28,y
// [16] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [15] (byte) main::i ← ++ (byte) main::i -- vbuz1=_inc_vbuz1
inc.z i
// [17] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [16] if((byte) main::i!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp.z i
bne __b1_from___b3
bne __b1
jmp __breturn
// main::@return
__breturn:
// [18] return
// [17] return
rts
}
// sub2
// sub2(byte register(X) i)
sub2: {
// [19] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0 -- vbuaa=vbuxx_plus_vbuxx
// [18] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0 -- vbuaa=vbuxx_plus_vbuxx
txa
asl
// [20] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0 -- vbuaa=vbuaa_plus_vbuxx
// [19] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0 -- vbuaa=vbuaa_plus_vbuxx
stx.z $ff
clc
adc.z $ff
jmp __breturn
// sub2::@return
__breturn:
// [21] return
// [20] return
rts
}
// sub1
// sub1(byte register(A) i)
sub1: {
// [22] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
// [21] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
asl
jmp __breturn
// sub1::@return
__breturn:
// [23] return
// [22] return
rts
}
// File Data
@@ -556,12 +531,9 @@ Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Replacing label __b1_from___b3 with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Removing instruction __b1_from_main:
Removing instruction __b1_from___b3:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b2:
@@ -588,10 +560,7 @@ FINAL SYMBOL TABLE
(label) main::@3
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(byte) main::i
(byte) main::i#0 i zp[1]:8 4.0
(byte) main::i#1 i zp[1]:8 16.5
(byte) main::i#2 i zp[1]:8 6.181818181818182
(byte) main::i loadstore zp[1]:8 6.583333333333334
(byte()) sub1((byte) sub1::i)
(label) sub1::@return
(byte) sub1::i
@@ -608,7 +577,7 @@ FINAL SYMBOL TABLE
(byte) sub2::return#0 reg byte a 22.0
(byte) sub2::return#1 reg byte a 4.333333333333333
zp[1]:8 [ main::i#2 main::i#0 main::i#1 ]
zp[1]:8 [ main::i ]
reg byte a [ sub1::i#0 ]
reg byte a [ sub1::return#0 ]
reg byte a [ main::$0 ]
@@ -641,75 +610,73 @@ main: {
.label SCREEN = $400
.label i = 8
// for( volatile byte i : 0..2)
// [4] (byte) main::i#0 ← (byte) 0 -- vbuz1=vbuc1
// [4] (byte) main::i ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z i
// [5] phi from main main::@3 to main::@1 [phi:main/main::@3->main::@1]
// [5] phi (byte) main::i#2 = (byte) main::i#0 [phi:main/main::@3->main::@1#0] -- register_copy
// main::@1
__b1:
// sub1(i)
// [6] (byte) sub1::i#0 ← (byte) main::i#2 -- vbuaa=vbuz1
// [5] (byte) sub1::i#0 ← (byte) main::i -- vbuaa=vbuz1
lda.z i
// [7] call sub1
// [6] call sub1
jsr sub1
// [8] (byte) sub1::return#0 ← (byte) sub1::return#1
// [7] (byte) sub1::return#0 ← (byte) sub1::return#1
// main::@2
// [9] (byte~) main::$0 ← (byte) sub1::return#0
// [8] (byte~) main::$0 ← (byte) sub1::return#0
// SCREEN[i] = sub1(i)
// [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
// [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy.z i
sta SCREEN,y
// sub2(i)
// [11] (byte) sub2::i#0 ← (byte) main::i#2 -- vbuxx=vbuz1
// [10] (byte) sub2::i#0 ← (byte) main::i -- vbuxx=vbuz1
ldx.z i
// [12] call sub2
// [11] call sub2
jsr sub2
// [13] (byte) sub2::return#0 ← (byte) sub2::return#1
// [12] (byte) sub2::return#0 ← (byte) sub2::return#1
// main::@3
// [14] (byte~) main::$1 ← (byte) sub2::return#0
// [13] (byte~) main::$1 ← (byte) sub2::return#0
// (SCREEN+40)[i] = sub2(i)
// [15] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i#2) ← (byte~) main::$1 -- pbuc1_derefidx_vbuz1=vbuaa
// [14] *((const byte*) main::SCREEN+(byte) $28 + (byte) main::i) ← (byte~) main::$1 -- pbuc1_derefidx_vbuz1=vbuaa
ldy.z i
sta SCREEN+$28,y
// for( volatile byte i : 0..2)
// [16] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [15] (byte) main::i ← ++ (byte) main::i -- vbuz1=_inc_vbuz1
inc.z i
// [17] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [16] if((byte) main::i!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp.z i
bne __b1
// main::@return
// }
// [18] return
// [17] return
rts
}
// sub2
// sub2(byte register(X) i)
sub2: {
// i+i
// [19] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0 -- vbuaa=vbuxx_plus_vbuxx
// [18] (byte~) sub2::$0 ← (byte) sub2::i#0 + (byte) sub2::i#0 -- vbuaa=vbuxx_plus_vbuxx
txa
asl
// i+i+i
// [20] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0 -- vbuaa=vbuaa_plus_vbuxx
// [19] (byte) sub2::return#1 ← (byte~) sub2::$0 + (byte) sub2::i#0 -- vbuaa=vbuaa_plus_vbuxx
stx.z $ff
clc
adc.z $ff
// sub2::@return
// }
// [21] return
// [20] return
rts
}
// sub1
// sub1(byte register(A) i)
sub1: {
// i+i
// [22] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
// [21] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
asl
// sub1::@return
// }
// [23] return
// [22] return
rts
}
// File Data
+2 -5
View File
@@ -9,10 +9,7 @@
(label) main::@3
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(byte) main::i
(byte) main::i#0 i zp[1]:8 4.0
(byte) main::i#1 i zp[1]:8 16.5
(byte) main::i#2 i zp[1]:8 6.181818181818182
(byte) main::i loadstore zp[1]:8 6.583333333333334
(byte()) sub1((byte) sub1::i)
(label) sub1::@return
(byte) sub1::i
@@ -29,7 +26,7 @@
(byte) sub2::return#0 reg byte a 22.0
(byte) sub2::return#1 reg byte a 4.333333333333333
zp[1]:8 [ main::i#2 main::i#0 main::i#1 ]
zp[1]:8 [ main::i ]
reg byte a [ sub1::i#0 ]
reg byte a [ sub1::return#0 ]
reg byte a [ main::$0 ]
+11 -12
View File
@@ -10,28 +10,27 @@
(void()) main()
main: scope:[main] from @1
[4] (byte) main::i#0 ← (byte) 0
[4] (byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@2/(byte) main::i#1 )
[6] (byte) sub1::i#0 ← (byte) main::i#2
[7] call sub1
[8] (byte) sub1::return#0 ← (byte) sub1::return#1
[5] (byte) sub1::i#0 ← (byte) main::i
[6] call sub1
[7] (byte) sub1::return#0 ← (byte) sub1::return#1
to:main::@2
main::@2: scope:[main] from main::@1
[9] (byte~) main::$0 ← (byte) sub1::return#0
[10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0
[11] (byte) main::i#1 ← ++ (byte) main::i#2
[12] if((byte) main::i#1!=(byte) 3) goto main::@1
[8] (byte~) main::$0 ← (byte) sub1::return#0
[9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0
[10] (byte) main::i ← ++ (byte) main::i
[11] if((byte) main::i!=(byte) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[13] return
[12] return
to:@return
(byte()) sub1((byte) sub1::i)
sub1: scope:[sub1] from main::@1
[14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
[13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
to:sub1::@return
sub1::@return: scope:[sub1] from sub1
[15] return
[14] return
to:@return
+77 -108
View File
@@ -9,21 +9,19 @@ CONTROL FLOW GRAPH SSA
(void()) main()
main: scope:[main] from @3
(byte) main::i#0 ← (byte) 0
(byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@3
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@3/(byte) main::i#1 )
(byte) sub1::i#0 ← (byte) main::i#2
(byte) sub1::i#0 ← (byte) main::i
call sub1
(byte) sub1::return#0 ← (byte) sub1::return#2
to:main::@3
main::@3: scope:[main] from main::@1
(byte) main::i#3 ← phi( main::@1/(byte) main::i#2 )
(byte) sub1::return#3 ← phi( main::@1/(byte) sub1::return#0 )
(byte~) main::$0 ← (byte) sub1::return#3
*((const byte*) main::SCREEN + (byte) main::i#3) ← (byte~) main::$0
(byte) main::i#1 ← (byte) main::i#3 + rangenext(0,2)
(bool~) main::$1 ← (byte) main::i#1 != rangelast(0,2)
*((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0
(byte) main::i ← (byte) main::i + rangenext(0,2)
(bool~) main::$1 ← (byte) main::i != rangelast(0,2)
if((bool~) main::$1) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
@@ -60,11 +58,7 @@ SYMBOL TABLE SSA
(label) main::@3
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i#3
(byte) main::i loadstore
(byte()) sub1((byte) sub1::i)
(byte~) sub1::$0
(label) sub1::@return
@@ -81,36 +75,31 @@ SYMBOL TABLE SSA
Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
Alias (byte) sub1::return#0 = (byte) sub1::return#3
Alias (byte) main::i#2 = (byte) main::i#3
Alias (byte) sub1::return#1 = (byte~) sub1::$0 (byte) sub1::return#4 (byte) sub1::return#2
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) sub1::i#1 (byte) sub1::i#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$1 [10] if((byte) main::i#1!=rangelast(0,2)) goto main::@1
Simple Condition (bool~) main::$1 [9] if((byte) main::i!=rangelast(0,2)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Resolved ranged next value [8] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [10] if(main::i#1!=rangelast(0,2)) goto main::@1 to (number) 3
Adding number conversion cast (unumber) 3 in if((byte) main::i#1!=(number) 3) goto main::@1
Resolved ranged next value [7] main::i ← ++ main::i to ++
Resolved ranged comparison value [9] if(main::i!=rangelast(0,2)) goto main::@1 to (number) 3
Adding number conversion cast (unumber) 3 in if((byte) main::i!=(number) 3) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 3
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 3
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting main::@4(between main::@3 and main::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @3
Adding NOP phi() at start of @4
Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:2
Calls in [main] to sub1:9
Calls in [main] to sub1:7
Created 1 initial phi equivalence classes
Coalesced [6] main::i#4 ← main::i#0
Coalesced [16] main::i#5 ← main::i#1
Coalesced down to 1 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @4
Culled Empty Block (label) main::@4
Renumbering block @3 to @1
Renumbering block main::@3 to main::@2
Adding NOP phi() at start of @begin
@@ -130,40 +119,36 @@ FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from @1
[4] (byte) main::i#0 ← (byte) 0
[4] (byte) main::i ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@2/(byte) main::i#1 )
[6] (byte) sub1::i#0 ← (byte) main::i#2
[7] call sub1
[8] (byte) sub1::return#0 ← (byte) sub1::return#1
[5] (byte) sub1::i#0 ← (byte) main::i
[6] call sub1
[7] (byte) sub1::return#0 ← (byte) sub1::return#1
to:main::@2
main::@2: scope:[main] from main::@1
[9] (byte~) main::$0 ← (byte) sub1::return#0
[10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0
[11] (byte) main::i#1 ← ++ (byte) main::i#2
[12] if((byte) main::i#1!=(byte) 3) goto main::@1
[8] (byte~) main::$0 ← (byte) sub1::return#0
[9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0
[10] (byte) main::i ← ++ (byte) main::i
[11] if((byte) main::i!=(byte) 3) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@2
[13] return
[12] return
to:@return
(byte()) sub1((byte) sub1::i)
sub1: scope:[sub1] from main::@1
[14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
[13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0
to:sub1::@return
sub1::@return: scope:[sub1] from sub1
[15] return
[14] return
to:@return
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte~) main::$0 22.0
(byte) main::i
(byte) main::i#0 4.0
(byte) main::i#1 16.5
(byte) main::i#2 7.666666666666666
(byte) main::i loadstore 8.142857142857142
(byte()) sub1((byte) sub1::i)
(byte) sub1::i
(byte) sub1::i#0 15.0
@@ -172,18 +157,18 @@ VARIABLE REGISTER WEIGHTS
(byte) sub1::return#1 4.333333333333333
Initial phi equivalence classes
[ main::i#2 main::i#0 main::i#1 ]
Added variable main::i to live range equivalence class [ main::i ]
Added variable sub1::i#0 to live range equivalence class [ sub1::i#0 ]
Added variable sub1::return#0 to live range equivalence class [ sub1::return#0 ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Added variable sub1::return#1 to live range equivalence class [ sub1::return#1 ]
Complete equivalence classes
[ main::i#2 main::i#0 main::i#1 ]
[ main::i ]
[ sub1::i#0 ]
[ sub1::return#0 ]
[ main::$0 ]
[ sub1::return#1 ]
Allocated zp[1]:5 [ main::i#2 main::i#0 main::i#1 ]
Allocated zp[1]:5 [ main::i ]
Allocated zp[1]:6 [ sub1::i#0 ]
Allocated zp[1]:7 [ sub1::return#0 ]
Allocated zp[1]:8 [ main::$0 ]
@@ -215,46 +200,42 @@ __bend:
// main
main: {
.label SCREEN = $400
.label __0 = 8
.label i = 5
// [4] (byte) main::i#0 ← (byte) 0 -- vbuz1=vbuc1
.label __0 = 8
// [4] (byte) main::i ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z i
// [5] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1]
__b1_from_main:
__b1_from___b2:
// [5] phi (byte) main::i#2 = (byte) main::i#0 [phi:main/main::@2->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [6] (byte) sub1::i#0 ← (byte) main::i#2 -- vbuz1=vbuz2
// [5] (byte) sub1::i#0 ← (byte) main::i -- vbuz1=vbuz2
lda.z i
sta.z sub1.i
// [7] call sub1
// [6] call sub1
jsr sub1
// [8] (byte) sub1::return#0 ← (byte) sub1::return#1 -- vbuz1=vbuz2
// [7] (byte) sub1::return#0 ← (byte) sub1::return#1 -- vbuz1=vbuz2
lda.z sub1.return_1
sta.z sub1.return
jmp __b2
// main::@2
__b2:
// [9] (byte~) main::$0 ← (byte) sub1::return#0 -- vbuz1=vbuz2
// [8] (byte~) main::$0 ← (byte) sub1::return#0 -- vbuz1=vbuz2
lda.z sub1.return
sta.z __0
// [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuz2
// [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuz2
lda.z __0
ldy.z i
sta SCREEN,y
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [10] (byte) main::i ← ++ (byte) main::i -- vbuz1=_inc_vbuz1
inc.z i
// [12] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [11] if((byte) main::i!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp.z i
bne __b1_from___b2
bne __b1
jmp __breturn
// main::@return
__breturn:
// [13] return
// [12] return
rts
}
// sub1
@@ -263,39 +244,39 @@ sub1: {
.label i = 6
.label return = 7
.label return_1 = 9
// [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuz1=vbuz2_plus_vbuz2
// [13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuz1=vbuz2_plus_vbuz2
lda.z i
asl
sta.z return_1
jmp __breturn
// sub1::@return
__breturn:
// [15] return
// [14] return
rts
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte) main::i#0 ← (byte) 0 [ main::i#0 ] ( main:2 [ main::i#0 ] ) always clobbers reg byte a
Statement [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte y
Statement [12] if((byte) main::i#1!=(byte) 3) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a
Statement [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 [ sub1::return#1 ] ( main:2::sub1:7 [ main::i#2 sub1::return#1 ] ) always clobbers reg byte a
Potential registers zp[1]:5 [ main::i#2 main::i#0 main::i#1 ] : zp[1]:5 ,
Statement [4] (byte) main::i ← (byte) 0 [ main::i ] ( main:2 [ main::i ] ) always clobbers reg byte a
Statement [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 [ ] ( main:2 [ ] ) always clobbers reg byte y
Statement [11] if((byte) main::i!=(byte) 3) goto main::@1 [ main::i ] ( main:2 [ main::i ] ) always clobbers reg byte a
Statement [13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 [ sub1::return#1 ] ( main:2::sub1:6 [ main::i sub1::return#1 ] ) always clobbers reg byte a
Potential registers zp[1]:5 [ main::i ] : zp[1]:5 ,
Potential registers zp[1]:6 [ sub1::i#0 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:7 [ sub1::return#0 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:8 [ main::$0 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y ,
Potential registers zp[1]:9 [ sub1::return#1 ] : zp[1]:9 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 28.17: zp[1]:5 [ main::i#2 main::i#0 main::i#1 ] 22: zp[1]:8 [ main::$0 ]
Uplift Scope [sub1] 22: zp[1]:7 [ sub1::return#0 ] 15: zp[1]:6 [ sub1::i#0 ] 4.33: zp[1]:9 [ sub1::return#1 ]
Uplift Scope [main] 22: zp[1]:8 [ main::$0 ] 8.14: zp[1]:5 [ main::i ]
Uplift Scope []
Uplifting [main] best 545 combination zp[1]:5 [ main::i#2 main::i#0 main::i#1 ] reg byte a [ main::$0 ]
Uplifting [sub1] best 419 combination reg byte a [ sub1::return#0 ] reg byte a [ sub1::i#0 ] reg byte a [ sub1::return#1 ]
Uplifting [] best 419 combination
Attempting to uplift remaining variables inzp[1]:5 [ main::i#2 main::i#0 main::i#1 ]
Uplifting [main] best 419 combination zp[1]:5 [ main::i#2 main::i#0 main::i#1 ]
Uplifting [sub1] best 452 combination reg byte a [ sub1::return#0 ] reg byte a [ sub1::i#0 ] reg byte a [ sub1::return#1 ]
Uplifting [main] best 392 combination reg byte a [ main::$0 ] zp[1]:5 [ main::i ]
Uplifting [] best 392 combination
Attempting to uplift remaining variables inzp[1]:5 [ main::i ]
Uplifting [main] best 392 combination zp[1]:5 [ main::i ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -323,49 +304,45 @@ __bend:
main: {
.label SCREEN = $400
.label i = 5
// [4] (byte) main::i#0 ← (byte) 0 -- vbuz1=vbuc1
// [4] (byte) main::i ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z i
// [5] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1]
__b1_from_main:
__b1_from___b2:
// [5] phi (byte) main::i#2 = (byte) main::i#0 [phi:main/main::@2->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [6] (byte) sub1::i#0 ← (byte) main::i#2 -- vbuaa=vbuz1
// [5] (byte) sub1::i#0 ← (byte) main::i -- vbuaa=vbuz1
lda.z i
// [7] call sub1
// [6] call sub1
jsr sub1
// [8] (byte) sub1::return#0 ← (byte) sub1::return#1
// [7] (byte) sub1::return#0 ← (byte) sub1::return#1
jmp __b2
// main::@2
__b2:
// [9] (byte~) main::$0 ← (byte) sub1::return#0
// [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
// [8] (byte~) main::$0 ← (byte) sub1::return#0
// [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy.z i
sta SCREEN,y
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [10] (byte) main::i ← ++ (byte) main::i -- vbuz1=_inc_vbuz1
inc.z i
// [12] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [11] if((byte) main::i!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp.z i
bne __b1_from___b2
bne __b1
jmp __breturn
// main::@return
__breturn:
// [13] return
// [12] return
rts
}
// sub1
// sub1(byte register(A) i)
sub1: {
// [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
// [13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
asl
jmp __breturn
// sub1::@return
__breturn:
// [15] return
// [14] return
rts
}
// File Data
@@ -379,12 +356,9 @@ Removing instruction jmp __breturn
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __bbegin with __b1
Replacing label __b1_from___b2 with __b1
Removing instruction __bbegin:
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Removing instruction __b1_from_main:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b2:
@@ -407,10 +381,7 @@ FINAL SYMBOL TABLE
(label) main::@2
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(byte) main::i
(byte) main::i#0 i zp[1]:5 4.0
(byte) main::i#1 i zp[1]:5 16.5
(byte) main::i#2 i zp[1]:5 7.666666666666666
(byte) main::i loadstore zp[1]:5 8.142857142857142
(byte()) sub1((byte) sub1::i)
(label) sub1::@return
(byte) sub1::i
@@ -419,7 +390,7 @@ FINAL SYMBOL TABLE
(byte) sub1::return#0 reg byte a 22.0
(byte) sub1::return#1 reg byte a 4.333333333333333
zp[1]:5 [ main::i#2 main::i#0 main::i#1 ]
zp[1]:5 [ main::i ]
reg byte a [ sub1::i#0 ]
reg byte a [ sub1::return#0 ]
reg byte a [ main::$0 ]
@@ -447,46 +418,44 @@ main: {
.label SCREEN = $400
.label i = 5
// for( volatile byte i : 0..2)
// [4] (byte) main::i#0 ← (byte) 0 -- vbuz1=vbuc1
// [4] (byte) main::i ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z i
// [5] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1]
// [5] phi (byte) main::i#2 = (byte) main::i#0 [phi:main/main::@2->main::@1#0] -- register_copy
// main::@1
__b1:
// sub1(i)
// [6] (byte) sub1::i#0 ← (byte) main::i#2 -- vbuaa=vbuz1
// [5] (byte) sub1::i#0 ← (byte) main::i -- vbuaa=vbuz1
lda.z i
// [7] call sub1
// [6] call sub1
jsr sub1
// [8] (byte) sub1::return#0 ← (byte) sub1::return#1
// [7] (byte) sub1::return#0 ← (byte) sub1::return#1
// main::@2
// [9] (byte~) main::$0 ← (byte) sub1::return#0
// [8] (byte~) main::$0 ← (byte) sub1::return#0
// SCREEN[i] = sub1(i)
// [10] *((const byte*) main::SCREEN + (byte) main::i#2) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
// [9] *((const byte*) main::SCREEN + (byte) main::i) ← (byte~) main::$0 -- pbuc1_derefidx_vbuz1=vbuaa
ldy.z i
sta SCREEN,y
// for( volatile byte i : 0..2)
// [11] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
// [10] (byte) main::i ← ++ (byte) main::i -- vbuz1=_inc_vbuz1
inc.z i
// [12] if((byte) main::i#1!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
// [11] if((byte) main::i!=(byte) 3) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #3
cmp.z i
bne __b1
// main::@return
// }
// [13] return
// [12] return
rts
}
// sub1
// sub1(byte register(A) i)
sub1: {
// i+i
// [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
// [13] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuaa=vbuaa_plus_vbuaa
asl
// sub1::@return
// }
// [15] return
// [14] return
rts
}
// File Data
+2 -5
View File
@@ -7,10 +7,7 @@
(label) main::@2
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(byte) main::i
(byte) main::i#0 i zp[1]:5 4.0
(byte) main::i#1 i zp[1]:5 16.5
(byte) main::i#2 i zp[1]:5 7.666666666666666
(byte) main::i loadstore zp[1]:5 8.142857142857142
(byte()) sub1((byte) sub1::i)
(label) sub1::@return
(byte) sub1::i
@@ -19,7 +16,7 @@
(byte) sub1::return#0 reg byte a 22.0
(byte) sub1::return#1 reg byte a 4.333333333333333
zp[1]:5 [ main::i#2 main::i#0 main::i#1 ]
zp[1]:5 [ main::i ]
reg byte a [ sub1::i#0 ]
reg byte a [ sub1::return#0 ]
reg byte a [ main::$0 ]
+2 -2
View File
@@ -10,8 +10,8 @@
(void()) main()
main: scope:[main] from @1
[4] (byte) main::b#0 ← (byte) 0
[5] (word) main::w#0 ← (byte) 0
[4] (byte) main::b ← (byte) 0
[5] (word) main::w ← (byte) 0
[6] *((const byte*) SCREEN) ← (byte) '0'+(const byte) SIZEOF_NUMBER
[7] *((const byte*) SCREEN+(byte) 1) ← (byte) '0'+(const byte) SIZEOF_BYTE
[8] *((const byte*) SCREEN+(byte) 2) ← (byte) '0'+(const byte) SIZEOF_BYTE
+36 -40
View File
@@ -15,8 +15,8 @@ CONTROL FLOW GRAPH SSA
(void()) main()
main: scope:[main] from @1
(byte) main::idx#0 ← (number) 0
(byte) main::b#0 ← (number) 0
(word) main::w#0 ← (number) 0
(byte) main::b ← (number) 0
(word) main::w ← (number) 0
(byte~) main::$0 ← sizeof (number) 0
(byte~) main::$1 ← (byte) '0' + (byte~) main::$0
*((const byte*) SCREEN + (byte) main::idx#0) ← (byte~) main::$1
@@ -90,8 +90,7 @@ SYMBOL TABLE SSA
(byte~) main::$8
(byte~) main::$9
(label) main::@return
(byte) main::b
(byte) main::b#0
(byte) main::b loadstore
(byte) main::idx
(byte) main::idx#0
(byte) main::idx#1
@@ -104,16 +103,15 @@ SYMBOL TABLE SSA
(byte) main::idx#7
(byte) main::idx#8
(byte) main::idx#9
(word) main::w
(word) main::w#0
(word) main::w loadstore
Adding number conversion cast (unumber) 0 in (byte) main::idx#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) main::b#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (word) main::w#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) main::b ← (number) 0
Adding number conversion cast (unumber) 0 in (word) main::w ← (number) 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) main::idx#0 ← (unumber)(number) 0
Inlining cast (byte) main::b#0 ← (unumber)(number) 0
Inlining cast (word) main::w#0 ← (unumber)(number) 0
Inlining cast (byte) main::b ← (unumber)(number) 0
Inlining cast (word) main::w ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
@@ -286,8 +284,8 @@ FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from @1
[4] (byte) main::b#0 ← (byte) 0
[5] (word) main::w#0 ← (byte) 0
[4] (byte) main::b ← (byte) 0
[5] (word) main::w ← (byte) 0
[6] *((const byte*) SCREEN) ← (byte) '0'+(const byte) SIZEOF_NUMBER
[7] *((const byte*) SCREEN+(byte) 1) ← (byte) '0'+(const byte) SIZEOF_BYTE
[8] *((const byte*) SCREEN+(byte) 2) ← (byte) '0'+(const byte) SIZEOF_BYTE
@@ -304,18 +302,18 @@ main::@return: scope:[main] from main
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::b
(byte) main::b#0 20.0
(byte) main::b loadstore 20.0
(byte) main::idx
(word) main::w
(word) main::w#0 20.0
(word) main::w loadstore 20.0
Initial phi equivalence classes
Added variable main::b to live range equivalence class [ main::b ]
Added variable main::w to live range equivalence class [ main::w ]
Complete equivalence classes
[ main::b#0 ]
[ main::w#0 ]
Allocated zp[1]:2 [ main::b#0 ]
Allocated zp[2]:3 [ main::w#0 ]
[ main::b ]
[ main::w ]
Allocated zp[1]:2 [ main::b ]
Allocated zp[2]:3 [ main::w ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -349,11 +347,11 @@ __bend:
main: {
.label b = 2
.label w = 3
// [4] (byte) main::b#0 ← (byte) 0 -- vbuz1=vbuc1
// [4] (byte) main::b ← (byte) 0 -- vbuz1=vbuc1
// Simple types
lda #0
sta.z b
// [5] (word) main::w#0 ← (byte) 0 -- vwuz1=vbuc1
// [5] (word) main::w ← (byte) 0 -- vwuz1=vbuc1
lda #<0
sta.z w
lda #>0
@@ -391,8 +389,8 @@ main: {
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte) main::b#0 ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [5] (word) main::w#0 ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [4] (byte) main::b ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [5] (word) main::w ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [6] *((const byte*) SCREEN) ← (byte) '0'+(const byte) SIZEOF_NUMBER [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [7] *((const byte*) SCREEN+(byte) 1) ← (byte) '0'+(const byte) SIZEOF_BYTE [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [8] *((const byte*) SCREEN+(byte) 2) ← (byte) '0'+(const byte) SIZEOF_BYTE [ ] ( main:2 [ ] ) always clobbers reg byte a
@@ -401,17 +399,17 @@ Statement [10] *((const byte*) SCREEN+(byte) 5) ← (byte) '0'+(const byte) SIZE
Statement [11] *((const byte*) SCREEN+(byte) 6) ← (byte) '0'+(const byte) SIZEOF_WORD [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [12] *((const byte*) SCREEN+(byte) 8) ← (byte) '0'+(const byte) SIZEOF_POINTER [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [13] *((const byte*) SCREEN+(byte) 9) ← (byte) '0'+(const byte) SIZEOF_POINTER [ ] ( main:2 [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::b#0 ] : zp[1]:2 ,
Potential registers zp[2]:3 [ main::w#0 ] : zp[2]:3 ,
Potential registers zp[1]:2 [ main::b ] : zp[1]:2 ,
Potential registers zp[2]:3 [ main::w ] : zp[2]:3 ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 20: zp[1]:2 [ main::b#0 ] 20: zp[2]:3 [ main::w#0 ]
Uplift Scope [main] 20: zp[1]:2 [ main::b ] 20: zp[2]:3 [ main::w ]
Uplift Scope []
Uplifting [main] best 84 combination zp[1]:2 [ main::b#0 ] zp[2]:3 [ main::w#0 ]
Uplifting [main] best 84 combination zp[1]:2 [ main::b ] zp[2]:3 [ main::w ]
Uplifting [] best 84 combination
Attempting to uplift remaining variables inzp[1]:2 [ main::b#0 ]
Uplifting [main] best 84 combination zp[1]:2 [ main::b#0 ]
Attempting to uplift remaining variables inzp[1]:2 [ main::b ]
Uplifting [main] best 84 combination zp[1]:2 [ main::b ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -444,11 +442,11 @@ __bend:
main: {
.label b = 2
.label w = 3
// [4] (byte) main::b#0 ← (byte) 0 -- vbuz1=vbuc1
// [4] (byte) main::b ← (byte) 0 -- vbuz1=vbuc1
// Simple types
lda #0
sta.z b
// [5] (word) main::w#0 ← (byte) 0 -- vwuz1=vbuc1
// [5] (word) main::w ← (byte) 0 -- vwuz1=vbuc1
lda #<0
sta.z w
lda #>0
@@ -521,14 +519,12 @@ FINAL SYMBOL TABLE
(const byte) SIZEOF_WORD = (byte) 2
(void()) main()
(label) main::@return
(byte) main::b
(byte) main::b#0 b zp[1]:2 20.0
(byte) main::b loadstore zp[1]:2 20.0
(byte) main::idx
(word) main::w
(word) main::w#0 w zp[2]:3 20.0
(word) main::w loadstore zp[2]:3 20.0
zp[1]:2 [ main::b#0 ]
zp[2]:3 [ main::w#0 ]
zp[1]:2 [ main::b ]
zp[2]:3 [ main::w ]
FINAL ASSEMBLER
@@ -557,12 +553,12 @@ main: {
.label b = 2
.label w = 3
// b = 0
// [4] (byte) main::b#0 ← (byte) 0 -- vbuz1=vbuc1
// [4] (byte) main::b ← (byte) 0 -- vbuz1=vbuc1
// Simple types
lda #0
sta.z b
// w = 0
// [5] (word) main::w#0 ← (byte) 0 -- vwuz1=vbuc1
// [5] (word) main::w ← (byte) 0 -- vwuz1=vbuc1
sta.z w
sta.z w+1
// SCREEN[idx++] = '0'+sizeof(0)
+4 -6
View File
@@ -8,11 +8,9 @@
(const byte) SIZEOF_WORD = (byte) 2
(void()) main()
(label) main::@return
(byte) main::b
(byte) main::b#0 b zp[1]:2 20.0
(byte) main::b loadstore zp[1]:2 20.0
(byte) main::idx
(word) main::w
(word) main::w#0 w zp[2]:3 20.0
(word) main::w loadstore zp[2]:3 20.0
zp[1]:2 [ main::b#0 ]
zp[2]:3 [ main::w#0 ]
zp[1]:2 [ main::b ]
zp[2]:3 [ main::w ]
+2 -2
View File
@@ -10,8 +10,8 @@
(void()) main()
main: scope:[main] from @1
[4] (byte) main::p_x#0 ← (byte) 2
[5] (byte) main::p_y#0 ← (byte) 3
[4] (byte) main::p_x ← (byte) 2
[5] (byte) main::p_y ← (byte) 3
[6] *((const byte*) main::SCREEN) ← *((byte*)(const struct Point*) main::q)
[7] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) main::q+(const byte) OFFSET_STRUCT_POINT_Y)
to:main::@return
+38 -46
View File
@@ -7,7 +7,6 @@ Adding struct value member variable copy (byte) main::p_y ← (byte)(number) 3
Rewriting struct pointer member access *((struct Point*) main::q).x
Rewriting struct pointer member access *((struct Point*) main::q).y
Identified constant variable (struct Point*) main::q
Adding versioned struct unwinding for (struct Point) main::p#0
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
@@ -15,9 +14,9 @@ CONTROL FLOW GRAPH SSA
(void()) main()
main: scope:[main] from @1
(byte) main::p_x#0 ← (byte)(number) 2
(byte) main::p_y#0 ← (byte)(number) 3
(struct Point) main::p#0 ← struct-unwound {(byte) main::p_x#0, (byte) main::p_y#0}
(byte) main::p_x ← (byte)(number) 2
(byte) main::p_y ← (byte)(number) 3
(struct Point) main::p ← struct-unwound {(byte) main::p_x, (byte) main::p_y}
(byte*~) main::$0 ← (byte*)(const struct Point*) main::q + (const byte) OFFSET_STRUCT_POINT_X
*((const byte*) main::SCREEN + (number) 0) ← *((byte*~) main::$0)
(byte*~) main::$1 ← (byte*)(const struct Point*) main::q + (const byte) OFFSET_STRUCT_POINT_Y
@@ -47,12 +46,9 @@ SYMBOL TABLE SSA
(byte*~) main::$1
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
(struct Point) main::p
(struct Point) main::p#0
(byte) main::p_x
(byte) main::p_x#0
(byte) main::p_y
(byte) main::p_y#0
(struct Point) main::p loadstore
(byte) main::p_x loadstore
(byte) main::p_y loadstore
(const struct Point*) main::q = &(struct Point) main::p
Adding number conversion cast (unumber) 0 in *((const byte*) main::SCREEN + (number) 0) ← *((byte*~) main::$0)
@@ -78,7 +74,7 @@ Successful SSA optimization Pass2ConstantIdentification
Simplifying expression containing zero (byte*)main::q in
Simplifying expression containing zero main::SCREEN in [4] *((const byte*) main::SCREEN + (byte) 0) ← *((const byte*) main::$0)
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable (struct Point) main::p#0 and assignment [2] (struct Point) main::p#0 ← struct-unwound {(byte) main::p_x#0, (byte) main::p_y#0}
Eliminating unused variable (struct Point) main::p and assignment [2] (struct Point) main::p ← struct-unwound {(byte) main::p_x, (byte) main::p_y}
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
Successful SSA optimization PassNEliminateUnusedVars
Constant inlined main::$1 = (byte*)(const struct Point*) main::q+(const byte) OFFSET_STRUCT_POINT_Y
@@ -113,8 +109,8 @@ FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from @1
[4] (byte) main::p_x#0 ← (byte) 2
[5] (byte) main::p_y#0 ← (byte) 3
[4] (byte) main::p_x ← (byte) 2
[5] (byte) main::p_y ← (byte) 3
[6] *((const byte*) main::SCREEN) ← *((byte*)(const struct Point*) main::q)
[7] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) main::q+(const byte) OFFSET_STRUCT_POINT_Y)
to:main::@return
@@ -127,18 +123,17 @@ VARIABLE REGISTER WEIGHTS
(byte) Point::x
(byte) Point::y
(void()) main()
(struct Point) main::p
(byte) main::p_x
(byte) main::p_x#0 20.0
(byte) main::p_y
(byte) main::p_y#0 20.0
(byte) main::p_x loadstore 20.0
(byte) main::p_y loadstore 20.0
Initial phi equivalence classes
Added variable main::p_x to live range equivalence class [ main::p_x ]
Added variable main::p_y to live range equivalence class [ main::p_y ]
Complete equivalence classes
[ main::p_x#0 ]
[ main::p_y#0 ]
Allocated zp[1]:2 [ main::p_x#0 ]
Allocated zp[1]:3 [ main::p_y#0 ]
[ main::p_x ]
[ main::p_y ]
Allocated zp[1]:2 [ main::p_x ]
Allocated zp[1]:3 [ main::p_y ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -170,10 +165,10 @@ main: {
.label q = p_x
.label p_x = 2
.label p_y = 3
// [4] (byte) main::p_x#0 ← (byte) 2 -- vbuz1=vbuc1
// [4] (byte) main::p_x ← (byte) 2 -- vbuz1=vbuc1
lda #2
sta.z p_x
// [5] (byte) main::p_y#0 ← (byte) 3 -- vbuz1=vbuc1
// [5] (byte) main::p_y ← (byte) 3 -- vbuz1=vbuc1
lda #3
sta.z p_y
// [6] *((const byte*) main::SCREEN) ← *((byte*)(const struct Point*) main::q) -- _deref_pbuc1=_deref_pbuc2
@@ -191,25 +186,25 @@ main: {
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte) main::p_x#0 ← (byte) 2 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [5] (byte) main::p_y#0 ← (byte) 3 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [4] (byte) main::p_x ← (byte) 2 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [5] (byte) main::p_y ← (byte) 3 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [6] *((const byte*) main::SCREEN) ← *((byte*)(const struct Point*) main::q) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [7] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) main::q+(const byte) OFFSET_STRUCT_POINT_Y) [ ] ( main:2 [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::p_x#0 ] : zp[1]:2 ,
Potential registers zp[1]:3 [ main::p_y#0 ] : zp[1]:3 ,
Potential registers zp[1]:2 [ main::p_x ] : zp[1]:2 ,
Potential registers zp[1]:3 [ main::p_y ] : zp[1]:3 ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 20: zp[1]:2 [ main::p_x#0 ] 20: zp[1]:3 [ main::p_y#0 ]
Uplift Scope [main] 20: zp[1]:2 [ main::p_x ] 20: zp[1]:3 [ main::p_y ]
Uplift Scope [Point]
Uplift Scope []
Uplifting [main] best 46 combination zp[1]:2 [ main::p_x#0 ] zp[1]:3 [ main::p_y#0 ]
Uplifting [main] best 46 combination zp[1]:2 [ main::p_x ] zp[1]:3 [ main::p_y ]
Uplifting [Point] best 46 combination
Uplifting [] best 46 combination
Attempting to uplift remaining variables inzp[1]:2 [ main::p_x#0 ]
Uplifting [main] best 46 combination zp[1]:2 [ main::p_x#0 ]
Attempting to uplift remaining variables inzp[1]:3 [ main::p_y#0 ]
Uplifting [main] best 46 combination zp[1]:3 [ main::p_y#0 ]
Attempting to uplift remaining variables inzp[1]:2 [ main::p_x ]
Uplifting [main] best 46 combination zp[1]:2 [ main::p_x ]
Attempting to uplift remaining variables inzp[1]:3 [ main::p_y ]
Uplifting [main] best 46 combination zp[1]:3 [ main::p_y ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -240,10 +235,10 @@ main: {
.label q = p_x
.label p_x = 2
.label p_y = 3
// [4] (byte) main::p_x#0 ← (byte) 2 -- vbuz1=vbuc1
// [4] (byte) main::p_x ← (byte) 2 -- vbuz1=vbuc1
lda #2
sta.z p_x
// [5] (byte) main::p_y#0 ← (byte) 3 -- vbuz1=vbuc1
// [5] (byte) main::p_y ← (byte) 3 -- vbuz1=vbuc1
lda #3
sta.z p_y
// [6] *((const byte*) main::SCREEN) ← *((byte*)(const struct Point*) main::q) -- _deref_pbuc1=_deref_pbuc2
@@ -289,15 +284,12 @@ FINAL SYMBOL TABLE
(void()) main()
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(struct Point) main::p
(byte) main::p_x
(byte) main::p_x#0 p_x zp[1]:2 20.0
(byte) main::p_y
(byte) main::p_y#0 p_y zp[1]:3 20.0
(const struct Point*) main::q = (struct Point*)&(byte) main::p_x#0
(byte) main::p_x loadstore zp[1]:2 20.0
(byte) main::p_y loadstore zp[1]:3 20.0
(const struct Point*) main::q = (struct Point*)&(byte) main::p_x
zp[1]:2 [ main::p_x#0 ]
zp[1]:3 [ main::p_y#0 ]
zp[1]:2 [ main::p_x ]
zp[1]:3 [ main::p_y ]
FINAL ASSEMBLER
@@ -324,10 +316,10 @@ main: {
.label p_x = 2
.label p_y = 3
// p = { 2, 3 }
// [4] (byte) main::p_x#0 ← (byte) 2 -- vbuz1=vbuc1
// [4] (byte) main::p_x ← (byte) 2 -- vbuz1=vbuc1
lda #2
sta.z p_x
// [5] (byte) main::p_y#0 ← (byte) 3 -- vbuz1=vbuc1
// [5] (byte) main::p_y ← (byte) 3 -- vbuz1=vbuc1
lda #3
sta.z p_y
// SCREEN[0] = q->x
+5 -8
View File
@@ -7,12 +7,9 @@
(void()) main()
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(struct Point) main::p
(byte) main::p_x
(byte) main::p_x#0 p_x zp[1]:2 20.0
(byte) main::p_y
(byte) main::p_y#0 p_y zp[1]:3 20.0
(const struct Point*) main::q = (struct Point*)&(byte) main::p_x#0
(byte) main::p_x loadstore zp[1]:2 20.0
(byte) main::p_y loadstore zp[1]:3 20.0
(const struct Point*) main::q = (struct Point*)&(byte) main::p_x
zp[1]:2 [ main::p_x#0 ]
zp[1]:3 [ main::p_y#0 ]
zp[1]:2 [ main::p_x ]
zp[1]:3 [ main::p_y ]
+2 -2
View File
@@ -10,8 +10,8 @@
(void()) main()
main: scope:[main] from @1
[4] (byte) main::p_x#0 ← (byte) 2
[5] (byte) main::p_y#0 ← (byte) 3
[4] (byte) main::p_x ← (byte) 2
[5] (byte) main::p_y ← (byte) 3
[6] call set
to:main::@1
main::@1: scope:[main] from main
+38 -46
View File
@@ -10,7 +10,6 @@ Rewriting struct pointer member access *((struct Point*) set::ptr).x
Rewriting struct pointer member access *((struct Point*) set::ptr).y
Identified constant variable (struct Point*) main::q
Culled Empty Block (label) @1
Adding versioned struct unwinding for (struct Point) main::p#0
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
@@ -18,9 +17,9 @@ CONTROL FLOW GRAPH SSA
(void()) main()
main: scope:[main] from @2
(byte) main::p_x#0 ← (byte)(number) 2
(byte) main::p_y#0 ← (byte)(number) 3
(struct Point) main::p#0 ← struct-unwound {(byte) main::p_x#0, (byte) main::p_y#0}
(byte) main::p_x ← (byte)(number) 2
(byte) main::p_y ← (byte)(number) 3
(struct Point) main::p ← struct-unwound {(byte) main::p_x, (byte) main::p_y}
(struct Point*) set::ptr#0 ← (const struct Point*) main::q
call set
to:main::@1
@@ -67,12 +66,9 @@ SYMBOL TABLE SSA
(label) main::@1
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
(struct Point) main::p
(struct Point) main::p#0
(byte) main::p_x
(byte) main::p_x#0
(byte) main::p_y
(byte) main::p_y#0
(struct Point) main::p loadstore
(byte) main::p_x loadstore
(byte) main::p_y loadstore
(const struct Point*) main::q = &(struct Point) main::p
(void()) set((struct Point*) set::ptr)
(byte*~) set::$0
@@ -125,7 +121,7 @@ Simplifying expression containing zero main::SCREEN in [6] *((const byte*) main:
Simplifying expression containing zero (byte*)set::ptr#0 in [11] (byte*~) set::$0 ← (byte*)(const struct Point*) set::ptr#0 + (const byte) OFFSET_STRUCT_POINT_X
Simplifying expression containing zero (byte*)set::ptr#0 in [12] *((byte*)(const struct Point*) set::ptr#0 + (const byte) OFFSET_STRUCT_POINT_X) ← (byte) 4
Successful SSA optimization PassNSimplifyExpressionWithZero
Eliminating unused variable (struct Point) main::p#0 and assignment [2] (struct Point) main::p#0 ← struct-unwound {(byte) main::p_x#0, (byte) main::p_y#0}
Eliminating unused variable (struct Point) main::p and assignment [2] (struct Point) main::p ← struct-unwound {(byte) main::p_x, (byte) main::p_y}
Eliminating unused variable (byte*~) set::$0 and assignment [7] (byte*~) set::$0 ← (byte*)(const struct Point*) set::ptr#0
Eliminating unused variable (byte*~) set::$1 and assignment [9] (byte*~) set::$1 ← (byte*)(const struct Point*) set::ptr#0 + (const byte) OFFSET_STRUCT_POINT_Y
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
@@ -166,8 +162,8 @@ FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from @1
[4] (byte) main::p_x#0 ← (byte) 2
[5] (byte) main::p_y#0 ← (byte) 3
[4] (byte) main::p_x ← (byte) 2
[5] (byte) main::p_y ← (byte) 3
[6] call set
to:main::@1
main::@1: scope:[main] from main
@@ -192,20 +188,19 @@ VARIABLE REGISTER WEIGHTS
(byte) Point::x
(byte) Point::y
(void()) main()
(struct Point) main::p
(byte) main::p_x
(byte) main::p_x#0 20.0
(byte) main::p_y
(byte) main::p_y#0 20.0
(byte) main::p_x loadstore 20.0
(byte) main::p_y loadstore 20.0
(void()) set((struct Point*) set::ptr)
(struct Point*) set::ptr
Initial phi equivalence classes
Added variable main::p_x to live range equivalence class [ main::p_x ]
Added variable main::p_y to live range equivalence class [ main::p_y ]
Complete equivalence classes
[ main::p_x#0 ]
[ main::p_y#0 ]
Allocated zp[1]:2 [ main::p_x#0 ]
Allocated zp[1]:3 [ main::p_y#0 ]
[ main::p_x ]
[ main::p_y ]
Allocated zp[1]:2 [ main::p_x ]
Allocated zp[1]:3 [ main::p_y ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -237,10 +232,10 @@ main: {
.label q = p_x
.label p_x = 2
.label p_y = 3
// [4] (byte) main::p_x#0 ← (byte) 2 -- vbuz1=vbuc1
// [4] (byte) main::p_x ← (byte) 2 -- vbuz1=vbuc1
lda #2
sta.z p_x
// [5] (byte) main::p_y#0 ← (byte) 3 -- vbuz1=vbuc1
// [5] (byte) main::p_y ← (byte) 3 -- vbuz1=vbuc1
lda #3
sta.z p_y
// [6] call set
@@ -277,29 +272,29 @@ set: {
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] (byte) main::p_x#0 ← (byte) 2 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [5] (byte) main::p_y#0 ← (byte) 3 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [4] (byte) main::p_x ← (byte) 2 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [5] (byte) main::p_y ← (byte) 3 [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [7] *((const byte*) main::SCREEN) ← *((byte*)(const struct Point*) main::q) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [8] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) main::q+(const byte) OFFSET_STRUCT_POINT_Y) [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement [10] *((byte*)(const struct Point*) main::q) ← (byte) 4 [ ] ( main:2::set:6 [ ] ) always clobbers reg byte a
Statement [11] *((byte*)(const struct Point*) main::q+(const byte) OFFSET_STRUCT_POINT_Y) ← (byte) 5 [ ] ( main:2::set:6 [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::p_x#0 ] : zp[1]:2 ,
Potential registers zp[1]:3 [ main::p_y#0 ] : zp[1]:3 ,
Potential registers zp[1]:2 [ main::p_x ] : zp[1]:2 ,
Potential registers zp[1]:3 [ main::p_y ] : zp[1]:3 ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 20: zp[1]:2 [ main::p_x#0 ] 20: zp[1]:3 [ main::p_y#0 ]
Uplift Scope [main] 20: zp[1]:2 [ main::p_x ] 20: zp[1]:3 [ main::p_y ]
Uplift Scope [Point]
Uplift Scope [set]
Uplift Scope []
Uplifting [main] best 75 combination zp[1]:2 [ main::p_x#0 ] zp[1]:3 [ main::p_y#0 ]
Uplifting [main] best 75 combination zp[1]:2 [ main::p_x ] zp[1]:3 [ main::p_y ]
Uplifting [Point] best 75 combination
Uplifting [set] best 75 combination
Uplifting [] best 75 combination
Attempting to uplift remaining variables inzp[1]:2 [ main::p_x#0 ]
Uplifting [main] best 75 combination zp[1]:2 [ main::p_x#0 ]
Attempting to uplift remaining variables inzp[1]:3 [ main::p_y#0 ]
Uplifting [main] best 75 combination zp[1]:3 [ main::p_y#0 ]
Attempting to uplift remaining variables inzp[1]:2 [ main::p_x ]
Uplifting [main] best 75 combination zp[1]:2 [ main::p_x ]
Attempting to uplift remaining variables inzp[1]:3 [ main::p_y ]
Uplifting [main] best 75 combination zp[1]:3 [ main::p_y ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -330,10 +325,10 @@ main: {
.label q = p_x
.label p_x = 2
.label p_y = 3
// [4] (byte) main::p_x#0 ← (byte) 2 -- vbuz1=vbuc1
// [4] (byte) main::p_x ← (byte) 2 -- vbuz1=vbuc1
lda #2
sta.z p_x
// [5] (byte) main::p_y#0 ← (byte) 3 -- vbuz1=vbuc1
// [5] (byte) main::p_y ← (byte) 3 -- vbuz1=vbuc1
lda #3
sta.z p_y
// [6] call set
@@ -403,18 +398,15 @@ FINAL SYMBOL TABLE
(label) main::@1
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(struct Point) main::p
(byte) main::p_x
(byte) main::p_x#0 p_x zp[1]:2 20.0
(byte) main::p_y
(byte) main::p_y#0 p_y zp[1]:3 20.0
(const struct Point*) main::q = (struct Point*)&(byte) main::p_x#0
(byte) main::p_x loadstore zp[1]:2 20.0
(byte) main::p_y loadstore zp[1]:3 20.0
(const struct Point*) main::q = (struct Point*)&(byte) main::p_x
(void()) set((struct Point*) set::ptr)
(label) set::@return
(struct Point*) set::ptr
zp[1]:2 [ main::p_x#0 ]
zp[1]:3 [ main::p_y#0 ]
zp[1]:2 [ main::p_x ]
zp[1]:3 [ main::p_y ]
FINAL ASSEMBLER
@@ -441,10 +433,10 @@ main: {
.label p_x = 2
.label p_y = 3
// p = { 2, 3 }
// [4] (byte) main::p_x#0 ← (byte) 2 -- vbuz1=vbuc1
// [4] (byte) main::p_x ← (byte) 2 -- vbuz1=vbuc1
lda #2
sta.z p_x
// [5] (byte) main::p_y#0 ← (byte) 3 -- vbuz1=vbuc1
// [5] (byte) main::p_y ← (byte) 3 -- vbuz1=vbuc1
lda #3
sta.z p_y
// set(q)
+5 -8
View File
@@ -8,15 +8,12 @@
(label) main::@1
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
(struct Point) main::p
(byte) main::p_x
(byte) main::p_x#0 p_x zp[1]:2 20.0
(byte) main::p_y
(byte) main::p_y#0 p_y zp[1]:3 20.0
(const struct Point*) main::q = (struct Point*)&(byte) main::p_x#0
(byte) main::p_x loadstore zp[1]:2 20.0
(byte) main::p_y loadstore zp[1]:3 20.0
(const struct Point*) main::q = (struct Point*)&(byte) main::p_x
(void()) set((struct Point*) set::ptr)
(label) set::@return
(struct Point*) set::ptr
zp[1]:2 [ main::p_x#0 ]
zp[1]:3 [ main::p_y#0 ]
zp[1]:2 [ main::p_x ]
zp[1]:3 [ main::p_y ]
@@ -16,13 +16,13 @@ main: {
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
__b2:
__b1:
lda.z col
cmp #$a+1
bcc __b2
bcc __b1
lda #0
sta.z col
jmp __b2
jmp __b1
}
irq: {
lda $dc0d
+9 -13
View File
@@ -1,5 +1,5 @@
@begin: scope:[] from
[0] (byte) col#0 ← (byte) 0
[0] (byte) col ← (byte) 0
to:@1
@1: scope:[] from @begin
[1] phi()
@@ -12,29 +12,25 @@
main: scope:[main] from @1
[4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
to:main::@1
main::@1: scope:[main] from main main::@2 main::@3
[5] (byte) col#14 ← phi( main/(byte) col#0 main::@2/(byte) col#14 main::@3/(byte) col#1 )
main::@1: scope:[main] from main main::@1 main::@2
[5] if((byte) col<(byte) $a+(byte) 1) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
[6] if((byte) col#14<(byte) $a+(byte) 1) goto main::@1
to:main::@3
main::@3: scope:[main] from main::@2
[7] (byte) col#1 ← (byte) 0
[6] (byte) col ← (byte) 0
to:main::@1
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
asm { lda$dc0d }
[9] *((const byte*) BGCOL) ← (byte) col#0
[10] if((byte) col#0!=(byte) 0) goto irq::@1
[8] *((const byte*) BGCOL) ← (byte) col
[9] if((byte) col!=(byte) 0) goto irq::@1
to:irq::@2
irq::@2: scope:[irq] from irq
[11] (byte) col#4 ← (byte) col#0 + (byte) 2
[10] (byte) col ← (byte) col + (byte) 2
to:irq::@return
irq::@return: scope:[irq] from irq::@1 irq::@2
[12] (byte) col#12 ← phi( irq::@1/(byte) col#3 irq::@2/(byte) col#4 )
[13] return
[11] return
to:@return
irq::@1: scope:[irq] from irq
[14] (byte) col#3 ← ++ (byte) col#0
[12] (byte) col ← ++ (byte) col
to:irq::@return
+96 -198
View File
@@ -10,61 +10,48 @@ Culled Empty Block (label) irq::@4
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte) col#0 ← (number) 0
(byte) col ← (number) 0
to:@2
(void()) main()
main: scope:[main] from @2
(byte) col#16 ← phi( @2/(byte) col#15 )
*((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
to:main::@1
main::@1: scope:[main] from main main::@2 main::@7
(byte) col#14 ← phi( main/(byte) col#16 main::@2/(byte) col#7 main::@7/(byte) col#1 )
if(true) goto main::@2
to:main::@return
main::@2: scope:[main] from main::@1
(byte) col#7 ← phi( main::@1/(byte) col#14 )
(bool~) main::$0 ← (byte) col#7 > (number) $a
(bool~) main::$0 ← (byte) col > (number) $a
(bool~) main::$1 ← ! (bool~) main::$0
if((bool~) main::$1) goto main::@1
to:main::@7
main::@7: scope:[main] from main::@2
(byte) col#1 ← (number) 0
(byte) col ← (number) 0
to:main::@1
main::@return: scope:[main] from main::@1
(byte) col#8 ← phi( main::@1/(byte) col#14 )
(byte) col#2 ← (byte) col#8
return
to:@return
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
(byte) col#9 ← phi( @2/(byte) col#15 )
asm { lda$dc0d }
*((const byte*) BGCOL) ← (byte) col#9
(bool~) irq::$0 ← (byte) col#9 != (number) 0
*((const byte*) BGCOL) ← (byte) col
(bool~) irq::$0 ← (byte) col != (number) 0
if((bool~) irq::$0) goto irq::@1
to:irq::@3
irq::@1: scope:[irq] from irq
(byte) col#10 ← phi( irq/(byte) col#9 )
(byte) col#3 ← ++ (byte) col#10
(byte) col ← ++ (byte) col
to:irq::@return
irq::@3: scope:[irq] from irq
(byte) col#11 ← phi( irq/(byte) col#9 )
(byte) col#4 ← (byte) col#11 + (number) 2
(byte) col ← (byte) col + (number) 2
to:irq::@return
irq::@return: scope:[irq] from irq::@1 irq::@3
(byte) col#12 ← phi( irq::@1/(byte) col#3 irq::@3/(byte) col#4 )
(byte) col#5 ← (byte) col#12
return
to:@return
@2: scope:[] from @begin
(byte) col#15 ← phi( @begin/(byte) col#0 )
call main
to:@3
@3: scope:[] from @2
(byte) col#13 ← phi( @2/(byte) col#2 )
(byte) col#6 ← (byte) col#13
to:@end
@end: scope:[] from @3
@@ -75,24 +62,7 @@ SYMBOL TABLE SSA
(label) @end
(const byte*) BGCOL = (byte*)(number) $d020
(const void()**) KERNEL_IRQ = (void()**)(number) $314
(byte) col
(byte) col#0
(byte) col#1
(byte) col#10
(byte) col#11
(byte) col#12
(byte) col#13
(byte) col#14
(byte) col#15
(byte) col#16
(byte) col#2
(byte) col#3
(byte) col#4
(byte) col#5
(byte) col#6
(byte) col#7
(byte) col#8
(byte) col#9
(byte) col loadstore
interrupt(KERNEL_MIN)(void()) irq()
(bool~) irq::$0
(label) irq::@1
@@ -106,14 +76,14 @@ interrupt(KERNEL_MIN)(void()) irq()
(label) main::@7
(label) main::@return
Adding number conversion cast (unumber) 0 in (byte) col#0 ← (number) 0
Adding number conversion cast (unumber) $a in (bool~) main::$0 ← (byte) col#7 > (number) $a
Adding number conversion cast (unumber) 0 in (byte) col#1 ← (number) 0
Adding number conversion cast (unumber) 0 in (bool~) irq::$0 ← (byte) col#9 != (number) 0
Adding number conversion cast (unumber) 2 in (byte) col#4 ← (byte) col#11 + (number) 2
Adding number conversion cast (unumber) 0 in (byte) col ← (number) 0
Adding number conversion cast (unumber) $a in (bool~) main::$0 ← (byte) col > (number) $a
Adding number conversion cast (unumber) 0 in (byte) col ← (number) 0
Adding number conversion cast (unumber) 0 in (bool~) irq::$0 ← (byte) col != (number) 0
Adding number conversion cast (unumber) 2 in (byte) col ← (byte) col + (number) 2
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) col#0 ← (unumber)(number) 0
Inlining cast (byte) col#1 ← (unumber)(number) 0
Inlining cast (byte) col ← (unumber)(number) 0
Inlining cast (byte) col ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (void()**) 788
Simplifying constant pointer cast (byte*) 53280
@@ -129,59 +99,45 @@ Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 2
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inversing boolean not [7] (bool~) main::$1 ← (byte) col#7 <= (byte) $a from [6] (bool~) main::$0 ← (byte) col#7 > (byte) $a
Inversing boolean not [4] (bool~) main::$1 ← (byte) col <= (byte) $a from [3] (bool~) main::$0 ← (byte) col > (byte) $a
Successful SSA optimization Pass2UnaryNotSimplification
Alias (byte) col#14 = (byte) col#7 (byte) col#8 (byte) col#2
Alias (byte) col#10 = (byte) col#9 (byte) col#11
Alias (byte) col#12 = (byte) col#5
Alias (byte) col#0 = (byte) col#15
Alias (byte) col#13 = (byte) col#6
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) col#16 (byte) col#0
Identical Phi Values (byte) col#10 (byte) col#0
Identical Phi Values (byte) col#13 (byte) col#14
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition (bool~) main::$1 [8] if((byte) col#14<=(byte) $a) goto main::@1
Simple Condition (bool~) irq::$0 [17] if((byte) col#0!=(byte) 0) goto irq::@1
Simple Condition (bool~) main::$1 [5] if((byte) col<=(byte) $a) goto main::@1
Simple Condition (bool~) irq::$0 [11] if((byte) col!=(byte) 0) goto irq::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
if() condition always true - replacing block destination [4] if(true) goto main::@2
if() condition always true - replacing block destination [2] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Rewriting conditional comparison [8] if((byte) col#14<=(byte) $a) goto main::@1
Rewriting conditional comparison [5] if((byte) col<=(byte) $a) goto main::@1
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Adding number conversion cast (unumber) $a+1 in if((byte) col#14<(byte) $a+(number) 1) goto main::@1
Adding number conversion cast (unumber) 1 in if((byte) col#14<(unumber)(byte) $a+(number) 1) goto main::@1
Adding number conversion cast (unumber) $a+1 in if((byte) col<(byte) $a+(number) 1) goto main::@1
Adding number conversion cast (unumber) 1 in if((byte) col<(unumber)(byte) $a+(number) 1) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast (byte) $a+(unumber)(number) 1
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Added new block during phi lifting main::@9(between main::@2 and main::@1)
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@1
CALL GRAPH
Calls in [] to main:2
Created 2 initial phi equivalence classes
Coalesced [6] col#17 ← col#0
Coalesced [10] col#19 ← col#1
Coalesced (already) [11] col#18 ← col#14
Coalesced [16] col#21 ← col#4
Coalesced [20] col#20 ← col#3
Coalesced down to 2 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@9
Culled Empty Block (label) main::@1
Renumbering block @2 to @1
Renumbering block main::@7 to main::@3
Renumbering block main::@2 to main::@1
Renumbering block main::@7 to main::@2
Renumbering block irq::@3 to irq::@2
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] (byte) col#0 ← (byte) 0
[0] (byte) col ← (byte) 0
to:@1
@1: scope:[] from @begin
[1] phi()
@@ -194,52 +150,40 @@ FINAL CONTROL FLOW GRAPH
main: scope:[main] from @1
[4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
to:main::@1
main::@1: scope:[main] from main main::@2 main::@3
[5] (byte) col#14 ← phi( main/(byte) col#0 main::@2/(byte) col#14 main::@3/(byte) col#1 )
main::@1: scope:[main] from main main::@1 main::@2
[5] if((byte) col<(byte) $a+(byte) 1) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
[6] if((byte) col#14<(byte) $a+(byte) 1) goto main::@1
to:main::@3
main::@3: scope:[main] from main::@2
[7] (byte) col#1 ← (byte) 0
[6] (byte) col ← (byte) 0
to:main::@1
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
asm { lda$dc0d }
[9] *((const byte*) BGCOL) ← (byte) col#0
[10] if((byte) col#0!=(byte) 0) goto irq::@1
[8] *((const byte*) BGCOL) ← (byte) col
[9] if((byte) col!=(byte) 0) goto irq::@1
to:irq::@2
irq::@2: scope:[irq] from irq
[11] (byte) col#4 ← (byte) col#0 + (byte) 2
[10] (byte) col ← (byte) col + (byte) 2
to:irq::@return
irq::@return: scope:[irq] from irq::@1 irq::@2
[12] (byte) col#12 ← phi( irq::@1/(byte) col#3 irq::@2/(byte) col#4 )
[13] return
[11] return
to:@return
irq::@1: scope:[irq] from irq
[14] (byte) col#3 ← ++ (byte) col#0
[12] (byte) col ← ++ (byte) col
to:irq::@return
VARIABLE REGISTER WEIGHTS
(byte) col
(byte) col#0 1.9999999999999998
(byte) col#1 22.0
(byte) col#12 40.0
(byte) col#14 158.0
(byte) col#3 4.0
(byte) col#4 4.0
(byte) col loadstore 17.999999999999996
interrupt(KERNEL_MIN)(void()) irq()
(void()) main()
Initial phi equivalence classes
[ col#14 col#0 col#1 ]
[ col#12 col#3 col#4 ]
Coalescing volatile variable equivalence classes [ col#14 col#0 col#1 ] and [ col#12 col#3 col#4 ]
Added variable col to live range equivalence class [ col ]
Complete equivalence classes
[ col#14 col#0 col#1 col#12 col#3 col#4 ]
Allocated zp[1]:2 [ col#14 col#0 col#1 col#12 col#3 col#4 ]
[ col ]
Allocated zp[1]:2 [ col ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -256,7 +200,7 @@ Target platform is c64basic / MOS6502X
.label col = 2
// @begin
__bbegin:
// [0] (byte) col#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -278,87 +222,75 @@ main: {
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
// [5] phi from main main::@2 main::@3 to main::@1 [phi:main/main::@2/main::@3->main::@1]
__b1_from_main:
__b1_from___b2:
__b1_from___b3:
// [5] phi (byte) col#14 = (byte) col#0 [phi:main/main::@2/main::@3->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [5] if((byte) col<(byte) $a+(byte) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z col
cmp #$a+1
bcc __b1
jmp __b2
// main::@2
__b2:
// [6] if((byte) col#14<(byte) $a+(byte) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z col
cmp #$a+1
bcc __b1_from___b2
jmp __b3
// main::@3
__b3:
// [7] (byte) col#1 ← (byte) 0 -- vbuz1=vbuc1
// [6] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
jmp __b1_from___b3
jmp __b1
}
// irq
irq: {
// entry interrupt(KERNEL_MIN)
// asm { lda$dc0d }
lda $dc0d
// [9] *((const byte*) BGCOL) ← (byte) col#0 -- _deref_pbuc1=vbuz1
// [8] *((const byte*) BGCOL) ← (byte) col -- _deref_pbuc1=vbuz1
lda.z col
sta BGCOL
// [10] if((byte) col#0!=(byte) 0) goto irq::@1 -- vbuz1_neq_0_then_la1
// [9] if((byte) col!=(byte) 0) goto irq::@1 -- vbuz1_neq_0_then_la1
lda.z col
cmp #0
bne __b1
jmp __b2
// irq::@2
__b2:
// [11] (byte) col#4 ← (byte) col#0 + (byte) 2 -- vbuz1=vbuz1_plus_2
// [10] (byte) col ← (byte) col + (byte) 2 -- vbuz1=vbuz1_plus_2
lda.z col
clc
adc #2
sta.z col
// [12] phi from irq::@1 irq::@2 to irq::@return [phi:irq::@1/irq::@2->irq::@return]
__breturn_from___b1:
__breturn_from___b2:
// [12] phi (byte) col#12 = (byte) col#3 [phi:irq::@1/irq::@2->irq::@return#0] -- register_copy
jmp __breturn
// irq::@return
__breturn:
// [13] return - exit interrupt(KERNEL_MIN)
// [11] return - exit interrupt(KERNEL_MIN)
jmp $ea81
// irq::@1
__b1:
// [14] (byte) col#3 ← ++ (byte) col#0 -- vbuz1=_inc_vbuz1
// [12] (byte) col ← ++ (byte) col -- vbuz1=_inc_vbuz1
inc.z col
jmp __breturn_from___b1
jmp __breturn
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte) col#0 ← (byte) 0 [ col#0 ] ( [ col#0 ] ) always clobbers reg byte a
Statement [4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ col#0 ] ( main:2 [ col#0 ] ) always clobbers reg byte a
Statement [6] if((byte) col#14<(byte) $a+(byte) 1) goto main::@1 [ col#14 ] ( main:2 [ col#14 ] ) always clobbers reg byte a
Statement [7] (byte) col#1 ← (byte) 0 [ col#1 ] ( main:2 [ col#1 ] ) always clobbers reg byte a
Statement [0] (byte) col ← (byte) 0 [ col ] ( [ col ] ) always clobbers reg byte a
Statement [4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ col ] ( main:2 [ col ] ) always clobbers reg byte a
Statement [5] if((byte) col<(byte) $a+(byte) 1) goto main::@1 [ col ] ( main:2 [ col ] ) always clobbers reg byte a
Statement [6] (byte) col ← (byte) 0 [ col ] ( main:2 [ col ] ) always clobbers reg byte a
Statement asm { lda$dc0d } always clobbers reg byte a
Statement [9] *((const byte*) BGCOL) ← (byte) col#0 [ col#0 ] ( [ col#0 ] ) always clobbers reg byte a
Statement [10] if((byte) col#0!=(byte) 0) goto irq::@1 [ col#0 ] ( [ col#0 ] ) always clobbers reg byte a
Statement [11] (byte) col#4 ← (byte) col#0 + (byte) 2 [ col#4 ] ( [ col#4 ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ col#14 col#0 col#1 col#12 col#3 col#4 ] : zp[1]:2 ,
Statement [8] *((const byte*) BGCOL) ← (byte) col [ col ] ( [ col ] ) always clobbers reg byte a
Statement [9] if((byte) col!=(byte) 0) goto irq::@1 [ ] ( [ ] ) always clobbers reg byte a
Statement [10] (byte) col ← (byte) col + (byte) 2 [ ] ( [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ col ] : zp[1]:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 230: zp[1]:2 [ col#14 col#0 col#1 col#12 col#3 col#4 ]
Uplift Scope [] 18: zp[1]:2 [ col ]
Uplift Scope [main]
Uplift Scope [irq]
Uplifting [] best 1534 combination zp[1]:2 [ col#14 col#0 col#1 col#12 col#3 col#4 ]
Uplifting [main] best 1534 combination
Uplifting [irq] best 1534 combination
Attempting to uplift remaining variables inzp[1]:2 [ col#14 col#0 col#1 col#12 col#3 col#4 ]
Uplifting [] best 1534 combination zp[1]:2 [ col#14 col#0 col#1 col#12 col#3 col#4 ]
Uplifting [] best 1207 combination zp[1]:2 [ col ]
Uplifting [main] best 1207 combination
Uplifting [irq] best 1207 combination
Attempting to uplift remaining variables inzp[1]:2 [ col ]
Uplifting [] best 1207 combination zp[1]:2 [ col ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -374,7 +306,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label col = 2
// @begin
__bbegin:
// [0] (byte) col#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -396,63 +328,51 @@ main: {
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
// [5] phi from main main::@2 main::@3 to main::@1 [phi:main/main::@2/main::@3->main::@1]
__b1_from_main:
__b1_from___b2:
__b1_from___b3:
// [5] phi (byte) col#14 = (byte) col#0 [phi:main/main::@2/main::@3->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [5] if((byte) col<(byte) $a+(byte) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z col
cmp #$a+1
bcc __b1
jmp __b2
// main::@2
__b2:
// [6] if((byte) col#14<(byte) $a+(byte) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z col
cmp #$a+1
bcc __b1_from___b2
jmp __b3
// main::@3
__b3:
// [7] (byte) col#1 ← (byte) 0 -- vbuz1=vbuc1
// [6] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
jmp __b1_from___b3
jmp __b1
}
// irq
irq: {
// entry interrupt(KERNEL_MIN)
// asm { lda$dc0d }
lda $dc0d
// [9] *((const byte*) BGCOL) ← (byte) col#0 -- _deref_pbuc1=vbuz1
// [8] *((const byte*) BGCOL) ← (byte) col -- _deref_pbuc1=vbuz1
lda.z col
sta BGCOL
// [10] if((byte) col#0!=(byte) 0) goto irq::@1 -- vbuz1_neq_0_then_la1
// [9] if((byte) col!=(byte) 0) goto irq::@1 -- vbuz1_neq_0_then_la1
lda.z col
cmp #0
bne __b1
jmp __b2
// irq::@2
__b2:
// [11] (byte) col#4 ← (byte) col#0 + (byte) 2 -- vbuz1=vbuz1_plus_2
// [10] (byte) col ← (byte) col + (byte) 2 -- vbuz1=vbuz1_plus_2
lda.z col
clc
adc #2
sta.z col
// [12] phi from irq::@1 irq::@2 to irq::@return [phi:irq::@1/irq::@2->irq::@return]
__breturn_from___b1:
__breturn_from___b2:
// [12] phi (byte) col#12 = (byte) col#3 [phi:irq::@1/irq::@2->irq::@return#0] -- register_copy
jmp __breturn
// irq::@return
__breturn:
// [13] return - exit interrupt(KERNEL_MIN)
// [11] return - exit interrupt(KERNEL_MIN)
jmp $ea81
// irq::@1
__b1:
// [14] (byte) col#3 ← ++ (byte) col#0 -- vbuz1=_inc_vbuz1
// [12] (byte) col ← ++ (byte) col -- vbuz1=_inc_vbuz1
inc.z col
jmp __breturn_from___b1
jmp __breturn
}
// File Data
@@ -461,25 +381,15 @@ Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp __b2
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b1_from___b2 with __b2
Replacing label __b1_from___b3 with __b2
Replacing label __breturn_from___b1 with __breturn
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Removing instruction __b1_from_main:
Removing instruction __b1_from___b2:
Removing instruction __b1_from___b3:
Removing instruction __b1:
Removing instruction __breturn_from___b1:
Removing instruction __breturn_from___b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1:
Removing instruction __bend:
Removing instruction __b3:
Removing instruction __b2:
Removing instruction __b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Skipping double jump to $ea81 in jmp __breturn
@@ -497,13 +407,7 @@ FINAL SYMBOL TABLE
(label) @end
(const byte*) BGCOL = (byte*) 53280
(const void()**) KERNEL_IRQ = (void()**) 788
(byte) col
(byte) col#0 col zp[1]:2 1.9999999999999998
(byte) col#1 col zp[1]:2 22.0
(byte) col#12 col zp[1]:2 40.0
(byte) col#14 col zp[1]:2 158.0
(byte) col#3 col zp[1]:2 4.0
(byte) col#4 col zp[1]:2 4.0
(byte) col loadstore zp[1]:2 17.999999999999996
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@1
(label) irq::@2
@@ -511,9 +415,8 @@ interrupt(KERNEL_MIN)(void()) irq()
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
zp[1]:2 [ col#14 col#0 col#1 col#12 col#3 col#4 ]
zp[1]:2 [ col ]
FINAL ASSEMBLER
@@ -533,7 +436,7 @@ Score: 895
// @begin
__bbegin:
// col = 0
// [0] (byte) col#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -551,22 +454,19 @@ main: {
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
// [5] phi from main main::@2 main::@3 to main::@1 [phi:main/main::@2/main::@3->main::@1]
// [5] phi (byte) col#14 = (byte) col#0 [phi:main/main::@2/main::@3->main::@1#0] -- register_copy
// main::@1
// main::@2
__b2:
__b1:
// if(col>10)
// [6] if((byte) col#14<(byte) $a+(byte) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
// [5] if((byte) col<(byte) $a+(byte) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1
lda.z col
cmp #$a+1
bcc __b2
// main::@3
bcc __b1
// main::@2
// col = 0
// [7] (byte) col#1 ← (byte) 0 -- vbuz1=vbuc1
// [6] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
jmp __b2
jmp __b1
}
// irq
irq: {
@@ -575,30 +475,28 @@ irq: {
// asm { lda$dc0d }
lda $dc0d
// *BGCOL = col
// [9] *((const byte*) BGCOL) ← (byte) col#0 -- _deref_pbuc1=vbuz1
// [8] *((const byte*) BGCOL) ← (byte) col -- _deref_pbuc1=vbuz1
lda.z col
sta BGCOL
// if(col!=0)
// [10] if((byte) col#0!=(byte) 0) goto irq::@1 -- vbuz1_neq_0_then_la1
// [9] if((byte) col!=(byte) 0) goto irq::@1 -- vbuz1_neq_0_then_la1
lda.z col
cmp #0
bne __b1
// irq::@2
// col += 2
// [11] (byte) col#4 ← (byte) col#0 + (byte) 2 -- vbuz1=vbuz1_plus_2
// [10] (byte) col ← (byte) col + (byte) 2 -- vbuz1=vbuz1_plus_2
clc
adc #2
sta.z col
// [12] phi from irq::@1 irq::@2 to irq::@return [phi:irq::@1/irq::@2->irq::@return]
// [12] phi (byte) col#12 = (byte) col#3 [phi:irq::@1/irq::@2->irq::@return#0] -- register_copy
// irq::@return
// }
// [13] return - exit interrupt(KERNEL_MIN)
// [11] return - exit interrupt(KERNEL_MIN)
jmp $ea81
// irq::@1
__b1:
// col++;
// [14] (byte) col#3 ← ++ (byte) col#0 -- vbuz1=_inc_vbuz1
// [12] (byte) col ← ++ (byte) col -- vbuz1=_inc_vbuz1
inc.z col
jmp $ea81
}
@@ -3,13 +3,7 @@
(label) @end
(const byte*) BGCOL = (byte*) 53280
(const void()**) KERNEL_IRQ = (void()**) 788
(byte) col
(byte) col#0 col zp[1]:2 1.9999999999999998
(byte) col#1 col zp[1]:2 22.0
(byte) col#12 col zp[1]:2 40.0
(byte) col#14 col zp[1]:2 158.0
(byte) col#3 col zp[1]:2 4.0
(byte) col#4 col zp[1]:2 4.0
(byte) col loadstore zp[1]:2 17.999999999999996
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@1
(label) irq::@2
@@ -17,6 +11,5 @@ interrupt(KERNEL_MIN)(void()) irq()
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
zp[1]:2 [ col#14 col#0 col#1 col#12 col#3 col#4 ]
zp[1]:2 [ col ]
+2 -2
View File
@@ -14,9 +14,9 @@ main: {
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
__b2:
__b1:
inc.z col
jmp __b2
jmp __b1
}
irq: {
lda $dc0d
+5 -8
View File
@@ -1,5 +1,5 @@
@begin: scope:[] from
[0] (byte) col#0 ← (byte) 0
[0] (byte) col ← (byte) 0
to:@1
@1: scope:[] from @begin
[1] phi()
@@ -12,18 +12,15 @@
main: scope:[main] from @1
[4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) col#2phi( main/(byte) col#0 main::@2/(byte) col#1 )
to:main::@2
main::@2: scope:[main] from main::@1
[6] (byte) col#1 ← ++ (byte) col#2
main::@1: scope:[main] from main main::@1
[5] (byte) col ← ++ (byte) col
to:main::@1
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
asm { lda$dc0d }
[8] *((const byte*) BGCOL) ← (byte) col#0
[7] *((const byte*) BGCOL) ← (byte) col
to:irq::@return
irq::@return: scope:[irq] from irq
[9] return
[8] return
to:@return
+49 -108
View File
@@ -7,44 +7,35 @@ Culled Empty Block (label) @1
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte) col#0 ← (number) 0
(byte) col ← (number) 0
to:@2
(void()) main()
main: scope:[main] from @2
(byte) col#10 ← phi( @2/(byte) col#9 )
*((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
to:main::@1
main::@1: scope:[main] from main main::@2
(byte) col#8 ← phi( main/(byte) col#10 main::@2/(byte) col#1 )
if(true) goto main::@2
to:main::@return
main::@2: scope:[main] from main::@1
(byte) col#4phi( main::@1/(byte) col#8 )
(byte) col#1 ← ++ (byte) col#4
(byte) col ← ++ (byte) col
to:main::@1
main::@return: scope:[main] from main::@1
(byte) col#5 ← phi( main::@1/(byte) col#8 )
(byte) col#2 ← (byte) col#5
return
to:@return
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
(byte) col#6 ← phi( @2/(byte) col#9 )
asm { lda$dc0d }
*((const byte*) BGCOL) ← (byte) col#6
*((const byte*) BGCOL) ← (byte) col
to:irq::@return
irq::@return: scope:[irq] from irq
return
to:@return
@2: scope:[] from @begin
(byte) col#9 ← phi( @begin/(byte) col#0 )
call main
to:@3
@3: scope:[] from @2
(byte) col#7 ← phi( @2/(byte) col#2 )
(byte) col#3 ← (byte) col#7
to:@end
@end: scope:[] from @3
@@ -55,18 +46,7 @@ SYMBOL TABLE SSA
(label) @end
(const byte*) BGCOL = (byte*)(number) $d020
(const void()**) KERNEL_IRQ = (void()**)(number) $314
(byte) col
(byte) col#0
(byte) col#1
(byte) col#10
(byte) col#2
(byte) col#3
(byte) col#4
(byte) col#5
(byte) col#6
(byte) col#7
(byte) col#8
(byte) col#9
(byte) col loadstore
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@return
(void()) main()
@@ -74,9 +54,9 @@ interrupt(KERNEL_MIN)(void()) irq()
(label) main::@2
(label) main::@return
Adding number conversion cast (unumber) 0 in (byte) col#0 ← (number) 0
Adding number conversion cast (unumber) 0 in (byte) col ← (number) 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast (byte) col#0 ← (unumber)(number) 0
Inlining cast (byte) col ← (unumber)(number) 0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (void()**) 788
Simplifying constant pointer cast (byte*) 53280
@@ -84,36 +64,29 @@ Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias (byte) col#2 = (byte) col#4 (byte) col#8 (byte) col#5
Alias (byte) col#0 = (byte) col#9
Alias (byte) col#3 = (byte) col#7
Successful SSA optimization Pass2AliasElimination
Identical Phi Values (byte) col#10 (byte) col#0
Identical Phi Values (byte) col#6 (byte) col#0
Identical Phi Values (byte) col#3 (byte) col#2
Successful SSA optimization Pass2IdenticalPhiElimination
if() condition always true - replacing block destination [4] if(true) goto main::@2
if() condition always true - replacing block destination [2] if(true) goto main::@2
Successful SSA optimization Pass2ConstantIfs
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Adding NOP phi() at start of @2
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main::@1
CALL GRAPH
Calls in [] to main:2
Created 1 initial phi equivalence classes
Coalesced [6] col#11 ← col#0
Coalesced [9] col#12 ← col#1
Coalesced down to 1 phi equivalence classes
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) @3
Culled Empty Block (label) main::@1
Renumbering block @2 to @1
Renumbering block main::@2 to main::@1
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] (byte) col#0 ← (byte) 0
[0] (byte) col ← (byte) 0
to:@1
@1: scope:[] from @begin
[1] phi()
@@ -126,36 +99,30 @@ FINAL CONTROL FLOW GRAPH
main: scope:[main] from @1
[4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq()
to:main::@1
main::@1: scope:[main] from main main::@2
[5] (byte) col#2phi( main/(byte) col#0 main::@2/(byte) col#1 )
to:main::@2
main::@2: scope:[main] from main::@1
[6] (byte) col#1 ← ++ (byte) col#2
main::@1: scope:[main] from main main::@1
[5] (byte) col ← ++ (byte) col
to:main::@1
interrupt(KERNEL_MIN)(void()) irq()
irq: scope:[irq] from
asm { lda$dc0d }
[8] *((const byte*) BGCOL) ← (byte) col#0
[7] *((const byte*) BGCOL) ← (byte) col
to:irq::@return
irq::@return: scope:[irq] from irq
[9] return
[8] return
to:@return
VARIABLE REGISTER WEIGHTS
(byte) col
(byte) col#0 1.5
(byte) col#1 22.0
(byte) col#2 24.0
(byte) col loadstore 26.0
interrupt(KERNEL_MIN)(void()) irq()
(void()) main()
Initial phi equivalence classes
[ col#2 col#0 col#1 ]
Added variable col to live range equivalence class [ col ]
Complete equivalence classes
[ col#2 col#0 col#1 ]
Allocated zp[1]:2 [ col#2 col#0 col#1 ]
[ col ]
Allocated zp[1]:2 [ col ]
INITIAL ASM
Target platform is c64basic / MOS6502X
@@ -170,7 +137,7 @@ Target platform is c64basic / MOS6502X
.label col = 2
// @begin
__bbegin:
// [0] (byte) col#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -192,53 +159,46 @@ main: {
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
// [5] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1]
__b1_from_main:
__b1_from___b2:
// [5] phi (byte) col#2 = (byte) col#0 [phi:main/main::@2->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
jmp __b2
// main::@2
__b2:
// [6] (byte) col#1 ← ++ (byte) col#2 -- vbuz1=_inc_vbuz1
// [5] (byte) col ← ++ (byte) col -- vbuz1=_inc_vbuz1
inc.z col
jmp __b1_from___b2
jmp __b1
}
// irq
irq: {
// entry interrupt(KERNEL_MIN)
// asm { lda$dc0d }
lda $dc0d
// [8] *((const byte*) BGCOL) ← (byte) col#0 -- _deref_pbuc1=vbuz1
// [7] *((const byte*) BGCOL) ← (byte) col -- _deref_pbuc1=vbuz1
lda.z col
sta BGCOL
jmp __breturn
// irq::@return
__breturn:
// [9] return - exit interrupt(KERNEL_MIN)
// [8] return - exit interrupt(KERNEL_MIN)
jmp $ea81
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] (byte) col#0 ← (byte) 0 [ col#0 ] ( [ col#0 ] ) always clobbers reg byte a
Statement [4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ col#0 ] ( main:2 [ col#0 ] ) always clobbers reg byte a
Statement [0] (byte) col ← (byte) 0 [ ] ( [ ] ) always clobbers reg byte a
Statement [4] *((const void()**) KERNEL_IRQ) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:2 [ ] ) always clobbers reg byte a
Statement asm { lda$dc0d } always clobbers reg byte a
Statement [8] *((const byte*) BGCOL) ← (byte) col#0 [ ] ( [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ col#2 col#0 col#1 ] : zp[1]:2 ,
Statement [7] *((const byte*) BGCOL) ← (byte) col [ ] ( [ ] ) always clobbers reg byte a
Potential registers zp[1]:2 [ col ] : zp[1]:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 47.5: zp[1]:2 [ col#2 col#0 col#1 ]
Uplift Scope [] 26: zp[1]:2 [ col ]
Uplift Scope [main]
Uplift Scope [irq]
Uplifting [] best 186 combination zp[1]:2 [ col#2 col#0 col#1 ]
Uplifting [main] best 186 combination
Uplifting [irq] best 186 combination
Attempting to uplift remaining variables inzp[1]:2 [ col#2 col#0 col#1 ]
Uplifting [] best 186 combination zp[1]:2 [ col#2 col#0 col#1 ]
Uplifting [] best 129 combination zp[1]:2 [ col ]
Uplifting [main] best 129 combination
Uplifting [irq] best 129 combination
Attempting to uplift remaining variables inzp[1]:2 [ col ]
Uplifting [] best 129 combination zp[1]:2 [ col ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@@ -252,7 +212,7 @@ ASSEMBLER BEFORE OPTIMIZATION
.label col = 2
// @begin
__bbegin:
// [0] (byte) col#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -274,32 +234,25 @@ main: {
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
// [5] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1]
__b1_from_main:
__b1_from___b2:
// [5] phi (byte) col#2 = (byte) col#0 [phi:main/main::@2->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
jmp __b2
// main::@2
__b2:
// [6] (byte) col#1 ← ++ (byte) col#2 -- vbuz1=_inc_vbuz1
// [5] (byte) col ← ++ (byte) col -- vbuz1=_inc_vbuz1
inc.z col
jmp __b1_from___b2
jmp __b1
}
// irq
irq: {
// entry interrupt(KERNEL_MIN)
// asm { lda$dc0d }
lda $dc0d
// [8] *((const byte*) BGCOL) ← (byte) col#0 -- _deref_pbuc1=vbuz1
// [7] *((const byte*) BGCOL) ← (byte) col -- _deref_pbuc1=vbuz1
lda.z col
sta BGCOL
jmp __breturn
// irq::@return
__breturn:
// [9] return - exit interrupt(KERNEL_MIN)
// [8] return - exit interrupt(KERNEL_MIN)
jmp $ea81
}
// File Data
@@ -308,15 +261,10 @@ ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b1_from___b2 with __b2
Removing instruction __b1_from___bbegin:
Removing instruction __bend_from___b1:
Removing instruction __b1_from_main:
Removing instruction __b1_from___b2:
Removing instruction __b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1:
Removing instruction __bend:
@@ -331,17 +279,13 @@ FINAL SYMBOL TABLE
(label) @end
(const byte*) BGCOL = (byte*) 53280
(const void()**) KERNEL_IRQ = (void()**) 788
(byte) col
(byte) col#0 col zp[1]:2 1.5
(byte) col#1 col zp[1]:2 22.0
(byte) col#2 col zp[1]:2 24.0
(byte) col loadstore zp[1]:2 26.0
interrupt(KERNEL_MIN)(void()) irq()
(label) irq::@return
(void()) main()
(label) main::@1
(label) main::@2
zp[1]:2 [ col#2 col#0 col#1 ]
zp[1]:2 [ col ]
FINAL ASSEMBLER
@@ -359,7 +303,7 @@ Score: 123
// @begin
__bbegin:
// col = 0
// [0] (byte) col#0 ← (byte) 0 -- vbuz1=vbuc1
// [0] (byte) col ← (byte) 0 -- vbuz1=vbuc1
lda #0
sta.z col
// [1] phi from @begin to @1 [phi:@begin->@1]
@@ -377,15 +321,12 @@ main: {
sta KERNEL_IRQ
lda #>irq
sta KERNEL_IRQ+1
// [5] phi from main main::@2 to main::@1 [phi:main/main::@2->main::@1]
// [5] phi (byte) col#2 = (byte) col#0 [phi:main/main::@2->main::@1#0] -- register_copy
// main::@1
// main::@2
__b2:
__b1:
// col++;
// [6] (byte) col#1 ← ++ (byte) col#2 -- vbuz1=_inc_vbuz1
// [5] (byte) col ← ++ (byte) col -- vbuz1=_inc_vbuz1
inc.z col
jmp __b2
jmp __b1
}
// irq
irq: {
@@ -394,12 +335,12 @@ irq: {
// asm { lda$dc0d }
lda $dc0d
// *BGCOL = col
// [8] *((const byte*) BGCOL) ← (byte) col#0 -- _deref_pbuc1=vbuz1
// [7] *((const byte*) BGCOL) ← (byte) col -- _deref_pbuc1=vbuz1
lda.z col
sta BGCOL
// irq::@return
// }
// [9] return - exit interrupt(KERNEL_MIN)
// [8] return - exit interrupt(KERNEL_MIN)
jmp $ea81
}
// File Data

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