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]

[tree-ssa] Generic code size esitmation code


Hi,
my recent fixes to inlining brought this patch back to bootstrap-land.
This is updated version with Jason's comment wrt RESX_EXPR incorporated.
Hope that this patch will make tree-ssa inlining behaving similarly to
mainline one so we get comparable results again.
OK?


Wed Oct 22 00:03:23 CEST 2003  Jan Hubicka  <jh@suse.cz>
	* c-common.c (c_estimate_num_insns_1): Kill.
	(c_estimate_num_insns): Kill.
	* c-common.h (c_estimate_num_insns): Kill.
	* c-lang.c (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): Kill.
	* cp-lang.c (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): Kill.
	* objc-lang.c (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): Kill.
	* lang.c (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): Kill.
	(java_estimate_num_insns_1, java_estimate_num_insns): Kill.
	* cgraphunit (cgraph_analyze_function): Use estimate_num_insns.
	* tree-eh.c (decide_copy_try_finally): Likewise.
	* tree-inline.c (limits_allow_inilining, optimize_inline_calls): Likewise.
	(estimate_num_insns_1, estimate_num_insns): New functions.
	* langhooks-def.h (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): Kill.
	* langhooks.h (estimate_num_inssn): Kill.
	* tree-inline.h (estimate_num_insns): Declare.
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.344.2.43
diff -c -3 -p -r1.344.2.43 c-common.c
*** c-common.c	23 Oct 2003 16:45:50 -0000	1.344.2.43
--- c-common.c	25 Oct 2003 15:38:11 -0000
*************** resort_sorted_fields (void *obj,
*** 5775,5888 ****
           resort_field_decl_cmp);
  }
  
- /* Used by estimate_num_insns.  Estimate number of instructions seen
-    by given statement.  */
- static tree
- c_estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
- {
-   int *count = data;
-   tree x = *tp;
- 
-   if (TYPE_P (x) || DECL_P (x))
-     {
-       *walk_subtrees = 0;
-       return NULL;
-     }
-   /* Assume that constants and references counts nothing.  These should
-      be majorized by amount of operations among them we count later
-      and are common target of CSE and similar optimizations.  */
-   if (TREE_CODE_CLASS (TREE_CODE (x)) == 'c'
-       || TREE_CODE_CLASS (TREE_CODE (x)) == 'r')
-     return NULL;
-   switch (TREE_CODE (x))
-     { 
-     /* Reconginze assignments of large structures and constructors of
-        big arrays.  */
-     case MODIFY_EXPR:
-     case CONSTRUCTOR:
-       {
- 	int size = int_size_in_bytes (TREE_TYPE (x));
- 
- 	if (!size || size > MOVE_MAX_PIECES)
- 	  *count += 10;
- 	else
- 	  *count += 2 * (size + MOVE_MAX - 1) / MOVE_MAX;
- 	return NULL;
-       }
-       break;
-     /* Few special cases of expensive operations.  This is usefull
-        to avoid inlining on functions having too many of these.  */
-     case TRUNC_DIV_EXPR:
-     case CEIL_DIV_EXPR:
-     case FLOOR_DIV_EXPR:
-     case ROUND_DIV_EXPR:
-     case TRUNC_MOD_EXPR:
-     case CEIL_MOD_EXPR:
-     case FLOOR_MOD_EXPR:
-     case ROUND_MOD_EXPR:
-     case RDIV_EXPR:
-     case CALL_EXPR:
-       *count += 10;
-       break;
-     /* Various containers that will produce no code themselves.  */
-     case INIT_EXPR:
-     case TARGET_EXPR:
-     case BIND_EXPR:
-     case BLOCK:
-     case TREE_LIST:
-     case TREE_VEC:
-     case IDENTIFIER_NODE:
-     case PLACEHOLDER_EXPR:
-     case WITH_CLEANUP_EXPR:
-     case CLEANUP_POINT_EXPR:
-     case NOP_EXPR:
-     case VIEW_CONVERT_EXPR:
-     case SAVE_EXPR:
-     case UNSAVE_EXPR:
-     case COMPLEX_EXPR:
-     case REALPART_EXPR:
-     case IMAGPART_EXPR:
-     case TRY_CATCH_EXPR:
-     case TRY_FINALLY_EXPR:
-     case LABEL_EXPR:
-     case EXIT_EXPR:
-     case LABELED_BLOCK_EXPR:
-     case EXIT_BLOCK_EXPR:
- 
-     case EXPR_STMT:
-     case COMPOUND_STMT:
-     case RETURN_STMT:
-     case LABEL_STMT:
-     case SCOPE_STMT:
-     case FILE_STMT:
-     case CASE_LABEL:
-     case STMT_EXPR:
-     case CLEANUP_STMT:
- 
-     case SIZEOF_EXPR:
-     case ARROW_EXPR:
-     case ALIGNOF_EXPR:
-       break;
-     case DECL_STMT:
-       /* Do not account static initializers.  */
-       if (TREE_STATIC (TREE_OPERAND (x, 0)))
- 	*walk_subtrees = 0;
-       break;
-     default:
-       (*count)++;
-     }
-   return NULL;
- }
- 
- /* Estimate number of instructions that will be created by expanding EXPR.  */
- int
- c_estimate_num_insns (tree expr)
- {
-   int num = 0;
-   walk_tree_without_duplicates (&expr, c_estimate_num_insns_1, &num);
-   return num;
- }
- 
  /* Used by c_decl_uninit to find where expressions like x = x + 1; */
  
  static tree
--- 5775,5780 ----
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.141.2.35
diff -c -3 -p -r1.141.2.35 c-common.h
*** c-common.h	14 Oct 2003 22:24:04 -0000	1.141.2.35
--- c-common.h	25 Oct 2003 15:38:11 -0000
*************** extern void c_common_no_more_pch (void);
*** 1299,1305 ****
  extern void builtin_define_with_value (const char *, const char *, int);
  extern void c_stddef_cpp_builtins (void);
  extern void fe_file_change (const struct line_map *);
- extern int c_estimate_num_insns (tree decl);
  extern bool c_decl_uninit (tree t);
  
  /* The following have been moved here from c-tree.h, since they're needed
--- 1299,1304 ----
Index: c-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-lang.c,v
retrieving revision 1.94.2.16
diff -c -3 -p -r1.94.2.16 c-lang.c
*** c-lang.c	6 Oct 2003 17:36:12 -0000	1.94.2.16
--- c-lang.c	25 Oct 2003 15:38:11 -0000
*************** enum c_language_kind c_language = clk_c;
*** 120,127 ****
  #undef LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING
  #define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
    c_convert_parm_for_inlining
- #undef LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS
- #define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS c_estimate_num_insns
  #undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
  #define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN c_dump_tree
  
--- 120,125 ----
Index: cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.1.4.10
diff -c -3 -p -r1.1.4.10 cgraphunit.c
*** cgraphunit.c	18 Oct 2003 23:59:36 -0000	1.1.4.10
--- cgraphunit.c	25 Oct 2003 15:38:11 -0000
*************** cgraph_analyze_function (struct cgraph_n
*** 315,322 ****
  
    node->local.inlinable = tree_inlinable_function_p (decl);
    if (!DECL_ESTIMATED_INSNS (decl))
!     DECL_ESTIMATED_INSNS (decl)
!       = (*lang_hooks.tree_inlining.estimate_num_insns) (DECL_SAVED_TREE (decl));
    node->local.self_insns = DECL_ESTIMATED_INSNS (decl);
    if (node->local.inlinable)
      node->local.disregard_inline_limits
--- 315,321 ----
  
    node->local.inlinable = tree_inlinable_function_p (decl);
    if (!DECL_ESTIMATED_INSNS (decl))
!     DECL_ESTIMATED_INSNS (decl) = estimate_num_insns (DECL_SAVED_TREE (decl));
    node->local.self_insns = DECL_ESTIMATED_INSNS (decl);
    if (node->local.inlinable)
      node->local.disregard_inline_limits
Index: langhooks-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks-def.h,v
retrieving revision 1.34.2.21
diff -c -3 -p -r1.34.2.21 langhooks-def.h
*** langhooks-def.h	23 Oct 2003 16:45:51 -0000	1.34.2.21
--- langhooks-def.h	25 Oct 2003 15:38:12 -0000
*************** extern int lhd_gimplify_expr (tree *, tr
*** 168,175 ****
    lhd_tree_inlining_end_inlining
  #define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
    lhd_tree_inlining_convert_parm_for_inlining
- #define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \
-   NULL
  
  #define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
    LANG_HOOKS_TREE_INLINING_WALK_SUBTREES, \
--- 168,173 ----
*************** extern int lhd_gimplify_expr (tree *, tr
*** 184,190 ****
    LANG_HOOKS_TREE_INLINING_START_INLINING, \
    LANG_HOOKS_TREE_INLINING_END_INLINING, \
    LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING, \
-   LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \
  }
  
  #define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR lhd_callgraph_analyze_expr
--- 182,187 ----
Index: langhooks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks.h,v
retrieving revision 1.42.2.22
diff -c -3 -p -r1.42.2.22 langhooks.h
*** langhooks.h	23 Oct 2003 16:45:52 -0000	1.42.2.22
--- langhooks.h	25 Oct 2003 15:38:12 -0000
*************** struct lang_hooks_for_tree_inlining
*** 48,54 ****
    int (*start_inlining) (tree);
    void (*end_inlining) (tree);
    tree (*convert_parm_for_inlining) (tree, tree, tree);
-   int (*estimate_num_insns) (tree);
  };
  
  struct lang_hooks_for_callgraph
--- 48,53 ----
Index: tree-eh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-eh.c,v
retrieving revision 1.1.2.7
diff -c -3 -p -r1.1.2.7 tree-eh.c
*** tree-eh.c	24 Oct 2003 07:41:31 -0000	1.1.2.7
--- tree-eh.c	25 Oct 2003 15:38:12 -0000
*************** decide_copy_try_finally (int ndests, tre
*** 1179,1185 ****
      return false;
  
    /* Finally estimate N times, plus N gotos.  */
!   f_estimate = (*lang_hooks.tree_inlining.estimate_num_insns) (finally);
    f_estimate = (f_estimate + 1) * ndests;
  
    /* Switch statement (cost 10), N variable assignments, N gotos.  */
--- 1179,1185 ----
      return false;
  
    /* Finally estimate N times, plus N gotos.  */
!   f_estimate = estimate_num_insns (finally);
    f_estimate = (f_estimate + 1) * ndests;
  
    /* Switch statement (cost 10), N variable assignments, N gotos.  */
Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.26.2.53
diff -c -3 -p -r1.26.2.53 tree-inline.c
*** tree-inline.c	24 Oct 2003 22:32:31 -0000	1.26.2.53
--- tree-inline.c	25 Oct 2003 15:38:12 -0000
*************** inlinable_function_p (tree fn)
*** 1097,1102 ****
--- 1097,1300 ----
    return inlinable;
  }
  
+ /* Used by estimate_num_insns.  Estimate number of instructions seen
+    by given statement.  */
+ static tree
+ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
+ {
+   int *count = data;
+   tree x = *tp;
+ 
+   if (TYPE_P (x) || DECL_P (x))
+     {
+       *walk_subtrees = 0;
+       return NULL;
+     }
+   /* Assume that constants and references counts nothing.  These should
+      be majorized by amount of operations among them we count later
+      and are common target of CSE and similar optimizations.  */
+   if (TREE_CODE_CLASS (TREE_CODE (x)) == 'c'
+       || TREE_CODE_CLASS (TREE_CODE (x)) == 'r')
+     return NULL;
+   switch (TREE_CODE (x))
+     { 
+     /* Containers have no cost.  */
+     case TREE_LIST:
+     case TREE_VEC:
+     case BLOCK:
+     case COMPONENT_REF:
+     case BIT_FIELD_REF:
+     case INDIRECT_REF:
+     case BUFFER_REF:
+     case ARRAY_REF:
+     case ARRAY_RANGE_REF:
+     case VTABLE_REF:
+     case EXC_PTR_EXPR: /* ??? */
+     case FILTER_EXPR: /* ??? */
+     case COMPOUND_EXPR:
+     case BIND_EXPR:
+     case LABELED_BLOCK_EXPR:
+     case WITH_CLEANUP_EXPR:
+     case WITH_RECORD_EXPR:
+     case NOP_EXPR:
+     case VIEW_CONVERT_EXPR:
+     case SAVE_EXPR:
+     case UNSAVE_EXPR:
+     case ADDR_EXPR:
+     case REFERENCE_EXPR:
+     case COMPLEX_EXPR:
+     case REALPART_EXPR:
+     case IMAGPART_EXPR:
+     case EXIT_BLOCK_EXPR:
+     case CASE_LABEL_EXPR:
+     case SSA_NAME:
+     case CATCH_EXPR:
+     case EH_FILTER_EXPR:
+       break;
+     /* We don't account constants for now.  Assume that the cost is amortized
+        by operations that do use them.  We may re-consider this decision once
+        we are able to optimize the tree before estimating it's size and break
+        out static initializers.  */
+     case IDENTIFIER_NODE:
+     case INTEGER_CST:
+     case REAL_CST:
+     case COMPLEX_CST:
+     case VECTOR_CST:
+     case STRING_CST:
+     case ENTRY_VALUE_EXPR:
+     case FDESC_EXPR:
+     case VA_ARG_EXPR:
+     case TRY_CATCH_EXPR:
+     case TRY_FINALLY_EXPR:
+     case LABEL_EXPR:
+     case GOTO_EXPR:
+     case RETURN_EXPR:
+     case EXIT_EXPR:
+     case LOOP_EXPR:
+     case VDEF_EXPR:
+     case EUSE_NODE:
+     case EKILL_NODE:
+     case EPHI_NODE:
+     case EEXIT_NODE:
+     case PHI_NODE:
+       *walk_subtrees = 0;
+       return NULL;
+       break;
+     /* Reconginze assignments of large structures and constructors of
+        big arrays.  */
+     case INIT_EXPR:
+     case TARGET_EXPR:
+     case MODIFY_EXPR:
+     case CONSTRUCTOR:
+       {
+ 	int size = int_size_in_bytes (TREE_TYPE (x));
+ 
+ 	if (!size || size > MOVE_MAX_PIECES)
+ 	  *count += 10;
+ 	else
+ 	  *count += 2 * (size + MOVE_MAX - 1) / MOVE_MAX;
+ 	return NULL;
+       }
+       break;
+ 
+       /* Assign cost of 1 to usual operations.
+ 	 ??? We may consider mapping RTL costs to this.  */
+     case COND_EXPR:
+ 
+     case PLUS_EXPR:
+     case MINUS_EXPR:
+     case MULT_EXPR:
+ 
+     case FIX_TRUNC_EXPR:
+     case FIX_CEIL_EXPR:
+     case FIX_FLOOR_EXPR:
+     case FIX_ROUND_EXPR:
+ 
+     case NEGATE_EXPR:
+     case FLOAT_EXPR:
+     case MIN_EXPR:
+     case MAX_EXPR:
+     case ABS_EXPR:
+ 
+     case LSHIFT_EXPR:
+     case RSHIFT_EXPR:
+     case LROTATE_EXPR:
+     case RROTATE_EXPR:
+ 
+     case BIT_IOR_EXPR:
+     case BIT_XOR_EXPR:
+     case BIT_AND_EXPR:
+     case BIT_NOT_EXPR:
+ 
+     case TRUTH_ANDIF_EXPR:
+     case TRUTH_ORIF_EXPR:
+     case TRUTH_AND_EXPR:
+     case TRUTH_OR_EXPR:
+     case TRUTH_XOR_EXPR:
+     case TRUTH_NOT_EXPR:
+ 
+     case LT_EXPR:
+     case LE_EXPR:
+     case GT_EXPR:
+     case GE_EXPR:
+     case EQ_EXPR:
+     case NE_EXPR:
+     case ORDERED_EXPR:
+     case UNORDERED_EXPR:
+ 
+     case UNLT_EXPR:
+     case UNLE_EXPR:
+     case UNGT_EXPR:
+     case UNGE_EXPR:
+     case UNEQ_EXPR:
+ 
+     case CONVERT_EXPR:
+ 
+     case CONJ_EXPR:
+ 
+     case PREDECREMENT_EXPR:
+     case PREINCREMENT_EXPR:
+     case POSTDECREMENT_EXPR:
+     case POSTINCREMENT_EXPR:
+ 
+     case SWITCH_EXPR:
+ 
+     case ASM_EXPR:
+ 
+     case RESX_EXPR:
+       *count++;
+       break;
+ 
+     /* Few special cases of expensive operations.  This is usefull
+        to avoid inlining on functions having too many of these.  */
+     case TRUNC_DIV_EXPR:
+     case CEIL_DIV_EXPR:
+     case FLOOR_DIV_EXPR:
+     case ROUND_DIV_EXPR:
+     case EXACT_DIV_EXPR:
+     case TRUNC_MOD_EXPR:
+     case CEIL_MOD_EXPR:
+     case FLOOR_MOD_EXPR:
+     case ROUND_MOD_EXPR:
+     case RDIV_EXPR:
+     case CALL_EXPR:
+       *count += 10;
+       break;
+     default:
+       break;
+     }
+   return NULL;
+ }
+ 
+ /* Estimate number of instructions that will be created by expanding EXPR.  */
+ int
+ estimate_num_insns (tree expr)
+ {
+   int num = 0;
+   walk_tree_without_duplicates (&expr, estimate_num_insns_1, &num);
+   return num;
+ }
+ 
  /* We can't inline functions that are too big.  Only allow a single
     function to be of MAX_INLINE_INSNS_SINGLE size.  Make special
     allowance for extern inline functions, though.
*************** limits_allow_inlining (tree fn, inline_d
*** 1123,1131 ****
        /* If we haven't already done so, get an estimate of the number of
  	 instructions that will be produces when expanding this function.  */
        if (!DECL_ESTIMATED_INSNS (fn))
! 	DECL_ESTIMATED_INSNS (fn)
! 	  = (*lang_hooks.tree_inlining.estimate_num_insns)
! 	    (DECL_SAVED_TREE (fn));
        estimated_insns = DECL_ESTIMATED_INSNS (fn);
  
        /* We may be here either because fn is declared inline or because
--- 1321,1327 ----
        /* If we haven't already done so, get an estimate of the number of
  	 instructions that will be produces when expanding this function.  */
        if (!DECL_ESTIMATED_INSNS (fn))
! 	DECL_ESTIMATED_INSNS (fn) = estimate_num_insns (DECL_SAVED_TREE (fn));
        estimated_insns = DECL_ESTIMATED_INSNS (fn);
  
        /* We may be here either because fn is declared inline or because
*************** optimize_inline_calls (tree fn)
*** 1629,1636 ****
    VARRAY_TREE_INIT (id.fns, 32, "fns");
    VARRAY_PUSH_TREE (id.fns, fn);
    if (!DECL_ESTIMATED_INSNS (fn))
!     DECL_ESTIMATED_INSNS (fn) 
!       = (*lang_hooks.tree_inlining.estimate_num_insns) (fn);
    /* Or any functions that aren't finished yet.  */
    prev_fn = NULL_TREE;
    if (current_function_decl)
--- 1825,1831 ----
    VARRAY_TREE_INIT (id.fns, 32, "fns");
    VARRAY_PUSH_TREE (id.fns, fn);
    if (!DECL_ESTIMATED_INSNS (fn))
!     DECL_ESTIMATED_INSNS (fn) = estimate_num_insns (fn);
    /* Or any functions that aren't finished yet.  */
    prev_fn = NULL_TREE;
    if (current_function_decl)
Index: tree-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.h,v
retrieving revision 1.4.2.3
diff -c -3 -p -r1.4.2.3 tree-inline.h
*** tree-inline.h	20 Aug 2003 20:44:32 -0000	1.4.2.3
--- tree-inline.h	25 Oct 2003 15:38:12 -0000
*************** tree walk_tree_without_duplicates (tree*
*** 31,36 ****
--- 31,37 ----
  tree copy_tree_r (tree*, int*, void*);
  void clone_body (tree, tree, void*);
  void remap_save_expr (tree*, void*, tree, int*);
+ int estimate_num_insns (tree expr);
  
  /* 0 if we should not perform inlining.
     1 if we should expand functions calls inline at the tree level.
Index: cp/cp-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-lang.c,v
retrieving revision 1.36.2.23
diff -c -3 -p -r1.36.2.23 cp-lang.c
*** cp/cp-lang.c	28 Sep 2003 06:07:22 -0000	1.36.2.23
--- cp/cp-lang.c	25 Oct 2003 15:38:16 -0000
*************** static void cxx_initialize_diagnostics (
*** 161,168 ****
  #define LANG_HOOKS_TREE_INLINING_START_INLINING cp_start_inlining
  #undef LANG_HOOKS_TREE_INLINING_END_INLINING
  #define LANG_HOOKS_TREE_INLINING_END_INLINING cp_end_inlining
- #undef LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS
- #define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS c_estimate_num_insns
  #undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
  #define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN cp_dump_tree
  #undef LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN
--- 161,166 ----
Index: java/lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/lang.c,v
retrieving revision 1.103.2.21
diff -c -3 -p -r1.103.2.21 lang.c
*** java/lang.c	8 Oct 2003 14:31:49 -0000	1.103.2.21
--- java/lang.c	25 Oct 2003 15:38:17 -0000
*************** static bool java_can_use_bit_fields_p (v
*** 64,70 ****
  static bool java_dump_tree (void *, tree);
  static void dump_compound_expr (dump_info_p, tree);
  static bool java_decl_ok_for_sibcall (tree);
- static int java_estimate_num_insns (tree);
  static int java_start_inlining (tree);
  
  #ifndef TARGET_OBJECT_SUFFIX
--- 64,69 ----
*************** struct language_function GTY(())
*** 247,255 ****
  #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
  #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE java_signed_or_unsigned_type
  
- #undef LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS
- #define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS java_estimate_num_insns
- 
  #undef LANG_HOOKS_TREE_INLINING_START_INLINING
  #define LANG_HOOKS_TREE_INLINING_START_INLINING java_start_inlining
  
--- 246,251 ----
*************** static bool
*** 1044,1151 ****
  java_decl_ok_for_sibcall (tree decl)
  {
    return decl != NULL && DECL_CONTEXT (decl) == current_class;
- }
- 
- /* Used by estimate_num_insns.  Estimate number of instructions seen
-    by given statement.  */
- static tree
- java_estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
- {
-   int *count = data;
-   tree x = *tp;
- 
-   if (TYPE_P (x) || DECL_P (x))
-     {
-       *walk_subtrees = 0;
-       return NULL;
-     }
-   /* Assume that constants and references counts nothing.  These should
-      be majorized by amount of operations amoung them we count later
-      and are common target of CSE and similar optimizations.  */
-   if (TREE_CODE_CLASS (TREE_CODE (x)) == 'c'
-       || TREE_CODE_CLASS (TREE_CODE (x)) == 'r')
-     return NULL;
-   switch (TREE_CODE (x))
-     { 
-     /* Reconginze assignments of large structures and constructors of
-        big arrays.  */
-     case MODIFY_EXPR:
-     case CONSTRUCTOR:
-       {
- 	int size = int_size_in_bytes (TREE_TYPE (x));
- 
- 	if (!size || size > MOVE_MAX_PIECES)
- 	  *count += 10;
- 	else
- 	  *count += 2 * (size + MOVE_MAX - 1) / MOVE_MAX;
- 	return NULL;
-       }
-       break;
-     /* Few special cases of expensive operations.  This is usefull
-        to avoid inlining on functions having too many of these.  */
-     case TRUNC_DIV_EXPR:
-     case CEIL_DIV_EXPR:
-     case FLOOR_DIV_EXPR:
-     case ROUND_DIV_EXPR:
-     case TRUNC_MOD_EXPR:
-     case CEIL_MOD_EXPR:
-     case FLOOR_MOD_EXPR:
-     case ROUND_MOD_EXPR:
-     case RDIV_EXPR:
-     case CALL_EXPR:
- 
-     case NEW_ARRAY_EXPR:
-     case NEW_ANONYMOUS_ARRAY_EXPR:
-     case NEW_CLASS_EXPR:
-       *count += 10;
-       break;
-     /* Various containers that will produce no code themselves.  */
-     case INIT_EXPR:
-     case TARGET_EXPR:
-     case BIND_EXPR:
-     case BLOCK:
-     case TREE_LIST:
-     case TREE_VEC:
-     case IDENTIFIER_NODE:
-     case PLACEHOLDER_EXPR:
-     case WITH_CLEANUP_EXPR:
-     case CLEANUP_POINT_EXPR:
-     case NOP_EXPR:
-     case VIEW_CONVERT_EXPR:
-     case SAVE_EXPR:
-     case UNSAVE_EXPR:
-     case COMPLEX_EXPR:
-     case REALPART_EXPR:
-     case IMAGPART_EXPR:
-     case TRY_CATCH_EXPR:
-     case TRY_FINALLY_EXPR:
-     case LABEL_EXPR:
-     case EXIT_EXPR:
-     case LABELED_BLOCK_EXPR:
-     case EXIT_BLOCK_EXPR:
-     case EXPR_WITH_FILE_LOCATION:
-     case UNARY_PLUS_EXPR:
-     case THIS_EXPR:
-     case DEFAULT_EXPR:
-     case TRY_EXPR:
- 
-       break;
-     case CLASS_LITERAL:
-       *walk_subtrees = 0;
-       break;
-     default:
-       (*count)++;
-     }
-   return NULL;
- }
- 
- /*  Estimate number of instructions that will be created by expanding EXPR.  */
- static int
- java_estimate_num_insns (tree expr)
- {
-   int num = 0;
-   walk_tree_without_duplicates (&expr, java_estimate_num_insns_1, &num);
-   return num;
  }
  
  /* Start inlining fn.  Called by the tree inliner via
--- 1040,1045 ----
Index: objc/objc-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-lang.c,v
retrieving revision 1.24.2.12
diff -c -3 -p -r1.24.2.12 objc-lang.c
*** objc/objc-lang.c	28 Sep 2003 06:07:44 -0000	1.24.2.12
--- objc/objc-lang.c	25 Oct 2003 15:38:17 -0000
*************** enum c_language_kind c_language = clk_ob
*** 114,121 ****
  #undef LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P
  #define LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P \
    c_tree_chain_matters_p
- #undef LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS
- #define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS c_estimate_num_insns
  
  #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
  #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION c_expand_body
--- 114,119 ----


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