diff mbox series

[gensupport] PR 91255: Do not error out immediately on set_attr_alternative with define_subst

Message ID 12c86354-4874-e0bd-9599-39bad9398b74@foss.arm.com
State New
Headers show
Series [gensupport] PR 91255: Do not error out immediately on set_attr_alternative with define_subst | expand

Commit Message

Kyrill Tkachov Aug. 15, 2019, 3:44 p.m. UTC
Hi all,

I'm trying to add a define_subst use in the arm backend but am getting 
many build errors complaining about:
`set_attr_alternative' is unsupported by `define_subst'

Looking at the gensupport.c code it iterates over all define_insns and 
errors if any of them have set_attr_alternative.

The usecase I'm targetting doesn't involve patterns with 
set_attr_alternative, so I would like to make the define_subst handling
more robust to only error out if the define_subst is actually attempted 
on a set_attr_alternative.

This patch produces the error only if the set_attr_alternative attr 
matches the subst name.
This allows a build of the arm backend with a define_subst usage to succeed.

Bootstrapped and tested on arm-none-linux-gnueabihf and x86_64-linux-gnu.

Ok for trunk?

Thanks,
Kyrill

2019-08-15  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     PR other/91255
     * gensupport.c (has_subst_attribute): Error out on set_attr_alternative
     only if subst_name matches curr_attr string.

Comments

Richard Sandiford Aug. 16, 2019, 9:24 a.m. UTC | #1
Kyrill Tkachov <kyrylo.tkachov@foss.arm.com> writes:
> Hi all,
>
> I'm trying to add a define_subst use in the arm backend but am getting 
> many build errors complaining about:
> `set_attr_alternative' is unsupported by `define_subst'
>
> Looking at the gensupport.c code it iterates over all define_insns and 
> errors if any of them have set_attr_alternative.
>
> The usecase I'm targetting doesn't involve patterns with 
> set_attr_alternative, so I would like to make the define_subst handling
> more robust to only error out if the define_subst is actually attempted 
> on a set_attr_alternative.
>
> This patch produces the error only if the set_attr_alternative attr 
> matches the subst name.
> This allows a build of the arm backend with a define_subst usage to succeed.
>
> Bootstrapped and tested on arm-none-linux-gnueabihf and x86_64-linux-gnu.
>
> Ok for trunk?

OK, thanks.

Richard

>
> Thanks,
> Kyrill
>
> 2019-08-15  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>      PR other/91255
>      * gensupport.c (has_subst_attribute): Error out on set_attr_alternative
>      only if subst_name matches curr_attr string.
>
> diff --git a/gcc/gensupport.c b/gcc/gensupport.c
> index 1aab7119901..c64f683bc5c 100644
> --- a/gcc/gensupport.c
> +++ b/gcc/gensupport.c
> @@ -788,9 +788,10 @@ has_subst_attribute (class queue_elem *elem, class queue_elem *subst_elem)
>  	  return false;
>  
>  	case SET_ATTR_ALTERNATIVE:
> -	  error_at (elem->loc,
> -		    "%s: `set_attr_alternative' is unsupported by "
> -		    "`define_subst'", XSTR (elem->data, 0));
> +	  if (strcmp (XSTR (cur_attr, 0), subst_name) == 0)
> +	    error_at (elem->loc,
> +		      "%s: `set_attr_alternative' is unsupported by "
> +		      "`define_subst'", XSTR (elem->data, 0));
>  	  return false;
>  
>
diff mbox series

Patch

diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index 1aab7119901..c64f683bc5c 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -788,9 +788,10 @@  has_subst_attribute (class queue_elem *elem, class queue_elem *subst_elem)
 	  return false;
 
 	case SET_ATTR_ALTERNATIVE:
-	  error_at (elem->loc,
-		    "%s: `set_attr_alternative' is unsupported by "
-		    "`define_subst'", XSTR (elem->data, 0));
+	  if (strcmp (XSTR (cur_attr, 0), subst_name) == 0)
+	    error_at (elem->loc,
+		      "%s: `set_attr_alternative' is unsupported by "
+		      "`define_subst'", XSTR (elem->data, 0));
 	  return false;