Patchwork Move couple of structs from headers to sources

login
register
mail settings
Submitter Laurynas Biveinis
Date Dec. 1, 2010, 12:10 p.m.
Message ID <4CF63B37.7000701@gmail.com>
Download mbox | patch
Permalink /patch/73809/
State New
Headers show

Comments

Laurynas Biveinis - Dec. 1, 2010, 12:10 p.m.
While working on removing redundant GTYs [1] I have noticed that some of the touched
structs are only used in a single source file, although declared in a header.  This patch
moves them accordingly.

Bootstrapped/regtested on x86_64/linux on the top of [1].

OK for trunk?

[1]: http://gcc.gnu.org/ml/gcc-patches/2010-12/msg00007.html

2010-12-01  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* basic-block.h (struct edge_prediction): Remove forward
	declaration.
	* tree-flow.h (struct edge_prediction): Move from here...
	* predict.c (struct edge_prediction): ...to here.
	* cselib.h (struct elt_list): Move from here...
	* cselib.c (struct elt_list): ...to here.
Richard Guenther - Dec. 1, 2010, 12:36 p.m.
On Wed, Dec 1, 2010 at 1:10 PM, Laurynas Biveinis
<laurynas.biveinis@gmail.com> wrote:
> While working on removing redundant GTYs [1] I have noticed that some of the touched
> structs are only used in a single source file, although declared in a header.  This patch
> moves them accordingly.
>
> Bootstrapped/regtested on x86_64/linux on the top of [1].
>
> OK for trunk?

Ok.

Thanks,
Richard.

> [1]: http://gcc.gnu.org/ml/gcc-patches/2010-12/msg00007.html
>
> 2010-12-01  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
>
>        * basic-block.h (struct edge_prediction): Remove forward
>        declaration.
>        * tree-flow.h (struct edge_prediction): Move from here...
>        * predict.c (struct edge_prediction): ...to here.
>        * cselib.h (struct elt_list): Move from here...
>        * cselib.c (struct elt_list): ...to here.
>
> Index: gcc/predict.c
> ===================================================================
> --- gcc/predict.c       (revision 167293)
> +++ gcc/predict.c       (working copy)
> @@ -387,6 +387,15 @@
>
>  static struct pointer_map_t *bb_predictions;
>
> +/*  Structure representing predictions in tree level. */
> +
> +struct edge_prediction {
> +    struct edge_prediction *ep_next;
> +    edge ep_edge;
> +    enum br_predictor ep_predictor;
> +    int ep_probability;
> +};
> +
>  /* Return true if the one of outgoing edges is already predicted by
>    PREDICTOR.  */
>
> Index: gcc/cselib.c
> ===================================================================
> --- gcc/cselib.c        (revision 167293)
> +++ gcc/cselib.c        (working copy)
> @@ -44,6 +44,12 @@
>  #include "target.h"
>  #include "bitmap.h"
>
> +/* A list of cselib_val structures.  */
> +struct elt_list {
> +    struct elt_list *next;
> +    cselib_val *elt;
> +};
> +
>  static bool cselib_record_memory;
>  static bool cselib_preserve_constants;
>  static int entry_and_rtx_equal_p (const void *, const void *);
> Index: gcc/cselib.h
> ===================================================================
> --- gcc/cselib.h        (revision 167293)
> +++ gcc/cselib.h        (working copy)
> @@ -51,12 +51,6 @@
>   rtx setting_insn;
>  };
>
> -/* A list of cselib_val structures.  */
> -struct GTY(()) elt_list {
> -  struct elt_list *next;
> -  cselib_val *elt;
> -};
> -
>  /* Describe a single set that is part of an insn.  */
>  struct cselib_set
>  {
> Index: gcc/tree-flow.h
> ===================================================================
> --- gcc/tree-flow.h     (revision 167293)
> +++ gcc/tree-flow.h     (working copy)
> @@ -286,16 +286,6 @@
>  static inline void update_stmt (gimple);
>  static inline int get_lineno (const_gimple);
>
> -/*---------------------------------------------------------------------------
> -                  Structure representing predictions in tree level.
> ----------------------------------------------------------------------------*/
> -struct GTY((chain_next ("%h.ep_next"))) edge_prediction {
> -  struct edge_prediction *ep_next;
> -  edge ep_edge;
> -  enum br_predictor ep_predictor;
> -  int ep_probability;
> -};
> -
>  /* Accessors for basic block annotations.  */
>  static inline gimple_seq phi_nodes (const_basic_block);
>  static inline void set_phi_nodes (basic_block, gimple_seq);
> Index: gcc/basic-block.h
> ===================================================================
> --- gcc/basic-block.h   (revision 167293)
> +++ gcc/basic-block.h   (working copy)
> @@ -99,7 +99,6 @@
>  struct loop;
>
>  /* Declared in tree-flow.h.  */
> -struct edge_prediction;
>  struct rtl_bb_info;
>
>  /* A basic block is a sequence of instructions with only entry and
>

Patch

Index: gcc/predict.c
===================================================================
--- gcc/predict.c	(revision 167293)
+++ gcc/predict.c	(working copy)
@@ -387,6 +387,15 @@ 

 static struct pointer_map_t *bb_predictions;

+/*  Structure representing predictions in tree level. */
+
+struct edge_prediction {
+    struct edge_prediction *ep_next;
+    edge ep_edge;
+    enum br_predictor ep_predictor;
+    int ep_probability;
+};
+
 /* Return true if the one of outgoing edges is already predicted by
    PREDICTOR.  */

Index: gcc/cselib.c
===================================================================
--- gcc/cselib.c	(revision 167293)
+++ gcc/cselib.c	(working copy)
@@ -44,6 +44,12 @@ 
 #include "target.h"
 #include "bitmap.h"

+/* A list of cselib_val structures.  */
+struct elt_list {
+    struct elt_list *next;
+    cselib_val *elt;
+};
+
 static bool cselib_record_memory;
 static bool cselib_preserve_constants;
 static int entry_and_rtx_equal_p (const void *, const void *);
Index: gcc/cselib.h
===================================================================
--- gcc/cselib.h	(revision 167293)
+++ gcc/cselib.h	(working copy)
@@ -51,12 +51,6 @@ 
   rtx setting_insn;
 };

-/* A list of cselib_val structures.  */
-struct GTY(()) elt_list {
-  struct elt_list *next;
-  cselib_val *elt;
-};
-
 /* Describe a single set that is part of an insn.  */
 struct cselib_set
 {
Index: gcc/tree-flow.h
===================================================================
--- gcc/tree-flow.h	(revision 167293)
+++ gcc/tree-flow.h	(working copy)
@@ -286,16 +286,6 @@ 
 static inline void update_stmt (gimple);
 static inline int get_lineno (const_gimple);

-/*---------------------------------------------------------------------------
-                  Structure representing predictions in tree level.
----------------------------------------------------------------------------*/
-struct GTY((chain_next ("%h.ep_next"))) edge_prediction {
-  struct edge_prediction *ep_next;
-  edge ep_edge;
-  enum br_predictor ep_predictor;
-  int ep_probability;
-};
-
 /* Accessors for basic block annotations.  */
 static inline gimple_seq phi_nodes (const_basic_block);
 static inline void set_phi_nodes (basic_block, gimple_seq);
Index: gcc/basic-block.h
===================================================================
--- gcc/basic-block.h	(revision 167293)
+++ gcc/basic-block.h	(working copy)
@@ -99,7 +99,6 @@ 
 struct loop;

 /* Declared in tree-flow.h.  */
-struct edge_prediction;
 struct rtl_bb_info;

 /* A basic block is a sequence of instructions with only entry and