1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-09-08 17:54:40 +00:00

Improved constant inlining to inline constants with different valued versions

This commit is contained in:
jespergravgaard 2017-11-01 13:26:32 +01:00
parent 4de433730f
commit 0317fc50c3
12 changed files with 114 additions and 166 deletions

View File

@ -7,7 +7,6 @@ Known Problems
- (useuninitialized.kc) Using an uninitialized variable fails in the optimizer phase. It should fail much earlier.
Features
- Inline contants that are only call parameters used once (eg. x0#0 and x0#1 in callconstparam.kc)
- Move the main code into a main() function, and disallow code outside functions. The main function per default has no parameters and exits with RTS.
- Improve locality of block sequence for if(cond) { stmt1; } else { stmt2; } to if(!cond) goto @else stmt1; jmp @end; @else: stmt2; @end:
- Optimize if/else by swapping if & else if cond is easier to evaluate than !cond.
@ -161,3 +160,4 @@ Done
+ Add ALU support for lo/hi operators on pointers - to avoid unnecessary zp-variable holding for cases like byte v = y&$7 | <yoffs;
+ (callconstparam.kc) Constant parameters to multiple calls are mixed together because their versioned names (x0#0, X0#1) are shortened to not include the version and only one version is output in the ASM.
+ (callconstparam.kc) Constant call parameters are stored as values in the called function - not at the call. The reference from the call to the constant does not include the function name, so the result is an unknown symbol error when compiling the ASM.
+ Inline constants that are only call parameters used once (eg. x0#0 and x0#1 in callconstparam.kc)

View File

@ -115,7 +115,9 @@ public class Pass2ConstantInlining extends Pass2SsaOptimization {
}
/**
* Find single variable versions that are constant eg. i#0 = 0
* Find
* - variable versions that are constant, while other versions are still variable eg. i#0 = 0, i#1 = i#0 + 1
* - constant versions where other constant versions have different values eg. line(1); line(2); (the constants here are the parameters to the method line)
* @return Map from constant name to constant value
*/
private Map<ConstantRef, ConstantValue> findConstVarVersions() {
@ -129,8 +131,16 @@ public class Pass2ConstantInlining extends Pass2SsaOptimization {
Collection<Symbol> scopeSymbols = constant.getScope().getAllSymbols();
for (Symbol symbol : scopeSymbols) {
if(symbol.getRef().isVersion() && symbol.getRef().getFullNameUnversioned().equals(baseName)) {
ConstantValue value = constant.getValue();
if(symbol instanceof Variable) {
aliases.put(constant.getRef(), constant.getValue());
aliases.put(constant.getRef(), value);
break;
} else if(symbol instanceof ConstantVar) {
ConstantValue otherValue = ((ConstantVar) symbol).getValue();
if(!otherValue.equals(value) && !(value instanceof ConstantString) && !(value instanceof ConstantArray) && !(otherValue instanceof ConstantRef)) {
aliases.put(constant.getRef(), value);
break;
}
}
}
}

View File

@ -29,8 +29,7 @@ public class TestPrograms extends TestCase {
}
public void testCallConstParam() throws IOException, URISyntaxException {
String filename = "callconstparam";
compileAndCompare(filename);
compileAndCompare("callconstparam");
}

View File

@ -30,18 +30,17 @@ main: {
sta D018
jsr initscreen
jsr initplottables
lda #line.y0
lda #0
sta line.y
ldx #$a
lda #line.x0
sta line.x
lda #$14
sta line.x1
jsr line
lda #line.y0_1
lda #$14
sta line.y
ldx #$28
lda #line.x0_1
lda #$a
sta line.x
lda #$28
sta line.x1
@ -49,10 +48,6 @@ main: {
rts
}
line: {
.const x0 = 0
.const y0 = 0
.const x0_1 = $a
.const y0_1 = $14
.label xd = 8
.label yd = 9
.label x = 3

View File

@ -24,9 +24,9 @@ main::@return: scope:[main] from main::@3
[9] return [ ]
to:@return
line: scope:[line] from main::@2 main::@3
[10] (byte) line::y#0 ← phi( main::@2/(const byte) line::y0#0 main::@3/(const byte) line::y0#1 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::y#0 ← phi( main::@2/(byte) 0 main::@3/(byte) 20 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::y1#2 ← phi( main::@2/(byte) 10 main::@3/(byte) 40 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::x#0 ← phi( main::@2/(const byte) line::x0#0 main::@3/(const byte) line::x0#1 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::x#0 ← phi( main::@2/(byte) 0 main::@3/(byte) 10 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::x1#2 ← phi( main::@2/(byte) 20 main::@3/(byte) 40 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[11] (byte) line::xd#0 ← (byte) line::x1#2 - (byte) line::x#0 [ line::x1#2 line::x#0 line::y1#2 line::y#0 line::xd#0 ]
[12] (byte) line::yd#0 ← (byte) line::y1#2 - (byte) line::y#0 [ line::x1#2 line::x#0 line::y#0 line::xd#0 line::yd#0 ]

View File

@ -4703,6 +4703,8 @@ Constant inlined plot::plotter#0 = (const byte*) BITMAP#0
Constant inlined initscreen::$0 = (const byte*) BITMAP#0+(word) 8192
Constant inlined initscreen::$2 = (const byte*) SCREEN#0+(word) 1024
Constant inlined plot_bit#1 = (const byte[]) plot_bit#0
Constant inlined line::y0#1 = (byte) 20
Constant inlined line::y0#0 = (byte) 0
Constant inlined initplottables::$1 = >(const byte*) BITMAP#0
Constant inlined line::y1#0 = (byte) 10
Constant inlined line::y1#1 = (byte) 40
@ -4721,6 +4723,8 @@ Constant inlined plot_ylo#12 = (const byte[]) plot_ylo#0
Constant inlined plot_xhi#1 = (const byte[]) plot_xhi#0
Constant inlined BITMAP#13 = (const byte*) BITMAP#0
Constant inlined plot_yhi#12 = (const byte[]) plot_yhi#0
Constant inlined line::x0#0 = (byte) 0
Constant inlined line::x0#1 = (byte) 10
Constant inlined plot_yhi#14 = (const byte[]) plot_yhi#0
Constant inlined initscreen::b#0 = (const byte*) BITMAP#0
Constant inlined plot_yhi#1 = (const byte[]) plot_yhi#0
@ -4749,9 +4753,9 @@ main::@return: scope:[main] from main::@3
return
to:@return
line: scope:[line] from main::@2 main::@3
(byte) line::y#0 ← phi( main::@2/(const byte) line::y0#0 main::@3/(const byte) line::y0#1 )
(byte) line::y#0 ← phi( main::@2/(byte) 0 main::@3/(byte) 20 )
(byte) line::y1#2 ← phi( main::@2/(byte) 10 main::@3/(byte) 40 )
(byte) line::x#0 ← phi( main::@2/(const byte) line::x0#0 main::@3/(const byte) line::x0#1 )
(byte) line::x#0 ← phi( main::@2/(byte) 0 main::@3/(byte) 10 )
(byte) line::x1#2 ← phi( main::@2/(byte) 20 main::@3/(byte) 40 )
(byte) line::xd#0 ← (byte) line::x1#2 - (byte) line::x#0
(byte) line::yd#0 ← (byte) line::y1#2 - (byte) line::y#0
@ -4956,8 +4960,6 @@ FINAL SYMBOL TABLE
(byte) line::x#1
(byte) line::x#2
(byte) line::x0
(const byte) line::x0#0 = (byte) 0
(const byte) line::x0#1 = (byte) 10
(byte) line::x1
(byte) line::x1#2
(byte) line::xd
@ -4968,8 +4970,6 @@ FINAL SYMBOL TABLE
(byte) line::y#2
(byte) line::y#4
(byte) line::y0
(const byte) line::y0#0 = (byte) 0
(const byte) line::y0#1 = (byte) 20
(byte) line::y1
(byte) line::y1#2
(byte) line::yd
@ -5045,9 +5045,9 @@ main::@return: scope:[main] from main::@3
return
to:@return
line: scope:[line] from main::@2 main::@3
(byte) line::y#0 ← phi( main::@2/(const byte) line::y0#0 main::@3/(const byte) line::y0#1 )
(byte) line::y#0 ← phi( main::@2/(byte) 0 main::@3/(byte) 20 )
(byte) line::y1#2 ← phi( main::@2/(byte) 10 main::@3/(byte) 40 )
(byte) line::x#0 ← phi( main::@2/(const byte) line::x0#0 main::@3/(const byte) line::x0#1 )
(byte) line::x#0 ← phi( main::@2/(byte) 0 main::@3/(byte) 10 )
(byte) line::x1#2 ← phi( main::@2/(byte) 20 main::@3/(byte) 40 )
(byte) line::xd#0 ← (byte) line::x1#2 - (byte) line::x#0
(byte) line::yd#0 ← (byte) line::y1#2 - (byte) line::y#0
@ -5241,9 +5241,9 @@ main::@return: scope:[main] from main::@3
[9] return [ ]
to:@return
line: scope:[line] from main::@2 main::@3
[10] (byte) line::y#0 ← phi( main::@2/(const byte) line::y0#0 main::@3/(const byte) line::y0#1 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::y#0 ← phi( main::@2/(byte) 0 main::@3/(byte) 20 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::y1#2 ← phi( main::@2/(byte) 10 main::@3/(byte) 40 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::x#0 ← phi( main::@2/(const byte) line::x0#0 main::@3/(const byte) line::x0#1 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::x#0 ← phi( main::@2/(byte) 0 main::@3/(byte) 10 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::x1#2 ← phi( main::@2/(byte) 20 main::@3/(byte) 40 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[11] (byte) line::xd#0 ← (byte) line::x1#2 - (byte) line::x#0 [ line::x1#2 line::x#0 line::y1#2 line::y#0 line::xd#0 ]
[12] (byte) line::yd#0 ← (byte) line::y1#2 - (byte) line::y#0 [ line::x1#2 line::x#0 line::y#0 line::xd#0 line::yd#0 ]
@ -5461,9 +5461,9 @@ main::@return: scope:[main] from main::@3
[9] return [ ]
to:@return
line: scope:[line] from main::@2 main::@3
[10] (byte) line::y#0 ← phi( main::@2/(const byte) line::y0#0 main::@3/(const byte) line::y0#1 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::y#0 ← phi( main::@2/(byte) 0 main::@3/(byte) 20 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::y1#2 ← phi( main::@2/(byte) 10 main::@3/(byte) 40 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::x#0 ← phi( main::@2/(const byte) line::x0#0 main::@3/(const byte) line::x0#1 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::x#0 ← phi( main::@2/(byte) 0 main::@3/(byte) 10 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[10] (byte) line::x1#2 ← phi( main::@2/(byte) 20 main::@3/(byte) 40 ) [ line::x1#2 line::x#0 line::y1#2 line::y#0 ]
[11] (byte) line::xd#0 ← (byte) line::x1#2 - (byte) line::x#0 [ line::x1#2 line::x#0 line::y1#2 line::y#0 line::xd#0 ]
[12] (byte) line::yd#0 ← (byte) line::y1#2 - (byte) line::y#0 [ line::x1#2 line::x#0 line::y#0 line::xd#0 line::yd#0 ]
@ -5901,14 +5901,14 @@ main: {
//SEG16 [7] call line param-assignment [ ]
//SEG17 [10] phi from main::@2 to line [phi:main::@2->line]
line_from_b2:
//SEG18 [10] phi (byte) line::y#0 = (const byte) line::y0#0 [phi:main::@2->line#0] -- zpby1=coby1
lda #line.y0
//SEG18 [10] phi (byte) line::y#0 = (byte) 0 [phi:main::@2->line#0] -- zpby1=coby1
lda #0
sta line.y
//SEG19 [10] phi (byte) line::y1#2 = (byte) 10 [phi:main::@2->line#1] -- zpby1=coby1
lda #$a
sta line.y1
//SEG20 [10] phi (byte) line::x#0 = (const byte) line::x0#0 [phi:main::@2->line#2] -- zpby1=coby1
lda #line.x0
//SEG20 [10] phi (byte) line::x#0 = (byte) 0 [phi:main::@2->line#2] -- zpby1=coby1
lda #0
sta line.x
//SEG21 [10] phi (byte) line::x1#2 = (byte) 20 [phi:main::@2->line#3] -- zpby1=coby1
lda #$14
@ -5920,14 +5920,14 @@ main: {
//SEG23 [8] call line param-assignment [ ]
//SEG24 [10] phi from main::@3 to line [phi:main::@3->line]
line_from_b3:
//SEG25 [10] phi (byte) line::y#0 = (const byte) line::y0#1 [phi:main::@3->line#0] -- zpby1=coby1
lda #line.y0_1
//SEG25 [10] phi (byte) line::y#0 = (byte) 20 [phi:main::@3->line#0] -- zpby1=coby1
lda #$14
sta line.y
//SEG26 [10] phi (byte) line::y1#2 = (byte) 40 [phi:main::@3->line#1] -- zpby1=coby1
lda #$28
sta line.y1
//SEG27 [10] phi (byte) line::x#0 = (const byte) line::x0#1 [phi:main::@3->line#2] -- zpby1=coby1
lda #line.x0_1
//SEG27 [10] phi (byte) line::x#0 = (byte) 10 [phi:main::@3->line#2] -- zpby1=coby1
lda #$a
sta line.x
//SEG28 [10] phi (byte) line::x1#2 = (byte) 40 [phi:main::@3->line#3] -- zpby1=coby1
lda #$28
@ -5941,10 +5941,6 @@ main: {
}
//SEG31 line
line: {
.const x0 = 0
.const y0 = 0
.const x0_1 = $a
.const y0_1 = $14
.label _10 = 20
.label xd = 16
.label yd = 17
@ -6570,13 +6566,13 @@ main: {
//SEG16 [7] call line param-assignment [ ]
//SEG17 [10] phi from main::@2 to line [phi:main::@2->line]
line_from_b2:
//SEG18 [10] phi (byte) line::y#0 = (const byte) line::y0#0 [phi:main::@2->line#0] -- zpby1=coby1
lda #line.y0
//SEG18 [10] phi (byte) line::y#0 = (byte) 0 [phi:main::@2->line#0] -- zpby1=coby1
lda #0
sta line.y
//SEG19 [10] phi (byte) line::y1#2 = (byte) 10 [phi:main::@2->line#1] -- xby=coby1
ldx #$a
//SEG20 [10] phi (byte) line::x#0 = (const byte) line::x0#0 [phi:main::@2->line#2] -- zpby1=coby1
lda #line.x0
//SEG20 [10] phi (byte) line::x#0 = (byte) 0 [phi:main::@2->line#2] -- zpby1=coby1
lda #0
sta line.x
//SEG21 [10] phi (byte) line::x1#2 = (byte) 20 [phi:main::@2->line#3] -- zpby1=coby1
lda #$14
@ -6587,13 +6583,13 @@ main: {
//SEG23 [8] call line param-assignment [ ]
//SEG24 [10] phi from main::@3 to line [phi:main::@3->line]
line_from_b3:
//SEG25 [10] phi (byte) line::y#0 = (const byte) line::y0#1 [phi:main::@3->line#0] -- zpby1=coby1
lda #line.y0_1
//SEG25 [10] phi (byte) line::y#0 = (byte) 20 [phi:main::@3->line#0] -- zpby1=coby1
lda #$14
sta line.y
//SEG26 [10] phi (byte) line::y1#2 = (byte) 40 [phi:main::@3->line#1] -- xby=coby1
ldx #$28
//SEG27 [10] phi (byte) line::x#0 = (const byte) line::x0#1 [phi:main::@3->line#2] -- zpby1=coby1
lda #line.x0_1
//SEG27 [10] phi (byte) line::x#0 = (byte) 10 [phi:main::@3->line#2] -- zpby1=coby1
lda #$a
sta line.x
//SEG28 [10] phi (byte) line::x1#2 = (byte) 40 [phi:main::@3->line#3] -- zpby1=coby1
lda #$28
@ -6606,10 +6602,6 @@ main: {
}
//SEG31 line
line: {
.const x0 = 0
.const y0 = 0
.const x0_1 = $a
.const y0_1 = $14
.label xd = 8
.label yd = 9
.label x = 3
@ -6911,6 +6903,7 @@ initscreen: {
rts
}
Removing instruction lda #0
Removing instruction lda #0
Removing instruction ldy #0
Removing instruction lda #0
@ -6974,13 +6967,12 @@ main: {
//SEG16 [7] call line param-assignment [ ]
//SEG17 [10] phi from main::@2 to line [phi:main::@2->line]
line_from_b2:
//SEG18 [10] phi (byte) line::y#0 = (const byte) line::y0#0 [phi:main::@2->line#0] -- zpby1=coby1
lda #line.y0
//SEG18 [10] phi (byte) line::y#0 = (byte) 0 [phi:main::@2->line#0] -- zpby1=coby1
lda #0
sta line.y
//SEG19 [10] phi (byte) line::y1#2 = (byte) 10 [phi:main::@2->line#1] -- xby=coby1
ldx #$a
//SEG20 [10] phi (byte) line::x#0 = (const byte) line::x0#0 [phi:main::@2->line#2] -- zpby1=coby1
lda #line.x0
//SEG20 [10] phi (byte) line::x#0 = (byte) 0 [phi:main::@2->line#2] -- zpby1=coby1
sta line.x
//SEG21 [10] phi (byte) line::x1#2 = (byte) 20 [phi:main::@2->line#3] -- zpby1=coby1
lda #$14
@ -6991,13 +6983,13 @@ main: {
//SEG23 [8] call line param-assignment [ ]
//SEG24 [10] phi from main::@3 to line [phi:main::@3->line]
line_from_b3:
//SEG25 [10] phi (byte) line::y#0 = (const byte) line::y0#1 [phi:main::@3->line#0] -- zpby1=coby1
lda #line.y0_1
//SEG25 [10] phi (byte) line::y#0 = (byte) 20 [phi:main::@3->line#0] -- zpby1=coby1
lda #$14
sta line.y
//SEG26 [10] phi (byte) line::y1#2 = (byte) 40 [phi:main::@3->line#1] -- xby=coby1
ldx #$28
//SEG27 [10] phi (byte) line::x#0 = (const byte) line::x0#1 [phi:main::@3->line#2] -- zpby1=coby1
lda #line.x0_1
//SEG27 [10] phi (byte) line::x#0 = (byte) 10 [phi:main::@3->line#2] -- zpby1=coby1
lda #$a
sta line.x
//SEG28 [10] phi (byte) line::x1#2 = (byte) 40 [phi:main::@3->line#3] -- zpby1=coby1
lda #$28
@ -7010,10 +7002,6 @@ main: {
}
//SEG31 line
line: {
.const x0 = 0
.const y0 = 0
.const x0_1 = $a
.const y0_1 = $14
.label xd = 8
.label yd = 9
.label x = 3
@ -7394,13 +7382,12 @@ main: {
b2:
//SEG16 [7] call line param-assignment [ ]
//SEG17 [10] phi from main::@2 to line [phi:main::@2->line]
//SEG18 [10] phi (byte) line::y#0 = (const byte) line::y0#0 [phi:main::@2->line#0] -- zpby1=coby1
lda #line.y0
//SEG18 [10] phi (byte) line::y#0 = (byte) 0 [phi:main::@2->line#0] -- zpby1=coby1
lda #0
sta line.y
//SEG19 [10] phi (byte) line::y1#2 = (byte) 10 [phi:main::@2->line#1] -- xby=coby1
ldx #$a
//SEG20 [10] phi (byte) line::x#0 = (const byte) line::x0#0 [phi:main::@2->line#2] -- zpby1=coby1
lda #line.x0
//SEG20 [10] phi (byte) line::x#0 = (byte) 0 [phi:main::@2->line#2] -- zpby1=coby1
sta line.x
//SEG21 [10] phi (byte) line::x1#2 = (byte) 20 [phi:main::@2->line#3] -- zpby1=coby1
lda #$14
@ -7410,13 +7397,13 @@ main: {
b3:
//SEG23 [8] call line param-assignment [ ]
//SEG24 [10] phi from main::@3 to line [phi:main::@3->line]
//SEG25 [10] phi (byte) line::y#0 = (const byte) line::y0#1 [phi:main::@3->line#0] -- zpby1=coby1
lda #line.y0_1
//SEG25 [10] phi (byte) line::y#0 = (byte) 20 [phi:main::@3->line#0] -- zpby1=coby1
lda #$14
sta line.y
//SEG26 [10] phi (byte) line::y1#2 = (byte) 40 [phi:main::@3->line#1] -- xby=coby1
ldx #$28
//SEG27 [10] phi (byte) line::x#0 = (const byte) line::x0#1 [phi:main::@3->line#2] -- zpby1=coby1
lda #line.x0_1
//SEG27 [10] phi (byte) line::x#0 = (byte) 10 [phi:main::@3->line#2] -- zpby1=coby1
lda #$a
sta line.x
//SEG28 [10] phi (byte) line::x1#2 = (byte) 40 [phi:main::@3->line#3] -- zpby1=coby1
lda #$28
@ -7429,10 +7416,6 @@ main: {
}
//SEG31 line
line: {
.const x0 = 0
.const y0 = 0
.const x0_1 = $a
.const y0_1 = $14
.label xd = 8
.label yd = 9
.label x = 3
@ -7792,13 +7775,12 @@ main: {
//SEG15 main::@2
//SEG16 [7] call line param-assignment [ ]
//SEG17 [10] phi from main::@2 to line [phi:main::@2->line]
//SEG18 [10] phi (byte) line::y#0 = (const byte) line::y0#0 [phi:main::@2->line#0] -- zpby1=coby1
lda #line.y0
//SEG18 [10] phi (byte) line::y#0 = (byte) 0 [phi:main::@2->line#0] -- zpby1=coby1
lda #0
sta line.y
//SEG19 [10] phi (byte) line::y1#2 = (byte) 10 [phi:main::@2->line#1] -- xby=coby1
ldx #$a
//SEG20 [10] phi (byte) line::x#0 = (const byte) line::x0#0 [phi:main::@2->line#2] -- zpby1=coby1
lda #line.x0
//SEG20 [10] phi (byte) line::x#0 = (byte) 0 [phi:main::@2->line#2] -- zpby1=coby1
sta line.x
//SEG21 [10] phi (byte) line::x1#2 = (byte) 20 [phi:main::@2->line#3] -- zpby1=coby1
lda #$14
@ -7807,13 +7789,13 @@ main: {
//SEG22 main::@3
//SEG23 [8] call line param-assignment [ ]
//SEG24 [10] phi from main::@3 to line [phi:main::@3->line]
//SEG25 [10] phi (byte) line::y#0 = (const byte) line::y0#1 [phi:main::@3->line#0] -- zpby1=coby1
lda #line.y0_1
//SEG25 [10] phi (byte) line::y#0 = (byte) 20 [phi:main::@3->line#0] -- zpby1=coby1
lda #$14
sta line.y
//SEG26 [10] phi (byte) line::y1#2 = (byte) 40 [phi:main::@3->line#1] -- xby=coby1
ldx #$28
//SEG27 [10] phi (byte) line::x#0 = (const byte) line::x0#1 [phi:main::@3->line#2] -- zpby1=coby1
lda #line.x0_1
//SEG27 [10] phi (byte) line::x#0 = (byte) 10 [phi:main::@3->line#2] -- zpby1=coby1
lda #$a
sta line.x
//SEG28 [10] phi (byte) line::x1#2 = (byte) 40 [phi:main::@3->line#3] -- zpby1=coby1
lda #$28
@ -7825,10 +7807,6 @@ main: {
}
//SEG31 line
line: {
.const x0 = 0
.const y0 = 0
.const x0_1 = $a
.const y0_1 = $14
.label xd = 8
.label yd = 9
.label x = 3
@ -8161,13 +8139,12 @@ main: {
//SEG15 main::@2
//SEG16 [7] call line param-assignment [ ]
//SEG17 [10] phi from main::@2 to line [phi:main::@2->line]
//SEG18 [10] phi (byte) line::y#0 = (const byte) line::y0#0 [phi:main::@2->line#0] -- zpby1=coby1
lda #line.y0
//SEG18 [10] phi (byte) line::y#0 = (byte) 0 [phi:main::@2->line#0] -- zpby1=coby1
lda #0
sta line.y
//SEG19 [10] phi (byte) line::y1#2 = (byte) 10 [phi:main::@2->line#1] -- xby=coby1
ldx #$a
//SEG20 [10] phi (byte) line::x#0 = (const byte) line::x0#0 [phi:main::@2->line#2] -- zpby1=coby1
lda #line.x0
//SEG20 [10] phi (byte) line::x#0 = (byte) 0 [phi:main::@2->line#2] -- zpby1=coby1
sta line.x
//SEG21 [10] phi (byte) line::x1#2 = (byte) 20 [phi:main::@2->line#3] -- zpby1=coby1
lda #$14
@ -8176,13 +8153,13 @@ main: {
//SEG22 main::@3
//SEG23 [8] call line param-assignment [ ]
//SEG24 [10] phi from main::@3 to line [phi:main::@3->line]
//SEG25 [10] phi (byte) line::y#0 = (const byte) line::y0#1 [phi:main::@3->line#0] -- zpby1=coby1
lda #line.y0_1
//SEG25 [10] phi (byte) line::y#0 = (byte) 20 [phi:main::@3->line#0] -- zpby1=coby1
lda #$14
sta line.y
//SEG26 [10] phi (byte) line::y1#2 = (byte) 40 [phi:main::@3->line#1] -- xby=coby1
ldx #$28
//SEG27 [10] phi (byte) line::x#0 = (const byte) line::x0#1 [phi:main::@3->line#2] -- zpby1=coby1
lda #line.x0_1
//SEG27 [10] phi (byte) line::x#0 = (byte) 10 [phi:main::@3->line#2] -- zpby1=coby1
lda #$a
sta line.x
//SEG28 [10] phi (byte) line::x1#2 = (byte) 40 [phi:main::@3->line#3] -- zpby1=coby1
lda #$28
@ -8194,10 +8171,6 @@ main: {
}
//SEG31 line
line: {
.const x0 = 0
.const y0 = 0
.const x0_1 = $a
.const y0_1 = $14
.label xd = 8
.label yd = 9
.label x = 3
@ -8562,8 +8535,6 @@ FINAL SYMBOL TABLE
(byte) line::x#1 x zp ZP_BYTE:3 4.125
(byte) line::x#2 x zp ZP_BYTE:3 8.75
(byte) line::x0
(const byte) line::x0#0 x0 = (byte) 0
(const byte) line::x0#1 x0#1 = (byte) 10
(byte) line::x1
(byte) line::x1#2 x1 zp ZP_BYTE:2 0.8125
(byte) line::xd
@ -8574,8 +8545,6 @@ FINAL SYMBOL TABLE
(byte) line::y#2 y zp ZP_BYTE:4 6.571428571428571
(byte) line::y#4 y zp ZP_BYTE:4 11.0
(byte) line::y0
(const byte) line::y0#0 y0 = (byte) 0
(const byte) line::y0#1 y0#1 = (byte) 20
(byte) line::y1
(byte) line::y1#2 reg byte x 1.0
(byte) line::yd
@ -8692,13 +8661,12 @@ main: {
//SEG15 main::@2
//SEG16 [7] call line param-assignment [ ]
//SEG17 [10] phi from main::@2 to line [phi:main::@2->line]
//SEG18 [10] phi (byte) line::y#0 = (const byte) line::y0#0 [phi:main::@2->line#0] -- zpby1=coby1
lda #line.y0
//SEG18 [10] phi (byte) line::y#0 = (byte) 0 [phi:main::@2->line#0] -- zpby1=coby1
lda #0
sta line.y
//SEG19 [10] phi (byte) line::y1#2 = (byte) 10 [phi:main::@2->line#1] -- xby=coby1
ldx #$a
//SEG20 [10] phi (byte) line::x#0 = (const byte) line::x0#0 [phi:main::@2->line#2] -- zpby1=coby1
lda #line.x0
//SEG20 [10] phi (byte) line::x#0 = (byte) 0 [phi:main::@2->line#2] -- zpby1=coby1
sta line.x
//SEG21 [10] phi (byte) line::x1#2 = (byte) 20 [phi:main::@2->line#3] -- zpby1=coby1
lda #$14
@ -8707,13 +8675,13 @@ main: {
//SEG22 main::@3
//SEG23 [8] call line param-assignment [ ]
//SEG24 [10] phi from main::@3 to line [phi:main::@3->line]
//SEG25 [10] phi (byte) line::y#0 = (const byte) line::y0#1 [phi:main::@3->line#0] -- zpby1=coby1
lda #line.y0_1
//SEG25 [10] phi (byte) line::y#0 = (byte) 20 [phi:main::@3->line#0] -- zpby1=coby1
lda #$14
sta line.y
//SEG26 [10] phi (byte) line::y1#2 = (byte) 40 [phi:main::@3->line#1] -- xby=coby1
ldx #$28
//SEG27 [10] phi (byte) line::x#0 = (const byte) line::x0#1 [phi:main::@3->line#2] -- zpby1=coby1
lda #line.x0_1
//SEG27 [10] phi (byte) line::x#0 = (byte) 10 [phi:main::@3->line#2] -- zpby1=coby1
lda #$a
sta line.x
//SEG28 [10] phi (byte) line::x1#2 = (byte) 40 [phi:main::@3->line#3] -- zpby1=coby1
lda #$28
@ -8725,10 +8693,6 @@ main: {
}
//SEG31 line
line: {
.const x0 = 0
.const y0 = 0
.const x0_1 = $a
.const y0_1 = $14
.label xd = 8
.label yd = 9
.label x = 3

View File

@ -89,8 +89,6 @@
(byte) line::x#1 x zp ZP_BYTE:3 4.125
(byte) line::x#2 x zp ZP_BYTE:3 8.75
(byte) line::x0
(const byte) line::x0#0 x0 = (byte) 0
(const byte) line::x0#1 x0#1 = (byte) 10
(byte) line::x1
(byte) line::x1#2 x1 zp ZP_BYTE:2 0.8125
(byte) line::xd
@ -101,8 +99,6 @@
(byte) line::y#2 y zp ZP_BYTE:4 6.571428571428571
(byte) line::y#4 y zp ZP_BYTE:4 11.0
(byte) line::y0
(const byte) line::y0#0 y0 = (byte) 0
(const byte) line::y0#1 y0#1 = (byte) 20
(byte) line::y1
(byte) line::y1#2 reg byte x 1.0
(byte) line::yd

View File

@ -7,17 +7,15 @@ main: {
sta screen
lda #>$400
sta screen+1
ldx #line.x0
ldx #1
jsr line
lda #5
sta line.x1
ldx #line.x0_1
ldx #3
jsr line
rts
}
line: {
.const x0 = 1
.const x0_1 = 3
.label x1 = 2
b1:
txa

View File

@ -15,7 +15,7 @@ main::@return: scope:[main] from main::@1
line: scope:[line] from main main::@1
[5] (byte) line::x1#2 ← phi( main/(byte) 2 main::@1/(byte) 5 ) [ line::x#0 screen#14 line::x1#2 ]
[5] (byte*) screen#14 ← phi( main/(word) 1024 main::@1/(byte*) screen#1 ) [ line::x#0 screen#14 line::x1#2 ]
[5] (byte) line::x#0 ← phi( main/(const byte) line::x0#0 main::@1/(const byte) line::x0#1 ) [ line::x#0 screen#14 line::x1#2 ]
[5] (byte) line::x#0 ← phi( main/(byte) 1 main::@1/(byte) 3 ) [ line::x#0 screen#14 line::x1#2 ]
to:line::@1
line::@1: scope:[line] from line line::@1
[6] (byte*) screen#11 ← phi( line/(byte*) screen#14 line::@1/(byte*) screen#1 ) [ line::x1#2 line::x#2 screen#11 ]

View File

@ -560,6 +560,8 @@ line::@return: scope:[line] from line::@1
to:@return
@end: scope:[] from @begin
Constant inlined line::x0#0 = (byte) 1
Constant inlined line::x0#1 = (byte) 3
Constant inlined screen#0 = (word) 1024
Constant inlined line::x1#0 = (byte) 2
Constant inlined line::x1#1 = (byte) 5
@ -580,7 +582,7 @@ main::@return: scope:[main] from main::@1
line: scope:[line] from main main::@1
(byte) line::x1#2 ← phi( main/(byte) 2 main::@1/(byte) 5 )
(byte*) screen#14 ← phi( main/(word) 1024 main::@1/(byte*) screen#1 )
(byte) line::x#0 ← phi( main/(const byte) line::x0#0 main::@1/(const byte) line::x0#1 )
(byte) line::x#0 ← phi( main/(byte) 1 main::@1/(byte) 3 )
to:line::@1
line::@1: scope:[line] from line line::@1
(byte*) screen#11 ← phi( line/(byte*) screen#14 line::@1/(byte*) screen#1 )
@ -606,8 +608,6 @@ FINAL SYMBOL TABLE
(byte) line::x#1
(byte) line::x#2
(byte) line::x0
(const byte) line::x0#0 = (byte) 1
(const byte) line::x0#1 = (byte) 3
(byte) line::x1
(byte) line::x1#2
(void()) main()
@ -639,7 +639,7 @@ main::@return: scope:[main] from main::@1
line: scope:[line] from main main::@1
(byte) line::x1#2 ← phi( main/(byte) 2 main::@1/(byte) 5 )
(byte*) screen#14 ← phi( main/(word) 1024 main::@1/(byte*~) screen#15 )
(byte) line::x#0 ← phi( main/(const byte) line::x0#0 main::@1/(const byte) line::x0#1 )
(byte) line::x#0 ← phi( main/(byte) 1 main::@1/(byte) 3 )
(byte~) line::x#3 ← (byte) line::x#0
(byte*~) screen#16 ← (byte*) screen#14
to:line::@1
@ -691,7 +691,7 @@ main::@return: scope:[main] from main::@1
line: scope:[line] from main main::@1
[6] (byte) line::x1#2 ← phi( main/(byte) 2 main::@1/(byte) 5 ) [ line::x#0 screen#14 line::x1#2 ]
[6] (byte*) screen#14 ← phi( main/(word) 1024 main::@1/(byte*~) screen#15 ) [ line::x#0 screen#14 line::x1#2 ]
[6] (byte) line::x#0 ← phi( main/(const byte) line::x0#0 main::@1/(const byte) line::x0#1 ) [ line::x#0 screen#14 line::x1#2 ]
[6] (byte) line::x#0 ← phi( main/(byte) 1 main::@1/(byte) 3 ) [ line::x#0 screen#14 line::x1#2 ]
[7] (byte~) line::x#3 ← (byte) line::x#0 [ screen#14 line::x1#2 line::x#3 ]
[8] (byte*~) screen#16 ← (byte*) screen#14 [ line::x1#2 line::x#3 screen#16 ]
to:line::@1
@ -745,7 +745,7 @@ main::@return: scope:[main] from main::@1
line: scope:[line] from main main::@1
[5] (byte) line::x1#2 ← phi( main/(byte) 2 main::@1/(byte) 5 ) [ line::x#0 screen#14 line::x1#2 ]
[5] (byte*) screen#14 ← phi( main/(word) 1024 main::@1/(byte*) screen#1 ) [ line::x#0 screen#14 line::x1#2 ]
[5] (byte) line::x#0 ← phi( main/(const byte) line::x0#0 main::@1/(const byte) line::x0#1 ) [ line::x#0 screen#14 line::x1#2 ]
[5] (byte) line::x#0 ← phi( main/(byte) 1 main::@1/(byte) 3 ) [ line::x#0 screen#14 line::x1#2 ]
to:line::@1
line::@1: scope:[line] from line line::@1
[6] (byte*) screen#11 ← phi( line/(byte*) screen#14 line::@1/(byte*) screen#1 ) [ line::x1#2 line::x#2 screen#11 ]
@ -833,8 +833,8 @@ main: {
sta screen
lda #>$400
sta screen+1
//SEG10 [5] phi (byte) line::x#0 = (const byte) line::x0#0 [phi:main->line#2] -- zpby1=coby1
lda #line.x0
//SEG10 [5] phi (byte) line::x#0 = (byte) 1 [phi:main->line#2] -- zpby1=coby1
lda #1
sta line.x
jsr line
jmp b1
@ -847,8 +847,8 @@ main: {
lda #5
sta line.x1
//SEG15 [5] phi (byte*) screen#14 = (byte*) screen#1 [phi:main::@1->line#1] -- register_copy
//SEG16 [5] phi (byte) line::x#0 = (const byte) line::x0#1 [phi:main::@1->line#2] -- zpby1=coby1
lda #line.x0_1
//SEG16 [5] phi (byte) line::x#0 = (byte) 3 [phi:main::@1->line#2] -- zpby1=coby1
lda #3
sta line.x
jsr line
jmp breturn
@ -859,8 +859,6 @@ main: {
}
//SEG19 line
line: {
.const x0 = 1
.const x0_1 = 3
.label x = 3
.label x1 = 2
//SEG20 [6] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1]
@ -943,8 +941,8 @@ main: {
sta screen
lda #>$400
sta screen+1
//SEG10 [5] phi (byte) line::x#0 = (const byte) line::x0#0 [phi:main->line#2] -- xby=coby1
ldx #line.x0
//SEG10 [5] phi (byte) line::x#0 = (byte) 1 [phi:main->line#2] -- xby=coby1
ldx #1
jsr line
//SEG11 main::@1
b1:
@ -955,8 +953,8 @@ main: {
lda #5
sta line.x1
//SEG15 [5] phi (byte*) screen#14 = (byte*) screen#1 [phi:main::@1->line#1] -- register_copy
//SEG16 [5] phi (byte) line::x#0 = (const byte) line::x0#1 [phi:main::@1->line#2] -- xby=coby1
ldx #line.x0_1
//SEG16 [5] phi (byte) line::x#0 = (byte) 3 [phi:main::@1->line#2] -- xby=coby1
ldx #3
jsr line
//SEG17 main::@return
breturn:
@ -965,8 +963,6 @@ main: {
}
//SEG19 line
line: {
.const x0 = 1
.const x0_1 = 3
.label x1 = 2
//SEG20 [6] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1]
b1_from_line:
@ -1024,8 +1020,8 @@ main: {
sta screen
lda #>$400
sta screen+1
//SEG10 [5] phi (byte) line::x#0 = (const byte) line::x0#0 [phi:main->line#2] -- xby=coby1
ldx #line.x0
//SEG10 [5] phi (byte) line::x#0 = (byte) 1 [phi:main->line#2] -- xby=coby1
ldx #1
jsr line
//SEG11 main::@1
b1:
@ -1035,8 +1031,8 @@ main: {
lda #5
sta line.x1
//SEG15 [5] phi (byte*) screen#14 = (byte*) screen#1 [phi:main::@1->line#1] -- register_copy
//SEG16 [5] phi (byte) line::x#0 = (const byte) line::x0#1 [phi:main::@1->line#2] -- xby=coby1
ldx #line.x0_1
//SEG16 [5] phi (byte) line::x#0 = (byte) 3 [phi:main::@1->line#2] -- xby=coby1
ldx #3
jsr line
//SEG17 main::@return
breturn:
@ -1045,8 +1041,6 @@ main: {
}
//SEG19 line
line: {
.const x0 = 1
.const x0_1 = 3
.label x1 = 2
//SEG20 [6] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1]
//SEG21 [6] phi (byte*) screen#11 = (byte*) screen#14 [phi:line/line::@1->line::@1#0] -- register_copy
@ -1100,8 +1094,8 @@ main: {
sta screen
lda #>$400
sta screen+1
//SEG10 [5] phi (byte) line::x#0 = (const byte) line::x0#0 [phi:main->line#2] -- xby=coby1
ldx #line.x0
//SEG10 [5] phi (byte) line::x#0 = (byte) 1 [phi:main->line#2] -- xby=coby1
ldx #1
jsr line
//SEG11 main::@1
//SEG12 [3] call line param-assignment [ ]
@ -1110,8 +1104,8 @@ main: {
lda #5
sta line.x1
//SEG15 [5] phi (byte*) screen#14 = (byte*) screen#1 [phi:main::@1->line#1] -- register_copy
//SEG16 [5] phi (byte) line::x#0 = (const byte) line::x0#1 [phi:main::@1->line#2] -- xby=coby1
ldx #line.x0_1
//SEG16 [5] phi (byte) line::x#0 = (byte) 3 [phi:main::@1->line#2] -- xby=coby1
ldx #3
jsr line
//SEG17 main::@return
//SEG18 [4] return [ ]
@ -1119,8 +1113,6 @@ main: {
}
//SEG19 line
line: {
.const x0 = 1
.const x0_1 = 3
.label x1 = 2
//SEG20 [6] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1]
//SEG21 [6] phi (byte*) screen#11 = (byte*) screen#14 [phi:line/line::@1->line::@1#0] -- register_copy
@ -1157,8 +1149,6 @@ FINAL SYMBOL TABLE
(byte) line::x#1 reg byte x 16.5
(byte) line::x#2 reg byte x 11.666666666666666
(byte) line::x0
(const byte) line::x0#0 x0 = (byte) 1
(const byte) line::x0#1 x0#1 = (byte) 3
(byte) line::x1
(byte) line::x1#2 x1 zp ZP_BYTE:2 1.8333333333333333
(void()) main()
@ -1193,8 +1183,8 @@ main: {
sta screen
lda #>$400
sta screen+1
//SEG10 [5] phi (byte) line::x#0 = (const byte) line::x0#0 [phi:main->line#2] -- xby=coby1
ldx #line.x0
//SEG10 [5] phi (byte) line::x#0 = (byte) 1 [phi:main->line#2] -- xby=coby1
ldx #1
jsr line
//SEG11 main::@1
//SEG12 [3] call line param-assignment [ ]
@ -1203,8 +1193,8 @@ main: {
lda #5
sta line.x1
//SEG15 [5] phi (byte*) screen#14 = (byte*) screen#1 [phi:main::@1->line#1] -- register_copy
//SEG16 [5] phi (byte) line::x#0 = (const byte) line::x0#1 [phi:main::@1->line#2] -- xby=coby1
ldx #line.x0_1
//SEG16 [5] phi (byte) line::x#0 = (byte) 3 [phi:main::@1->line#2] -- xby=coby1
ldx #3
jsr line
//SEG17 main::@return
//SEG18 [4] return [ ]
@ -1212,8 +1202,6 @@ main: {
}
//SEG19 line
line: {
.const x0 = 1
.const x0_1 = 3
.label x1 = 2
//SEG20 [6] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1]
//SEG21 [6] phi (byte*) screen#11 = (byte*) screen#14 [phi:line/line::@1->line::@1#0] -- register_copy

View File

@ -8,8 +8,6 @@
(byte) line::x#1 reg byte x 16.5
(byte) line::x#2 reg byte x 11.666666666666666
(byte) line::x0
(const byte) line::x0#0 x0 = (byte) 1
(const byte) line::x0#1 x0#1 = (byte) 3
(byte) line::x1
(byte) line::x1#2 x1 zp ZP_BYTE:2 1.8333333333333333
(void()) main()

View File

@ -3446,8 +3446,8 @@ Multiple usages for variable. Not optimizing sub-constant (byte) flip::srcIdx#2
Multiple usages for variable. Not optimizing sub-constant (byte) flip::i#2
Multiple usages for variable. Not optimizing sub-constant (byte) flip::i#2
Multiple usages for variable. Not optimizing sub-constant (byte) plot::i#2
Constant inlined buffer2#1 = (const byte[256]) buffer2#0
Constant inlined flip::r#0 = (byte) 16
Constant inlined buffer2#1 = (const byte[256]) buffer2#0
Constant inlined SCREEN#1 = (const byte[1000]) SCREEN#0
Constant inlined plot::x#0 = (byte) 0
Constant inlined flip::dstIdx#0 = (byte) 15
@ -3459,8 +3459,8 @@ Constant inlined flip::srcIdx#0 = (byte) 0
Constant inlined RASTER#1 = (const byte*) RASTER#0
Constant inlined buffer1#10 = (const byte[256]) buffer1#0
Constant inlined prepare::i#0 = (byte) 0
Constant inlined main::c#0 = (byte) 25
Constant inlined plot::y#0 = (byte) 16
Constant inlined main::c#0 = (byte) 25
Constant inlined plot::$1 = (const byte[1000]) SCREEN#0
Constant inlined plot::$0 = (byte) 5*(byte) 40
Constant inlined plot::line#0 = (const byte[1000]) SCREEN#0+(byte) 5*(byte) 40+(byte) 12