1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-25 20:32:25 +00:00

Fixed problem with boolean constant comparison (false!=false). Closes #527

This commit is contained in:
jespergravgaard 2020-10-01 08:45:55 +02:00
parent 31b0a500a1
commit b9d69db454
11 changed files with 1459 additions and 1489 deletions

View File

@ -7,7 +7,7 @@ import dk.camelot64.kickc.model.types.SymbolType;
/**
* SSA form constant integer value
*/
public class ConstantBool implements ConstantLiteral<Boolean> {
public class ConstantBool implements ConstantEnumerable<Boolean> {
private Boolean value;
@ -20,6 +20,19 @@ public class ConstantBool implements ConstantLiteral<Boolean> {
return SymbolType.BOOLEAN;
}
@Override
public Long getInteger() {
if(value)
return 1l;
else
return 0l;
}
@Override
public ConstantLiteral calculateLiteral(ProgramScope scope) {
return new ConstantBool(value);
}
@Override
public Boolean getValue() {
return value;

View File

@ -44,6 +44,11 @@ public class TestPrograms {
public TestPrograms() {
}
@Test
public void testProblemBoolCompare() throws IOException, URISyntaxException {
compileAndCompare("problem-bool-compare.c");
}
@Test
public void testIndexSizeofReuse() throws IOException, URISyntaxException {
compileAndCompare("index-sizeof-reuse.c");

View File

@ -1,5 +1,5 @@
#pragma target(nes)
//#pragma emulator("java -jar /Applications/Nintaco_bin_2020-05-01/Nintaco.jar")
#pragma emulator("java -jar /Applications/Nintaco_bin_2020-05-01/Nintaco.jar")
#include <nes.h>
#include <stdio.h>
@ -67,7 +67,7 @@ int main(void)
PPU->PPUCTRL = 0b10001000;
unsigned short i;
unsigned char active_balls = 0;
unsigned short active_balls = 0;
unsigned char timer = 0;
unsigned char timer_2 = 0;
unsigned char h_bar = 0x80;

View File

@ -124,20 +124,15 @@ main: {
.label __9 = $36
.label __10 = $36
.label __11 = $36
.label __20 = $f
.label __20 = $21
.label __23 = $27
.label __25 = $25
.label __26 = $29
.label __25 = $29
.label __26 = $2b
.label __31 = $30
.label __32 = $34
.label __33 = $32
.label __35 = $38
.label __36 = $3a
.label __40 = $f
.label __44 = $25
.label __45 = $21
.label __50 = $32
.label __53 = $2a
.label __33 = $f
.label __36 = $38
.label __44 = $f
.label __56 = $30
.label i = 2
.label timer_2 = 4
@ -146,8 +141,8 @@ main: {
.label sprite_idx = 9
.label i_1 = 7
.label timer = 6
.label __59 = $38
.label __60 = $3a
.label __59 = $3a
.label __60 = $38
.label __61 = $11
.label __62 = $13
.label __63 = $15
@ -156,16 +151,16 @@ main: {
.label __66 = $1b
.label __67 = $1d
.label __68 = $1f
.label __69 = $f
.label __69 = $21
.label __70 = $27
.label __71 = $25
.label __71 = $29
.label __72 = $23
.label __73 = $21
.label __73 = $25
.label __74 = $34
.label __75 = $32
.label __75 = $f
.label __76 = $2c
.label __77 = $2e
.label __78 = $2a
.label __78 = $32
// asm
cld
ldx #$ff
@ -366,33 +361,33 @@ main: {
// balls[i].x_position += balls[i].x_velocity
lda.z i_1
asl
sta.z __40
sta.z __44
lda.z i_1+1
rol
sta.z __40+1
asl.z __40
rol.z __40+1
asl.z __40
rol.z __40+1
lda.z __40
sta.z __44+1
asl.z __44
rol.z __44+1
asl.z __44
rol.z __44+1
lda.z __44
clc
adc #<balls
sta.z __61
lda.z __40+1
lda.z __44+1
adc #>balls
sta.z __61+1
lda.z __40
lda.z __44
clc
adc #<balls+4
sta.z __62
lda.z __40+1
lda.z __44+1
adc #>balls+4
sta.z __62+1
lda.z __40
lda.z __44
clc
adc #<balls
sta.z __63
lda.z __40+1
lda.z __44+1
adc #>balls
sta.z __63+1
ldy #0
@ -405,18 +400,18 @@ main: {
adc (__62),y
sta (__63),y
// balls[i].y_velocity += WEIGHT
lda.z __40
lda.z __44
clc
adc #<balls+6
sta.z __64
lda.z __40+1
lda.z __44+1
adc #>balls+6
sta.z __64+1
lda.z __40
lda.z __44
clc
adc #<balls+6
sta.z __65
lda.z __40+1
lda.z __44+1
adc #>balls+6
sta.z __65+1
ldy #0
@ -429,25 +424,25 @@ main: {
adc #>$10
sta (__65),y
// balls[i].y_position += (balls[i].y_velocity += WEIGHT)
lda.z __40
lda.z __44
clc
adc #<balls+2
sta.z __66
lda.z __40+1
lda.z __44+1
adc #>balls+2
sta.z __66+1
lda.z __40
lda.z __44
clc
adc #<balls+6
sta.z __67
lda.z __40+1
lda.z __44+1
adc #>balls+6
sta.z __67+1
lda.z __40
lda.z __44
clc
adc #<balls+2
sta.z __68
lda.z __40+1
lda.z __44+1
adc #>balls+2
sta.z __68+1
ldy #0
@ -460,11 +455,11 @@ main: {
adc (__67),y
sta (__68),y
// balls[i].x_position >> 8
lda.z __44
clc
lda.z __69
adc #<balls
sta.z __69
lda.z __69+1
lda.z __44+1
adc #>balls
sta.z __69+1
ldy #1
@ -480,28 +475,18 @@ main: {
bcs __b9
!:
// balls[i].x_velocity ^= 0xFFFF
lda.z i_1
asl
sta.z __45
lda.z i_1+1
rol
sta.z __45+1
asl.z __45
rol.z __45+1
asl.z __45
rol.z __45+1
lda.z __45
lda.z __44
clc
adc #<balls+4
sta.z __72
lda.z __45+1
lda.z __44+1
adc #>balls+4
sta.z __72+1
lda.z __44
clc
lda.z __73
adc #<balls+4
sta.z __73
lda.z __73+1
lda.z __44+1
adc #>balls+4
sta.z __73+1
ldy #0
@ -514,16 +499,6 @@ main: {
sta (__73),y
__b9:
// balls[i].y_position >> 8
lda.z i_1
asl
sta.z __44
lda.z i_1+1
rol
sta.z __44+1
asl.z __44
rol.z __44+1
asl.z __44
rol.z __44+1
lda.z __44
clc
adc #<balls+2
@ -536,11 +511,11 @@ main: {
sta.z __23
dey
sty.z __23+1
lda.z __44
clc
lda.z __71
adc #<balls+2
sta.z __71
lda.z __71+1
lda.z __44+1
adc #>balls+2
sta.z __71+1
ldy #1
@ -566,28 +541,18 @@ main: {
bcs __b10
!:
// balls[i].y_velocity ^= 0xFFFF
lda.z i_1
asl
sta.z __53
lda.z i_1+1
rol
sta.z __53+1
asl.z __53
rol.z __53+1
asl.z __53
rol.z __53+1
lda.z __53
lda.z __44
clc
adc #<balls+6
sta.z __76
lda.z __53+1
lda.z __44+1
adc #>balls+6
sta.z __76+1
lda.z __53
lda.z __44
clc
adc #<balls+6
sta.z __77
lda.z __53+1
lda.z __44+1
adc #>balls+6
sta.z __77+1
ldy #0
@ -611,11 +576,11 @@ main: {
lda #0
sta.z __31
// balls[i].y_position = ((unsigned short)(h_bar - 2) << 8)
lda.z __44
clc
lda.z __78
adc #<balls+2
sta.z __78
lda.z __78+1
lda.z __44+1
adc #>balls+2
sta.z __78+1
ldy #0
@ -626,21 +591,11 @@ main: {
sta (__78),y
__b10:
// balls[i].y_position >> 8
lda.z i_1
asl
sta.z __50
lda.z i_1+1
rol
sta.z __50+1
asl.z __50
rol.z __50+1
asl.z __50
rol.z __50+1
lda.z __50
lda.z __44
clc
adc #<balls+2
sta.z __74
lda.z __50+1
lda.z __44+1
adc #>balls+2
sta.z __74+1
ldy #1
@ -701,19 +656,19 @@ main: {
// balls[i].x_velocity = rand() & 0x3FF
lda.z i
asl
sta.z __35
sta.z __36
lda.z i+1
rol
sta.z __35+1
asl.z __35
rol.z __35+1
asl.z __35
rol.z __35+1
sta.z __36+1
asl.z __36
rol.z __36+1
asl.z __36
rol.z __36+1
lda.z __36
clc
lda.z __59
adc #<balls+4
sta.z __59
lda.z __59+1
lda.z __36+1
adc #>balls+4
sta.z __59+1
ldy #0
@ -730,16 +685,6 @@ main: {
and.z __11
tax
// balls[i].y_velocity = rand() & 0x0FF
lda.z i
asl
sta.z __36
lda.z i+1
rol
sta.z __36+1
asl.z __36
rol.z __36+1
asl.z __36
rol.z __36+1
clc
lda.z __60
adc #<balls+6

View File

@ -149,160 +149,155 @@ main::@14: scope:[main] from main::@13
[68] *((byte*) 8193) ← (byte) $18
to:main::@3
main::@7: scope:[main] from main::@6
[69] (word~) main::$40 ← (word) main::i#10 << (byte) 3
[70] (word*~) main::$61 ← (word*)(const struct $0*) balls + (word~) main::$40
[71] (word*~) main::$62 ← (word*)(const struct $0*) balls+(byte) 4 + (word~) main::$40
[72] (word*~) main::$63 ← (word*)(const struct $0*) balls + (word~) main::$40
[69] (word~) main::$44 ← (word) main::i#10 << (byte) 3
[70] (word*~) main::$61 ← (word*)(const struct $0*) balls + (word~) main::$44
[71] (word*~) main::$62 ← (word*)(const struct $0*) balls+(byte) 4 + (word~) main::$44
[72] (word*~) main::$63 ← (word*)(const struct $0*) balls + (word~) main::$44
[73] *((word*~) main::$63) ← *((word*~) main::$61) + *((word*~) main::$62)
[74] (word*~) main::$64 ← (word*)(const struct $0*) balls+(byte) 6 + (word~) main::$40
[75] (word*~) main::$65 ← (word*)(const struct $0*) balls+(byte) 6 + (word~) main::$40
[74] (word*~) main::$64 ← (word*)(const struct $0*) balls+(byte) 6 + (word~) main::$44
[75] (word*~) main::$65 ← (word*)(const struct $0*) balls+(byte) 6 + (word~) main::$44
[76] *((word*~) main::$65) ← *((word*~) main::$64) + (byte) $10
[77] (word*~) main::$66 ← (word*)(const struct $0*) balls+(byte) 2 + (word~) main::$40
[78] (word*~) main::$67 ← (word*)(const struct $0*) balls+(byte) 6 + (word~) main::$40
[79] (word*~) main::$68 ← (word*)(const struct $0*) balls+(byte) 2 + (word~) main::$40
[77] (word*~) main::$66 ← (word*)(const struct $0*) balls+(byte) 2 + (word~) main::$44
[78] (word*~) main::$67 ← (word*)(const struct $0*) balls+(byte) 6 + (word~) main::$44
[79] (word*~) main::$68 ← (word*)(const struct $0*) balls+(byte) 2 + (word~) main::$44
[80] *((word*~) main::$68) ← *((word*~) main::$66) + *((word*~) main::$67)
[81] (word*~) main::$69 ← (word*)(const struct $0*) balls + (word~) main::$40
[81] (word*~) main::$69 ← (word*)(const struct $0*) balls + (word~) main::$44
[82] (word~) main::$20 ← *((word*~) main::$69) >> (byte) 8
[83] if((word~) main::$20>=(byte) 8) goto main::@9
to:main::@11
main::@11: scope:[main] from main::@7
[84] (word~) main::$45 ← (word) main::i#10 << (byte) 3
[85] (word*~) main::$72 ← (word*)(const struct $0*) balls+(byte) 4 + (word~) main::$45
[86] (word*~) main::$73 ← (word*)(const struct $0*) balls+(byte) 4 + (word~) main::$45
[87] *((word*~) main::$73) ← *((word*~) main::$72) ^ (word) $ffff
[84] (word*~) main::$72 ← (word*)(const struct $0*) balls+(byte) 4 + (word~) main::$44
[85] (word*~) main::$73 ← (word*)(const struct $0*) balls+(byte) 4 + (word~) main::$44
[86] *((word*~) main::$73) ← *((word*~) main::$72) ^ (word) $ffff
to:main::@9
main::@9: scope:[main] from main::@11 main::@7
[88] (word~) main::$44 ← (word) main::i#10 << (byte) 3
[89] (word*~) main::$70 ← (word*)(const struct $0*) balls+(byte) 2 + (word~) main::$44
[90] (word~) main::$23 ← *((word*~) main::$70) >> (byte) 8
[91] (word*~) main::$71 ← (word*)(const struct $0*) balls+(byte) 2 + (word~) main::$44
[92] (word~) main::$25 ← *((word*~) main::$71) >> (byte) 8
[93] (byte~) main::$26 ← (byte) main::h_bar#1 + (byte) 8
[94] if((word~) main::$23<(byte) main::h_bar#1) goto main::@10
[87] (word*~) main::$70 ← (word*)(const struct $0*) balls+(byte) 2 + (word~) main::$44
[88] (word~) main::$23 ← *((word*~) main::$70) >> (byte) 8
[89] (word*~) main::$71 ← (word*)(const struct $0*) balls+(byte) 2 + (word~) main::$44
[90] (word~) main::$25 ← *((word*~) main::$71) >> (byte) 8
[91] (byte~) main::$26 ← (byte) main::h_bar#1 + (byte) 8
[92] if((word~) main::$23<(byte) main::h_bar#1) goto main::@10
to:main::@24
main::@24: scope:[main] from main::@9
[95] if((word~) main::$25>=(byte~) main::$26) goto main::@10
[93] if((word~) main::$25>=(byte~) main::$26) goto main::@10
to:main::@12
main::@12: scope:[main] from main::@24
[96] (word~) main::$53 ← (word) main::i#10 << (byte) 3
[97] (word*~) main::$76 ← (word*)(const struct $0*) balls+(byte) 6 + (word~) main::$53
[98] (word*~) main::$77 ← (word*)(const struct $0*) balls+(byte) 6 + (word~) main::$53
[99] *((word*~) main::$77) ← *((word*~) main::$76) ^ (word) $ffff
[100] (byte~) main::$30 ← (byte) main::h_bar#1 - (byte) 2
[101] (word~) main::$56 ← (word)(byte~) main::$30
[102] (word~) main::$31 ← (word~) main::$56 << (byte) 8
[103] (word*~) main::$78 ← (word*)(const struct $0*) balls+(byte) 2 + (word~) main::$53
[104] *((word*~) main::$78) ← (word~) main::$31
[94] (word*~) main::$76 ← (word*)(const struct $0*) balls+(byte) 6 + (word~) main::$44
[95] (word*~) main::$77 ← (word*)(const struct $0*) balls+(byte) 6 + (word~) main::$44
[96] *((word*~) main::$77) ← *((word*~) main::$76) ^ (word) $ffff
[97] (byte~) main::$30 ← (byte) main::h_bar#1 - (byte) 2
[98] (word~) main::$56 ← (word)(byte~) main::$30
[99] (word~) main::$31 ← (word~) main::$56 << (byte) 8
[100] (word*~) main::$78 ← (word*)(const struct $0*) balls+(byte) 2 + (word~) main::$44
[101] *((word*~) main::$78) ← (word~) main::$31
to:main::@10
main::@10: scope:[main] from main::@12 main::@24 main::@9
[105] (word~) main::$50 ← (word) main::i#10 << (byte) 3
[106] (word*~) main::$74 ← (word*)(const struct $0*) balls+(byte) 2 + (word~) main::$50
[107] (word~) main::$32 ← *((word*~) main::$74) >> (byte) 8
[108] (byte~) main::$48 ← (byte) main::sprite_idx#3 << (byte) 2
[109] *((byte*)(const struct SpriteData*) SPRITE_BUFFER + (byte~) main::$48) ← (byte)(word~) main::$32
[110] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_TILE + (byte~) main::$48) ← (byte) $a
[111] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES + (byte~) main::$48) ← (byte) 3
[112] (word*~) main::$75 ← (word*)(const struct $0*) balls + (word~) main::$50
[113] (word~) main::$33 ← *((word*~) main::$75) >> (byte) 8
[114] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_X + (byte~) main::$48) ← (byte)(word~) main::$33
[115] (byte) main::sprite_idx#2 ← ++ (byte) main::sprite_idx#3
[116] (word) main::i#4 ← ++ (word) main::i#10
[102] (word*~) main::$74 ← (word*)(const struct $0*) balls+(byte) 2 + (word~) main::$44
[103] (word~) main::$32 ← *((word*~) main::$74) >> (byte) 8
[104] (byte~) main::$48 ← (byte) main::sprite_idx#3 << (byte) 2
[105] *((byte*)(const struct SpriteData*) SPRITE_BUFFER + (byte~) main::$48) ← (byte)(word~) main::$32
[106] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_TILE + (byte~) main::$48) ← (byte) $a
[107] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_ATTRIBUTES + (byte~) main::$48) ← (byte) 3
[108] (word*~) main::$75 ← (word*)(const struct $0*) balls + (word~) main::$44
[109] (word~) main::$33 ← *((word*~) main::$75) >> (byte) 8
[110] *((byte*)(const struct SpriteData*) SPRITE_BUFFER+(const byte) OFFSET_STRUCT_SPRITEDATA_X + (byte~) main::$48) ← (byte)(word~) main::$33
[111] (byte) main::sprite_idx#2 ← ++ (byte) main::sprite_idx#3
[112] (word) main::i#4 ← ++ (word) main::i#10
to:main::@6
main::@25: scope:[main] from main::@15
[117] (byte) main::timer#21 ← (byte) main::timer#1
[113] (byte) main::timer#21 ← (byte) main::timer#1
to:main::@5
main::@2: scope:[main] from main::@1
[118] phi()
[119] call rand
[120] (word) rand::return#2 ← (word) rand::return#0
[114] phi()
[115] call rand
[116] (word) rand::return#2 ← (word) rand::return#0
to:main::@22
main::@22: scope:[main] from main::@2
[121] (word~) main::$9 ← (word) rand::return#2
[122] (word~) main::$10 ← (word~) main::$9 & (word) $3ff
[123] (word~) main::$35 ← (word) main::i#14 << (byte) 3
[124] (word*~) main::$59 ← (word*)(const struct $0*) balls+(byte) 4 + (word~) main::$35
[125] *((word*~) main::$59) ← (word~) main::$10
[126] call rand
[127] (word) rand::return#3 ← (word) rand::return#0
[117] (word~) main::$9 ← (word) rand::return#2
[118] (word~) main::$10 ← (word~) main::$9 & (word) $3ff
[119] (word~) main::$36 ← (word) main::i#14 << (byte) 3
[120] (word*~) main::$59 ← (word*)(const struct $0*) balls+(byte) 4 + (word~) main::$36
[121] *((word*~) main::$59) ← (word~) main::$10
[122] call rand
[123] (word) rand::return#3 ← (word) rand::return#0
to:main::@23
main::@23: scope:[main] from main::@22
[128] (word~) main::$11 ← (word) rand::return#3
[129] (byte~) main::$12 ← (word~) main::$11 & (byte) $ff
[130] (word~) main::$36 ← (word) main::i#14 << (byte) 3
[131] (word*~) main::$60 ← (word*)(const struct $0*) balls+(byte) 6 + (word~) main::$36
[132] *((word*~) main::$60) ← (byte~) main::$12
[133] (word) main::i#2 ← ++ (word) main::i#14
[124] (word~) main::$11 ← (word) rand::return#3
[125] (byte~) main::$12 ← (word~) main::$11 & (byte) $ff
[126] (word*~) main::$60 ← (word*)(const struct $0*) balls+(byte) 6 + (word~) main::$36
[127] *((word*~) main::$60) ← (byte~) main::$12
[128] (word) main::i#2 ← ++ (word) main::i#14
to:main::@1
(void()) ppuDataTransfer((nomodify void*) ppuDataTransfer::ppuData , (nomodify void*) ppuDataTransfer::cpuData , (word) ppuDataTransfer::size)
ppuDataTransfer: scope:[ppuDataTransfer] from main::@17 main::@21
[134] (nomodify void*) ppuDataTransfer::cpuData#2 ← phi( main::@17/(void*)(const to_nomodify byte*) palette main::@21/(void*)(const to_nomodify byte*) h_bar_tilemap )
[134] (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 ← phi( main::@17/(void*)(const nomodify byte*) PPU_PALETTE main::@21/(void*) 8256 )
[129] (nomodify void*) ppuDataTransfer::cpuData#2 ← phi( main::@17/(void*)(const to_nomodify byte*) palette main::@21/(void*)(const to_nomodify byte*) h_bar_tilemap )
[129] (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 ← phi( main::@17/(void*)(const nomodify byte*) PPU_PALETTE main::@21/(void*) 8256 )
to:ppuDataTransfer::ppuDataPrepare1
ppuDataTransfer::ppuDataPrepare1: scope:[ppuDataTransfer] from ppuDataTransfer
[135] (byte~) ppuDataTransfer::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0
[136] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataTransfer::ppuDataPrepare1_$0
[137] (byte~) ppuDataTransfer::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0
[138] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataTransfer::ppuDataPrepare1_$1
[130] (byte~) ppuDataTransfer::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0
[131] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataTransfer::ppuDataPrepare1_$0
[132] (byte~) ppuDataTransfer::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0
[133] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataTransfer::ppuDataPrepare1_$1
to:ppuDataTransfer::@3
ppuDataTransfer::@3: scope:[ppuDataTransfer] from ppuDataTransfer::ppuDataPrepare1
[139] (byte*) ppuDataTransfer::cpuSrc#6 ← (byte*)(nomodify void*) ppuDataTransfer::cpuData#2
[134] (byte*) ppuDataTransfer::cpuSrc#6 ← (byte*)(nomodify void*) ppuDataTransfer::cpuData#2
to:ppuDataTransfer::@1
ppuDataTransfer::@1: scope:[ppuDataTransfer] from ppuDataTransfer::@3 ppuDataTransfer::@4
[140] (byte*) ppuDataTransfer::cpuSrc#2 ← phi( ppuDataTransfer::@3/(byte*) ppuDataTransfer::cpuSrc#6 ppuDataTransfer::@4/(byte*) ppuDataTransfer::cpuSrc#1 )
[140] (word) ppuDataTransfer::i#2 ← phi( ppuDataTransfer::@3/(word) 0 ppuDataTransfer::@4/(word) ppuDataTransfer::i#1 )
[141] if((word) ppuDataTransfer::i#2<(byte) $20*(const byte) SIZEOF_BYTE) goto ppuDataTransfer::@2
[135] (byte*) ppuDataTransfer::cpuSrc#2 ← phi( ppuDataTransfer::@3/(byte*) ppuDataTransfer::cpuSrc#6 ppuDataTransfer::@4/(byte*) ppuDataTransfer::cpuSrc#1 )
[135] (word) ppuDataTransfer::i#2 ← phi( ppuDataTransfer::@3/(word) 0 ppuDataTransfer::@4/(word) ppuDataTransfer::i#1 )
[136] if((word) ppuDataTransfer::i#2<(byte) $20*(const byte) SIZEOF_BYTE) goto ppuDataTransfer::@2
to:ppuDataTransfer::@return
ppuDataTransfer::@return: scope:[ppuDataTransfer] from ppuDataTransfer::@1
[142] return
[137] return
to:@return
ppuDataTransfer::@2: scope:[ppuDataTransfer] from ppuDataTransfer::@1
[143] (byte) ppuDataTransfer::ppuDataPut1_val#0 ← *((byte*) ppuDataTransfer::cpuSrc#2)
[138] (byte) ppuDataTransfer::ppuDataPut1_val#0 ← *((byte*) ppuDataTransfer::cpuSrc#2)
to:ppuDataTransfer::ppuDataPut1
ppuDataTransfer::ppuDataPut1: scope:[ppuDataTransfer] from ppuDataTransfer::@2
[144] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataTransfer::ppuDataPut1_val#0
[139] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) ppuDataTransfer::ppuDataPut1_val#0
to:ppuDataTransfer::@4
ppuDataTransfer::@4: scope:[ppuDataTransfer] from ppuDataTransfer::ppuDataPut1
[145] (byte*) ppuDataTransfer::cpuSrc#1 ← ++ (byte*) ppuDataTransfer::cpuSrc#2
[146] (word) ppuDataTransfer::i#1 ← ++ (word) ppuDataTransfer::i#2
[140] (byte*) ppuDataTransfer::cpuSrc#1 ← ++ (byte*) ppuDataTransfer::cpuSrc#2
[141] (word) ppuDataTransfer::i#1 ← ++ (word) ppuDataTransfer::i#2
to:ppuDataTransfer::@1
(void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size)
ppuDataFill: scope:[ppuDataFill] from main::@19 main::@20
[147] (word) ppuDataFill::size#3 ← phi( main::@19/(word)(number) $20*(number) $1e main::@20/(byte) $40 )
[147] (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ← phi( main::@19/(void*)(const nomodify byte*) PPU_NAME_TABLE_0 main::@20/(void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 )
[142] (word) ppuDataFill::size#3 ← phi( main::@19/(word)(number) $20*(number) $1e main::@20/(byte) $40 )
[142] (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ← phi( main::@19/(void*)(const nomodify byte*) PPU_NAME_TABLE_0 main::@20/(void*)(const nomodify byte*) PPU_ATTRIBUTE_TABLE_0 )
to:ppuDataFill::ppuDataPrepare1
ppuDataFill::ppuDataPrepare1: scope:[ppuDataFill] from ppuDataFill
[148] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0
[149] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$0
[150] (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0
[151] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$1
[143] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0
[144] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$0
[145] (byte~) ppuDataFill::ppuDataPrepare1_$1 ← < (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0
[146] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUADDR) ← (byte~) ppuDataFill::ppuDataPrepare1_$1
to:ppuDataFill::@1
ppuDataFill::@1: scope:[ppuDataFill] from ppuDataFill::@2 ppuDataFill::ppuDataPrepare1
[152] (word) ppuDataFill::i#2 ← phi( ppuDataFill::ppuDataPrepare1/(word) 0 ppuDataFill::@2/(word) ppuDataFill::i#1 )
[153] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1
[147] (word) ppuDataFill::i#2 ← phi( ppuDataFill::ppuDataPrepare1/(word) 0 ppuDataFill::@2/(word) ppuDataFill::i#1 )
[148] if((word) ppuDataFill::i#2<(word) ppuDataFill::size#3) goto ppuDataFill::ppuDataPut1
to:ppuDataFill::@return
ppuDataFill::@return: scope:[ppuDataFill] from ppuDataFill::@1
[154] return
[149] return
to:@return
ppuDataFill::ppuDataPut1: scope:[ppuDataFill] from ppuDataFill::@1
[155] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) 0
[150] *((byte*)(const struct RICOH_2C02*) PPU+(const byte) OFFSET_STRUCT_RICOH_2C02_PPUDATA) ← (byte) 0
to:ppuDataFill::@2
ppuDataFill::@2: scope:[ppuDataFill] from ppuDataFill::ppuDataPut1
[156] (word) ppuDataFill::i#1 ← ++ (word) ppuDataFill::i#2
[151] (word) ppuDataFill::i#1 ← ++ (word) ppuDataFill::i#2
to:ppuDataFill::@1
(word()) rand()
rand: scope:[rand] from main::@2 main::@22
[157] (word) rand_state#10 ← phi( main::@2/(word) rand_state#17 main::@22/(word) rand_state#11 )
[158] (word~) rand::$0 ← (word) rand_state#10 << (byte) 7
[159] (word) rand_state#0 ← (word) rand_state#10 ^ (word~) rand::$0
[160] (word~) rand::$1 ← (word) rand_state#0 >> (byte) 9
[161] (word) rand_state#1 ← (word) rand_state#0 ^ (word~) rand::$1
[162] (word~) rand::$2 ← (word) rand_state#1 << (byte) 8
[163] (word) rand_state#11 ← (word) rand_state#1 ^ (word~) rand::$2
[164] (word) rand::return#0 ← (word) rand_state#11
[152] (word) rand_state#10 ← phi( main::@2/(word) rand_state#17 main::@22/(word) rand_state#11 )
[153] (word~) rand::$0 ← (word) rand_state#10 << (byte) 7
[154] (word) rand_state#0 ← (word) rand_state#10 ^ (word~) rand::$0
[155] (word~) rand::$1 ← (word) rand_state#0 >> (byte) 9
[156] (word) rand_state#1 ← (word) rand_state#0 ^ (word~) rand::$1
[157] (word~) rand::$2 ← (word) rand_state#1 << (byte) 8
[158] (word) rand_state#11 ← (word) rand_state#1 ^ (word~) rand::$2
[159] (word) rand::return#0 ← (word) rand_state#11
to:rand::@return
rand::@return: scope:[rand] from rand
[165] return
[160] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -75,28 +75,23 @@
(signed word()) main()
(word~) main::$10 zp[2]:54 67.33333333333333
(word~) main::$11 zp[2]:54 202.0
(byte~) main::$12 reg byte x 67.33333333333333
(byte~) main::$12 reg byte x 101.0
(byte~) main::$14 reg byte a 202.0
(word~) main::$20 zp[2]:15 2002.0
(word~) main::$20 zp[2]:33 2002.0
(word~) main::$23 zp[2]:39 500.5
(word~) main::$25 zp[2]:37 667.3333333333334
(byte~) main::$26 zp[1]:41 1001.0
(word~) main::$25 zp[2]:41 667.3333333333334
(byte~) main::$26 zp[1]:43 1001.0
(byte~) main::$30 reg byte a 1001.0
(word~) main::$31 zp[2]:48 1001.0
(word~) main::$32 zp[2]:52 500.5
(word~) main::$33 zp[2]:50 1001.0
(word~) main::$35 zp[2]:56 202.0
(word~) main::$36 zp[2]:58 202.0
(word~) main::$33 zp[2]:15 1001.0
(word~) main::$36 zp[2]:56 43.285714285714285
(byte~) main::$38 reg byte x 151.5
(word~) main::$40 zp[2]:15 834.1666666666666
(word~) main::$44 zp[2]:37 1001.0
(word~) main::$45 zp[2]:33 1501.5
(word~) main::$44 zp[2]:15 487.6666666666668
(byte~) main::$48 reg byte x 834.1666666666667
(word~) main::$50 zp[2]:50 429.0
(word~) main::$53 zp[2]:42 572.0
(word~) main::$56 zp[2]:48 2002.0
(word*~) main::$59 zp[2]:56 202.0
(word*~) main::$60 zp[2]:58 202.0
(word*~) main::$59 zp[2]:58 202.0
(word*~) main::$60 zp[2]:56 202.0
(word*~) main::$61 zp[2]:17 667.3333333333334
(word*~) main::$62 zp[2]:19 1001.0
(word*~) main::$63 zp[2]:21 2002.0
@ -105,16 +100,16 @@
(word*~) main::$66 zp[2]:27 667.3333333333334
(word*~) main::$67 zp[2]:29 1001.0
(word*~) main::$68 zp[2]:31 2002.0
(word*~) main::$69 zp[2]:15 2002.0
(word*~) main::$69 zp[2]:33 2002.0
(word*~) main::$70 zp[2]:39 2002.0
(word*~) main::$71 zp[2]:37 2002.0
(word*~) main::$71 zp[2]:41 2002.0
(word*~) main::$72 zp[2]:35 1001.0
(word*~) main::$73 zp[2]:33 2002.0
(word*~) main::$73 zp[2]:37 2002.0
(word*~) main::$74 zp[2]:52 2002.0
(word*~) main::$75 zp[2]:50 2002.0
(word*~) main::$75 zp[2]:15 2002.0
(word*~) main::$76 zp[2]:44 1001.0
(word*~) main::$77 zp[2]:46 2002.0
(word*~) main::$78 zp[2]:42 2002.0
(word*~) main::$78 zp[2]:50 2002.0
(word~) main::$9 zp[2]:54 202.0
(label) main::@1
(label) main::@10
@ -144,13 +139,13 @@
(byte) main::active_balls
(byte) main::active_balls#1 active_balls zp[1]:5 75.75
(byte) main::active_balls#2 active_balls zp[1]:5 56.11111111111111
(byte) main::active_balls#8 active_balls zp[1]:5 25.545454545454547
(byte) main::active_balls#8 active_balls zp[1]:5 27.54901960784314
(label) main::enableVideoOutput1
(byte) main::h_bar
(byte) main::h_bar#1 h_bar zp[1]:14 51.69354838709677
(byte) main::h_bar#1 h_bar zp[1]:14 55.258620689655174
(word) main::i
(word) main::i#10 i_1 zp[2]:7 163.42857142857142
(word) main::i#14 i zp[2]:2 29.705882352941178
(word) main::i#10 i_1 zp[2]:7 88.97777777777777
(word) main::i#14 i zp[2]:2 25.25
(word) main::i#2 i zp[2]:2 202.0
(word) main::i#4 i_1 zp[2]:7 2002.0
(label) main::initNES1
@ -171,14 +166,14 @@
(signed word) main::return
(byte) main::sprite_idx
(byte) main::sprite_idx#2 sprite_idx zp[1]:9 1001.0
(byte) main::sprite_idx#3 sprite_idx zp[1]:9 62.5625
(byte) main::sprite_idx#3 sprite_idx zp[1]:9 68.25
(byte) main::timer
(byte) main::timer#1 reg byte x 101.0
(byte) main::timer#15 timer zp[1]:6 5.50909090909091
(byte) main::timer#15 timer zp[1]:6 5.9411764705882355
(byte) main::timer#21 timer zp[1]:6 202.0
(byte) main::timer#3 timer zp[1]:6 57.714285714285715
(byte) main::timer_2
(byte) main::timer_2#1 timer_2 zp[1]:4 4.522388059701492
(byte) main::timer_2#1 timer_2 zp[1]:4 4.80952380952381
(byte) main::timer_2#2 timer_2 zp[1]:4 202.0
(const to_nomodify byte*) palette[] = { (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4 }
(void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size)
@ -247,7 +242,7 @@
(word) rand_state#0 rand_state zp[2]:10 1501.5
(word) rand_state#1 rand_state zp[2]:10 1501.5
(word) rand_state#10 rand_state zp[2]:10 1102.0
(word) rand_state#11 rand_state zp[2]:10 122.44444444444446
(word) rand_state#11 rand_state zp[2]:10 129.64705882352942
(word) rand_state#17 rand_state zp[2]:10 67.33333333333333
(volatile byte) scroll_y loadstore zp[1]:12 105.0
(const to_nomodify byte*) sine_table[(number) $100] = { (byte) $40, (byte) $42, (byte) $43, (byte) $45, (byte) $46, (byte) $48, (byte) $49, (byte) $4b, (byte) $4c, (byte) $4e, (byte) $50, (byte) $51, (byte) $53, (byte) $54, (byte) $56, (byte) $57, (byte) $58, (byte) $5a, (byte) $5b, (byte) $5d, (byte) $5e, (byte) $60, (byte) $61, (byte) $62, (byte) $64, (byte) $65, (byte) $66, (byte) $67, (byte) $69, (byte) $6a, (byte) $6b, (byte) $6c, (byte) $6d, (byte) $6e, (byte) $6f, (byte) $70, (byte) $71, (byte) $72, (byte) $73, (byte) $74, (byte) $75, (byte) $76, (byte) $77, (byte) $78, (byte) $78, (byte) $79, (byte) $7a, (byte) $7b, (byte) $7b, (byte) $7c, (byte) $7c, (byte) $7d, (byte) $7d, (byte) $7e, (byte) $7e, (byte) $7e, (byte) $7f, (byte) $7f, (byte) $7f, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $7f, (byte) $7f, (byte) $7f, (byte) $7e, (byte) $7e, (byte) $7e, (byte) $7d, (byte) $7d, (byte) $7c, (byte) $7c, (byte) $7b, (byte) $7b, (byte) $7a, (byte) $79, (byte) $78, (byte) $78, (byte) $77, (byte) $76, (byte) $75, (byte) $74, (byte) $73, (byte) $72, (byte) $71, (byte) $70, (byte) $6f, (byte) $6e, (byte) $6d, (byte) $6c, (byte) $6b, (byte) $6a, (byte) $69, (byte) $67, (byte) $66, (byte) $65, (byte) $64, (byte) $62, (byte) $61, (byte) $60, (byte) $5e, (byte) $5d, (byte) $5b, (byte) $5a, (byte) $58, (byte) $57, (byte) $56, (byte) $54, (byte) $53, (byte) $51, (byte) $50, (byte) $4e, (byte) $4c, (byte) $4b, (byte) $49, (byte) $48, (byte) $46, (byte) $45, (byte) $43, (byte) $42, (byte) $40, (byte) $3e, (byte) $3d, (byte) $3b, (byte) $3a, (byte) $38, (byte) $37, (byte) $35, (byte) $34, (byte) $32, (byte) $30, (byte) $2f, (byte) $2d, (byte) $2c, (byte) $2a, (byte) $29, (byte) $28, (byte) $26, (byte) $25, (byte) $23, (byte) $22, (byte) $20, (byte) $1f, (byte) $1e, (byte) $1c, (byte) $1b, (byte) $1a, (byte) $19, (byte) $17, (byte) $16, (byte) $15, (byte) $14, (byte) $13, (byte) $12, (byte) $11, (byte) $10, (byte) $f, (byte) $e, (byte) $d, (byte) $c, (byte) $b, (byte) $a, (byte) 9, (byte) 8, (byte) 8, (byte) 7, (byte) 6, (byte) 5, (byte) 5, (byte) 4, (byte) 4, (byte) 3, (byte) 3, (byte) 2, (byte) 2, (byte) 2, (byte) 1, (byte) 1, (byte) 1, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 1, (byte) 1, (byte) 1, (byte) 2, (byte) 2, (byte) 2, (byte) 3, (byte) 3, (byte) 4, (byte) 4, (byte) 5, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 8, (byte) 9, (byte) $a, (byte) $b, (byte) $c, (byte) $d, (byte) $e, (byte) $f, (byte) $10, (byte) $11, (byte) $12, (byte) $13, (byte) $14, (byte) $15, (byte) $16, (byte) $17, (byte) $19, (byte) $1a, (byte) $1b, (byte) $1c, (byte) $1e, (byte) $1f, (byte) $20, (byte) $22, (byte) $23, (byte) $25, (byte) $26, (byte) $28, (byte) $29, (byte) $2a, (byte) $2c, (byte) $2d, (byte) $2f, (byte) $30, (byte) $32, (byte) $34, (byte) $35, (byte) $37, (byte) $38, (byte) $3a, (byte) $3b, (byte) $3d, (byte) $3e }
@ -256,7 +251,7 @@ interrupt(HARDWARE_STACK)(void()) vblank()
(label) vblank::@return
(label) vblank::ppuSpriteBufferDmaTransfer1
(struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer
(volatile byte) vblank_hit loadstore zp[1]:13 8.65625
(volatile byte) vblank_hit loadstore zp[1]:13 9.008130081300813
reg byte x [ main::initNES1_i#2 main::initNES1_i#1 ]
zp[2]:2 [ main::i#14 main::i#2 ]
@ -274,7 +269,7 @@ zp[1]:14 [ main::h_bar#1 ]
reg byte a [ main::$14 ]
reg byte x [ main::timer#1 ]
reg byte x [ main::$38 ]
zp[2]:15 [ main::$40 main::$69 main::$20 ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataTransfer::ppuDataPrepare1_ppuData#0 ]
zp[2]:15 [ main::$44 main::$75 main::$33 ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataTransfer::ppuDataPrepare1_ppuData#0 ]
zp[2]:17 [ main::$61 ppuDataFill::size#3 ppuDataTransfer::cpuData#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#6 ppuDataTransfer::cpuSrc#1 ]
zp[2]:19 [ main::$62 ppuDataFill::i#2 ppuDataFill::i#1 ppuDataTransfer::i#2 ppuDataTransfer::i#1 ]
zp[2]:21 [ main::$63 ]
@ -283,23 +278,23 @@ zp[2]:25 [ main::$65 ]
zp[2]:27 [ main::$66 ]
zp[2]:29 [ main::$67 ]
zp[2]:31 [ main::$68 ]
zp[2]:33 [ main::$45 main::$73 ]
zp[2]:33 [ main::$69 main::$20 ]
zp[2]:35 [ main::$72 ]
zp[2]:37 [ main::$44 main::$71 main::$25 ]
zp[2]:37 [ main::$73 ]
zp[2]:39 [ main::$70 main::$23 ]
zp[1]:41 [ main::$26 ]
zp[2]:42 [ main::$53 main::$78 ]
zp[2]:41 [ main::$71 main::$25 ]
zp[1]:43 [ main::$26 ]
zp[2]:44 [ main::$76 ]
zp[2]:46 [ main::$77 ]
reg byte a [ main::$30 ]
zp[2]:48 [ main::$56 main::$31 ]
zp[2]:50 [ main::$50 main::$75 main::$33 ]
zp[2]:50 [ main::$78 ]
zp[2]:52 [ main::$74 main::$32 ]
reg byte x [ main::$48 ]
zp[2]:54 [ rand::return#2 main::$9 rand::return#0 main::$10 rand::return#3 main::$11 ]
zp[2]:56 [ main::$35 main::$59 ]
zp[2]:56 [ main::$36 main::$60 ]
zp[2]:58 [ main::$59 ]
reg byte x [ main::$12 ]
zp[2]:58 [ main::$36 main::$60 ]
reg byte a [ ppuDataTransfer::ppuDataPrepare1_$0 ]
reg byte a [ ppuDataTransfer::ppuDataPrepare1_$1 ]
reg byte a [ ppuDataTransfer::ppuDataPut1_val#0 ]

View File

@ -0,0 +1,13 @@
// Test boolean comparison false!=false
// https://atariage.com/forums/topic/311788-kickc-optimizing-c-compiler-now-supports-atari-8bit-xlxe/?tab=comments#comment-4644101
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
main: {
.label SCREEN = $400
// SCREEN[1] = '*'
lda #'*'
sta SCREEN+1
// }
rts
}

View File

@ -0,0 +1,11 @@
(void()) main()
main: scope:[main] from
[0] phi()
to:main::@1
main::@1: scope:[main] from main
[1] *((const byte*) main::SCREEN+(byte) 1) ← (byte) '*'
to:main::@return
main::@return: scope:[main] from main::@1
[2] return
to:@return

View File

@ -0,0 +1,207 @@
CONTROL FLOW GRAPH SSA
(void()) main()
main: scope:[main] from __start
(bool~) main::$0 ← ! false!=false
if((bool~) main::$0) goto main::@1
to:main::@2
main::@1: scope:[main] from main main::@2
(bool~) main::$1 ← ! true!=false
if((bool~) main::$1) goto main::@return
to:main::@3
main::@2: scope:[main] from main
*((const byte*) main::SCREEN + (number) 0) ← (byte) '*'
to:main::@1
main::@3: scope:[main] from main::@1
*((const byte*) main::SCREEN + (number) 1) ← (byte) '*'
to:main::@return
main::@return: scope:[main] from main::@1 main::@3
return
to:@return
(void()) __start()
__start: scope:[__start] from
call main
to:__start::@1
__start::@1: scope:[__start] from __start
to:__start::@return
__start::@return: scope:[__start] from __start::@1
return
to:@return
SYMBOL TABLE SSA
(void()) __start()
(label) __start::@1
(label) __start::@return
(void()) main()
(bool~) main::$0
(bool~) main::$1
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@return
(const byte*) main::SCREEN = (byte*)(number) $400
Adding number conversion cast (unumber) 0 in *((const byte*) main::SCREEN + (number) 0) ← (byte) '*'
Adding number conversion cast (unumber) 1 in *((const byte*) main::SCREEN + (number) 1) ← (byte) '*'
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant pointer cast (byte*) 1024
Simplifying constant integer cast 0
Simplifying constant integer cast 1
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 0
Finalized unsigned number type (byte) 1
Successful SSA optimization PassNFinalizeNumberTypeConversions
Rewriting ! if()-condition to reversed if() [0] (bool~) main::$0 ← ! false!=false
Rewriting ! if()-condition to reversed if() [2] (bool~) main::$1 ← ! true!=false
Successful SSA optimization Pass2ConditionalAndOrRewriting
if() condition always false - eliminating [1] if(false!=false) goto main::@2
if() condition always true - replacing block destination [3] if(true!=false) goto main::@3
Successful SSA optimization Pass2ConstantIfs
Simplifying expression containing zero main::SCREEN in [4] *((const byte*) main::SCREEN + (byte) 0) ← (byte) '*'
Successful SSA optimization PassNSimplifyExpressionWithZero
Removing unused block main::@2
Successful SSA optimization Pass2EliminateUnusedBlocks
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::@1
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Consolidated array index constant in *(main::SCREEN+1)
Successful SSA optimization Pass2ConstantAdditionElimination
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@1
CALL GRAPH
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Culled Empty Block (label) main::@1
Renumbering block main::@3 to main::@1
Adding NOP phi() at start of main
FINAL CONTROL FLOW GRAPH
(void()) main()
main: scope:[main] from
[0] phi()
to:main::@1
main::@1: scope:[main] from main
[1] *((const byte*) main::SCREEN+(byte) 1) ← (byte) '*'
to:main::@return
main::@return: scope:[main] from main::@1
[2] return
to:@return
VARIABLE REGISTER WEIGHTS
(void()) main()
Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
Target platform is c64basic / MOS6502X
// File Comments
// Test boolean comparison false!=false
// https://atariage.com/forums/topic/311788-kickc-optimizing-c-compiler-now-supports-atari-8bit-xlxe/?tab=comments#comment-4644101
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
// main
main: {
.label SCREEN = $400
jmp __b1
// main::@1
__b1:
// [1] *((const byte*) main::SCREEN+(byte) 1) ← (byte) '*' -- _deref_pbuc1=vbuc2
lda #'*'
sta SCREEN+1
jmp __breturn
// main::@return
__breturn:
// [2] return
rts
}
// File Data
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] *((const byte*) main::SCREEN+(byte) 1) ← (byte) '*' [ ] ( [ ] { } ) always clobbers reg byte a
REGISTER UPLIFT SCOPES
Uplift Scope [main]
Uplift Scope []
Uplifting [main] best 45 combination
Uplifting [] best 45 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Test boolean comparison false!=false
// https://atariage.com/forums/topic/311788-kickc-optimizing-c-compiler-now-supports-atari-8bit-xlxe/?tab=comments#comment-4644101
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
// main
main: {
.label SCREEN = $400
jmp __b1
// main::@1
__b1:
// [1] *((const byte*) main::SCREEN+(byte) 1) ← (byte) '*' -- _deref_pbuc1=vbuc2
lda #'*'
sta SCREEN+1
jmp __breturn
// main::@return
__breturn:
// [2] return
rts
}
// File Data
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
(void()) main()
(label) main::@1
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024
FINAL ASSEMBLER
Score: 12
// File Comments
// Test boolean comparison false!=false
// https://atariage.com/forums/topic/311788-kickc-optimizing-c-compiler-now-supports-atari-8bit-xlxe/?tab=comments#comment-4644101
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
// main
main: {
.label SCREEN = $400
// main::@1
// SCREEN[1] = '*'
// [1] *((const byte*) main::SCREEN+(byte) 1) ← (byte) '*' -- _deref_pbuc1=vbuc2
lda #'*'
sta SCREEN+1
// main::@return
// }
// [2] return
rts
}
// File Data

View File

@ -0,0 +1,5 @@
(void()) main()
(label) main::@1
(label) main::@return
(const byte*) main::SCREEN = (byte*) 1024