public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFC][PATCH] Introduce -fdump*-folding
@ 2017-05-03  8:14 Martin Liška
  2017-05-03  8:20 ` Andrew Pinski
  2017-05-03 10:16 ` Richard Biener
  0 siblings, 2 replies; 54+ messages in thread
From: Martin Liška @ 2017-05-03  8:14 UTC (permalink / raw)
  To: GCC Patches; +Cc: Richard Biener

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

Hello

Last release cycle I spent quite some time with reading of IVOPTS pass
dump file. Using -fdump*-details causes to generate a lot of 'Applying pattern'
lines, which can make reading of a dump file more complicated.

There are stats for tramp3d with -O2 and -fdump-tree-all-details. Percentage number
shows how many lines are of the aforementioned pattern:

                        tramp3d-v4.cpp.164t.ivopts: 6.34%
                          tramp3d-v4.cpp.091t.ccp2: 5.04%
                      tramp3d-v4.cpp.093t.cunrolli: 4.41%
                      tramp3d-v4.cpp.129t.laddress: 3.70%
                          tramp3d-v4.cpp.032t.ccp1: 2.31%
                          tramp3d-v4.cpp.038t.evrp: 1.90%
                     tramp3d-v4.cpp.033t.forwprop1: 1.74%
                          tramp3d-v4.cpp.103t.vrp1: 1.52%
                     tramp3d-v4.cpp.124t.forwprop3: 1.31%
                          tramp3d-v4.cpp.181t.vrp2: 1.30%
                       tramp3d-v4.cpp.161t.cunroll: 1.22%
                    tramp3d-v4.cpp.027t.fixup_cfg3: 1.11%
                       tramp3d-v4.cpp.153t.ivcanon: 1.07%
                          tramp3d-v4.cpp.126t.ccp3: 0.96%
                          tramp3d-v4.cpp.143t.sccp: 0.91%
                     tramp3d-v4.cpp.185t.forwprop4: 0.82%
                           tramp3d-v4.cpp.011t.cfg: 0.74%
                     tramp3d-v4.cpp.096t.forwprop2: 0.50%
                    tramp3d-v4.cpp.019t.fixup_cfg1: 0.37%
                     tramp3d-v4.cpp.120t.phicprop1: 0.33%
                           tramp3d-v4.cpp.133t.pre: 0.32%
                     tramp3d-v4.cpp.182t.phicprop2: 0.27%
                    tramp3d-v4.cpp.170t.veclower21: 0.25%
                       tramp3d-v4.cpp.029t.einline: 0.24%

I'm suggesting to add new TDF that will be allocated for that.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Thoughts?
Martin

[-- Attachment #2: 0001-Introduce-fdump-folding.patch --]
[-- Type: text/x-patch, Size: 2483 bytes --]

From c1b832212576fd9f89fd738ae0cc98e9fb189c1d Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 1 Feb 2017 15:34:52 +0100
Subject: [PATCH] Introduce -fdump*-folding

gcc/ChangeLog:

2017-05-03  Martin Liska  <mliska@suse.cz>

	* dumpfile.c: Add TDF_FOLDING.
	* dumpfile.h (enum tree_dump_index): Add to the enum.
	* genmatch.c (dt_simplify::gen_1): Use the newly added enum
	value.
---
 gcc/dumpfile.c | 1 +
 gcc/dumpfile.h | 7 ++++---
 gcc/genmatch.c | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 6b9a47c5a26..b9c881c103f 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -111,6 +111,7 @@ static const struct dump_option_value_info dump_options[] =
   {"enumerate_locals", TDF_ENUMERATE_LOCALS},
   {"scev", TDF_SCEV},
   {"gimple", TDF_GIMPLE},
+  {"folding", TDF_FOLDING},
   {"optimized", MSG_OPTIMIZED_LOCATIONS},
   {"missed", MSG_MISSED_OPTIMIZATION},
   {"note", MSG_NOTE},
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index fef58f5e9b1..69c4ec0f861 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -84,9 +84,10 @@ enum tree_dump_index
 #define TDF_SCEV	(1 << 24)	/* Dump SCEV details.  */
 #define TDF_COMMENT	(1 << 25)	/* Dump lines with prefix ";;"  */
 #define TDF_GIMPLE	(1 << 26)	/* Dump in GIMPLE FE syntax  */
-#define MSG_OPTIMIZED_LOCATIONS  (1 << 27)  /* -fopt-info optimized sources */
-#define MSG_MISSED_OPTIMIZATION  (1 << 28)  /* missed opportunities */
-#define MSG_NOTE                 (1 << 29)  /* general optimization info */
+#define TDF_FOLDING	(1 << 27)	/* Dump folding details.  */
+#define MSG_OPTIMIZED_LOCATIONS  (1 << 28)  /* -fopt-info optimized sources */
+#define MSG_MISSED_OPTIMIZATION  (1 << 29)  /* missed opportunities */
+#define MSG_NOTE                 (1 << 30)  /* general optimization info */
 #define MSG_ALL         (MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION \
                          | MSG_NOTE)
 
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 5621aa05b59..979d6856084 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -3187,7 +3187,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
 	}
     }
 
-  fprintf_indent (f, indent, "if (dump_file && (dump_flags & TDF_DETAILS)) "
+  fprintf_indent (f, indent, "if (dump_file && (dump_flags & TDF_FOLDING)) "
 	   "fprintf (dump_file, \"Applying pattern ");
   output_line_directive (f,
 			 result ? result->location : s->match->location, true);
-- 
2.12.2


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

* Re: [RFC][PATCH] Introduce -fdump*-folding
  2017-05-03  8:14 [RFC][PATCH] Introduce -fdump*-folding Martin Liška
@ 2017-05-03  8:20 ` Andrew Pinski
  2017-05-03 10:16 ` Richard Biener
  1 sibling, 0 replies; 54+ messages in thread
From: Andrew Pinski @ 2017-05-03  8:20 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches, Richard Biener

On Wed, May 3, 2017 at 1:10 AM, Martin Liška <mliska@suse.cz> wrote:
> Hello
>
> Last release cycle I spent quite some time with reading of IVOPTS pass
> dump file. Using -fdump*-details causes to generate a lot of 'Applying pattern'
> lines, which can make reading of a dump file more complicated.

Yes the folding message can get annoying.  Especially when it is not
clear what is being folded which is the case a lot of the time I have
seen the message.

Thanks,
Andrew

>
> There are stats for tramp3d with -O2 and -fdump-tree-all-details. Percentage number
> shows how many lines are of the aforementioned pattern:
>
>                         tramp3d-v4.cpp.164t.ivopts: 6.34%
>                           tramp3d-v4.cpp.091t.ccp2: 5.04%
>                       tramp3d-v4.cpp.093t.cunrolli: 4.41%
>                       tramp3d-v4.cpp.129t.laddress: 3.70%
>                           tramp3d-v4.cpp.032t.ccp1: 2.31%
>                           tramp3d-v4.cpp.038t.evrp: 1.90%
>                      tramp3d-v4.cpp.033t.forwprop1: 1.74%
>                           tramp3d-v4.cpp.103t.vrp1: 1.52%
>                      tramp3d-v4.cpp.124t.forwprop3: 1.31%
>                           tramp3d-v4.cpp.181t.vrp2: 1.30%
>                        tramp3d-v4.cpp.161t.cunroll: 1.22%
>                     tramp3d-v4.cpp.027t.fixup_cfg3: 1.11%
>                        tramp3d-v4.cpp.153t.ivcanon: 1.07%
>                           tramp3d-v4.cpp.126t.ccp3: 0.96%
>                           tramp3d-v4.cpp.143t.sccp: 0.91%
>                      tramp3d-v4.cpp.185t.forwprop4: 0.82%
>                            tramp3d-v4.cpp.011t.cfg: 0.74%
>                      tramp3d-v4.cpp.096t.forwprop2: 0.50%
>                     tramp3d-v4.cpp.019t.fixup_cfg1: 0.37%
>                      tramp3d-v4.cpp.120t.phicprop1: 0.33%
>                            tramp3d-v4.cpp.133t.pre: 0.32%
>                      tramp3d-v4.cpp.182t.phicprop2: 0.27%
>                     tramp3d-v4.cpp.170t.veclower21: 0.25%
>                        tramp3d-v4.cpp.029t.einline: 0.24%
>
> I'm suggesting to add new TDF that will be allocated for that.
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Thoughts?
> Martin

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

* Re: [RFC][PATCH] Introduce -fdump*-folding
  2017-05-03  8:14 [RFC][PATCH] Introduce -fdump*-folding Martin Liška
  2017-05-03  8:20 ` Andrew Pinski
@ 2017-05-03 10:16 ` Richard Biener
  2017-05-04  9:23   ` Martin Liška
  1 sibling, 1 reply; 54+ messages in thread
From: Richard Biener @ 2017-05-03 10:16 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Wed, May 3, 2017 at 10:10 AM, Martin Liška <mliska@suse.cz> wrote:
> Hello
>
> Last release cycle I spent quite some time with reading of IVOPTS pass
> dump file. Using -fdump*-details causes to generate a lot of 'Applying pattern'
> lines, which can make reading of a dump file more complicated.
>
> There are stats for tramp3d with -O2 and -fdump-tree-all-details. Percentage number
> shows how many lines are of the aforementioned pattern:
>
>                         tramp3d-v4.cpp.164t.ivopts: 6.34%
>                           tramp3d-v4.cpp.091t.ccp2: 5.04%
>                       tramp3d-v4.cpp.093t.cunrolli: 4.41%
>                       tramp3d-v4.cpp.129t.laddress: 3.70%
>                           tramp3d-v4.cpp.032t.ccp1: 2.31%
>                           tramp3d-v4.cpp.038t.evrp: 1.90%
>                      tramp3d-v4.cpp.033t.forwprop1: 1.74%
>                           tramp3d-v4.cpp.103t.vrp1: 1.52%
>                      tramp3d-v4.cpp.124t.forwprop3: 1.31%
>                           tramp3d-v4.cpp.181t.vrp2: 1.30%
>                        tramp3d-v4.cpp.161t.cunroll: 1.22%
>                     tramp3d-v4.cpp.027t.fixup_cfg3: 1.11%
>                        tramp3d-v4.cpp.153t.ivcanon: 1.07%
>                           tramp3d-v4.cpp.126t.ccp3: 0.96%
>                           tramp3d-v4.cpp.143t.sccp: 0.91%
>                      tramp3d-v4.cpp.185t.forwprop4: 0.82%
>                            tramp3d-v4.cpp.011t.cfg: 0.74%
>                      tramp3d-v4.cpp.096t.forwprop2: 0.50%
>                     tramp3d-v4.cpp.019t.fixup_cfg1: 0.37%
>                      tramp3d-v4.cpp.120t.phicprop1: 0.33%
>                            tramp3d-v4.cpp.133t.pre: 0.32%
>                      tramp3d-v4.cpp.182t.phicprop2: 0.27%
>                     tramp3d-v4.cpp.170t.veclower21: 0.25%
>                        tramp3d-v4.cpp.029t.einline: 0.24%
>
> I'm suggesting to add new TDF that will be allocated for that.
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Thoughts?

Ok.  Soon we'll want to change dump_flags to uint64_t ...  (we have 1 bit left
if you allow negative dump_flags).  It'll tickle down on a lot of interfaces
so introducing dump_flags_t at the same time might be a good idea.

Thanks,
Richard.

> Martin

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

* Re: [RFC][PATCH] Introduce -fdump*-folding
  2017-05-03 10:16 ` Richard Biener
@ 2017-05-04  9:23   ` Martin Liška
  2017-05-04 10:41     ` Richard Biener
  0 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-04  9:23 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

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

On 05/03/2017 12:12 PM, Richard Biener wrote:
> On Wed, May 3, 2017 at 10:10 AM, Martin Liška <mliska@suse.cz> wrote:
>> Hello
>>
>> Last release cycle I spent quite some time with reading of IVOPTS pass
>> dump file. Using -fdump*-details causes to generate a lot of 'Applying pattern'
>> lines, which can make reading of a dump file more complicated.
>>
>> There are stats for tramp3d with -O2 and -fdump-tree-all-details. Percentage number
>> shows how many lines are of the aforementioned pattern:
>>
>>                         tramp3d-v4.cpp.164t.ivopts: 6.34%
>>                           tramp3d-v4.cpp.091t.ccp2: 5.04%
>>                       tramp3d-v4.cpp.093t.cunrolli: 4.41%
>>                       tramp3d-v4.cpp.129t.laddress: 3.70%
>>                           tramp3d-v4.cpp.032t.ccp1: 2.31%
>>                           tramp3d-v4.cpp.038t.evrp: 1.90%
>>                      tramp3d-v4.cpp.033t.forwprop1: 1.74%
>>                           tramp3d-v4.cpp.103t.vrp1: 1.52%
>>                      tramp3d-v4.cpp.124t.forwprop3: 1.31%
>>                           tramp3d-v4.cpp.181t.vrp2: 1.30%
>>                        tramp3d-v4.cpp.161t.cunroll: 1.22%
>>                     tramp3d-v4.cpp.027t.fixup_cfg3: 1.11%
>>                        tramp3d-v4.cpp.153t.ivcanon: 1.07%
>>                           tramp3d-v4.cpp.126t.ccp3: 0.96%
>>                           tramp3d-v4.cpp.143t.sccp: 0.91%
>>                      tramp3d-v4.cpp.185t.forwprop4: 0.82%
>>                            tramp3d-v4.cpp.011t.cfg: 0.74%
>>                      tramp3d-v4.cpp.096t.forwprop2: 0.50%
>>                     tramp3d-v4.cpp.019t.fixup_cfg1: 0.37%
>>                      tramp3d-v4.cpp.120t.phicprop1: 0.33%
>>                            tramp3d-v4.cpp.133t.pre: 0.32%
>>                      tramp3d-v4.cpp.182t.phicprop2: 0.27%
>>                     tramp3d-v4.cpp.170t.veclower21: 0.25%
>>                        tramp3d-v4.cpp.029t.einline: 0.24%
>>
>> I'm suggesting to add new TDF that will be allocated for that.
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>
>> Thoughts?
>
> Ok.  Soon we'll want to change dump_flags to uint64_t ...  (we have 1 bit left
> if you allow negative dump_flags).  It'll tickle down on a lot of interfaces
> so introducing dump_flags_t at the same time might be a good idea.

Hello.

I've prepared patch that migrates all interfaces and introduces dump_flags_t. I've been
currently testing that. Apart from that Richi requested to come up with more generic approach
of hierarchical structure of options.

Can you please take a look at self-contained source file that shows way I've decided to go?
Another question is whether we want to implement also "aliases", where for instance
current 'all' is equal to union of couple of suboptions?

Thanks for feedback,
Martin

>
> Thanks,
> Richard.
>
>> Martin


[-- Attachment #2: hierarchy.C --]
[-- Type: text/x-c++src, Size: 4012 bytes --]

#include <cstdint>
#include <vector>
#include "stdio.h"
#include "string.h"

using namespace std;

enum dump_option_enum
{
  FOLDING,
  FOLDING_GIMPLE,
  FOLDING_GIMPLE_CTOR,
  FOLDING_GIMPLE_MATCH,
  FOLDING_GENERIC,
  FOLDING_GENERIC_C,
  FOLDING_GENERIC_CPP,
  DUMP_OPTION_COUNT
};

struct dump_option_node
{
  inline dump_option_node (const char *_name, dump_option_enum _enum_value);
  inline void initialize (uint64_t *mask_translation);
  inline uint64_t initialize_masks (unsigned *current, uint64_t *mask_translation);
  inline uint64_t parse(char *token);

  const char *name;
  dump_option_enum enum_value;
  vector<dump_option_node *> children;
  uint64_t mask;
};

dump_option_node::dump_option_node (const char *_name,
				    dump_option_enum _enum_value):
  name (_name), enum_value (_enum_value), mask (0)
{}

void
dump_option_node::initialize (uint64_t *mask_translation)
{
  unsigned current = 0;
  initialize_masks (&current, mask_translation);
}

uint64_t
dump_option_node::initialize_masks (unsigned *current, uint64_t *mask_translation)
{
  if (children.empty ())
    mask = (1 << ((*current)++));
  // TODO: add assert
  else
    {
      uint64_t combined = 0;
      for (unsigned i = 0; i < children.size (); i++)
	combined |= children[i]->initialize_masks (current, mask_translation);

      mask = combined;
    }

  mask_translation[enum_value] = mask;
  return mask;
}

uint64_t
dump_option_node::parse(char *token)
{
  if (token == NULL)
    return mask;

  for (unsigned i = 0; i < children.size (); i++)
    if (strcmp (children[i]->name, token) == 0)
    {
      token = strtok (NULL, "-");
      return children[i]->parse (token); 
    }

  return 0;
}

struct dump_flags_t
{
  dump_flags_t ();
  dump_flags_t (uint64_t mask);
  dump_flags_t (dump_option_enum enum_value);

  inline void operator|= (dump_flags_t other)
  {
    m_mask |= other.m_mask;
  }

  inline void operator&= (dump_flags_t other)
  {
    m_mask &= other.m_mask;
  }

  inline bool operator& (dump_flags_t other)
  {
    return m_mask & other.m_mask;
  }

  static inline void init ();
  static dump_flags_t parse (char *option);

  uint64_t m_mask;

  static dump_option_node *root;
  static uint64_t mask_translation[DUMP_OPTION_COUNT];
};

dump_flags_t::dump_flags_t (): m_mask (0)
{}

dump_flags_t::dump_flags_t (uint64_t mask): m_mask (mask)
{}

dump_flags_t::dump_flags_t (dump_option_enum enum_value)
{
  // TODO: add checking assert
  m_mask = mask_translation[enum_value];
}

dump_option_node *dump_flags_t::root = nullptr;
uint64_t dump_flags_t::mask_translation[DUMP_OPTION_COUNT];

void
dump_flags_t::init ()
{
  dump_option_node *n;

  n = new dump_option_node ("gimple", FOLDING_GIMPLE);
  n->children.push_back (new dump_option_node ("ctor", FOLDING_GIMPLE_CTOR));
  n->children.push_back (new dump_option_node ("match", FOLDING_GIMPLE_MATCH));

  root = new dump_option_node ("folding", FOLDING);
  root->children.push_back (n);

  n = new dump_option_node ("generic", FOLDING_GENERIC);
  n->children.push_back (new dump_option_node ("c", FOLDING_GENERIC_C));
  n->children.push_back (new dump_option_node ("cpp", FOLDING_GENERIC_CPP));

  root->children.push_back (n);

  root->initialize (mask_translation);
}

dump_flags_t
dump_flags_t::parse (char *option)
{
  char *token = strtok (option, "-");
  if (token == NULL)
    return dump_flags_t ();
  return dump_flags_t (root->parse (token));
}


int main()
{
  dump_flags_t::init ();

  dump_flags_t flags;
  flags |= FOLDING_GIMPLE;
  flags &= FOLDING_GENERIC;

  if (flags & FOLDING_GENERIC)
    __builtin_abort ();

  dump_flags_t flags2 = dump_flags_t::parse (strdup("gimple-match2"));
  if (!flags2.m_mask)
    fprintf (stderr, "invalid option!!\n");

  flags2 = dump_flags_t::parse (strdup("gimple-match"));
  fprintf (stderr, "flags2 mask: 0x%.8x\n", flags2);
//  for (unsigned i = 0; i < dump_flags_t::root->children.size (); i++)
//    fprintf (stderr, "%s: mask: 0x%.8x\n", root->children[i]->name, root->children[i]->mask);
}

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

* Re: [RFC][PATCH] Introduce -fdump*-folding
  2017-05-04  9:23   ` Martin Liška
@ 2017-05-04 10:41     ` Richard Biener
  2017-05-04 12:06       ` Martin Liška
  0 siblings, 1 reply; 54+ messages in thread
From: Richard Biener @ 2017-05-04 10:41 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Thu, May 4, 2017 at 11:22 AM, Martin Liška <mliska@suse.cz> wrote:
> On 05/03/2017 12:12 PM, Richard Biener wrote:
>>
>> On Wed, May 3, 2017 at 10:10 AM, Martin Liška <mliska@suse.cz> wrote:
>>>
>>> Hello
>>>
>>> Last release cycle I spent quite some time with reading of IVOPTS pass
>>> dump file. Using -fdump*-details causes to generate a lot of 'Applying
>>> pattern'
>>> lines, which can make reading of a dump file more complicated.
>>>
>>> There are stats for tramp3d with -O2 and -fdump-tree-all-details.
>>> Percentage number
>>> shows how many lines are of the aforementioned pattern:
>>>
>>>                         tramp3d-v4.cpp.164t.ivopts: 6.34%
>>>                           tramp3d-v4.cpp.091t.ccp2: 5.04%
>>>                       tramp3d-v4.cpp.093t.cunrolli: 4.41%
>>>                       tramp3d-v4.cpp.129t.laddress: 3.70%
>>>                           tramp3d-v4.cpp.032t.ccp1: 2.31%
>>>                           tramp3d-v4.cpp.038t.evrp: 1.90%
>>>                      tramp3d-v4.cpp.033t.forwprop1: 1.74%
>>>                           tramp3d-v4.cpp.103t.vrp1: 1.52%
>>>                      tramp3d-v4.cpp.124t.forwprop3: 1.31%
>>>                           tramp3d-v4.cpp.181t.vrp2: 1.30%
>>>                        tramp3d-v4.cpp.161t.cunroll: 1.22%
>>>                     tramp3d-v4.cpp.027t.fixup_cfg3: 1.11%
>>>                        tramp3d-v4.cpp.153t.ivcanon: 1.07%
>>>                           tramp3d-v4.cpp.126t.ccp3: 0.96%
>>>                           tramp3d-v4.cpp.143t.sccp: 0.91%
>>>                      tramp3d-v4.cpp.185t.forwprop4: 0.82%
>>>                            tramp3d-v4.cpp.011t.cfg: 0.74%
>>>                      tramp3d-v4.cpp.096t.forwprop2: 0.50%
>>>                     tramp3d-v4.cpp.019t.fixup_cfg1: 0.37%
>>>                      tramp3d-v4.cpp.120t.phicprop1: 0.33%
>>>                            tramp3d-v4.cpp.133t.pre: 0.32%
>>>                      tramp3d-v4.cpp.182t.phicprop2: 0.27%
>>>                     tramp3d-v4.cpp.170t.veclower21: 0.25%
>>>                        tramp3d-v4.cpp.029t.einline: 0.24%
>>>
>>> I'm suggesting to add new TDF that will be allocated for that.
>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression
>>> tests.
>>>
>>> Thoughts?
>>
>>
>> Ok.  Soon we'll want to change dump_flags to uint64_t ...  (we have 1 bit
>> left
>> if you allow negative dump_flags).  It'll tickle down on a lot of
>> interfaces
>> so introducing dump_flags_t at the same time might be a good idea.
>
>
> Hello.
>
> I've prepared patch that migrates all interfaces and introduces
> dump_flags_t.

Great.

> I've been
> currently testing that. Apart from that Richi requested to come up with more
> generic approach
> of hierarchical structure of options.

Didn't really "request" it, it's just something we eventually need to do when
we run out of bits again ;)

>
> Can you please take a look at self-contained source file that shows way I've
> decided to go?
> Another question is whether we want to implement also "aliases", where for
> instance
> current 'all' is equal to union of couple of suboptions?

Yeah, I think we do want -all-all-all and -foo-all to work.  Not sure
about -all-foo-all.

The important thing is to make sure dump_flags_t stays POD and thus is
eligible to be passed in register(s).  In the end we might simply come up
with a two-level hierarchy, each 32bits (or we can even get back to 32bits
in total with two times 16bits).

It looks you didn't actually implement this as a hierarchy though but
still allocate from one pool of bits (so you only do a change to how
users access this?)

Thanks,
Richard.

>
> Thanks for feedback,
> Martin
>
>>
>> Thanks,
>> Richard.
>>
>>> Martin
>
>

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

* Re: [RFC][PATCH] Introduce -fdump*-folding
  2017-05-04 10:41     ` Richard Biener
@ 2017-05-04 12:06       ` Martin Liška
  2017-05-05 10:44         ` [PATCH 1/N] Introduce dump_flags_t type and use it instead of int type Martin Liška
                           ` (2 more replies)
  0 siblings, 3 replies; 54+ messages in thread
From: Martin Liška @ 2017-05-04 12:06 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

On 05/04/2017 12:40 PM, Richard Biener wrote:
> On Thu, May 4, 2017 at 11:22 AM, Martin Liška <mliska@suse.cz> wrote:
>> On 05/03/2017 12:12 PM, Richard Biener wrote:
>>>
>>> On Wed, May 3, 2017 at 10:10 AM, Martin Liška <mliska@suse.cz> wrote:
>>>>
>>>> Hello
>>>>
>>>> Last release cycle I spent quite some time with reading of IVOPTS pass
>>>> dump file. Using -fdump*-details causes to generate a lot of 'Applying
>>>> pattern'
>>>> lines, which can make reading of a dump file more complicated.
>>>>
>>>> There are stats for tramp3d with -O2 and -fdump-tree-all-details.
>>>> Percentage number
>>>> shows how many lines are of the aforementioned pattern:
>>>>
>>>>                         tramp3d-v4.cpp.164t.ivopts: 6.34%
>>>>                           tramp3d-v4.cpp.091t.ccp2: 5.04%
>>>>                       tramp3d-v4.cpp.093t.cunrolli: 4.41%
>>>>                       tramp3d-v4.cpp.129t.laddress: 3.70%
>>>>                           tramp3d-v4.cpp.032t.ccp1: 2.31%
>>>>                           tramp3d-v4.cpp.038t.evrp: 1.90%
>>>>                      tramp3d-v4.cpp.033t.forwprop1: 1.74%
>>>>                           tramp3d-v4.cpp.103t.vrp1: 1.52%
>>>>                      tramp3d-v4.cpp.124t.forwprop3: 1.31%
>>>>                           tramp3d-v4.cpp.181t.vrp2: 1.30%
>>>>                        tramp3d-v4.cpp.161t.cunroll: 1.22%
>>>>                     tramp3d-v4.cpp.027t.fixup_cfg3: 1.11%
>>>>                        tramp3d-v4.cpp.153t.ivcanon: 1.07%
>>>>                           tramp3d-v4.cpp.126t.ccp3: 0.96%
>>>>                           tramp3d-v4.cpp.143t.sccp: 0.91%
>>>>                      tramp3d-v4.cpp.185t.forwprop4: 0.82%
>>>>                            tramp3d-v4.cpp.011t.cfg: 0.74%
>>>>                      tramp3d-v4.cpp.096t.forwprop2: 0.50%
>>>>                     tramp3d-v4.cpp.019t.fixup_cfg1: 0.37%
>>>>                      tramp3d-v4.cpp.120t.phicprop1: 0.33%
>>>>                            tramp3d-v4.cpp.133t.pre: 0.32%
>>>>                      tramp3d-v4.cpp.182t.phicprop2: 0.27%
>>>>                     tramp3d-v4.cpp.170t.veclower21: 0.25%
>>>>                        tramp3d-v4.cpp.029t.einline: 0.24%
>>>>
>>>> I'm suggesting to add new TDF that will be allocated for that.
>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression
>>>> tests.
>>>>
>>>> Thoughts?
>>>
>>>
>>> Ok.  Soon we'll want to change dump_flags to uint64_t ...  (we have 1 bit
>>> left
>>> if you allow negative dump_flags).  It'll tickle down on a lot of
>>> interfaces
>>> so introducing dump_flags_t at the same time might be a good idea.
>>
>>
>> Hello.
>>
>> I've prepared patch that migrates all interfaces and introduces
>> dump_flags_t.
>
> Great.
>
>> I've been
>> currently testing that. Apart from that Richi requested to come up with more
>> generic approach
>> of hierarchical structure of options.
>
> Didn't really "request" it, it's just something we eventually need to do when
> we run out of bits again ;)

I know, but it was me who came up with the idea of more fine suboptions :)

>
>>
>> Can you please take a look at self-contained source file that shows way I've
>> decided to go?
>> Another question is whether we want to implement also "aliases", where for
>> instance
>> current 'all' is equal to union of couple of suboptions?
>
> Yeah, I think we do want -all-all-all and -foo-all to work.  Not sure
> about -all-foo-all.

Actually only having 'all' is quite easy to implement.

Let's imagine following hierarchy:

(root)
- vops
- folding
   - gimple
     - ctor
     - array_ref
     - arithmetic
   - generic
     - c
     - c++
     - ctor
     - xyz

Then '-fdump-passname-folding-all' will be equal to '-fdump-passname-folding'.

>
> The important thing is to make sure dump_flags_t stays POD and thus is
> eligible to be passed in register(s).  In the end we might simply come up
> with a two-level hierarchy, each 32bits (or we can even get back to 32bits
> in total with two times 16bits).

I'm aware of having the type as POD.

>
> It looks you didn't actually implement this as a hierarchy though but
> still allocate from one pool of bits (so you only do a change to how
> users access this?)

Yep, all leaf options are mapped to a mask and all inner nodes are just union
of suboptions. That will allow us to have 64 leaf suboptions. Reaching the limit
we can encode the values in more sophisticated way. That however brings need
to implement more complicated '&' and '|' operators.

I'll finish the implementation and try to migrate that to current handling.
Guess, I'm quite close.

Martin

>
> Thanks,
> Richard.
>
>>
>> Thanks for feedback,
>> Martin
>>
>>>
>>> Thanks,
>>> Richard.
>>>
>>>> Martin
>>
>>

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

* [PATCH 1/N] Introduce dump_flags_t type and use it instead of int type.
  2017-05-04 12:06       ` Martin Liška
@ 2017-05-05 10:44         ` Martin Liška
  2017-05-05 11:50           ` Richard Biener
  2017-05-05 10:56         ` [PATCH 2/N] Add dump_flags_type<E> for handling of suboptions Martin Liška
  2017-05-05 11:57         ` [RFC][PATCH] Introduce -fdump*-folding Richard Biener
  2 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-05 10:44 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

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

Hello.

There's first patch that just defines dump_flags_t as uint64_t and changes all
corresponding interfaces that do use it. There's a problematic impact that
all targets have to include dumpfile.h just right after coretypes.h. That makes
the patch harder to properly test. I tried couple of cross-compilers and it works.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
I've been also testing i686-linux-gnu bootstrap and x86_64-linux-gnu targets.

Thoughts?
Martin

[-- Attachment #2: 0001-Introduce-dump_flags_t-type-and-use-it-instead-of-in.patch.bz2 --]
[-- Type: application/x-bzip, Size: 33024 bytes --]

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

* [PATCH 2/N] Add dump_flags_type<E> for handling of suboptions.
  2017-05-04 12:06       ` Martin Liška
  2017-05-05 10:44         ` [PATCH 1/N] Introduce dump_flags_t type and use it instead of int type Martin Liška
@ 2017-05-05 10:56         ` Martin Liška
  2017-05-09 12:05           ` Martin Liška
                             ` (2 more replies)
  2017-05-05 11:57         ` [RFC][PATCH] Introduce -fdump*-folding Richard Biener
  2 siblings, 3 replies; 54+ messages in thread
From: Martin Liška @ 2017-05-05 10:56 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

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

Hi.

This one is more interesting as it implements hierarchical option parsing
and as a first step I implemented that for optgroup suboptions.

Next candidates are dump_option_value_info and obviously my primary motivation:
dump_option_value_info.

I'm expecting feedback for implementation I've decided to come up with.
Patch has been tested.

Thanks,
Martin

[-- Attachment #2: 0002-Add-dump_flags_type-E-for-handling-of-suboptions.patch --]
[-- Type: text/x-patch, Size: 13973 bytes --]

From fcb78a3d07f3043766f27f73038f313f914b3976 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 5 May 2017 11:31:18 +0200
Subject: [PATCH 2/2] Add dump_flags_type<E> for handling of suboptions.

gcc/ChangeLog:

2017-05-05  Martin Liska  <mliska@suse.cz>

	* dumpfile.c (dump_option_node::initialize): New function.
	(dump_option_node::initialize_masks): Likewise.
	(dump_option_node::parse): Likewise.
	(gcc::dump_manager::dump_manager): Initialize options.
	(dump_switch_p_1): Use the new parser.
	(initialize_options): New function.
	(opt_info_switch_p_1): Use the new parser.
	(opt_info_switch_p): Use new dump_flags_type<E> type.
	* dumpfile.h (struct dump_option_node): New struct.
	(struct dump_flags_type): Likewise.
	(enum optgroup_types): New enum type.
	(struct dump_file_info): Change type of optgroup_flags.
---
 gcc/dumpfile.c | 141 ++++++++++++++++++++++++++++++++++++++++----------
 gcc/dumpfile.h | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 255 insertions(+), 46 deletions(-)

diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 907ded3695f..82c4fc9d4ff 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -135,17 +135,78 @@ static const struct dump_option_value_info optinfo_verbosity_options[] =
   {NULL, 0}
 };
 
-/* Flags used for -fopt-info groups.  */
-static const struct dump_option_value_info optgroup_options[] =
-{
-  {"ipa", OPTGROUP_IPA},
-  {"loop", OPTGROUP_LOOP},
-  {"inline", OPTGROUP_INLINE},
-  {"omp", OPTGROUP_OMP},
-  {"vec", OPTGROUP_VEC},
-  {"optall", OPTGROUP_ALL},
-  {NULL, 0}
-};
+template <typename E>
+dump_option_node<E>::dump_option_node (const char *name, E enum_value):
+  m_name (name), m_enum_value (enum_value), m_children (), m_mask (0)
+{
+}
+
+template <typename E>
+void
+dump_option_node<E>::initialize (uint64_t *mask_translation)
+{
+  memset (mask_translation, 0, sizeof (uint64_t) * OPT_MASK_SIZE);
+  unsigned current = 0;
+  initialize_masks (&current, mask_translation);
+}
+
+template <typename E>
+uint64_t
+dump_option_node<E>::initialize_masks (unsigned *current,
+				       uint64_t *mask_translation)
+{
+  if (m_children.is_empty ())
+    {
+      gcc_assert (*current < OPT_MASK_SIZE);
+      m_mask = 1 << *current;
+      *current += 1;
+    }
+  else
+    {
+      uint64_t combined = 0;
+      for (unsigned i = 0; i < m_children.length (); i++)
+	combined |= m_children[i]->initialize_masks (current, mask_translation);
+
+      m_mask = combined;
+    }
+
+  mask_translation[m_enum_value] = m_mask;
+  return m_mask;
+}
+
+template <typename E>
+uint64_t
+dump_option_node<E>::parse (const char *token)
+{
+  char *s = xstrdup (token);
+  uint64_t r = parse (s);
+  free (s);
+
+  return r;
+}
+
+template <typename E>
+uint64_t
+dump_option_node<E>::parse (char *token)
+{
+  if (token == NULL)
+    return m_mask;
+
+  if (strcmp (token, "all") == 0)
+  {
+    token = strtok (NULL, "-");
+    return token == NULL ? m_mask : 0;
+  }
+
+  for (unsigned i = 0; i < m_children.length (); i++)
+    if (strcmp (m_children[i]->m_name, token) == 0)
+    {
+      token = strtok (NULL, "-");
+      return m_children[i]->parse (token);
+    }
+
+  return 0;
+}
 
 gcc::dump_manager::dump_manager ():
   m_next_dump (FIRST_AUTO_NUMBERED_DUMP),
@@ -153,6 +214,7 @@ gcc::dump_manager::dump_manager ():
   m_extra_dump_files_in_use (0),
   m_extra_dump_files_alloced (0)
 {
+  initialize_options ();
 }
 
 gcc::dump_manager::~dump_manager ()
@@ -174,12 +236,14 @@ gcc::dump_manager::~dump_manager ()
       XDELETEVEC (const_cast <char *> (dfi->alt_filename));
     }
   XDELETEVEC (m_extra_dump_files);
+
+  delete (optgroup_options);
 }
 
 unsigned int
 gcc::dump_manager::
 dump_register (const char *suffix, const char *swtch, const char *glob,
-	       dump_flags_t flags, int optgroup_flags,
+	       dump_flags_t flags, optgroup_dump_flags_t  optgroup_flags,
 	       bool take_ownership)
 {
   int num = m_next_dump++;
@@ -716,8 +780,8 @@ dump_enable_all (dump_flags_t flags, const char *filename)
 
 int
 gcc::dump_manager::
-opt_info_enable_passes (int optgroup_flags, dump_flags_t flags,
-			const char *filename)
+opt_info_enable_passes (optgroup_dump_flags_t optgroup_flags,
+			dump_flags_t flags, const char *filename)
 {
   int n = 0;
   size_t i;
@@ -808,7 +872,7 @@ dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob)
 	if (strlen (option_ptr->name) == length
 	    && !memcmp (option_ptr->name, ptr, length))
           {
-            flags |= option_ptr->value;
+	    flags |= option_ptr->value;
 	    goto found;
           }
 
@@ -865,15 +929,36 @@ dump_switch_p (const char *arg)
   return any;
 }
 
+void
+gcc::dump_manager::
+initialize_options ()
+{
+  /* Initialize optgroup options.  */
+  typedef dump_option_node<optgroup_types> node;
+
+  optgroup_options = new node (NULL, OPTGROUP_NONE);
+  optgroup_options->register_suboption (new node ("ipa", OPTGROUP_IPA));
+  optgroup_options->register_suboption (new node ("loop", OPTGROUP_LOOP));
+  optgroup_options->register_suboption (new node ("inline", OPTGROUP_INLINE));
+  optgroup_options->register_suboption (new node ("omp", OPTGROUP_OMP));
+  optgroup_options->register_suboption (new node ("vec", OPTGROUP_VEC));
+  optgroup_options->register_suboption (new node ("other", OPTGROUP_OTHER));
+
+  optgroup_options->initialize (optgroup_dump_flags_t::m_mask_translation);
+}
+
 /* Parse ARG as a -fopt-info switch and store flags, optgroup_flags
    and filename.  Return non-zero if it is a recognized switch.  */
 
 static int
-opt_info_switch_p_1 (const char *arg, dump_flags_t *flags, int *optgroup_flags,
-                     char **filename)
+opt_info_switch_p_1 (const char *arg, dump_flags_t *flags,
+		     optgroup_dump_flags_t *optgroup_flags,
+		     char **filename)
 {
   const char *option_value;
   const char *ptr;
+  optgroup_dump_flags_t f;
+  gcc::dump_manager *dumps = g->get_dumps ();
 
   option_value = arg;
   ptr = option_value;
@@ -885,6 +970,7 @@ opt_info_switch_p_1 (const char *arg, dump_flags_t *flags, int *optgroup_flags,
   if (!ptr)
     return 1;       /* Handle '-fopt-info' without any additional options.  */
 
+
   while (*ptr)
     {
       const struct dump_option_value_info *option_ptr;
@@ -909,17 +995,16 @@ opt_info_switch_p_1 (const char *arg, dump_flags_t *flags, int *optgroup_flags,
 	if (strlen (option_ptr->name) == length
 	    && !memcmp (option_ptr->name, ptr, length))
           {
-            *flags |= option_ptr->value;
+	    *flags |= option_ptr->value;
 	    goto found;
-          }
+	  }
 
-      for (option_ptr = optgroup_options; option_ptr->name; option_ptr++)
-	if (strlen (option_ptr->name) == length
-	    && !memcmp (option_ptr->name, ptr, length))
-          {
-            *optgroup_flags |= option_ptr->value;
-	    goto found;
-          }
+      f = dumps->get_optgroup_options ()->parse (ptr);
+      if (f)
+	{
+	  *optgroup_flags |= f;
+	  goto found;
+	}
 
       if (*ptr == '=')
         {
@@ -948,7 +1033,7 @@ int
 opt_info_switch_p (const char *arg)
 {
   dump_flags_t flags;
-  int optgroup_flags;
+  optgroup_dump_flags_t optgroup_flags;
   char *filename;
   static char *file_seen = NULL;
   gcc::dump_manager *dumps = g->get_dumps ();
@@ -971,7 +1056,7 @@ opt_info_switch_p (const char *arg)
   if (!flags)
     flags = MSG_OPTIMIZED_LOCATIONS;
   if (!optgroup_flags)
-    optgroup_flags = OPTGROUP_ALL;
+    optgroup_flags = optgroup_dump_flags_t::get_all ();
 
   return dumps->opt_info_enable_passes (optgroup_flags, flags, filename);
 }
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index 76183e3eede..67da7003331 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -90,20 +90,134 @@ enum tree_dump_index
 #define MSG_ALL         (MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION \
                          | MSG_NOTE)
 
+/* Dump option node is a tree structure that implements
+   parsing of suboptions and provides mapping between a given enum type E
+   and unsigned integer masks that are encapsulated in dump_flags_type type.  */
 
-/* Flags to control high-level -fopt-info dumps.  Usually these flags
-   define a group of passes.  An optimization pass can be part of
-   multiple groups.  */
-#define OPTGROUP_NONE        (0)
-#define OPTGROUP_IPA         (1 << 1)   /* IPA optimization passes */
-#define OPTGROUP_LOOP        (1 << 2)   /* Loop optimization passes */
-#define OPTGROUP_INLINE      (1 << 3)   /* Inlining passes */
-#define OPTGROUP_OMP         (1 << 4)   /* OMP (Offloading and Multi
-					   Processing) transformations */
-#define OPTGROUP_VEC         (1 << 5)   /* Vectorization passes */
-#define OPTGROUP_OTHER       (1 << 6)   /* All other passes */
-#define OPTGROUP_ALL	     (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \
-                              | OPTGROUP_OMP | OPTGROUP_VEC | OPTGROUP_OTHER)
+template <typename E>
+struct dump_option_node
+{
+  /* Constructor.  */
+  dump_option_node (const char *name, E enum_value);
+
+  /* Initialize hierarchy and fill up a MASK_TRANLATION table.  */
+  void initialize (uint64_t *mask_translation);
+
+  /* Parse a given option string and return mask.  */
+  uint64_t parse (const char *token);
+
+  /* Register a SUBOPTION for a dump option node.  */
+  void register_suboption (dump_option_node<E> *suboption)
+  {
+    m_children.safe_push (suboption);
+  }
+
+private:
+  /* Initialize masks for internal nodes.  CURRENT is a counter with first
+     free mask.  MASK_TRANSLATION is table that is filled up.  */
+  uint64_t initialize_masks (unsigned *current, uint64_t *mask_translation);
+
+  /* Parse a given option string and return mask.  */
+  uint64_t parse (char *token);
+
+  /* Name of the option.  */
+  const char *m_name;
+
+  /* Enum value of the option.  */
+  E m_enum_value;
+
+  /* Children options.  */
+  vec<dump_option_node *> m_children;
+
+  /* Mask that represents the option.  */
+  uint64_t m_mask;
+};
+
+/* Size of possible valid leaf options.  */
+#define OPT_MASK_SIZE (CHAR_BIT * sizeof (uint64_t))
+
+/* Dump flags type represents a set of selected options for
+   a given enum type E.  */
+
+template <typename E>
+struct dump_flags_type
+{
+  /* Constructor.  */
+  dump_flags_type<E> (): m_mask (0)
+  {}
+
+  /* Constructor for a MASK.  */
+  dump_flags_type<E> (uint64_t mask): m_mask (mask)
+  {}
+
+  /* Constructor for a enum value E.  */
+  dump_flags_type<E> (E enum_value)
+  {
+    gcc_checking_assert ((unsigned)enum_value <= OPT_MASK_SIZE);
+    m_mask = m_mask_translation[enum_value];
+  }
+
+  /* OR operator for OTHER dump_flags_type.  */
+  inline void operator|= (dump_flags_type other)
+  {
+    m_mask |= other.m_mask;
+  }
+
+  /* AND operator for OTHER dump_flags_type.  */
+  inline void operator&= (dump_flags_type other)
+  {
+    m_mask &= other.m_mask;
+  }
+
+  /* AND operator for OTHER dump_flags_type.  */
+  inline bool operator& (dump_flags_type other)
+  {
+    return m_mask & other.m_mask;
+  }
+
+  /* Bool operator that is typically used to test whether an option is set.  */
+  inline operator bool () const
+  {
+    return m_mask;
+  }
+
+  /* Return mask that represents all selected options.  */
+  static inline dump_flags_type get_all ()
+  {
+    return m_mask_translation[0];
+  }
+
+  /* Initialize.  */
+  static dump_flags_type parse (char *option);
+
+  /* Selected mask of options.  */
+  uint64_t m_mask;
+
+  /* Translation table between enum values and masks.  */
+  static uint64_t m_mask_translation[OPT_MASK_SIZE];
+};
+
+/* Flags used for -fopt-info groups.  */
+
+enum optgroup_types
+{
+  OPTGROUP_NONE,
+  OPTGROUP_IPA,
+  OPTGROUP_LOOP,
+  OPTGROUP_INLINE,
+  OPTGROUP_OMP,
+  OPTGROUP_VEC,
+  OPTGROUP_OTHER,
+  OPTGROUP_COUNT
+};
+
+template<typename E>
+uint64_t
+dump_flags_type<E>::m_mask_translation[OPT_MASK_SIZE];
+
+/* Dump flags type for optgroup_types enum type.  */
+
+typedef dump_flags_type<optgroup_types> optgroup_dump_flags_t;
 
 /* Dump flags type.  */
 
@@ -120,7 +234,7 @@ struct dump_file_info
   FILE *pstream;                /* pass-specific dump stream  */
   FILE *alt_stream;             /* -fopt-info stream */
   dump_flags_t pflags;		/* dump flags */
-  int optgroup_flags;           /* optgroup flags for -fopt-info */
+  optgroup_dump_flags_t optgroup_flags; /* optgroup flags for -fopt-info */
   int alt_flags;                /* flags for opt-info */
   int pstate;                   /* state of pass-specific stream */
   int alt_state;                /* state of the -fopt-info stream */
@@ -187,7 +301,7 @@ public:
      SUFFIX, SWTCH, and GLOB. */
   unsigned int
   dump_register (const char *suffix, const char *swtch, const char *glob,
-		 dump_flags_t flags, int optgroup_flags,
+		 dump_flags_t flags, optgroup_dump_flags_t  optgroup_flags,
 		 bool take_ownership);
 
   /* Return the dump_file_info for the given phase.  */
@@ -232,6 +346,12 @@ public:
   const char *
   dump_flag_name (int phase) const;
 
+  /* Return optgroup_types dump options.  */
+  dump_option_node<optgroup_types> *get_optgroup_options ()
+  {
+    return optgroup_options;
+  }
+
 private:
 
   int
@@ -244,8 +364,10 @@ private:
   dump_enable_all (dump_flags_t flags, const char *filename);
 
   int
-  opt_info_enable_passes (int optgroup_flags, dump_flags_t flags,
-			  const char *filename);
+  opt_info_enable_passes (optgroup_dump_flags_t optgroup_flags,
+			  dump_flags_t flags, const char *filename);
+
+  void initialize_options ();
 
 private:
 
@@ -255,12 +377,14 @@ private:
   size_t m_extra_dump_files_in_use;
   size_t m_extra_dump_files_alloced;
 
+  /* Dump option node for optgroup_types enum.  */
+  dump_option_node<optgroup_types> *optgroup_options;
+
   /* Grant access to dump_enable_all.  */
   friend bool ::enable_rtl_dump_file (void);
 
   /* Grant access to opt_info_enable_passes.  */
   friend int ::opt_info_switch_p (const char *arg);
-
 }; // class dump_manager
 
 } // namespace gcc
-- 
2.12.2


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

* Re: [PATCH 1/N] Introduce dump_flags_t type and use it instead of int type.
  2017-05-05 10:44         ` [PATCH 1/N] Introduce dump_flags_t type and use it instead of int type Martin Liška
@ 2017-05-05 11:50           ` Richard Biener
  2017-05-06 15:04             ` Trevor Saunders
  0 siblings, 1 reply; 54+ messages in thread
From: Richard Biener @ 2017-05-05 11:50 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Fri, May 5, 2017 at 12:41 PM, Martin Liška <mliska@suse.cz> wrote:
> Hello.
>
> There's first patch that just defines dump_flags_t as uint64_t and changes all
> corresponding interfaces that do use it. There's a problematic impact that
> all targets have to include dumpfile.h just right after coretypes.h. That makes
> the patch harder to properly test. I tried couple of cross-compilers and it works.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> I've been also testing i686-linux-gnu bootstrap and x86_64-linux-gnu targets.
>
> Thoughts?

So usually we get away with defining pervasive types in coretypes.h instead.

Now I see how that can be not what we want if dump_flags_t becomes a
"class".  Well, at least if it has too many (inline) methods.

How many of our files end up including dumpfile.h?  There's

/* Most host source files will require the following headers.  */
#if !defined (GENERATOR_FILE) && !defined (USED_FOR_TARGET)
#include "machmode.h"
#include "signop.h"
#include "wide-int.h"

at the end of coretypes.h so it might be possible to stuff dumpfile.h there.

Or create a dump-flags.h header just containing the flag bits.  I suppose
most files need it because they include some interfaces that have
dump_flags_t, not because they do dumping (they'd include dumpflags.h
already), right?

Anyway, I think the patch is a good thing (how do we make sure we
don't "regress", aka people using 'int', not knowing about dump_flag_t?).

I'd probably, as a first step, simply put the typedef into coretypes.h.

A patch doing that instead of sprinkling dumpfile.h everywhere is ok.

Thanks,
Richard.

> Martin

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

* Re: [RFC][PATCH] Introduce -fdump*-folding
  2017-05-04 12:06       ` Martin Liška
  2017-05-05 10:44         ` [PATCH 1/N] Introduce dump_flags_t type and use it instead of int type Martin Liška
  2017-05-05 10:56         ` [PATCH 2/N] Add dump_flags_type<E> for handling of suboptions Martin Liška
@ 2017-05-05 11:57         ` Richard Biener
  2017-05-09 12:03           ` Martin Liška
  2 siblings, 1 reply; 54+ messages in thread
From: Richard Biener @ 2017-05-05 11:57 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Thu, May 4, 2017 at 1:10 PM, Martin Liška <mliska@suse.cz> wrote:
> On 05/04/2017 12:40 PM, Richard Biener wrote:
>>
>> On Thu, May 4, 2017 at 11:22 AM, Martin Liška <mliska@suse.cz> wrote:
>>>
>>> On 05/03/2017 12:12 PM, Richard Biener wrote:
>>>>
>>>>
>>>> On Wed, May 3, 2017 at 10:10 AM, Martin Liška <mliska@suse.cz> wrote:
>>>>>
>>>>>
>>>>> Hello
>>>>>
>>>>> Last release cycle I spent quite some time with reading of IVOPTS pass
>>>>> dump file. Using -fdump*-details causes to generate a lot of 'Applying
>>>>> pattern'
>>>>> lines, which can make reading of a dump file more complicated.
>>>>>
>>>>> There are stats for tramp3d with -O2 and -fdump-tree-all-details.
>>>>> Percentage number
>>>>> shows how many lines are of the aforementioned pattern:
>>>>>
>>>>>                         tramp3d-v4.cpp.164t.ivopts: 6.34%
>>>>>                           tramp3d-v4.cpp.091t.ccp2: 5.04%
>>>>>                       tramp3d-v4.cpp.093t.cunrolli: 4.41%
>>>>>                       tramp3d-v4.cpp.129t.laddress: 3.70%
>>>>>                           tramp3d-v4.cpp.032t.ccp1: 2.31%
>>>>>                           tramp3d-v4.cpp.038t.evrp: 1.90%
>>>>>                      tramp3d-v4.cpp.033t.forwprop1: 1.74%
>>>>>                           tramp3d-v4.cpp.103t.vrp1: 1.52%
>>>>>                      tramp3d-v4.cpp.124t.forwprop3: 1.31%
>>>>>                           tramp3d-v4.cpp.181t.vrp2: 1.30%
>>>>>                        tramp3d-v4.cpp.161t.cunroll: 1.22%
>>>>>                     tramp3d-v4.cpp.027t.fixup_cfg3: 1.11%
>>>>>                        tramp3d-v4.cpp.153t.ivcanon: 1.07%
>>>>>                           tramp3d-v4.cpp.126t.ccp3: 0.96%
>>>>>                           tramp3d-v4.cpp.143t.sccp: 0.91%
>>>>>                      tramp3d-v4.cpp.185t.forwprop4: 0.82%
>>>>>                            tramp3d-v4.cpp.011t.cfg: 0.74%
>>>>>                      tramp3d-v4.cpp.096t.forwprop2: 0.50%
>>>>>                     tramp3d-v4.cpp.019t.fixup_cfg1: 0.37%
>>>>>                      tramp3d-v4.cpp.120t.phicprop1: 0.33%
>>>>>                            tramp3d-v4.cpp.133t.pre: 0.32%
>>>>>                      tramp3d-v4.cpp.182t.phicprop2: 0.27%
>>>>>                     tramp3d-v4.cpp.170t.veclower21: 0.25%
>>>>>                        tramp3d-v4.cpp.029t.einline: 0.24%
>>>>>
>>>>> I'm suggesting to add new TDF that will be allocated for that.
>>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression
>>>>> tests.
>>>>>
>>>>> Thoughts?
>>>>
>>>>
>>>>
>>>> Ok.  Soon we'll want to change dump_flags to uint64_t ...  (we have 1
>>>> bit
>>>> left
>>>> if you allow negative dump_flags).  It'll tickle down on a lot of
>>>> interfaces
>>>> so introducing dump_flags_t at the same time might be a good idea.
>>>
>>>
>>>
>>> Hello.
>>>
>>> I've prepared patch that migrates all interfaces and introduces
>>> dump_flags_t.
>>
>>
>> Great.
>>
>>> I've been
>>> currently testing that. Apart from that Richi requested to come up with
>>> more
>>> generic approach
>>> of hierarchical structure of options.
>>
>>
>> Didn't really "request" it, it's just something we eventually need to do
>> when
>> we run out of bits again ;)
>
>
> I know, but it was me who came up with the idea of more fine suboptions :)
>
>>
>>>
>>> Can you please take a look at self-contained source file that shows way
>>> I've
>>> decided to go?
>>> Another question is whether we want to implement also "aliases", where
>>> for
>>> instance
>>> current 'all' is equal to union of couple of suboptions?
>>
>>
>> Yeah, I think we do want -all-all-all and -foo-all to work.  Not sure
>> about -all-foo-all.
>
>
> Actually only having 'all' is quite easy to implement.
>
> Let's imagine following hierarchy:
>
> (root)
> - vops
> - folding
>   - gimple
>     - ctor
>     - array_ref
>     - arithmetic
>   - generic
>     - c
>     - c++
>     - ctor
>     - xyz
>
> Then '-fdump-passname-folding-all' will be equal to
> '-fdump-passname-folding'.

Ok, so you envision that sub-options restrict stuff.  I thought of

 -gimple
   -vops
 -generic
   -folding

so the other way around.  We do not have many options that would be RTL
specific but gimple only are -vops -alias -scev -gimple -rhs-only
-verbose -memsyms
while RTL has -cselib. -eh sounds gimple specific.  Then there's the optgroup
stuff you already saw.

So it looks like a 8 bit "group id" plus 56 bits of flags would do.

Yes, this implies reworking how & and | work.  For example you can't
| dump-flags of different groups.

>>
>> The important thing is to make sure dump_flags_t stays POD and thus is
>> eligible to be passed in register(s).  In the end we might simply come up
>> with a two-level hierarchy, each 32bits (or we can even get back to 32bits
>> in total with two times 16bits).
>
>
> I'm aware of having the type as POD.
>
>>
>> It looks you didn't actually implement this as a hierarchy though but
>> still allocate from one pool of bits (so you only do a change to how
>> users access this?)
>
>
> Yep, all leaf options are mapped to a mask and all inner nodes are just
> union
> of suboptions. That will allow us to have 64 leaf suboptions. Reaching the
> limit
> we can encode the values in more sophisticated way. That however brings need
> to implement more complicated '&' and '|' operators.
>
> I'll finish the implementation and try to migrate that to current handling.
> Guess, I'm quite close.

Hmm, but then there's not much advantage in suboptions (well, apart from maybe
at the user-side).

> Martin
>
>
>>
>> Thanks,
>> Richard.
>>
>>>
>>> Thanks for feedback,
>>> Martin
>>>
>>>>
>>>> Thanks,
>>>> Richard.
>>>>
>>>>> Martin
>>>
>>>
>>>
>

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

* Re: [PATCH 1/N] Introduce dump_flags_t type and use it instead of int type.
  2017-05-05 11:50           ` Richard Biener
@ 2017-05-06 15:04             ` Trevor Saunders
  2017-05-12 13:01               ` [PATCH v2 01/N] Add default value for last argument of dump functions Martin Liška
                                 ` (4 more replies)
  0 siblings, 5 replies; 54+ messages in thread
From: Trevor Saunders @ 2017-05-06 15:04 UTC (permalink / raw)
  To: Richard Biener; +Cc: Martin Liška, GCC Patches

On Fri, May 05, 2017 at 01:38:21PM +0200, Richard Biener wrote:
> On Fri, May 5, 2017 at 12:41 PM, Martin Liška <mliska@suse.cz> wrote:
> > Hello.
> >
> > There's first patch that just defines dump_flags_t as uint64_t and changes all
> > corresponding interfaces that do use it. There's a problematic impact that
> > all targets have to include dumpfile.h just right after coretypes.h. That makes
> > the patch harder to properly test. I tried couple of cross-compilers and it works.
> >
> > Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> > I've been also testing i686-linux-gnu bootstrap and x86_64-linux-gnu targets.
> >
> > Thoughts?
> 
> So usually we get away with defining pervasive types in coretypes.h instead.
> 
> Now I see how that can be not what we want if dump_flags_t becomes a
> "class".  Well, at least if it has too many (inline) methods.
> 
> How many of our files end up including dumpfile.h?  There's
> 
> /* Most host source files will require the following headers.  */
> #if !defined (GENERATOR_FILE) && !defined (USED_FOR_TARGET)
> #include "machmode.h"
> #include "signop.h"
> #include "wide-int.h"
> 
> at the end of coretypes.h so it might be possible to stuff dumpfile.h there.
> 
> Or create a dump-flags.h header just containing the flag bits.  I suppose
> most files need it because they include some interfaces that have
> dump_flags_t, not because they do dumping (they'd include dumpflags.h
> already), right?

well, if a header uses dumpflags_t and a forward declaration won't do it
should include it right? but continueing the coretypes.h hacks may be
expedient.

> Anyway, I think the patch is a good thing (how do we make sure we
> don't "regress", aka people using 'int', not knowing about dump_flag_t?).

does it make sense to define it as a struct whose only member is a
uint64_t?  That way you'd have to explicitly pull out the field wherever
you want to pass it to something taking an int.  That would require
defining a bunch of operator &/| etc.  However we could also move from
there to a set of bitfields for most of the flags and usually not need
to explicitly extract the bit we want.

Trev

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

* Re: [RFC][PATCH] Introduce -fdump*-folding
  2017-05-05 11:57         ` [RFC][PATCH] Introduce -fdump*-folding Richard Biener
@ 2017-05-09 12:03           ` Martin Liška
  2017-05-09 12:19             ` Richard Biener
  0 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-09 12:03 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

On 05/05/2017 01:50 PM, Richard Biener wrote:
> On Thu, May 4, 2017 at 1:10 PM, Martin Liška <mliska@suse.cz> wrote:
>> On 05/04/2017 12:40 PM, Richard Biener wrote:
>>>
>>> On Thu, May 4, 2017 at 11:22 AM, Martin Liška <mliska@suse.cz> wrote:
>>>>
>>>> On 05/03/2017 12:12 PM, Richard Biener wrote:
>>>>>
>>>>>
>>>>> On Wed, May 3, 2017 at 10:10 AM, Martin Liška <mliska@suse.cz> wrote:
>>>>>>
>>>>>>
>>>>>> Hello
>>>>>>
>>>>>> Last release cycle I spent quite some time with reading of IVOPTS pass
>>>>>> dump file. Using -fdump*-details causes to generate a lot of 'Applying
>>>>>> pattern'
>>>>>> lines, which can make reading of a dump file more complicated.
>>>>>>
>>>>>> There are stats for tramp3d with -O2 and -fdump-tree-all-details.
>>>>>> Percentage number
>>>>>> shows how many lines are of the aforementioned pattern:
>>>>>>
>>>>>>                         tramp3d-v4.cpp.164t.ivopts: 6.34%
>>>>>>                           tramp3d-v4.cpp.091t.ccp2: 5.04%
>>>>>>                       tramp3d-v4.cpp.093t.cunrolli: 4.41%
>>>>>>                       tramp3d-v4.cpp.129t.laddress: 3.70%
>>>>>>                           tramp3d-v4.cpp.032t.ccp1: 2.31%
>>>>>>                           tramp3d-v4.cpp.038t.evrp: 1.90%
>>>>>>                      tramp3d-v4.cpp.033t.forwprop1: 1.74%
>>>>>>                           tramp3d-v4.cpp.103t.vrp1: 1.52%
>>>>>>                      tramp3d-v4.cpp.124t.forwprop3: 1.31%
>>>>>>                           tramp3d-v4.cpp.181t.vrp2: 1.30%
>>>>>>                        tramp3d-v4.cpp.161t.cunroll: 1.22%
>>>>>>                     tramp3d-v4.cpp.027t.fixup_cfg3: 1.11%
>>>>>>                        tramp3d-v4.cpp.153t.ivcanon: 1.07%
>>>>>>                           tramp3d-v4.cpp.126t.ccp3: 0.96%
>>>>>>                           tramp3d-v4.cpp.143t.sccp: 0.91%
>>>>>>                      tramp3d-v4.cpp.185t.forwprop4: 0.82%
>>>>>>                            tramp3d-v4.cpp.011t.cfg: 0.74%
>>>>>>                      tramp3d-v4.cpp.096t.forwprop2: 0.50%
>>>>>>                     tramp3d-v4.cpp.019t.fixup_cfg1: 0.37%
>>>>>>                      tramp3d-v4.cpp.120t.phicprop1: 0.33%
>>>>>>                            tramp3d-v4.cpp.133t.pre: 0.32%
>>>>>>                      tramp3d-v4.cpp.182t.phicprop2: 0.27%
>>>>>>                     tramp3d-v4.cpp.170t.veclower21: 0.25%
>>>>>>                        tramp3d-v4.cpp.029t.einline: 0.24%
>>>>>>
>>>>>> I'm suggesting to add new TDF that will be allocated for that.
>>>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression
>>>>>> tests.
>>>>>>
>>>>>> Thoughts?
>>>>>
>>>>>
>>>>>
>>>>> Ok.  Soon we'll want to change dump_flags to uint64_t ...  (we have 1
>>>>> bit
>>>>> left
>>>>> if you allow negative dump_flags).  It'll tickle down on a lot of
>>>>> interfaces
>>>>> so introducing dump_flags_t at the same time might be a good idea.
>>>>
>>>>
>>>>
>>>> Hello.
>>>>
>>>> I've prepared patch that migrates all interfaces and introduces
>>>> dump_flags_t.
>>>
>>>
>>> Great.
>>>
>>>> I've been
>>>> currently testing that. Apart from that Richi requested to come up with
>>>> more
>>>> generic approach
>>>> of hierarchical structure of options.
>>>
>>>
>>> Didn't really "request" it, it's just something we eventually need to do
>>> when
>>> we run out of bits again ;)
>>
>>
>> I know, but it was me who came up with the idea of more fine suboptions :)
>>
>>>
>>>>
>>>> Can you please take a look at self-contained source file that shows way
>>>> I've
>>>> decided to go?
>>>> Another question is whether we want to implement also "aliases", where
>>>> for
>>>> instance
>>>> current 'all' is equal to union of couple of suboptions?
>>>
>>>
>>> Yeah, I think we do want -all-all-all and -foo-all to work.  Not sure
>>> about -all-foo-all.
>>
>>
>> Actually only having 'all' is quite easy to implement.
>>
>> Let's imagine following hierarchy:
>>
>> (root)
>> - vops
>> - folding
>>   - gimple
>>     - ctor
>>     - array_ref
>>     - arithmetic
>>   - generic
>>     - c
>>     - c++
>>     - ctor
>>     - xyz
>>
>> Then '-fdump-passname-folding-all' will be equal to
>> '-fdump-passname-folding'.
> 
> Ok, so you envision that sub-options restrict stuff.  I thought of
> 
>  -gimple
>    -vops
>  -generic
>    -folding
> 
> so the other way around.  We do not have many options that would be RTL
> specific but gimple only are -vops -alias -scev -gimple -rhs-only
> -verbose -memsyms
> while RTL has -cselib. -eh sounds gimple specific.  Then there's the optgroup
> stuff you already saw.
> 
> So it looks like a 8 bit "group id" plus 56 bits of flags would do.
> 
> Yes, this implies reworking how & and | work.  For example you can't
> | dump-flags of different groups.

Well, I'm not opposed to idea of converting that to way you described.
So, you're willing to introduce something like:

(root)
- generic
  - eh
  - folding
  - ...
- gimple
  - vops
  - folding
   - rhs-only
   - ...
  - vops
- rtl
  - cselib
  - ...

?

> 
>>>
>>> The important thing is to make sure dump_flags_t stays POD and thus is
>>> eligible to be passed in register(s).  In the end we might simply come up
>>> with a two-level hierarchy, each 32bits (or we can even get back to 32bits
>>> in total with two times 16bits).
>>
>>
>> I'm aware of having the type as POD.
>>
>>>
>>> It looks you didn't actually implement this as a hierarchy though but
>>> still allocate from one pool of bits (so you only do a change to how
>>> users access this?)
>>
>>
>> Yep, all leaf options are mapped to a mask and all inner nodes are just
>> union
>> of suboptions. That will allow us to have 64 leaf suboptions. Reaching the
>> limit
>> we can encode the values in more sophisticated way. That however brings need
>> to implement more complicated '&' and '|' operators.
>>
>> I'll finish the implementation and try to migrate that to current handling.
>> Guess, I'm quite close.
> 
> Hmm, but then there's not much advantage in suboptions (well, apart from maybe
> at the user-side).

Yep, please take a look at updated version of PATCH 2/N, where I ported -fopt-info.
As you can see I had to explicitly define all enum values and hierarchy creation
of every single node.

Martin

> 
>> Martin
>>
>>
>>>
>>> Thanks,
>>> Richard.
>>>
>>>>
>>>> Thanks for feedback,
>>>> Martin
>>>>
>>>>>
>>>>> Thanks,
>>>>> Richard.
>>>>>
>>>>>> Martin
>>>>
>>>>
>>>>
>>

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

* Re: [PATCH 2/N] Add dump_flags_type<E> for handling of suboptions.
  2017-05-05 10:56         ` [PATCH 2/N] Add dump_flags_type<E> for handling of suboptions Martin Liška
@ 2017-05-09 12:05           ` Martin Liška
  2017-05-12 17:47           ` Martin Sebor
  2017-05-15  9:47           ` [RFC] Do we want hierarchical options & encapsulation in a class Martin Liška
  2 siblings, 0 replies; 54+ messages in thread
From: Martin Liška @ 2017-05-09 12:05 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

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

On 05/05/2017 12:44 PM, Martin Liška wrote:
> Hi.
> 
> This one is more interesting as it implements hierarchical option parsing
> and as a first step I implemented that for optgroup suboptions.
> 
> Next candidates are dump_option_value_info and obviously my primary motivation:
> dump_option_value_info.
> 
> I'm expecting feedback for implementation I've decided to come up with.
> Patch has been tested.
> 
> Thanks,
> Martin
> 

Update version of the patch. Actually it contains of 2 parts, where the second one
is mechanical replacement of enum values.

It's still work-in-progress as we're still tuning internal representation.

Martin

[-- Attachment #2: 0002-Port-MSG_-option-values-to-OPGROUP_.patch.bz2 --]
[-- Type: application/x-bzip, Size: 32959 bytes --]

[-- Attachment #3: 0001-Port-fopt-info-to-new-option-infrastructure.patch --]
[-- Type: text/x-patch, Size: 30950 bytes --]

From 1a6f1dc6333bef2a643eacacbbc31f83a10e28ee Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 9 May 2017 13:22:23 +0200
Subject: [PATCH 1/2] Port -fopt-info to new option infrastructure.

---
 gcc/dumpfile.c  | 332 ++++++++++++++++++++++++++------------------------------
 gcc/dumpfile.h  | 125 ++++++++++++++-------
 gcc/passes.c    |   2 +-
 gcc/tree-pass.h |   2 +-
 4 files changed, 240 insertions(+), 221 deletions(-)

diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 82c4fc9d4ff..e3db0a5ff7e 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -33,10 +33,10 @@ along with GCC; see the file COPYING3.  If not see
 #define skip_leading_substring(whole,  part) \
    (strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
 
-static dump_flags_t pflags;		      /* current dump_flags */
-static dump_flags_t alt_flags;		      /* current opt_info flags */
+static dump_flags_t pflags;		/* current dump_flags */
+static optgroup_dump_flags_t opt_info_flags; /* current opt_info flags */
 
-static void dump_loc (dump_flags_t, FILE *, source_location);
+static void dump_loc (optgroup_dump_flags_t, FILE *, source_location);
 static FILE *dump_open_alternate_stream (struct dump_file_info *);
 
 /* These are currently used for communicating between passes.
@@ -51,31 +51,33 @@ dump_flags_t dump_flags;
    TREE_DUMP_INDEX enumeration in dumpfile.h.  */
 static struct dump_file_info dump_files[TDI_end] =
 {
-  {NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, false, false},
+  {NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, optgroup_dump_flags_t (),
+   optgroup_dump_flags_t (), 0, 0, 0, false, false},
   {".cgraph", "ipa-cgraph", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
-   0, 0, 0, 0, 0, false, false},
-  {".type-inheritance", "ipa-type-inheritance", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
-   0, 0, 0, 0, 0, false, false},
+   optgroup_dump_flags_t (), optgroup_dump_flags_t (), 0, 0, 0, false, false},
+  {".type-inheritance", "ipa-type-inheritance", NULL, NULL, NULL, NULL, NULL,
+    TDF_IPA, optgroup_dump_flags_t (), optgroup_dump_flags_t (), 0, 0, 0,
+    false, false},
   {".ipa-clones", "ipa-clones", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
-   0, 0, 0, 0, 0, false, false},
+   optgroup_dump_flags_t (), optgroup_dump_flags_t (), 0, 0, 0, false, false},
   {".tu", "translation-unit", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 1, false, false},
+   optgroup_dump_flags_t (), optgroup_dump_flags_t (), 0, 0, 1, false, false},
   {".class", "class-hierarchy", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 2, false, false},
+   optgroup_dump_flags_t (), optgroup_dump_flags_t (), 0, 0, 2, false, false},
   {".original", "tree-original", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 3, false, false},
+   optgroup_dump_flags_t (), optgroup_dump_flags_t (), 0, 0, 3, false, false},
   {".gimple", "tree-gimple", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 4, false, false},
+   optgroup_dump_flags_t (), optgroup_dump_flags_t (), 0, 0, 4, false, false},
   {".nested", "tree-nested", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 5, false, false},
+   optgroup_dump_flags_t (), optgroup_dump_flags_t (), 0, 0, 5, false, false},
 #define FIRST_AUTO_NUMBERED_DUMP 6
 
   {NULL, "tree-all", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 0, false, false},
+   optgroup_dump_flags_t (), optgroup_dump_flags_t (), 0, 0, 0, false, false},
   {NULL, "rtl-all", NULL, NULL, NULL, NULL, NULL, TDF_RTL,
-   0, 0, 0, 0, 0, false, false},
+   optgroup_dump_flags_t (), optgroup_dump_flags_t (), 0, 0, 0, false, false},
   {NULL, "ipa-all", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
-   0, 0, 0, 0, 0, false, false},
+   optgroup_dump_flags_t (), optgroup_dump_flags_t (), 0, 0, 0, false, false},
 };
 
 /* Define a name->number mapping for a dump flag value.  */
@@ -94,9 +96,7 @@ static const struct dump_option_value_info dump_options[] =
   {"slim", TDF_SLIM},
   {"raw", TDF_RAW},
   {"graph", TDF_GRAPH},
-  {"details", (TDF_DETAILS | MSG_OPTIMIZED_LOCATIONS
-               | MSG_MISSED_OPTIMIZATION
-               | MSG_NOTE)},
+  {"details", TDF_DETAILS},
   {"cselib", TDF_CSELIB},
   {"stats", TDF_STATS},
   {"blocks", TDF_BLOCKS},
@@ -112,10 +112,6 @@ static const struct dump_option_value_info dump_options[] =
   {"enumerate_locals", TDF_ENUMERATE_LOCALS},
   {"scev", TDF_SCEV},
   {"gimple", TDF_GIMPLE},
-  {"optimized", MSG_OPTIMIZED_LOCATIONS},
-  {"missed", MSG_MISSED_OPTIMIZATION},
-  {"note", MSG_NOTE},
-  {"optall", MSG_ALL},
   {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_TREE | TDF_RTL | TDF_IPA
 	    | TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC | TDF_VERBOSE
 	    | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV
@@ -123,18 +119,6 @@ static const struct dump_option_value_info dump_options[] =
   {NULL, 0}
 };
 
-/* A subset of the dump_options table which is used for -fopt-info
-   types. This must be consistent with the MSG_* flags in dumpfile.h.
- */
-static const struct dump_option_value_info optinfo_verbosity_options[] =
-{
-  {"optimized", MSG_OPTIMIZED_LOCATIONS},
-  {"missed", MSG_MISSED_OPTIMIZATION},
-  {"note", MSG_NOTE},
-  {"all", MSG_ALL},
-  {NULL, 0}
-};
-
 template <typename E>
 dump_option_node<E>::dump_option_node (const char *name, E enum_value):
   m_name (name), m_enum_value (enum_value), m_children (), m_mask (0)
@@ -179,7 +163,7 @@ uint64_t
 dump_option_node<E>::parse (const char *token)
 {
   char *s = xstrdup (token);
-  uint64_t r = parse (s);
+  uint64_t r = parse (strtok (s, "-"));
   free (s);
 
   return r;
@@ -189,6 +173,13 @@ template <typename E>
 uint64_t
 dump_option_node<E>::parse (char *token)
 {
+  return parse_internal (strtok (token, "-"));
+}
+
+template <typename E>
+uint64_t
+dump_option_node<E>::parse_internal (char *token)
+{
   if (token == NULL)
     return m_mask;
 
@@ -202,19 +193,61 @@ dump_option_node<E>::parse (char *token)
     if (strcmp (m_children[i]->m_name, token) == 0)
     {
       token = strtok (NULL, "-");
-      return m_children[i]->parse (token);
+      return m_children[i]->parse_internal (token);
     }
 
   return 0;
 }
 
+optgroup_option_hierarchy::optgroup_option_hierarchy ()
+{
+  root = new node (NULL, OPTGROUP_NONE);
+
+  node *n = new node ("ipa", OPTGROUP_IPA);
+  n->register_suboption (new node ("optimized", OPTGROUP_IPA_OPTIMIZED));
+  n->register_suboption (new node ("missed", OPTGROUP_IPA_MISSED));
+  n->register_suboption (new node ("note", OPTGROUP_IPA_NOTE));
+  root->register_suboption (n);
+
+  n = new node ("loop", OPTGROUP_LOOP);
+  n->register_suboption (new node ("optimized", OPTGROUP_LOOP_OPTIMIZED));
+  n->register_suboption (new node ("missed", OPTGROUP_LOOP_MISSED));
+  n->register_suboption (new node ("note", OPTGROUP_LOOP_NOTE));
+  root->register_suboption (n);
+
+  n = new node ("inline", OPTGROUP_INLINE);
+  n->register_suboption (new node ("optimized", OPTGROUP_INLINE_OPTIMIZED));
+  n->register_suboption (new node ("missed", OPTGROUP_INLINE_MISSED));
+  n->register_suboption (new node ("note", OPTGROUP_INLINE_NOTE));
+  root->register_suboption (n);
+
+  n = new node ("omp", OPTGROUP_OMP);
+  n->register_suboption (new node ("optimized", OPTGROUP_OMP_OPTIMIZED));
+  n->register_suboption (new node ("missed", OPTGROUP_OMP_MISSED));
+  n->register_suboption (new node ("note", OPTGROUP_OMP_NOTE));
+  root->register_suboption (n);
+
+  n = new node ("vec", OPTGROUP_VEC);
+  n->register_suboption (new node ("optimized", OPTGROUP_VEC_OPTIMIZED));
+  n->register_suboption (new node ("missed", OPTGROUP_VEC_MISSED));
+  n->register_suboption (new node ("note", OPTGROUP_VEC_NOTE));
+  root->register_suboption (n);
+
+  n = new node ("other", OPTGROUP_OTHER);
+  n->register_suboption (new node ("optimized", OPTGROUP_OTHER_OPTIMIZED));
+  n->register_suboption (new node ("missed", OPTGROUP_OTHER_MISSED));
+  n->register_suboption (new node ("note", OPTGROUP_OTHER_NOTE));
+  root->register_suboption (n);
+
+  root->initialize (optgroup_dump_flags_t::m_mask_translation);
+}
+
 gcc::dump_manager::dump_manager ():
   m_next_dump (FIRST_AUTO_NUMBERED_DUMP),
   m_extra_dump_files (NULL),
   m_extra_dump_files_in_use (0),
   m_extra_dump_files_alloced (0)
 {
-  initialize_options ();
 }
 
 gcc::dump_manager::~dump_manager ()
@@ -236,14 +269,12 @@ gcc::dump_manager::~dump_manager ()
       XDELETEVEC (const_cast <char *> (dfi->alt_filename));
     }
   XDELETEVEC (m_extra_dump_files);
-
-  delete (optgroup_options);
 }
 
 unsigned int
 gcc::dump_manager::
 dump_register (const char *suffix, const char *swtch, const char *glob,
-	       dump_flags_t flags, optgroup_dump_flags_t  optgroup_flags,
+	       dump_flags_t flags, optgroup_dump_flags_t optgroup_flags,
 	       bool take_ownership)
 {
   int num = m_next_dump++;
@@ -266,7 +297,7 @@ dump_register (const char *suffix, const char *swtch, const char *glob,
   m_extra_dump_files[count].swtch = swtch;
   m_extra_dump_files[count].glob = glob;
   m_extra_dump_files[count].pflags = flags;
-  m_extra_dump_files[count].optgroup_flags = optgroup_flags;
+  m_extra_dump_files[count].pass_optgroup_flags = optgroup_flags;
   m_extra_dump_files[count].num = num;
   m_extra_dump_files[count].owns_strings = take_ownership;
 
@@ -393,7 +424,7 @@ dump_open_alternate_stream (struct dump_file_info *dfi)
 /* Print source location on DFILE if enabled.  */
 
 void
-dump_loc (dump_flags_t dump_kind, FILE *dfile, source_location loc)
+dump_loc (optgroup_dump_flags_t dump_kind, FILE *dfile, source_location loc)
 {
   if (dump_kind)
     {
@@ -412,29 +443,30 @@ dump_loc (dump_flags_t dump_kind, FILE *dfile, source_location loc)
    EXTRA_DUMP_FLAGS on the dump streams if DUMP_KIND is enabled.  */
 
 void
-dump_gimple_stmt (dump_flags_t dump_kind, dump_flags_t extra_dump_flags,
+dump_gimple_stmt (optgroup_dump_flags_t dump_kind,
+		  dump_flags_t extra_dump_flags,
 		  gimple *gs, int spc)
 {
-  if (dump_file && (dump_kind & pflags))
+  if (dump_file)
     print_gimple_stmt (dump_file, gs, spc, dump_flags | extra_dump_flags);
 
-  if (alt_dump_file && (dump_kind & alt_flags))
+  if (alt_dump_file && (dump_kind & opt_info_flags))
     print_gimple_stmt (alt_dump_file, gs, spc, dump_flags | extra_dump_flags);
 }
 
 /* Similar to dump_gimple_stmt, except additionally print source location.  */
 
 void
-dump_gimple_stmt_loc (dump_flags_t dump_kind, source_location loc,
+dump_gimple_stmt_loc (optgroup_dump_flags_t dump_kind, source_location loc,
 		      dump_flags_t extra_dump_flags, gimple *gs, int spc)
 {
-  if (dump_file && (dump_kind & pflags))
+  if (dump_file)
     {
       dump_loc (dump_kind, dump_file, loc);
       print_gimple_stmt (dump_file, gs, spc, dump_flags | extra_dump_flags);
     }
 
-  if (alt_dump_file && (dump_kind & alt_flags))
+  if (alt_dump_file && (dump_kind & opt_info_flags))
     {
       dump_loc (dump_kind, alt_dump_file, loc);
       print_gimple_stmt (alt_dump_file, gs, spc, dump_flags | extra_dump_flags);
@@ -445,13 +477,14 @@ dump_gimple_stmt_loc (dump_flags_t dump_kind, source_location loc,
    DUMP_KIND is enabled.  */
 
 void
-dump_generic_expr (dump_flags_t dump_kind, dump_flags_t extra_dump_flags,
+dump_generic_expr (optgroup_dump_flags_t dump_kind,
+		   dump_flags_t extra_dump_flags,
 		   tree t)
 {
-  if (dump_file && (dump_kind & pflags))
+  if (dump_file)
       print_generic_expr (dump_file, t, dump_flags | extra_dump_flags);
 
-  if (alt_dump_file && (dump_kind & alt_flags))
+  if (alt_dump_file && (dump_kind & opt_info_flags))
       print_generic_expr (alt_dump_file, t, dump_flags | extra_dump_flags);
 }
 
@@ -460,16 +493,16 @@ dump_generic_expr (dump_flags_t dump_kind, dump_flags_t extra_dump_flags,
    location.  */
 
 void
-dump_generic_expr_loc (int dump_kind, source_location loc,
+dump_generic_expr_loc (optgroup_dump_flags_t dump_kind, source_location loc,
 		       dump_flags_t extra_dump_flags, tree t)
 {
-  if (dump_file && (dump_kind & pflags))
+  if (dump_file)
     {
       dump_loc (dump_kind, dump_file, loc);
       print_generic_expr (dump_file, t, dump_flags | extra_dump_flags);
     }
 
-  if (alt_dump_file && (dump_kind & alt_flags))
+  if (alt_dump_file && (dump_kind & opt_info_flags))
     {
       dump_loc (dump_kind, alt_dump_file, loc);
       print_generic_expr (alt_dump_file, t, dump_flags | extra_dump_flags);
@@ -479,9 +512,9 @@ dump_generic_expr_loc (int dump_kind, source_location loc,
 /* Output a formatted message using FORMAT on appropriate dump streams.  */
 
 void
-dump_printf (dump_flags_t dump_kind, const char *format, ...)
+dump_printf (optgroup_dump_flags_t dump_kind, const char *format, ...)
 {
-  if (dump_file && (dump_kind & pflags))
+  if (dump_file)
     {
       va_list ap;
       va_start (ap, format);
@@ -489,7 +522,7 @@ dump_printf (dump_flags_t dump_kind, const char *format, ...)
       va_end (ap);
     }
 
-  if (alt_dump_file && (dump_kind & alt_flags))
+  if (alt_dump_file && (dump_kind & opt_info_flags))
     {
       va_list ap;
       va_start (ap, format);
@@ -501,10 +534,10 @@ dump_printf (dump_flags_t dump_kind, const char *format, ...)
 /* Similar to dump_printf, except source location is also printed.  */
 
 void
-dump_printf_loc (dump_flags_t dump_kind, source_location loc,
+dump_printf_loc (optgroup_dump_flags_t dump_kind, source_location loc,
 		 const char *format, ...)
 {
-  if (dump_file && (dump_kind & pflags))
+  if (dump_file)
     {
       va_list ap;
       dump_loc (dump_kind, dump_file, loc);
@@ -513,7 +546,7 @@ dump_printf_loc (dump_flags_t dump_kind, source_location loc,
       va_end (ap);
     }
 
-  if (alt_dump_file && (dump_kind & alt_flags))
+  if (alt_dump_file && (dump_kind & opt_info_flags))
     {
       va_list ap;
       dump_loc (dump_kind, alt_dump_file, loc);
@@ -570,7 +603,7 @@ dump_start (int phase, dump_flags_t *flag_ptr)
       count++;
       alt_dump_file = dfi->alt_stream;
       /* Initialize current -fopt-info flags. */
-      alt_flags = dfi->alt_flags;
+      opt_info_flags = dfi->optgroup_flags;
     }
 
   if (flag_ptr)
@@ -605,7 +638,7 @@ dump_finish (int phase)
   dump_file = NULL;
   alt_dump_file = NULL;
   dump_flags = TDI_none;
-  alt_flags = 0;
+  opt_info_flags = optgroup_dump_flags_t ();
   pflags = 0;
 }
 
@@ -781,45 +814,45 @@ dump_enable_all (dump_flags_t flags, const char *filename)
 int
 gcc::dump_manager::
 opt_info_enable_passes (optgroup_dump_flags_t optgroup_flags,
-			dump_flags_t flags, const char *filename)
+			const char *filename)
 {
   int n = 0;
   size_t i;
 
   for (i = TDI_none + 1; i < (size_t) TDI_end; i++)
     {
-      if ((dump_files[i].optgroup_flags & optgroup_flags))
-        {
-          const char *old_filename = dump_files[i].alt_filename;
-          /* Since this file is shared among different passes, it
-             should be opened in append mode.  */
-          dump_files[i].alt_state = 1;
-          dump_files[i].alt_flags |= flags;
-          n++;
-          /* Override the existing filename.  */
-          if (filename)
-            dump_files[i].alt_filename = xstrdup (filename);
-          if (old_filename && filename != old_filename)
-            free (CONST_CAST (char *, old_filename));
-        }
+      if ((dump_files[i].pass_optgroup_flags & optgroup_flags))
+	{
+	  const char *old_filename = dump_files[i].alt_filename;
+	  /* Since this file is shared among different passes, it
+	     should be opened in append mode.  */
+	  dump_files[i].alt_state = 1;
+	  dump_files[i].optgroup_flags |= optgroup_flags;
+	  n++;
+	  /* Override the existing filename.  */
+	  if (filename)
+	    dump_files[i].alt_filename = xstrdup (filename);
+	  if (old_filename && filename != old_filename)
+	    free (CONST_CAST (char *, old_filename));
+	}
     }
 
   for (i = 0; i < m_extra_dump_files_in_use; i++)
     {
-      if ((m_extra_dump_files[i].optgroup_flags & optgroup_flags))
-        {
-          const char *old_filename = m_extra_dump_files[i].alt_filename;
-          /* Since this file is shared among different passes, it
-             should be opened in append mode.  */
-          m_extra_dump_files[i].alt_state = 1;
-          m_extra_dump_files[i].alt_flags |= flags;
-          n++;
-          /* Override the existing filename.  */
-          if (filename)
-            m_extra_dump_files[i].alt_filename = xstrdup (filename);
-          if (old_filename && filename != old_filename)
-            free (CONST_CAST (char *, old_filename));
-        }
+      if ((m_extra_dump_files[i].pass_optgroup_flags & optgroup_flags))
+	{
+	  const char *old_filename = m_extra_dump_files[i].alt_filename;
+	  /* Since this file is shared among different passes, it
+	     should be opened in append mode.  */
+	  m_extra_dump_files[i].alt_state = 1;
+	  m_extra_dump_files[i].optgroup_flags |= optgroup_flags;
+	  n++;
+	  /* Override the existing filename.  */
+	  if (filename)
+	    m_extra_dump_files[i].alt_filename = xstrdup (filename);
+	  if (old_filename && filename != old_filename)
+	    free (CONST_CAST (char *, old_filename));
+	}
     }
 
   return n;
@@ -929,101 +962,49 @@ dump_switch_p (const char *arg)
   return any;
 }
 
-void
-gcc::dump_manager::
-initialize_options ()
-{
-  /* Initialize optgroup options.  */
-  typedef dump_option_node<optgroup_types> node;
-
-  optgroup_options = new node (NULL, OPTGROUP_NONE);
-  optgroup_options->register_suboption (new node ("ipa", OPTGROUP_IPA));
-  optgroup_options->register_suboption (new node ("loop", OPTGROUP_LOOP));
-  optgroup_options->register_suboption (new node ("inline", OPTGROUP_INLINE));
-  optgroup_options->register_suboption (new node ("omp", OPTGROUP_OMP));
-  optgroup_options->register_suboption (new node ("vec", OPTGROUP_VEC));
-  optgroup_options->register_suboption (new node ("other", OPTGROUP_OTHER));
-
-  optgroup_options->initialize (optgroup_dump_flags_t::m_mask_translation);
-}
+static optgroup_option_hierarchy optgroup_options __attribute__
+((init_priority((200))));
 
 /* Parse ARG as a -fopt-info switch and store flags, optgroup_flags
    and filename.  Return non-zero if it is a recognized switch.  */
 
 static int
-opt_info_switch_p_1 (const char *arg, dump_flags_t *flags,
-		     optgroup_dump_flags_t *optgroup_flags,
+opt_info_switch_p_1 (const char *arg, optgroup_dump_flags_t *optgroup_flags,
 		     char **filename)
 {
-  const char *option_value;
-  const char *ptr;
-  optgroup_dump_flags_t f;
-  gcc::dump_manager *dumps = g->get_dumps ();
-
-  option_value = arg;
-  ptr = option_value;
-
+  char *option_value;
   *filename = NULL;
-  *flags = 0;
-  *optgroup_flags = 0;
+  *optgroup_flags = optgroup_dump_flags_t ();
 
-  if (!ptr)
+  if (!arg)
     return 1;       /* Handle '-fopt-info' without any additional options.  */
 
+  option_value = xstrdup (arg);
 
-  while (*ptr)
+  char *eq_ptr = strchr (option_value, '=');
+  if (eq_ptr)
     {
-      const struct dump_option_value_info *option_ptr;
-      const char *end_ptr;
-      const char *eq_ptr;
-      unsigned length;
-
-      while (*ptr == '-')
-	ptr++;
-      end_ptr = strchr (ptr, '-');
-      eq_ptr = strchr (ptr, '=');
-
-      if (eq_ptr && !end_ptr)
-        end_ptr = eq_ptr;
-
-      if (!end_ptr)
-	end_ptr = ptr + strlen (ptr);
-      length = end_ptr - ptr;
-
-      for (option_ptr = optinfo_verbosity_options; option_ptr->name;
-           option_ptr++)
-	if (strlen (option_ptr->name) == length
-	    && !memcmp (option_ptr->name, ptr, length))
-          {
-	    *flags |= option_ptr->value;
-	    goto found;
-	  }
+      *filename = xstrdup (eq_ptr + 1);
+      *eq_ptr = '\0';
+    }
 
-      f = dumps->get_optgroup_options ()->parse (ptr);
-      if (f)
-	{
-	  *optgroup_flags |= f;
-	  goto found;
-	}
 
-      if (*ptr == '=')
-        {
-          /* Interpret rest of the argument as a dump filename.  This
-             filename overrides other command line filenames.  */
-          *filename = xstrdup (ptr + 1);
-          break;
-        }
-      else
-        {
-          warning (0, "unknown option %q.*s in %<-fopt-info-%s%>",
-                   length, ptr, arg);
-          return 0;
-        }
-    found:;
-      ptr = end_ptr;
+  optgroup_dump_flags_t f;
+  f = optgroup_dump_flags_t::from_mask
+    (optgroup_options.root->parse (option_value));
+  if (f)
+    {
+      *optgroup_flags |= f;
+      free (option_value);
+      return 1;
+    }
+  else
+    {
+      warning (0, "unknown option %s in %<-fopt-info-%s%>",
+	       option_value, option_value);
+      free (option_value);
+      return 0;
     }
-
-  return 1;
 }
 
 /* Return non-zero if ARG is a recognized switch for
@@ -1032,13 +1013,12 @@ opt_info_switch_p_1 (const char *arg, dump_flags_t *flags,
 int
 opt_info_switch_p (const char *arg)
 {
-  dump_flags_t flags;
   optgroup_dump_flags_t optgroup_flags;
   char *filename;
   static char *file_seen = NULL;
   gcc::dump_manager *dumps = g->get_dumps ();
 
-  if (!opt_info_switch_p_1 (arg, &flags, &optgroup_flags, &filename))
+  if (!opt_info_switch_p_1 (arg, &optgroup_flags, &filename))
     return 0;
 
   if (!filename)
@@ -1053,12 +1033,10 @@ opt_info_switch_p (const char *arg)
     }
 
   file_seen = xstrdup (filename);
-  if (!flags)
-    flags = MSG_OPTIMIZED_LOCATIONS;
   if (!optgroup_flags)
     optgroup_flags = optgroup_dump_flags_t::get_all ();
 
-  return dumps->opt_info_enable_passes (optgroup_flags, flags, filename);
+  return dumps->opt_info_enable_passes (optgroup_flags, filename);
 }
 
 /* Print basic block on the dump streams.  */
@@ -1068,7 +1046,7 @@ dump_basic_block (int dump_kind, basic_block bb, int indent)
 {
   if (dump_file && (dump_kind & pflags))
     dump_bb (dump_file, bb, indent, TDF_DETAILS);
-  if (alt_dump_file && (dump_kind & alt_flags))
+  if (alt_dump_file && (dump_kind & opt_info_flags))
     dump_bb (alt_dump_file, bb, indent, TDF_DETAILS);
 }
 
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index 67da7003331..bcd70198901 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -84,11 +84,6 @@ enum tree_dump_index
 #define TDF_SCEV	(1 << 24)	/* Dump SCEV details.  */
 #define TDF_COMMENT	(1 << 25)	/* Dump lines with prefix ";;"  */
 #define TDF_GIMPLE	(1 << 26)	/* Dump in GIMPLE FE syntax  */
-#define MSG_OPTIMIZED_LOCATIONS  (1 << 27)  /* -fopt-info optimized sources */
-#define MSG_MISSED_OPTIMIZATION  (1 << 28)  /* missed opportunities */
-#define MSG_NOTE                 (1 << 29)  /* general optimization info */
-#define MSG_ALL         (MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION \
-                         | MSG_NOTE)
 
 /* Dump option node is a tree structure that implements
    parsing of suboptions and provides mapping between a given enum type E
@@ -106,6 +101,9 @@ struct dump_option_node
   /* Parse a given option string and return mask.  */
   uint64_t parse (const char *token);
 
+  /* Parse a given option string and return mask.  */
+  uint64_t parse (char *token);
+
   /* Register a SUBOPTION for a dump option node.  */
   void register_suboption (dump_option_node<E> *suboption)
   {
@@ -118,7 +116,7 @@ private:
   uint64_t initialize_masks (unsigned *current, uint64_t *mask_translation);
 
   /* Parse a given option string and return mask.  */
-  uint64_t parse (char *token);
+  uint64_t parse_internal (char *token);
 
   /* Name of the option.  */
   const char *m_name;
@@ -146,15 +144,21 @@ struct dump_flags_type
   dump_flags_type<E> (): m_mask (0)
   {}
 
-  /* Constructor for a MASK.  */
-  dump_flags_type<E> (uint64_t mask): m_mask (mask)
-  {}
-
   /* Constructor for a enum value E.  */
   dump_flags_type<E> (E enum_value)
   {
     gcc_checking_assert ((unsigned)enum_value <= OPT_MASK_SIZE);
     m_mask = m_mask_translation[enum_value];
+    gcc_checking_assert (m_mask != 0);
+  }
+
+  /* Constructor for two enum values.  */
+  dump_flags_type<E> (E enum_value, E enum_value2)
+  {
+    gcc_checking_assert ((unsigned)enum_value <= OPT_MASK_SIZE);
+    gcc_checking_assert ((unsigned)enum_value2 <= OPT_MASK_SIZE);
+    m_mask = m_mask_translation[enum_value] | m_mask_translation[enum_value2];
+    gcc_checking_assert (m_mask != 0);
   }
 
   /* OR operator for OTHER dump_flags_type.  */
@@ -181,6 +185,12 @@ struct dump_flags_type
     return m_mask;
   }
 
+  /* Return dump_flags_type for a computed mask.  */
+  static inline dump_flags_type from_mask (uint64_t mask)
+  {
+    return dump_flags_type (mask);
+  }
+
   /* Return mask that represents all selected options.  */
   static inline dump_flags_type get_all ()
   {
@@ -195,6 +205,12 @@ struct dump_flags_type
 
   /* Translation table between enum values and masks.  */
   static uint64_t m_mask_translation[OPT_MASK_SIZE];
+
+private:
+  /* Constructor.  */
+  dump_flags_type<E> (uint64_t mask): m_mask (mask)
+  {}
+
 };
 
 /* Flags used for -fopt-info groups.  */
@@ -203,11 +219,29 @@ enum optgroup_types
 {
   OPTGROUP_NONE,
   OPTGROUP_IPA,
+  OPTGROUP_IPA_OPTIMIZED,
+  OPTGROUP_IPA_MISSED,
+  OPTGROUP_IPA_NOTE,
   OPTGROUP_LOOP,
+  OPTGROUP_LOOP_OPTIMIZED,
+  OPTGROUP_LOOP_MISSED,
+  OPTGROUP_LOOP_NOTE,
   OPTGROUP_INLINE,
+  OPTGROUP_INLINE_OPTIMIZED,
+  OPTGROUP_INLINE_MISSED,
+  OPTGROUP_INLINE_NOTE,
   OPTGROUP_OMP,
+  OPTGROUP_OMP_OPTIMIZED,
+  OPTGROUP_OMP_MISSED,
+  OPTGROUP_OMP_NOTE,
   OPTGROUP_VEC,
+  OPTGROUP_VEC_OPTIMIZED,
+  OPTGROUP_VEC_MISSED,
+  OPTGROUP_VEC_NOTE,
   OPTGROUP_OTHER,
+  OPTGROUP_OTHER_OPTIMIZED,
+  OPTGROUP_OTHER_MISSED,
+  OPTGROUP_OTHER_NOTE,
   OPTGROUP_COUNT
 };
 
@@ -226,20 +260,21 @@ typedef uint64_t dump_flags_t;
 /* Define a tree dump switch.  */
 struct dump_file_info
 {
-  const char *suffix;           /* suffix to give output file.  */
-  const char *swtch;            /* command line dump switch */
-  const char *glob;             /* command line glob  */
-  const char *pfilename;        /* filename for the pass-specific stream  */
+  const char *suffix;		/* suffix to give output file.  */
+  const char *swtch;		/* command line dump switch */
+  const char *glob;		/* command line glob  */
+  const char *pfilename;	/* filename for the pass-specific stream  */
   const char *alt_filename;     /* filename for the -fopt-info stream  */
-  FILE *pstream;                /* pass-specific dump stream  */
-  FILE *alt_stream;             /* -fopt-info stream */
+  FILE *pstream;		/* pass-specific dump stream  */
+  FILE *alt_stream;		/* -fopt-info stream */
   dump_flags_t pflags;		/* dump flags */
-  optgroup_dump_flags_t optgroup_flags; /* optgroup flags for -fopt-info */
-  int alt_flags;                /* flags for opt-info */
-  int pstate;                   /* state of pass-specific stream */
-  int alt_state;                /* state of the -fopt-info stream */
-  int num;                      /* dump file number */
-  bool owns_strings;            /* fields "suffix", "swtch", "glob" can be
+  optgroup_dump_flags_t pass_optgroup_flags; /* a pass flags for -fopt-info */
+  optgroup_dump_flags_t optgroup_flags; /* flags for -fopt-info given
+					   by a user */
+  int pstate;			/* state of pass-specific stream */
+  int alt_state;		/* state of the -fopt-info stream */
+  int num;			/* dump file number */
+  bool owns_strings;		/* fields "suffix", "swtch", "glob" can be
 				   const strings, or can be dynamically
 				   allocated, needing free.  */
   bool graph_dump_initialized;  /* When a given dump file is being initialized,
@@ -253,15 +288,18 @@ extern FILE *dump_begin (int, dump_flags_t *);
 extern void dump_end (int, FILE *);
 extern int opt_info_switch_p (const char *);
 extern const char *dump_flag_name (int);
-extern void dump_printf (dump_flags_t, const char *, ...) ATTRIBUTE_PRINTF_2;
-extern void dump_printf_loc (dump_flags_t, source_location,
+extern void dump_printf (optgroup_dump_flags_t,
+			 const char *, ...) ATTRIBUTE_PRINTF_2;
+extern void dump_printf_loc (optgroup_dump_flags_t, source_location,
                              const char *, ...) ATTRIBUTE_PRINTF_3;
-extern void dump_basic_block (int, basic_block, int);
-extern void dump_generic_expr_loc (int, source_location, int, tree);
-extern void dump_generic_expr (dump_flags_t, dump_flags_t, tree);
-extern void dump_gimple_stmt_loc (dump_flags_t, source_location, dump_flags_t,
-				  gimple *, int);
-extern void dump_gimple_stmt (dump_flags_t, dump_flags_t, gimple *, int);
+extern void dump_basic_block (optgroup_dump_flags_t, basic_block, int);
+extern void dump_generic_expr_loc (optgroup_dump_flags_t, source_location,
+				   int, tree);
+extern void dump_generic_expr (optgroup_dump_flags_t, dump_flags_t, tree);
+extern void dump_gimple_stmt_loc (optgroup_dump_flags_t, source_location,
+				  dump_flags_t, gimple *, int);
+extern void dump_gimple_stmt (optgroup_dump_flags_t, dump_flags_t, gimple *,
+			      int);
 extern void print_combine_total_stats (void);
 extern bool enable_rtl_dump_file (void);
 
@@ -286,6 +324,20 @@ dump_enabled_p (void)
   return (dump_file || alt_dump_file);
 }
 
+/* Optgroup option hierarchy.  */
+
+struct optgroup_option_hierarchy
+{
+  /* Contructor.  */
+  optgroup_option_hierarchy();
+
+  /* Initialize optgroup options.  */
+  typedef dump_option_node<optgroup_types> node;
+
+  /* Root option node.  */
+  node *root;
+};
+
 namespace gcc {
 
 class dump_manager
@@ -346,12 +398,6 @@ public:
   const char *
   dump_flag_name (int phase) const;
 
-  /* Return optgroup_types dump options.  */
-  dump_option_node<optgroup_types> *get_optgroup_options ()
-  {
-    return optgroup_options;
-  }
-
 private:
 
   int
@@ -365,9 +411,7 @@ private:
 
   int
   opt_info_enable_passes (optgroup_dump_flags_t optgroup_flags,
-			  dump_flags_t flags, const char *filename);
-
-  void initialize_options ();
+			  const char *filename);
 
 private:
 
@@ -377,9 +421,6 @@ private:
   size_t m_extra_dump_files_in_use;
   size_t m_extra_dump_files_alloced;
 
-  /* Dump option node for optgroup_types enum.  */
-  dump_option_node<optgroup_types> *optgroup_options;
-
   /* Grant access to dump_enable_all.  */
   friend bool ::enable_rtl_dump_file (void);
 
diff --git a/gcc/passes.c b/gcc/passes.c
index a607e3e6bc2..ce488bc6328 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -779,7 +779,7 @@ pass_manager::register_one_dump_file (opt_pass *pass)
   char num[11];
   dump_flags_t flags;
   int id;
-  int optgroup_flags = OPTGROUP_NONE;
+  optgroup_dump_flags_t optgroup_flags;
   gcc::dump_manager *dumps = m_ctxt->get_dumps ();
 
   /* See below in next_pass_1.  */
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 85bfba7ac28..1ce8a7afe8f 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -47,7 +47,7 @@ struct pass_data
   const char *name;
 
   /* The -fopt-info optimization group flags as defined in dumpfile.h. */
-  unsigned int optinfo_flags;
+  optgroup_dump_flags_t optinfo_flags;
 
   /* The timevar id associated with this pass.  */
   /* ??? Ideally would be dynamically assigned.  */
-- 
2.12.2


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

* Re: [RFC][PATCH] Introduce -fdump*-folding
  2017-05-09 12:03           ` Martin Liška
@ 2017-05-09 12:19             ` Richard Biener
  2017-05-09 12:52               ` Martin Liška
  0 siblings, 1 reply; 54+ messages in thread
From: Richard Biener @ 2017-05-09 12:19 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Tue, May 9, 2017 at 2:01 PM, Martin Liška <mliska@suse.cz> wrote:
> On 05/05/2017 01:50 PM, Richard Biener wrote:
>> On Thu, May 4, 2017 at 1:10 PM, Martin Liška <mliska@suse.cz> wrote:
>>> On 05/04/2017 12:40 PM, Richard Biener wrote:
>>>>
>>>> On Thu, May 4, 2017 at 11:22 AM, Martin Liška <mliska@suse.cz> wrote:
>>>>>
>>>>> On 05/03/2017 12:12 PM, Richard Biener wrote:
>>>>>>
>>>>>>
>>>>>> On Wed, May 3, 2017 at 10:10 AM, Martin Liška <mliska@suse.cz> wrote:
>>>>>>>
>>>>>>>
>>>>>>> Hello
>>>>>>>
>>>>>>> Last release cycle I spent quite some time with reading of IVOPTS pass
>>>>>>> dump file. Using -fdump*-details causes to generate a lot of 'Applying
>>>>>>> pattern'
>>>>>>> lines, which can make reading of a dump file more complicated.
>>>>>>>
>>>>>>> There are stats for tramp3d with -O2 and -fdump-tree-all-details.
>>>>>>> Percentage number
>>>>>>> shows how many lines are of the aforementioned pattern:
>>>>>>>
>>>>>>>                         tramp3d-v4.cpp.164t.ivopts: 6.34%
>>>>>>>                           tramp3d-v4.cpp.091t.ccp2: 5.04%
>>>>>>>                       tramp3d-v4.cpp.093t.cunrolli: 4.41%
>>>>>>>                       tramp3d-v4.cpp.129t.laddress: 3.70%
>>>>>>>                           tramp3d-v4.cpp.032t.ccp1: 2.31%
>>>>>>>                           tramp3d-v4.cpp.038t.evrp: 1.90%
>>>>>>>                      tramp3d-v4.cpp.033t.forwprop1: 1.74%
>>>>>>>                           tramp3d-v4.cpp.103t.vrp1: 1.52%
>>>>>>>                      tramp3d-v4.cpp.124t.forwprop3: 1.31%
>>>>>>>                           tramp3d-v4.cpp.181t.vrp2: 1.30%
>>>>>>>                        tramp3d-v4.cpp.161t.cunroll: 1.22%
>>>>>>>                     tramp3d-v4.cpp.027t.fixup_cfg3: 1.11%
>>>>>>>                        tramp3d-v4.cpp.153t.ivcanon: 1.07%
>>>>>>>                           tramp3d-v4.cpp.126t.ccp3: 0.96%
>>>>>>>                           tramp3d-v4.cpp.143t.sccp: 0.91%
>>>>>>>                      tramp3d-v4.cpp.185t.forwprop4: 0.82%
>>>>>>>                            tramp3d-v4.cpp.011t.cfg: 0.74%
>>>>>>>                      tramp3d-v4.cpp.096t.forwprop2: 0.50%
>>>>>>>                     tramp3d-v4.cpp.019t.fixup_cfg1: 0.37%
>>>>>>>                      tramp3d-v4.cpp.120t.phicprop1: 0.33%
>>>>>>>                            tramp3d-v4.cpp.133t.pre: 0.32%
>>>>>>>                      tramp3d-v4.cpp.182t.phicprop2: 0.27%
>>>>>>>                     tramp3d-v4.cpp.170t.veclower21: 0.25%
>>>>>>>                        tramp3d-v4.cpp.029t.einline: 0.24%
>>>>>>>
>>>>>>> I'm suggesting to add new TDF that will be allocated for that.
>>>>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression
>>>>>>> tests.
>>>>>>>
>>>>>>> Thoughts?
>>>>>>
>>>>>>
>>>>>>
>>>>>> Ok.  Soon we'll want to change dump_flags to uint64_t ...  (we have 1
>>>>>> bit
>>>>>> left
>>>>>> if you allow negative dump_flags).  It'll tickle down on a lot of
>>>>>> interfaces
>>>>>> so introducing dump_flags_t at the same time might be a good idea.
>>>>>
>>>>>
>>>>>
>>>>> Hello.
>>>>>
>>>>> I've prepared patch that migrates all interfaces and introduces
>>>>> dump_flags_t.
>>>>
>>>>
>>>> Great.
>>>>
>>>>> I've been
>>>>> currently testing that. Apart from that Richi requested to come up with
>>>>> more
>>>>> generic approach
>>>>> of hierarchical structure of options.
>>>>
>>>>
>>>> Didn't really "request" it, it's just something we eventually need to do
>>>> when
>>>> we run out of bits again ;)
>>>
>>>
>>> I know, but it was me who came up with the idea of more fine suboptions :)
>>>
>>>>
>>>>>
>>>>> Can you please take a look at self-contained source file that shows way
>>>>> I've
>>>>> decided to go?
>>>>> Another question is whether we want to implement also "aliases", where
>>>>> for
>>>>> instance
>>>>> current 'all' is equal to union of couple of suboptions?
>>>>
>>>>
>>>> Yeah, I think we do want -all-all-all and -foo-all to work.  Not sure
>>>> about -all-foo-all.
>>>
>>>
>>> Actually only having 'all' is quite easy to implement.
>>>
>>> Let's imagine following hierarchy:
>>>
>>> (root)
>>> - vops
>>> - folding
>>>   - gimple
>>>     - ctor
>>>     - array_ref
>>>     - arithmetic
>>>   - generic
>>>     - c
>>>     - c++
>>>     - ctor
>>>     - xyz
>>>
>>> Then '-fdump-passname-folding-all' will be equal to
>>> '-fdump-passname-folding'.
>>
>> Ok, so you envision that sub-options restrict stuff.  I thought of
>>
>>  -gimple
>>    -vops
>>  -generic
>>    -folding
>>
>> so the other way around.  We do not have many options that would be RTL
>> specific but gimple only are -vops -alias -scev -gimple -rhs-only
>> -verbose -memsyms
>> while RTL has -cselib. -eh sounds gimple specific.  Then there's the optgroup
>> stuff you already saw.
>>
>> So it looks like a 8 bit "group id" plus 56 bits of flags would do.
>>
>> Yes, this implies reworking how & and | work.  For example you can't
>> | dump-flags of different groups.
>
> Well, I'm not opposed to idea of converting that to way you described.
> So, you're willing to introduce something like:
>
> (root)
> - generic
>   - eh
>   - folding
>   - ...
> - gimple
>   - vops
>   - folding
>    - rhs-only
>    - ...
>   - vops
> - rtl
>   - cselib
>   - ...
>
> ?

Yeah.  As said the motivation was to escape the 32 (now 64) bits limitation,
not to make the user interface into a hierarchy.

I suppose we can easily defer now given we have 32 bits available now ;)

Richard.

>>
>>>>
>>>> The important thing is to make sure dump_flags_t stays POD and thus is
>>>> eligible to be passed in register(s).  In the end we might simply come up
>>>> with a two-level hierarchy, each 32bits (or we can even get back to 32bits
>>>> in total with two times 16bits).
>>>
>>>
>>> I'm aware of having the type as POD.
>>>
>>>>
>>>> It looks you didn't actually implement this as a hierarchy though but
>>>> still allocate from one pool of bits (so you only do a change to how
>>>> users access this?)
>>>
>>>
>>> Yep, all leaf options are mapped to a mask and all inner nodes are just
>>> union
>>> of suboptions. That will allow us to have 64 leaf suboptions. Reaching the
>>> limit
>>> we can encode the values in more sophisticated way. That however brings need
>>> to implement more complicated '&' and '|' operators.
>>>
>>> I'll finish the implementation and try to migrate that to current handling.
>>> Guess, I'm quite close.
>>
>> Hmm, but then there's not much advantage in suboptions (well, apart from maybe
>> at the user-side).
>
> Yep, please take a look at updated version of PATCH 2/N, where I ported -fopt-info.
> As you can see I had to explicitly define all enum values and hierarchy creation
> of every single node.
>
> Martin
>
>>
>>> Martin
>>>
>>>
>>>>
>>>> Thanks,
>>>> Richard.
>>>>
>>>>>
>>>>> Thanks for feedback,
>>>>> Martin
>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Richard.
>>>>>>
>>>>>>> Martin
>>>>>
>>>>>
>>>>>
>>>
>

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

* Re: [RFC][PATCH] Introduce -fdump*-folding
  2017-05-09 12:19             ` Richard Biener
@ 2017-05-09 12:52               ` Martin Liška
  2017-05-09 13:01                 ` Richard Biener
  0 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-09 12:52 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

On 05/09/2017 02:16 PM, Richard Biener wrote:
> On Tue, May 9, 2017 at 2:01 PM, Martin Liška <mliska@suse.cz> wrote:
>> On 05/05/2017 01:50 PM, Richard Biener wrote:
>>> On Thu, May 4, 2017 at 1:10 PM, Martin Liška <mliska@suse.cz> wrote:
>>>> On 05/04/2017 12:40 PM, Richard Biener wrote:
>>>>>
>>>>> On Thu, May 4, 2017 at 11:22 AM, Martin Liška <mliska@suse.cz> wrote:
>>>>>>
>>>>>> On 05/03/2017 12:12 PM, Richard Biener wrote:
>>>>>>>
>>>>>>>
>>>>>>> On Wed, May 3, 2017 at 10:10 AM, Martin Liška <mliska@suse.cz> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> Hello
>>>>>>>>
>>>>>>>> Last release cycle I spent quite some time with reading of IVOPTS pass
>>>>>>>> dump file. Using -fdump*-details causes to generate a lot of 'Applying
>>>>>>>> pattern'
>>>>>>>> lines, which can make reading of a dump file more complicated.
>>>>>>>>
>>>>>>>> There are stats for tramp3d with -O2 and -fdump-tree-all-details.
>>>>>>>> Percentage number
>>>>>>>> shows how many lines are of the aforementioned pattern:
>>>>>>>>
>>>>>>>>                         tramp3d-v4.cpp.164t.ivopts: 6.34%
>>>>>>>>                           tramp3d-v4.cpp.091t.ccp2: 5.04%
>>>>>>>>                       tramp3d-v4.cpp.093t.cunrolli: 4.41%
>>>>>>>>                       tramp3d-v4.cpp.129t.laddress: 3.70%
>>>>>>>>                           tramp3d-v4.cpp.032t.ccp1: 2.31%
>>>>>>>>                           tramp3d-v4.cpp.038t.evrp: 1.90%
>>>>>>>>                      tramp3d-v4.cpp.033t.forwprop1: 1.74%
>>>>>>>>                           tramp3d-v4.cpp.103t.vrp1: 1.52%
>>>>>>>>                      tramp3d-v4.cpp.124t.forwprop3: 1.31%
>>>>>>>>                           tramp3d-v4.cpp.181t.vrp2: 1.30%
>>>>>>>>                        tramp3d-v4.cpp.161t.cunroll: 1.22%
>>>>>>>>                     tramp3d-v4.cpp.027t.fixup_cfg3: 1.11%
>>>>>>>>                        tramp3d-v4.cpp.153t.ivcanon: 1.07%
>>>>>>>>                           tramp3d-v4.cpp.126t.ccp3: 0.96%
>>>>>>>>                           tramp3d-v4.cpp.143t.sccp: 0.91%
>>>>>>>>                      tramp3d-v4.cpp.185t.forwprop4: 0.82%
>>>>>>>>                            tramp3d-v4.cpp.011t.cfg: 0.74%
>>>>>>>>                      tramp3d-v4.cpp.096t.forwprop2: 0.50%
>>>>>>>>                     tramp3d-v4.cpp.019t.fixup_cfg1: 0.37%
>>>>>>>>                      tramp3d-v4.cpp.120t.phicprop1: 0.33%
>>>>>>>>                            tramp3d-v4.cpp.133t.pre: 0.32%
>>>>>>>>                      tramp3d-v4.cpp.182t.phicprop2: 0.27%
>>>>>>>>                     tramp3d-v4.cpp.170t.veclower21: 0.25%
>>>>>>>>                        tramp3d-v4.cpp.029t.einline: 0.24%
>>>>>>>>
>>>>>>>> I'm suggesting to add new TDF that will be allocated for that.
>>>>>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression
>>>>>>>> tests.
>>>>>>>>
>>>>>>>> Thoughts?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Ok.  Soon we'll want to change dump_flags to uint64_t ...  (we have 1
>>>>>>> bit
>>>>>>> left
>>>>>>> if you allow negative dump_flags).  It'll tickle down on a lot of
>>>>>>> interfaces
>>>>>>> so introducing dump_flags_t at the same time might be a good idea.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Hello.
>>>>>>
>>>>>> I've prepared patch that migrates all interfaces and introduces
>>>>>> dump_flags_t.
>>>>>
>>>>>
>>>>> Great.
>>>>>
>>>>>> I've been
>>>>>> currently testing that. Apart from that Richi requested to come up with
>>>>>> more
>>>>>> generic approach
>>>>>> of hierarchical structure of options.
>>>>>
>>>>>
>>>>> Didn't really "request" it, it's just something we eventually need to do
>>>>> when
>>>>> we run out of bits again ;)
>>>>
>>>>
>>>> I know, but it was me who came up with the idea of more fine suboptions :)
>>>>
>>>>>
>>>>>>
>>>>>> Can you please take a look at self-contained source file that shows way
>>>>>> I've
>>>>>> decided to go?
>>>>>> Another question is whether we want to implement also "aliases", where
>>>>>> for
>>>>>> instance
>>>>>> current 'all' is equal to union of couple of suboptions?
>>>>>
>>>>>
>>>>> Yeah, I think we do want -all-all-all and -foo-all to work.  Not sure
>>>>> about -all-foo-all.
>>>>
>>>>
>>>> Actually only having 'all' is quite easy to implement.
>>>>
>>>> Let's imagine following hierarchy:
>>>>
>>>> (root)
>>>> - vops
>>>> - folding
>>>>   - gimple
>>>>     - ctor
>>>>     - array_ref
>>>>     - arithmetic
>>>>   - generic
>>>>     - c
>>>>     - c++
>>>>     - ctor
>>>>     - xyz
>>>>
>>>> Then '-fdump-passname-folding-all' will be equal to
>>>> '-fdump-passname-folding'.
>>>
>>> Ok, so you envision that sub-options restrict stuff.  I thought of
>>>
>>>  -gimple
>>>    -vops
>>>  -generic
>>>    -folding
>>>
>>> so the other way around.  We do not have many options that would be RTL
>>> specific but gimple only are -vops -alias -scev -gimple -rhs-only
>>> -verbose -memsyms
>>> while RTL has -cselib. -eh sounds gimple specific.  Then there's the optgroup
>>> stuff you already saw.
>>>
>>> So it looks like a 8 bit "group id" plus 56 bits of flags would do.
>>>
>>> Yes, this implies reworking how & and | work.  For example you can't
>>> | dump-flags of different groups.
>>
>> Well, I'm not opposed to idea of converting that to way you described.
>> So, you're willing to introduce something like:
>>
>> (root)
>> - generic
>>   - eh
>>   - folding
>>   - ...
>> - gimple
>>   - vops
>>   - folding
>>    - rhs-only
>>    - ...
>>   - vops
>> - rtl
>>   - cselib
>>   - ...
>>
>> ?
> 
> Yeah.  As said the motivation was to escape the 32 (now 64) bits limitation,
> not to make the user interface into a hierarchy.
> 
> I suppose we can easily defer now given we have 32 bits available now ;)

I see. Hopefully we can live quite some time with another 32 bits and I'm going
to transform the TDF_* stuff to enum.

Martin

> 
> Richard.
> 
>>>
>>>>>
>>>>> The important thing is to make sure dump_flags_t stays POD and thus is
>>>>> eligible to be passed in register(s).  In the end we might simply come up
>>>>> with a two-level hierarchy, each 32bits (or we can even get back to 32bits
>>>>> in total with two times 16bits).
>>>>
>>>>
>>>> I'm aware of having the type as POD.
>>>>
>>>>>
>>>>> It looks you didn't actually implement this as a hierarchy though but
>>>>> still allocate from one pool of bits (so you only do a change to how
>>>>> users access this?)
>>>>
>>>>
>>>> Yep, all leaf options are mapped to a mask and all inner nodes are just
>>>> union
>>>> of suboptions. That will allow us to have 64 leaf suboptions. Reaching the
>>>> limit
>>>> we can encode the values in more sophisticated way. That however brings need
>>>> to implement more complicated '&' and '|' operators.
>>>>
>>>> I'll finish the implementation and try to migrate that to current handling.
>>>> Guess, I'm quite close.
>>>
>>> Hmm, but then there's not much advantage in suboptions (well, apart from maybe
>>> at the user-side).
>>
>> Yep, please take a look at updated version of PATCH 2/N, where I ported -fopt-info.
>> As you can see I had to explicitly define all enum values and hierarchy creation
>> of every single node.
>>
>> Martin
>>
>>>
>>>> Martin
>>>>
>>>>
>>>>>
>>>>> Thanks,
>>>>> Richard.
>>>>>
>>>>>>
>>>>>> Thanks for feedback,
>>>>>> Martin
>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Richard.
>>>>>>>
>>>>>>>> Martin
>>>>>>
>>>>>>
>>>>>>
>>>>
>>

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

* Re: [RFC][PATCH] Introduce -fdump*-folding
  2017-05-09 12:52               ` Martin Liška
@ 2017-05-09 13:01                 ` Richard Biener
  0 siblings, 0 replies; 54+ messages in thread
From: Richard Biener @ 2017-05-09 13:01 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Tue, May 9, 2017 at 2:46 PM, Martin Liška <mliska@suse.cz> wrote:
> On 05/09/2017 02:16 PM, Richard Biener wrote:
>> On Tue, May 9, 2017 at 2:01 PM, Martin Liška <mliska@suse.cz> wrote:
>>> On 05/05/2017 01:50 PM, Richard Biener wrote:
>>>> On Thu, May 4, 2017 at 1:10 PM, Martin Liška <mliska@suse.cz> wrote:
>>>>> On 05/04/2017 12:40 PM, Richard Biener wrote:
>>>>>>
>>>>>> On Thu, May 4, 2017 at 11:22 AM, Martin Liška <mliska@suse.cz> wrote:
>>>>>>>
>>>>>>> On 05/03/2017 12:12 PM, Richard Biener wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, May 3, 2017 at 10:10 AM, Martin Liška <mliska@suse.cz> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Hello
>>>>>>>>>
>>>>>>>>> Last release cycle I spent quite some time with reading of IVOPTS pass
>>>>>>>>> dump file. Using -fdump*-details causes to generate a lot of 'Applying
>>>>>>>>> pattern'
>>>>>>>>> lines, which can make reading of a dump file more complicated.
>>>>>>>>>
>>>>>>>>> There are stats for tramp3d with -O2 and -fdump-tree-all-details.
>>>>>>>>> Percentage number
>>>>>>>>> shows how many lines are of the aforementioned pattern:
>>>>>>>>>
>>>>>>>>>                         tramp3d-v4.cpp.164t.ivopts: 6.34%
>>>>>>>>>                           tramp3d-v4.cpp.091t.ccp2: 5.04%
>>>>>>>>>                       tramp3d-v4.cpp.093t.cunrolli: 4.41%
>>>>>>>>>                       tramp3d-v4.cpp.129t.laddress: 3.70%
>>>>>>>>>                           tramp3d-v4.cpp.032t.ccp1: 2.31%
>>>>>>>>>                           tramp3d-v4.cpp.038t.evrp: 1.90%
>>>>>>>>>                      tramp3d-v4.cpp.033t.forwprop1: 1.74%
>>>>>>>>>                           tramp3d-v4.cpp.103t.vrp1: 1.52%
>>>>>>>>>                      tramp3d-v4.cpp.124t.forwprop3: 1.31%
>>>>>>>>>                           tramp3d-v4.cpp.181t.vrp2: 1.30%
>>>>>>>>>                        tramp3d-v4.cpp.161t.cunroll: 1.22%
>>>>>>>>>                     tramp3d-v4.cpp.027t.fixup_cfg3: 1.11%
>>>>>>>>>                        tramp3d-v4.cpp.153t.ivcanon: 1.07%
>>>>>>>>>                           tramp3d-v4.cpp.126t.ccp3: 0.96%
>>>>>>>>>                           tramp3d-v4.cpp.143t.sccp: 0.91%
>>>>>>>>>                      tramp3d-v4.cpp.185t.forwprop4: 0.82%
>>>>>>>>>                            tramp3d-v4.cpp.011t.cfg: 0.74%
>>>>>>>>>                      tramp3d-v4.cpp.096t.forwprop2: 0.50%
>>>>>>>>>                     tramp3d-v4.cpp.019t.fixup_cfg1: 0.37%
>>>>>>>>>                      tramp3d-v4.cpp.120t.phicprop1: 0.33%
>>>>>>>>>                            tramp3d-v4.cpp.133t.pre: 0.32%
>>>>>>>>>                      tramp3d-v4.cpp.182t.phicprop2: 0.27%
>>>>>>>>>                     tramp3d-v4.cpp.170t.veclower21: 0.25%
>>>>>>>>>                        tramp3d-v4.cpp.029t.einline: 0.24%
>>>>>>>>>
>>>>>>>>> I'm suggesting to add new TDF that will be allocated for that.
>>>>>>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression
>>>>>>>>> tests.
>>>>>>>>>
>>>>>>>>> Thoughts?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Ok.  Soon we'll want to change dump_flags to uint64_t ...  (we have 1
>>>>>>>> bit
>>>>>>>> left
>>>>>>>> if you allow negative dump_flags).  It'll tickle down on a lot of
>>>>>>>> interfaces
>>>>>>>> so introducing dump_flags_t at the same time might be a good idea.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Hello.
>>>>>>>
>>>>>>> I've prepared patch that migrates all interfaces and introduces
>>>>>>> dump_flags_t.
>>>>>>
>>>>>>
>>>>>> Great.
>>>>>>
>>>>>>> I've been
>>>>>>> currently testing that. Apart from that Richi requested to come up with
>>>>>>> more
>>>>>>> generic approach
>>>>>>> of hierarchical structure of options.
>>>>>>
>>>>>>
>>>>>> Didn't really "request" it, it's just something we eventually need to do
>>>>>> when
>>>>>> we run out of bits again ;)
>>>>>
>>>>>
>>>>> I know, but it was me who came up with the idea of more fine suboptions :)
>>>>>
>>>>>>
>>>>>>>
>>>>>>> Can you please take a look at self-contained source file that shows way
>>>>>>> I've
>>>>>>> decided to go?
>>>>>>> Another question is whether we want to implement also "aliases", where
>>>>>>> for
>>>>>>> instance
>>>>>>> current 'all' is equal to union of couple of suboptions?
>>>>>>
>>>>>>
>>>>>> Yeah, I think we do want -all-all-all and -foo-all to work.  Not sure
>>>>>> about -all-foo-all.
>>>>>
>>>>>
>>>>> Actually only having 'all' is quite easy to implement.
>>>>>
>>>>> Let's imagine following hierarchy:
>>>>>
>>>>> (root)
>>>>> - vops
>>>>> - folding
>>>>>   - gimple
>>>>>     - ctor
>>>>>     - array_ref
>>>>>     - arithmetic
>>>>>   - generic
>>>>>     - c
>>>>>     - c++
>>>>>     - ctor
>>>>>     - xyz
>>>>>
>>>>> Then '-fdump-passname-folding-all' will be equal to
>>>>> '-fdump-passname-folding'.
>>>>
>>>> Ok, so you envision that sub-options restrict stuff.  I thought of
>>>>
>>>>  -gimple
>>>>    -vops
>>>>  -generic
>>>>    -folding
>>>>
>>>> so the other way around.  We do not have many options that would be RTL
>>>> specific but gimple only are -vops -alias -scev -gimple -rhs-only
>>>> -verbose -memsyms
>>>> while RTL has -cselib. -eh sounds gimple specific.  Then there's the optgroup
>>>> stuff you already saw.
>>>>
>>>> So it looks like a 8 bit "group id" plus 56 bits of flags would do.
>>>>
>>>> Yes, this implies reworking how & and | work.  For example you can't
>>>> | dump-flags of different groups.
>>>
>>> Well, I'm not opposed to idea of converting that to way you described.
>>> So, you're willing to introduce something like:
>>>
>>> (root)
>>> - generic
>>>   - eh
>>>   - folding
>>>   - ...
>>> - gimple
>>>   - vops
>>>   - folding
>>>    - rhs-only
>>>    - ...
>>>   - vops
>>> - rtl
>>>   - cselib
>>>   - ...
>>>
>>> ?
>>
>> Yeah.  As said the motivation was to escape the 32 (now 64) bits limitation,
>> not to make the user interface into a hierarchy.
>>
>> I suppose we can easily defer now given we have 32 bits available now ;)
>
> I see. Hopefully we can live quite some time with another 32 bits and I'm going
> to transform the TDF_* stuff to enum.

Maybe another .def file with embedded docs ;)

Ok, no, I didn't suggest this.

/me runs...

> Martin
>
>>
>> Richard.
>>
>>>>
>>>>>>
>>>>>> The important thing is to make sure dump_flags_t stays POD and thus is
>>>>>> eligible to be passed in register(s).  In the end we might simply come up
>>>>>> with a two-level hierarchy, each 32bits (or we can even get back to 32bits
>>>>>> in total with two times 16bits).
>>>>>
>>>>>
>>>>> I'm aware of having the type as POD.
>>>>>
>>>>>>
>>>>>> It looks you didn't actually implement this as a hierarchy though but
>>>>>> still allocate from one pool of bits (so you only do a change to how
>>>>>> users access this?)
>>>>>
>>>>>
>>>>> Yep, all leaf options are mapped to a mask and all inner nodes are just
>>>>> union
>>>>> of suboptions. That will allow us to have 64 leaf suboptions. Reaching the
>>>>> limit
>>>>> we can encode the values in more sophisticated way. That however brings need
>>>>> to implement more complicated '&' and '|' operators.
>>>>>
>>>>> I'll finish the implementation and try to migrate that to current handling.
>>>>> Guess, I'm quite close.
>>>>
>>>> Hmm, but then there's not much advantage in suboptions (well, apart from maybe
>>>> at the user-side).
>>>
>>> Yep, please take a look at updated version of PATCH 2/N, where I ported -fopt-info.
>>> As you can see I had to explicitly define all enum values and hierarchy creation
>>> of every single node.
>>>
>>> Martin
>>>
>>>>
>>>>> Martin
>>>>>
>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Richard.
>>>>>>
>>>>>>>
>>>>>>> Thanks for feedback,
>>>>>>> Martin
>>>>>>>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Richard.
>>>>>>>>
>>>>>>>>> Martin
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>
>

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

* [PATCH v2 01/N] Add default value for last argument of dump functions.
  2017-05-06 15:04             ` Trevor Saunders
@ 2017-05-12 13:01               ` Martin Liška
  2017-05-16 13:49                 ` Richard Biener
  2017-05-12 13:04               ` [PATCH v2 2/N] Introduce dump_flags_t type and use it instead of int, type Martin Liška
                                 ` (3 subsequent siblings)
  4 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-12 13:01 UTC (permalink / raw)
  To: Trevor Saunders, Richard Biener; +Cc: GCC Patches

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

Hello.

After fiddling with that, I decided to come up with reworked first part
of the patch and eventual translation to a more hierarchical structure
is subject for discussion.

This first patch adds default for couple of dump functions and it helps in future
to transform 0 to a TDF_NONE (or whatever we call it).

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

[-- Attachment #2: 0001-Add-default-value-for-last-argument-of-dump-function.patch.bz2 --]
[-- Type: application/x-bzip, Size: 23298 bytes --]

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

* [PATCH v2 2/N] Introduce dump_flags_t type and use it instead of int, type.
  2017-05-06 15:04             ` Trevor Saunders
  2017-05-12 13:01               ` [PATCH v2 01/N] Add default value for last argument of dump functions Martin Liška
@ 2017-05-12 13:04               ` Martin Liška
  2017-05-16 13:50                 ` Richard Biener
  2017-05-12 13:30               ` [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum Martin Liška
                                 ` (2 subsequent siblings)
  4 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-12 13:04 UTC (permalink / raw)
  To: Trevor Saunders, Richard Biener; +Cc: GCC Patches

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

Second part changes 'int flags' to a new typedef.
All corresponding interfaces have been changed.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

[-- Attachment #2: 0002-Introduce-dump_flags_t-type-and-use-it-instead-of-in.patch --]
[-- Type: text/x-patch, Size: 68621 bytes --]

From fdcd3bc0c76140d8d2e28cd4b8d15cc55ddba4b0 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 1 Feb 2017 15:34:52 +0100
Subject: [PATCH 2/3] Introduce dump_flags_t type and use it instead of int
 type.

gcc/cp/ChangeLog:

2017-05-12  Martin Liska  <mliska@suse.cz>

	* class.c (dump_class_hierarchy): Introduce dump_flags_t type and
	use it instead of int type.
	(dump_vtable): Likewise.
	(dump_vtt): Likewise.
	* decl2.c (dump_tu): Likewise.

gcc/c-family/ChangeLog:

2017-05-12  Martin Liska  <mliska@suse.cz>

	* c-common.h: Introduce dump_flags_t type and
	use it instead of int type.
	* c-gimplify.c (c_genericize): Likewise.
	* c-opts.c: Likewise.

gcc/c/ChangeLog:

2017-05-12  Martin Liska  <mliska@suse.cz>

	* c-decl.c (c_parse_final_cleanups): Introduce dump_flags_t type and
	use it instead of int type.

gcc/ChangeLog:

2017-05-12  Martin Liska  <mliska@suse.cz>

	* cfg.c: Introduce dump_flags_t type and
	use it instead of int type.
	* cfg.h: Likewise.
	* cfghooks.c: Likewise.
	* cfghooks.h (struct cfg_hooks): Likewise.
	* cfgrtl.c: Likewise.
	* cfgrtl.h: Likewise.
	* cgraph.c (cgraph_node::get_body): Likewise.
	* coretypes.h: Likewise.
	* domwalk.c: Likewise.
	* domwalk.h: Likewise.
	* dumpfile.c (struct dump_option_value_info): Likewise.
	(dump_enable_all): Likewise.
	(dump_switch_p_1): Likewise.
	(opt_info_switch_p): Likewise.
	* dumpfile.h (enum tree_dump_index): Likewise.
	(struct dump_file_info): Likewise.
	* genemit.c: Likewise.
	* generic-match-head.c: Likewise.
	* gengtype.c (open_base_files): Likewise.
	* gimple-pretty-print.c: Likewise.
	* gimple-pretty-print.h: Likewise.
	* graph.c (print_graph_cfg): Likewise.
	* graphite-scop-detection.c (dot_all_sese): Likewise.
	* ipa-devirt.c (build_type_inheritance_graph): Likewise.
	* loop-unroll.c (report_unroll): Likewise.
	* passes.c (pass_manager::register_one_dump_file): Likewise.
	* print-tree.c: Likewise.
	* statistics.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-cfg.h: Likewise.
	* tree-dfa.c: Likewise.
	* tree-dfa.h: Likewise.
	* tree-dump.c (dump_function): Likewise.
	* tree-dump.h (struct dump_info): Likewise.
	* tree-pretty-print.c: Likewise.
	* tree-pretty-print.h: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-live.h: Likewise.
	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise.
	* tree-vect-loop.c: Likewise.
	* tree-vect-slp.c: Likewise.
---
 gcc/c-family/c-common.h       |   2 +-
 gcc/c-family/c-gimplify.c     |   2 +-
 gcc/c-family/c-opts.c         |   6 +-
 gcc/c/c-decl.c                |   2 +-
 gcc/cfg.c                     |   8 +--
 gcc/cfg.h                     |   6 +-
 gcc/cfghooks.c                |   4 +-
 gcc/cfghooks.h                |   6 +-
 gcc/cfgrtl.c                  |   8 +--
 gcc/cfgrtl.h                  |   4 +-
 gcc/cgraph.c                  |   2 +-
 gcc/coretypes.h               |   1 +
 gcc/cp/class.c                |  14 ++---
 gcc/cp/decl2.c                |   2 +-
 gcc/domwalk.c                 |   2 +-
 gcc/domwalk.h                 |   2 +-
 gcc/dumpfile.c                |  52 +++++++++--------
 gcc/dumpfile.h                |  43 ++++++++------
 gcc/genemit.c                 |   1 -
 gcc/generic-match-head.c      |   1 -
 gcc/gengtype.c                |   3 +-
 gcc/gimple-pretty-print.c     | 127 +++++++++++++++++++++++++-----------------
 gcc/gimple-pretty-print.h     |  10 ++--
 gcc/graph.c                   |   4 +-
 gcc/graphite-scop-detection.c |   4 +-
 gcc/ipa-devirt.c              |   2 +-
 gcc/loop-unroll.c             |   2 +-
 gcc/passes.c                  |   3 +-
 gcc/print-tree.c              |   2 +-
 gcc/statistics.c              |   2 +-
 gcc/tree-cfg.c                |  10 ++--
 gcc/tree-cfg.h                |   4 +-
 gcc/tree-dfa.c                |   2 +-
 gcc/tree-dfa.h                |   2 +-
 gcc/tree-dump.c               |   4 +-
 gcc/tree-dump.h               |   4 +-
 gcc/tree-pretty-print.c       |  39 ++++++-------
 gcc/tree-pretty-print.h       |  18 +++---
 gcc/tree-ssa-live.c           |   8 +--
 gcc/tree-ssa-live.h           |   6 +-
 gcc/tree-ssa-loop-ivcanon.c   |   2 +-
 gcc/tree-vect-loop.c          |   2 +-
 gcc/tree-vect-slp.c           |   2 +-
 43 files changed, 236 insertions(+), 194 deletions(-)

diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 9e3982d1ce8..ded0c37bc8a 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -904,7 +904,7 @@ extern bool c_common_post_options (const char **);
 extern bool c_common_init (void);
 extern void c_common_finish (void);
 extern void c_common_parse_file (void);
-extern FILE *get_dump_info (int, int *);
+extern FILE *get_dump_info (int, dump_flags_t *);
 extern alias_set_type c_common_get_alias_set (tree);
 extern void c_register_builtin_type (tree, const char*);
 extern bool c_promoting_integer_type_p (const_tree);
diff --git a/gcc/c-family/c-gimplify.c b/gcc/c-family/c-gimplify.c
index 1ae75d294ff..6a4b7c77a34 100644
--- a/gcc/c-family/c-gimplify.c
+++ b/gcc/c-family/c-gimplify.c
@@ -115,7 +115,7 @@ void
 c_genericize (tree fndecl)
 {
   FILE *dump_orig;
-  int local_dump_flags;
+  dump_flags_t local_dump_flags;
   struct cgraph_node *cgn;
 
   if (flag_sanitize & SANITIZE_BOUNDS)
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index ed1b0377fa0..d294c37bdba 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -101,9 +101,9 @@ static size_t include_cursor;
 
 /* Dump files/flags to use during parsing.  */
 static FILE *original_dump_file = NULL;
-static int original_dump_flags;
+static dump_flags_t original_dump_flags;
 static FILE *class_dump_file = NULL;
-static int class_dump_flags;
+static dump_flags_t class_dump_flags;
 
 /* Whether any standard preincluded header has been preincluded.  */
 static bool done_preinclude;
@@ -1136,7 +1136,7 @@ c_common_parse_file (void)
 
 /* Returns the appropriate dump file for PHASE to dump with FLAGS.  */
 FILE *
-get_dump_info (int phase, int *flags)
+get_dump_info (int phase, dump_flags_t *flags)
 {
   gcc_assert (phase == TDI_original || phase == TDI_class);
   if (phase == TDI_original)
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index b779d37aaae..39acb3936f2 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -11243,7 +11243,7 @@ c_parse_final_cleanups (void)
   if (ext_block)
     {
       tree tmp = BLOCK_VARS (ext_block);
-      int flags;
+      dump_flags_t flags;
       FILE * stream = dump_begin (TDI_tu, &flags);
       if (stream && tmp)
 	{
diff --git a/gcc/cfg.c b/gcc/cfg.c
index 7a0e5bb16cb..ffac69f266d 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -396,7 +396,7 @@ clear_bb_flags (void)
    It is still practical to have them reported for debugging of simple
    testcases.  */
 static void
-check_bb_profile (basic_block bb, FILE * file, int indent, int flags)
+check_bb_profile (basic_block bb, FILE * file, int indent, dump_flags_t flags)
 {
   edge e;
   int sum = 0;
@@ -474,7 +474,7 @@ check_bb_profile (basic_block bb, FILE * file, int indent, int flags)
 }
 \f
 void
-dump_edge_info (FILE *file, edge e, int flags, int do_succ)
+dump_edge_info (FILE *file, edge e, dump_flags_t flags, int do_succ)
 {
   basic_block side = (do_succ ? e->dest : e->src);
   bool do_details = false;
@@ -713,7 +713,7 @@ debug_bb_n (int n)
    that maybe_hot_bb_p and probably_never_executed_bb_p don't ICE.  */
 
 void
-dump_bb_info (FILE *outf, basic_block bb, int indent, int flags,
+dump_bb_info (FILE *outf, basic_block bb, int indent, dump_flags_t flags,
 	      bool do_header, bool do_footer)
 {
   edge_iterator ei;
@@ -833,7 +833,7 @@ dump_bb_info (FILE *outf, basic_block bb, int indent, int flags,
 /* Dumps a brief description of cfg to FILE.  */
 
 void
-brief_dump_cfg (FILE *file, int flags)
+brief_dump_cfg (FILE *file, dump_flags_t flags)
 {
   basic_block bb;
 
diff --git a/gcc/cfg.h b/gcc/cfg.h
index b44f1e11e35..f71c00e6df8 100644
--- a/gcc/cfg.h
+++ b/gcc/cfg.h
@@ -89,7 +89,7 @@ extern void remove_edge_raw (edge);
 extern void redirect_edge_succ (edge, basic_block);
 extern void redirect_edge_pred (edge, basic_block);
 extern void clear_bb_flags (void);
-extern void dump_edge_info (FILE *, edge, int, int);
+extern void dump_edge_info (FILE *, edge, dump_flags_t, int);
 extern void debug (edge_def &ref);
 extern void debug (edge_def *ptr);
 extern void alloc_aux_for_blocks (int);
@@ -101,8 +101,8 @@ extern void clear_aux_for_edges (void);
 extern void free_aux_for_edges (void);
 extern void debug_bb (basic_block);
 extern basic_block debug_bb_n (int);
-extern void dump_bb_info (FILE *, basic_block, int, int, bool, bool);
-extern void brief_dump_cfg (FILE *, int);
+extern void dump_bb_info (FILE *, basic_block, int, dump_flags_t, bool, bool);
+extern void brief_dump_cfg (FILE *, dump_flags_t);
 extern void update_bb_profile_for_threading (basic_block, int, gcov_type, edge);
 extern void scale_bbs_frequencies_int (basic_block *, int, int, int);
 extern void scale_bbs_frequencies_gcov_type (basic_block *, int, gcov_type,
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index ce2da6a2f39..1644c9ff31c 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -269,7 +269,7 @@ verify_flow_info (void)
    representation-specific information.  */
 
 void
-dump_bb (FILE *outf, basic_block bb, int indent, int flags)
+dump_bb (FILE *outf, basic_block bb, int indent, dump_flags_t flags)
 {
   if (flags & TDF_BLOCKS)
     dump_bb_info (outf, bb, indent, flags, true, false);
@@ -319,7 +319,7 @@ dump_bb_for_graph (pretty_printer *pp, basic_block bb)
 
 /* Dump the complete CFG to FILE.  FLAGS are the TDF_* flags in dumpfile.h.  */
 void
-dump_flow_info (FILE *file, int flags)
+dump_flow_info (FILE *file, dump_flags_t flags)
 {
   basic_block bb;
 
diff --git a/gcc/cfghooks.h b/gcc/cfghooks.h
index 4c1abe73623..5800a331e41 100644
--- a/gcc/cfghooks.h
+++ b/gcc/cfghooks.h
@@ -62,7 +62,7 @@ struct cfg_hooks
 
   /* Debugging.  */
   int (*verify_flow_info) (void);
-  void (*dump_bb) (FILE *, basic_block, int, int);
+  void (*dump_bb) (FILE *, basic_block, int, dump_flags_t);
   void (*dump_bb_for_graph) (pretty_printer *, basic_block);
 
   /* Basic CFG manipulation.  */
@@ -198,9 +198,9 @@ checking_verify_flow_info (void)
     verify_flow_info ();
 }
 
-extern void dump_bb (FILE *, basic_block, int, int);
+extern void dump_bb (FILE *, basic_block, int, dump_flags_t);
 extern void dump_bb_for_graph (pretty_printer *, basic_block);
-extern void dump_flow_info (FILE *, int);
+extern void dump_flow_info (FILE *, dump_flags_t);
 
 extern edge redirect_edge_and_branch (edge, basic_block);
 extern basic_block redirect_edge_and_branch_force (edge, basic_block);
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index cafa38d35b0..ead82d23166 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -86,7 +86,7 @@ static void rtl_delete_block (basic_block);
 static basic_block rtl_redirect_edge_and_branch_force (edge, basic_block);
 static edge rtl_redirect_edge_and_branch (edge, basic_block);
 static basic_block rtl_split_block (basic_block, void *);
-static void rtl_dump_bb (FILE *, basic_block, int, int);
+static void rtl_dump_bb (FILE *, basic_block, int, dump_flags_t);
 static int rtl_verify_flow_info_1 (void);
 static void rtl_make_forwarder_block (edge);
 \f
@@ -2112,7 +2112,7 @@ commit_edge_insertions (void)
    documented in dumpfile.h.  */
 
 static void
-rtl_dump_bb (FILE *outf, basic_block bb, int indent, int flags)
+rtl_dump_bb (FILE *outf, basic_block bb, int indent, dump_flags_t flags)
 {
   rtx_insn *insn;
   rtx_insn *last;
@@ -2155,7 +2155,7 @@ rtl_dump_bb (FILE *outf, basic_block bb, int indent, int flags)
    in dumpfile.h.  */
 
 void
-print_rtl_with_bb (FILE *outf, const rtx_insn *rtx_first, int flags)
+print_rtl_with_bb (FILE *outf, const rtx_insn *rtx_first, dump_flags_t flags)
 {
   const rtx_insn *tmp_rtx;
   if (rtx_first == 0)
@@ -4242,7 +4242,7 @@ cfg_layout_duplicate_bb (basic_block bb)
    FLAGS is a set of additional flags to pass to cleanup_cfg().  */
 
 void
-cfg_layout_initialize (unsigned int flags)
+cfg_layout_initialize (int flags)
 {
   rtx_insn_list *x;
   basic_block bb;
diff --git a/gcc/cfgrtl.h b/gcc/cfgrtl.h
index befd1aaaa85..9235b50ed66 100644
--- a/gcc/cfgrtl.h
+++ b/gcc/cfgrtl.h
@@ -40,7 +40,7 @@ extern basic_block force_nonfallthru_and_redirect (edge, basic_block, rtx);
 extern void insert_insn_on_edge (rtx, edge);
 extern void commit_one_edge_insertion (edge e);
 extern void commit_edge_insertions (void);
-extern void print_rtl_with_bb (FILE *, const rtx_insn *, int);
+extern void print_rtl_with_bb (FILE *, const rtx_insn *, dump_flags_t);
 extern void update_br_prob_note (basic_block);
 extern rtx_insn *get_last_bb_insn (basic_block);
 extern void fixup_partitions (void);
@@ -50,7 +50,7 @@ extern bool fixup_abnormal_edges (void);
 extern rtx_insn *unlink_insn_chain (rtx_insn *, rtx_insn *);
 extern void relink_block_chain (bool);
 extern rtx_insn *duplicate_insn_chain (rtx_insn *, rtx_insn *);
-extern void cfg_layout_initialize (unsigned int);
+extern void cfg_layout_initialize (int);
 extern void cfg_layout_finalize (void);
 extern void break_superblocks (void);
 extern void init_rtl_bb_info (basic_block);
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index d5294c8ce92..10ba987701c 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -3652,7 +3652,7 @@ cgraph_node::get_body (void)
       opt_pass *saved_current_pass = current_pass;
       FILE *saved_dump_file = dump_file;
       const char *saved_dump_file_name = dump_file_name;
-      int saved_dump_flags = dump_flags;
+      dump_flags_t saved_dump_flags = dump_flags;
       dump_file_name = NULL;
       dump_file = NULL;
 
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 8eb33ccf123..b7c3704eff8 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -371,6 +371,7 @@ typedef unsigned char uchar;
 #include "input.h"
 #include "is-a.h"
 #include "memory-block.h"
+#include "dumpfile.h"
 #endif /* GENERATOR_FILE && !USED_FOR_TARGET */
 
 #endif /* coretypes.h */
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 15b583aa96d..7b5daeaf9d1 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -172,9 +172,9 @@ static tree find_final_overrider (tree, tree, tree);
 static int make_new_vtable (tree, tree);
 static tree get_primary_binfo (tree);
 static int maybe_indent_hierarchy (FILE *, int, int);
-static tree dump_class_hierarchy_r (FILE *, int, tree, tree, int);
+static tree dump_class_hierarchy_r (FILE *, dump_flags_t, tree, tree, int);
 static void dump_class_hierarchy (tree);
-static void dump_class_hierarchy_1 (FILE *, int, tree);
+static void dump_class_hierarchy_1 (FILE *, dump_flags_t, tree);
 static void dump_array (FILE *, tree);
 static void dump_vtable (tree, tree, tree);
 static void dump_vtt (tree, tree);
@@ -8844,7 +8844,7 @@ maybe_indent_hierarchy (FILE * stream, int indent, int indented_p)
 
 static tree
 dump_class_hierarchy_r (FILE *stream,
-			int flags,
+			dump_flags_t flags,
 			tree binfo,
 			tree igo,
 			int indent)
@@ -8937,7 +8937,7 @@ dump_class_hierarchy_r (FILE *stream,
 /* Dump the BINFO hierarchy for T.  */
 
 static void
-dump_class_hierarchy_1 (FILE *stream, int flags, tree t)
+dump_class_hierarchy_1 (FILE *stream, dump_flags_t flags, tree t)
 {
   fprintf (stream, "Class %s\n", type_as_string (t, TFF_PLAIN_IDENTIFIER));
   fprintf (stream, "   size=%lu align=%lu\n",
@@ -8963,7 +8963,7 @@ debug_class (tree t)
 static void
 dump_class_hierarchy (tree t)
 {
-  int flags;
+  dump_flags_t flags;
   FILE *stream = get_dump_info (TDI_class, &flags);
 
   if (stream)
@@ -8997,7 +8997,7 @@ dump_array (FILE * stream, tree decl)
 static void
 dump_vtable (tree t, tree binfo, tree vtable)
 {
-  int flags;
+  dump_flags_t flags;
   FILE *stream = get_dump_info (TDI_class, &flags);
 
   if (!stream)
@@ -9026,7 +9026,7 @@ dump_vtable (tree t, tree binfo, tree vtable)
 static void
 dump_vtt (tree t, tree vtt)
 {
-  int flags;
+  dump_flags_t flags;
   FILE *stream = get_dump_info (TDI_class, &flags);
 
   if (!stream)
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 46959ec77f7..9f28d1a7df3 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4369,7 +4369,7 @@ generate_mangling_aliases ()
 static void
 dump_tu (void)
 {
-  int flags;
+  dump_flags_t flags;
   FILE *stream = dump_begin (TDI_tu, &flags);
 
   if (stream)
diff --git a/gcc/domwalk.c b/gcc/domwalk.c
index c7d9654b452..a0daae6b2d8 100644
--- a/gcc/domwalk.c
+++ b/gcc/domwalk.c
@@ -201,7 +201,7 @@ dom_walker::bb_reachable (struct function *fun, basic_block bb)
 void
 dom_walker::propagate_unreachable_to_edges (basic_block bb,
 					    FILE *dump_file,
-					    int dump_flags)
+					    dump_flags_t dump_flags)
 {
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file, "Marking all outgoing edges of unreachable "
diff --git a/gcc/domwalk.h b/gcc/domwalk.h
index bbb9afc0fbe..4b9f70ac703 100644
--- a/gcc/domwalk.h
+++ b/gcc/domwalk.h
@@ -70,7 +70,7 @@ private:
      and possibly incoming edges for the block.  Typically called after
      determining a block is unreachable in the before_dom_children
      callback.  */
-  void propagate_unreachable_to_edges (basic_block, FILE *, int);
+  void propagate_unreachable_to_edges (basic_block, FILE *, dump_flags_t);
 
 };
 
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index d9a84ff661f..ee967d825f4 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -33,10 +33,10 @@ along with GCC; see the file COPYING3.  If not see
 #define skip_leading_substring(whole,  part) \
    (strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
 
-static int pflags;                   /* current dump_flags */
-static int alt_flags;                /* current opt_info flags */
+static dump_flags_t pflags;		      /* current dump_flags */
+static dump_flags_t alt_flags;		      /* current opt_info flags */
 
-static void dump_loc (int, FILE *, source_location);
+static void dump_loc (dump_flags_t, FILE *, source_location);
 static FILE *dump_open_alternate_stream (struct dump_file_info *);
 
 /* These are currently used for communicating between passes.
@@ -45,7 +45,7 @@ static FILE *dump_open_alternate_stream (struct dump_file_info *);
 FILE *dump_file = NULL;
 FILE *alt_dump_file = NULL;
 const char *dump_file_name;
-int dump_flags;
+dump_flags_t dump_flags;
 
 /* Table of tree dump switches. This must be consistent with the
    TREE_DUMP_INDEX enumeration in dumpfile.h.  */
@@ -84,7 +84,7 @@ static struct dump_file_info dump_files[TDI_end] =
 struct dump_option_value_info
 {
   const char *const name;	/* the name of the value */
-  const int value;		/* the value of the name */
+  const dump_flags_t value;	/* the value of the name */
 };
 
 /* Table of dump options. This must be consistent with the TDF_* flags
@@ -181,7 +181,7 @@ gcc::dump_manager::~dump_manager ()
 unsigned int
 gcc::dump_manager::
 dump_register (const char *suffix, const char *swtch, const char *glob,
-	       int flags, int optgroup_flags,
+	       dump_flags_t flags, int optgroup_flags,
 	       bool take_ownership)
 {
   int num = m_next_dump++;
@@ -327,7 +327,7 @@ dump_open_alternate_stream (struct dump_file_info *dfi)
 /* Print source location on DFILE if enabled.  */
 
 void
-dump_loc (int dump_kind, FILE *dfile, source_location loc)
+dump_loc (dump_flags_t dump_kind, FILE *dfile, source_location loc)
 {
   if (dump_kind)
     {
@@ -346,7 +346,8 @@ dump_loc (int dump_kind, FILE *dfile, source_location loc)
    EXTRA_DUMP_FLAGS on the dump streams if DUMP_KIND is enabled.  */
 
 void
-dump_gimple_stmt (int dump_kind, int extra_dump_flags, gimple *gs, int spc)
+dump_gimple_stmt (dump_flags_t dump_kind, dump_flags_t extra_dump_flags,
+		  gimple *gs, int spc)
 {
   if (dump_file && (dump_kind & pflags))
     print_gimple_stmt (dump_file, gs, spc, dump_flags | extra_dump_flags);
@@ -358,8 +359,8 @@ dump_gimple_stmt (int dump_kind, int extra_dump_flags, gimple *gs, int spc)
 /* Similar to dump_gimple_stmt, except additionally print source location.  */
 
 void
-dump_gimple_stmt_loc (int dump_kind, source_location loc, int extra_dump_flags,
-		      gimple *gs, int spc)
+dump_gimple_stmt_loc (dump_flags_t dump_kind, source_location loc,
+		      dump_flags_t extra_dump_flags, gimple *gs, int spc)
 {
   if (dump_file && (dump_kind & pflags))
     {
@@ -378,7 +379,8 @@ dump_gimple_stmt_loc (int dump_kind, source_location loc, int extra_dump_flags,
    DUMP_KIND is enabled.  */
 
 void
-dump_generic_expr (int dump_kind, int extra_dump_flags, tree t)
+dump_generic_expr (dump_flags_t dump_kind, dump_flags_t extra_dump_flags,
+		   tree t)
 {
   if (dump_file && (dump_kind & pflags))
       print_generic_expr (dump_file, t, dump_flags | extra_dump_flags);
@@ -393,7 +395,7 @@ dump_generic_expr (int dump_kind, int extra_dump_flags, tree t)
 
 void
 dump_generic_expr_loc (int dump_kind, source_location loc,
-                       int extra_dump_flags, tree t)
+		       dump_flags_t extra_dump_flags, tree t)
 {
   if (dump_file && (dump_kind & pflags))
     {
@@ -411,7 +413,7 @@ dump_generic_expr_loc (int dump_kind, source_location loc,
 /* Output a formatted message using FORMAT on appropriate dump streams.  */
 
 void
-dump_printf (int dump_kind, const char *format, ...)
+dump_printf (dump_flags_t dump_kind, const char *format, ...)
 {
   if (dump_file && (dump_kind & pflags))
     {
@@ -433,7 +435,8 @@ dump_printf (int dump_kind, const char *format, ...)
 /* Similar to dump_printf, except source location is also printed.  */
 
 void
-dump_printf_loc (int dump_kind, source_location loc, const char *format, ...)
+dump_printf_loc (dump_flags_t dump_kind, source_location loc,
+		 const char *format, ...)
 {
   if (dump_file && (dump_kind & pflags))
     {
@@ -462,7 +465,7 @@ dump_printf_loc (int dump_kind, source_location loc, const char *format, ...)
 
 int
 gcc::dump_manager::
-dump_start (int phase, int *flag_ptr)
+dump_start (int phase, dump_flags_t *flag_ptr)
 {
   int count = 0;
   char *name;
@@ -546,14 +549,14 @@ dump_finish (int phase)
    Multiple calls will reopen and append to the dump file.  */
 
 FILE *
-dump_begin (int phase, int *flag_ptr)
+dump_begin (int phase, dump_flags_t *flag_ptr)
 {
   return g->get_dumps ()->dump_begin (phase, flag_ptr);
 }
 
 FILE *
 gcc::dump_manager::
-dump_begin (int phase, int *flag_ptr)
+dump_begin (int phase, dump_flags_t *flag_ptr)
 {
   char *name;
   struct dump_file_info *dfi;
@@ -654,9 +657,9 @@ dump_end (int phase ATTRIBUTE_UNUSED, FILE *stream)
 
 int
 gcc::dump_manager::
-dump_enable_all (int flags, const char *filename)
+dump_enable_all (dump_flags_t flags, const char *filename)
 {
-  int ir_dump_type = TDF_KIND (flags);
+  dump_flags_t ir_dump_type = TDF_KIND (flags);
   int n = 0;
   size_t i;
 
@@ -711,7 +714,8 @@ dump_enable_all (int flags, const char *filename)
 
 int
 gcc::dump_manager::
-opt_info_enable_passes (int optgroup_flags, int flags, const char *filename)
+opt_info_enable_passes (int optgroup_flags, dump_flags_t flags,
+			const char *filename)
 {
   int n = 0;
   size_t i;
@@ -764,7 +768,7 @@ dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob)
 {
   const char *option_value;
   const char *ptr;
-  int flags;
+  dump_flags_t flags;
 
   if (doglob && !dfi->glob)
     return 0;
@@ -863,7 +867,7 @@ dump_switch_p (const char *arg)
    and filename.  Return non-zero if it is a recognized switch.  */
 
 static int
-opt_info_switch_p_1 (const char *arg, int *flags, int *optgroup_flags,
+opt_info_switch_p_1 (const char *arg, dump_flags_t *flags, int *optgroup_flags,
                      char **filename)
 {
   const char *option_value;
@@ -941,7 +945,7 @@ opt_info_switch_p_1 (const char *arg, int *flags, int *optgroup_flags,
 int
 opt_info_switch_p (const char *arg)
 {
-  int flags;
+  dump_flags_t flags;
   int optgroup_flags;
   char *filename;
   static char *file_seen = NULL;
@@ -987,7 +991,7 @@ void
 dump_function (int phase, tree fn)
 {
   FILE *stream;
-  int flags;
+  dump_flags_t flags;
 
   stream = dump_begin (phase, &flags);
   if (stream)
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index 19c6d3ec90e..3eec6ab56d5 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -98,6 +98,7 @@ enum tree_dump_index
 #define MSG_ALL		(MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION \
 			 | MSG_NOTE)
 
+#define TDF_NONE 0
 
 /* Flags to control high-level -fopt-info dumps.  Usually these flags
    define a group of passes.  An optimization pass can be part of
@@ -113,6 +114,14 @@ enum tree_dump_index
 #define OPTGROUP_ALL	     (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \
 			      | OPTGROUP_OMP | OPTGROUP_VEC | OPTGROUP_OTHER)
 
+/* Dump flags type.  */
+
+typedef uint64_t dump_flags_t;
+
+/* Dump flags type.  */
+
+typedef uint64_t dump_flags_t;
+
 /* Define a tree dump switch.  */
 struct dump_file_info
 {
@@ -123,7 +132,7 @@ struct dump_file_info
   const char *alt_filename;	/* filename for the -fopt-info stream  */
   FILE *pstream;		/* pass-specific dump stream  */
   FILE *alt_stream;		/* -fopt-info stream */
-  int pflags;			/* dump flags */
+  dump_flags_t pflags;		/* dump flags */
   int optgroup_flags;		/* optgroup flags for -fopt-info */
   int alt_flags;		/* flags for opt-info */
   int pstate;			/* state of pass-specific stream */
@@ -140,34 +149,35 @@ struct dump_file_info
 };
 
 /* In dumpfile.c */
-extern FILE *dump_begin (int, int *);
+extern FILE *dump_begin (int, dump_flags_t *);
 extern void dump_end (int, FILE *);
 extern int opt_info_switch_p (const char *);
 extern const char *dump_flag_name (int);
-extern void dump_printf (int, const char *, ...) ATTRIBUTE_PRINTF_2;
-extern void dump_printf_loc (int, source_location,
-			     const char *, ...) ATTRIBUTE_PRINTF_3;
+extern void dump_printf (dump_flags_t, const char *, ...) ATTRIBUTE_PRINTF_2;
+extern void dump_printf_loc (dump_flags_t, source_location,
+                             const char *, ...) ATTRIBUTE_PRINTF_3;
 extern void dump_function (int phase, tree fn);
 extern void dump_basic_block (int, basic_block, int);
 extern void dump_generic_expr_loc (int, source_location, int, tree);
-extern void dump_generic_expr (int, int, tree);
-extern void dump_gimple_stmt_loc (int, source_location, int, gimple *, int);
-extern void dump_gimple_stmt (int, int, gimple *, int);
+extern void dump_generic_expr (dump_flags_t, dump_flags_t, tree);
+extern void dump_gimple_stmt_loc (dump_flags_t, source_location, dump_flags_t,
+				  gimple *, int);
+extern void dump_gimple_stmt (dump_flags_t, dump_flags_t, gimple *, int);
 extern void print_combine_total_stats (void);
 extern bool enable_rtl_dump_file (void);
 
 /* In tree-dump.c  */
-extern void dump_node (const_tree, int, FILE *);
+extern void dump_node (const_tree, dump_flags_t, FILE *);
 
 /* In combine.c  */
 extern void dump_combine_total_stats (FILE *);
 /* In cfghooks.c  */
-extern void dump_bb (FILE *, basic_block, int, int);
+extern void dump_bb (FILE *, basic_block, int, dump_flags_t);
 
 /* Global variables used to communicate with passes.  */
 extern FILE *dump_file;
 extern FILE *alt_dump_file;
-extern int dump_flags;
+extern dump_flags_t dump_flags;
 extern const char *dump_file_name;
 
 /* Return true if any of the dumps is enabled, false otherwise. */
@@ -192,7 +202,7 @@ public:
      SUFFIX, SWTCH, and GLOB. */
   unsigned int
   dump_register (const char *suffix, const char *swtch, const char *glob,
-		 int flags, int optgroup_flags,
+		 dump_flags_t flags, int optgroup_flags,
 		 bool take_ownership);
 
   /* Return the dump_file_info for the given phase.  */
@@ -219,7 +229,7 @@ public:
      set dump_flags appropriately for both pass dump stream and
      -fopt-info stream. */
   int
-  dump_start (int phase, int *flag_ptr);
+  dump_start (int phase, dump_flags_t *flag_ptr);
 
   /* Finish a tree dump for PHASE and close associated dump streams.  Also
      reset the globals DUMP_FILE, ALT_DUMP_FILE, and DUMP_FLAGS.  */
@@ -227,7 +237,7 @@ public:
   dump_finish (int phase);
 
   FILE *
-  dump_begin (int phase, int *flag_ptr);
+  dump_begin (int phase, dump_flags_t *flag_ptr);
 
   /* Returns nonzero if tree dump PHASE has been initialized.  */
   int
@@ -246,10 +256,11 @@ private:
   dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob);
 
   int
-  dump_enable_all (int flags, const char *filename);
+  dump_enable_all (dump_flags_t flags, const char *filename);
 
   int
-  opt_info_enable_passes (int optgroup_flags, int flags, const char *filename);
+  opt_info_enable_passes (int optgroup_flags, dump_flags_t flags,
+			  const char *filename);
 
 private:
 
diff --git a/gcc/genemit.c b/gcc/genemit.c
index 7bf745d1727..6e60c0a76ca 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -797,7 +797,6 @@ from the machine description file `md'.  */\n\n");
   printf ("#include \"regs.h\"\n");
   printf ("#include \"tm-constrs.h\"\n");
   printf ("#include \"ggc.h\"\n");
-  printf ("#include \"dumpfile.h\"\n");
   printf ("#include \"target.h\"\n\n");
 
   /* Read the machine description.  */
diff --git a/gcc/generic-match-head.c b/gcc/generic-match-head.c
index 04e0854fd75..0c0d1824933 100644
--- a/gcc/generic-match-head.c
+++ b/gcc/generic-match-head.c
@@ -31,7 +31,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "stor-layout.h"
 #include "tree-dfa.h"
 #include "builtins.h"
-#include "dumpfile.h"
 #include "case-cfn-macros.h"
 #include "gimplify.h"
 
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index a315c6cfe87..b02e9fffb23 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -1706,7 +1706,8 @@ open_base_files (void)
   {
     /* The order of files here matters very much.  */
     static const char *const ifiles[] = {
-      "config.h", "system.h", "coretypes.h", "backend.h", "predict.h", "tree.h",
+      "config.h", "system.h", "coretypes.h",
+      "backend.h", "predict.h", "tree.h",
       "rtl.h", "gimple.h", "fold-const.h", "insn-codes.h", "splay-tree.h",
       "alias.h", "insn-config.h", "flags.h", "expmed.h", "dojump.h",
       "explow.h", "calls.h", "cilk.h", "memmodel.h", "emit-rtl.h", "varasm.h",
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index a7a5d00dc2e..c99dfe1192c 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "dumpfile.h"
 #include "backend.h"
 #include "tree.h"
 #include "gimple.h"
@@ -108,7 +109,7 @@ dump_edge_probability (pretty_printer *buffer, edge e)
    FLAGS as in pp_gimple_stmt_1.  */
 
 void
-print_gimple_stmt (FILE *file, gimple *g, int spc, int flags)
+print_gimple_stmt (FILE *file, gimple *g, int spc, dump_flags_t flags)
 {
   pretty_printer buffer;
   pp_needs_newline (&buffer) = true;
@@ -138,7 +139,7 @@ debug (gimple *ptr)
    of the statement.  */
 
 void
-print_gimple_expr (FILE *file, gimple *g, int spc, int flags)
+print_gimple_expr (FILE *file, gimple *g, int spc, dump_flags_t flags)
 {
   flags |= TDF_RHS_ONLY;
   pretty_printer buffer;
@@ -155,7 +156,8 @@ print_gimple_expr (FILE *file, gimple *g, int spc, int flags)
    the pretty printer.  */
 
 static void
-dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc, int flags)
+dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc,
+		 dump_flags_t flags)
 {
   gimple_stmt_iterator i;
 
@@ -174,7 +176,7 @@ dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc, int flags)
    FLAGS as in pp_gimple_stmt_1.  */
 
 void
-print_gimple_seq (FILE *file, gimple_seq seq, int spc, int flags)
+print_gimple_seq (FILE *file, gimple_seq seq, int spc, dump_flags_t flags)
 {
   pretty_printer buffer;
   pp_needs_newline (&buffer) = true;
@@ -206,7 +208,7 @@ debug_gimple_seq (gimple_seq seq)
      '-' - decreases indent by 2 then outputs a newline.   */
 
 static void
-dump_gimple_fmt (pretty_printer *buffer, int spc, int flags,
+dump_gimple_fmt (pretty_printer *buffer, int spc, dump_flags_t flags,
                  const char *fmt, ...)
 {
   va_list args;
@@ -285,7 +287,8 @@ dump_gimple_fmt (pretty_printer *buffer, int spc, int flags,
    assignment GS.  BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.  */
 
 static void
-dump_unary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
+dump_unary_rhs (pretty_printer *buffer, gassign *gs, int spc,
+		dump_flags_t flags)
 {
   enum tree_code rhs_code = gimple_assign_rhs_code (gs);
   tree lhs = gimple_assign_lhs (gs);
@@ -377,7 +380,8 @@ dump_unary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
    assignment GS.  BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.  */
 
 static void
-dump_binary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
+dump_binary_rhs (pretty_printer *buffer, gassign *gs, int spc,
+		 dump_flags_t flags)
 {
   const char *p;
   enum tree_code code = gimple_assign_rhs_code (gs);
@@ -433,7 +437,8 @@ dump_binary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
    assignment GS.  BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.  */
 
 static void
-dump_ternary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
+dump_ternary_rhs (pretty_printer *buffer, gassign *gs, int spc,
+		  dump_flags_t flags)
 {
   const char *p;
   enum tree_code code = gimple_assign_rhs_code (gs);
@@ -559,7 +564,8 @@ dump_ternary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
    pp_gimple_stmt_1.  */
 
 static void
-dump_gimple_assign (pretty_printer *buffer, gassign *gs, int spc, int flags)
+dump_gimple_assign (pretty_printer *buffer, gassign *gs, int spc,
+		    dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     {
@@ -620,7 +626,8 @@ dump_gimple_assign (pretty_printer *buffer, gassign *gs, int spc, int flags)
    pp_gimple_stmt_1.  */
 
 static void
-dump_gimple_return (pretty_printer *buffer, greturn *gs, int spc, int flags)
+dump_gimple_return (pretty_printer *buffer, greturn *gs, int spc,
+		    dump_flags_t flags)
 {
   tree t, t2;
 
@@ -650,7 +657,7 @@ dump_gimple_return (pretty_printer *buffer, greturn *gs, int spc, int flags)
    dump_gimple_call.  */
 
 static void
-dump_gimple_call_args (pretty_printer *buffer, gcall *gs, int flags)
+dump_gimple_call_args (pretty_printer *buffer, gcall *gs, dump_flags_t flags)
 {
   size_t i = 0;
 
@@ -806,7 +813,8 @@ pp_points_to_solution (pretty_printer *buffer, struct pt_solution *pt)
    pp_gimple_stmt_1.  */
 
 static void
-dump_gimple_call (pretty_printer *buffer, gcall *gs, int spc, int flags)
+dump_gimple_call (pretty_printer *buffer, gcall *gs, int spc,
+		  dump_flags_t flags)
 {
   tree lhs = gimple_call_lhs (gs);
   tree fn = gimple_call_fn (gs);
@@ -942,7 +950,7 @@ dump_gimple_call (pretty_printer *buffer, gcall *gs, int spc, int flags)
 
 static void
 dump_gimple_switch (pretty_printer *buffer, gswitch *gs, int spc,
-		    int flags)
+		    dump_flags_t flags)
 {
   unsigned int i;
 
@@ -999,7 +1007,8 @@ dump_gimple_switch (pretty_printer *buffer, gswitch *gs, int spc,
    pp_gimple_stmt_1.  */
 
 static void
-dump_gimple_cond (pretty_printer *buffer, gcond *gs, int spc, int flags)
+dump_gimple_cond (pretty_printer *buffer, gcond *gs, int spc,
+		  dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
@@ -1065,7 +1074,8 @@ dump_gimple_cond (pretty_printer *buffer, gcond *gs, int spc, int flags)
    TDF_* in dumpfils.h).  */
 
 static void
-dump_gimple_label (pretty_printer *buffer, glabel *gs, int spc, int flags)
+dump_gimple_label (pretty_printer *buffer, glabel *gs, int spc,
+		   dump_flags_t flags)
 {
   tree label = gimple_label_label (gs);
   if (flags & TDF_RAW)
@@ -1091,7 +1101,8 @@ dump_gimple_label (pretty_printer *buffer, glabel *gs, int spc, int flags)
    TDF_* in dumpfile.h).  */
 
 static void
-dump_gimple_goto (pretty_printer *buffer, ggoto *gs, int spc, int flags)
+dump_gimple_goto (pretty_printer *buffer, ggoto *gs, int spc,
+		  dump_flags_t flags)
 {
   tree label = gimple_goto_dest (gs);
   if (flags & TDF_RAW)
@@ -1106,7 +1117,8 @@ dump_gimple_goto (pretty_printer *buffer, ggoto *gs, int spc, int flags)
    TDF_* in dumpfile.h).  */
 
 static void
-dump_gimple_bind (pretty_printer *buffer, gbind *gs, int spc, int flags)
+dump_gimple_bind (pretty_printer *buffer, gbind *gs, int spc,
+		  dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     dump_gimple_fmt (buffer, spc, flags, "%G <", gs);
@@ -1139,7 +1151,8 @@ dump_gimple_bind (pretty_printer *buffer, gbind *gs, int spc, int flags)
    dumpfile.h).  */
 
 static void
-dump_gimple_try (pretty_printer *buffer, gtry *gs, int spc, int flags)
+dump_gimple_try (pretty_printer *buffer, gtry *gs, int spc,
+		 dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     {
@@ -1195,7 +1208,8 @@ dump_gimple_try (pretty_printer *buffer, gtry *gs, int spc, int flags)
    dumpfile.h).  */
 
 static void
-dump_gimple_catch (pretty_printer *buffer, gcatch *gs, int spc, int flags)
+dump_gimple_catch (pretty_printer *buffer, gcatch *gs, int spc,
+		   dump_flags_t flags)
 {
   if (flags & TDF_RAW)
       dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+CATCH <%S>%->", gs,
@@ -1212,7 +1226,7 @@ dump_gimple_catch (pretty_printer *buffer, gcatch *gs, int spc, int flags)
 
 static void
 dump_gimple_eh_filter (pretty_printer *buffer, geh_filter *gs, int spc,
-		       int flags)
+		       dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+FAILURE <%S>%->", gs,
@@ -1229,7 +1243,7 @@ dump_gimple_eh_filter (pretty_printer *buffer, geh_filter *gs, int spc,
 
 static void
 dump_gimple_eh_must_not_throw (pretty_printer *buffer,
-			       geh_mnt *gs, int spc, int flags)
+			       geh_mnt *gs, int spc, dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
@@ -1246,7 +1260,7 @@ dump_gimple_eh_must_not_throw (pretty_printer *buffer,
 
 static void
 dump_gimple_eh_else (pretty_printer *buffer, geh_else *gs, int spc,
-		     int flags)
+		     dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     dump_gimple_fmt (buffer, spc, flags,
@@ -1264,7 +1278,8 @@ dump_gimple_eh_else (pretty_printer *buffer, geh_else *gs, int spc,
    dumpfile.h).  */
 
 static void
-dump_gimple_resx (pretty_printer *buffer, gresx *gs, int spc, int flags)
+dump_gimple_resx (pretty_printer *buffer, gresx *gs, int spc,
+		  dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
@@ -1276,7 +1291,8 @@ dump_gimple_resx (pretty_printer *buffer, gresx *gs, int spc, int flags)
 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER.  */
 
 static void
-dump_gimple_eh_dispatch (pretty_printer *buffer, geh_dispatch *gs, int spc, int flags)
+dump_gimple_eh_dispatch (pretty_printer *buffer, geh_dispatch *gs, int spc,
+			 dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
@@ -1291,7 +1307,8 @@ dump_gimple_eh_dispatch (pretty_printer *buffer, geh_dispatch *gs, int spc, int
    in dumpfile.h).  */
 
 static void
-dump_gimple_debug (pretty_printer *buffer, gdebug *gs, int spc, int flags)
+dump_gimple_debug (pretty_printer *buffer, gdebug *gs, int spc,
+		   dump_flags_t flags)
 {
   switch (gs->subcode)
     {
@@ -1324,7 +1341,8 @@ dump_gimple_debug (pretty_printer *buffer, gdebug *gs, int spc, int flags)
 
 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER.  */
 static void
-dump_gimple_omp_for (pretty_printer *buffer, gomp_for *gs, int spc, int flags)
+dump_gimple_omp_for (pretty_printer *buffer, gomp_for *gs, int spc,
+		     dump_flags_t flags)
 {
   size_t i;
 
@@ -1476,7 +1494,7 @@ dump_gimple_omp_for (pretty_printer *buffer, gomp_for *gs, int spc, int flags)
 
 static void
 dump_gimple_omp_continue (pretty_printer *buffer, gomp_continue *gs,
-			  int spc, int flags)
+			  int spc, dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     {
@@ -1501,7 +1519,7 @@ dump_gimple_omp_continue (pretty_printer *buffer, gomp_continue *gs,
 
 static void
 dump_gimple_omp_single (pretty_printer *buffer, gomp_single *gs,
-			int spc, int flags)
+			int spc, dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     {
@@ -1530,7 +1548,7 @@ dump_gimple_omp_single (pretty_printer *buffer, gomp_single *gs,
 
 static void
 dump_gimple_omp_target (pretty_printer *buffer, gomp_target *gs,
-			int spc, int flags)
+			int spc, dump_flags_t flags)
 {
   const char *kind;
   switch (gimple_omp_target_kind (gs))
@@ -1623,7 +1641,7 @@ dump_gimple_omp_target (pretty_printer *buffer, gomp_target *gs,
 
 static void
 dump_gimple_omp_teams (pretty_printer *buffer, gomp_teams *gs, int spc,
-		       int flags)
+		       dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     {
@@ -1652,7 +1670,7 @@ dump_gimple_omp_teams (pretty_printer *buffer, gomp_teams *gs, int spc,
 
 static void
 dump_gimple_omp_sections (pretty_printer *buffer, gomp_sections *gs,
-			  int spc, int flags)
+			  int spc, dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     {
@@ -1688,7 +1706,8 @@ dump_gimple_omp_sections (pretty_printer *buffer, gomp_sections *gs,
    pretty_printer BUFFER.  */
 
 static void
-dump_gimple_omp_block (pretty_printer *buffer, gimple *gs, int spc, int flags)
+dump_gimple_omp_block (pretty_printer *buffer, gimple *gs, int spc,
+		       dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
@@ -1728,7 +1747,7 @@ dump_gimple_omp_block (pretty_printer *buffer, gimple *gs, int spc, int flags)
 
 static void
 dump_gimple_omp_critical (pretty_printer *buffer, gomp_critical *gs,
-			  int spc, int flags)
+			  int spc, dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
@@ -1760,7 +1779,7 @@ dump_gimple_omp_critical (pretty_printer *buffer, gomp_critical *gs,
 
 static void
 dump_gimple_omp_ordered (pretty_printer *buffer, gomp_ordered *gs,
-			 int spc, int flags)
+			 int spc, dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
@@ -1784,7 +1803,8 @@ dump_gimple_omp_ordered (pretty_printer *buffer, gomp_ordered *gs,
 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER.  */
 
 static void
-dump_gimple_omp_return (pretty_printer *buffer, gimple *gs, int spc, int flags)
+dump_gimple_omp_return (pretty_printer *buffer, gimple *gs, int spc,
+			dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     {
@@ -1815,7 +1835,7 @@ dump_gimple_omp_return (pretty_printer *buffer, gimple *gs, int spc, int flags)
 
 static void
 dump_gimple_transaction (pretty_printer *buffer, gtransaction *gs,
-			 int spc, int flags)
+			 int spc, dump_flags_t flags)
 {
   unsigned subcode = gimple_transaction_subcode (gs);
 
@@ -1916,7 +1936,7 @@ dump_gimple_transaction (pretty_printer *buffer, gtransaction *gs,
    dumpfile.h).  */
 
 static void
-dump_gimple_asm (pretty_printer *buffer, gasm *gs, int spc, int flags)
+dump_gimple_asm (pretty_printer *buffer, gasm *gs, int spc, dump_flags_t flags)
 {
   unsigned int i, n, f, fields;
 
@@ -2134,7 +2154,7 @@ dump_ssaname_info_to_file (FILE *file, tree node, int spc)
 
 static void
 dump_gimple_phi (pretty_printer *buffer, gphi *phi, int spc, bool comment,
-		 int flags)
+		 dump_flags_t flags)
 {
   size_t i;
   tree lhs = gimple_phi_result (phi);
@@ -2198,7 +2218,7 @@ dump_gimple_phi (pretty_printer *buffer, gphi *phi, int spc, bool comment,
 
 static void
 dump_gimple_omp_parallel (pretty_printer *buffer, gomp_parallel *gs,
-			  int spc, int flags)
+			  int spc, dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     {
@@ -2252,7 +2272,7 @@ dump_gimple_omp_parallel (pretty_printer *buffer, gomp_parallel *gs,
 
 static void
 dump_gimple_omp_task (pretty_printer *buffer, gomp_task *gs, int spc,
-		      int flags)
+		      dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     {
@@ -2312,7 +2332,7 @@ dump_gimple_omp_task (pretty_printer *buffer, gomp_task *gs, int spc,
 
 static void
 dump_gimple_omp_atomic_load (pretty_printer *buffer, gomp_atomic_load *gs,
-			     int spc, int flags)
+			     int spc, dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     {
@@ -2345,7 +2365,8 @@ dump_gimple_omp_atomic_load (pretty_printer *buffer, gomp_atomic_load *gs,
 
 static void
 dump_gimple_omp_atomic_store (pretty_printer *buffer,
-			      gomp_atomic_store *gs, int spc, int flags)
+			      gomp_atomic_store *gs, int spc,
+			      dump_flags_t flags)
 {
   if (flags & TDF_RAW)
     {
@@ -2371,7 +2392,8 @@ dump_gimple_omp_atomic_store (pretty_printer *buffer,
    FLAGS are as in pp_gimple_stmt_1.  */
 
 static void
-dump_gimple_mem_ops (pretty_printer *buffer, gimple *gs, int spc, int flags)
+dump_gimple_mem_ops (pretty_printer *buffer, gimple *gs, int spc,
+		     dump_flags_t flags)
 {
   tree vdef = gimple_vdef (gs);
   tree vuse = gimple_vuse (gs);
@@ -2401,7 +2423,8 @@ dump_gimple_mem_ops (pretty_printer *buffer, gimple *gs, int spc, int flags)
    pp_flush on BUFFER to finalize the pretty printer.  */
 
 void
-pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc, int flags)
+pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc,
+		  dump_flags_t flags)
 {
   if (!gs)
     return;
@@ -2609,7 +2632,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc, int flags)
    spaces and details described by flags.  */
 
 static void
-dump_gimple_bb_header (FILE *outf, basic_block bb, int indent, int flags)
+dump_gimple_bb_header (FILE *outf, basic_block bb, int indent,
+		       dump_flags_t flags)
 {
   if (flags & TDF_BLOCKS)
     {
@@ -2655,7 +2679,7 @@ static void
 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED,
 		       basic_block bb ATTRIBUTE_UNUSED,
 		       int indent ATTRIBUTE_UNUSED,
-		       int flags ATTRIBUTE_UNUSED)
+		       dump_flags_t flags ATTRIBUTE_UNUSED)
 {
   /* There is currently no GIMPLE-specific basic block info to dump.  */
   return;
@@ -2666,7 +2690,8 @@ dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED,
    by FLAGS and indented by INDENT spaces.  */
 
 static void
-dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
+dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent,
+		dump_flags_t flags)
 {
   gphi_iterator i;
 
@@ -2688,7 +2713,7 @@ dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
    to BUFFER.  */
 
 static void
-pp_cfg_jump (pretty_printer *buffer, edge e, int flags)
+pp_cfg_jump (pretty_printer *buffer, edge e, dump_flags_t flags)
 {
   if (flags & TDF_GIMPLE)
     {
@@ -2725,7 +2750,7 @@ pp_cfg_jump (pretty_printer *buffer, edge e, int flags)
 
 static void
 dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
-		     int flags)
+		     dump_flags_t flags)
 {
   edge e;
   gimple *stmt;
@@ -2776,7 +2801,7 @@ dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
 
 static void
 gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent,
-		     int flags)
+		     dump_flags_t flags)
 {
   gimple_stmt_iterator gsi;
   gimple *stmt;
@@ -2812,7 +2837,7 @@ gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent,
    indented by INDENT spaces.  */
 
 void
-gimple_dump_bb (FILE *file, basic_block bb, int indent, int flags)
+gimple_dump_bb (FILE *file, basic_block bb, int indent, dump_flags_t flags)
 {
   dump_gimple_bb_header (file, bb, indent, flags);
   if (bb->index >= NUM_FIXED_BLOCKS)
diff --git a/gcc/gimple-pretty-print.h b/gcc/gimple-pretty-print.h
index 4c1d9258847..0b74d1b0494 100644
--- a/gcc/gimple-pretty-print.h
+++ b/gcc/gimple-pretty-print.h
@@ -26,13 +26,13 @@ along with GCC; see the file COPYING3.  If not see
 /* In gimple-pretty-print.c  */
 extern void debug_gimple_stmt (gimple *);
 extern void debug_gimple_seq (gimple_seq);
-extern void print_gimple_seq (FILE *, gimple_seq, int, int);
-extern void print_gimple_stmt (FILE *, gimple *, int, int = 0);
+extern void print_gimple_seq (FILE *, gimple_seq, int, dump_flags_t);
+extern void print_gimple_stmt (FILE *, gimple *, int, dump_flags_t = TDF_NONE);
 extern void debug (gimple &ref);
 extern void debug (gimple *ptr);
-extern void print_gimple_expr (FILE *, gimple *, int, int = 0);
-extern void pp_gimple_stmt_1 (pretty_printer *, gimple *, int, int);
-extern void gimple_dump_bb (FILE *, basic_block, int, int);
+extern void print_gimple_expr (FILE *, gimple *, int, dump_flags_t = TDF_NONE);
+extern void pp_gimple_stmt_1 (pretty_printer *, gimple *, int, dump_flags_t);
+extern void gimple_dump_bb (FILE *, basic_block, int, dump_flags_t);
 extern void gimple_dump_bb_for_graph (pretty_printer *, basic_block);
 extern void dump_ssaname_info_to_file (FILE *, tree, int);
 
diff --git a/gcc/graph.c b/gcc/graph.c
index 9f075c0a3f2..9261732d23e 100644
--- a/gcc/graph.c
+++ b/gcc/graph.c
@@ -291,9 +291,9 @@ print_graph_cfg (FILE *fp, struct function *fun)
 /* Overload with additional flag argument.  */
 
 void DEBUG_FUNCTION
-print_graph_cfg (FILE *fp, struct function *fun, int flags)
+print_graph_cfg (FILE *fp, struct function *fun, dump_flags_t flags)
 {
-  int saved_dump_flags = dump_flags;
+  dump_flags_t saved_dump_flags = dump_flags;
   dump_flags = flags;
   print_graph_cfg (fp, fun);
   dump_flags = saved_dump_flags;
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index e3a627df46d..2b7604e2e73 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -96,8 +96,8 @@ DEBUG_FUNCTION void
 dot_all_sese (FILE *file, vec<sese_l>& scops)
 {
   /* Disable debugging while printing graph.  */
-  int tmp_dump_flags = dump_flags;
-  dump_flags = 0;
+  dump_flags_t tmp_dump_flags = dump_flags;
+  dump_flags = TDF_NONE;
 
   fprintf (file, "digraph all {\n");
 
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 20e0dd68b4d..2949f92193e 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -2260,7 +2260,7 @@ build_type_inheritance_graph (void)
 {
   struct symtab_node *n;
   FILE *inheritance_dump_file;
-  int flags;
+  dump_flags_t flags;
 
   if (odr_hash)
     return;
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 3d48a8fb7bc..e2b6add6d41 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -191,7 +191,7 @@ static rtx get_expansion (struct var_to_expand *);
 static void
 report_unroll (struct loop *loop, location_t locus)
 {
-  int report_flags = MSG_OPTIMIZED_LOCATIONS | TDF_RTL | TDF_DETAILS;
+  dump_flags_t report_flags = MSG_OPTIMIZED_LOCATIONS | TDF_RTL | TDF_DETAILS;
 
   if (loop->lpt_decision.decision == LPT_NONE)
     return;
diff --git a/gcc/passes.c b/gcc/passes.c
index 911495ed865..a2fa9f742ee 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -776,7 +776,8 @@ pass_manager::register_one_dump_file (opt_pass *pass)
 
   /* Buffer big enough to format a 32-bit UINT_MAX into.  */
   char num[11];
-  int flags, id;
+  dump_flags_t flags;
+  int id;
   int optgroup_flags = OPTGROUP_NONE;
   gcc::dump_manager *dumps = m_ctxt->get_dumps ();
 
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index e0db2dfe82e..fb58be6c073 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -1007,7 +1007,7 @@ debug_raw (const tree_node *ptr)
 }
 
 static void
-dump_tree_via_hooks (const tree_node *ptr, int options)
+dump_tree_via_hooks (const tree_node *ptr, dump_flags_t options)
 {
   if (DECL_P (ptr))
     lang_hooks.print_decl (stderr, const_cast <tree_node*> (ptr), 0);
diff --git a/gcc/statistics.c b/gcc/statistics.c
index 57344f109b5..ca7551c2170 100644
--- a/gcc/statistics.c
+++ b/gcc/statistics.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "pass_manager.h"
 
 static int statistics_dump_nr;
-static int statistics_dump_flags;
+static dump_flags_t statistics_dump_flags;
 static FILE *statistics_dump_file;
 
 /* Statistics entry.  A integer counter associated to a string ID
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 19283b00833..b588bc03a47 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2372,7 +2372,7 @@ gimple_debug_bb_n (int n)
    (see TDF_* in dumpfile.h).  */
 
 void
-gimple_debug_cfg (int flags)
+gimple_debug_cfg (dump_flags_t flags)
 {
   gimple_dump_cfg (stderr, flags);
 }
@@ -2384,7 +2384,7 @@ gimple_debug_cfg (int flags)
    tree.h).  */
 
 void
-gimple_dump_cfg (FILE *file, int flags)
+gimple_dump_cfg (FILE *file, dump_flags_t flags)
 {
   if (flags & TDF_DETAILS)
     {
@@ -7514,7 +7514,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
    SPC.  */
 
 static void
-dump_default_def (FILE *file, tree def, int spc, int flags)
+dump_default_def (FILE *file, tree def, int spc, dump_flags_t flags)
 {
   for (int i = 0; i < spc; ++i)
     fprintf (file, " ");
@@ -7532,7 +7532,7 @@ dump_default_def (FILE *file, tree def, int spc, int flags)
    */
 
 void
-dump_function_to_file (tree fndecl, FILE *file, int flags)
+dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
 {
   tree arg, var, old_current_fndecl = current_function_decl;
   struct function *dsf;
@@ -7755,7 +7755,7 @@ dump_function_to_file (tree fndecl, FILE *file, int flags)
 /* Dump FUNCTION_DECL FN to stderr using FLAGS (see TDF_* in tree.h)  */
 
 DEBUG_FUNCTION void
-debug_function (tree fn, int flags)
+debug_function (tree fn, dump_flags_t flags)
 {
   dump_function_to_file (fn, stderr, flags);
 }
diff --git a/gcc/tree-cfg.h b/gcc/tree-cfg.h
index a3af5a40567..a0ef479ef20 100644
--- a/gcc/tree-cfg.h
+++ b/gcc/tree-cfg.h
@@ -46,7 +46,7 @@ extern edge find_taken_edge (basic_block, tree);
 extern void gimple_debug_bb (basic_block);
 extern basic_block gimple_debug_bb_n (int);
 extern void gimple_debug_cfg (int);
-extern void gimple_dump_cfg (FILE *, int);
+extern void gimple_dump_cfg (FILE *, dump_flags_t);
 extern void dump_cfg_stats (FILE *);
 extern void debug_cfg_stats (void);
 extern bool computed_goto_p (gimple *);
@@ -79,7 +79,7 @@ extern void verify_sese (basic_block, basic_block, vec<basic_block> *);
 extern bool gather_ssa_name_hash_map_from (tree const &, tree const &, void *);
 extern basic_block move_sese_region_to_fn (struct function *, basic_block,
 				           basic_block, tree);
-extern void dump_function_to_file (tree, FILE *, int);
+extern void dump_function_to_file (tree, FILE *, dump_flags_t);
 extern void debug_function (tree, int) ;
 extern void print_loops_bb (FILE *, basic_block, int, int);
 extern void print_loops (FILE *, int);
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 4e47be1dc05..2e65a4443fc 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -898,7 +898,7 @@ dump_enumerated_decls_push (tree *tp, int *walk_subtrees, void *data)
    FILE is the dump file where to output the list and FLAGS is as in
    print_generic_expr.  */
 void
-dump_enumerated_decls (FILE *file, int flags)
+dump_enumerated_decls (FILE *file, dump_flags_t flags)
 {
   basic_block bb;
   struct walk_stmt_info wi;
diff --git a/gcc/tree-dfa.h b/gcc/tree-dfa.h
index fb1f53fac4d..adaed620487 100644
--- a/gcc/tree-dfa.h
+++ b/gcc/tree-dfa.h
@@ -36,7 +36,7 @@ extern tree get_addr_base_and_unit_offset_1 (tree, HOST_WIDE_INT *,
 extern tree get_addr_base_and_unit_offset (tree, HOST_WIDE_INT *);
 extern bool stmt_references_abnormal_ssa_name (gimple *);
 extern void replace_abnormal_ssa_names (gimple *);
-extern void dump_enumerated_decls (FILE *, int);
+extern void dump_enumerated_decls (FILE *, dump_flags_t);
 
 
 #endif /* GCC_TREE_DFA_H */
diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c
index fd1783e020d..347b33ab505 100644
--- a/gcc/tree-dump.c
+++ b/gcc/tree-dump.c
@@ -713,7 +713,7 @@ dequeue_and_dump (dump_info_p di)
 /* Return nonzero if FLAG has been specified for the dump, and NODE
    is not the root node of the dump.  */
 
-int dump_flag (dump_info_p di, int flag, const_tree node)
+int dump_flag (dump_info_p di, dump_flags_t flag, const_tree node)
 {
   return (di->flags & flag) && (node != di->node);
 }
@@ -721,7 +721,7 @@ int dump_flag (dump_info_p di, int flag, const_tree node)
 /* Dump T, and all its children, on STREAM.  */
 
 void
-dump_node (const_tree t, int flags, FILE *stream)
+dump_node (const_tree t, dump_flags_t flags, FILE *stream)
 {
   struct dump_info di;
   dump_queue_p dq;
diff --git a/gcc/tree-dump.h b/gcc/tree-dump.h
index 6649ed2548d..448ac83f72b 100644
--- a/gcc/tree-dump.h
+++ b/gcc/tree-dump.h
@@ -60,7 +60,7 @@ struct dump_info
   /* The original node.  */
   const_tree node;
   /* User flags.  */
-  int flags;
+  dump_flags_t flags;
   /* The next unused node index.  */
   unsigned int index;
   /* The next column.  */
@@ -87,6 +87,6 @@ extern void dump_string (dump_info_p, const char *);
 extern void dump_string_field (dump_info_p, const char *, const char *);
 extern void queue_and_dump_index (dump_info_p, const char *, const_tree, int);
 extern void queue_and_dump_type (dump_info_p, const_tree);
-extern int dump_flag (dump_info_p, int, const_tree);
+extern int dump_flag (dump_info_p, dump_flags_t, const_tree);
 
 #endif /* ! GCC_TREE_DUMP_H */
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index d823c2e1245..ec28b1e3c95 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -39,8 +39,8 @@ static const char *op_symbol (const_tree);
 static void pretty_print_string (pretty_printer *, const char*);
 static void newline_and_indent (pretty_printer *, int);
 static void maybe_init_pretty_print (FILE *);
-static void print_struct_decl (pretty_printer *, const_tree, int, int);
-static void do_niy (pretty_printer *, const_tree, int);
+static void print_struct_decl (pretty_printer *, const_tree, int, dump_flags_t);
+static void do_niy (pretty_printer *, const_tree, dump_flags_t);
 
 #define INDENT(SPACE) do { \
   int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
@@ -52,7 +52,7 @@ static pretty_printer *tree_pp;
 /* Try to print something for an unknown tree code.  */
 
 static void
-do_niy (pretty_printer *pp, const_tree node, int flags)
+do_niy (pretty_printer *pp, const_tree node, dump_flags_t flags)
 {
   int i, len;
 
@@ -115,7 +115,7 @@ debug_tree_chain (tree t)
 
 /* Prints declaration DECL to the FILE with details specified by FLAGS.  */
 void
-print_generic_decl (FILE *file, tree decl, int flags)
+print_generic_decl (FILE *file, tree decl, dump_flags_t flags)
 {
   maybe_init_pretty_print (file);
   print_declaration (tree_pp, decl, 2, flags);
@@ -126,7 +126,7 @@ print_generic_decl (FILE *file, tree decl, int flags)
    to show in the dump.  See TDF_* in dumpfile.h.  */
 
 void
-print_generic_stmt (FILE *file, tree t, int flags)
+print_generic_stmt (FILE *file, tree t, dump_flags_t flags)
 {
   maybe_init_pretty_print (file);
   dump_generic_node (tree_pp, t, 0, flags, true);
@@ -138,7 +138,7 @@ print_generic_stmt (FILE *file, tree t, int flags)
    INDENT spaces.  */
 
 void
-print_generic_stmt_indented (FILE *file, tree t, int flags, int indent)
+print_generic_stmt_indented (FILE *file, tree t, dump_flags_t flags, int indent)
 {
   int i;
 
@@ -154,7 +154,7 @@ print_generic_stmt_indented (FILE *file, tree t, int flags, int indent)
    in the dump.  See TDF_* in dumpfile.h.  */
 
 void
-print_generic_expr (FILE *file, tree t, int flags)
+print_generic_expr (FILE *file, tree t, dump_flags_t flags)
 {
   maybe_init_pretty_print (file);
   dump_generic_node (tree_pp, t, 0, flags, false);
@@ -244,7 +244,7 @@ dump_fancy_name (pretty_printer *pp, tree name)
    in FLAGS.  */
 
 static void
-dump_decl_name (pretty_printer *pp, tree node, int flags)
+dump_decl_name (pretty_printer *pp, tree node, dump_flags_t flags)
 {
   if (DECL_NAME (node))
     {
@@ -290,7 +290,7 @@ dump_decl_name (pretty_printer *pp, tree node, int flags)
 /* Like the above, but used for pretty printing function calls.  */
 
 static void
-dump_function_name (pretty_printer *pp, tree node, int flags)
+dump_function_name (pretty_printer *pp, tree node, dump_flags_t flags)
 {
   if (CONVERT_EXPR_P (node))
     node = TREE_OPERAND (node, 0);
@@ -305,7 +305,7 @@ dump_function_name (pretty_printer *pp, tree node, int flags)
 
 static void
 dump_function_declaration (pretty_printer *pp, tree node,
-			   int spc, int flags)
+			   int spc, dump_flags_t flags)
 {
   bool wrote_arg = false;
   tree arg;
@@ -341,7 +341,7 @@ dump_function_declaration (pretty_printer *pp, tree node,
 /* Dump the domain associated with an array.  */
 
 static void
-dump_array_domain (pretty_printer *pp, tree domain, int spc, int flags)
+dump_array_domain (pretty_printer *pp, tree domain, int spc, dump_flags_t flags)
 {
   pp_left_bracket (pp);
   if (domain)
@@ -372,7 +372,7 @@ dump_array_domain (pretty_printer *pp, tree domain, int spc, int flags)
    dump_generic_node.  */
 
 static void
-dump_omp_clause (pretty_printer *pp, tree clause, int spc, int flags)
+dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
 {
   const char *name;
 
@@ -1051,7 +1051,7 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, int flags)
    dump_generic_node.  */
 
 void
-dump_omp_clauses (pretty_printer *pp, tree clause, int spc, int flags)
+dump_omp_clauses (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
 {
   if (clause == NULL)
     return;
@@ -1092,7 +1092,7 @@ dump_location (pretty_printer *pp, location_t loc)
    dump_generic_node.  */
 
 static void
-dump_block_node (pretty_printer *pp, tree block, int spc, int flags)
+dump_block_node (pretty_printer *pp, tree block, int spc, dump_flags_t flags)
 {
   tree t;
 
@@ -1205,7 +1205,7 @@ dump_block_node (pretty_printer *pp, tree block, int spc, int flags)
    to be a statement and it is terminated by ';' if appropriate.  */
 
 int
-dump_generic_node (pretty_printer *pp, tree node, int spc, int flags,
+dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
 		   bool is_stmt)
 {
   tree type;
@@ -3313,7 +3313,7 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, int flags,
 /* Print the declaration of a variable.  */
 
 void
-print_declaration (pretty_printer *pp, tree t, int spc, int flags)
+print_declaration (pretty_printer *pp, tree t, int spc, dump_flags_t flags)
 {
   INDENT (spc);
 
@@ -3414,7 +3414,8 @@ print_declaration (pretty_printer *pp, tree t, int spc, int flags)
    FIXME: Still incomplete.  */
 
 static void
-print_struct_decl (pretty_printer *pp, const_tree node, int spc, int flags)
+print_struct_decl (pretty_printer *pp, const_tree node, int spc,
+		   dump_flags_t flags)
 {
   /* Print the name of the structure.  */
   if (TYPE_NAME (node))
@@ -3810,7 +3811,7 @@ op_symbol (const_tree op)
    the gimple_call_fn of a GIMPLE_CALL.  */
 
 void
-print_call_name (pretty_printer *pp, tree node, int flags)
+print_call_name (pretty_printer *pp, tree node, dump_flags_t flags)
 {
   tree op0 = node;
 
@@ -4050,7 +4051,7 @@ pp_tree_identifier (pretty_printer *pp, tree id)
    function dump.  */
 
 void
-dump_function_header (FILE *dump_file, tree fdecl, int flags)
+dump_function_header (FILE *dump_file, tree fdecl, dump_flags_t flags)
 {
   const char *dname, *aname;
   struct cgraph_node *node = cgraph_node::get (fdecl);
diff --git a/gcc/tree-pretty-print.h b/gcc/tree-pretty-print.h
index 0af1acc609a..07270b735a7 100644
--- a/gcc/tree-pretty-print.h
+++ b/gcc/tree-pretty-print.h
@@ -34,20 +34,20 @@ along with GCC; see the file COPYING3.  If not see
 extern void debug_generic_expr (tree);
 extern void debug_generic_stmt (tree);
 extern void debug_tree_chain (tree);
-extern void print_generic_decl (FILE *, tree, int);
-extern void print_generic_stmt (FILE *, tree, int = 0);
-extern void print_generic_stmt_indented (FILE *, tree, int, int);
-extern void print_generic_expr (FILE *, tree, int = 0);
-extern void dump_omp_clauses (pretty_printer *, tree, int, int);
-extern int dump_generic_node (pretty_printer *, tree, int, int, bool);
-extern void print_declaration (pretty_printer *, tree, int, int);
+extern void print_generic_decl (FILE *, tree, dump_flags_t);
+extern void print_generic_stmt (FILE *, tree, dump_flags_t = TDF_NONE);
+extern void print_generic_stmt_indented (FILE *, tree, dump_flags_t, int);
+extern void print_generic_expr (FILE *, tree, dump_flags_t = TDF_NONE);
+extern void dump_omp_clauses (pretty_printer *, tree, int, dump_flags_t);
+extern int dump_generic_node (pretty_printer *, tree, int, dump_flags_t, bool);
+extern void print_declaration (pretty_printer *, tree, int, dump_flags_t);
 extern int op_code_prio (enum tree_code);
 extern int op_prio (const_tree);
 extern const char *op_symbol_code (enum tree_code);
-extern void print_call_name (pretty_printer *, tree, int);
+extern void print_call_name (pretty_printer *, tree, dump_flags_t);
 extern void percent_K_format (text_info *);
 extern void pp_tree_identifier (pretty_printer *, tree);
-extern void dump_function_header (FILE *, tree, int);
+extern void dump_function_header (FILE *, tree, dump_flags_t);
 extern void pp_double_int (pretty_printer *pp, double_int d, bool uns);
 extern void dump_location (pretty_printer *buffer, location_t loc);
 
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 0b992dba130..c77075e4ac6 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -613,7 +613,7 @@ clear_unused_block_pointer (void)
    indentation level and FLAGS is as in print_generic_expr.  */
 
 static void
-dump_scope_block (FILE *file, int indent, tree scope, int flags)
+dump_scope_block (FILE *file, int indent, tree scope, dump_flags_t flags)
 {
   tree var, t;
   unsigned int i;
@@ -661,7 +661,7 @@ dump_scope_block (FILE *file, int indent, tree scope, int flags)
    is as in print_generic_expr.  */
 
 DEBUG_FUNCTION void
-debug_scope_block (tree scope, int flags)
+debug_scope_block (tree scope, dump_flags_t flags)
 {
   dump_scope_block (stderr, 0, scope, flags);
 }
@@ -671,7 +671,7 @@ debug_scope_block (tree scope, int flags)
    FLAGS is as in print_generic_expr.  */
 
 void
-dump_scope_blocks (FILE *file, int flags)
+dump_scope_blocks (FILE *file, dump_flags_t flags)
 {
   dump_scope_block (file, 0, DECL_INITIAL (current_function_decl), flags);
 }
@@ -681,7 +681,7 @@ dump_scope_blocks (FILE *file, int flags)
    FLAGS is as in print_generic_expr.  */
 
 DEBUG_FUNCTION void
-debug_scope_blocks (int flags)
+debug_scope_blocks (dump_flags_t flags)
 {
   dump_scope_blocks (stderr, flags);
 }
diff --git a/gcc/tree-ssa-live.h b/gcc/tree-ssa-live.h
index 6685befcb97..dd9ca799597 100644
--- a/gcc/tree-ssa-live.h
+++ b/gcc/tree-ssa-live.h
@@ -73,9 +73,9 @@ extern void delete_var_map (var_map);
 extern int var_union (var_map, tree, tree);
 extern void partition_view_normal (var_map);
 extern void partition_view_bitmap (var_map, bitmap);
-extern void dump_scope_blocks (FILE *, int);
-extern void debug_scope_block (tree, int);
-extern void debug_scope_blocks (int);
+extern void dump_scope_blocks (FILE *, dump_flags_t);
+extern void debug_scope_block (tree, dump_flags_t);
+extern void debug_scope_blocks (dump_flags_t);
 extern void remove_unused_locals (void);
 extern void dump_var_map (FILE *, var_map);
 extern void debug (_var_map &ref);
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index e09ac29a58b..0a38c0a36d6 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -686,7 +686,7 @@ try_unroll_loop_completely (struct loop *loop,
   struct loop_size size;
   bool n_unroll_found = false;
   edge edge_to_cancel = NULL;
-  int report_flags = MSG_OPTIMIZED_LOCATIONS | TDF_RTL | TDF_DETAILS;
+  dump_flags_t report_flags = MSG_OPTIMIZED_LOCATIONS | TDF_RTL | TDF_DETAILS;
 
   /* See if we proved number of iterations to be low constant.
 
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index af874e7ad8e..b41abf3335c 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -2432,7 +2432,7 @@ reduction_code_for_scalar_code (enum tree_code code,
    STMT is printed with a message MSG. */
 
 static void
-report_vect_op (int msg_type, gimple *stmt, const char *msg)
+report_vect_op (dump_flags_t msg_type, gimple *stmt, const char *msg)
 {
   dump_printf_loc (msg_type, vect_location, "%s", msg);
   dump_gimple_stmt (msg_type, TDF_SLIM, stmt, 0);
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index e254aa0e49f..d221fc63873 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1220,7 +1220,7 @@ fail:
 /* Dump a slp tree NODE using flags specified in DUMP_KIND.  */
 
 static void
-vect_print_slp_tree (int dump_kind, location_t loc, slp_tree node)
+vect_print_slp_tree (dump_flags_t dump_kind, location_t loc, slp_tree node)
 {
   int i;
   gimple *stmt;
-- 
2.12.2


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

* [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum.
  2017-05-06 15:04             ` Trevor Saunders
  2017-05-12 13:01               ` [PATCH v2 01/N] Add default value for last argument of dump functions Martin Liška
  2017-05-12 13:04               ` [PATCH v2 2/N] Introduce dump_flags_t type and use it instead of int, type Martin Liška
@ 2017-05-12 13:30               ` Martin Liška
  2017-05-16 14:17                 ` Richard Biener
                                   ` (2 more replies)
  2017-05-16 13:55               ` [PATCH v2 04/N] Simplify usage of some TDF_* flags Martin Liška
  2017-05-24 11:04               ` [PATCH v2 05/N] Add -fdump*-folding suboption Martin Liška
  4 siblings, 3 replies; 54+ messages in thread
From: Martin Liška @ 2017-05-12 13:30 UTC (permalink / raw)
  To: Trevor Saunders, Richard Biener; +Cc: GCC Patches, Nathan Sidwell

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

Third part removes TDF_* flags mentioned in the subject. These flags are used
to enable all passes of specific type and Nathan has recently separated these
by a new pair of macros. I hope moving these to a separate enum will help even more.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

[-- Attachment #2: 0003-Transform-TDF_-lang-tree-ipa-rtl-to-dump_kind-enum.patch --]
[-- Type: text/x-patch, Size: 18353 bytes --]

From 33ae777e1dc3b6026299fd19b5f2d80e60f3ca4a Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 10 May 2017 14:32:26 +0200
Subject: [PATCH 3/3] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum.

gcc/ChangeLog:

2017-05-12  Martin Liska  <mliska@suse.cz>

	* cfgrtl.c (rtl_verify_edges): Remove usage of TDF_RTL.
	* dumpfile.c (dump_register): Use new enum dump_kind.
	(get_dump_file_name): Likewise.
	(dump_enable_all): Likewise.
	(dump_switch_p_1): Likewise.
	(enable_rtl_dump_file): Remove usage of TDF_RTL.
	* dumpfile.h (enum dump_kind): New enum type.
	(struct dump_file_info): Create constructor and
	format fields and comments.
	* passes.c (pass_manager::register_one_dump_file):
	Use num dump_kind.
	* statistics.c (statistics_early_init): Likewise.
	* tree-ssa-loop-prefetch.c (dump_mem_details): Replace
	TDF_TREE with TDF_SLIM.
	(gather_memory_references_ref): Likewise.
---
 gcc/cfgrtl.c                 |  2 +-
 gcc/dumpfile.c               | 84 +++++++++++++++++++++---------------------
 gcc/dumpfile.h               | 87 +++++++++++++++++++++++++++-----------------
 gcc/loop-unroll.c            |  4 +-
 gcc/passes.c                 | 10 ++---
 gcc/statistics.c             |  2 +-
 gcc/tree-ssa-loop-ivcanon.c  |  2 +-
 gcc/tree-ssa-loop-prefetch.c |  8 ++--
 8 files changed, 111 insertions(+), 88 deletions(-)

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index ead82d23166..aad02921392 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2527,7 +2527,7 @@ rtl_verify_edges (void)
 	    && JUMP_P (BB_END (bb))
 	    && CROSSING_JUMP_P (BB_END (bb)))
           {
-            print_rtl_with_bb (stderr, get_insns (), TDF_RTL | TDF_BLOCKS | TDF_DETAILS);
+	    print_rtl_with_bb (stderr, get_insns (), TDF_BLOCKS | TDF_DETAILS);
             error ("Region crossing jump across same section in bb %i",
                    bb->index);
             err = 1;
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index ee967d825f4..ccc6db3077a 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -47,37 +47,41 @@ FILE *alt_dump_file = NULL;
 const char *dump_file_name;
 dump_flags_t dump_flags;
 
+dump_file_info::dump_file_info (): suffix (NULL), swtch (NULL), glob (NULL),
+  pfilename (NULL), alt_filename (NULL), pstream (NULL), alt_stream (NULL),
+  dkind (DK_none), pflags (), alt_flags (0), optgroup_flags (0),
+  pstate (0), num (0), owns_strings (false), graph_dump_initialized (false)
+{
+}
+
+dump_file_info::dump_file_info (const char *_suffix, const char *_swtch,
+				dump_kind _dkind, int _num):
+  suffix (_suffix), swtch (_swtch), glob (NULL),
+  pfilename (NULL), alt_filename (NULL), pstream (NULL), alt_stream (NULL),
+  dkind (_dkind), pflags (), alt_flags (0), optgroup_flags (0),
+  pstate (0), num (_num), owns_strings (false), graph_dump_initialized (false)
+{
+}
+
 /* Table of tree dump switches. This must be consistent with the
    TREE_DUMP_INDEX enumeration in dumpfile.h.  */
 static struct dump_file_info dump_files[TDI_end] =
 {
-  {NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, false, false},
-  {".cgraph", "ipa-cgraph", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
-   0, 0, 0, 0, 0, false, false},
-  {".type-inheritance", "ipa-type-inheritance", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
-   0, 0, 0, 0, 0, false, false},
-  {".ipa-clones", "ipa-clones", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
-   0, 0, 0, 0, 0, false, false},
-  {".tu", "translation-unit", NULL, NULL, NULL, NULL, NULL, TDF_LANG,
-   0, 0, 0, 0, 1, false, false},
-  {".class", "class-hierarchy", NULL, NULL, NULL, NULL, NULL, TDF_LANG,
-   0, 0, 0, 0, 2, false, false},
-  {".original", "tree-original", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 3, false, false},
-  {".gimple", "tree-gimple", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 4, false, false},
-  {".nested", "tree-nested", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 5, false, false},
+  dump_file_info (),
+  dump_file_info (".cgraph", "ipa-cgraph", DK_ipa, 0),
+  dump_file_info (".type-inheritance", "ipa-type-inheritance", DK_ipa, 0),
+  dump_file_info (".ipa-clones", "ipa-clones", DK_ipa, 0),
+  dump_file_info (".tu", "translation-unit", DK_lang, 1),
+  dump_file_info (".class", "class-hierarchy", DK_lang, 2),
+  dump_file_info (".original", "tree-original", DK_tree, 3),
+  dump_file_info (".gimple", "tree-gimple", DK_tree, 4),
+  dump_file_info (".nested", "tree-nested", DK_tree, 5),
 #define FIRST_AUTO_NUMBERED_DUMP 6
 
-  {NULL, "lang-all", NULL, NULL, NULL, NULL, NULL, TDF_LANG,
-   0, 0, 0, 0, 0, false, false},
-  {NULL, "tree-all", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 0, false, false},
-  {NULL, "rtl-all", NULL, NULL, NULL, NULL, NULL, TDF_RTL,
-   0, 0, 0, 0, 0, false, false},
-  {NULL, "ipa-all", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
-   0, 0, 0, 0, 0, false, false},
+  dump_file_info (NULL, "lang-all", DK_lang, 0),
+  dump_file_info (NULL, "tree-all", DK_tree, 0),
+  dump_file_info (NULL, "rtl-all", DK_rtl, 0),
+  dump_file_info (NULL, "ipa-all", DK_ipa, 0),
 };
 
 /* Define a name->number mapping for a dump flag value.  */
@@ -118,7 +122,7 @@ static const struct dump_option_value_info dump_options[] =
   {"missed", MSG_MISSED_OPTIMIZATION},
   {"note", MSG_NOTE},
   {"optall", MSG_ALL},
-  {"all", ~(TDF_KIND_MASK | TDF_RAW | TDF_SLIM | TDF_LINENO
+  {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO
 	    | TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC | TDF_VERBOSE
 	    | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV
 	    | TDF_GIMPLE)},
@@ -181,8 +185,7 @@ gcc::dump_manager::~dump_manager ()
 unsigned int
 gcc::dump_manager::
 dump_register (const char *suffix, const char *swtch, const char *glob,
-	       dump_flags_t flags, int optgroup_flags,
-	       bool take_ownership)
+	       dump_kind dkind, int optgroup_flags, bool take_ownership)
 {
   int num = m_next_dump++;
 
@@ -203,7 +206,7 @@ dump_register (const char *suffix, const char *swtch, const char *glob,
   m_extra_dump_files[count].suffix = suffix;
   m_extra_dump_files[count].swtch = swtch;
   m_extra_dump_files[count].glob = glob;
-  m_extra_dump_files[count].pflags = flags;
+  m_extra_dump_files[count].dkind = dkind;
   m_extra_dump_files[count].optgroup_flags = optgroup_flags;
   m_extra_dump_files[count].num = num;
   m_extra_dump_files[count].owns_strings = take_ownership;
@@ -285,11 +288,10 @@ get_dump_file_name (struct dump_file_info *dfi) const
     dump_id[0] = '\0';
   else
     {
-      /* LANG, TREE, RTL, IPA.  */
-      char suffix = "ltri"[TDF_KIND (dfi->pflags)];
+      /* (null), LANG, TREE, RTL, IPA.  */
+      char suffix = " ltri"[dfi->dkind];
       
-      if (snprintf (dump_id, sizeof (dump_id), ".%03d%c", dfi->num, suffix)
-	  < 0)
+      if (snprintf (dump_id, sizeof (dump_id), ".%03d%c", dfi->num, suffix) < 0)
 	dump_id[0] = '\0';
     }
 
@@ -494,7 +496,7 @@ dump_start (int phase, dump_flags_t *flag_ptr)
       dfi->pstream = stream;
       dump_file = dfi->pstream;
       /* Initialize current dump flags. */
-      pflags = TDF_FLAGS (dfi->pflags);
+      pflags = dfi->pflags;
     }
 
   stream = dump_open_alternate_stream (dfi);
@@ -504,7 +506,7 @@ dump_start (int phase, dump_flags_t *flag_ptr)
       count++;
       alt_dump_file = dfi->alt_stream;
       /* Initialize current -fopt-info flags. */
-      alt_flags = TDF_FLAGS (dfi->alt_flags);
+      alt_flags = dfi->alt_flags;
     }
 
   if (flag_ptr)
@@ -657,15 +659,14 @@ dump_end (int phase ATTRIBUTE_UNUSED, FILE *stream)
 
 int
 gcc::dump_manager::
-dump_enable_all (dump_flags_t flags, const char *filename)
+dump_enable_all (dump_kind dkind, dump_flags_t flags, const char *filename)
 {
-  dump_flags_t ir_dump_type = TDF_KIND (flags);
   int n = 0;
   size_t i;
 
   for (i = TDI_none + 1; i < (size_t) TDI_end; i++)
     {
-      if (TDF_KIND (dump_files[i].pflags) == ir_dump_type)
+      if ((dump_files[i].dkind == dkind))
         {
           const char *old_filename = dump_files[i].pfilename;
           dump_files[i].pstate = -1;
@@ -686,7 +687,7 @@ dump_enable_all (dump_flags_t flags, const char *filename)
 
   for (i = 0; i < m_extra_dump_files_in_use; i++)
     {
-      if (TDF_KIND (m_extra_dump_files[i].pflags) == ir_dump_type)
+      if ((m_extra_dump_files[i].dkind == dkind))
         {
           const char *old_filename = m_extra_dump_files[i].pfilename;
           m_extra_dump_files[i].pstate = -1;
@@ -832,7 +833,7 @@ dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob)
   /* Process -fdump-tree-all and -fdump-rtl-all, by enabling all the
      known dumps.  */
   if (dfi->suffix == NULL)
-    dump_enable_all (dfi->pflags, dfi->pfilename);
+    dump_enable_all (dfi->dkind, dfi->pflags, dfi->pfilename);
 
   return 1;
 }
@@ -1017,6 +1018,7 @@ enable_rtl_dump_file (void)
 {
   gcc::dump_manager *dumps = g->get_dumps ();
   int num_enabled =
-    dumps->dump_enable_all (TDF_RTL | TDF_DETAILS | TDF_BLOCKS, NULL);
+    dumps->dump_enable_all (DK_rtl, dump_flags_t (TDF_DETAILS) | TDF_BLOCKS,
+			    NULL);
   return num_enabled > 0;
 }
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index 3eec6ab56d5..a826f37a27c 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -44,20 +44,22 @@ enum tree_dump_index
   TDI_end
 };
 
+/* Enum used to distinguish dump files to types.  */
+
+enum dump_kind
+{
+  DK_none,
+  DK_lang,
+  DK_tree,
+  DK_ipa,
+  DK_rtl
+};
+
 /* Bit masks to control dumping. Not all values are applicable to all
    dumps. Add new ones at the end. When you define new values, extend
    the DUMP_OPTIONS array in dumpfile.c. The TDF_* flags coexist with
    MSG_* flags (for -fopt-info) and the bit values must be chosen to
    allow that.  */
-#define TDF_LANG	0	/* is a lang-specific dump.  */
-#define TDF_TREE	1	/* is a tree dump */
-#define TDF_RTL		2	/* is a RTL dump */
-#define TDF_IPA		3	/* is an IPA dump */
-#define TDF_KIND_MASK   3
-#define TDF_KIND(X) ((X) & TDF_KIND_MASK)
-#define TDF_FLAGS(X) ((X) & ~TDF_KIND_MASK)
-
-/* Bit 2 unused, available for hire.  */
 #define TDF_ADDRESS	(1 << 3)	/* dump node addresses */
 #define TDF_SLIM	(1 << 4)	/* don't go wild following links */
 #define TDF_RAW		(1 << 5)	/* don't unparse the function */
@@ -125,27 +127,47 @@ typedef uint64_t dump_flags_t;
 /* Define a tree dump switch.  */
 struct dump_file_info
 {
-  const char *suffix;		/* suffix to give output file.  */
-  const char *swtch;		/* command line dump switch */
-  const char *glob;		/* command line glob  */
-  const char *pfilename;	/* filename for the pass-specific stream  */
-  const char *alt_filename;	/* filename for the -fopt-info stream  */
-  FILE *pstream;		/* pass-specific dump stream  */
-  FILE *alt_stream;		/* -fopt-info stream */
-  dump_flags_t pflags;		/* dump flags */
-  int optgroup_flags;		/* optgroup flags for -fopt-info */
-  int alt_flags;		/* flags for opt-info */
-  int pstate;			/* state of pass-specific stream */
-  int alt_state;		/* state of the -fopt-info stream */
-  int num;			/* dump file number */
-  bool owns_strings;		/* fields "suffix", "swtch", "glob" can be
-				   const strings, or can be dynamically
-				   allocated, needing free.  */
-  bool graph_dump_initialized;	/* When a given dump file is being
-				   initialized, this flag is set to
-				   true if the corresponding TDF_graph
-				   dump file has also been
-				   initialized.  */
+  /* Constructor.  */
+  dump_file_info ();
+
+  /* Constructor.  */
+  dump_file_info (const char *_suffix, const char *_swtch, dump_kind _dkind,
+		  int _num);
+
+  /* Suffix to give output file.  */
+  const char *suffix;
+  /* Command line dump switch.  */
+  const char *swtch;
+  /* Command line glob.  */
+  const char *glob;
+  /* Filename for the pass-specific stream.  */
+  const char *pfilename;
+  /* Filename for the -fopt-info stream.  */
+  const char *alt_filename;
+  /* Pass-specific dump stream.  */
+  FILE *pstream;
+  /* -fopt-info stream.  */
+  FILE *alt_stream;
+  /* Dump kind.  */
+  dump_kind dkind;
+  /* Dump flags.  */
+  dump_flags_t pflags;
+  /* A pass flags for -fopt-info.  */
+  int alt_flags;
+  /* Flags for -fopt-info given by a user.  */
+  int optgroup_flags;
+  /* State of pass-specific stream.  */
+  int pstate;
+  /* State of the -fopt-info stream.  */
+  int alt_state;
+  /* Dump file number.  */
+  int num;
+  /* Fields "suffix", "swtch", "glob" can be const strings,
+     or can be dynamically allocated, needing free.  */
+  bool owns_strings;
+  /* When a given dump file is being initialized, this flag is set to true
+     if the corresponding TDF_graph dump file has also been initialized.  */
+  bool graph_dump_initialized;
 };
 
 /* In dumpfile.c */
@@ -202,8 +224,7 @@ public:
      SUFFIX, SWTCH, and GLOB. */
   unsigned int
   dump_register (const char *suffix, const char *swtch, const char *glob,
-		 dump_flags_t flags, int optgroup_flags,
-		 bool take_ownership);
+		 dump_kind dkind, int optgroup_flags, bool take_ownership);
 
   /* Return the dump_file_info for the given phase.  */
   struct dump_file_info *
@@ -256,7 +277,7 @@ private:
   dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob);
 
   int
-  dump_enable_all (dump_flags_t flags, const char *filename);
+  dump_enable_all (dump_kind dkind, dump_flags_t flags, const char *filename);
 
   int
   opt_info_enable_passes (int optgroup_flags, dump_flags_t flags,
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index e2b6add6d41..5feaa8c20cb 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -191,7 +191,7 @@ static rtx get_expansion (struct var_to_expand *);
 static void
 report_unroll (struct loop *loop, location_t locus)
 {
-  dump_flags_t report_flags = MSG_OPTIMIZED_LOCATIONS | TDF_RTL | TDF_DETAILS;
+  dump_flags_t report_flags = MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS;
 
   if (loop->lpt_decision.decision == LPT_NONE)
     return;
@@ -223,7 +223,7 @@ decide_unrolling (int flags)
       location_t locus = get_loop_location (loop);
 
       if (dump_enabled_p ())
-	dump_printf_loc (TDF_RTL, locus,
+	dump_printf_loc (MSG_NOTE, locus,
                          ";; *** Considering loop %d at BB %d for "
                          "unrolling ***\n",
                          loop->num, loop->header->index);
diff --git a/gcc/passes.c b/gcc/passes.c
index a2fa9f742ee..e7c5d194010 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -776,7 +776,7 @@ pass_manager::register_one_dump_file (opt_pass *pass)
 
   /* Buffer big enough to format a 32-bit UINT_MAX into.  */
   char num[11];
-  dump_flags_t flags;
+  dump_kind dkind;
   int id;
   int optgroup_flags = OPTGROUP_NONE;
   gcc::dump_manager *dumps = m_ctxt->get_dumps ();
@@ -798,18 +798,18 @@ pass_manager::register_one_dump_file (opt_pass *pass)
   if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS)
     {
       prefix = "ipa-";
-      flags = TDF_IPA;
+      dkind = DK_ipa;
       optgroup_flags |= OPTGROUP_IPA;
     }
   else if (pass->type == GIMPLE_PASS)
     {
       prefix = "tree-";
-      flags = TDF_TREE;
+      dkind = DK_tree;
     }
   else
     {
       prefix = "rtl-";
-      flags = TDF_RTL;
+      dkind = DK_rtl;
     }
 
   flag_name = concat (prefix, name, num, NULL);
@@ -820,7 +820,7 @@ pass_manager::register_one_dump_file (opt_pass *pass)
      any dump messages are emitted properly under -fopt-info(-optall).  */
   if (optgroup_flags == OPTGROUP_NONE)
     optgroup_flags = OPTGROUP_OTHER;
-  id = dumps->dump_register (dot_name, flag_name, glob_name, flags,
+  id = dumps->dump_register (dot_name, flag_name, glob_name, dkind,
 			     optgroup_flags,
 			     true);
   set_pass_for_id (id, pass);
diff --git a/gcc/statistics.c b/gcc/statistics.c
index ca7551c2170..2961f9f5152 100644
--- a/gcc/statistics.c
+++ b/gcc/statistics.c
@@ -259,7 +259,7 @@ statistics_early_init (void)
 {
   gcc::dump_manager *dumps = g->get_dumps ();
   statistics_dump_nr = dumps->dump_register (".statistics", "statistics",
-					     "statistics", TDF_TREE,
+					     "statistics", DK_tree,
 					     OPTGROUP_NONE,
 					     false);
 }
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 0a38c0a36d6..31a4b3224fa 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -686,7 +686,7 @@ try_unroll_loop_completely (struct loop *loop,
   struct loop_size size;
   bool n_unroll_found = false;
   edge edge_to_cancel = NULL;
-  dump_flags_t report_flags = MSG_OPTIMIZED_LOCATIONS | TDF_RTL | TDF_DETAILS;
+  dump_flags_t report_flags = MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS;
 
   /* See if we proved number of iterations to be low constant.
 
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index 339eeafcfee..f5f2802e5b9 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -288,7 +288,7 @@ dump_mem_details (FILE *file, tree base, tree step,
   if (cst_and_fits_in_hwi (step))
     fprintf (file, HOST_WIDE_INT_PRINT_DEC, int_cst_value (step));
   else
-    print_generic_expr (file, step, TDF_TREE);
+    print_generic_expr (file, step, TDF_SLIM);
   fprintf (file, ")\n");
   fprintf (file, "  delta ");
   fprintf (file, HOST_WIDE_INT_PRINT_DEC, delta);
@@ -553,8 +553,8 @@ gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs,
           if (dump_file && (dump_flags & TDF_DETAILS))
             {
               fprintf (dump_file, "Memory expression %p\n",(void *) ref ); 
-              print_generic_expr (dump_file, ref, TDF_TREE); 
-              fprintf (dump_file,":");
+	      print_generic_expr (dump_file, ref, TDF_SLIM);
+	      fprintf (dump_file,":");
               dump_mem_details (dump_file, base, step, delta, write_p);
               fprintf (dump_file, 
                        "Ignoring %p, non-constant step prefetching is "
@@ -570,7 +570,7 @@ gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs,
             if (dump_file && (dump_flags & TDF_DETAILS))
               {
                 fprintf (dump_file, "Memory expression %p\n",(void *) ref );
-                print_generic_expr (dump_file, ref, TDF_TREE);
+		print_generic_expr (dump_file, ref, TDF_SLIM);
                 fprintf (dump_file,":");
                 dump_mem_details (dump_file, base, step, delta, write_p);
                 fprintf (dump_file, 
-- 
2.12.2


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

* Re: [PATCH 2/N] Add dump_flags_type<E> for handling of suboptions.
  2017-05-05 10:56         ` [PATCH 2/N] Add dump_flags_type<E> for handling of suboptions Martin Liška
  2017-05-09 12:05           ` Martin Liška
@ 2017-05-12 17:47           ` Martin Sebor
  2017-05-15  6:52             ` Martin Sebor
  2017-05-15  9:47           ` [RFC] Do we want hierarchical options & encapsulation in a class Martin Liška
  2 siblings, 1 reply; 54+ messages in thread
From: Martin Sebor @ 2017-05-12 17:47 UTC (permalink / raw)
  To: Martin Liška, Richard Biener; +Cc: GCC Patches

On 05/05/2017 04:44 AM, Martin Liška wrote:
> Hi.
>
> This one is more interesting as it implements hierarchical option parsing
> and as a first step I implemented that for optgroup suboptions.

I haven't gone through the rest of the patches so I could be
missing some context.  But I have a few observations about and
suggestions for the new dump_option_node (and to a smaller extent,
dump_flags_type) class template. (Feel free to disregard whatever
doesn't make sense.)

First, since dump_option_node's public member functions (including
the only ctor) are defined in dumpfile.c it seems that the template
definition doesn't really need to be provided in the header. If
that's correct, it would reduce coupling and might avoid bloat to
only declare the bare minimum needed to use the type in other .c
files, and define the rest in the one .c file where the complete
type is actually needed.

As far as I can see, there is just one instantiation of the template
in the patch, in dumpfile.c:

+  typedef dump_option_node<optgroup_types> node;

If there are no other existing instantiations and no others are
anticipated, it could even be a plain class (further reducing
complexity and bloat).

Finally, the template ctor takes a const char* and stores it
in a member, and the implicit copy ctor and assignment operator
copy the underlying vec class.  That means that the string
argument must outlive the constructed object, which is not
typically expected.  IIUC, vec is not safely copy-assignable
or copy-constructible (i.e., has undefined behavior).  At
a minimum, it would be appropriate to document these
constraints.  Removing them or preventing copy construction
and assignment to avoid getting bit by it would be even better.

For dump_flags_type, none of the members need to be explicitly
declared inline or mention the <E> template argument list.
operator&(dump_flags_type) should be declared const.  Compound
assignment operators should return a reference to *this  (to
behave as closely to the native operators).  The exclusive OR
operator and compound assignment are missing and should probably
be provided for completeness, even if they aren't needed.  The
m_mask member should probably be private for better encapsulation
(and operator uint64_t() const provided to provide implicit
conversion to that type, or perhaps one converting to E's
underlying type; that should also obviate the need for operator
bool).

Martin

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

* Re: [PATCH 2/N] Add dump_flags_type<E> for handling of suboptions.
  2017-05-12 17:47           ` Martin Sebor
@ 2017-05-15  6:52             ` Martin Sebor
  0 siblings, 0 replies; 54+ messages in thread
From: Martin Sebor @ 2017-05-15  6:52 UTC (permalink / raw)
  To: Martin Liška, Richard Biener; +Cc: GCC Patches

On 05/12/2017 11:42 AM, Martin Sebor wrote:
> On 05/05/2017 04:44 AM, Martin Liška wrote:
>> Hi.
>>
>> This one is more interesting as it implements hierarchical option parsing
>> and as a first step I implemented that for optgroup suboptions.
>
> I haven't gone through the rest of the patches so I could be
> missing some context.  But I have a few observations about and
> suggestions for the new dump_option_node (and to a smaller extent,
> dump_flags_type) class template. (Feel free to disregard whatever
> doesn't make sense.)
>
> First, since dump_option_node's public member functions (including
> the only ctor) are defined in dumpfile.c it seems that the template
> definition doesn't really need to be provided in the header. If
> that's correct, it would reduce coupling and might avoid bloat to
> only declare the bare minimum needed to use the type in other .c
> files, and define the rest in the one .c file where the complete
> type is actually needed.
>
> As far as I can see, there is just one instantiation of the template
> in the patch, in dumpfile.c:
>
> +  typedef dump_option_node<optgroup_types> node;
>
> If there are no other existing instantiations and no others are
> anticipated, it could even be a plain class (further reducing
> complexity and bloat).
>
> Finally, the template ctor takes a const char* and stores it
> in a member, and the implicit copy ctor and assignment operator
> copy the underlying vec class.  That means that the string
> argument must outlive the constructed object, which is not
> typically expected.  IIUC, vec is not safely copy-assignable
> or copy-constructible (i.e., has undefined behavior).  At
> a minimum, it would be appropriate to document these
> constraints.  Removing them or preventing copy construction
> and assignment to avoid getting bit by it would be even better.
>
> For dump_flags_type, none of the members need to be explicitly
> declared inline or mention the <E> template argument list.
> operator&(dump_flags_type) should be declared const.  Compound
> assignment operators should return a reference to *this  (to
> behave as closely to the native operators).  The exclusive OR
> operator and compound assignment are missing and should probably
> be provided for completeness, even if they aren't needed.  The
> m_mask member should probably be private for better encapsulation
> (and operator uint64_t() const provided to provide implicit
> conversion to that type, or perhaps one converting to E's
> underlying type; that should also obviate the need for operator
> bool).

One other comment/suggestion I meant to add but forgot:

It's best to make binary operators like operator| non-members.
That way, they are symmetric in terms of implicit conversions
of their operands.  E.g., with dump_flags_type which defines
a conversion ctor from uint64_t (whether or not that's a good
approach is a separate topic), it's expected that if

   dump_flags_type () | uint64_t (1)

is valid, then

   uint64_t (1) | dump_flags_type ()

is valid as well.  With operator| being a dump_flags_type member
the former would be valid but the latter would not be.  In other
words, the general rule is to only define member functions for
the smallest set of operations that cannot be non-members (like
compound assignments).

Martin

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

* [RFC] Do we want hierarchical options & encapsulation in a class
  2017-05-05 10:56         ` [PATCH 2/N] Add dump_flags_type<E> for handling of suboptions Martin Liška
  2017-05-09 12:05           ` Martin Liška
  2017-05-12 17:47           ` Martin Sebor
@ 2017-05-15  9:47           ` Martin Liška
  2017-05-15 11:26             ` Nathan Sidwell
  2017-05-15 11:46             ` Nathan Sidwell
  2 siblings, 2 replies; 54+ messages in thread
From: Martin Liška @ 2017-05-15  9:47 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches, Martin Sebor, Nathan Sidwell

Hello.

Thanks Martin for feedback! After I spent quite some time with fiddling with
the options, I'm not convinced we should convert options to more hierarchical
structure. There's description:

1) -fopt-info is used to dump optimization options. One can pick both verbosity
(note, optimization, all) and an optimization (ipa, inline, vec,...). Thus said
it's probably not a candidate for hierarchical options?

2) -fdump-pass_name-... as mentioned by Nathan is combination of verbosity
(graph, note, verbose, details) and specific type of options (VOPS, RHS_ONLY, UID,..).

There's a complete list and suggestion how we can move it to more hierarchical ordering:

#define TDF_ADDRESS
#define TDF_SLIM
#define TDF_RAW
#define TDF_DETAILS
#define TDF_STATS
#define TDF_BLOCKS
#define TDF_VOPS
#define TDF_LINENO
#define TDF_UID
#define TDF_TREE - remove & replace with DI_kind
#define TDF_RTL - remove & replace with DI_kind
#define TDF_IPA - remove & replace with DI_kind
#define TDF_STMTADDR - merge with TDF_ADDRESS
#define TDF_GRAPH
#define TDF_MEMSYMS
#define TDF_DIAGNOSTIC - merge with TDF_DETAILS
#define TDF_VERBOSE - merge with TDF_DETAILS
#define TDF_RHS_ONLY
#define TDF_ASMNAME
#define TDF_EH
#define TDF_NOUID
#define TDF_ALIAS
#define TDF_ENUMERATE_LOCALS
#define TDF_CSELIB
#define TDF_SCEV
#define TDF_COMMENT - remove and dump ';; ' unconditionally
#define TDF_GIMPLE

and more hierarchical ordering can be:

#define TDF_ADDRESS
#define TDF_SLIM
#define TDF_RAW
#define TDF_DETAILS
#define TDF_STATS
#define TDF_BLOCKS
#define TDF_LINENO
#define TDF_UID
#define TDF_GRAPH
#define TDF_ASMNAME
#define TDF_NOUID
#define TDF_ENUMERATE_LOCALS

#define TDF_GIMPLE
#define TDF_GIMPLE_FE - GIMPLE front-end
#define TDF_GIMPLE_VOPS
#define TDF_GIMPLE_EH
#define TDF_GIMPLE_ALIAS
#define TDF_GIMPLE_SCEV
#define TDF_GIMPLE_MEMSYMS
#define TDF_GIMPLE_RHS_ONLY

#define TDF_RTL
#define TDF_RTL_CSELIB

I already discussed that with Richi, but I would like to receive a feedback about TDF_ clean
and about -fopt-info.

Thanks,
Martin

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

* Re: [RFC] Do we want hierarchical options & encapsulation in a class
  2017-05-15  9:47           ` [RFC] Do we want hierarchical options & encapsulation in a class Martin Liška
@ 2017-05-15 11:26             ` Nathan Sidwell
  2017-05-15 12:24               ` Martin Liška
  2017-05-15 11:46             ` Nathan Sidwell
  1 sibling, 1 reply; 54+ messages in thread
From: Nathan Sidwell @ 2017-05-15 11:26 UTC (permalink / raw)
  To: Martin Liška, Richard Biener; +Cc: GCC Patches, Martin Sebor

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

On 05/15/2017 05:39 AM, Martin Liška wrote:
> Thanks Martin for feedback! After I spent quite some time with fiddling with
> the options, I'm not convinced we should convert options to more hierarchical

I'll respond to Martin's email properly separates, but while we're on 
dump redesign, here's a WIP patch I whipped up on Friday for the modules 
branch.  This tries to move the language-specific options to a dynamic 
registration mechanism, rather than hard wire them into dumpfile.[hc]. 
There were some awkward pieces due to the current structure of dumpfile 
registration.

I took the -fdump-class-heirachy and -fdump-translation-unit and turned 
them into -fdump-lang-class and -fdump-lang-translation.  Unfortunately 
the current LANG_HOOKS_INIT_OPTIONS is run rather too late to register 
these dumps so that they get nice low numbers.  That's because 
gcc::context::context () both creates the dump manager and then 
immediately creates all the optimization passes:
   m_dumps = new gcc::dump_manager ();
   /* Allow languages to register dumps before passes.  */
   lang_hooks.register_dumps (m_dumps);
   m_passes = new gcc::pass_manager (this);

As you can see i wedged a new lang hook between.  That's a little 
unpleasant -- perhaps
   m_passes = new gcc::pass_manager (this);
should be done later? Or the lang dumps could be unnumbered -- it is 
jarring for them to be numbered as-if succeeding the optimization passes.

(I passed m_dumps as a void * purely to avoid header file jiggery pokery 
at this step)

This patch does allow removing special class_dump_file handling from 
c-family/c-opts.c, which is nice.  It looks like -mdump-tree-original 
might be another candidate for dynamic registration?

thoughts?

nathan

-- 
Nathan Sidwell

[-- Attachment #2: lreg.diff --]
[-- Type: text/x-patch, Size: 16080 bytes --]

Index: gcc/c-family/c-opts.c
===================================================================
--- gcc/c-family/c-opts.c	(revision 247990)
+++ gcc/c-family/c-opts.c	(working copy)
@@ -102,8 +102,6 @@ static size_t include_cursor;
 /* Dump files/flags to use during parsing.  */
 static FILE *original_dump_file = NULL;
 static int original_dump_flags;
-static FILE *class_dump_file = NULL;
-static int class_dump_flags;
 
 /* Whether any standard preincluded header has been preincluded.  */
 static bool done_preinclude;
@@ -1098,10 +1096,9 @@ c_common_parse_file (void)
   for (;;)
     {
       c_finish_options ();
-      /* Open the dump files to use for the original and class dump output
+      /* Open the dump files to use for the original output
          here, to be used during parsing for the current file.  */
       original_dump_file = dump_begin (TDI_original, &original_dump_flags);
-      class_dump_file = dump_begin (TDI_class, &class_dump_flags);
       pch_init ();
       push_file_scope ();
       c_parse_file ();
@@ -1120,11 +1117,6 @@ c_common_parse_file (void)
           dump_end (TDI_original, original_dump_file);
           original_dump_file = NULL;
         }
-      if (class_dump_file)
-        {
-          dump_end (TDI_class, class_dump_file);
-          class_dump_file = NULL;
-        }
       /* If an input file is missing, abandon further compilation.
 	 cpplib has issued a diagnostic.  */
       if (!this_input_filename)
@@ -1138,17 +1130,10 @@ c_common_parse_file (void)
 FILE *
 get_dump_info (int phase, int *flags)
 {
-  gcc_assert (phase == TDI_original || phase == TDI_class);
-  if (phase == TDI_original)
-    {
-      *flags = original_dump_flags;
-      return original_dump_file;
-    }
-  else
-    {
-      *flags = class_dump_flags;
-      return class_dump_file;
-    }
+  gcc_assert (phase == TDI_original);
+  
+  *flags = original_dump_flags;
+  return original_dump_file;
 }
 
 /* Common finish hook for the C, ObjC and C++ front ends.  */
Index: gcc/context.c
===================================================================
--- gcc/context.c	(revision 247990)
+++ gcc/context.c	(working copy)
@@ -24,6 +24,8 @@ along with GCC; see the file COPYING3.
 #include "pass_manager.h"
 #include "dumpfile.h"
 #include "realmpfr.h"
+#include "tree.h"
+#include "langhooks.h"
 
 /* The singleton holder of global state: */
 gcc::context *g;
@@ -36,6 +38,8 @@ gcc::context::context ()
      dumps for the various passes), so the dump manager must be set up
      before the pass manager.  */
   m_dumps = new gcc::dump_manager ();
+  /* Allow languages to reguster dumps before passes.  */
+  lang_hooks.register_dumps (m_dumps);
   m_passes = new gcc::pass_manager (this);
 }
 
Index: gcc/cp/class.c
===================================================================
--- gcc/cp/class.c	(revision 247990)
+++ gcc/cp/class.c	(working copy)
@@ -36,6 +36,10 @@ along with GCC; see the file COPYING3.
 #include "dumpfile.h"
 #include "gimplify.h"
 #include "intl.h"
+#include "context.h"
+
+/* ID for dumping the class hierarchy.  */
+static int class_dump_id;
 
 /* The number of nested classes being processed.  If we are not in the
    scope of any class, this is zero.  */
@@ -7733,6 +7737,13 @@ init_class_processing (void)
   ridpointers[(int) RID_PROTECTED] = access_protected_node;
 }
 
+void
+register_class_dump (void *d)
+{
+  class_dump_id = ((gcc::dump_manager *)d)->dump_register
+    (".class", "lang-class", "lang-class", TDF_LANG, OPTGROUP_NONE, false);
+}
+
 /* Restore the cached PREVIOUS_CLASS_LEVEL.  */
 
 static void
@@ -8916,11 +8927,10 @@ static void
 dump_class_hierarchy (tree t)
 {
   int flags;
-  FILE *stream = get_dump_info (TDI_class, &flags);
-
-  if (stream)
+  if (FILE *d = dump_begin (class_dump_id, &flags))
     {
-      dump_class_hierarchy_1 (stream, flags, t);
+      dump_class_hierarchy_1 (d, flags, t);
+      dump_end (class_dump_id, d);
     }
 }
 
@@ -8950,7 +8960,7 @@ static void
 dump_vtable (tree t, tree binfo, tree vtable)
 {
   int flags;
-  FILE *stream = get_dump_info (TDI_class, &flags);
+  FILE *stream = dump_begin (class_dump_id, &flags);
 
   if (!stream)
     return;
@@ -8973,13 +8983,14 @@ dump_vtable (tree t, tree binfo, tree vt
       dump_array (stream, vtable);
       fprintf (stream, "\n");
     }
+  dump_end (class_dump_id, stream);
 }
 
 static void
 dump_vtt (tree t, tree vtt)
 {
   int flags;
-  FILE *stream = get_dump_info (TDI_class, &flags);
+  FILE *stream = dump_begin (class_dump_id, &flags);
 
   if (!stream)
     return;
@@ -8991,6 +9002,7 @@ dump_vtt (tree t, tree vtt)
       dump_array (stream, vtt);
       fprintf (stream, "\n");
     }
+  dump_end (class_dump_id, stream);
 }
 
 /* Dump a function or thunk and its thunkees.  */
Index: gcc/cp/cp-lang.c
===================================================================
--- gcc/cp/cp-lang.c	(revision 247990)
+++ gcc/cp/cp-lang.c	(working copy)
@@ -35,6 +35,7 @@ static tree cp_eh_personality (void);
 static tree get_template_innermost_arguments_folded (const_tree);
 static tree get_template_argument_pack_elems_folded (const_tree);
 static tree cxx_enum_underlying_base_type (const_tree);
+static void cxx_register_dumps (void *);
 
 /* Lang hooks common to C++ and ObjC++ are declared in cp/cp-objcp-common.h;
    consequently, there should be very few hooks below.  */
@@ -43,11 +44,12 @@ static tree cxx_enum_underlying_base_typ
 #define LANG_HOOKS_NAME "GNU C++"
 #undef LANG_HOOKS_INIT
 #define LANG_HOOKS_INIT cxx_init
+#undef LANG_HOOKS_REGISTER_DUMPS
+#define LANG_HOOKS_REGISTER_DUMPS cxx_register_dumps
 #undef LANG_HOOKS_CLASSIFY_RECORD
 #define LANG_HOOKS_CLASSIFY_RECORD cp_classify_record
 #undef LANG_HOOKS_GENERIC_TYPE_P
 #define LANG_HOOKS_GENERIC_TYPE_P class_tmpl_impl_spec_p
-
 #undef LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS
 #define LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS \
 	get_primary_template_innermost_parameters
@@ -229,6 +231,12 @@ tree cxx_enum_underlying_base_type (cons
   return underlying_type;
 }
 
+static void
+cxx_register_dumps (void *d)
+{
+  register_tu_dump (d);
+  register_class_dump (d);
+}
 
 #include "gt-cp-cp-lang.h"
 #include "gtype-cp.h"
Index: gcc/cp/cp-tree.h
===================================================================
--- gcc/cp/cp-tree.h	(revision 247990)
+++ gcc/cp/cp-tree.h	(working copy)
@@ -5973,6 +5973,7 @@ extern tree finish_struct			(tree, tree)
 extern void finish_struct_1			(tree);
 extern int resolves_to_fixed_type_p		(tree, int *);
 extern void init_class_processing		(void);
+extern void register_class_dump			(void *);
 extern int is_empty_class			(tree);
 extern bool is_really_empty_class		(tree);
 extern void pushclass				(tree);
@@ -6223,6 +6224,7 @@ extern int parm_index
 extern tree vtv_start_verification_constructor_init_function (void);
 extern tree vtv_finish_verification_constructor_init_function (tree);
 extern bool cp_omp_mappable_type		(tree);
+extern void register_tu_dump			(void *);
 
 /* in error.c */
 extern const char *type_as_string		(tree, int);
Index: gcc/cp/decl2.c
===================================================================
--- gcc/cp/decl2.c	(revision 247990)
+++ gcc/cp/decl2.c	(working copy)
@@ -4351,6 +4351,17 @@ generate_mangling_aliases ()
   defer_mangling_aliases = false;
 }
 
+/* ID for dumping the raw trees.  */
+static int tu_dump_id;
+
+void
+register_tu_dump (void *d)
+{
+  tu_dump_id = ((gcc::dump_manager *)d)->dump_register
+    (".tu", "lang-translation", "lang-translation",
+     TDF_LANG, OPTGROUP_NONE, false);
+}
+
 /* The entire file is now complete.  If requested, dump everything
    to a file.  */
 
@@ -4358,12 +4369,10 @@ static void
 dump_tu (void)
 {
   int flags;
-  FILE *stream = dump_begin (TDI_tu, &flags);
-
-  if (stream)
+  if (FILE *stream = dump_begin (tu_dump_id, &flags))
     {
       dump_node (global_namespace, flags & ~TDF_SLIM, stream);
-      dump_end (TDI_tu, stream);
+      dump_end (tu_dump_id, stream);
     }
 }
 
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 247990)
+++ gcc/doc/invoke.texi	(working copy)
@@ -540,14 +540,15 @@ Objective-C and Objective-C++ Dialects}.
 -fdisable-tree-@var{pass_name} @gol
 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
 -fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links @gol
--fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
 -fdump-final-insns@r{[}=@var{file}@r{]}
 -fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline @gol
 -fdump-lang-all @gol
+-fdump-lang-@var{switch} @gol
+-fdump-lang-@var{switch}-@var{options} @gol
+-fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
 -fdump-passes @gol
 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
 -fdump-statistics @gol
--fdump-translation-unit@r{[}-@var{n}@r{]} @gol
 -fdump-tree-all @gol
 -fdump-tree-@var{switch} @gol
 -fdump-tree-@var{switch}-@var{options} @gol
@@ -12944,16 +12945,6 @@ When doing debugging dumps (see @option{
 instruction numbers for the links to the previous and next instructions
 in a sequence.
 
-@item -fdump-class-hierarchy @r{(C++ only)}
-@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
-@opindex fdump-class-hierarchy
-Dump a representation of each class's hierarchy and virtual function
-table layout to a file.  The file name is made by appending
-@file{.class} to the source file name, and the file is created in the
-same directory as the output file.  If the @samp{-@var{options}} form
-is used, @var{options} controls the details of the dump as described
-for the @option{-fdump-tree} options.
-
 @item -fdump-ipa-@var{switch}
 @opindex fdump-ipa
 Control the dumping at various stages of inter-procedural analysis
@@ -12981,8 +12972,19 @@ Dump language-specific information.  The
 @file{.lang} to the source file name.  Currently used for C++ modules.
 
 @item -fdump-lang-all
+@itemx -fdump-lang-@var{switch}
+@itemx -fdump-lang-@var{switch}-@var{options}
+@itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
 @opindex fdump-lang-all
-Control the dumping of language-specific information.
+@opindex fdump-lang
+Control the dumping of language-specific information.  The file name is
+generated by appending a switch-specific suffix to the source file name,
+and the file is created in the same directory as the output file. In
+case of @option{=@var{filename}} option, the dump is output on the given
+file instead of the auto named dump files.  If the @samp{-@var{options}}
+form is used, @var{options} is a list of @samp{-} separated options
+which control the details of the dump.  Not all options are applicable
+to all dumps; those that are not meaningful are ignored.
 
 @item -fdump-passes
 @opindex fdump-passes
@@ -13000,16 +13002,6 @@ whole compilation unit while @samp{-deta
 the passes generate them.  The default with no option is to sum
 counters for each function compiled.
 
-@item -fdump-translation-unit @r{(C++ only)}
-@itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
-@opindex fdump-translation-unit
-Dump a representation of the tree structure for the entire translation
-unit to a file.  The file name is made by appending @file{.tu} to the
-source file name, and the file is created in the same directory as the
-output file.  If the @samp{-@var{options}} form is used, @var{options}
-controls the details of the dump as described for the
-@option{-fdump-tree} options.
-
 @item -fdump-tree-all
 @itemx -fdump-tree-@var{switch}
 @itemx -fdump-tree-@var{switch}-@var{options}
Index: gcc/dumpfile.c
===================================================================
--- gcc/dumpfile.c	(revision 247990)
+++ gcc/dumpfile.c	(working copy)
@@ -52,7 +52,7 @@ int dump_flags;
 static struct dump_file_info dump_files[TDI_end] =
 {
   {NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, false, false},
-  {".lang", "lang", NULL, NULL, NULL, NULL, NULL, TDF_LANG,
+  {".langg", "langg", NULL, NULL, NULL, NULL, NULL, TDF_LANG,
    OPTGROUP_OTHER, 0, 0, 0, -1, false, false},
   {".cgraph", "ipa-cgraph", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
    0, 0, 0, 0, 0, false, false},
@@ -60,17 +60,13 @@ static struct dump_file_info dump_files[
    0, 0, 0, 0, 0, false, false},
   {".ipa-clones", "ipa-clones", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
    0, 0, 0, 0, 0, false, false},
-  {".tu", "translation-unit", NULL, NULL, NULL, NULL, NULL, TDF_LANG,
-   0, 0, 0, 0, 1, false, false},
-  {".class", "class-hierarchy", NULL, NULL, NULL, NULL, NULL, TDF_LANG,
-   0, 0, 0, 0, 2, false, false},
   {".original", "tree-original", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
    0, 0, 0, 0, 3, false, false},
   {".gimple", "tree-gimple", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
    0, 0, 0, 0, 4, false, false},
   {".nested", "tree-nested", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
    0, 0, 0, 0, 5, false, false},
-#define FIRST_AUTO_NUMBERED_DUMP 6
+#define FIRST_AUTO_NUMBERED_DUMP 4
 
   {NULL, "lang-all", NULL, NULL, NULL, NULL, NULL, TDF_LANG,
    0, 0, 0, 0, 0, false, false},
Index: gcc/dumpfile.h
===================================================================
--- gcc/dumpfile.h	(revision 247990)
+++ gcc/dumpfile.h	(working copy)
@@ -31,8 +31,6 @@ enum tree_dump_index
   TDI_cgraph,                   /* dump function call graph.  */
   TDI_inheritance,              /* dump type inheritance graph.  */
   TDI_clones,			/* dump IPA cloning decisions.  */
-  TDI_tu,			/* dump the whole translation unit.  */
-  TDI_class,			/* dump class hierarchy.  */
   TDI_original,			/* dump each function before optimizing it */
   TDI_generic,			/* dump each function after genericizing it */
   TDI_nested,			/* dump each function after unnesting it */
Index: gcc/langhooks-def.h
===================================================================
--- gcc/langhooks-def.h	(revision 247990)
+++ gcc/langhooks-def.h	(working copy)
@@ -65,6 +65,7 @@ extern tree lhd_enum_underlying_base_typ
 
 /* Declarations of default tree inlining hooks.  */
 extern void lhd_initialize_diagnostics (diagnostic_context *);
+extern void lhd_register_dumps (void *);
 extern void lhd_init_options (unsigned int,
 			      struct cl_decoded_option *);
 extern bool lhd_complain_wrong_lang_p (const struct cl_option *);
@@ -97,6 +98,7 @@ extern int lhd_type_dwarf_attribute (con
 #define LANG_HOOKS_INIT_OPTIONS_STRUCT	hook_void_gcc_optionsp
 #define LANG_HOOKS_INIT_OPTIONS		lhd_init_options
 #define LANG_HOOKS_INITIALIZE_DIAGNOSTICS lhd_initialize_diagnostics
+#define LANG_HOOKS_REGISTER_DUMPS	lhd_register_dumps
 #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lhd_complain_wrong_lang_p
 #define LANG_HOOKS_HANDLE_OPTION	lhd_handle_option
 #define LANG_HOOKS_POST_OPTIONS		lhd_post_options
@@ -294,6 +296,7 @@ extern void lhd_end_section (void);
   LANG_HOOKS_INIT_OPTIONS_STRUCT, \
   LANG_HOOKS_INIT_OPTIONS, \
   LANG_HOOKS_INITIALIZE_DIAGNOSTICS, \
+  LANG_HOOKS_REGISTER_DUMPS, \
   LANG_HOOKS_COMPLAIN_WRONG_LANG_P, \
   LANG_HOOKS_HANDLE_OPTION, \
   LANG_HOOKS_POST_OPTIONS, \
Index: gcc/langhooks.c
===================================================================
--- gcc/langhooks.c	(revision 247990)
+++ gcc/langhooks.c	(working copy)
@@ -322,6 +322,12 @@ lhd_initialize_diagnostics (diagnostic_c
 {
 }
 
+/* Called to register language-specific dumps.  */
+void
+lhd_register_dumps (void *)
+{
+}
+
 /* Called to perform language-specific options initialization.  */
 void
 lhd_init_options (unsigned int decoded_options_count ATTRIBUTE_UNUSED,
Index: gcc/langhooks.h
===================================================================
--- gcc/langhooks.h	(revision 247990)
+++ gcc/langhooks.h	(working copy)
@@ -326,6 +326,9 @@ struct lang_hooks
      global diagnostic context structure.  */
   void (*initialize_diagnostics) (diagnostic_context *);
 
+  /* Callback to register langage-specific dumps.  */
+  void (*register_dumps) (void *);
+
   /* Return true if a warning should be given about option OPTION,
      which is for the wrong language, false if it should be quietly
      ignored.  */

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

* Re: [RFC] Do we want hierarchical options & encapsulation in a class
  2017-05-15  9:47           ` [RFC] Do we want hierarchical options & encapsulation in a class Martin Liška
  2017-05-15 11:26             ` Nathan Sidwell
@ 2017-05-15 11:46             ` Nathan Sidwell
  2017-05-15 12:05               ` Martin Liška
  1 sibling, 1 reply; 54+ messages in thread
From: Nathan Sidwell @ 2017-05-15 11:46 UTC (permalink / raw)
  To: Martin Liška, Richard Biener; +Cc: GCC Patches, Martin Sebor

Martin,
thanks for the write up.

On 05/15/2017 05:39 AM, Martin Liška wrote:
> Thanks Martin for feedback! After I spent quite some time with fiddling with > the options, I'm not convinced we should convert options to more 
hierarchical> structure. There's description:
> 1) -fopt-info is used to dump optimization options. One can pick both verbosity
> (note, optimization, all) and an optimization (ipa, inline, vec,...). Thus said
> it's probably not a candidate for hierarchical options?

I've never used this option, so have no comment (too lazy to figure out 
if it told me anything I didn't already see in a dump I was groveling over).

> 2) -fdump-pass_name-... as mentioned by Nathan is combination of verbosity
> (graph, note, verbose, details) and specific type of options (VOPS, RHS_ONLY, UID,..).
> 
> There's a complete list and suggestion how we can move it to more hierarchical ordering:
> 
> #define TDF_ADDRESS
> #define TDF_SLIM
> #define TDF_RAW
> #define TDF_DETAILS
> #define TDF_STATS
> #define TDF_BLOCKS
> #define TDF_VOPS
> #define TDF_LINENO
> #define TDF_UID
#define TDF_LANG is now a thing too. it should be DI_kind too
> #define TDF_TREE - remove & replace with DI_kind
> #define TDF_RTL - remove & replace with DI_kind
> #define TDF_IPA - remove & replace with DI_kind
> #define TDF_STMTADDR - merge with TDF_ADDRESS
> #define TDF_GRAPH
> #define TDF_MEMSYMS
> #define TDF_DIAGNOSTIC - merge with TDF_DETAILS
> #define TDF_VERBOSE - merge with TDF_DETAILS
> #define TDF_RHS_ONLY
> #define TDF_ASMNAME
> #define TDF_EH
> #define TDF_NOUID
> #define TDF_ALIAS
> #define TDF_ENUMERATE_LOCALS
> #define TDF_CSELIB
> #define TDF_SCEV
> #define TDF_COMMENT - remove and dump ';; ' unconditionally
> #define TDF_GIMPLE

Looks a good start.

1) The TDF_UID and TDF_NOUID options seem to be inverses of each other. 
Can't we just ditch the latter?

2) We might want to distinguish between enabling dump information that 
is useful to us gcc developers (TDF_DETAILS, say), and that that would 
be useful to end users trying to figure out why some random loop isn't 
being optimized in (say TDF_DIAGNOSTIC).  But if we can't define a 
sensible way of distinguishing then I'm all for not making the distinction.

> and more hierarchical ordering can be:
> 
> #define TDF_ADDRESS
> #define TDF_SLIM
> #define TDF_RAW
> #define TDF_DETAILS
> #define TDF_STATS
> #define TDF_BLOCKS
> #define TDF_LINENO
> #define TDF_UID
> #define TDF_GRAPH
> #define TDF_ASMNAME
> #define TDF_NOUID
> #define TDF_ENUMERATE_LOCALS

It'd be nice to name TDF_ENUMERATE_LOCALS without the second _ to avoid 
confusion with the hierarchy you discuss below?  (perhaps TDF_LOCALS?)

I like the idea of naming flags specific to a particular kind of dump 
with the name of that kind of dump.  We do have a mismatch between 
DI_TREE and TDF_GIMPLE though -- is there something sensible we could do 
there?

> #define TDF_GIMPLE
> #define TDF_GIMPLE_FE - GIMPLE front-end

How might this differ from a new  -fdump-lang-original?  I.e.
(1) why is it a dump-modifier flag, rather than a dump in its own right
(2) if we do need it, name it TDF_GIMPLE_LANG

> #define TDF_GIMPLE_VOPS
> #define TDF_GIMPLE_EH
> #define TDF_GIMPLE_ALIAS
> #define TDF_GIMPLE_SCEV
> #define TDF_GIMPLE_MEMSYMS
> #define TDF_GIMPLE_RHS_ONLY
> 
> #define TDF_RTL

How does this differ from the current TDF_RTL meaning?  Is it implying 
'TDF_RTL_ALL'? (same question about TDF_GIMPLE).

> #define TDF_RTL_CSELIB

nathan
-- 
Nathan Sidwell

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

* Re: [RFC] Do we want hierarchical options & encapsulation in a class
  2017-05-15 11:46             ` Nathan Sidwell
@ 2017-05-15 12:05               ` Martin Liška
  2017-05-15 12:43                 ` Nathan Sidwell
  0 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-15 12:05 UTC (permalink / raw)
  To: Nathan Sidwell, Richard Biener; +Cc: GCC Patches, Martin Sebor

On 05/15/2017 01:33 PM, Nathan Sidwell wrote:
> Martin,
> thanks for the write up.
> 
> On 05/15/2017 05:39 AM, Martin Liška wrote:
>> Thanks Martin for feedback! After I spent quite some time with fiddling with > the options, I'm not convinced we should convert options to more 
> hierarchical> structure. There's description:
>> 1) -fopt-info is used to dump optimization options. One can pick both verbosity
>> (note, optimization, all) and an optimization (ipa, inline, vec,...). Thus said
>> it's probably not a candidate for hierarchical options?
> 
> I've never used this option, so have no comment (too lazy to figure out if it told me anything I didn't already see in a dump I was groveling over).

Hi.

Thanks for feedback, I'll mention -fopt-info later in this email.

> 
>> 2) -fdump-pass_name-... as mentioned by Nathan is combination of verbosity
>> (graph, note, verbose, details) and specific type of options (VOPS, RHS_ONLY, UID,..).
>>
>> There's a complete list and suggestion how we can move it to more hierarchical ordering:
>>
>> #define TDF_ADDRESS
>> #define TDF_SLIM
>> #define TDF_RAW
>> #define TDF_DETAILS
>> #define TDF_STATS
>> #define TDF_BLOCKS
>> #define TDF_VOPS
>> #define TDF_LINENO
>> #define TDF_UID
> #define TDF_LANG is now a thing too. it should be DI_kind too
>> #define TDF_TREE - remove & replace with DI_kind
>> #define TDF_RTL - remove & replace with DI_kind
>> #define TDF_IPA - remove & replace with DI_kind
>> #define TDF_STMTADDR - merge with TDF_ADDRESS
>> #define TDF_GRAPH
>> #define TDF_MEMSYMS
>> #define TDF_DIAGNOSTIC - merge with TDF_DETAILS
>> #define TDF_VERBOSE - merge with TDF_DETAILS
>> #define TDF_RHS_ONLY
>> #define TDF_ASMNAME
>> #define TDF_EH
>> #define TDF_NOUID
>> #define TDF_ALIAS
>> #define TDF_ENUMERATE_LOCALS
>> #define TDF_CSELIB
>> #define TDF_SCEV
>> #define TDF_COMMENT - remove and dump ';; ' unconditionally
>> #define TDF_GIMPLE
> 
> Looks a good start.
> 
> 1) The TDF_UID and TDF_NOUID options seem to be inverses of each other. Can't we just ditch the latter?

One is used to paper over UIDs in order to preserve -fdebug-compare (I believe). And the second one
is used to dump UIDd basically for *_DECL. As any of these is not default, both make sense.

> 
> 2) We might want to distinguish between enabling dump information that is useful to us gcc developers (TDF_DETAILS, say), and that that would be useful to end users trying to figure out why some random loop isn't being optimized in (say TDF_DIAGNOSTIC).  But if we can't define a sensible way of distinguishing then I'm all for not making the distinction.

That's probably motivation behind -fopt-info, which should represent "Optimization dumps", readable by user.
To be honest, just a part of optimizations can be found in these files (vectorization and loop optimization).
The rest lives in normal -fdump-xyz*. Maybe this can be opportunity to clean it up?

> 
>> and more hierarchical ordering can be:
>>
>> #define TDF_ADDRESS
>> #define TDF_SLIM
>> #define TDF_RAW
>> #define TDF_DETAILS
>> #define TDF_STATS
>> #define TDF_BLOCKS
>> #define TDF_LINENO
>> #define TDF_UID
>> #define TDF_GRAPH
>> #define TDF_ASMNAME
>> #define TDF_NOUID
>> #define TDF_ENUMERATE_LOCALS
> 
> It'd be nice to name TDF_ENUMERATE_LOCALS without the second _ to avoid confusion with the hierarchy you discuss below?  (perhaps TDF_LOCALS?)

Yep, works for me.

> 
> I like the idea of naming flags specific to a particular kind of dump with the name of that kind of dump.  We do have a mismatch between DI_TREE and TDF_GIMPLE though -- is there something sensible we could do there?
> 
>> #define TDF_GIMPLE
>> #define TDF_GIMPLE_FE - GIMPLE front-end

As we have couple of dump flags used just for GIMPLE dumps, my idea was to give them common predecessor (TDF_GIMPLE).
Which explains why current TDF_GIMPLE (GIMPLE FE) needs to be renamed.
> 
> How might this differ from a new  -fdump-lang-original?  I.e.
> (1) why is it a dump-modifier flag, rather than a dump in its own right

Because you can use it for all gimple/tree passes to produce input for GIMPLE FE.

> (2) if we do need it, name it TDF_GIMPLE_LANG

Can be done that.

> 
>> #define TDF_GIMPLE_VOPS
>> #define TDF_GIMPLE_EH
>> #define TDF_GIMPLE_ALIAS
>> #define TDF_GIMPLE_SCEV
>> #define TDF_GIMPLE_MEMSYMS
>> #define TDF_GIMPLE_RHS_ONLY
>>
>> #define TDF_RTL
> 
> How does this differ from the current TDF_RTL meaning?  Is it implying 'TDF_RTL_ALL'? (same question about TDF_GIMPLE).

Yes, -fdump-tree-xyz-rtl would be equal to -fdump-tree-xyz-rtl-all.

Martin

> 
>> #define TDF_RTL_CSELIB
> 
> nathan

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

* Re: [RFC] Do we want hierarchical options & encapsulation in a class
  2017-05-15 11:26             ` Nathan Sidwell
@ 2017-05-15 12:24               ` Martin Liška
  0 siblings, 0 replies; 54+ messages in thread
From: Martin Liška @ 2017-05-15 12:24 UTC (permalink / raw)
  To: Nathan Sidwell, Richard Biener; +Cc: GCC Patches, Martin Sebor

On 05/15/2017 01:18 PM, Nathan Sidwell wrote:
> On 05/15/2017 05:39 AM, Martin Liška wrote:
>> Thanks Martin for feedback! After I spent quite some time with fiddling with
>> the options, I'm not convinced we should convert options to more hierarchical
> 
> I'll respond to Martin's email properly separates, but while we're on dump redesign, here's a WIP patch I whipped up on Friday for the modules branch.  This tries to move the language-specific options to a dynamic registration mechanism, rather than hard wire them into dumpfile.[hc]. There were some awkward pieces due to the current structure of dumpfile registration.
> 
> I took the -fdump-class-heirachy and -fdump-translation-unit and turned them into -fdump-lang-class and -fdump-lang-translation.  Unfortunately the current LANG_HOOKS_INIT_OPTIONS is run rather too late to register these dumps so that they get nice low numbers.  That's because gcc::context::context () both creates the dump manager and then immediately creates all the optimization passes:
>   m_dumps = new gcc::dump_manager ();
>   /* Allow languages to register dumps before passes.  */
>   lang_hooks.register_dumps (m_dumps);
>   m_passes = new gcc::pass_manager (this);
> 
> As you can see i wedged a new lang hook between.  That's a little unpleasant -- perhaps
>   m_passes = new gcc::pass_manager (this);
> should be done later? Or the lang dumps could be unnumbered -- it is jarring for them to be numbered as-if succeeding the optimization passes.
> 
> (I passed m_dumps as a void * purely to avoid header file jiggery pokery at this step)
> 
> This patch does allow removing special class_dump_file handling from c-family/c-opts.c, which is nice.  It looks like -mdump-tree-original might be another candidate for dynamic registration?
> 
> thoughts?

Hello.

I like the idea and I believe we should do the same with single use (in a particular pass) dump files like:

  dump_file_info (".cgraph", "ipa-cgraph", DK_ipa, 0),
  dump_file_info (".type-inheritance", "ipa-type-inheritance", DK_ipa, 0),
  dump_file_info (".ipa-clones", "ipa-clones", DK_ipa, 0),
  dump_file_info (".tu", "translation-unit", DK_lang, 1),
  dump_file_info (".class", "class-hierarchy", DK_lang, 2),
  dump_file_info (".original", "tree-original", DK_tree, 3),
  dump_file_info (".gimple", "tree-gimple", DK_tree, 4),
  dump_file_info (".nested", "tree-nested", DK_tree, 5),

Martin

> 
> nathan
> 

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

* Re: [RFC] Do we want hierarchical options & encapsulation in a class
  2017-05-15 12:05               ` Martin Liška
@ 2017-05-15 12:43                 ` Nathan Sidwell
  2017-05-15 13:50                   ` Martin Liška
  0 siblings, 1 reply; 54+ messages in thread
From: Nathan Sidwell @ 2017-05-15 12:43 UTC (permalink / raw)
  To: Martin Liška, Richard Biener; +Cc: GCC Patches, Martin Sebor

On 05/15/2017 08:04 AM, Martin Liška wrote:
> On 05/15/2017 01:33 PM, Nathan Sidwell wrote:

>> 1) The TDF_UID and TDF_NOUID options seem to be inverses of each other. Can't we just ditch the latter?
> 
> One is used to paper over UIDs in order to preserve -fdebug-compare (I believe). And the second one
> is used to dump UIDd basically for *_DECL. As any of these is not default, both make sense.

Might I suggest we rename at least one of them then?

>> How does this differ from the current TDF_RTL meaning?  Is it implying 'TDF_RTL_ALL'? (same question about TDF_GIMPLE).
> 
> Yes, -fdump-tree-xyz-rtl would be equal to -fdump-tree-xyz-rtl-all.

I wonder if we can name things to be a little clearer?  Here you're 
applying an rtl modifier to a tree dump.  I find that jarring, given we 
have rtl dumps themselves. (I don't have a good suggestion right now).

Given a blank sheet of paper, the current 'TDF_tree' dumps should really 
be 'TDF_gimple' dumps, so we'd have lang/ipa/gimple/rtl kinds of dumps. 
Such a renaming may be an unacceptable amount of churn though.

nathan

-- 
Nathan Sidwell

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

* Re: [RFC] Do we want hierarchical options & encapsulation in a class
  2017-05-15 12:43                 ` Nathan Sidwell
@ 2017-05-15 13:50                   ` Martin Liška
  2017-05-15 14:13                     ` Nathan Sidwell
  0 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-15 13:50 UTC (permalink / raw)
  To: Nathan Sidwell, Richard Biener; +Cc: GCC Patches, Martin Sebor

On 05/15/2017 02:24 PM, Nathan Sidwell wrote:
> On 05/15/2017 08:04 AM, Martin Liška wrote:
>> On 05/15/2017 01:33 PM, Nathan Sidwell wrote:
> 
>>> 1) The TDF_UID and TDF_NOUID options seem to be inverses of each other. Can't we just ditch the latter?
>>
>> One is used to paper over UIDs in order to preserve -fdebug-compare (I believe). And the second one
>> is used to dump UIDd basically for *_DECL. As any of these is not default, both make sense.
> 
> Might I suggest we rename at least one of them then?

Yep, it's doable.

> 
>>> How does this differ from the current TDF_RTL meaning?  Is it implying 'TDF_RTL_ALL'? (same question about TDF_GIMPLE).
>>
>> Yes, -fdump-tree-xyz-rtl would be equal to -fdump-tree-xyz-rtl-all.
> 
> I wonder if we can name things to be a little clearer?  Here you're applying an rtl modifier to a tree dump.  I find that jarring, given we have rtl dumps themselves. (I don't have a good suggestion right now).

Sorry, that's confusing example.

> 
> Given a blank sheet of paper, the current 'TDF_tree' dumps should really be 'TDF_gimple' dumps, so we'd have lang/ipa/gimple/rtl kinds of dumps. Such a renaming may be an unacceptable amount of churn though.

Well, I would prefer to introduce new enum for kind of dump:
https://gcc.gnu.org/ml/gcc-patches/2017-05/msg01033.html

and TDF_GIMPLE_* would really reflect to a dump suboption which is used by GIMPLE pretty printer related functions.

Martin

> 
> nathan
> 

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

* Re: [RFC] Do we want hierarchical options & encapsulation in a class
  2017-05-15 13:50                   ` Martin Liška
@ 2017-05-15 14:13                     ` Nathan Sidwell
  2017-05-15 14:24                       ` Martin Liška
  0 siblings, 1 reply; 54+ messages in thread
From: Nathan Sidwell @ 2017-05-15 14:13 UTC (permalink / raw)
  To: Martin Liška, Richard Biener; +Cc: GCC Patches, Martin Sebor

On 05/15/2017 09:06 AM, Martin Liška wrote:

>> Given a blank sheet of paper, the current 'TDF_tree' dumps should really be 'TDF_gimple' dumps, so we'd have lang/ipa/gimple/rtl kinds of dumps. Such a renaming may be an unacceptable amount of churn though.
> 
> Well, I would prefer to introduce new enum for kind of dump:
> https://gcc.gnu.org/ml/gcc-patches/2017-05/msg01033.html

Right, I understand that.  My point is that it might be confusing to 
users of the dump machinery (i.e. me), at the command-line level where 
'rtl' means different things in different contexts.  And we have 'tree' 
dumps that dump gimple and 'lang' dumps that also (can) dump trees.

We have a bunch of gimple optimization passes, but call the dumpers 
'tree'.  I know how we ended up here, but it seems confusing.

nathan

-- 
Nathan Sidwell

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

* Re: [RFC] Do we want hierarchical options & encapsulation in a class
  2017-05-15 14:13                     ` Nathan Sidwell
@ 2017-05-15 14:24                       ` Martin Liška
  2017-05-16 13:44                         ` Richard Biener
  0 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-15 14:24 UTC (permalink / raw)
  To: Nathan Sidwell, Richard Biener; +Cc: GCC Patches, Martin Sebor

On 05/15/2017 04:12 PM, Nathan Sidwell wrote:
> On 05/15/2017 09:06 AM, Martin Liška wrote:
> 
>>> Given a blank sheet of paper, the current 'TDF_tree' dumps should really be 'TDF_gimple' dumps, so we'd have lang/ipa/gimple/rtl kinds of dumps. Such a renaming may be an unacceptable amount of churn though.
>>
>> Well, I would prefer to introduce new enum for kind of dump:
>> https://gcc.gnu.org/ml/gcc-patches/2017-05/msg01033.html
> 
> Right, I understand that.  My point is that it might be confusing to users of the dump machinery (i.e. me), at the command-line level where 'rtl' means different things in different contexts.  And we have 'tree' dumps that dump gimple and 'lang' dumps that also (can) dump trees.

Right. To be honest, originally I was convinced about positive impact of hierarchical options. But changing names of dump suboptions will bring
inconvenience for current developers of GCC (who mainly use it). And I also noticed that one can write -fdump-tree-ifcvt-stats-blocks-details,
a combination of multiple suboptions. Which makes it even more complex :)

That said, I'm not inclining to that. Then it's questionable whether to encapsulate masking enum to a class?

Martin

> 
> We have a bunch of gimple optimization passes, but call the dumpers 'tree'.  I know how we ended up here, but it seems confusing.
> 
> nathan
> 

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

* Re: [RFC] Do we want hierarchical options & encapsulation in a class
  2017-05-15 14:24                       ` Martin Liška
@ 2017-05-16 13:44                         ` Richard Biener
  0 siblings, 0 replies; 54+ messages in thread
From: Richard Biener @ 2017-05-16 13:44 UTC (permalink / raw)
  To: Martin Liška; +Cc: Nathan Sidwell, GCC Patches, Martin Sebor

On Mon, May 15, 2017 at 4:21 PM, Martin Liška <mliska@suse.cz> wrote:
> On 05/15/2017 04:12 PM, Nathan Sidwell wrote:
>> On 05/15/2017 09:06 AM, Martin Liška wrote:
>>
>>>> Given a blank sheet of paper, the current 'TDF_tree' dumps should really be 'TDF_gimple' dumps, so we'd have lang/ipa/gimple/rtl kinds of dumps. Such a renaming may be an unacceptable amount of churn though.
>>>
>>> Well, I would prefer to introduce new enum for kind of dump:
>>> https://gcc.gnu.org/ml/gcc-patches/2017-05/msg01033.html
>>
>> Right, I understand that.  My point is that it might be confusing to users of the dump machinery (i.e. me), at the command-line level where 'rtl' means different things in different contexts.  And we have 'tree' dumps that dump gimple and 'lang' dumps that also (can) dump trees.
>
> Right. To be honest, originally I was convinced about positive impact of hierarchical options. But changing names of dump suboptions will bring
> inconvenience for current developers of GCC (who mainly use it). And I also noticed that one can write -fdump-tree-ifcvt-stats-blocks-details,
> a combination of multiple suboptions. Which makes it even more complex :)
>
> That said, I'm not inclining to that. Then it's questionable whether to encapsulate masking enum to a class?

So replying to the last mail in this thread.

Originally the motivation was to get more bits when we disallow some
flags for some categories (lang, tree, rtl, ipa).  Now given
that we have 32bits free and that Nathans TDF_lang stuff should add
missing hierarchy the only user-visible change I'd do is
to disallow for example

-fdump-rtl-vops

or

-fdump-tree-note

with a diagnostic.  That allows us to allocate overlapping bits.  Like
if we move TDF_* to a .def file and have

DEFFLAG(EH, GIMPLE|RTL)
DEFFLAG(NOTE, INFO)
DEFFLAG(SCEV, GIMPLE)

etc. and some "intelligent" generator that allocates the bits.

Now, given we have 32bit free the pressure to do this is quite low
(and I usally dislike changes that are just there
for the sake of changes).

Given the introduction of -lang, which I appreciate, there's the
opportunity to do better than currently, esp. with
respect to maintainance of dump flags and the machinery.

I realize this doesn't really answer whether we want a class or a enum
or a uint64_t for dump_flags.  A class would
be most forward-looking.  An enum for the bit number then works well
(I dislike "sparse" enums), so operator|, etc.
would do the missing 1<<

Richard.

> Martin
>
>>
>> We have a bunch of gimple optimization passes, but call the dumpers 'tree'.  I know how we ended up here, but it seems confusing.
>>
>> nathan
>>
>

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

* Re: [PATCH v2 01/N] Add default value for last argument of dump functions.
  2017-05-12 13:01               ` [PATCH v2 01/N] Add default value for last argument of dump functions Martin Liška
@ 2017-05-16 13:49                 ` Richard Biener
  0 siblings, 0 replies; 54+ messages in thread
From: Richard Biener @ 2017-05-16 13:49 UTC (permalink / raw)
  To: Martin Liška; +Cc: Trevor Saunders, GCC Patches

On Fri, May 12, 2017 at 2:57 PM, Martin Liška <mliska@suse.cz> wrote:
> Hello.
>
> After fiddling with that, I decided to come up with reworked first part
> of the patch and eventual translation to a more hierarchical structure
> is subject for discussion.
>
> This first patch adds default for couple of dump functions and it helps in future
> to transform 0 to a TDF_NONE (or whatever we call it).
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?

Works for me.

Thanks,
Richard.

> Martin

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

* Re: [PATCH v2 2/N] Introduce dump_flags_t type and use it instead of int, type.
  2017-05-12 13:04               ` [PATCH v2 2/N] Introduce dump_flags_t type and use it instead of int, type Martin Liška
@ 2017-05-16 13:50                 ` Richard Biener
  2017-05-16 14:56                   ` Martin Liška
  0 siblings, 1 reply; 54+ messages in thread
From: Richard Biener @ 2017-05-16 13:50 UTC (permalink / raw)
  To: Martin Liška; +Cc: Trevor Saunders, GCC Patches

On Fri, May 12, 2017 at 3:00 PM, Martin Liška <mliska@suse.cz> wrote:
> Second part changes 'int flags' to a new typedef.
> All corresponding interfaces have been changed.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?

@@ -113,6 +114,14 @@ enum tree_dump_index
 #define OPTGROUP_ALL        (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \
                              | OPTGROUP_OMP | OPTGROUP_VEC | OPTGROUP_OTHER)

+/* Dump flags type.  */
+
+typedef uint64_t dump_flags_t;
+
+/* Dump flags type.  */
+
+typedef uint64_t dump_flags_t;
+

duplicate.

+#define TDF_NONE 0

this now seems to "conflict" with

#define TDF_LANG        0       /* is a lang-specific dump.  */

?

that is, TDF_RTL | TDF_NONE would still be "none" conceptually ...

Ok with the duplicate typedef removed.

Thanks,
Richard.

> Martin

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

* [PATCH v2 04/N] Simplify usage of some TDF_* flags.
  2017-05-06 15:04             ` Trevor Saunders
                                 ` (2 preceding siblings ...)
  2017-05-12 13:30               ` [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum Martin Liška
@ 2017-05-16 13:55               ` Martin Liška
  2017-05-17 12:37                 ` Richard Biener
  2017-05-24 11:04               ` [PATCH v2 05/N] Add -fdump*-folding suboption Martin Liška
  4 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-16 13:55 UTC (permalink / raw)
  To: Trevor Saunders, Richard Biener; +Cc: GCC Patches

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

There's one another patch that merges some TDF_* flags that have
very similar meaning and do not influence test-suite, because
nobody is using them for scanning.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

[-- Attachment #2: 0004-Simplify-usage-of-some-TDF_-flags.patch --]
[-- Type: text/x-patch, Size: 13900 bytes --]

From d75cc6896b1041042c4aea316c67fbe47265f30d Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 12 May 2017 15:55:24 +0200
Subject: [PATCH 4/4] Simplify usage of some TDF_* flags.

gcc/ChangeLog:

2017-05-12  Martin Liska  <mliska@suse.cz>

	* cfg.c (check_bb_profile): Do not use TDF_COMMENT and print
	always leading ';; '.
	(dump_bb_info): Likewise.
	(brief_dump_cfg): Likewise.
	* cfgrtl.c (print_rtl_with_bb): Do not use TDF_COMMENT.
	* dumpfile.c: Remove usage of TDF_STMTADDR and TDF_VERBOSE.
	* dumpfile.h (enum dump_kind): Likewise.
	* gimple-pretty-print.c (pp_gimple_stmt_1): Change TDF_STMTADDR
	to TDF_ADDRESS.
	(dump_gimple_bb_header): Do not use TDF_COMMENT.
	* print-tree.c (debug_verbose): Remove.
	* tree-cfg.c (gimple_dump_cfg): Do not use TDF_COMMENT.
	(dump_function_to_file): Replace TDF_VERBOSE with TDF_DETAILS.
	* tree-diagnostic.c (default_tree_printer): Replace
	TDF_DIAGNOSTIC with TDF_SLIM.
	* tree-pretty-print.c (dump_generic_node): Change TDF_STMTADDR
	to TDF_ADDRESS.
---
 gcc/cfg.c                 | 56 +++++++++++++++++++----------------------------
 gcc/cfgrtl.c              |  4 ++--
 gcc/dumpfile.c            |  5 +----
 gcc/dumpfile.h            |  7 ------
 gcc/gimple-pretty-print.c |  5 ++---
 gcc/print-tree.c          | 15 -------------
 gcc/tree-cfg.c            | 10 ++++-----
 gcc/tree-diagnostic.c     |  3 +--
 gcc/tree-pretty-print.c   |  2 +-
 9 files changed, 35 insertions(+), 72 deletions(-)

diff --git a/gcc/cfg.c b/gcc/cfg.c
index ffac69f266d..aef053f5d22 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -396,7 +396,7 @@ clear_bb_flags (void)
    It is still practical to have them reported for debugging of simple
    testcases.  */
 static void
-check_bb_profile (basic_block bb, FILE * file, int indent, dump_flags_t flags)
+check_bb_profile (basic_block bb, FILE * file, int indent)
 {
   edge e;
   int sum = 0;
@@ -425,17 +425,17 @@ check_bb_profile (basic_block bb, FILE * file, int indent, dump_flags_t flags)
       if (found)
 	{
 	  if (EDGE_COUNT (bb->succs) && abs (sum - REG_BR_PROB_BASE) > 100)
-	    fprintf (file, "%s%sInvalid sum of outgoing probabilities %.1f%%\n",
-		     (flags & TDF_COMMENT) ? ";; " : "", s_indent,
-		     sum * 100.0 / REG_BR_PROB_BASE);
+	    fprintf (file,
+		     ";; %sInvalid sum of outgoing probabilities %.1f%%\n",
+		     s_indent, sum * 100.0 / REG_BR_PROB_BASE);
 	  lsum = 0;
 	  FOR_EACH_EDGE (e, ei, bb->succs)
 	    lsum += e->count;
 	  if (EDGE_COUNT (bb->succs)
 	      && (lsum - bb->count > 100 || lsum - bb->count < -100))
-	    fprintf (file, "%s%sInvalid sum of outgoing counts %i, should be %i\n",
-		     (flags & TDF_COMMENT) ? ";; " : "", s_indent,
-		     (int) lsum, (int) bb->count);
+	    fprintf (file,
+		     ";; %sInvalid sum of outgoing counts %i, should be %i\n",
+		     s_indent, (int) lsum, (int) bb->count);
 	}
     }
     if (bb != ENTRY_BLOCK_PTR_FOR_FN (fun))
@@ -445,30 +445,28 @@ check_bb_profile (basic_block bb, FILE * file, int indent, dump_flags_t flags)
 	sum += EDGE_FREQUENCY (e);
       if (abs (sum - bb->frequency) > 100)
 	fprintf (file,
-		 "%s%sInvalid sum of incoming frequencies %i, should be %i\n",
-		 (flags & TDF_COMMENT) ? ";; " : "", s_indent,
-		 sum, bb->frequency);
+		 ";; %sInvalid sum of incoming frequencies %i, should be %i\n",
+		 s_indent, sum, bb->frequency);
       lsum = 0;
       FOR_EACH_EDGE (e, ei, bb->preds)
 	lsum += e->count;
       if (lsum - bb->count > 100 || lsum - bb->count < -100)
-	fprintf (file, "%s%sInvalid sum of incoming counts %i, should be %i\n",
-		 (flags & TDF_COMMENT) ? ";; " : "", s_indent,
-		 (int) lsum, (int) bb->count);
+	fprintf (file, ";; %sInvalid sum of incoming counts %i, should be %i\n",
+		 s_indent, (int) lsum, (int) bb->count);
     }
   if (BB_PARTITION (bb) == BB_COLD_PARTITION)
     {
       /* Warn about inconsistencies in the partitioning that are
          currently caused by profile insanities created via optimization.  */
       if (!probably_never_executed_bb_p (fun, bb))
-        fprintf (file, "%s%sBlock in cold partition with hot count\n",
-                 (flags & TDF_COMMENT) ? ";; " : "", s_indent);
+	fprintf (file, ";; %sBlock in cold partition with hot count\n",
+		 s_indent);
       FOR_EACH_EDGE (e, ei, bb->preds)
         {
           if (!probably_never_executed_edge_p (fun, e))
             fprintf (file,
-                     "%s%sBlock in cold partition with incoming hot edge\n",
-                     (flags & TDF_COMMENT) ? ";; " : "", s_indent);
+		     ";; %sBlock in cold partition with incoming hot edge\n",
+		     s_indent);
         }
     }
 }
@@ -737,8 +735,7 @@ dump_bb_info (FILE *outf, basic_block bb, int indent, dump_flags_t flags,
     {
       unsigned i;
 
-      if (flags & TDF_COMMENT)
-	fputs (";; ", outf);
+      fputs (";; ", outf);
       fprintf (outf, "%sbasic block %d, loop depth %d",
 	       s_indent, bb->index, bb_loop_depth (bb));
       if (flags & TDF_DETAILS)
@@ -756,9 +753,8 @@ dump_bb_info (FILE *outf, basic_block bb, int indent, dump_flags_t flags,
 
       if (flags & TDF_DETAILS)
 	{
-	  check_bb_profile (bb, outf, indent, flags);
-	  if (flags & TDF_COMMENT)
-	    fputs (";; ", outf);
+	  check_bb_profile (bb, outf, indent);
+	  fputs (";; ", outf);
 	  fprintf (outf, "%s prev block ", s_indent);
 	  if (bb->prev_bb)
 	    fprintf (outf, "%d", bb->prev_bb->index);
@@ -787,16 +783,14 @@ dump_bb_info (FILE *outf, basic_block bb, int indent, dump_flags_t flags,
 	  fputc ('\n', outf);
 	}
 
-      if (flags & TDF_COMMENT)
-	fputs (";; ", outf);
+      fputs (";; ", outf);
       fprintf (outf, "%s pred:      ", s_indent);
       first = true;
       FOR_EACH_EDGE (e, ei, bb->preds)
 	{
 	  if (! first)
 	    {
-	      if (flags & TDF_COMMENT)
-		fputs (";; ", outf);
+	      fputs (";; ", outf);
 	      fprintf (outf, "%s            ", s_indent);
 	    }
 	  first = false;
@@ -809,16 +803,14 @@ dump_bb_info (FILE *outf, basic_block bb, int indent, dump_flags_t flags,
 
   if (do_footer)
     {
-      if (flags & TDF_COMMENT)
-	fputs (";; ", outf);
+      fputs (";; ", outf);
       fprintf (outf, "%s succ:      ", s_indent);
       first = true;
       FOR_EACH_EDGE (e, ei, bb->succs)
         {
 	  if (! first)
 	    {
-	      if (flags & TDF_COMMENT)
-		fputs (";; ", outf);
+	      fputs (";; ", outf);
 	      fprintf (outf, "%s            ", s_indent);
 	    }
 	  first = false;
@@ -839,9 +831,7 @@ brief_dump_cfg (FILE *file, dump_flags_t flags)
 
   FOR_EACH_BB_FN (bb, cfun)
     {
-      dump_bb_info (file, bb, 0,
-		    flags & (TDF_COMMENT | TDF_DETAILS),
-		    true, true);
+      dump_bb_info (file, bb, 0, flags & TDF_DETAILS, true, true);
     }
 }
 
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index aad02921392..fffc4b070cd 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2207,7 +2207,7 @@ print_rtl_with_bb (FILE *outf, const rtx_insn *rtx_first, dump_flags_t flags)
 	      bb = start[INSN_UID (tmp_rtx)];
 	      if (bb != NULL)
 		{
-		  dump_bb_info (outf, bb, 0, dump_flags | TDF_COMMENT, true, false);
+		  dump_bb_info (outf, bb, 0, dump_flags, true, false);
 		  if (df && (flags & TDF_DETAILS))
 		    df_dump_top (bb, outf);
 		}
@@ -2234,7 +2234,7 @@ print_rtl_with_bb (FILE *outf, const rtx_insn *rtx_first, dump_flags_t flags)
 	      bb = end[INSN_UID (tmp_rtx)];
 	      if (bb != NULL)
 		{
-		  dump_bb_info (outf, bb, 0, dump_flags | TDF_COMMENT, false, true);
+		  dump_bb_info (outf, bb, 0, dump_flags, false, true);
 		  if (df && (flags & TDF_DETAILS))
 		    df_dump_bottom (bb, outf);
 		  putc ('\n', outf);
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index ccc6db3077a..e63a2d5ed7e 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -109,9 +109,7 @@ static const struct dump_option_value_info dump_options[] =
   {"vops", TDF_VOPS},
   {"lineno", TDF_LINENO},
   {"uid", TDF_UID},
-  {"stmtaddr", TDF_STMTADDR},
   {"memsyms", TDF_MEMSYMS},
-  {"verbose", TDF_VERBOSE},
   {"eh", TDF_EH},
   {"alias", TDF_ALIAS},
   {"nouid", TDF_NOUID},
@@ -122,8 +120,7 @@ static const struct dump_option_value_info dump_options[] =
   {"missed", MSG_MISSED_OPTIMIZATION},
   {"note", MSG_NOTE},
   {"optall", MSG_ALL},
-  {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO
-	    | TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC | TDF_VERBOSE
+  {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_GRAPH
 	    | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV
 	    | TDF_GIMPLE)},
   {NULL, 0}
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index dc1e6d1d89d..bc1a223a378 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -72,16 +72,10 @@ enum dump_kind
 #define TDF_LINENO	(1 << 10)	/* display statement line numbers */
 #define TDF_UID		(1 << 11)	/* display decl UIDs */
 
-#define TDF_STMTADDR	(1 << 12)	/* Address of stmt.  */
-
 #define TDF_GRAPH	(1 << 13)	/* a graph dump is being emitted */
 #define TDF_MEMSYMS	(1 << 14)	/* display memory symbols in expr.
 					   Implies TDF_VOPS.  */
 
-#define TDF_DIAGNOSTIC	(1 << 15)	/* A dump to be put in a diagnostic
-					   message.  */
-#define TDF_VERBOSE	(1 << 16)	/* A dump that uses the full tree
-					   dumper to print stmts.  */
 #define TDF_RHS_ONLY	(1 << 17)	/* a flag to only print the RHS of
 					   a gimple stmt.  */
 #define TDF_ASMNAME	(1 << 18)	/* display asm names of decls  */
@@ -92,7 +86,6 @@ enum dump_kind
 #define TDF_ENUMERATE_LOCALS (1 << 22)	/* Enumerate locals by uid.  */
 #define TDF_CSELIB	(1 << 23)	/* Dump cselib details.  */
 #define TDF_SCEV	(1 << 24)	/* Dump SCEV details.  */
-#define TDF_COMMENT	(1 << 25)	/* Dump lines with prefix ";;"  */
 #define TDF_GIMPLE	(1 << 26)	/* Dump in GIMPLE FE syntax  */
 #define MSG_OPTIMIZED_LOCATIONS	 (1 << 27)  /* -fopt-info optimized sources */
 #define MSG_MISSED_OPTIMIZATION	 (1 << 28)  /* missed opportunities */
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index c99dfe1192c..9eac7fb389c 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -2429,7 +2429,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc,
   if (!gs)
     return;
 
-  if (flags & TDF_STMTADDR)
+  if (flags & TDF_ADDRESS)
     pp_printf (buffer, "<&%p> ", (void *) gs);
 
   if ((flags & TDF_LINENO) && gimple_has_location (gs))
@@ -2641,8 +2641,7 @@ dump_gimple_bb_header (FILE *outf, basic_block bb, int indent,
 	{
 	  gimple_stmt_iterator gsi;
 
-	  if (flags & TDF_COMMENT)
-	    fputs (";; ", outf);
+	  fputs (";; ", outf);
 
 	  for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
 	    if (!is_gimple_debug (gsi_stmt (gsi))
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index fb58be6c073..77fcd575335 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -1036,21 +1036,6 @@ debug (const tree_node *ptr)
 }
 
 DEBUG_FUNCTION void
-debug_verbose (const tree_node &ref)
-{
-  dump_tree_via_hooks (&ref, TDF_VERBOSE);
-}
-
-DEBUG_FUNCTION void
-debug_verbose (const tree_node *ptr)
-{
-  if (ptr)
-    debug_verbose (*ptr);
-  else
-    fprintf (stderr, "<nil>\n");
-}
-
-DEBUG_FUNCTION void
 debug_head (const tree_node &ref)
 {
   debug (ref);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index b588bc03a47..5e2042c0059 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2393,7 +2393,7 @@ gimple_dump_cfg (FILE *file, dump_flags_t flags)
 	       n_basic_blocks_for_fn (cfun), n_edges_for_fn (cfun),
 	       last_basic_block_for_fn (cfun));
 
-      brief_dump_cfg (file, flags | TDF_COMMENT);
+      brief_dump_cfg (file, flags);
       fprintf (file, "\n");
     }
 
@@ -7583,7 +7583,7 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
       print_generic_expr (file, TREE_TYPE (arg), dump_flags);
       fprintf (file, " ");
       print_generic_expr (file, arg, dump_flags);
-      if (flags & TDF_VERBOSE)
+      if (flags & TDF_DETAILS)
 	print_node (file, "", arg, 4);
       if (DECL_CHAIN (arg))
 	fprintf (file, ", ");
@@ -7591,7 +7591,7 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
     }
   fprintf (file, ")\n");
 
-  if (flags & TDF_VERBOSE)
+  if (flags & TDF_DETAILS)
     print_node (file, "", fndecl, 2);
 
   dsf = DECL_STRUCT_FUNCTION (fndecl);
@@ -7646,7 +7646,7 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
 	FOR_EACH_LOCAL_DECL (fun, ix, var)
 	  {
 	    print_generic_decl (file, var, flags);
-	    if (flags & TDF_VERBOSE)
+	    if (flags & TDF_DETAILS)
 	      print_node (file, "", var, 4);
 	    fprintf (file, "\n");
 
@@ -7683,7 +7683,7 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
 	fprintf (file, "\n");
 
       FOR_EACH_BB_FN (bb, fun)
-	dump_bb (file, bb, 2, flags | TDF_COMMENT);
+	dump_bb (file, bb, 2, flags);
 
       fprintf (file, "}\n");
     }
diff --git a/gcc/tree-diagnostic.c b/gcc/tree-diagnostic.c
index 4f211ed42b3..1009c78ab3c 100644
--- a/gcc/tree-diagnostic.c
+++ b/gcc/tree-diagnostic.c
@@ -26,7 +26,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "diagnostic.h"
 #include "tree-pretty-print.h"
 #include "tree-diagnostic.h"
-#include "dumpfile.h" /* TDF_DIAGNOSTIC */
 #include "langhooks.h"
 #include "intl.h"
 
@@ -294,7 +293,7 @@ default_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
       pp_string (pp, n);
     }
   else
-    dump_generic_node (pp, t, 0, TDF_DIAGNOSTIC, 0);
+    dump_generic_node (pp, t, 0, TDF_SLIM, 0);
 
   return true;
 }
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index ec28b1e3c95..4f14aab01ea 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1219,7 +1219,7 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
 
   is_expr = EXPR_P (node);
 
-  if (is_stmt && (flags & TDF_STMTADDR))
+  if (is_stmt && (flags & TDF_ADDRESS))
     pp_printf (pp, "<&%p> ", (void *)node);
 
   if ((flags & TDF_LINENO) && EXPR_HAS_LOCATION (node))
-- 
2.12.2


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

* Re: [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum.
  2017-05-12 13:30               ` [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum Martin Liška
@ 2017-05-16 14:17                 ` Richard Biener
  2017-05-17 12:22                 ` Richard Biener
  2017-05-25  5:29                 ` Martin Sebor
  2 siblings, 0 replies; 54+ messages in thread
From: Richard Biener @ 2017-05-16 14:17 UTC (permalink / raw)
  To: Martin Liška; +Cc: Trevor Saunders, GCC Patches, Nathan Sidwell

On Fri, May 12, 2017 at 3:04 PM, Martin Liška <mliska@suse.cz> wrote:
> Third part removes TDF_* flags mentioned in the subject. These flags are used
> to enable all passes of specific type and Nathan has recently separated these
> by a new pair of macros. I hope moving these to a separate enum will help even more.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?

 /* Table of tree dump switches. This must be consistent with the
    TREE_DUMP_INDEX enumeration in dumpfile.h.  */
 static struct dump_file_info dump_files[TDI_end] =
 {
...
+  dump_file_info (),

that will make it a runtime constructor unless you make dump_file_info
() constexpr.

ISTR we do have some C++11 stuff abstracted as macros.  Ah, no, just
manually in vec.h.

need to look closer at the rest.  Sth I notice is that it would be
nice to have dump_file
replaced by sth more elaborate (dump_file_info itself?), one could easily add an
implicit conversion to FILE * to make transition easy.

Well, one change at a time ;)

dump_flags, dump_file -> cdump ...

Richard.

> Martin

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

* Re: [PATCH v2 2/N] Introduce dump_flags_t type and use it instead of int, type.
  2017-05-16 13:50                 ` Richard Biener
@ 2017-05-16 14:56                   ` Martin Liška
  2017-05-17  7:55                     ` Richard Biener
  0 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-16 14:56 UTC (permalink / raw)
  To: Richard Biener; +Cc: Trevor Saunders, GCC Patches

On 05/16/2017 03:48 PM, Richard Biener wrote:
> On Fri, May 12, 2017 at 3:00 PM, Martin Liška <mliska@suse.cz> wrote:
>> Second part changes 'int flags' to a new typedef.
>> All corresponding interfaces have been changed.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>
>> Ready to be installed?
> 
> @@ -113,6 +114,14 @@ enum tree_dump_index
>  #define OPTGROUP_ALL        (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \
>                               | OPTGROUP_OMP | OPTGROUP_VEC | OPTGROUP_OTHER)
> 
> +/* Dump flags type.  */
> +
> +typedef uint64_t dump_flags_t;
> +
> +/* Dump flags type.  */
> +
> +typedef uint64_t dump_flags_t;
> +
> 
> duplicate.

Yes, wrong patch merge.

> 
> +#define TDF_NONE 0
> 
> this now seems to "conflict" with
> 
> #define TDF_LANG        0       /* is a lang-specific dump.  */
> 
> ?

I'll make TDF_LANG 1 and will increment next TDF_KIND_MASK values.
Re-running regression tests.

Martin

> 
> that is, TDF_RTL | TDF_NONE would still be "none" conceptually ...
> 
> Ok with the duplicate typedef removed.
> 
> Thanks,
> Richard.
> 
>> Martin

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

* Re: [PATCH v2 2/N] Introduce dump_flags_t type and use it instead of int, type.
  2017-05-16 14:56                   ` Martin Liška
@ 2017-05-17  7:55                     ` Richard Biener
  2017-05-17  9:06                       ` Martin Liška
  0 siblings, 1 reply; 54+ messages in thread
From: Richard Biener @ 2017-05-17  7:55 UTC (permalink / raw)
  To: Martin Liška; +Cc: Trevor Saunders, GCC Patches

On Tue, May 16, 2017 at 4:55 PM, Martin Liška <mliska@suse.cz> wrote:
> On 05/16/2017 03:48 PM, Richard Biener wrote:
>> On Fri, May 12, 2017 at 3:00 PM, Martin Liška <mliska@suse.cz> wrote:
>>> Second part changes 'int flags' to a new typedef.
>>> All corresponding interfaces have been changed.
>>>
>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>>
>>> Ready to be installed?
>>
>> @@ -113,6 +114,14 @@ enum tree_dump_index
>>  #define OPTGROUP_ALL        (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \
>>                               | OPTGROUP_OMP | OPTGROUP_VEC | OPTGROUP_OTHER)
>>
>> +/* Dump flags type.  */
>> +
>> +typedef uint64_t dump_flags_t;
>> +
>> +/* Dump flags type.  */
>> +
>> +typedef uint64_t dump_flags_t;
>> +
>>
>> duplicate.
>
> Yes, wrong patch merge.
>
>>
>> +#define TDF_NONE 0
>>
>> this now seems to "conflict" with
>>
>> #define TDF_LANG        0       /* is a lang-specific dump.  */
>>
>> ?
>
> I'll make TDF_LANG 1 and will increment next TDF_KIND_MASK values.
> Re-running regression tests.

You'll have to adjust the & value as well then.

I didn't mean to really change this but eventually just document the
behavior of TDF_NONE to just affect the bits "above" TDF_KIND_MASK.

Thus when you test for TDF_NONE you'd use

TDF_FLAGS (flags) == TDF_NONE

rather than flags == TDF_NONE.

RIchard.

> Martin
>
>>
>> that is, TDF_RTL | TDF_NONE would still be "none" conceptually ...
>>
>> Ok with the duplicate typedef removed.
>>
>> Thanks,
>> Richard.
>>
>>> Martin
>

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

* Re: [PATCH v2 2/N] Introduce dump_flags_t type and use it instead of int, type.
  2017-05-17  7:55                     ` Richard Biener
@ 2017-05-17  9:06                       ` Martin Liška
  2017-05-18 13:37                         ` Thomas Schwinge
  0 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-17  9:06 UTC (permalink / raw)
  To: Richard Biener; +Cc: Trevor Saunders, GCC Patches

On 05/17/2017 09:44 AM, Richard Biener wrote:
> On Tue, May 16, 2017 at 4:55 PM, Martin Liška <mliska@suse.cz> wrote:
>> On 05/16/2017 03:48 PM, Richard Biener wrote:
>>> On Fri, May 12, 2017 at 3:00 PM, Martin Liška <mliska@suse.cz> wrote:
>>>> Second part changes 'int flags' to a new typedef.
>>>> All corresponding interfaces have been changed.
>>>>
>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>>>
>>>> Ready to be installed?
>>>
>>> @@ -113,6 +114,14 @@ enum tree_dump_index
>>>  #define OPTGROUP_ALL        (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \
>>>                               | OPTGROUP_OMP | OPTGROUP_VEC | OPTGROUP_OTHER)
>>>
>>> +/* Dump flags type.  */
>>> +
>>> +typedef uint64_t dump_flags_t;
>>> +
>>> +/* Dump flags type.  */
>>> +
>>> +typedef uint64_t dump_flags_t;
>>> +
>>>
>>> duplicate.
>>
>> Yes, wrong patch merge.
>>
>>>
>>> +#define TDF_NONE 0
>>>
>>> this now seems to "conflict" with
>>>
>>> #define TDF_LANG        0       /* is a lang-specific dump.  */
>>>
>>> ?
>>
>> I'll make TDF_LANG 1 and will increment next TDF_KIND_MASK values.
>> Re-running regression tests.
> 
> You'll have to adjust the & value as well then.
> 
> I didn't mean to really change this but eventually just document the
> behavior of TDF_NONE to just affect the bits "above" TDF_KIND_MASK.
> 
> Thus when you test for TDF_NONE you'd use
> 
> TDF_FLAGS (flags) == TDF_NONE
> 
> rather than flags == TDF_NONE.

You are right, I've just added comment of the original version and installed as r248140.

Martin

> 
> RIchard.
> 
>> Martin
>>
>>>
>>> that is, TDF_RTL | TDF_NONE would still be "none" conceptually ...
>>>
>>> Ok with the duplicate typedef removed.
>>>
>>> Thanks,
>>> Richard.
>>>
>>>> Martin
>>

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

* Re: [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum.
  2017-05-12 13:30               ` [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum Martin Liška
  2017-05-16 14:17                 ` Richard Biener
@ 2017-05-17 12:22                 ` Richard Biener
  2017-05-18 12:37                   ` Martin Liška
  2017-05-25  5:29                 ` Martin Sebor
  2 siblings, 1 reply; 54+ messages in thread
From: Richard Biener @ 2017-05-17 12:22 UTC (permalink / raw)
  To: Martin Liška; +Cc: Trevor Saunders, GCC Patches, Nathan Sidwell

On Fri, May 12, 2017 at 3:04 PM, Martin Liška <mliska@suse.cz> wrote:
> Third part removes TDF_* flags mentioned in the subject. These flags are used
> to enable all passes of specific type and Nathan has recently separated these
> by a new pair of macros. I hope moving these to a separate enum will help even more.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?

Ok with the constexpr issue solved.

Thanks,
Richard.

> Martin

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

* Re: [PATCH v2 04/N] Simplify usage of some TDF_* flags.
  2017-05-16 13:55               ` [PATCH v2 04/N] Simplify usage of some TDF_* flags Martin Liška
@ 2017-05-17 12:37                 ` Richard Biener
  2017-05-18 12:58                   ` Martin Liška
  0 siblings, 1 reply; 54+ messages in thread
From: Richard Biener @ 2017-05-17 12:37 UTC (permalink / raw)
  To: Martin Liška; +Cc: Trevor Saunders, GCC Patches

On Tue, May 16, 2017 at 3:53 PM, Martin Liška <mliska@suse.cz> wrote:
> There's one another patch that merges some TDF_* flags that have
> very similar meaning and do not influence test-suite, because
> nobody is using them for scanning.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?

I think the patch removes too many TDF flags.  For example
-fdump-tree-xxx-address
will then print not only addresses of gimple stmts but also of each
tree operand.  The
change to dump_generic_node looks ok though.

Did you look who intoduced TDF_COMMENT?  ISTR it was for some graph
dumping stuff.

Likewise the TDF_VERBOSE use in tree-cfg.c shouldn't be replaced with
-details but
dropped if you trop the flag.

Did you look at effects in dump-files at all?

Richard.

> Martin

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

* Re: [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum.
  2017-05-17 12:22                 ` Richard Biener
@ 2017-05-18 12:37                   ` Martin Liška
  0 siblings, 0 replies; 54+ messages in thread
From: Martin Liška @ 2017-05-18 12:37 UTC (permalink / raw)
  To: Richard Biener; +Cc: Trevor Saunders, GCC Patches, Nathan Sidwell

On 05/17/2017 02:20 PM, Richard Biener wrote:
> On Fri, May 12, 2017 at 3:04 PM, Martin Liška <mliska@suse.cz> wrote:
>> Third part removes TDF_* flags mentioned in the subject. These flags are used
>> to enable all passes of specific type and Nathan has recently separated these
>> by a new pair of macros. I hope moving these to a separate enum will help even more.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>
>> Ready to be installed?
> 
> Ok with the constexpr issue solved.

Thanks. I'll separate that into 2 patches, where first will extract CONSTEXPR macro
to ansidecl.h.

Currently running regression tests.

Martin

> 
> Thanks,
> Richard.
> 
>> Martin

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

* Re: [PATCH v2 04/N] Simplify usage of some TDF_* flags.
  2017-05-17 12:37                 ` Richard Biener
@ 2017-05-18 12:58                   ` Martin Liška
  2017-05-24 21:23                     ` Martin Liška
  0 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-18 12:58 UTC (permalink / raw)
  To: Richard Biener; +Cc: Trevor Saunders, GCC Patches, steven

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

On 05/17/2017 02:36 PM, Richard Biener wrote:
> On Tue, May 16, 2017 at 3:53 PM, Martin Liška <mliska@suse.cz> wrote:
>> There's one another patch that merges some TDF_* flags that have
>> very similar meaning and do not influence test-suite, because
>> nobody is using them for scanning.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>
>> Ready to be installed?
> 
> I think the patch removes too many TDF flags.  For example
> -fdump-tree-xxx-address
> will then print not only addresses of gimple stmts but also of each


Hi.

Ok, I'll preserve TDF_STMTADDR flag.

> tree operand.  The
> change to dump_generic_node looks ok though.
> 
> Did you look who intoduced TDF_COMMENT?  ISTR it was for some graph
> dumping stuff.

Adding Steven, author of the TDF_COMMENT.

> 
> Likewise the TDF_VERBOSE use in tree-cfg.c shouldn't be replaced with
> -details but
> dropped if you trop the flag.

Done in v2.

> 
> Did you look at effects in dump-files at all?

I did, with -fdump-tree-all-all and -fdump-rtl-all-all the only difference with my patch are ';; ',
where it only differs for:

 Removing basic block 53
-basic block 53, loop depth 1
- pred:      
- succ:       30
+;; basic block 53, loop depth 1
+;;  pred:      
+;;  succ:       30

while even only file looks as follows (011t.cfg dumpfile):

;; Loop 4
;;  header 7, latch 6
;;  depth 2, outer 1
;;  nodes: 7 6 8
;; 2 succs { 18 3 }
;; 3 succs { 4 11 }
;; 4 succs { 10 }
;; 5 succs { 7 }
;; 6 succs { 7 }
;; 7 succs { 8 9 }
;; 8 succs { 6 9 }
;; 9 succs { 10 }
;; 10 succs { 5 11 }
;; 11 succs { 17 }
;; 12 succs { 14 }
;; 13 succs { 14 }
;; 14 succs { 15 16 }
;; 15 succs { 13 16 }
;; 16 succs { 17 }
;; 17 succs { 12 18 }
;; 18 succs { 1 }

Pass statistics of "cfg": ----------------

fallbackSimpleSort (UInt32D.1796 * fmapD.1799, UInt32D.1796 * eclassD.1800, Int32D.1795 loD.1801, Int32D.1795 hiD.1802)
{
  UInt32D.1796 ec_tmpD.1808;
  Int32D.1795 tmpD.1807;
  Int32D.1795 jD.1806;
  Int32D.1795 iD.1805;

;;   basic block 2, loop depth 0, count 0, freq 0, maybe hot
;;    prev block 0, next block 3, flags: (NEW, REACHABLE)
;;    pred:       ENTRY (FALLTHRU)
  if (loD.1801 == hiD.1802)
    goto <bb 18>; [0.00%]
  else
    goto <bb 3>; [0.00%]
;;    succ:       18 (TRUE_VALUE)
;;                3 (FALSE_VALUE)

;;   basic block 3, loop depth 0, count 0, freq 0, maybe hot
;;    prev block 2, next block 4, flags: (NEW, REACHABLE)
;;    pred:       2 (FALSE_VALUE)

Martin

> 
> Richard.
> 
>> Martin



[-- Attachment #2: 0004-Simplify-usage-of-some-TDF_-flags.patch --]
[-- Type: text/x-patch, Size: 12892 bytes --]

From 0aff275b520dc72b13b5d127c36bc6a41af495cd Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 12 May 2017 15:55:24 +0200
Subject: [PATCH 4/4] Simplify usage of some TDF_* flags.

gcc/ChangeLog:

2017-05-12  Martin Liska  <mliska@suse.cz>

	* cfg.c (check_bb_profile): Do not use TDF_COMMENT and print
	always leading ';; '.
	(dump_bb_info): Likewise.
	(brief_dump_cfg): Likewise.
	* cfgrtl.c (print_rtl_with_bb): Do not use TDF_COMMENT.
	* dumpfile.c: Remove usage of TDF_VERBOSE.
	* dumpfile.h (enum dump_kind): Likewise.
	(dump_gimple_bb_header): Do not use TDF_COMMENT.
	* print-tree.c (debug_verbose): Remove.
	* tree-cfg.c (gimple_dump_cfg): Do not use TDF_COMMENT.
	(dump_function_to_file): Remove dumps guarded with TDF_VERBOSE.
	* tree-diagnostic.c (default_tree_printer): Replace
	TDF_DIAGNOSTIC with TDF_SLIM.
---
 gcc/cfg.c                 | 56 +++++++++++++++++++----------------------------
 gcc/cfgrtl.c              |  4 ++--
 gcc/dumpfile.c            |  4 +---
 gcc/dumpfile.h            |  7 +-----
 gcc/gimple-pretty-print.c |  3 +--
 gcc/print-tree.c          | 15 -------------
 gcc/tree-cfg.c            | 11 ++--------
 gcc/tree-diagnostic.c     |  3 +--
 8 files changed, 31 insertions(+), 72 deletions(-)

diff --git a/gcc/cfg.c b/gcc/cfg.c
index ffac69f266d..aef053f5d22 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -396,7 +396,7 @@ clear_bb_flags (void)
    It is still practical to have them reported for debugging of simple
    testcases.  */
 static void
-check_bb_profile (basic_block bb, FILE * file, int indent, dump_flags_t flags)
+check_bb_profile (basic_block bb, FILE * file, int indent)
 {
   edge e;
   int sum = 0;
@@ -425,17 +425,17 @@ check_bb_profile (basic_block bb, FILE * file, int indent, dump_flags_t flags)
       if (found)
 	{
 	  if (EDGE_COUNT (bb->succs) && abs (sum - REG_BR_PROB_BASE) > 100)
-	    fprintf (file, "%s%sInvalid sum of outgoing probabilities %.1f%%\n",
-		     (flags & TDF_COMMENT) ? ";; " : "", s_indent,
-		     sum * 100.0 / REG_BR_PROB_BASE);
+	    fprintf (file,
+		     ";; %sInvalid sum of outgoing probabilities %.1f%%\n",
+		     s_indent, sum * 100.0 / REG_BR_PROB_BASE);
 	  lsum = 0;
 	  FOR_EACH_EDGE (e, ei, bb->succs)
 	    lsum += e->count;
 	  if (EDGE_COUNT (bb->succs)
 	      && (lsum - bb->count > 100 || lsum - bb->count < -100))
-	    fprintf (file, "%s%sInvalid sum of outgoing counts %i, should be %i\n",
-		     (flags & TDF_COMMENT) ? ";; " : "", s_indent,
-		     (int) lsum, (int) bb->count);
+	    fprintf (file,
+		     ";; %sInvalid sum of outgoing counts %i, should be %i\n",
+		     s_indent, (int) lsum, (int) bb->count);
 	}
     }
     if (bb != ENTRY_BLOCK_PTR_FOR_FN (fun))
@@ -445,30 +445,28 @@ check_bb_profile (basic_block bb, FILE * file, int indent, dump_flags_t flags)
 	sum += EDGE_FREQUENCY (e);
       if (abs (sum - bb->frequency) > 100)
 	fprintf (file,
-		 "%s%sInvalid sum of incoming frequencies %i, should be %i\n",
-		 (flags & TDF_COMMENT) ? ";; " : "", s_indent,
-		 sum, bb->frequency);
+		 ";; %sInvalid sum of incoming frequencies %i, should be %i\n",
+		 s_indent, sum, bb->frequency);
       lsum = 0;
       FOR_EACH_EDGE (e, ei, bb->preds)
 	lsum += e->count;
       if (lsum - bb->count > 100 || lsum - bb->count < -100)
-	fprintf (file, "%s%sInvalid sum of incoming counts %i, should be %i\n",
-		 (flags & TDF_COMMENT) ? ";; " : "", s_indent,
-		 (int) lsum, (int) bb->count);
+	fprintf (file, ";; %sInvalid sum of incoming counts %i, should be %i\n",
+		 s_indent, (int) lsum, (int) bb->count);
     }
   if (BB_PARTITION (bb) == BB_COLD_PARTITION)
     {
       /* Warn about inconsistencies in the partitioning that are
          currently caused by profile insanities created via optimization.  */
       if (!probably_never_executed_bb_p (fun, bb))
-        fprintf (file, "%s%sBlock in cold partition with hot count\n",
-                 (flags & TDF_COMMENT) ? ";; " : "", s_indent);
+	fprintf (file, ";; %sBlock in cold partition with hot count\n",
+		 s_indent);
       FOR_EACH_EDGE (e, ei, bb->preds)
         {
           if (!probably_never_executed_edge_p (fun, e))
             fprintf (file,
-                     "%s%sBlock in cold partition with incoming hot edge\n",
-                     (flags & TDF_COMMENT) ? ";; " : "", s_indent);
+		     ";; %sBlock in cold partition with incoming hot edge\n",
+		     s_indent);
         }
     }
 }
@@ -737,8 +735,7 @@ dump_bb_info (FILE *outf, basic_block bb, int indent, dump_flags_t flags,
     {
       unsigned i;
 
-      if (flags & TDF_COMMENT)
-	fputs (";; ", outf);
+      fputs (";; ", outf);
       fprintf (outf, "%sbasic block %d, loop depth %d",
 	       s_indent, bb->index, bb_loop_depth (bb));
       if (flags & TDF_DETAILS)
@@ -756,9 +753,8 @@ dump_bb_info (FILE *outf, basic_block bb, int indent, dump_flags_t flags,
 
       if (flags & TDF_DETAILS)
 	{
-	  check_bb_profile (bb, outf, indent, flags);
-	  if (flags & TDF_COMMENT)
-	    fputs (";; ", outf);
+	  check_bb_profile (bb, outf, indent);
+	  fputs (";; ", outf);
 	  fprintf (outf, "%s prev block ", s_indent);
 	  if (bb->prev_bb)
 	    fprintf (outf, "%d", bb->prev_bb->index);
@@ -787,16 +783,14 @@ dump_bb_info (FILE *outf, basic_block bb, int indent, dump_flags_t flags,
 	  fputc ('\n', outf);
 	}
 
-      if (flags & TDF_COMMENT)
-	fputs (";; ", outf);
+      fputs (";; ", outf);
       fprintf (outf, "%s pred:      ", s_indent);
       first = true;
       FOR_EACH_EDGE (e, ei, bb->preds)
 	{
 	  if (! first)
 	    {
-	      if (flags & TDF_COMMENT)
-		fputs (";; ", outf);
+	      fputs (";; ", outf);
 	      fprintf (outf, "%s            ", s_indent);
 	    }
 	  first = false;
@@ -809,16 +803,14 @@ dump_bb_info (FILE *outf, basic_block bb, int indent, dump_flags_t flags,
 
   if (do_footer)
     {
-      if (flags & TDF_COMMENT)
-	fputs (";; ", outf);
+      fputs (";; ", outf);
       fprintf (outf, "%s succ:      ", s_indent);
       first = true;
       FOR_EACH_EDGE (e, ei, bb->succs)
         {
 	  if (! first)
 	    {
-	      if (flags & TDF_COMMENT)
-		fputs (";; ", outf);
+	      fputs (";; ", outf);
 	      fprintf (outf, "%s            ", s_indent);
 	    }
 	  first = false;
@@ -839,9 +831,7 @@ brief_dump_cfg (FILE *file, dump_flags_t flags)
 
   FOR_EACH_BB_FN (bb, cfun)
     {
-      dump_bb_info (file, bb, 0,
-		    flags & (TDF_COMMENT | TDF_DETAILS),
-		    true, true);
+      dump_bb_info (file, bb, 0, flags & TDF_DETAILS, true, true);
     }
 }
 
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index aad02921392..fffc4b070cd 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2207,7 +2207,7 @@ print_rtl_with_bb (FILE *outf, const rtx_insn *rtx_first, dump_flags_t flags)
 	      bb = start[INSN_UID (tmp_rtx)];
 	      if (bb != NULL)
 		{
-		  dump_bb_info (outf, bb, 0, dump_flags | TDF_COMMENT, true, false);
+		  dump_bb_info (outf, bb, 0, dump_flags, true, false);
 		  if (df && (flags & TDF_DETAILS))
 		    df_dump_top (bb, outf);
 		}
@@ -2234,7 +2234,7 @@ print_rtl_with_bb (FILE *outf, const rtx_insn *rtx_first, dump_flags_t flags)
 	      bb = end[INSN_UID (tmp_rtx)];
 	      if (bb != NULL)
 		{
-		  dump_bb_info (outf, bb, 0, dump_flags | TDF_COMMENT, false, true);
+		  dump_bb_info (outf, bb, 0, dump_flags, false, true);
 		  if (df && (flags & TDF_DETAILS))
 		    df_dump_bottom (bb, outf);
 		  putc ('\n', outf);
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index d5a0e70cf66..d3c64d6f64b 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -113,7 +113,6 @@ static const struct dump_option_value_info dump_options[] =
   {"uid", TDF_UID},
   {"stmtaddr", TDF_STMTADDR},
   {"memsyms", TDF_MEMSYMS},
-  {"verbose", TDF_VERBOSE},
   {"eh", TDF_EH},
   {"alias", TDF_ALIAS},
   {"nouid", TDF_NOUID},
@@ -124,8 +123,7 @@ static const struct dump_option_value_info dump_options[] =
   {"missed", MSG_MISSED_OPTIMIZATION},
   {"note", MSG_NOTE},
   {"optall", MSG_ALL},
-  {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO
-	    | TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC | TDF_VERBOSE
+  {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_GRAPH | TDF_STMTADDR
 	    | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV
 	    | TDF_GIMPLE)},
   {NULL, 0}
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index 6edea857ba8..f7dcab0642f 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -72,16 +72,12 @@ enum dump_kind
 #define TDF_LINENO	(1 << 10)	/* display statement line numbers */
 #define TDF_UID		(1 << 11)	/* display decl UIDs */
 
-#define TDF_STMTADDR	(1 << 12)	/* Address of stmt.  */
+#define TDF_STMTADDR	(1 << 12)       /* Address of stmt.  */
 
 #define TDF_GRAPH	(1 << 13)	/* a graph dump is being emitted */
 #define TDF_MEMSYMS	(1 << 14)	/* display memory symbols in expr.
 					   Implies TDF_VOPS.  */
 
-#define TDF_DIAGNOSTIC	(1 << 15)	/* A dump to be put in a diagnostic
-					   message.  */
-#define TDF_VERBOSE	(1 << 16)	/* A dump that uses the full tree
-					   dumper to print stmts.  */
 #define TDF_RHS_ONLY	(1 << 17)	/* a flag to only print the RHS of
 					   a gimple stmt.  */
 #define TDF_ASMNAME	(1 << 18)	/* display asm names of decls  */
@@ -92,7 +88,6 @@ enum dump_kind
 #define TDF_ENUMERATE_LOCALS (1 << 22)	/* Enumerate locals by uid.  */
 #define TDF_CSELIB	(1 << 23)	/* Dump cselib details.  */
 #define TDF_SCEV	(1 << 24)	/* Dump SCEV details.  */
-#define TDF_COMMENT	(1 << 25)	/* Dump lines with prefix ";;"  */
 #define TDF_GIMPLE	(1 << 26)	/* Dump in GIMPLE FE syntax  */
 #define MSG_OPTIMIZED_LOCATIONS	 (1 << 27)  /* -fopt-info optimized sources */
 #define MSG_MISSED_OPTIMIZATION	 (1 << 28)  /* missed opportunities */
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index c99dfe1192c..5ff63a167a1 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -2641,8 +2641,7 @@ dump_gimple_bb_header (FILE *outf, basic_block bb, int indent,
 	{
 	  gimple_stmt_iterator gsi;
 
-	  if (flags & TDF_COMMENT)
-	    fputs (";; ", outf);
+	  fputs (";; ", outf);
 
 	  for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
 	    if (!is_gimple_debug (gsi_stmt (gsi))
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index fb58be6c073..77fcd575335 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -1036,21 +1036,6 @@ debug (const tree_node *ptr)
 }
 
 DEBUG_FUNCTION void
-debug_verbose (const tree_node &ref)
-{
-  dump_tree_via_hooks (&ref, TDF_VERBOSE);
-}
-
-DEBUG_FUNCTION void
-debug_verbose (const tree_node *ptr)
-{
-  if (ptr)
-    debug_verbose (*ptr);
-  else
-    fprintf (stderr, "<nil>\n");
-}
-
-DEBUG_FUNCTION void
 debug_head (const tree_node &ref)
 {
   debug (ref);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index b588bc03a47..3926a53ed7f 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2393,7 +2393,7 @@ gimple_dump_cfg (FILE *file, dump_flags_t flags)
 	       n_basic_blocks_for_fn (cfun), n_edges_for_fn (cfun),
 	       last_basic_block_for_fn (cfun));
 
-      brief_dump_cfg (file, flags | TDF_COMMENT);
+      brief_dump_cfg (file, flags);
       fprintf (file, "\n");
     }
 
@@ -7583,17 +7583,12 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
       print_generic_expr (file, TREE_TYPE (arg), dump_flags);
       fprintf (file, " ");
       print_generic_expr (file, arg, dump_flags);
-      if (flags & TDF_VERBOSE)
-	print_node (file, "", arg, 4);
       if (DECL_CHAIN (arg))
 	fprintf (file, ", ");
       arg = DECL_CHAIN (arg);
     }
   fprintf (file, ")\n");
 
-  if (flags & TDF_VERBOSE)
-    print_node (file, "", fndecl, 2);
-
   dsf = DECL_STRUCT_FUNCTION (fndecl);
   if (dsf && (flags & TDF_EH))
     dump_eh_tree (file, dsf);
@@ -7646,8 +7641,6 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
 	FOR_EACH_LOCAL_DECL (fun, ix, var)
 	  {
 	    print_generic_decl (file, var, flags);
-	    if (flags & TDF_VERBOSE)
-	      print_node (file, "", var, 4);
 	    fprintf (file, "\n");
 
 	    any_var = true;
@@ -7683,7 +7676,7 @@ dump_function_to_file (tree fndecl, FILE *file, dump_flags_t flags)
 	fprintf (file, "\n");
 
       FOR_EACH_BB_FN (bb, fun)
-	dump_bb (file, bb, 2, flags | TDF_COMMENT);
+	dump_bb (file, bb, 2, flags);
 
       fprintf (file, "}\n");
     }
diff --git a/gcc/tree-diagnostic.c b/gcc/tree-diagnostic.c
index 4f211ed42b3..1009c78ab3c 100644
--- a/gcc/tree-diagnostic.c
+++ b/gcc/tree-diagnostic.c
@@ -26,7 +26,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "diagnostic.h"
 #include "tree-pretty-print.h"
 #include "tree-diagnostic.h"
-#include "dumpfile.h" /* TDF_DIAGNOSTIC */
 #include "langhooks.h"
 #include "intl.h"
 
@@ -294,7 +293,7 @@ default_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
       pp_string (pp, n);
     }
   else
-    dump_generic_node (pp, t, 0, TDF_DIAGNOSTIC, 0);
+    dump_generic_node (pp, t, 0, TDF_SLIM, 0);
 
   return true;
 }
-- 
2.12.2



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

* Re: [PATCH v2 2/N] Introduce dump_flags_t type and use it instead of int, type.
  2017-05-17  9:06                       ` Martin Liška
@ 2017-05-18 13:37                         ` Thomas Schwinge
  2017-05-18 14:26                           ` Martin Liška
  0 siblings, 1 reply; 54+ messages in thread
From: Thomas Schwinge @ 2017-05-18 13:37 UTC (permalink / raw)
  To: Martin Liška, GCC Patches
  Cc: Trevor Saunders, Richard Biener,
	Pekka Jääskeläinen, Martin Jambor

Hi!

On Wed, 17 May 2017 11:02:09 +0200, Martin Liška <mliska@suse.cz> wrote:
> On 05/17/2017 09:44 AM, Richard Biener wrote:
> > On Tue, May 16, 2017 at 4:55 PM, Martin Liška <mliska@suse.cz> wrote:
> >> On 05/16/2017 03:48 PM, Richard Biener wrote:
> >>> On Fri, May 12, 2017 at 3:00 PM, Martin Liška <mliska@suse.cz> wrote:
> >>>> Second part changes 'int flags' to a new typedef.
> >>>> All corresponding interfaces have been changed.

The very most, but not not all.  ;-)

> installed as r248140.

    [...]/gcc/brig/brigfrontend/brig-to-generic.cc: In constructor 'brig_to_generic::brig_to_generic()':
    [...]/gcc/brig/brigfrontend/brig-to-generic.cc:89:56: error: cannot convert 'int*' to 'dump_flags_t* {aka long unsigned int*}' for argument '2' to 'FILE* dump_begin(int, dump_flags_t*)'
       m_dump_file = dump_begin (TDI_original, &m_dump_flags);
                                                            ^

As obvious, committed to trunk in r248200:

commit 6059695267f35a22932f75471ab78467eeddf5e8
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu May 18 13:34:29 2017 +0000

    More dump_flags_t conversion
    
            gcc/brig/
            * brigfrontend/brig-to-generic.h (class brig_to_generic): Use
            "dump_flags_t" for "m_dump_flags" member.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248200 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/brig/ChangeLog                      | 5 +++++
 gcc/brig/brigfrontend/brig-to-generic.h | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git gcc/brig/ChangeLog gcc/brig/ChangeLog
index 3c563b1..1b1a1eb 100644
--- gcc/brig/ChangeLog
+++ gcc/brig/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-18  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* brigfrontend/brig-to-generic.h (class brig_to_generic): Use
+	"dump_flags_t" for "m_dump_flags" member.
+
 2017-05-13  Pekka Jääskeläinen  <pekka.jaaskelainen@parmance.com>
 
 	* brigfrontend/brig-code-entry-handler.cc
diff --git gcc/brig/brigfrontend/brig-to-generic.h gcc/brig/brigfrontend/brig-to-generic.h
index 09d7c42..b94ff7c 100644
--- gcc/brig/brigfrontend/brig-to-generic.h
+++ gcc/brig/brigfrontend/brig-to-generic.h
@@ -169,7 +169,7 @@ private:
   FILE *m_dump_file;
 
   /* The original dump file flags.  */
-  int m_dump_flags;
+  dump_flags_t m_dump_flags;
 };
 
 /* Produce a "mangled name" for the given brig variable.  The mangling is used


Grüße
 Thomas

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

* Re: [PATCH v2 2/N] Introduce dump_flags_t type and use it instead of int, type.
  2017-05-18 13:37                         ` Thomas Schwinge
@ 2017-05-18 14:26                           ` Martin Liška
  0 siblings, 0 replies; 54+ messages in thread
From: Martin Liška @ 2017-05-18 14:26 UTC (permalink / raw)
  To: Thomas Schwinge, GCC Patches
  Cc: Trevor Saunders, Richard Biener,
	Pekka Jääskeläinen, Martin Jambor

On 05/18/2017 03:36 PM, Thomas Schwinge wrote:
> The very most, but not not all.  

Thanks for the fix.

Martin

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

* [PATCH v2 05/N] Add -fdump*-folding suboption.
  2017-05-06 15:04             ` Trevor Saunders
                                 ` (3 preceding siblings ...)
  2017-05-16 13:55               ` [PATCH v2 04/N] Simplify usage of some TDF_* flags Martin Liška
@ 2017-05-24 11:04               ` Martin Liška
  2017-05-24 13:53                 ` Richard Biener
  4 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-24 11:04 UTC (permalink / raw)
  To: Trevor Saunders, Richard Biener; +Cc: GCC Patches

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

Hello.

After discussions with Richi, I decided to end up with the transformation and thus
I would like to apply the original patch on top of what was done. Probably last change
should be that we should renumber TDF_* values to start from 1 << 0 and holes in numbering
should be eliminated?

Thanks,
Martin

[-- Attachment #2: 0001-Add-fdump-folding-suboption.patch --]
[-- Type: text/x-patch, Size: 2076 bytes --]

From d0cab884035be37e5ceab54384611830661fdd9f Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 24 May 2017 10:32:42 +0200
Subject: [PATCH] Add -fdump*-folding suboption.

gcc/ChangeLog:

2017-05-24  Martin Liska  <mliska@suse.cz>

	* dumpfile.c: Add TDF_FOLDING.
	* dumpfile.h (enum dump_kind): Likewise.
	* genmatch.c (dt_simplify::gen_1): Use it.
---
 gcc/dumpfile.c | 1 +
 gcc/dumpfile.h | 1 +
 gcc/genmatch.c | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 13a711345b4..903d879e784 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -118,6 +118,7 @@ static const struct dump_option_value_info dump_options[] =
   {"enumerate_locals", TDF_ENUMERATE_LOCALS},
   {"scev", TDF_SCEV},
   {"gimple", TDF_GIMPLE},
+  {"folding", TDF_FOLDING},
   {"optimized", MSG_OPTIMIZED_LOCATIONS},
   {"missed", MSG_MISSED_OPTIMIZATION},
   {"note", MSG_NOTE},
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index a1e4720156d..abb4d93a93b 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -92,6 +92,7 @@ enum dump_kind
 #define TDF_SCEV	(1 << 24)	/* Dump SCEV details.  */
 #define TDF_COMMENT	(1 << 25)	/* Dump lines with prefix ";;"  */
 #define TDF_GIMPLE	(1 << 26)	/* Dump in GIMPLE FE syntax  */
+#define TDF_FOLDING	(1 << 27)	/* Dump folding details.  */
 #define MSG_OPTIMIZED_LOCATIONS	 (1 << 27)  /* -fopt-info optimized sources */
 #define MSG_MISSED_OPTIMIZATION	 (1 << 28)  /* missed opportunities */
 #define MSG_NOTE		 (1 << 29)  /* general optimization info */
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 2c3183b25af..f20e39f9158 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -3191,7 +3191,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
 	}
     }
 
-  fprintf_indent (f, indent, "if (dump_file && (dump_flags & TDF_DETAILS)) "
+  fprintf_indent (f, indent, "if (dump_file && (dump_flags & TDF_FOLDING)) "
 	   "fprintf (dump_file, \"Applying pattern ");
   output_line_directive (f,
 			 result ? result->location : s->match->location, true);
-- 
2.12.2


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

* Re: [PATCH v2 05/N] Add -fdump*-folding suboption.
  2017-05-24 11:04               ` [PATCH v2 05/N] Add -fdump*-folding suboption Martin Liška
@ 2017-05-24 13:53                 ` Richard Biener
  0 siblings, 0 replies; 54+ messages in thread
From: Richard Biener @ 2017-05-24 13:53 UTC (permalink / raw)
  To: Martin Liška; +Cc: Trevor Saunders, GCC Patches

On Wed, May 24, 2017 at 12:54 PM, Martin Liška <mliska@suse.cz> wrote:
> Hello.
>
> After discussions with Richi, I decided to end up with the transformation
> and thus
> I would like to apply the original patch on top of what was done. Probably
> last change
> should be that we should renumber TDF_* values to start from 1 << 0 and
> holes in numbering
> should be eliminated?

Ok.

Richard.

> Thanks,
> Martin

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

* Re: [PATCH v2 04/N] Simplify usage of some TDF_* flags.
  2017-05-18 12:58                   ` Martin Liška
@ 2017-05-24 21:23                     ` Martin Liška
  2017-05-26 11:46                       ` Richard Biener
  0 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-24 21:23 UTC (permalink / raw)
  To: Richard Biener; +Cc: Trevor Saunders, GCC Patches, steven

Hi Richi.

That's a small reminder. I CCed Steven, but I guess if the TDF_COMMENT would be really
important, it can be eventually added back.

May I install the patch now?
Thanks,
Martin

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

* Re: [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum.
  2017-05-12 13:30               ` [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum Martin Liška
  2017-05-16 14:17                 ` Richard Biener
  2017-05-17 12:22                 ` Richard Biener
@ 2017-05-25  5:29                 ` Martin Sebor
  2017-05-25  9:56                   ` Martin Liška
  2 siblings, 1 reply; 54+ messages in thread
From: Martin Sebor @ 2017-05-25  5:29 UTC (permalink / raw)
  To: Martin Liška, Trevor Saunders, Richard Biener
  Cc: GCC Patches, Nathan Sidwell

On 05/12/2017 07:04 AM, Martin Liška wrote:
> Third part removes TDF_* flags mentioned in the subject. These flags are used
> to enable all passes of specific type and Nathan has recently separated these
> by a new pair of macros. I hope moving these to a separate enum will help even more.

Just as an FYI, the addition of the user-defined constructor makes
the class non-trivial and so unsafe to initialize by calling memset
in C++ 11 and later.  In C++ 98 that GCC is compiled with, the class
is not a POD and so not safe to realloc (i.e., new objects must be
brought to life by calling a constructor).  I noticed this by testing
my latest patch for the new -Wclass-memassign warning but I thought
it might be worth noting here as well.

+  /* Constructor.  */
+  dump_file_info ();
+
+  /* Constructor.  */
+  dump_file_info (const char *_suffix, const char *_swtch, dump_kind 
_dkind,
+		  int _num);
+

Also, making the ctor constexpr and defining it in the .c file will
trigger Clang -Wundefined-inline and makes the ctor unusable in other
sources.  AFAICS, there is no constexpr context where the constexpr
ctor would be needed so I'm not sure I understand its purpose.  Is
it constexpr to allow the static initialization of dump_files[0]?
(All the other elements of the array are dynamically initialized
by calling the other, non-constexpr ctor so that doesn't seem like
the answer.)

Martin

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

* Re: [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum.
  2017-05-25  5:29                 ` Martin Sebor
@ 2017-05-25  9:56                   ` Martin Liška
  2017-05-25 10:58                     ` Nathan Sidwell
  2017-05-26 13:00                     ` Richard Biener
  0 siblings, 2 replies; 54+ messages in thread
From: Martin Liška @ 2017-05-25  9:56 UTC (permalink / raw)
  To: Martin Sebor, Trevor Saunders, Richard Biener; +Cc: GCC Patches, Nathan Sidwell

On 05/25/2017 05:35 AM, Martin Sebor wrote:
> On 05/12/2017 07:04 AM, Martin Liška wrote:
>> Third part removes TDF_* flags mentioned in the subject. These flags are used
>> to enable all passes of specific type and Nathan has recently separated these
>> by a new pair of macros. I hope moving these to a separate enum will help even more.
> 
> Just as an FYI, the addition of the user-defined constructor makes
> the class non-trivial and so unsafe to initialize by calling memset
> in C++ 11 and later.  In C++ 98 that GCC is compiled with, the class
> is not a POD and so not safe to realloc (i.e., new objects must be
> brought to life by calling a constructor).  I noticed this by testing
> my latest patch for the new -Wclass-memassign warning but I thought
> it might be worth noting here as well.

Hi.

Thanks for heads up. I'm not sure why the class is no longer POD as one can define
constructors (but not copy-ctors) in order to preserve a type to be POD?
I'm also interested what is the new warning -Wclass-memassign about?

> 
> +  /* Constructor.  */
> +  dump_file_info ();
> +
> +  /* Constructor.  */
> +  dump_file_info (const char *_suffix, const char *_swtch, dump_kind _dkind,
> +          int _num);
> +
> 
> Also, making the ctor constexpr and defining it in the .c file will
> trigger Clang -Wundefined-inline and makes the ctor unusable in other
> sources.  AFAICS, there is no constexpr context where the constexpr
> ctor would be needed so I'm not sure I understand its purpose.  Is
> it constexpr to allow the static initialization of dump_files[0]?
> (All the other elements of the array are dynamically initialized
> by calling the other, non-constexpr ctor so that doesn't seem like
> the answer.)

Yep, that was Richi's objection to use constexpr and I know it's used
just for the first elements of the array.
Richi?

Martin

> 
> Martin

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

* Re: [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum.
  2017-05-25  9:56                   ` Martin Liška
@ 2017-05-25 10:58                     ` Nathan Sidwell
  2017-05-26 13:00                     ` Richard Biener
  1 sibling, 0 replies; 54+ messages in thread
From: Nathan Sidwell @ 2017-05-25 10:58 UTC (permalink / raw)
  To: Martin Liška, Martin Sebor, Trevor Saunders, Richard Biener
  Cc: GCC Patches

On 05/25/2017 05:52 AM, Martin Liška wrote:
> On 05/25/2017 05:35 AM, Martin Sebor wrote:
>> On 05/12/2017 07:04 AM, Martin Liška wrote:
>>> Third part removes TDF_* flags mentioned in the subject. These flags are used
>>> to enable all passes of specific type and Nathan has recently separated these
>>> by a new pair of macros. I hope moving these to a separate enum will help even more.
>>
>> Just as an FYI, the addition of the user-defined constructor makes
>> the class non-trivial and so unsafe to initialize by calling memset
>> in C++ 11 and later.  In C++ 98 that GCC is compiled with, the class
>> is not a POD and so not safe to realloc (i.e., new objects must be
>> brought to life by calling a constructor).  I noticed this by testing
>> my latest patch for the new -Wclass-memassign warning but I thought
>> it might be worth noting here as well.
> 
> Hi.
> 
> Thanks for heads up. I'm not sure why the class is no longer POD as one can define
> constructors (but not copy-ctors) in order to preserve a type to be POD?

As Martin S says, it's a change from C98 to C11.  98 disallowed any ctor.

nathan

-- 
Nathan Sidwell

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

* Re: [PATCH v2 04/N] Simplify usage of some TDF_* flags.
  2017-05-24 21:23                     ` Martin Liška
@ 2017-05-26 11:46                       ` Richard Biener
  0 siblings, 0 replies; 54+ messages in thread
From: Richard Biener @ 2017-05-26 11:46 UTC (permalink / raw)
  To: Martin Liška; +Cc: Trevor Saunders, GCC Patches, Steven Bosscher

On Wed, May 24, 2017 at 10:48 PM, Martin Liška <mliska@suse.cz> wrote:
> Hi Richi.
>
> That's a small reminder. I CCed Steven, but I guess if the TDF_COMMENT would
> be really
> important, it can be eventually added back.
>
> May I install the patch now?

Ok.

Richard.

> Thanks,
> Martin

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

* Re: [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum.
  2017-05-25  9:56                   ` Martin Liška
  2017-05-25 10:58                     ` Nathan Sidwell
@ 2017-05-26 13:00                     ` Richard Biener
  2017-05-26 13:54                       ` Martin Liška
  1 sibling, 1 reply; 54+ messages in thread
From: Richard Biener @ 2017-05-26 13:00 UTC (permalink / raw)
  To: Martin Liška
  Cc: Martin Sebor, Trevor Saunders, GCC Patches, Nathan Sidwell

On Thu, May 25, 2017 at 11:52 AM, Martin Liška <mliska@suse.cz> wrote:
> On 05/25/2017 05:35 AM, Martin Sebor wrote:
>> On 05/12/2017 07:04 AM, Martin Liška wrote:
>>> Third part removes TDF_* flags mentioned in the subject. These flags are used
>>> to enable all passes of specific type and Nathan has recently separated these
>>> by a new pair of macros. I hope moving these to a separate enum will help even more.
>>
>> Just as an FYI, the addition of the user-defined constructor makes
>> the class non-trivial and so unsafe to initialize by calling memset
>> in C++ 11 and later.  In C++ 98 that GCC is compiled with, the class
>> is not a POD and so not safe to realloc (i.e., new objects must be
>> brought to life by calling a constructor).  I noticed this by testing
>> my latest patch for the new -Wclass-memassign warning but I thought
>> it might be worth noting here as well.
>
> Hi.
>
> Thanks for heads up. I'm not sure why the class is no longer POD as one can define
> constructors (but not copy-ctors) in order to preserve a type to be POD?
> I'm also interested what is the new warning -Wclass-memassign about?
>
>>
>> +  /* Constructor.  */
>> +  dump_file_info ();
>> +
>> +  /* Constructor.  */
>> +  dump_file_info (const char *_suffix, const char *_swtch, dump_kind _dkind,
>> +          int _num);
>> +
>>
>> Also, making the ctor constexpr and defining it in the .c file will
>> trigger Clang -Wundefined-inline and makes the ctor unusable in other
>> sources.  AFAICS, there is no constexpr context where the constexpr
>> ctor would be needed so I'm not sure I understand its purpose.  Is
>> it constexpr to allow the static initialization of dump_files[0]?
>> (All the other elements of the array are dynamically initialized
>> by calling the other, non-constexpr ctor so that doesn't seem like
>> the answer.)
>
> Yep, that was Richi's objection to use constexpr and I know it's used
> just for the first elements of the array.
> Richi?

Well, then we have to go without the constructor.  Runtime init isn't
an option IMHO.
Just use some macros for the eye candy, will you?

Richard.

> Martin
>
>>
>> Martin
>

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

* Re: [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum.
  2017-05-26 13:00                     ` Richard Biener
@ 2017-05-26 13:54                       ` Martin Liška
  2017-05-30 11:46                         ` Richard Biener
  0 siblings, 1 reply; 54+ messages in thread
From: Martin Liška @ 2017-05-26 13:54 UTC (permalink / raw)
  To: Richard Biener; +Cc: Martin Sebor, Trevor Saunders, GCC Patches, Nathan Sidwell

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

On 05/26/2017 02:31 PM, Richard Biener wrote:
> Well, then we have to go without the constructor.  Runtime init isn't
> an option IMHO.
> Just use some macros for the eye candy, will you?
> 
> Richard.

Yep. I'm testing following eye candy patch.
Ready to install after tests?

Martin

[-- Attachment #2: 0001-Remove-dump_file_info-dump_file_info-and-replace-it-.patch --]
[-- Type: text/x-patch, Size: 3656 bytes --]

From 5339db7288e6ba28b65b166bc3f008c08c765834 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 26 May 2017 15:08:45 +0200
Subject: [PATCH] Remove dump_file_info::dump_file_info and replace it with
 macro.

gcc/ChangeLog:

2017-05-26  Martin Liska  <mliska@suse.cz>

	* dumpfile.c: Use newly added macro DUMP_FILE_INFO.
	* dumpfile.h (struct dump_file_info): Remove ctors.
---
 gcc/dumpfile.c | 42 ++++++++++++++----------------------------
 gcc/dumpfile.h |  7 -------
 2 files changed, 14 insertions(+), 35 deletions(-)

diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 233e6b19916..b8bda3c9183 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -47,41 +47,27 @@ FILE *alt_dump_file = NULL;
 const char *dump_file_name;
 dump_flags_t dump_flags;
 
-CONSTEXPR dump_file_info::dump_file_info (): suffix (NULL), swtch (NULL),
-  glob (NULL), pfilename (NULL), alt_filename (NULL), pstream (NULL),
-  alt_stream (NULL), dkind (DK_none), pflags (), alt_flags (0),
-  optgroup_flags (0), pstate (0), alt_state (0), num (0), owns_strings (false),
-  graph_dump_initialized (false)
-{
-}
-
-dump_file_info::dump_file_info (const char *_suffix, const char *_swtch,
-				dump_kind _dkind, int _num):
-  suffix (_suffix), swtch (_swtch), glob (NULL),
-  pfilename (NULL), alt_filename (NULL), pstream (NULL), alt_stream (NULL),
-  dkind (_dkind), pflags (), alt_flags (0), optgroup_flags (0),
-  pstate (0), alt_state (0), num (_num), owns_strings (false),
-  graph_dump_initialized (false)
-{
-}
+#define DUMP_FILE_INFO(suffix, swtch, dkind, num) \
+  {suffix, swtch, NULL, NULL, NULL, NULL, NULL, dkind, 0, 0, 0, 0, 0, num, \
+   false, false}
 
 /* Table of tree dump switches. This must be consistent with the
    TREE_DUMP_INDEX enumeration in dumpfile.h.  */
 static struct dump_file_info dump_files[TDI_end] =
 {
-  dump_file_info (),
-  dump_file_info (".cgraph", "ipa-cgraph", DK_ipa, 0),
-  dump_file_info (".type-inheritance", "ipa-type-inheritance", DK_ipa, 0),
-  dump_file_info (".ipa-clones", "ipa-clones", DK_ipa, 0),
-  dump_file_info (".original", "tree-original", DK_tree, 3),
-  dump_file_info (".gimple", "tree-gimple", DK_tree, 4),
-  dump_file_info (".nested", "tree-nested", DK_tree, 5),
+  DUMP_FILE_INFO (NULL, NULL, DK_none, 0),
+  DUMP_FILE_INFO (".cgraph", "ipa-cgraph", DK_ipa, 0),
+  DUMP_FILE_INFO (".type-inheritance", "ipa-type-inheritance", DK_ipa, 0),
+  DUMP_FILE_INFO (".ipa-clones", "ipa-clones", DK_ipa, 0),
+  DUMP_FILE_INFO (".original", "tree-original", DK_tree, 3),
+  DUMP_FILE_INFO (".gimple", "tree-gimple", DK_tree, 4),
+  DUMP_FILE_INFO (".nested", "tree-nested", DK_tree, 5),
 #define FIRST_AUTO_NUMBERED_DUMP 3
 
-  dump_file_info (NULL, "lang-all", DK_lang, 0),
-  dump_file_info (NULL, "tree-all", DK_tree, 0),
-  dump_file_info (NULL, "rtl-all", DK_rtl, 0),
-  dump_file_info (NULL, "ipa-all", DK_ipa, 0),
+  DUMP_FILE_INFO (NULL, "lang-all", DK_lang, 0),
+  DUMP_FILE_INFO (NULL, "tree-all", DK_tree, 0),
+  DUMP_FILE_INFO (NULL, "rtl-all", DK_rtl, 0),
+  DUMP_FILE_INFO (NULL, "ipa-all", DK_ipa, 0),
 };
 
 /* Define a name->number mapping for a dump flag value.  */
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index a60777f344d..fda8d712c43 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -120,13 +120,6 @@ typedef uint64_t dump_flags_t;
 /* Define a tree dump switch.  */
 struct dump_file_info
 {
-  /* Constructor.  */
-  CONSTEXPR dump_file_info ();
-
-  /* Constructor.  */
-  dump_file_info (const char *_suffix, const char *_swtch, dump_kind _dkind,
-		  int _num);
-
   /* Suffix to give output file.  */
   const char *suffix;
   /* Command line dump switch.  */
-- 
2.12.2


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

* Re: [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum.
  2017-05-26 13:54                       ` Martin Liška
@ 2017-05-30 11:46                         ` Richard Biener
  0 siblings, 0 replies; 54+ messages in thread
From: Richard Biener @ 2017-05-30 11:46 UTC (permalink / raw)
  To: Martin Liška
  Cc: Martin Sebor, Trevor Saunders, GCC Patches, Nathan Sidwell

On Fri, May 26, 2017 at 3:25 PM, Martin Liška <mliska@suse.cz> wrote:
> On 05/26/2017 02:31 PM, Richard Biener wrote:
>> Well, then we have to go without the constructor.  Runtime init isn't
>> an option IMHO.
>> Just use some macros for the eye candy, will you?
>>
>> Richard.
>
> Yep. I'm testing following eye candy patch.
> Ready to install after tests?

Yes.

Thanks,
Richard.

> Martin

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

end of thread, other threads:[~2017-05-30 11:30 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03  8:14 [RFC][PATCH] Introduce -fdump*-folding Martin Liška
2017-05-03  8:20 ` Andrew Pinski
2017-05-03 10:16 ` Richard Biener
2017-05-04  9:23   ` Martin Liška
2017-05-04 10:41     ` Richard Biener
2017-05-04 12:06       ` Martin Liška
2017-05-05 10:44         ` [PATCH 1/N] Introduce dump_flags_t type and use it instead of int type Martin Liška
2017-05-05 11:50           ` Richard Biener
2017-05-06 15:04             ` Trevor Saunders
2017-05-12 13:01               ` [PATCH v2 01/N] Add default value for last argument of dump functions Martin Liška
2017-05-16 13:49                 ` Richard Biener
2017-05-12 13:04               ` [PATCH v2 2/N] Introduce dump_flags_t type and use it instead of int, type Martin Liška
2017-05-16 13:50                 ` Richard Biener
2017-05-16 14:56                   ` Martin Liška
2017-05-17  7:55                     ` Richard Biener
2017-05-17  9:06                       ` Martin Liška
2017-05-18 13:37                         ` Thomas Schwinge
2017-05-18 14:26                           ` Martin Liška
2017-05-12 13:30               ` [PATCH v2 3/N] Transform TDF_{lang,tree,ipa,rtl} to dump_kind enum Martin Liška
2017-05-16 14:17                 ` Richard Biener
2017-05-17 12:22                 ` Richard Biener
2017-05-18 12:37                   ` Martin Liška
2017-05-25  5:29                 ` Martin Sebor
2017-05-25  9:56                   ` Martin Liška
2017-05-25 10:58                     ` Nathan Sidwell
2017-05-26 13:00                     ` Richard Biener
2017-05-26 13:54                       ` Martin Liška
2017-05-30 11:46                         ` Richard Biener
2017-05-16 13:55               ` [PATCH v2 04/N] Simplify usage of some TDF_* flags Martin Liška
2017-05-17 12:37                 ` Richard Biener
2017-05-18 12:58                   ` Martin Liška
2017-05-24 21:23                     ` Martin Liška
2017-05-26 11:46                       ` Richard Biener
2017-05-24 11:04               ` [PATCH v2 05/N] Add -fdump*-folding suboption Martin Liška
2017-05-24 13:53                 ` Richard Biener
2017-05-05 10:56         ` [PATCH 2/N] Add dump_flags_type<E> for handling of suboptions Martin Liška
2017-05-09 12:05           ` Martin Liška
2017-05-12 17:47           ` Martin Sebor
2017-05-15  6:52             ` Martin Sebor
2017-05-15  9:47           ` [RFC] Do we want hierarchical options & encapsulation in a class Martin Liška
2017-05-15 11:26             ` Nathan Sidwell
2017-05-15 12:24               ` Martin Liška
2017-05-15 11:46             ` Nathan Sidwell
2017-05-15 12:05               ` Martin Liška
2017-05-15 12:43                 ` Nathan Sidwell
2017-05-15 13:50                   ` Martin Liška
2017-05-15 14:13                     ` Nathan Sidwell
2017-05-15 14:24                       ` Martin Liška
2017-05-16 13:44                         ` Richard Biener
2017-05-05 11:57         ` [RFC][PATCH] Introduce -fdump*-folding Richard Biener
2017-05-09 12:03           ` Martin Liška
2017-05-09 12:19             ` Richard Biener
2017-05-09 12:52               ` Martin Liška
2017-05-09 13:01                 ` Richard Biener

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