Parser outputs some stats and fixed error is pseudo.r
authorbruce <none@none>
Tue, 28 Jul 1987 11:22:59 +0000 (11:22 +0000)
committerbruce <none@none>
Tue, 28 Jul 1987 11:22:59 +0000 (11:22 +0000)
modules/src/em_opt/outputdfa.c
modules/src/em_opt/parser.g
modules/src/em_opt/parser.h
modules/src/em_opt/pseudo.r

index d87af09..0e5bb93 100644 (file)
@@ -110,7 +110,7 @@ increase_next(size)
        do {
                newsize *= 2;
        } 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);
        check = (int *)Realloc(check,newsize);
        /* clear ends of new arrays */
@@ -191,9 +191,13 @@ outdfa()
                else
                        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 */
-       printf("Compacted %d entries into %d positions\n",numentries,maxpos);
        fprintf(ofile,"struct dfa OO_checknext[] = {\n");
        for(i=0;i<=maxpos;i++) {
                fprintf(ofile,"\t/* %4d */\t",i);
index 3edec57..425dcbc 100644 (file)
@@ -23,6 +23,7 @@ static char rcsidp1[] = "$Header$";
 struct state   *states[MAXSTATES];
 struct action  *actions[MAXSTATES];
 struct mnems   patterns[MAXSTATES];
+int            numpatterns = 0;        /* Number of patterns */
 int            higheststate = 0;       /* Highest state yet allocated */
 struct idf     *ops;                   /* Chained list of all ops */
 int            maxpattern = 0;
@@ -59,6 +60,7 @@ optimization
        ':'
        action(&repllist)
                        {
+                       numpatterns++;
                        addaction(startline,currentstate,restrictions,
                                finaltest,repllist);
                        }
index 412a5e6..ab365c6 100644 (file)
@@ -75,6 +75,7 @@ struct state {
 extern struct state    *states[MAXSTATES];
 extern struct action   *actions[MAXSTATES];
 extern struct mnems    patterns[MAXSTATES];
+extern int             numpatterns;    /* Number of patterns */
 extern int             higheststate;   /* Highest state yet allocated */
 extern struct idf      *ops;           /* Chained list of all ops */
 extern int             maxpattern;
index 56fca96..fecb834 100644 (file)
@@ -1,22 +1,17 @@
 df_dlb | label:l       |
-       register p_instr p = GETNXTPATT();
-       FLUSHDFA(p);
+       FLUSHDFA();
        C_df_dlb(l);
 df_dnam        | char *:s      |
-       register p_instr p = GETNXTPATT();
-       FLUSHDFA(p);
+       FLUSHDFA();
        C_df_dnam(s);
 pro    | char *:s arith:l      |
-       register p_instr p = GETNXTPATT();
-       FLUSHDFA(p);
+       FLUSHDFA();
        C_pro(s,l);
 pro_narg       | char *:s      |
-       register p_instr p = GETNXTPATT();
-       FLUSHDFA(p);
+       FLUSHDFA();
        C_pro_narg(s);
 end    | arith:l       |
-       register p_instr p = GETNXTPATT();
-       FLUSHDFA(p);
+       FLUSHDFA();
        C_end(l);
 end_narg       |       |
        FLUSHDFA();