This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Trivial inliner cleanups


This patch does some trivial cleanups to the inliner and related
code, namely exposing a local define to tree-inline.h and using
it in more places instead of 10; removing an unused define and
marking a local helper function inline (it's uses are such that
it will collapse to almost a NOP at most call-sites).

Bootstrapped on x86_64-unknown-linux-gnu.

Ok for mainline?

Thanks,
Richard.


2005-Feb-28  Richard Guenther  <rguenth@gcc.gnu.org>

	* cgraphunit.c (cgraph_estimate_size_after_inlining):
	Mark inline.
	(INSNS_PER_CALL): Move ...
	* tree-inline.h: ... here and document.
	* tree-inline.c (estimate_num_insns_1): Use INSNS_PER_CALL
	instead of 10 where appropriate.
	(INSNS_PER_STMT): Remove unused define.


Index: cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.93
diff -c -3 -p -r1.93 cgraphunit.c
*** cgraphunit.c	21 Feb 2005 14:39:46 -0000	1.93
--- cgraphunit.c	28 Feb 2005 10:25:51 -0000
*************** Software Foundation, 59 Temple Place - S
*** 190,197 ****
  #include "function.h"
  #include "tree-gimple.h"

- #define INSNS_PER_CALL 10
-
  static void cgraph_expand_all_functions (void);
  static void cgraph_mark_functions_to_output (void);
  static void cgraph_expand_function (struct cgraph_node *);
--- 190,195 ----
*************** cgraph_remove_unreachable_nodes (void)
*** 1027,1033 ****

  /* Estimate size of the function after inlining WHAT into TO.  */

! static int
  cgraph_estimate_size_after_inlining (int times, struct cgraph_node *to,
  				     struct cgraph_node *what)
  {
--- 1025,1031 ----

  /* Estimate size of the function after inlining WHAT into TO.  */

! static inline int
  cgraph_estimate_size_after_inlining (int times, struct cgraph_node *to,
  				     struct cgraph_node *what)
  {
Index: tree-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.h,v
retrieving revision 1.14
diff -c -3 -p -r1.14 tree-inline.h
*** tree-inline.h	8 Nov 2004 22:40:09 -0000	1.14
--- tree-inline.h	28 Feb 2005 10:25:51 -0000
*************** int estimate_num_insns (tree expr);
*** 38,41 ****
--- 38,46 ----

  extern int flag_inline_trees;

+ /* Instructions per call.  Used in estimate_num_insns and in the
+    inliner to account for (removed) calls.  */
+
+ #define INSNS_PER_CALL 10
+
  #endif /* GCC_TREE_INLINE_H */
Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.170
diff -c -3 -p -r1.170 tree-inline.c
*** tree-inline.c	27 Jan 2005 14:36:17 -0000	1.170
--- tree-inline.c	28 Feb 2005 10:25:51 -0000
*************** typedef struct inline_data
*** 118,128 ****

  /* Prototypes.  */

- /* The approximate number of instructions per statement.  This number
-    need not be particularly accurate; it is used only to make
-    decisions about when a function is too big to inline.  */
- #define INSNS_PER_STMT (10)
-
  static tree copy_body_r (tree *, int *, void *);
  static tree copy_body (inline_data *);
  static tree expand_call_inline (tree *, int *, void *);
--- 118,123 ----
*************** estimate_num_insns_1 (tree *tp, int *wal
*** 1257,1263 ****
  	size = int_size_in_bytes (TREE_TYPE (x));

  	if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO)
! 	  *count += 10;
  	else
  	  *count += ((size + MOVE_MAX_PIECES - 1) / MOVE_MAX_PIECES);
        }
--- 1252,1258 ----
  	size = int_size_in_bytes (TREE_TYPE (x));

  	if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO)
! 	  *count += INSNS_PER_CALL;
  	else
  	  *count += ((size + MOVE_MAX_PIECES - 1) / MOVE_MAX_PIECES);
        }
*************** estimate_num_insns_1 (tree *tp, int *wal
*** 1363,1369 ****
  	    default:
  	      break;
  	    }
! 	*count += 10;
  	break;
        }
      default:
--- 1358,1364 ----
  	    default:
  	      break;
  	    }
! 	*count += INSNS_PER_CALL;
  	break;
        }
      default:



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]