diff options
author | Steven Bosscher <stevenb@suse.de> | 2004-06-03 12:07:47 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2004-06-03 12:07:47 +0000 |
commit | 6ce2bcb71c2f66918a8287090589a9d9ea45ed74 (patch) | |
tree | a5c35a768c30f3209297293fe64b76eab30e93f8 /gcc/stmt.c | |
parent | 53ef271f84dcf405c5e58ea7b1ef2211f073d3c1 (diff) | |
download | gcc-6ce2bcb71c2f66918a8287090589a9d9ea45ed74.zip gcc-6ce2bcb71c2f66918a8287090589a9d9ea45ed74.tar.gz gcc-6ce2bcb71c2f66918a8287090589a9d9ea45ed74.tar.bz2 |
basic-block.c (tail_recursion_label_list): Don't declare.
* basic-block.c (tail_recursion_label_list): Don't declare.
(CLEANUP_PRE_SIBCALL): Remove. Renumber the other CLEANUP_*
accordingly.
* cfgbuild.c (find_label_refs): Remove.
(find_basic_blocks_1): Don't handle CALL_PLACEHOLDER insns.
* cfgcleanup.c (tail_recursion_label_p): Remove.
(merge_blocks_move): Do not check for tail recursion.
(try_optimize_cfg): Likewise.
(cleanup_cfg): Never handle CLEANUP_PRE_SIBCALL.
* cfgrtl.c (tail_recursion_label_list): Remove.
* except.c (remove_unreachable_regions): Don't handle
CALL_PLACEHOLDER insns.
(convert_from_eh_region_ranges_1, can_throw_internal,
can_throw_external): Likewise.
* function.c (free_after_compilation): Don't clear
x_tail_recursion_label.
(fixup_var_refs_insns): Don't handle CALL_PLACEHOLDER insns.
(identify_blocks_1): Don't recurse for CALL_PLACEHOLDER insns.
(reorder_blocks_1): Likewise.
* function.h (struct function): Remove x_tail_recursion_label
member. Don't define tail_recursion_label.
* jump.c (mark_all_labels): Don't handle CALL_PLACEHOLDER insns.
* print-rtl.c (print_rtx): Likewise.
* rtl.def (CALL_PLACEHOLDER): Remove.
* rtl.h (sibcall_use_t): Remove enum.
(optimize_sibling_and_tail_recursive_calls,
replace_call_placeholder): Remove function prototypes.
* stmt.c (tail_recursion_args): Remove.
(optimize_tail_recursion): Remove.
(expand_return): Don't check for possible tail recursion.
* tree.h (optimize_tail_recursion): Remove prototype.
From-SVN: r82597
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r-- | gcc/stmt.c | 142 |
1 files changed, 0 insertions, 142 deletions
@@ -382,7 +382,6 @@ static void expand_null_return_1 (rtx); static enum br_predictor return_prediction (rtx); static rtx shift_return_value (rtx); static void expand_value_return (rtx); -static int tail_recursion_args (tree, tree); static void expand_cleanups (tree, int, int); static void check_seenlabel (void); static void do_jump_if_equal (rtx, rtx, rtx, int); @@ -2668,39 +2667,6 @@ expand_return (tree retval) last_insn = get_last_insn (); - /* Distribute return down conditional expr if either of the sides - may involve tail recursion (see test below). This enhances the number - of tail recursions we see. Don't do this always since it can produce - sub-optimal code in some cases and we distribute assignments into - conditional expressions when it would help. */ - - if (optimize && retval_rhs != 0 - && frame_offset == 0 - && TREE_CODE (retval_rhs) == COND_EXPR - && (TREE_CODE (TREE_OPERAND (retval_rhs, 1)) == CALL_EXPR - || TREE_CODE (TREE_OPERAND (retval_rhs, 2)) == CALL_EXPR)) - { - rtx label = gen_label_rtx (); - tree expr; - - do_jump (TREE_OPERAND (retval_rhs, 0), label, NULL_RTX); - start_cleanup_deferral (); - expr = build (MODIFY_EXPR, TREE_TYPE (TREE_TYPE (current_function_decl)), - DECL_RESULT (current_function_decl), - TREE_OPERAND (retval_rhs, 1)); - TREE_SIDE_EFFECTS (expr) = 1; - expand_return (expr); - emit_label (label); - - expr = build (MODIFY_EXPR, TREE_TYPE (TREE_TYPE (current_function_decl)), - DECL_RESULT (current_function_decl), - TREE_OPERAND (retval_rhs, 2)); - TREE_SIDE_EFFECTS (expr) = 1; - expand_return (expr); - end_cleanup_deferral (); - return; - } - result_rtl = DECL_RTL (DECL_RESULT (current_function_decl)); /* If the result is an aggregate that is being returned in one (or more) @@ -2850,114 +2816,6 @@ expand_return (tree retval) } } -/* Attempt to optimize a potential tail recursion call into a goto. - ARGUMENTS are the arguments to a CALL_EXPR; LAST_INSN indicates - where to place the jump to the tail recursion label. - - Return TRUE if the call was optimized into a goto. */ - -int -optimize_tail_recursion (tree arguments, rtx last_insn) -{ - /* Finish checking validity, and if valid emit code to set the - argument variables for the new call. */ - if (tail_recursion_args (arguments, DECL_ARGUMENTS (current_function_decl))) - { - if (tail_recursion_label == 0) - { - tail_recursion_label = gen_label_rtx (); - emit_label_after (tail_recursion_label, - tail_recursion_reentry); - } - emit_queue (); - expand_goto_internal (NULL_TREE, tail_recursion_label, last_insn); - emit_barrier (); - return 1; - } - return 0; -} - -/* Emit code to alter this function's formal parms for a tail-recursive call. - ACTUALS is a list of actual parameter expressions (chain of TREE_LISTs). - FORMALS is the chain of decls of formals. - Return 1 if this can be done; - otherwise return 0 and do not emit any code. */ - -static int -tail_recursion_args (tree actuals, tree formals) -{ - tree a = actuals, f = formals; - int i; - rtx *argvec; - - /* Check that number and types of actuals are compatible - with the formals. This is not always true in valid C code. - Also check that no formal needs to be addressable - and that all formals are scalars. */ - - /* Also count the args. */ - - for (a = actuals, f = formals, i = 0; a && f; a = TREE_CHAIN (a), f = TREE_CHAIN (f), i++) - { - if (!lang_hooks.types_compatible_p (TREE_TYPE (TREE_VALUE (a)), - TREE_TYPE (f))) - return 0; - if (GET_CODE (DECL_RTL (f)) != REG || DECL_MODE (f) == BLKmode) - return 0; - } - if (a != 0 || f != 0) - return 0; - - /* Compute all the actuals. */ - - argvec = alloca (i * sizeof (rtx)); - - for (a = actuals, i = 0; a; a = TREE_CHAIN (a), i++) - argvec[i] = expand_expr (TREE_VALUE (a), NULL_RTX, VOIDmode, 0); - - /* Find which actual values refer to current values of previous formals. - Copy each of them now, before any formal is changed. */ - - for (a = actuals, i = 0; a; a = TREE_CHAIN (a), i++) - { - int copy = 0; - int j; - for (f = formals, j = 0; j < i; f = TREE_CHAIN (f), j++) - if (reg_mentioned_p (DECL_RTL (f), argvec[i])) - { - copy = 1; - break; - } - if (copy) - argvec[i] = copy_to_reg (argvec[i]); - } - - /* Store the values of the actuals into the formals. */ - - for (f = formals, a = actuals, i = 0; f; - f = TREE_CHAIN (f), a = TREE_CHAIN (a), i++) - { - if (GET_MODE (DECL_RTL (f)) == GET_MODE (argvec[i])) - emit_move_insn (DECL_RTL (f), argvec[i]); - else - { - rtx tmp = argvec[i]; - int unsignedp = TYPE_UNSIGNED (TREE_TYPE (TREE_VALUE (a))); - promote_mode(TREE_TYPE (TREE_VALUE (a)), GET_MODE (tmp), - &unsignedp, 0); - if (DECL_MODE (f) != GET_MODE (DECL_RTL (f))) - { - tmp = gen_reg_rtx (DECL_MODE (f)); - convert_move (tmp, argvec[i], unsignedp); - } - convert_move (DECL_RTL (f), tmp, unsignedp); - } - } - - free_temp_slots (); - return 1; -} - /* Generate the RTL code for entering a binding contour. The variables are declared one by one, by calls to `expand_decl'. |