Patchwork Fix bootstrap/44458 was: [patch][ada] Clean up middle-end includes from the ada front end

login
register
mail settings
Submitter Laurent GUERBY
Date July 3, 2010, 7:11 a.m.
Message ID <1278141076.3393.300.camel@pc2.unassigned-domain>
Download mbox | patch
Permalink /patch/57794/
State New
Headers show

Comments

Laurent GUERBY - July 3, 2010, 7:11 a.m.
Hi,

A partial reversal of Steven's patch is needed to restore
Ada bootstrap on arm-linux, Steven is ok with the reversal,
Eric is it ok or is there a better solution?

Thanks in advance,

Laurent

2010-07-03  Laurent GUERBY  <laurent@guerby.net>

        PR bootstrap/44458
        * gcc-interface/targtyps.c: Include tm_p.h.
        * gcc-interface/Make-lang.in: Update dependencies.




On Tue, 2010-05-25 at 20:40 +0200, Steven Bosscher wrote:
> Hi,
> 
> This removes most includes of middle-end headers from the ada front
> end, and adds explanations to those where the #include has to stay.
> 
> Only notable change is the removal of enumerate_modes, which is unused.
> 
> Bootstrapped on x86_64-unknown-linux-gnu.
> OK for trunk?
> 
> Ciao!
> Steven
> 
> 
> 	* gcc-interface/utils.c: Do not include function.h, pointer-set.h,
> 	and gimple.h.  Explain why rtl.h has to be included.
> 	(handle_vector_size_attribute): Call reconstruct_complex_type directly.
> 	* gcc-interface/targtyps.c: Do not include tm_p.h
> 	* gcc-interface/utils2.c: Do not include flags.h.
> 	* gcc-interface/trans.c: Do not include expr.h.  Include rtl.h instead,
> 	and explain why it has to be included.
> 	* gcc-interface/misc.c: Do not include expr.h, libfuncs.h, cgraph.h,
> 	and optabs.h.
> 	Include function.h and explain why.  Explain why except.h is included.
> 	(enumerate_modes): Remove unused function.
> 	* gcc-interface/gigi.h (enumerate_modes): Remove prototype.
> 	* gcc-interface/Make-lang.in: Update dependencies.
> 
> Index: gcc-interface/utils.c
> ===================================================================
> --- gcc-interface/utils.c	(revision 159837)
> +++ gcc-interface/utils.c	(working copy)
> @@ -30,20 +30,17 @@
>  #include "tree.h"
>  #include "flags.h"
>  #include "toplev.h"
> -#include "rtl.h"
>  #include "output.h"
>  #include "ggc.h"
>  #include "debug.h"
>  #include "convert.h"
>  #include "target.h"
> -#include "function.h"
>  #include "langhooks.h"
> -#include "pointer-set.h"
>  #include "cgraph.h"
>  #include "tree-dump.h"
>  #include "tree-inline.h"
>  #include "tree-iterator.h"
> -#include "gimple.h"
> +#include "rtl.h"		/* For decl_default_tls_model.  */
> 
>  #include "ada.h"
>  #include "types.h"
> @@ -5314,7 +5311,7 @@ handle_vector_size_attribute (tree *node, tree nam
>    new_type = build_vector_type (type, nunits);
> 
>    /* Build back pointers if needed.  */
> -  *node = lang_hooks.types.reconstruct_complex_type (*node, new_type);
> +  *node = reconstruct_complex_type (*node, new_type);
> 
>    return NULL_TREE;
>  }
> Index: gcc-interface/targtyps.c
> ===================================================================
> --- gcc-interface/targtyps.c	(revision 159837)
> +++ gcc-interface/targtyps.c	(working copy)
> @@ -30,7 +30,6 @@
>  #include "coretypes.h"
>  #include "tree.h"
>  #include "tm.h"
> -#include "tm_p.h"
> 
>  #include "ada.h"
>  #include "types.h"
> Index: gcc-interface/utils2.c
> ===================================================================
> --- gcc-interface/utils2.c	(revision 159837)
> +++ gcc-interface/utils2.c	(working copy)
> @@ -29,7 +29,6 @@
>  #include "tm.h"
>  #include "tree.h"
>  #include "ggc.h"
> -#include "flags.h"
>  #include "output.h"
>  #include "tree-inline.h"
> 
> Index: gcc-interface/trans.c
> ===================================================================
> --- gcc-interface/trans.c	(revision 159837)
> +++ gcc-interface/trans.c	(working copy)
> @@ -29,7 +29,9 @@
>  #include "tm.h"
>  #include "tree.h"
>  #include "flags.h"
> -#include "expr.h"
> +#include "rtl.h"	/* FIXME: For set_stack_check_libfunc and
> +			   gen_rtx_SYMBOL_REF -- here is a front end
> +			   still trying to generate RTL!  */
>  #include "ggc.h"
>  #include "output.h"
>  #include "tree-iterator.h"
> Index: gcc-interface/misc.c
> ===================================================================
> --- gcc-interface/misc.c	(revision 159837)
> +++ gcc-interface/misc.c	(working copy)
> @@ -34,21 +34,17 @@
>  #include "tree.h"
>  #include "diagnostic.h"
>  #include "target.h"
> -#include "expr.h"
> -#include "libfuncs.h"
>  #include "ggc.h"
>  #include "flags.h"
>  #include "debug.h"
> -#include "cgraph.h"
> -#include "optabs.h"
>  #include "toplev.h"
> -#include "except.h"
>  #include "langhooks.h"
>  #include "langhooks-def.h"
>  #include "opts.h"
>  #include "options.h"
> -#include "tree-inline.h"
>  #include "plugin.h"
> +#include "function.h"	/* For pass_by_reference.  */
> +#include "except.h"	/* For USING_SJLJ_EXCEPTIONS.  */
> 
>  #include "ada.h"
>  #include "adadecode.h"
> @@ -719,85 +715,6 @@ must_pass_by_ref (tree gnu_type)
>  	      && TREE_CODE (TYPE_SIZE (gnu_type)) != INTEGER_CST));
>  }
> 
> -/* This function is called by the front end to enumerate all the supported
> -   modes for the machine.  We pass a function which is called back with
> -   the following integer parameters:
> -
> -   FLOAT_P	nonzero if this represents a floating-point mode
> -   COMPLEX_P	nonzero is this represents a complex mode
> -   COUNT	count of number of items, nonzero for vector mode
> -   PRECISION	number of bits in data representation
> -   MANTISSA	number of bits in mantissa, if FP and known, else zero.
> -   SIZE		number of bits used to store data
> -   ALIGN	number of bits to which mode is aligned.  */
> -
> -void
> -enumerate_modes (void (*f) (int, int, int, int, int, int, unsigned int))
> -{
> -  int iloop;
> -
> -  for (iloop = 0; iloop < NUM_MACHINE_MODES; iloop++)
> -    {
> -      enum machine_mode i = (enum machine_mode) iloop;
> -      enum machine_mode j;
> -      bool float_p = 0;
> -      bool complex_p = 0;
> -      bool vector_p = 0;
> -      bool skip_p = 0;
> -      int mantissa = 0;
> -      enum machine_mode inner_mode = i;
> -
> -      switch (GET_MODE_CLASS (i))
> -	{
> -	case MODE_INT:
> -	  break;
> -	case MODE_FLOAT:
> -	  float_p = 1;
> -	  break;
> -	case MODE_COMPLEX_INT:
> -	  complex_p = 1;
> -	  inner_mode = GET_MODE_INNER (i);
> -	  break;
> -	case MODE_COMPLEX_FLOAT:
> -	  float_p = 1;
> -	  complex_p = 1;
> -	  inner_mode = GET_MODE_INNER (i);
> -	  break;
> -	case MODE_VECTOR_INT:
> -	  vector_p = 1;
> -	  inner_mode = GET_MODE_INNER (i);
> -	  break;
> -	case MODE_VECTOR_FLOAT:
> -	  float_p = 1;
> -	  vector_p = 1;
> -	  inner_mode = GET_MODE_INNER (i);
> -	  break;
> -	default:
> -	  skip_p = 1;
> -	}
> -
> -      /* Skip this mode if it's one the front end doesn't need to know about
> -	 (e.g., the CC modes) or if there is no add insn for that mode (or
> -	 any wider mode), meaning it is not supported by the hardware.  If
> -	 this a complex or vector mode, we care about the inner mode.  */
> -      for (j = inner_mode; j != VOIDmode; j = GET_MODE_WIDER_MODE (j))
> -	if (optab_handler (add_optab, j)->insn_code != CODE_FOR_nothing)
> -	  break;
> -
> -      if (float_p)
> -	{
> -	  const struct real_format *fmt = REAL_MODE_FORMAT (inner_mode);
> -
> -	  mantissa = fmt->p;
> -	}
> -
> -      if (!skip_p && j != VOIDmode)
> -	(*f) (float_p, complex_p, vector_p ? GET_MODE_NUNITS (i) : 0,
> -	      GET_MODE_BITSIZE (i), mantissa,
> -	      GET_MODE_SIZE (i) * BITS_PER_UNIT, GET_MODE_ALIGNMENT (i));
> -    }
> -}
> -
>  /* Return the size of the FP mode with precision PREC.  */
> 
>  int
> Index: gcc-interface/gigi.h
> ===================================================================
> --- gcc-interface/gigi.h	(revision 159837)
> +++ gcc-interface/gigi.h	(working copy)
> @@ -863,20 +863,6 @@
>     if it should be passed by reference.  */
>  extern bool must_pass_by_ref (tree gnu_type);
> 
> -/* This function is called by the front end to enumerate all the supported
> -   modes for the machine.  We pass a function which is called back with
> -   the following integer parameters:
> -
> -   FLOAT_P	nonzero if this represents a floating-point mode
> -   COMPLEX_P	nonzero is this represents a complex mode
> -   COUNT	count of number of items, nonzero for vector mode
> -   PRECISION	number of bits in data representation
> -   MANTISSA	number of bits in mantissa, if FP and known, else zero.
> -   SIZE		number of bits used to store data
> -   ALIGN	number of bits to which mode is aligned.  */
> -extern void enumerate_modes (void (*f) (int, int, int, int, int, int,
> -					unsigned int));
> -
>  /* Return the size of the FP mode with precision PREC.  */
>  extern int fp_prec_to_size (int prec);
> 
> Index: gcc-interface/Make-lang.in
> ===================================================================
> --- gcc-interface/Make-lang.in	(revision 159837)
> +++ gcc-interface/Make-lang.in	(working copy)
> @@ -1233,8 +1233,8 @@ ada/decl.o : ada/gcc-interface/decl.c $(CONFIG_H)
>  	$(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
> 
>  ada/misc.o : ada/gcc-interface/misc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
> -   $(TM_H) $(TREE_H) $(DIAGNOSTIC_H) $(TARGET_H) $(EXPR_H) libfuncs.h \
> -   $(FLAGS_H) debug.h $(CGRAPH_H) $(OPTABS_H) toplev.h except.h langhooks.h \
> +   $(TM_H) $(TREE_H) $(DIAGNOSTIC_H) $(TARGET_H) $(FUNCTION_H) \
> +   $(FLAGS_H) debug.h toplev.h $(EXCEPT_H) langhooks.h \
>     $(LANGHOOKS_DEF_H) opts.h options.h $(TREE_INLINE_H) $(PLUGIN_H) \
>     ada/gcc-interface/ada.h ada/adadecode.h ada/types.h ada/atree.h \
>     ada/elists.h ada/namet.h ada/nlists.h ada/stringt.h ada/uintp.h ada/fe.h \
> @@ -1243,14 +1243,14 @@ ada/misc.o : ada/gcc-interface/misc.c $(CONFIG_H)
>  	$(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
> 
>  ada/targtyps.o : ada/gcc-interface/targtyps.c $(CONFIG_H) $(SYSTEM_H) \
> -   coretypes.h $(TM_H) $(TM_P_H) $(TREE_H) ada/gcc-interface/ada.h \
> +   coretypes.h $(TM_H) $(TREE_H) ada/gcc-interface/ada.h \
>     ada/types.h ada/atree.h ada/elists.h ada/namet.h ada/nlists.h \
>     ada/snames.h ada/stringt.h ada/uintp.h ada/urealp.h ada/fe.h ada/sinfo.h \
>     ada/einfo.h $(ADA_TREE_H) ada/gcc-interface/gigi.h
>  	$(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
> 
>  ada/trans.o : ada/gcc-interface/trans.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
> -   $(TM_H) $(TREE_H) $(FLAGS_H) $(EXPR_H) output.h tree-iterator.h \
> +   $(TM_H) $(TREE_H) $(FLAGS_H) output.h tree-iterator.h \
>     $(GIMPLE_H) ada/gcc-interface/ada.h ada/adadecode.h ada/types.h \
>     ada/atree.h ada/elists.h ada/namet.h ada/nlists.h ada/snames.h \
>     ada/stringt.h ada/uintp.h ada/urealp.h ada/fe.h ada/sinfo.h ada/einfo.h \
> @@ -1260,15 +1260,15 @@ ada/trans.o : ada/gcc-interface/trans.c $(CONFIG_H
> 
>  ada/utils.o : ada/gcc-interface/utils.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
>     $(TM_H) $(TREE_H) $(FLAGS_H) toplev.h $(RTL_H) output.h debug.h convert.h \
> -   $(TARGET_H) function.h langhooks.h pointer-set.h $(CGRAPH_H) \
> -   $(TREE_DUMP_H) $(TREE_INLINE_H) tree-iterator.h $(GIMPLE_H) \
> +   $(TARGET_H) function.h langhooks.h $(CGRAPH_H) \
> +   $(TREE_DUMP_H) $(TREE_INLINE_H) tree-iterator.h \
>     ada/gcc-interface/ada.h ada/types.h ada/atree.h ada/elists.h ada/namet.h \
>     ada/nlists.h ada/stringt.h ada/uintp.h ada/fe.h ada/sinfo.h ada/einfo.h \
>     $(ADA_TREE_H) ada/gcc-interface/gigi.h gt-ada-utils.h gtype-ada.h
>  	$(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
> 
>  ada/utils2.o : ada/gcc-interface/utils2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
> -   $(TM_H) $(TREE_H) $(FLAGS_H) output.h $(TREE_INLINE_H) \
> +   $(TM_H) $(TREE_H) output.h $(TREE_INLINE_H) \
>     ada/gcc-interface/ada.h ada/types.h ada/atree.h ada/elists.h ada/namet.h \
>     ada/nlists.h ada/snames.h ada/stringt.h ada/uintp.h ada/fe.h ada/sinfo.h \
>     ada/einfo.h $(ADA_TREE_H) ada/gcc-interface/gigi.h
Eric Botcazou - July 3, 2010, 7:27 a.m.
> A partial reversal of Steven's patch is needed to restore
> Ada bootstrap on arm-linux, Steven is ok with the reversal,
> Eric is it ok or is there a better solution?

Fine with me, thanks.

Patch

Index: gcc-interface/targtyps.c
===================================================================
--- gcc-interface/targtyps.c	(revision 161765)
+++ gcc-interface/targtyps.c	(working copy)
@@ -30,6 +30,7 @@ 
 #include "coretypes.h"
 #include "tree.h"
 #include "tm.h"
+#include "tm_p.h"
 
 #include "ada.h"
 #include "types.h"
Index: gcc-interface/Make-lang.in
===================================================================
--- gcc-interface/Make-lang.in	(revision 161765)
+++ gcc-interface/Make-lang.in	(working copy)
@@ -1253,7 +1253,7 @@ 
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
 
 ada/targtyps.o : ada/gcc-interface/targtyps.c $(CONFIG_H) $(SYSTEM_H) \
-   coretypes.h $(TM_H) $(TREE_H) ada/gcc-interface/ada.h \
+   coretypes.h $(TM_H) $(TM_P_H) $(TREE_H) ada/gcc-interface/ada.h \
    ada/types.h ada/atree.h ada/elists.h ada/namet.h ada/nlists.h \
    ada/snames.h ada/stringt.h ada/uintp.h ada/urealp.h ada/fe.h ada/sinfo.h \
    ada/einfo.h $(ADA_TREE_H) ada/gcc-interface/gigi.h