1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-09-30 09:57:11 +00:00

Added missing fragments.

This commit is contained in:
jespergravgaard 2021-08-03 00:38:16 +02:00
parent 3557cf178f
commit e3fdefd2ae
12 changed files with 7024 additions and 21442 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -792,3 +792,401 @@ iny
tax
//FRAGMENT vbuyy=vbuaa
tay
//FRAGMENT vbuz1=vbuz2_band_vbuc1
lda #{c1}
and {z2}
sta {z1}
//FRAGMENT _deref_pbuc1=_dec__deref_pbuc1
dec {c1}
//FRAGMENT pbuz1=pbuc1_plus_vbuz2
lda {z2}
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT pvoz1=pvoz2
lda {z2}
sta {z1}
lda {z2}+1
sta {z1}+1
//FRAGMENT vbuz1=vbuz1_plus_2
lda {z1}
clc
adc #2
sta {z1}
//FRAGMENT vbuz1=pbuz2_derefidx_vbuc1
ldy #{c1}
lda ({z2}),y
sta {z1}
//FRAGMENT pbuz1=pbuz2_plus_vbuc1
lda #{c1}
clc
adc {z2}
sta {z1}
lda #0
adc {z2}+1
sta {z1}+1
//FRAGMENT pbuz1_neq_pbuc1_then_la1
lda {z1}+1
cmp #>{c1}
bne {la1}
lda {z1}
cmp #<{c1}
bne {la1}
//FRAGMENT _deref_pbuz1=_deref_pbuz2
ldy #0
lda ({z2}),y
ldy #0
sta ({z1}),y
//FRAGMENT vbuz1=vbuaa_band_vbuc1
and #{c1}
sta {z1}
//FRAGMENT vbuz1=vbuxx_band_vbuc1
lda #{c1}
sax {z1}
//FRAGMENT vbuz1=vbuyy_band_vbuc1
tya
and #{c1}
sta {z1}
//FRAGMENT vbuaa=vbuz1_band_vbuc1
lda #{c1}
and {z1}
//FRAGMENT vbuaa=vbuaa_band_vbuc1
and #{c1}
//FRAGMENT vbuaa=vbuxx_band_vbuc1
txa
and #{c1}
//FRAGMENT vbuaa=vbuyy_band_vbuc1
tya
and #{c1}
//FRAGMENT vbuxx=vbuz1_band_vbuc1
lda #{c1}
and {z1}
tax
//FRAGMENT vbuxx=vbuaa_band_vbuc1
ldx #{c1}
axs #0
//FRAGMENT vbuyy=vbuz1_band_vbuc1
lda #{c1}
and {z1}
tay
//FRAGMENT pbuz1=pbuc1_plus_vbuaa
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vbuxx
txa
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vbuyy
tya
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT vbuxx=vbuxx_plus_2
inx
inx
//FRAGMENT vbuaa=pbuz1_derefidx_vbuc1
ldy #{c1}
lda ({z1}),y
//FRAGMENT vbuxx=pbuz1_derefidx_vbuc1
ldy #{c1}
lda ({z1}),y
tax
//FRAGMENT vbuyy=pbuz1_derefidx_vbuc1
ldy #{c1}
lda ({z1}),y
tay
//FRAGMENT pbuz1=pbuz1_plus_vbuc1
lda #{c1}
clc
adc {z1}
sta {z1}
bcc !+
inc {z1}+1
!:
//FRAGMENT vbuz1=_dec_vbuz1
dec {z1}
//FRAGMENT pbuz1=pbuz2
lda {z2}
sta {z1}
lda {z2}+1
sta {z1}+1
//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuz2
ldy {z2}
lda {c1},y
ldy #0
sta ({z1}),y
//FRAGMENT pbuz1=_inc_pbuz2
clc
lda {z2}
adc #1
sta {z1}
lda {z2}+1
adc #0
sta {z1}+1
//FRAGMENT _deref_pbuz1=vbuc1
lda #{c1}
ldy #0
sta ({z1}),y
//FRAGMENT vbuz1=pbuc1_derefidx_vbuz2
ldy {z2}
lda {c1},y
sta {z1}
//FRAGMENT vbuz1_ge_vbuz2_then_la1
lda {z1}
cmp {z2}
bcs {la1}
//FRAGMENT vbuz1=vbuz1_minus_vbuz2
lda {z1}
sec
sbc {z2}
sta {z1}
//FRAGMENT vwuz1=_word_vbuz2
lda {z2}
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=vwuz2_rol_5
lda {z2}
asl
sta {z1}
lda {z2}+1
rol
sta {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vwuz2
lda {z2}
clc
adc #<{c1}
sta {z1}
lda {z2}+1
adc #>{c1}
sta {z1}+1
//FRAGMENT pbuz1=pbuz2_plus_vbuz3
lda {z3}
clc
adc {z2}
sta {z1}
lda #0
adc {z2}+1
sta {z1}+1
//FRAGMENT pbuz1=pbuz1_minus_vbuc1
sec
lda {z1}
sbc #{c1}
sta {z1}
lda {z1}+1
sbc #0
sta {z1}+1
//FRAGMENT vbuz1=_deref_pbuc1
lda {c1}
sta {z1}
//FRAGMENT _deref_pbuz1=vbuz2
lda {z2}
ldy #0
sta ({z1}),y
//FRAGMENT vbuxx=vbuxx_band_vbuc1
lda #{c1}
axs #0
//FRAGMENT vbuyy=vbuxx_band_vbuc1
txa
and #{c1}
tay
//FRAGMENT vbuxx=vbuyy_band_vbuc1
ldx #{c1}
tya
axs #0
//FRAGMENT vbuyy=vbuyy_band_vbuc1
tya
and #{c1}
tay
//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuaa
tay
lda {c1},y
ldy #0
sta ({z1}),y
//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuxx
lda {c1},x
ldy #0
sta ({z1}),y
//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuyy
lda {c1},y
ldy #0
sta ({z1}),y
//FRAGMENT vbuaa=pbuc1_derefidx_vbuz1
ldy {z1}
lda {c1},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuz1
ldy {z1}
ldx {c1},y
//FRAGMENT vbuyy=pbuc1_derefidx_vbuz1
ldx {z1}
ldy {c1},x
//FRAGMENT vbuz1=pbuc1_derefidx_vbuaa
tay
lda {c1},y
sta {z1}
//FRAGMENT vbuaa=pbuc1_derefidx_vbuaa
tay
lda {c1},y
//FRAGMENT vbuxx=pbuc1_derefidx_vbuaa
tay
ldx {c1},y
//FRAGMENT vbuyy=pbuc1_derefidx_vbuaa
tax
ldy {c1},x
//FRAGMENT vbuz1=pbuc1_derefidx_vbuxx
lda {c1},x
sta {z1}
//FRAGMENT 0_neq_vbuaa_then_la1
cmp #0
bne {la1}
//FRAGMENT vbuaa_ge_vbuz1_then_la1
cmp {z1}
bcs {la1}
//FRAGMENT vbuxx=vbuxx_minus_vbuz1
txa
sec
sbc {z1}
tax
//FRAGMENT vbuz1=vbuz1_minus_vbuaa
eor #$ff
sec
adc {z1}
sta {z1}
//FRAGMENT vbuxx=vbuxx_minus_vbuaa
sta $ff
txa
sec
sbc $ff
tax
//FRAGMENT vbuz1=vbuz1_minus_vbuxx
txa
eor #$ff
sec
adc {z1}
sta {z1}
//FRAGMENT vbuxx=vbuxx_minus_vbuxx
lda #0
tax
//FRAGMENT vbuz1=vbuz1_minus_vbuyy
tya
eor #$ff
sec
adc {z1}
sta {z1}
//FRAGMENT vbuxx=vbuxx_minus_vbuyy
txa
sty $ff
sec
sbc $ff
tax
//FRAGMENT vwuz1=_word_vbuaa
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=_word_vbuxx
txa
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=_word_vbuyy
tya
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vbuaa_eq_vbuc1_then_la1
cmp #{c1}
beq {la1}
//FRAGMENT vbuaa=_deref_pbuc1
lda {c1}
//FRAGMENT vbuxx=_deref_pbuc1
ldx {c1}
//FRAGMENT _deref_pbuz1=vbuaa
ldy #0
sta ({z1}),y
//FRAGMENT _deref_pbuz1=vbuxx
txa
ldy #0
sta ({z1}),y
//FRAGMENT _deref_pbuz1=vbuyy
tya
ldy #0
sta ({z1}),y
//FRAGMENT vbuxx_ge_vbuz1_then_la1
cpx {z1}
bcs {la1}
//FRAGMENT vbuxx_eq_vbuc1_then_la1
cpx #{c1}
beq {la1}
//FRAGMENT vbuyy=_deref_pbuc1
ldy {c1}
//FRAGMENT vbuz1_ge_vbuxx_then_la1
lda {z1}
stx $ff
cmp $ff
bcs {la1}
//FRAGMENT vbuz1_ge_vbuyy_then_la1
lda {z1}
sty $ff
cmp $ff
bcs {la1}
//FRAGMENT vbuxx_ge_vbuyy_then_la1
sty $ff
cpx $ff
bcs {la1}
//FRAGMENT vbuaa=vbuxx
txa
//FRAGMENT vbuyy=vbuxx
txa
tay
//FRAGMENT vbuyy_eq_vbuc1_then_la1
cpy #{c1}
beq {la1}
//FRAGMENT vbuaa=vbuyy
tya
//FRAGMENT vbuxx=vbuyy
tya
tax
//FRAGMENT vbuyy_ge_vbuz1_then_la1
cpy {z1}
bcs {la1}
//FRAGMENT vwuz1=vwuz1_rol_5
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vwuz1
lda {z1}
clc
adc #<{c1}
sta {z1}
lda {z1}+1
adc #>{c1}
sta {z1}+1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
lda ({z1}),y
sta $fe
iny
lda ({z1}),y
sta $ff
ldy {m2}
lda ($fe),y
bne {la1}

View File

@ -0,0 +1,9 @@
lda ({z1}),y
sta $fe
iny
lda ({z1}),y
sta $ff
stx $fe
ldy $fe
lda ($fe),y
bne {la1}

View File

@ -0,0 +1,18 @@
lda {m2}
asl
sta {m1}
lda {m2}+1
rol
sta {m1}+1
lda #0
sta {m1}+3
rol
sta {m1}+2
asl {m1}
rol {m1}+1
rol {m1}+2
rol {m1}+3
asl {m1}
rol {m1}+1
rol {m1}+2
rol {m1}+3

View File

@ -224,7 +224,24 @@ md5: {
ldy #0
sta (__74),y
// uint32_t bits_len = initial_len * 8
.assert "Missing ASM fragment Fragment not found vduz1=vwuz2_rol_3. Attempted variations vduz1=vwuz2_rol_3 ", 0, 1
lda.z initial_len
asl
sta.z bits_len
lda.z initial_len+1
rol
sta.z bits_len+1
tya
sta.z bits_len+3
rol
sta.z bits_len+2
asl.z bits_len
rol.z bits_len+1
rol.z bits_len+2
rol.z bits_len+3
asl.z bits_len
rol.z bits_len+1
rol.z bits_len+2
rol.z bits_len+3
// msg + new_len
lda.z msg
clc

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,6 @@
.const SIZEOF_STRUCT_PERSON = 3
.const OFFSET_STRUCT_PERSON_NAME = 1
.label SCREEN = $400
.label idx = 5
.segment Code
main: {
// print_person(&persons[0])
@ -46,22 +45,42 @@ print_person: {
sta SCREEN,x
// SCREEN[idx++] = ' ';
inx
stx.z idx
lda #0
sta.z i
__b1:
// for(byte i=0; person->name[i]; i++)
.assert "Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1 ", 0, 1
ldy #OFFSET_STRUCT_PERSON_NAME
lda (person),y
sta.z $fe
iny
lda (person),y
sta.z $ff
ldy.z i
lda ($fe),y
bne __b2
// SCREEN[idx++] = ' '
lda #' '
ldy.z idx
sta SCREEN,y
sta SCREEN,x
// SCREEN[idx++] = ' ';
inx
// }
rts
__b2:
// SCREEN[idx++] = person->name[i]
ldy #OFFSET_STRUCT_PERSON_NAME
lda (person),y
sta.z $fe
iny
lda (person),y
sta.z $ff
ldy.z i
lda ($fe),y
sta SCREEN,x
// SCREEN[idx++] = person->name[i];
inx
// for(byte i=0; person->name[i]; i++)
inc.z i
jmp __b1
}
.segment Data
persons: .byte 4

View File

@ -310,45 +310,28 @@ Allocated zp[1]:4 [ idx#14 idx#17 ]
Allocated zp[1]:5 [ print_person::i#2 print_person::i#1 ]
Allocated zp[1]:6 [ idx#15 idx#4 idx#5 ]
Allocated zp[1]:7 [ idx#3 ]
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] SCREEN[idx#14] = DIGIT[*((byte*)print_person::person#2)] [ print_person::person#2 idx#14 ] ( print_person:1 [ print_person::person#2 idx#14 ] { } print_person:3 [ print_person::person#2 idx#14 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte a as potential for zp[1]:4 [ idx#14 idx#17 ]
Removing always clobbered register reg byte y as potential for zp[1]:4 [ idx#14 idx#17 ]
Statement [8] SCREEN[idx#3] = ' ' [ print_person::person#2 idx#3 ] ( print_person:1 [ print_person::person#2 idx#3 ] { } print_person:3 [ print_person::person#2 idx#3 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:7 [ idx#3 ]
Potential register analysis [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2 missing fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1 allocation: zp[1]:5 [ print_person::i#2 print_person::i#1 ] zp[2]:2 [ print_person::person#2 ]
Potential register analysis [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2 missing fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuaa_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuaa_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuaa_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuaa_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuaa_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuaa_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuaa_then_la1 allocation: reg byte a [ print_person::i#2 print_person::i#1 ] zp[2]:2 [ print_person::person#2 ]
Potential register analysis [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2 missing fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuxx_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuxx_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuxx_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuxx_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuxx_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuxx_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuxx_then_la1 allocation: reg byte x [ print_person::i#2 print_person::i#1 ] zp[2]:2 [ print_person::person#2 ]
Potential register analysis [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2 missing fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuyy_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuyy_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuyy_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuyy_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuyy_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuyy_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuyy_then_la1 allocation: reg byte y [ print_person::i#2 print_person::i#1 ] zp[2]:2 [ print_person::person#2 ]
MISSING FRAGMENTS
Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuaa_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuaa_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuaa_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuaa_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuaa_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuaa_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuaa_then_la1
Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuxx_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuxx_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuxx_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuxx_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuxx_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuxx_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuxx_then_la1
Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuyy_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuyy_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuyy_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuyy_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuyy_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuyy_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuyy_then_la1
Statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2 [ print_person::person#2 print_person::i#2 idx#15 ] ( print_person:1 [ print_person::person#2 print_person::i#2 idx#15 ] { } print_person:3 [ print_person::person#2 print_person::i#2 idx#15 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a reg byte x reg byte y
Statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2 [ print_person::person#2 print_person::i#2 idx#15 ] ( print_person:1 [ print_person::person#2 print_person::i#2 idx#15 ] { } print_person:3 [ print_person::person#2 print_person::i#2 idx#15 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a reg byte y
Removing always clobbered register reg byte a as potential for zp[1]:5 [ print_person::i#2 print_person::i#1 ]
Removing always clobbered register reg byte x as potential for zp[1]:5 [ print_person::i#2 print_person::i#1 ]
Removing always clobbered register reg byte y as potential for zp[1]:5 [ print_person::i#2 print_person::i#1 ]
Removing always clobbered register reg byte a as potential for zp[1]:6 [ idx#15 idx#4 idx#5 ]
Removing always clobbered register reg byte x as potential for zp[1]:6 [ idx#15 idx#4 idx#5 ]
Removing always clobbered register reg byte y as potential for zp[1]:6 [ idx#15 idx#4 idx#5 ]
Statement [12] SCREEN[idx#15] = ' ' [ idx#15 ] ( print_person:1 [ idx#15 ] { } print_person:3 [ idx#15 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a reg byte y
Statement [15] SCREEN[idx#15] = (((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2] [ print_person::person#2 print_person::i#2 idx#15 ] ( print_person:1 [ print_person::person#2 print_person::i#2 idx#15 ] { } print_person:3 [ print_person::person#2 print_person::i#2 idx#15 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a reg byte x reg byte y
Statement [12] SCREEN[idx#15] = ' ' [ idx#15 ] ( print_person:1 [ idx#15 ] { } print_person:3 [ idx#15 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a
Statement [15] SCREEN[idx#15] = (((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2] [ print_person::person#2 print_person::i#2 idx#15 ] ( print_person:1 [ print_person::person#2 print_person::i#2 idx#15 ] { } print_person:3 [ print_person::person#2 print_person::i#2 idx#15 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a reg byte y
Statement [6] SCREEN[idx#14] = DIGIT[*((byte*)print_person::person#2)] [ print_person::person#2 idx#14 ] ( print_person:1 [ print_person::person#2 idx#14 ] { } print_person:3 [ print_person::person#2 idx#14 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a reg byte y
Statement [8] SCREEN[idx#3] = ' ' [ print_person::person#2 idx#3 ] ( print_person:1 [ print_person::person#2 idx#3 ] { } print_person:3 [ print_person::person#2 idx#3 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a
Potential register analysis [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2 missing fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1 allocation: zp[1]:5 [ print_person::i#2 print_person::i#1 ] zp[2]:2 [ print_person::person#2 ]
MISSING FRAGMENTS
Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
Statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2 [ print_person::person#2 print_person::i#2 idx#15 ] ( print_person:1 [ print_person::person#2 print_person::i#2 idx#15 ] { } print_person:3 [ print_person::person#2 print_person::i#2 idx#15 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a reg byte x reg byte y
Statement [12] SCREEN[idx#15] = ' ' [ idx#15 ] ( print_person:1 [ idx#15 ] { } print_person:3 [ idx#15 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a reg byte y
Statement [15] SCREEN[idx#15] = (((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2] [ print_person::person#2 print_person::i#2 idx#15 ] ( print_person:1 [ print_person::person#2 print_person::i#2 idx#15 ] { } print_person:3 [ print_person::person#2 print_person::i#2 idx#15 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a reg byte x reg byte y
Statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2 [ print_person::person#2 print_person::i#2 idx#15 ] ( print_person:1 [ print_person::person#2 print_person::i#2 idx#15 ] { } print_person:3 [ print_person::person#2 print_person::i#2 idx#15 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a reg byte y
Statement [12] SCREEN[idx#15] = ' ' [ idx#15 ] ( print_person:1 [ idx#15 ] { } print_person:3 [ idx#15 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a
Statement [15] SCREEN[idx#15] = (((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2] [ print_person::person#2 print_person::i#2 idx#15 ] ( print_person:1 [ print_person::person#2 print_person::i#2 idx#15 ] { } print_person:3 [ print_person::person#2 print_person::i#2 idx#15 ] { { idx#14 = idx#17 } } ) always clobbers reg byte a reg byte y
Potential registers zp[2]:2 [ print_person::person#2 ] : zp[2]:2 ,
Potential registers zp[1]:4 [ idx#14 idx#17 ] : zp[1]:4 , reg byte x ,
Potential registers zp[1]:5 [ print_person::i#2 print_person::i#1 ] : zp[1]:5 ,
Potential registers zp[1]:6 [ idx#15 idx#4 idx#5 ] : zp[1]:6 ,
Potential registers zp[1]:5 [ print_person::i#2 print_person::i#1 ] : zp[1]:5 , reg byte x ,
Potential registers zp[1]:6 [ idx#15 idx#4 idx#5 ] : zp[1]:6 , reg byte x ,
Potential registers zp[1]:7 [ idx#3 ] : zp[1]:7 , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
@ -357,52 +340,13 @@ Uplift Scope [] 207: zp[1]:6 [ idx#15 idx#4 idx#5 ] 16.5: zp[1]:7 [ idx#3 ] 15.2
Uplift Scope [Person]
Uplift Scope [main]
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
Uplifting [print_person] best 739 combination zp[1]:5 [ print_person::i#2 print_person::i#1 ] zp[2]:2 [ print_person::person#2 ]
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
Uplifting [] best 718 combination zp[1]:6 [ idx#15 idx#4 idx#5 ] reg byte x [ idx#3 ] reg byte x [ idx#14 idx#17 ]
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
Uplifting [Person] best 718 combination
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
Uplifting [main] best 718 combination
Uplifting [print_person] best 1059 combination zp[1]:5 [ print_person::i#2 print_person::i#1 ] zp[2]:2 [ print_person::person#2 ]
Uplifting [] best 969 combination reg byte x [ idx#15 idx#4 idx#5 ] reg byte x [ idx#3 ] reg byte x [ idx#14 idx#17 ]
Uplifting [Person] best 969 combination
Uplifting [main] best 969 combination
Attempting to uplift remaining variables inzp[1]:5 [ print_person::i#2 print_person::i#1 ]
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
Uplifting [print_person] best 718 combination zp[1]:5 [ print_person::i#2 print_person::i#1 ]
Attempting to uplift remaining variables inzp[1]:6 [ idx#15 idx#4 idx#5 ]
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
Uplifting [] best 718 combination zp[1]:6 [ idx#15 idx#4 idx#5 ]
Uplifting [print_person] best 969 combination zp[1]:5 [ print_person::i#2 print_person::i#1 ]
Allocated (was zp[1]:5) zp[1]:4 [ print_person::i#2 print_person::i#1 ]
Allocated (was zp[1]:6) zp[1]:5 [ idx#15 idx#4 idx#5 ]
Warning! Unknown fragment for statement [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1
/Users/jespergravgaard/c64/kickc/src/test/kc/struct-ptr-29.c:25:5:
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -420,7 +364,6 @@ ASSEMBLER BEFORE OPTIMIZATION
.const SIZEOF_STRUCT_PERSON = 3
.const OFFSET_STRUCT_PERSON_NAME = 1
.label SCREEN = $400
.label idx = 5
.segment Code
// main
main: {
@ -472,9 +415,8 @@ print_person: {
// [8] SCREEN[idx#3] = ' ' -- pbuc1_derefidx_vbuxx=vbuc2
lda #' '
sta SCREEN,x
// [9] idx#4 = ++ idx#3 -- vbuz1=_inc_vbuxx
// [9] idx#4 = ++ idx#3 -- vbuxx=_inc_vbuxx
inx
stx.z idx
// [10] phi from print_person to print_person::@1 [phi:print_person->print_person::@1]
__b1_from_print_person:
// [10] phi idx#15 = idx#4 [phi:print_person->print_person::@1#0] -- register_copy
@ -484,17 +426,23 @@ print_person: {
jmp __b1
// print_person::@1
__b1:
// [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
.assert "Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1 ", 0, 1
// [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2 -- 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1
ldy #OFFSET_STRUCT_PERSON_NAME
lda (person),y
sta.z $fe
iny
lda (person),y
sta.z $ff
ldy.z i
lda ($fe),y
bne __b2
jmp __b3
// print_person::@3
__b3:
// [12] SCREEN[idx#15] = ' ' -- pbuc1_derefidx_vbuz1=vbuc2
// [12] SCREEN[idx#15] = ' ' -- pbuc1_derefidx_vbuxx=vbuc2
lda #' '
ldy.z idx
sta SCREEN,y
// [13] idx#17 = ++ idx#15 -- vbuxx=_inc_vbuz1
ldx.z idx
sta SCREEN,x
// [13] idx#17 = ++ idx#15 -- vbuxx=_inc_vbuxx
inx
jmp __breturn
// print_person::@return
@ -503,8 +451,7 @@ print_person: {
rts
// print_person::@2
__b2:
// [15] SCREEN[idx#15] = (((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2] -- pbuc1_derefidx_vbuz1=(qbuz2_derefidx_vbuc2)_derefidx_vbuz3
ldx.z idx
// [15] SCREEN[idx#15] = (((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2] -- pbuc1_derefidx_vbuxx=(qbuz1_derefidx_vbuc2)_derefidx_vbuz2
ldy #OFFSET_STRUCT_PERSON_NAME
lda (person),y
sta.z $fe
@ -514,8 +461,8 @@ print_person: {
ldy.z i
lda ($fe),y
sta SCREEN,x
// [16] idx#5 = ++ idx#15 -- vbuz1=_inc_vbuz1
inc.z idx
// [16] idx#5 = ++ idx#15 -- vbuxx=_inc_vbuxx
inx
// [17] print_person::i#1 = ++ print_person::i#2 -- vbuz1=_inc_vbuz1
inc.z i
// [10] phi from print_person::@2 to print_person::@1 [phi:print_person::@2->print_person::@1]
@ -553,27 +500,8 @@ Removing instruction __breturn:
Removing instruction __b1_from_print_person:
Removing instruction __b3:
Removing instruction __breturn:
Removing instruction __b2:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing unreachable instruction ldx.z idx
Removing unreachable instruction ldy #OFFSET_STRUCT_PERSON_NAME
Removing unreachable instruction lda (person),y
Removing unreachable instruction sta.z $fe
Removing unreachable instruction iny
Removing unreachable instruction lda (person),y
Removing unreachable instruction sta.z $ff
Removing unreachable instruction ldy.z i
Removing unreachable instruction lda ($fe),y
Removing unreachable instruction sta SCREEN,x
Removing unreachable instruction inc.z idx
Removing unreachable instruction inc.z i
Removing unreachable instruction jmp __b1
Succesful ASM optimization Pass5UnreachableCodeElimination
Removing instruction __b1:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction ldx.z idx
Succesful ASM optimization Pass5UnnecesaryLoadElimination
FINAL SYMBOL TABLE
constant byte* DIGIT[] = "0123456789"
@ -582,11 +510,11 @@ constant byte* const SCREEN = (byte*) 1024
constant byte SIZEOF_STRUCT_PERSON = 3
byte idx
byte idx#14 reg byte x 12.0
byte idx#15 idx zp[1]:5 84.0
byte idx#15 reg byte x 84.0
byte idx#17 reg byte x 3.25
byte idx#3 reg byte x 16.5
byte idx#4 idx zp[1]:5 22.0
byte idx#5 idx zp[1]:5 101.0
byte idx#4 reg byte x 22.0
byte idx#5 reg byte x 101.0
void main()
constant byte* person_name[7] = "jesper"
constant byte* person_name1[7] = "repsej"
@ -601,12 +529,12 @@ struct Person* print_person::person#2 person zp[2]:2
zp[2]:2 [ print_person::person#2 ]
reg byte x [ idx#14 idx#17 ]
zp[1]:4 [ print_person::i#2 print_person::i#1 ]
zp[1]:5 [ idx#15 idx#4 idx#5 ]
reg byte x [ idx#15 idx#4 idx#5 ]
reg byte x [ idx#3 ]
FINAL ASSEMBLER
Score: 141
Score: 900
// File Comments
// Example of a struct containing a pointer
@ -623,7 +551,6 @@ Score: 141
.const SIZEOF_STRUCT_PERSON = 3
.const OFFSET_STRUCT_PERSON_NAME = 1
.label SCREEN = $400
.label idx = 5
.segment Code
// main
main: {
@ -675,41 +602,61 @@ print_person: {
lda #' '
sta SCREEN,x
// SCREEN[idx++] = ' ';
// [9] idx#4 = ++ idx#3 -- vbuz1=_inc_vbuxx
// [9] idx#4 = ++ idx#3 -- vbuxx=_inc_vbuxx
inx
stx.z idx
// [10] phi from print_person to print_person::@1 [phi:print_person->print_person::@1]
// [10] phi idx#15 = idx#4 [phi:print_person->print_person::@1#0] -- register_copy
// [10] phi print_person::i#2 = 0 [phi:print_person->print_person::@1#1] -- vbuz1=vbuc1
lda #0
sta.z i
// print_person::@1
__b1:
// for(byte i=0; person->name[i]; i++)
// [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2
.assert "Missing ASM fragment Fragment not found 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1. Attempted variations 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vbsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwuc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vwsc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vduc1)_derefidx_vbuz2_then_la1 0_neq_(qbuz1_derefidx_vdsc1)_derefidx_vbuz2_then_la1 ", 0, 1
// [11] if(0!=(((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2]) goto print_person::@2 -- 0_neq_(qbuz1_derefidx_vbuc1)_derefidx_vbuz2_then_la1
ldy #OFFSET_STRUCT_PERSON_NAME
lda (person),y
sta.z $fe
iny
lda (person),y
sta.z $ff
ldy.z i
lda ($fe),y
bne __b2
// print_person::@3
// SCREEN[idx++] = ' '
// [12] SCREEN[idx#15] = ' ' -- pbuc1_derefidx_vbuz1=vbuc2
// [12] SCREEN[idx#15] = ' ' -- pbuc1_derefidx_vbuxx=vbuc2
lda #' '
ldy.z idx
sta SCREEN,y
sta SCREEN,x
// SCREEN[idx++] = ' ';
// [13] idx#17 = ++ idx#15 -- vbuxx=_inc_vbuz1
// [13] idx#17 = ++ idx#15 -- vbuxx=_inc_vbuxx
inx
// print_person::@return
// }
// [14] return
rts
// print_person::@2
__b2:
// SCREEN[idx++] = person->name[i]
// [15] SCREEN[idx#15] = (((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2] -- pbuc1_derefidx_vbuz1=(qbuz2_derefidx_vbuc2)_derefidx_vbuz3
// [15] SCREEN[idx#15] = (((byte**)print_person::person#2)[OFFSET_STRUCT_PERSON_NAME])[print_person::i#2] -- pbuc1_derefidx_vbuxx=(qbuz1_derefidx_vbuc2)_derefidx_vbuz2
ldy #OFFSET_STRUCT_PERSON_NAME
lda (person),y
sta.z $fe
iny
lda (person),y
sta.z $ff
ldy.z i
lda ($fe),y
sta SCREEN,x
// SCREEN[idx++] = person->name[i];
// [16] idx#5 = ++ idx#15 -- vbuz1=_inc_vbuz1
// [16] idx#5 = ++ idx#15 -- vbuxx=_inc_vbuxx
inx
// for(byte i=0; person->name[i]; i++)
// [17] print_person::i#1 = ++ print_person::i#2 -- vbuz1=_inc_vbuz1
inc.z i
// [10] phi from print_person::@2 to print_person::@1 [phi:print_person::@2->print_person::@1]
// [10] phi idx#15 = idx#5 [phi:print_person::@2->print_person::@1#0] -- register_copy
// [10] phi print_person::i#2 = print_person::i#1 [phi:print_person::@2->print_person::@1#1] -- register_copy
jmp __b1
}
// File Data
.segment Data

View File

@ -4,11 +4,11 @@ constant byte* const SCREEN = (byte*) 1024
constant byte SIZEOF_STRUCT_PERSON = 3
byte idx
byte idx#14 reg byte x 12.0
byte idx#15 idx zp[1]:5 84.0
byte idx#15 reg byte x 84.0
byte idx#17 reg byte x 3.25
byte idx#3 reg byte x 16.5
byte idx#4 idx zp[1]:5 22.0
byte idx#5 idx zp[1]:5 101.0
byte idx#4 reg byte x 22.0
byte idx#5 reg byte x 101.0
void main()
constant byte* person_name[7] = "jesper"
constant byte* person_name1[7] = "repsej"
@ -23,5 +23,5 @@ struct Person* print_person::person#2 person zp[2]:2
zp[2]:2 [ print_person::person#2 ]
reg byte x [ idx#14 idx#17 ]
zp[1]:4 [ print_person::i#2 print_person::i#1 ]
zp[1]:5 [ idx#15 idx#4 idx#5 ]
reg byte x [ idx#15 idx#4 idx#5 ]
reg byte x [ idx#3 ]