Commit 0e607518 by Anatoly Sokolov Committed by Anatoly Sokolov

m32c.c (classes_intersect): Remove.

	* config/m32c/m32c.c (classes_intersect): Remove.
	(m32c_preferred_reload_class, m32c_secondary_reload_class): Use
	reg_classes_intersect_p instead of classes_intersect.
	(class_can_hold_mode): Change arguments type from enum reg_class to
	reg_class_t.  Use reg_class_contents instead of class_contents.
	(m32c_register_move_cost): Make static. Change arguments type from
	enum reg_class to reg_class_t. Use reg_classes_intersect_p instead of
	classes_intersect. Use reg_class_contents instead of class_contents.
	(m32c_memory_move_cost): Make static. Change arguments type from
	enum reg_class to reg_class_t.
	(TARGET_REGISTER_MOVE_COST, TARGET_MEMORY_MOVE_COST): Define.
	* config/m32c/m32c.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove.
	* config/m32c/m32c-protos.h (m32c_register_move_cost,
	m32c_memory_move_cost): Remove.

From-SVN: r163693
parent ad5f4de2
2010-08-31 Anatoly Sokolov <aesok@post.ru>
* config/m32c/m32c.c (classes_intersect): Remove.
(m32c_preferred_reload_class, m32c_secondary_reload_class): Use
reg_classes_intersect_p instead of classes_intersect.
(class_can_hold_mode): Change arguments type from enum reg_class to
reg_class_t. Use reg_class_contents instead of class_contents.
(m32c_register_move_cost): Make static. Change arguments type from
enum reg_class to reg_class_t. Use reg_classes_intersect_p instead of
classes_intersect. Use reg_class_contents instead of class_contents.
(m32c_memory_move_cost): Make static. Change arguments type from
enum reg_class to reg_class_t.
(TARGET_REGISTER_MOVE_COST, TARGET_MEMORY_MOVE_COST): Define.
* config/m32c/m32c.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove.
* config/m32c/m32c-protos.h (m32c_register_move_cost,
m32c_memory_move_cost): Remove.
2010-08-31 Nathan Froyd <froydnj@codesourcery.com> 2010-08-31 Nathan Froyd <froydnj@codesourcery.com>
* config/arm/arm-protos.h (arm_function_arg_advance): Delete. * config/arm/arm-protos.h (arm_function_arg_advance): Delete.
......
...@@ -75,7 +75,6 @@ rtx m32c_incoming_return_addr_rtx (void); ...@@ -75,7 +75,6 @@ rtx m32c_incoming_return_addr_rtx (void);
int m32c_legitimate_constant_p (rtx); int m32c_legitimate_constant_p (rtx);
int m32c_legitimize_reload_address (rtx *, MM, int, int, int); int m32c_legitimize_reload_address (rtx *, MM, int, int, int);
int m32c_limit_reload_class (MM, int); int m32c_limit_reload_class (MM, int);
int m32c_memory_move_cost (MM, int, int);
int m32c_modes_tieable_p (MM, MM); int m32c_modes_tieable_p (MM, MM);
bool m32c_mov_ok (rtx *, MM); bool m32c_mov_ok (rtx *, MM);
char * m32c_output_compare (rtx, rtx *); char * m32c_output_compare (rtx, rtx *);
...@@ -86,7 +85,6 @@ int m32c_prepare_shift (rtx *, int, int); ...@@ -86,7 +85,6 @@ int m32c_prepare_shift (rtx *, int, int);
void m32c_print_operand (FILE *, rtx, int); void m32c_print_operand (FILE *, rtx, int);
void m32c_print_operand_address (FILE *, rtx); void m32c_print_operand_address (FILE *, rtx);
int m32c_reg_ok_for_base_p (rtx, int); int m32c_reg_ok_for_base_p (rtx, int);
int m32c_register_move_cost (MM, int, int);
MM m32c_regno_reg_class (int); MM m32c_regno_reg_class (int);
rtx m32c_return_addr_rtx (int); rtx m32c_return_addr_rtx (int);
const char *m32c_scc_pattern (rtx *, RTX_CODE); const char *m32c_scc_pattern (rtx *, RTX_CODE);
......
...@@ -340,47 +340,33 @@ reduce_class (int original_class, int limiting_class, int returned_if_empty) ...@@ -340,47 +340,33 @@ reduce_class (int original_class, int limiting_class, int returned_if_empty)
return best; return best;
} }
/* Returns TRUE If there are any registers that exist in both register
classes. */
static int
classes_intersect (int class1, int class2)
{
return class_contents[class1][0] & class_contents[class2][0];
}
/* Used by m32c_register_move_cost to determine if a move is /* Used by m32c_register_move_cost to determine if a move is
impossibly expensive. */ impossibly expensive. */
static int static bool
class_can_hold_mode (int rclass, enum machine_mode mode) class_can_hold_mode (reg_class_t rclass, enum machine_mode mode)
{ {
/* Cache the results: 0=untested 1=no 2=yes */ /* Cache the results: 0=untested 1=no 2=yes */
static char results[LIM_REG_CLASSES][MAX_MACHINE_MODE]; static char results[LIM_REG_CLASSES][MAX_MACHINE_MODE];
if (results[rclass][mode] == 0)
if (results[(int) rclass][mode] == 0)
{ {
int r, n, i; int r;
results[rclass][mode] = 1; results[rclass][mode] = 1;
for (r = 0; r < FIRST_PSEUDO_REGISTER; r++) for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
if (class_contents[rclass][0] & (1 << r) if (in_hard_reg_set_p (reg_class_contents[(int) rclass], mode, r)
&& HARD_REGNO_MODE_OK (r, mode)) && HARD_REGNO_MODE_OK (r, mode))
{ {
int ok = 1; results[rclass][mode] = 2;
n = HARD_REGNO_NREGS (r, mode); break;
for (i = 1; i < n; i++)
if (!(class_contents[rclass][0] & (1 << (r + i))))
ok = 0;
if (ok)
{
results[rclass][mode] = 2;
break;
}
} }
} }
#if DEBUG0 #if DEBUG0
fprintf (stderr, "class %s can hold %s? %s\n", fprintf (stderr, "class %s can hold %s? %s\n",
class_names[rclass], mode_name[mode], class_names[(int) rclass], mode_name[mode],
(results[rclass][mode] == 2) ? "yes" : "no"); (results[rclass][mode] == 2) ? "yes" : "no");
#endif #endif
return results[rclass][mode] == 2; return results[(int) rclass][mode] == 2;
} }
/* Run-time Target Specification. */ /* Run-time Target Specification. */
...@@ -740,7 +726,7 @@ m32c_preferred_reload_class (rtx x, int rclass) ...@@ -740,7 +726,7 @@ m32c_preferred_reload_class (rtx x, int rclass)
if (rclass == NO_REGS) if (rclass == NO_REGS)
rclass = GET_MODE (x) == QImode ? HL_REGS : R03_REGS; rclass = GET_MODE (x) == QImode ? HL_REGS : R03_REGS;
if (classes_intersect (rclass, CR_REGS)) if (reg_classes_intersect_p (rclass, CR_REGS))
{ {
switch (GET_MODE (x)) switch (GET_MODE (x))
{ {
...@@ -826,7 +812,7 @@ m32c_secondary_reload_class (int rclass, enum machine_mode mode, rtx x) ...@@ -826,7 +812,7 @@ m32c_secondary_reload_class (int rclass, enum machine_mode mode, rtx x)
if (mode == QImode if (mode == QImode
&& GET_CODE (x) == MEM && (cc & ~class_contents[R23_REGS][0]) == 0) && GET_CODE (x) == MEM && (cc & ~class_contents[R23_REGS][0]) == 0)
return QI_REGS; return QI_REGS;
if (classes_intersect (rclass, CR_REGS) if (reg_classes_intersect_p (rclass, CR_REGS)
&& GET_CODE (x) == REG && GET_CODE (x) == REG
&& REGNO (x) >= SB_REGNO && REGNO (x) <= SP_REGNO) && REGNO (x) >= SB_REGNO && REGNO (x) <= SP_REGNO)
return TARGET_A16 ? HI_REGS : A_REGS; return TARGET_A16 ? HI_REGS : A_REGS;
...@@ -2096,19 +2082,29 @@ m32c_fixed_condition_code_regs (unsigned int *p1, unsigned int *p2) ...@@ -2096,19 +2082,29 @@ m32c_fixed_condition_code_regs (unsigned int *p1, unsigned int *p2)
/* Describing Relative Costs of Operations */ /* Describing Relative Costs of Operations */
/* Implements REGISTER_MOVE_COST. We make impossible moves /* Implements TARGET_REGISTER_MOVE_COST. We make impossible moves
prohibitively expensive, like trying to put QIs in r2/r3 (there are prohibitively expensive, like trying to put QIs in r2/r3 (there are
no opcodes to do that). We also discourage use of mem* registers no opcodes to do that). We also discourage use of mem* registers
since they're really memory. */ since they're really memory. */
int
m32c_register_move_cost (enum machine_mode mode, int from, int to) #undef TARGET_REGISTER_MOVE_COST
#define TARGET_REGISTER_MOVE_COST m32c_register_move_cost
static int
m32c_register_move_cost (enum machine_mode mode, reg_class_t from,
reg_class_t to)
{ {
int cost = COSTS_N_INSNS (3); int cost = COSTS_N_INSNS (3);
int cc = class_contents[from][0] | class_contents[to][0]; HARD_REG_SET cc;
/* FIXME: pick real values, but not 2 for now. */
if (mode == QImode && (cc & class_contents[R23_REGS][0])) /* FIXME: pick real values, but not 2 for now. */
COPY_HARD_REG_SET (cc, reg_class_contents[(int) from]);
IOR_HARD_REG_SET (cc, reg_class_contents[(int) to]);
if (mode == QImode
&& hard_reg_set_intersect_p (cc, reg_class_contents[R23_REGS]))
{ {
if (!(cc & ~class_contents[R23_REGS][0])) if (hard_reg_set_subset_p (cc, reg_class_contents[R23_REGS]))
cost = COSTS_N_INSNS (1000); cost = COSTS_N_INSNS (1000);
else else
cost = COSTS_N_INSNS (80); cost = COSTS_N_INSNS (80);
...@@ -2117,30 +2113,35 @@ m32c_register_move_cost (enum machine_mode mode, int from, int to) ...@@ -2117,30 +2113,35 @@ m32c_register_move_cost (enum machine_mode mode, int from, int to)
if (!class_can_hold_mode (from, mode) || !class_can_hold_mode (to, mode)) if (!class_can_hold_mode (from, mode) || !class_can_hold_mode (to, mode))
cost = COSTS_N_INSNS (1000); cost = COSTS_N_INSNS (1000);
if (classes_intersect (from, CR_REGS)) if (reg_classes_intersect_p (from, CR_REGS))
cost += COSTS_N_INSNS (5); cost += COSTS_N_INSNS (5);
if (classes_intersect (to, CR_REGS)) if (reg_classes_intersect_p (to, CR_REGS))
cost += COSTS_N_INSNS (5); cost += COSTS_N_INSNS (5);
if (from == MEM_REGS || to == MEM_REGS) if (from == MEM_REGS || to == MEM_REGS)
cost += COSTS_N_INSNS (50); cost += COSTS_N_INSNS (50);
else if (classes_intersect (from, MEM_REGS) else if (reg_classes_intersect_p (from, MEM_REGS)
|| classes_intersect (to, MEM_REGS)) || reg_classes_intersect_p (to, MEM_REGS))
cost += COSTS_N_INSNS (10); cost += COSTS_N_INSNS (10);
#if DEBUG0 #if DEBUG0
fprintf (stderr, "register_move_cost %s from %s to %s = %d\n", fprintf (stderr, "register_move_cost %s from %s to %s = %d\n",
mode_name[mode], class_names[from], class_names[to], cost); mode_name[mode], class_names[(int) from], class_names[(int) to],
cost);
#endif #endif
return cost; return cost;
} }
/* Implements MEMORY_MOVE_COST. */ /* Implements TARGET_MEMORY_MOVE_COST. */
int
#undef TARGET_MEMORY_MOVE_COST
#define TARGET_MEMORY_MOVE_COST m32c_memory_move_cost
static int
m32c_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED, m32c_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
int reg_class ATTRIBUTE_UNUSED, reg_class_t rclass ATTRIBUTE_UNUSED,
int in ATTRIBUTE_UNUSED) bool in ATTRIBUTE_UNUSED)
{ {
/* FIXME: pick real values. */ /* FIXME: pick real values. */
return COSTS_N_INSNS (10); return COSTS_N_INSNS (10);
......
...@@ -578,13 +578,6 @@ typedef struct m32c_cumulative_args ...@@ -578,13 +578,6 @@ typedef struct m32c_cumulative_args
#define REVERSIBLE_CC_MODE(MODE) 1 #define REVERSIBLE_CC_MODE(MODE) 1
/* Describing Relative Costs of Operations */
#define REGISTER_MOVE_COST(MODE,FROM,TO) \
m32c_register_move_cost (MODE, FROM, TO)
#define MEMORY_MOVE_COST(MODE,CLASS,IN) \
m32c_memory_move_cost (MODE, CLASS, IN)
/* Dividing the Output into Sections (Texts, Data, ...) */ /* Dividing the Output into Sections (Texts, Data, ...) */
#define TEXT_SECTION_ASM_OP ".text" #define TEXT_SECTION_ASM_OP ".text"
......
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