[Top] [All Lists]

Re: [PATCH] MIPS: Add option to pass return address location to _mcount.

Subject: Re: [PATCH] MIPS: Add option to pass return address location to _mcount.
From: David Daney <>
Date: Thu, 29 Oct 2009 09:32:38 -0700
Cc: Richard Sandiford <>, GCC Patches <>,, Adam Nemet <>,, Thomas Gleixner <>, Ralf Baechle <>, Nicholas Mc Guire <>
In-reply-to: <1256798674.6448.42.camel@falcon>
Original-recipient: rfc822;
References: <> <> <> <> <> <1256233679.23653.7.camel@falcon> <> <87y6n36plp.fsf@firetop.home> <> <87my3htau1.fsf@firetop.home> <> <87ljiwr0t9.fsf@firetop.home> <1256798674.6448.42.camel@falcon>
User-agent: Thunderbird (X11/20090320)
Wu Zhangjin wrote:

On Tue, 2009-10-27 at 21:20 +0000, Richard Sandiford wrote:
OK with those changes,

Just applied the above changes, and added one more for not getting the
ra_fp_offset when -pg is not enabled:

@@ -9619,6 +9622,9 @@ mips_for_each_saved_gpr_and_fpr (HOST_WIDE_INT
   for (regno = GP_REG_LAST; regno >= GP_REG_FIRST; regno--)
     if (BITSET_P (cfun->machine->frame.mask, regno - GP_REG_FIRST))
+       /* Record the ra offset for use by mips_function_profiler.  */
+       if (crtl->profile && regno == RETURN_ADDR_REGNUM)
+         cfun->machine->frame.ra_fp_offset = offset + sp_offset;
        mips_save_restore_reg (word_mode, regno, offset, fn);
        offset -= UNITS_PER_WORD;

"crtl->profile &&" was added.

I am a little confused.

I don't think your change is needed. The FUNCTION_PROFILER code is not invoked unless -pg is passed.

Were you getting wrong code without your change? The ra_fp_offset field will be unused if -pg is not specified, but its existence shouldn't affect code generation.

David Daney

<Prev in Thread] Current Thread [Next in Thread>