From patchwork Mon Aug 30 19:32:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [score] hookize FUNCTION_ARG &co. Date: Mon, 30 Aug 2010 09:32:50 -0000 From: Nathan Froyd X-Patchwork-Id: 63124 Message-Id: <20100830193250.GL16898@codesourcery.com> To: gcc-patches@gcc.gnu.org The patch below hookizes FUNCTION_ARG and related macros for the score backend. Nothing unusual, just a little more work due to the score3/score7 split. Tested with score-elf and checking generated assembly before/after. I plan to commit this patch under the obvious rule after waiting for a week for comments. (Apparently the score port does not have a maintainer?) -Nathan * config/score/score-protos.h (score_function_arg): Delete. (score_function_arg_advance): Delete. * config/score/score3.h (score3_function_arg_advance): Take a const_tree and a bool. (score3_function_arg): Likewise. * config/score/score7.h (score7_function_arg_advance): Likewise. (score7_function_arg): Likewise. * config/score/score3.c (score3_classify_arg): Likewise. (score3_function_arg_advance, score3_function_arg): Likewise. * config/score/score7.c (score7_classify_arg): Likewise. (score7_function_arg_advance, score7_function_arg): Likewise. * config/score/score.c (score_function_arg_advance): Likewise. (score_function_arg): Likewise. De-const-ify `cum' argument. (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. diff --git a/gcc/config/score/score-protos.h b/gcc/config/score/score-protos.h index d42ec14..9721c4a 100644 --- a/gcc/config/score/score-protos.h +++ b/gcc/config/score/score-protos.h @@ -39,9 +39,6 @@ extern bool score_unaligned_load (rtx* ops); extern bool score_unaligned_store (rtx* ops); extern bool score_block_move (rtx* ops); extern int score_address_cost (rtx addr, bool speed); -extern rtx score_function_arg (const CUMULATIVE_ARGS *cum, - enum machine_mode mode, - tree type, int named); extern int score_address_p (enum machine_mode mode, rtx x, int strict); extern int score_reg_class (int regno); extern int score_register_move_cost (enum machine_mode mode, enum reg_class to, @@ -51,9 +48,6 @@ extern int score_const_ok_for_letter_p (HOST_WIDE_INT value, char c); extern int score_extra_constraint (rtx op, char c); extern rtx score_return_addr (int count, rtx frame); extern int score_regno_mode_ok_for_base_p (int regno, int strict); -extern void score_function_arg_advance (CUMULATIVE_ARGS *cum, - enum machine_mode mode, - tree type, int named); extern void score_init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, rtx libname); extern void score_declare_object (FILE *stream, const char *name, diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c index e7e5600..20558a3 100644 --- a/gcc/config/score/score.c +++ b/gcc/config/score/score.c @@ -101,6 +101,12 @@ #undef TARGET_ARG_PARTIAL_BYTES #define TARGET_ARG_PARTIAL_BYTES score_arg_partial_bytes +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG score_function_arg + +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE score_function_arg_advance + #undef TARGET_PASS_BY_REFERENCE #define TARGET_PASS_BY_REFERENCE score_pass_by_reference @@ -475,10 +481,10 @@ score_init_cumulative_args (CUMULATIVE_ARGS *cum, memset (cum, 0, sizeof (CUMULATIVE_ARGS)); } -/* Implement FUNCTION_ARG_ADVANCE macro. */ +/* Implement TARGET_FUNCTION_ARG_ADVANCE hook. */ void score_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, int named) + const_tree type, bool named) { if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D) return score7_function_arg_advance (cum, mode, type, named); @@ -501,10 +507,10 @@ score_arg_partial_bytes (CUMULATIVE_ARGS *cum, gcc_unreachable (); } -/* Implement FUNCTION_ARG macro. */ +/* Implement TARGET_FUNCTION_ARG hook. */ rtx -score_function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, int named) +score_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named) { if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D) return score7_function_arg (cum, mode, type, named); diff --git a/gcc/config/score/score3.c b/gcc/config/score/score3.c index cf33431..ff5f340 100644 --- a/gcc/config/score/score3.c +++ b/gcc/config/score/score3.c @@ -440,7 +440,7 @@ score3_legitimize_address (rtx x) is a named (fixed) argument rather than a variable one. */ static void score3_classify_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, int named, struct score3_arg_info *info) + const_tree type, bool named, struct score3_arg_info *info) { int even_reg_p; unsigned int num_words, max_regs; @@ -798,10 +798,10 @@ score3_initial_elimination_offset (int from, } } -/* Implement FUNCTION_ARG_ADVANCE macro. */ +/* Implement TARGET_FUNCTION_ARG_ADVANCE hook. */ void score3_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, int named) + const_tree type, bool named) { struct score3_arg_info info; score3_classify_arg (cum, mode, type, named, &info); @@ -821,10 +821,10 @@ score3_arg_partial_bytes (CUMULATIVE_ARGS *cum, return info.stack_words > 0 ? info.reg_words * UNITS_PER_WORD : 0; } -/* Implement FUNCTION_ARG macro. */ +/* Implement TARGET_FUNCTION_ARG hook. */ rtx score3_function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, int named) + const_tree type, bool named) { struct score3_arg_info info; diff --git a/gcc/config/score/score3.h b/gcc/config/score/score3.h index 4e545fc..6a767cd 100644 --- a/gcc/config/score/score3.h +++ b/gcc/config/score/score3.h @@ -107,16 +107,16 @@ score3_initial_elimination_offset (int from, int to ATTRIBUTE_UNUSED); extern void score3_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, - int named); + const_tree type, + bool named); extern int score3_arg_partial_bytes (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, bool named); extern rtx score3_function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, - int named); + const_tree type, + bool named); extern rtx score3_function_value (tree valtype, tree func ATTRIBUTE_UNUSED, enum machine_mode mode); diff --git a/gcc/config/score/score7.c b/gcc/config/score/score7.c index d3cd1c5..c13ef7a 100644 --- a/gcc/config/score/score7.c +++ b/gcc/config/score/score7.c @@ -439,7 +439,7 @@ score7_legitimize_address (rtx x) is a named (fixed) argument rather than a variable one. */ static void score7_classify_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, int named, struct score7_arg_info *info) + const_tree type, bool named, struct score7_arg_info *info) { int even_reg_p; unsigned int num_words, max_regs; @@ -789,10 +789,10 @@ score7_initial_elimination_offset (int from, } } -/* Implement FUNCTION_ARG_ADVANCE macro. */ +/* Implement TARGET_FUNCTION_ARG_ADVANCE hook. */ void score7_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, int named) + const_tree type, bool named) { struct score7_arg_info info; score7_classify_arg (cum, mode, type, named, &info); @@ -812,10 +812,10 @@ score7_arg_partial_bytes (CUMULATIVE_ARGS *cum, return info.stack_words > 0 ? info.reg_words * UNITS_PER_WORD : 0; } -/* Implement FUNCTION_ARG macro. */ +/* Implement TARGET_FUNCTION_ARG hook. */ rtx score7_function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, int named) + const_tree type, bool named) { struct score7_arg_info info; diff --git a/gcc/config/score/score7.h b/gcc/config/score/score7.h index 0931a2b..19ec478 100644 --- a/gcc/config/score/score7.h +++ b/gcc/config/score/score7.h @@ -107,16 +107,16 @@ score7_initial_elimination_offset (int from, int to ATTRIBUTE_UNUSED); extern void score7_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, - int named); + const_tree type, + bool named); extern int score7_arg_partial_bytes (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, bool named); extern rtx score7_function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode, - tree type, - int named); + const_tree type, + bool named); extern rtx score7_function_value (tree valtype, tree func ATTRIBUTE_UNUSED, enum machine_mode mode);