m68hc11.c (m68hc11_check_z_replacement): Take into account pre/post increment decrement for 68HC12.

* config/m68hc11/m68hc11.c (m68hc11_check_z_replacement): Take
	into account pre/post increment decrement for 68HC12.
	Fix other problems in replacement and fix call to reg_mentioned_p.

From-SVN: r41848
This commit is contained in:
Stephane Carrez 2001-05-04 23:00:37 +02:00 committed by Stephane Carrez
parent c5c2ca1677
commit 3c2f40009a
2 changed files with 50 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2001-05-04 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* config/m68hc11/m68hc11.c (m68hc11_check_z_replacement): Take
into account pre/post increment decrement for 68HC12.
Fix other problems in replacement and fix call to reg_mentioned_p.
2001-05-04 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* config/m68hc11/larith.asm (L_regs_frame): New for _.frame.

View File

@ -3851,6 +3851,7 @@ m68hc11_check_z_replacement (insn, info)
int this_insn_uses_ix;
int this_insn_uses_iy;
int this_insn_uses_z;
int this_insn_uses_z_in_dst;
int this_insn_uses_d;
rtx body;
int z_dies_here;
@ -3954,10 +3955,13 @@ m68hc11_check_z_replacement (insn, info)
{
if (!reg_mentioned_p (z_reg, src))
{
if (insn == info->first)
/* Z reg is used before being set. Treat this as
a new sequence of Z register replacement. */
if (insn != info->first)
{
info->must_load_z = 0;
return 0;
}
info->must_load_z = 0;
}
info->z_set_count++;
info->z_value = src;
@ -3977,9 +3981,23 @@ m68hc11_check_z_replacement (insn, info)
/* If z is used as an address operand (like (MEM (reg z))),
we can't replace it with d. */
if (this_insn_uses_z && !Z_REG_P (src))
if (this_insn_uses_z && !Z_REG_P (src)
&& !(m68hc11_arith_operator (src, GET_MODE (src))
&& Z_REG_P (XEXP (src, 0))
&& !reg_mentioned_p (z_reg, XEXP (src, 1))
&& insn == info->first
&& dead_register_here (insn, d_reg)))
info->can_use_d = 0;
this_insn_uses_z |= reg_mentioned_p (z_reg, dst);
this_insn_uses_z_in_dst = reg_mentioned_p (z_reg, dst);
if (TARGET_M6812 && !z_dies_here
&& ((this_insn_uses_z && side_effects_p (src))
|| (this_insn_uses_z_in_dst && side_effects_p (dst))))
{
info->need_save_z = 1;
info->z_set_count++;
}
this_insn_uses_z |= this_insn_uses_z_in_dst;
if (this_insn_uses_z && this_insn_uses_ix && this_insn_uses_iy)
{
@ -3996,6 +4014,9 @@ m68hc11_check_z_replacement (insn, info)
return 0;
}
if (this_insn_uses_ix && X_REG_P (dst) && GET_MODE (dst) == SImode)
info->can_use_d = 0;
if (info->x_used == 0 && this_insn_uses_ix)
{
if (info->y_used)
@ -4058,7 +4079,7 @@ m68hc11_check_z_replacement (insn, info)
return 0;
}
info->x_used = 1;
if (z_dies_here && !reg_mentioned_p (src, ix_reg)
if (z_dies_here && !reg_mentioned_p (ix_reg, src)
&& GET_CODE (dst) == REG && REGNO (dst) == HARD_X_REGNUM)
{
info->need_save_z = 0;
@ -4069,6 +4090,13 @@ m68hc11_check_z_replacement (insn, info)
info->must_restore_reg = 0;
return 0;
}
if (rtx_equal_p (src, z_reg) && rtx_equal_p (dst, ix_reg))
{
info->regno = HARD_X_REGNUM;
info->must_restore_reg = 0;
info->must_save_reg = 0;
return 0;
}
}
if (info->y_used == 0 && this_insn_uses_iy)
{
@ -4129,7 +4157,7 @@ m68hc11_check_z_replacement (insn, info)
return 0;
}
info->y_used = 1;
if (z_dies_here && !reg_mentioned_p (src, iy_reg)
if (z_dies_here && !reg_mentioned_p (iy_reg, src)
&& GET_CODE (dst) == REG && REGNO (dst) == HARD_Y_REGNUM)
{
info->need_save_z = 0;
@ -4140,6 +4168,13 @@ m68hc11_check_z_replacement (insn, info)
info->must_restore_reg = 0;
return 0;
}
if (rtx_equal_p (src, z_reg) && rtx_equal_p (dst, iy_reg))
{
info->regno = HARD_Y_REGNUM;
info->must_restore_reg = 0;
info->must_save_reg = 0;
return 0;
}
}
if (z_dies_here)
{
@ -4193,6 +4228,9 @@ m68hc11_check_z_replacement (insn, info)
if (Z_REG_P (dst))
info->z_set_count++;
}
if (TARGET_M6812 && uses_z && side_effects_p (x))
info->need_save_z = 1;
if (z_clobber)
info->need_save_z = 0;
}