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] kill unused function in c-common.c


When the tree-ssa was merged into the mainline, c_estimate_num_insns
is no longer needed as the same functionality is handled in
tree-inline.c on generic trees.  This was once killed on the tree-ssa
some how it came back.

OK? Bootstrapped on powerpc-apple-darwin with no regressions.

If you want me to use delete or remove in the changelog just say so.

ChangeLog:
	* c-common.c (c_estimate_num_insns_1): Kill.
	(c_estimate_num_insns): Kill.
	* c-common.h (c_estimate_num_insns): Kill.



Patch:
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.500
diff -u -p -r1.500 c-common.c
--- c-common.c	18 May 2004 01:26:05 -0000	1.500
+++ c-common.c	19 May 2004 19:15:27 -0000
@@ -5756,131 +5756,6 @@ resort_sorted_fields (void *obj,
 	 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))
- {
- /* Recognize assignments of large structures and constructors of
- big arrays. */
- case MODIFY_EXPR:
- case CONSTRUCTOR:
- {
- HOST_WIDE_INT size;
-
- 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);
- }
- break;
- case CALL_EXPR:
- {
- tree decl = get_callee_fndecl (x);
-
- if (decl && DECL_BUILT_IN (decl))
- switch (DECL_FUNCTION_CODE (decl))
- {
- case BUILT_IN_CONSTANT_P:
- *walk_subtrees = 0;
- return NULL_TREE;
- case BUILT_IN_EXPECT:
- return NULL_TREE;
- default:
- break;
- }
- *count += 10;
- break;
- }
- /* Few special cases of expensive operations. This is useful
- 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:
- *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 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 the body. */
-int
-c_estimate_num_insns (tree decl)
-{
- int num = 0;
- walk_tree_without_duplicates (&DECL_SAVED_TREE (decl), c_estimate_num_insns_1, &num);
- return num;
-}
-
/* Issue the error given by MSGID, indicating that it occurred before
TOKEN, which had the associated VALUE. */


Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.227
diff -u -p -r1.227 c-common.h
--- c-common.h 18 May 2004 01:26:05 -0000 1.227
+++ c-common.h 19 May 2004 19:15:27 -0000
@@ -1221,7 +1221,6 @@ extern void c_common_no_more_pch (void);
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 void c_parse_error (const char *, enum cpp_ttype, tree);


/* The following have been moved here from c-tree.h, since they're needed


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