@@ -57,8 +57,6 @@ extern int spu_constant_address_p (rtx x);
extern int spu_legitimate_constant_p (rtx x);
extern int spu_initial_elimination_offset (int from, int to);
extern rtx spu_function_value (const_tree type, const_tree func);
-extern rtx spu_function_arg (int cum, enum machine_mode mode, tree type,
- int named);
extern void spu_setup_incoming_varargs (int *cum, enum machine_mode mode,
tree type, int *pretend_size,
int no_rtl);
@@ -188,6 +188,10 @@ static tree spu_handle_vector_attribute (tree * node, tree name, tree args,
static int spu_naked_function_p (tree func);
static bool spu_pass_by_reference (CUMULATIVE_ARGS *cum, enum machine_mode mode,
const_tree type, bool named);
+static rtx spu_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool named);
+static void spu_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool named);
static tree spu_build_builtin_va_list (void);
static void spu_va_start (tree, rtx);
static tree spu_gimplify_va_arg_expr (tree valist, tree type,
@@ -389,6 +393,12 @@ static const struct attribute_spec spu_attribute_table[] =
#undef TARGET_PASS_BY_REFERENCE
#define TARGET_PASS_BY_REFERENCE spu_pass_by_reference
+#undef TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG spu_function_arg
+
+#undef TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE spu_function_arg_advance
+
#undef TARGET_MUST_PASS_IN_STACK
#define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size
@@ -3986,10 +3996,10 @@ spu_function_value (const_tree type, const_tree func ATTRIBUTE_UNUSED)
return gen_rtx_REG (mode, FIRST_RETURN_REGNUM);
}
-rtx
-spu_function_arg (CUMULATIVE_ARGS cum,
+static rtx
+spu_function_arg (CUMULATIVE_ARGS *cum,
enum machine_mode mode,
- tree type, int named ATTRIBUTE_UNUSED)
+ const_tree type, bool named ATTRIBUTE_UNUSED)
{
int byte_size;
@@ -4022,6 +4032,19 @@ spu_function_arg (CUMULATIVE_ARGS cum,
return gen_rtx_REG (mode, FIRST_ARG_REGNUM + cum);
}
+static void
+spu_function_arg_advance (CUMULATIVE_ARGS * cum, enum machine_mode mode,
+ const_tree type, bool named ATTRIBUTE_UNUSED)
+{
+ *cum += (type && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
+ ? 1
+ : mode == BLKmode
+ ? ((int_size_in_bytes (type) + 15) / 16)
+ : mode == VOIDmode
+ ? 1
+ : HARD_REGNO_NREGS (cum, mode));
+}
+
/* Variable sized types are passed by reference. */
static bool
spu_pass_by_reference (CUMULATIVE_ARGS * cum ATTRIBUTE_UNUSED,
@@ -4230,7 +4253,7 @@ spu_setup_incoming_varargs (CUMULATIVE_ARGS * cum, enum machine_mode mode,
/* cum currently points to the last named argument, we want to
start at the next argument. */
- FUNCTION_ARG_ADVANCE (ncum, mode, type, 1);
+ spu_function_arg_advance (&ncum, mode, type, true);
offset = -STACK_POINTER_OFFSET;
for (regno = ncum; regno < MAX_REGISTER_ARGS; regno++)
@@ -337,22 +337,11 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \
/* Register Arguments */
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- (spu_function_arg((CUM),(MODE),(TYPE),(NAMED)))
-
#define CUMULATIVE_ARGS int
#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) \
((CUM) = 0)
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += \
- (TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST ? 1 \
- : (MODE) == BLKmode ? ((int_size_in_bytes(TYPE)+15) / 16) \
- : (MODE) == VOIDmode ? 1 \
- : HARD_REGNO_NREGS(CUM,MODE))
-
-
/* The SPU ABI wants 32/64-bit types at offset 0 in the quad-word on the
stack. 8/16-bit types should be at offsets 3/2 respectively. */
#define FUNCTION_ARG_OFFSET(MODE, TYPE) \