parent
f133a43eab
commit
f725a3ec9b
|
@ -1,3 +1,7 @@
|
|||
2000-09-06 Kazu Hirata <kazu@hxi.com>
|
||||
|
||||
* calls.c: Fix formatting.
|
||||
|
||||
2000-09-06 Graham Stott <grahams@cygnus.co.uk>
|
||||
|
||||
* config/i386/i386.h (ADDRESS_COST): Fix typo.
|
||||
|
|
158
gcc/calls.c
158
gcc/calls.c
|
@ -163,11 +163,11 @@ int stack_arg_under_construction;
|
|||
static int calls_function PARAMS ((tree, int));
|
||||
static int calls_function_1 PARAMS ((tree, int));
|
||||
|
||||
/* Nonzero if this is a call to a `const' function. */
|
||||
/* Nonzero if this is a call to a `const' function. */
|
||||
#define ECF_CONST 1
|
||||
/* Nonzero if this is a call to a `volatile' function. */
|
||||
#define ECF_NORETURN 2
|
||||
/* Nonzero if this is a call to malloc or a related function. */
|
||||
/* Nonzero if this is a call to malloc or a related function. */
|
||||
#define ECF_MALLOC 4
|
||||
/* Nonzero if it is plausible that this is a call to alloca. */
|
||||
#define ECF_MAY_BE_ALLOCA 8
|
||||
|
@ -473,7 +473,7 @@ emit_call_1 (funexp, fndecl, funtype, stack_size, rounded_stack_size,
|
|||
if ((ecf_flags & ECF_SIBCALL)
|
||||
&& HAVE_sibcall_pop && HAVE_sibcall_value_pop
|
||||
&& (RETURN_POPS_ARGS (fndecl, funtype, stack_size) > 0
|
||||
|| stack_size == 0))
|
||||
|| stack_size == 0))
|
||||
{
|
||||
rtx n_pop = GEN_INT (RETURN_POPS_ARGS (fndecl, funtype, stack_size));
|
||||
rtx pat;
|
||||
|
@ -757,7 +757,7 @@ special_function_p (fndecl, flags)
|
|||
it may return the same address across multiple calls.
|
||||
C++ operator new is not suitable because it is not required
|
||||
to return a unique pointer; indeed, the standard placement new
|
||||
just returns its argument. */
|
||||
just returns its argument. */
|
||||
else if (TYPE_MODE (TREE_TYPE (TREE_TYPE (fndecl))) == Pmode
|
||||
&& (! strcmp (tname, "malloc")
|
||||
|| ! strcmp (tname, "calloc")
|
||||
|
@ -808,7 +808,6 @@ flags_from_decl_or_type (exp)
|
|||
return flags;
|
||||
}
|
||||
|
||||
|
||||
/* Precompute all register parameters as described by ARGS, storing values
|
||||
into fields within the ARGS array.
|
||||
|
||||
|
@ -915,7 +914,7 @@ save_fixed_argument_area (reg_parm_stack_space, argblock,
|
|||
|
||||
/* If we don't have the required alignment, must do this in BLKmode. */
|
||||
if ((*low_to_save & (MIN (GET_MODE_SIZE (save_mode),
|
||||
BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1)))
|
||||
BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1)))
|
||||
save_mode = BLKmode;
|
||||
|
||||
#ifdef ARGS_GROW_DOWNWARD
|
||||
|
@ -1184,7 +1183,7 @@ initialize_argument_information (num_actuals, args, args_size, n_named_args,
|
|||
but it is safe in the only case where this is a useful
|
||||
optimization; namely, when the argument is a plain object.
|
||||
In that case, the frontend is just asking the backend to
|
||||
make a bitwise copy of the argument. */
|
||||
make a bitwise copy of the argument. */
|
||||
|
||||
if (TREE_CODE (args[i].tree_value) == TARGET_EXPR
|
||||
&& (DECL_P (TREE_OPERAND (args[i].tree_value, 1)))
|
||||
|
@ -1254,7 +1253,7 @@ initialize_argument_information (num_actuals, args, args_size, n_named_args,
|
|||
register window has to be unwinded before calling the routine, so
|
||||
arguments have to go into the incoming registers. */
|
||||
args[i].tail_call_reg = FUNCTION_INCOMING_ARG (*args_so_far, mode, type,
|
||||
argpos < n_named_args);
|
||||
argpos < n_named_args);
|
||||
#else
|
||||
args[i].tail_call_reg = args[i].reg;
|
||||
#endif
|
||||
|
@ -1349,7 +1348,7 @@ initialize_argument_information (num_actuals, args, args_size, n_named_args,
|
|||
|
||||
static int
|
||||
compute_argument_block_size (reg_parm_stack_space, args_size,
|
||||
preferred_stack_boundary)
|
||||
preferred_stack_boundary)
|
||||
int reg_parm_stack_space;
|
||||
struct args_size *args_size;
|
||||
int preferred_stack_boundary ATTRIBUTE_UNUSED;
|
||||
|
@ -1381,7 +1380,7 @@ compute_argument_block_size (reg_parm_stack_space, args_size,
|
|||
to add the delta, round and substract the delta.
|
||||
Currently no machine description requires this support. */
|
||||
if (stack_pointer_delta & (preferred_stack_boundary - 1))
|
||||
abort();
|
||||
abort ();
|
||||
args_size->var = round_up (args_size->var, preferred_stack_boundary);
|
||||
}
|
||||
#endif
|
||||
|
@ -1436,9 +1435,9 @@ compute_argument_block_size (reg_parm_stack_space, args_size,
|
|||
|
||||
NUM_ACTUALS is the number of arguments.
|
||||
|
||||
ARGS is an array containing information for each argument; this routine
|
||||
fills in the INITIAL_VALUE and VALUE fields for each precomputed argument.
|
||||
*/
|
||||
ARGS is an array containing information for each argument; this
|
||||
routine fills in the INITIAL_VALUE and VALUE fields for each
|
||||
precomputed argument. */
|
||||
|
||||
static void
|
||||
precompute_arguments (flags, num_actuals, args)
|
||||
|
@ -1667,8 +1666,8 @@ rtx_for_function_call (fndecl, exp)
|
|||
rtx funaddr;
|
||||
push_temp_slots ();
|
||||
funaddr = funexp =
|
||||
expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
|
||||
pop_temp_slots (); /* FUNEXP can't be BLKmode */
|
||||
expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
|
||||
pop_temp_slots (); /* FUNEXP can't be BLKmode. */
|
||||
|
||||
/* Check the function is executable. */
|
||||
if (current_function_check_memory_usage)
|
||||
|
@ -1676,8 +1675,8 @@ rtx_for_function_call (fndecl, exp)
|
|||
#ifdef POINTERS_EXTEND_UNSIGNED
|
||||
/* It might be OK to convert funexp in place, but there's
|
||||
a lot going on between here and when it happens naturally
|
||||
that this seems safer. */
|
||||
funaddr = convert_memory_address (Pmode, funexp);
|
||||
that this seems safer. */
|
||||
funaddr = convert_memory_address (Pmode, funexp);
|
||||
#endif
|
||||
emit_library_call (chkr_check_exec_libfunc, 1,
|
||||
VOIDmode, 1,
|
||||
|
@ -1931,9 +1930,9 @@ combine_pending_stack_adjustment_and_call (unadjusted_args_size,
|
|||
if (preferred_unit_stack_boundary > 1)
|
||||
{
|
||||
if (unadjusted_alignment >= 0)
|
||||
adjustment -= preferred_unit_stack_boundary - unadjusted_alignment;
|
||||
adjustment -= preferred_unit_stack_boundary - unadjusted_alignment;
|
||||
else
|
||||
adjustment += unadjusted_alignment;
|
||||
adjustment += unadjusted_alignment;
|
||||
}
|
||||
|
||||
/* Now, sets ARGS_SIZE->CONSTANT so that we pop the right number of
|
||||
|
@ -1990,24 +1989,23 @@ check_sibcall_argument_overlap_1 (x)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Scan all subexpressions. */
|
||||
/* Scan all subexpressions. */
|
||||
fmt = GET_RTX_FORMAT (code);
|
||||
for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
|
||||
{
|
||||
if (*fmt == 'e')
|
||||
{
|
||||
if (check_sibcall_argument_overlap_1 (XEXP (x, i)))
|
||||
return 1;
|
||||
}
|
||||
{
|
||||
if (check_sibcall_argument_overlap_1 (XEXP (x, i)))
|
||||
return 1;
|
||||
}
|
||||
else if (*fmt == 'E')
|
||||
{
|
||||
for (j = 0; j < XVECLEN (x, i); j++)
|
||||
if (check_sibcall_argument_overlap_1 (XVECEXP (x, i, j)))
|
||||
return 1;
|
||||
}
|
||||
{
|
||||
for (j = 0; j < XVECLEN (x, i); j++)
|
||||
if (check_sibcall_argument_overlap_1 (XVECEXP (x, i, j)))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/* Scan sequence after INSN if it does not dereference any argument slots
|
||||
|
@ -2029,8 +2027,8 @@ check_sibcall_argument_overlap (insn, arg)
|
|||
insn = NEXT_INSN (insn);
|
||||
|
||||
for (; insn; insn = NEXT_INSN (insn))
|
||||
if (INSN_P (insn) &&
|
||||
check_sibcall_argument_overlap_1 (PATTERN (insn)))
|
||||
if (INSN_P (insn)
|
||||
&& check_sibcall_argument_overlap_1 (PATTERN (insn)))
|
||||
break;
|
||||
|
||||
#ifdef ARGS_GROW_DOWNWARD
|
||||
|
@ -2213,7 +2211,7 @@ expand_call (exp, target, ignore)
|
|||
&& TYPE_RETURNS_STACK_DEPRESSED (TREE_TYPE (TREE_TYPE (p))))
|
||||
{
|
||||
flags |= ECF_SP_DEPRESSED;
|
||||
flags &= ~ (ECF_PURE | ECF_CONST);
|
||||
flags &= ~(ECF_PURE | ECF_CONST);
|
||||
}
|
||||
|
||||
#ifdef REG_PARM_STACK_SPACE
|
||||
|
@ -2377,10 +2375,8 @@ expand_call (exp, target, ignore)
|
|||
or not. */
|
||||
INIT_CUMULATIVE_ARGS (args_so_far, funtype, NULL_RTX, (fndecl == 0));
|
||||
|
||||
|
||||
/* Make a vector to hold all the information about each arg. */
|
||||
args = (struct arg_data *) alloca (num_actuals
|
||||
* sizeof (struct arg_data));
|
||||
args = (struct arg_data *) alloca (num_actuals * sizeof (struct arg_data));
|
||||
bzero ((char *) args, num_actuals * sizeof (struct arg_data));
|
||||
|
||||
/* Build up entries inthe ARGS array, compute the size of the arguments
|
||||
|
@ -2505,7 +2501,7 @@ expand_call (exp, target, ignore)
|
|||
end = num_actuals;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
inc = -1;
|
||||
i = num_actuals - 1;
|
||||
end = -1;
|
||||
|
@ -2515,26 +2511,26 @@ expand_call (exp, target, ignore)
|
|||
{
|
||||
switch (unsafe_for_reeval (args[i].tree_value))
|
||||
{
|
||||
case 0: /* Safe. */
|
||||
break;
|
||||
case 0: /* Safe. */
|
||||
break;
|
||||
|
||||
case 1: /* Mildly unsafe. */
|
||||
args[i].tree_value = unsave_expr (args[i].tree_value);
|
||||
break;
|
||||
case 1: /* Mildly unsafe. */
|
||||
args[i].tree_value = unsave_expr (args[i].tree_value);
|
||||
break;
|
||||
|
||||
case 2: /* Wildly unsafe. */
|
||||
{
|
||||
tree var = build_decl (VAR_DECL, NULL_TREE,
|
||||
case 2: /* Wildly unsafe. */
|
||||
{
|
||||
tree var = build_decl (VAR_DECL, NULL_TREE,
|
||||
TREE_TYPE (args[i].tree_value));
|
||||
DECL_RTL (var) = expand_expr (args[i].tree_value, NULL_RTX,
|
||||
VOIDmode, EXPAND_NORMAL);
|
||||
VOIDmode, EXPAND_NORMAL);
|
||||
args[i].tree_value = var;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
/* We need to build actparms for optimize_tail_recursion. We can
|
||||
safely trash away TREE_PURPOSE, since it is unused by this
|
||||
function. */
|
||||
|
@ -2681,7 +2677,6 @@ expand_call (exp, target, ignore)
|
|||
temporaries we make. */
|
||||
push_temp_slots ();
|
||||
|
||||
|
||||
#ifdef FINAL_REG_PARM_STACK_SPACE
|
||||
reg_parm_stack_space = FINAL_REG_PARM_STACK_SPACE (args_size.constant,
|
||||
args_size.var);
|
||||
|
@ -2702,11 +2697,12 @@ expand_call (exp, target, ignore)
|
|||
pattern, do not round up, since we'll be re-using whatever space our
|
||||
caller provided. */
|
||||
unadjusted_args_size
|
||||
= compute_argument_block_size (reg_parm_stack_space, &adjusted_args_size,
|
||||
= compute_argument_block_size (reg_parm_stack_space,
|
||||
&adjusted_args_size,
|
||||
(pass == 0 ? 0
|
||||
: preferred_stack_boundary));
|
||||
|
||||
old_stack_allocated = stack_pointer_delta - pending_stack_adjust;
|
||||
old_stack_allocated = stack_pointer_delta - pending_stack_adjust;
|
||||
|
||||
/* The argument block when performing a sibling call is the
|
||||
incoming argument block. */
|
||||
|
@ -2798,10 +2794,10 @@ expand_call (exp, target, ignore)
|
|||
/* The address of the outgoing argument list must not be
|
||||
copied to a register here, because argblock would be left
|
||||
pointing to the wrong place after the call to
|
||||
allocate_dynamic_stack_space below. */
|
||||
allocate_dynamic_stack_space below. */
|
||||
|
||||
argblock = virtual_outgoing_args_rtx;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inhibit_defer_pop == 0)
|
||||
|
@ -3015,7 +3011,7 @@ expand_call (exp, target, ignore)
|
|||
passed in registers. */
|
||||
#ifdef OUTGOING_REG_PARM_STACK_SPACE
|
||||
if (!ACCUMULATE_OUTGOING_ARGS
|
||||
&& must_preallocate == 0 && reg_parm_stack_space > 0)
|
||||
&& must_preallocate == 0 && reg_parm_stack_space > 0)
|
||||
anti_adjust_stack (GEN_INT (reg_parm_stack_space));
|
||||
#endif
|
||||
|
||||
|
@ -3082,8 +3078,8 @@ expand_call (exp, target, ignore)
|
|||
|
||||
/* Verify that we've deallocated all the stack we used. */
|
||||
if (pass
|
||||
&& old_stack_allocated != stack_pointer_delta - pending_stack_adjust)
|
||||
abort();
|
||||
&& old_stack_allocated != stack_pointer_delta - pending_stack_adjust)
|
||||
abort ();
|
||||
|
||||
/* If call is cse'able, make appropriate pair of reg-notes around it.
|
||||
Test valreg so we don't crash; may safely ignore `const'
|
||||
|
@ -3133,7 +3129,7 @@ expand_call (exp, target, ignore)
|
|||
rtx temp = gen_reg_rtx (GET_MODE (valreg));
|
||||
rtx last, insns;
|
||||
|
||||
/* The return value from a malloc-like function is a pointer. */
|
||||
/* The return value from a malloc-like function is a pointer. */
|
||||
if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE)
|
||||
mark_reg_pointer (temp, BIGGEST_ALIGNMENT);
|
||||
|
||||
|
@ -3372,7 +3368,7 @@ expand_call (exp, target, ignore)
|
|||
stack_pointer_delta = save_stack_pointer_delta;
|
||||
|
||||
/* Prepare arg structure for next iteration. */
|
||||
for (i = 0 ; i < num_actuals ; i++)
|
||||
for (i = 0; i < num_actuals; i++)
|
||||
{
|
||||
args[i].value = 0;
|
||||
args[i].aligned_regs = 0;
|
||||
|
@ -3391,7 +3387,7 @@ expand_call (exp, target, ignore)
|
|||
function who's expansion contains another CALL_PLACEHOLDER.
|
||||
|
||||
If there are any C_Ps in any of these sequences, replace them
|
||||
with their normal call. */
|
||||
with their normal call. */
|
||||
|
||||
for (insn = normal_call_insns; insn; insn = NEXT_INSN (insn))
|
||||
if (GET_CODE (insn) == CALL_INSN
|
||||
|
@ -3485,8 +3481,16 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p)
|
|||
struct args_size alignment_pad;
|
||||
rtx argblock = 0;
|
||||
CUMULATIVE_ARGS args_so_far;
|
||||
struct arg { rtx value; enum machine_mode mode; rtx reg; int partial;
|
||||
struct args_size offset; struct args_size size; rtx save_area; };
|
||||
struct arg
|
||||
{
|
||||
rtx value;
|
||||
enum machine_mode mode;
|
||||
rtx reg;
|
||||
int partial;
|
||||
struct args_size offset;
|
||||
struct args_size size;
|
||||
rtx save_area;
|
||||
};
|
||||
struct arg *argvec;
|
||||
int old_inhibit_defer_pop = inhibit_defer_pop;
|
||||
rtx call_fusage = 0;
|
||||
|
@ -3502,7 +3506,7 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p)
|
|||
/* Define the boundary of the register parm stack space that needs to be
|
||||
save, if any. */
|
||||
int low_to_save = -1, high_to_save = 0;
|
||||
rtx save_area = 0; /* Place that it is saved */
|
||||
rtx save_area = 0; /* Place that it is saved. */
|
||||
#endif
|
||||
|
||||
/* Size of the stack reserved for parameter registers. */
|
||||
|
@ -3614,7 +3618,6 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p)
|
|||
NULL_TREE, &args_size, &argvec[count].offset,
|
||||
&argvec[count].size, &alignment_pad);
|
||||
|
||||
|
||||
if (argvec[count].reg == 0 || argvec[count].partial != 0
|
||||
|| reg_parm_stack_space > 0)
|
||||
args_size.constant += argvec[count].size.constant;
|
||||
|
@ -3676,7 +3679,7 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p)
|
|||
|
||||
locate_and_pad_parm (mode, NULL_TREE,
|
||||
#ifdef STACK_PARMS_IN_REG_PARM_AREA
|
||||
1,
|
||||
1,
|
||||
#else
|
||||
argvec[count].reg != 0,
|
||||
#endif
|
||||
|
@ -3767,8 +3770,7 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p)
|
|||
|
||||
/* The address of the outgoing argument list must not be copied to a
|
||||
register here, because argblock would be left pointing to the
|
||||
wrong place after the call to allocate_dynamic_stack_space below.
|
||||
*/
|
||||
wrong place after the call to allocate_dynamic_stack_space below. */
|
||||
|
||||
argblock = virtual_outgoing_args_rtx;
|
||||
}
|
||||
|
@ -3812,7 +3814,7 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p)
|
|||
for (count = 0; count < reg_parm_stack_space; count++)
|
||||
#endif
|
||||
{
|
||||
if (count >= highest_outgoing_arg_in_use
|
||||
if (count >= highest_outgoing_arg_in_use
|
||||
|| stack_usage_map[count] == 0)
|
||||
continue;
|
||||
|
||||
|
@ -3838,7 +3840,7 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p)
|
|||
stack_area = gen_rtx_MEM (save_mode,
|
||||
memory_address (save_mode,
|
||||
plus_constant (argblock,
|
||||
- high_to_save)));
|
||||
-high_to_save)));
|
||||
#else
|
||||
stack_area = gen_rtx_MEM (save_mode,
|
||||
memory_address (save_mode,
|
||||
|
@ -3899,7 +3901,7 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p)
|
|||
if (i != upper_bound)
|
||||
{
|
||||
/* We need to make a save area. See what mode we can make
|
||||
it. */
|
||||
it. */
|
||||
enum machine_mode save_mode
|
||||
= mode_for_size (argvec[argnum].size.constant
|
||||
* BITS_PER_UNIT,
|
||||
|
@ -3985,7 +3987,7 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p)
|
|||
force_operand (XEXP (mem_value, 0),
|
||||
NULL_RTX)));
|
||||
if (GET_CODE (struct_value_rtx) == REG)
|
||||
use_reg (&call_fusage, struct_value_rtx);
|
||||
use_reg (&call_fusage, struct_value_rtx);
|
||||
}
|
||||
|
||||
/* Don't allow popping to be deferred, since then
|
||||
|
@ -3997,7 +3999,7 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p)
|
|||
#ifdef PREFERRED_STACK_BOUNDARY
|
||||
/* Stack must be properly aligned now. */
|
||||
if (stack_pointer_delta & (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT - 1))
|
||||
abort();
|
||||
abort ();
|
||||
#endif
|
||||
|
||||
/* We pass the old value of inhibit_defer_pop + 1 to emit_call_1, which
|
||||
|
@ -4008,10 +4010,10 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p)
|
|||
no impact, so we pretend it is unknown. */
|
||||
|
||||
emit_call_1 (fun,
|
||||
get_identifier (XSTR (orgfun, 0)),
|
||||
get_identifier (XSTR (orgfun, 0)),
|
||||
build_function_type (outmode == VOIDmode ? void_type_node
|
||||
: type_for_mode (outmode, 0), NULL_TREE),
|
||||
original_args_size.constant, args_size.constant,
|
||||
original_args_size.constant, args_size.constant,
|
||||
struct_value_size,
|
||||
FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
|
||||
valreg,
|
||||
|
@ -4261,8 +4263,7 @@ target_for_arg (type, size, args_addr, offset)
|
|||
zero otherwise. */
|
||||
|
||||
static int
|
||||
store_one_arg (arg, argblock, flags, variable_size,
|
||||
reg_parm_stack_space)
|
||||
store_one_arg (arg, argblock, flags, variable_size, reg_parm_stack_space)
|
||||
struct arg_data *arg;
|
||||
rtx argblock;
|
||||
int flags;
|
||||
|
@ -4532,7 +4533,6 @@ store_one_arg (arg, argblock, flags, variable_size,
|
|||
ARGS_SIZE_RTX (arg->alignment_pad));
|
||||
}
|
||||
|
||||
|
||||
/* Unless this is a partially-in-register argument, the argument is now
|
||||
in the stack.
|
||||
|
||||
|
|
Loading…
Reference in New Issue