static int combine_pending_stack_adjustment_and_call (int, struct args_size *,
unsigned int);
-static tree fix_unsafe_tree (tree);
static bool shift_returned_value (tree, rtx *);
#ifdef REG_PARM_STACK_SPACE
&& args[i].mode != BLKmode
&& rtx_cost (args[i].value, SET) > COSTS_N_INSNS (1)
&& ((SMALL_REGISTER_CLASSES && *reg_parm_seen)
- || preserve_subexpressions_p ()))
+ || optimize))
args[i].value = copy_to_mode_reg (args[i].mode, args[i].value);
}
}
seem worth generating rtl to say that. */
reg = gen_rtx_REG (word_mode, REGNO (reg));
x = expand_shift (LSHIFT_EXPR, word_mode, reg,
- build_int_2 (shift, 0), reg, 1);
+ build_int_cst (NULL_TREE, shift),
+ reg, 1);
if (x != reg)
emit_move_insn (reg, x);
}
emit_move_insn (x, tem);
x = expand_shift (dir, word_mode, x,
- build_int_2 (shift, 0), ri, 1);
+ build_int_cst (NULL_TREE, shift),
+ ri, 1);
if (x != ri)
emit_move_insn (ri, x);
}
return insn != NULL_RTX;
}
-static tree
-fix_unsafe_tree (tree t)
-{
- switch (unsafe_for_reeval (t))
- {
- case 0: /* Safe. */
- break;
-
- case 1: /* Mildly unsafe. */
- t = unsave_expr (t);
- break;
-
- case 2: /* Wildly unsafe. */
- {
- tree var = build_decl (VAR_DECL, NULL_TREE,
- TREE_TYPE (t));
- SET_DECL_RTL (var,
- expand_expr (t, NULL_RTX, VOIDmode, EXPAND_NORMAL));
- t = var;
- }
- break;
-
- default:
- abort ();
- }
- return t;
-}
-
-
/* If function value *VALUE was returned at the most significant end of a
register, shift it towards the least significant end and convert it to
TYPE's mode. Return true and update *VALUE if some action was needed.
}
}
-/* Clear RTX_UNCHANGING_P flag of incoming argument MEMs. */
-
-static void
-purge_mem_unchanging_flag (rtx x)
-{
- RTX_CODE code;
- int i, j;
- const char *fmt;
-
- if (x == NULL_RTX)
- return;
-
- code = GET_CODE (x);
-
- if (code == MEM)
- {
- if (RTX_UNCHANGING_P (x)
- && (XEXP (x, 0) == current_function_internal_arg_pointer
- || (GET_CODE (XEXP (x, 0)) == PLUS
- && XEXP (XEXP (x, 0), 0) ==
- current_function_internal_arg_pointer
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT)))
- RTX_UNCHANGING_P (x) = 0;
- return;
- }
-
- /* Scan all subexpressions. */
- fmt = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
- {
- if (*fmt == 'e')
- purge_mem_unchanging_flag (XEXP (x, i));
- else if (*fmt == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- purge_mem_unchanging_flag (XVECEXP (x, i, j));
- }
-}
-
-
/* Generate all the code for a function call
and return an rtx for its value.
Store the value in TARGET (specified as an rtx) if convenient.
/* Tail calls can make things harder to debug, and we've traditionally
pushed these optimizations into -O2. Don't try if we're already
expanding a call, as that means we're an argument. Don't try if
- there's cleanups, as we know there's code to follow the call.
-
- If rtx_equal_function_value_matters is false, that means we've
- finished with regular parsing. Which means that some of the
- machinery we use to generate tail-calls is no longer in place.
- This is most often true of sjlj-exceptions, which we couldn't
- tail-call to anyway. */
+ there's cleanups, as we know there's code to follow the call. */
if (currently_expanding_call++ != 0
|| !flag_optimize_sibling_calls
- || !rtx_equal_function_value_matters
|| args_size.var
|| lookup_stmt_eh_region (exp) >= 0)
try_tail_call = 0;
|| !lang_hooks.decls.ok_for_sibcall (fndecl))
try_tail_call = 0;
- if (try_tail_call)
- {
- int end, inc;
- actparms = NULL_TREE;
- /* Ok, we're going to give the tail call the old college try.
- This means we're going to evaluate the function arguments
- up to three times. There are two degrees of badness we can
- encounter, those that can be unsaved and those that can't.
- (See unsafe_for_reeval commentary for details.)
-
- Generate a new argument list. Pass safe arguments through
- unchanged. For the easy badness wrap them in UNSAVE_EXPRs.
- For hard badness, evaluate them now and put their resulting
- rtx in a temporary VAR_DECL.
-
- initialize_argument_information has ordered the array for the
- order to be pushed, and we must remember this when reconstructing
- the original argument order. */
-
- if (PUSH_ARGS_REVERSED)
- {
- inc = 1;
- i = 0;
- end = num_actuals;
- }
- else
- {
- inc = -1;
- i = num_actuals - 1;
- end = -1;
- }
-
- for (; i != end; i += inc)
- {
- args[i].tree_value = fix_unsafe_tree (args[i].tree_value);
- }
- /* Do the same for the function address if it is an expression. */
- if (!fndecl)
- addr = fix_unsafe_tree (addr);
- }
-
-
/* Ensure current function's preferred stack boundary is at least
what we need. We don't have to increase alignment for recursive
functions. */
if (args[i].aligned_regs)
free (args[i].aligned_regs);
- /* If this function is returning into a memory location marked as
- readonly, it means it is initializing that location. We normally treat
- functions as not clobbering such locations, so we need to specify that
- this one does. We do this by adding the appropriate CLOBBER to the
- CALL_INSN function usage list. This cannot be done by emitting a
- standalone CLOBBER after the call because the latter would be ignored
- by at least the delay slot scheduling pass. We do this now instead of
- adding to call_fusage before the call to emit_call_1 because TARGET
- may be modified in the meantime. */
- if (structure_value_addr != 0 && target != 0
- && MEM_P (target) && RTX_UNCHANGING_P (target))
- add_function_usage_to
- (last_call_insn (),
- gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_CLOBBER (VOIDmode, target),
- NULL_RTX));
-
insns = get_insns ();
end_sequence ();
void
fixup_tail_calls (void)
{
- rtx insn;
- tree arg;
-
purge_reg_equiv_notes ();
-
- /* A sibling call sequence also may invalidate RTX_UNCHANGING_P
- flag of some incoming arguments MEM RTLs, because it can write into
- those slots. We clear all those bits now.
-
- This is (slight) overkill, we could keep track of which arguments
- we actually write into. */
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- if (INSN_P (insn))
- purge_mem_unchanging_flag (PATTERN (insn));
- }
-
- /* Similarly, invalidate RTX_UNCHANGING_P for any incoming
- arguments passed in registers. */
- for (arg = DECL_ARGUMENTS (current_function_decl);
- arg;
- arg = TREE_CHAIN (arg))
- {
- if (REG_P (DECL_RTL (arg)))
- RTX_UNCHANGING_P (DECL_RTL (arg)) = false;
- }
}
/* Traverse an argument list in VALUES and expand all complex