--- gforth/engine/peephole.c 2001/06/15 16:09:15 1.5 +++ gforth/engine/peephole.c 2003/11/02 18:18:35 1.9 @@ -1,6 +1,6 @@ /* Peephole optimization routines and tables - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001,2002,2003 Free Software Foundation, Inc. This file is part of Gforth. @@ -33,9 +33,69 @@ typedef struct Combination { } Combination; Combination peephole_table[] = { -#include "peephole.i" +#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