From: ceriel Date: Fri, 17 Mar 1989 16:49:58 +0000 (+0000) Subject: some fixes: fix order in which registers are allocated, make sure that X-Git-Tag: release-5-5~2496 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=3ecaa0b6341e2370ca812c413ca10727c1f8bad2;p=ack.git some fixes: fix order in which registers are allocated, make sure that a pattern chosen by the distance routine can be made from the stack if the fakestack does not contain enough tokens --- diff --git a/mach/proto/ncg/codegen.c b/mach/proto/ncg/codegen.c index 2b1391b2f..06c7e69e7 100644 --- a/mach/proto/ncg/codegen.c +++ b/mach/proto/ncg/codegen.c @@ -848,9 +848,14 @@ normalfailed: if (stackpad!=tokpatlen) { doreturn: #ifdef ALLOW_NEXTEM if (toplevel && totalcost == INFINITY && ! paniced) { + DEBUG("PANIC!"); totalcost += stackupto(&fakestack[stackheight-1], ply, toplevel); +#ifndef NDEBUG + if (Debug > 2) + fprintf(stderr, "Stackheight = %d\n", stackheight); +#endif paniced = 1; - DEBUG("PANIC!"); + tokpatlen = 0; goto panic; } #endif diff --git a/mach/proto/ncg/equiv.c b/mach/proto/ncg/equiv.c index ad1437f13..41966e974 100644 --- a/mach/proto/ncg/equiv.c +++ b/mach/proto/ncg/equiv.c @@ -36,10 +36,10 @@ tuples(regls,nregneeded) rl_p *regls; { * First compute equivalence classes of registers. */ - for (i=0;i=0;) { regclass[i] = class++; if (getrefcount(i, FALSE) == 0) { - for (j=0;ji;) { if (eqregclass(i,j) && eqtoken(&machregs[i].r_contents, &machregs[j].r_contents)) { @@ -86,8 +86,8 @@ permute(index) { perms = pp; } else { rlp=lar[index]; - for (i=rlp->rl_n-1; i>=0; i--) { - rar[index] = rlp->rl_list[i]; + for (i=rlp->rl_n; i>0; i--) { + rar[index] = rlp->rl_list[rlp->rl_n-i]; permute(index+1); } } diff --git a/mach/proto/ncg/subr.c b/mach/proto/ncg/subr.c index d7a4eec39..e5f6cca0a 100644 --- a/mach/proto/ncg/subr.c +++ b/mach/proto/ncg/subr.c @@ -327,6 +327,15 @@ distance(cindex) { } else exact++; } + for (;iset_val[i] & s2->set_val[i]) != 0) return 1; + } + return 0; +} + unsigned costcalc(cost) cost_t cost; { extern unsigned cc1,cc2,cc3,cc4;