mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-02-21 07:29:14 +00:00
Fixed error "Type inference case not handled byte* + byte*" that occurs when constant addition optimization changes the sequence of addition between pointers and integers.
This commit is contained in:
parent
ffa0ae17d0
commit
566a6c0ffc
@ -1398,6 +1398,231 @@ asw {z1}
|
|||||||
asw {z1}
|
asw {z1}
|
||||||
asw {z1}
|
asw {z1}
|
||||||
asw {z1}
|
asw {z1}
|
||||||
|
//FRAGMENT vwuz1=vwuc1
|
||||||
|
lda #<{c1}
|
||||||
|
sta {z1}
|
||||||
|
lda #>{c1}
|
||||||
|
sta {z1}+1
|
||||||
|
//FRAGMENT pwuz1=pbuc1
|
||||||
|
lda #<{c1}
|
||||||
|
sta {z1}
|
||||||
|
lda #>{c1}
|
||||||
|
sta {z1}+1
|
||||||
|
//FRAGMENT pbuz1=pbuz1_plus_vwuc1
|
||||||
|
clc
|
||||||
|
lda {z1}
|
||||||
|
adc #<{c1}
|
||||||
|
sta {z1}
|
||||||
|
lda {z1}+1
|
||||||
|
adc #>{c1}
|
||||||
|
sta {z1}+1
|
||||||
|
//FRAGMENT pbuz1_derefidx_vbuz2=pbuz3_derefidx_vbuz2
|
||||||
|
ldy {z2}
|
||||||
|
lda ({z3}),y
|
||||||
|
sta ({z1}),y
|
||||||
|
//FRAGMENT pwuz1=pwuz1_plus_vbuc1
|
||||||
|
lda #{c1}
|
||||||
|
clc
|
||||||
|
adc {z1}
|
||||||
|
sta {z1}
|
||||||
|
bcc !+
|
||||||
|
inc {z1}+1
|
||||||
|
!:
|
||||||
|
//FRAGMENT vbuz1=vbuz2_rol_1
|
||||||
|
lda {z2}
|
||||||
|
asl
|
||||||
|
sta {z1}
|
||||||
|
//FRAGMENT pwuz1_derefidx_vbuz2=vwuz3
|
||||||
|
ldy {z2}
|
||||||
|
lda {z3}
|
||||||
|
sta ({z1}),y
|
||||||
|
iny
|
||||||
|
lda {z3}+1
|
||||||
|
sta ({z1}),y
|
||||||
|
//FRAGMENT vwuz1=vwuz1_plus_vbuc1
|
||||||
|
lda #{c1}
|
||||||
|
clc
|
||||||
|
adc {z1}
|
||||||
|
sta {z1}
|
||||||
|
bcc !+
|
||||||
|
inc {z1}+1
|
||||||
|
!:
|
||||||
|
//FRAGMENT _deref_pwuc1=vwuz1
|
||||||
|
lda {z1}
|
||||||
|
sta {c1}
|
||||||
|
lda {z1}+1
|
||||||
|
sta {c1}+1
|
||||||
|
//FRAGMENT _deref_qbuc1=_ptr_vbuz1
|
||||||
|
lda {z1}
|
||||||
|
sta {c1}
|
||||||
|
lda #0
|
||||||
|
sta {c1}+1
|
||||||
|
//FRAGMENT _deref_qbuc1=pbuz1
|
||||||
|
lda {z1}
|
||||||
|
sta {c1}
|
||||||
|
lda {z1}+1
|
||||||
|
sta {c1}+1
|
||||||
|
//FRAGMENT _deref_pwuc1=vwuc2
|
||||||
|
lda #<{c2}
|
||||||
|
sta {c1}
|
||||||
|
lda #>{c2}
|
||||||
|
sta {c1}+1
|
||||||
|
//FRAGMENT _deref_qbuc1=pbuc2
|
||||||
|
lda #<{c2}
|
||||||
|
sta {c1}
|
||||||
|
lda #>{c2}
|
||||||
|
sta {c1}+1
|
||||||
|
//FRAGMENT pbuz1_derefidx_vbuaa=pbuz2_derefidx_vbuaa
|
||||||
|
tay
|
||||||
|
lda ({z2}),y
|
||||||
|
sta ({z1}),y
|
||||||
|
//FRAGMENT pbuz1_derefidx_vbuxx=pbuz2_derefidx_vbuxx
|
||||||
|
txa
|
||||||
|
tay
|
||||||
|
lda ({z2}),y
|
||||||
|
sta ({z1}),y
|
||||||
|
//FRAGMENT pbuz1_derefidx_vbuyy=pbuz2_derefidx_vbuyy
|
||||||
|
lda ({z2}),y
|
||||||
|
sta ({z1}),y
|
||||||
|
//FRAGMENT pbuz1_derefidx_vbuzz=pbuz2_derefidx_vbuzz
|
||||||
|
tza
|
||||||
|
tay
|
||||||
|
lda ({z2}),y
|
||||||
|
sta ({z1}),y
|
||||||
|
//FRAGMENT vwuz1=_word_vbuaa
|
||||||
|
sta {z1}
|
||||||
|
lda #0
|
||||||
|
sta {z1}+1
|
||||||
|
//FRAGMENT vbuz1=vbuaa_rol_1
|
||||||
|
asl
|
||||||
|
sta {z1}
|
||||||
|
//FRAGMENT vbuz1=vbuxx_rol_1
|
||||||
|
txa
|
||||||
|
asl
|
||||||
|
sta {z1}
|
||||||
|
//FRAGMENT vbuz1=vbuyy_rol_1
|
||||||
|
tya
|
||||||
|
asl
|
||||||
|
sta {z1}
|
||||||
|
//FRAGMENT vbuz1=vbuzz_rol_1
|
||||||
|
tza
|
||||||
|
asl
|
||||||
|
sta {z1}
|
||||||
|
//FRAGMENT vbuaa=vbuz1_rol_1
|
||||||
|
lda {z1}
|
||||||
|
asl
|
||||||
|
//FRAGMENT vbuaa=vbuaa_rol_1
|
||||||
|
asl
|
||||||
|
//FRAGMENT vbuaa=vbuxx_rol_1
|
||||||
|
txa
|
||||||
|
asl
|
||||||
|
//FRAGMENT vbuaa=vbuyy_rol_1
|
||||||
|
tya
|
||||||
|
asl
|
||||||
|
//FRAGMENT vbuaa=vbuzz_rol_1
|
||||||
|
tza
|
||||||
|
asl
|
||||||
|
//FRAGMENT vbuxx=vbuz1_rol_1
|
||||||
|
lda {z1}
|
||||||
|
asl
|
||||||
|
tax
|
||||||
|
//FRAGMENT vbuxx=vbuaa_rol_1
|
||||||
|
asl
|
||||||
|
tax
|
||||||
|
//FRAGMENT vbuxx=vbuxx_rol_1
|
||||||
|
txa
|
||||||
|
asl
|
||||||
|
tax
|
||||||
|
//FRAGMENT vbuxx=vbuyy_rol_1
|
||||||
|
tya
|
||||||
|
asl
|
||||||
|
tax
|
||||||
|
//FRAGMENT vbuxx=vbuzz_rol_1
|
||||||
|
tza
|
||||||
|
asl
|
||||||
|
tax
|
||||||
|
//FRAGMENT vbuyy=vbuz1_rol_1
|
||||||
|
lda {z1}
|
||||||
|
asl
|
||||||
|
tay
|
||||||
|
//FRAGMENT vbuyy=vbuaa_rol_1
|
||||||
|
asl
|
||||||
|
tay
|
||||||
|
//FRAGMENT vbuyy=vbuxx_rol_1
|
||||||
|
txa
|
||||||
|
asl
|
||||||
|
tay
|
||||||
|
//FRAGMENT vbuyy=vbuyy_rol_1
|
||||||
|
tya
|
||||||
|
asl
|
||||||
|
tay
|
||||||
|
//FRAGMENT vbuyy=vbuzz_rol_1
|
||||||
|
tza
|
||||||
|
asl
|
||||||
|
tay
|
||||||
|
//FRAGMENT vbuzz=vbuz1_rol_1
|
||||||
|
lda {z1}
|
||||||
|
asl
|
||||||
|
taz
|
||||||
|
//FRAGMENT vbuzz=vbuaa_rol_1
|
||||||
|
asl
|
||||||
|
taz
|
||||||
|
//FRAGMENT vbuzz=vbuxx_rol_1
|
||||||
|
txa
|
||||||
|
asl
|
||||||
|
taz
|
||||||
|
//FRAGMENT vbuzz=vbuyy_rol_1
|
||||||
|
tya
|
||||||
|
asl
|
||||||
|
taz
|
||||||
|
//FRAGMENT vbuzz=vbuzz_rol_1
|
||||||
|
tza
|
||||||
|
asl
|
||||||
|
taz
|
||||||
|
//FRAGMENT pwuz1_derefidx_vbuaa=vwuz2
|
||||||
|
tay
|
||||||
|
lda {z2}
|
||||||
|
sta ({z1}),y
|
||||||
|
iny
|
||||||
|
lda {z2}+1
|
||||||
|
sta ({z1}),y
|
||||||
|
//FRAGMENT pwuz1_derefidx_vbuxx=vwuz2
|
||||||
|
txa
|
||||||
|
tay
|
||||||
|
lda {z2}
|
||||||
|
sta ({z1}),y
|
||||||
|
iny
|
||||||
|
lda {z2}+1
|
||||||
|
sta ({z1}),y
|
||||||
|
//FRAGMENT pwuz1_derefidx_vbuyy=vwuz2
|
||||||
|
lda {z2}
|
||||||
|
sta ({z1}),y
|
||||||
|
iny
|
||||||
|
lda {z2}+1
|
||||||
|
sta ({z1}),y
|
||||||
|
//FRAGMENT pwuz1_derefidx_vbuzz=vwuz2
|
||||||
|
tza
|
||||||
|
tay
|
||||||
|
lda {z2}
|
||||||
|
sta ({z1}),y
|
||||||
|
iny
|
||||||
|
lda {z2}+1
|
||||||
|
sta ({z1}),y
|
||||||
|
//FRAGMENT _deref_qbuc1=_ptr_vbuxx
|
||||||
|
txa
|
||||||
|
sta {c1}
|
||||||
|
lda #0
|
||||||
|
sta {c1}+1
|
||||||
|
//FRAGMENT _deref_qbuc1=_ptr_vbuyy
|
||||||
|
tya
|
||||||
|
sta {c1}
|
||||||
|
lda #0
|
||||||
|
sta {c1}+1
|
||||||
|
//FRAGMENT _deref_qbuc1=_ptr_vbuzz
|
||||||
|
tza
|
||||||
|
sta {c1}
|
||||||
|
lda #0
|
||||||
|
sta {c1}+1
|
||||||
//FRAGMENT _deref_pbuc1=_inc__deref_pbuc1
|
//FRAGMENT _deref_pbuc1=_inc__deref_pbuc1
|
||||||
inc {c1}
|
inc {c1}
|
||||||
//FRAGMENT vwuz1=vbuc1
|
//FRAGMENT vwuz1=vbuc1
|
||||||
@ -1414,11 +1639,6 @@ dec {c1}
|
|||||||
//FRAGMENT pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
|
//FRAGMENT pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
|
||||||
ldx {z1}
|
ldx {z1}
|
||||||
inc {c1},x
|
inc {c1},x
|
||||||
//FRAGMENT vwuz1=vwuc1
|
|
||||||
lda #<{c1}
|
|
||||||
sta {z1}
|
|
||||||
lda #>{c1}
|
|
||||||
sta {z1}+1
|
|
||||||
//FRAGMENT vbuz1=_lo_vwuz2
|
//FRAGMENT vbuz1=_lo_vwuz2
|
||||||
lda {z2}
|
lda {z2}
|
||||||
sta {z1}
|
sta {z1}
|
||||||
@ -1429,16 +1649,6 @@ sta {z1}
|
|||||||
lda {z2}
|
lda {z2}
|
||||||
ora {z3}
|
ora {z3}
|
||||||
sta {z1}
|
sta {z1}
|
||||||
//FRAGMENT _deref_pwuc1=vwuc2
|
|
||||||
lda #<{c2}
|
|
||||||
sta {c1}
|
|
||||||
lda #>{c2}
|
|
||||||
sta {c1}+1
|
|
||||||
//FRAGMENT _deref_qbuc1=pbuc2
|
|
||||||
lda #<{c2}
|
|
||||||
sta {c1}
|
|
||||||
lda #>{c2}
|
|
||||||
sta {c1}+1
|
|
||||||
//FRAGMENT _deref_pbuc1_eq_vbuaa_then_la1
|
//FRAGMENT _deref_pbuc1_eq_vbuaa_then_la1
|
||||||
cmp {c1}
|
cmp {c1}
|
||||||
beq {la1}
|
beq {la1}
|
||||||
@ -2399,213 +2609,3 @@ sta {z1}+3
|
|||||||
NO_SYNTHESIS
|
NO_SYNTHESIS
|
||||||
//FRAGMENT vduz1=vwsc1
|
//FRAGMENT vduz1=vwsc1
|
||||||
NO_SYNTHESIS
|
NO_SYNTHESIS
|
||||||
//FRAGMENT pwuz1=pbuc1
|
|
||||||
lda #<{c1}
|
|
||||||
sta {z1}
|
|
||||||
lda #>{c1}
|
|
||||||
sta {z1}+1
|
|
||||||
//FRAGMENT pbuz1=pbuz1_plus_vwuc1
|
|
||||||
clc
|
|
||||||
lda {z1}
|
|
||||||
adc #<{c1}
|
|
||||||
sta {z1}
|
|
||||||
lda {z1}+1
|
|
||||||
adc #>{c1}
|
|
||||||
sta {z1}+1
|
|
||||||
//FRAGMENT pbuz1_derefidx_vbuz2=pbuz3_derefidx_vbuz2
|
|
||||||
ldy {z2}
|
|
||||||
lda ({z3}),y
|
|
||||||
sta ({z1}),y
|
|
||||||
//FRAGMENT pwuz1=pwuz1_plus_vbuc1
|
|
||||||
lda #{c1}
|
|
||||||
clc
|
|
||||||
adc {z1}
|
|
||||||
sta {z1}
|
|
||||||
bcc !+
|
|
||||||
inc {z1}+1
|
|
||||||
!:
|
|
||||||
//FRAGMENT vbuz1=vbuz2_rol_1
|
|
||||||
lda {z2}
|
|
||||||
asl
|
|
||||||
sta {z1}
|
|
||||||
//FRAGMENT pwuz1_derefidx_vbuz2=vwuz3
|
|
||||||
ldy {z2}
|
|
||||||
lda {z3}
|
|
||||||
sta ({z1}),y
|
|
||||||
iny
|
|
||||||
lda {z3}+1
|
|
||||||
sta ({z1}),y
|
|
||||||
//FRAGMENT vwuz1=vwuz1_plus_vbuc1
|
|
||||||
lda #{c1}
|
|
||||||
clc
|
|
||||||
adc {z1}
|
|
||||||
sta {z1}
|
|
||||||
bcc !+
|
|
||||||
inc {z1}+1
|
|
||||||
!:
|
|
||||||
//FRAGMENT _deref_pwuc1=vwuz1
|
|
||||||
lda {z1}
|
|
||||||
sta {c1}
|
|
||||||
lda {z1}+1
|
|
||||||
sta {c1}+1
|
|
||||||
//FRAGMENT _deref_qbuc1=_ptr_vbuz1
|
|
||||||
lda {z1}
|
|
||||||
sta {c1}
|
|
||||||
lda #0
|
|
||||||
sta {c1}+1
|
|
||||||
//FRAGMENT _deref_qbuc1=pbuz1
|
|
||||||
lda {z1}
|
|
||||||
sta {c1}
|
|
||||||
lda {z1}+1
|
|
||||||
sta {c1}+1
|
|
||||||
//FRAGMENT pbuz1_derefidx_vbuaa=pbuz2_derefidx_vbuaa
|
|
||||||
tay
|
|
||||||
lda ({z2}),y
|
|
||||||
sta ({z1}),y
|
|
||||||
//FRAGMENT pbuz1_derefidx_vbuxx=pbuz2_derefidx_vbuxx
|
|
||||||
txa
|
|
||||||
tay
|
|
||||||
lda ({z2}),y
|
|
||||||
sta ({z1}),y
|
|
||||||
//FRAGMENT pbuz1_derefidx_vbuyy=pbuz2_derefidx_vbuyy
|
|
||||||
lda ({z2}),y
|
|
||||||
sta ({z1}),y
|
|
||||||
//FRAGMENT pbuz1_derefidx_vbuzz=pbuz2_derefidx_vbuzz
|
|
||||||
tza
|
|
||||||
tay
|
|
||||||
lda ({z2}),y
|
|
||||||
sta ({z1}),y
|
|
||||||
//FRAGMENT vwuz1=_word_vbuaa
|
|
||||||
sta {z1}
|
|
||||||
lda #0
|
|
||||||
sta {z1}+1
|
|
||||||
//FRAGMENT vbuz1=vbuaa_rol_1
|
|
||||||
asl
|
|
||||||
sta {z1}
|
|
||||||
//FRAGMENT vbuz1=vbuxx_rol_1
|
|
||||||
txa
|
|
||||||
asl
|
|
||||||
sta {z1}
|
|
||||||
//FRAGMENT vbuz1=vbuyy_rol_1
|
|
||||||
tya
|
|
||||||
asl
|
|
||||||
sta {z1}
|
|
||||||
//FRAGMENT vbuz1=vbuzz_rol_1
|
|
||||||
tza
|
|
||||||
asl
|
|
||||||
sta {z1}
|
|
||||||
//FRAGMENT vbuaa=vbuz1_rol_1
|
|
||||||
lda {z1}
|
|
||||||
asl
|
|
||||||
//FRAGMENT vbuaa=vbuaa_rol_1
|
|
||||||
asl
|
|
||||||
//FRAGMENT vbuaa=vbuxx_rol_1
|
|
||||||
txa
|
|
||||||
asl
|
|
||||||
//FRAGMENT vbuaa=vbuyy_rol_1
|
|
||||||
tya
|
|
||||||
asl
|
|
||||||
//FRAGMENT vbuaa=vbuzz_rol_1
|
|
||||||
tza
|
|
||||||
asl
|
|
||||||
//FRAGMENT vbuxx=vbuz1_rol_1
|
|
||||||
lda {z1}
|
|
||||||
asl
|
|
||||||
tax
|
|
||||||
//FRAGMENT vbuxx=vbuaa_rol_1
|
|
||||||
asl
|
|
||||||
tax
|
|
||||||
//FRAGMENT vbuxx=vbuxx_rol_1
|
|
||||||
txa
|
|
||||||
asl
|
|
||||||
tax
|
|
||||||
//FRAGMENT vbuxx=vbuyy_rol_1
|
|
||||||
tya
|
|
||||||
asl
|
|
||||||
tax
|
|
||||||
//FRAGMENT vbuxx=vbuzz_rol_1
|
|
||||||
tza
|
|
||||||
asl
|
|
||||||
tax
|
|
||||||
//FRAGMENT vbuyy=vbuz1_rol_1
|
|
||||||
lda {z1}
|
|
||||||
asl
|
|
||||||
tay
|
|
||||||
//FRAGMENT vbuyy=vbuaa_rol_1
|
|
||||||
asl
|
|
||||||
tay
|
|
||||||
//FRAGMENT vbuyy=vbuxx_rol_1
|
|
||||||
txa
|
|
||||||
asl
|
|
||||||
tay
|
|
||||||
//FRAGMENT vbuyy=vbuyy_rol_1
|
|
||||||
tya
|
|
||||||
asl
|
|
||||||
tay
|
|
||||||
//FRAGMENT vbuyy=vbuzz_rol_1
|
|
||||||
tza
|
|
||||||
asl
|
|
||||||
tay
|
|
||||||
//FRAGMENT vbuzz=vbuz1_rol_1
|
|
||||||
lda {z1}
|
|
||||||
asl
|
|
||||||
taz
|
|
||||||
//FRAGMENT vbuzz=vbuaa_rol_1
|
|
||||||
asl
|
|
||||||
taz
|
|
||||||
//FRAGMENT vbuzz=vbuxx_rol_1
|
|
||||||
txa
|
|
||||||
asl
|
|
||||||
taz
|
|
||||||
//FRAGMENT vbuzz=vbuyy_rol_1
|
|
||||||
tya
|
|
||||||
asl
|
|
||||||
taz
|
|
||||||
//FRAGMENT vbuzz=vbuzz_rol_1
|
|
||||||
tza
|
|
||||||
asl
|
|
||||||
taz
|
|
||||||
//FRAGMENT pwuz1_derefidx_vbuaa=vwuz2
|
|
||||||
tay
|
|
||||||
lda {z2}
|
|
||||||
sta ({z1}),y
|
|
||||||
iny
|
|
||||||
lda {z2}+1
|
|
||||||
sta ({z1}),y
|
|
||||||
//FRAGMENT pwuz1_derefidx_vbuxx=vwuz2
|
|
||||||
txa
|
|
||||||
tay
|
|
||||||
lda {z2}
|
|
||||||
sta ({z1}),y
|
|
||||||
iny
|
|
||||||
lda {z2}+1
|
|
||||||
sta ({z1}),y
|
|
||||||
//FRAGMENT pwuz1_derefidx_vbuyy=vwuz2
|
|
||||||
lda {z2}
|
|
||||||
sta ({z1}),y
|
|
||||||
iny
|
|
||||||
lda {z2}+1
|
|
||||||
sta ({z1}),y
|
|
||||||
//FRAGMENT pwuz1_derefidx_vbuzz=vwuz2
|
|
||||||
tza
|
|
||||||
tay
|
|
||||||
lda {z2}
|
|
||||||
sta ({z1}),y
|
|
||||||
iny
|
|
||||||
lda {z2}+1
|
|
||||||
sta ({z1}),y
|
|
||||||
//FRAGMENT _deref_qbuc1=_ptr_vbuxx
|
|
||||||
txa
|
|
||||||
sta {c1}
|
|
||||||
lda #0
|
|
||||||
sta {c1}+1
|
|
||||||
//FRAGMENT _deref_qbuc1=_ptr_vbuyy
|
|
||||||
tya
|
|
||||||
sta {c1}
|
|
||||||
lda #0
|
|
||||||
sta {c1}+1
|
|
||||||
//FRAGMENT _deref_qbuc1=_ptr_vbuzz
|
|
||||||
tza
|
|
||||||
sta {c1}
|
|
||||||
lda #0
|
|
||||||
sta {c1}+1
|
|
||||||
|
2178
src/main/fragment/cache/fragment-cache-mos6502x.asm
vendored
2178
src/main/fragment/cache/fragment-cache-mos6502x.asm
vendored
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,9 @@
|
|||||||
package dk.camelot64.kickc.passes;
|
package dk.camelot64.kickc.passes;
|
||||||
|
|
||||||
import dk.camelot64.kickc.model.*;
|
import dk.camelot64.kickc.model.ConstantNotLiteral;
|
||||||
|
import dk.camelot64.kickc.model.ControlFlowBlock;
|
||||||
|
import dk.camelot64.kickc.model.Program;
|
||||||
|
import dk.camelot64.kickc.model.VariableReferenceInfos;
|
||||||
import dk.camelot64.kickc.model.iterator.ProgramValue;
|
import dk.camelot64.kickc.model.iterator.ProgramValue;
|
||||||
import dk.camelot64.kickc.model.iterator.ProgramValueIterator;
|
import dk.camelot64.kickc.model.iterator.ProgramValueIterator;
|
||||||
import dk.camelot64.kickc.model.operators.Operator;
|
import dk.camelot64.kickc.model.operators.Operator;
|
||||||
@ -9,6 +12,7 @@ import dk.camelot64.kickc.model.statements.Statement;
|
|||||||
import dk.camelot64.kickc.model.statements.StatementAssignment;
|
import dk.camelot64.kickc.model.statements.StatementAssignment;
|
||||||
import dk.camelot64.kickc.model.statements.StatementLValue;
|
import dk.camelot64.kickc.model.statements.StatementLValue;
|
||||||
import dk.camelot64.kickc.model.symbols.Variable;
|
import dk.camelot64.kickc.model.symbols.Variable;
|
||||||
|
import dk.camelot64.kickc.model.types.SymbolType;
|
||||||
import dk.camelot64.kickc.model.values.*;
|
import dk.camelot64.kickc.model.values.*;
|
||||||
import dk.camelot64.kickc.passes.utils.VarAssignments;
|
import dk.camelot64.kickc.passes.utils.VarAssignments;
|
||||||
|
|
||||||
@ -204,9 +208,12 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
|
|||||||
if(assignment.getOperator() != null && "+".equals(assignment.getOperator().getOperator())) {
|
if(assignment.getOperator() != null && "+".equals(assignment.getOperator().getOperator())) {
|
||||||
if(assignment.getrValue1() instanceof ConstantValue) {
|
if(assignment.getrValue1() instanceof ConstantValue) {
|
||||||
ConstantValue constant = (ConstantValue) assignment.getrValue1();
|
ConstantValue constant = (ConstantValue) assignment.getrValue1();
|
||||||
assignment.setrValue1(null);
|
SymbolType constantType = constant.getType(getScope());
|
||||||
assignment.setOperator(null);
|
if(SymbolType.isInteger(constantType)) {
|
||||||
return constant;
|
assignment.setrValue1(null);
|
||||||
|
assignment.setOperator(null);
|
||||||
|
return constant;
|
||||||
|
}
|
||||||
} else if(assignment.getrValue2() instanceof ConstantValue) {
|
} else if(assignment.getrValue2() instanceof ConstantValue) {
|
||||||
ConstantValue constant = (ConstantValue) assignment.getrValue2();
|
ConstantValue constant = (ConstantValue) assignment.getrValue2();
|
||||||
assignment.setrValue2(assignment.getrValue1());
|
assignment.setrValue2(assignment.getrValue1());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user