Commit 8610ba70 by Richard Henderson Committed by Richard Henderson

regrename.c (mode_change_ok): New.

        * regrename.c (mode_change_ok): New.
        (find_oldest_value_reg): Use it.

From-SVN: r48029
parent 752ae914
2001-12-14 Richard Henderson <rth@redhat.com> 2001-12-14 Richard Henderson <rth@redhat.com>
* regrename.c (mode_change_ok): New.
(find_oldest_value_reg): Use it.
2001-12-14 Richard Henderson <rth@redhat.com>
* regrename.c (struct value_data): Add max_value_regs. * regrename.c (struct value_data): Add max_value_regs.
(init_value_data): Initialize it. (init_value_data): Initialize it.
(kill_value): Kill values that overlap the dying register. (kill_value): Kill values that overlap the dying register.
......
...@@ -996,6 +996,8 @@ static void kill_clobbered_value PARAMS ((rtx, rtx, void *)); ...@@ -996,6 +996,8 @@ static void kill_clobbered_value PARAMS ((rtx, rtx, void *));
static void kill_set_value PARAMS ((rtx, rtx, void *)); static void kill_set_value PARAMS ((rtx, rtx, void *));
static int kill_autoinc_value PARAMS ((rtx *, void *)); static int kill_autoinc_value PARAMS ((rtx *, void *));
static void copy_value PARAMS ((rtx, rtx, struct value_data *)); static void copy_value PARAMS ((rtx, rtx, struct value_data *));
static bool mode_change_ok PARAMS ((enum machine_mode, enum machine_mode,
unsigned int));
static rtx find_oldest_value_reg PARAMS ((enum reg_class, unsigned int, static rtx find_oldest_value_reg PARAMS ((enum reg_class, unsigned int,
enum machine_mode, enum machine_mode,
struct value_data *)); struct value_data *));
...@@ -1212,6 +1214,25 @@ copy_value (dest, src, vd) ...@@ -1212,6 +1214,25 @@ copy_value (dest, src, vd)
#endif #endif
} }
/* Return true if a mode change from ORIG to NEW is allowed for REGNO. */
static bool
mode_change_ok (orig_mode, new_mode, regno)
enum machine_mode orig_mode, new_mode;
unsigned int regno;
{
if (GET_MODE_SIZE (orig_mode) < GET_MODE_SIZE (new_mode))
return false;
#ifdef CLASS_CANNOT_CHANGE_MODE
if (TEST_HARD_REG_BIT (reg_class_contents[CLASS_CANNOT_CHANGE_MODE], regno)
&& CLASS_CANNOT_CHANGE_MODE_P (orig_mode, new_mode))
return false;
#endif
return true;
}
/* Find the oldest copy of the value contained in REGNO that is in /* Find the oldest copy of the value contained in REGNO that is in
register class CLASS and has mode MODE. If found, return an rtx register class CLASS and has mode MODE. If found, return an rtx
of that oldest register, otherwise return NULL. */ of that oldest register, otherwise return NULL. */
...@@ -1226,8 +1247,9 @@ find_oldest_value_reg (class, regno, mode, vd) ...@@ -1226,8 +1247,9 @@ find_oldest_value_reg (class, regno, mode, vd)
unsigned int i; unsigned int i;
for (i = vd->e[regno].oldest_regno; i != regno; i = vd->e[i].next_regno) for (i = vd->e[regno].oldest_regno; i != regno; i = vd->e[i].next_regno)
if (vd->e[i].mode == mode if (TEST_HARD_REG_BIT (reg_class_contents[class], i)
&& TEST_HARD_REG_BIT (reg_class_contents[class], i)) && (vd->e[i].mode == mode
|| mode_change_ok (vd->e[i].mode, mode, regno)))
return gen_rtx_REG (mode, i); return gen_rtx_REG (mode, i);
return NULL_RTX; return NULL_RTX;
......
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