summaryrefslogtreecommitdiff
path: root/gcc/calls.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-30 03:08:18 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-30 03:08:18 +0000
commitf054eb3c16ec5aec863986d2e14a6174a77e3cd4 (patch)
tree89b8670b5e2c1cd0fc2446517dc71747b11ef273 /gcc/calls.c
parenta82e7476d0e47b303704defbc753529c02b4c563 (diff)
downloadgcc-f054eb3c16ec5aec863986d2e14a6174a77e3cd4.tar.gz
* target.h (targetm.calls.arg_partial_bytes): New.
* target-def.h (TARGET_ARG_PARTIAL_BYTES): New. * calls.c (store_unaligned_arguments_into_pseudos): Update for partial in bytes. (load_register_parameters): Likewise. (store_one_arg): Likewise. (initialize_argument_information): Use targetm.calls.arg_partial_bytes. (emit_library_call_value_1): Likewise. * expr.c (block_move_libcall_safe_for_call_parm): Likewise. (emit_push_insn): Update for partial in bytes. * expr.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * function.c (assign_parm_find_entry_rtl): Use targetm.calls.arg_partial_bytes. Update for result in bytes. (locate_and_pad_parm): Update for partial in bytes. * system.h (FUNCTION_ARG_PARTIAL_NREGS): Poison. * targhooks.c (hook_int_CUMULATIVE_ARGS_mode_tree_bool_0): New. * targhooks.h (hook_int_CUMULATIVE_ARGS_mode_tree_bool_0): Declare. * doc/tm.texi (TARGET_ARG_PARTIAL_BYTES): Rename and update from FUNCTION_ARG_PARTIAL_NREGS. * config/arc/arc.h, config/c4x/c4x.h, config/i386/i386.h, config/i860/i860.h, config/m68hc11/m68hc11.h, config/m68k/m68k.h, config/pdp11/pdp11.h, config/s390/s390.h, config/stormy16/stormy16.h, config/xtensa/xtensa.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/alpha/alpha.c (alpha_arg_partial_bytes): New. (TARGET_ARG_PARTIAL_BYTES): New. * config/alpha/alpha.h, config/alpha/unicosmk.h, config/alpha/vms.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/arm/arm.h (FUNCTION_ARG_PARTIAL_NREGS): Move ... * config/arm/arm.c (arm_arg_partial_bytes): ... here. (TARGET_ARG_PARTIAL_BYTES): New. * config/cris/cris.h (FUNCTION_ARG_PARTIAL_NREGS): Move ... * config/cris/cris.c (cris_arg_partial_bytes): ... here. (TARGET_ARG_PARTIAL_BYTES): New. * config/fr30/fr30.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/fr30/fr30.c (fr30_arg_partial_bytes): Rename from fr30_function_arg_partial_nregs. Adjust to return bytes. (TARGET_ARG_PARTIAL_BYTES): New. * config/fr30/fr30-protos.h: Update. * config/frv/frv.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/frv/frv.c (frv_arg_partial_bytes): Rename from frv_function_arg_partial_nregs. Adjust to return bytes. (TARGET_ARG_PARTIAL_BYTES): New. * config/frv/frv-protos.h: Update. * config/ia64/ia64.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/ia64/ia64.c (ia64_arg_partial_bytes): Rename from ia64_function_arg_partial_nregs. Adjust to return bytes. (TARGET_ARG_PARTIAL_BYTES): New. * config/ia64/ia64-protos.h: Update. * config/iq2000/iq2000.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/iq2000/iq2000.c (iq2000_arg_partial_bytes): Rename from function_arg_partial_nregs. Adjust to return bytes. (TARGET_ARG_PARTIAL_BYTES): New. * config/iq2000/iq2000-protos.h: Update. * config/m32r/m32r.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/m32r/m32r.c (m32r_arg_partial_bytes): Rename from function_arg_partial_nregs. Adjust to return bytes. (TARGET_ARG_PARTIAL_BYTES): New. * config/m32r/m32r-protos.h: Update. * config/mcore/mcore.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/mcore/mcore.c (mcore_arg_partial_bytes): Rename from mcore_function_arg_partial_nregs. Adjust to return bytes. (TARGET_ARG_PARTIAL_BYTES): New. * config/mcore/mcore-protos.h: Update. * config/mips/mips.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/mips/mips.c (mips_arg_partial_bytes): Rename from function_arg_partial_nregs. Adjust to return bytes. (TARGET_ARG_PARTIAL_BYTES): New. * config/mips/mips-protos.h: Update. * config/mn10300/mn10300.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/mn10300/mn10300.c (mn10300_arg_partial_bytes): Rename from function_arg_partial_nregs. Adjust to return bytes. (TARGET_ARG_PARTIAL_BYTES): New. * config/mn10300/mn10300-protos.h: Update. * config/ns32k/ns32k.h (FUNCTION_ARG_PARTIAL_NREGS): Move ... * config/ns32k/ns32k.c (ns32k_arg_partial_bytes): ... here. (TARGET_ARG_PARTIAL_BYTES): New. * config/pa/pa.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/pa/pa.c (pa_arg_partial_bytes): Rename from function_arg_partial_nregs. Handle 32-bit. Adjust to return bytes. (TARGET_ARG_PARTIAL_BYTES): New. * config/pa/pa-protos.h: Update. * config/rs6000/rs6000.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/rs6000/rs6000.c (rs6000_arg_partial_bytes): Rename from function_arg_partial_nregs. Adjust to return bytes. (TARGET_ARG_PARTIAL_BYTES): New. * config/rs6000/rs6000-protos.h: Update. * config/sh/sh.h (FUNCTION_ARG_PARTIAL_NREGS): Move ... * config/sh/sh.c (sh_arg_partial_bytes): ... here. (TARGET_ARG_PARTIAL_BYTES): New. * config/sparc/sparc.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/sparc/sparc.c (sparc_arg_partial_bytes): Rename from function_arg_partial_nregs. Adjust to return bytes. (TARGET_ARG_PARTIAL_BYTES): New. * config/sparc/sparc-protos.h: Update. * config/v850/v850.h (FUNCTION_ARG_PARTIAL_NREGS): Remove. * config/v850/v850.c (v850_arg_partial_bytes): Rename from function_arg_partial_nregs. Adjust to return bytes. (TARGET_ARG_PARTIAL_BYTES): New. * config/v850/v850-protos.h: Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92726 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/calls.c')
-rw-r--r--gcc/calls.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/gcc/calls.c b/gcc/calls.c
index 946e5bdf95d..0d0c0f26202 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -832,10 +832,19 @@ store_unaligned_arguments_into_pseudos (struct arg_data *args, int num_actuals)
< (unsigned int) MIN (BIGGEST_ALIGNMENT, BITS_PER_WORD)))
{
int bytes = int_size_in_bytes (TREE_TYPE (args[i].tree_value));
- int nregs = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
int endian_correction = 0;
- args[i].n_aligned_regs = args[i].partial ? args[i].partial : nregs;
+ if (args[i].partial)
+ {
+ gcc_assert (args[i].partial % UNITS_PER_WORD == 0);
+ args[i].n_aligned_regs = args[i].partial / UNITS_PER_WORD;
+ }
+ else
+ {
+ args[i].n_aligned_regs
+ = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
+ }
+
args[i].aligned_regs = xmalloc (sizeof (rtx) * args[i].n_aligned_regs);
/* Structures smaller than a word are normally aligned to the
@@ -973,7 +982,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
args[i].reg is nonzero if all or part is passed in registers.
args[i].partial is nonzero if part but not all is passed in registers,
- and the exact value says how many words are passed in registers.
+ and the exact value says how many bytes are passed in registers.
args[i].pass_on_stack is nonzero if the argument must at least be
computed on the stack. It may then be loaded back into registers
@@ -1079,8 +1088,8 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
if (args[i].reg)
args[i].partial
- = FUNCTION_ARG_PARTIAL_NREGS (*args_so_far, mode, type,
- argpos < n_named_args);
+ = targetm.calls.arg_partial_bytes (args_so_far, mode, type,
+ argpos < n_named_args);
args[i].pass_on_stack = targetm.calls.must_pass_in_stack (mode, type);
@@ -1454,8 +1463,13 @@ load_register_parameters (struct arg_data *args, int num_actuals,
we just use a normal move insn. This value can be zero if the
argument is a zero size structure with no fields. */
nregs = -1;
- if (partial)
- nregs = partial;
+ if (GET_CODE (reg) == PARALLEL)
+ ;
+ else if (partial)
+ {
+ gcc_assert (partial % UNITS_PER_WORD == 0);
+ nregs = partial / UNITS_PER_WORD;
+ }
else if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode)
{
size = int_size_in_bytes (TREE_TYPE (args[i].tree_value));
@@ -3286,7 +3300,6 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
if (mem_value && struct_value == 0 && ! pcc_struct_value)
{
rtx addr = XEXP (mem_value, 0);
- int partial;
nargs++;
@@ -3300,8 +3313,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
argvec[count].partial = 0;
argvec[count].reg = FUNCTION_ARG (args_so_far, Pmode, NULL_TREE, 1);
- partial = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, Pmode, NULL_TREE, 1);
- gcc_assert (!partial);
+ gcc_assert (targetm.calls.arg_partial_bytes (&args_so_far, Pmode,
+ NULL_TREE, 1) == 0);
locate_and_pad_parm (Pmode, NULL_TREE,
#ifdef STACK_PARMS_IN_REG_PARM_AREA
@@ -3387,7 +3400,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1);
argvec[count].partial
- = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, NULL_TREE, 1);
+ = targetm.calls.arg_partial_bytes (&args_so_far, mode, NULL_TREE, 1);
locate_and_pad_parm (mode, NULL_TREE,
#ifdef STACK_PARMS_IN_REG_PARM_AREA
@@ -4097,20 +4110,11 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags,
}
else
{
- /* PUSH_ROUNDING has no effect on us, because
- emit_push_insn for BLKmode is careful to avoid it. */
- if (reg && GET_CODE (reg) == PARALLEL)
- {
- /* Use the size of the elt to compute excess. */
- rtx elt = XEXP (XVECEXP (reg, 0, 0), 0);
- excess = (arg->locate.size.constant
- - int_size_in_bytes (TREE_TYPE (pval))
- + partial * GET_MODE_SIZE (GET_MODE (elt)));
- }
- else
- excess = (arg->locate.size.constant
- - int_size_in_bytes (TREE_TYPE (pval))
- + partial * UNITS_PER_WORD);
+ /* PUSH_ROUNDING has no effect on us, because emit_push_insn
+ for BLKmode is careful to avoid it. */
+ excess = (arg->locate.size.constant
+ - int_size_in_bytes (TREE_TYPE (pval))
+ + partial);
size_rtx = expand_expr (size_in_bytes (TREE_TYPE (pval)),
NULL_RTX, TYPE_MODE (sizetype), 0);
}