--- gforth/engine/peephole.c 2001/03/28 16:18:51 1.3 +++ gforth/engine/peephole.c 2002/02/10 14:02:25 1.6 @@ -22,6 +22,8 @@ #include "config.h" #include "forth.h" #include +#include +#include /* the numbers in this struct are primitive indices */ typedef struct Combination { @@ -34,6 +36,66 @@ Combination peephole_table[] = { #include "peephole.i" }; +#ifdef PRINT_SUPER_LENGTHS +char *prim_names[] = { +#include "prim_names.i" +}; + +Combination *find_super(Cell prim) +{ + Cell i; + + for (i=0; iprefix)+prim_length(super->lastprim); + else + return prim_length(prim); +} + +void print_prim(Cell prim) +{ + fprintf(stderr, "%s", prim_names[prim]); +} + +void print_super(Cell prim) +{ + Combination *super=find_super(prim); + + if (super) { + print_super(super->prefix); + fprintf(stderr, " "); + print_prim(super->lastprim); + } else { + print_prim(prim); + } +} + +void print_super_lengths() +{ + Cell i; + + for (i=0; i