* 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
#include "tm.h"
#include "gengtype.h"
#include "gtyp-gen.h"
-#include "rtl.h"
#undef abort
/* Nonzero iff an error has occurred. */
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
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. */
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,
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;
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)
/* 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)
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: