From: Uros Bizjak Date: Thu, 12 Nov 2015 12:17:01 +0000 (+0100) Subject: alpha.h (FUNCTION_VALUE, [...]): Remove. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ef995717ac8dd150710c192f842ebdc8ee8a2f5c;p=gcc.git alpha.h (FUNCTION_VALUE, [...]): Remove. * config/alpha/alpha.h (FUNCTION_VALUE, LIBCALL_VALUE, FUNCTION_VALUE_REGNO_P): Remove. * config/alpha/alpha-protos.h (function_value): Remove. * config/alpha/alpha.c (function_value): Rename to... (alpha_function_value_1): ... this. Make static. (alpha_function_value, alpha_libcall_value, alpha_function_value_regno_p): New functions. (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE, TARGET_FUNCTION_VALUE_REGNO_P): Define. * config/alpha/alpha.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove. * config/alpha/alpha.c (alpha_memory_latency): Make static. (alpha_register_move_cost, alpha_memory_move_cost): New functions. (TARGET_REGISTER_MOVE_COST, TARGET_MEMORY_MOVE_COST): Define. From-SVN: r230250 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ab7d52959f8..645a59c5baa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2015-11-12 Uros Bizjak + + * config/alpha/alpha.h (FUNCTION_VALUE, LIBCALL_VALUE, + FUNCTION_VALUE_REGNO_P): Remove. + * config/alpha/alpha-protos.h (function_value): Remove. + * config/alpha/alpha.c (function_value): Rename to... + (alpha_function_value_1): ... this. Make static. + (alpha_function_value, alpha_libcall_value, + alpha_function_value_regno_p): New functions. + (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE, + TARGET_FUNCTION_VALUE_REGNO_P): Define. + +2015-11-12 Uros Bizjak + + * config/alpha/alpha.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove. + * config/alpha/alpha.c (alpha_memory_latency): Make static. + (alpha_register_move_cost, alpha_memory_move_cost): New functions. + (TARGET_REGISTER_MOVE_COST, TARGET_MEMORY_MOVE_COST): Define. + 2015-11-12 Eric Botcazou PR target/67265 diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h index 7d4579167e8..cec8329225b 100644 --- a/gcc/config/alpha/alpha-protos.h +++ b/gcc/config/alpha/alpha-protos.h @@ -68,7 +68,6 @@ extern rtx alpha_gp_save_rtx (void); extern void alpha_initialize_trampoline (rtx, rtx, rtx, int, int, int); extern rtx alpha_va_arg (tree, tree); -extern rtx function_value (const_tree, const_tree, machine_mode); extern void alpha_start_function (FILE *, const char *, tree); extern void alpha_end_function (FILE *, const char *, tree); diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 4e284dca382..4cfae822905 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -95,7 +95,7 @@ static int inside_function = FALSE; /* The number of cycles of latency we should assume on memory reads. */ -int alpha_memory_latency = 3; +static int alpha_memory_latency = 3; /* Whether the function needs the GP. */ @@ -1339,6 +1339,36 @@ alpha_legitimize_reload_address (rtx x, return NULL_RTX; } +/* Return the cost of moving between registers of various classes. Moving + between FLOAT_REGS and anything else except float regs is expensive. + In fact, we make it quite expensive because we really don't want to + do these moves unless it is clearly worth it. Optimizations may + reduce the impact of not being able to allocate a pseudo to a + hard register. */ + +static int +alpha_register_move_cost (machine_mode /*mode*/, + reg_class_t from, reg_class_t to) +{ + if ((from == FLOAT_REGS) == (to == FLOAT_REGS)) + return 2; + + if (TARGET_FIX) + return (from == FLOAT_REGS) ? 6 : 8; + + return 4 + 2 * alpha_memory_latency; +} + +/* Return the cost of moving data of MODE from a register to + or from memory. On the Alpha, bump this up a bit. */ + +static int +alpha_memory_move_cost (machine_mode /*mode*/, reg_class_t /*regclass*/, + bool /*in*/) +{ + return 2 * alpha_memory_latency; +} + /* Compute a (partial) cost for rtx X. Return true if the complete cost has been computed, and false if subexpressions should be scanned. In either case, *TOTAL contains the cost result. */ @@ -5736,9 +5766,9 @@ alpha_pass_by_reference (cumulative_args_t ca ATTRIBUTE_UNUSED, On Alpha the value is found in $0 for integer functions and $f0 for floating-point functions. */ -rtx -function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED, - machine_mode mode) +static rtx +alpha_function_value_1 (const_tree valtype, const_tree func ATTRIBUTE_UNUSED, + machine_mode mode) { unsigned int regnum, dummy ATTRIBUTE_UNUSED; enum mode_class mclass; @@ -5793,6 +5823,33 @@ function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED, return gen_rtx_REG (mode, regnum); } +/* Implement TARGET_FUNCTION_VALUE. */ + +static rtx +alpha_function_value (const_tree valtype, const_tree fn_decl_or_type, + bool /*outgoing*/) +{ + return alpha_function_value_1 (valtype, fn_decl_or_type, VOIDmode); +} + +/* Implement TARGET_LIBCALL_VALUE. */ + +static rtx +alpha_libcall_value (machine_mode mode, const_rtx /*fun*/) +{ + return alpha_function_value_1 (NULL_TREE, NULL_TREE, mode); +} + +/* Implement TARGET_FUNCTION_VALUE_REGNO_P. + + On the Alpha, $0 $1 and $f0 $f1 are the only register thus used. */ + +static bool +alpha_function_value_regno_p (const unsigned int regno) +{ + return (regno == 0 || regno == 1 || regno == 32 || regno == 33); +} + /* TCmode complex values are passed by invisible reference. We should not split these values. */ @@ -9908,6 +9965,10 @@ alpha_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update) #undef TARGET_USE_BLOCKS_FOR_CONSTANT_P #define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_const_rtx_true +#undef TARGET_REGISTER_MOVE_COST +#define TARGET_REGISTER_MOVE_COST alpha_register_move_cost +#undef TARGET_MEMORY_MOVE_COST +#define TARGET_MEMORY_MOVE_COST alpha_memory_move_cost #undef TARGET_RTX_COSTS #define TARGET_RTX_COSTS alpha_rtx_costs #undef TARGET_ADDRESS_COST @@ -9920,6 +9981,13 @@ alpha_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update) #define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote #undef TARGET_PROMOTE_PROTOTYPES #define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_false + +#undef TARGET_FUNCTION_VALUE +#define TARGET_FUNCTION_VALUE alpha_function_value +#undef TARGET_LIBCALL_VALUE +#define TARGET_LIBCALL_VALUE alpha_libcall_value +#undef TARGET_FUNCTION_VALUE_REGNO_P +#define TARGET_FUNCTION_VALUE_REGNO_P alpha_function_value_regno_p #undef TARGET_RETURN_IN_MEMORY #define TARGET_RETURN_IN_MEMORY alpha_return_in_memory #undef TARGET_PASS_BY_REFERENCE diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 52581552fea..5a198f79a2e 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -537,26 +537,6 @@ enum reg_class { (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \ ? reg_classes_intersect_p (FLOAT_REGS, CLASS) : 0) -/* Define the cost of moving between registers of various classes. Moving - between FLOAT_REGS and anything else except float regs is expensive. - In fact, we make it quite expensive because we really don't want to - do these moves unless it is clearly worth it. Optimizations may - reduce the impact of not being able to allocate a pseudo to a - hard register. */ - -#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \ - (((CLASS1) == FLOAT_REGS) == ((CLASS2) == FLOAT_REGS) ? 2 \ - : TARGET_FIX ? ((CLASS1) == FLOAT_REGS ? 6 : 8) \ - : 4+2*alpha_memory_latency) - -/* A C expressions returning the cost of moving data of MODE from a register to - or from memory. - - On the Alpha, bump this up a bit. */ - -extern int alpha_memory_latency; -#define MEMORY_MOVE_COST(MODE,CLASS,IN) (2*alpha_memory_latency) - /* Provide the cost of a branch. Exact meaning under development. */ #define BRANCH_COST(speed_p, predictable_p) 5 @@ -626,29 +606,6 @@ extern int alpha_memory_latency; in a register. */ /* #define REG_PARM_STACK_SPACE */ -/* Define how to find the value returned by a function. - VALTYPE is the data type of the value (as a tree). - If the precise function being called is known, FUNC is its FUNCTION_DECL; - otherwise, FUNC is 0. - - On Alpha the value is found in $0 for integer functions and - $f0 for floating-point functions. */ - -#define FUNCTION_VALUE(VALTYPE, FUNC) \ - function_value (VALTYPE, FUNC, VOIDmode) - -/* Define how to find the value returned by a library function - assuming the value has mode MODE. */ - -#define LIBCALL_VALUE(MODE) \ - function_value (NULL, NULL, MODE) - -/* 1 if N is a possible register number for a function value - as seen by the caller. */ - -#define FUNCTION_VALUE_REGNO_P(N) \ - ((N) == 0 || (N) == 1 || (N) == 32 || (N) == 33) - /* 1 if N is a possible register number for function argument passing. On Alpha, these are $16-$21 and $f16-$f21. */