aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@redhat.com>2002-08-04 20:49:41 +0000
committerGeoffrey Keating <geoffk@redhat.com>2002-08-04 20:49:41 +0000
commitaf6bde0d57dac0653ef51031baae4e04fc285ebf (patch)
treef8458086f2d89cadbc154835886e6c92fd113b60
parentfa482bbab18e2e703b5fac95ea23a260fdc68f3b (diff)
Index: ChangeLog
2002-08-03 Geoffrey Keating <geoffk@redhat.com> * rtl.h (rtx_next): Declare. (struct rtx_def): Add chain_next and chain_prev options. (RTX_NEXT): New. (RTX_PREV): New. * gengtype.c (enum rtx_code): Make global. (rtx_format): Make global. (rtx_next): New. (gen_rtx_next): New. (write_rtx_next): New. (adjust_field_rtx_def): Skip fields marked by chain_next. (open_base_files): Delete redundant prototype. (write_enum_defn): New. (output_mangled_typename): Correct abort call. (write_gc_marker_routine_for_structure): Handle chain_next and chain_prev options. (finish_root_table): Don't output redundant \n. (main): Call gen_rtx_next, write_rtx_next, write_enum_defn. * c-tree.h (union lang_tree_node): Add chain_next option. Index: ada/ChangeLog 2002-08-03 Geoffrey Keating <geoffk@redhat.com> * ada-tree.h (union lang_tree_node): Add chain_next option. Index: cp/ChangeLog 2002-08-03 Geoffrey Keating <geoffk@redhat.com> * cp-tree.h (union lang_tree_node): Add chain_next option. Index: f/ChangeLog 2002-08-03 Geoffrey Keating <geoffk@redhat.com> * com.c (union lang_tree_node): Add chain_next option. Index: java/ChangeLog 2002-08-03 Geoffrey Keating <geoffk@redhat.com> * java-tree.h (union lang_tree_node): Add chain_next option. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/pch-branch@56032 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog19
-rw-r--r--gcc/ada/ChangeLog4
-rw-r--r--gcc/ada/ada-tree.h3
-rw-r--r--gcc/c-tree.h3
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/cp-tree.h3
-rw-r--r--gcc/f/ChangeLog4
-rw-r--r--gcc/f/com.c3
-rw-r--r--gcc/gengtype.c191
-rw-r--r--gcc/java/ChangeLog4
-rw-r--r--gcc/java/java-tree.h3
-rw-r--r--gcc/rtl.h22
12 files changed, 233 insertions, 30 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1c5238f58fd..3401db68e53 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,24 @@
2002-08-03 Geoffrey Keating <geoffk@redhat.com>
+ * rtl.h (rtx_next): Declare.
+ (struct rtx_def): Add chain_next and chain_prev options.
+ (RTX_NEXT): New.
+ (RTX_PREV): New.
+ * gengtype.c (enum rtx_code): Make global.
+ (rtx_format): Make global.
+ (rtx_next): New.
+ (gen_rtx_next): New.
+ (write_rtx_next): New.
+ (adjust_field_rtx_def): Skip fields marked by chain_next.
+ (open_base_files): Delete redundant prototype.
+ (write_enum_defn): New.
+ (output_mangled_typename): Correct abort call.
+ (write_gc_marker_routine_for_structure): Handle chain_next and
+ chain_prev options.
+ (finish_root_table): Don't output redundant \n.
+ (main): Call gen_rtx_next, write_rtx_next, write_enum_defn.
+ * c-tree.h (union lang_tree_node): Add chain_next option.
+
* gengenrtl.c: Delete unnecessary rtl_obstack declaration.
2002-07-25 Geoffrey Keating <geoffk@redhat.com>
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 159b68ef089..8ad66eaabbc 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,7 @@
+2002-08-03 Geoffrey Keating <geoffk@redhat.com>
+
+ * ada-tree.h (union lang_tree_node): Add chain_next option.
+
2002-07-15 Florian Weimer <fw@deneb.enyo.de>
* make.adb (Add_Switch): Make Generic_Position a procedure. The
diff --git a/gcc/ada/ada-tree.h b/gcc/ada/ada-tree.h
index b22f081bb6a..2580a236932 100644
--- a/gcc/ada/ada-tree.h
+++ b/gcc/ada/ada-tree.h
@@ -43,7 +43,8 @@ struct tree_loop_id GTY(())
/* The language-specific tree. */
union lang_tree_node
- GTY((desc ("TREE_CODE (&%h.generic) == GNAT_LOOP_ID")))
+ GTY((desc ("TREE_CODE (&%h.generic) == GNAT_LOOP_ID"),
+ chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
{
union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)")))
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index 64eb2e14135..9b320d178d8 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -48,7 +48,8 @@ struct lang_identifier GTY(())
/* The resulting tree type. */
union lang_tree_node
- GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE")))
+ GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
+ chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
{
union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)")))
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fc5418070fd..424db13135c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2002-08-03 Geoffrey Keating <geoffk@redhat.com>
+
+ * cp-tree.h (union lang_tree_node): Add chain_next option.
+
2002-07-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/7347, c++/7348
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 0f4bf9081cf..28baa5ce8de 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -512,7 +512,8 @@ enum cp_tree_node_structure_enum {
};
/* The resulting tree type. */
-union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)")))
+union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"),
+ chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
{
struct tree_common GTY ((tag ("TS_CP_COMMON"))) common;
union tree_node GTY ((tag ("TS_CP_GENERIC"),
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog
index 44fe4cc258e..fd3675d22fc 100644
--- a/gcc/f/ChangeLog
+++ b/gcc/f/ChangeLog
@@ -1,3 +1,7 @@
+2002-08-03 Geoffrey Keating <geoffk@redhat.com>
+
+ * com.c (union lang_tree_node): Add chain_next option.
+
2002-07-01 Roger Sayle <roger@eyesopen.com>
* f/com.c (builtin_function): Accept additional parameter.
diff --git a/gcc/f/com.c b/gcc/f/com.c
index 45c06c7cefb..9aaf18f3447 100644
--- a/gcc/f/com.c
+++ b/gcc/f/com.c
@@ -605,7 +605,8 @@ struct lang_identifier GTY(())
/* The resulting tree type. */
union lang_tree_node
- GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE")))
+ GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
+ chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
{
union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)")))
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index ad81405d386..eb68400a60d 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -26,10 +26,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* Nonzero iff an error has occurred. */
static int hit_error = 0;
+static void gen_rtx_next PARAMS ((void));
+static void write_rtx_next PARAMS ((void));
static void open_base_files PARAMS ((void));
static void close_output_files PARAMS ((void));
-
/* Report an error at POS, printing MSG. */
void
@@ -333,6 +334,65 @@ note_variable (s, t, o, pos)
variables = n;
}
+enum rtx_code {
+#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
+#include "rtl.def"
+#undef DEF_RTL_EXPR
+ NUM_RTX_CODE
+};
+
+/* We really don't care how long a CONST_DOUBLE is. */
+#define CONST_DOUBLE_FORMAT "ww"
+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 char rtx_next[NUM_RTX_CODE];
+
+/* 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. */
+
+static void
+gen_rtx_next ()
+{
+ int i;
+ for (i = 0; i < NUM_RTX_CODE; i++)
+ {
+ int k;
+
+ rtx_next[i] = -1;
+ if (strncmp (rtx_format[i], "iuu", 3) == 0)
+ rtx_next[i] = 2;
+ else if (i == COND_EXEC || i == SET || i == EXPR_LIST || i == INSN_LIST)
+ rtx_next[i] = 1;
+ else
+ for (k = strlen (rtx_format[i]) - 1; k >= 0; k--)
+ if (rtx_format[i][k] == 'e' || rtx_format[i][k] == 'u')
+ rtx_next[i] = k;
+ }
+}
+
+/* Write out the contents of the rtx_next array. */
+static void
+write_rtx_next ()
+{
+ outf_p f = get_output_file_with_visibility (NULL);
+ int i;
+
+ oprintf (f, "\n/* Used to implement the RTX_NEXT macro. */\n");
+ oprintf (f, "const unsigned char rtx_next[NUM_RTX_CODE] = {\n");
+ for (i = 0; i < NUM_RTX_CODE; i++)
+ if (rtx_next[i] == -1)
+ oprintf (f, " 0,\n");
+ else
+ oprintf (f,
+ " offsetof (struct rtx_def, fld) + %d * sizeof (rtunion),\n",
+ rtx_next[i]);
+ oprintf (f, "};\n");
+}
+
/* Handle `special("rtx_def")'. This is a special case for field
`fld' of struct rtx_def, which is an array of unions whose values
are based in a complex way on the type of RTL. */
@@ -348,24 +408,11 @@ adjust_field_rtx_def (t, opt)
type_p rtx_tp, rtvec_tp, tree_tp, mem_attrs_tp, note_union_tp, scalar_tp;
type_p bitmap_tp, basic_block_tp;
- 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
};
- /* We really don't care how long a CONST_DOUBLE is. */
-#define CONST_DOUBLE_FORMAT "ww"
- 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
- };
if (t->kind != TYPE_ARRAY)
{
@@ -430,7 +477,7 @@ adjust_field_rtx_def (t, opt)
pair_p old_subf = subfields;
type_p t;
const char *subname;
-
+
switch (rtx_format[i][aindex])
{
case '*':
@@ -538,6 +585,14 @@ adjust_field_rtx_def (t, opt)
subfields->opt->name = "skip";
subfields->opt->info = NULL;
}
+ else if ((size_t) rtx_next[i] == aindex)
+ {
+ /* The 'next' field will be marked by the chain_next option. */
+ subfields->opt = xmalloc (sizeof (*subfields->opt));
+ subfields->opt->next = nodot;
+ subfields->opt->name = "skip";
+ subfields->opt->info = NULL;
+ }
else
subfields->opt = nodot;
}
@@ -1022,8 +1077,6 @@ oprintf VPARAMS ((outf_p o, const char *format, ...))
/* Open the global header file and the language-specific header files. */
-static void open_base_files PARAMS((void));
-
static void
open_base_files ()
{
@@ -1298,6 +1351,7 @@ static void write_gc_structure_fields
static void write_gc_marker_routine_for_structure PARAMS ((type_p, type_p,
type_p *));
static void write_gc_types PARAMS ((type_p structures, type_p param_structs));
+static void write_enum_defn PARAMS ((type_p structures, type_p param_structs));
static void put_mangled_filename PARAMS ((outf_p , const char *));
static void finish_root_table PARAMS ((struct flist *flp, const char *pfx,
const char *tname, const char *lastname,
@@ -1373,7 +1427,7 @@ output_mangled_typename (of, t)
}
break;
case TYPE_ARRAY:
- abort;
+ abort ();
}
}
@@ -1791,6 +1845,9 @@ write_gc_marker_routine_for_structure (orig_s, s, param)
outf_p f;
const char *fn = s->u.s.line.file;
int i;
+ const char *chain_next = NULL;
+ const char *chain_prev = NULL;
+ options_p opt;
/* This is a hack, and not the good kind either. */
for (i = NUM_PARAM - 1; i >= 0; i--)
@@ -1800,7 +1857,16 @@ write_gc_marker_routine_for_structure (orig_s, s, param)
f = get_output_file_with_visibility (fn);
- oprintf (f, "%c", '\n');
+ for (opt = s->u.s.opt; opt; opt = opt->next)
+ if (strcmp (opt->name, "chain_next") == 0)
+ chain_next = (const char *) opt->info;
+ else if (strcmp (opt->name, "chain_prev") == 0)
+ chain_prev = (const char *) opt->info;
+
+ if (chain_prev != NULL && chain_next == NULL)
+ error_at_line (&s->u.s.line, "chain_prev without chain_next");
+
+ oprintf (f, "\n");
oprintf (f, "void\n");
if (param == NULL)
oprintf (f, "gt_ggc_mx_%s", s->u.s.tag);
@@ -1812,17 +1878,55 @@ write_gc_marker_routine_for_structure (orig_s, s, param)
oprintf (f, " (x_p)\n");
oprintf (f, " void *x_p;\n");
oprintf (f, "{\n");
- oprintf (f, " %s %s * const x = (%s %s *)x_p;\n",
+ oprintf (f, " %s %s * %sx = (%s %s *)x_p;\n",
s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag,
+ chain_next == NULL ? "const " : "",
s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag);
- oprintf (f, " if (! ggc_test_and_set_mark (x))\n");
- oprintf (f, " return;\n");
+ if (chain_next != NULL)
+ oprintf (f, " %s %s * xlimit = x;\n",
+ s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag);
+ if (chain_next == NULL)
+ oprintf (f, " if (ggc_test_and_set_mark (x))\n");
+ else
+ {
+ oprintf (f, " while (ggc_test_and_set_mark (xlimit))\n");
+ oprintf (f, " xlimit = (");
+ output_escaped_param (f, chain_next, "*xlimit", "*xlimit",
+ "chain_next", &s->u.s.line);
+ oprintf (f, ");\n");
+ if (chain_prev != NULL)
+ {
+ oprintf (f, " if (x != xlimit)\n");
+ oprintf (f, " for (;;)\n");
+ oprintf (f, " {\n");
+ oprintf (f, " %s %s * const xprev = (",
+ s->kind == TYPE_UNION ? "union" : "struct", s->u.s.tag);
+ output_escaped_param (f, chain_prev, "*x", "*x",
+ "chain_prev", &s->u.s.line);
+ oprintf (f, ");\n");
+ oprintf (f, " if (xprev == NULL) break;\n");
+ oprintf (f, " x = xprev;\n");
+ oprintf (f, " ggc_set_mark (xprev);\n");
+ oprintf (f, " }\n");
+ }
+ oprintf (f, " while (x != xlimit)\n");
+ }
+ oprintf (f, " {\n");
gc_counter = 0;
write_gc_structure_fields (f, s, "(*x)", "not valid postage",
- s->u.s.opt, 2, &s->u.s.line, s->u.s.bitmap,
+ s->u.s.opt, 6, &s->u.s.line, s->u.s.bitmap,
param);
+ if (chain_next != NULL)
+ {
+ oprintf (f, " x = (");
+ output_escaped_param (f, chain_next, "*x", "*x",
+ "chain_next", &s->u.s.line);
+ oprintf (f, ");\n");
+ }
+
+ oprintf (f, " }\n");
oprintf (f, "}\n");
}
@@ -1923,6 +2027,41 @@ write_gc_types (structures, param_structs)
}
}
+/* Write out the 'enum' definition for gt_types_enum. */
+
+static void
+write_enum_defn (structures, param_structs)
+ type_p structures;
+ type_p param_structs;
+{
+ type_p s;
+
+ oprintf (header_file, "\n/* Enumeration of types known. */\n");
+ oprintf (header_file, "enum gt_types_enum {\n");
+ for (s = structures; s; s = s->next)
+ if (s->gc_used == GC_POINTED_TO
+ || s->gc_used == GC_MAYBE_POINTED_TO)
+ {
+ if (s->gc_used == GC_MAYBE_POINTED_TO
+ && s->u.s.line.file == NULL)
+ continue;
+
+ oprintf (header_file, " gt_ggc_e_");
+ output_mangled_typename (header_file, s);
+ oprintf (header_file, ", \n");
+ }
+ for (s = param_structs; s; s = s->next)
+ if (s->gc_used == GC_POINTED_TO)
+ {
+ oprintf (header_file, " gt_e_");
+ output_mangled_typename (header_file, s);
+ oprintf (header_file, ", \n");
+ }
+ oprintf (header_file, " gt_types_enum_last\n");
+ oprintf (header_file, "};\n");
+}
+
+
/* Mangle FN and print it to F. */
static void
@@ -2009,7 +2148,7 @@ finish_root_table (flp, pfx, lastname, tname, name)
if (bitmap & 1)
{
oprintf (base_files[fnum], " NULL\n");
- oprintf (base_files[fnum], "};\n\n");
+ oprintf (base_files[fnum], "};\n");
}
}
}
@@ -2399,6 +2538,8 @@ main(argc, argv)
static struct fileloc pos = { __FILE__, __LINE__ };
unsigned j;
+ gen_rtx_next ();
+
srcdir_len = strlen (srcdir);
do_typedef ("CUMULATIVE_ARGS",
@@ -2439,8 +2580,10 @@ main(argc, argv)
set_gc_used (variables);
open_base_files ();
+ write_enum_defn (structures, param_structs);
write_gc_types (structures, param_structs);
write_gc_roots (variables);
+ write_rtx_next ();
close_output_files ();
return (hit_error != 0);
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 2ccdd0585dd..7cd70906de6 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,7 @@
+2002-08-03 Geoffrey Keating <geoffk@redhat.com>
+
+ * java-tree.h (union lang_tree_node): Add chain_next option.
+
2002-07-21 Richard Henderson <rth@redhat.com>
* lang.c (java_unsafe_for_reeval): New.
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index 8a7fb9e9366..c241dcce96b 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -693,7 +693,8 @@ struct lang_identifier GTY(())
/* The resulting tree type. */
union lang_tree_node
- GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE")))
+ GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
+ chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
{
union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)")))
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 0fffd83eef9..18b0a4f7a72 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -62,6 +62,8 @@ extern const char * const rtx_format[NUM_RTX_CODE];
extern const char rtx_class[NUM_RTX_CODE];
#define GET_RTX_CLASS(CODE) (rtx_class[(int) (CODE)])
+
+extern const unsigned char rtx_next[NUM_RTX_CODE];
/* The flags and bitfields of an ADDR_DIFF_VEC. BASE is the base label
relative to which the offsets are calculated, as explained in rtl.def. */
@@ -120,7 +122,8 @@ typedef union rtunion_def rtunion;
/* RTL expression ("rtx"). */
-struct rtx_def GTY(())
+struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"),
+ chain_prev ("RTX_PREV (&%h)")))
{
/* The kind of expression this is. */
ENUM_BITFIELD(rtx_code) code: 16;
@@ -202,6 +205,23 @@ struct rtx_def GTY(())
#define NULL_RTX (rtx) 0
+/* The "next" and "previous" RTX, relative to this one. */
+
+#define RTX_NEXT(X) (rtx_next[GET_CODE (X)] == 0 ? NULL \
+ : *(rtx *)(((char *)X) + rtx_next[GET_CODE (X)]))
+
+/* FIXME: the "NEXT_INSN (PREV_INSN (X)) == X" condition shouldn't be needed.
+ */
+#define RTX_PREV(X) ((GET_CODE (X) == INSN \
+ || GET_CODE (X) == CALL_INSN \
+ || GET_CODE (X) == JUMP_INSN \
+ || GET_CODE (X) == NOTE \
+ || GET_CODE (X) == BARRIER \
+ || GET_CODE (X) == CODE_LABEL) \
+ && PREV_INSN (X) != NULL \
+ && NEXT_INSN (PREV_INSN (X)) == X \
+ ? PREV_INSN (X) : NULL)
+
/* Define macros to access the `code' field of the rtx. */
#define GET_CODE(RTX) ((enum rtx_code) (RTX)->code)