Message ID | 1286546318-17636-1-git-send-email-froydnj@codesourcery.com |
---|---|
State | New |
Headers | show |
Ok. "pdp11-aout" is a suitable test target. paul On Oct 8, 2010, at 9:58 AM, Nathan Froyd wrote: > The patch below hookizes FUNCTION_ARG and related macros for the pdp11 > backend. Nothing special here. > > Not entirely sure what target to use to test this, but the changes are > trivial. I plan to commit this under the obvious rule after waiting a > week for comments/approval. > > * config/pdp11/pdp11.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete. > * config/pdp11/pdp11.c (pdp11_function_arg): New function. > (pdp11_function_arg_advance): New function. > (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. > --- > gcc/config/pdp11/pdp11.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++ > gcc/config/pdp11/pdp11.h | 34 -------------------------------- > 2 files changed, 48 insertions(+), 34 deletions(-) > > diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c > index 2812e95..651b0cc 100644 > --- a/gcc/config/pdp11/pdp11.c > +++ b/gcc/config/pdp11/pdp11.c > @@ -157,6 +157,10 @@ static rtx pdp11_function_value (const_tree, const_tree, bool); > static rtx pdp11_libcall_value (enum machine_mode, const_rtx); > static bool pdp11_function_value_regno_p (const unsigned int); > static void pdp11_trampoline_init (rtx, tree, rtx); > +static rtx pdp11_function_arg (CUMULATIVE_ARGS *, enum machine_mode, > + const_tree, bool); > +static void pdp11_function_arg_advance (CUMULATIVE_ARGS *, > + enum machine_mode, const_tree, bool); > > /* Initialize the GCC target structure. */ > #undef TARGET_ASM_BYTE_OP > @@ -189,6 +193,11 @@ static void pdp11_trampoline_init (rtx, tree, rtx); > #undef TARGET_RTX_COSTS > #define TARGET_RTX_COSTS pdp11_rtx_costs > > +#undef TARGET_FUNCTION_ARG > +#define TARGET_FUNCTION_ARG pdp11_function_arg > +#undef TARGET_FUNCTION_ARG_ADVANCE > +#define TARGET_FUNCTION_ARG_ADVANCE pdp11_function_arg_advance > + > #undef TARGET_RETURN_IN_MEMORY > #define TARGET_RETURN_IN_MEMORY pdp11_return_in_memory > > @@ -1834,3 +1843,42 @@ pdp11_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) > emit_move_insn (mem, GEN_INT (0x0058)); > emit_move_insn (mem, fnaddr); > } > + > +/* Worker function for TARGET_FUNCTION_ARG. > + > + Determine where to put an argument to a function. > + Value is zero to push the argument on the stack, > + or a hard register in which to store the argument. > + > + MODE is the argument's machine mode. > + TYPE is the data type of the argument (as a tree). > + This is null for libcalls where that information may > + not be available. > + CUM is a variable of type CUMULATIVE_ARGS which gives info about > + the preceding args and about the function being called. > + NAMED is nonzero if this argument is a named parameter > + (otherwise it is an extra parameter matching an ellipsis). */ > + > +static rtx > +pdp11_function_arg (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED, > + enum machine_mode mode ATTRIBUTE_UNUSED, > + const_tree type ATTRIBUTE_UNUSED, > + bool named ATTRIBUTE_UNUSED) > +{ > + return NULL_RTX; > +} > + > +/* Worker function for TARGET_FUNCTION_ARG_ADVANCE. > + > + Update the data in CUM to advance over an argument of mode MODE and > + data type TYPE. (TYPE is null for libcalls where that information > + may not be available.) */ > + > +static void > +pdp11_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, > + const_tree type, bool named ATTRIBUTE_UNUSED) > +{ > + *cum += (mode != BLKmode > + ? GET_MODE_SIZE (mode) > + : int_size_in_bytes (type)); > +} > diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h > index a1a96a1..2904acd 100644 > --- a/gcc/config/pdp11/pdp11.h > +++ b/gcc/config/pdp11/pdp11.h > @@ -468,40 +468,6 @@ extern int current_first_parm_offset; > #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ > ((CUM) = 0) > > -/* Update the data in CUM to advance over an argument > - of mode MODE and data type TYPE. > - (TYPE is null for libcalls where that information may not be available.) > - > -*/ > - > - > -#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ > - ((CUM) += ((MODE) != BLKmode \ > - ? (GET_MODE_SIZE (MODE)) \ > - : (int_size_in_bytes (TYPE)))) > - > -/* Determine where to put an argument to a function. > - Value is zero to push the argument on the stack, > - or a hard register in which to store the argument. > - > - MODE is the argument's machine mode. > - TYPE is the data type of the argument (as a tree). > - This is null for libcalls where that information may > - not be available. > - CUM is a variable of type CUMULATIVE_ARGS which gives info about > - the preceding args and about the function being called. > - NAMED is nonzero if this argument is a named parameter > - (otherwise it is an extra parameter matching an ellipsis). */ > - > -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0 > - > -/* Define where a function finds its arguments. > - This would be different from FUNCTION_ARG if we had register windows. */ > -/* > -#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \ > - FUNCTION_ARG (CUM, MODE, TYPE, NAMED) > -*/ > - > /* Output assembler code to FILE to increment profiler label # LABELNO > for profiling a function entry. */ > > -- > 1.7.0.4 >
diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index 2812e95..651b0cc 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -157,6 +157,10 @@ static rtx pdp11_function_value (const_tree, const_tree, bool); static rtx pdp11_libcall_value (enum machine_mode, const_rtx); static bool pdp11_function_value_regno_p (const unsigned int); static void pdp11_trampoline_init (rtx, tree, rtx); +static rtx pdp11_function_arg (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); +static void pdp11_function_arg_advance (CUMULATIVE_ARGS *, + enum machine_mode, const_tree, bool); /* Initialize the GCC target structure. */ #undef TARGET_ASM_BYTE_OP @@ -189,6 +193,11 @@ static void pdp11_trampoline_init (rtx, tree, rtx); #undef TARGET_RTX_COSTS #define TARGET_RTX_COSTS pdp11_rtx_costs +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG pdp11_function_arg +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE pdp11_function_arg_advance + #undef TARGET_RETURN_IN_MEMORY #define TARGET_RETURN_IN_MEMORY pdp11_return_in_memory @@ -1834,3 +1843,42 @@ pdp11_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) emit_move_insn (mem, GEN_INT (0x0058)); emit_move_insn (mem, fnaddr); } + +/* Worker function for TARGET_FUNCTION_ARG. + + Determine where to put an argument to a function. + Value is zero to push the argument on the stack, + or a hard register in which to store the argument. + + MODE is the argument's machine mode. + TYPE is the data type of the argument (as a tree). + This is null for libcalls where that information may + not be available. + CUM is a variable of type CUMULATIVE_ARGS which gives info about + the preceding args and about the function being called. + NAMED is nonzero if this argument is a named parameter + (otherwise it is an extra parameter matching an ellipsis). */ + +static rtx +pdp11_function_arg (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED, + const_tree type ATTRIBUTE_UNUSED, + bool named ATTRIBUTE_UNUSED) +{ + return NULL_RTX; +} + +/* Worker function for TARGET_FUNCTION_ARG_ADVANCE. + + Update the data in CUM to advance over an argument of mode MODE and + data type TYPE. (TYPE is null for libcalls where that information + may not be available.) */ + +static void +pdp11_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) +{ + *cum += (mode != BLKmode + ? GET_MODE_SIZE (mode) + : int_size_in_bytes (type)); +} diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h index a1a96a1..2904acd 100644 --- a/gcc/config/pdp11/pdp11.h +++ b/gcc/config/pdp11/pdp11.h @@ -468,40 +468,6 @@ extern int current_first_parm_offset; #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ ((CUM) = 0) -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) - -*/ - - -#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ - ((CUM) += ((MODE) != BLKmode \ - ? (GET_MODE_SIZE (MODE)) \ - : (int_size_in_bytes (TYPE)))) - -/* Determine where to put an argument to a function. - Value is zero to push the argument on the stack, - or a hard register in which to store the argument. - - MODE is the argument's machine mode. - TYPE is the data type of the argument (as a tree). - This is null for libcalls where that information may - not be available. - CUM is a variable of type CUMULATIVE_ARGS which gives info about - the preceding args and about the function being called. - NAMED is nonzero if this argument is a named parameter - (otherwise it is an extra parameter matching an ellipsis). */ - -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0 - -/* Define where a function finds its arguments. - This would be different from FUNCTION_ARG if we had register windows. */ -/* -#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \ - FUNCTION_ARG (CUM, MODE, TYPE, NAMED) -*/ - /* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */