Commit 9e995780 by Zack Weinberg Committed by Zack Weinberg

rtl.def: Wrap MD-only codes in #ifdef GENERATOR_FILE.

	* 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.

From-SVN: r86499
parent de37af8c
......@@ -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 <zack@codesourcery.com>
* basic-block.h (struct basic_block_def): Reorder fields to
......
......@@ -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
......
......@@ -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)
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment