1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-27 04:49:27 +00:00

Improved test.

This commit is contained in:
jespergravgaard 2019-04-20 01:48:11 +02:00
parent 576735aeaf
commit 5da972b5b2
4 changed files with 34 additions and 34 deletions

View File

@ -1,6 +1,6 @@
// Demonstrates global directive reserving addresses on zeropage
reserve(2,3,5);
reserve(2,5);
void main() {
const byte* SCREEN = $400;
@ -9,7 +9,7 @@ void main() {
}
}
reserve(4) byte sub1(byte i) {
reserve(3) byte sub1(byte i) {
return i+i;
}

View File

@ -4,7 +4,7 @@
.pc = $80d "Program"
main: {
.label SCREEN = $400
.label i = 6
.label i = 4
lda #0
sta i
b1:

View File

@ -168,11 +168,11 @@ Complete equivalence classes
[ sub1::return#0 ]
[ main::$0 ]
[ sub1::return#1 ]
Allocated zp ZP_BYTE:6 [ main::i#2 main::i#0 main::i#1 ]
Allocated zp ZP_BYTE:7 [ sub1::i#0 ]
Allocated zp ZP_BYTE:8 [ sub1::return#0 ]
Allocated zp ZP_BYTE:9 [ main::$0 ]
Allocated zp ZP_BYTE:10 [ sub1::return#1 ]
Allocated zp ZP_BYTE:4 [ main::i#2 main::i#0 main::i#1 ]
Allocated zp ZP_BYTE:6 [ sub1::i#0 ]
Allocated zp ZP_BYTE:7 [ sub1::return#0 ]
Allocated zp ZP_BYTE:8 [ main::$0 ]
Allocated zp ZP_BYTE:9 [ sub1::return#1 ]
INITIAL ASM
//SEG0 File Comments
@ -199,8 +199,8 @@ bend:
//SEG9 main
main: {
.label SCREEN = $400
.label _0 = 9
.label i = 6
.label _0 = 8
.label i = 4
//SEG10 [4] (byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta i
@ -242,11 +242,11 @@ main: {
rts
}
//SEG24 sub1
// sub1(byte zeropage(7) i)
// sub1(byte zeropage(6) i)
sub1: {
.label i = 7
.label return = 8
.label return_1 = $a
.label i = 6
.label return = 7
.label return_1 = 9
//SEG25 [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 -- vbuz1=vbuz2_plus_vbuz2
lda i
asl
@ -263,22 +263,22 @@ Statement [4] (byte) main::i#0 ← (byte/signed byte/word/signed word/dword/sign
Statement [10] *((const byte*) main::SCREEN#0 + (byte) main::i#2) ← (byte~) main::$0 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte y
Statement [12] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) always clobbers reg byte a
Statement [14] (byte) sub1::return#1 ← (byte) sub1::i#0 + (byte) sub1::i#0 [ sub1::return#1 ] ( main:2::sub1:7 [ main::i#2 sub1::return#1 ] ) always clobbers reg byte a
Potential registers zp ZP_BYTE:6 [ main::i#2 main::i#0 main::i#1 ] : zp ZP_BYTE:6 ,
Potential registers zp ZP_BYTE:7 [ sub1::i#0 ] : zp ZP_BYTE:7 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:8 [ sub1::return#0 ] : zp ZP_BYTE:8 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:9 [ main::$0 ] : zp ZP_BYTE:9 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:10 [ sub1::return#1 ] : zp ZP_BYTE:10 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:4 [ main::i#2 main::i#0 main::i#1 ] : zp ZP_BYTE:4 ,
Potential registers zp ZP_BYTE:6 [ sub1::i#0 ] : zp ZP_BYTE:6 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:7 [ sub1::return#0 ] : zp ZP_BYTE:7 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:8 [ main::$0 ] : zp ZP_BYTE:8 , reg byte a , reg byte x , reg byte y ,
Potential registers zp ZP_BYTE:9 [ sub1::return#1 ] : zp ZP_BYTE:9 , reg byte a , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 28.17: zp ZP_BYTE:6 [ main::i#2 main::i#0 main::i#1 ] 22: zp ZP_BYTE:9 [ main::$0 ]
Uplift Scope [sub1] 22: zp ZP_BYTE:8 [ sub1::return#0 ] 15: zp ZP_BYTE:7 [ sub1::i#0 ] 4.33: zp ZP_BYTE:10 [ sub1::return#1 ]
Uplift Scope [main] 28.17: zp ZP_BYTE:4 [ main::i#2 main::i#0 main::i#1 ] 22: zp ZP_BYTE:8 [ main::$0 ]
Uplift Scope [sub1] 22: zp ZP_BYTE:7 [ sub1::return#0 ] 15: zp ZP_BYTE:6 [ sub1::i#0 ] 4.33: zp ZP_BYTE:9 [ sub1::return#1 ]
Uplift Scope []
Uplifting [main] best 545 combination zp ZP_BYTE:6 [ main::i#2 main::i#0 main::i#1 ] reg byte a [ main::$0 ]
Uplifting [main] best 545 combination zp ZP_BYTE:4 [ main::i#2 main::i#0 main::i#1 ] reg byte a [ main::$0 ]
Uplifting [sub1] best 419 combination reg byte a [ sub1::return#0 ] reg byte a [ sub1::i#0 ] reg byte a [ sub1::return#1 ]
Uplifting [] best 419 combination
Attempting to uplift remaining variables inzp ZP_BYTE:6 [ main::i#2 main::i#0 main::i#1 ]
Uplifting [main] best 419 combination zp ZP_BYTE:6 [ main::i#2 main::i#0 main::i#1 ]
Attempting to uplift remaining variables inzp ZP_BYTE:4 [ main::i#2 main::i#0 main::i#1 ]
Uplifting [main] best 419 combination zp ZP_BYTE:4 [ main::i#2 main::i#0 main::i#1 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 File Comments
@ -305,7 +305,7 @@ bend:
//SEG9 main
main: {
.label SCREEN = $400
.label i = 6
.label i = 4
//SEG10 [4] (byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta i
@ -390,9 +390,9 @@ FINAL SYMBOL TABLE
(byte*) main::SCREEN
(const byte*) main::SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) $400
(byte) main::i
(byte) main::i#0 i zp ZP_BYTE:6 4.0
(byte) main::i#1 i zp ZP_BYTE:6 16.5
(byte) main::i#2 i zp ZP_BYTE:6 7.666666666666666
(byte) main::i#0 i zp ZP_BYTE:4 4.0
(byte) main::i#1 i zp ZP_BYTE:4 16.5
(byte) main::i#2 i zp ZP_BYTE:4 7.666666666666666
(byte()) sub1((byte) sub1::i)
(label) sub1::@return
(byte) sub1::i
@ -401,7 +401,7 @@ FINAL SYMBOL TABLE
(byte) sub1::return#0 reg byte a 22.0
(byte) sub1::return#1 reg byte a 4.333333333333333
zp ZP_BYTE:6 [ main::i#2 main::i#0 main::i#1 ]
zp ZP_BYTE:4 [ main::i#2 main::i#0 main::i#1 ]
reg byte a [ sub1::i#0 ]
reg byte a [ sub1::return#0 ]
reg byte a [ main::$0 ]
@ -427,7 +427,7 @@ Score: 314
//SEG9 main
main: {
.label SCREEN = $400
.label i = 6
.label i = 4
//SEG10 [4] (byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1
lda #0
sta i

View File

@ -9,9 +9,9 @@
(byte*) main::SCREEN
(const byte*) main::SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) $400
(byte) main::i
(byte) main::i#0 i zp ZP_BYTE:6 4.0
(byte) main::i#1 i zp ZP_BYTE:6 16.5
(byte) main::i#2 i zp ZP_BYTE:6 7.666666666666666
(byte) main::i#0 i zp ZP_BYTE:4 4.0
(byte) main::i#1 i zp ZP_BYTE:4 16.5
(byte) main::i#2 i zp ZP_BYTE:4 7.666666666666666
(byte()) sub1((byte) sub1::i)
(label) sub1::@return
(byte) sub1::i
@ -20,7 +20,7 @@
(byte) sub1::return#0 reg byte a 22.0
(byte) sub1::return#1 reg byte a 4.333333333333333
zp ZP_BYTE:6 [ main::i#2 main::i#0 main::i#1 ]
zp ZP_BYTE:4 [ main::i#2 main::i#0 main::i#1 ]
reg byte a [ sub1::i#0 ]
reg byte a [ sub1::return#0 ]
reg byte a [ main::$0 ]