diff options
author | Nathan Froyd <froydnj@codesourcery.com> | 2010-10-09 14:22:30 +0000 |
---|---|---|
committer | Nathan Froyd <froydnj@gcc.gnu.org> | 2010-10-09 14:22:30 +0000 |
commit | 9fb41e15f2a7cb10a3090971fa542c265e01bd44 (patch) | |
tree | 8e164fcf4d5e85c2f62fb53170970b2bf1be21c7 /gcc/config/mmix | |
parent | 8f8a46ba9264ba2e78c23ba1872c8be5dde0672f (diff) | |
download | gcc-9fb41e15f2a7cb10a3090971fa542c265e01bd44.zip gcc-9fb41e15f2a7cb10a3090971fa542c265e01bd44.tar.gz gcc-9fb41e15f2a7cb10a3090971fa542c265e01bd44.tar.bz2 |
mmix-protos.h (mmix_function_arg): Delete.
* config/mmix/mmix-protos.h (mmix_function_arg): Delete.
* config/mmix/mmix.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete.
* config/mmix/mmix.c (mmix_function_arg): Rename to...
(mmix_function_arg_1): ...this. Make static. Take a const_tree and
bool arguments.
(mmix_function_arg): New function.
(mmix_function_incoming_arg): New function.
(mmix_function_arg_advance): New function.
(TARGET_FUNCTION_ARG, TARGET_FUNCTION_INCOMING_ARG): Define.
(TARGET_FUNCTION_ARG_ADVANCE): Define.
From-SVN: r165230
Diffstat (limited to 'gcc/config/mmix')
-rw-r--r-- | gcc/config/mmix/mmix-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/mmix/mmix.c | 70 | ||||
-rw-r--r-- | gcc/config/mmix/mmix.h | 13 |
3 files changed, 59 insertions, 26 deletions
diff --git a/gcc/config/mmix/mmix-protos.h b/gcc/config/mmix/mmix-protos.h index d7e0a94..1f9cae0 100644 --- a/gcc/config/mmix/mmix-protos.h +++ b/gcc/config/mmix/mmix-protos.h @@ -59,8 +59,6 @@ extern void mmix_asm_output_aligned_common (FILE *, const char *, int, int); extern void mmix_asm_output_aligned_local (FILE *, const char *, int, int); extern void mmix_asm_declare_register_global (FILE *, tree, int, const char *); -extern rtx mmix_function_arg - (const CUMULATIVE_ARGS *, enum machine_mode, tree, int, int); extern void mmix_asm_output_addr_diff_elt (FILE *, rtx, int, int); extern void mmix_asm_output_addr_vec_elt (FILE *, int); extern enum reg_class mmix_preferred_reload_class (rtx, enum reg_class); diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 293a2f5..91fa1fb 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -143,6 +143,14 @@ static rtx mmix_struct_value_rtx (tree, int); static enum machine_mode mmix_promote_function_mode (const_tree, enum machine_mode, int *, const_tree, int); +static void mmix_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); +static rtx mmix_function_arg_1 (const CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool, bool); +static rtx mmix_function_incoming_arg (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); +static rtx mmix_function_arg (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); static rtx mmix_function_value (const_tree, const_tree, bool); static rtx mmix_libcall_value (enum machine_mode, const_rtx); static bool mmix_function_value_regno_p (const unsigned int); @@ -213,6 +221,12 @@ static void mmix_trampoline_init (rtx, tree, rtx); #undef TARGET_FUNCTION_VALUE_REGNO_P #define TARGET_FUNCTION_VALUE_REGNO_P mmix_function_value_regno_p +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG mmix_function_arg +#undef TARGET_FUNCTION_INCOMING_ARG +#define TARGET_FUNCTION_INCOMING_ARG mmix_function_incoming_arg +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE mmix_function_arg_advance #undef TARGET_STRUCT_VALUE_RTX #define TARGET_STRUCT_VALUE_RTX mmix_struct_value_rtx #undef TARGET_SETUP_INCOMING_VARARGS @@ -369,9 +383,9 @@ mmix_conditional_register_usage (void) Those two macros must only be applied to function argument registers. FIXME: for their current use in gcc, it'd be better with an explicit specific additional FUNCTION_INCOMING_ARG_REGNO_P - a'la FUNCTION_ARG / FUNCTION_INCOMING_ARG instead of forcing the - target to commit to a fixed mapping and for any unspecified - register use. */ + a'la TARGET_FUNCTION_ARG / TARGET_FUNCTION_INCOMING_ARG instead of + forcing the target to commit to a fixed mapping and for any + unspecified register use. */ int mmix_opposite_regno (int regno, int incoming) @@ -622,15 +636,28 @@ mmix_initial_elimination_offset (int fromreg, int toreg) + (fromreg == MMIX_ARG_POINTER_REGNUM ? 0 : 8); } -/* Return an rtx for a function argument to go in a register, and 0 for - one that must go on stack. */ +static void +mmix_function_arg_advance (CUMULATIVE_ARGS *argsp, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) +{ + int arg_size = MMIX_FUNCTION_ARG_SIZE (mode, type); -rtx -mmix_function_arg (const CUMULATIVE_ARGS *argsp, - enum machine_mode mode, - tree type, - int named ATTRIBUTE_UNUSED, - int incoming) + argsp->regs = ((targetm.calls.must_pass_in_stack (mode, type) + || (arg_size > 8 + && !TARGET_LIBFUNC + && !argsp->lib)) + ? (MMIX_MAX_ARGS_IN_REGS) + 1 + : argsp->regs + (7 + arg_size) / 8); +} + +/* Helper function for mmix_function_arg and mmix_function_incoming_arg. */ + +static rtx +mmix_function_arg_1 (const CUMULATIVE_ARGS *argsp, + enum machine_mode mode, + const_tree type, + bool named ATTRIBUTE_UNUSED, + bool incoming) { /* Last-argument marker. */ if (type == void_type_node) @@ -654,6 +681,27 @@ mmix_function_arg (const CUMULATIVE_ARGS *argsp, : NULL_RTX; } +/* Return an rtx for a function argument to go in a register, and 0 for + one that must go on stack. */ + +static rtx +mmix_function_arg (CUMULATIVE_ARGS *argsp, + enum machine_mode mode, + const_tree type, + bool named) +{ + return mmix_function_arg_1 (argsp, mode, type, named, false); +} + +static rtx +mmix_function_incoming_arg (CUMULATIVE_ARGS *argsp, + enum machine_mode mode, + const_tree type, + bool named) +{ + return mmix_function_arg_1 (argsp, mode, type, named, true); +} + /* Returns nonzero for everything that goes by reference, 0 for everything that goes by value. */ diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index b4fc856..02d0528 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -571,25 +571,12 @@ enum reg_class /* Node: Register Arguments */ -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ - mmix_function_arg (&(CUM), MODE, TYPE, NAMED, 0) - -#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \ - mmix_function_arg (&(CUM), MODE, TYPE, NAMED, 1) typedef struct { int regs; int lib; } CUMULATIVE_ARGS; #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ ((CUM).regs = 0, (CUM).lib = ((LIBNAME) != 0)) -#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ - ((CUM).regs \ - = ((targetm.calls.must_pass_in_stack (MODE, TYPE)) \ - || (MMIX_FUNCTION_ARG_SIZE (MODE, TYPE) > 8 \ - && !TARGET_LIBFUNC && !(CUM).lib)) \ - ? (MMIX_MAX_ARGS_IN_REGS) + 1 \ - : (CUM).regs + (7 + (MMIX_FUNCTION_ARG_SIZE (MODE, TYPE))) / 8) - #define FUNCTION_ARG_REGNO_P(REGNO) \ mmix_function_arg_regno_p (REGNO, 0) |