From 363dc72c15e5191a3f04bde3098793326f681b07 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 7 Jun 2017 10:57:11 +0200 Subject: [PATCH] dumpfile.h (enum tree_dump_index): Rename TDI_generic to TDI_gimple. * dumpfile.h (enum tree_dump_index): Rename TDI_generic to TDI_gimple. (class dump_manager): Add register_dumps method. * dumpfile.c: Include langhooks.h. (dump_files): Use 0 instead of 3/4/5 for TDI_{original,gimple,nested}. (FIRST_AUTO_NUMBERED_DUMP): Decrease to 1. (FIRST_ME_AUTO_NUMBERED_DUMP): Define. (dump_manager::dump_register): Start with 512 entries instead of 32. (dump_manager::register_dumps): New method. * toplev.c (general_init): Instead of invoking register_dumps langhook, invoke register_dumps method on the dump manager. * gimplify.c (gimplify_function_tree): Use TDI_gimple instead of TDI_generic. * gimple-parser.c (c_parser_parse_gimple_body): Use TDI_gimple instead of TDI_generic. From-SVN: r248947 --- gcc/ChangeLog | 16 ++++++++++++++++ gcc/c/ChangeLog | 5 +++++ gcc/c/gimple-parser.c | 2 +- gcc/dumpfile.c | 31 ++++++++++++++++++++++++++----- gcc/dumpfile.h | 7 ++++++- gcc/gimplify.c | 2 +- gcc/toplev.c | 6 +++--- 7 files changed, 58 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a5aaf47b5a4..f5fc52765d5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2017-06-07 Jakub Jelinek + + * dumpfile.h (enum tree_dump_index): Rename TDI_generic to + TDI_gimple. + (class dump_manager): Add register_dumps method. + * dumpfile.c: Include langhooks.h. + (dump_files): Use 0 instead of 3/4/5 for TDI_{original,gimple,nested}. + (FIRST_AUTO_NUMBERED_DUMP): Decrease to 1. + (FIRST_ME_AUTO_NUMBERED_DUMP): Define. + (dump_manager::dump_register): Start with 512 entries instead of 32. + (dump_manager::register_dumps): New method. + * toplev.c (general_init): Instead of invoking register_dumps + langhook, invoke register_dumps method on the dump manager. + * gimplify.c (gimplify_function_tree): Use TDI_gimple instead of + TDI_generic. + 2017-06-07 Richard Sandiford * doc/md.texi: Clarify the restrictions on a define_insn condition. diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 63cd3d4ab79..0f23eb3773b 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2017-06-07 Jakub Jelinek + + * gimple-parser.c (c_parser_parse_gimple_body): Use TDI_gimple instead + of TDI_generic. + 2017-06-06 Marek Polacek PR c/79983 diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c index fb9a5430f31..4a55904662e 100644 --- a/gcc/c/gimple-parser.c +++ b/gcc/c/gimple-parser.c @@ -116,7 +116,7 @@ c_parser_parse_gimple_body (c_parser *parser) we have to go through lowering again. */ cfun->curr_properties = PROP_gimple_any; - dump_function (TDI_generic, current_function_decl); + dump_function (TDI_gimple, current_function_decl); } /* Parse a compound statement in gimple function body. diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c index b8bda3c9183..c746d0b24ff 100644 --- a/gcc/dumpfile.c +++ b/gcc/dumpfile.c @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see #include "dumpfile.h" #include "context.h" #include "tree-cfg.h" +#include "langhooks.h" /* If non-NULL, return one past-the-end of the matching SUBPART of the WHOLE string. */ @@ -59,10 +60,11 @@ static struct dump_file_info dump_files[TDI_end] = 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 (".original", "tree-original", DK_tree, 0), + DUMP_FILE_INFO (".gimple", "tree-gimple", DK_tree, 0), + DUMP_FILE_INFO (".nested", "tree-nested", DK_tree, 0), +#define FIRST_AUTO_NUMBERED_DUMP 1 +#define FIRST_ME_AUTO_NUMBERED_DUMP 3 DUMP_FILE_INFO (NULL, "lang-all", DK_lang, 0), DUMP_FILE_INFO (NULL, "tree-all", DK_tree, 0), @@ -179,7 +181,7 @@ dump_register (const char *suffix, const char *swtch, const char *glob, if (count >= m_extra_dump_files_alloced) { if (m_extra_dump_files_alloced == 0) - m_extra_dump_files_alloced = 32; + m_extra_dump_files_alloced = 512; else m_extra_dump_files_alloced *= 2; m_extra_dump_files = XRESIZEVEC (struct dump_file_info, @@ -200,6 +202,25 @@ dump_register (const char *suffix, const char *swtch, const char *glob, } +/* Allow languages and middle-end to register their dumps before the + optimization passes. */ + +void +gcc::dump_manager:: +register_dumps () +{ + lang_hooks.register_dumps (this); + /* If this assert fails, some FE registered more than + FIRST_ME_AUTO_NUMBERED_DUMP - FIRST_AUTO_NUMBERED_DUMP + dump files. Bump FIRST_ME_AUTO_NUMBERED_DUMP accordingly. */ + gcc_assert (m_next_dump <= FIRST_ME_AUTO_NUMBERED_DUMP); + m_next_dump = FIRST_ME_AUTO_NUMBERED_DUMP; + dump_files[TDI_original].num = m_next_dump++; + dump_files[TDI_gimple].num = m_next_dump++; + dump_files[TDI_nested].num = m_next_dump++; +} + + /* Return the dump_file_info for the given phase. */ struct dump_file_info * diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h index fda8d712c43..4d9f6b3656a 100644 --- a/gcc/dumpfile.h +++ b/gcc/dumpfile.h @@ -31,7 +31,7 @@ enum tree_dump_index TDI_inheritance, /* dump type inheritance graph. */ TDI_clones, /* dump IPA cloning decisions. */ TDI_original, /* dump each function before optimizing it */ - TDI_generic, /* dump each function after genericizing it */ + TDI_gimple, /* dump each function after gimplifying it */ TDI_nested, /* dump each function after unnesting it */ TDI_lang_all, /* enable all the language dumps. */ @@ -212,6 +212,11 @@ public: dump_register (const char *suffix, const char *swtch, const char *glob, dump_kind dkind, int optgroup_flags, bool take_ownership); + /* Allow languages and middle-end to register their dumps before the + optimization passes. */ + void + register_dumps (); + /* Return the dump_file_info for the given phase. */ struct dump_file_info * get_dump_file_info (int phase) const; diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 2c7fc9fabd1..653057fd543 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -12732,7 +12732,7 @@ gimplify_function_tree (tree fndecl) pop_cfun (); - dump_function (TDI_generic, fndecl); + dump_function (TDI_gimple, fndecl); } /* Return a dummy expression of type TYPE in order to keep going after an diff --git a/gcc/toplev.c b/gcc/toplev.c index f8b5a4001c4..e6c69a4ba93 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1168,9 +1168,9 @@ general_init (const char *argv0, bool init_signals) dump manager. */ g = new gcc::context (); - /* Allow languages to register their dumps before the optimization - passes. */ - lang_hooks.register_dumps (g->get_dumps ()); + /* Allow languages and middle-end to register their dumps before the + optimization passes. */ + g->get_dumps ()->register_dumps (); /* Create the passes. */ g->set_passes (new gcc::pass_manager (g)); -- 2.30.2