aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorAnatoly Sokolov <aesok@post.ru>2010-08-31 23:32:59 +0400
committerAnatoly Sokolov <aesok@gcc.gnu.org>2010-08-31 23:32:59 +0400
commit0e607518d5cb2b5254adf739f90b6ca68e3f3daa (patch)
tree1acdfeafd368992b156f4865d48a4dfba43efa60 /gcc/config
parentad5f4de228737897d59cb3e629f934d504029e16 (diff)
downloadgcc-0e607518d5cb2b5254adf739f90b6ca68e3f3daa.zip
gcc-0e607518d5cb2b5254adf739f90b6ca68e3f3daa.tar.gz
gcc-0e607518d5cb2b5254adf739f90b6ca68e3f3daa.tar.bz2
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
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/m32c/m32c-protos.h2
-rw-r--r--gcc/config/m32c/m32c.c87
-rw-r--r--gcc/config/m32c/m32c.h7
3 files changed, 44 insertions, 52 deletions
diff --git a/gcc/config/m32c/m32c-protos.h b/gcc/config/m32c/m32c-protos.h
index 3ebaa08..cd3c240 100644
--- a/gcc/config/m32c/m32c-protos.h
+++ b/gcc/config/m32c/m32c-protos.h
@@ -75,7 +75,6 @@ rtx m32c_incoming_return_addr_rtx (void);
int m32c_legitimate_constant_p (rtx);
int m32c_legitimize_reload_address (rtx *, MM, int, int, int);
int m32c_limit_reload_class (MM, int);
-int m32c_memory_move_cost (MM, int, int);
int m32c_modes_tieable_p (MM, MM);
bool m32c_mov_ok (rtx *, MM);
char * m32c_output_compare (rtx, rtx *);
@@ -86,7 +85,6 @@ int m32c_prepare_shift (rtx *, int, int);
void m32c_print_operand (FILE *, rtx, int);
void m32c_print_operand_address (FILE *, rtx);
int m32c_reg_ok_for_base_p (rtx, int);
-int m32c_register_move_cost (MM, int, int);
MM m32c_regno_reg_class (int);
rtx m32c_return_addr_rtx (int);
const char *m32c_scc_pattern (rtx *, RTX_CODE);
diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c
index 34e814a..42d343a 100644
--- a/gcc/config/m32c/m32c.c
+++ b/gcc/config/m32c/m32c.c
@@ -340,47 +340,33 @@ reduce_class (int original_class, int limiting_class, int returned_if_empty)
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
impossibly expensive. */
-static int
-class_can_hold_mode (int rclass, enum machine_mode mode)
+static bool
+class_can_hold_mode (reg_class_t rclass, enum machine_mode mode)
{
/* Cache the results: 0=untested 1=no 2=yes */
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;
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))
{
- int ok = 1;
- n = HARD_REGNO_NREGS (r, mode);
- for (i = 1; i < n; i++)
- if (!(class_contents[rclass][0] & (1 << (r + i))))
- ok = 0;
- if (ok)
- {
- results[rclass][mode] = 2;
- break;
- }
+ results[rclass][mode] = 2;
+ break;
}
}
+
#if DEBUG0
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");
#endif
- return results[rclass][mode] == 2;
+ return results[(int) rclass][mode] == 2;
}
/* Run-time Target Specification. */
@@ -740,7 +726,7 @@ m32c_preferred_reload_class (rtx x, int rclass)
if (rclass == NO_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))
{
@@ -826,7 +812,7 @@ m32c_secondary_reload_class (int rclass, enum machine_mode mode, rtx x)
if (mode == QImode
&& GET_CODE (x) == MEM && (cc & ~class_contents[R23_REGS][0]) == 0)
return QI_REGS;
- if (classes_intersect (rclass, CR_REGS)
+ if (reg_classes_intersect_p (rclass, CR_REGS)
&& GET_CODE (x) == REG
&& REGNO (x) >= SB_REGNO && REGNO (x) <= SP_REGNO)
return TARGET_A16 ? HI_REGS : A_REGS;
@@ -2096,19 +2082,29 @@ m32c_fixed_condition_code_regs (unsigned int *p1, unsigned int *p2)
/* 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
no opcodes to do that). We also discourage use of mem* registers
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 cc = class_contents[from][0] | class_contents[to][0];
- /* FIXME: pick real values, but not 2 for now. */
- if (mode == QImode && (cc & class_contents[R23_REGS][0]))
+ HARD_REG_SET cc;
+
+/* 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);
else
cost = COSTS_N_INSNS (80);
@@ -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))
cost = COSTS_N_INSNS (1000);
- if (classes_intersect (from, CR_REGS))
+ if (reg_classes_intersect_p (from, CR_REGS))
cost += COSTS_N_INSNS (5);
- if (classes_intersect (to, CR_REGS))
+ if (reg_classes_intersect_p (to, CR_REGS))
cost += COSTS_N_INSNS (5);
if (from == MEM_REGS || to == MEM_REGS)
cost += COSTS_N_INSNS (50);
- else if (classes_intersect (from, MEM_REGS)
- || classes_intersect (to, MEM_REGS))
+ else if (reg_classes_intersect_p (from, MEM_REGS)
+ || reg_classes_intersect_p (to, MEM_REGS))
cost += COSTS_N_INSNS (10);
#if DEBUG0
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
return cost;
}
-/* Implements MEMORY_MOVE_COST. */
-int
+/* Implements TARGET_MEMORY_MOVE_COST. */
+
+#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,
- int reg_class ATTRIBUTE_UNUSED,
- int in ATTRIBUTE_UNUSED)
+ reg_class_t rclass ATTRIBUTE_UNUSED,
+ bool in ATTRIBUTE_UNUSED)
{
/* FIXME: pick real values. */
return COSTS_N_INSNS (10);
diff --git a/gcc/config/m32c/m32c.h b/gcc/config/m32c/m32c.h
index 781d68c..ed20b82 100644
--- a/gcc/config/m32c/m32c.h
+++ b/gcc/config/m32c/m32c.h
@@ -578,13 +578,6 @@ typedef struct m32c_cumulative_args
#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, ...) */
#define TEXT_SECTION_ASM_OP ".text"