aboutsummaryrefslogtreecommitdiff
path: root/gcc/dumpfile.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2013-10-14 16:15:38 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2013-10-14 16:15:38 +0000
commit47e0da377eb7021c043244cd4ff99669eb1a370c (patch)
treea2a58a4c89a20875a0fa23706d4171d2fe967ef5 /gcc/dumpfile.h
parent811189d91a29fbced411a62f9fcea66e2b7882cb (diff)
downloadgcc-47e0da377eb7021c043244cd4ff99669eb1a370c.zip
gcc-47e0da377eb7021c043244cd4ff99669eb1a370c.tar.gz
gcc-47e0da377eb7021c043244cd4ff99669eb1a370c.tar.bz2
Introduce gcc::dump_manager class
gcc/ * dumpfile.h (gcc::dump_manager): New class, to hold state relating to dumpfile management. (get_dump_file_name): Remove in favor of method of dump_manager. (dump_initialized_p): Likewise. (dump_start): Likewise. (dump_finish): Likewise. (dump_switch_p): Likewise. (dump_register): Likewise. (get_dump_file_info): Likewise. * context.c (gcc::context::context): Construct the dump_manager instance. * context.h (gcc::context::get_dumps): New. (gcc::context::m_dumps): New. * coverage.c (coverage_init): Port to dump_manager API. * dumpfile.c (extra_dump_files): Convert to field of gcc::dump_manager. (extra_dump_files_in_use): Likewise. (extra_dump_files_alloced): Likewise. (gcc::dump_manager::dump_manager): New. (dump_register): Convert to... (gcc::dump_manager::dump_register): ...method, replacing function-static next_dump with m_next_dump field. (get_dump_file_info): Convert to... (gcc::dump_manager::get_dump_file_info): ...method. (get_dump_file_name): Convert to... (gcc::dump_manager::get_dump_file_name): ...method. (dump_start): Convert to... (gcc::dump_manager::dump_start): ...method. (dump_finish): Convert to... (gcc::dump_manager::dump_finish): ...method. (dump_begin): Replace body with... (gcc::dump_manager::dump_begin): ...new method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_phase_enabled_p): Convert to... (gcc::dump_manager::dump_phase_enabled_p): ...method. (dump_initialized_p): Convert to... (gcc::dump_manager::dump_initialized_p): ...method. (dump_flag_name): Replace body with... (gcc::dump_manager::dump_flag_name): ...new method. (dump_enable_all): Convert to... (gcc::dump_manager::dump_enable_all): ...new method. (opt_info_enable_passes): Convert to... (gcc::dump_manager::opt_info_enable_passes): ...new method. (dump_switch_p_1): Convert to... (gcc::dump_manager::dump_switch_p_1): ...new method. (dump_switch_p): Convert to... (gcc::dump_manager::dump_switch_p): ...new method. (opt_info_switch_p): Port to dump_manager API. (enable_rtl_dump_file): Likewise. * opts-global.c (handle_common_deferred_options): Port to new dump_manager API. * passes.c (pass_manager::finish_optimization_passes): Likewise. (pass_manager::register_one_dump_file): Likewise. (pass_manager::register_pass): Likewise. (pass_init_dump_file): Likewise. (pass_fini_dump_file): Likewise. * statistics.c (statistics_early_init): Likewise. gcc/java/ * lang.c (java_handle_option): Update for introduction of gcc::dump_manager. From-SVN: r203569
Diffstat (limited to 'gcc/dumpfile.h')
-rw-r--r--gcc/dumpfile.h90
1 files changed, 80 insertions, 10 deletions
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index ddc770a..a6b377e 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -121,13 +121,8 @@ struct dump_file_info
};
/* In dumpfile.c */
-extern char *get_dump_file_name (int);
-extern int dump_initialized_p (int);
extern FILE *dump_begin (int, int *);
extern void dump_end (int, FILE *);
-extern int dump_start (int, int *);
-extern void dump_finish (int);
-extern int dump_switch_p (const char *);
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;
@@ -139,8 +134,6 @@ 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 print_combine_total_stats (void);
-extern unsigned int dump_register (const char *, const char *, const char *,
- int, int);
extern bool enable_rtl_dump_file (void);
/* In tree-dump.c */
@@ -157,9 +150,6 @@ extern FILE *alt_dump_file;
extern int dump_flags;
extern const char *dump_file_name;
-/* Return the dump_file_info for the given phase. */
-extern struct dump_file_info *get_dump_file_info (int);
-
/* Return true if any of the dumps is enabled, false otherwise. */
static inline bool
dump_enabled_p (void)
@@ -167,4 +157,84 @@ dump_enabled_p (void)
return (dump_file || alt_dump_file);
}
+namespace gcc {
+
+class dump_manager
+{
+public:
+
+ dump_manager ();
+
+ unsigned int
+ dump_register (const char *suffix, const char *swtch, const char *glob,
+ int flags, int optgroup_flags);
+
+ /* Return the dump_file_info for the given phase. */
+ struct dump_file_info *
+ get_dump_file_info (int phase) const;
+
+ /* Return the name of the dump file for the given phase.
+ If the dump is not enabled, returns NULL. */
+ char *
+ get_dump_file_name (int phase) const;
+
+ int
+ dump_switch_p (const char *arg);
+
+ /* Start a dump for PHASE. Store user-supplied dump flags in
+ *FLAG_PTR. Return the number of streams opened. Set globals
+ DUMP_FILE, and ALT_DUMP_FILE to point to the opened streams, and
+ set dump_flags appropriately for both pass dump stream and
+ -fopt-info stream. */
+ int
+ dump_start (int phase, int *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. */
+ void
+ dump_finish (int phase);
+
+ FILE *
+ dump_begin (int phase, int *flag_ptr);
+
+ /* Returns nonzero if tree dump PHASE has been initialized. */
+ int
+ dump_initialized_p (int phase) const;
+
+ /* Returns the switch name of PHASE. */
+ const char *
+ dump_flag_name (int phase) const;
+
+private:
+
+ int
+ dump_phase_enabled_p (int phase) const;
+
+ int
+ dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob);
+
+ int
+ dump_enable_all (int flags, const char *filename);
+
+ int
+ opt_info_enable_passes (int optgroup_flags, int flags, const char *filename);
+
+private:
+
+ /* Dynamically registered dump files and switches. */
+ int m_next_dump;
+ struct dump_file_info *m_extra_dump_files;
+ size_t m_extra_dump_files_in_use;
+ size_t m_extra_dump_files_alloced;
+
+ /* 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
+
#endif /* GCC_DUMPFILE_H */