Patchwork [c++,ada,middle-end] Remove redundant GTY markers from structs

login
register
mail settings
Submitter Laurynas Biveinis
Date Dec. 1, 2010, 3:31 a.m.
Message ID <4CF5C1A1.5000900@gmail.com>
Download mbox | patch
Permalink /patch/73693/
State New
Headers show

Comments

Laurynas Biveinis - Dec. 1, 2010, 3:31 a.m.
I am working on a patch to diagnose redundant GTY markers.  It is not completed (possibly
it will not be completed at all, at least not for 4.6: it is likely that to get false
positive numbers to zero it will be necessary to preprocess GTY input), but it is already
useful to remove some GTY instances in GCC.

Bootstrapped r167283 with this patch and regtested against r167293 with no regressions on
x86_64/linux.

OK for trunk?

Also, while preparing this patch I have noticed that some of these types (for example,
struct edge_prediction) are used in a single source file only.  I will prepare a patch to
move them.

2010-11-30  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* tree.h (struct call_expr_arg_iterator_d): Remove GTY tag.
	(const_call_expr_arg_iterator_d): Likewise.
	(expanded_location): Likewise.
	* c-tree.h (struct c_arg_tag_d): Likewise.
	* dwarf2out.c (struct cfa_loc): Likewise.
	(struct skeleton_chain_struct): Likewise.
	* except.c (struct ttypes_filter): Likewise.
	* cselib.h (struct cselib_val_struct): Likewise.
	(elt_loc_list): Likewise.
	(elt_list): Likewise.
	* varasm.c (struct addr_const): Likewise.
	* tree-flow.h (struct edge_prediction): Likewise.
	(struct int_tree_map): Likewise.
	(struct _edge_var_map): Likewise.

ada:

2010-11-30  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* gcc-interface/decl.c (struct subst_pair_d): Remove GTY tag.
	(variant_desc_d): Likewise.

cp:

2010-11-30  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* cp-tree.h (struct aggr_init_expr_arg_iterator_d): Remove GTY
	tag.
Laurynas Biveinis - Dec. 3, 2010, 4:12 a.m.
> 2010-11-30  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
>
>        * tree.h (struct call_expr_arg_iterator_d): Remove GTY tag.
>        (const_call_expr_arg_iterator_d): Likewise.
>        (expanded_location): Likewise.
>        * c-tree.h (struct c_arg_tag_d): Likewise.
>        * dwarf2out.c (struct cfa_loc): Likewise.
>        (struct skeleton_chain_struct): Likewise.
>        * except.c (struct ttypes_filter): Likewise.
>        * cselib.h (struct cselib_val_struct): Likewise.
>        (elt_loc_list): Likewise.
>        (elt_list): Likewise.
>        * varasm.c (struct addr_const): Likewise.
>        * tree-flow.h (struct edge_prediction): Likewise.
>        (struct int_tree_map): Likewise.
>        (struct _edge_var_map): Likewise.
>
> ada:
>
> 2010-11-30  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
>
>        * gcc-interface/decl.c (struct subst_pair_d): Remove GTY tag.
>        (variant_desc_d): Likewise.
>
> cp:
>
> 2010-11-30  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
>
>        * cp-tree.h (struct aggr_init_expr_arg_iterator_d): Remove GTY
>        tag.

On a second thought, obviously this patch is obvious. Committed.

Patch

Index: gcc/tree.h
===================================================================
--- gcc/tree.h	(revision 167283)
+++ gcc/tree.h	(working copy)
@@ -5598,13 +5598,13 @@ 
    defined by this point.  */

 /* Structure containing iterator state.  */
-typedef struct GTY (()) call_expr_arg_iterator_d {
+typedef struct call_expr_arg_iterator_d {
   tree t;	/* the call_expr */
   int n;	/* argument count */
   int i;	/* next argument index */
 } call_expr_arg_iterator;

-typedef struct GTY (()) const_call_expr_arg_iterator_d {
+typedef struct const_call_expr_arg_iterator_d {
   const_tree t;	/* the call_expr */
   int n;	/* argument count */
   int i;	/* next argument index */
Index: gcc/input.h
===================================================================
--- gcc/input.h	(revision 167283)
+++ gcc/input.h	(working copy)
@@ -37,7 +37,7 @@ 
 extern char builtins_location_check[(BUILTINS_LOCATION
 				     < RESERVED_LOCATION_COUNT) ? 1 : -1];

-typedef struct GTY (())
+typedef struct
 {
   /* The name of the source file involved.  */
   const char *file;
Index: gcc/cp/cp-tree.h
===================================================================
--- gcc/cp/cp-tree.h	(revision 167283)
+++ gcc/cp/cp-tree.h	(working copy)
@@ -2840,7 +2840,7 @@ 
 /* Abstract iterators for AGGR_INIT_EXPRs.  */

 /* Structure containing iterator state.  */
-typedef struct GTY (()) aggr_init_expr_arg_iterator_d {
+typedef struct aggr_init_expr_arg_iterator_d {
   tree t;	/* the aggr_init_expr */
   int n;	/* argument count */
   int i;	/* next argument index */
Index: gcc/c-tree.h
===================================================================
--- gcc/c-tree.h	(revision 167283)
+++ gcc/c-tree.h	(working copy)
@@ -294,7 +294,7 @@ 
   cdk_attrs
 };

-typedef struct GTY(()) c_arg_tag_d {
+typedef struct c_arg_tag_d {
   /* The argument name.  */
   tree id;
   /* The type of the argument.  */
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 167283)
+++ gcc/dwarf2out.c	(working copy)
@@ -282,7 +282,7 @@ 
    It can now be either REG + CFA_OFFSET or *(REG + BASE_OFFSET) + CFA_OFFSET.
    Instead of passing around REG and OFFSET, we pass a copy
    of this structure.  */
-typedef struct GTY(()) cfa_loc {
+typedef struct cfa_loc {
   HOST_WIDE_INT offset;
   HOST_WIDE_INT base_offset;
   unsigned int reg;
@@ -5879,7 +5879,7 @@ 
 }
 limbo_die_node;

-typedef struct GTY(()) skeleton_chain_struct
+typedef struct skeleton_chain_struct
 {
   dw_die_ref old_die;
   dw_die_ref new_die;
Index: gcc/ada/gcc-interface/decl.c
===================================================================
--- gcc/ada/gcc-interface/decl.c	(revision 167283)
+++ gcc/ada/gcc-interface/decl.c	(working copy)
@@ -97,7 +97,7 @@ 
 static int defer_finalize_level = 0;
 static VEC (tree,heap) *defer_finalize_list;

-typedef struct GTY(()) subst_pair_d {
+typedef struct subst_pair_d {
   tree discriminant;
   tree replacement;
 } subst_pair;
@@ -105,7 +105,7 @@ 
 DEF_VEC_O(subst_pair);
 DEF_VEC_ALLOC_O(subst_pair,heap);

-typedef struct GTY(()) variant_desc_d {
+typedef struct variant_desc_d {
   /* The type of the variant.  */
   tree type;

Index: gcc/except.c
===================================================================
--- gcc/except.c	(revision 167283)
+++ gcc/except.c	(working copy)
@@ -681,7 +681,7 @@ 
 
 /* Represent an entry in @TTypes for either catch actions
    or exception filter actions.  */
-struct GTY(()) ttypes_filter {
+struct ttypes_filter {
   tree t;
   int filter;
 };
Index: gcc/cselib.h
===================================================================
--- gcc/cselib.h	(revision 167283)
+++ gcc/cselib.h	(working copy)
@@ -20,7 +20,7 @@ 
 <http://www.gnu.org/licenses/>.  */

 /* Describe a value.  */
-typedef struct GTY(()) cselib_val_struct {
+typedef struct cselib_val_struct {
   /* The hash value.  */
   unsigned int hash;

@@ -42,7 +42,7 @@ 
 } cselib_val;

 /* A list of rtl expressions that hold the same value.  */
-struct GTY(()) elt_loc_list {
+struct elt_loc_list {
   /* Next element in the list.  */
   struct elt_loc_list *next;
   /* An rtl expression that holds the value.  */
@@ -52,7 +52,7 @@ 
 };

 /* A list of cselib_val structures.  */
-struct GTY(()) elt_list {
+struct elt_list {
   struct elt_list *next;
   cselib_val *elt;
 };
Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c	(revision 167283)
+++ gcc/varasm.c	(working copy)
@@ -2541,7 +2541,7 @@ 
    Store them both in the structure *VALUE.
    EXP must be reducible.  */

-struct GTY(()) addr_const {
+struct addr_const {
   rtx base;
   HOST_WIDE_INT offset;
 };
Index: gcc/tree-flow.h
===================================================================
--- gcc/tree-flow.h	(revision 167283)
+++ gcc/tree-flow.h	(working copy)
@@ -289,7 +289,7 @@ 
 /*---------------------------------------------------------------------------
                   Structure representing predictions in tree level.
 ---------------------------------------------------------------------------*/
-struct GTY((chain_next ("%h.ep_next"))) edge_prediction {
+struct edge_prediction {
   struct edge_prediction *ep_next;
   edge ep_edge;
   enum br_predictor ep_predictor;
@@ -303,8 +303,7 @@ 
 /*---------------------------------------------------------------------------
 			      Global declarations
 ---------------------------------------------------------------------------*/
-struct GTY(()) int_tree_map {
-
+struct int_tree_map {
   unsigned int uid;
   tree to;
 };
@@ -533,7 +532,7 @@ 
 /* In tree-ssa.c  */

 /* Mapping for redirected edges.  */
-struct GTY(()) _edge_var_map {
+struct _edge_var_map {
   tree result;			/* PHI result.  */
   tree def;			/* PHI arg definition.  */
   source_location locus;        /* PHI arg location.  */