* src/conflicts.c (print_reductions): Pessimize, but clarify.

This commit is contained in:
Akim Demaille
2001-12-05 09:19:53 +00:00
parent 4c3791f08d
commit 980929ba0b
2 changed files with 19 additions and 30 deletions

View File

@@ -1,3 +1,8 @@
2001-12-05 Akim Demaille <akim@epita.fr>
* src/conflicts.c (print_reductions): Pessimize, but clarify.
2001-12-05 Akim Demaille <akim@epita.fr>
* src/conflicts.c (print_reductions): Improve variable locality.

View File

@@ -567,6 +567,7 @@ print_reductions (FILE *out, int state)
else if (n - m >= 1)
{
unsigned *fp1, *fp2, *fp3, *fp4;
int k;
cmax = 0;
default_LA = -1;
@@ -575,28 +576,13 @@ print_reductions (FILE *out, int state)
if (!nodefault)
for (i = m; i < n; i++)
{
fp1 = LA (i);
fp2 = shiftset;
fp3 = lookaheadset;
while (fp3 < fp4)
*fp3++ = *fp1++ & (~(*fp2++));
for (k = 0; k < tokensetsize; ++k)
lookaheadset[k] = LA (i)[k] & ~shiftset[k];
count = 0;
mask = 1;
fp3 = lookaheadset;
for (j = 0; j < ntokens; j++)
{
if (mask & *fp3)
count++;
mask <<= 1;
if (mask == 0)
{
mask = 1;
fp3++;
}
}
if (BITISSET (lookaheadset, j))
count++;
if (count > cmax)
{
@@ -616,17 +602,15 @@ print_reductions (FILE *out, int state)
shiftset[i] = 0;
if (shiftp)
{
for (i = 0; i < shiftp->nshifts; i++)
{
if (!shiftp->shifts[i])
continue;
symbol = state_table[shiftp->shifts[i]].accessing_symbol;
if (ISVAR (symbol))
break;
SETBIT (shiftset, symbol);
}
}
for (i = 0; i < shiftp->nshifts; i++)
{
if (!shiftp->shifts[i])
continue;
symbol = state_table[shiftp->shifts[i]].accessing_symbol;
if (ISVAR (symbol))
break;
SETBIT (shiftset, symbol);
}
mask = 1;
fp1 = LA (m);