Commit 09e2bf48 by Jan Hubicka Committed by Jan Hubicka

calls.c (rtx_for_function_call): Take the address as an argument

	* calls.c (rtx_for_function_call): Take the address as an argument
	(expand_call): Do not modify the expression.

From-SVN: r63725
parent f7da1e9a
Mon Mar 3 19:07:21 CET 2003 Jan Hubicka <jh@suse.cz> Mon Mar 3 19:07:21 CET 2003 Jan Hubicka <jh@suse.cz>
* calls.c (rtx_for_function_call): Take the address as an argument
(expand_call): Do not modify the expression.
* toplev.c (rest_of_compilation): Avoid cfg_cleanup calls when not * toplev.c (rest_of_compilation): Avoid cfg_cleanup calls when not
optimizing. optimizing.
......
...@@ -1663,12 +1663,12 @@ compute_argument_addresses (args, argblock, num_actuals) ...@@ -1663,12 +1663,12 @@ compute_argument_addresses (args, argblock, num_actuals)
FNDECL is the tree node for the target function. For an indirect call FNDECL is the tree node for the target function. For an indirect call
FNDECL will be NULL_TREE. FNDECL will be NULL_TREE.
EXP is the CALL_EXPR for this call. */ ADDR is the operand 0 of CALL_EXPR for this call. */
static rtx static rtx
rtx_for_function_call (fndecl, exp) rtx_for_function_call (fndecl, addr)
tree fndecl; tree fndecl;
tree exp; tree addr;
{ {
rtx funexp; rtx funexp;
...@@ -1690,7 +1690,7 @@ rtx_for_function_call (fndecl, exp) ...@@ -1690,7 +1690,7 @@ rtx_for_function_call (fndecl, exp)
/* Generate an rtx (probably a pseudo-register) for the address. */ /* Generate an rtx (probably a pseudo-register) for the address. */
{ {
push_temp_slots (); push_temp_slots ();
funexp = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0); funexp = expand_expr (addr, NULL_RTX, VOIDmode, 0);
pop_temp_slots (); /* FUNEXP can't be BLKmode. */ pop_temp_slots (); /* FUNEXP can't be BLKmode. */
emit_queue (); emit_queue ();
} }
...@@ -2212,6 +2212,7 @@ expand_call (exp, target, ignore) ...@@ -2212,6 +2212,7 @@ expand_call (exp, target, ignore)
int old_stack_allocated; int old_stack_allocated;
rtx call_fusage; rtx call_fusage;
tree p = TREE_OPERAND (exp, 0); tree p = TREE_OPERAND (exp, 0);
tree addr = TREE_OPERAND (exp, 0);
int i; int i;
/* The alignment of the stack, in bits. */ /* The alignment of the stack, in bits. */
HOST_WIDE_INT preferred_stack_boundary; HOST_WIDE_INT preferred_stack_boundary;
...@@ -2343,7 +2344,7 @@ expand_call (exp, target, ignore) ...@@ -2343,7 +2344,7 @@ expand_call (exp, target, ignore)
preferred_stack_boundary = PREFERRED_STACK_BOUNDARY; preferred_stack_boundary = PREFERRED_STACK_BOUNDARY;
/* Operand 0 is a pointer-to-function; get the type of the function. */ /* Operand 0 is a pointer-to-function; get the type of the function. */
funtype = TREE_TYPE (TREE_OPERAND (exp, 0)); funtype = TREE_TYPE (addr);
if (! POINTER_TYPE_P (funtype)) if (! POINTER_TYPE_P (funtype))
abort (); abort ();
funtype = TREE_TYPE (funtype); funtype = TREE_TYPE (funtype);
...@@ -2480,8 +2481,8 @@ expand_call (exp, target, ignore) ...@@ -2480,8 +2481,8 @@ expand_call (exp, target, ignore)
/* Tail recursion fails, when we are not dealing with recursive calls. */ /* Tail recursion fails, when we are not dealing with recursive calls. */
if (!try_tail_recursion if (!try_tail_recursion
|| TREE_CODE (TREE_OPERAND (exp, 0)) != ADDR_EXPR || TREE_CODE (addr) != ADDR_EXPR
|| TREE_OPERAND (TREE_OPERAND (exp, 0), 0) != current_function_decl) || TREE_OPERAND (addr, 0) != current_function_decl)
try_tail_recursion = 0; try_tail_recursion = 0;
/* Rest of purposes for tail call optimizations to fail. */ /* Rest of purposes for tail call optimizations to fail. */
...@@ -2503,7 +2504,7 @@ expand_call (exp, target, ignore) ...@@ -2503,7 +2504,7 @@ expand_call (exp, target, ignore)
/* Functions that do not return exactly once may not be sibcall /* Functions that do not return exactly once may not be sibcall
optimized. */ optimized. */
|| (flags & (ECF_RETURNS_TWICE | ECF_LONGJMP | ECF_NORETURN)) || (flags & (ECF_RETURNS_TWICE | ECF_LONGJMP | ECF_NORETURN))
|| TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0)))) || TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (addr)))
/* If this function requires more stack slots than the current /* If this function requires more stack slots than the current
function, we cannot change it into a sibling call. */ function, we cannot change it into a sibling call. */
|| args_size.constant > current_function_args_size || args_size.constant > current_function_args_size
...@@ -2558,7 +2559,7 @@ expand_call (exp, target, ignore) ...@@ -2558,7 +2559,7 @@ expand_call (exp, target, ignore)
} }
/* Do the same for the function address if it is an expression. */ /* Do the same for the function address if it is an expression. */
if (!fndecl) if (!fndecl)
TREE_OPERAND (exp, 0) = fix_unsafe_tree (TREE_OPERAND (exp, 0)); addr = fix_unsafe_tree (addr);
/* Expanding one of those dangerous arguments could have added /* Expanding one of those dangerous arguments could have added
cleanups, but otherwise give it a whirl. */ cleanups, but otherwise give it a whirl. */
if (any_pending_cleanups (1)) if (any_pending_cleanups (1))
...@@ -2949,7 +2950,7 @@ expand_call (exp, target, ignore) ...@@ -2949,7 +2950,7 @@ expand_call (exp, target, ignore)
be deferred during the evaluation of the arguments. */ be deferred during the evaluation of the arguments. */
NO_DEFER_POP; NO_DEFER_POP;
funexp = rtx_for_function_call (fndecl, exp); funexp = rtx_for_function_call (fndecl, addr);
/* Figure out the register where the value, if any, will come back. */ /* Figure out the register where the value, if any, will come back. */
valreg = 0; valreg = 0;
......
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