diff options
author | Diego Novillo <dnovillo@google.com> | 2013-11-08 17:46:16 -0500 |
---|---|---|
committer | Diego Novillo <dnovillo@gcc.gnu.org> | 2013-11-08 17:46:16 -0500 |
commit | 862d0b359fb98790d5fad654eecf471228d8bb77 (patch) | |
tree | 956d82c4131695b3b703c5ba7a83a02ad61d5928 /gcc/function.c | |
parent | f0e56cd667259c3bc4234cb75c5137136af7b25d (diff) | |
download | gcc-862d0b359fb98790d5fad654eecf471228d8bb77.zip gcc-862d0b359fb98790d5fad654eecf471228d8bb77.tar.gz gcc-862d0b359fb98790d5fad654eecf471228d8bb77.tar.bz2 |
Re-factor tree.h - Part 1.
This is the first patch in a series of patches to cleanup tree.h to
reduce the exposure it has all over the compiler.
In this patch, I'm moving functions that are used once into the files
that use them, and make them private to that file. These functions
were declared extern in tree.h and called from exactly one place.
The patch does not move EVERY function. This usually happens
when the function uses private state from its original file, and
moving that private state would mean moving other functions that made
no sense to move.
Additionally, the patch removes functions that were never used.
In subsequent patches, I will be moving out of tree.h extern definitions
that should be grouped in other files (e.g., all functions defined in
some FOO.c will be moved to the corresponding FOO.h). This will allow
me to remove the inclusion of tree.h from some files.
* attribs.c (lookup_scoped_attribute_spec): Make static.
(get_attribute_namespace): Likewise.
* builtins.c (more_const_call_expr_args_p): Move from
tree.h.
(validate_arglist): Move earlier in the file. Make static.
(expand_stack_restore): Move from stmt.c
(expand_stack_save): Move from stmt.c
(rewrite_call_expr_array): Move earlier in the file.
(rewrite_call_expr_valist): Likewise.
* cfgexpand.c: Include hard-reg-set.h before tree.h
Include recog.h.
Include output.h.
(expand_asm_loc): Move from stmt.c.
(n_occurrences): Move from stmt.c.
(check_operand_nalternatives): Move from stmt.c.
(tree_conflicts_with_clobbers_p): Move from stmt.c.
(expand_asm_operands): Move from stmt.c
(expand_asm_stmt): Move from stmt.c
(expand_computed_goto): Move from stmt.c
(expand_goto): Move from stmt.c
(expand_null_return_1): Move from stmt.c
(expand_null_return): Move from stmt.c
(expand_value_return): Move from stmt.c
(expand_return): Move from stmt.c
(expand_main_function): Move from function.c
(stack_protect_prologue): Move from function.c
* cgraphclones.c (build_function_type_skip_args): Move from tree.c.
(build_function_decl_skip_args): Move from tree.c.
* explow.c (tree_expr_size): Move from tree.c.
* expr.c (addr_expr_of_non_mem_decl_p): Remove.
(fields_length): Move from tree.c.
* fold-const.c (size_low_cst): Move from tree.c.
(tree_expr_nonzero_warnv_p): Make static. Move earlier in the file.
(tree_expr_nonzero_p): Make static. Move earlier in the file.
(fold_build3_initializer_loc): Remove.
(tree_invalid_nonnegative_warnv_p): Make static.
* function.c (expand_main_function): Move to cfgexpand.c.
(stack_protect_prologue): Move to cfgexpand.c.
(set_insn_locations): Move earlier in the file.
* gimple-fold.c: Include langhooks.h.
(truth_type_for): Move from tree.c.
* print-tree.c (print_vec_tree): Remove.
* stmt.c (expand_computed_goto): Move to cfgexpand.c.
(expand_goto): Move to cfgexpand.c.
(n_occurrences): Move to cfgexpand.c.
(expand_asm_loc): Move to cfgexpand.c
(tree_conflicts_with_clobbers_p): Move to cfgexpand.c.
(expand_asm_operands): Move to cfgexpand.c.
(expand_asm_stmt): Move to cfgexpand.c.
(check_operand_nalternatives): Move to cfgexpand.c
(expand_null_return): Move to cfgexpand.c.
(expand_value_return): Move to cfgexpand.c.
(expand_null_return_1): Move to cfgexpand.c.
(expand_return): Move to cfgexpand.c.
(expand_stack_save): Move to builtins.c.
(expand_stack_restore): Move to builtins.c
* symtab.c: Include output.h.
(decl_assembler_name_hash): Move from tree.c.
(decl_assembler_name_equal): Move from tree.c.
* trans-mem.c (is_tm_safe_or_pure): Move from tree.h.
* tree-eh.c (in_array_bounds_p): Move from tree.c.
(range_in_array_bounds_p): Move from tree.c.
* tree-object-size.c (fini_object_sizes): Make static.
* tree-ssa-dom.c (iterative_hash_exprs_commutative): Move from tree.h.
* tree-vrp.c (ssa_name_nonnegative_p): Remove.
* tree.c (decl_assembler_name_equal): Move to symtab.c.
(tree_expr_size): Move to explow.c.
(decl_assembler_name_hash): Move to symtab.c.
(real_twop): Remove.
(tree_expr_size): Move to explow.c.
(stabilize_reference_1): Move earlier in the file. Make static.
(omp_remove_redundant_declare_simd_attrs): Remove.
(simple_cst_list_equal): Move earlier in the file. Make static.
(size_low_cst): Move to fold-const.c.
(build_type_no_quals): Remove.
(build_function_type_skip_args): Move to cgraphclones.c.
(build_function_decl_skip_args): Move to cgraphclones.c.
(in_array_bounds_p): Move to tree-eh.c.
(range_in_array_bounds_p): Move to tree-eh.c.
(truth_type_for): Move to gimple-fold.c.
(list_equal_p): remove.
* tree.h (decl_assembler_name_equal): Remove.
(decl_assembler_name_hash): Remove.
(truth_type_for): Remove.
(build_type_no_quals): Remove.
(build_function_decl_skip_args): Remove.
(in_array_bounds_p): Remove.
(range_in_array_bounds_p): Remove.
(size_low_cst): Remove.
(omp_remove_redundant_declare_simd_attrs): Remove.
(tree_expr_size): Remove.
(fields_length): Remove.
(stabilize_reference_1): Remove.
(expand_goto): Remove.
(expand_stack_save): Remove.
(expand_stack_restore): Remove.
(expand_return): Remove.
(fold_build3_initializer_loc): Remove.
(tree_expr_nonzero_p): Remove.
(tree_invalid_nonnegative_warnv_p): Remove.
(tree_expr_nonzero_warnv_p): Remove.
(fold_builtin_snprintf_chk): Remove.
(validate_arglist): Remove.
(iterative_hash_exprs_commutative): Move to tree-ssa-dom.c.
(simple_cst_list_equal): Remove.
(real_twop): Remove.
(expand_main_function): Remove.
(stack_protect_prologue): Remove.
(print_vec_tree): Remove.
(lookup_scoped_attribute_spec): Remove.
(get_attribute_namespace): Remove.
(expand_computed_goto): Remove.
(expand_asm_stmt): Remove.
(list_equal_p): Remove.
(ssa_name_nonnegative_p): Remove.
(fini_object_sizes): Remove.
(addr_expr_of_non_mem_decl_p): Remove.
(is_tm_safe_or_pure): Move to trans-mem.c.
(more_const_call_expr_args_p): Remove.
(save_vtable_map_decl): Remove.
From-SVN: r204606
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 71 |
1 files changed, 13 insertions, 58 deletions
diff --git a/gcc/function.c b/gcc/function.c index 21ab691..ba881c9 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -130,7 +130,6 @@ static bool contains (const_rtx, htab_t); static void prepare_function_start (void); static void do_clobber_return_reg (rtx, void *); static void do_use_return_reg (rtx, void *); -static void set_insn_locations (rtx, int) ATTRIBUTE_UNUSED; /* Stack of nested functions. */ /* Keep track of the cfun stack. */ @@ -4644,51 +4643,6 @@ init_function_start (tree subr) warning (OPT_Waggregate_return, "function returns an aggregate"); } - -void -expand_main_function (void) -{ -#if (defined(INVOKE__main) \ - || (!defined(HAS_INIT_SECTION) \ - && !defined(INIT_SECTION_ASM_OP) \ - && !defined(INIT_ARRAY_SECTION_ASM_OP))) - emit_library_call (init_one_libfunc (NAME__MAIN), LCT_NORMAL, VOIDmode, 0); -#endif -} - -/* Expand code to initialize the stack_protect_guard. This is invoked at - the beginning of a function to be protected. */ - -#ifndef HAVE_stack_protect_set -# define HAVE_stack_protect_set 0 -# define gen_stack_protect_set(x,y) (gcc_unreachable (), NULL_RTX) -#endif - -void -stack_protect_prologue (void) -{ - tree guard_decl = targetm.stack_protect_guard (); - rtx x, y; - - x = expand_normal (crtl->stack_protect_guard); - y = expand_normal (guard_decl); - - /* Allow the target to copy from Y to X without leaking Y into a - register. */ - if (HAVE_stack_protect_set) - { - rtx insn = gen_stack_protect_set (x, y); - if (insn) - { - emit_insn (insn); - return; - } - } - - /* Otherwise do a straight move. */ - emit_move_insn (x, y); -} - /* Expand code to verify the stack_protect_guard. This is invoked at the end of a function to be protected. */ @@ -5006,6 +4960,19 @@ do_warn_unused_parameter (tree fn) warning (OPT_Wunused_parameter, "unused parameter %q+D", decl); } +/* Set the location of the insn chain starting at INSN to LOC. */ + +static void +set_insn_locations (rtx insn, int loc) +{ + while (insn != NULL_RTX) + { + if (INSN_P (insn)) + INSN_LOCATION (insn) = loc; + insn = NEXT_INSN (insn); + } +} + /* Generate RTL for the end of the current function. */ void @@ -5335,18 +5302,6 @@ maybe_copy_prologue_epilogue_insn (rtx insn, rtx copy) *slot = copy; } -/* Set the location of the insn chain starting at INSN to LOC. */ -static void -set_insn_locations (rtx insn, int loc) -{ - while (insn != NULL_RTX) - { - if (INSN_P (insn)) - INSN_LOCATION (insn) = loc; - insn = NEXT_INSN (insn); - } -} - /* Determine if any INSNs in HASH are, or are part of, INSN. Because we can be running after reorg, SEQUENCE rtl is possible. */ |