Parser outputs some stats and fixed error is pseudo.r

This commit is contained in:
bruce 1987-07-28 11:22:59 +00:00
parent ac20a570cd
commit 9e55f02c3b
4 changed files with 15 additions and 13 deletions

View file

@ -110,7 +110,7 @@ increase_next(size)
do { do {
newsize *= 2; newsize *= 2;
} while (newsize<size); } while (newsize<size);
printf("Extending next/check arrays from %d to %d\n",currsize,newsize); printf("Note: Extending next/check arrays from %d to %d\n",currsize,newsize);
next = (int *)Realloc(next,newsize); next = (int *)Realloc(next,newsize);
check = (int *)Realloc(check,newsize); check = (int *)Realloc(check,newsize);
/* clear ends of new arrays */ /* clear ends of new arrays */
@ -191,9 +191,13 @@ outdfa()
else else
base[s] = EMPTY; base[s] = EMPTY;
} }
/* give some statistics on size of dfa */
printf("Number of patterns: %d\n", numpatterns);
printf("Longest pattern: %d\n", maxpattern);
printf("Longest replacement: %d\n", maxreplacement);
printf("Dfa contains %d distinct state/opcode pairs\n", numentries);
printf("Compacted using row displacement into %d entries\n",maxpos);
/* output the arrays */ /* output the arrays */
printf("Compacted %d entries into %d positions\n",numentries,maxpos);
fprintf(ofile,"struct dfa OO_checknext[] = {\n"); fprintf(ofile,"struct dfa OO_checknext[] = {\n");
for(i=0;i<=maxpos;i++) { for(i=0;i<=maxpos;i++) {
fprintf(ofile,"\t/* %4d */\t",i); fprintf(ofile,"\t/* %4d */\t",i);

View file

@ -23,6 +23,7 @@ static char rcsidp1[] = "$Header$";
struct state *states[MAXSTATES]; struct state *states[MAXSTATES];
struct action *actions[MAXSTATES]; struct action *actions[MAXSTATES];
struct mnems patterns[MAXSTATES]; struct mnems patterns[MAXSTATES];
int numpatterns = 0; /* Number of patterns */
int higheststate = 0; /* Highest state yet allocated */ int higheststate = 0; /* Highest state yet allocated */
struct idf *ops; /* Chained list of all ops */ struct idf *ops; /* Chained list of all ops */
int maxpattern = 0; int maxpattern = 0;
@ -59,6 +60,7 @@ optimization
':' ':'
action(&repllist) action(&repllist)
{ {
numpatterns++;
addaction(startline,currentstate,restrictions, addaction(startline,currentstate,restrictions,
finaltest,repllist); finaltest,repllist);
} }

View file

@ -75,6 +75,7 @@ struct state {
extern struct state *states[MAXSTATES]; extern struct state *states[MAXSTATES];
extern struct action *actions[MAXSTATES]; extern struct action *actions[MAXSTATES];
extern struct mnems patterns[MAXSTATES]; extern struct mnems patterns[MAXSTATES];
extern int numpatterns; /* Number of patterns */
extern int higheststate; /* Highest state yet allocated */ extern int higheststate; /* Highest state yet allocated */
extern struct idf *ops; /* Chained list of all ops */ extern struct idf *ops; /* Chained list of all ops */
extern int maxpattern; extern int maxpattern;

View file

@ -1,22 +1,17 @@
df_dlb | label:l | df_dlb | label:l |
register p_instr p = GETNXTPATT(); FLUSHDFA();
FLUSHDFA(p);
C_df_dlb(l); C_df_dlb(l);
df_dnam | char *:s | df_dnam | char *:s |
register p_instr p = GETNXTPATT(); FLUSHDFA();
FLUSHDFA(p);
C_df_dnam(s); C_df_dnam(s);
pro | char *:s arith:l | pro | char *:s arith:l |
register p_instr p = GETNXTPATT(); FLUSHDFA();
FLUSHDFA(p);
C_pro(s,l); C_pro(s,l);
pro_narg | char *:s | pro_narg | char *:s |
register p_instr p = GETNXTPATT(); FLUSHDFA();
FLUSHDFA(p);
C_pro_narg(s); C_pro_narg(s);
end | arith:l | end | arith:l |
register p_instr p = GETNXTPATT(); FLUSHDFA();
FLUSHDFA(p);
C_end(l); C_end(l);
end_narg | | end_narg | |
FLUSHDFA(); FLUSHDFA();