summaryrefslogtreecommitdiff
path: root/gcc/config/fr30
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-08 22:38:18 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-08 22:38:18 +0000
commitf48ac6551329833c376450dc03fd48796f2e68bd (patch)
tree42761e0c704092139a0253655c7a3ee0a0ff76f0 /gcc/config/fr30
parent4592df6bea44cadd44224dc4fa159c3bd47f859f (diff)
downloadgcc-f48ac6551329833c376450dc03fd48796f2e68bd.tar.gz
* config/fr30/fr30-protos.h (fr30_va_arg): Remove.
* config/fr30/fr30.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New. (fr30_gimplify_va_arg_expr): New. (fr30_pass_by_reference, fr30_pass_by_value, fr30_va_arg): Remove. * config/fr30/fr30.h (EXPAND_BUILTIN_VA_ARG): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84322 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/fr30')
-rw-r--r--gcc/config/fr30/fr30-protos.h1
-rw-r--r--gcc/config/fr30/fr30.c76
-rw-r--r--gcc/config/fr30/fr30.h4
3 files changed, 9 insertions, 72 deletions
diff --git a/gcc/config/fr30/fr30-protos.h b/gcc/config/fr30/fr30-protos.h
index 8f8f585cd76..781c36bb9e0 100644
--- a/gcc/config/fr30/fr30-protos.h
+++ b/gcc/config/fr30/fr30-protos.h
@@ -28,7 +28,6 @@ extern void fr30_print_operand (FILE *, rtx, int);
extern void fr30_print_operand_address (FILE *, rtx);
extern rtx fr30_move_double (rtx *);
#ifdef TREE_CODE
-extern rtx fr30_va_arg (tree, tree);
extern int fr30_num_arg_regs (enum machine_mode, tree);
extern int fr30_function_arg_partial_nregs (CUMULATIVE_ARGS,
enum machine_mode, tree, int);
diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c
index 5e11b6330f8..d0213d27651 100644
--- a/gcc/config/fr30/fr30.c
+++ b/gcc/config/fr30/fr30.c
@@ -123,8 +123,7 @@ static struct fr30_frame_info zero_frame_info;
static void fr30_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
tree, int *, int);
-static rtx fr30_pass_by_reference (tree, tree);
-static rtx fr30_pass_by_value (tree, tree);
+static tree fr30_gimplify_va_arg_expr (tree, tree, tree *, tree *);
#define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM))
#define RETURN_POINTER_MASK (1 << (RETURN_POINTER_REGNUM))
@@ -156,6 +155,8 @@ static rtx fr30_pass_by_value (tree, tree);
#undef TARGET_SETUP_INCOMING_VARARGS
#define TARGET_SETUP_INCOMING_VARARGS fr30_setup_incoming_varargs
+#undef TARGET_GIMPLIFY_VA_ARG_EXPR
+#define TARGET_GIMPLIFY_VA_ARG_EXPR fr30_gimplify_va_arg_expr
struct gcc_target targetm = TARGET_INITIALIZER;
@@ -712,74 +713,15 @@ fr30_function_arg_partial_nregs (CUMULATIVE_ARGS cum, enum machine_mode mode,
return FR30_NUM_ARG_REGS - cum;
}
-static rtx
-fr30_pass_by_reference (tree valist, tree type)
-{
- tree type_ptr;
- tree type_ptr_ptr;
- tree t;
-
- type_ptr = build_pointer_type (type);
- type_ptr_ptr = build_pointer_type (type_ptr);
-
- t = build (POSTINCREMENT_EXPR, va_list_type_node, valist, build_int_2 (UNITS_PER_WORD, 0));
- TREE_SIDE_EFFECTS (t) = 1;
- t = build1 (NOP_EXPR, type_ptr_ptr, t);
- TREE_SIDE_EFFECTS (t) = 1;
- t = build1 (INDIRECT_REF, type_ptr, t);
-
- return expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL);
-}
-
-static rtx
-fr30_pass_by_value (tree valist, tree type)
-{
- HOST_WIDE_INT size = int_size_in_bytes (type);
- HOST_WIDE_INT rsize;
- rtx addr_rtx;
- tree t;
-
- if ((size % UNITS_PER_WORD) == 0)
- {
- t = build (POSTINCREMENT_EXPR, va_list_type_node, valist, build_int_2 (size, 0));
- TREE_SIDE_EFFECTS (t) = 1;
-
- return expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL);
- }
-
- rsize = (size + UNITS_PER_WORD - 1) & - UNITS_PER_WORD;
-
- /* Care for bigendian correction on the aligned address. */
- t = build (PLUS_EXPR, ptr_type_node, valist, build_int_2 (rsize - size, 0));
- addr_rtx = expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL);
- addr_rtx = copy_to_reg (addr_rtx);
-
- /* Increment AP. */
- t = build (PLUS_EXPR, va_list_type_node, valist, build_int_2 (rsize, 0));
- t = build (MODIFY_EXPR, va_list_type_node, valist, t);
- TREE_SIDE_EFFECTS (t) = 1;
- expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
- return addr_rtx;
-}
-
/* Implement `va_arg'. */
-rtx
-fr30_va_arg (tree valist, tree type)
+static tree
+fr30_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
{
- HOST_WIDE_INT size;
-
- if (AGGREGATE_TYPE_P (type))
- return fr30_pass_by_reference (valist, type);
-
- size = int_size_in_bytes (type);
-
- if ((size % sizeof (int)) == 0
- || size < 4)
- return fr30_pass_by_value (valist, type);
-
- return fr30_pass_by_reference (valist, type);
+ if (FUNCTION_ARG_PASS_BY_REFERENCE (dummy, TYPE_MODE (type), type, dummy))
+ return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p);
+ else
+ return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
}
/*}}}*/
diff --git a/gcc/config/fr30/fr30.h b/gcc/config/fr30/fr30.h
index 81b5f1f9bc5..1260075e3bb 100644
--- a/gcc/config/fr30/fr30.h
+++ b/gcc/config/fr30/fr30.h
@@ -648,10 +648,6 @@ enum reg_class
takes a fixed number of arguments. */
#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
-/* Implement `va_arg'. */
-#define EXPAND_BUILTIN_VA_ARG(valist, type) \
- fr30_va_arg (valist, type)
-
/*}}}*/
/*{{{ Function Arguments in Registers. */