}
}
+#define MOVEM_LIMIT 2
+/* If #registers to be saved exceeds MOVEM_LIMIT, we
+* use the movem instruction to save registers; else
+* we simply use several move.l's.
+*/
+
+
regscore(off,size,typ,score,totyp)
long off;
{
return -1;
case reg_pointer:
if (size != 4 || totyp != reg_pointer) return -1;
- score *= 2;
+ score += (score >> 1);
break;
case reg_loop:
score += 5;
*/
score -= 2;
}
- score -= 1; /* take save/restore into account */
+ score--; /* save/restore */
return score;
}
struct regsav_t {
regnr = 0;
}
-#define MOVEM_LIMIT 2
-/* If #registers to be saved exceeds MOVEM_LIMIT, we
-* use the movem instruction to save registers; else
-* we simply use several move.l's.
-*/
-
save()
{
register struct regsav_t *p;
with any4
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen move %1, {LOCAL, $1}
+with exact STACK
+ kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
+ gen move {post_inc4, sp}, {LOCAL, $1}
pat stl inreg($1)==reg_pointer
with any4
with exact address-ext_addr
kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
gen lea %1, {LOCAL, $1}
+with exact STACK
+ kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
+ gen move {post_inc4, sp}, {LOCAL, $1}
pat sil inreg($1)==reg_pointer
with any4
kills allexceptcon
gen move %1, {indirect4, regvar($1, reg_pointer)}
+with exact STACK
+ kills allexceptcon
+ gen move {post_inc4, sp}, {indirect4, regvar($1, reg_pointer)}
pat lol sbi stl $1==$3 && $2==4 && inreg($1)==reg_any
kills allexceptcon
gen sub_l {const, 1}, {indirect4, regvar($1, reg_pointer)}
+pat lil adp sil $1==$3 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen add_l {const, $2}, {indirect4, regvar($1, reg_pointer)}
+
+pat lol lof inc lol stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen add_l {const, 1}, {offsetted4, regvar($1, reg_pointer), $2}
+
+pat lol lof dec lol stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen sub_l {const, 1}, {offsetted4, regvar($1, reg_pointer), $2}
+
+pat lol lof adp lol stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen add_l {const, $3}, {offsetted4, regvar($1, reg_pointer), $2}
+
pat inl inreg($1)==reg_any
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen add_l {const, 1}, {LOCAL, $1}
+pat lol inl $1==$2 && inreg($1)==reg_any
+ kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
+ uses DD_REG = {LOCAL, $1}
+ gen add_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat del inreg($1)==reg_any
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen sub_l {const, 1}, {LOCAL, $1}
+pat lol del $1==$2 && inreg($1)==reg_any
+ kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
+ uses DD_REG = {LOCAL, $1}
+ gen sub_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat zrl inreg($1)==reg_any
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen clr_l {LOCAL, $1}
kills allexceptcon
gen xxx* %1, {indirect4, regvar($1, reg_pointer)}
+proc lolfxxlolf example lol lof and lol stf
+with conreg4
+ kills allexceptcon
+ gen xxx* %1, {offsetted4, regvar($1, reg_pointer), $2}
+
proc lolcxxstl example lol loc and stl
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen xxx* {const, $2}, {LOCAL, $1}
call lolcxxstl("add.l")
pat lil adi sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("add.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("add.l")
pat lil loc adi sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("add.l")
pat lol lol adi stl $1==$4 && $3==4 && inreg($1)==reg_any && inreg($2)==reg_any
call lolcxxstl("add.l")
pat lil adu sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("add.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("add.l")
pat lil loc adu sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("add.l")
pat lol lol adu stl $1==$4 && $3==4 && inreg($1)==reg_any && inreg($2)==reg_any
call lolcxxstl("and.l")
pat lil and sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("and.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("and.l")
pat lil loc and sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("and.l")
pat lol lol and stl $1==$4 && $3==4 && inreg($1)==reg_any && inreg($2)==reg_any
call lolcxxstl("or.l")
pat lil ior sil $1==$3 && $2==4 && inreg($1)==reg_pointer
call lilxxsil("or.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("or.l")
pat lil loc ior sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("or.l")
pat lol lol ior stl $1==$4 && $3==4 && inreg($1)==reg_any &&
call lolcxxstl("eor.l")
pat lil xor sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("eor.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("eor.l")
pat lil loc xor sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("eor.l")
pat lol lol xor stl $1==$4 && $3==4 && inreg($1)==reg_any &&
gen add_l {const, $3}, {indirect4, regvar($1, reg_pointer)}
yields %a
+pat lol lof dup adp lol stf $1==$5 && $2==$6 && inreg($1)==reg_pointer
+ kills allexceptcon
+ uses AA_REG = {offsetted4, regvar($1, reg_pointer), $2}
+ gen add_l {const, $4}, {offsetted4, regvar($1, reg_pointer), $2}
+ yields %a
+
pat lol lol adp stl loi $1==$2 && $1==$4 && $3==1 && $5==1 &&
inreg($1)==reg_pointer
kills regvar($1, reg_pointer)
{indirect4, %1}
pat loi $1>8
with AA_REG STACK
+ kills ALL
uses DD_REG = {const, $1/4 -1}
gen add_l {const, $1}, %1
1:
pat los $1==4
with STACK
+ kills ALL
gen jsr {absolute4, ".los"}
pat lde yields {absolute4, $1+4}
kills all_indir, LOCAL %bd==$1
gen move %1, {LOCAL, $1}
with exact STACK
+ kills all_indir, LOCAL %bd==$1
gen move {post_inc4,sp}, {LOCAL, $1}
pat ste
kills posextern
gen move %1, {absolute4, $1}
with exact STACK
+ kills posextern
gen move {post_inc4, sp}, {absolute4, $1}
pat sil
kills allexceptcon
gen move %1, {ILOCAL, $1}
with exact STACK
+ kills allexceptcon
gen move {post_inc4, sp}, {ILOCAL, $1}
#else TBL68020
with any4
uses AA_REG = {LOCAL, $1}
gen move %1, {indirect4, %a}
with exact STACK
+ kills allexceptcon
uses AA_REG = {LOCAL, $1}
gen move {post_inc4, sp}, {indirect4, %a}
#endif TBL68020
kills allexceptcon
gen move %2, {offsetted4, %1, $1}
with A_REG STACK
+ kills allexceptcon
gen move {post_inc4, sp}, {offsetted4, %1, $1}
with exact local_addr any4
kills allexceptcon
kills allexceptcon
gen move %2, {indirect4, %1}
with A_REG STACK
+ kills allexceptcon
gen move {post_inc4, sp}, {indirect4, %1}
with exact local_addr any4
kills allexceptcon
pat sti $1>4
with AA_REG STACK
+ kills ALL
uses DD_REG = {const, $1/4 -1}
gen 1:
move_l {post_inc4, sp}, {post_inc4, %1}
pat sts $1==4
with STACK
+ kills ALL
gen jsr {absolute4, ".sts"}
pat sdl
gen muls_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".mli"}
yields d1
#endif TBL68020
gen divs_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvi"}
yields d1
#endif TBL68020
yields %a
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvi"}
yields d0
#endif TBL68020
gen mulu_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".mlu"}
yields d1
#endif TBL68020
gen divu_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvu"}
yields d1
#endif TBL68020
yields %a
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvu"}
yields d0
#endif TBL68020
kills all_indir, LOCAL %bd==$1
gen add_l {const, 1}, {LOCAL, $1}
+pat lol inl $1==$2
+ kills all_indir, LOCAL %bd==$1
+ uses DD_REG = {LOCAL, $1}
+ gen add_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat ine
kills posextern
gen add_l {const, 1}, {absolute4, $1}
kills all_indir, LOCAL %bd==$1
gen sub_l {const, 1}, {LOCAL, $1}
+pat lol del $1==$2
+ kills all_indir, LOCAL %bd==$1
+ uses DD_REG = {LOCAL, $1}
+ gen sub_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat dee
kills posextern
gen sub_l {const, 1}, {absolute4, $1}
pat cii
with STACK
+ kills ALL
gen jsr {absolute4, ".cii"}
pat cuu
with STACK
+ kills ALL
gen jsr {absolute4, ".cuu"}
pat ciu leaving cuu
proc logdef example and
with STACK
uses DD_REG = {const, $1/4 -1},
- AA_REG = {regAcon, sp, $1},
+ AA_REG,
DD_REG
- gen 1:
+ gen
+ lea {regAcon, sp, $1}, %b
+ 1:
move_l {post_inc4, sp}, %c
xxx* %c, {post_inc4, %b}
dbf %a, {slabel, 1b}
proc logndef
with DD_REG STACK
- uses AA_REG = {regAregXcon, sp, %1, 1, 0},
+ uses AA_REG,
DD_REG
- gen asr_l {shconst, 2}, %1
+ gen
+ lea {regAregXcon, sp, %1, 1, 0},%a
+ asr_l {shconst, 2}, %1
sub_l {const, 1}, %1
1:
move_l {post_inc4, sp}, %b
pat inn defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
move {const, $1}, d1
jsr {absolute4, ".inn"}
pat inn !defined($1)
with any4 any4 STACK
+ kills ALL
gen move %2, d0
move %1, d1
jsr {absolute4, ".inn"}
pat set $1>4
with any4 STACK
+ kills ALL
gen move %1, d0
move {const, $1}, d1
jsr {absolute4, ".set"}
pat set !defined($1)
with any4 any4 STACK
+ kills ALL
gen move %2, d0
move %1, d1
jsr {absolute4, ".set"}
pat lar defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".lar"}
pat lar !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".lar"}
pat sar defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".sar"}
pat sar !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".sar"}
pat aar defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".aar"}
yields a0
pat aar !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".aar"}
yields a0
pat cmi defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".cmi"}
yields d0
pat cmi !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".cmi"}
yields d0
pat cmu defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".cmu"}
yields d0
pat cmu !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".cmu"}
yields d0
pat cms defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".cms"}
yields d0
pat cms !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".cms"}
yields d0
kills ALL
gen jsr {absolute4, %1.bd}
with A_REG STACK
+ kills ALL
gen jsr {indirect4, %1}
with STACK
+ kills ALL
uses AA_REG = {post_inc4, sp}
gen jsr {indirect4, %a}
#ifdef TBL68020
gen jsr %1
#else TBL68020
with address STACK
+ kills ALL
gen jsr %1
#endif TBL68020
pat cal
with STACK
+ kills ALL
gen jsr {absolute4, $1}
pat lfr $1==4 yields d0
pat bls $1==4
with DD_REG AA_REG AA_REG
- kills allexceptcon, AA_REG
+ kills ALL
gen asr_l {shconst, 2}, %1
beq {slabel, 2f}
sub_l {const, 1}, %1
pat dus $1==4
with DD_REG STACK
- uses AA_REG = {regAregXcon, sp, %1, 1, 0}
- gen asr_l {shconst, 2}, %1
+ uses AA_REG
+ gen
+ lea {regAregXcon, sp, %1, 1, 0}, %a
+ asr_l {shconst, 2}, %1
beq {slabel, 2f}
sub_l {const, 1}, %1
1:
pat exg defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".exg"}
pat exg !defined($1)
with any4 STACK
+ kills ALL
gen move_l %1, d0
jsr {absolute4, ".exg"}
pat mon
with STACK
+ kills ALL
gen jsr {absolute4, ".mon"}
pat nop
with STACK
+ kills ALL
gen jsr {absolute4, ".nop"}
pat rck
1: yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".rck"}
#endif TBL68020
pat str $1==0
with any4 STACK
+ kills ALL
gen move %1, lb
pat str $1==1
pat str $1==2
with STACK
+ kills ALL
gen jsr {absolute4, ".strhp"}
pat trp
with STACK
+ kills ALL
gen jsr {absolute4, ".trp"}
pat loc loc cii loc bge $1==2 && $2==4 && in_2($4) call bxx2_in("bge")
pat loc loc cii loc bgt $1==2 && $2==4 && in_2($4) call bxx2_in("bgt")
-pat loc loc cii $1==1 && $2==2
-with DD_REG
- gen ext_w %1 yields %1
-
pat loc loc cii $1==2 && $2==4
with DD_REG
gen ext_l %1 yields %1
+with exact data2
+uses reusing %1,DD_REG
+ gen move %1,%a
+ ext_l %a yields %a
pat loc loc cii $1==1 && $2==4
with DD_REG
gen ext_w %1
ext_l %1 yields %1
#endif TBL68020
+with exact data1
+uses reusing %1,DD_REG
+ gen move %1,%a
+#ifdef TBL68020
+ extb_l %a yields %a
+#else TBL68020
+ ext_w %a
+ ext_l %a yields %a
+#endif TBL68020
pat loc loc ciu $1==$2 /* skip this */
pat loc loc cui $1==$2 /* skip this */
}
}
+#define MOVEM_LIMIT 2
+/* If #registers to be saved exceeds MOVEM_LIMIT, we
+* use the movem instruction to save registers; else
+* we simply use several move.l's.
+*/
+
+
regscore(off,size,typ,score,totyp)
long off;
{
return -1;
case reg_pointer:
if (size != 4 || totyp != reg_pointer) return -1;
- score *= 2;
+ score += (score >> 1);
break;
case reg_loop:
score += 5;
*/
score -= 2;
}
- score -= 1; /* take save/restore into account */
+ score--; /* save/restore */
return score;
}
struct regsav_t {
regnr = 0;
}
-#define MOVEM_LIMIT 2
-/* If #registers to be saved exceeds MOVEM_LIMIT, we
-* use the movem instruction to save registers; else
-* we simply use several move.l's.
-*/
-
save()
{
register struct regsav_t *p;
with any4
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen move %1, {LOCAL, $1}
+with exact STACK
+ kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
+ gen move {post_inc4, sp}, {LOCAL, $1}
pat stl inreg($1)==reg_pointer
with any4
with exact address-ext_addr
kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
gen lea %1, {LOCAL, $1}
+with exact STACK
+ kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
+ gen move {post_inc4, sp}, {LOCAL, $1}
pat sil inreg($1)==reg_pointer
with any4
kills allexceptcon
gen move %1, {indirect4, regvar($1, reg_pointer)}
+with exact STACK
+ kills allexceptcon
+ gen move {post_inc4, sp}, {indirect4, regvar($1, reg_pointer)}
pat lol sbi stl $1==$3 && $2==4 && inreg($1)==reg_any
kills allexceptcon
gen sub_l {const, 1}, {indirect4, regvar($1, reg_pointer)}
+pat lil adp sil $1==$3 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen add_l {const, $2}, {indirect4, regvar($1, reg_pointer)}
+
+pat lol lof inc lol stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen add_l {const, 1}, {offsetted4, regvar($1, reg_pointer), $2}
+
+pat lol lof dec lol stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen sub_l {const, 1}, {offsetted4, regvar($1, reg_pointer), $2}
+
+pat lol lof adp lol stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen add_l {const, $3}, {offsetted4, regvar($1, reg_pointer), $2}
+
pat inl inreg($1)==reg_any
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen add_l {const, 1}, {LOCAL, $1}
+pat lol inl $1==$2 && inreg($1)==reg_any
+ kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
+ uses DD_REG = {LOCAL, $1}
+ gen add_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat del inreg($1)==reg_any
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen sub_l {const, 1}, {LOCAL, $1}
+pat lol del $1==$2 && inreg($1)==reg_any
+ kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
+ uses DD_REG = {LOCAL, $1}
+ gen sub_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat zrl inreg($1)==reg_any
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen clr_l {LOCAL, $1}
kills allexceptcon
gen xxx* %1, {indirect4, regvar($1, reg_pointer)}
+proc lolfxxlolf example lol lof and lol stf
+with conreg4
+ kills allexceptcon
+ gen xxx* %1, {offsetted4, regvar($1, reg_pointer), $2}
+
proc lolcxxstl example lol loc and stl
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen xxx* {const, $2}, {LOCAL, $1}
call lolcxxstl("add.l")
pat lil adi sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("add.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("add.l")
pat lil loc adi sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("add.l")
pat lol lol adi stl $1==$4 && $3==4 && inreg($1)==reg_any && inreg($2)==reg_any
call lolcxxstl("add.l")
pat lil adu sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("add.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("add.l")
pat lil loc adu sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("add.l")
pat lol lol adu stl $1==$4 && $3==4 && inreg($1)==reg_any && inreg($2)==reg_any
call lolcxxstl("and.l")
pat lil and sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("and.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("and.l")
pat lil loc and sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("and.l")
pat lol lol and stl $1==$4 && $3==4 && inreg($1)==reg_any && inreg($2)==reg_any
call lolcxxstl("or.l")
pat lil ior sil $1==$3 && $2==4 && inreg($1)==reg_pointer
call lilxxsil("or.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("or.l")
pat lil loc ior sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("or.l")
pat lol lol ior stl $1==$4 && $3==4 && inreg($1)==reg_any &&
call lolcxxstl("eor.l")
pat lil xor sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("eor.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("eor.l")
pat lil loc xor sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("eor.l")
pat lol lol xor stl $1==$4 && $3==4 && inreg($1)==reg_any &&
gen add_l {const, $3}, {indirect4, regvar($1, reg_pointer)}
yields %a
+pat lol lof dup adp lol stf $1==$5 && $2==$6 && inreg($1)==reg_pointer
+ kills allexceptcon
+ uses AA_REG = {offsetted4, regvar($1, reg_pointer), $2}
+ gen add_l {const, $4}, {offsetted4, regvar($1, reg_pointer), $2}
+ yields %a
+
pat lol lol adp stl loi $1==$2 && $1==$4 && $3==1 && $5==1 &&
inreg($1)==reg_pointer
kills regvar($1, reg_pointer)
{indirect4, %1}
pat loi $1>8
with AA_REG STACK
+ kills ALL
uses DD_REG = {const, $1/4 -1}
gen add_l {const, $1}, %1
1:
pat los $1==4
with STACK
+ kills ALL
gen jsr {absolute4, ".los"}
pat lde yields {absolute4, $1+4}
kills all_indir, LOCAL %bd==$1
gen move %1, {LOCAL, $1}
with exact STACK
+ kills all_indir, LOCAL %bd==$1
gen move {post_inc4,sp}, {LOCAL, $1}
pat ste
kills posextern
gen move %1, {absolute4, $1}
with exact STACK
+ kills posextern
gen move {post_inc4, sp}, {absolute4, $1}
pat sil
kills allexceptcon
gen move %1, {ILOCAL, $1}
with exact STACK
+ kills allexceptcon
gen move {post_inc4, sp}, {ILOCAL, $1}
#else TBL68020
with any4
uses AA_REG = {LOCAL, $1}
gen move %1, {indirect4, %a}
with exact STACK
+ kills allexceptcon
uses AA_REG = {LOCAL, $1}
gen move {post_inc4, sp}, {indirect4, %a}
#endif TBL68020
kills allexceptcon
gen move %2, {offsetted4, %1, $1}
with A_REG STACK
+ kills allexceptcon
gen move {post_inc4, sp}, {offsetted4, %1, $1}
with exact local_addr any4
kills allexceptcon
kills allexceptcon
gen move %2, {indirect4, %1}
with A_REG STACK
+ kills allexceptcon
gen move {post_inc4, sp}, {indirect4, %1}
with exact local_addr any4
kills allexceptcon
pat sti $1>4
with AA_REG STACK
+ kills ALL
uses DD_REG = {const, $1/4 -1}
gen 1:
move_l {post_inc4, sp}, {post_inc4, %1}
pat sts $1==4
with STACK
+ kills ALL
gen jsr {absolute4, ".sts"}
pat sdl
gen muls_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".mli"}
yields d1
#endif TBL68020
gen divs_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvi"}
yields d1
#endif TBL68020
yields %a
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvi"}
yields d0
#endif TBL68020
gen mulu_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".mlu"}
yields d1
#endif TBL68020
gen divu_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvu"}
yields d1
#endif TBL68020
yields %a
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvu"}
yields d0
#endif TBL68020
kills all_indir, LOCAL %bd==$1
gen add_l {const, 1}, {LOCAL, $1}
+pat lol inl $1==$2
+ kills all_indir, LOCAL %bd==$1
+ uses DD_REG = {LOCAL, $1}
+ gen add_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat ine
kills posextern
gen add_l {const, 1}, {absolute4, $1}
kills all_indir, LOCAL %bd==$1
gen sub_l {const, 1}, {LOCAL, $1}
+pat lol del $1==$2
+ kills all_indir, LOCAL %bd==$1
+ uses DD_REG = {LOCAL, $1}
+ gen sub_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat dee
kills posextern
gen sub_l {const, 1}, {absolute4, $1}
pat cii
with STACK
+ kills ALL
gen jsr {absolute4, ".cii"}
pat cuu
with STACK
+ kills ALL
gen jsr {absolute4, ".cuu"}
pat ciu leaving cuu
proc logdef example and
with STACK
uses DD_REG = {const, $1/4 -1},
- AA_REG = {regAcon, sp, $1},
+ AA_REG,
DD_REG
- gen 1:
+ gen
+ lea {regAcon, sp, $1}, %b
+ 1:
move_l {post_inc4, sp}, %c
xxx* %c, {post_inc4, %b}
dbf %a, {slabel, 1b}
proc logndef
with DD_REG STACK
- uses AA_REG = {regAregXcon, sp, %1, 1, 0},
+ uses AA_REG,
DD_REG
- gen asr_l {shconst, 2}, %1
+ gen
+ lea {regAregXcon, sp, %1, 1, 0},%a
+ asr_l {shconst, 2}, %1
sub_l {const, 1}, %1
1:
move_l {post_inc4, sp}, %b
pat inn defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
move {const, $1}, d1
jsr {absolute4, ".inn"}
pat inn !defined($1)
with any4 any4 STACK
+ kills ALL
gen move %2, d0
move %1, d1
jsr {absolute4, ".inn"}
pat set $1>4
with any4 STACK
+ kills ALL
gen move %1, d0
move {const, $1}, d1
jsr {absolute4, ".set"}
pat set !defined($1)
with any4 any4 STACK
+ kills ALL
gen move %2, d0
move %1, d1
jsr {absolute4, ".set"}
pat lar defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".lar"}
pat lar !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".lar"}
pat sar defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".sar"}
pat sar !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".sar"}
pat aar defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".aar"}
yields a0
pat aar !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".aar"}
yields a0
pat cmi defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".cmi"}
yields d0
pat cmi !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".cmi"}
yields d0
pat cmu defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".cmu"}
yields d0
pat cmu !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".cmu"}
yields d0
pat cms defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".cms"}
yields d0
pat cms !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".cms"}
yields d0
kills ALL
gen jsr {absolute4, %1.bd}
with A_REG STACK
+ kills ALL
gen jsr {indirect4, %1}
with STACK
+ kills ALL
uses AA_REG = {post_inc4, sp}
gen jsr {indirect4, %a}
#ifdef TBL68020
gen jsr %1
#else TBL68020
with address STACK
+ kills ALL
gen jsr %1
#endif TBL68020
pat cal
with STACK
+ kills ALL
gen jsr {absolute4, $1}
pat lfr $1==4 yields d0
pat bls $1==4
with DD_REG AA_REG AA_REG
- kills allexceptcon, AA_REG
+ kills ALL
gen asr_l {shconst, 2}, %1
beq {slabel, 2f}
sub_l {const, 1}, %1
pat dus $1==4
with DD_REG STACK
- uses AA_REG = {regAregXcon, sp, %1, 1, 0}
- gen asr_l {shconst, 2}, %1
+ uses AA_REG
+ gen
+ lea {regAregXcon, sp, %1, 1, 0}, %a
+ asr_l {shconst, 2}, %1
beq {slabel, 2f}
sub_l {const, 1}, %1
1:
pat exg defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".exg"}
pat exg !defined($1)
with any4 STACK
+ kills ALL
gen move_l %1, d0
jsr {absolute4, ".exg"}
pat mon
with STACK
+ kills ALL
gen jsr {absolute4, ".mon"}
pat nop
with STACK
+ kills ALL
gen jsr {absolute4, ".nop"}
pat rck
1: yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".rck"}
#endif TBL68020
pat str $1==0
with any4 STACK
+ kills ALL
gen move %1, lb
pat str $1==1
pat str $1==2
with STACK
+ kills ALL
gen jsr {absolute4, ".strhp"}
pat trp
with STACK
+ kills ALL
gen jsr {absolute4, ".trp"}
pat loc loc cii loc bge $1==2 && $2==4 && in_2($4) call bxx2_in("bge")
pat loc loc cii loc bgt $1==2 && $2==4 && in_2($4) call bxx2_in("bgt")
-pat loc loc cii $1==1 && $2==2
-with DD_REG
- gen ext_w %1 yields %1
-
pat loc loc cii $1==2 && $2==4
with DD_REG
gen ext_l %1 yields %1
+with exact data2
+uses reusing %1,DD_REG
+ gen move %1,%a
+ ext_l %a yields %a
pat loc loc cii $1==1 && $2==4
with DD_REG
gen ext_w %1
ext_l %1 yields %1
#endif TBL68020
+with exact data1
+uses reusing %1,DD_REG
+ gen move %1,%a
+#ifdef TBL68020
+ extb_l %a yields %a
+#else TBL68020
+ ext_w %a
+ ext_l %a yields %a
+#endif TBL68020
pat loc loc ciu $1==$2 /* skip this */
pat loc loc cui $1==$2 /* skip this */
}
}
+#define MOVEM_LIMIT 2
+/* If #registers to be saved exceeds MOVEM_LIMIT, we
+* use the movem instruction to save registers; else
+* we simply use several move.l's.
+*/
+
+
regscore(off,size,typ,score,totyp)
long off;
{
return -1;
case reg_pointer:
if (size != 4 || totyp != reg_pointer) return -1;
- score *= 2;
+ score += (score >> 1);
break;
case reg_loop:
score += 5;
*/
score -= 2;
}
- score -= 1; /* take save/restore into account */
+ score--; /* save/restore */
return score;
}
struct regsav_t {
regnr = 0;
}
-#define MOVEM_LIMIT 2
-/* If #registers to be saved exceeds MOVEM_LIMIT, we
-* use the movem instruction to save registers; else
-* we simply use several move.l's.
-*/
-
save()
{
register struct regsav_t *p;
with any4
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen move %1, {LOCAL, $1}
+with exact STACK
+ kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
+ gen move {post_inc4, sp}, {LOCAL, $1}
pat stl inreg($1)==reg_pointer
with any4
with exact address-ext_addr
kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
gen lea %1, {LOCAL, $1}
+with exact STACK
+ kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
+ gen move {post_inc4, sp}, {LOCAL, $1}
pat sil inreg($1)==reg_pointer
with any4
kills allexceptcon
gen move %1, {indirect4, regvar($1, reg_pointer)}
+with exact STACK
+ kills allexceptcon
+ gen move {post_inc4, sp}, {indirect4, regvar($1, reg_pointer)}
pat lol sbi stl $1==$3 && $2==4 && inreg($1)==reg_any
kills allexceptcon
gen sub_l {const, 1}, {indirect4, regvar($1, reg_pointer)}
+pat lil adp sil $1==$3 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen add_l {const, $2}, {indirect4, regvar($1, reg_pointer)}
+
+pat lol lof inc lol stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen add_l {const, 1}, {offsetted4, regvar($1, reg_pointer), $2}
+
+pat lol lof dec lol stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen sub_l {const, 1}, {offsetted4, regvar($1, reg_pointer), $2}
+
+pat lol lof adp lol stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen add_l {const, $3}, {offsetted4, regvar($1, reg_pointer), $2}
+
pat inl inreg($1)==reg_any
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen add_l {const, 1}, {LOCAL, $1}
+pat lol inl $1==$2 && inreg($1)==reg_any
+ kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
+ uses DD_REG = {LOCAL, $1}
+ gen add_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat del inreg($1)==reg_any
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen sub_l {const, 1}, {LOCAL, $1}
+pat lol del $1==$2 && inreg($1)==reg_any
+ kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
+ uses DD_REG = {LOCAL, $1}
+ gen sub_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat zrl inreg($1)==reg_any
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen clr_l {LOCAL, $1}
kills allexceptcon
gen xxx* %1, {indirect4, regvar($1, reg_pointer)}
+proc lolfxxlolf example lol lof and lol stf
+with conreg4
+ kills allexceptcon
+ gen xxx* %1, {offsetted4, regvar($1, reg_pointer), $2}
+
proc lolcxxstl example lol loc and stl
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen xxx* {const, $2}, {LOCAL, $1}
call lolcxxstl("add.l")
pat lil adi sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("add.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("add.l")
pat lil loc adi sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("add.l")
pat lol lol adi stl $1==$4 && $3==4 && inreg($1)==reg_any && inreg($2)==reg_any
call lolcxxstl("add.l")
pat lil adu sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("add.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("add.l")
pat lil loc adu sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("add.l")
pat lol lol adu stl $1==$4 && $3==4 && inreg($1)==reg_any && inreg($2)==reg_any
call lolcxxstl("and.l")
pat lil and sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("and.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("and.l")
pat lil loc and sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("and.l")
pat lol lol and stl $1==$4 && $3==4 && inreg($1)==reg_any && inreg($2)==reg_any
call lolcxxstl("or.l")
pat lil ior sil $1==$3 && $2==4 && inreg($1)==reg_pointer
call lilxxsil("or.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("or.l")
pat lil loc ior sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("or.l")
pat lol lol ior stl $1==$4 && $3==4 && inreg($1)==reg_any &&
call lolcxxstl("eor.l")
pat lil xor sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("eor.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("eor.l")
pat lil loc xor sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("eor.l")
pat lol lol xor stl $1==$4 && $3==4 && inreg($1)==reg_any &&
gen add_l {const, $3}, {indirect4, regvar($1, reg_pointer)}
yields %a
+pat lol lof dup adp lol stf $1==$5 && $2==$6 && inreg($1)==reg_pointer
+ kills allexceptcon
+ uses AA_REG = {offsetted4, regvar($1, reg_pointer), $2}
+ gen add_l {const, $4}, {offsetted4, regvar($1, reg_pointer), $2}
+ yields %a
+
pat lol lol adp stl loi $1==$2 && $1==$4 && $3==1 && $5==1 &&
inreg($1)==reg_pointer
kills regvar($1, reg_pointer)
{indirect4, %1}
pat loi $1>8
with AA_REG STACK
+ kills ALL
uses DD_REG = {const, $1/4 -1}
gen add_l {const, $1}, %1
1:
pat los $1==4
with STACK
+ kills ALL
gen jsr {absolute4, ".los"}
pat lde yields {absolute4, $1+4}
kills all_indir, LOCAL %bd==$1
gen move %1, {LOCAL, $1}
with exact STACK
+ kills all_indir, LOCAL %bd==$1
gen move {post_inc4,sp}, {LOCAL, $1}
pat ste
kills posextern
gen move %1, {absolute4, $1}
with exact STACK
+ kills posextern
gen move {post_inc4, sp}, {absolute4, $1}
pat sil
kills allexceptcon
gen move %1, {ILOCAL, $1}
with exact STACK
+ kills allexceptcon
gen move {post_inc4, sp}, {ILOCAL, $1}
#else TBL68020
with any4
uses AA_REG = {LOCAL, $1}
gen move %1, {indirect4, %a}
with exact STACK
+ kills allexceptcon
uses AA_REG = {LOCAL, $1}
gen move {post_inc4, sp}, {indirect4, %a}
#endif TBL68020
kills allexceptcon
gen move %2, {offsetted4, %1, $1}
with A_REG STACK
+ kills allexceptcon
gen move {post_inc4, sp}, {offsetted4, %1, $1}
with exact local_addr any4
kills allexceptcon
kills allexceptcon
gen move %2, {indirect4, %1}
with A_REG STACK
+ kills allexceptcon
gen move {post_inc4, sp}, {indirect4, %1}
with exact local_addr any4
kills allexceptcon
pat sti $1>4
with AA_REG STACK
+ kills ALL
uses DD_REG = {const, $1/4 -1}
gen 1:
move_l {post_inc4, sp}, {post_inc4, %1}
pat sts $1==4
with STACK
+ kills ALL
gen jsr {absolute4, ".sts"}
pat sdl
gen muls_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".mli"}
yields d1
#endif TBL68020
gen divs_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvi"}
yields d1
#endif TBL68020
yields %a
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvi"}
yields d0
#endif TBL68020
gen mulu_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".mlu"}
yields d1
#endif TBL68020
gen divu_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvu"}
yields d1
#endif TBL68020
yields %a
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvu"}
yields d0
#endif TBL68020
kills all_indir, LOCAL %bd==$1
gen add_l {const, 1}, {LOCAL, $1}
+pat lol inl $1==$2
+ kills all_indir, LOCAL %bd==$1
+ uses DD_REG = {LOCAL, $1}
+ gen add_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat ine
kills posextern
gen add_l {const, 1}, {absolute4, $1}
kills all_indir, LOCAL %bd==$1
gen sub_l {const, 1}, {LOCAL, $1}
+pat lol del $1==$2
+ kills all_indir, LOCAL %bd==$1
+ uses DD_REG = {LOCAL, $1}
+ gen sub_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat dee
kills posextern
gen sub_l {const, 1}, {absolute4, $1}
pat cii
with STACK
+ kills ALL
gen jsr {absolute4, ".cii"}
pat cuu
with STACK
+ kills ALL
gen jsr {absolute4, ".cuu"}
pat ciu leaving cuu
proc logdef example and
with STACK
uses DD_REG = {const, $1/4 -1},
- AA_REG = {regAcon, sp, $1},
+ AA_REG,
DD_REG
- gen 1:
+ gen
+ lea {regAcon, sp, $1}, %b
+ 1:
move_l {post_inc4, sp}, %c
xxx* %c, {post_inc4, %b}
dbf %a, {slabel, 1b}
proc logndef
with DD_REG STACK
- uses AA_REG = {regAregXcon, sp, %1, 1, 0},
+ uses AA_REG,
DD_REG
- gen asr_l {shconst, 2}, %1
+ gen
+ lea {regAregXcon, sp, %1, 1, 0},%a
+ asr_l {shconst, 2}, %1
sub_l {const, 1}, %1
1:
move_l {post_inc4, sp}, %b
pat inn defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
move {const, $1}, d1
jsr {absolute4, ".inn"}
pat inn !defined($1)
with any4 any4 STACK
+ kills ALL
gen move %2, d0
move %1, d1
jsr {absolute4, ".inn"}
pat set $1>4
with any4 STACK
+ kills ALL
gen move %1, d0
move {const, $1}, d1
jsr {absolute4, ".set"}
pat set !defined($1)
with any4 any4 STACK
+ kills ALL
gen move %2, d0
move %1, d1
jsr {absolute4, ".set"}
pat lar defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".lar"}
pat lar !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".lar"}
pat sar defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".sar"}
pat sar !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".sar"}
pat aar defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".aar"}
yields a0
pat aar !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".aar"}
yields a0
pat cmi defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".cmi"}
yields d0
pat cmi !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".cmi"}
yields d0
pat cmu defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".cmu"}
yields d0
pat cmu !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".cmu"}
yields d0
pat cms defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".cms"}
yields d0
pat cms !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".cms"}
yields d0
kills ALL
gen jsr {absolute4, %1.bd}
with A_REG STACK
+ kills ALL
gen jsr {indirect4, %1}
with STACK
+ kills ALL
uses AA_REG = {post_inc4, sp}
gen jsr {indirect4, %a}
#ifdef TBL68020
gen jsr %1
#else TBL68020
with address STACK
+ kills ALL
gen jsr %1
#endif TBL68020
pat cal
with STACK
+ kills ALL
gen jsr {absolute4, $1}
pat lfr $1==4 yields d0
pat bls $1==4
with DD_REG AA_REG AA_REG
- kills allexceptcon, AA_REG
+ kills ALL
gen asr_l {shconst, 2}, %1
beq {slabel, 2f}
sub_l {const, 1}, %1
pat dus $1==4
with DD_REG STACK
- uses AA_REG = {regAregXcon, sp, %1, 1, 0}
- gen asr_l {shconst, 2}, %1
+ uses AA_REG
+ gen
+ lea {regAregXcon, sp, %1, 1, 0}, %a
+ asr_l {shconst, 2}, %1
beq {slabel, 2f}
sub_l {const, 1}, %1
1:
pat exg defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".exg"}
pat exg !defined($1)
with any4 STACK
+ kills ALL
gen move_l %1, d0
jsr {absolute4, ".exg"}
pat mon
with STACK
+ kills ALL
gen jsr {absolute4, ".mon"}
pat nop
with STACK
+ kills ALL
gen jsr {absolute4, ".nop"}
pat rck
1: yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".rck"}
#endif TBL68020
pat str $1==0
with any4 STACK
+ kills ALL
gen move %1, lb
pat str $1==1
pat str $1==2
with STACK
+ kills ALL
gen jsr {absolute4, ".strhp"}
pat trp
with STACK
+ kills ALL
gen jsr {absolute4, ".trp"}
pat loc loc cii loc bge $1==2 && $2==4 && in_2($4) call bxx2_in("bge")
pat loc loc cii loc bgt $1==2 && $2==4 && in_2($4) call bxx2_in("bgt")
-pat loc loc cii $1==1 && $2==2
-with DD_REG
- gen ext_w %1 yields %1
-
pat loc loc cii $1==2 && $2==4
with DD_REG
gen ext_l %1 yields %1
+with exact data2
+uses reusing %1,DD_REG
+ gen move %1,%a
+ ext_l %a yields %a
pat loc loc cii $1==1 && $2==4
with DD_REG
gen ext_w %1
ext_l %1 yields %1
#endif TBL68020
+with exact data1
+uses reusing %1,DD_REG
+ gen move %1,%a
+#ifdef TBL68020
+ extb_l %a yields %a
+#else TBL68020
+ ext_w %a
+ ext_l %a yields %a
+#endif TBL68020
pat loc loc ciu $1==$2 /* skip this */
pat loc loc cui $1==$2 /* skip this */
}
}
+#define MOVEM_LIMIT 2
+/* If #registers to be saved exceeds MOVEM_LIMIT, we
+* use the movem instruction to save registers; else
+* we simply use several move.l's.
+*/
+
+
regscore(off,size,typ,score,totyp)
long off;
{
return -1;
case reg_pointer:
if (size != 4 || totyp != reg_pointer) return -1;
- score *= 2;
+ score += (score >> 1);
break;
case reg_loop:
score += 5;
*/
score -= 2;
}
- score -= 1; /* take save/restore into account */
+ score--; /* save/restore */
return score;
}
struct regsav_t {
regnr = 0;
}
-#define MOVEM_LIMIT 2
-/* If #registers to be saved exceeds MOVEM_LIMIT, we
-* use the movem instruction to save registers; else
-* we simply use several move.l's.
-*/
-
save()
{
register struct regsav_t *p;
with any4
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen move %1, {LOCAL, $1}
+with exact STACK
+ kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
+ gen move {post_inc4, sp}, {LOCAL, $1}
pat stl inreg($1)==reg_pointer
with any4
with exact address-ext_addr
kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
gen lea %1, {LOCAL, $1}
+with exact STACK
+ kills regvar($1, reg_pointer), all_regind %reg==regvar($1, reg_pointer)
+ gen move {post_inc4, sp}, {LOCAL, $1}
pat sil inreg($1)==reg_pointer
with any4
kills allexceptcon
gen move %1, {indirect4, regvar($1, reg_pointer)}
+with exact STACK
+ kills allexceptcon
+ gen move {post_inc4, sp}, {indirect4, regvar($1, reg_pointer)}
pat lol sbi stl $1==$3 && $2==4 && inreg($1)==reg_any
kills allexceptcon
gen sub_l {const, 1}, {indirect4, regvar($1, reg_pointer)}
+pat lil adp sil $1==$3 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen add_l {const, $2}, {indirect4, regvar($1, reg_pointer)}
+
+pat lol lof inc lol stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen add_l {const, 1}, {offsetted4, regvar($1, reg_pointer), $2}
+
+pat lol lof dec lol stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen sub_l {const, 1}, {offsetted4, regvar($1, reg_pointer), $2}
+
+pat lol lof adp lol stf $1==$4 && $2==$5 && inreg($1)==reg_pointer
+ kills allexceptcon
+ gen add_l {const, $3}, {offsetted4, regvar($1, reg_pointer), $2}
+
pat inl inreg($1)==reg_any
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen add_l {const, 1}, {LOCAL, $1}
+pat lol inl $1==$2 && inreg($1)==reg_any
+ kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
+ uses DD_REG = {LOCAL, $1}
+ gen add_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat del inreg($1)==reg_any
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen sub_l {const, 1}, {LOCAL, $1}
+pat lol del $1==$2 && inreg($1)==reg_any
+ kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
+ uses DD_REG = {LOCAL, $1}
+ gen sub_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat zrl inreg($1)==reg_any
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen clr_l {LOCAL, $1}
kills allexceptcon
gen xxx* %1, {indirect4, regvar($1, reg_pointer)}
+proc lolfxxlolf example lol lof and lol stf
+with conreg4
+ kills allexceptcon
+ gen xxx* %1, {offsetted4, regvar($1, reg_pointer), $2}
+
proc lolcxxstl example lol loc and stl
kills regvar($1, reg_any), use_index %xreg==regvar($1, reg_any)
gen xxx* {const, $2}, {LOCAL, $1}
call lolcxxstl("add.l")
pat lil adi sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("add.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("add.l")
pat lil loc adi sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("add.l")
pat lol lol adi stl $1==$4 && $3==4 && inreg($1)==reg_any && inreg($2)==reg_any
call lolcxxstl("add.l")
pat lil adu sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("add.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("add.l")
pat lil loc adu sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("add.l")
pat lol lol adu stl $1==$4 && $3==4 && inreg($1)==reg_any && inreg($2)==reg_any
call lolcxxstl("and.l")
pat lil and sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("and.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("and.l")
pat lil loc and sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("and.l")
pat lol lol and stl $1==$4 && $3==4 && inreg($1)==reg_any && inreg($2)==reg_any
call lolcxxstl("or.l")
pat lil ior sil $1==$3 && $2==4 && inreg($1)==reg_pointer
call lilxxsil("or.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("or.l")
pat lil loc ior sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("or.l")
pat lol lol ior stl $1==$4 && $3==4 && inreg($1)==reg_any &&
call lolcxxstl("eor.l")
pat lil xor sil $1==$3 && $2==4 &&inreg($1)==reg_pointer
call lilxxsil("eor.l")
+pat lol lof adi lol stf $1==$4 && $2==$5 && $3==4 && inreg($1)==reg_pointer
+ call lolfxxlolf("eor.l")
pat lil loc xor sil $1==$4 && $3==4 && inreg($1)==reg_pointer
call lilcxxsil("eor.l")
pat lol lol xor stl $1==$4 && $3==4 && inreg($1)==reg_any &&
gen add_l {const, $3}, {indirect4, regvar($1, reg_pointer)}
yields %a
+pat lol lof dup adp lol stf $1==$5 && $2==$6 && inreg($1)==reg_pointer
+ kills allexceptcon
+ uses AA_REG = {offsetted4, regvar($1, reg_pointer), $2}
+ gen add_l {const, $4}, {offsetted4, regvar($1, reg_pointer), $2}
+ yields %a
+
pat lol lol adp stl loi $1==$2 && $1==$4 && $3==1 && $5==1 &&
inreg($1)==reg_pointer
kills regvar($1, reg_pointer)
{indirect4, %1}
pat loi $1>8
with AA_REG STACK
+ kills ALL
uses DD_REG = {const, $1/4 -1}
gen add_l {const, $1}, %1
1:
pat los $1==4
with STACK
+ kills ALL
gen jsr {absolute4, ".los"}
pat lde yields {absolute4, $1+4}
kills all_indir, LOCAL %bd==$1
gen move %1, {LOCAL, $1}
with exact STACK
+ kills all_indir, LOCAL %bd==$1
gen move {post_inc4,sp}, {LOCAL, $1}
pat ste
kills posextern
gen move %1, {absolute4, $1}
with exact STACK
+ kills posextern
gen move {post_inc4, sp}, {absolute4, $1}
pat sil
kills allexceptcon
gen move %1, {ILOCAL, $1}
with exact STACK
+ kills allexceptcon
gen move {post_inc4, sp}, {ILOCAL, $1}
#else TBL68020
with any4
uses AA_REG = {LOCAL, $1}
gen move %1, {indirect4, %a}
with exact STACK
+ kills allexceptcon
uses AA_REG = {LOCAL, $1}
gen move {post_inc4, sp}, {indirect4, %a}
#endif TBL68020
kills allexceptcon
gen move %2, {offsetted4, %1, $1}
with A_REG STACK
+ kills allexceptcon
gen move {post_inc4, sp}, {offsetted4, %1, $1}
with exact local_addr any4
kills allexceptcon
kills allexceptcon
gen move %2, {indirect4, %1}
with A_REG STACK
+ kills allexceptcon
gen move {post_inc4, sp}, {indirect4, %1}
with exact local_addr any4
kills allexceptcon
pat sti $1>4
with AA_REG STACK
+ kills ALL
uses DD_REG = {const, $1/4 -1}
gen 1:
move_l {post_inc4, sp}, {post_inc4, %1}
pat sts $1==4
with STACK
+ kills ALL
gen jsr {absolute4, ".sts"}
pat sdl
gen muls_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".mli"}
yields d1
#endif TBL68020
gen divs_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvi"}
yields d1
#endif TBL68020
yields %a
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvi"}
yields d0
#endif TBL68020
gen mulu_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".mlu"}
yields d1
#endif TBL68020
gen divu_l %1, %2 yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvu"}
yields d1
#endif TBL68020
yields %a
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".dvu"}
yields d0
#endif TBL68020
kills all_indir, LOCAL %bd==$1
gen add_l {const, 1}, {LOCAL, $1}
+pat lol inl $1==$2
+ kills all_indir, LOCAL %bd==$1
+ uses DD_REG = {LOCAL, $1}
+ gen add_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat ine
kills posextern
gen add_l {const, 1}, {absolute4, $1}
kills all_indir, LOCAL %bd==$1
gen sub_l {const, 1}, {LOCAL, $1}
+pat lol del $1==$2
+ kills all_indir, LOCAL %bd==$1
+ uses DD_REG = {LOCAL, $1}
+ gen sub_l {const, 1}, {LOCAL, $1}
+ yields %a
+
pat dee
kills posextern
gen sub_l {const, 1}, {absolute4, $1}
pat cii
with STACK
+ kills ALL
gen jsr {absolute4, ".cii"}
pat cuu
with STACK
+ kills ALL
gen jsr {absolute4, ".cuu"}
pat ciu leaving cuu
proc logdef example and
with STACK
uses DD_REG = {const, $1/4 -1},
- AA_REG = {regAcon, sp, $1},
+ AA_REG,
DD_REG
- gen 1:
+ gen
+ lea {regAcon, sp, $1}, %b
+ 1:
move_l {post_inc4, sp}, %c
xxx* %c, {post_inc4, %b}
dbf %a, {slabel, 1b}
proc logndef
with DD_REG STACK
- uses AA_REG = {regAregXcon, sp, %1, 1, 0},
+ uses AA_REG,
DD_REG
- gen asr_l {shconst, 2}, %1
+ gen
+ lea {regAregXcon, sp, %1, 1, 0},%a
+ asr_l {shconst, 2}, %1
sub_l {const, 1}, %1
1:
move_l {post_inc4, sp}, %b
pat inn defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
move {const, $1}, d1
jsr {absolute4, ".inn"}
pat inn !defined($1)
with any4 any4 STACK
+ kills ALL
gen move %2, d0
move %1, d1
jsr {absolute4, ".inn"}
pat set $1>4
with any4 STACK
+ kills ALL
gen move %1, d0
move {const, $1}, d1
jsr {absolute4, ".set"}
pat set !defined($1)
with any4 any4 STACK
+ kills ALL
gen move %2, d0
move %1, d1
jsr {absolute4, ".set"}
pat lar defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".lar"}
pat lar !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".lar"}
pat sar defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".sar"}
pat sar !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".sar"}
pat aar defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".aar"}
yields a0
pat aar !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".aar"}
yields a0
pat cmi defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".cmi"}
yields d0
pat cmi !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".cmi"}
yields d0
pat cmu defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".cmu"}
yields d0
pat cmu !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".cmu"}
yields d0
pat cms defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".cms"}
yields d0
pat cms !defined($1)
with any4 STACK
+ kills ALL
gen move %1, d0
jsr {absolute4, ".cms"}
yields d0
kills ALL
gen jsr {absolute4, %1.bd}
with A_REG STACK
+ kills ALL
gen jsr {indirect4, %1}
with STACK
+ kills ALL
uses AA_REG = {post_inc4, sp}
gen jsr {indirect4, %a}
#ifdef TBL68020
gen jsr %1
#else TBL68020
with address STACK
+ kills ALL
gen jsr %1
#endif TBL68020
pat cal
with STACK
+ kills ALL
gen jsr {absolute4, $1}
pat lfr $1==4 yields d0
pat bls $1==4
with DD_REG AA_REG AA_REG
- kills allexceptcon, AA_REG
+ kills ALL
gen asr_l {shconst, 2}, %1
beq {slabel, 2f}
sub_l {const, 1}, %1
pat dus $1==4
with DD_REG STACK
- uses AA_REG = {regAregXcon, sp, %1, 1, 0}
- gen asr_l {shconst, 2}, %1
+ uses AA_REG
+ gen
+ lea {regAregXcon, sp, %1, 1, 0}, %a
+ asr_l {shconst, 2}, %1
beq {slabel, 2f}
sub_l {const, 1}, %1
1:
pat exg defined($1)
with STACK
+ kills ALL
gen move {const, $1}, d0
jsr {absolute4, ".exg"}
pat exg !defined($1)
with any4 STACK
+ kills ALL
gen move_l %1, d0
jsr {absolute4, ".exg"}
pat mon
with STACK
+ kills ALL
gen jsr {absolute4, ".mon"}
pat nop
with STACK
+ kills ALL
gen jsr {absolute4, ".nop"}
pat rck
1: yields %2
#else TBL68020
with STACK
+ kills ALL
gen jsr {absolute4, ".rck"}
#endif TBL68020
pat str $1==0
with any4 STACK
+ kills ALL
gen move %1, lb
pat str $1==1
pat str $1==2
with STACK
+ kills ALL
gen jsr {absolute4, ".strhp"}
pat trp
with STACK
+ kills ALL
gen jsr {absolute4, ".trp"}
pat loc loc cii loc bge $1==2 && $2==4 && in_2($4) call bxx2_in("bge")
pat loc loc cii loc bgt $1==2 && $2==4 && in_2($4) call bxx2_in("bgt")
-pat loc loc cii $1==1 && $2==2
-with DD_REG
- gen ext_w %1 yields %1
-
pat loc loc cii $1==2 && $2==4
with DD_REG
gen ext_l %1 yields %1
+with exact data2
+uses reusing %1,DD_REG
+ gen move %1,%a
+ ext_l %a yields %a
pat loc loc cii $1==1 && $2==4
with DD_REG
gen ext_w %1
ext_l %1 yields %1
#endif TBL68020
+with exact data1
+uses reusing %1,DD_REG
+ gen move %1,%a
+#ifdef TBL68020
+ extb_l %a yields %a
+#else TBL68020
+ ext_w %a
+ ext_l %a yields %a
+#endif TBL68020
pat loc loc ciu $1==$2 /* skip this */
pat loc loc cui $1==$2 /* skip this */