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
This commit is contained in:
parent
11cb7edde4
commit
3ecaa0b634
3 changed files with 33 additions and 6 deletions
|
@ -848,9 +848,14 @@ normalfailed: if (stackpad!=tokpatlen) {
|
|||
doreturn:
|
||||
#ifdef ALLOW_NEXTEM
|
||||
if (toplevel && totalcost == INFINITY && ! paniced) {
|
||||
totalcost += stackupto(&fakestack[stackheight-1], ply, toplevel);
|
||||
paniced = 1;
|
||||
DEBUG("PANIC!");
|
||||
totalcost += stackupto(&fakestack[stackheight-1], ply, toplevel);
|
||||
#ifndef NDEBUG
|
||||
if (Debug > 2)
|
||||
fprintf(stderr, "Stackheight = %d\n", stackheight);
|
||||
#endif
|
||||
paniced = 1;
|
||||
tokpatlen = 0;
|
||||
goto panic;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -36,10 +36,10 @@ tuples(regls,nregneeded) rl_p *regls; {
|
|||
* First compute equivalence classes of registers.
|
||||
*/
|
||||
|
||||
for (i=0;i<NREGS;i++) {
|
||||
for (i=NREGS;--i>=0;) {
|
||||
regclass[i] = class++;
|
||||
if (getrefcount(i, FALSE) == 0) {
|
||||
for (j=0;j<i;j++) {
|
||||
for (j=NREGS;--j>i;) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,6 +327,15 @@ distance(cindex) {
|
|||
} else
|
||||
exact++;
|
||||
}
|
||||
for (;i<tpl+fromstackneeded;i++) {
|
||||
/* Make sure that any pattern we pick can be
|
||||
made from the stack
|
||||
*/
|
||||
getint(tokexp,bp);
|
||||
if (! from_stack(&machsets[tokexp])) {
|
||||
return(MAXINT);
|
||||
}
|
||||
}
|
||||
if (exact==tpl && ! fromstackneeded) {
|
||||
if (xsekt)
|
||||
return(0);
|
||||
|
@ -335,6 +344,19 @@ distance(cindex) {
|
|||
return(20-2*exact+fromstackneeded);
|
||||
}
|
||||
|
||||
extern set_t unstackset;
|
||||
|
||||
int from_stack(s1)
|
||||
register set_p s1;
|
||||
{
|
||||
register set_p s2 = &unstackset;
|
||||
register int i;
|
||||
for (i = 0; i < SETSIZE; i++) {
|
||||
if ((s1->set_val[i] & s2->set_val[i]) != 0) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned costcalc(cost) cost_t cost; {
|
||||
extern unsigned cc1,cc2,cc3,cc4;
|
||||
|
||||
|
|
Loading…
Reference in a new issue