Commit 5378dda2 by Anatoly Sokolov Committed by Anatoly Sokolov

xtensa.h (REGISTER_MOVE_COST, [...]): Remove macros.

	* config/xtensa/xtensa.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST):
	Remove macros.
	* config/xtensa/xtensa.c (xtensa_register_move_cost,
	xtensa_memory_move_cost): New functions.
	(TARGET_REGISTER_MOVE_COST, TARGET_REGISTER_MOVE_COST): Define.

From-SVN: r170071
parent f3d533d3
2011-02-12 Anatoly Sokolov <aesok@post.ru>
* config/xtensa/xtensa.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST):
Remove macros.
* config/xtensa/xtensa.c (xtensa_register_move_cost,
xtensa_memory_move_cost): New functions.
(TARGET_REGISTER_MOVE_COST, TARGET_REGISTER_MOVE_COST): Define.
2011-02-12 Alexandre Oliva <aoliva@redhat.com> 2011-02-12 Alexandre Oliva <aoliva@redhat.com>
PR lto/47225 PR lto/47225
......
...@@ -137,6 +137,9 @@ static unsigned int xtensa_multibss_section_type_flags (tree, const char *, ...@@ -137,6 +137,9 @@ static unsigned int xtensa_multibss_section_type_flags (tree, const char *,
static section *xtensa_select_rtx_section (enum machine_mode, rtx, static section *xtensa_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT); unsigned HOST_WIDE_INT);
static bool xtensa_rtx_costs (rtx, int, int, int *, bool); static bool xtensa_rtx_costs (rtx, int, int, int *, bool);
static int xtensa_register_move_cost (enum machine_mode, reg_class_t,
reg_class_t);
static int xtensa_memory_move_cost (enum machine_mode, reg_class_t, bool);
static tree xtensa_build_builtin_va_list (void); static tree xtensa_build_builtin_va_list (void);
static bool xtensa_return_in_memory (const_tree, const_tree); static bool xtensa_return_in_memory (const_tree, const_tree);
static tree xtensa_gimplify_va_arg_expr (tree, tree, gimple_seq *, static tree xtensa_gimplify_va_arg_expr (tree, tree, gimple_seq *,
...@@ -213,6 +216,10 @@ static const struct default_options xtensa_option_optimization_table[] = ...@@ -213,6 +216,10 @@ static const struct default_options xtensa_option_optimization_table[] =
#undef TARGET_MODE_DEPENDENT_ADDRESS_P #undef TARGET_MODE_DEPENDENT_ADDRESS_P
#define TARGET_MODE_DEPENDENT_ADDRESS_P xtensa_mode_dependent_address_p #define TARGET_MODE_DEPENDENT_ADDRESS_P xtensa_mode_dependent_address_p
#undef TARGET_REGISTER_MOVE_COST
#define TARGET_REGISTER_MOVE_COST xtensa_register_move_cost
#undef TARGET_MEMORY_MOVE_COST
#define TARGET_MEMORY_MOVE_COST xtensa_memory_move_cost
#undef TARGET_RTX_COSTS #undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS xtensa_rtx_costs #define TARGET_RTX_COSTS xtensa_rtx_costs
#undef TARGET_ADDRESS_COST #undef TARGET_ADDRESS_COST
...@@ -3307,6 +3314,34 @@ xtensa_select_rtx_section (enum machine_mode mode ATTRIBUTE_UNUSED, ...@@ -3307,6 +3314,34 @@ xtensa_select_rtx_section (enum machine_mode mode ATTRIBUTE_UNUSED,
return function_section (current_function_decl); return function_section (current_function_decl);
} }
/* Worker function for TARGET_REGISTER_MOVE_COST. */
static int
xtensa_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
reg_class_t from, reg_class_t to)
{
if (from == to && from != BR_REGS && to != BR_REGS)
return 2;
else if (reg_class_subset_p (from, AR_REGS)
&& reg_class_subset_p (to, AR_REGS))
return 2;
else if (reg_class_subset_p (from, AR_REGS) && to == ACC_REG)
return 3;
else if (from == ACC_REG && reg_class_subset_p (to, AR_REGS))
return 3;
else
return 10;
}
/* Worker function for TARGET_MEMORY_MOVE_COST. */
static int
xtensa_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
reg_class_t rclass ATTRIBUTE_UNUSED,
bool in ATTRIBUTE_UNUSED)
{
return 4;
}
/* Compute a (partial) cost for rtx X. Return true if the complete /* Compute a (partial) cost for rtx X. Return true if the complete
cost has been computed, and false if subexpressions should be cost has been computed, and false if subexpressions should be
......
...@@ -723,26 +723,6 @@ typedef struct xtensa_args ...@@ -723,26 +723,6 @@ typedef struct xtensa_args
indexing purposes) so give the MEM rtx a words's mode. */ indexing purposes) so give the MEM rtx a words's mode. */
#define FUNCTION_MODE SImode #define FUNCTION_MODE SImode
/* A C expression for the cost of moving data from a register in
class FROM to one in class TO. The classes are expressed using
the enumeration values such as 'GENERAL_REGS'. A value of 2 is
the default; other values are interpreted relative to that. */
#define REGISTER_MOVE_COST(MODE, FROM, TO) \
(((FROM) == (TO) && (FROM) != BR_REGS && (TO) != BR_REGS) \
? 2 \
: (reg_class_subset_p ((FROM), AR_REGS) \
&& reg_class_subset_p ((TO), AR_REGS) \
? 2 \
: (reg_class_subset_p ((FROM), AR_REGS) \
&& (TO) == ACC_REG \
? 3 \
: ((FROM) == ACC_REG \
&& reg_class_subset_p ((TO), AR_REGS) \
? 3 \
: 10))))
#define MEMORY_MOVE_COST(MODE, CLASS, IN) 4
#define BRANCH_COST(speed_p, predictable_p) 3 #define BRANCH_COST(speed_p, predictable_p) 3
/* How to refer to registers in assembler output. /* How to refer to registers in assembler output.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment