From 12d4f3809feb679c3c595b8c95a9828e29cc688f Mon Sep 17 00:00:00 2001 From: zack Date: Tue, 24 Aug 2004 17:00:54 +0000 Subject: [PATCH] * rtl.def: Wrap MD-only codes in #ifdef GENERATOR_FILE. * gengtype.c: Don't include rtl.h. Define enum rtx_code and rtx_name, rtx_format arrays by direct reference to rtl.def, first undefining GENERATOR_FILE. Define enum insn_note and note_insn_name array by direct reference to insn-notes.def. (adjust_field_rtx_def): Remove local definition of rtx_name. Use symbolic names for insn notes. * Makefile.in (gengtype.o): Update dependencies. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86499 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/Makefile.in | 4 ++-- gcc/gengtype.c | 50 +++++++++++++++++++++++++++++++++++++++----------- gcc/rtl.def | 2 ++ 4 files changed, 52 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c2d984bc888..efa8514b331 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,15 @@ * rtl.def: Reorganize, placing all codes used only in machine descriptions at the end. + * rtl.def: Wrap MD-only codes in #ifdef GENERATOR_FILE. + * gengtype.c: Don't include rtl.h. Define enum rtx_code and + rtx_name, rtx_format arrays by direct reference to rtl.def, + first undefining GENERATOR_FILE. Define enum insn_note and + note_insn_name array by direct reference to insn-notes.def. + (adjust_field_rtx_def): Remove local definition of rtx_name. + Use symbolic names for insn notes. + * Makefile.in (gengtype.o): Update dependencies. + 2004-08-24 Zack Weinberg * basic-block.h (struct basic_block_def): Reorder fields to diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 283c1061002..794ff0f459b 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2566,8 +2566,8 @@ gengtype$(build_exeext) : gengtype.o gengtype-lex.o gengtype-yacc.o \ $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \ gengtype.o gengtype-lex.o gengtype-yacc.o $(BUILD_LIBS) -gengtype.o : gengtype.c gengtype.h $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) \ - real.h $(RTL_BASE_H) gtyp-gen.h +gengtype.o : gengtype.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) \ + gengtype.h gtyp-gen.h rtl.def insn-notes.def gengtype-lex.o : gengtype-lex.c gengtype.h gengtype-yacc.h \ $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) vec.h diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 6cb89f0e872..2cdff54ecbd 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -24,7 +24,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm.h" #include "gengtype.h" #include "gtyp-gen.h" -#include "rtl.h" #undef abort /* Nonzero iff an error has occurred. */ @@ -332,9 +331,25 @@ note_variable (const char *s, type_p t, options_p o, struct fileloc *pos) variables = n; } -/* We really don't care how long a CONST_DOUBLE is. */ +/* We don't care how long a CONST_DOUBLE is. */ #define CONST_DOUBLE_FORMAT "ww" -const char * const rtx_format[NUM_RTX_CODE] = { +/* We don't want to see codes that are only for generator files. */ +#undef GENERATOR_FILE + +enum rtx_code { +#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM , +#include "rtl.def" +#undef DEF_RTL_EXPR + NUM_RTX_CODE +}; + +static const char * const rtx_name[NUM_RTX_CODE] = { +#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) NAME , +#include "rtl.def" +#undef DEF_RTL_EXPR +}; + +static const char * const rtx_format[NUM_RTX_CODE] = { #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT , #include "rtl.def" #undef DEF_RTL_EXPR @@ -342,6 +357,25 @@ const char * const rtx_format[NUM_RTX_CODE] = { static int rtx_next_new[NUM_RTX_CODE]; +/* We also need codes and names for insn notes (not register notes). + Note that we do *not* bias the note values here. */ +enum insn_note { +#define DEF_INSN_NOTE(NAME) NAME, +#include "insn-notes.def" +#undef DEF_INSN_NOTE + + NOTE_INSN_MAX +}; + +static const char *const note_insn_name[NOTE_INSN_MAX] = { +#define DEF_INSN_NOTE(NAME) #NAME, +#include "insn-notes.def" +#undef DEF_INSN_NOTE +}; + +#undef CONST_DOUBLE_FORMAT +#define GENERATOR_FILE + /* Generate the contents of the rtx_next array. This really doesn't belong in gengtype at all, but it's needed for adjust_field_rtx_def. */ @@ -397,12 +431,6 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt)) type_p rtx_tp, rtvec_tp, tree_tp, mem_attrs_tp, note_union_tp, scalar_tp; type_p bitmap_tp, basic_block_tp, reg_attrs_tp; - static const char * const rtx_name[NUM_RTX_CODE] = { -#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) NAME , -#include "rtl.def" -#undef DEF_RTL_EXPR - }; - if (t->kind != TYPE_UNION) { error_at_line (&lexer_line, @@ -428,7 +456,7 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt)) pair_p note_flds = NULL; int c; - for (c = NOTE_INSN_BIAS; c <= NOTE_INSN_MAX; c++) + for (c = 0; c <= NOTE_INSN_MAX; c++) { pair_p old_note_flds = note_flds; @@ -438,7 +466,7 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt)) note_flds->opt = XNEW (struct options); note_flds->opt->next = nodot; note_flds->opt->name = "tag"; - note_flds->opt->info = xasprintf ("%d", c); + note_flds->opt->info = note_insn_name[c]; note_flds->next = old_note_flds; switch (c) diff --git a/gcc/rtl.def b/gcc/rtl.def index 5038514e711..e45004d22ab 100644 --- a/gcc/rtl.def +++ b/gcc/rtl.def @@ -685,6 +685,7 @@ DEF_RTL_EXPR(VAR_LOCATION, "var_location", "te", RTX_EXTRA) /* All expressions from this point forward appear only in machine descriptions. */ +#ifdef GENERATOR_FILE /* Include a secondary machine-description file at this point. */ DEF_RTL_EXPR(INCLUDE, "include", "s", RTX_EXTRA) @@ -1160,6 +1161,7 @@ DEF_RTL_EXPR (ATTR_FLAG, "attr_flag", "s", RTX_EXTRA) true, the second operand will be used as the value of the conditional. */ DEF_RTL_EXPR(COND, "cond", "Ee", RTX_EXTRA) +#endif /* GENERATOR_FILE */ /* Local variables: -- 2.11.0