diff mbox

Fix abort in write_eligible_delay

Message ID 56293685.7040507@redhat.com
State New
Headers show

Commit Message

Jeff Law Oct. 22, 2015, 7:18 p.m. UTC
Various ports are currently failing to build, faulting in 
write_eligible_delay.

This can happen if the target has delay slots defined, but does not have 
annul-true or annul-false slots.  cris is a reasonable example.

This is most easily addressed by writing out a trivial dummy function if 
we don't have annul-true or annul-false slots.

I've verified this fixes the 47 newly failing targets in config-list.mk 
and survives the usual bootstrap & comparison test on x86_64-linux-gnu.

Installed on the trunk.

Jeff
commit 6119ad4e875ff0c856102c14b08d869c7d33b357
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Oct 22 19:18:05 2015 +0000

    [PATCH] Fix abort in write_eligible_delay
            * genattrtab.c (main): If we do not have any annul-true or annul-false
            slots, then write out a dummy eligible_for_annul_true or
            eligible_for_annul_false as needed.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229184 138bc75d-0d04-0410-961f-82ee72b054a4

Comments

Trevor Saunders Oct. 22, 2015, 7:59 p.m. UTC | #1
On Thu, Oct 22, 2015 at 01:18:29PM -0600, Jeff Law wrote:
> 
> Various ports are currently failing to build, faulting in
> write_eligible_delay.
> 
> This can happen if the target has delay slots defined, but does not have
> annul-true or annul-false slots.  cris is a reasonable example.
> 
> This is most easily addressed by writing out a trivial dummy function if we
> don't have annul-true or annul-false slots.
> 
> I've verified this fixes the 47 newly failing targets in config-list.mk and
> survives the usual bootstrap & comparison test on x86_64-linux-gnu.

thanks for taking care of this.

> +write_dummy_eligible_delay (FILE *outf, const char *kind)
> +{
> +  /* Write function prelude.  */
> +
> +  fprintf (outf, "int\n");
> +  fprintf (outf, "eligible_for_%s (rtx_insn *delay_insn ATTRIBUTE_UNUSED,\n"
> +		 "    int slot ATTRIBUTE_UNUSED,\n"
> +		 "    rtx_insn *candidate_insn ATTRIBUTE_UNUSED,\n"
> +		 "    int flags ATTRIBUTE_UNUSED)\n",
> +	   kind);

Couldn't you just leave the arguments unnamed as a simpler way to avoid
unused warnings?

Trev
Jeff Law Oct. 22, 2015, 8:30 p.m. UTC | #2
On 10/22/2015 01:59 PM, Trevor Saunders wrote:
>>
>> I've verified this fixes the 47 newly failing targets in config-list.mk and
>> survives the usual bootstrap & comparison test on x86_64-linux-gnu.
>
> thanks for taking care of this.
No problem.

>
>> +write_dummy_eligible_delay (FILE *outf, const char *kind)
>> +{
>> +  /* Write function prelude.  */
>> +
>> +  fprintf (outf, "int\n");
>> +  fprintf (outf, "eligible_for_%s (rtx_insn *delay_insn ATTRIBUTE_UNUSED,\n"
>> +		 "    int slot ATTRIBUTE_UNUSED,\n"
>> +		 "    rtx_insn *candidate_insn ATTRIBUTE_UNUSED,\n"
>> +		 "    int flags ATTRIBUTE_UNUSED)\n",
>> +	   kind);
>
> Couldn't you just leave the arguments unnamed as a simpler way to avoid
> unused warnings?
Had I known about that feature, I would have considered it!  I know for 
the future though.

jeff
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 08d26a9..04d8e16 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@ 
+2015-10-22  Jeff Law  <law@redhat.com>
+
+	* genattrtab.c (main): If we do not have any annul-true or annul-false
+	slots, then write out a dummy eligible_for_annul_true or
+	eligible_for_annul_false as needed.
+
 2015-10-22  Nick Clifton  <nickc@redhat.com>
 
 	* config/msp430/msp430.opt: Add -msilicon-errata and
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index 8d1fa6c..32b837c 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -4411,6 +4411,26 @@  write_indent (FILE *outf, int indent)
     fprintf (outf, " ");
 }
 
+/* If the target does not have annul-true or annul-false delay slots, this
+   function will create a dummy eligible_for function on OUTF which always
+   returns false.  KIND will be annul_true or annul_false.  */
+
+static void
+write_dummy_eligible_delay (FILE *outf, const char *kind)
+{
+  /* Write function prelude.  */
+
+  fprintf (outf, "int\n");
+  fprintf (outf, "eligible_for_%s (rtx_insn *delay_insn ATTRIBUTE_UNUSED,\n"
+		 "    int slot ATTRIBUTE_UNUSED,\n"
+		 "    rtx_insn *candidate_insn ATTRIBUTE_UNUSED,\n"
+		 "    int flags ATTRIBUTE_UNUSED)\n",
+	   kind);
+  fprintf (outf, "{\n");
+  fprintf (outf, "  return 0;\n");
+  fprintf (outf, "}\n\n");
+}
+
 /* Write a subroutine that is given an insn that requires a delay slot, a
    delay slot ordinal, and a candidate insn.  It returns nonzero if the
    candidate can be placed in the specified delay slot of the insn.
@@ -5307,8 +5327,14 @@  main (int argc, char **argv)
      (The function to compute the number of delay slots will be written
      below.)  */
   write_eligible_delay (attr_file, "delay");
-  write_eligible_delay (attr_file, "annul_true");
-  write_eligible_delay (attr_file, "annul_false");
+  if (have_annul_true)
+    write_eligible_delay (attr_file, "annul_true");
+  else
+    write_dummy_eligible_delay (attr_file, "annul_true");
+  if (have_annul_false)
+    write_eligible_delay (attr_file, "annul_false");
+  else
+    write_dummy_eligible_delay (attr_file, "annul_false");
 
   /* Write out constant delay slot info.  */
   write_const_num_delay_slots (attr_file);