diff mbox

Inline functions tweeks 2/n: bring some heavy functions offline

Message ID 20140102173010.GB15068@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Jan. 2, 2014, 5:30 p.m. UTC
Hi,
those functions are not inlined since they are too large anyway.
I do not think it is disaster. get_attr_length_1 takes a callback
that may make it more interesting inlining candidate than others,
perhaps.

Bootstrapped/regtested x86_64-linux, OK?

Honza

	* gengtype-state.c (fatal_reading_state): Bring offline.
	* optabs.c (widening_optab_handler): Bring offline.
	* optabs.h (widening_optab_handler): Likewise.
	* final.c (get_attr_length_1): Likewise.
	* gimple.c (gimple_expr_type): LIkewise.
	* gimple.h (gimple_expr_type): Likewise.

Comments

Richard Biener Jan. 7, 2014, 1:24 p.m. UTC | #1
On Thu, Jan 2, 2014 at 6:30 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> those functions are not inlined since they are too large anyway.
> I do not think it is disaster. get_attr_length_1 takes a callback
> that may make it more interesting inlining candidate than others,
> perhaps.
>
> Bootstrapped/regtested x86_64-linux, OK?

All but gimple_expr_type are ok.  That one needs some TLC, I'll see
what I can do.

Richard.

> Honza
>
>         * gengtype-state.c (fatal_reading_state): Bring offline.
>         * optabs.c (widening_optab_handler): Bring offline.
>         * optabs.h (widening_optab_handler): Likewise.
>         * final.c (get_attr_length_1): Likewise.
>         * gimple.c (gimple_expr_type): LIkewise.
>         * gimple.h (gimple_expr_type): Likewise.
> Index: gengtype-state.c
> ===================================================================
> --- gengtype-state.c    (revision 206233)
> +++ gengtype-state.c    (working copy)
> @@ -283,7 +283,7 @@ state_writer::state_writer ()
>
>
>  /* Fatal message while reading state.  */
> -static inline void
> +static void
>  fatal_reading_state (struct state_token_st* tok, const char*msg)
>  {
>    if (tok)
> index: optabs.c
> ===================================================================
> --- optabs.c    (revision 206233)
> +++ optabs.c    (working copy)
> @@ -297,6 +297,25 @@ widened_mode (enum machine_mode to_mode,
>    return result;
>  }
>
> +/* Like optab_handler, but for widening_operations that have a
> +   TO_MODE and a FROM_MODE.  */
> +
> +enum insn_code
> +widening_optab_handler (optab op, enum machine_mode to_mode,
> +                       enum machine_mode from_mode)
> +{
> +  unsigned scode = (op << 16) | to_mode;
> +  if (to_mode != from_mode && from_mode != VOIDmode)
> +    {
> +      /* ??? Why does find_widening_optab_handler_and_mode attempt to
> +        widen things that can't be widened?  E.g. add_optab... */
> +      if (op > LAST_CONV_OPTAB)
> +       return CODE_FOR_nothing;
> +      scode |= from_mode << 8;
> +    }
> +  return raw_optab_handler (scode);
> +}
> +
>  /* Find a widening optab even if it doesn't widen as much as we want.
>     E.g. if from_mode is HImode, and to_mode is DImode, and there is no
>     direct HI->SI insn, then return SI->DI, if that exists.
> Index: optabs.h
> ===================================================================
> --- optabs.h    (revision 206233)
> +++ optabs.h    (working copy)
> @@ -144,6 +144,8 @@ extern enum insn_code find_widening_opta
>                                                             enum machine_mode,
>                                                             int,
>                                                             enum machine_mode *);
> +extern enum insn_code widening_optab_handler (optab, enum machine_mode,
> +                                             enum machine_mode);
>
>  /* An extra flag to control optab_for_tree_code's behavior.  This is needed to
>     distinguish between machines with a vector shift that takes a scalar for the
> @@ -275,25 +277,6 @@ convert_optab_handler (convert_optab op,
>    return raw_optab_handler (scode);
>  }
>
> -/* Like optab_handler, but for widening_operations that have a
> -   TO_MODE and a FROM_MODE.  */
> -
> -static inline enum insn_code
> -widening_optab_handler (optab op, enum machine_mode to_mode,
> -                       enum machine_mode from_mode)
> -{
> -  unsigned scode = (op << 16) | to_mode;
> -  if (to_mode != from_mode && from_mode != VOIDmode)
> -    {
> -      /* ??? Why does find_widening_optab_handler_and_mode attempt to
> -        widen things that can't be widened?  E.g. add_optab... */
> -      if (op > LAST_CONV_OPTAB)
> -       return CODE_FOR_nothing;
> -      scode |= from_mode << 8;
> -    }
> -  return raw_optab_handler (scode);
> -}
> -
>  /* Return the insn used to implement mode MODE of OP, or CODE_FOR_nothing
>     if the target does not have such an insn.  */
>
> Index: final.c
> ===================================================================
> --- final.c     (revision 206233)
> +++ final.c     (working copy)
> @@ -371,7 +371,7 @@ init_insn_lengths (void)
>  /* Obtain the current length of an insn.  If branch shortening has been done,
>     get its actual length.  Otherwise, use FALLBACK_FN to calculate the
>     length.  */
> -static inline int
> +static int
>  get_attr_length_1 (rtx insn, int (*fallback_fn) (rtx))
>  {
>    rtx body;
> Index: gimple.c
> ===================================================================
> --- gimple.c    (revision 206233)
> +++ gimple.c    (working copy)
> @@ -2787,3 +2787,47 @@ gimple_seq_set_location (gimple_seq seq,
>    for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
>      gimple_set_location (gsi_stmt (i), loc);
>  }
> +
> +
> +/* Return the type of the main expression computed by STMT.  Return
> +   void_type_node if the statement computes nothing.  */
> +
> +tree
> +gimple_expr_type (const_gimple stmt)
> +{
> +  enum gimple_code code = gimple_code (stmt);
> +
> +  if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
> +    {
> +      tree type;
> +      /* In general we want to pass out a type that can be substituted
> +         for both the RHS and the LHS types if there is a possibly
> +        useless conversion involved.  That means returning the
> +        original RHS type as far as we can reconstruct it.  */
> +      if (code == GIMPLE_CALL)
> +       {
> +         if (gimple_call_internal_p (stmt)
> +             && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
> +           type = TREE_TYPE (gimple_call_arg (stmt, 3));
> +         else
> +           type = gimple_call_return_type (stmt);
> +       }
> +      else
> +       switch (gimple_assign_rhs_code (stmt))
> +         {
> +         case POINTER_PLUS_EXPR:
> +           type = TREE_TYPE (gimple_assign_rhs1 (stmt));
> +           break;
> +
> +         default:
> +           /* As fallback use the type of the LHS.  */
> +           type = TREE_TYPE (gimple_get_lhs (stmt));
> +           break;
> +         }
> +      return type;
> +    }
> +  else if (code == GIMPLE_COND)
> +    return boolean_type_node;
> +  else
> +    return void_type_node;
> +}
> Index: gimple.h
> ===================================================================
> --- gimple.h    (revision 206233)
> +++ gimple.h    (working copy)
> @@ -1263,6 +1263,7 @@ extern bool infer_nonnull_range (gimple,
>  extern void sort_case_labels (vec<tree> );
>  extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
>  extern void gimple_seq_set_location (gimple_seq , location_t);
> +extern tree gimple_expr_type (const_gimple stmt);
>
>  /* Formal (expression) temporary table handling: multiple occurrences of
>     the same scalar expression are evaluated into the same temporary.  */
> @@ -5607,50 +5608,6 @@ gimple_predict_set_outcome (gimple gs, e
>      gs->subcode &= ~GF_PREDICT_TAKEN;
>  }
>
> -
> -/* Return the type of the main expression computed by STMT.  Return
> -   void_type_node if the statement computes nothing.  */
> -
> -static inline tree
> -gimple_expr_type (const_gimple stmt)
> -{
> -  enum gimple_code code = gimple_code (stmt);
> -
> -  if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
> -    {
> -      tree type;
> -      /* In general we want to pass out a type that can be substituted
> -         for both the RHS and the LHS types if there is a possibly
> -        useless conversion involved.  That means returning the
> -        original RHS type as far as we can reconstruct it.  */
> -      if (code == GIMPLE_CALL)
> -       {
> -         if (gimple_call_internal_p (stmt)
> -             && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
> -           type = TREE_TYPE (gimple_call_arg (stmt, 3));
> -         else
> -           type = gimple_call_return_type (stmt);
> -       }
> -      else
> -       switch (gimple_assign_rhs_code (stmt))
> -         {
> -         case POINTER_PLUS_EXPR:
> -           type = TREE_TYPE (gimple_assign_rhs1 (stmt));
> -           break;
> -
> -         default:
> -           /* As fallback use the type of the LHS.  */
> -           type = TREE_TYPE (gimple_get_lhs (stmt));
> -           break;
> -         }
> -      return type;
> -    }
> -  else if (code == GIMPLE_COND)
> -    return boolean_type_node;
> -  else
> -    return void_type_node;
> -}
> -
>  /* Enum and arrays used for allocation stats.  Keep in sync with
>     gimple.c:gimple_alloc_kind_names.  */
>  enum gimple_alloc_kind
Jeff Law April 24, 2014, 9:04 p.m. UTC | #2
On 01/02/14 10:30, Jan Hubicka wrote:
> Hi,
> those functions are not inlined since they are too large anyway.
> I do not think it is disaster. get_attr_length_1 takes a callback
> that may make it more interesting inlining candidate than others,
> perhaps.
>
> Bootstrapped/regtested x86_64-linux, OK?
>
> Honza
>
> 	* gengtype-state.c (fatal_reading_state): Bring offline.
> 	* optabs.c (widening_optab_handler): Bring offline.
> 	* optabs.h (widening_optab_handler): Likewise.
> 	* final.c (get_attr_length_1): Likewise.
> 	* gimple.c (gimple_expr_type): LIkewise.
> 	* gimple.h (gimple_expr_type): Likewise.
OK for the trunk.

jeff
diff mbox

Patch

Index: gengtype-state.c
===================================================================
--- gengtype-state.c	(revision 206233)
+++ gengtype-state.c	(working copy)
@@ -283,7 +283,7 @@  state_writer::state_writer ()
 
 
 /* Fatal message while reading state.  */
-static inline void 
+static void 
 fatal_reading_state (struct state_token_st* tok, const char*msg)
 {
   if (tok)
index: optabs.c
===================================================================
--- optabs.c	(revision 206233)
+++ optabs.c	(working copy)
@@ -297,6 +297,25 @@  widened_mode (enum machine_mode to_mode,
   return result;
 }
 
+/* Like optab_handler, but for widening_operations that have a
+   TO_MODE and a FROM_MODE.  */
+
+enum insn_code
+widening_optab_handler (optab op, enum machine_mode to_mode,
+			enum machine_mode from_mode)
+{
+  unsigned scode = (op << 16) | to_mode;
+  if (to_mode != from_mode && from_mode != VOIDmode)
+    {
+      /* ??? Why does find_widening_optab_handler_and_mode attempt to
+	 widen things that can't be widened?  E.g. add_optab... */
+      if (op > LAST_CONV_OPTAB)
+	return CODE_FOR_nothing;
+      scode |= from_mode << 8;
+    }
+  return raw_optab_handler (scode);
+}
+
 /* Find a widening optab even if it doesn't widen as much as we want.
    E.g. if from_mode is HImode, and to_mode is DImode, and there is no
    direct HI->SI insn, then return SI->DI, if that exists.
Index: optabs.h
===================================================================
--- optabs.h	(revision 206233)
+++ optabs.h	(working copy)
@@ -144,6 +144,8 @@  extern enum insn_code find_widening_opta
 							    enum machine_mode,
 							    int,
 							    enum machine_mode *);
+extern enum insn_code widening_optab_handler (optab, enum machine_mode,
+					      enum machine_mode);
 
 /* An extra flag to control optab_for_tree_code's behavior.  This is needed to
    distinguish between machines with a vector shift that takes a scalar for the
@@ -275,25 +277,6 @@  convert_optab_handler (convert_optab op,
   return raw_optab_handler (scode);
 }
 
-/* Like optab_handler, but for widening_operations that have a
-   TO_MODE and a FROM_MODE.  */
-
-static inline enum insn_code
-widening_optab_handler (optab op, enum machine_mode to_mode,
-			enum machine_mode from_mode)
-{
-  unsigned scode = (op << 16) | to_mode;
-  if (to_mode != from_mode && from_mode != VOIDmode)
-    {
-      /* ??? Why does find_widening_optab_handler_and_mode attempt to
-	 widen things that can't be widened?  E.g. add_optab... */
-      if (op > LAST_CONV_OPTAB)
-	return CODE_FOR_nothing;
-      scode |= from_mode << 8;
-    }
-  return raw_optab_handler (scode);
-}
-
 /* Return the insn used to implement mode MODE of OP, or CODE_FOR_nothing
    if the target does not have such an insn.  */
 
Index: final.c
===================================================================
--- final.c	(revision 206233)
+++ final.c	(working copy)
@@ -371,7 +371,7 @@  init_insn_lengths (void)
 /* Obtain the current length of an insn.  If branch shortening has been done,
    get its actual length.  Otherwise, use FALLBACK_FN to calculate the
    length.  */
-static inline int
+static int
 get_attr_length_1 (rtx insn, int (*fallback_fn) (rtx))
 {
   rtx body;
Index: gimple.c
===================================================================
--- gimple.c	(revision 206233)
+++ gimple.c	(working copy)
@@ -2787,3 +2787,47 @@  gimple_seq_set_location (gimple_seq seq,
   for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
     gimple_set_location (gsi_stmt (i), loc);
 }
+
+
+/* Return the type of the main expression computed by STMT.  Return
+   void_type_node if the statement computes nothing.  */
+
+tree
+gimple_expr_type (const_gimple stmt)
+{
+  enum gimple_code code = gimple_code (stmt);
+
+  if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
+    {
+      tree type;
+      /* In general we want to pass out a type that can be substituted
+         for both the RHS and the LHS types if there is a possibly
+	 useless conversion involved.  That means returning the
+	 original RHS type as far as we can reconstruct it.  */
+      if (code == GIMPLE_CALL)
+	{
+	  if (gimple_call_internal_p (stmt)
+	      && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
+	    type = TREE_TYPE (gimple_call_arg (stmt, 3));
+	  else
+	    type = gimple_call_return_type (stmt);
+	}
+      else
+	switch (gimple_assign_rhs_code (stmt))
+	  {
+	  case POINTER_PLUS_EXPR:
+	    type = TREE_TYPE (gimple_assign_rhs1 (stmt));
+	    break;
+
+	  default:
+	    /* As fallback use the type of the LHS.  */
+	    type = TREE_TYPE (gimple_get_lhs (stmt));
+	    break;
+	  }
+      return type;
+    }
+  else if (code == GIMPLE_COND)
+    return boolean_type_node;
+  else
+    return void_type_node;
+}
Index: gimple.h
===================================================================
--- gimple.h	(revision 206233)
+++ gimple.h	(working copy)
@@ -1263,6 +1263,7 @@  extern bool infer_nonnull_range (gimple,
 extern void sort_case_labels (vec<tree> );
 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
 extern void gimple_seq_set_location (gimple_seq , location_t);
+extern tree gimple_expr_type (const_gimple stmt);
 
 /* Formal (expression) temporary table handling: multiple occurrences of
    the same scalar expression are evaluated into the same temporary.  */
@@ -5607,50 +5608,6 @@  gimple_predict_set_outcome (gimple gs, e
     gs->subcode &= ~GF_PREDICT_TAKEN;
 }
 
-
-/* Return the type of the main expression computed by STMT.  Return
-   void_type_node if the statement computes nothing.  */
-
-static inline tree
-gimple_expr_type (const_gimple stmt)
-{
-  enum gimple_code code = gimple_code (stmt);
-
-  if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
-    {
-      tree type;
-      /* In general we want to pass out a type that can be substituted
-         for both the RHS and the LHS types if there is a possibly
-	 useless conversion involved.  That means returning the
-	 original RHS type as far as we can reconstruct it.  */
-      if (code == GIMPLE_CALL)
-	{
-	  if (gimple_call_internal_p (stmt)
-	      && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
-	    type = TREE_TYPE (gimple_call_arg (stmt, 3));
-	  else
-	    type = gimple_call_return_type (stmt);
-	}
-      else
-	switch (gimple_assign_rhs_code (stmt))
-	  {
-	  case POINTER_PLUS_EXPR:
-	    type = TREE_TYPE (gimple_assign_rhs1 (stmt));
-	    break;
-
-	  default:
-	    /* As fallback use the type of the LHS.  */
-	    type = TREE_TYPE (gimple_get_lhs (stmt));
-	    break;
-	  }
-      return type;
-    }
-  else if (code == GIMPLE_COND)
-    return boolean_type_node;
-  else
-    return void_type_node;
-}
-
 /* Enum and arrays used for allocation stats.  Keep in sync with
    gimple.c:gimple_alloc_kind_names.  */
 enum gimple_alloc_kind