--- gforth/engine/peephole.c 2001/06/15 16:09:15 1.5 +++ gforth/engine/peephole.c 2003/03/09 15:17:03 1.7 @@ -1,6 +1,6 @@ /* Peephole optimization routines and tables - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001,2002 Free Software Foundation, Inc. This file is part of Gforth. @@ -36,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