public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] More type_for_size caller removals
@ 2012-03-07 13:34 Richard Guenther
  0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2012-03-07 13:34 UTC (permalink / raw)
  To: gcc-patches


Nearly obvious.  One question would be whether IVOPTs wants to
use SImode and word_mode instead of int/long.  And the dojump.c
code is dead - TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp))
cannot ever hold here, but I'm double-checkign with an assert
(consider the patch adjusted before commit to remove the
case completely).

Bootstrap & regtest running on x86_64-unknown-linux-gnu.

Richard.

2012-03-07  Richard Guenther  <rguenther@suse.de>

	* coverage.c (get_gcov_type): Use type_for_mode.
	(get_gcov_unsigned_t): Likewise.
	* expr.c (store_constructor): Use type_for_mode.
	(try_casesi): Likewise.
	* tree-ssa-loop-ivopts.c (add_standard_iv_candidates_for_size):
	Remove.
	(add_standard_iv_candidates): Use standard type trees.
	* dojump.c (do_jump): Remove dead code.

Index: gcc/coverage.c
===================================================================
*** gcc/coverage.c	(revision 185029)
--- gcc/coverage.c	(working copy)
*************** static void coverage_obj_finish (VEC(con
*** 131,137 ****
  tree
  get_gcov_type (void)
  {
!   return lang_hooks.types.type_for_size (GCOV_TYPE_SIZE, false);
  }
  
  /* Return the type node for gcov_unsigned_t.  */
--- 131,138 ----
  tree
  get_gcov_type (void)
  {
!   enum machine_mode mode = smallest_mode_for_size (GCOV_TYPE_SIZE, MODE_INT);
!   return lang_hooks.types.type_for_mode (mode, false);
  }
  
  /* Return the type node for gcov_unsigned_t.  */
*************** get_gcov_type (void)
*** 139,145 ****
  static tree
  get_gcov_unsigned_t (void)
  {
!   return lang_hooks.types.type_for_size (32, true);
  }
  \f
  static hashval_t
--- 140,147 ----
  static tree
  get_gcov_unsigned_t (void)
  {
!   enum machine_mode mode = smallest_mode_for_size (32, MODE_INT);
!   return lang_hooks.types.type_for_mode (mode, true);
  }
  \f
  static hashval_t
Index: gcc/expr.c
===================================================================
*** gcc/expr.c	(revision 185029)
--- gcc/expr.c	(working copy)
*************** store_constructor (tree exp, rtx target,
*** 5893,5900 ****
  
  		if (TYPE_PRECISION (type) < BITS_PER_WORD)
  		  {
! 		    type = lang_hooks.types.type_for_size
! 		      (BITS_PER_WORD, TYPE_UNSIGNED (type));
  		    value = fold_convert (type, value);
  		  }
  
--- 5893,5900 ----
  
  		if (TYPE_PRECISION (type) < BITS_PER_WORD)
  		  {
! 		    type = lang_hooks.types.type_for_mode
! 		      (word_mode, TYPE_UNSIGNED (type));
  		    value = fold_convert (type, value);
  		  }
  
*************** try_casesi (tree index_type, tree index_
*** 10726,10732 ****
  {
    struct expand_operand ops[5];
    enum machine_mode index_mode = SImode;
-   int index_bits = GET_MODE_BITSIZE (index_mode);
    rtx op1, op2, index;
  
    if (! HAVE_casesi)
--- 10726,10731 ----
*************** try_casesi (tree index_type, tree index_
*** 10753,10759 ****
      {
        if (TYPE_MODE (index_type) != index_mode)
  	{
! 	  index_type = lang_hooks.types.type_for_size (index_bits, 0);
  	  index_expr = fold_convert (index_type, index_expr);
  	}
  
--- 10752,10758 ----
      {
        if (TYPE_MODE (index_type) != index_mode)
  	{
! 	  index_type = lang_hooks.types.type_for_mode (index_mode, 0);
  	  index_expr = fold_convert (index_type, index_expr);
  	}
  
Index: gcc/tree-ssa-loop-ivopts.c
===================================================================
*** gcc/tree-ssa-loop-ivopts.c	(revision 185029)
--- gcc/tree-ssa-loop-ivopts.c	(working copy)
*************** add_candidate (struct ivopts_data *data,
*** 2405,2432 ****
      add_autoinc_candidates (data, base, step, important, use);
  }
  
- /* Add a standard "0 + 1 * iteration" iv candidate for a
-    type with SIZE bits.  */
- 
- static void
- add_standard_iv_candidates_for_size (struct ivopts_data *data,
- 				     unsigned int size)
- {
-   tree type = lang_hooks.types.type_for_size (size, true);
-   add_candidate (data, build_int_cst (type, 0), build_int_cst (type, 1),
- 		 true, NULL);
- }
- 
  /* Adds standard iv candidates.  */
  
  static void
  add_standard_iv_candidates (struct ivopts_data *data)
  {
!   add_standard_iv_candidates_for_size (data, INT_TYPE_SIZE);
  
    /* The same for a double-integer type if it is still fast enough.  */
!   if (BITS_PER_WORD >= INT_TYPE_SIZE * 2)
!     add_standard_iv_candidates_for_size (data, INT_TYPE_SIZE * 2);
  }
  
  
--- 2405,2430 ----
      add_autoinc_candidates (data, base, step, important, use);
  }
  
  /* Adds standard iv candidates.  */
  
  static void
  add_standard_iv_candidates (struct ivopts_data *data)
  {
!   add_candidate (data, integer_zero_node, integer_one_node, true, NULL);
! 
!   /* The same for a double-integer type if it is still fast enough.  */
!   if (TYPE_PRECISION
!         (long_integer_type_node) > TYPE_PRECISION (integer_type_node)
!       && TYPE_PRECISION (long_integer_type_node) <= BITS_PER_WORD)
!     add_candidate (data, build_int_cst (long_integer_type_node, 0),
! 		   build_int_cst (long_integer_type_node, 1), true, NULL);
  
    /* The same for a double-integer type if it is still fast enough.  */
!   if (TYPE_PRECISION
!         (long_long_integer_type_node) > TYPE_PRECISION (long_integer_type_node)
!       && TYPE_PRECISION (long_long_integer_type_node) <= BITS_PER_WORD)
!     add_candidate (data, build_int_cst (long_long_integer_type_node, 0),
! 		   build_int_cst (long_long_integer_type_node, 1), true, NULL);
  }
  
  
Index: gcc/dojump.c
===================================================================
*** gcc/dojump.c	(revision 185029)
--- gcc/dojump.c	(working copy)
*************** do_jump (tree exp, rtx if_false_label, r
*** 462,476 ****
                               &unsignedp, &volatilep, false);
  
          type = lang_hooks.types.type_for_size (bitsize, unsignedp);
!         if (! SLOW_BYTE_ACCESS
!             && type != 0 && bitsize >= 0
!             && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp))
!             && have_insn_for (COMPARE, TYPE_MODE (type)))
!           {
! 	    do_jump (fold_convert (type, exp), if_false_label, if_true_label,
! 		     prob);
!             break;
!           }
          goto normal;
        }
  
--- 462,470 ----
                               &unsignedp, &volatilep, false);
  
          type = lang_hooks.types.type_for_size (bitsize, unsignedp);
!         if (type != 0 && bitsize >= 0
!             && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp)))
! 	  gcc_unreachable ();
          goto normal;
        }
  

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-07 13:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-07 13:34 [PATCH] More type_for_size caller removals Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).