public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Mark predicates generated by genmatch as static
@ 2016-04-28 13:50 Patrick Palka
  2016-04-28 14:02 ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Palka @ 2016-04-28 13:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: Patrick Palka

The predicate functions emitted by genmatch are expected to only be used
locally within {gimple,generic}-match.c, so this patch marks them as
static.  Does this look OK to commit after bootstrap and regtest?

gcc/ChangeLog:

	* genmatch.c (write_predicate): Mark the emitted function as
	static.
---
 gcc/genmatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index ce964fa..2f5147f 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -3552,7 +3552,7 @@ decision_tree::gen (FILE *f, bool gimple)
 void
 write_predicate (FILE *f, predicate_id *p, decision_tree &dt, bool gimple)
 {
-  fprintf (f, "\nbool\n"
+  fprintf (f, "\nstatic bool\n"
 	   "%s%s (tree t%s%s)\n"
 	   "{\n", gimple ? "gimple_" : "tree_", p->id,
 	   p->nargs > 0 ? ", tree *res_ops" : "",
-- 
2.8.1.361.g2fbef4c

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

* Re: [PATCH] Mark predicates generated by genmatch as static
  2016-04-28 13:50 [PATCH] Mark predicates generated by genmatch as static Patrick Palka
@ 2016-04-28 14:02 ` Richard Biener
  2016-04-28 14:13   ` Patrick Palka
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2016-04-28 14:02 UTC (permalink / raw)
  To: Patrick Palka; +Cc: GCC Patches

On Thu, Apr 28, 2016 at 3:50 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
> The predicate functions emitted by genmatch are expected to only be used
> locally within {gimple,generic}-match.c, so this patch marks them as
> static.  Does this look OK to commit after bootstrap and regtest?

Actually the idea was to for example generate predicates in match.pd
format for things like vectorizer pattern recog (I've done this for a few,
need to search for (partial) patches on my disk), so they are supposed
to be externally visible.

Of course we might want to make that explicit in some way with
a (extern_match ...) [or by prefixing local ones with a '*' ...].

Richard.

> gcc/ChangeLog:
>
>         * genmatch.c (write_predicate): Mark the emitted function as
>         static.
> ---
>  gcc/genmatch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/genmatch.c b/gcc/genmatch.c
> index ce964fa..2f5147f 100644
> --- a/gcc/genmatch.c
> +++ b/gcc/genmatch.c
> @@ -3552,7 +3552,7 @@ decision_tree::gen (FILE *f, bool gimple)
>  void
>  write_predicate (FILE *f, predicate_id *p, decision_tree &dt, bool gimple)
>  {
> -  fprintf (f, "\nbool\n"
> +  fprintf (f, "\nstatic bool\n"
>            "%s%s (tree t%s%s)\n"
>            "{\n", gimple ? "gimple_" : "tree_", p->id,
>            p->nargs > 0 ? ", tree *res_ops" : "",
> --
> 2.8.1.361.g2fbef4c
>

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

* Re: [PATCH] Mark predicates generated by genmatch as static
  2016-04-28 14:02 ` Richard Biener
@ 2016-04-28 14:13   ` Patrick Palka
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick Palka @ 2016-04-28 14:13 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

On Thu, Apr 28, 2016 at 10:02 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Thu, Apr 28, 2016 at 3:50 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
>> The predicate functions emitted by genmatch are expected to only be used
>> locally within {gimple,generic}-match.c, so this patch marks them as
>> static.  Does this look OK to commit after bootstrap and regtest?
>
> Actually the idea was to for example generate predicates in match.pd
> format for things like vectorizer pattern recog (I've done this for a few,
> need to search for (partial) patches on my disk), so they are supposed
> to be externally visible.
>
> Of course we might want to make that explicit in some way with
> a (extern_match ...) [or by prefixing local ones with a '*' ...].

Oh, I see.  That sounds useful.

>
> Richard.
>
>> gcc/ChangeLog:
>>
>>         * genmatch.c (write_predicate): Mark the emitted function as
>>         static.
>> ---
>>  gcc/genmatch.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gcc/genmatch.c b/gcc/genmatch.c
>> index ce964fa..2f5147f 100644
>> --- a/gcc/genmatch.c
>> +++ b/gcc/genmatch.c
>> @@ -3552,7 +3552,7 @@ decision_tree::gen (FILE *f, bool gimple)
>>  void
>>  write_predicate (FILE *f, predicate_id *p, decision_tree &dt, bool gimple)
>>  {
>> -  fprintf (f, "\nbool\n"
>> +  fprintf (f, "\nstatic bool\n"
>>            "%s%s (tree t%s%s)\n"
>>            "{\n", gimple ? "gimple_" : "tree_", p->id,
>>            p->nargs > 0 ? ", tree *res_ops" : "",
>> --
>> 2.8.1.361.g2fbef4c
>>

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

end of thread, other threads:[~2016-04-28 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-28 13:50 [PATCH] Mark predicates generated by genmatch as static Patrick Palka
2016-04-28 14:02 ` Richard Biener
2016-04-28 14:13   ` Patrick Palka

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).