diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-09 10:10:51 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-09 10:10:51 +0000 |
commit | d30e852f058c20a1609f047792c744aa7e213ac0 (patch) | |
tree | 52d2484e446a11e350b6e175d02c37c6b7d5c719 /gcc/config/v850 | |
parent | a98995ea9dfbfc607ee53cd96a7db99e0c6923f7 (diff) | |
download | gcc-d30e852f058c20a1609f047792c744aa7e213ac0.tar.gz |
* config/v850/v850-protos.h (v850_va_arg): Remove.
* config/v850/v850.c (TARGET_GIMPLIFY_VA_ARG_EXPR): New.
(v850_gimplify_va_arg_expr): Rewrite from v850_va_arg.
* config/v850/v850.h (EXPAND_BUILTIN_VA_ARG): Remove.
(FUNCTION_ARG_PASS_BY_REFERENCE): Handle variable size types.
(FUNCTION_ARG_CALLEE_COPIES): Use FUNCTION_ARG_PASS_BY_REFERENCE.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84359 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/v850')
-rw-r--r-- | gcc/config/v850/v850-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/v850/v850.c | 46 | ||||
-rw-r--r-- | gcc/config/v850/v850.h | 8 |
3 files changed, 12 insertions, 43 deletions
diff --git a/gcc/config/v850/v850-protos.h b/gcc/config/v850/v850-protos.h index 5355f88181a..d20f50b50d1 100644 --- a/gcc/config/v850/v850-protos.h +++ b/gcc/config/v850/v850-protos.h @@ -70,7 +70,6 @@ extern int pattern_is_ok_for_epilogue (rtx, Mmode); extern int register_is_ok_for_epilogue (rtx, Mmode); #ifdef TREE_CODE extern rtx function_arg (CUMULATIVE_ARGS *, Mmode, tree, int); -extern rtx v850_va_arg (tree, tree); #endif #endif #endif /* TREE_CODE */ diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 063a3fe5c77..5a8c89ff49f 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -67,6 +67,7 @@ static void v850_encode_section_info (tree, rtx, int); static bool v850_return_in_memory (tree, tree); static void v850_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int); +static tree v850_gimplify_va_arg_expr (tree, tree, tree *, tree *); /* Information about the various small memory areas. */ struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] = @@ -132,6 +133,9 @@ static int v850_interrupt_p = FALSE; #undef TARGET_SETUP_INCOMING_VARARGS #define TARGET_SETUP_INCOMING_VARARGS v850_setup_incoming_varargs +#undef TARGET_GIMPLIFY_VA_ARG_EXPR +#define TARGET_GIMPLIFY_VA_ARG_EXPR v850_gimplify_va_arg_expr + struct gcc_target targetm = TARGET_INITIALIZER; /* Sometimes certain combinations of command options do not make @@ -3306,43 +3310,13 @@ construct_prepare_instruction (rtx op) /* Implement `va_arg'. */ -rtx -v850_va_arg (tree valist, tree type) +static tree +v850_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) { - HOST_WIDE_INT size, rsize; - tree addr, incr; - rtx addr_rtx; - int indirect; - - /* Round up sizeof(type) to a word. */ - size = int_size_in_bytes (type); - rsize = (size + UNITS_PER_WORD - 1) & -UNITS_PER_WORD; - indirect = 0; - - if (size > 8) - { - size = rsize = UNITS_PER_WORD; - indirect = 1; - } - - addr = save_expr (valist); - incr = fold (build (PLUS_EXPR, ptr_type_node, addr, - build_int_2 (rsize, 0))); - - incr = build (MODIFY_EXPR, ptr_type_node, valist, incr); - TREE_SIDE_EFFECTS (incr) = 1; - expand_expr (incr, const0_rtx, VOIDmode, EXPAND_NORMAL); - - addr_rtx = expand_expr (addr, NULL, Pmode, EXPAND_NORMAL); - - if (indirect) - { - addr_rtx = force_reg (Pmode, addr_rtx); - addr_rtx = gen_rtx_MEM (Pmode, addr_rtx); - set_mem_alias_set (addr_rtx, get_varargs_alias_set ()); - } - - return addr_rtx; + if (FUNCTION_ARG_PASS_BY_REFERENCE (dummy, TYPE_MODE (type), type, 0)) + 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); } /* Return an RTX indicating where the return address to the diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 6f3282184d7..9a34a50a5af 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -773,15 +773,11 @@ struct cum_arg { int nbytes; int anonymous_args; }; space allocated by the caller. */ #define OUTGOING_REG_PARM_STACK_SPACE -/* Implement `va_arg'. */ -#define EXPAND_BUILTIN_VA_ARG(valist, type) \ - v850_va_arg (valist, type) - #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ - ((TYPE) && int_size_in_bytes (TYPE) > 8) + ((TYPE) && (unsigned HOST_WIDE_INT) int_size_in_bytes (TYPE) > 8) #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \ - ((TYPE) && int_size_in_bytes (TYPE) > 8) + FUNCTION_ARG_PASS_BY_REFERENCE (CUM, MODE, TYPE, NAMED) /* 1 if N is a possible register number for function argument passing. */ |