mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-02-25 18:29:15 +00:00
Added working test for signed multiplication. Refactored AsmFragment synthesis away from relying on vwuc.
This commit is contained in:
parent
b95c7e20f5
commit
c7b137d631
@ -120,9 +120,6 @@ public class AsmFragmentManager {
|
||||
|
||||
List<FragmentSynthesis> synths = new ArrayList<>();
|
||||
|
||||
synths.add(new FragmentSynthesis("(.*)pbuc(.)(.*)", null, null, "$1vwuc$2$3", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)pbsc(.)(.*)", null, null, "$1vwuc$2$3", null, null));
|
||||
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)_(band|bor|bxor|plus)_(vb.aa)", ".*=vb.aa_.*", null, "$1=$4_$3_$2", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)_(band|bor|bxor|plus)_(vb.xx)", ".*=vb.[ax][ax]_.*", null, "$1=$4_$3_$2", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)_(band|bor|bxor|plus)_(vb.yy)", ".*=vb.[axy][axy]_.*", null, "$1=$4_$3_$2", null, null));
|
||||
@ -133,26 +130,15 @@ public class AsmFragmentManager {
|
||||
synths.add(new FragmentSynthesis("vbsyy=(.*)", null, null, "vbsaa=$1", "tay\n", null));
|
||||
synths.add(new FragmentSynthesis("vbuz1=(.*)", ".*=.*vb.z1.*", null, "vbuaa=$1", "sta {z1}\n", mapZ));
|
||||
synths.add(new FragmentSynthesis("vbsz1=(.*)", ".*=.*vb.z1.*", null, "vbsaa=$1", "sta {z1}\n", mapZ));
|
||||
synths.add(new FragmentSynthesis("_deref_vwuc1=(.*)", null, null, "vbuaa=$1", "sta {c1}\n", mapC));
|
||||
synths.add(new FragmentSynthesis("_deref_pb(.)c1=(.*)", null, null, "vb$1aa=$2", "sta {c1}\n", mapC));
|
||||
synths.add(new FragmentSynthesis("_deref_pbuz1=(.*)", ".*=.*z1.*", null, "vbuaa=$1", "ldy #0\n" + "sta ({z1}),y\n", mapZ));
|
||||
|
||||
synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuz1=(.*)", ".*z1.*z1.*|.*c1.*c1.*", null, "vb$1aa=$2", "ldx {z1}\n"+"sta {c1},x\n", mapZC));
|
||||
synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuz1=(.*c1.*)", ".*z1.*z1.*", null, "vb$1aa=$2", "ldx {z1}\n"+"sta {c1},x\n", mapZ));
|
||||
synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuyy=(.*)", ".*c1.*c1.*", null, "vb$1aa=$2", "sta {c1},y\n", mapC));
|
||||
synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuxx=(.*)", ".*c1.*c1.*", null, "vb$1aa=$2", "sta {c1},x\n", mapC));
|
||||
synths.add(new FragmentSynthesis("pb(.)z1_derefidx_vbuz2=(.*)", ".*z1.*z1.*|.*z2.*z2.*", null, "vb$1aa=$2", "ldy {z2}\n"+"sta ({z1}),y\n", mapZ2));
|
||||
|
||||
synths.add(new FragmentSynthesis("(.*)=vbuxx(.*)", ".*=.*vb.aa.*", "txa\n", "$1=vbuaa$2", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=vbuyy(.*)", ".*=.*vb.aa.*", "tya\n", "$1=vbuaa$2", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=vbuz1(.*)", ".*=.*vb.aa.*|.*z1.*z1.*", "lda {z1}\n", "$1=vbuaa$2", null, mapZ));
|
||||
synths.add(new FragmentSynthesis("(.*)=vbsz1(.*)", ".*=.*vb.aa.*|.*z1.*z1.*", "lda {z1}\n", "$1=vbsaa$2", null, mapZ));
|
||||
synths.add(new FragmentSynthesis("(.*)=vbuz2(.*)", ".*=.*vb.aa.*|.*z2.*z2.*|.*z3.*", "lda {z2}\n", "$1=vbuaa$2", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=vbsz2(.*)", ".*=.*vb.aa.*|.*z2.*z2.*|.*z3.*", "lda {z2}\n", "$1=vbsaa$2", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=vbuz2", ".*=.*aa.*|.*z2.*=.*", "lda {z2}\n", "$1=vbuaa", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=vbsz2", ".*=.*aa.*|.*z2.*=.*", "lda {z2}\n", "$1=vbuaa", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=vbuc1", ".*=.*aa.*", "lda #{c1}\n", "$1=vbuaa", null, mapC));
|
||||
synths.add(new FragmentSynthesis("(.*)=vbsc1", ".*=.*aa.*", "lda #{c1}\n", "$1=vbsaa", null, mapC));
|
||||
synths.add(new FragmentSynthesis("(.*)=_deref_vwuc1(.*)", ".*=.*aa.*", "lda {c1}\n", "$1=vbuaa$2", null, mapC));
|
||||
synths.add(new FragmentSynthesis("(.*)=_deref_pb(.)c1(.*)", ".*=.*aa.*", "lda {c1}\n", "$1=vb$2aa$3", null, mapC));
|
||||
synths.add(new FragmentSynthesis("(.*)=_deref_pb(.)z1(.*)", ".*z1.*z1.*|.*=.*aa.*|.*=.*yy.*", "ldy #0\n" + "lda ({z1}),y\n", "$1=vb$2aa$3", null, mapZ));
|
||||
|
||||
// Convert array indexing with A register to X/Y register by prefixing tax/tay (..._derefidx_vbuaa... -> ..._derefidx_vbuxx... /... _derefidx_vbuyy... )
|
||||
@ -172,6 +158,9 @@ public class AsmFragmentManager {
|
||||
synths.add(new FragmentSynthesis("(.*)_derefidx_vbuz1(.*)_derefidx_vbuz1(.*)", ".*z1.*z1.*z1.*|.*yy.*", null, "$1_derefidx_vbuyy$2_derefidx_vbuyy$3", "ldy {z1}\n", mapZ));
|
||||
synths.add(new FragmentSynthesis("(.*)_derefidx_vbuz2(.*)_derefidx_vbuz2(.*)", ".*z2.*z2.*z2.*|.*xx.*", null, "$1_derefidx_vbuxx$2_derefidx_vbuxx$3", "ldx {z2}\n", mapZ));
|
||||
synths.add(new FragmentSynthesis("(.*)_derefidx_vbuz2(.*)_derefidx_vbuz2(.*)", ".*z2.*z2.*z2.*|.*yy.*", null, "$1_derefidx_vbuyy$2_derefidx_vbuyy$3", "ldy {z2}\n", mapZ));
|
||||
synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuz1=(.*c1.*)", ".*z1.*z1.*", null, "vb$1aa=$2", "ldx {z1}\n"+"sta {c1},x\n", mapZ));
|
||||
synths.add(new FragmentSynthesis("pb(.)c1_derefidx_vbuz1=(.*z1.*)", ".*c1.*c1.*", null, "vb$1aa=$2", "ldx {z1}\n"+"sta {c1},x\n", mapC));
|
||||
|
||||
// Convert X/Y-based array indexing of a constant pointer into A-register by prefixing lda cn,x / lda cn,y ( ...pb.c1_derefidx_vbuxx... / ...pb.c1_derefidx_vbuyy... -> ...vb.aa... )
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)pb(.)c1_derefidx_vbuxx(.*)", ".*=.*aa.*|.*c1.*c1.*", "lda {c1},x\n", "$1=$2vb$3aa$4", null, mapC));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*c1.*)pb(.)c1_derefidx_vbuxx(.*)", ".*=.*aa.*", "lda {c1},x\n", "$1=$2vb$3aa$4", null, null));
|
||||
@ -186,6 +175,14 @@ public class AsmFragmentManager {
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*c2.*)pb(.)c2_derefidx_vbuyy(.*)", ".*=.*aa.*", "lda {c2},y\n", "$1=$2vb$3aa$4", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)pb(.)c2_derefidx_vbuyy(.*c2.*)", ".*=.*aa.*", "lda {c2},y\n", "$1=$2vb$3aa$4", null, null));
|
||||
|
||||
// Convert zeropage/constants/X/Y in assignments to A-register using LDA/TXA/TYA prefix
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)vbuz1(.*)", ".*z1.*=.*|.*=.*aa.*|.*z1.*z1.*", "lda {z1}\n", "$1=$2vbuaa$3", null, mapZ));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)vbsz1(.*)", ".*z1.*=.*|.*=.*aa.*|.*z1.*z1.*", "lda {z1}\n", "$1=$2vbsaa$3", null, mapZ));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)vbuz2(.*)", ".*z2.*=.*|.*=.*aa.*|.*z2.*z2.*|.*z3.*", "lda {z2}\n", "$1=$2vbuaa$3", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)vbsz2(.*)", ".*z2.*=.*|.*=.*aa.*|.*z2.*z2.*|.*z3.*", "lda {z2}\n", "$1=$2vbsaa$3", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)vbuz2(.*z3.*)", ".*z2.*=.*|.*=.*aa.*|.*z2.*z2.*|.*z3.*", "lda {z2}\n", "$1=$2vbuaa$3", null, mapZ3));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)vbsz2(.*z3.*)", ".*z2.*=.*|.*=.*aa.*|.*z2.*z2.*|.*z3.*", "lda {z2}\n", "$1=$2vbsaa$3", null, mapZ3));
|
||||
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)_vbuxx", ".*=.*[ax][ax].*xx|.*derefidx_vb.xx", "txa\n", "$1=$2_vbuaa", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)_vbsxx", ".*=.*[ax][ax].*xx|.*derefidx_vb.xx", "txa\n", "$1=$2_vbsaa", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)_vbuyy", ".*=.*[ay][ay].*yy|.*derefidx_vb.yy", "tya\n", "$1=$2_vbuaa", null, null));
|
||||
@ -200,7 +197,7 @@ public class AsmFragmentManager {
|
||||
|
||||
synths.add(new FragmentSynthesis("vbuz1_(lt|gt|le|ge|eq|neq)_(.*)", ".*vb.aa.*", "lda {z1}\n", "vbuaa_$1_$2", null, mapZ));
|
||||
synths.add(new FragmentSynthesis("vbsz1_(lt|gt|le|ge|eq|neq)_(.*)", ".*vb.aa.*", "lda {z1}\n", "vbsaa_$1_$2", null, mapZ));
|
||||
synths.add(new FragmentSynthesis("_deref_vwuc1_(lt|gt|le|ge|eq|neq)_(.*)", ".*vb.aa.*", "lda {c1}\n", "vbuaa_$1_$2", null, mapC));
|
||||
synths.add(new FragmentSynthesis("_deref_pb(.)c1_(lt|gt|le|ge|eq|neq)_(.*)", ".*vb.aa.*", "lda {c1}\n", "vb$1aa_$2_$3", null, mapC));
|
||||
synths.add(new FragmentSynthesis("_deref_pb(.)z1_(lt|gt|le|ge|eq|neq)_(.*)", ".*vb.aa.*|.*vb.yy.*|.*z1.*z1.*", "ldy #0\n" + "lda ({z1}),y\n", "vb$1aa_$2_$3", null, mapZ));
|
||||
|
||||
synths.add(new FragmentSynthesis("(.*)_derefidx_vbuz1_(lt|gt|le|ge|eq|neq)_(.*)", ".*z1.*z1.*|.*vb.yy.*", "ldy {z1}\n", "$1_derefidx_vbuyy_$2_$3", null, mapZ));
|
||||
@ -229,16 +226,14 @@ public class AsmFragmentManager {
|
||||
synths.add(new FragmentSynthesis("(.*)_eq_(vb.xx)_then_(.*)", ".*vb.[ax][ax].*_eq.*", null, "$2_eq_$1_then_$3", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)_eq_(vb.yy)_then_(.*)", ".*vb.[axy][axy].*_eq.*", null, "$2_eq_$1_then_$3", null, null));
|
||||
|
||||
synths.add(new FragmentSynthesis("p..z1=(.*)_(sethi|setlo|plus|minus)_(.*)", null, null, "vwuz1=$1_$2_$3", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=p..z(.)_(sethi|setlo|plus|minus)_(.*)", null, null, "$1=vwuz$2_$3_$4", null, null));
|
||||
|
||||
// Use unsigned ASM to synthesize signed ASM ( ...vbs... -> ...vbu... )
|
||||
synths.add(new FragmentSynthesis("(vbsz.|vbsaa|vbsxx|vbsyy)_(eq|neq)_(vbsz.|vbsc.|vbsaa|vbsxx|vbsyy)_then_(.*)", null, null, "$1_$2_$3_then_$4", null, mapSToU));
|
||||
synths.add(new FragmentSynthesis("(vbsz.|vbsaa|vbsxx|vbsyy)=(vbsz.|vbsc.|vbsaa|vbsxx|vbsyy)", null, null, "$1=$2", null, mapSToU));
|
||||
synths.add(new FragmentSynthesis("(vbsz.|vbsaa|vbsxx|vbsyy)=(vbsz.|vbsc.|vbsaa|vbsxx|vbsyy)_(plus|band|bxor|bor)_(vbsz.|csoby.|vbsaa|vbsxx|vbsyy)", null, null, "$1=$2_$3_$4", null, mapSToU));
|
||||
synths.add(new FragmentSynthesis("(vbsz.|vbsaa|vbsxx|vbsyy)=_(inc|dec)_(vbsz.|vbsc.|vbsaa|vbsxx|vbsyy)", null, null, "$1=_$2_$3", null, mapSToU));
|
||||
synths.add(new FragmentSynthesis("(vbsz.|vbsc.|vbsaa|vbsxx|vbsyy)_(eq|neq)_(vbsz.|vbsc.|vbsaa|vbsxx|vbsyy)_then_(.*)", null, null, "$1_$2_$3_then_$4", null, mapSToU));
|
||||
synths.add(new FragmentSynthesis("(vbsz.|vbsc.|vbsaa|vbsxx|vbsyy)=(vbsz.|vbsc.|vbsaa|vbsxx|vbsyy)", null, null, "$1=$2", null, mapSToU));
|
||||
synths.add(new FragmentSynthesis("(vbsz.|vbsc.|vbsaa|vbsxx|vbsyy)=(vbsz.|vbsc.|vbsaa|vbsxx|vbsyy)_(plus|band|bxor|bor)_(vbsz.|csoby.|vbsaa|vbsxx|vbsyy)", null, null, "$1=$2_$3_$4", null, mapSToU));
|
||||
synths.add(new FragmentSynthesis("(vbsz.|vbsc.|vbsaa|vbsxx|vbsyy)=_(inc|dec)_(vbsz.|vbsc.|vbsaa|vbsxx|vbsyy)", null, null, "$1=_$2_$3", null, mapSToU));
|
||||
synths.add(new FragmentSynthesis("(vwsz.|vwsc.)_(eq|neq)_(vwsz.|vwsc.)_then_(.*)", null, null, "$1_$2_$3_then_$4", null, mapSToU));
|
||||
synths.add(new FragmentSynthesis("(vwsz.)=(vwsz.|vwsc.)", null, null, "$1=$2", null, mapSToU));
|
||||
synths.add(new FragmentSynthesis("(vwsz.)=(vwsz.|vwsc.)_(plus|band|bxor|bor)_(vwsz.|vwsc.)", null, null, "$1=$2_$3_$4", null, mapSToU));
|
||||
synths.add(new FragmentSynthesis("(v.sz.)=(v.s..)_(band|bxor|bor)_(v.s..)", null, null, "$1=$2_$3_$4", null, mapSToU));
|
||||
synths.add(new FragmentSynthesis("(vbuz.|vbuaa|vbuxx|vbuyy)=_(lo|hi)_vws(z.|c.)", null, null, "$1=_$2_vwu$3", null, mapSToU));
|
||||
|
||||
// Use constant word ASM to synthesize unsigned constant byte ASM ( ...vb.c... -> vw.c... )
|
||||
@ -260,6 +255,25 @@ public class AsmFragmentManager {
|
||||
synths.add(new FragmentSynthesis("vb(.)aa=_inc_(.*)", null, null, "vb$1aa=$2_plus_1", null, null));
|
||||
synths.add(new FragmentSynthesis("vb(.)aa=_dec_(.*)", null, null, "vb$1aa=$2_minus_1", null, null));
|
||||
|
||||
// Synthesize XX/YY using AA
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)vbuxx(.*)", ".*=.*aa.*|.*derefidx_vb.xx.*", "txa\n", "$1=$2vbuaa$3", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)vbsxx(.*)", ".*=.*aa.*|.*derefidx_vb.xx.*", "txa\n", "$1=$2vbsaa$3", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)vbuyy(.*)", ".*=.*aa.*|.*derefidx_vb.yy.*", "tya\n", "$1=$2vbuaa$3", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)vbsyy(.*)", ".*=.*aa.*|.*derefidx_vb.yy.*", "tya\n", "$1=$2vbsaa$3", null, null));
|
||||
// Synthesize constants using AA
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)vbuc1(.*)", ".*=.*aa.*|.*c1.*c1.*|.*c1_deref.*", "lda #{c1}\n", "$1=$2vbuaa$3", null, mapC));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)vbsc1(.*)", ".*=.*aa.*|.*c1.*c1.*|.*c1_deref.*", "lda #{c1}\n", "$1=$2vbsaa$3", null, mapC));
|
||||
|
||||
// Synthesize some constant pointers as constant words
|
||||
synths.add(new FragmentSynthesis("(.*)_(lt|gt|le|ge|eq|neq)_p..([cz].)_then_(.*)", null, null, "$1_$2_vwu$3_then_$4", null, null));
|
||||
synths.add(new FragmentSynthesis("p..([cz].)_(lt|gt|le|ge|eq|neq)_(.*)", null, null, "vwu$1_$2_$3", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=p..([zc].)", null, null, "$1=vwu$2", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=(.*)_(plus|minus|bor|bxor)_p..([cz].)", null, null, "$1=$2_$3_vwu$4", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=p..([cz].)_(plus|minus|bor|bxor)_(.*)", null, null, "$1=vwu$2_$3_$4", null, null));
|
||||
synths.add(new FragmentSynthesis("p..([cz].)=(.*)_(sethi|setlo|plus|minus)_(.*)", null, null, "vwu$1=$2_$3_$4", null, null));
|
||||
synths.add(new FragmentSynthesis("(.*)=p..([cz].)_(sethi|setlo|plus|minus)_(.*)", null, null, "$1=vwu$2_$3_$4", null, null));
|
||||
|
||||
|
||||
|
||||
for (FragmentSynthesis synth : synths) {
|
||||
CharStream synthesized = synth.synthesize(signature, log);
|
||||
|
@ -0,0 +1,4 @@
|
||||
lda #<{c1}
|
||||
sta {z1}
|
||||
lda #>{c1}
|
||||
sta {z1}+1
|
@ -1,6 +0,0 @@
|
||||
lda {z1}+1
|
||||
cmp #>{c1}
|
||||
bne {la1}
|
||||
lda {z1}
|
||||
cmp #<{c1}
|
||||
bne {la1}
|
@ -0,0 +1,2 @@
|
||||
cmp #0
|
||||
bpl {la1}
|
@ -0,0 +1,2 @@
|
||||
cmp #1
|
||||
bmi {la1}
|
@ -0,0 +1 @@
|
||||
dex
|
@ -0,0 +1 @@
|
||||
inx
|
@ -0,0 +1,2 @@
|
||||
cpx #0
|
||||
bpl {la1}
|
@ -0,0 +1,2 @@
|
||||
cpx #1
|
||||
bmi {la1}
|
@ -0,0 +1 @@
|
||||
dey
|
@ -0,0 +1 @@
|
||||
iny
|
@ -0,0 +1,2 @@
|
||||
cpy #0
|
||||
bpl {la1}
|
@ -0,0 +1,2 @@
|
||||
cpy #1
|
||||
bmi {la1}
|
@ -0,0 +1 @@
|
||||
ora {z1}+1
|
@ -1 +1 @@
|
||||
xor {z1}
|
||||
eor {z1}
|
||||
|
@ -1,2 +1,2 @@
|
||||
stx $ff
|
||||
xor $ff
|
||||
eor $ff
|
@ -1,2 +1,2 @@
|
||||
sty $ff
|
||||
xor $ff
|
||||
eor $ff
|
@ -0,0 +1,2 @@
|
||||
cpx #0
|
||||
beq {la1}
|
@ -0,0 +1,3 @@
|
||||
stx $ff
|
||||
cpy $ff
|
||||
bne {la1}
|
@ -0,0 +1,2 @@
|
||||
cpy #0
|
||||
beq {la1}
|
@ -0,0 +1,3 @@
|
||||
sty $ff
|
||||
cpx $ff
|
||||
bne {la1}
|
@ -0,0 +1 @@
|
||||
// do nothing
|
@ -0,0 +1,4 @@
|
||||
lda {z2}
|
||||
sta {z1}
|
||||
lda {z2}+1
|
||||
sta {z1}+1
|
@ -0,0 +1,13 @@
|
||||
sta $fe
|
||||
ora #$7f
|
||||
bmi !+
|
||||
lda #0
|
||||
!:
|
||||
sta $ff
|
||||
sec
|
||||
lda {z1}
|
||||
sbc $fe
|
||||
sta {z1}
|
||||
lda {z1}+1
|
||||
sbc $ff
|
||||
sta {z1}+1
|
@ -0,0 +1,13 @@
|
||||
sta $fe
|
||||
ora #$7f
|
||||
bmi !+
|
||||
lda #0
|
||||
!:
|
||||
sta $ff
|
||||
clc
|
||||
lda {z1}
|
||||
adc $fe
|
||||
sta {z1}
|
||||
lda {z1}+1
|
||||
adc $ff
|
||||
sta {z1}+1
|
@ -0,0 +1,7 @@
|
||||
clc
|
||||
lda {z1}
|
||||
adc {z2}
|
||||
sta {z1}
|
||||
lda {z1}+1
|
||||
adc {z2}+1
|
||||
sta {z1}+1
|
@ -0,0 +1,13 @@
|
||||
sta $fe
|
||||
ora #$7f
|
||||
bmi !+
|
||||
lda #0
|
||||
!:
|
||||
sta $ff
|
||||
sec
|
||||
lda {z2}
|
||||
sbc $fe
|
||||
sta {z1}
|
||||
lda {z2}+1
|
||||
sbc $ff
|
||||
sta {z1}+1
|
@ -0,0 +1,13 @@
|
||||
sta $fe
|
||||
ora #$7f
|
||||
bmi !+
|
||||
lda #0
|
||||
!:
|
||||
sta $ff
|
||||
clc
|
||||
lda {z2}
|
||||
adc $fe
|
||||
sta {z1}
|
||||
lda {z2}+1
|
||||
adc $ff
|
||||
sta {z1}+1
|
@ -0,0 +1,4 @@
|
||||
lda {z2}
|
||||
sta {z1}
|
||||
lda #0
|
||||
sta {z1}+1
|
@ -0,0 +1 @@
|
||||
// do nothing
|
@ -1,6 +1,6 @@
|
||||
clc
|
||||
adc {z1}
|
||||
sta {z1}
|
||||
bcc !+
|
||||
inc {z1}+1
|
||||
!:
|
||||
lda #0
|
||||
adc {z1}+1
|
||||
sta {z1}+1
|
||||
|
@ -1,6 +1,6 @@
|
||||
lda {z1}+1
|
||||
cmp #>{c1}
|
||||
bne {la1}
|
||||
lda {z1}
|
||||
cmp #<{c1}
|
||||
bne {la1}
|
||||
lda {z1}+1
|
||||
cmp #>{c1}
|
||||
bne {la1}
|
@ -231,13 +231,13 @@ public class SymbolTypeInference {
|
||||
if(SymbolType.isSByte(type1) && SymbolType.isSByte(type2)) {
|
||||
return SymbolTypeInline.NUMERIC;
|
||||
}
|
||||
if(SymbolType.isWord(type1) && SymbolType.isWord(type2)) {
|
||||
return SymbolTypeInline.NUMERIC;
|
||||
if(SymbolType.isWord(type1) && (SymbolType.isWord(type2) || SymbolType.isByte(type2))) {
|
||||
return SymbolType.WORD;
|
||||
}
|
||||
if(SymbolType.isSWord(type1) && SymbolType.isSWord(type2)) {
|
||||
return SymbolTypeInline.NUMERIC;
|
||||
if(SymbolType.isSWord(type1) && (SymbolType.isSWord(type2) || SymbolType.isSByte(type2))) {
|
||||
return SymbolType.SWORD;
|
||||
}
|
||||
throw new RuntimeException("Type inference case not handled " + type1 + " " + "+" + " " + type2);
|
||||
throw new RuntimeException("Type inference case not handled " + type1 + " - " + type2);
|
||||
}
|
||||
|
||||
|
||||
|
@ -400,8 +400,8 @@ public class TestPrograms extends TestCase {
|
||||
success &= helper.testOutput(fileName, ".cfg", program.getGraph().toString(program));
|
||||
success &= helper.testOutput(fileName, ".log", program.getLog().toString());
|
||||
if (!success) {
|
||||
System.out.println("\nCOMPILE LOG");
|
||||
System.out.println(program.getLog().toString());
|
||||
//System.out.println("\nCOMPILE LOG");
|
||||
//System.out.println(program.getLog().toString());
|
||||
fail("Output does not match reference!");
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ void init_multiply() {
|
||||
}
|
||||
|
||||
// Fast multiply two unsigned bytes to a word result
|
||||
// Done in assembler to utilize fast addition A+X
|
||||
word multiply(byte a, byte b) {
|
||||
const byte* memA = $fe;
|
||||
const byte* memB = $ff;
|
||||
@ -73,4 +74,17 @@ word multiply(byte a, byte b) {
|
||||
sta memB
|
||||
}
|
||||
return { *memB, *memA };
|
||||
}
|
||||
|
||||
// Fast multiply of two signed bytes to a signed word
|
||||
// Fixes offsets introduced by using unsigned multiplication
|
||||
signed word signed_multiply(signed byte a, signed byte b) {
|
||||
word m = multiply((byte)a, (byte) b);
|
||||
if(a<0) {
|
||||
>m = (>m)-(byte)b;
|
||||
}
|
||||
if(b<0) {
|
||||
>m = (>m)-(byte)a;
|
||||
}
|
||||
return (signed word)m;
|
||||
}
|
@ -17,6 +17,24 @@ void print_ln() {
|
||||
char_cursor = line_cursor;
|
||||
}
|
||||
|
||||
// Print a signed word as HEX
|
||||
void print_sword(signed word w) {
|
||||
if(w<0) {
|
||||
print_char('-');
|
||||
w = -w;
|
||||
}
|
||||
print_word((word)w);
|
||||
}
|
||||
|
||||
// Print a signed byte as HEX
|
||||
void print_sbyte(signed byte b) {
|
||||
if(b<0) {
|
||||
print_char('-');
|
||||
b = -b;
|
||||
}
|
||||
print_byte((byte)b);
|
||||
}
|
||||
|
||||
// Print a word as HEX
|
||||
void print_word(word w) {
|
||||
print_byte(>w);
|
||||
@ -26,7 +44,7 @@ void print_word(word w) {
|
||||
// Print a byte as HEX
|
||||
void print_byte(byte b) {
|
||||
// Table of hexadecimal digits
|
||||
const byte[] hextab = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
const byte[] hextab = "0123456789abcdef";
|
||||
print_char(hextab[b>>4]);
|
||||
print_char(hextab[b&$f]);
|
||||
}
|
||||
|
@ -63,8 +63,8 @@ proc (void()) w()
|
||||
w::@1:
|
||||
(word) w::w1 ← (word/signed word) 1300
|
||||
(word) w::w2 ← (word/signed word) 1250
|
||||
(byte/signed byte/word/signed word~) w::$0 ← (word) w::w1 - (word) w::w2
|
||||
(byte~) w::$1 ← ((byte)) (byte/signed byte/word/signed word~) w::$0
|
||||
(word~) w::$0 ← (word) w::w1 - (word) w::w2
|
||||
(byte~) w::$1 ← ((byte)) (word~) w::$0
|
||||
(byte) w::b ← (byte~) w::$1
|
||||
(byte/signed byte/word/signed word~) w::$2 ← (word/signed word) 1400 - (word/signed word) 1350
|
||||
(byte/word~) w::$3 ← (byte/signed byte/word/signed word~) w::$2 + (byte) w::i
|
||||
@ -103,7 +103,7 @@ SYMBOLS
|
||||
(byte) main::b2
|
||||
(signed byte) main::sb
|
||||
(void()) w()
|
||||
(byte/signed byte/word/signed word~) w::$0
|
||||
(word~) w::$0
|
||||
(byte~) w::$1
|
||||
(byte/signed byte/word/signed word~) w::$2
|
||||
(byte/word~) w::$3
|
||||
@ -160,8 +160,8 @@ w: scope:[w] from
|
||||
w::@1: scope:[w] from w w::@1
|
||||
(word) w::w1 ← (word/signed word) 1300
|
||||
(word) w::w2 ← (word/signed word) 1250
|
||||
(byte/signed byte/word/signed word~) w::$0 ← (word) w::w1 - (word) w::w2
|
||||
(byte~) w::$1 ← ((byte)) (byte/signed byte/word/signed word~) w::$0
|
||||
(word~) w::$0 ← (word) w::w1 - (word) w::w2
|
||||
(byte~) w::$1 ← ((byte)) (word~) w::$0
|
||||
(byte) w::b ← (byte~) w::$1
|
||||
(byte/signed byte/word/signed word~) w::$2 ← (word/signed word) 1400 - (word/signed word) 1350
|
||||
(byte/word~) w::$3 ← (byte/signed byte/word/signed word~) w::$2 + (byte) w::i
|
||||
@ -253,8 +253,8 @@ w::@1: scope:[w] from w w::@1
|
||||
(byte) w::i#2 ← phi( w/(byte) w::i#0 w::@1/(byte) w::i#1 )
|
||||
(word) w::w1#0 ← (word/signed word) 1300
|
||||
(word) w::w2#0 ← (word/signed word) 1250
|
||||
(byte/signed byte/word/signed word~) w::$0 ← (word) w::w1#0 - (word) w::w2#0
|
||||
(byte~) w::$1 ← ((byte)) (byte/signed byte/word/signed word~) w::$0
|
||||
(word~) w::$0 ← (word) w::w1#0 - (word) w::w2#0
|
||||
(byte~) w::$1 ← ((byte)) (word~) w::$0
|
||||
(byte) w::b#0 ← (byte~) w::$1
|
||||
(byte/signed byte/word/signed word~) w::$2 ← (word/signed word) 1400 - (word/signed word) 1350
|
||||
(byte/word~) w::$3 ← (byte/signed byte/word/signed word~) w::$2 + (byte) w::i#2
|
||||
@ -335,7 +335,7 @@ SYMBOL TABLE SSA
|
||||
(signed byte) main::sb
|
||||
(signed byte) main::sb#0
|
||||
(void()) w()
|
||||
(byte/signed byte/word/signed word~) w::$0
|
||||
(word~) w::$0
|
||||
(byte~) w::$1
|
||||
(byte/signed byte/word/signed word~) w::$2
|
||||
(byte/word~) w::$3
|
||||
@ -418,7 +418,7 @@ Succesful SSA optimization Pass2ConstantIdentification
|
||||
Constant (const byte*) SCREEN2#0 = SCREEN#0+$0
|
||||
Constant (const byte*) SCREEN3#0 = SCREEN#0+$2
|
||||
Constant (const byte*) SCREEN4#0 = SCREEN#0+$4
|
||||
Constant (const byte/signed byte/word/signed word) w::$0 = w::w1#0-w::w2#0
|
||||
Constant (const word) w::$0 = w::w1#0-w::w2#0
|
||||
Succesful SSA optimization Pass2ConstantIdentification
|
||||
Constant (const byte) w::b#0 = ((byte))w::$0
|
||||
Succesful SSA optimization Pass2ConstantIdentification
|
||||
|
@ -27,7 +27,7 @@ line: {
|
||||
bcs b1
|
||||
sta x
|
||||
b2:
|
||||
ldy x
|
||||
ldx x
|
||||
jsr plot
|
||||
inc x
|
||||
lda x
|
||||
@ -37,15 +37,15 @@ line: {
|
||||
breturn:
|
||||
rts
|
||||
b1:
|
||||
ldy #x0
|
||||
ldx #x0
|
||||
jsr plot
|
||||
jmp breturn
|
||||
}
|
||||
plot: {
|
||||
ldx plots,y
|
||||
lda SCREEN,x
|
||||
ldy plots,x
|
||||
lda SCREEN,y
|
||||
clc
|
||||
adc #1
|
||||
sta SCREEN,x
|
||||
sta SCREEN,y
|
||||
rts
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ Uplift Scope [line] 252.5: zp ZP_BYTE:3 [ line::x#2 line::x#1 ]
|
||||
Uplift Scope [main] 34.83: zp ZP_BYTE:2 [ main::i#2 main::i#1 ]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [plot] best 3894 combination reg byte y [ plot::x#2 plot::x#1 ] reg byte a [ plot::$0 ] reg byte x [ plot::idx#0 ]
|
||||
Uplifting [plot] best 3894 combination reg byte x [ plot::x#2 plot::x#1 ] reg byte a [ plot::$0 ] reg byte y [ plot::idx#0 ]
|
||||
Uplifting [line] best 3894 combination zp ZP_BYTE:3 [ line::x#2 line::x#1 ]
|
||||
Uplifting [main] best 3744 combination reg byte x [ main::i#2 main::i#1 ]
|
||||
Uplifting [] best 3744 combination
|
||||
@ -829,8 +829,8 @@ line: {
|
||||
jmp b2
|
||||
//SEG32 line::@2
|
||||
b2:
|
||||
//SEG33 [16] (byte) plot::x#1 ← (byte) line::x#2 [ line::x#2 plot::x#1 ] ( main:2::line:11 [ line::x#2 plot::x#1 ] ) -- vbuyy=vbuz1
|
||||
ldy x
|
||||
//SEG33 [16] (byte) plot::x#1 ← (byte) line::x#2 [ line::x#2 plot::x#1 ] ( main:2::line:11 [ line::x#2 plot::x#1 ] ) -- vbuxx=vbuz1
|
||||
ldx x
|
||||
//SEG34 [17] call plot param-assignment [ line::x#2 ] ( main:2::line:11 [ line::x#2 ] )
|
||||
//SEG35 [23] phi from line::@2 to plot [phi:line::@2->plot]
|
||||
plot_from_b2:
|
||||
@ -859,21 +859,21 @@ line: {
|
||||
//SEG44 [22] call plot param-assignment [ ] ( main:2::line:11 [ ] )
|
||||
//SEG45 [23] phi from line::@1 to plot [phi:line::@1->plot]
|
||||
plot_from_b1:
|
||||
//SEG46 [23] phi (byte) plot::x#2 = (const byte) line::x0#0 [phi:line::@1->plot#0] -- vbuyy=vbuc1
|
||||
ldy #x0
|
||||
//SEG46 [23] phi (byte) plot::x#2 = (const byte) line::x0#0 [phi:line::@1->plot#0] -- vbuxx=vbuc1
|
||||
ldx #x0
|
||||
jsr plot
|
||||
jmp breturn
|
||||
}
|
||||
//SEG47 plot
|
||||
plot: {
|
||||
//SEG48 [24] (byte) plot::idx#0 ← *((const byte*) plots#0 + (byte) plot::x#2) [ plot::idx#0 ] ( main:2::line:11::plot:17 [ line::x#2 plot::idx#0 ] main:2::line:11::plot:22 [ plot::idx#0 ] ) -- vbuxx=pbuc1_derefidx_vbuyy
|
||||
ldx plots,y
|
||||
//SEG49 [25] (byte/word~) plot::$0 ← *((const byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word) 1 [ plot::idx#0 plot::$0 ] ( main:2::line:11::plot:17 [ line::x#2 plot::idx#0 plot::$0 ] main:2::line:11::plot:22 [ plot::idx#0 plot::$0 ] ) -- vbuaa=pbuc1_derefidx_vbuxx_plus_1
|
||||
lda SCREEN,x
|
||||
//SEG48 [24] (byte) plot::idx#0 ← *((const byte*) plots#0 + (byte) plot::x#2) [ plot::idx#0 ] ( main:2::line:11::plot:17 [ line::x#2 plot::idx#0 ] main:2::line:11::plot:22 [ plot::idx#0 ] ) -- vbuyy=pbuc1_derefidx_vbuxx
|
||||
ldy plots,x
|
||||
//SEG49 [25] (byte/word~) plot::$0 ← *((const byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word) 1 [ plot::idx#0 plot::$0 ] ( main:2::line:11::plot:17 [ line::x#2 plot::idx#0 plot::$0 ] main:2::line:11::plot:22 [ plot::idx#0 plot::$0 ] ) -- vbuaa=pbuc1_derefidx_vbuyy_plus_1
|
||||
lda SCREEN,y
|
||||
clc
|
||||
adc #1
|
||||
//SEG50 [26] *((const byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/word~) plot::$0 [ ] ( main:2::line:11::plot:17 [ line::x#2 ] main:2::line:11::plot:22 [ ] ) -- pbuc1_derefidx_vbuxx=vbuaa
|
||||
sta SCREEN,x
|
||||
//SEG50 [26] *((const byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/word~) plot::$0 [ ] ( main:2::line:11::plot:17 [ line::x#2 ] main:2::line:11::plot:22 [ ] ) -- pbuc1_derefidx_vbuyy=vbuaa
|
||||
sta SCREEN,y
|
||||
jmp breturn
|
||||
//SEG51 plot::@return
|
||||
breturn:
|
||||
@ -958,17 +958,17 @@ FINAL SYMBOL TABLE
|
||||
(byte/word~) plot::$0 reg byte a 4.0
|
||||
(label) plot::@return
|
||||
(byte) plot::idx
|
||||
(byte) plot::idx#0 reg byte x 3.0
|
||||
(byte) plot::idx#0 reg byte y 3.0
|
||||
(byte) plot::x
|
||||
(byte) plot::x#1 reg byte y 202.0
|
||||
(byte) plot::x#2 reg byte y 103.0
|
||||
(byte) plot::x#1 reg byte x 202.0
|
||||
(byte) plot::x#2 reg byte x 103.0
|
||||
(byte*) plots
|
||||
(const byte*) plots#0 plots = ((byte*))(word/signed word) 4096
|
||||
|
||||
reg byte x [ main::i#2 main::i#1 ]
|
||||
zp ZP_BYTE:2 [ line::x#2 line::x#1 ]
|
||||
reg byte y [ plot::x#2 plot::x#1 ]
|
||||
reg byte x [ plot::idx#0 ]
|
||||
reg byte x [ plot::x#2 plot::x#1 ]
|
||||
reg byte y [ plot::idx#0 ]
|
||||
reg byte a [ plot::$0 ]
|
||||
|
||||
|
||||
@ -1035,8 +1035,8 @@ line: {
|
||||
//SEG31 [15] phi (byte) line::x#2 = (byte) line::x#1 [phi:line::@8->line::@2#0] -- register_copy
|
||||
//SEG32 line::@2
|
||||
b2:
|
||||
//SEG33 [16] (byte) plot::x#1 ← (byte) line::x#2 [ line::x#2 plot::x#1 ] ( main:2::line:11 [ line::x#2 plot::x#1 ] ) -- vbuyy=vbuz1
|
||||
ldy x
|
||||
//SEG33 [16] (byte) plot::x#1 ← (byte) line::x#2 [ line::x#2 plot::x#1 ] ( main:2::line:11 [ line::x#2 plot::x#1 ] ) -- vbuxx=vbuz1
|
||||
ldx x
|
||||
//SEG34 [17] call plot param-assignment [ line::x#2 ] ( main:2::line:11 [ line::x#2 ] )
|
||||
//SEG35 [23] phi from line::@2 to plot [phi:line::@2->plot]
|
||||
//SEG36 [23] phi (byte) plot::x#2 = (byte) plot::x#1 [phi:line::@2->plot#0] -- register_copy
|
||||
@ -1058,21 +1058,21 @@ line: {
|
||||
b1:
|
||||
//SEG44 [22] call plot param-assignment [ ] ( main:2::line:11 [ ] )
|
||||
//SEG45 [23] phi from line::@1 to plot [phi:line::@1->plot]
|
||||
//SEG46 [23] phi (byte) plot::x#2 = (const byte) line::x0#0 [phi:line::@1->plot#0] -- vbuyy=vbuc1
|
||||
ldy #x0
|
||||
//SEG46 [23] phi (byte) plot::x#2 = (const byte) line::x0#0 [phi:line::@1->plot#0] -- vbuxx=vbuc1
|
||||
ldx #x0
|
||||
jsr plot
|
||||
jmp breturn
|
||||
}
|
||||
//SEG47 plot
|
||||
plot: {
|
||||
//SEG48 [24] (byte) plot::idx#0 ← *((const byte*) plots#0 + (byte) plot::x#2) [ plot::idx#0 ] ( main:2::line:11::plot:17 [ line::x#2 plot::idx#0 ] main:2::line:11::plot:22 [ plot::idx#0 ] ) -- vbuxx=pbuc1_derefidx_vbuyy
|
||||
ldx plots,y
|
||||
//SEG49 [25] (byte/word~) plot::$0 ← *((const byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word) 1 [ plot::idx#0 plot::$0 ] ( main:2::line:11::plot:17 [ line::x#2 plot::idx#0 plot::$0 ] main:2::line:11::plot:22 [ plot::idx#0 plot::$0 ] ) -- vbuaa=pbuc1_derefidx_vbuxx_plus_1
|
||||
lda SCREEN,x
|
||||
//SEG48 [24] (byte) plot::idx#0 ← *((const byte*) plots#0 + (byte) plot::x#2) [ plot::idx#0 ] ( main:2::line:11::plot:17 [ line::x#2 plot::idx#0 ] main:2::line:11::plot:22 [ plot::idx#0 ] ) -- vbuyy=pbuc1_derefidx_vbuxx
|
||||
ldy plots,x
|
||||
//SEG49 [25] (byte/word~) plot::$0 ← *((const byte*) SCREEN#0 + (byte) plot::idx#0) + (byte/signed byte/word/signed word) 1 [ plot::idx#0 plot::$0 ] ( main:2::line:11::plot:17 [ line::x#2 plot::idx#0 plot::$0 ] main:2::line:11::plot:22 [ plot::idx#0 plot::$0 ] ) -- vbuaa=pbuc1_derefidx_vbuyy_plus_1
|
||||
lda SCREEN,y
|
||||
clc
|
||||
adc #1
|
||||
//SEG50 [26] *((const byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/word~) plot::$0 [ ] ( main:2::line:11::plot:17 [ line::x#2 ] main:2::line:11::plot:22 [ ] ) -- pbuc1_derefidx_vbuxx=vbuaa
|
||||
sta SCREEN,x
|
||||
//SEG50 [26] *((const byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte/word~) plot::$0 [ ] ( main:2::line:11::plot:17 [ line::x#2 ] main:2::line:11::plot:22 [ ] ) -- pbuc1_derefidx_vbuyy=vbuaa
|
||||
sta SCREEN,y
|
||||
//SEG51 plot::@return
|
||||
//SEG52 [27] return [ ] ( main:2::line:11::plot:17 [ line::x#2 ] main:2::line:11::plot:22 [ ] )
|
||||
rts
|
||||
|
@ -27,15 +27,15 @@
|
||||
(byte/word~) plot::$0 reg byte a 4.0
|
||||
(label) plot::@return
|
||||
(byte) plot::idx
|
||||
(byte) plot::idx#0 reg byte x 3.0
|
||||
(byte) plot::idx#0 reg byte y 3.0
|
||||
(byte) plot::x
|
||||
(byte) plot::x#1 reg byte y 202.0
|
||||
(byte) plot::x#2 reg byte y 103.0
|
||||
(byte) plot::x#1 reg byte x 202.0
|
||||
(byte) plot::x#2 reg byte x 103.0
|
||||
(byte*) plots
|
||||
(const byte*) plots#0 plots = ((byte*))(word/signed word) 4096
|
||||
|
||||
reg byte x [ main::i#2 main::i#1 ]
|
||||
zp ZP_BYTE:2 [ line::x#2 line::x#1 ]
|
||||
reg byte y [ plot::x#2 plot::x#1 ]
|
||||
reg byte x [ plot::idx#0 ]
|
||||
reg byte x [ plot::x#2 plot::x#1 ]
|
||||
reg byte y [ plot::idx#0 ]
|
||||
reg byte a [ plot::$0 ]
|
||||
|
@ -1,13 +1,13 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ] ( )
|
||||
to:@11
|
||||
@11: scope:[] from @begin
|
||||
to:@13
|
||||
@13: scope:[] from @begin
|
||||
[1] phi() [ ] ( )
|
||||
[2] call main param-assignment [ ] ( )
|
||||
to:@end
|
||||
@end: scope:[] from @11
|
||||
@end: scope:[] from @13
|
||||
[3] phi() [ ] ( )
|
||||
main: scope:[main] from @11
|
||||
main: scope:[main] from @13
|
||||
[4] phi() [ ] ( main:2 [ ] )
|
||||
[5] call print_cls param-assignment [ ] ( main:2 [ ] )
|
||||
to:main::@1
|
||||
|
@ -80,6 +80,24 @@ void print_ln() {
|
||||
char_cursor = line_cursor;
|
||||
}
|
||||
|
||||
// Print a signed word as HEX
|
||||
void print_sword(signed word w) {
|
||||
if(w<0) {
|
||||
print_char('-');
|
||||
w = -w;
|
||||
}
|
||||
print_word((word)w);
|
||||
}
|
||||
|
||||
// Print a signed byte as HEX
|
||||
void print_sbyte(signed byte b) {
|
||||
if(b<0) {
|
||||
print_char('-');
|
||||
b = -b;
|
||||
}
|
||||
print_byte((byte)b);
|
||||
}
|
||||
|
||||
// Print a word as HEX
|
||||
void print_word(word w) {
|
||||
print_byte(>w);
|
||||
@ -89,7 +107,7 @@ void print_word(word w) {
|
||||
// Print a byte as HEX
|
||||
void print_byte(byte b) {
|
||||
// Table of hexadecimal digits
|
||||
const byte[] hextab = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
const byte[] hextab = "0123456789abcdef";
|
||||
print_char(hextab[b>>4]);
|
||||
print_char(hextab[b&$f]);
|
||||
}
|
||||
@ -140,6 +158,32 @@ print_ln::@1:
|
||||
print_ln::@return:
|
||||
return
|
||||
endproc // print_ln()
|
||||
proc (void()) print_sword((signed word) print_sword::w)
|
||||
(boolean~) print_sword::$0 ← (signed word) print_sword::w < (byte/signed byte/word/signed word) 0
|
||||
(boolean~) print_sword::$1 ← ! (boolean~) print_sword::$0
|
||||
if((boolean~) print_sword::$1) goto print_sword::@1
|
||||
(void~) print_sword::$2 ← call print_char (byte) '-'
|
||||
(signed word~) print_sword::$3 ← - (signed word) print_sword::w
|
||||
(signed word) print_sword::w ← (signed word~) print_sword::$3
|
||||
print_sword::@1:
|
||||
(word~) print_sword::$4 ← ((word)) (signed word) print_sword::w
|
||||
(void~) print_sword::$5 ← call print_word (word~) print_sword::$4
|
||||
print_sword::@return:
|
||||
return
|
||||
endproc // print_sword()
|
||||
proc (void()) print_sbyte((signed byte) print_sbyte::b)
|
||||
(boolean~) print_sbyte::$0 ← (signed byte) print_sbyte::b < (byte/signed byte/word/signed word) 0
|
||||
(boolean~) print_sbyte::$1 ← ! (boolean~) print_sbyte::$0
|
||||
if((boolean~) print_sbyte::$1) goto print_sbyte::@1
|
||||
(void~) print_sbyte::$2 ← call print_char (byte) '-'
|
||||
(signed byte~) print_sbyte::$3 ← - (signed byte) print_sbyte::b
|
||||
(signed byte) print_sbyte::b ← (signed byte~) print_sbyte::$3
|
||||
print_sbyte::@1:
|
||||
(byte~) print_sbyte::$4 ← ((byte)) (signed byte) print_sbyte::b
|
||||
(void~) print_sbyte::$5 ← call print_byte (byte~) print_sbyte::$4
|
||||
print_sbyte::@return:
|
||||
return
|
||||
endproc // print_sbyte()
|
||||
proc (void()) print_word((word) print_word::w)
|
||||
(byte~) print_word::$0 ← > (word) print_word::w
|
||||
(void~) print_word::$1 ← call print_byte (byte~) print_word::$0
|
||||
@ -149,7 +193,7 @@ print_word::@return:
|
||||
return
|
||||
endproc // print_word()
|
||||
proc (void()) print_byte((byte) print_byte::b)
|
||||
(byte[]) print_byte::hextab ← { (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f' }
|
||||
(byte[]) print_byte::hextab ← (string) "0123456789abcdef"
|
||||
(byte~) print_byte::$0 ← (byte) print_byte::b >> (byte/signed byte/word/signed word) 4
|
||||
(void~) print_byte::$1 ← call print_char *((byte[]) print_byte::hextab + (byte~) print_byte::$0)
|
||||
(byte~) print_byte::$2 ← (byte) print_byte::b & (byte/signed byte/word/signed word) 15
|
||||
@ -314,6 +358,16 @@ SYMBOLS
|
||||
(boolean~) print_ln::$1
|
||||
(label) print_ln::@1
|
||||
(label) print_ln::@return
|
||||
(void()) print_sbyte((signed byte) print_sbyte::b)
|
||||
(boolean~) print_sbyte::$0
|
||||
(boolean~) print_sbyte::$1
|
||||
(void~) print_sbyte::$2
|
||||
(signed byte~) print_sbyte::$3
|
||||
(byte~) print_sbyte::$4
|
||||
(void~) print_sbyte::$5
|
||||
(label) print_sbyte::@1
|
||||
(label) print_sbyte::@return
|
||||
(signed byte) print_sbyte::b
|
||||
(void()) print_str((byte*) print_str::str)
|
||||
(boolean~) print_str::$0
|
||||
(label) print_str::@1
|
||||
@ -321,6 +375,16 @@ SYMBOLS
|
||||
(label) print_str::@3
|
||||
(label) print_str::@return
|
||||
(byte*) print_str::str
|
||||
(void()) print_sword((signed word) print_sword::w)
|
||||
(boolean~) print_sword::$0
|
||||
(boolean~) print_sword::$1
|
||||
(void~) print_sword::$2
|
||||
(signed word~) print_sword::$3
|
||||
(word~) print_sword::$4
|
||||
(void~) print_sword::$5
|
||||
(label) print_sword::@1
|
||||
(label) print_sword::@return
|
||||
(signed word) print_sword::w
|
||||
(void()) print_word((word) print_word::w)
|
||||
(byte~) print_word::$0
|
||||
(void~) print_word::$1
|
||||
@ -407,6 +471,44 @@ print_ln::@return: scope:[print_ln] from print_ln::@2
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
print_sword: scope:[print_sword] from
|
||||
(boolean~) print_sword::$0 ← (signed word) print_sword::w < (byte/signed byte/word/signed word) 0
|
||||
(boolean~) print_sword::$1 ← ! (boolean~) print_sword::$0
|
||||
if((boolean~) print_sword::$1) goto print_sword::@1
|
||||
to:print_sword::@2
|
||||
print_sword::@1: scope:[print_sword] from print_sword print_sword::@2
|
||||
(word~) print_sword::$4 ← ((word)) (signed word) print_sword::w
|
||||
(void~) print_sword::$5 ← call print_word (word~) print_sword::$4
|
||||
to:print_sword::@return
|
||||
print_sword::@2: scope:[print_sword] from print_sword
|
||||
(void~) print_sword::$2 ← call print_char (byte) '-'
|
||||
(signed word~) print_sword::$3 ← - (signed word) print_sword::w
|
||||
(signed word) print_sword::w ← (signed word~) print_sword::$3
|
||||
to:print_sword::@1
|
||||
print_sword::@return: scope:[print_sword] from print_sword::@1
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
print_sbyte: scope:[print_sbyte] from
|
||||
(boolean~) print_sbyte::$0 ← (signed byte) print_sbyte::b < (byte/signed byte/word/signed word) 0
|
||||
(boolean~) print_sbyte::$1 ← ! (boolean~) print_sbyte::$0
|
||||
if((boolean~) print_sbyte::$1) goto print_sbyte::@1
|
||||
to:print_sbyte::@2
|
||||
print_sbyte::@1: scope:[print_sbyte] from print_sbyte print_sbyte::@2
|
||||
(byte~) print_sbyte::$4 ← ((byte)) (signed byte) print_sbyte::b
|
||||
(void~) print_sbyte::$5 ← call print_byte (byte~) print_sbyte::$4
|
||||
to:print_sbyte::@return
|
||||
print_sbyte::@2: scope:[print_sbyte] from print_sbyte
|
||||
(void~) print_sbyte::$2 ← call print_char (byte) '-'
|
||||
(signed byte~) print_sbyte::$3 ← - (signed byte) print_sbyte::b
|
||||
(signed byte) print_sbyte::b ← (signed byte~) print_sbyte::$3
|
||||
to:print_sbyte::@1
|
||||
print_sbyte::@return: scope:[print_sbyte] from print_sbyte::@1
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
to:@5
|
||||
print_word: scope:[print_word] from
|
||||
(byte~) print_word::$0 ← > (word) print_word::w
|
||||
(void~) print_word::$1 ← call print_byte (byte~) print_word::$0
|
||||
@ -416,10 +518,10 @@ print_word: scope:[print_word] from
|
||||
print_word::@return: scope:[print_word] from print_word
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
@5: scope:[] from @4
|
||||
to:@6
|
||||
print_byte: scope:[print_byte] from
|
||||
(byte[]) print_byte::hextab ← { (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f' }
|
||||
(byte[]) print_byte::hextab ← (string) "0123456789abcdef"
|
||||
(byte~) print_byte::$0 ← (byte) print_byte::b >> (byte/signed byte/word/signed word) 4
|
||||
(void~) print_byte::$1 ← call print_char *((byte[]) print_byte::hextab + (byte~) print_byte::$0)
|
||||
(byte~) print_byte::$2 ← (byte) print_byte::b & (byte/signed byte/word/signed word) 15
|
||||
@ -428,8 +530,8 @@ print_byte: scope:[print_byte] from
|
||||
print_byte::@return: scope:[print_byte] from print_byte
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
to:@5
|
||||
@6: scope:[] from @5
|
||||
to:@7
|
||||
print_char: scope:[print_char] from
|
||||
*((byte*) char_cursor) ← (byte) print_char::ch
|
||||
(byte*) char_cursor ← ++ (byte*) char_cursor
|
||||
@ -437,8 +539,8 @@ print_char: scope:[print_char] from
|
||||
print_char::@return: scope:[print_char] from print_char
|
||||
return
|
||||
to:@return
|
||||
@5: scope:[] from @4
|
||||
to:@6
|
||||
@7: scope:[] from @6
|
||||
to:@8
|
||||
print_cls: scope:[print_cls] from
|
||||
(byte*) print_cls::sc ← ((byte*)) (word/signed word) 1024
|
||||
to:print_cls::@1
|
||||
@ -454,11 +556,11 @@ print_cls::@2: scope:[print_cls] from print_cls::@1
|
||||
print_cls::@return: scope:[print_cls] from print_cls::@2
|
||||
return
|
||||
to:@return
|
||||
@6: scope:[] from @5
|
||||
@8: scope:[] from @7
|
||||
(byte*) BGCOL ← ((byte*)) (word) 53281
|
||||
(byte) GREEN ← (byte/signed byte/word/signed word) 5
|
||||
(byte) RED ← (byte/signed byte/word/signed word) 2
|
||||
to:@7
|
||||
to:@9
|
||||
main: scope:[main] from
|
||||
(void~) main::$0 ← call print_cls
|
||||
*((byte*) BGCOL) ← (byte) GREEN
|
||||
@ -468,8 +570,8 @@ main: scope:[main] from
|
||||
main::@return: scope:[main] from main
|
||||
return
|
||||
to:@return
|
||||
@7: scope:[] from @6
|
||||
to:@8
|
||||
@9: scope:[] from @8
|
||||
to:@10
|
||||
test_bytes: scope:[test_bytes] from
|
||||
(byte) test_bytes::bb ← (byte/signed byte/word/signed word) 0
|
||||
(void~) test_bytes::$0 ← call assert_byte (string) "0=0@" (byte) test_bytes::bb (byte/signed byte/word/signed word) 0
|
||||
@ -484,8 +586,8 @@ test_bytes: scope:[test_bytes] from
|
||||
test_bytes::@return: scope:[test_bytes] from test_bytes
|
||||
return
|
||||
to:@return
|
||||
@8: scope:[] from @7
|
||||
to:@9
|
||||
@10: scope:[] from @9
|
||||
to:@11
|
||||
assert_byte: scope:[assert_byte] from
|
||||
(void~) assert_byte::$0 ← call print_str (byte*) assert_byte::msg
|
||||
(void~) assert_byte::$1 ← call print_str (string) " @"
|
||||
@ -508,8 +610,8 @@ assert_byte::@4: scope:[assert_byte] from
|
||||
assert_byte::@return: scope:[assert_byte] from assert_byte::@2
|
||||
return
|
||||
to:@return
|
||||
@9: scope:[] from @8
|
||||
to:@10
|
||||
@11: scope:[] from @10
|
||||
to:@12
|
||||
test_sbytes: scope:[test_sbytes] from
|
||||
(signed byte) test_sbytes::bb ← (byte/signed byte/word/signed word) 0
|
||||
(void~) test_sbytes::$0 ← call assert_sbyte (string) "0=0@" (signed byte) test_sbytes::bb (byte/signed byte/word/signed word) 0
|
||||
@ -532,8 +634,8 @@ test_sbytes: scope:[test_sbytes] from
|
||||
test_sbytes::@return: scope:[test_sbytes] from test_sbytes
|
||||
return
|
||||
to:@return
|
||||
@10: scope:[] from @9
|
||||
to:@11
|
||||
@12: scope:[] from @11
|
||||
to:@13
|
||||
assert_sbyte: scope:[assert_sbyte] from
|
||||
(void~) assert_sbyte::$0 ← call print_str (byte*) assert_sbyte::msg
|
||||
(void~) assert_sbyte::$1 ← call print_str (string) " @"
|
||||
@ -556,11 +658,13 @@ assert_sbyte::@4: scope:[assert_sbyte] from
|
||||
assert_sbyte::@return: scope:[assert_sbyte] from assert_sbyte::@2
|
||||
return
|
||||
to:@return
|
||||
@11: scope:[] from @10
|
||||
@13: scope:[] from @12
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @11
|
||||
@end: scope:[] from @13
|
||||
|
||||
Removing unused procedure print_sword
|
||||
Removing unused procedure print_sbyte
|
||||
Removing unused procedure print_word
|
||||
Removing unused procedure print_byte
|
||||
Removing unused procedure print_char
|
||||
@ -608,12 +712,14 @@ Removing empty block @2
|
||||
Removing empty block @3
|
||||
Removing empty block @4
|
||||
Removing empty block @5
|
||||
Removing empty block print_cls::@2
|
||||
Removing empty block @6
|
||||
Removing empty block @7
|
||||
Removing empty block @8
|
||||
Removing empty block assert_byte::@4
|
||||
Removing empty block print_cls::@2
|
||||
Removing empty block @9
|
||||
Removing empty block @10
|
||||
Removing empty block assert_byte::@4
|
||||
Removing empty block @11
|
||||
Removing empty block @12
|
||||
Removing empty block assert_sbyte::@4
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
print_str modifies char_cursor
|
||||
@ -642,7 +748,7 @@ CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
@begin: scope:[] from
|
||||
(byte*) line_cursor#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte*) char_cursor#0 ← (byte*) line_cursor#0
|
||||
to:@6
|
||||
to:@8
|
||||
print_str: scope:[print_str] from assert_byte assert_byte::@1 assert_byte::@3 assert_byte::@5 assert_sbyte assert_sbyte::@1 assert_sbyte::@3 assert_sbyte::@5
|
||||
(byte*) char_cursor#75 ← phi( assert_byte/(byte*) char_cursor#65 assert_byte::@1/(byte*) char_cursor#66 assert_byte::@3/(byte*) char_cursor#67 assert_byte::@5/(byte*) char_cursor#12 assert_sbyte/(byte*) char_cursor#70 assert_sbyte::@1/(byte*) char_cursor#71 assert_sbyte::@3/(byte*) char_cursor#72 assert_sbyte::@5/(byte*) char_cursor#24 )
|
||||
(byte*) print_str::str#11 ← phi( assert_byte/(byte*) print_str::str#1 assert_byte::@1/(byte*) print_str::str#3 assert_byte::@3/(byte*) print_str::str#4 assert_byte::@5/(byte*) print_str::str#2 assert_sbyte/(byte*) print_str::str#5 assert_sbyte::@1/(byte*) print_str::str#7 assert_sbyte::@3/(byte*) print_str::str#8 assert_sbyte::@5/(byte*) print_str::str#6 )
|
||||
@ -702,16 +808,16 @@ print_cls::@1: scope:[print_cls] from print_cls print_cls::@1
|
||||
print_cls::@return: scope:[print_cls] from print_cls::@1
|
||||
return
|
||||
to:@return
|
||||
@6: scope:[] from @begin
|
||||
@8: scope:[] from @begin
|
||||
(byte*) line_cursor#54 ← phi( @begin/(byte*) line_cursor#0 )
|
||||
(byte*) char_cursor#77 ← phi( @begin/(byte*) char_cursor#0 )
|
||||
(byte*) BGCOL#0 ← ((byte*)) (word) 53281
|
||||
(byte) GREEN#0 ← (byte/signed byte/word/signed word) 5
|
||||
(byte) RED#0 ← (byte/signed byte/word/signed word) 2
|
||||
to:@11
|
||||
main: scope:[main] from @11
|
||||
(byte*) line_cursor#49 ← phi( @11/(byte*) line_cursor#48 )
|
||||
(byte*) char_cursor#76 ← phi( @11/(byte*) char_cursor#74 )
|
||||
to:@13
|
||||
main: scope:[main] from @13
|
||||
(byte*) line_cursor#49 ← phi( @13/(byte*) line_cursor#48 )
|
||||
(byte*) char_cursor#76 ← phi( @13/(byte*) char_cursor#74 )
|
||||
call print_cls param-assignment
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main
|
||||
@ -1003,23 +1109,23 @@ assert_sbyte::@return: scope:[assert_sbyte] from assert_sbyte::@9
|
||||
(byte*) line_cursor#19 ← (byte*) line_cursor#40
|
||||
return
|
||||
to:@return
|
||||
@11: scope:[] from @6
|
||||
(byte*) line_cursor#48 ← phi( @6/(byte*) line_cursor#54 )
|
||||
(byte*) char_cursor#74 ← phi( @6/(byte*) char_cursor#77 )
|
||||
@13: scope:[] from @8
|
||||
(byte*) line_cursor#48 ← phi( @8/(byte*) line_cursor#54 )
|
||||
(byte*) char_cursor#74 ← phi( @8/(byte*) char_cursor#77 )
|
||||
call main param-assignment
|
||||
to:@12
|
||||
@12: scope:[] from @11
|
||||
(byte*) line_cursor#41 ← phi( @11/(byte*) line_cursor#5 )
|
||||
(byte*) char_cursor#60 ← phi( @11/(byte*) char_cursor#7 )
|
||||
to:@14
|
||||
@14: scope:[] from @13
|
||||
(byte*) line_cursor#41 ← phi( @13/(byte*) line_cursor#5 )
|
||||
(byte*) char_cursor#60 ← phi( @13/(byte*) char_cursor#7 )
|
||||
(byte*) char_cursor#30 ← (byte*) char_cursor#60
|
||||
(byte*) line_cursor#20 ← (byte*) line_cursor#41
|
||||
to:@end
|
||||
@end: scope:[] from @12
|
||||
@end: scope:[] from @14
|
||||
|
||||
SYMBOL TABLE SSA
|
||||
(label) @11
|
||||
(label) @12
|
||||
(label) @6
|
||||
(label) @13
|
||||
(label) @14
|
||||
(label) @8
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
@ -1702,7 +1808,7 @@ Constant (const byte) assert_byte::b#2 = test_bytes::bd#0
|
||||
Constant (const signed byte) assert_sbyte::b#3 = test_sbytes::be#0
|
||||
Succesful SSA optimization Pass2ConstantIdentification
|
||||
Culled Empty Block (label) print_ln::@2
|
||||
Culled Empty Block (label) @6
|
||||
Culled Empty Block (label) @8
|
||||
Culled Empty Block (label) main::@3
|
||||
Culled Empty Block (label) test_bytes::@3
|
||||
Culled Empty Block (label) assert_byte::@7
|
||||
@ -1712,7 +1818,7 @@ Culled Empty Block (label) test_sbytes::@5
|
||||
Culled Empty Block (label) assert_sbyte::@7
|
||||
Culled Empty Block (label) assert_sbyte::@8
|
||||
Culled Empty Block (label) assert_sbyte::@9
|
||||
Culled Empty Block (label) @12
|
||||
Culled Empty Block (label) @14
|
||||
Succesful SSA optimization Pass2CullEmptyBlocks
|
||||
Not aliassing across scopes: print_str::str#11 print_str::str#1
|
||||
Not aliassing across scopes: char_cursor#75 char_cursor#65
|
||||
@ -1842,12 +1948,12 @@ Constant inlined print_str::str#8 = (const string) assert_sbyte::str2
|
||||
Constant inlined print_str::str#7 = (const string) assert_sbyte::str1
|
||||
Constant inlined print_str::str#6 = (const string) assert_sbyte::str
|
||||
Succesful SSA optimization Pass2ConstantInlining
|
||||
Block Sequence Planned @begin @11 @end main main::@1 main::@2 main::@return test_sbytes test_sbytes::@1 test_sbytes::@2 test_sbytes::@3 test_sbytes::@4 test_sbytes::@return assert_sbyte assert_sbyte::@5 assert_sbyte::@6 assert_sbyte::@3 assert_sbyte::@2 assert_sbyte::@return assert_sbyte::@1 print_str print_str::@1 print_str::@return print_str::@2 print_ln print_ln::@1 print_ln::@return test_bytes test_bytes::@1 test_bytes::@2 test_bytes::@return assert_byte assert_byte::@5 assert_byte::@6 assert_byte::@3 assert_byte::@2 assert_byte::@return assert_byte::@1 print_cls print_cls::@1 print_cls::@return
|
||||
Block Sequence Planned @begin @13 @end main main::@1 main::@2 main::@return test_sbytes test_sbytes::@1 test_sbytes::@2 test_sbytes::@3 test_sbytes::@4 test_sbytes::@return assert_sbyte assert_sbyte::@5 assert_sbyte::@6 assert_sbyte::@3 assert_sbyte::@2 assert_sbyte::@return assert_sbyte::@1 print_str print_str::@1 print_str::@return print_str::@2 print_ln print_ln::@1 print_ln::@return test_bytes test_bytes::@1 test_bytes::@2 test_bytes::@return assert_byte assert_byte::@5 assert_byte::@6 assert_byte::@3 assert_byte::@2 assert_byte::@return assert_byte::@1 print_cls print_cls::@1 print_cls::@return
|
||||
Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1)
|
||||
Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1)
|
||||
Block Sequence Planned @begin @11 @end main main::@1 main::@2 main::@return test_sbytes test_sbytes::@1 test_sbytes::@2 test_sbytes::@3 test_sbytes::@4 test_sbytes::@return assert_sbyte assert_sbyte::@5 assert_sbyte::@6 assert_sbyte::@3 assert_sbyte::@2 assert_sbyte::@return assert_sbyte::@1 print_str print_str::@1 print_str::@return print_str::@2 print_ln print_ln::@1 print_ln::@return print_ln::@3 test_bytes test_bytes::@1 test_bytes::@2 test_bytes::@return assert_byte assert_byte::@5 assert_byte::@6 assert_byte::@3 assert_byte::@2 assert_byte::@return assert_byte::@1 print_cls print_cls::@1 print_cls::@return print_cls::@3
|
||||
Block Sequence Planned @begin @13 @end main main::@1 main::@2 main::@return test_sbytes test_sbytes::@1 test_sbytes::@2 test_sbytes::@3 test_sbytes::@4 test_sbytes::@return assert_sbyte assert_sbyte::@5 assert_sbyte::@6 assert_sbyte::@3 assert_sbyte::@2 assert_sbyte::@return assert_sbyte::@1 print_str print_str::@1 print_str::@return print_str::@2 print_ln print_ln::@1 print_ln::@return print_ln::@3 test_bytes test_bytes::@1 test_bytes::@2 test_bytes::@return assert_byte assert_byte::@5 assert_byte::@6 assert_byte::@3 assert_byte::@2 assert_byte::@return assert_byte::@1 print_cls print_cls::@1 print_cls::@return print_cls::@3
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @11
|
||||
Adding NOP phi() at start of @13
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@2
|
||||
@ -1903,9 +2009,9 @@ Coalesced [87] print_cls::sc#3 ← print_cls::sc#1
|
||||
Coalesced down to 10 phi equivalence classes
|
||||
Culled Empty Block (label) print_ln::@3
|
||||
Culled Empty Block (label) print_cls::@3
|
||||
Block Sequence Planned @begin @11 @end main main::@1 main::@2 main::@return test_sbytes test_sbytes::@1 test_sbytes::@2 test_sbytes::@3 test_sbytes::@4 test_sbytes::@return assert_sbyte assert_sbyte::@5 assert_sbyte::@6 assert_sbyte::@3 assert_sbyte::@2 assert_sbyte::@return assert_sbyte::@1 print_str print_str::@1 print_str::@return print_str::@2 print_ln print_ln::@1 print_ln::@return test_bytes test_bytes::@1 test_bytes::@2 test_bytes::@return assert_byte assert_byte::@5 assert_byte::@6 assert_byte::@3 assert_byte::@2 assert_byte::@return assert_byte::@1 print_cls print_cls::@1 print_cls::@return
|
||||
Block Sequence Planned @begin @13 @end main main::@1 main::@2 main::@return test_sbytes test_sbytes::@1 test_sbytes::@2 test_sbytes::@3 test_sbytes::@4 test_sbytes::@return assert_sbyte assert_sbyte::@5 assert_sbyte::@6 assert_sbyte::@3 assert_sbyte::@2 assert_sbyte::@return assert_sbyte::@1 print_str print_str::@1 print_str::@return print_str::@2 print_ln print_ln::@1 print_ln::@return test_bytes test_bytes::@1 test_bytes::@2 test_bytes::@return assert_byte assert_byte::@5 assert_byte::@6 assert_byte::@3 assert_byte::@2 assert_byte::@return assert_byte::@1 print_cls print_cls::@1 print_cls::@return
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @11
|
||||
Adding NOP phi() at start of @13
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@2
|
||||
@ -1934,14 +2040,14 @@ Propagating live ranges...
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ] ( )
|
||||
to:@11
|
||||
@11: scope:[] from @begin
|
||||
to:@13
|
||||
@13: scope:[] from @begin
|
||||
[1] phi() [ ] ( )
|
||||
[2] call main param-assignment [ ] ( )
|
||||
to:@end
|
||||
@end: scope:[] from @11
|
||||
@end: scope:[] from @13
|
||||
[3] phi() [ ] ( )
|
||||
main: scope:[main] from @11
|
||||
main: scope:[main] from @13
|
||||
[4] phi() [ ] ( main:2 [ ] )
|
||||
[5] call print_cls param-assignment [ ] ( main:2 [ ] )
|
||||
to:main::@1
|
||||
@ -2098,46 +2204,46 @@ print_cls::@return: scope:[print_cls] from print_cls::@1
|
||||
|
||||
DOMINATORS
|
||||
@begin dominated by @begin
|
||||
@11 dominated by @11 @begin
|
||||
@end dominated by @end @11 @begin
|
||||
main dominated by main @11 @begin
|
||||
main::@1 dominated by main main::@1 @11 @begin
|
||||
main::@2 dominated by main main::@1 main::@2 @11 @begin
|
||||
main::@return dominated by main::@return main main::@1 main::@2 @11 @begin
|
||||
test_sbytes dominated by main test_sbytes main::@1 main::@2 @11 @begin
|
||||
test_sbytes::@1 dominated by main test_sbytes main::@1 main::@2 @11 @begin test_sbytes::@1
|
||||
test_sbytes::@2 dominated by main test_sbytes main::@1 main::@2 @11 @begin test_sbytes::@1 test_sbytes::@2
|
||||
test_sbytes::@3 dominated by main test_sbytes main::@1 main::@2 @11 @begin test_sbytes::@1 test_sbytes::@2 test_sbytes::@3
|
||||
test_sbytes::@4 dominated by main test_sbytes main::@1 main::@2 @11 @begin test_sbytes::@1 test_sbytes::@2 test_sbytes::@3 test_sbytes::@4
|
||||
test_sbytes::@return dominated by test_sbytes::@return main test_sbytes main::@1 main::@2 @11 @begin test_sbytes::@1 test_sbytes::@2 test_sbytes::@3 test_sbytes::@4
|
||||
assert_sbyte dominated by assert_sbyte main test_sbytes main::@1 main::@2 @11 @begin
|
||||
assert_sbyte::@5 dominated by assert_sbyte main test_sbytes main::@1 main::@2 @11 @begin assert_sbyte::@5
|
||||
assert_sbyte::@6 dominated by assert_sbyte main test_sbytes main::@1 main::@2 @11 @begin assert_sbyte::@5 assert_sbyte::@6
|
||||
assert_sbyte::@3 dominated by assert_sbyte main test_sbytes main::@1 main::@2 @11 @begin assert_sbyte::@5 assert_sbyte::@3 assert_sbyte::@6
|
||||
assert_sbyte::@2 dominated by assert_sbyte main test_sbytes main::@1 main::@2 @11 @begin assert_sbyte::@5 assert_sbyte::@2 assert_sbyte::@6
|
||||
assert_sbyte::@return dominated by assert_sbyte assert_sbyte::@return main test_sbytes main::@1 main::@2 @11 @begin assert_sbyte::@5 assert_sbyte::@2 assert_sbyte::@6
|
||||
assert_sbyte::@1 dominated by assert_sbyte main test_sbytes main::@1 main::@2 @11 @begin assert_sbyte::@5 assert_sbyte::@1 assert_sbyte::@6
|
||||
print_str dominated by main main::@1 @11 @begin print_str
|
||||
print_str::@1 dominated by main print_str::@1 main::@1 @11 @begin print_str
|
||||
print_str::@return dominated by print_str::@return main print_str::@1 main::@1 @11 @begin print_str
|
||||
print_str::@2 dominated by main print_str::@1 print_str::@2 main::@1 @11 @begin print_str
|
||||
print_ln dominated by main main::@1 @11 @begin print_ln
|
||||
print_ln::@1 dominated by print_ln::@1 main main::@1 @11 @begin print_ln
|
||||
print_ln::@return dominated by print_ln::@1 main print_ln::@return main::@1 @11 @begin print_ln
|
||||
test_bytes dominated by test_bytes main main::@1 @11 @begin
|
||||
test_bytes::@1 dominated by test_bytes main main::@1 @11 @begin test_bytes::@1
|
||||
test_bytes::@2 dominated by test_bytes main main::@1 @11 @begin test_bytes::@2 test_bytes::@1
|
||||
test_bytes::@return dominated by test_bytes main main::@1 @11 @begin test_bytes::@2 test_bytes::@1 test_bytes::@return
|
||||
assert_byte dominated by test_bytes main main::@1 @11 @begin assert_byte
|
||||
assert_byte::@5 dominated by test_bytes main assert_byte::@5 main::@1 @11 @begin assert_byte
|
||||
assert_byte::@6 dominated by test_bytes main assert_byte::@5 assert_byte::@6 main::@1 @11 @begin assert_byte
|
||||
assert_byte::@3 dominated by test_bytes assert_byte::@3 main assert_byte::@5 assert_byte::@6 main::@1 @11 @begin assert_byte
|
||||
assert_byte::@2 dominated by test_bytes main assert_byte::@5 assert_byte::@6 assert_byte::@2 main::@1 @11 @begin assert_byte
|
||||
assert_byte::@return dominated by test_bytes main assert_byte::@5 assert_byte::@6 assert_byte::@2 main::@1 assert_byte::@return @11 @begin assert_byte
|
||||
assert_byte::@1 dominated by test_bytes main assert_byte::@5 assert_byte::@6 assert_byte::@1 main::@1 @11 @begin assert_byte
|
||||
print_cls dominated by main @11 @begin print_cls
|
||||
print_cls::@1 dominated by main @11 @begin print_cls::@1 print_cls
|
||||
print_cls::@return dominated by main print_cls::@return @11 @begin print_cls::@1 print_cls
|
||||
@13 dominated by @13 @begin
|
||||
@end dominated by @end @13 @begin
|
||||
main dominated by main @13 @begin
|
||||
main::@1 dominated by main main::@1 @13 @begin
|
||||
main::@2 dominated by main main::@1 main::@2 @13 @begin
|
||||
main::@return dominated by main::@return main main::@1 main::@2 @13 @begin
|
||||
test_sbytes dominated by main test_sbytes main::@1 main::@2 @13 @begin
|
||||
test_sbytes::@1 dominated by main test_sbytes main::@1 main::@2 @13 @begin test_sbytes::@1
|
||||
test_sbytes::@2 dominated by main test_sbytes main::@1 main::@2 @13 @begin test_sbytes::@1 test_sbytes::@2
|
||||
test_sbytes::@3 dominated by main test_sbytes main::@1 main::@2 @13 @begin test_sbytes::@1 test_sbytes::@2 test_sbytes::@3
|
||||
test_sbytes::@4 dominated by main test_sbytes main::@1 main::@2 @13 @begin test_sbytes::@1 test_sbytes::@2 test_sbytes::@3 test_sbytes::@4
|
||||
test_sbytes::@return dominated by test_sbytes::@return main test_sbytes main::@1 main::@2 @13 @begin test_sbytes::@1 test_sbytes::@2 test_sbytes::@3 test_sbytes::@4
|
||||
assert_sbyte dominated by assert_sbyte main test_sbytes main::@1 main::@2 @13 @begin
|
||||
assert_sbyte::@5 dominated by assert_sbyte main test_sbytes main::@1 main::@2 @13 @begin assert_sbyte::@5
|
||||
assert_sbyte::@6 dominated by assert_sbyte main test_sbytes main::@1 main::@2 @13 @begin assert_sbyte::@5 assert_sbyte::@6
|
||||
assert_sbyte::@3 dominated by assert_sbyte main test_sbytes main::@1 main::@2 @13 @begin assert_sbyte::@5 assert_sbyte::@3 assert_sbyte::@6
|
||||
assert_sbyte::@2 dominated by assert_sbyte main test_sbytes main::@1 main::@2 @13 @begin assert_sbyte::@5 assert_sbyte::@2 assert_sbyte::@6
|
||||
assert_sbyte::@return dominated by assert_sbyte assert_sbyte::@return main test_sbytes main::@1 main::@2 @13 @begin assert_sbyte::@5 assert_sbyte::@2 assert_sbyte::@6
|
||||
assert_sbyte::@1 dominated by assert_sbyte main test_sbytes main::@1 main::@2 @13 @begin assert_sbyte::@5 assert_sbyte::@1 assert_sbyte::@6
|
||||
print_str dominated by main main::@1 @13 @begin print_str
|
||||
print_str::@1 dominated by main print_str::@1 main::@1 @13 @begin print_str
|
||||
print_str::@return dominated by print_str::@return main print_str::@1 main::@1 @13 @begin print_str
|
||||
print_str::@2 dominated by main print_str::@1 print_str::@2 main::@1 @13 @begin print_str
|
||||
print_ln dominated by main main::@1 @13 @begin print_ln
|
||||
print_ln::@1 dominated by print_ln::@1 main main::@1 @13 @begin print_ln
|
||||
print_ln::@return dominated by print_ln::@1 main print_ln::@return main::@1 @13 @begin print_ln
|
||||
test_bytes dominated by test_bytes main main::@1 @13 @begin
|
||||
test_bytes::@1 dominated by test_bytes main main::@1 @13 @begin test_bytes::@1
|
||||
test_bytes::@2 dominated by test_bytes main main::@1 @13 @begin test_bytes::@2 test_bytes::@1
|
||||
test_bytes::@return dominated by test_bytes main main::@1 @13 @begin test_bytes::@2 test_bytes::@1 test_bytes::@return
|
||||
assert_byte dominated by test_bytes main main::@1 @13 @begin assert_byte
|
||||
assert_byte::@5 dominated by test_bytes main assert_byte::@5 main::@1 @13 @begin assert_byte
|
||||
assert_byte::@6 dominated by test_bytes main assert_byte::@5 assert_byte::@6 main::@1 @13 @begin assert_byte
|
||||
assert_byte::@3 dominated by test_bytes assert_byte::@3 main assert_byte::@5 assert_byte::@6 main::@1 @13 @begin assert_byte
|
||||
assert_byte::@2 dominated by test_bytes main assert_byte::@5 assert_byte::@6 assert_byte::@2 main::@1 @13 @begin assert_byte
|
||||
assert_byte::@return dominated by test_bytes main assert_byte::@5 assert_byte::@6 assert_byte::@2 main::@1 assert_byte::@return @13 @begin assert_byte
|
||||
assert_byte::@1 dominated by test_bytes main assert_byte::@5 assert_byte::@6 assert_byte::@1 main::@1 @13 @begin assert_byte
|
||||
print_cls dominated by main @13 @begin print_cls
|
||||
print_cls::@1 dominated by main @13 @begin print_cls::@1 print_cls
|
||||
print_cls::@return dominated by main print_cls::@return @13 @begin print_cls::@1 print_cls
|
||||
|
||||
NATURAL LOOPS
|
||||
Found back edge: Loop head: print_str::@1 tails: print_str::@2 blocks: null
|
||||
@ -2269,17 +2375,17 @@ INITIAL ASM
|
||||
.label line_cursor = $a
|
||||
//SEG2 @begin
|
||||
bbegin:
|
||||
//SEG3 [1] phi from @begin to @11 [phi:@begin->@11]
|
||||
b11_from_bbegin:
|
||||
jmp b11
|
||||
//SEG4 @11
|
||||
b11:
|
||||
//SEG3 [1] phi from @begin to @13 [phi:@begin->@13]
|
||||
b13_from_bbegin:
|
||||
jmp b13
|
||||
//SEG4 @13
|
||||
b13:
|
||||
//SEG5 [2] call main param-assignment [ ] ( )
|
||||
//SEG6 [4] phi from @11 to main [phi:@11->main]
|
||||
main_from_b11:
|
||||
//SEG6 [4] phi from @13 to main [phi:@13->main]
|
||||
main_from_b13:
|
||||
jsr main
|
||||
//SEG7 [3] phi from @11 to @end [phi:@11->@end]
|
||||
bend_from_b11:
|
||||
//SEG7 [3] phi from @13 to @end [phi:@13->@end]
|
||||
bend_from_b13:
|
||||
jmp bend
|
||||
//SEG8 @end
|
||||
bend:
|
||||
@ -2906,17 +3012,17 @@ ASSEMBLER BEFORE OPTIMIZATION
|
||||
.label line_cursor = 7
|
||||
//SEG2 @begin
|
||||
bbegin:
|
||||
//SEG3 [1] phi from @begin to @11 [phi:@begin->@11]
|
||||
b11_from_bbegin:
|
||||
jmp b11
|
||||
//SEG4 @11
|
||||
b11:
|
||||
//SEG3 [1] phi from @begin to @13 [phi:@begin->@13]
|
||||
b13_from_bbegin:
|
||||
jmp b13
|
||||
//SEG4 @13
|
||||
b13:
|
||||
//SEG5 [2] call main param-assignment [ ] ( )
|
||||
//SEG6 [4] phi from @11 to main [phi:@11->main]
|
||||
main_from_b11:
|
||||
//SEG6 [4] phi from @13 to main [phi:@13->main]
|
||||
main_from_b13:
|
||||
jsr main
|
||||
//SEG7 [3] phi from @11 to @end [phi:@11->@end]
|
||||
bend_from_b11:
|
||||
//SEG7 [3] phi from @13 to @end [phi:@13->@end]
|
||||
bend_from_b13:
|
||||
jmp bend
|
||||
//SEG8 @end
|
||||
bend:
|
||||
@ -3441,7 +3547,7 @@ print_cls: {
|
||||
}
|
||||
|
||||
ASSEMBLER OPTIMIZATIONS
|
||||
Removing instruction jmp b11
|
||||
Removing instruction jmp b13
|
||||
Removing instruction jmp bend
|
||||
Removing instruction jmp b1
|
||||
Removing instruction jmp b2
|
||||
@ -3485,9 +3591,9 @@ Replacing label b2_from_b1 with b2
|
||||
Replacing label b1_from_b1 with b1
|
||||
Replacing label b1_from_b1 with b1
|
||||
Removing instruction bbegin:
|
||||
Removing instruction b11_from_bbegin:
|
||||
Removing instruction main_from_b11:
|
||||
Removing instruction bend_from_b11:
|
||||
Removing instruction b13_from_bbegin:
|
||||
Removing instruction main_from_b13:
|
||||
Removing instruction bend_from_b13:
|
||||
Removing instruction b2_from_b1:
|
||||
Removing instruction test_sbytes_from_b2:
|
||||
Removing instruction b1_from_test_sbytes:
|
||||
@ -3518,7 +3624,7 @@ Removing instruction b1_from_b6:
|
||||
Removing instruction print_str_from_b1:
|
||||
Removing instruction b1_from_b1:
|
||||
Succesful ASM optimization Pass5RedundantLabelElimination
|
||||
Removing instruction b11:
|
||||
Removing instruction b13:
|
||||
Removing instruction bend:
|
||||
Removing instruction print_cls_from_main:
|
||||
Removing instruction b1:
|
||||
@ -3558,7 +3664,7 @@ Removing instruction jmp b1
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
(label) @11
|
||||
(label) @13
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
@ -3690,12 +3796,12 @@ FINAL ASSEMBLER
|
||||
.label char_cursor = 2
|
||||
.label line_cursor = 7
|
||||
//SEG2 @begin
|
||||
//SEG3 [1] phi from @begin to @11 [phi:@begin->@11]
|
||||
//SEG4 @11
|
||||
//SEG3 [1] phi from @begin to @13 [phi:@begin->@13]
|
||||
//SEG4 @13
|
||||
//SEG5 [2] call main param-assignment [ ] ( )
|
||||
//SEG6 [4] phi from @11 to main [phi:@11->main]
|
||||
//SEG6 [4] phi from @13 to main [phi:@13->main]
|
||||
jsr main
|
||||
//SEG7 [3] phi from @11 to @end [phi:@11->@end]
|
||||
//SEG7 [3] phi from @13 to @end [phi:@13->@end]
|
||||
//SEG8 @end
|
||||
//SEG9 main
|
||||
main: {
|
||||
|
@ -1,4 +1,4 @@
|
||||
(label) @11
|
||||
(label) @13
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) BGCOL
|
||||
|
@ -13,9 +13,9 @@ main: {
|
||||
clc
|
||||
adc w
|
||||
sta w
|
||||
bcc !+
|
||||
inc w+1
|
||||
!:
|
||||
lda #0
|
||||
adc w+1
|
||||
sta w+1
|
||||
inx
|
||||
cpx #$b
|
||||
bne b1
|
||||
|
@ -286,9 +286,9 @@ main: {
|
||||
clc
|
||||
adc w
|
||||
sta w
|
||||
bcc !+
|
||||
inc w+1
|
||||
!:
|
||||
lda #0
|
||||
adc w+1
|
||||
sta w+1
|
||||
//SEG18 [7] (byte) main::j#1 ← ++ (byte) main::i#1 [ main::j#1 main::w#1 ] ( main:2 [ main::j#1 main::w#1 ] ) -- vbuz1=_inc_vbuz1
|
||||
inc j
|
||||
//SEG19 [8] if((byte) main::j#1!=(byte/signed byte/word/signed word) 11) goto main::@1 [ main::j#1 main::w#1 ] ( main:2 [ main::j#1 main::w#1 ] ) -- vbuz1_neq_vbuc1_then_la1
|
||||
@ -313,8 +313,8 @@ REGISTER UPLIFT SCOPES
|
||||
Uplift Scope [main] 33: zp ZP_BYTE:2 [ main::i#1 main::j#1 ] 29.33: zp ZP_WORD:3 [ main::w#2 main::w#1 ]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [main] best 488 combination reg byte x [ main::i#1 main::j#1 ] zp ZP_WORD:3 [ main::w#2 main::w#1 ]
|
||||
Uplifting [] best 488 combination
|
||||
Uplifting [main] best 503 combination reg byte x [ main::i#1 main::j#1 ] zp ZP_WORD:3 [ main::w#2 main::w#1 ]
|
||||
Uplifting [] best 503 combination
|
||||
Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ main::w#2 main::w#1 ]
|
||||
|
||||
ASSEMBLER BEFORE OPTIMIZATION
|
||||
@ -364,9 +364,9 @@ main: {
|
||||
clc
|
||||
adc w
|
||||
sta w
|
||||
bcc !+
|
||||
inc w+1
|
||||
!:
|
||||
lda #0
|
||||
adc w+1
|
||||
sta w+1
|
||||
//SEG18 [7] (byte) main::j#1 ← ++ (byte) main::i#1 [ main::j#1 main::w#1 ] ( main:2 [ main::j#1 main::w#1 ] ) -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
//SEG19 [8] if((byte) main::j#1!=(byte/signed byte/word/signed word) 11) goto main::@1 [ main::j#1 main::w#1 ] ( main:2 [ main::j#1 main::w#1 ] ) -- vbuxx_neq_vbuc1_then_la1
|
||||
@ -456,9 +456,9 @@ main: {
|
||||
clc
|
||||
adc w
|
||||
sta w
|
||||
bcc !+
|
||||
inc w+1
|
||||
!:
|
||||
lda #0
|
||||
adc w+1
|
||||
sta w+1
|
||||
//SEG18 [7] (byte) main::j#1 ← ++ (byte) main::i#1 [ main::j#1 main::w#1 ] ( main:2 [ main::j#1 main::w#1 ] ) -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
//SEG19 [8] if((byte) main::j#1!=(byte/signed byte/word/signed word) 11) goto main::@1 [ main::j#1 main::w#1 ] ( main:2 [ main::j#1 main::w#1 ] ) -- vbuxx_neq_vbuc1_then_la1
|
||||
|
@ -1,13 +1,13 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ] ( )
|
||||
to:@7
|
||||
@7: scope:[] from @begin
|
||||
to:@9
|
||||
@9: scope:[] from @begin
|
||||
[1] phi() [ ] ( )
|
||||
[2] call main param-assignment [ ] ( )
|
||||
to:@end
|
||||
@end: scope:[] from @7
|
||||
@end: scope:[] from @9
|
||||
[3] phi() [ ] ( )
|
||||
main: scope:[main] from @7
|
||||
main: scope:[main] from @9
|
||||
[4] phi() [ ] ( main:2 [ ] )
|
||||
[5] call print_cls param-assignment [ ] ( main:2 [ ] )
|
||||
to:main::@1
|
||||
|
@ -33,6 +33,24 @@ void print_ln() {
|
||||
char_cursor = line_cursor;
|
||||
}
|
||||
|
||||
// Print a signed word as HEX
|
||||
void print_sword(signed word w) {
|
||||
if(w<0) {
|
||||
print_char('-');
|
||||
w = -w;
|
||||
}
|
||||
print_word((word)w);
|
||||
}
|
||||
|
||||
// Print a signed byte as HEX
|
||||
void print_sbyte(signed byte b) {
|
||||
if(b<0) {
|
||||
print_char('-');
|
||||
b = -b;
|
||||
}
|
||||
print_byte((byte)b);
|
||||
}
|
||||
|
||||
// Print a word as HEX
|
||||
void print_word(word w) {
|
||||
print_byte(>w);
|
||||
@ -42,7 +60,7 @@ void print_word(word w) {
|
||||
// Print a byte as HEX
|
||||
void print_byte(byte b) {
|
||||
// Table of hexadecimal digits
|
||||
const byte[] hextab = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
const byte[] hextab = "0123456789abcdef";
|
||||
print_char(hextab[b>>4]);
|
||||
print_char(hextab[b&$f]);
|
||||
}
|
||||
@ -94,6 +112,32 @@ print_ln::@1:
|
||||
print_ln::@return:
|
||||
return
|
||||
endproc // print_ln()
|
||||
proc (void()) print_sword((signed word) print_sword::w)
|
||||
(boolean~) print_sword::$0 ← (signed word) print_sword::w < (byte/signed byte/word/signed word) 0
|
||||
(boolean~) print_sword::$1 ← ! (boolean~) print_sword::$0
|
||||
if((boolean~) print_sword::$1) goto print_sword::@1
|
||||
(void~) print_sword::$2 ← call print_char (byte) '-'
|
||||
(signed word~) print_sword::$3 ← - (signed word) print_sword::w
|
||||
(signed word) print_sword::w ← (signed word~) print_sword::$3
|
||||
print_sword::@1:
|
||||
(word~) print_sword::$4 ← ((word)) (signed word) print_sword::w
|
||||
(void~) print_sword::$5 ← call print_word (word~) print_sword::$4
|
||||
print_sword::@return:
|
||||
return
|
||||
endproc // print_sword()
|
||||
proc (void()) print_sbyte((signed byte) print_sbyte::b)
|
||||
(boolean~) print_sbyte::$0 ← (signed byte) print_sbyte::b < (byte/signed byte/word/signed word) 0
|
||||
(boolean~) print_sbyte::$1 ← ! (boolean~) print_sbyte::$0
|
||||
if((boolean~) print_sbyte::$1) goto print_sbyte::@1
|
||||
(void~) print_sbyte::$2 ← call print_char (byte) '-'
|
||||
(signed byte~) print_sbyte::$3 ← - (signed byte) print_sbyte::b
|
||||
(signed byte) print_sbyte::b ← (signed byte~) print_sbyte::$3
|
||||
print_sbyte::@1:
|
||||
(byte~) print_sbyte::$4 ← ((byte)) (signed byte) print_sbyte::b
|
||||
(void~) print_sbyte::$5 ← call print_byte (byte~) print_sbyte::$4
|
||||
print_sbyte::@return:
|
||||
return
|
||||
endproc // print_sbyte()
|
||||
proc (void()) print_word((word) print_word::w)
|
||||
(byte~) print_word::$0 ← > (word) print_word::w
|
||||
(void~) print_word::$1 ← call print_byte (byte~) print_word::$0
|
||||
@ -103,7 +147,7 @@ print_word::@return:
|
||||
return
|
||||
endproc // print_word()
|
||||
proc (void()) print_byte((byte) print_byte::b)
|
||||
(byte[]) print_byte::hextab ← { (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f' }
|
||||
(byte[]) print_byte::hextab ← (string) "0123456789abcdef"
|
||||
(byte~) print_byte::$0 ← (byte) print_byte::b >> (byte/signed byte/word/signed word) 4
|
||||
(void~) print_byte::$1 ← call print_char *((byte[]) print_byte::hextab + (byte~) print_byte::$0)
|
||||
(byte~) print_byte::$2 ← (byte) print_byte::b & (byte/signed byte/word/signed word) 15
|
||||
@ -177,6 +221,16 @@ SYMBOLS
|
||||
(boolean~) print_ln::$1
|
||||
(label) print_ln::@1
|
||||
(label) print_ln::@return
|
||||
(void()) print_sbyte((signed byte) print_sbyte::b)
|
||||
(boolean~) print_sbyte::$0
|
||||
(boolean~) print_sbyte::$1
|
||||
(void~) print_sbyte::$2
|
||||
(signed byte~) print_sbyte::$3
|
||||
(byte~) print_sbyte::$4
|
||||
(void~) print_sbyte::$5
|
||||
(label) print_sbyte::@1
|
||||
(label) print_sbyte::@return
|
||||
(signed byte) print_sbyte::b
|
||||
(void()) print_str((byte*) print_str::str)
|
||||
(boolean~) print_str::$0
|
||||
(label) print_str::@1
|
||||
@ -184,6 +238,16 @@ SYMBOLS
|
||||
(label) print_str::@3
|
||||
(label) print_str::@return
|
||||
(byte*) print_str::str
|
||||
(void()) print_sword((signed word) print_sword::w)
|
||||
(boolean~) print_sword::$0
|
||||
(boolean~) print_sword::$1
|
||||
(void~) print_sword::$2
|
||||
(signed word~) print_sword::$3
|
||||
(word~) print_sword::$4
|
||||
(void~) print_sword::$5
|
||||
(label) print_sword::@1
|
||||
(label) print_sword::@return
|
||||
(signed word) print_sword::w
|
||||
(void()) print_word((word) print_word::w)
|
||||
(byte~) print_word::$0
|
||||
(void~) print_word::$1
|
||||
@ -240,6 +304,44 @@ print_ln::@return: scope:[print_ln] from print_ln::@2
|
||||
to:@return
|
||||
@2: scope:[] from @1
|
||||
to:@3
|
||||
print_sword: scope:[print_sword] from
|
||||
(boolean~) print_sword::$0 ← (signed word) print_sword::w < (byte/signed byte/word/signed word) 0
|
||||
(boolean~) print_sword::$1 ← ! (boolean~) print_sword::$0
|
||||
if((boolean~) print_sword::$1) goto print_sword::@1
|
||||
to:print_sword::@2
|
||||
print_sword::@1: scope:[print_sword] from print_sword print_sword::@2
|
||||
(word~) print_sword::$4 ← ((word)) (signed word) print_sword::w
|
||||
(void~) print_sword::$5 ← call print_word (word~) print_sword::$4
|
||||
to:print_sword::@return
|
||||
print_sword::@2: scope:[print_sword] from print_sword
|
||||
(void~) print_sword::$2 ← call print_char (byte) '-'
|
||||
(signed word~) print_sword::$3 ← - (signed word) print_sword::w
|
||||
(signed word) print_sword::w ← (signed word~) print_sword::$3
|
||||
to:print_sword::@1
|
||||
print_sword::@return: scope:[print_sword] from print_sword::@1
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
print_sbyte: scope:[print_sbyte] from
|
||||
(boolean~) print_sbyte::$0 ← (signed byte) print_sbyte::b < (byte/signed byte/word/signed word) 0
|
||||
(boolean~) print_sbyte::$1 ← ! (boolean~) print_sbyte::$0
|
||||
if((boolean~) print_sbyte::$1) goto print_sbyte::@1
|
||||
to:print_sbyte::@2
|
||||
print_sbyte::@1: scope:[print_sbyte] from print_sbyte print_sbyte::@2
|
||||
(byte~) print_sbyte::$4 ← ((byte)) (signed byte) print_sbyte::b
|
||||
(void~) print_sbyte::$5 ← call print_byte (byte~) print_sbyte::$4
|
||||
to:print_sbyte::@return
|
||||
print_sbyte::@2: scope:[print_sbyte] from print_sbyte
|
||||
(void~) print_sbyte::$2 ← call print_char (byte) '-'
|
||||
(signed byte~) print_sbyte::$3 ← - (signed byte) print_sbyte::b
|
||||
(signed byte) print_sbyte::b ← (signed byte~) print_sbyte::$3
|
||||
to:print_sbyte::@1
|
||||
print_sbyte::@return: scope:[print_sbyte] from print_sbyte::@1
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
to:@5
|
||||
print_word: scope:[print_word] from
|
||||
(byte~) print_word::$0 ← > (word) print_word::w
|
||||
(void~) print_word::$1 ← call print_byte (byte~) print_word::$0
|
||||
@ -249,10 +351,10 @@ print_word: scope:[print_word] from
|
||||
print_word::@return: scope:[print_word] from print_word
|
||||
return
|
||||
to:@return
|
||||
@3: scope:[] from @2
|
||||
to:@4
|
||||
@5: scope:[] from @4
|
||||
to:@6
|
||||
print_byte: scope:[print_byte] from
|
||||
(byte[]) print_byte::hextab ← { (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f' }
|
||||
(byte[]) print_byte::hextab ← (string) "0123456789abcdef"
|
||||
(byte~) print_byte::$0 ← (byte) print_byte::b >> (byte/signed byte/word/signed word) 4
|
||||
(void~) print_byte::$1 ← call print_char *((byte[]) print_byte::hextab + (byte~) print_byte::$0)
|
||||
(byte~) print_byte::$2 ← (byte) print_byte::b & (byte/signed byte/word/signed word) 15
|
||||
@ -261,8 +363,8 @@ print_byte: scope:[print_byte] from
|
||||
print_byte::@return: scope:[print_byte] from print_byte
|
||||
return
|
||||
to:@return
|
||||
@4: scope:[] from @3
|
||||
to:@5
|
||||
@6: scope:[] from @5
|
||||
to:@7
|
||||
print_char: scope:[print_char] from
|
||||
*((byte*) char_cursor) ← (byte) print_char::ch
|
||||
(byte*) char_cursor ← ++ (byte*) char_cursor
|
||||
@ -270,8 +372,8 @@ print_char: scope:[print_char] from
|
||||
print_char::@return: scope:[print_char] from print_char
|
||||
return
|
||||
to:@return
|
||||
@5: scope:[] from @4
|
||||
to:@6
|
||||
@7: scope:[] from @6
|
||||
to:@8
|
||||
print_cls: scope:[print_cls] from
|
||||
(byte*) print_cls::sc ← ((byte*)) (word/signed word) 1024
|
||||
to:print_cls::@1
|
||||
@ -287,9 +389,9 @@ print_cls::@2: scope:[print_cls] from print_cls::@1
|
||||
print_cls::@return: scope:[print_cls] from print_cls::@2
|
||||
return
|
||||
to:@return
|
||||
@6: scope:[] from @5
|
||||
@8: scope:[] from @7
|
||||
(byte[]) txt ← (string) "camelot@"
|
||||
to:@7
|
||||
to:@9
|
||||
main: scope:[main] from
|
||||
(void~) main::$0 ← call print_cls
|
||||
(byte) main::i ← (byte/signed byte/word/signed word) 0
|
||||
@ -307,11 +409,13 @@ main::@2: scope:[main] from main::@1
|
||||
main::@return: scope:[main] from main::@2
|
||||
return
|
||||
to:@return
|
||||
@7: scope:[] from @6
|
||||
@9: scope:[] from @8
|
||||
call main
|
||||
to:@end
|
||||
@end: scope:[] from @7
|
||||
@end: scope:[] from @9
|
||||
|
||||
Removing unused procedure print_sword
|
||||
Removing unused procedure print_sbyte
|
||||
Removing unused procedure print_word
|
||||
Removing unused procedure print_byte
|
||||
Removing unused procedure print_char
|
||||
@ -328,6 +432,8 @@ Removing empty block @2
|
||||
Removing empty block @3
|
||||
Removing empty block @4
|
||||
Removing empty block @5
|
||||
Removing empty block @6
|
||||
Removing empty block @7
|
||||
Removing empty block print_cls::@2
|
||||
Removing empty block main::@2
|
||||
PROCEDURE MODIFY VARIABLE ANALYSIS
|
||||
@ -347,7 +453,7 @@ CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN
|
||||
@begin: scope:[] from
|
||||
(byte*) line_cursor#0 ← ((byte*)) (word/signed word) 1024
|
||||
(byte*) char_cursor#0 ← (byte*) line_cursor#0
|
||||
to:@6
|
||||
to:@8
|
||||
print_str: scope:[print_str] from main::@1
|
||||
(byte*) char_cursor#21 ← phi( main::@1/(byte*) char_cursor#19 )
|
||||
(byte*) print_str::str#4 ← phi( main::@1/(byte*) print_str::str#1 )
|
||||
@ -407,14 +513,14 @@ print_cls::@1: scope:[print_cls] from print_cls print_cls::@1
|
||||
print_cls::@return: scope:[print_cls] from print_cls::@1
|
||||
return
|
||||
to:@return
|
||||
@6: scope:[] from @begin
|
||||
@8: scope:[] from @begin
|
||||
(byte*) line_cursor#16 ← phi( @begin/(byte*) line_cursor#0 )
|
||||
(byte*) char_cursor#23 ← phi( @begin/(byte*) char_cursor#0 )
|
||||
(byte[]) txt#0 ← (const string) $0
|
||||
to:@7
|
||||
main: scope:[main] from @7
|
||||
(byte*) line_cursor#18 ← phi( @7/(byte*) line_cursor#14 )
|
||||
(byte*) char_cursor#24 ← phi( @7/(byte*) char_cursor#20 )
|
||||
to:@9
|
||||
main: scope:[main] from @9
|
||||
(byte*) line_cursor#18 ← phi( @9/(byte*) line_cursor#14 )
|
||||
(byte*) char_cursor#24 ← phi( @9/(byte*) char_cursor#20 )
|
||||
call print_cls param-assignment
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main
|
||||
@ -454,24 +560,24 @@ main::@return: scope:[main] from main::@5
|
||||
(byte*) line_cursor#4 ← (byte*) line_cursor#10
|
||||
return
|
||||
to:@return
|
||||
@7: scope:[] from @6
|
||||
(byte*) line_cursor#14 ← phi( @6/(byte*) line_cursor#16 )
|
||||
(byte*) char_cursor#20 ← phi( @6/(byte*) char_cursor#23 )
|
||||
@9: scope:[] from @8
|
||||
(byte*) line_cursor#14 ← phi( @8/(byte*) line_cursor#16 )
|
||||
(byte*) char_cursor#20 ← phi( @8/(byte*) char_cursor#23 )
|
||||
call main param-assignment
|
||||
to:@8
|
||||
@8: scope:[] from @7
|
||||
(byte*) line_cursor#11 ← phi( @7/(byte*) line_cursor#4 )
|
||||
(byte*) char_cursor#16 ← phi( @7/(byte*) char_cursor#7 )
|
||||
to:@10
|
||||
@10: scope:[] from @9
|
||||
(byte*) line_cursor#11 ← phi( @9/(byte*) line_cursor#4 )
|
||||
(byte*) char_cursor#16 ← phi( @9/(byte*) char_cursor#7 )
|
||||
(byte*) char_cursor#8 ← (byte*) char_cursor#16
|
||||
(byte*) line_cursor#5 ← (byte*) line_cursor#11
|
||||
to:@end
|
||||
@end: scope:[] from @8
|
||||
@end: scope:[] from @10
|
||||
|
||||
SYMBOL TABLE SSA
|
||||
(const string) $0 = (string) "camelot@"
|
||||
(label) @6
|
||||
(label) @7
|
||||
(label) @10
|
||||
(label) @8
|
||||
(label) @9
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) char_cursor
|
||||
@ -633,9 +739,9 @@ Consolidated array index constant in *(txt#0+1)
|
||||
Consolidated array index constant in *(txt#0+1)
|
||||
Succesful SSA optimization Pass2ConstantAdditionElimination
|
||||
Culled Empty Block (label) print_ln::@2
|
||||
Culled Empty Block (label) @6
|
||||
Culled Empty Block (label) main::@3
|
||||
Culled Empty Block (label) @8
|
||||
Culled Empty Block (label) main::@3
|
||||
Culled Empty Block (label) @10
|
||||
Succesful SSA optimization Pass2CullEmptyBlocks
|
||||
Not aliassing across scopes: char_cursor#10 char_cursor#19
|
||||
Not aliassing across scopes: line_cursor#6 line_cursor#13
|
||||
@ -658,13 +764,13 @@ Constant inlined print_cls::$0 = (word/signed word) 1024+(word/signed word) 1000
|
||||
Constant inlined $0 = (const string) txt#0
|
||||
Constant inlined print_cls::sc#0 = ((byte*))(word/signed word) 1024
|
||||
Succesful SSA optimization Pass2ConstantInlining
|
||||
Block Sequence Planned @begin @7 @end main main::@1 main::@4 main::@5 main::@return print_ln print_ln::@1 print_ln::@return print_str print_str::@1 print_str::@return print_str::@2 print_cls print_cls::@1 print_cls::@return
|
||||
Block Sequence Planned @begin @9 @end main main::@1 main::@4 main::@5 main::@return print_ln print_ln::@1 print_ln::@return print_str print_str::@1 print_str::@return print_str::@2 print_cls print_cls::@1 print_cls::@return
|
||||
Added new block during phi lifting main::@6(between main::@5 and main::@1)
|
||||
Added new block during phi lifting print_ln::@3(between print_ln::@1 and print_ln::@1)
|
||||
Added new block during phi lifting print_cls::@3(between print_cls::@1 and print_cls::@1)
|
||||
Block Sequence Planned @begin @7 @end main main::@1 main::@4 main::@5 main::@return main::@6 print_ln print_ln::@1 print_ln::@return print_ln::@3 print_str print_str::@1 print_str::@return print_str::@2 print_cls print_cls::@1 print_cls::@return print_cls::@3
|
||||
Block Sequence Planned @begin @9 @end main main::@1 main::@4 main::@5 main::@return main::@6 print_ln print_ln::@1 print_ln::@return print_ln::@3 print_str print_str::@1 print_str::@return print_str::@2 print_cls print_cls::@1 print_cls::@return print_cls::@3
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @7
|
||||
Adding NOP phi() at start of @9
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@4
|
||||
@ -693,9 +799,9 @@ Coalesced [38] print_cls::sc#3 ← print_cls::sc#1
|
||||
Coalesced down to 5 phi equivalence classes
|
||||
Culled Empty Block (label) print_ln::@3
|
||||
Culled Empty Block (label) print_cls::@3
|
||||
Block Sequence Planned @begin @7 @end main main::@1 main::@4 main::@5 main::@return main::@6 print_ln print_ln::@1 print_ln::@return print_str print_str::@1 print_str::@return print_str::@2 print_cls print_cls::@1 print_cls::@return
|
||||
Block Sequence Planned @begin @9 @end main main::@1 main::@4 main::@5 main::@return main::@6 print_ln print_ln::@1 print_ln::@return print_str print_str::@1 print_str::@return print_str::@2 print_cls print_cls::@1 print_cls::@return
|
||||
Adding NOP phi() at start of @begin
|
||||
Adding NOP phi() at start of @7
|
||||
Adding NOP phi() at start of @9
|
||||
Adding NOP phi() at start of @end
|
||||
Adding NOP phi() at start of main
|
||||
Adding NOP phi() at start of main::@4
|
||||
@ -713,14 +819,14 @@ Propagating live ranges...
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ] ( )
|
||||
to:@7
|
||||
@7: scope:[] from @begin
|
||||
to:@9
|
||||
@9: scope:[] from @begin
|
||||
[1] phi() [ ] ( )
|
||||
[2] call main param-assignment [ ] ( )
|
||||
to:@end
|
||||
@end: scope:[] from @7
|
||||
@end: scope:[] from @9
|
||||
[3] phi() [ ] ( )
|
||||
main: scope:[main] from @7
|
||||
main: scope:[main] from @9
|
||||
[4] phi() [ ] ( main:2 [ ] )
|
||||
[5] call print_cls param-assignment [ ] ( main:2 [ ] )
|
||||
to:main::@1
|
||||
@ -787,24 +893,24 @@ print_cls::@return: scope:[print_cls] from print_cls::@1
|
||||
|
||||
DOMINATORS
|
||||
@begin dominated by @begin
|
||||
@7 dominated by @begin @7
|
||||
@end dominated by @begin @end @7
|
||||
main dominated by @begin main @7
|
||||
main::@1 dominated by @begin main @7 main::@1
|
||||
main::@4 dominated by @begin main @7 main::@1 main::@4
|
||||
main::@5 dominated by @begin main @7 main::@1 main::@5 main::@4
|
||||
main::@return dominated by main::@return @begin main @7 main::@1 main::@5 main::@4
|
||||
main::@6 dominated by @begin main @7 main::@1 main::@5 main::@6 main::@4
|
||||
print_ln dominated by @begin main print_ln @7 main::@1 main::@4
|
||||
print_ln::@1 dominated by print_ln::@1 @begin main print_ln @7 main::@1 main::@4
|
||||
print_ln::@return dominated by print_ln::@1 @begin main print_ln print_ln::@return @7 main::@1 main::@4
|
||||
print_str dominated by @begin main print_str @7 main::@1
|
||||
print_str::@1 dominated by @begin main print_str::@1 print_str @7 main::@1
|
||||
print_str::@return dominated by @begin print_str::@return main print_str::@1 print_str @7 main::@1
|
||||
print_str::@2 dominated by @begin main print_str::@1 print_str::@2 print_str @7 main::@1
|
||||
print_cls dominated by @begin main print_cls @7
|
||||
print_cls::@1 dominated by @begin print_cls::@1 main print_cls @7
|
||||
print_cls::@return dominated by @begin print_cls::@1 main print_cls @7 print_cls::@return
|
||||
@9 dominated by @begin @9
|
||||
@end dominated by @begin @end @9
|
||||
main dominated by @begin main @9
|
||||
main::@1 dominated by @begin main main::@1 @9
|
||||
main::@4 dominated by @begin main main::@1 @9 main::@4
|
||||
main::@5 dominated by @begin main main::@1 @9 main::@5 main::@4
|
||||
main::@return dominated by main::@return @begin main main::@1 @9 main::@5 main::@4
|
||||
main::@6 dominated by @begin main main::@1 @9 main::@5 main::@6 main::@4
|
||||
print_ln dominated by @begin main print_ln main::@1 @9 main::@4
|
||||
print_ln::@1 dominated by print_ln::@1 @begin main print_ln main::@1 @9 main::@4
|
||||
print_ln::@return dominated by print_ln::@1 @begin main print_ln print_ln::@return main::@1 @9 main::@4
|
||||
print_str dominated by @begin main print_str main::@1 @9
|
||||
print_str::@1 dominated by @begin main print_str::@1 print_str main::@1 @9
|
||||
print_str::@return dominated by @begin print_str::@return main print_str::@1 print_str main::@1 @9
|
||||
print_str::@2 dominated by @begin main print_str::@1 print_str::@2 print_str main::@1 @9
|
||||
print_cls dominated by @begin main print_cls @9
|
||||
print_cls::@1 dominated by @begin print_cls::@1 main print_cls @9
|
||||
print_cls::@return dominated by @begin print_cls::@1 main print_cls print_cls::@return @9
|
||||
|
||||
NATURAL LOOPS
|
||||
Found back edge: Loop head: main::@1 tails: main::@6 blocks: null
|
||||
@ -889,17 +995,17 @@ INITIAL ASM
|
||||
.label line_cursor = 3
|
||||
//SEG2 @begin
|
||||
bbegin:
|
||||
//SEG3 [1] phi from @begin to @7 [phi:@begin->@7]
|
||||
b7_from_bbegin:
|
||||
jmp b7
|
||||
//SEG4 @7
|
||||
b7:
|
||||
//SEG3 [1] phi from @begin to @9 [phi:@begin->@9]
|
||||
b9_from_bbegin:
|
||||
jmp b9
|
||||
//SEG4 @9
|
||||
b9:
|
||||
//SEG5 [2] call main param-assignment [ ] ( )
|
||||
//SEG6 [4] phi from @7 to main [phi:@7->main]
|
||||
main_from_b7:
|
||||
//SEG6 [4] phi from @9 to main [phi:@9->main]
|
||||
main_from_b9:
|
||||
jsr main
|
||||
//SEG7 [3] phi from @7 to @end [phi:@7->@end]
|
||||
bend_from_b7:
|
||||
//SEG7 [3] phi from @9 to @end [phi:@9->@end]
|
||||
bend_from_b9:
|
||||
jmp bend
|
||||
//SEG8 @end
|
||||
bend:
|
||||
@ -1146,17 +1252,17 @@ ASSEMBLER BEFORE OPTIMIZATION
|
||||
.label line_cursor = 2
|
||||
//SEG2 @begin
|
||||
bbegin:
|
||||
//SEG3 [1] phi from @begin to @7 [phi:@begin->@7]
|
||||
b7_from_bbegin:
|
||||
jmp b7
|
||||
//SEG4 @7
|
||||
b7:
|
||||
//SEG3 [1] phi from @begin to @9 [phi:@begin->@9]
|
||||
b9_from_bbegin:
|
||||
jmp b9
|
||||
//SEG4 @9
|
||||
b9:
|
||||
//SEG5 [2] call main param-assignment [ ] ( )
|
||||
//SEG6 [4] phi from @7 to main [phi:@7->main]
|
||||
main_from_b7:
|
||||
//SEG6 [4] phi from @9 to main [phi:@9->main]
|
||||
main_from_b9:
|
||||
jsr main
|
||||
//SEG7 [3] phi from @7 to @end [phi:@7->@end]
|
||||
bend_from_b7:
|
||||
//SEG7 [3] phi from @9 to @end [phi:@9->@end]
|
||||
bend_from_b9:
|
||||
jmp bend
|
||||
//SEG8 @end
|
||||
bend:
|
||||
@ -1349,7 +1455,7 @@ print_cls: {
|
||||
txt: .text "camelot@"
|
||||
|
||||
ASSEMBLER OPTIMIZATIONS
|
||||
Removing instruction jmp b7
|
||||
Removing instruction jmp b9
|
||||
Removing instruction jmp bend
|
||||
Removing instruction jmp b1
|
||||
Removing instruction jmp b4
|
||||
@ -1369,9 +1475,9 @@ Replacing label b1_from_b1 with b1
|
||||
Replacing label b1_from_b1 with b1
|
||||
Replacing label b1_from_b1 with b1
|
||||
Removing instruction bbegin:
|
||||
Removing instruction b7_from_bbegin:
|
||||
Removing instruction main_from_b7:
|
||||
Removing instruction bend_from_b7:
|
||||
Removing instruction b9_from_bbegin:
|
||||
Removing instruction main_from_b9:
|
||||
Removing instruction bend_from_b9:
|
||||
Removing instruction print_str_from_b1:
|
||||
Removing instruction b4_from_b1:
|
||||
Removing instruction print_ln_from_b4:
|
||||
@ -1379,7 +1485,7 @@ Removing instruction b1_from_print_ln:
|
||||
Removing instruction b1_from_b1:
|
||||
Removing instruction b1_from_b1:
|
||||
Succesful ASM optimization Pass5RedundantLabelElimination
|
||||
Removing instruction b7:
|
||||
Removing instruction b9:
|
||||
Removing instruction bend:
|
||||
Removing instruction print_cls_from_main:
|
||||
Removing instruction b1_from_main:
|
||||
@ -1398,7 +1504,7 @@ Removing instruction jmp b1
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
(label) @7
|
||||
(label) @9
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) char_cursor
|
||||
@ -1453,12 +1559,12 @@ FINAL ASSEMBLER
|
||||
.label char_cursor = 6
|
||||
.label line_cursor = 2
|
||||
//SEG2 @begin
|
||||
//SEG3 [1] phi from @begin to @7 [phi:@begin->@7]
|
||||
//SEG4 @7
|
||||
//SEG3 [1] phi from @begin to @9 [phi:@begin->@9]
|
||||
//SEG4 @9
|
||||
//SEG5 [2] call main param-assignment [ ] ( )
|
||||
//SEG6 [4] phi from @7 to main [phi:@7->main]
|
||||
//SEG6 [4] phi from @9 to main [phi:@9->main]
|
||||
jsr main
|
||||
//SEG7 [3] phi from @7 to @end [phi:@7->@end]
|
||||
//SEG7 [3] phi from @9 to @end [phi:@9->@end]
|
||||
//SEG8 @end
|
||||
//SEG9 main
|
||||
main: {
|
||||
|
@ -1,4 +1,4 @@
|
||||
(label) @7
|
||||
(label) @9
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(byte*) char_cursor
|
||||
|
@ -1,13 +1,13 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ] ( )
|
||||
to:@7
|
||||
@7: scope:[] from @begin
|
||||
to:@9
|
||||
@9: scope:[] from @begin
|
||||
[1] phi() [ ] ( )
|
||||
[2] call main param-assignment [ ] ( )
|
||||
to:@end
|
||||
@end: scope:[] from @7
|
||||
@end: scope:[] from @9
|
||||
[3] phi() [ ] ( )
|
||||
main: scope:[main] from @7
|
||||
main: scope:[main] from @9
|
||||
[4] phi() [ ] ( main:2 [ ] )
|
||||
[5] call print_str param-assignment [ char_cursor#13 ] ( main:2 [ char_cursor#13 ] )
|
||||
to:main::@1
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user