mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-08-13 00:25:34 +00:00
New type system fixed addition sequence. Closes #132
This commit is contained in:
@@ -3,6 +3,6 @@ const byte* screen = $400;
|
|||||||
void main() {
|
void main() {
|
||||||
inline for( byte j: 0..1) {
|
inline for( byte j: 0..1) {
|
||||||
*(screen+40*j+39) = 0;
|
*(screen+40*j+39) = 0;
|
||||||
screen[40*j+38] = 0;
|
screen[40*j+37] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -5,8 +5,8 @@
|
|||||||
main: {
|
main: {
|
||||||
lda #0
|
lda #0
|
||||||
sta screen+$27
|
sta screen+$27
|
||||||
sta screen+$26
|
sta screen+$25
|
||||||
sta screen+$28*1+$27
|
sta screen+$28*1+$27
|
||||||
sta screen+$28*1+$26
|
sta screen+$28*1+$25
|
||||||
rts
|
rts
|
||||||
}
|
}
|
||||||
|
@@ -12,11 +12,11 @@ main: scope:[main] from @1
|
|||||||
to:main::@1
|
to:main::@1
|
||||||
main::@1: scope:[main] from main
|
main::@1: scope:[main] from main
|
||||||
[5] *((const byte*) screen#0+(byte) $27) ← (byte) 0
|
[5] *((const byte*) screen#0+(byte) $27) ← (byte) 0
|
||||||
[6] *((const byte*) screen#0+(byte) $26) ← (byte) 0
|
[6] *((const byte*) screen#0+(byte) $25) ← (byte) 0
|
||||||
to:main::@1_1
|
to:main::@1_1
|
||||||
main::@1_1: scope:[main] from main::@1
|
main::@1_1: scope:[main] from main::@1
|
||||||
[7] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $27) ← (byte) 0
|
[7] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $27) ← (byte) 0
|
||||||
[8] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $26) ← (byte) 0
|
[8] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $25) ← (byte) 0
|
||||||
to:main::@return
|
to:main::@return
|
||||||
main::@return: scope:[main] from main::@1_1
|
main::@return: scope:[main] from main::@1_1
|
||||||
[9] return
|
[9] return
|
||||||
|
@@ -15,7 +15,7 @@ main::@1: scope:[main] from main main::@1
|
|||||||
(byte*~) main::$2 ← (byte*~) main::$1 + (number) $27
|
(byte*~) main::$2 ← (byte*~) main::$1 + (number) $27
|
||||||
*((byte*~) main::$2) ← (number) 0
|
*((byte*~) main::$2) ← (number) 0
|
||||||
(number~) main::$3 ← (number) $28 * (byte) main::j#2
|
(number~) main::$3 ← (number) $28 * (byte) main::j#2
|
||||||
(number~) main::$4 ← (number~) main::$3 + (number) $26
|
(number~) main::$4 ← (number~) main::$3 + (number) $25
|
||||||
*((byte*) screen#0 + (number~) main::$4) ← (number) 0
|
*((byte*) screen#0 + (number~) main::$4) ← (number) 0
|
||||||
(byte) main::j#1 ← (byte) main::j#2 + rangenext(0,1)
|
(byte) main::j#1 ← (byte) main::j#2 + rangenext(0,1)
|
||||||
(bool~) main::$5 ← (byte) main::j#1 != rangelast(0,1)
|
(bool~) main::$5 ← (byte) main::j#1 != rangelast(0,1)
|
||||||
@@ -58,8 +58,8 @@ Adding number conversion cast (unumber) $27 in (byte*~) main::$2 ← (byte*~) ma
|
|||||||
Adding number conversion cast (unumber) 0 in *((byte*~) main::$2) ← (number) 0
|
Adding number conversion cast (unumber) 0 in *((byte*~) main::$2) ← (number) 0
|
||||||
Adding number conversion cast (unumber) $28 in (number~) main::$3 ← (number) $28 * (byte) main::j#2
|
Adding number conversion cast (unumber) $28 in (number~) main::$3 ← (number) $28 * (byte) main::j#2
|
||||||
Adding number conversion cast (unumber) main::$3 in (number~) main::$3 ← (unumber)(number) $28 * (byte) main::j#2
|
Adding number conversion cast (unumber) main::$3 in (number~) main::$3 ← (unumber)(number) $28 * (byte) main::j#2
|
||||||
Adding number conversion cast (unumber) $26 in (number~) main::$4 ← (unumber~) main::$3 + (number) $26
|
Adding number conversion cast (unumber) $25 in (number~) main::$4 ← (unumber~) main::$3 + (number) $25
|
||||||
Adding number conversion cast (unumber) main::$4 in (number~) main::$4 ← (unumber~) main::$3 + (unumber)(number) $26
|
Adding number conversion cast (unumber) main::$4 in (number~) main::$4 ← (unumber~) main::$3 + (unumber)(number) $25
|
||||||
Adding number conversion cast (unumber) 0 in *((byte*) screen#0 + (unumber~) main::$4) ← (number) 0
|
Adding number conversion cast (unumber) 0 in *((byte*) screen#0 + (unumber~) main::$4) ← (number) 0
|
||||||
Successful SSA optimization PassNAddNumberTypeConversions
|
Successful SSA optimization PassNAddNumberTypeConversions
|
||||||
Inlining cast (byte*) screen#0 ← (byte*)(number) $400
|
Inlining cast (byte*) screen#0 ← (byte*)(number) $400
|
||||||
@@ -71,19 +71,19 @@ Simplifying constant integer cast $28
|
|||||||
Simplifying constant integer cast $27
|
Simplifying constant integer cast $27
|
||||||
Simplifying constant integer cast 0
|
Simplifying constant integer cast 0
|
||||||
Simplifying constant integer cast $28
|
Simplifying constant integer cast $28
|
||||||
Simplifying constant integer cast $26
|
Simplifying constant integer cast $25
|
||||||
Simplifying constant integer cast 0
|
Simplifying constant integer cast 0
|
||||||
Successful SSA optimization PassNCastSimplification
|
Successful SSA optimization PassNCastSimplification
|
||||||
Finalized unsigned number type (byte) $28
|
Finalized unsigned number type (byte) $28
|
||||||
Finalized unsigned number type (byte) $27
|
Finalized unsigned number type (byte) $27
|
||||||
Finalized unsigned number type (byte) 0
|
Finalized unsigned number type (byte) 0
|
||||||
Finalized unsigned number type (byte) $28
|
Finalized unsigned number type (byte) $28
|
||||||
Finalized unsigned number type (byte) $26
|
Finalized unsigned number type (byte) $25
|
||||||
Finalized unsigned number type (byte) 0
|
Finalized unsigned number type (byte) 0
|
||||||
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
||||||
Inferred type updated to byte in (unumber~) main::$0 ← (byte) $28 * (byte) main::j#2
|
Inferred type updated to byte in (unumber~) main::$0 ← (byte) $28 * (byte) main::j#2
|
||||||
Inferred type updated to byte in (unumber~) main::$3 ← (byte) $28 * (byte) main::j#2
|
Inferred type updated to byte in (unumber~) main::$3 ← (byte) $28 * (byte) main::j#2
|
||||||
Inferred type updated to byte in (unumber~) main::$4 ← (byte~) main::$3 + (byte) $26
|
Inferred type updated to byte in (unumber~) main::$4 ← (byte~) main::$3 + (byte) $25
|
||||||
Identified duplicate assignment right side [7] (byte~) main::$3 ← (byte) $28 * (byte) main::j#2
|
Identified duplicate assignment right side [7] (byte~) main::$3 ← (byte) $28 * (byte) main::j#2
|
||||||
Successful SSA optimization Pass2DuplicateRValueIdentification
|
Successful SSA optimization Pass2DuplicateRValueIdentification
|
||||||
Simple Condition (bool~) main::$5 [12] unroll if((byte) main::j#1!=rangelast(0,1)) goto main::@1
|
Simple Condition (bool~) main::$5 [12] unroll if((byte) main::j#1!=rangelast(0,1)) goto main::@1
|
||||||
@@ -122,12 +122,12 @@ Successful SSA optimization Pass2ConstantIfs
|
|||||||
Simplifying constant evaluating to zero (byte) $28*(const byte) main::j#0 in
|
Simplifying constant evaluating to zero (byte) $28*(const byte) main::j#0 in
|
||||||
Successful SSA optimization PassNSimplifyConstantZero
|
Successful SSA optimization PassNSimplifyConstantZero
|
||||||
Simplifying expression containing zero screen#0 in [2] (byte*~) main::$1 ← (const byte*) screen#0 + (const byte) main::$3
|
Simplifying expression containing zero screen#0 in [2] (byte*~) main::$1 ← (const byte*) screen#0 + (const byte) main::$3
|
||||||
Simplifying expression containing zero $26 in [4] (byte~) main::$4 ← (const byte) main::$3 + (byte) $26
|
Simplifying expression containing zero $25 in [4] (byte~) main::$4 ← (const byte) main::$3 + (byte) $25
|
||||||
Successful SSA optimization PassNSimplifyExpressionWithZero
|
Successful SSA optimization PassNSimplifyExpressionWithZero
|
||||||
Eliminating unused constant (const byte) main::$3
|
Eliminating unused constant (const byte) main::$3
|
||||||
Successful SSA optimization PassNEliminateUnusedVars
|
Successful SSA optimization PassNEliminateUnusedVars
|
||||||
Constant (const byte*) main::$1 = screen#0
|
Constant (const byte*) main::$1 = screen#0
|
||||||
Constant (const byte) main::$4 = $26
|
Constant (const byte) main::$4 = $25
|
||||||
Successful SSA optimization Pass2ConstantIdentification
|
Successful SSA optimization Pass2ConstantIdentification
|
||||||
Unrolling loop Loop head: main::@1_1 tails: main::@1_1 blocks: main::@1_1
|
Unrolling loop Loop head: main::@1_1 tails: main::@1_1 blocks: main::@1_1
|
||||||
Successful SSA optimization Pass2LoopUnroll
|
Successful SSA optimization Pass2LoopUnroll
|
||||||
@@ -154,25 +154,25 @@ Eliminating variable (byte) main::j#6 from unused block main::@1_2
|
|||||||
Removing unused block main::@1_2
|
Removing unused block main::@1_2
|
||||||
Successful SSA optimization Pass2EliminateUnusedBlocks
|
Successful SSA optimization Pass2EliminateUnusedBlocks
|
||||||
Constant right-side identified [3] (byte*~) main::$7 ← (const byte*) screen#0 + (const byte) main::$6
|
Constant right-side identified [3] (byte*~) main::$7 ← (const byte*) screen#0 + (const byte) main::$6
|
||||||
Constant right-side identified [5] (byte~) main::$8 ← (const byte) main::$6 + (byte) $26
|
Constant right-side identified [5] (byte~) main::$8 ← (const byte) main::$6 + (byte) $25
|
||||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||||
Constant (const byte*) main::$7 = screen#0+main::$6
|
Constant (const byte*) main::$7 = screen#0+main::$6
|
||||||
Constant (const byte) main::$8 = main::$6+$26
|
Constant (const byte) main::$8 = main::$6+$25
|
||||||
Successful SSA optimization Pass2ConstantIdentification
|
Successful SSA optimization Pass2ConstantIdentification
|
||||||
Inlining constant with different constant siblings (const byte) main::j#0
|
Inlining constant with different constant siblings (const byte) main::j#0
|
||||||
Inlining constant with different constant siblings (const byte) main::j#1
|
Inlining constant with different constant siblings (const byte) main::j#1
|
||||||
Constant inlined main::$1 = (const byte*) screen#0
|
Constant inlined main::$1 = (const byte*) screen#0
|
||||||
Constant inlined main::$6 = (byte) $28*++(byte) 0
|
Constant inlined main::$6 = (byte) $28*++(byte) 0
|
||||||
Constant inlined main::j#1 = ++(byte) 0
|
Constant inlined main::j#1 = ++(byte) 0
|
||||||
Constant inlined main::$4 = (byte) $26
|
Constant inlined main::$4 = (byte) $25
|
||||||
Constant inlined main::j#0 = (byte) 0
|
Constant inlined main::j#0 = (byte) 0
|
||||||
Constant inlined main::$7 = (const byte*) screen#0+(byte) $28*++(byte) 0
|
Constant inlined main::$7 = (const byte*) screen#0+(byte) $28*++(byte) 0
|
||||||
Constant inlined main::$8 = (byte) $28*++(byte) 0+(byte) $26
|
Constant inlined main::$8 = (byte) $28*++(byte) 0+(byte) $25
|
||||||
Successful SSA optimization Pass2ConstantInlining
|
Successful SSA optimization Pass2ConstantInlining
|
||||||
Consolidated array index constant in *(screen#0+$27)
|
Consolidated array index constant in *(screen#0+$27)
|
||||||
Consolidated array index constant in *(screen#0+$26)
|
Consolidated array index constant in *(screen#0+$25)
|
||||||
Consolidated array index constant in *(screen#0+$28*++0+$27)
|
Consolidated array index constant in *(screen#0+$28*++0+$27)
|
||||||
Consolidated array index constant in *(screen#0+$28*++0+$26)
|
Consolidated array index constant in *(screen#0+$28*++0+$25)
|
||||||
Successful SSA optimization Pass2ConstantAdditionElimination
|
Successful SSA optimization Pass2ConstantAdditionElimination
|
||||||
Simplifying constant integer increment ++0
|
Simplifying constant integer increment ++0
|
||||||
Successful SSA optimization Pass2ConstantSimplification
|
Successful SSA optimization Pass2ConstantSimplification
|
||||||
@@ -207,11 +207,11 @@ main: scope:[main] from @1
|
|||||||
to:main::@1
|
to:main::@1
|
||||||
main::@1: scope:[main] from main
|
main::@1: scope:[main] from main
|
||||||
[5] *((const byte*) screen#0+(byte) $27) ← (byte) 0
|
[5] *((const byte*) screen#0+(byte) $27) ← (byte) 0
|
||||||
[6] *((const byte*) screen#0+(byte) $26) ← (byte) 0
|
[6] *((const byte*) screen#0+(byte) $25) ← (byte) 0
|
||||||
to:main::@1_1
|
to:main::@1_1
|
||||||
main::@1_1: scope:[main] from main::@1
|
main::@1_1: scope:[main] from main::@1
|
||||||
[7] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $27) ← (byte) 0
|
[7] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $27) ← (byte) 0
|
||||||
[8] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $26) ← (byte) 0
|
[8] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $25) ← (byte) 0
|
||||||
to:main::@return
|
to:main::@return
|
||||||
main::@return: scope:[main] from main::@1_1
|
main::@return: scope:[main] from main::@1_1
|
||||||
[9] return
|
[9] return
|
||||||
@@ -258,18 +258,18 @@ main: {
|
|||||||
//SEG12 [5] *((const byte*) screen#0+(byte) $27) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
//SEG12 [5] *((const byte*) screen#0+(byte) $27) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
||||||
lda #0
|
lda #0
|
||||||
sta screen+$27
|
sta screen+$27
|
||||||
//SEG13 [6] *((const byte*) screen#0+(byte) $26) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
//SEG13 [6] *((const byte*) screen#0+(byte) $25) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
||||||
lda #0
|
lda #0
|
||||||
sta screen+$26
|
sta screen+$25
|
||||||
jmp b1_1
|
jmp b1_1
|
||||||
//SEG14 main::@1_1
|
//SEG14 main::@1_1
|
||||||
b1_1:
|
b1_1:
|
||||||
//SEG15 [7] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $27) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
//SEG15 [7] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $27) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
||||||
lda #0
|
lda #0
|
||||||
sta screen+$28*1+$27
|
sta screen+$28*1+$27
|
||||||
//SEG16 [8] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $26) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
//SEG16 [8] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $25) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
||||||
lda #0
|
lda #0
|
||||||
sta screen+$28*1+$26
|
sta screen+$28*1+$25
|
||||||
jmp breturn
|
jmp breturn
|
||||||
//SEG17 main::@return
|
//SEG17 main::@return
|
||||||
breturn:
|
breturn:
|
||||||
@@ -279,9 +279,9 @@ main: {
|
|||||||
|
|
||||||
REGISTER UPLIFT POTENTIAL REGISTERS
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
||||||
Statement [5] *((const byte*) screen#0+(byte) $27) ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
|
Statement [5] *((const byte*) screen#0+(byte) $27) ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
|
||||||
Statement [6] *((const byte*) screen#0+(byte) $26) ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
|
Statement [6] *((const byte*) screen#0+(byte) $25) ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
|
||||||
Statement [7] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $27) ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
|
Statement [7] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $27) ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
|
||||||
Statement [8] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $26) ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
|
Statement [8] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $25) ← (byte) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a
|
||||||
|
|
||||||
REGISTER UPLIFT SCOPES
|
REGISTER UPLIFT SCOPES
|
||||||
Uplift Scope [main]
|
Uplift Scope [main]
|
||||||
@@ -322,18 +322,18 @@ main: {
|
|||||||
//SEG12 [5] *((const byte*) screen#0+(byte) $27) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
//SEG12 [5] *((const byte*) screen#0+(byte) $27) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
||||||
lda #0
|
lda #0
|
||||||
sta screen+$27
|
sta screen+$27
|
||||||
//SEG13 [6] *((const byte*) screen#0+(byte) $26) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
//SEG13 [6] *((const byte*) screen#0+(byte) $25) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
||||||
lda #0
|
lda #0
|
||||||
sta screen+$26
|
sta screen+$25
|
||||||
jmp b1_1
|
jmp b1_1
|
||||||
//SEG14 main::@1_1
|
//SEG14 main::@1_1
|
||||||
b1_1:
|
b1_1:
|
||||||
//SEG15 [7] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $27) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
//SEG15 [7] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $27) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
||||||
lda #0
|
lda #0
|
||||||
sta screen+$28*1+$27
|
sta screen+$28*1+$27
|
||||||
//SEG16 [8] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $26) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
//SEG16 [8] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $25) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
||||||
lda #0
|
lda #0
|
||||||
sta screen+$28*1+$26
|
sta screen+$28*1+$25
|
||||||
jmp breturn
|
jmp breturn
|
||||||
//SEG17 main::@return
|
//SEG17 main::@return
|
||||||
breturn:
|
breturn:
|
||||||
@@ -406,13 +406,13 @@ main: {
|
|||||||
//SEG12 [5] *((const byte*) screen#0+(byte) $27) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
//SEG12 [5] *((const byte*) screen#0+(byte) $27) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
||||||
lda #0
|
lda #0
|
||||||
sta screen+$27
|
sta screen+$27
|
||||||
//SEG13 [6] *((const byte*) screen#0+(byte) $26) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
//SEG13 [6] *((const byte*) screen#0+(byte) $25) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
||||||
sta screen+$26
|
sta screen+$25
|
||||||
//SEG14 main::@1_1
|
//SEG14 main::@1_1
|
||||||
//SEG15 [7] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $27) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
//SEG15 [7] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $27) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
||||||
sta screen+$28*1+$27
|
sta screen+$28*1+$27
|
||||||
//SEG16 [8] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $26) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
//SEG16 [8] *((const byte*) screen#0+(byte) $28*(byte) 1+(byte) $25) ← (byte) 0 -- _deref_pbuc1=vbuc2
|
||||||
sta screen+$28*1+$26
|
sta screen+$28*1+$25
|
||||||
//SEG17 main::@return
|
//SEG17 main::@return
|
||||||
//SEG18 [9] return
|
//SEG18 [9] return
|
||||||
rts
|
rts
|
||||||
|
Reference in New Issue
Block a user