* src/conflicts.c (print_reductions): Improve variable locality.

This commit is contained in:
Akim Demaille
2001-12-05 09:19:13 +00:00
parent 825b9e4ef4
commit 2883204382
2 changed files with 27 additions and 30 deletions

View File

@@ -1,3 +1,8 @@
2001-12-05 Akim Demaille <akim@epita.fr>
* src/conflicts.c (print_reductions): Improve variable locality.
2001-12-05 Akim Demaille <akim@epita.fr> 2001-12-05 Akim Demaille <akim@epita.fr>
* src/state.h (SHIFT_IS_ERROR, SHIFT_IS_GOTO, SHIFT_IS_SHIFT): New. * src/state.h (SHIFT_IS_ERROR, SHIFT_IS_GOTO, SHIFT_IS_SHIFT): New.

View File

@@ -502,11 +502,6 @@ print_reductions (FILE *out, int state)
{ {
int i; int i;
int j; int j;
int k;
unsigned *fp1;
unsigned *fp2;
unsigned *fp3;
unsigned *fp4;
int rule; int rule;
int symbol; int symbol;
unsigned mask; unsigned mask;
@@ -525,28 +520,24 @@ print_reductions (FILE *out, int state)
shiftp = state_table[state].shift_table; shiftp = state_table[state].shift_table;
if (shiftp) if (shiftp)
{ for (i = 0; i < shiftp->nshifts; i++)
k = shiftp->nshifts; {
for (i = 0; i < k; i++) if (!shiftp->shifts[i])
{ continue;
if (!shiftp->shifts[i]) symbol = state_table[shiftp->shifts[i]].accessing_symbol;
continue; if (ISVAR (symbol))
symbol = state_table[shiftp->shifts[i]].accessing_symbol; break;
if (ISVAR (symbol)) /* if this state has a shift for the error token,
break; don't use a default rule. */
/* if this state has a shift for the error token, if (symbol == error_token_number)
don't use a default rule. */ nodefault = 1;
if (symbol == error_token_number) SETBIT (shiftset, symbol);
nodefault = 1; }
SETBIT (shiftset, symbol);
}
}
errp = err_table[state]; errp = err_table[state];
if (errp) if (errp)
{ {
k = errp->nerrs; for (i = 0; i < errp->nerrs; i++)
for (i = 0; i < k; i++)
{ {
if (!errp->errs[i]) if (!errp->errs[i])
continue; continue;
@@ -560,12 +551,12 @@ print_reductions (FILE *out, int state)
if (n - m == 1 && !nodefault) if (n - m == 1 && !nodefault)
{ {
default_rule = LAruleno[m]; unsigned *fp1 = LA (m);
unsigned *fp2 = shiftset;
unsigned *fp3 = lookaheadset;
unsigned *fp4 = lookaheadset + tokensetsize;
fp1 = LA (m); default_rule = LAruleno[m];
fp2 = shiftset;
fp3 = lookaheadset;
fp4 = lookaheadset + tokensetsize;
while (fp3 < fp4) while (fp3 < fp4)
*fp3++ = *fp1++ & *fp2++; *fp3++ = *fp1++ & *fp2++;
@@ -593,6 +584,8 @@ print_reductions (FILE *out, int state)
} }
else if (n - m >= 1) else if (n - m >= 1)
{ {
unsigned *fp1, *fp2, *fp3, *fp4;
cmax = 0; cmax = 0;
default_LA = -1; default_LA = -1;
fp4 = lookaheadset + tokensetsize; fp4 = lookaheadset + tokensetsize;
@@ -642,8 +635,7 @@ print_reductions (FILE *out, int state)
if (shiftp) if (shiftp)
{ {
k = shiftp->nshifts; for (i = 0; i < shiftp->nshifts; i++)
for (i = 0; i < k; i++)
{ {
if (!shiftp->shifts[i]) if (!shiftp->shifts[i])
continue; continue;