This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH/RFC] SH64 EH with pic (4/4)


Joern Rennecke <joern.rennecke@superh.com> wrote:
> Hmm.  I thought that it would be necessary to suppress cfi generation for
> either the move or the stack access, but now I see that we do not generate
> cfi for the move from the target / special register in the first place.
> So we also had a second bug, that we said only that a general purpose
> register was saved, without mentioning first the move of the target /
> special register into that general purpose register.
> Your patch fixes both these bugs for target registers, but it doesn't fix
> the latter one for PR_REG / special registers on SHcompact.
> 
>> +	    /* We gross over the intermediate copy and pretend we do
>> +	       a direct save from the target register in the cfi.  */
> 
> Typo: s/gross/gloss/ .  Moreover, it is even more important to explain *why*
> we are doing this.  And with the change below, we are doing a bit more, too.
> I suggest:
> 
> +	    /* If we use an intermediate register for the save, we can't
> +	       describe this exactly in cfi as a copy of the to-be-saved
> +	       register into the temporary register and then the temporary
> +	       register on the stack, because the temporary register can
> +	       have a different natural size than the to-be-saved register.
> +	       Thus, we gloss over the intermediate copy and pretend we do
> +	       a direct save from the to-be-saved register.  */
> 
> 
>> +	    if (TARGET_REGISTER_P (reg))
> 
> Make this (REGNO (reg_rtx) != reg) to catch the SHcompact problems.

I see.  Here is a revised patch according to your suggestion.  Again,
it's regtested for x86 cross sh64-unknown-linux-gnu without new
failures on c and c++ testsuite.

Regards,
	kaz
--
	* config/sh/sh.c (sh_expand_prologue): Add a REG_FRAME_RELATED_EXPR
	note to pretend a direct save from the original register when an
	intermediate register is used for the save.

--- ORIG/gcc/gcc/config/sh/sh.c	Thu Aug 19 12:21:08 2004
+++ LOCAL/gcc/gcc/config/sh/sh.c	Fri Sep 17 19:41:26 2004
@@ -5558,6 +5558,7 @@ sh_expand_prologue (void)
 	  enum machine_mode mode = entry->mode;
 	  int reg = entry->reg;
 	  rtx reg_rtx, mem_rtx, pre_dec = NULL_RTX;
+	  rtx orig_reg_rtx;
 
 	  offset = entry->offset;
 
@@ -5647,6 +5648,7 @@ sh_expand_prologue (void)
 	    abort ();
 
 	addr_ok:
+	  orig_reg_rtx = reg_rtx;
 	  if (TARGET_REGISTER_P (reg)
 	      || ((reg == PR_REG || SPECIAL_REGISTER_P (reg))
 		  && mem_rtx != pre_dec))
@@ -5674,6 +5676,22 @@ sh_expand_prologue (void)
 	    /* Mark as interesting for dwarf cfi generator */
 	    insn = emit_move_insn (mem_rtx, reg_rtx);
 	    RTX_FRAME_RELATED_P (insn) = 1;
+	    /* If we use an intermediate register for the save, we can't
+	       describe this exactly in cfi as a copy of the to-be-saved
+	       register into the temporary register and then the temporary
+	       register on the stack, because the temporary register can
+	       have a different natural size than the to-be-saved register.
+	       Thus, we gloss over the intermediate copy and pretend we do
+	       a direct save from the to-be-saved register.  */
+	    if (REGNO (reg_rtx) != reg)
+	      {
+		rtx set, note_rtx;
+
+		set = gen_rtx_SET (VOIDmode, mem_rtx, orig_reg_rtx);
+		note_rtx = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, set,
+					      REG_NOTES (insn));
+		REG_NOTES (insn) = note_rtx;
+	      }
 
 	    if (TARGET_SHCOMPACT && (offset_in_r0 != -1))
 	      {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]