1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-03-01 15:29:52 +00:00

Fixed issue with loop depth - now calculated corrent when some functions have no loops.

This commit is contained in:
jespergravgaard 2018-01-15 21:02:49 +01:00
parent 4c22877f0e
commit 13bd9509d1
16 changed files with 1738 additions and 854 deletions

View File

@ -40,7 +40,7 @@ public class CallGraph {
* @param scopeLabel The label for the scope.
* @return The call block for the scope. Null if the call block does not exist (no calls are made from it).
*/
private CallBlock getCallBlock(LabelRef scopeLabel) {
public CallBlock getCallBlock(LabelRef scopeLabel) {
for(CallBlock callBlock : callBlocks) {
if(callBlock.getScopeLabel().equals(scopeLabel)) {
return callBlock;

View File

@ -10,8 +10,13 @@ import java.util.*;
*/
public class Pass3LoopDepthAnalysis extends Pass2Base {
private CallGraph callGraph;
private NaturalLoopSet loopSet;
public Pass3LoopDepthAnalysis(Program program) {
super(program);
callGraph = getProgram().getCallGraph();
loopSet = getProgram().getLoopSet();
}
/**
@ -19,9 +24,6 @@ public class Pass3LoopDepthAnalysis extends Pass2Base {
* Uses the call graph and natural loops of the control flow graph.
*/
public void findLoopDepths() {
CallGraph callGraph = getProgram().getCallGraph();
NaturalLoopSet loopSet = getProgram().getLoopSet();
Deque<LabelRef> todo = new ArrayDeque<>();
Set<LabelRef> done = new LinkedHashSet<>();
todo.push(callGraph.getFirstCallBlock());
@ -37,27 +39,38 @@ public class Pass3LoopDepthAnalysis extends Pass2Base {
}
}
// Find the scope blocks calling the current scope block - and the loop depth of the blocks where the call statement is
int callingDepth = 1;
Collection<LabelRef> callingScopes = callGraph.getCallingBlocks(currentScope);
for(LabelRef callingScope : callingScopes) {
CallGraph.CallBlock callingBlock = callGraph.getOrCreateCallBlock(callingScope);
Collection<CallGraph.CallBlock.Call> calls = callingBlock.getCalls(currentScope);
for(CallGraph.CallBlock.Call call : calls) {
int callStatementIdx = call.getCallStatementIdx();
ControlFlowBlock callingControlBlock = getProgram().getStatementInfos().getBlock(callStatementIdx);
Collection<NaturalLoop> callingLoops = loopSet.getLoopsContainingBlock(callingControlBlock.getLabel());
for(NaturalLoop callingLoop : callingLoops) {
int potentialDepth = callingLoop.getDepth() + 1;
if(potentialDepth > callingDepth) {
callingDepth = potentialDepth;
}
}
}
}
int callingDepth = getCallingDepth(currentScope);
findLoopDepth(currentScope, callingDepth);
}
}
private int getCallingDepth(LabelRef currentScope) {
int callingDepth = 1;
Collection<LabelRef> callingScopes = callGraph.getCallingBlocks(currentScope);
for(LabelRef callingScope : callingScopes) {
CallGraph.CallBlock callingBlock = callGraph.getCallBlock(callingScope);
Collection<CallGraph.CallBlock.Call> calls = callingBlock.getCalls(currentScope);
for(CallGraph.CallBlock.Call call : calls) {
// First look for loops containing the call
int callStatementIdx = call.getCallStatementIdx();
ControlFlowBlock callingControlBlock = getProgram().getStatementInfos().getBlock(callStatementIdx);
Collection<NaturalLoop> callingLoops = loopSet.getLoopsContainingBlock(callingControlBlock.getLabel());
for(NaturalLoop callingLoop : callingLoops) {
int potentialDepth = callingLoop.getDepth() + 1;
if(potentialDepth > callingDepth) {
callingDepth = potentialDepth;
}
}
// Also look through all callers
int superCallingDepth = getCallingDepth(callingScope);
if(superCallingDepth>callingDepth) {
callingDepth= superCallingDepth;
}
}
}
return callingDepth;
}
private void findLoopDepth(LabelRef currentScope, int initialDepth) {
NaturalLoopSet loopSet = getProgram().getLoopSet();
// Find loops in the current scope block

View File

@ -26,7 +26,6 @@ public class TestFragments {
AsmFragmentTemplateUsages.logUsages(log, false, false, false, false, false, false);
}
@Test
public void testAssignmentsBu() throws IOException, URISyntaxException {
testFragments("fragments-assignment-copy", assignmentsBu());

View File

@ -354,10 +354,15 @@ public class TestPrograms {
}
@Test
public void testLoopNest2() throws IOException, URISyntaxException {
public void testLoopNest2() throws IOException, URISyntaxException {
compileAndCompare("loopnest2");
}
@Test
public void testLoopNest3() throws IOException, URISyntaxException {
compileAndCompare("loopnest3");
}
@Test
public void testFibMem() throws IOException, URISyntaxException {
compileAndCompare("fibmem");

View File

@ -0,0 +1,18 @@
void main() {
for(byte i:0..100) {
b(i);
}
}
void b(byte i) {
c(i);
}
const byte* SCREEN = $400;
void c(byte i) {
for( byte j: 0..100) {
SCREEN[j] = i;
}
}

View File

@ -27,25 +27,30 @@ main: {
jmp b1
}
lines: {
ldx #0
.label l = 2
lda #0
sta l
b1:
lda lines_x,x
ldy l
lda lines_x,y
sta line.x0
lda lines_x+1,x
lda lines_x+1,y
sta line.x1
ldy lines_y,x
lda lines_y+1,x
sta line.y1
lda lines_y,y
sta line.y0
ldx l
ldy lines_y+1,x
jsr line
inx
cpx #lines_cnt
inc l
lda l
cmp #lines_cnt
bcc b1
rts
}
line: {
.label x0 = 2
.label x1 = 3
.label y1 = 4
.label x0 = 3
.label x1 = 4
.label y0 = 5
.label xd = 7
.label yd = $a
lda x0
@ -55,18 +60,19 @@ line: {
sec
sbc x0
sta xd
cpy y1
lda y0
sty $ff
cmp $ff
bcs b2
tya
eor #$ff
sec
adc y1
sbc y0
sta yd
cmp xd
bcs b3
lda x0
sta line_xdyi.x
sty line_xdyi.y
ldx x0
lda y0
sta line_xdyi.y
lda x1
sta line_xdyi.x1
lda xd
@ -77,9 +83,10 @@ line: {
breturn:
rts
b3:
sty line_ydxi.y
lda x0
sta line_ydxi.x
lda y0
sta line_ydxi.y
ldx x0
sty line_ydxi.y1
lda yd
sta line_ydxi.yd
lda xd
@ -88,14 +95,15 @@ line: {
jmp breturn
b2:
tya
eor #$ff
sec
sbc y1
adc y0
sta yd
cmp xd
bcs b6
lda x0
sta line_xdyd.x
sty line_xdyd.y
ldx x0
lda y0
sta line_xdyd.y
lda x1
sta line_xdyd.x1
lda xd
@ -105,11 +113,8 @@ line: {
jsr line_xdyd
jmp breturn
b6:
lda y1
sta line_ydxd.y
lda x1
sta line_ydxd.x
sty line_ydxd.y1
sty line_ydxd.y
ldx x1
lda yd
sta line_ydxd.yd
lda xd
@ -121,19 +126,18 @@ line: {
sec
sbc x1
sta xd
cpy y1
lda y0
sty $ff
cmp $ff
bcs b9
tya
eor #$ff
sec
adc y1
sbc y0
sta yd
cmp xd
bcs b10
lda x1
sta line_xdyd.x
lda y1
sta line_xdyd.y
ldx x1
sty line_xdyd.y
lda x0
sta line_xdyd.x1
lda xd
@ -143,9 +147,10 @@ line: {
jsr line_xdyd
jmp breturn
b10:
sty line_ydxd.y
lda x0
sta line_ydxd.x
lda y0
sta line_ydxd.y
ldx x0
sty line_ydxd.y1
lda yd
sta line_ydxd.yd
lda xd
@ -154,15 +159,14 @@ line: {
jmp breturn
b9:
tya
eor #$ff
sec
sbc y1
adc y0
sta yd
cmp xd
bcs b13
lda x1
sta line_xdyi.x
lda y1
sta line_xdyi.y
ldx x1
sty line_xdyi.y
lda x0
sta line_xdyi.x1
lda xd
@ -172,11 +176,8 @@ line: {
jsr line_xdyi
jmp breturn
b13:
lda y1
sta line_ydxi.y
lda x1
sta line_ydxi.x
sty line_ydxi.y1
sty line_ydxi.y
ldx x1
lda yd
sta line_ydxi.yd
lda xd
@ -186,15 +187,15 @@ line: {
}
line_ydxi: {
.label y = 6
.label x = 5
.label y1 = 4
.label yd = 3
.label xd = 2
.label y1 = 5
.label yd = 4
.label xd = 3
.label e = 7
lda xd
lsr
sta e
b1:
ldy y
jsr plot
inc y
lda xd
@ -204,7 +205,7 @@ line_ydxi: {
lda yd
cmp e
bcs b2
inc x
inx
lda e
sec
sbc yd
@ -218,17 +219,13 @@ line_ydxi: {
}
plot: {
.label _0 = 8
.label x = 5
.label y = 6
.label plotter_x = 8
.label plotter_y = $b
.label plotter = 8
ldy x
lda plot_xhi,y
lda plot_xhi,x
sta plotter_x+1
lda plot_xlo,y
lda plot_xlo,x
sta plotter_x
ldy y
lda plot_yhi,y
sta plotter_y+1
lda plot_ylo,y
@ -240,26 +237,26 @@ plot: {
lda _0+1
adc plotter_y+1
sta _0+1
ldy x
lda plot_bit,y
ldy #0
ora (plotter),y
lda (plotter),y
ora plot_bit,x
sta (plotter),y
rts
}
line_xdyi: {
.label x = 5
.label _6 = $a
.label y = 6
.label x1 = 4
.label xd = 3
.label yd = 2
.label x1 = 5
.label xd = 4
.label yd = 3
.label e = 7
lda yd
lsr
sta e
b1:
ldy y
jsr plot
inc x
inx
lda yd
clc
adc e
@ -275,21 +272,22 @@ line_xdyi: {
b2:
ldy x1
iny
cpy x
sty _6
cpx _6
bne b1
rts
}
line_ydxd: {
.label y = 6
.label x = 5
.label y1 = 4
.label yd = 3
.label xd = 2
.label y1 = 5
.label yd = 4
.label xd = 3
.label e = 7
lda xd
lsr
sta e
b1:
ldy y
jsr plot
inc y
lda xd
@ -299,7 +297,7 @@ line_ydxd: {
lda yd
cmp e
bcs b2
dec x
dex
lda e
sec
sbc yd
@ -312,18 +310,19 @@ line_ydxd: {
rts
}
line_xdyd: {
.label x = 5
.label _6 = $a
.label y = 6
.label x1 = 4
.label xd = 3
.label yd = 2
.label x1 = 5
.label xd = 4
.label yd = 3
.label e = 7
lda yd
lsr
sta e
b1:
ldy y
jsr plot
inc x
inx
lda yd
clc
adc e
@ -339,7 +338,8 @@ line_xdyd: {
b2:
ldy x1
iny
cpy x
sty _6
cpx _6
bne b1
rts
}

File diff suppressed because it is too large Load Diff

View File

@ -74,23 +74,23 @@
(label) line::@9
(label) line::@return
(byte) line::x0
(byte) line::x0#0 x0 zp ZP_BYTE:2 5.173913043478264
(byte) line::x0#0 x0 zp ZP_BYTE:3 5.173913043478264
(byte) line::x1
(byte) line::x1#0 x1 zp ZP_BYTE:3 5.409090909090908
(byte) line::x1#0 x1 zp ZP_BYTE:4 5.409090909090908
(byte) line::xd
(byte) line::xd#0 xd zp ZP_BYTE:7 0.7
(byte) line::xd#1 xd zp ZP_BYTE:7 0.7
(byte) line::y0
(byte) line::y0#0 reg byte y 5.952380952380948
(byte) line::y0#0 y0 zp ZP_BYTE:5 5.952380952380948
(byte) line::y1
(byte) line::y1#0 y1 zp ZP_BYTE:4 6.249999999999996
(byte) line::y1#0 reg byte y 6.249999999999996
(byte) line::yd
(byte) line::yd#0 yd zp ZP_BYTE:10 0.8888888888888888
(byte) line::yd#1 yd zp ZP_BYTE:10 0.8888888888888888
(byte) line::yd#10 yd zp ZP_BYTE:10 0.8888888888888888
(byte) line::yd#3 yd zp ZP_BYTE:10 0.8888888888888888
(void()) line_xdyd((byte) line_xdyd::x , (byte) line_xdyd::y , (byte) line_xdyd::x1 , (byte) line_xdyd::xd , (byte) line_xdyd::yd)
(byte/word~) line_xdyd::$6 reg byte y 22.0
(byte/word~) line_xdyd::$6 $6 zp ZP_BYTE:10 2002.0
(label) line_xdyd::@1
(label) line_xdyd::@2
(label) line_xdyd::@3
@ -98,37 +98,37 @@
(label) line_xdyd::@return
(byte) line_xdyd::e
(byte) line_xdyd::e#0 e zp ZP_BYTE:7 4.0
(byte) line_xdyd::e#1 e zp ZP_BYTE:7 14.666666666666666
(byte) line_xdyd::e#2 e zp ZP_BYTE:7 22.0
(byte) line_xdyd::e#3 e zp ZP_BYTE:7 4.800000000000001
(byte) line_xdyd::e#6 e zp ZP_BYTE:7 11.0
(byte) line_xdyd::e#1 e zp ZP_BYTE:7 1334.6666666666667
(byte) line_xdyd::e#2 e zp ZP_BYTE:7 2002.0
(byte) line_xdyd::e#3 e zp ZP_BYTE:7 400.79999999999995
(byte) line_xdyd::e#6 e zp ZP_BYTE:7 1001.0
(byte) line_xdyd::x
(byte) line_xdyd::x#0 x zp ZP_BYTE:5 0.8
(byte) line_xdyd::x#1 x zp ZP_BYTE:5 0.8
(byte) line_xdyd::x#2 x zp ZP_BYTE:5 4.125
(byte) line_xdyd::x#3 x zp ZP_BYTE:5 8.75
(byte) line_xdyd::x#6 x zp ZP_BYTE:5 3.0
(byte) line_xdyd::x#0 reg byte x 0.8
(byte) line_xdyd::x#1 reg byte x 0.8
(byte) line_xdyd::x#2 reg byte x 375.375
(byte) line_xdyd::x#3 reg byte x 751.25
(byte) line_xdyd::x#6 reg byte x 3.0
(byte) line_xdyd::x1
(byte) line_xdyd::x1#0 x1 zp ZP_BYTE:4 1.3333333333333333
(byte) line_xdyd::x1#1 x1 zp ZP_BYTE:4 1.3333333333333333
(byte) line_xdyd::x1#6 x1 zp ZP_BYTE:4 1.0714285714285714
(byte) line_xdyd::x1#0 x1 zp ZP_BYTE:5 1.3333333333333333
(byte) line_xdyd::x1#1 x1 zp ZP_BYTE:5 1.3333333333333333
(byte) line_xdyd::x1#6 x1 zp ZP_BYTE:5 71.78571428571429
(byte) line_xdyd::xd
(byte) line_xdyd::xd#0 xd zp ZP_BYTE:3 2.0
(byte) line_xdyd::xd#1 xd zp ZP_BYTE:3 2.0
(byte) line_xdyd::xd#5 xd zp ZP_BYTE:3 1.8571428571428572
(byte) line_xdyd::xd#0 xd zp ZP_BYTE:4 2.0
(byte) line_xdyd::xd#1 xd zp ZP_BYTE:4 2.0
(byte) line_xdyd::xd#5 xd zp ZP_BYTE:4 143.28571428571428
(byte) line_xdyd::y
(byte) line_xdyd::y#0 y zp ZP_BYTE:6 1.0
(byte) line_xdyd::y#1 y zp ZP_BYTE:6 1.0
(byte) line_xdyd::y#2 y zp ZP_BYTE:6 11.0
(byte) line_xdyd::y#3 y zp ZP_BYTE:6 6.571428571428571
(byte) line_xdyd::y#2 y zp ZP_BYTE:6 1001.0
(byte) line_xdyd::y#3 y zp ZP_BYTE:6 572.2857142857142
(byte) line_xdyd::y#5 y zp ZP_BYTE:6 3.0
(byte) line_xdyd::y#6 y zp ZP_BYTE:6 11.0
(byte) line_xdyd::y#6 y zp ZP_BYTE:6 1001.0
(byte) line_xdyd::yd
(byte) line_xdyd::yd#0 yd zp ZP_BYTE:2 4.0
(byte) line_xdyd::yd#1 yd zp ZP_BYTE:2 4.0
(byte) line_xdyd::yd#2 yd zp ZP_BYTE:2 1.2142857142857142
(byte) line_xdyd::yd#0 yd zp ZP_BYTE:3 4.0
(byte) line_xdyd::yd#1 yd zp ZP_BYTE:3 4.0
(byte) line_xdyd::yd#2 yd zp ZP_BYTE:3 71.92857142857143
(void()) line_xdyi((byte) line_xdyi::x , (byte) line_xdyi::y , (byte) line_xdyi::x1 , (byte) line_xdyi::xd , (byte) line_xdyi::yd)
(byte/word~) line_xdyi::$6 reg byte y 22.0
(byte/word~) line_xdyi::$6 $6 zp ZP_BYTE:10 2002.0
(label) line_xdyi::@1
(label) line_xdyi::@2
(label) line_xdyi::@3
@ -136,37 +136,37 @@
(label) line_xdyi::@return
(byte) line_xdyi::e
(byte) line_xdyi::e#0 e zp ZP_BYTE:7 4.0
(byte) line_xdyi::e#1 e zp ZP_BYTE:7 14.666666666666666
(byte) line_xdyi::e#2 e zp ZP_BYTE:7 22.0
(byte) line_xdyi::e#3 e zp ZP_BYTE:7 4.800000000000001
(byte) line_xdyi::e#6 e zp ZP_BYTE:7 11.0
(byte) line_xdyi::e#1 e zp ZP_BYTE:7 1334.6666666666667
(byte) line_xdyi::e#2 e zp ZP_BYTE:7 2002.0
(byte) line_xdyi::e#3 e zp ZP_BYTE:7 400.79999999999995
(byte) line_xdyi::e#6 e zp ZP_BYTE:7 1001.0
(byte) line_xdyi::x
(byte) line_xdyi::x#0 x zp ZP_BYTE:5 0.8
(byte) line_xdyi::x#1 x zp ZP_BYTE:5 0.8
(byte) line_xdyi::x#2 x zp ZP_BYTE:5 4.125
(byte) line_xdyi::x#3 x zp ZP_BYTE:5 8.75
(byte) line_xdyi::x#6 x zp ZP_BYTE:5 3.0
(byte) line_xdyi::x#0 reg byte x 0.8
(byte) line_xdyi::x#1 reg byte x 0.8
(byte) line_xdyi::x#2 reg byte x 375.375
(byte) line_xdyi::x#3 reg byte x 751.25
(byte) line_xdyi::x#6 reg byte x 3.0
(byte) line_xdyi::x1
(byte) line_xdyi::x1#0 x1 zp ZP_BYTE:4 1.3333333333333333
(byte) line_xdyi::x1#1 x1 zp ZP_BYTE:4 1.3333333333333333
(byte) line_xdyi::x1#6 x1 zp ZP_BYTE:4 1.0714285714285714
(byte) line_xdyi::x1#0 x1 zp ZP_BYTE:5 1.3333333333333333
(byte) line_xdyi::x1#1 x1 zp ZP_BYTE:5 1.3333333333333333
(byte) line_xdyi::x1#6 x1 zp ZP_BYTE:5 71.78571428571429
(byte) line_xdyi::xd
(byte) line_xdyi::xd#0 xd zp ZP_BYTE:3 2.0
(byte) line_xdyi::xd#1 xd zp ZP_BYTE:3 2.0
(byte) line_xdyi::xd#5 xd zp ZP_BYTE:3 1.8571428571428572
(byte) line_xdyi::xd#0 xd zp ZP_BYTE:4 2.0
(byte) line_xdyi::xd#1 xd zp ZP_BYTE:4 2.0
(byte) line_xdyi::xd#5 xd zp ZP_BYTE:4 143.28571428571428
(byte) line_xdyi::y
(byte) line_xdyi::y#0 y zp ZP_BYTE:6 1.0
(byte) line_xdyi::y#1 y zp ZP_BYTE:6 1.0
(byte) line_xdyi::y#2 y zp ZP_BYTE:6 11.0
(byte) line_xdyi::y#3 y zp ZP_BYTE:6 6.571428571428571
(byte) line_xdyi::y#2 y zp ZP_BYTE:6 1001.0
(byte) line_xdyi::y#3 y zp ZP_BYTE:6 572.2857142857142
(byte) line_xdyi::y#5 y zp ZP_BYTE:6 3.0
(byte) line_xdyi::y#6 y zp ZP_BYTE:6 11.0
(byte) line_xdyi::y#6 y zp ZP_BYTE:6 1001.0
(byte) line_xdyi::yd
(byte) line_xdyi::yd#0 yd zp ZP_BYTE:2 4.0
(byte) line_xdyi::yd#1 yd zp ZP_BYTE:2 4.0
(byte) line_xdyi::yd#2 yd zp ZP_BYTE:2 1.2142857142857142
(byte) line_xdyi::yd#0 yd zp ZP_BYTE:3 4.0
(byte) line_xdyi::yd#1 yd zp ZP_BYTE:3 4.0
(byte) line_xdyi::yd#2 yd zp ZP_BYTE:3 71.92857142857143
(void()) line_ydxd((byte) line_ydxd::y , (byte) line_ydxd::x , (byte) line_ydxd::y1 , (byte) line_ydxd::yd , (byte) line_ydxd::xd)
(byte/word~) line_ydxd::$6 reg byte y 22.0
(byte/word~) line_ydxd::$6 reg byte y 2002.0
(label) line_ydxd::@1
(label) line_ydxd::@2
(label) line_ydxd::@3
@ -174,37 +174,37 @@
(label) line_ydxd::@return
(byte) line_ydxd::e
(byte) line_ydxd::e#0 e zp ZP_BYTE:7 4.0
(byte) line_ydxd::e#1 e zp ZP_BYTE:7 14.666666666666666
(byte) line_ydxd::e#2 e zp ZP_BYTE:7 22.0
(byte) line_ydxd::e#3 e zp ZP_BYTE:7 4.800000000000001
(byte) line_ydxd::e#6 e zp ZP_BYTE:7 11.0
(byte) line_ydxd::e#1 e zp ZP_BYTE:7 1334.6666666666667
(byte) line_ydxd::e#2 e zp ZP_BYTE:7 2002.0
(byte) line_ydxd::e#3 e zp ZP_BYTE:7 400.79999999999995
(byte) line_ydxd::e#6 e zp ZP_BYTE:7 1001.0
(byte) line_ydxd::x
(byte) line_ydxd::x#0 x zp ZP_BYTE:5 1.0
(byte) line_ydxd::x#1 x zp ZP_BYTE:5 1.0
(byte) line_ydxd::x#2 x zp ZP_BYTE:5 11.0
(byte) line_ydxd::x#3 x zp ZP_BYTE:5 6.571428571428571
(byte) line_ydxd::x#5 x zp ZP_BYTE:5 3.0
(byte) line_ydxd::x#6 x zp ZP_BYTE:5 11.0
(byte) line_ydxd::x#0 reg byte x 1.0
(byte) line_ydxd::x#1 reg byte x 1.0
(byte) line_ydxd::x#2 reg byte x 1001.0
(byte) line_ydxd::x#3 reg byte x 572.2857142857142
(byte) line_ydxd::x#5 reg byte x 3.0
(byte) line_ydxd::x#6 reg byte x 1001.0
(byte) line_ydxd::xd
(byte) line_ydxd::xd#0 xd zp ZP_BYTE:2 4.0
(byte) line_ydxd::xd#1 xd zp ZP_BYTE:2 4.0
(byte) line_ydxd::xd#2 xd zp ZP_BYTE:2 1.2142857142857142
(byte) line_ydxd::xd#0 xd zp ZP_BYTE:3 4.0
(byte) line_ydxd::xd#1 xd zp ZP_BYTE:3 4.0
(byte) line_ydxd::xd#2 xd zp ZP_BYTE:3 71.92857142857143
(byte) line_ydxd::y
(byte) line_ydxd::y#0 y zp ZP_BYTE:6 0.8
(byte) line_ydxd::y#1 y zp ZP_BYTE:6 0.8
(byte) line_ydxd::y#2 y zp ZP_BYTE:6 8.75
(byte) line_ydxd::y#3 y zp ZP_BYTE:6 4.125
(byte) line_ydxd::y#2 y zp ZP_BYTE:6 751.25
(byte) line_ydxd::y#3 y zp ZP_BYTE:6 375.375
(byte) line_ydxd::y#7 y zp ZP_BYTE:6 3.0
(byte) line_ydxd::y1
(byte) line_ydxd::y1#0 y1 zp ZP_BYTE:4 1.3333333333333333
(byte) line_ydxd::y1#1 y1 zp ZP_BYTE:4 1.3333333333333333
(byte) line_ydxd::y1#6 y1 zp ZP_BYTE:4 1.0714285714285714
(byte) line_ydxd::y1#0 y1 zp ZP_BYTE:5 1.3333333333333333
(byte) line_ydxd::y1#1 y1 zp ZP_BYTE:5 1.3333333333333333
(byte) line_ydxd::y1#6 y1 zp ZP_BYTE:5 71.78571428571429
(byte) line_ydxd::yd
(byte) line_ydxd::yd#0 yd zp ZP_BYTE:3 2.0
(byte) line_ydxd::yd#1 yd zp ZP_BYTE:3 2.0
(byte) line_ydxd::yd#5 yd zp ZP_BYTE:3 1.8571428571428572
(byte) line_ydxd::yd#0 yd zp ZP_BYTE:4 2.0
(byte) line_ydxd::yd#1 yd zp ZP_BYTE:4 2.0
(byte) line_ydxd::yd#5 yd zp ZP_BYTE:4 143.28571428571428
(void()) line_ydxi((byte) line_ydxi::y , (byte) line_ydxi::x , (byte) line_ydxi::y1 , (byte) line_ydxi::yd , (byte) line_ydxi::xd)
(byte/word~) line_ydxi::$6 reg byte y 22.0
(byte/word~) line_ydxi::$6 reg byte y 2002.0
(label) line_ydxi::@1
(label) line_ydxi::@2
(label) line_ydxi::@3
@ -212,42 +212,42 @@
(label) line_ydxi::@return
(byte) line_ydxi::e
(byte) line_ydxi::e#0 e zp ZP_BYTE:7 4.0
(byte) line_ydxi::e#1 e zp ZP_BYTE:7 14.666666666666666
(byte) line_ydxi::e#2 e zp ZP_BYTE:7 22.0
(byte) line_ydxi::e#3 e zp ZP_BYTE:7 4.800000000000001
(byte) line_ydxi::e#6 e zp ZP_BYTE:7 11.0
(byte) line_ydxi::e#1 e zp ZP_BYTE:7 1334.6666666666667
(byte) line_ydxi::e#2 e zp ZP_BYTE:7 2002.0
(byte) line_ydxi::e#3 e zp ZP_BYTE:7 400.79999999999995
(byte) line_ydxi::e#6 e zp ZP_BYTE:7 1001.0
(byte) line_ydxi::x
(byte) line_ydxi::x#0 x zp ZP_BYTE:5 1.0
(byte) line_ydxi::x#1 x zp ZP_BYTE:5 1.0
(byte) line_ydxi::x#2 x zp ZP_BYTE:5 11.0
(byte) line_ydxi::x#3 x zp ZP_BYTE:5 6.571428571428571
(byte) line_ydxi::x#5 x zp ZP_BYTE:5 3.0
(byte) line_ydxi::x#6 x zp ZP_BYTE:5 11.0
(byte) line_ydxi::x#0 reg byte x 1.0
(byte) line_ydxi::x#1 reg byte x 1.0
(byte) line_ydxi::x#2 reg byte x 1001.0
(byte) line_ydxi::x#3 reg byte x 572.2857142857142
(byte) line_ydxi::x#5 reg byte x 3.0
(byte) line_ydxi::x#6 reg byte x 1001.0
(byte) line_ydxi::xd
(byte) line_ydxi::xd#0 xd zp ZP_BYTE:2 4.0
(byte) line_ydxi::xd#1 xd zp ZP_BYTE:2 4.0
(byte) line_ydxi::xd#2 xd zp ZP_BYTE:2 1.2142857142857142
(byte) line_ydxi::xd#0 xd zp ZP_BYTE:3 4.0
(byte) line_ydxi::xd#1 xd zp ZP_BYTE:3 4.0
(byte) line_ydxi::xd#2 xd zp ZP_BYTE:3 71.92857142857143
(byte) line_ydxi::y
(byte) line_ydxi::y#0 y zp ZP_BYTE:6 0.8
(byte) line_ydxi::y#1 y zp ZP_BYTE:6 0.8
(byte) line_ydxi::y#2 y zp ZP_BYTE:6 4.125
(byte) line_ydxi::y#3 y zp ZP_BYTE:6 8.75
(byte) line_ydxi::y#2 y zp ZP_BYTE:6 375.375
(byte) line_ydxi::y#3 y zp ZP_BYTE:6 751.25
(byte) line_ydxi::y#6 y zp ZP_BYTE:6 3.0
(byte) line_ydxi::y1
(byte) line_ydxi::y1#0 y1 zp ZP_BYTE:4 1.3333333333333333
(byte) line_ydxi::y1#1 y1 zp ZP_BYTE:4 1.3333333333333333
(byte) line_ydxi::y1#6 y1 zp ZP_BYTE:4 1.0714285714285714
(byte) line_ydxi::y1#0 y1 zp ZP_BYTE:5 1.3333333333333333
(byte) line_ydxi::y1#1 y1 zp ZP_BYTE:5 1.3333333333333333
(byte) line_ydxi::y1#6 y1 zp ZP_BYTE:5 71.78571428571429
(byte) line_ydxi::yd
(byte) line_ydxi::yd#0 yd zp ZP_BYTE:3 2.0
(byte) line_ydxi::yd#1 yd zp ZP_BYTE:3 2.0
(byte) line_ydxi::yd#5 yd zp ZP_BYTE:3 1.8571428571428572
(byte) line_ydxi::yd#0 yd zp ZP_BYTE:4 2.0
(byte) line_ydxi::yd#1 yd zp ZP_BYTE:4 2.0
(byte) line_ydxi::yd#5 yd zp ZP_BYTE:4 143.28571428571428
(void()) lines()
(label) lines::@1
(label) lines::@3
(label) lines::@return
(byte) lines::l
(byte) lines::l#1 reg byte x 151.5
(byte) lines::l#2 reg byte x 100.99999999999999
(byte) lines::l#1 l zp ZP_BYTE:2 151.5
(byte) lines::l#2 l zp ZP_BYTE:2 100.99999999999999
(byte) lines_cnt
(const byte) lines_cnt#0 lines_cnt = (byte/signed byte/word/signed word) 8
(byte[]) lines_x
@ -270,17 +270,17 @@
(word) plot::plotter_y
(word) plot::plotter_y#0 plotter_y zp ZP_WORD:11 4.0
(byte) plot::x
(byte) plot::x#0 x zp ZP_BYTE:5 11.0
(byte) plot::x#1 x zp ZP_BYTE:5 11.0
(byte) plot::x#2 x zp ZP_BYTE:5 11.0
(byte) plot::x#3 x zp ZP_BYTE:5 11.0
(byte) plot::x#4 x zp ZP_BYTE:5 10.000000000000002
(byte) plot::x#0 reg byte x 1001.0
(byte) plot::x#1 reg byte x 1001.0
(byte) plot::x#2 reg byte x 1001.0
(byte) plot::x#3 reg byte x 1001.0
(byte) plot::x#4 reg byte x 801.9999999999999
(byte) plot::y
(byte) plot::y#0 y zp ZP_BYTE:6 22.0
(byte) plot::y#1 y zp ZP_BYTE:6 22.0
(byte) plot::y#2 y zp ZP_BYTE:6 22.0
(byte) plot::y#3 y zp ZP_BYTE:6 22.0
(byte) plot::y#4 y zp ZP_BYTE:6 24.0
(byte) plot::y#0 reg byte y 2002.0
(byte) plot::y#1 reg byte y 2002.0
(byte) plot::y#2 reg byte y 2002.0
(byte) plot::y#3 reg byte y 2002.0
(byte) plot::y#4 reg byte y 2004.0
(byte[256]) plot_bit
(const byte[256]) plot_bit#0 plot_bit = { fill( 256, 0) }
(byte[256]) plot_xhi
@ -292,25 +292,28 @@
(byte[256]) plot_ylo
(const byte[256]) plot_ylo#0 plot_ylo = { fill( 256, 0) }
reg byte x [ lines::l#2 lines::l#1 ]
zp ZP_BYTE:2 [ line_ydxi::xd#2 line_ydxi::xd#1 line_ydxi::xd#0 line_xdyi::yd#2 line_xdyi::yd#0 line_xdyi::yd#1 line_ydxd::xd#2 line_ydxd::xd#1 line_ydxd::xd#0 line_xdyd::yd#2 line_xdyd::yd#0 line_xdyd::yd#1 line::x0#0 init_plot_tables::$6 ]
zp ZP_BYTE:3 [ line_ydxi::yd#5 line_ydxi::yd#1 line_ydxi::yd#0 line_xdyi::xd#5 line_xdyi::xd#0 line_xdyi::xd#1 line_ydxd::yd#5 line_ydxd::yd#1 line_ydxd::yd#0 line_xdyd::xd#5 line_xdyd::xd#0 line_xdyd::xd#1 line::x1#0 ]
zp ZP_BYTE:4 [ line_ydxi::y1#6 line_ydxi::y1#1 line_ydxi::y1#0 line_xdyi::x1#6 line_xdyi::x1#0 line_xdyi::x1#1 line_ydxd::y1#6 line_ydxd::y1#1 line_ydxd::y1#0 line_xdyd::x1#6 line_xdyd::x1#0 line_xdyd::x1#1 line::y1#0 ]
zp ZP_BYTE:5 [ line_ydxi::x#3 line_ydxi::x#5 line_ydxi::x#1 line_ydxi::x#0 line_ydxi::x#6 line_ydxi::x#2 plot::x#4 plot::x#1 plot::x#0 plot::x#3 plot::x#2 line_xdyi::x#3 line_xdyi::x#6 line_xdyi::x#0 line_xdyi::x#1 line_xdyi::x#2 line_ydxd::x#3 line_ydxd::x#5 line_ydxd::x#1 line_ydxd::x#0 line_ydxd::x#6 line_ydxd::x#2 line_xdyd::x#3 line_xdyd::x#6 line_xdyd::x#0 line_xdyd::x#1 line_xdyd::x#2 ]
zp ZP_BYTE:6 [ line_ydxi::y#3 line_ydxi::y#6 line_ydxi::y#1 line_ydxi::y#0 line_ydxi::y#2 plot::y#4 plot::y#1 plot::y#0 plot::y#3 plot::y#2 line_xdyi::y#3 line_xdyi::y#5 line_xdyi::y#0 line_xdyi::y#1 line_xdyi::y#6 line_xdyi::y#2 line_ydxd::y#2 line_ydxd::y#7 line_ydxd::y#1 line_ydxd::y#0 line_ydxd::y#3 line_xdyd::y#3 line_xdyd::y#5 line_xdyd::y#0 line_xdyd::y#1 line_xdyd::y#6 line_xdyd::y#2 ]
zp ZP_BYTE:2 [ lines::l#2 lines::l#1 init_plot_tables::$6 ]
zp ZP_BYTE:3 [ line_ydxi::xd#2 line_ydxi::xd#1 line_ydxi::xd#0 line_xdyi::yd#2 line_xdyi::yd#0 line_xdyi::yd#1 line_ydxd::xd#2 line_ydxd::xd#1 line_ydxd::xd#0 line_xdyd::yd#2 line_xdyd::yd#0 line_xdyd::yd#1 line::x0#0 ]
zp ZP_BYTE:4 [ line_ydxi::yd#5 line_ydxi::yd#1 line_ydxi::yd#0 line_xdyi::xd#5 line_xdyi::xd#0 line_xdyi::xd#1 line_ydxd::yd#5 line_ydxd::yd#1 line_ydxd::yd#0 line_xdyd::xd#5 line_xdyd::xd#0 line_xdyd::xd#1 line::x1#0 ]
zp ZP_BYTE:5 [ line_ydxi::y1#6 line_ydxi::y1#1 line_ydxi::y1#0 line_xdyi::x1#6 line_xdyi::x1#0 line_xdyi::x1#1 line_ydxd::y1#6 line_ydxd::y1#1 line_ydxd::y1#0 line_xdyd::x1#6 line_xdyd::x1#0 line_xdyd::x1#1 line::y0#0 ]
reg byte x [ line_ydxi::x#3 line_ydxi::x#5 line_ydxi::x#1 line_ydxi::x#0 line_ydxi::x#6 line_ydxi::x#2 ]
zp ZP_BYTE:6 [ line_ydxi::y#3 line_ydxi::y#6 line_ydxi::y#1 line_ydxi::y#0 line_ydxi::y#2 line_xdyi::y#3 line_xdyi::y#5 line_xdyi::y#0 line_xdyi::y#1 line_xdyi::y#6 line_xdyi::y#2 line_ydxd::y#2 line_ydxd::y#7 line_ydxd::y#1 line_ydxd::y#0 line_ydxd::y#3 line_xdyd::y#3 line_xdyd::y#5 line_xdyd::y#0 line_xdyd::y#1 line_xdyd::y#6 line_xdyd::y#2 ]
zp ZP_BYTE:7 [ line_ydxi::e#3 line_ydxi::e#0 line_ydxi::e#6 line_ydxi::e#2 line_ydxi::e#1 line_xdyi::e#3 line_xdyi::e#0 line_xdyi::e#6 line_xdyi::e#2 line_xdyi::e#1 line_ydxd::e#3 line_ydxd::e#0 line_ydxd::e#6 line_ydxd::e#2 line_ydxd::e#1 line_xdyd::e#3 line_xdyd::e#0 line_xdyd::e#6 line_xdyd::e#2 line_xdyd::e#1 line::xd#1 line::xd#0 ]
reg byte x [ plot::x#4 plot::x#1 plot::x#0 plot::x#3 plot::x#2 ]
reg byte y [ plot::y#4 plot::y#1 plot::y#0 plot::y#3 plot::y#2 ]
reg byte x [ line_xdyi::x#3 line_xdyi::x#6 line_xdyi::x#0 line_xdyi::x#1 line_xdyi::x#2 ]
reg byte x [ line_ydxd::x#3 line_ydxd::x#5 line_ydxd::x#1 line_ydxd::x#0 line_ydxd::x#6 line_ydxd::x#2 ]
reg byte x [ line_xdyd::x#3 line_xdyd::x#6 line_xdyd::x#0 line_xdyd::x#1 line_xdyd::x#2 ]
reg byte x [ init_plot_tables::x#2 init_plot_tables::x#1 ]
reg byte y [ init_plot_tables::bits#3 init_plot_tables::bits#4 init_plot_tables::bits#1 ]
reg byte x [ init_plot_tables::y#2 init_plot_tables::y#1 ]
zp ZP_WORD:8 [ init_plot_tables::yoffs#2 init_plot_tables::yoffs#4 init_plot_tables::yoffs#1 init_screen::b#2 init_screen::b#1 init_screen::c#2 init_screen::c#1 plot::plotter_x#0 plot::$0 plot::plotter#0 ]
reg byte y [ line::y0#0 ]
zp ZP_BYTE:10 [ line::yd#1 line::yd#0 line::yd#3 line::yd#10 ]
reg byte y [ line::y1#0 ]
zp ZP_BYTE:10 [ line::yd#1 line::yd#0 line::yd#3 line::yd#10 line_xdyi::$6 line_xdyd::$6 ]
reg byte y [ line_ydxi::$6 ]
zp ZP_WORD:11 [ plot::plotter_y#0 ]
reg byte a [ plot::$1 ]
reg byte y [ line_xdyi::$6 ]
reg byte y [ line_ydxd::$6 ]
reg byte y [ line_xdyd::$6 ]
reg byte a [ init_plot_tables::$0 ]
reg byte a [ init_plot_tables::$7 ]
reg byte a [ init_plot_tables::$8 ]

View File

@ -0,0 +1,28 @@
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.const SCREEN = $400
jsr main
main: {
ldy #0
b1:
jsr b
iny
cpy #$65
bne b1
rts
}
b: {
tya
jsr c
rts
}
c: {
ldx #0
b1:
sta SCREEN,x
inx
cpx #$65
bne b1
rts
}

View File

@ -0,0 +1,43 @@
@begin: scope:[] from
[0] phi() [ ] ( )
to:@3
@3: scope:[] from @begin
[1] phi() [ ] ( )
[2] call main param-assignment [ ] ( )
to:@end
@end: scope:[] from @3
[3] phi() [ ] ( )
main: scope:[main] from @3
[4] phi() [ ] ( main:2 [ ] )
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word) 0 main::@3/(byte) main::i#1 ) [ main::i#2 ] ( main:2 [ main::i#2 ] )
[6] (byte) b::i#0 ← (byte) main::i#2 [ main::i#2 b::i#0 ] ( main:2 [ main::i#2 b::i#0 ] )
[7] call b param-assignment [ main::i#2 ] ( main:2 [ main::i#2 ] )
to:main::@3
main::@3: scope:[main] from main::@1
[8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] )
[9] if((byte) main::i#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] )
to:main::@return
main::@return: scope:[main] from main::@3
[10] return [ ] ( main:2 [ ] )
to:@return
b: scope:[b] from main::@1
[11] (byte) c::i#0 ← (byte) b::i#0 [ c::i#0 ] ( main:2::b:7 [ main::i#2 c::i#0 ] )
[12] call c param-assignment [ ] ( main:2::b:7 [ main::i#2 ] )
to:b::@return
b::@return: scope:[b] from b
[13] return [ ] ( main:2::b:7 [ main::i#2 ] )
to:@return
c: scope:[c] from b
[14] phi() [ c::i#0 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 ] )
to:c::@1
c::@1: scope:[c] from c c::@1
[15] (byte) c::j#2 ← phi( c/(byte/signed byte/word/signed word) 0 c::@1/(byte) c::j#1 ) [ c::i#0 c::j#2 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#2 ] )
[16] *((const byte*) SCREEN#0 + (byte) c::j#2) ← (byte) c::i#0 [ c::i#0 c::j#2 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#2 ] )
[17] (byte) c::j#1 ← ++ (byte) c::j#2 [ c::i#0 c::j#1 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#1 ] )
[18] if((byte) c::j#1!=(byte/signed byte/word/signed word) 101) goto c::@1 [ c::i#0 c::j#1 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#1 ] )
to:c::@return
c::@return: scope:[c] from c::@1
[19] return [ ] ( main:2::b:7::c:12 [ main::i#2 ] )
to:@return

View File

@ -0,0 +1,760 @@
PARSING src/test/java/dk/camelot64/kickc/test/kc/loopnest3.kc
void main() {
for(byte i:0..100) {
b(i);
}
}
void b(byte i) {
c(i);
}
const byte* SCREEN = $400;
void c(byte i) {
for( byte j: 0..100) {
SCREEN[j] = i;
}
}
STATEMENTS
proc (void()) main()
(byte) main::i ← (byte/signed byte/word/signed word) 0
main::@1:
(void~) main::$0 ← call b (byte) main::i
(byte) main::i ← ++ (byte) main::i
(boolean~) main::$1 ← (byte) main::i != (byte/signed byte/word/signed word) 101
if((boolean~) main::$1) goto main::@1
main::@return:
return
endproc // main()
proc (void()) b((byte) b::i)
(void~) b::$0 ← call c (byte) b::i
b::@return:
return
endproc // b()
(byte*) SCREEN ← (word/signed word) 1024
proc (void()) c((byte) c::i)
(byte) c::j ← (byte/signed byte/word/signed word) 0
c::@1:
*((byte*) SCREEN + (byte) c::j) ← (byte) c::i
(byte) c::j ← ++ (byte) c::j
(boolean~) c::$0 ← (byte) c::j != (byte/signed byte/word/signed word) 101
if((boolean~) c::$0) goto c::@1
c::@return:
return
endproc // c()
call main
SYMBOLS
(byte*) SCREEN
(void()) b((byte) b::i)
(void~) b::$0
(label) b::@return
(byte) b::i
(void()) c((byte) c::i)
(boolean~) c::$0
(label) c::@1
(label) c::@return
(byte) c::i
(byte) c::j
(void()) main()
(void~) main::$0
(boolean~) main::$1
(label) main::@1
(label) main::@return
(byte) main::i
Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024
INITIAL CONTROL FLOW GRAPH
@begin: scope:[] from
to:@1
main: scope:[main] from
(byte) main::i ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(void~) main::$0 ← call b (byte) main::i
(byte) main::i ← ++ (byte) main::i
(boolean~) main::$1 ← (byte) main::i != (byte/signed byte/word/signed word) 101
if((boolean~) main::$1) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1
to:main::@return
main::@return: scope:[main] from main::@2
return
to:@return
@1: scope:[] from @begin
to:@2
b: scope:[b] from
(void~) b::$0 ← call c (byte) b::i
to:b::@return
b::@return: scope:[b] from b
return
to:@return
@2: scope:[] from @1
(byte*) SCREEN ← ((byte*)) (word/signed word) 1024
to:@3
c: scope:[c] from
(byte) c::j ← (byte/signed byte/word/signed word) 0
to:c::@1
c::@1: scope:[c] from c c::@1
*((byte*) SCREEN + (byte) c::j) ← (byte) c::i
(byte) c::j ← ++ (byte) c::j
(boolean~) c::$0 ← (byte) c::j != (byte/signed byte/word/signed word) 101
if((boolean~) c::$0) goto c::@1
to:c::@2
c::@2: scope:[c] from c::@1
to:c::@return
c::@return: scope:[c] from c::@2
return
to:@return
@3: scope:[] from @2
call main
to:@end
@end: scope:[] from @3
Eliminating unused variable - keeping the call (void~) main::$0
Eliminating unused variable - keeping the call (void~) b::$0
Removing empty block main::@2
Removing empty block @1
Removing empty block c::@2
PROCEDURE MODIFY VARIABLE ANALYSIS
Completing Phi functions...
Completing Phi functions...
CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
@begin: scope:[] from
to:@2
main: scope:[main] from @3
(byte) main::i#0 ← (byte/signed byte/word/signed word) 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) b::i#0 ← (byte) main::i#2
call b param-assignment
to:main::@3
main::@3: scope:[main] from main::@1
(byte) main::i#3 ← phi( main::@1/(byte) main::i#2 )
(byte) main::i#1 ← ++ (byte) main::i#3
(boolean~) main::$1 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 101
if((boolean~) main::$1) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@3
return
to:@return
b: scope:[b] from main::@1
(byte) b::i#1 ← phi( main::@1/(byte) b::i#0 )
(byte) c::i#0 ← (byte) b::i#1
call c param-assignment
to:b::@1
b::@1: scope:[b] from b
to:b::@return
b::@return: scope:[b] from b::@1
return
to:@return
@2: scope:[] from @begin
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@3
c: scope:[c] from b
(byte) c::i#2 ← phi( b/(byte) c::i#0 )
(byte) c::j#0 ← (byte/signed byte/word/signed word) 0
to:c::@1
c::@1: scope:[c] from c c::@1
(byte) c::j#2 ← phi( c/(byte) c::j#0 c::@1/(byte) c::j#1 )
(byte) c::i#1 ← phi( c/(byte) c::i#2 c::@1/(byte) c::i#1 )
*((byte*) SCREEN#0 + (byte) c::j#2) ← (byte) c::i#1
(byte) c::j#1 ← ++ (byte) c::j#2
(boolean~) c::$0 ← (byte) c::j#1 != (byte/signed byte/word/signed word) 101
if((boolean~) c::$0) goto c::@1
to:c::@return
c::@return: scope:[c] from c::@1
return
to:@return
@3: scope:[] from @2
call main param-assignment
to:@4
@4: scope:[] from @3
to:@end
@end: scope:[] from @4
SYMBOL TABLE SSA
(label) @2
(label) @3
(label) @4
(label) @begin
(label) @end
(byte*) SCREEN
(byte*) SCREEN#0
(void()) b((byte) b::i)
(label) b::@1
(label) b::@return
(byte) b::i
(byte) b::i#0
(byte) b::i#1
(void()) c((byte) c::i)
(boolean~) c::$0
(label) c::@1
(label) c::@return
(byte) c::i
(byte) c::i#0
(byte) c::i#1
(byte) c::i#2
(byte) c::j
(byte) c::j#0
(byte) c::j#1
(byte) c::j#2
(void()) main()
(boolean~) main::$1
(label) main::@1
(label) main::@3
(label) main::@return
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
(byte) main::i#3
OPTIMIZING CONTROL FLOW GRAPH
Culled Empty Block (label) b::@1
Culled Empty Block (label) @4
Succesful SSA optimization Pass2CullEmptyBlocks
Not aliassing across scopes: b::i#0 main::i#2
Not aliassing across scopes: b::i#1 b::i#0
Not aliassing across scopes: c::i#0 b::i#1
Not aliassing across scopes: c::i#2 c::i#0
Alias (byte) main::i#2 = (byte) main::i#3
Succesful SSA optimization Pass2AliasElimination
Not aliassing across scopes: b::i#0 main::i#2
Not aliassing across scopes: b::i#1 b::i#0
Not aliassing across scopes: c::i#0 b::i#1
Not aliassing across scopes: c::i#2 c::i#0
Self Phi Eliminated (byte) c::i#1
Succesful SSA optimization Pass2SelfPhiElimination
Redundant Phi (byte) b::i#1 (byte) b::i#0
Redundant Phi (byte) c::i#2 (byte) c::i#0
Redundant Phi (byte) c::i#1 (byte) c::i#2
Succesful SSA optimization Pass2RedundantPhiElimination
Simple Condition (boolean~) main::$1 if((byte) main::i#1!=(byte/signed byte/word/signed word) 101) goto main::@1
Simple Condition (boolean~) c::$0 if((byte) c::j#1!=(byte/signed byte/word/signed word) 101) goto c::@1
Succesful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte) main::i#0 = 0
Constant (const byte*) SCREEN#0 = ((byte*))1024
Constant (const byte) c::j#0 = 0
Succesful SSA optimization Pass2ConstantIdentification
Culled Empty Block (label) @2
Succesful SSA optimization Pass2CullEmptyBlocks
Not aliassing across scopes: b::i#0 main::i#2
Not aliassing across scopes: c::i#0 b::i#0
Not aliassing across scopes: b::i#0 main::i#2
Not aliassing across scopes: c::i#0 b::i#0
OPTIMIZING CONTROL FLOW GRAPH
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte) main::i#0
Inlining constant with var siblings (const byte) c::j#0
Inlining constant with var siblings (const byte) c::j#0
Constant inlined main::i#0 = (byte/signed byte/word/signed word) 0
Constant inlined c::j#0 = (byte/signed byte/word/signed word) 0
Succesful SSA optimization Pass2ConstantInlining
Block Sequence Planned @begin @3 @end main main::@1 main::@3 main::@return b b::@return c c::@1 c::@return
Added new block during phi lifting main::@4(between main::@3 and main::@1)
Added new block during phi lifting c::@3(between c::@1 and c::@1)
Block Sequence Planned @begin @3 @end main main::@1 main::@3 main::@return main::@4 b b::@return c c::@1 c::@return c::@3
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of c
CALL GRAPH
Calls in [] to main:2
Calls in [main] to b:7
Calls in [b] to c:13
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Created 2 initial phi equivalence classes
Coalesced [11] main::i#4 ← main::i#1
Coalesced [21] c::j#3 ← c::j#1
Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) main::@4
Culled Empty Block (label) c::@3
Block Sequence Planned @begin @3 @end main main::@1 main::@3 main::@return b b::@return c c::@1 c::@return
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @3
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
Adding NOP phi() at start of c
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
Propagating live ranges...
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] phi() [ ] ( )
to:@3
@3: scope:[] from @begin
[1] phi() [ ] ( )
[2] call main param-assignment [ ] ( )
to:@end
@end: scope:[] from @3
[3] phi() [ ] ( )
main: scope:[main] from @3
[4] phi() [ ] ( main:2 [ ] )
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word) 0 main::@3/(byte) main::i#1 ) [ main::i#2 ] ( main:2 [ main::i#2 ] )
[6] (byte) b::i#0 ← (byte) main::i#2 [ main::i#2 b::i#0 ] ( main:2 [ main::i#2 b::i#0 ] )
[7] call b param-assignment [ main::i#2 ] ( main:2 [ main::i#2 ] )
to:main::@3
main::@3: scope:[main] from main::@1
[8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] )
[9] if((byte) main::i#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] )
to:main::@return
main::@return: scope:[main] from main::@3
[10] return [ ] ( main:2 [ ] )
to:@return
b: scope:[b] from main::@1
[11] (byte) c::i#0 ← (byte) b::i#0 [ c::i#0 ] ( main:2::b:7 [ main::i#2 c::i#0 ] )
[12] call c param-assignment [ ] ( main:2::b:7 [ main::i#2 ] )
to:b::@return
b::@return: scope:[b] from b
[13] return [ ] ( main:2::b:7 [ main::i#2 ] )
to:@return
c: scope:[c] from b
[14] phi() [ c::i#0 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 ] )
to:c::@1
c::@1: scope:[c] from c c::@1
[15] (byte) c::j#2 ← phi( c/(byte/signed byte/word/signed word) 0 c::@1/(byte) c::j#1 ) [ c::i#0 c::j#2 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#2 ] )
[16] *((const byte*) SCREEN#0 + (byte) c::j#2) ← (byte) c::i#0 [ c::i#0 c::j#2 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#2 ] )
[17] (byte) c::j#1 ← ++ (byte) c::j#2 [ c::i#0 c::j#1 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#1 ] )
[18] if((byte) c::j#1!=(byte/signed byte/word/signed word) 101) goto c::@1 [ c::i#0 c::j#1 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#1 ] )
to:c::@return
c::@return: scope:[c] from c::@1
[19] return [ ] ( main:2::b:7::c:12 [ main::i#2 ] )
to:@return
DOMINATORS
@begin dominated by @begin
@3 dominated by @begin @3
@end dominated by @begin @3 @end
main dominated by @begin @3 main
main::@1 dominated by @begin @3 main::@1 main
main::@3 dominated by @begin @3 main::@1 main main::@3
main::@return dominated by main::@return @begin @3 main::@1 main main::@3
b dominated by b @begin @3 main::@1 main
b::@return dominated by b::@return b @begin @3 main::@1 main
c dominated by b @begin @3 c main::@1 main
c::@1 dominated by b @begin @3 c main::@1 main c::@1
c::@return dominated by b @begin @3 c c::@return main::@1 main c::@1
NATURAL LOOPS
Found back edge: Loop head: main::@1 tails: main::@3 blocks: null
Found back edge: Loop head: c::@1 tails: c::@1 blocks: null
Populated: Loop head: main::@1 tails: main::@3 blocks: main::@3 main::@1
Populated: Loop head: c::@1 tails: c::@1 blocks: c::@1
Loop head: main::@1 tails: main::@3 blocks: main::@3 main::@1
Loop head: c::@1 tails: c::@1 blocks: c::@1
NATURAL LOOPS WITH DEPTH
Found 0 loops in scope []
Found 1 loops in scope [main]
Loop head: main::@1 tails: main::@3 blocks: main::@3 main::@1
Found 0 loops in scope [b]
Found 1 loops in scope [c]
Loop head: c::@1 tails: c::@1 blocks: c::@1
Loop head: main::@1 tails: main::@3 blocks: main::@3 main::@1 depth: 1
Loop head: c::@1 tails: c::@1 blocks: c::@1 depth: 2
VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) b((byte) b::i)
(byte) b::i
(byte) b::i#0 13.0
(void()) c((byte) c::i)
(byte) c::i
(byte) c::i#0 17.166666666666664
(byte) c::j
(byte) c::j#1 151.5
(byte) c::j#2 151.5
(void()) main()
(byte) main::i
(byte) main::i#1 16.5
(byte) main::i#2 11.0
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
[ c::j#2 c::j#1 ]
Added variable b::i#0 to zero page equivalence class [ b::i#0 ]
Added variable c::i#0 to zero page equivalence class [ c::i#0 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
[ c::j#2 c::j#1 ]
[ b::i#0 ]
[ c::i#0 ]
Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Allocated zp ZP_BYTE:3 [ c::j#2 c::j#1 ]
Allocated zp ZP_BYTE:4 [ b::i#0 ]
Allocated zp ZP_BYTE:5 [ c::i#0 ]
INITIAL ASM
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
.const SCREEN = $400
//SEG2 @begin
bbegin:
//SEG3 [1] phi from @begin to @3 [phi:@begin->@3]
b3_from_bbegin:
jmp b3
//SEG4 @3
b3:
//SEG5 [2] call main param-assignment [ ] ( )
//SEG6 [4] phi from @3 to main [phi:@3->main]
main_from_b3:
jsr main
//SEG7 [3] phi from @3 to @end [phi:@3->@end]
bend_from_b3:
jmp bend
//SEG8 @end
bend:
//SEG9 main
main: {
.label i = 2
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta i
jmp b1
//SEG12 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
b1:
//SEG15 [6] (byte) b::i#0 ← (byte) main::i#2 [ main::i#2 b::i#0 ] ( main:2 [ main::i#2 b::i#0 ] ) -- vbuz1=vbuz2
lda i
sta b.i
//SEG16 [7] call b param-assignment [ main::i#2 ] ( main:2 [ main::i#2 ] )
jsr b
jmp b3
//SEG17 main::@3
b3:
//SEG18 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuz1=_inc_vbuz1
inc i
//SEG19 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1
lda i
cmp #$65
bne b1_from_b3
jmp breturn
//SEG20 main::@return
breturn:
//SEG21 [10] return [ ] ( main:2 [ ] )
rts
}
//SEG22 b
b: {
.label i = 4
//SEG23 [11] (byte) c::i#0 ← (byte) b::i#0 [ c::i#0 ] ( main:2::b:7 [ main::i#2 c::i#0 ] ) -- vbuz1=vbuz2
lda i
sta c.i
//SEG24 [12] call c param-assignment [ ] ( main:2::b:7 [ main::i#2 ] )
//SEG25 [14] phi from b to c [phi:b->c]
c_from_b:
jsr c
jmp breturn
//SEG26 b::@return
breturn:
//SEG27 [13] return [ ] ( main:2::b:7 [ main::i#2 ] )
rts
}
//SEG28 c
c: {
.label i = 5
.label j = 3
//SEG29 [15] phi from c to c::@1 [phi:c->c::@1]
b1_from_c:
//SEG30 [15] phi (byte) c::j#2 = (byte/signed byte/word/signed word) 0 [phi:c->c::@1#0] -- vbuz1=vbuc1
lda #0
sta j
jmp b1
//SEG31 [15] phi from c::@1 to c::@1 [phi:c::@1->c::@1]
b1_from_b1:
//SEG32 [15] phi (byte) c::j#2 = (byte) c::j#1 [phi:c::@1->c::@1#0] -- register_copy
jmp b1
//SEG33 c::@1
b1:
//SEG34 [16] *((const byte*) SCREEN#0 + (byte) c::j#2) ← (byte) c::i#0 [ c::i#0 c::j#2 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#2 ] ) -- pbuc1_derefidx_vbuz1=vbuz2
ldy j
lda i
sta SCREEN,y
//SEG35 [17] (byte) c::j#1 ← ++ (byte) c::j#2 [ c::i#0 c::j#1 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#1 ] ) -- vbuz1=_inc_vbuz1
inc j
//SEG36 [18] if((byte) c::j#1!=(byte/signed byte/word/signed word) 101) goto c::@1 [ c::i#0 c::j#1 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#1 ] ) -- vbuz1_neq_vbuc1_then_la1
lda j
cmp #$65
bne b1_from_b1
jmp breturn
//SEG37 c::@return
breturn:
//SEG38 [19] return [ ] ( main:2::b:7::c:12 [ main::i#2 ] )
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:3 [ c::j#2 c::j#1 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ b::i#0 ] : zp ZP_BYTE:4 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:5 [ c::i#0 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [c] 303: zp ZP_BYTE:3 [ c::j#2 c::j#1 ] 17.17: zp ZP_BYTE:5 [ c::i#0 ]
Uplift Scope [main] 27.5: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
Uplift Scope [b] 13: zp ZP_BYTE:4 [ b::i#0 ]
Uplift Scope []
Uplifting [c] best 2707 combination reg byte x [ c::j#2 c::j#1 ] reg byte a [ c::i#0 ]
Uplifting [main] best 2587 combination reg byte y [ main::i#2 main::i#1 ]
Uplifting [b] best 2556 combination reg byte y [ b::i#0 ]
Uplifting [] best 2556 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
.const SCREEN = $400
//SEG2 @begin
bbegin:
//SEG3 [1] phi from @begin to @3 [phi:@begin->@3]
b3_from_bbegin:
jmp b3
//SEG4 @3
b3:
//SEG5 [2] call main param-assignment [ ] ( )
//SEG6 [4] phi from @3 to main [phi:@3->main]
main_from_b3:
jsr main
//SEG7 [3] phi from @3 to @end [phi:@3->@end]
bend_from_b3:
jmp bend
//SEG8 @end
bend:
//SEG9 main
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
b1_from_main:
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1
ldy #0
jmp b1
//SEG12 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
b1_from_b3:
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
jmp b1
//SEG14 main::@1
b1:
//SEG15 [6] (byte) b::i#0 ← (byte) main::i#2 [ main::i#2 b::i#0 ] ( main:2 [ main::i#2 b::i#0 ] )
// (byte) b::i#0 = (byte) main::i#2 // register copy reg byte y
//SEG16 [7] call b param-assignment [ main::i#2 ] ( main:2 [ main::i#2 ] )
jsr b
jmp b3
//SEG17 main::@3
b3:
//SEG18 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuyy=_inc_vbuyy
iny
//SEG19 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuyy_neq_vbuc1_then_la1
cpy #$65
bne b1_from_b3
jmp breturn
//SEG20 main::@return
breturn:
//SEG21 [10] return [ ] ( main:2 [ ] )
rts
}
//SEG22 b
b: {
//SEG23 [11] (byte) c::i#0 ← (byte) b::i#0 [ c::i#0 ] ( main:2::b:7 [ main::i#2 c::i#0 ] ) -- vbuaa=vbuyy
tya
//SEG24 [12] call c param-assignment [ ] ( main:2::b:7 [ main::i#2 ] )
//SEG25 [14] phi from b to c [phi:b->c]
c_from_b:
jsr c
jmp breturn
//SEG26 b::@return
breturn:
//SEG27 [13] return [ ] ( main:2::b:7 [ main::i#2 ] )
rts
}
//SEG28 c
c: {
//SEG29 [15] phi from c to c::@1 [phi:c->c::@1]
b1_from_c:
//SEG30 [15] phi (byte) c::j#2 = (byte/signed byte/word/signed word) 0 [phi:c->c::@1#0] -- vbuxx=vbuc1
ldx #0
jmp b1
//SEG31 [15] phi from c::@1 to c::@1 [phi:c::@1->c::@1]
b1_from_b1:
//SEG32 [15] phi (byte) c::j#2 = (byte) c::j#1 [phi:c::@1->c::@1#0] -- register_copy
jmp b1
//SEG33 c::@1
b1:
//SEG34 [16] *((const byte*) SCREEN#0 + (byte) c::j#2) ← (byte) c::i#0 [ c::i#0 c::j#2 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#2 ] ) -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
//SEG35 [17] (byte) c::j#1 ← ++ (byte) c::j#2 [ c::i#0 c::j#1 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#1 ] ) -- vbuxx=_inc_vbuxx
inx
//SEG36 [18] if((byte) c::j#1!=(byte/signed byte/word/signed word) 101) goto c::@1 [ c::i#0 c::j#1 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#1 ] ) -- vbuxx_neq_vbuc1_then_la1
cpx #$65
bne b1_from_b1
jmp breturn
//SEG37 c::@return
breturn:
//SEG38 [19] return [ ] ( main:2::b:7::c:12 [ main::i#2 ] )
rts
}
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp b3
Removing instruction jmp bend
Removing instruction jmp b1
Removing instruction jmp b3
Removing instruction jmp breturn
Removing instruction jmp breturn
Removing instruction jmp b1
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label b1_from_b3 with b1
Replacing label b1_from_b1 with b1
Removing instruction bbegin:
Removing instruction b3_from_bbegin:
Removing instruction main_from_b3:
Removing instruction bend_from_b3:
Removing instruction b1_from_b3:
Removing instruction b1_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction b3:
Removing instruction bend:
Removing instruction b1_from_main:
Removing instruction b3:
Removing instruction breturn:
Removing instruction c_from_b:
Removing instruction breturn:
Removing instruction b1_from_c:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jmp b1
Removing instruction jmp b1
Succesful ASM optimization Pass5NextJumpElimination
FINAL SYMBOL TABLE
(label) @3
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word) 1024
(void()) b((byte) b::i)
(label) b::@return
(byte) b::i
(byte) b::i#0 reg byte y 13.0
(void()) c((byte) c::i)
(label) c::@1
(label) c::@return
(byte) c::i
(byte) c::i#0 reg byte a 17.166666666666664
(byte) c::j
(byte) c::j#1 reg byte x 151.5
(byte) c::j#2 reg byte x 151.5
(void()) main()
(label) main::@1
(label) main::@3
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte y 16.5
(byte) main::i#2 reg byte y 11.0
reg byte y [ main::i#2 main::i#1 ]
reg byte x [ c::j#2 c::j#1 ]
reg byte y [ b::i#0 ]
reg byte a [ c::i#0 ]
FINAL ASSEMBLER
Score: 1527
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
.const SCREEN = $400
//SEG2 @begin
//SEG3 [1] phi from @begin to @3 [phi:@begin->@3]
//SEG4 @3
//SEG5 [2] call main param-assignment [ ] ( )
//SEG6 [4] phi from @3 to main [phi:@3->main]
jsr main
//SEG7 [3] phi from @3 to @end [phi:@3->@end]
//SEG8 @end
//SEG9 main
main: {
//SEG10 [5] phi from main to main::@1 [phi:main->main::@1]
//SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1
ldy #0
//SEG12 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1]
//SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy
//SEG14 main::@1
b1:
//SEG15 [6] (byte) b::i#0 ← (byte) main::i#2 [ main::i#2 b::i#0 ] ( main:2 [ main::i#2 b::i#0 ] )
// (byte) b::i#0 = (byte) main::i#2 // register copy reg byte y
//SEG16 [7] call b param-assignment [ main::i#2 ] ( main:2 [ main::i#2 ] )
jsr b
//SEG17 main::@3
//SEG18 [8] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuyy=_inc_vbuyy
iny
//SEG19 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word) 101) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuyy_neq_vbuc1_then_la1
cpy #$65
bne b1
//SEG20 main::@return
//SEG21 [10] return [ ] ( main:2 [ ] )
rts
}
//SEG22 b
b: {
//SEG23 [11] (byte) c::i#0 ← (byte) b::i#0 [ c::i#0 ] ( main:2::b:7 [ main::i#2 c::i#0 ] ) -- vbuaa=vbuyy
tya
//SEG24 [12] call c param-assignment [ ] ( main:2::b:7 [ main::i#2 ] )
//SEG25 [14] phi from b to c [phi:b->c]
jsr c
//SEG26 b::@return
//SEG27 [13] return [ ] ( main:2::b:7 [ main::i#2 ] )
rts
}
//SEG28 c
c: {
//SEG29 [15] phi from c to c::@1 [phi:c->c::@1]
//SEG30 [15] phi (byte) c::j#2 = (byte/signed byte/word/signed word) 0 [phi:c->c::@1#0] -- vbuxx=vbuc1
ldx #0
//SEG31 [15] phi from c::@1 to c::@1 [phi:c::@1->c::@1]
//SEG32 [15] phi (byte) c::j#2 = (byte) c::j#1 [phi:c::@1->c::@1#0] -- register_copy
//SEG33 c::@1
b1:
//SEG34 [16] *((const byte*) SCREEN#0 + (byte) c::j#2) ← (byte) c::i#0 [ c::i#0 c::j#2 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#2 ] ) -- pbuc1_derefidx_vbuxx=vbuaa
sta SCREEN,x
//SEG35 [17] (byte) c::j#1 ← ++ (byte) c::j#2 [ c::i#0 c::j#1 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#1 ] ) -- vbuxx=_inc_vbuxx
inx
//SEG36 [18] if((byte) c::j#1!=(byte/signed byte/word/signed word) 101) goto c::@1 [ c::i#0 c::j#1 ] ( main:2::b:7::c:12 [ main::i#2 c::i#0 c::j#1 ] ) -- vbuxx_neq_vbuc1_then_la1
cpx #$65
bne b1
//SEG37 c::@return
//SEG38 [19] return [ ] ( main:2::b:7::c:12 [ main::i#2 ] )
rts
}

View File

@ -0,0 +1,29 @@
(label) @3
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word) 1024
(void()) b((byte) b::i)
(label) b::@return
(byte) b::i
(byte) b::i#0 reg byte y 13.0
(void()) c((byte) c::i)
(label) c::@1
(label) c::@return
(byte) c::i
(byte) c::i#0 reg byte a 17.166666666666664
(byte) c::j
(byte) c::j#1 reg byte x 151.5
(byte) c::j#2 reg byte x 151.5
(void()) main()
(label) main::@1
(label) main::@3
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte y 16.5
(byte) main::i#2 reg byte y 11.0
reg byte y [ main::i#2 main::i#1 ]
reg byte x [ c::j#2 c::j#1 ]
reg byte y [ b::i#0 ]
reg byte a [ c::i#0 ]

View File

@ -2447,8 +2447,8 @@ Found 1 loops in scope [scroll_hard]
Loop head: main::@2 tails: main::@2 blocks: main::@2 depth: 2
Loop head: main::@3 tails: main::@3 blocks: main::@3 depth: 2
Loop head: main::@2 tails: main::@8 blocks: main::@8 main::@5 main::@3 main::@2 depth: 1
Loop head: scroll_bit::@2 tails: scroll_bit::@3 blocks: scroll_bit::@3 scroll_bit::@2 scroll_bit::@5 depth: 1
Loop head: scroll_hard::@1 tails: scroll_hard::@1 blocks: scroll_hard::@1 depth: 1
Loop head: scroll_bit::@2 tails: scroll_bit::@3 blocks: scroll_bit::@3 scroll_bit::@2 scroll_bit::@5 depth: 2
Loop head: scroll_hard::@1 tails: scroll_hard::@1 blocks: scroll_hard::@1 depth: 2
Loop head: fillscreen::@1 tails: fillscreen::@1 blocks: fillscreen::@1 depth: 1
@ -2462,12 +2462,12 @@ VARIABLE REGISTER WEIGHTS
(byte*) TEXT
(byte) current_bit
(byte) current_bit#12 2.5
(byte) current_bit#21 0.8333333333333334
(byte) current_bit#21 5.833333333333333
(byte) current_bit#29 2.142857142857143
(byte) current_bit#5 3.0
(byte*) current_chargen
(byte*) current_chargen#11 2.5
(byte*) current_chargen#19 0.9444444444444444
(byte*) current_chargen#19 5.944444444444444
(byte*) current_chargen#27 1.666666666666667
(byte*) current_chargen#5 4.0
(void()) fillscreen((byte*) fillscreen::screen , (byte) fillscreen::fill)
@ -2497,23 +2497,23 @@ VARIABLE REGISTER WEIGHTS
(void()) scroll_bit()
(byte~) scroll_bit::$3 4.0
(word~) scroll_bit::$4 4.0
(byte~) scroll_bit::$9 22.0
(byte~) scroll_bit::$9 202.0
(byte) scroll_bit::b
(byte) scroll_bit::b#2 11.0
(byte) scroll_bit::b#2 101.0
(byte) scroll_bit::bits
(byte) scroll_bit::bits#0 22.0
(byte) scroll_bit::bits#0 202.0
(word) scroll_bit::c
(word) scroll_bit::c#0 4.0
(byte) scroll_bit::r
(byte) scroll_bit::r#1 16.5
(byte) scroll_bit::r#2 4.125
(byte) scroll_bit::r#1 151.5
(byte) scroll_bit::r#2 37.875
(byte*) scroll_bit::sc
(byte*) scroll_bit::sc#1 7.333333333333333
(byte*) scroll_bit::sc#2 4.714285714285714
(byte*) scroll_bit::sc#1 67.33333333333333
(byte*) scroll_bit::sc#2 43.285714285714285
(void()) scroll_hard()
(byte) scroll_hard::i
(byte) scroll_hard::i#1 16.5
(byte) scroll_hard::i#2 21.999999999999993
(byte) scroll_hard::i#1 151.5
(byte) scroll_hard::i#2 202.00000000000006
(byte*) scroll_hard::line0
(byte*) scroll_hard::line1
(byte*) scroll_hard::line2
@ -3114,23 +3114,23 @@ Potential registers zp ZP_BYTE:22 [ scroll_bit::bits#0 ] : zp ZP_BYTE:22 , reg b
Potential registers zp ZP_BYTE:23 [ scroll_bit::$9 ] : zp ZP_BYTE:23 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [scroll_bit] 22: zp ZP_BYTE:22 [ scroll_bit::bits#0 ] 22: zp ZP_BYTE:23 [ scroll_bit::$9 ] 20.62: zp ZP_BYTE:6 [ scroll_bit::r#2 scroll_bit::r#1 ] 12.05: zp ZP_WORD:7 [ scroll_bit::sc#2 scroll_bit::sc#1 ] 11: zp ZP_BYTE:9 [ scroll_bit::b#2 ] 4: zp ZP_BYTE:17 [ scroll_bit::$3 ] 4: zp ZP_WORD:18 [ scroll_bit::c#0 ] 4: zp ZP_WORD:20 [ scroll_bit::$4 ]
Uplift Scope [scroll_hard] 38.5: zp ZP_BYTE:10 [ scroll_hard::i#2 scroll_hard::i#1 ]
Uplift Scope [] 9.11: zp ZP_WORD:4 [ current_chargen#27 current_chargen#11 current_chargen#19 current_chargen#5 ] 8.92: zp ZP_WORD:11 [ nxt#18 nxt#31 nxt#14 nxt#36 nxt#19 ] 8.75: zp ZP_BYTE:2 [ scroll#18 scroll#10 scroll#3 ] 8.48: zp ZP_BYTE:3 [ current_bit#29 current_bit#12 current_bit#21 current_bit#5 ]
Uplift Scope [scroll_bit] 202: zp ZP_BYTE:22 [ scroll_bit::bits#0 ] 202: zp ZP_BYTE:23 [ scroll_bit::$9 ] 189.38: zp ZP_BYTE:6 [ scroll_bit::r#2 scroll_bit::r#1 ] 110.62: zp ZP_WORD:7 [ scroll_bit::sc#2 scroll_bit::sc#1 ] 101: zp ZP_BYTE:9 [ scroll_bit::b#2 ] 4: zp ZP_BYTE:17 [ scroll_bit::$3 ] 4: zp ZP_WORD:18 [ scroll_bit::c#0 ] 4: zp ZP_WORD:20 [ scroll_bit::$4 ]
Uplift Scope [scroll_hard] 353.5: zp ZP_BYTE:10 [ scroll_hard::i#2 scroll_hard::i#1 ]
Uplift Scope [] 14.11: zp ZP_WORD:4 [ current_chargen#27 current_chargen#11 current_chargen#19 current_chargen#5 ] 13.48: zp ZP_BYTE:3 [ current_bit#29 current_bit#12 current_bit#21 current_bit#5 ] 8.92: zp ZP_WORD:11 [ nxt#18 nxt#31 nxt#14 nxt#36 nxt#19 ] 8.75: zp ZP_BYTE:2 [ scroll#18 scroll#10 scroll#3 ]
Uplift Scope [fillscreen] 33: zp ZP_WORD:14 [ fillscreen::cursor#2 fillscreen::cursor#1 ]
Uplift Scope [next_char] 8.5: zp ZP_BYTE:13 [ next_char::return#1 next_char::c#0 next_char::c#1 ] 4: zp ZP_BYTE:16 [ next_char::return#0 ]
Uplift Scope [main]
Uplift Scope [scroll_soft]
Uplifting [scroll_bit] best 9473 combination reg byte a [ scroll_bit::bits#0 ] reg byte a [ scroll_bit::$9 ] reg byte x [ scroll_bit::r#2 scroll_bit::r#1 ] zp ZP_WORD:7 [ scroll_bit::sc#2 scroll_bit::sc#1 ] reg byte a [ scroll_bit::b#2 ] reg byte a [ scroll_bit::$3 ] zp ZP_WORD:18 [ scroll_bit::c#0 ] zp ZP_WORD:20 [ scroll_bit::$4 ]
Uplifting [scroll_hard] best 9143 combination reg byte x [ scroll_hard::i#2 scroll_hard::i#1 ]
Uplifting [] best 8831 combination zp ZP_WORD:4 [ current_chargen#27 current_chargen#11 current_chargen#19 current_chargen#5 ] zp ZP_WORD:11 [ nxt#18 nxt#31 nxt#14 nxt#36 nxt#19 ] reg byte x [ scroll#18 scroll#10 scroll#3 ] zp ZP_BYTE:3 [ current_bit#29 current_bit#12 current_bit#21 current_bit#5 ]
Uplifting [fillscreen] best 8831 combination zp ZP_WORD:14 [ fillscreen::cursor#2 fillscreen::cursor#1 ]
Uplifting [next_char] best 8813 combination reg byte a [ next_char::return#1 next_char::c#0 next_char::c#1 ] reg byte a [ next_char::return#0 ]
Uplifting [main] best 8813 combination
Uplifting [scroll_soft] best 8813 combination
Uplifting [scroll_bit] best 28508 combination reg byte a [ scroll_bit::bits#0 ] reg byte a [ scroll_bit::$9 ] reg byte x [ scroll_bit::r#2 scroll_bit::r#1 ] zp ZP_WORD:7 [ scroll_bit::sc#2 scroll_bit::sc#1 ] reg byte a [ scroll_bit::b#2 ] reg byte a [ scroll_bit::$3 ] zp ZP_WORD:18 [ scroll_bit::c#0 ] zp ZP_WORD:20 [ scroll_bit::$4 ]
Uplifting [scroll_hard] best 25208 combination reg byte x [ scroll_hard::i#2 scroll_hard::i#1 ]
Uplifting [] best 24896 combination zp ZP_WORD:4 [ current_chargen#27 current_chargen#11 current_chargen#19 current_chargen#5 ] zp ZP_BYTE:3 [ current_bit#29 current_bit#12 current_bit#21 current_bit#5 ] zp ZP_WORD:11 [ nxt#18 nxt#31 nxt#14 nxt#36 nxt#19 ] reg byte x [ scroll#18 scroll#10 scroll#3 ]
Uplifting [fillscreen] best 24896 combination zp ZP_WORD:14 [ fillscreen::cursor#2 fillscreen::cursor#1 ]
Uplifting [next_char] best 24878 combination reg byte a [ next_char::return#1 next_char::c#0 next_char::c#1 ] reg byte a [ next_char::return#0 ]
Uplifting [main] best 24878 combination
Uplifting [scroll_soft] best 24878 combination
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ current_bit#29 current_bit#12 current_bit#21 current_bit#5 ]
Uplifting [] best 8813 combination zp ZP_BYTE:3 [ current_bit#29 current_bit#12 current_bit#21 current_bit#5 ]
Uplifting [] best 24878 combination zp ZP_BYTE:3 [ current_bit#29 current_bit#12 current_bit#21 current_bit#5 ]
Coalescing zero page register [ zp ZP_WORD:4 [ current_chargen#27 current_chargen#11 current_chargen#19 current_chargen#5 ] ] with [ zp ZP_WORD:14 [ fillscreen::cursor#2 fillscreen::cursor#1 ] ]
Coalescing zero page register [ zp ZP_WORD:4 [ current_chargen#27 current_chargen#11 current_chargen#19 current_chargen#5 fillscreen::cursor#2 fillscreen::cursor#1 ] ] with [ zp ZP_WORD:18 [ scroll_bit::c#0 ] ]
Coalescing zero page register [ zp ZP_WORD:4 [ current_chargen#27 current_chargen#11 current_chargen#19 current_chargen#5 fillscreen::cursor#2 fillscreen::cursor#1 scroll_bit::c#0 ] ] with [ zp ZP_WORD:20 [ scroll_bit::$4 ] ]
@ -3679,12 +3679,12 @@ FINAL SYMBOL TABLE
(const string) TEXT#0 TEXT = (string) "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =- @"
(byte) current_bit
(byte) current_bit#12 current_bit zp ZP_BYTE:2 2.5
(byte) current_bit#21 current_bit zp ZP_BYTE:2 0.8333333333333334
(byte) current_bit#21 current_bit zp ZP_BYTE:2 5.833333333333333
(byte) current_bit#29 current_bit zp ZP_BYTE:2 2.142857142857143
(byte) current_bit#5 current_bit zp ZP_BYTE:2 3.0
(byte*) current_chargen
(byte*) current_chargen#11 current_chargen zp ZP_WORD:3 2.5
(byte*) current_chargen#19 current_chargen zp ZP_WORD:3 0.9444444444444444
(byte*) current_chargen#19 current_chargen zp ZP_WORD:3 5.944444444444444
(byte*) current_chargen#27 current_chargen zp ZP_WORD:3 1.666666666666667
(byte*) current_chargen#5 current_chargen zp ZP_WORD:3 4.0
(void()) fillscreen((byte*) fillscreen::screen , (byte) fillscreen::fill)
@ -3725,7 +3725,7 @@ FINAL SYMBOL TABLE
(void()) scroll_bit()
(byte~) scroll_bit::$3 reg byte a 4.0
(word~) scroll_bit::$4 $4 zp ZP_WORD:3 4.0
(byte~) scroll_bit::$9 reg byte a 22.0
(byte~) scroll_bit::$9 reg byte a 202.0
(label) scroll_bit::@1
(label) scroll_bit::@2
(label) scroll_bit::@3
@ -3736,23 +3736,23 @@ FINAL SYMBOL TABLE
(label) scroll_bit::@8
(label) scroll_bit::@return
(byte) scroll_bit::b
(byte) scroll_bit::b#2 reg byte a 11.0
(byte) scroll_bit::b#2 reg byte a 101.0
(byte) scroll_bit::bits
(byte) scroll_bit::bits#0 reg byte a 22.0
(byte) scroll_bit::bits#0 reg byte a 202.0
(word) scroll_bit::c
(word) scroll_bit::c#0 c zp ZP_WORD:3 4.0
(byte) scroll_bit::r
(byte) scroll_bit::r#1 reg byte x 16.5
(byte) scroll_bit::r#2 reg byte x 4.125
(byte) scroll_bit::r#1 reg byte x 151.5
(byte) scroll_bit::r#2 reg byte x 37.875
(byte*) scroll_bit::sc
(byte*) scroll_bit::sc#1 sc zp ZP_WORD:5 7.333333333333333
(byte*) scroll_bit::sc#2 sc zp ZP_WORD:5 4.714285714285714
(byte*) scroll_bit::sc#1 sc zp ZP_WORD:5 67.33333333333333
(byte*) scroll_bit::sc#2 sc zp ZP_WORD:5 43.285714285714285
(void()) scroll_hard()
(label) scroll_hard::@1
(label) scroll_hard::@return
(byte) scroll_hard::i
(byte) scroll_hard::i#1 reg byte x 16.5
(byte) scroll_hard::i#2 reg byte x 21.999999999999993
(byte) scroll_hard::i#1 reg byte x 151.5
(byte) scroll_hard::i#2 reg byte x 202.00000000000006
(byte*) scroll_hard::line0
(const byte*) scroll_hard::line0#0 line0 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 40*(byte/signed byte/word/signed word) 0
(byte*) scroll_hard::line1
@ -3790,7 +3790,7 @@ reg byte a [ scroll_bit::$9 ]
FINAL ASSEMBLER
Score: 6851
Score: 20756
//SEG0 Basic Upstart
.pc = $801 "Basic"

View File

@ -17,12 +17,12 @@
(const string) TEXT#0 TEXT = (string) "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =- @"
(byte) current_bit
(byte) current_bit#12 current_bit zp ZP_BYTE:2 2.5
(byte) current_bit#21 current_bit zp ZP_BYTE:2 0.8333333333333334
(byte) current_bit#21 current_bit zp ZP_BYTE:2 5.833333333333333
(byte) current_bit#29 current_bit zp ZP_BYTE:2 2.142857142857143
(byte) current_bit#5 current_bit zp ZP_BYTE:2 3.0
(byte*) current_chargen
(byte*) current_chargen#11 current_chargen zp ZP_WORD:3 2.5
(byte*) current_chargen#19 current_chargen zp ZP_WORD:3 0.9444444444444444
(byte*) current_chargen#19 current_chargen zp ZP_WORD:3 5.944444444444444
(byte*) current_chargen#27 current_chargen zp ZP_WORD:3 1.666666666666667
(byte*) current_chargen#5 current_chargen zp ZP_WORD:3 4.0
(void()) fillscreen((byte*) fillscreen::screen , (byte) fillscreen::fill)
@ -63,7 +63,7 @@
(void()) scroll_bit()
(byte~) scroll_bit::$3 reg byte a 4.0
(word~) scroll_bit::$4 $4 zp ZP_WORD:3 4.0
(byte~) scroll_bit::$9 reg byte a 22.0
(byte~) scroll_bit::$9 reg byte a 202.0
(label) scroll_bit::@1
(label) scroll_bit::@2
(label) scroll_bit::@3
@ -74,23 +74,23 @@
(label) scroll_bit::@8
(label) scroll_bit::@return
(byte) scroll_bit::b
(byte) scroll_bit::b#2 reg byte a 11.0
(byte) scroll_bit::b#2 reg byte a 101.0
(byte) scroll_bit::bits
(byte) scroll_bit::bits#0 reg byte a 22.0
(byte) scroll_bit::bits#0 reg byte a 202.0
(word) scroll_bit::c
(word) scroll_bit::c#0 c zp ZP_WORD:3 4.0
(byte) scroll_bit::r
(byte) scroll_bit::r#1 reg byte x 16.5
(byte) scroll_bit::r#2 reg byte x 4.125
(byte) scroll_bit::r#1 reg byte x 151.5
(byte) scroll_bit::r#2 reg byte x 37.875
(byte*) scroll_bit::sc
(byte*) scroll_bit::sc#1 sc zp ZP_WORD:5 7.333333333333333
(byte*) scroll_bit::sc#2 sc zp ZP_WORD:5 4.714285714285714
(byte*) scroll_bit::sc#1 sc zp ZP_WORD:5 67.33333333333333
(byte*) scroll_bit::sc#2 sc zp ZP_WORD:5 43.285714285714285
(void()) scroll_hard()
(label) scroll_hard::@1
(label) scroll_hard::@return
(byte) scroll_hard::i
(byte) scroll_hard::i#1 reg byte x 16.5
(byte) scroll_hard::i#2 reg byte x 21.999999999999993
(byte) scroll_hard::i#1 reg byte x 151.5
(byte) scroll_hard::i#2 reg byte x 202.00000000000006
(byte*) scroll_hard::line0
(const byte*) scroll_hard::line0#0 line0 = (const byte*) SCREEN#0+(byte/signed byte/word/signed word) 40*(byte/signed byte/word/signed word) 0
(byte*) scroll_hard::line1

View File

@ -6953,20 +6953,20 @@ Found 1 loops in scope [print_str]
Loop head: main::@22 tails: main::@22 blocks: main::@22 depth: 1
Loop head: main::@1 tails: main::@71 blocks: main::@71 main::@70 main::@69 main::@21 main::@42 main::@68 main::@20 main::@41 main::@67 main::@19 main::@40 main::@66 main::@18 main::@39 main::@65 main::@64 main::@17 main::@38 main::@63 main::@16 main::@37 main::@62 main::@15 main::@36 main::@61 main::@14 main::@35 main::@60 main::@59 main::@13 main::@34 main::@58 main::@12 main::@33 main::@57 main::@11 main::@32 main::@56 main::@10 main::@31 main::@55 main::@54 main::@9 main::@30 main::@53 main::@8 main::@29 main::@52 main::@7 main::@28 main::@51 main::@6 main::@27 main::@50 main::@49 main::@5 main::@26 main::@48 main::@4 main::@25 main::@47 main::@3 main::@24 main::@46 main::@2 main::@1 main::@23 depth: 1
Loop head: print_ln::@1 tails: print_ln::@1 blocks: print_ln::@1 depth: 2
Loop head: print_str::@1 tails: print_str::@2 blocks: print_str::@2 print_str::@1 depth: 1
Loop head: print_str::@1 tails: print_str::@2 blocks: print_str::@2 print_str::@1 depth: 2
Loop head: print_cls::@1 tails: print_cls::@1 blocks: print_cls::@1 depth: 1
VARIABLE REGISTER WEIGHTS
(byte*) char_cursor
(byte*) char_cursor#1 11.0
(byte*) char_cursor#1 101.0
(byte*) char_cursor#114 2.75
(byte*~) char_cursor#137 22.0
(byte*~) char_cursor#138 22.0
(byte*~) char_cursor#142 22.0
(byte*~) char_cursor#146 22.0
(byte*~) char_cursor#154 22.0
(byte*) char_cursor#2 6.166666666666666
(byte*) char_cursor#2 51.16666666666666
(byte*) char_cursor#51 7.0
(byte*) char_cursor#52 2.106060606060605
(byte*) char_cursor#89 2.0
@ -7028,9 +7028,9 @@ VARIABLE REGISTER WEIGHTS
(void()) print_ln()
(void()) print_str((byte*) print_str::str)
(byte*) print_str::str
(byte*) print_str::str#0 22.0
(byte*) print_str::str#0 202.0
(byte*) print_str::str#1 2.0
(byte*) print_str::str#2 11.5
(byte*) print_str::str#2 101.5
(void()) printu((byte) printu::a , (byte[]) printu::op , (byte) printu::b , (byte) printu::res)
(byte) printu::a
(byte) printu::a#0 7.333333333333333
@ -8782,73 +8782,73 @@ Potential registers zp ZP_BYTE:41 [ print_byte::$2 ] : zp ZP_BYTE:41 , reg byte
REGISTER UPLIFT SCOPES
Uplift Scope [printu] 418.2: zp ZP_BYTE:30 [ printu::res#20 printu::res#8 printu::res#9 printu::res#10 printu::res#11 printu::res#12 printu::res#13 printu::res#14 printu::res#15 printu::res#16 printu::res#17 printu::res#0 printu::res#18 printu::res#19 printu::res#1 printu::res#2 printu::res#3 printu::res#4 printu::res#5 printu::res#6 printu::res#7 ] 268.67: zp ZP_BYTE:26 [ printu::a#20 printu::a#8 printu::a#9 printu::a#10 printu::a#11 printu::a#12 printu::a#13 printu::a#14 printu::a#15 printu::a#16 printu::a#17 printu::a#0 printu::a#18 printu::a#19 printu::a#1 printu::a#2 printu::a#3 printu::a#4 printu::a#5 printu::a#6 printu::a#7 ] 178.17: zp ZP_BYTE:29 [ printu::b#20 printu::b#8 printu::b#10 printu::b#11 printu::b#12 printu::b#14 printu::b#15 printu::b#16 printu::b#0 printu::b#18 printu::b#19 printu::b#2 printu::b#3 printu::b#4 printu::b#6 printu::b#7 ] 0.5: zp ZP_WORD:27 [ printu::op#20 ]
Uplift Scope [] 363.02: zp ZP_WORD:32 [ char_cursor#51 char_cursor#89 char_cursor#90 char_cursor#138 char_cursor#52 char_cursor#142 char_cursor#146 char_cursor#114 char_cursor#137 char_cursor#154 char_cursor#2 char_cursor#1 ] 264.96: zp ZP_WORD:24 [ line_cursor#10 line_cursor#20 line_cursor#21 line_cursor#1 ]
Uplift Scope [] 498.02: zp ZP_WORD:32 [ char_cursor#51 char_cursor#89 char_cursor#90 char_cursor#138 char_cursor#52 char_cursor#142 char_cursor#146 char_cursor#114 char_cursor#137 char_cursor#154 char_cursor#2 char_cursor#1 ] 264.96: zp ZP_WORD:24 [ line_cursor#10 line_cursor#20 line_cursor#21 line_cursor#1 ]
Uplift Scope [print_str] 305.5: zp ZP_WORD:35 [ print_str::str#2 print_str::str#1 print_str::str#0 ]
Uplift Scope [main] 11.87: zp ZP_BYTE:3 [ main::i#10 main::i#1 ] 9.36: zp ZP_BYTE:2 [ main::a#10 main::a#1 ] 5.5: zp ZP_BYTE:5 [ main::r#41 ] 5.5: zp ZP_BYTE:9 [ main::r#45 ] 5.5: zp ZP_BYTE:13 [ main::r#49 ] 5.5: zp ZP_BYTE:17 [ main::r#53 ] 5.5: zp ZP_BYTE:21 [ main::r#57 ] 3.67: zp ZP_BYTE:4 [ main::r#40 ] 3.67: zp ZP_BYTE:6 [ main::r#42 ] 3.67: zp ZP_BYTE:7 [ main::r#43 ] 3.67: zp ZP_BYTE:8 [ main::r#44 ] 3.67: zp ZP_BYTE:10 [ main::r#46 ] 3.67: zp ZP_BYTE:11 [ main::r#47 ] 3.67: zp ZP_BYTE:12 [ main::r#48 ] 3.67: zp ZP_BYTE:14 [ main::r#50 ] 3.67: zp ZP_BYTE:15 [ main::r#51 ] 3.67: zp ZP_BYTE:16 [ main::r#52 ] 3.67: zp ZP_BYTE:18 [ main::r#54 ] 3.67: zp ZP_BYTE:19 [ main::r#55 ] 3.67: zp ZP_BYTE:20 [ main::r#56 ] 3.67: zp ZP_BYTE:22 [ main::r#58 ] 3.67: zp ZP_BYTE:23 [ main::r#59 ] 0.98: zp ZP_BYTE:39 [ main::b#0 ]
Uplift Scope [print_str] 35.5: zp ZP_WORD:35 [ print_str::str#2 print_str::str#1 print_str::str#0 ]
Uplift Scope [print_cls] 33: zp ZP_WORD:37 [ print_cls::sc#2 print_cls::sc#1 ]
Uplift Scope [print_char] 20: zp ZP_BYTE:31 [ print_char::ch#5 print_char::ch#0 print_char::ch#1 print_char::ch#4 ]
Uplift Scope [print_byte] 10: zp ZP_BYTE:34 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] 4: zp ZP_BYTE:40 [ print_byte::$0 ] 4: zp ZP_BYTE:41 [ print_byte::$2 ]
Uplift Scope [print_ln]
Uplifting [printu] best 16302 combination reg byte x [ printu::res#20 printu::res#8 printu::res#9 printu::res#10 printu::res#11 printu::res#12 printu::res#13 printu::res#14 printu::res#15 printu::res#16 printu::res#17 printu::res#0 printu::res#18 printu::res#19 printu::res#1 printu::res#2 printu::res#3 printu::res#4 printu::res#5 printu::res#6 printu::res#7 ] zp ZP_BYTE:26 [ printu::a#20 printu::a#8 printu::a#9 printu::a#10 printu::a#11 printu::a#12 printu::a#13 printu::a#14 printu::a#15 printu::a#16 printu::a#17 printu::a#0 printu::a#18 printu::a#19 printu::a#1 printu::a#2 printu::a#3 printu::a#4 printu::a#5 printu::a#6 printu::a#7 ] zp ZP_BYTE:29 [ printu::b#20 printu::b#8 printu::b#10 printu::b#11 printu::b#12 printu::b#14 printu::b#15 printu::b#16 printu::b#0 printu::b#18 printu::b#19 printu::b#2 printu::b#3 printu::b#4 printu::b#6 printu::b#7 ] zp ZP_WORD:27 [ printu::op#20 ]
Uplifting [] best 16302 combination zp ZP_WORD:32 [ char_cursor#51 char_cursor#89 char_cursor#90 char_cursor#138 char_cursor#52 char_cursor#142 char_cursor#146 char_cursor#114 char_cursor#137 char_cursor#154 char_cursor#2 char_cursor#1 ] zp ZP_WORD:24 [ line_cursor#10 line_cursor#20 line_cursor#21 line_cursor#1 ]
Uplifting [print_str] best 16302 combination zp ZP_WORD:35 [ print_str::str#2 print_str::str#1 print_str::str#0 ]
Uplifting [print_cls] best 16302 combination zp ZP_WORD:37 [ print_cls::sc#2 print_cls::sc#1 ]
Uplifting [print_char] best 16286 combination reg byte a [ print_char::ch#5 print_char::ch#0 print_char::ch#1 print_char::ch#4 ]
Uplifting [print_byte] best 16278 combination zp ZP_BYTE:34 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ]
Uplifting [print_ln] best 16278 combination
Uplifting [printu] best 21837 combination reg byte x [ printu::res#20 printu::res#8 printu::res#9 printu::res#10 printu::res#11 printu::res#12 printu::res#13 printu::res#14 printu::res#15 printu::res#16 printu::res#17 printu::res#0 printu::res#18 printu::res#19 printu::res#1 printu::res#2 printu::res#3 printu::res#4 printu::res#5 printu::res#6 printu::res#7 ] zp ZP_BYTE:26 [ printu::a#20 printu::a#8 printu::a#9 printu::a#10 printu::a#11 printu::a#12 printu::a#13 printu::a#14 printu::a#15 printu::a#16 printu::a#17 printu::a#0 printu::a#18 printu::a#19 printu::a#1 printu::a#2 printu::a#3 printu::a#4 printu::a#5 printu::a#6 printu::a#7 ] zp ZP_BYTE:29 [ printu::b#20 printu::b#8 printu::b#10 printu::b#11 printu::b#12 printu::b#14 printu::b#15 printu::b#16 printu::b#0 printu::b#18 printu::b#19 printu::b#2 printu::b#3 printu::b#4 printu::b#6 printu::b#7 ] zp ZP_WORD:27 [ printu::op#20 ]
Uplifting [] best 21837 combination zp ZP_WORD:32 [ char_cursor#51 char_cursor#89 char_cursor#90 char_cursor#138 char_cursor#52 char_cursor#142 char_cursor#146 char_cursor#114 char_cursor#137 char_cursor#154 char_cursor#2 char_cursor#1 ] zp ZP_WORD:24 [ line_cursor#10 line_cursor#20 line_cursor#21 line_cursor#1 ]
Uplifting [print_str] best 21837 combination zp ZP_WORD:35 [ print_str::str#2 print_str::str#1 print_str::str#0 ]
Uplifting [print_cls] best 21837 combination zp ZP_WORD:37 [ print_cls::sc#2 print_cls::sc#1 ]
Uplifting [print_char] best 21821 combination reg byte a [ print_char::ch#5 print_char::ch#0 print_char::ch#1 print_char::ch#4 ]
Uplifting [print_byte] best 21813 combination zp ZP_BYTE:34 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ] reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ]
Uplifting [print_ln] best 21813 combination
Attempting to uplift remaining variables inzp ZP_BYTE:26 [ printu::a#20 printu::a#8 printu::a#9 printu::a#10 printu::a#11 printu::a#12 printu::a#13 printu::a#14 printu::a#15 printu::a#16 printu::a#17 printu::a#0 printu::a#18 printu::a#19 printu::a#1 printu::a#2 printu::a#3 printu::a#4 printu::a#5 printu::a#6 printu::a#7 ]
Uplifting [printu] best 16278 combination zp ZP_BYTE:26 [ printu::a#20 printu::a#8 printu::a#9 printu::a#10 printu::a#11 printu::a#12 printu::a#13 printu::a#14 printu::a#15 printu::a#16 printu::a#17 printu::a#0 printu::a#18 printu::a#19 printu::a#1 printu::a#2 printu::a#3 printu::a#4 printu::a#5 printu::a#6 printu::a#7 ]
Uplifting [printu] best 21813 combination zp ZP_BYTE:26 [ printu::a#20 printu::a#8 printu::a#9 printu::a#10 printu::a#11 printu::a#12 printu::a#13 printu::a#14 printu::a#15 printu::a#16 printu::a#17 printu::a#0 printu::a#18 printu::a#19 printu::a#1 printu::a#2 printu::a#3 printu::a#4 printu::a#5 printu::a#6 printu::a#7 ]
Attempting to uplift remaining variables inzp ZP_BYTE:29 [ printu::b#20 printu::b#8 printu::b#10 printu::b#11 printu::b#12 printu::b#14 printu::b#15 printu::b#16 printu::b#0 printu::b#18 printu::b#19 printu::b#2 printu::b#3 printu::b#4 printu::b#6 printu::b#7 ]
Uplifting [printu] best 16278 combination zp ZP_BYTE:29 [ printu::b#20 printu::b#8 printu::b#10 printu::b#11 printu::b#12 printu::b#14 printu::b#15 printu::b#16 printu::b#0 printu::b#18 printu::b#19 printu::b#2 printu::b#3 printu::b#4 printu::b#6 printu::b#7 ]
Uplifting [printu] best 21813 combination zp ZP_BYTE:29 [ printu::b#20 printu::b#8 printu::b#10 printu::b#11 printu::b#12 printu::b#14 printu::b#15 printu::b#16 printu::b#0 printu::b#18 printu::b#19 printu::b#2 printu::b#3 printu::b#4 printu::b#6 printu::b#7 ]
Attempting to uplift remaining variables inzp ZP_BYTE:3 [ main::i#10 main::i#1 ]
Uplifting [main] best 16278 combination zp ZP_BYTE:3 [ main::i#10 main::i#1 ]
Uplifting [main] best 21813 combination zp ZP_BYTE:3 [ main::i#10 main::i#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:34 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
Uplifting [print_byte] best 16278 combination zp ZP_BYTE:34 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
Uplifting [print_byte] best 21813 combination zp ZP_BYTE:34 [ print_byte::b#2 print_byte::b#0 print_byte::b#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::a#10 main::a#1 ]
Uplifting [main] best 16278 combination zp ZP_BYTE:2 [ main::a#10 main::a#1 ]
Uplifting [main] best 21813 combination zp ZP_BYTE:2 [ main::a#10 main::a#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:5 [ main::r#41 ]
Uplifting [main] best 16188 combination reg byte x [ main::r#41 ]
Uplifting [main] best 21723 combination reg byte x [ main::r#41 ]
Attempting to uplift remaining variables inzp ZP_BYTE:9 [ main::r#45 ]
Uplifting [main] best 16098 combination reg byte x [ main::r#45 ]
Uplifting [main] best 21633 combination reg byte x [ main::r#45 ]
Attempting to uplift remaining variables inzp ZP_BYTE:13 [ main::r#49 ]
Uplifting [main] best 16008 combination reg byte x [ main::r#49 ]
Uplifting [main] best 21543 combination reg byte x [ main::r#49 ]
Attempting to uplift remaining variables inzp ZP_BYTE:17 [ main::r#53 ]
Uplifting [main] best 15918 combination reg byte x [ main::r#53 ]
Uplifting [main] best 21453 combination reg byte x [ main::r#53 ]
Attempting to uplift remaining variables inzp ZP_BYTE:21 [ main::r#57 ]
Uplifting [main] best 15828 combination reg byte x [ main::r#57 ]
Uplifting [main] best 21363 combination reg byte x [ main::r#57 ]
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ main::r#40 ]
Uplifting [main] best 15738 combination reg byte x [ main::r#40 ]
Uplifting [main] best 21273 combination reg byte x [ main::r#40 ]
Attempting to uplift remaining variables inzp ZP_BYTE:6 [ main::r#42 ]
Uplifting [main] best 15648 combination reg byte x [ main::r#42 ]
Uplifting [main] best 21183 combination reg byte x [ main::r#42 ]
Attempting to uplift remaining variables inzp ZP_BYTE:7 [ main::r#43 ]
Uplifting [main] best 15558 combination reg byte x [ main::r#43 ]
Uplifting [main] best 21093 combination reg byte x [ main::r#43 ]
Attempting to uplift remaining variables inzp ZP_BYTE:8 [ main::r#44 ]
Uplifting [main] best 15468 combination reg byte x [ main::r#44 ]
Uplifting [main] best 21003 combination reg byte x [ main::r#44 ]
Attempting to uplift remaining variables inzp ZP_BYTE:10 [ main::r#46 ]
Uplifting [main] best 15378 combination reg byte x [ main::r#46 ]
Uplifting [main] best 20913 combination reg byte x [ main::r#46 ]
Attempting to uplift remaining variables inzp ZP_BYTE:11 [ main::r#47 ]
Uplifting [main] best 15288 combination reg byte x [ main::r#47 ]
Uplifting [main] best 20823 combination reg byte x [ main::r#47 ]
Attempting to uplift remaining variables inzp ZP_BYTE:12 [ main::r#48 ]
Uplifting [main] best 15198 combination reg byte x [ main::r#48 ]
Uplifting [main] best 20733 combination reg byte x [ main::r#48 ]
Attempting to uplift remaining variables inzp ZP_BYTE:14 [ main::r#50 ]
Uplifting [main] best 15108 combination reg byte x [ main::r#50 ]
Uplifting [main] best 20643 combination reg byte x [ main::r#50 ]
Attempting to uplift remaining variables inzp ZP_BYTE:15 [ main::r#51 ]
Uplifting [main] best 15018 combination reg byte x [ main::r#51 ]
Uplifting [main] best 20553 combination reg byte x [ main::r#51 ]
Attempting to uplift remaining variables inzp ZP_BYTE:16 [ main::r#52 ]
Uplifting [main] best 14928 combination reg byte x [ main::r#52 ]
Uplifting [main] best 20463 combination reg byte x [ main::r#52 ]
Attempting to uplift remaining variables inzp ZP_BYTE:18 [ main::r#54 ]
Uplifting [main] best 14838 combination reg byte x [ main::r#54 ]
Uplifting [main] best 20373 combination reg byte x [ main::r#54 ]
Attempting to uplift remaining variables inzp ZP_BYTE:19 [ main::r#55 ]
Uplifting [main] best 14748 combination reg byte x [ main::r#55 ]
Uplifting [main] best 20283 combination reg byte x [ main::r#55 ]
Attempting to uplift remaining variables inzp ZP_BYTE:20 [ main::r#56 ]
Uplifting [main] best 14658 combination reg byte x [ main::r#56 ]
Uplifting [main] best 20193 combination reg byte x [ main::r#56 ]
Attempting to uplift remaining variables inzp ZP_BYTE:22 [ main::r#58 ]
Uplifting [main] best 14568 combination reg byte x [ main::r#58 ]
Uplifting [main] best 20103 combination reg byte x [ main::r#58 ]
Attempting to uplift remaining variables inzp ZP_BYTE:23 [ main::r#59 ]
Uplifting [main] best 14478 combination reg byte x [ main::r#59 ]
Uplifting [main] best 20013 combination reg byte x [ main::r#59 ]
Attempting to uplift remaining variables inzp ZP_BYTE:39 [ main::b#0 ]
Uplifting [main] best 14478 combination zp ZP_BYTE:39 [ main::b#0 ]
Uplifting [main] best 20013 combination zp ZP_BYTE:39 [ main::b#0 ]
Coalescing zero page register [ zp ZP_BYTE:2 [ main::a#10 main::a#1 ] ] with [ zp ZP_BYTE:26 [ printu::a#20 printu::a#8 printu::a#9 printu::a#10 printu::a#11 printu::a#12 printu::a#13 printu::a#14 printu::a#15 printu::a#16 printu::a#17 printu::a#0 printu::a#18 printu::a#19 printu::a#1 printu::a#2 printu::a#3 printu::a#4 printu::a#5 printu::a#6 printu::a#7 ] ]
Coalescing zero page register [ zp ZP_WORD:24 [ line_cursor#10 line_cursor#20 line_cursor#21 line_cursor#1 ] ] with [ zp ZP_WORD:37 [ print_cls::sc#2 print_cls::sc#1 ] ]
Coalescing zero page register [ zp ZP_WORD:27 [ printu::op#20 ] ] with [ zp ZP_WORD:35 [ print_str::str#2 print_str::str#1 print_str::str#0 ] ]
@ -10453,14 +10453,14 @@ FINAL SYMBOL TABLE
(label) @begin
(label) @end
(byte*) char_cursor
(byte*) char_cursor#1 char_cursor zp ZP_WORD:9 11.0
(byte*) char_cursor#1 char_cursor zp ZP_WORD:9 101.0
(byte*) char_cursor#114 char_cursor zp ZP_WORD:9 2.75
(byte*~) char_cursor#137 char_cursor zp ZP_WORD:9 22.0
(byte*~) char_cursor#138 char_cursor zp ZP_WORD:9 22.0
(byte*~) char_cursor#142 char_cursor zp ZP_WORD:9 22.0
(byte*~) char_cursor#146 char_cursor zp ZP_WORD:9 22.0
(byte*~) char_cursor#154 char_cursor zp ZP_WORD:9 22.0
(byte*) char_cursor#2 char_cursor zp ZP_WORD:9 6.166666666666666
(byte*) char_cursor#2 char_cursor zp ZP_WORD:9 51.16666666666666
(byte*) char_cursor#51 char_cursor zp ZP_WORD:9 7.0
(byte*) char_cursor#52 char_cursor zp ZP_WORD:9 2.106060606060605
(byte*) char_cursor#89 char_cursor zp ZP_WORD:9 2.0
@ -10623,9 +10623,9 @@ FINAL SYMBOL TABLE
(label) print_str::@2
(label) print_str::@return
(byte*) print_str::str
(byte*) print_str::str#0 str zp ZP_WORD:6 22.0
(byte*) print_str::str#0 str zp ZP_WORD:6 202.0
(byte*) print_str::str#1 str zp ZP_WORD:6 2.0
(byte*) print_str::str#2 str zp ZP_WORD:6 11.5
(byte*) print_str::str#2 str zp ZP_WORD:6 101.5
(void()) printu((byte) printu::a , (byte[]) printu::op , (byte) printu::b , (byte) printu::res)
(label) printu::@1
(label) printu::@2
@ -10732,7 +10732,7 @@ reg byte a [ print_byte::$2 ]
FINAL ASSEMBLER
Score: 10957
Score: 15772
//SEG0 Basic Upstart
.pc = $801 "Basic"

View File

@ -2,14 +2,14 @@
(label) @begin
(label) @end
(byte*) char_cursor
(byte*) char_cursor#1 char_cursor zp ZP_WORD:9 11.0
(byte*) char_cursor#1 char_cursor zp ZP_WORD:9 101.0
(byte*) char_cursor#114 char_cursor zp ZP_WORD:9 2.75
(byte*~) char_cursor#137 char_cursor zp ZP_WORD:9 22.0
(byte*~) char_cursor#138 char_cursor zp ZP_WORD:9 22.0
(byte*~) char_cursor#142 char_cursor zp ZP_WORD:9 22.0
(byte*~) char_cursor#146 char_cursor zp ZP_WORD:9 22.0
(byte*~) char_cursor#154 char_cursor zp ZP_WORD:9 22.0
(byte*) char_cursor#2 char_cursor zp ZP_WORD:9 6.166666666666666
(byte*) char_cursor#2 char_cursor zp ZP_WORD:9 51.16666666666666
(byte*) char_cursor#51 char_cursor zp ZP_WORD:9 7.0
(byte*) char_cursor#52 char_cursor zp ZP_WORD:9 2.106060606060605
(byte*) char_cursor#89 char_cursor zp ZP_WORD:9 2.0
@ -172,9 +172,9 @@
(label) print_str::@2
(label) print_str::@return
(byte*) print_str::str
(byte*) print_str::str#0 str zp ZP_WORD:6 22.0
(byte*) print_str::str#0 str zp ZP_WORD:6 202.0
(byte*) print_str::str#1 str zp ZP_WORD:6 2.0
(byte*) print_str::str#2 str zp ZP_WORD:6 11.5
(byte*) print_str::str#2 str zp ZP_WORD:6 101.5
(void()) printu((byte) printu::a , (byte[]) printu::op , (byte) printu::b , (byte) printu::res)
(label) printu::@1
(label) printu::@2