Fixed problem with repl_mul(); it was called far too often

This commit is contained in:
ceriel 1992-04-24 12:39:58 +00:00
parent 6640944a51
commit bc42e31518
2 changed files with 12 additions and 5 deletions

View file

@ -32,6 +32,7 @@ adp sti $1!=0 && $2==w: stf $1
adp sti $1!=0 && $2==2*w: sdf $1
asp $1==0:
asp asp : asp $1+$2
dup asp $1<=$2: asp $2-$1
blm $1==0 : asp 2*p
cmi zeq $1==w: beq $2
cmi zge $1==w: bge $2

View file

@ -655,9 +655,17 @@ basicblock(alpp) line_p *alpp; {
lpp = next;
}
lpp = alpp;
if (repl_muls) while ((*lpp) != (line_p) 0) {
if (repl_muls) {
while ((lp = *lpp) != (line_p) 0 && (lp->l_instr&BMASK) != op_lab) {
line_p b_repl, e_repl;
int cnt = repl_mul(*lpp, &b_repl, &e_repl);
int cnt;
if ((cnt = (lp->l_instr & BMASK)) != op_loc && cnt != op_ldc) {
lpp = &lp->l_next;
continue;
}
cnt = repl_mul(lp, &b_repl, &e_repl);
lp = *lpp;
if (cnt > 0 && cnt <= repl_muls) {
@ -678,6 +686,7 @@ basicblock(alpp) line_p *alpp; {
lpp = &lp->l_next;
}
}
}
return madeopt;
}
@ -698,9 +707,6 @@ repl_mul(lp, b, e)
if ((ins = (next->l_instr & BMASK)) != op_mli && ins != op_mlu) {
return 0;
}
if ((ins = (lp->l_instr & BMASK)) != op_loc && ins != op_ldc) {
return 0;
}
switch(next->l_optyp) {
case OPNO:
return 0;