This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: new register allocator and HARD_REGNO_CALL_PART_CLOBBERED
- From: Dale Johannesen <dalej at apple dot com>
- To: hermantenbrugge at home dot nl (Herman ten Brugge)
- Cc: Dale Johannesen <dalej at apple dot com>, gcc at gcc dot gnu dot org
- Date: Wed, 30 Apr 2003 17:30:53 -0700
- Subject: Re: new register allocator and HARD_REGNO_CALL_PART_CLOBBERED
On Wednesday, April 30, 2003, at 12:31 PM, Herman ten Brugge wrote:
Hello,
I found a problem with the -fnew-ra option of the compiler. I analysed
the problem and found that the macro HARD_REGNO_CALL_PART_CLOBBERED
is not used by the new register allocator.
I think this is also a bit difficult to implement because we now
have to check the mode for every register that is used during a
CALL_INSN.
You can try the following (mail may have screwed up spacing). It may
result in even worse code than your patch, but maybe it's better than
trying to work around this new-ra problem in individual targets.
(Untested, I do not have a c4x.)
*** df.c Thu Apr 17 13:30:04 2003
--- /Volumes/MacOS9/gcc/gcc3.preimport/gcc/df.c Fri Apr 4 10:33:25 2003
*************** df_insn_refs_record (df, bb, insn)
*** 1282,1301 ****
df_uses_record (df, &PATTERN (insn),
DF_REF_REG_USE, bb, insn, 0);
if (GET_CODE (insn) == CALL_INSN)
{
rtx note;
if (df->flags & DF_HARD_REGS)
! {
! /* Kill all registers invalidated by a call. */
! for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
! if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
! {
! rtx reg_clob = df_reg_clobber_gen (i);
! df_defs_record (df, reg_clob, bb, insn);
! }
! }
/* There may be extra registers to be clobbered. */
for (note = CALL_INSN_FUNCTION_USAGE (insn);
--- 1286,1308 ----
df_uses_record (df, &PATTERN (insn),
DF_REF_REG_USE, bb, insn, 0);
+
if (GET_CODE (insn) == CALL_INSN)
{
rtx note;
if (df->flags & DF_HARD_REGS)
! {
! /* Kill all registers invalidated by a call. */
! for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
! if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i)
! || HARD_REGNO_CALL_PART_CLOBBERED (i,
reg_raw_mode[i]))
! {
! rtx reg_clob = df_reg_clobber_gen (i);
! df_defs_record (df, reg_clob, bb, insn);
! }
! }
!
/* There may be extra registers to be clobbered. */
for (note = CALL_INSN_FUNCTION_USAGE (insn);