new register allocator and HARD_REGNO_CALL_PART_CLOBBERED
Dale Johannesen
dalej@apple.com
Thu May 1 00:31:00 GMT 2003
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);
More information about the Gcc
mailing list