* config/alpha/alpha.c (alpha_gimplify_va_arg_1): Move indirect ...
(alpha_gimplify_va_arg): ... handling here. Use pass_by_reference.
* config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Use pass_by_reference.
* config/i386/i386.c (ix86_gimplify_va_arg): Likewise.
* config/i860/i860.c (i860_gimplify_va_arg_expr): Likewise.
* config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise.
* config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise.
* config/sh/sh.c (sh_gimplify_va_arg_expr): Likewise.
* config/xtensa/xtensa.c (xtensa_gimplify_va_arg_expr): Likewise.
From-SVN: r84713
+2004-07-14 Richard Henderson <rth@redhat.com>
+
+ * config/alpha/alpha.c (alpha_gimplify_va_arg_1): Move indirect ...
+ (alpha_gimplify_va_arg): ... handling here. Use pass_by_reference.
+ * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Use pass_by_reference.
+ * config/i386/i386.c (ix86_gimplify_va_arg): Likewise.
+ * config/i860/i860.c (i860_gimplify_va_arg_expr): Likewise.
+ * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise.
+ * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise.
+ * config/sh/sh.c (sh_gimplify_va_arg_expr): Likewise.
+ * config/xtensa/xtensa.c (xtensa_gimplify_va_arg_expr): Likewise.
+
2004-07-14 Mike Stump <mrs@apple.com>
* config/darwin.h (WINT_TYPE): Define to be int to match
alpha_gimplify_va_arg_1 (tree type, tree base, tree offset, tree *pre_p)
{
tree type_size, ptr_type, addend, t, addr, internal_post;
- bool indirect;
/* If the type could not be passed in registers, skip the block
reserved for the registers. */
addend = offset;
ptr_type = build_pointer_type (type);
- indirect = false;
- if (TYPE_MODE (type) == TFmode || TYPE_MODE (type) == TCmode)
- {
- type = ptr_type;
- ptr_type = build_pointer_type (type);
- indirect = true;
- }
- else if (TREE_CODE (type) == COMPLEX_TYPE)
+ if (TREE_CODE (type) == COMPLEX_TYPE)
{
tree real_part, imag_part, real_temp;
/* Build the final address and force that value into a temporary. */
addr = build (PLUS_EXPR, ptr_type, fold_convert (ptr_type, base),
fold_convert (ptr_type, addend));
- if (indirect)
- addr = build (INDIRECT_REF, type, addr);
internal_post = NULL;
gimplify_expr (&addr, pre_p, &internal_post, is_gimple_val, fb_rvalue);
append_to_statement_list (internal_post, pre_p);
alpha_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
{
tree offset_field, base_field, offset, base, t, r;
+ bool indirect;
if (TARGET_ABI_OPEN_VMS || TARGET_ABI_UNICOSMK)
return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
t = fold_convert (lang_hooks.types.type_for_size (64, 0), offset_field);
offset = get_initialized_tmp_var (t, pre_p, NULL);
+ indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ if (indirect)
+ type = build_pointer_type (type);
+
/* Find the value. Note that this will be a stable indirection, or
a composite of stable indirections in the case of complex. */
r = alpha_gimplify_va_arg_1 (type, base, offset, pre_p);
fold_convert (TREE_TYPE (offset_field), offset));
gimplify_and_add (t, pre_p);
+ if (indirect)
+ r = build_fold_indirect_ref (r);
+
return r;
}
\f
tree *post_p ATTRIBUTE_UNUSED)
{
tree t;
+ bool indirect;
+
+ indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ if (indirect)
+ type = build_pointer_type (type);
t = build (PREDECREMENT_EXPR, TREE_TYPE (valist), valist,
build_int_2 (int_size_in_bytes (type), 0));
t = fold_convert (build_pointer_type (type), t);
t = build_fold_indirect_ref (t);
+ if (indirect)
+ t = build_fold_indirect_ref (t);
+
return t;
}
ovf = build (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE);
sav = build (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE);
+ indirect_p = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ if (indirect_p)
+ type = build_pointer_type (type);
size = int_size_in_bytes (type);
- if (size == -1)
- {
- /* Variable-size types are passed by reference. */
- indirect_p = 1;
- type = build_pointer_type (type);
- size = int_size_in_bytes (type);
- }
rsize = (size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
container = construct_container (TYPE_MODE (type), type, 0,
tree size, t, u, addr, type_ptr;
tree reg, n_reg, sav_ofs, lim_reg;
HOST_WIDE_INT isize;
+ bool indirect;
#ifdef I860_SVR4_VA_LIST
f_gpr = TYPE_FIELDS (va_list_type_node);
mem = build (COMPONENT_REF, TREE_TYPE (f_mem), valist, f_mem, NULL_TREE);
sav = build (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE);
+ indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ if (indirect)
+ type = build_pointer_type (type);
size = size_in_bytes (type);
type_ptr = build_pointer_type (type);
}
addr = fold_convert (type_ptr, addr);
+ if (indirect)
+ addr = build_fold_indirect_ref (addr);
return build_fold_indirect_ref (addr);
}
ia64_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
{
/* Variable sized types are passed by reference. */
- if (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
+ if (pass_by_reference (NULL, TYPE_MODE (type), type, false))
{
tree ptrtype = build_pointer_type (type);
tree addr = std_gimplify_va_arg_expr (valist, ptrtype, pre_p, post_p);
{
tree f_gpr, f_fpr, f_res, f_ovf, f_sav;
tree gpr, fpr, ovf, sav, reg, t, u;
- int indirect_p, size, rsize, n_reg, sav_ofs, sav_scale;
+ int size, rsize, n_reg, sav_ofs, sav_scale;
tree lab_false, lab_over, addr;
int align;
tree ptrtype = build_pointer_type (type);
+ if (pass_by_reference (NULL, TYPE_MODE (type), type, false))
+ {
+ t = rs6000_gimplify_va_arg (valist, ptrtype, pre_p, post_p);
+ return build_fold_indirect_ref (t);
+ }
+
if (DEFAULT_ABI != ABI_V4)
{
- /* Variable sized types are passed by reference, as are AltiVec
- vectors when 32-bit and not using the AltiVec ABI extension. */
- if (int_size_in_bytes (type) < 0
- || (TARGET_32BIT
- && !TARGET_ALTIVEC_ABI
- && ALTIVEC_VECTOR_MODE (TYPE_MODE (type))))
- {
- /* Args grow upward. */
- t = build2 (POSTINCREMENT_EXPR, TREE_TYPE (valist), valist,
- size_int (POINTER_SIZE / BITS_PER_UNIT));
- t = build1 (NOP_EXPR, build_pointer_type (ptrtype), t);
- t = build_fold_indirect_ref (t);
- return build_fold_indirect_ref (t);
- }
- if (targetm.calls.split_complex_arg
- && TREE_CODE (type) == COMPLEX_TYPE)
+ if (targetm.calls.split_complex_arg && TREE_CODE (type) == COMPLEX_TYPE)
{
tree elem_type = TREE_TYPE (type);
enum machine_mode elem_mode = TYPE_MODE (elem_type);
rsize = (size + 3) / 4;
align = 1;
- if (AGGREGATE_TYPE_P (type)
- || TYPE_MODE (type) == TFmode
- || (!TARGET_ALTIVEC_ABI && ALTIVEC_VECTOR_MODE (TYPE_MODE (type))))
- {
- /* Aggregates, long doubles, and AltiVec vectors are passed by
- reference. */
- indirect_p = 1;
- reg = gpr;
- n_reg = 1;
- sav_ofs = 0;
- sav_scale = 4;
- size = 4;
- rsize = 1;
- }
- else if (TARGET_HARD_FLOAT && TARGET_FPRS
- && (TYPE_MODE (type) == SFmode || TYPE_MODE (type) == DFmode))
+ if (TARGET_HARD_FLOAT && TARGET_FPRS
+ && (TYPE_MODE (type) == SFmode || TYPE_MODE (type) == DFmode))
{
/* FP args go in FP registers, if present. */
- indirect_p = 0;
reg = fpr;
n_reg = 1;
sav_ofs = 8*4;
else
{
/* Otherwise into GP registers. */
- indirect_p = 0;
reg = gpr;
n_reg = rsize;
sav_ofs = 0;
append_to_statement_list (t, pre_p);
}
- if (indirect_p)
- {
- addr = fold_convert (build_pointer_type (ptrtype), addr);
- addr = build_fold_indirect_ref (addr);
- }
- else
- addr = fold_convert (ptrtype, addr);
-
+ addr = fold_convert (ptrtype, addr);
return build_fold_indirect_ref (addr);
}
HOST_WIDE_INT size, rsize;
tree tmp, pptr_type_node;
tree addr, lab_over, result = NULL;
- int pass_by_ref = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
+ int pass_by_ref = pass_by_reference (NULL, TYPE_MODE (type), type, false);
if (pass_by_ref)
type = build_pointer_type (type);
tree f_ndx, ndx;
tree type_size, array, orig_ndx, addr, size, va_size, t;
tree lab_false, lab_over, lab_false2;
+ bool indirect;
+
+ indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ if (indirect)
+ type = build_pointer_type (type);
/* Handle complex values as separate real and imaginary parts. */
if (TREE_CODE (type) == COMPLEX_TYPE)
addr = build (MINUS_EXPR, ptr_type_node, addr, t);
addr = fold_convert (build_pointer_type (type), addr);
+ if (indirect)
+ addr = build_fold_indirect_ref (addr);
return build_fold_indirect_ref (addr);
}