2010-10-28 Nathan Froyd <froydnj@codesourcery.com>
+ * config/fr30/fr30-protos.h (fr30_num_arg_regs): Delete.
+ * config/fr30/fr30.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete.
+ * config/fr30/fr30.c (fr30_num_arg_regs): Make static. Take a
+ const_tree.
+ (fr30_function_arg): New function.
+ (fr30_function_arg_advance): New function.
+ (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define.
+
+2010-10-28 Nathan Froyd <froydnj@codesourcery.com>
+
* config/frv/frv-protos.h (frv_function_arg): Delete.
(frv_function_arg_advance): Delete.
* config/frv/frv.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete.
static bool fr30_must_pass_in_stack (enum machine_mode, const_tree);
static int fr30_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
+static rtx fr30_function_arg (CUMULATIVE_ARGS *, enum machine_mode,
+ const_tree, bool);
+static void fr30_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
+ const_tree, bool);
static bool fr30_frame_pointer_required (void);
static bool fr30_can_eliminate (const int, const int);
static void fr30_asm_trampoline_template (FILE *);
static void fr30_trampoline_init (rtx, tree, rtx);
+static int fr30_num_arg_regs (enum machine_mode, const_tree);
#define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM))
#define RETURN_POINTER_MASK (1 << (RETURN_POINTER_REGNUM))
#define TARGET_PASS_BY_REFERENCE hook_pass_by_reference_must_pass_in_stack
#undef TARGET_ARG_PARTIAL_BYTES
#define TARGET_ARG_PARTIAL_BYTES fr30_arg_partial_bytes
+#undef TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG fr30_function_arg
+#undef TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE fr30_function_arg_advance
#undef TARGET_SETUP_INCOMING_VARARGS
#define TARGET_SETUP_INCOMING_VARARGS fr30_setup_incoming_varargs
/* Compute the number of word sized registers needed to hold a
function argument of mode INT_MODE and tree type TYPE. */
-int
-fr30_num_arg_regs (enum machine_mode mode, tree type)
+static int
+fr30_num_arg_regs (enum machine_mode mode, const_tree type)
{
int size;
return (FR30_NUM_ARG_REGS - *cum) * UNITS_PER_WORD;
}
+static rtx
+fr30_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool named)
+{
+ if (!named
+ || fr30_must_pass_in_stack (mode, type)
+ || *cum >= FR30_NUM_ARG_REGS)
+ return NULL_RTX;
+ else
+ return gen_rtx_REG (mode, *cum + FIRST_ARG_REGNUM);
+}
+
+/* A C statement (sans semicolon) to update the summarizer variable CUM to
+ advance past an argument in the argument list. The values MODE, TYPE and
+ NAMED describe that argument. Once this is done, the variable CUM is
+ suitable for analyzing the *following* argument with `FUNCTION_ARG', etc.
+
+ This macro need not do anything if the argument in question was passed on
+ the stack. The compiler knows how to track the amount of stack space used
+ for arguments without any special help. */
+static void
+fr30_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool named)
+{
+ *cum += named * fr30_num_arg_regs (mode, type);
+}
+
/*}}}*/
/*{{{ Operand predicates */
#define FR30_NUM_ARG_REGS 4
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- ( (NAMED) == 0 ? NULL_RTX \
- : targetm.calls.must_pass_in_stack (MODE, TYPE) ? NULL_RTX \
- : (CUM) >= FR30_NUM_ARG_REGS ? NULL_RTX \
- : gen_rtx_REG (MODE, CUM + FIRST_ARG_REGNUM))
-
/* A C type for declaring a variable that is used as the first argument of
`FUNCTION_ARG' and other related values. For some target machines, the type
`int' suffices and can hold the number of bytes of argument so far.
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
(CUM) = 0
-/* A C statement (sans semicolon) to update the summarizer variable CUM to
- advance past an argument in the argument list. The values MODE, TYPE and
- NAMED describe that argument. Once this is done, the variable CUM is
- suitable for analyzing the *following* argument with `FUNCTION_ARG', etc.
-
- This macro need not do anything if the argument in question was passed on
- the stack. The compiler knows how to track the amount of stack space used
- for arguments without any special help. */
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- (CUM) += (NAMED) * fr30_num_arg_regs (MODE, TYPE)
-
/* A C expression that is nonzero if REGNO is the number of a hard register in
which function arguments are sometimes passed. This does *not* include
implicit arguments such as the static chain and the structure-value address.