Patchwork A few more header cleanups

login
register
mail settings
Submitter Steven Bosscher
Date July 11, 2012, 7:36 a.m.
Message ID <CABu31nM7uXzrzjwr=ss=R03F+ELd24KgQCv+usRDa66jwovC6A@mail.gmail.com>
Download mbox | patch
Permalink /patch/170384/
State New
Headers show

Comments

Steven Bosscher - July 11, 2012, 7:36 a.m.
Hello,

This is another round of small header include cleanups.

Note: I'm not going through this work completely at random, but it's
sometimes hard to keep an overview of all the changes which is why I'm
sending them in bits. For example, moving the can_move_by_pieces
prototype really doesn't improve things at the surface, but it helps
expose what is needed by what, i.e. define the interfaces.
Longer-term, it should be easier to move/regroup code once the
interfaces are clear...

Bootstrapped&tested on x86_64-unknown-linux-gnu, and build
cross-compilers (cc1) to sparc-linux and ia64-linux. OK for trunk?

Ciao!
Steven


gcc/
	* expr.h (can_move_by_pieces): Move prototype from here ...
	* tree.h (can_move_by_pieces): ... to here.
	* optabs.h (set_widening_optab_handler): Use XCNEW.
	* gimplify.c: Do not include expr.h.

	* toplev.c: Do not include dwarf2out.h.
	* config/ia64/ia64.c: Likewise.
	* config/sparc/sparc.c: Likewise.

c-family/
	* c-family/c-gimplify.c: Do not include basic-block.h.
	* c-family/c-common.c: Do not include libfuncs.h.

cp/
	* cp/method.c: Do not include tree-pass.h.

fortran/
	* fortran/trans.c: Do not include defaults.h.
	* fortran/trans-intrinsic.c: Likewise.

java/
	* java/decl.c: Do not include libfuncs.h.
	* class.c: Do not include defaults.h.
	* jvgenmain.c: Likewise.
	* magnle.c: Likewise.
Richard Guenther - July 11, 2012, 7:47 a.m.
On Wed, Jul 11, 2012 at 9:36 AM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Hello,
>
> This is another round of small header include cleanups.
>
> Note: I'm not going through this work completely at random, but it's
> sometimes hard to keep an overview of all the changes which is why I'm
> sending them in bits. For example, moving the can_move_by_pieces
> prototype really doesn't improve things at the surface, but it helps
> expose what is needed by what, i.e. define the interfaces.
> Longer-term, it should be easier to move/regroup code once the
> interfaces are clear...
>
> Bootstrapped&tested on x86_64-unknown-linux-gnu, and build
> cross-compilers (cc1) to sparc-linux and ia64-linux. OK for trunk?

Ok with adjusting dependences in Makefile.in (if required).

Thanks,
Richard.

> Ciao!
> Steven
>
>
> gcc/
>         * expr.h (can_move_by_pieces): Move prototype from here ...
>         * tree.h (can_move_by_pieces): ... to here.
>         * optabs.h (set_widening_optab_handler): Use XCNEW.
>         * gimplify.c: Do not include expr.h.
>
>         * toplev.c: Do not include dwarf2out.h.
>         * config/ia64/ia64.c: Likewise.
>         * config/sparc/sparc.c: Likewise.
>
> c-family/
>         * c-family/c-gimplify.c: Do not include basic-block.h.
>         * c-family/c-common.c: Do not include libfuncs.h.
>
> cp/
>         * cp/method.c: Do not include tree-pass.h.
>
> fortran/
>         * fortran/trans.c: Do not include defaults.h.
>         * fortran/trans-intrinsic.c: Likewise.
>
> java/
>         * java/decl.c: Do not include libfuncs.h.
>         * class.c: Do not include defaults.h.
>         * jvgenmain.c: Likewise.
>         * magnle.c: Likewise.
>
> Index: expr.h
> ===================================================================
> --- expr.h      (revision 189365)
> +++ expr.h      (working copy)
> @@ -369,11 +369,6 @@ rtx set_storage_via_libcall (rtx, rtx, r
>  extern bool set_storage_via_setmem (rtx, rtx, rtx, unsigned int,
>                                     unsigned int, HOST_WIDE_INT);
>
> -/* Determine whether the LEN bytes can be moved by using several move
> -   instructions.  Return nonzero if a call to move_by_pieces should
> -   succeed.  */
> -extern int can_move_by_pieces (unsigned HOST_WIDE_INT, unsigned int);
> -
>  extern unsigned HOST_WIDE_INT move_by_pieces_ninsns (unsigned HOST_WIDE_INT,
>                                                      unsigned int,
>                                                      unsigned int);
> Index: tree.h
> ===================================================================
> --- tree.h      (revision 189365)
> +++ tree.h      (working copy)
> @@ -5886,6 +5886,12 @@ extern void fini_object_sizes (void);
>  extern unsigned HOST_WIDE_INT compute_builtin_object_size (tree, int);
>
>  /* In expr.c.  */
> +
> +/* Determine whether the LEN bytes can be moved by using several move
> +   instructions.  Return nonzero if a call to move_by_pieces should
> +   succeed.  */
> +extern int can_move_by_pieces (unsigned HOST_WIDE_INT, unsigned int);
> +
>  extern unsigned HOST_WIDE_INT highest_pow2_factor (const_tree);
>  extern tree build_personality_function (const char *);
>
> Index: optabs.h
> ===================================================================
> --- optabs.h    (revision 189366)
> +++ optabs.h    (working copy)
> @@ -1051,8 +1051,7 @@ set_widening_optab_handler (optab op, en
>    else
>      {
>        if (op->widening == NULL)
> -       op->widening = (struct widening_optab_handlers *)
> -             xcalloc (1, sizeof (struct widening_optab_handlers));
> +       op->widening = XCNEW (struct widening_optab_handlers);
>
>        op->widening->handlers[(int) to_mode][(int) from_mode].insn_code = code;
>      }
> Index: gimplify.c
> ===================================================================
> --- gimplify.c  (revision 189365)
> +++ gimplify.c  (working copy)
> @@ -47,8 +47,6 @@ along with GCC; see the file COPYING3.
>  #include "tree-pass.h"
>
>  #include "langhooks-def.h"     /* FIXME: for lhd_set_decl_assembler_name.  */
> -#include "expr.h"              /* FIXME: for can_move_by_pieces
> -                                  and STACK_CHECK_MAX_VAR_SIZE.  */
>
>  enum gimplify_omp_var_data
>  {
> @@ -3970,7 +3968,7 @@ gimplify_init_constructor (tree *expr_p,
>             walk_tree (&DECL_INITIAL (object), force_labels_r, NULL, NULL);
>
>             /* ??? C++ doesn't automatically append a .<number> to the
> -              assembler name, and even when it does, it looks a FE private
> +              assembler name, and even when it does, it looks at FE private
>                data structures to figure out what that number should be,
>                which are not set for this variable.  I suppose this is
>                important for local statics for inline functions, which aren't
> Index: toplev.c
> ===================================================================
> --- toplev.c    (revision 189365)
> +++ toplev.c    (working copy)
> @@ -76,10 +76,6 @@ along with GCC; see the file COPYING3.
>  #include "tree-ssa-alias.h"
>  #include "plugin.h"
>
> -#if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
> -#include "dwarf2out.h"
> -#endif
> -
>  #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
>  #include "dbxout.h"
>  #endif
> Index: cgraph.c
> ===================================================================
> --- cgraph.c    (revision 189365)
> +++ cgraph.c    (working copy)
> @@ -509,7 +509,7 @@ cgraph_node_for_asm (tree asmname)
>    return NULL;
>  }
>
> -/* Returns a hash value for X (which really is a die_struct).  */
> +/* Returns a hash value for X (which really is a cgraph_edge).  */
>
>  static hashval_t
>  edge_hash (const void *x)
> @@ -517,7 +517,7 @@ edge_hash (const void *x)
>    return htab_hash_pointer (((const struct cgraph_edge *) x)->call_stmt);
>  }
>
> -/* Return nonzero if decl_id of die_struct X is the same as UID of decl *Y.  */
> +/* Return nonzero if the call_stmt of of cgraph_edge X is stmt *Y.  */
>
>  static int
>  edge_eq (const void *x, const void *y)
> Index: value-prof.c
> ===================================================================
> --- value-prof.c        (revision 189365)
> +++ value-prof.c        (working copy)
> @@ -108,7 +108,7 @@ histogram_hash (const void *x)
>    return htab_hash_pointer (((const_histogram_value)x)->hvalue.stmt);
>  }
>
> -/* Return nonzero if decl_id of die_struct X is the same as UID of decl *Y.  */
> +/* Return nonzero if statement for histogram_value X is Y.  */
>
>  static int
>  histogram_eq (const void *x, const void *y)
> Index: config/ia64/ia64.c
> ===================================================================
> --- config/ia64/ia64.c  (revision 189365)
> +++ config/ia64/ia64.c  (working copy)
> @@ -60,7 +60,6 @@ along with GCC; see the file COPYING3.
>  #include "tm-constrs.h"
>  #include "sel-sched.h"
>  #include "reload.h"
> -#include "dwarf2out.h"
>  #include "opts.h"
>
>  /* This is used for communication between ASM_OUTPUT_LABEL and
> Index: config/sparc/sparc.c
> ===================================================================
> --- config/sparc/sparc.c        (revision 189365)
> +++ config/sparc/sparc.c        (working copy)
> @@ -54,7 +54,6 @@ along with GCC; see the file COPYING3.
>  #include "reload.h"
>  #include "params.h"
>  #include "df.h"
> -#include "dwarf2out.h"
>  #include "opts.h"
>
>  /* Processor costs */
> Index: c-family/c-gimplify.c
> ===================================================================
> --- c-family/c-gimplify.c       (revision 189365)
> +++ c-family/c-gimplify.c       (working copy)
> @@ -31,7 +31,6 @@ along with GCC; see the file COPYING3.
>  #include "tree.h"
>  #include "c-common.h"
>  #include "gimple.h"
> -#include "basic-block.h"
>  #include "tree-inline.h"
>  #include "diagnostic-core.h"
>  #include "langhooks.h"
> Index: c-family/c-common.c
> ===================================================================
> --- c-family/c-common.c (revision 189365)
> +++ c-family/c-common.c (working copy)
> @@ -45,7 +45,6 @@ along with GCC; see the file COPYING3.
>  #include "opts.h"
>  #include "cgraph.h"
>  #include "target-def.h"
> -#include "libfuncs.h"
>
>  cpp_reader *parse_in;          /* Declared in c-pragma.h.  */
>
> Index: cp/method.c
> ===================================================================
> --- cp/method.c (revision 189365)
> +++ cp/method.c (working copy)
> @@ -34,7 +34,6 @@ along with GCC; see the file COPYING3.
>  #include "tm_p.h"
>  #include "target.h"
>  #include "common/common-target.h"
> -#include "tree-pass.h"
>  #include "diagnostic.h"
>  #include "cgraph.h"
>  #include "gimple.h"
> Index: fortran/trans.c
> ===================================================================
> --- fortran/trans.c     (revision 189365)
> +++ fortran/trans.c     (working copy)
> @@ -26,7 +26,6 @@ along with GCC; see the file COPYING3.
>  #include "gimple.h"    /* For create_tmp_var_raw.  */
>  #include "tree-iterator.h"
>  #include "diagnostic-core.h"  /* For internal_error.  */
> -#include "defaults.h"
>  #include "flags.h"
>  #include "gfortran.h"
>  #include "trans.h"
> Index: fortran/trans-intrinsic.c
> ===================================================================
> --- fortran/trans-intrinsic.c   (revision 189365)
> +++ fortran/trans-intrinsic.c   (working copy)
> @@ -39,7 +39,6 @@ along with GCC; see the file COPYING3.
>  #include "trans-const.h"
>  #include "trans-types.h"
>  #include "trans-array.h"
> -#include "defaults.h"
>  /* Only for gfc_trans_assign and gfc_trans_pointer_assign.  */
>  #include "trans-stmt.h"
>
> Index: java/decl.c
> ===================================================================
> --- java/decl.c (revision 189365)
> +++ java/decl.c (working copy)
> @@ -34,7 +34,6 @@ The Free Software Foundation is independ
>  #include "flags.h"
>  #include "java-tree.h"
>  #include "jcf.h"
> -#include "libfuncs.h"
>  #include "java-except.h"
>  #include "ggc.h"
>  #include "cgraph.h"
> Index: java/class.c
> ===================================================================
> --- java/class.c        (revision 189365)
> +++ java/class.c        (working copy)
> @@ -41,7 +41,6 @@ The Free Software Foundation is independ
>  #include "cgraph.h"
>  #include "tree-iterator.h"
>  #include "vecprim.h"
> -#include "tm.h"         /* FIXME: For gcc_obstack_init from defaults.h.  */
>  #include "target.h"
>
>  static tree make_method_value (tree);
> Index: java/jvgenmain.c
> ===================================================================
> --- java/jvgenmain.c    (revision 189365)
> +++ java/jvgenmain.c    (working copy)
> @@ -33,7 +33,6 @@ The Free Software Foundation is independ
>  #include "java-tree.h"
>  #include "intl.h"
>  #include "diagnostic.h"
> -#include "tm.h"         /* FIXME: For gcc_obstack_init from defaults.h.  */
>
>  static char * do_mangle_classname (const char *string);
>
> Index: java/mangle.c
> ===================================================================
> --- java/mangle.c       (revision 189365)
> +++ java/mangle.c       (working copy)
> @@ -35,7 +35,6 @@ The Free Software Foundation is independ
>  #include "diagnostic-core.h"
>  #include "ggc.h"
>  #include "langhooks-def.h"
> -#include "tm.h"         /* FIXME: For gcc_obstack_init from defaults.h.  */
>
>  static void mangle_class_field (tree);
>  static void mangle_vtable (tree);

Patch

Index: expr.h
===================================================================
--- expr.h	(revision 189365)
+++ expr.h	(working copy)
@@ -369,11 +369,6 @@  rtx set_storage_via_libcall (rtx, rtx, r
 extern bool set_storage_via_setmem (rtx, rtx, rtx, unsigned int,
 				    unsigned int, HOST_WIDE_INT);

-/* Determine whether the LEN bytes can be moved by using several move
-   instructions.  Return nonzero if a call to move_by_pieces should
-   succeed.  */
-extern int can_move_by_pieces (unsigned HOST_WIDE_INT, unsigned int);
-
 extern unsigned HOST_WIDE_INT move_by_pieces_ninsns (unsigned HOST_WIDE_INT,
 						     unsigned int,
 						     unsigned int);
Index: tree.h
===================================================================
--- tree.h	(revision 189365)
+++ tree.h	(working copy)
@@ -5886,6 +5886,12 @@  extern void fini_object_sizes (void);
 extern unsigned HOST_WIDE_INT compute_builtin_object_size (tree, int);

 /* In expr.c.  */
+
+/* Determine whether the LEN bytes can be moved by using several move
+   instructions.  Return nonzero if a call to move_by_pieces should
+   succeed.  */
+extern int can_move_by_pieces (unsigned HOST_WIDE_INT, unsigned int);
+
 extern unsigned HOST_WIDE_INT highest_pow2_factor (const_tree);
 extern tree build_personality_function (const char *);

Index: optabs.h
===================================================================
--- optabs.h	(revision 189366)
+++ optabs.h	(working copy)
@@ -1051,8 +1051,7 @@  set_widening_optab_handler (optab op, en
   else
     {
       if (op->widening == NULL)
-	op->widening = (struct widening_optab_handlers *)
-	      xcalloc (1, sizeof (struct widening_optab_handlers));
+	op->widening = XCNEW (struct widening_optab_handlers);

       op->widening->handlers[(int) to_mode][(int) from_mode].insn_code = code;
     }
Index: gimplify.c
===================================================================
--- gimplify.c	(revision 189365)
+++ gimplify.c	(working copy)
@@ -47,8 +47,6 @@  along with GCC; see the file COPYING3.
 #include "tree-pass.h"

 #include "langhooks-def.h"	/* FIXME: for lhd_set_decl_assembler_name.  */
-#include "expr.h"		/* FIXME: for can_move_by_pieces
-				   and STACK_CHECK_MAX_VAR_SIZE.  */

 enum gimplify_omp_var_data
 {
@@ -3970,7 +3968,7 @@  gimplify_init_constructor (tree *expr_p,
 	    walk_tree (&DECL_INITIAL (object), force_labels_r, NULL, NULL);

 	    /* ??? C++ doesn't automatically append a .<number> to the
-	       assembler name, and even when it does, it looks a FE private
+	       assembler name, and even when it does, it looks at FE private
 	       data structures to figure out what that number should be,
 	       which are not set for this variable.  I suppose this is
 	       important for local statics for inline functions, which aren't
Index: toplev.c
===================================================================
--- toplev.c	(revision 189365)
+++ toplev.c	(working copy)
@@ -76,10 +76,6 @@  along with GCC; see the file COPYING3.
 #include "tree-ssa-alias.h"
 #include "plugin.h"

-#if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
-#include "dwarf2out.h"
-#endif
-
 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
 #include "dbxout.h"
 #endif
Index: cgraph.c
===================================================================
--- cgraph.c	(revision 189365)
+++ cgraph.c	(working copy)
@@ -509,7 +509,7 @@  cgraph_node_for_asm (tree asmname)
   return NULL;
 }

-/* Returns a hash value for X (which really is a die_struct).  */
+/* Returns a hash value for X (which really is a cgraph_edge).  */

 static hashval_t
 edge_hash (const void *x)
@@ -517,7 +517,7 @@  edge_hash (const void *x)
   return htab_hash_pointer (((const struct cgraph_edge *) x)->call_stmt);
 }

-/* Return nonzero if decl_id of die_struct X is the same as UID of decl *Y.  */
+/* Return nonzero if the call_stmt of of cgraph_edge X is stmt *Y.  */

 static int
 edge_eq (const void *x, const void *y)
Index: value-prof.c
===================================================================
--- value-prof.c	(revision 189365)
+++ value-prof.c	(working copy)
@@ -108,7 +108,7 @@  histogram_hash (const void *x)
   return htab_hash_pointer (((const_histogram_value)x)->hvalue.stmt);
 }

-/* Return nonzero if decl_id of die_struct X is the same as UID of decl *Y.  */
+/* Return nonzero if statement for histogram_value X is Y.  */

 static int
 histogram_eq (const void *x, const void *y)
Index: config/ia64/ia64.c
===================================================================
--- config/ia64/ia64.c	(revision 189365)
+++ config/ia64/ia64.c	(working copy)
@@ -60,7 +60,6 @@  along with GCC; see the file COPYING3.
 #include "tm-constrs.h"
 #include "sel-sched.h"
 #include "reload.h"
-#include "dwarf2out.h"
 #include "opts.h"

 /* This is used for communication between ASM_OUTPUT_LABEL and
Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 189365)
+++ config/sparc/sparc.c	(working copy)
@@ -54,7 +54,6 @@  along with GCC; see the file COPYING3.
 #include "reload.h"
 #include "params.h"
 #include "df.h"
-#include "dwarf2out.h"
 #include "opts.h"

 /* Processor costs */
Index: c-family/c-gimplify.c
===================================================================
--- c-family/c-gimplify.c	(revision 189365)
+++ c-family/c-gimplify.c	(working copy)
@@ -31,7 +31,6 @@  along with GCC; see the file COPYING3.
 #include "tree.h"
 #include "c-common.h"
 #include "gimple.h"
-#include "basic-block.h"
 #include "tree-inline.h"
 #include "diagnostic-core.h"
 #include "langhooks.h"
Index: c-family/c-common.c
===================================================================
--- c-family/c-common.c	(revision 189365)
+++ c-family/c-common.c	(working copy)
@@ -45,7 +45,6 @@  along with GCC; see the file COPYING3.
 #include "opts.h"
 #include "cgraph.h"
 #include "target-def.h"
-#include "libfuncs.h"

 cpp_reader *parse_in;		/* Declared in c-pragma.h.  */

Index: cp/method.c
===================================================================
--- cp/method.c	(revision 189365)
+++ cp/method.c	(working copy)
@@ -34,7 +34,6 @@  along with GCC; see the file COPYING3.
 #include "tm_p.h"
 #include "target.h"
 #include "common/common-target.h"
-#include "tree-pass.h"
 #include "diagnostic.h"
 #include "cgraph.h"
 #include "gimple.h"
Index: fortran/trans.c
===================================================================
--- fortran/trans.c	(revision 189365)
+++ fortran/trans.c	(working copy)
@@ -26,7 +26,6 @@  along with GCC; see the file COPYING3.
 #include "gimple.h"	/* For create_tmp_var_raw.  */
 #include "tree-iterator.h"
 #include "diagnostic-core.h"  /* For internal_error.  */
-#include "defaults.h"
 #include "flags.h"
 #include "gfortran.h"
 #include "trans.h"
Index: fortran/trans-intrinsic.c
===================================================================
--- fortran/trans-intrinsic.c	(revision 189365)
+++ fortran/trans-intrinsic.c	(working copy)
@@ -39,7 +39,6 @@  along with GCC; see the file COPYING3.
 #include "trans-const.h"
 #include "trans-types.h"
 #include "trans-array.h"
-#include "defaults.h"
 /* Only for gfc_trans_assign and gfc_trans_pointer_assign.  */
 #include "trans-stmt.h"

Index: java/decl.c
===================================================================
--- java/decl.c	(revision 189365)
+++ java/decl.c	(working copy)
@@ -34,7 +34,6 @@  The Free Software Foundation is independ
 #include "flags.h"
 #include "java-tree.h"
 #include "jcf.h"
-#include "libfuncs.h"
 #include "java-except.h"
 #include "ggc.h"
 #include "cgraph.h"
Index: java/class.c
===================================================================
--- java/class.c	(revision 189365)
+++ java/class.c	(working copy)
@@ -41,7 +41,6 @@  The Free Software Foundation is independ
 #include "cgraph.h"
 #include "tree-iterator.h"
 #include "vecprim.h"
-#include "tm.h"         /* FIXME: For gcc_obstack_init from defaults.h.  */
 #include "target.h"

 static tree make_method_value (tree);
Index: java/jvgenmain.c
===================================================================
--- java/jvgenmain.c	(revision 189365)
+++ java/jvgenmain.c	(working copy)
@@ -33,7 +33,6 @@  The Free Software Foundation is independ
 #include "java-tree.h"
 #include "intl.h"
 #include "diagnostic.h"
-#include "tm.h"         /* FIXME: For gcc_obstack_init from defaults.h.  */

 static char * do_mangle_classname (const char *string);

Index: java/mangle.c
===================================================================
--- java/mangle.c	(revision 189365)
+++ java/mangle.c	(working copy)
@@ -35,7 +35,6 @@  The Free Software Foundation is independ
 #include "diagnostic-core.h"
 #include "ggc.h"
 #include "langhooks-def.h"
-#include "tm.h"         /* FIXME: For gcc_obstack_init from defaults.h.  */

 static void mangle_class_field (tree);
 static void mangle_vtable (tree);