1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-02-17 10:30:43 +00:00

Improved duplicate assignment right side optimization slightly.

This commit is contained in:
jespergravgaard 2019-05-22 08:19:43 +02:00
parent 2c808e59d6
commit 67db0f0f6f
6 changed files with 31 additions and 40 deletions

View File

@ -111,10 +111,6 @@ public class Pass2DuplicateRValueIdentification extends Pass2SsaOptimization {
if(operator instanceof OperatorCast) return true; if(operator instanceof OperatorCast) return true;
if(operator.equals(Operators.PLUS)) return true; if(operator.equals(Operators.PLUS)) return true;
if(operator.equals(Operators.MINUS)) return true; if(operator.equals(Operators.MINUS)) return true;
if(operator.equals(Operators.BOOL_AND)) return true;
if(operator.equals(Operators.BOOL_OR)) return true;
if(operator.equals(Operators.BOOL_XOR)) return true;
if(operator.equals(Operators.BOOL_NOT)) return true;
if(operator.equals(Operators.LE)) return true; if(operator.equals(Operators.LE)) return true;
if(operator.equals(Operators.LT)) return true; if(operator.equals(Operators.LT)) return true;
if(operator.equals(Operators.GE)) return true; if(operator.equals(Operators.GE)) return true;
@ -122,6 +118,8 @@ public class Pass2DuplicateRValueIdentification extends Pass2SsaOptimization {
if(operator.equals(Operators.EQ)) return true; if(operator.equals(Operators.EQ)) return true;
if(operator.equals(Operators.NEQ)) return true; if(operator.equals(Operators.NEQ)) return true;
if(operator.equals(Operators.LOGIC_NOT)) return true; if(operator.equals(Operators.LOGIC_NOT)) return true;
if(operator.equals(Operators.LOGIC_AND)) return true;
if(operator.equals(Operators.LOGIC_OR)) return true;
return false; return false;
} }

View File

@ -81,7 +81,7 @@ plot: {
rts rts
} }
init_plot_tables: { init_plot_tables: {
.label _6 = 4 .label _10 = 4
.label yoffs = 2 .label yoffs = 2
ldy #$80 ldy #$80
ldx #0 ldx #0
@ -109,15 +109,14 @@ init_plot_tables: {
tax tax
b3: b3:
lda #7 lda #7
sax _6 sax _10
lda yoffs lda yoffs
ora _6 ora _10
sta plot_ylo,x sta plot_ylo,x
lda yoffs+1 lda yoffs+1
sta plot_yhi,x sta plot_yhi,x
txa lda #7
and #7 cmp _10
cmp #7
bne b4 bne b4
clc clc
lda yoffs lda yoffs

View File

@ -11,34 +11,31 @@ main: {
} }
bool_complex: { bool_complex: {
.label screen = $478 .label screen = $478
ldy #0 ldx #0
b1: b1:
ldx #1 txa
tya
axs #0
tya
and #1 and #1
cpy #$a cpx #$a
bcc b6 bcc b6
b5: b5:
cpy #$a cpx #$a
bcc b4 bcc b4
cmp #0 cmp #0
beq b4 beq b4
b2: b2:
lda #'*' lda #'*'
sta screen,y sta screen,x
b3: b3:
iny inx
cpy #$15 cpx #$15
bne b1 bne b1
rts rts
b4: b4:
lda #' ' lda #' '
sta screen,y sta screen,x
jmp b3 jmp b3
b6: b6:
cpx #0 cmp #0
beq b2 beq b2
jmp b5 jmp b5
} }

View File

@ -364,7 +364,7 @@ bitmap_clear: {
} }
// Initialize the bitmap plotter tables for a specific bitmap // Initialize the bitmap plotter tables for a specific bitmap
bitmap_init: { bitmap_init: {
.label _6 = 2 .label _10 = 2
.label yoffs = 9 .label yoffs = 9
ldy #$80 ldy #$80
ldx #0 ldx #0
@ -392,15 +392,14 @@ bitmap_init: {
tax tax
b3: b3:
lda #7 lda #7
sax _6 sax _10
lda yoffs lda yoffs
ora _6 ora _10
sta bitmap_plot_ylo,x sta bitmap_plot_ylo,x
lda yoffs+1 lda yoffs+1
sta bitmap_plot_yhi,x sta bitmap_plot_yhi,x
txa lda #7
and #7 cmp _10
cmp #7
bne b4 bne b4
clc clc
lda yoffs lda yoffs

View File

@ -757,7 +757,7 @@ bitmap_clear: {
} }
// Initialize bitmap plotting tables // Initialize bitmap plotting tables
bitmap_init: { bitmap_init: {
.label _3 = $16 .label _7 = $16
.label yoffs = 2 .label yoffs = 2
ldx #0 ldx #0
lda #$80 lda #$80
@ -778,15 +778,14 @@ bitmap_init: {
ldx #0 ldx #0
b3: b3:
lda #7 lda #7
sax _3 sax _7
lda yoffs lda yoffs
ora _3 ora _7
sta bitmap_plot_ylo,x sta bitmap_plot_ylo,x
lda yoffs+1 lda yoffs+1
sta bitmap_plot_yhi,x sta bitmap_plot_yhi,x
txa lda #7
and #7 cmp _7
cmp #7
bne b4 bne b4
clc clc
lda yoffs lda yoffs

View File

@ -455,7 +455,7 @@ bitmap_clear: {
rts rts
} }
bitmap_init: { bitmap_init: {
.label _3 = 2 .label _7 = 2
.label yoffs = 3 .label yoffs = 3
ldx #0 ldx #0
lda #$80 lda #$80
@ -476,15 +476,14 @@ bitmap_init: {
ldx #0 ldx #0
b3: b3:
lda #7 lda #7
sax _3 sax _7
lda yoffs lda yoffs
ora _3 ora _7
sta bitmap_plot_ylo,x sta bitmap_plot_ylo,x
lda yoffs+1 lda yoffs+1
sta bitmap_plot_yhi,x sta bitmap_plot_yhi,x
txa lda #7
and #7 cmp _7
cmp #7
bne b4 bne b4
clc clc
lda yoffs lda yoffs