Commit 36a5eadd by Geoffrey Keating Committed by Geoffrey Keating

Index: gcc/ChangeLog

2002-09-12  Geoffrey Keating  <geoffk@apple.com>

	* ggc-common.c (ggc_mark_rtx_children_1): Update for changed name
	mangling.

	The following changes are merged from pch-branch:

	* doc/gty.texi (GTY Options): Document %a.
	* gengtype.c (do_scalar_typedef): New function.
	(process_gc_options): Handle `length' option.
	(set_gc_used_type): A pointer to an array of structures doesn't
	qualify as a pointer to a structure.
	(output_escaped_param): Add `%a' escape.
	(write_gc_structure_fields): Allow 'desc' on array of unions.
	(main): Define `uint8', `jword' and `JCF_u2' as scalars; use
	do_scalar_typedef.

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

	* gengtype.h (NUM_PARAM): New definition.
	(struct type): For TYPE_PARAM_STRUCT, allow multiple parameters.
	* gengtype.c (find_param_structure): New.
	(adjust_field_type): Handle param<n>_is option.
	(process_gc_options): Detect use_params option.  Update callers.
	(set_gc_used_type): Add 'param' parameter, update callers.  Handle
	'use_params' option.
	(open_base_files): Add splay-tree.h to list of files included.
	(output_mangled_typename): New.
	(write_gc_structure_fields): Update 'param' parameter to support
	multiple parameters.  Change name mangling.  Allow parameterized
	fields to have an apparent scalar type.  Handle param<n>_is options,
	use_param option.
	(write_gc_marker_routine_for_structure): Update for change to name
	mangling.  Better guess the output file for parameterized types.
	(write_gc_types): Update for change to name mangling.
	(write_gc_root): Update for change to name mangling.  Handle (ignore)
	param<n>_is options.
	* doc/gty.texi (GTY Options): Add description of param<n>_is
	options, use_params option.
	* ggc.h (ggc_mark_rtx): Update for changed name mangling.
	* gengtype-lex.l: Produce token for param<n>_is.
	* gengtype-yacc.y: Parse param<n>_is.

	* gengtype.c (adjust_field_tree_exp): Don't name a variable 'rindex'.

	* rtl.c: Update comment describing rtx_format.
	* rtl.h (union rtunion): Separate definition and typedef.
	(struct rtx_def): Use gengtype to mark.
	* Makefile.in (gengtype.o): Also depend on rtl.def.
	* ggc.h (ggc_mark_rtx_children): Delete prototype.
	(ggc_mark_rtx): Change to alias of gengtype-generated routine.
	* ggc-common.c (ggc_mark_rtx_children): Delete.
	(ggc_mark_rtx_children_1): Delete.
	(gt_ggc_m_rtx_def): Delete.
	* gengtype.c (adjust_field_rtx_def): New.
	(adjust_field_type): Call adjust_field_rtx_def.
	(write_gc_structure_fields): Add 'default' case to switch if none
	is specified; remove unused code.

	* tree.h (struct tree_exp): Update for change to meaning
	of special.
	* gengtype.c (adjust_field_tree_exp): New function.
	(adjust_field_type): Handle `tree_exp' special here.
	(write_gc_structure_fields): Don't handle `tree_exp' special here.
	Handle new `dot' option.

	* gengtype.h: Make `info' a pointer-to-const.
	* gengtype-yacc.y (yacc_ids): Use xasprintf.

	* gengtype.c (write_gc_structure_fields): Remove implementation
	of `always' option, add `default' option.
	* doc/gty.texi (GTY Options): Remove documentation of `always',
	add `default'.

Index: gcc/cp/ChangeLog
2002-09-12  Geoffrey Keating  <geoffk@apple.com>

	* cp-tree.h (union lang_tree_node): Add chain_next option.

Index: gcc/f/ChangeLog
2002-09-12  Geoffrey Keating  <geoffk@apple.com>

	* com.c (union lang_tree_node): Add chain_next option.

Index: gcc/java/ChangeLog
2002-09-12  Geoffrey Keating  <geoffk@apple.com>

	* java-tree.h (union lang_tree_node): Add chain_next option.

From-SVN: r57206
parent a7f6d760
2002-09-16 Geoffrey Keating <geoffk@apple.com>
* ggc-common.c (ggc_mark_rtx_children_1): Update for changed name
mangling.
The following changes are merged from pch-branch:
* doc/gty.texi (GTY Options): Document %a.
* gengtype.c (do_scalar_typedef): New function.
(process_gc_options): Handle `length' option.
(set_gc_used_type): A pointer to an array of structures doesn't
qualify as a pointer to a structure.
(output_escaped_param): Add `%a' escape.
(write_gc_structure_fields): Allow 'desc' on array of unions.
(main): Define `uint8', `jword' and `JCF_u2' as scalars; use
do_scalar_typedef.
* 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.
* gengtype.h (NUM_PARAM): New definition.
(struct type): For TYPE_PARAM_STRUCT, allow multiple parameters.
* gengtype.c (find_param_structure): New.
(adjust_field_type): Handle param<n>_is option.
(process_gc_options): Detect use_params option. Update callers.
(set_gc_used_type): Add 'param' parameter, update callers. Handle
'use_params' option.
(open_base_files): Add splay-tree.h to list of files included.
(output_mangled_typename): New.
(write_gc_structure_fields): Update 'param' parameter to support
multiple parameters. Change name mangling. Allow parameterized
fields to have an apparent scalar type. Handle param<n>_is options,
use_param option.
(write_gc_marker_routine_for_structure): Update for change to name
mangling. Better guess the output file for parameterized types.
(write_gc_types): Update for change to name mangling.
(write_gc_root): Update for change to name mangling. Handle (ignore)
param<n>_is options.
* doc/gty.texi (GTY Options): Add description of param<n>_is
options, use_params option.
* ggc.h (ggc_mark_rtx): Update for changed name mangling.
* gengtype-lex.l: Produce token for param<n>_is.
* gengtype-yacc.y: Parse param<n>_is.
* gengtype.c (adjust_field_tree_exp): Don't name a variable 'rindex'.
* rtl.c: Update comment describing rtx_format.
* rtl.h (union rtunion): Separate definition and typedef.
(struct rtx_def): Use gengtype to mark.
* Makefile.in (gengtype.o): Also depend on rtl.def.
* ggc.h (ggc_mark_rtx_children): Delete prototype.
(ggc_mark_rtx): Change to alias of gengtype-generated routine.
* ggc-common.c (ggc_mark_rtx_children): Delete.
(ggc_mark_rtx_children_1): Delete.
(gt_ggc_m_rtx_def): Delete.
* gengtype.c (adjust_field_rtx_def): New.
(adjust_field_type): Call adjust_field_rtx_def.
(write_gc_structure_fields): Add 'default' case to switch if none
is specified; remove unused code.
* tree.h (struct tree_exp): Update for change to meaning
of special.
* gengtype.c (adjust_field_tree_exp): New function.
(adjust_field_type): Handle `tree_exp' special here.
(write_gc_structure_fields): Don't handle `tree_exp' special here.
Handle new `dot' option.
* gengtype.h: Make `info' a pointer-to-const.
* gengtype-yacc.y (yacc_ids): Use xasprintf.
* gengtype.c (write_gc_structure_fields): Remove implementation
of `always' option, add `default' option.
* doc/gty.texi (GTY Options): Remove documentation of `always',
add `default'.
2002-09-16 Hans-Peter Nilsson <hp@bitrange.com> 2002-09-16 Hans-Peter Nilsson <hp@bitrange.com>
* output.h: Remove #ifdef RTX_CODE and #ifdef TREE_CODE. * output.h: Remove #ifdef RTX_CODE and #ifdef TREE_CODE.
......
...@@ -2053,7 +2053,8 @@ gengtype$(build_exeext) : gengtype.o gengtype-lex.o gengtype-yacc.o \ ...@@ -2053,7 +2053,8 @@ gengtype$(build_exeext) : gengtype.o gengtype-lex.o gengtype-yacc.o \
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
gengtype.o gengtype-lex.o gengtype-yacc.o $(HOST_LIBS) gengtype.o gengtype-lex.o gengtype-yacc.o $(HOST_LIBS)
gengtype.o : gengtype.c gengtype.h $(HCONFIG_H) $(SYSTEM_H) real.h gtyp-gen.h gengtype.o : gengtype.c gengtype.h $(HCONFIG_H) $(SYSTEM_H) real.h rtl.def \
gtyp-gen.h
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \ $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
$(srcdir)/gengtype.c $(OUTPUT_OPTION) $(srcdir)/gengtype.c $(OUTPUT_OPTION)
......
...@@ -48,7 +48,8 @@ struct lang_identifier GTY(()) ...@@ -48,7 +48,8 @@ struct lang_identifier GTY(())
/* The resulting tree type. */ /* The resulting tree type. */
union lang_tree_node 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"), union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)"))) desc ("tree_node_structure (&%h)")))
......
2002-09-16 Geoffrey Keating <geoffk@apple.com>
* cp-tree.h (union lang_tree_node): Add chain_next option.
2002-09-16 Nathan Sidwell <nathan@codesourcery.com> 2002-09-16 Nathan Sidwell <nathan@codesourcery.com>
* parse.y (parse_finish_call_expr): Check lookup_member result. * parse.y (parse_finish_call_expr): Check lookup_member result.
......
...@@ -505,7 +505,8 @@ enum cp_tree_node_structure_enum { ...@@ -505,7 +505,8 @@ enum cp_tree_node_structure_enum {
}; };
/* The resulting tree type. */ /* 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; struct tree_common GTY ((tag ("TS_CP_COMMON"))) common;
union tree_node GTY ((tag ("TS_CP_GENERIC"), union tree_node GTY ((tag ("TS_CP_GENERIC"),
......
...@@ -72,6 +72,10 @@ immediately contains the current structure. ...@@ -72,6 +72,10 @@ immediately contains the current structure.
@item %0 @item %0
This expands to an expression that evaluates to the outermost structure This expands to an expression that evaluates to the outermost structure
that contains the current structure. that contains the current structure.
@item %a
This expands to the string of the form @code{[i1][i2]...} that indexes
the array item currently being marked. For instance, if the field
being marked is @code{foo}, then @code{%1.foo%a} is the same as @code{%h}.
@end table @end table
The available options are: The available options are:
...@@ -121,10 +125,10 @@ field really isn't ever used. ...@@ -121,10 +125,10 @@ field really isn't ever used.
@findex desc @findex desc
@findex tag @findex tag
@findex always @findex default
@item desc @item desc
@itemx tag @itemx tag
@itemx always @itemx default
The type machinery needs to be told which field of a @code{union} is The type machinery needs to be told which field of a @code{union} is
currently active. This is done by giving each field a constant @code{tag} currently active. This is done by giving each field a constant @code{tag}
...@@ -146,7 +150,9 @@ it discriminates. Use @code{%1} to mean the structure containing it. ...@@ -146,7 +150,9 @@ it discriminates. Use @code{%1} to mean the structure containing it.
(There are no escapes available to the @code{tag} option, since it's (There are no escapes available to the @code{tag} option, since it's
supposed to be a constant.) supposed to be a constant.)
You can use @code{always} to mean that this field is always used. Each @code{tag} should be different. If no @code{tag} is matched,
the field marked with @code{default} is used if there is one, otherwise
no field in the union will be marked.
@findex param_is @findex param_is
@findex use_param @findex use_param
...@@ -154,15 +160,39 @@ You can use @code{always} to mean that this field is always used. ...@@ -154,15 +160,39 @@ You can use @code{always} to mean that this field is always used.
@itemx use_param @itemx use_param
Sometimes it's convenient to define some data structure to work on Sometimes it's convenient to define some data structure to work on
generic pointers (that is, @code{PTR}), and then use it with specific types. generic pointers (that is, @code{PTR}) and then use it with a specific
@code{param_is} specifies the real type pointed to, and @code{use_param} type. @code{param_is} specifies the real type pointed to, and
says where in the generic data structure that type should be put. @code{use_param} says where in the generic data structure that type
should be put.
For instance, to have a @code{htab_t} that points to trees, one should write For instance, to have a @code{htab_t} that points to trees, one should write
@verbatim @verbatim
htab_t GTY ((param_is (union tree_node))) ict; htab_t GTY ((param_is (union tree_node))) ict;
@end verbatim @end verbatim
@findex param@var{n}_is
@findex use_param@var{n}
@item param@var{n}_is
@itemx use_param@var{n}
In more complicated cases, the data structure might need to work on
several different types, which might not necessarily all be pointers.
For this, @code{param1_is} through @code{param9_is} may be used to
specify the real type of a field identified by @code{use_param1} through
@code{use_param9}.
@findex use_params
@item use_params
When a structure contains another structure that is parameterised,
there's no need to do anything special, the inner stucture inherits the
parameters of the outer one. When a structure contains a pointer to a
parameterised structure, the type machinery won't automatically detect
this (it could, it just doesn't yet), so it's necessary to tell it that
the pointed-to structure should use the same parameters as the outer
structure. This is done by marking the pointer with the
@code{use_params} option.
@findex deletable @findex deletable
@item deletable @item deletable
......
2002-09-16 Geoffrey Keating <geoffk@apple.com>
* com.c (union lang_tree_node): Add chain_next option.
2002-09-16 Richard Henderson <rth@redhat.com> 2002-09-16 Richard Henderson <rth@redhat.com>
* target.c (ffetarget_real1): Don't pass FFETARGET_ATOF_ * target.c (ffetarget_real1): Don't pass FFETARGET_ATOF_
......
...@@ -605,7 +605,8 @@ struct lang_identifier GTY(()) ...@@ -605,7 +605,8 @@ struct lang_identifier GTY(())
/* The resulting tree type. */ /* The resulting tree type. */
union lang_tree_node 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"), union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)"))) desc ("tree_node_structure (&%h)")))
......
...@@ -203,8 +203,11 @@ ITYPE {IWORD}({WS}{IWORD})* ...@@ -203,8 +203,11 @@ ITYPE {IWORD}({WS}{IWORD})*
"struct"/[^[:alnum:]_] { return STRUCT; } "struct"/[^[:alnum:]_] { return STRUCT; }
"enum"/[^[:alnum:]_] { return ENUM; } "enum"/[^[:alnum:]_] { return ENUM; }
"ptr_alias"/[^[:alnum:]_] { return ALIAS; } "ptr_alias"/[^[:alnum:]_] { return ALIAS; }
"param_is"/[^[:alnum:]_] { return PARAM_IS; }
[0-9]+ { return NUM; } [0-9]+ { return NUM; }
"param"[0-9]*"_is"/[^[:alnum:]_] {
yylval.s = xmemdup (yytext, yyleng, yyleng+1);
return PARAM_IS;
}
{IWORD}({WS}{IWORD})*/[^[:alnum:]_] | {IWORD}({WS}{IWORD})*/[^[:alnum:]_] |
"ENUM_BITFIELD"{WS}?"("{WS}?{ID}{WS}?")" { "ENUM_BITFIELD"{WS}?"("{WS}?{ID}{WS}?")" {
......
...@@ -42,7 +42,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -42,7 +42,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
%token STRUCT "struct" %token STRUCT "struct"
%token ENUM "enum" %token ENUM "enum"
%token ALIAS "ptr_alias" %token ALIAS "ptr_alias"
%token PARAM_IS "param_is" %token <s>PARAM_IS
%token NUM %token NUM
%token PERCENTPERCENT "%%" %token PERCENTPERCENT "%%"
%token <t>SCALAR %token <t>SCALAR
...@@ -174,8 +174,7 @@ yacc_ids: /* empty */ ...@@ -174,8 +174,7 @@ yacc_ids: /* empty */
p->opt = xmalloc (sizeof (*(p->opt))); p->opt = xmalloc (sizeof (*(p->opt)));
p->opt->name = "tag"; p->opt->name = "tag";
p->opt->next = NULL; p->opt->next = NULL;
p->opt->info = xmalloc (3 + strlen ($2)); p->opt->info = xasprintf ("'%s'", $2);
sprintf (p->opt->info, "'%s'", $2);
$$ = p; $$ = p;
} }
; ;
...@@ -263,14 +262,14 @@ options: GTY_TOKEN '(' '(' optionseqopt ')' ')' ...@@ -263,14 +262,14 @@ options: GTY_TOKEN '(' '(' optionseqopt ')' ')'
type_option : ALIAS type_option : ALIAS
{ $$ = "ptr_alias"; } { $$ = "ptr_alias"; }
| PARAM_IS | PARAM_IS
{ $$ = "param_is"; } { $$ = $1; }
; ;
option: type_option '(' type ')' option: type_option '(' type ')'
{ {
options_p o = xmalloc (sizeof (*o)); options_p o = xmalloc (sizeof (*o));
o->name = $1; o->name = $1;
o->info = $3; o->info = adjust_field_type ($3, NULL);
$$ = o; $$ = o;
} }
| ID '(' STRING ')' | ID '(' STRING ')'
......
...@@ -41,7 +41,7 @@ enum typekind { ...@@ -41,7 +41,7 @@ enum typekind {
typedef struct options { typedef struct options {
struct options *next; struct options *next;
const char *name; const char *name;
void *info; const void *info;
} *options_p; } *options_p;
typedef struct pair *pair_p; typedef struct pair *pair_p;
...@@ -57,6 +57,8 @@ struct pair { ...@@ -57,6 +57,8 @@ struct pair {
options_p opt; options_p opt;
}; };
#define NUM_PARAM 10
/* A description of a type. */ /* A description of a type. */
struct type { struct type {
enum typekind kind; enum typekind kind;
...@@ -85,7 +87,7 @@ struct type { ...@@ -85,7 +87,7 @@ struct type {
} a; } a;
struct { struct {
type_p stru; type_p stru;
type_p param; type_p param[NUM_PARAM];
struct fileloc line; struct fileloc line;
} param_struct; } param_struct;
} u; } u;
......
...@@ -34,7 +34,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -34,7 +34,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* Statistics about the allocation. */ /* Statistics about the allocation. */
static ggc_statistics *ggc_stats; static ggc_statistics *ggc_stats;
static void ggc_mark_rtx_children_1 PARAMS ((rtx));
static int ggc_htab_delete PARAMS ((void **, void *)); static int ggc_htab_delete PARAMS ((void **, void *));
/* Maintain global roots that are preserved during GC. */ /* Maintain global roots that are preserved during GC. */
...@@ -132,140 +131,6 @@ ggc_mark_roots () ...@@ -132,140 +131,6 @@ ggc_mark_roots ()
htab_traverse (*cti->base, ggc_htab_delete, (PTR) cti); htab_traverse (*cti->base, ggc_htab_delete, (PTR) cti);
} }
/* R had not been previously marked, but has now been marked via
ggc_set_mark. Now recurse and process the children. */
void
ggc_mark_rtx_children (r)
rtx r;
{
rtx i, last;
/* Special case the instruction chain. This is a data structure whose
chain length is potentially unbounded, and which contain references
within the chain (e.g. label_ref and insn_list). If do nothing here,
we risk blowing the stack recursing through a long chain of insns.
Combat this by marking all of the instructions in the chain before
marking the contents of those instructions. */
switch (GET_CODE (r))
{
case INSN:
case JUMP_INSN:
case CALL_INSN:
case NOTE:
case CODE_LABEL:
case BARRIER:
for (i = NEXT_INSN (r); ; i = NEXT_INSN (i))
if (! ggc_test_and_set_mark (i))
break;
last = i;
for (i = NEXT_INSN (r); i != last; i = NEXT_INSN (i))
ggc_mark_rtx_children_1 (i);
default:
break;
}
ggc_mark_rtx_children_1 (r);
}
static void
ggc_mark_rtx_children_1 (r)
rtx r;
{
const char *fmt;
int i;
rtx next_rtx;
do
{
enum rtx_code code = GET_CODE (r);
/* This gets set to a child rtx to eliminate tail recursion. */
next_rtx = NULL;
/* Collect statistics, if appropriate. */
if (ggc_stats)
{
++ggc_stats->num_rtxs[(int) code];
ggc_stats->size_rtxs[(int) code] += ggc_get_size (r);
}
/* ??? If (some of) these are really pass-dependent info, do we
have any right poking our noses in? */
switch (code)
{
case MEM:
gt_ggc_m_mem_attrs (MEM_ATTRS (r));
break;
case JUMP_INSN:
ggc_mark_rtx (JUMP_LABEL (r));
break;
case CODE_LABEL:
ggc_mark_rtx (LABEL_REFS (r));
break;
case LABEL_REF:
ggc_mark_rtx (LABEL_NEXTREF (r));
ggc_mark_rtx (CONTAINING_INSN (r));
break;
case ADDRESSOF:
ggc_mark_tree (ADDRESSOF_DECL (r));
break;
case NOTE:
switch (NOTE_LINE_NUMBER (r))
{
case NOTE_INSN_EXPECTED_VALUE:
ggc_mark_rtx (NOTE_EXPECTED_VALUE (r));
break;
case NOTE_INSN_BLOCK_BEG:
case NOTE_INSN_BLOCK_END:
ggc_mark_tree (NOTE_BLOCK (r));
break;
default:
break;
}
break;
default:
break;
}
for (fmt = GET_RTX_FORMAT (GET_CODE (r)), i = 0; *fmt ; ++fmt, ++i)
{
rtx exp;
switch (*fmt)
{
case 'e': case 'u':
exp = XEXP (r, i);
if (ggc_test_and_set_mark (exp))
{
if (next_rtx == NULL)
next_rtx = exp;
else
ggc_mark_rtx_children (exp);
}
break;
case 'V': case 'E':
gt_ggc_m_rtvec_def (XVEC (r, i));
break;
}
}
}
while ((r = next_rtx) != NULL);
}
/* Various adaptor functions. */
void
gt_ggc_mx_rtx_def (x)
void *x;
{
ggc_mark_rtx((rtx)x);
}
/* Allocate a block of memory, then clear it. */ /* Allocate a block of memory, then clear it. */
void * void *
ggc_alloc_cleared (size) ggc_alloc_cleared (size)
......
/* Garbage collection for the GNU compiler. /* Garbage collection for the GNU compiler.
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -62,21 +62,13 @@ extern const struct ggc_cache_tab * const gt_ggc_cache_rtab[]; ...@@ -62,21 +62,13 @@ extern const struct ggc_cache_tab * const gt_ggc_cache_rtab[];
extern void ggc_mark_roots PARAMS ((void)); extern void ggc_mark_roots PARAMS ((void));
extern void ggc_mark_rtx_children PARAMS ((struct rtx_def *));
/* If EXPR is not NULL and previously unmarked, mark it and evaluate /* If EXPR is not NULL and previously unmarked, mark it and evaluate
to true. Otherwise evaluate to false. */ to true. Otherwise evaluate to false. */
#define ggc_test_and_set_mark(EXPR) \ #define ggc_test_and_set_mark(EXPR) \
((EXPR) != NULL && ((void *) (EXPR)) != (void *) 1 && ! ggc_set_mark (EXPR)) ((EXPR) != NULL && ((void *) (EXPR)) != (void *) 1 && ! ggc_set_mark (EXPR))
#define ggc_mark_rtx(EXPR) \ #define ggc_mark_rtx gt_ggc_m_7rtx_def
do { \ #define ggc_mark_tree gt_ggc_m_9tree_node
rtx const r__ = (EXPR); \
if (ggc_test_and_set_mark (r__)) \
ggc_mark_rtx_children (r__); \
} while (0)
#define ggc_mark_tree gt_ggc_m_tree_node
#define ggc_mark(EXPR) \ #define ggc_mark(EXPR) \
do { \ do { \
......
2002-09-16 Geoffrey Keating <geoffk@apple.com>
* java-tree.h (union lang_tree_node): Add chain_next option.
2002-09-16 Richard Henderson <rth@redhat.com> 2002-09-16 Richard Henderson <rth@redhat.com>
* jcf-parse.c (get_constant): Runtime check for IEEE format; * jcf-parse.c (get_constant): Runtime check for IEEE format;
......
...@@ -693,7 +693,8 @@ struct lang_identifier GTY(()) ...@@ -693,7 +693,8 @@ struct lang_identifier GTY(())
/* The resulting tree type. */ /* The resulting tree type. */
union lang_tree_node 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"), union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)"))) desc ("tree_node_structure (&%h)")))
......
...@@ -186,6 +186,7 @@ const char * const rtx_format[NUM_RTX_CODE] = { ...@@ -186,6 +186,7 @@ const char * const rtx_format[NUM_RTX_CODE] = {
"u" a pointer to another insn "u" a pointer to another insn
prints the uid of the insn. prints the uid of the insn.
"b" is a pointer to a bitmap header. "b" is a pointer to a bitmap header.
"B" is a basic block pointer.
"t" is a tree pointer. */ "t" is a tree pointer. */
#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT , #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT ,
......
...@@ -62,6 +62,8 @@ extern const char * const rtx_format[NUM_RTX_CODE]; ...@@ -62,6 +62,8 @@ extern const char * const rtx_format[NUM_RTX_CODE];
extern const char rtx_class[NUM_RTX_CODE]; extern const char rtx_class[NUM_RTX_CODE];
#define GET_RTX_CLASS(CODE) (rtx_class[(int) (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 /* 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. */ relative to which the offsets are calculated, as explained in rtl.def. */
...@@ -103,7 +105,7 @@ typedef struct mem_attrs GTY(()) ...@@ -103,7 +105,7 @@ typedef struct mem_attrs GTY(())
/* Common union for an element of an rtx. */ /* Common union for an element of an rtx. */
typedef union rtunion_def union rtunion_def
{ {
HOST_WIDE_INT rtwint; HOST_WIDE_INT rtwint;
int rtint; int rtint;
...@@ -118,11 +120,13 @@ typedef union rtunion_def ...@@ -118,11 +120,13 @@ typedef union rtunion_def
tree rttree; tree rttree;
struct basic_block_def *bb; struct basic_block_def *bb;
mem_attrs *rtmem; mem_attrs *rtmem;
} rtunion; };
typedef union rtunion_def rtunion;
/* RTL expression ("rtx"). */ /* RTL expression ("rtx"). */
struct rtx_def struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"),
chain_prev ("RTX_PREV (&%h)")))
{ {
/* The kind of expression this is. */ /* The kind of expression this is. */
ENUM_BITFIELD(rtx_code) code: 16; ENUM_BITFIELD(rtx_code) code: 16;
...@@ -198,11 +202,29 @@ struct rtx_def ...@@ -198,11 +202,29 @@ struct rtx_def
/* The first element of the operands of this rtx. /* The first element of the operands of this rtx.
The number of operands and their types are controlled The number of operands and their types are controlled
by the `code' field, according to rtl.def. */ by the `code' field, according to rtl.def. */
rtunion fld[1]; rtunion GTY ((special ("rtx_def"),
desc ("GET_CODE (&%0)"))) fld[1];
}; };
#define NULL_RTX (rtx) 0 #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 macros to access the `code' field of the rtx. */
#define GET_CODE(RTX) ((enum rtx_code) (RTX)->code) #define GET_CODE(RTX) ((enum rtx_code) (RTX)->code)
......
...@@ -889,7 +889,7 @@ struct tree_exp GTY(()) ...@@ -889,7 +889,7 @@ struct tree_exp GTY(())
struct tree_common common; struct tree_common common;
int complexity; int complexity;
tree GTY ((special ("tree_exp"), tree GTY ((special ("tree_exp"),
length ("TREE_CODE_LENGTH (TREE_CODE ((tree) &%h))"))) desc ("TREE_CODE ((tree) &%0)")))
operands[1]; operands[1];
}; };
......
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