Commit 3c2f4000 by Stephane Carrez Committed by Stephane Carrez

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
parent c5c2ca16
2001-05-04 Stephane Carrez <Stephane.Carrez@worldnet.fr> 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. * config/m68hc11/larith.asm (L_regs_frame): New for _.frame.
Put the soft registers in bss for 68HC12. Put the soft registers in bss for 68HC12.
(L_regs_d3_4): New for _.d3 and _.d4. (L_regs_d3_4): New for _.d3 and _.d4.
......
...@@ -3851,6 +3851,7 @@ m68hc11_check_z_replacement (insn, info) ...@@ -3851,6 +3851,7 @@ m68hc11_check_z_replacement (insn, info)
int this_insn_uses_ix; int this_insn_uses_ix;
int this_insn_uses_iy; int this_insn_uses_iy;
int this_insn_uses_z; int this_insn_uses_z;
int this_insn_uses_z_in_dst;
int this_insn_uses_d; int this_insn_uses_d;
rtx body; rtx body;
int z_dies_here; int z_dies_here;
...@@ -3954,10 +3955,13 @@ m68hc11_check_z_replacement (insn, info) ...@@ -3954,10 +3955,13 @@ m68hc11_check_z_replacement (insn, info)
{ {
if (!reg_mentioned_p (z_reg, src)) 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_set_count++;
info->z_value = src; info->z_value = src;
...@@ -3977,9 +3981,23 @@ m68hc11_check_z_replacement (insn, info) ...@@ -3977,9 +3981,23 @@ m68hc11_check_z_replacement (insn, info)
/* If z is used as an address operand (like (MEM (reg z))), /* If z is used as an address operand (like (MEM (reg z))),
we can't replace it with d. */ 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; 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) if (this_insn_uses_z && this_insn_uses_ix && this_insn_uses_iy)
{ {
...@@ -3996,6 +4014,9 @@ m68hc11_check_z_replacement (insn, info) ...@@ -3996,6 +4014,9 @@ m68hc11_check_z_replacement (insn, info)
return 0; 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->x_used == 0 && this_insn_uses_ix)
{ {
if (info->y_used) if (info->y_used)
...@@ -4058,7 +4079,7 @@ m68hc11_check_z_replacement (insn, info) ...@@ -4058,7 +4079,7 @@ m68hc11_check_z_replacement (insn, info)
return 0; return 0;
} }
info->x_used = 1; 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) && GET_CODE (dst) == REG && REGNO (dst) == HARD_X_REGNUM)
{ {
info->need_save_z = 0; info->need_save_z = 0;
...@@ -4069,6 +4090,13 @@ m68hc11_check_z_replacement (insn, info) ...@@ -4069,6 +4090,13 @@ m68hc11_check_z_replacement (insn, info)
info->must_restore_reg = 0; info->must_restore_reg = 0;
return 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) if (info->y_used == 0 && this_insn_uses_iy)
{ {
...@@ -4129,7 +4157,7 @@ m68hc11_check_z_replacement (insn, info) ...@@ -4129,7 +4157,7 @@ m68hc11_check_z_replacement (insn, info)
return 0; return 0;
} }
info->y_used = 1; 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) && GET_CODE (dst) == REG && REGNO (dst) == HARD_Y_REGNUM)
{ {
info->need_save_z = 0; info->need_save_z = 0;
...@@ -4140,6 +4168,13 @@ m68hc11_check_z_replacement (insn, info) ...@@ -4140,6 +4168,13 @@ m68hc11_check_z_replacement (insn, info)
info->must_restore_reg = 0; info->must_restore_reg = 0;
return 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) if (z_dies_here)
{ {
...@@ -4193,6 +4228,9 @@ m68hc11_check_z_replacement (insn, info) ...@@ -4193,6 +4228,9 @@ m68hc11_check_z_replacement (insn, info)
if (Z_REG_P (dst)) if (Z_REG_P (dst))
info->z_set_count++; info->z_set_count++;
} }
if (TARGET_M6812 && uses_z && side_effects_p (x))
info->need_save_z = 1;
if (z_clobber) if (z_clobber)
info->need_save_z = 0; info->need_save_z = 0;
} }
......
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