mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
* src/lalr.c (initialize_F): Improve variable locality.
Avoid variables used as mere abbreviations.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2001-12-05 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/lalr.c (initialize_F): Improve variable locality.
|
||||||
|
Avoid variables used as mere abbreviations.
|
||||||
|
|
||||||
2001-12-05 Akim Demaille <akim@epita.fr>
|
2001-12-05 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/derives.c (print_derives): Display the ruleno.
|
* src/derives.c (print_derives): Display the ruleno.
|
||||||
|
|||||||
38
src/lalr.c
38
src/lalr.c
@@ -356,24 +356,14 @@ map_goto (int state, int symbol)
|
|||||||
static void
|
static void
|
||||||
initialize_F (void)
|
initialize_F (void)
|
||||||
{
|
{
|
||||||
|
short **reads = XCALLOC (short *, ngotos);
|
||||||
|
short *edge = XCALLOC (short, ngotos + 1);
|
||||||
|
int nedges = 0;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int j;
|
|
||||||
short *edge;
|
|
||||||
unsigned *rowp;
|
|
||||||
short *rp;
|
|
||||||
short **reads;
|
|
||||||
int nedges;
|
|
||||||
int symbol;
|
|
||||||
int nwords;
|
|
||||||
|
|
||||||
nwords = ngotos * tokensetsize;
|
F = XCALLOC (unsigned, ngotos * tokensetsize);
|
||||||
F = XCALLOC (unsigned, nwords);
|
|
||||||
|
|
||||||
reads = XCALLOC (short *, ngotos);
|
|
||||||
edge = XCALLOC (short, ngotos + 1);
|
|
||||||
nedges = 0;
|
|
||||||
|
|
||||||
rowp = F;
|
|
||||||
for (i = 0; i < ngotos; i++)
|
for (i = 0; i < ngotos; i++)
|
||||||
{
|
{
|
||||||
int stateno = to_state[i];
|
int stateno = to_state[i];
|
||||||
@@ -381,34 +371,30 @@ initialize_F (void)
|
|||||||
|
|
||||||
if (sp)
|
if (sp)
|
||||||
{
|
{
|
||||||
|
int j;
|
||||||
for (j = 0; j < sp->nshifts; j++)
|
for (j = 0; j < sp->nshifts; j++)
|
||||||
{
|
{
|
||||||
symbol = state_table[sp->shifts[j]].accessing_symbol;
|
int symbol = state_table[sp->shifts[j]].accessing_symbol;
|
||||||
if (ISVAR (symbol))
|
if (ISVAR (symbol))
|
||||||
break;
|
break;
|
||||||
SETBIT (rowp, symbol);
|
SETBIT (F + i * tokensetsize, symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; j < sp->nshifts; j++)
|
for (; j < sp->nshifts; j++)
|
||||||
{
|
{
|
||||||
symbol = state_table[sp->shifts[j]].accessing_symbol;
|
int symbol = state_table[sp->shifts[j]].accessing_symbol;
|
||||||
if (nullable[symbol])
|
if (nullable[symbol])
|
||||||
edge[nedges++] = map_goto (stateno, symbol);
|
edge[nedges++] = map_goto (stateno, symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nedges)
|
if (nedges)
|
||||||
{
|
{
|
||||||
reads[i] = rp = XCALLOC (short, nedges + 1);
|
reads[i] = XCALLOC (short, nedges + 1);
|
||||||
|
shortcpy (reads[i], edge, nedges);
|
||||||
for (j = 0; j < nedges; j++)
|
reads[i][nedges] = -1;
|
||||||
rp[j] = edge[j];
|
|
||||||
|
|
||||||
rp[nedges] = -1;
|
|
||||||
nedges = 0;
|
nedges = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rowp += tokensetsize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
digraph (reads);
|
digraph (reads);
|
||||||
|
|||||||
Reference in New Issue
Block a user