public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Enable match.pd dumping with -fdump-tree-original
@ 2022-07-12 10:37 Alex Coplan
0 siblings, 0 replies; only message in thread
From: Alex Coplan @ 2022-07-12 10:37 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9f4ac6c51abdd6a51dda683f53ee19b766661c7e
commit 9f4ac6c51abdd6a51dda683f53ee19b766661c7e
Author: Alex Coplan <alex.coplan@arm.com>
Date: Tue Jul 5 14:50:46 2022 +0100
Enable match.pd dumping with -fdump-tree-original
This is a backport to the Morello branch of upstream commit
1e2334302d6ad5dd8526c21b8062dc16a688f3e8.
This enables dumping of match.pd in the frontends with
-fdump-tree-original-folding or -fdump-tree-original-all.
Diff:
---
gcc/c-family/c-common.h | 1 -
gcc/c-family/c-gimplify.c | 6 +++++-
gcc/c-family/c-opts.c | 31 ++++++-------------------------
gcc/cgraph.c | 4 ++--
4 files changed, 13 insertions(+), 29 deletions(-)
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 4fdf78496ca..0479ea55323 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -937,7 +937,6 @@ 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, 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 0186f2bf086..b3bf15b39b3 100644
--- a/gcc/c-family/c-gimplify.c
+++ b/gcc/c-family/c-gimplify.c
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "dumpfile.h"
#include "c-ubsan.h"
+#include "context.h"
/* The gimplification pass converts the language-dependent trees
(ld-trees) emitted by the parser into language-independent trees
@@ -113,6 +114,7 @@ ubsan_walk_array_refs_r (tree *tp, int *walk_subtrees, void *data)
void
c_genericize (tree fndecl)
{
+ dump_file_info *dfi;
FILE *dump_orig;
dump_flags_t local_dump_flags;
struct cgraph_node *cgn;
@@ -129,7 +131,9 @@ c_genericize (tree fndecl)
do_warn_duplicated_branches_r, NULL);
/* Dump the C-specific tree IR. */
- dump_orig = get_dump_info (TDI_original, &local_dump_flags);
+ dfi = g->get_dumps ()->get_dump_file_info (TDI_original);
+ dump_orig = dfi->pstream;
+ local_dump_flags = dfi->pflags;
if (dump_orig)
{
fprintf (dump_orig, "\n;; Function %s",
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 38d33849423..d8621c60210 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see
#include "mkdeps.h"
#include "dumpfile.h"
#include "file-prefix-map.h" /* add_*_prefix_map() */
+#include "context.h"
#ifndef DOLLARS_IN_IDENTIFIERS
# define DOLLARS_IN_IDENTIFIERS true
@@ -100,10 +101,6 @@ static size_t deferred_count;
/* Number of deferred options scanned for -include. */
static size_t include_cursor;
-/* Dump files/flags to use during parsing. */
-static FILE *original_dump_file = NULL;
-static dump_flags_t original_dump_flags;
-
/* Whether any standard preincluded header has been preincluded. */
static bool done_preinclude;
@@ -1174,15 +1171,13 @@ c_common_init (void)
void
c_common_parse_file (void)
{
- unsigned int i;
-
- i = 0;
- for (;;)
+ auto dumps = g->get_dumps ();
+ for (unsigned int i = 0;;)
{
c_finish_options ();
/* Open the dump file to use for the original dump output
here, to be used during parsing for the current file. */
- original_dump_file = dump_begin (TDI_original, &original_dump_flags);
+ dumps->dump_start (TDI_original, &dump_flags);
pch_init ();
push_file_scope ();
c_parse_file ();
@@ -1196,29 +1191,15 @@ c_common_parse_file (void)
cpp_clear_file_cache (parse_in);
this_input_filename
= cpp_read_main_file (parse_in, in_fnames[i]);
- if (original_dump_file)
- {
- dump_end (TDI_original, original_dump_file);
- original_dump_file = NULL;
- }
/* If an input file is missing, abandon further compilation.
cpplib has issued a diagnostic. */
if (!this_input_filename)
break;
+ dumps->dump_finish (TDI_original);
}
c_parse_final_cleanups ();
-}
-
-/* Returns the appropriate dump file for PHASE to dump with FLAGS. */
-
-FILE *
-get_dump_info (int phase, dump_flags_t *flags)
-{
- gcc_assert (phase == TDI_original);
-
- *flags = original_dump_flags;
- return original_dump_file;
+ dumps->dump_finish (TDI_original);
}
/* Common finish hook for the C, ObjC and C++ front ends. */
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index c0b45795059..465a7b7f8ce 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -546,12 +546,12 @@ cgraph_node::get_create (tree decl)
node->order = first_clone->order;
symtab->symtab_prevail_in_asm_name_hash (node);
node->decl->decl_with_vis.symtab_node = node;
- if (dump_file)
+ if (dump_file && symtab->state != PARSING)
fprintf (dump_file, "Introduced new external node "
"(%s) and turned into root of the clone tree.\n",
node->dump_name ());
}
- else if (dump_file)
+ else if (dump_file && symtab->state != PARSING)
fprintf (dump_file, "Introduced new external node "
"(%s).\n", node->dump_name ());
return node;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-12 10:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 10:37 [gcc(refs/vendors/ARM/heads/morello)] Enable match.pd dumping with -fdump-tree-original Alex Coplan
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).