public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix mips-{mti,img}-linux-gnu boot-strap
@ 2015-07-04  7:46 Bernd Edlinger
  2015-07-04  8:02 ` Matthew Fortune
  2015-07-04  8:04 ` Richard Sandiford
  0 siblings, 2 replies; 5+ messages in thread
From: Bernd Edlinger @ 2015-07-04  7:46 UTC (permalink / raw)
  To: gcc-patches; +Cc: Catherine Moore, Matthew Fortune

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

Hi,<br><br>this patch fixes a regression that was triggered by commit r225260.<br>See pr66747 for details.<br><br>Is it OK for trunk?<br><br><br>Thanks<br>Bernd.<br> 		 	   		  

[-- Attachment #2: changelog-pr66747.txt --]
[-- Type: text/plain, Size: 165 bytes --]

2015-07-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR target/66747
	* config/mips/mips.c (mips_cfun_has_inflexible_gp_ref_p): Handle
	instruction sequences.


[-- Attachment #3: patch-pr66747.diff --]
[-- Type: application/octet-stream, Size: 608 bytes --]

--- gcc/config/mips/mips.c.jj	2015-06-08 23:06:50.000000000 +0200
+++ gcc/config/mips/mips.c	2015-07-03 13:16:02.637293167 +0200
@@ -9902,8 +9902,11 @@ mips_cfun_has_inflexible_gp_ref_p (void)
 static bool
 mips_insn_has_flexible_gp_ref_p (rtx_insn *insn)
 {
-  return (get_attr_got (insn) != GOT_UNSET
-	  || mips_small_data_pattern_p (PATTERN (insn))
+  rtx_insn *subinsn;
+  FOR_EACH_SUBINSN (subinsn, insn)
+    if (get_attr_got (subinsn) != GOT_UNSET)
+      return true;
+  return (mips_small_data_pattern_p (PATTERN (insn))
 	  || reg_overlap_mentioned_p (pic_offset_table_rtx, PATTERN (insn)));
 }
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] Fix mips-{mti,img}-linux-gnu boot-strap
  2015-07-04  7:46 [PATCH] Fix mips-{mti,img}-linux-gnu boot-strap Bernd Edlinger
@ 2015-07-04  8:02 ` Matthew Fortune
  2015-07-04  8:04 ` Richard Sandiford
  1 sibling, 0 replies; 5+ messages in thread
From: Matthew Fortune @ 2015-07-04  8:02 UTC (permalink / raw)
  To: Bernd Edlinger, gcc-patches; +Cc: Catherine Moore

Bernd Edlinger <bernd.edlinger@hotmail.de> writes:
> Hi,<br><br>this patch fixes a regression that was triggered by commit r225260.<br>See
> pr66747 for details.<br><br>Is it OK for trunk?<br><br><br>Thanks<br>Bernd.<br>

Thanks Bernd. I was just reviewing this PR. I think it will probably be safer to move
the fix up to the mips_find_gp_ref and consider each instruction inside a sequence
individually at that point. I'm not sure that mips_small_data_pattern_p is safe when
given a sequence.

It looks like we have never had to compute frame information after delay slot filling
Previously, hence a bug in old code.

I am happy to rework this to move it into mips_find_gp_ref.

Thanks,
Matthew


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix mips-{mti,img}-linux-gnu boot-strap
  2015-07-04  7:46 [PATCH] Fix mips-{mti,img}-linux-gnu boot-strap Bernd Edlinger
  2015-07-04  8:02 ` Matthew Fortune
@ 2015-07-04  8:04 ` Richard Sandiford
  2015-07-04 11:14   ` Bernd Edlinger
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Sandiford @ 2015-07-04  8:04 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: gcc-patches, Catherine Moore, Matthew Fortune

Bernd Edlinger <bernd.edlinger@hotmail.de> writes:
> --- gcc/config/mips/mips.c.jj	2015-06-08 23:06:50.000000000 +0200
> +++ gcc/config/mips/mips.c	2015-07-03 13:16:02.637293167 +0200
> @@ -9902,8 +9902,11 @@ mips_cfun_has_inflexible_gp_ref_p (void)
>  static bool
>  mips_insn_has_flexible_gp_ref_p (rtx_insn *insn)
>  {
> -  return (get_attr_got (insn) != GOT_UNSET
> -	  || mips_small_data_pattern_p (PATTERN (insn))
> +  rtx_insn *subinsn;
> +  FOR_EACH_SUBINSN (subinsn, insn)
> +    if (get_attr_got (subinsn) != GOT_UNSET)
> +      return true;
> +  return (mips_small_data_pattern_p (PATTERN (insn))
>  	  || reg_overlap_mentioned_p (pic_offset_table_rtx, PATTERN (insn)));
>  }
>  

The final return here would also mishandle SEQUENCE PATTERNs.
The idea was that this function would only see "real" instructions,
so I think instead the FOR_EACH_SUBINSN should be here:

static bool
mips_find_gp_ref (bool *cache, bool (*pred) (rtx_insn *))
{
  rtx_insn *insn;

  if (!*cache)
    {
      push_topmost_sequence ();
      for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
---->
	if (USEFUL_INSN_P (insn) && pred (insn))

Thanks,
Richard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] Fix mips-{mti,img}-linux-gnu boot-strap
  2015-07-04  8:04 ` Richard Sandiford
@ 2015-07-04 11:14   ` Bernd Edlinger
  2015-07-04 16:59     ` Matthew Fortune
  0 siblings, 1 reply; 5+ messages in thread
From: Bernd Edlinger @ 2015-07-04 11:14 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: gcc-patches, Catherine Moore, Matthew Fortune

[-- Attachment #1: Type: text/plain, Size: 724 bytes --]

Hi,

On Sat, 4 Jul 2015 09:04:41, Richard Sandiford wrote:
>
> The final return here would also mishandle SEQUENCE PATTERNs.
> The idea was that this function would only see "real" instructions,
> so I think instead the FOR_EACH_SUBINSN should be here:
>
> static bool
> mips_find_gp_ref (bool *cache, bool (*pred) (rtx_insn *))
> {
> rtx_insn *insn;
>
> if (!*cache)
> {
> push_topmost_sequence ();
> for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
> ---->
> if (USEFUL_INSN_P (insn) && pred (insn))
>
> Thanks,
> Richard

Yes, I agree.

I have now updated my patch as suggested.

A mips-img-linux-gnu cross compiler builds as expected.

OK for trunk?


Thanks
Bernd.
 		 	   		  

[-- Attachment #2: changelog-pr66747.txt --]
[-- Type: text/plain, Size: 147 bytes --]

2015-07-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR target/66747
	* config/mips/mips.c (mips_find_gp_ref): Handle instruction sequences.


[-- Attachment #3: patch-pr66747.diff --]
[-- Type: application/octet-stream, Size: 740 bytes --]

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	(revision 225378)
+++ gcc/config/mips/mips.c	(working copy)
@@ -9790,17 +9790,18 @@
 static bool
 mips_find_gp_ref (bool *cache, bool (*pred) (rtx_insn *))
 {
-  rtx_insn *insn;
+  rtx_insn *insn, *subinsn;
 
   if (!*cache)
     {
       push_topmost_sequence ();
       for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
-	if (USEFUL_INSN_P (insn) && pred (insn))
-	  {
-	    *cache = true;
-	    break;
-	  }
+	FOR_EACH_SUBINSN (subinsn, insn)
+	  if (USEFUL_INSN_P (subinsn) && pred (subinsn))
+	    {
+	      *cache = true;
+	      break;
+	    }
       pop_topmost_sequence ();
     }
   return *cache;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] Fix mips-{mti,img}-linux-gnu boot-strap
  2015-07-04 11:14   ` Bernd Edlinger
@ 2015-07-04 16:59     ` Matthew Fortune
  0 siblings, 0 replies; 5+ messages in thread
From: Matthew Fortune @ 2015-07-04 16:59 UTC (permalink / raw)
  To: Bernd Edlinger, Richard Sandiford; +Cc: gcc-patches, Catherine Moore

Bernd Edlinger <bernd.edlinger@hotmail.de> writes:
> On Sat, 4 Jul 2015 09:04:41, Richard Sandiford wrote:
> >
> > The final return here would also mishandle SEQUENCE PATTERNs.
> > The idea was that this function would only see "real" instructions,
> > so I think instead the FOR_EACH_SUBINSN should be here:
> >
> > static bool
> > mips_find_gp_ref (bool *cache, bool (*pred) (rtx_insn *))
> > {
> > rtx_insn *insn;
> >
> > if (!*cache)
> > {
> > push_topmost_sequence ();
> > for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
> > ---->
> > if (USEFUL_INSN_P (insn) && pred (insn))
> >
> > Thanks,
> > Richard
> 
> Yes, I agree.
> 
> I have now updated my patch as suggested.
> 
> A mips-img-linux-gnu cross compiler builds as expected.
> 
> OK for trunk?

OK, thanks.

Matthew

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-04 16:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-04  7:46 [PATCH] Fix mips-{mti,img}-linux-gnu boot-strap Bernd Edlinger
2015-07-04  8:02 ` Matthew Fortune
2015-07-04  8:04 ` Richard Sandiford
2015-07-04 11:14   ` Bernd Edlinger
2015-07-04 16:59     ` Matthew Fortune

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).