diff options
author | Richard Biener <rguenther@suse.de> | 2020-05-25 16:10:12 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-05-27 11:07:37 +0200 |
commit | f61f9b28793d94060ce858e5f8a080db91785779 (patch) | |
tree | 209e3957dcd0f54f72ea7ba599123b063db4430a /gcc/dump-context.h | |
parent | baff22c48bdee9cb644b7336bf6f20f799531507 (diff) | |
download | gcc-f61f9b28793d94060ce858e5f8a080db91785779.zip gcc-f61f9b28793d94060ce858e5f8a080db91785779.tar.gz gcc-f61f9b28793d94060ce858e5f8a080db91785779.tar.bz2 |
Add debug (slp_tree) and dump infrastructure for this
This adds an alternate debug_dump_context similar to the one for
selftests but for interactive debugging routines. This allows
to share code between user-visible dumping via the dump_* API
and those debugging routines. The primary driver was SLP node
dumping which wasn't accessible from inside a gdb session up to
now.
2020-05-27 Richard Biener <rguenther@suse.de>
* dump-context.h (debug_dump_context): New class.
(dump_context): Make it friend.
* dumpfile.c (debug_dump_context::debug_dump_context):
Implement.
(debug_dump_context::~debug_dump_context): Likewise.
* tree-vect-slp.c: Include dump-context.h.
(vect_print_slp_tree): Dump a single SLP node.
(debug): New overload for slp_tree.
(vect_print_slp_graph): Rename from vect_print_slp_tree and
use that.
(vect_analyze_slp_instance): Adjust.
Diffstat (limited to 'gcc/dump-context.h')
-rw-r--r-- | gcc/dump-context.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/dump-context.h b/gcc/dump-context.h index 347477f..3f72cc9 100644 --- a/gcc/dump-context.h +++ b/gcc/dump-context.h @@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see class optrecord_json_writer; namespace selftest { class temp_dump_context; } +class debug_dump_context; /* A class for handling the various dump_* calls. @@ -42,6 +43,7 @@ namespace selftest { class temp_dump_context; } class dump_context { friend class selftest::temp_dump_context; + friend class debug_dump_context; public: static dump_context &get () { return *s_current; } @@ -195,6 +197,25 @@ private: auto_vec<stashed_item> m_stashed_items; }; +/* An RAII-style class for use in debug dumpers for temporarily using a + different dump_context. It enables full details and outputs to + stderr instead of the currently active dump_file. */ + +class debug_dump_context +{ + public: + debug_dump_context (); + ~debug_dump_context (); + + private: + dump_context m_context; + dump_context *m_saved; + dump_flags_t m_saved_flags; + dump_flags_t m_saved_pflags; + FILE *m_saved_file; +}; + + #if CHECKING_P namespace selftest { |