* config/arm/arm.h (EXPAND_BUILTIN_VA_ARG,
FUNCTION_ARG_PASS_BY_REFERENCE): Define.
* config/arm/arm.c (arm_va_arg,
arm_function_arg_pass_by_reference): New.
* config/arm/arm-protos.h: Add prototypes.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59127
138bc75d-0d04-0410-961f-
82ee72b054a4
+2002-11-14 Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com>
+
+ * config/arm/arm.h (EXPAND_BUILTIN_VA_ARG,
+ FUNCTION_ARG_PASS_BY_REFERENCE): Define.
+ * config/arm/arm.c (arm_va_arg,
+ arm_function_arg_pass_by_reference): New.
+ * config/arm/arm-protos.h: Add prototypes.
+
2002-11-14 Kazu Hirata <kazu@cs.umass.edu>
* gthr-single.h: Fix formatting.
extern int arm_function_ok_for_sibcall PARAMS ((tree));
#endif
#ifdef RTX_CODE
-extern int arm_hard_regno_mode_ok PARAMS ((unsigned int, enum machine_mode));
+extern int arm_hard_regno_mode_ok PARAMS ((unsigned int,
+ enum machine_mode));
extern int const_ok_for_arm PARAMS ((HOST_WIDE_INT));
extern int arm_split_constant PARAMS ((RTX_CODE, enum machine_mode,
HOST_WIDE_INT, rtx, rtx, int));
extern const char * output_mov_immediate PARAMS ((rtx *));
extern const char * output_add_immediate PARAMS ((rtx *));
extern const char * arithmetic_instr PARAMS ((rtx, int));
-extern void output_ascii_pseudo_op PARAMS ((FILE *, const unsigned char *, int));
+extern void output_ascii_pseudo_op PARAMS ((FILE *, const unsigned char *,
+ int));
extern const char * output_return_instruction PARAMS ((rtx, int, int));
extern void arm_poke_function_name PARAMS ((FILE *, const char *));
extern void arm_print_operand PARAMS ((FILE *, rtx, int));
enum machine_mode, tree, int));
extern void arm_init_cumulative_args PARAMS ((CUMULATIVE_ARGS *, tree, rtx,
int));
+extern rtx arm_va_arg PARAMS ((tree, tree));
+extern int arm_function_arg_pass_by_reference PARAMS ((CUMULATIVE_ARGS *,
+ enum machine_mode,
+ tree, int));
+
#endif
#if defined AOF_ASSEMBLER
return gen_rtx_REG (mode, pcum->nregs);
}
+
+/* Variable sized types are passed by reference. This is a GCC
+ extension to the ARM ABI. */
+
+int
+arm_function_arg_pass_by_reference (cum, mode, type, named)
+ CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
+ tree type;
+ int named ATTRIBUTE_UNUSED;
+{
+ return type && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST;
+}
+
+/* Implement va_arg. */
+
+rtx
+arm_va_arg (valist, type)
+ tree valist, type;
+{
+ /* Variable sized types are passed by reference. */
+ if (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
+ {
+ rtx addr = std_expand_builtin_va_arg (valist, build_pointer_type (type));
+ return gen_rtx_MEM (ptr_mode, force_reg (Pmode, addr));
+ }
+
+ return std_expand_builtin_va_arg (valist, type);
+}
\f
/* Encode the current state of the #pragma [no_]long_calls. */
typedef enum
&& (NUM_ARG_REGS < ((CUM).nregs + ARM_NUM_REGS2 (MODE, TYPE))) \
? NUM_ARG_REGS - (CUM).nregs : 0)
+/* A C expression that indicates when an argument must be passed by
+ reference. If nonzero for an argument, a copy of that argument is
+ made in memory and a pointer to the argument is passed instead of
+ the argument itself. The pointer is passed in whatever way is
+ appropriate for passing a pointer to that type. */
+#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
+ arm_function_arg_pass_by_reference (&CUM, MODE, TYPE, NAMED)
+
/* Initialize a variable CUM of type CUMULATIVE_ARGS
for a call to a function whose data type is FNTYPE.
For a library call, FNTYPE is 0.
On the ARM, r0-r3 are used to pass args. */
#define FUNCTION_ARG_REGNO_P(REGNO) (IN_RANGE ((REGNO), 0, 3))
+/* Implement `va_arg'. */
+#define EXPAND_BUILTIN_VA_ARG(valist, type) \
+ arm_va_arg (valist, type)
+
\f
/* Tail calling. */