Commit 9dd9bf80 by Eric Botcazou Committed by Eric Botcazou

Removal of Return with Depressed Stack Pointer support

	Removal of Return with Depressed Stack Pointer support
	* tree.h (TYPE_RETURNS_STACK_DEPRESSED): Delete.
	(ECF_SP_DEPRESSED): Likewise.
	(ECF_LIBCALL_BLOCK, ECF_NOVOPS): Adjust.
	* calls.c (emit_call_1): Do not test ECF_SP_DEPRESSED.
	(flags_from_decl_or_type): Do not test TYPE_RETURNS_STACK_DEPRESSED.
	(expand_call): Do not test ECF_SP_DEPRESSED.
	* dse.c (dse_step0): Do not test TYPE_RETURNS_STACK_DEPRESSED.
	* function.c (keep_stack_depressed): Delete.
	(handle_epilogue_set): Likewise.
	(update_epilogue_consts): Likewise.
	(emit_equiv_load): Likewise.
	(thread_prologue_and_epilogue_insns): Remove support for Return with
	Depressed Stack Pointer.
	* print-tree.c (print_node): Do not test TYPE_RETURNS_STACK_DEPRESSED.

ada/
	* gigi.h (create_subprog_type): Remove returns_with_dsp parameter.
	* decl.c (gnat_to_gnu_entity): Adjust for above new prototype.
	* utils.c (create_subprog_type): Remove returns_with_dsp parameter.
	* trans.c (gnat_to_gnu) <N_Return_Statement>: Remove code dealing with
	Return by Depressed Stack Pointer.

From-SVN: r133976
parent f9985df5
2008-04-07 Eric Botcazou <ebotcazou@adacore.com>
Removal of Return with Depressed Stack Pointer support
* tree.h (TYPE_RETURNS_STACK_DEPRESSED): Delete.
(ECF_SP_DEPRESSED): Likewise.
(ECF_LIBCALL_BLOCK, ECF_NOVOPS): Adjust.
* calls.c (emit_call_1): Do not test ECF_SP_DEPRESSED.
(flags_from_decl_or_type): Do not test TYPE_RETURNS_STACK_DEPRESSED.
(expand_call): Do not test ECF_SP_DEPRESSED.
* dse.c (dse_step0): Do not test TYPE_RETURNS_STACK_DEPRESSED.
* function.c (keep_stack_depressed): Delete.
(handle_epilogue_set): Likewise.
(update_epilogue_consts): Likewise.
(emit_equiv_load): Likewise.
(thread_prologue_and_epilogue_insns): Remove support for Return with
Depressed Stack Pointer.
* print-tree.c (print_node): Do not test TYPE_RETURNS_STACK_DEPRESSED.
2008-04-06 Richard Guenther <rguenther@suse.de> 2008-04-06 Richard Guenther <rguenther@suse.de>
PR tree-optimization/35400 PR tree-optimization/35400
......
2008-04-07 Eric Botcazou <ebotcazou@adacore.com>
* gigi.h (create_subprog_type): Remove returns_with_dsp parameter.
* decl.c (gnat_to_gnu_entity): Adjust for above new prototype.
* utils.c (create_subprog_type): Remove returns_with_dsp parameter.
* trans.c (gnat_to_gnu) <N_Return_Statement>: Remove code dealing with
Return by Depressed Stack Pointer.
2008-04-06 Eric Botcazou <ebotcazou@adacore.com> 2008-04-06 Eric Botcazou <ebotcazou@adacore.com>
* decl.c (is_variable_size): Do not unconditionally return false * decl.c (is_variable_size): Do not unconditionally return false
...@@ -3863,17 +3863,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -3863,17 +3863,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnu_type gnu_type
= create_subprog_type (gnu_return_type, gnu_param_list, = create_subprog_type (gnu_return_type, gnu_param_list,
gnu_return_list, returns_unconstrained, gnu_return_list, returns_unconstrained,
returns_by_ref, returns_by_ref, returns_by_target_ptr);
Function_Returns_With_DSP (gnat_entity),
returns_by_target_ptr);
if (has_stub) if (has_stub)
gnu_stub_type gnu_stub_type
= create_subprog_type (gnu_return_type, gnu_stub_param_list, = create_subprog_type (gnu_return_type, gnu_stub_param_list,
gnu_return_list, returns_unconstrained, gnu_return_list, returns_unconstrained,
returns_by_ref, returns_by_ref, returns_by_target_ptr);
Function_Returns_With_DSP (gnat_entity),
returns_by_target_ptr);
/* A subprogram (something that doesn't return anything) shouldn't /* A subprogram (something that doesn't return anything) shouldn't
be considered Pure since there would be no reason for such a be considered Pure since there would be no reason for such a
......
...@@ -522,13 +522,11 @@ extern void rest_of_record_type_compilation (tree record_type); ...@@ -522,13 +522,11 @@ extern void rest_of_record_type_compilation (tree record_type);
copy-in/copy-out list to be stored into TYPE_CI_CO_LIST. copy-in/copy-out list to be stored into TYPE_CI_CO_LIST.
RETURNS_UNCONSTRAINED is true if the function returns an unconstrained RETURNS_UNCONSTRAINED is true if the function returns an unconstrained
object. RETURNS_BY_REF is true if the function returns by reference. object. RETURNS_BY_REF is true if the function returns by reference.
RETURNS_WITH_DSP is true if the function is to return with a RETURNS_BY_TARGET_PTR is true if the function is to be passed (as its
depressed stack pointer. RETURNS_BY_TARGET_PTR is true if the function first parameter) the address of the place to copy its result. */
is to be passed (as its first parameter) the address of the place to copy
its result. */
extern tree create_subprog_type (tree return_type, tree param_decl_list, extern tree create_subprog_type (tree return_type, tree param_decl_list,
tree cico_list, bool returns_unconstrained, tree cico_list, bool returns_unconstrained,
bool returns_by_ref, bool returns_with_dsp, bool returns_by_ref,
bool returns_by_target_ptr); bool returns_by_target_ptr);
/* Return a copy of TYPE, but safe to modify in any way. */ /* Return a copy of TYPE, but safe to modify in any way. */
......
...@@ -4182,26 +4182,13 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -4182,26 +4182,13 @@ gnat_to_gnu (Node_Id gnat_node)
else if (TYPE_RETURNS_UNCONSTRAINED_P (gnu_subprog_type)) else if (TYPE_RETURNS_UNCONSTRAINED_P (gnu_subprog_type))
{ {
gnu_ret_val = maybe_unconstrained_array (gnu_ret_val); gnu_ret_val = maybe_unconstrained_array (gnu_ret_val);
gnu_ret_val
/* We have two cases: either the function returns with = build_allocator (TREE_TYPE (gnu_ret_val),
depressed stack or not. If not, we allocate on the gnu_ret_val,
secondary stack. If so, we allocate in the stack frame. TREE_TYPE (gnu_subprog_type),
if no copy is needed, the front end will set By_Ref, Procedure_To_Call (gnat_node),
which we handle in the case above. */ Storage_Pool (gnat_node),
if (TYPE_RETURNS_STACK_DEPRESSED (gnu_subprog_type)) gnat_node, false);
gnu_ret_val
= build_allocator (TREE_TYPE (gnu_ret_val),
gnu_ret_val,
TREE_TYPE (gnu_subprog_type),
0, -1, gnat_node, false);
else
gnu_ret_val
= build_allocator (TREE_TYPE (gnu_ret_val),
gnu_ret_val,
TREE_TYPE (gnu_subprog_type),
Procedure_To_Call (gnat_node),
Storage_Pool (gnat_node),
gnat_node, false);
} }
} }
} }
......
...@@ -1255,17 +1255,15 @@ split_plus (tree in, tree *pvar) ...@@ -1255,17 +1255,15 @@ split_plus (tree in, tree *pvar)
otherwise we are dealing with a function. PARAM_DECL_LIST is a list of otherwise we are dealing with a function. PARAM_DECL_LIST is a list of
PARM_DECL nodes that are the subprogram arguments. CICO_LIST is the PARM_DECL nodes that are the subprogram arguments. CICO_LIST is the
copy-in/copy-out list to be stored into TYPE_CICO_LIST. copy-in/copy-out list to be stored into TYPE_CICO_LIST.
RETURNS_UNCONSTRAINED is nonzero if the function returns an unconstrained RETURNS_UNCONSTRAINED is true if the function returns an unconstrained
object. RETURNS_BY_REF is nonzero if the function returns by reference. object. RETURNS_BY_REF is true if the function returns by reference.
RETURNS_WITH_DSP is nonzero if the function is to return with a RETURNS_BY_TARGET_PTR is true if the function is to be passed (as its
depressed stack pointer. RETURNS_BY_TARGET_PTR is true if the function first parameter) the address of the place to copy its result. */
is to be passed (as its first parameter) the address of the place to copy
its result. */
tree tree
create_subprog_type (tree return_type, tree param_decl_list, tree cico_list, create_subprog_type (tree return_type, tree param_decl_list, tree cico_list,
bool returns_unconstrained, bool returns_by_ref, bool returns_unconstrained, bool returns_by_ref,
bool returns_with_dsp, bool returns_by_target_ptr) bool returns_by_target_ptr)
{ {
/* A chain of TREE_LIST nodes whose TREE_VALUEs are the data type nodes of /* A chain of TREE_LIST nodes whose TREE_VALUEs are the data type nodes of
the subprogram formal parameters. This list is generated by traversing the the subprogram formal parameters. This list is generated by traversing the
...@@ -1302,7 +1300,6 @@ create_subprog_type (tree return_type, tree param_decl_list, tree cico_list, ...@@ -1302,7 +1300,6 @@ create_subprog_type (tree return_type, tree param_decl_list, tree cico_list,
TYPE_CI_CO_LIST (type) = cico_list; TYPE_CI_CO_LIST (type) = cico_list;
TYPE_RETURNS_UNCONSTRAINED_P (type) = returns_unconstrained; TYPE_RETURNS_UNCONSTRAINED_P (type) = returns_unconstrained;
TYPE_RETURNS_STACK_DEPRESSED (type) = returns_with_dsp;
TYPE_RETURNS_BY_REF_P (type) = returns_by_ref; TYPE_RETURNS_BY_REF_P (type) = returns_by_ref;
TYPE_RETURNS_BY_TARGET_PTR_P (type) = returns_by_target_ptr; TYPE_RETURNS_BY_TARGET_PTR_P (type) = returns_by_target_ptr;
return type; return type;
......
...@@ -297,7 +297,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED, ...@@ -297,7 +297,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED,
even if the call has no arguments to pop. */ even if the call has no arguments to pop. */
#if defined (HAVE_call) && defined (HAVE_call_value) #if defined (HAVE_call) && defined (HAVE_call_value)
if (HAVE_call && HAVE_call_value && HAVE_call_pop && HAVE_call_value_pop if (HAVE_call && HAVE_call_value && HAVE_call_pop && HAVE_call_value_pop
&& n_popped > 0 && ! (ecf_flags & ECF_SP_DEPRESSED)) && n_popped > 0)
#else #else
if (HAVE_call_pop && HAVE_call_value_pop) if (HAVE_call_pop && HAVE_call_value_pop)
#endif #endif
...@@ -432,7 +432,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED, ...@@ -432,7 +432,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED,
if (rounded_stack_size != 0) if (rounded_stack_size != 0)
{ {
if (ecf_flags & (ECF_SP_DEPRESSED | ECF_NORETURN)) if (ecf_flags & ECF_NORETURN)
/* Just pretend we did the pop. */ /* Just pretend we did the pop. */
stack_pointer_delta -= rounded_stack_size; stack_pointer_delta -= rounded_stack_size;
else if (flag_defer_pop && inhibit_defer_pop == 0 else if (flag_defer_pop && inhibit_defer_pop == 0
...@@ -602,14 +602,6 @@ flags_from_decl_or_type (const_tree exp) ...@@ -602,14 +602,6 @@ flags_from_decl_or_type (const_tree exp)
if (TREE_THIS_VOLATILE (exp)) if (TREE_THIS_VOLATILE (exp))
flags |= ECF_NORETURN; flags |= ECF_NORETURN;
/* Mark if the function returns with the stack pointer depressed. We
cannot consider it pure or constant in that case. */
if (TREE_CODE (type) == FUNCTION_TYPE && TYPE_RETURNS_STACK_DEPRESSED (type))
{
flags |= ECF_SP_DEPRESSED;
flags &= ~(ECF_PURE | ECF_CONST);
}
return flags; return flags;
} }
...@@ -2354,13 +2346,12 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -2354,13 +2346,12 @@ expand_call (tree exp, rtx target, int ignore)
/* Don't let pending stack adjusts add up to too much. /* Don't let pending stack adjusts add up to too much.
Also, do all pending adjustments now if there is any chance Also, do all pending adjustments now if there is any chance
this might be a call to alloca or if we are expanding a sibling this might be a call to alloca or if we are expanding a sibling
call sequence or if we are calling a function that is to return call sequence.
with stack pointer depressed.
Also do the adjustments before a throwing call, otherwise Also do the adjustments before a throwing call, otherwise
exception handling can fail; PR 19225. */ exception handling can fail; PR 19225. */
if (pending_stack_adjust >= 32 if (pending_stack_adjust >= 32
|| (pending_stack_adjust > 0 || (pending_stack_adjust > 0
&& (flags & (ECF_MAY_BE_ALLOCA | ECF_SP_DEPRESSED))) && (flags & ECF_MAY_BE_ALLOCA))
|| (pending_stack_adjust > 0 || (pending_stack_adjust > 0
&& flag_exceptions && !(flags & ECF_NOTHROW)) && flag_exceptions && !(flags & ECF_NOTHROW))
|| pass == 0) || pass == 0)
...@@ -3071,7 +3062,7 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -3071,7 +3062,7 @@ expand_call (tree exp, rtx target, int ignore)
/* If size of args is variable or this was a constructor call for a stack /* If size of args is variable or this was a constructor call for a stack
argument, restore saved stack-pointer value. */ argument, restore saved stack-pointer value. */
if (old_stack_level && ! (flags & ECF_SP_DEPRESSED)) if (old_stack_level)
{ {
emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX); emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
stack_pointer_delta = old_stack_pointer_delta; stack_pointer_delta = old_stack_pointer_delta;
...@@ -3177,16 +3168,6 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -3177,16 +3168,6 @@ expand_call (tree exp, rtx target, int ignore)
currently_expanding_call--; currently_expanding_call--;
/* If this function returns with the stack pointer depressed, ensure
this block saves and restores the stack pointer, show it was
changed, and adjust for any outgoing arg space. */
if (flags & ECF_SP_DEPRESSED)
{
clear_pending_stack_adjust ();
emit_insn (gen_rtx_CLOBBER (VOIDmode, stack_pointer_rtx));
emit_move_insn (virtual_stack_dynamic_rtx, stack_pointer_rtx);
}
if (stack_usage_map_buf) if (stack_usage_map_buf)
free (stack_usage_map_buf); free (stack_usage_map_buf);
......
...@@ -522,11 +522,8 @@ struct clear_alias_mode_holder ...@@ -522,11 +522,8 @@ struct clear_alias_mode_holder
static alloc_pool clear_alias_mode_pool; static alloc_pool clear_alias_mode_pool;
/* This is true except for two cases: /* This is true except if current_function_stdarg -- i.e. we cannot do
(1) current_function_stdarg -- i.e. we cannot do this this for vararg functions because they play games with the frame. */
for vararg functions because they play games with the frame.
(2) In ada, it is sometimes not safe to do assume that any stores
based off the stack frame go dead at the exit to a function. */
static bool stores_off_frame_dead_at_return; static bool stores_off_frame_dead_at_return;
/* Counter for stats. */ /* Counter for stats. */
...@@ -712,10 +709,7 @@ dse_step0 (void) ...@@ -712,10 +709,7 @@ dse_step0 (void)
bb_table = XCNEWVEC (bb_info_t, last_basic_block); bb_table = XCNEWVEC (bb_info_t, last_basic_block);
rtx_group_next_id = 0; rtx_group_next_id = 0;
stores_off_frame_dead_at_return = stores_off_frame_dead_at_return = !current_function_stdarg;
(!(TREE_CODE (TREE_TYPE (current_function_decl)) == FUNCTION_TYPE
&& (TYPE_RETURNS_STACK_DEPRESSED (TREE_TYPE (current_function_decl)))))
&& (!current_function_stdarg);
init_alias_analysis (); init_alias_analysis ();
......
...@@ -565,9 +565,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent) ...@@ -565,9 +565,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
else if (TREE_CODE (node) == INTEGER_TYPE else if (TREE_CODE (node) == INTEGER_TYPE
&& TYPE_IS_SIZETYPE (node)) && TYPE_IS_SIZETYPE (node))
fputs (" sizetype", file); fputs (" sizetype", file);
else if (TREE_CODE (node) == FUNCTION_TYPE
&& TYPE_RETURNS_STACK_DEPRESSED (node))
fputs (" returns-stack-depressed", file);
if (TYPE_STRING_FLAG (node)) if (TYPE_STRING_FLAG (node))
fputs (" string-flag", file); fputs (" string-flag", file);
......
...@@ -2207,11 +2207,6 @@ struct tree_block GTY(()) ...@@ -2207,11 +2207,6 @@ struct tree_block GTY(())
#define TYPE_IS_SIZETYPE(NODE) \ #define TYPE_IS_SIZETYPE(NODE) \
(INTEGER_TYPE_CHECK (NODE)->type.no_force_blk_flag) (INTEGER_TYPE_CHECK (NODE)->type.no_force_blk_flag)
/* In a FUNCTION_TYPE, indicates that the function returns with the stack
pointer depressed. */
#define TYPE_RETURNS_STACK_DEPRESSED(NODE) \
(FUNCTION_TYPE_CHECK (NODE)->type.no_force_blk_flag)
/* Nonzero in a type considered volatile as a whole. */ /* Nonzero in a type considered volatile as a whole. */
#define TYPE_VOLATILE(NODE) (TYPE_CHECK (NODE)->base.volatile_flag) #define TYPE_VOLATILE(NODE) (TYPE_CHECK (NODE)->base.volatile_flag)
...@@ -5002,14 +4997,11 @@ extern tree build_duplicate_type (tree); ...@@ -5002,14 +4997,11 @@ extern tree build_duplicate_type (tree);
/* Nonzero if this is a call to "pure" function (like const function, /* Nonzero if this is a call to "pure" function (like const function,
but may read memory. */ but may read memory. */
#define ECF_PURE 128 #define ECF_PURE 128
/* Nonzero if this is a call to a function that returns with the stack
pointer depressed. */
#define ECF_SP_DEPRESSED 256
/* Create libcall block around the call. */ /* Create libcall block around the call. */
#define ECF_LIBCALL_BLOCK 512 #define ECF_LIBCALL_BLOCK 256
/* Function does not read or write memory (but may have side effects, so /* Function does not read or write memory (but may have side effects, so
it does not necessarily fit ECF_CONST). */ it does not necessarily fit ECF_CONST). */
#define ECF_NOVOPS 1024 #define ECF_NOVOPS 512
extern int flags_from_decl_or_type (const_tree); extern int flags_from_decl_or_type (const_tree);
extern int call_expr_flags (const_tree); extern int call_expr_flags (const_tree);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment