Mercurial > hg > CbC > CbC_gcc
diff gcc/dumpfile.h @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
line wrap: on
line diff
--- a/gcc/dumpfile.h Thu Oct 25 07:37:49 2018 +0900 +++ b/gcc/dumpfile.h Thu Feb 13 11:34:05 2020 +0900 @@ -1,5 +1,5 @@ /* Definitions for the shared dumpfile. - Copyright (C) 2004-2018 Free Software Foundation, Inc. + Copyright (C) 2004-2020 Free Software Foundation, Inc. This file is part of GCC. @@ -193,6 +193,9 @@ /* Dumping for -fcompare-debug. */ TDF_COMPARE_DEBUG = (1 << 28), + /* For error. */ + TDF_ERROR = (1 << 26), + /* All values. */ TDF_ALL_VALUES = (1 << 29) - 1 }; @@ -364,8 +367,9 @@ /* A class for identifying where in the compiler's own source (or a plugin) that a dump message is being emitted from. */ -struct dump_impl_location_t +class dump_impl_location_t { +public: dump_impl_location_t ( #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) const char *file = __builtin_FILE (), @@ -385,6 +389,38 @@ const char *m_function; }; +/* A bundle of metadata for describing a dump message: + (a) the dump_flags + (b) the source location within the compiler/plugin. + + The constructors use default parameters so that (b) gets sets up + automatically. + + Hence you can pass in e.g. MSG_NOTE, and the dump call + will automatically record where in GCC's source code the + dump was emitted from. */ + +class dump_metadata_t +{ + public: + dump_metadata_t (dump_flags_t dump_flags, + const dump_impl_location_t &impl_location + = dump_impl_location_t ()) + : m_dump_flags (dump_flags), + m_impl_location (impl_location) + { + } + + dump_flags_t get_dump_flags () const { return m_dump_flags; } + + const dump_impl_location_t & + get_impl_location () const { return m_impl_location; } + + private: + dump_flags_t m_dump_flags; + dump_impl_location_t m_impl_location; +}; + /* A bundle of information for describing the location of a dump message: (a) the source location and hotness within the user's code, together with (b) the source location within the compiler/plugin. @@ -469,6 +505,8 @@ extern int opt_info_switch_p (const char *); extern const char *dump_flag_name (int); extern const kv_pair<optgroup_flags_t> optgroup_options[]; +extern dump_flags_t +parse_dump_option (const char *, const char **); /* Global variables used to communicate with passes. */ extern FILE *dump_file; @@ -521,27 +559,30 @@ to minimize the work done for the common case where dumps are disabled. */ -extern void dump_printf (dump_flags_t, const char *, ...) +extern void dump_printf (const dump_metadata_t &, const char *, ...) ATTRIBUTE_GCC_DUMP_PRINTF (2, 3); -extern void dump_printf_loc (dump_flags_t, const dump_location_t &, +extern void dump_printf_loc (const dump_metadata_t &, const dump_user_location_t &, const char *, ...) ATTRIBUTE_GCC_DUMP_PRINTF (3, 0); extern void dump_function (int phase, tree fn); extern void dump_basic_block (dump_flags_t, basic_block, int); -extern void dump_generic_expr_loc (dump_flags_t, const dump_location_t &, +extern void dump_generic_expr_loc (const dump_metadata_t &, + const dump_user_location_t &, dump_flags_t, tree); -extern void dump_generic_expr (dump_flags_t, dump_flags_t, tree); -extern void dump_gimple_stmt_loc (dump_flags_t, const dump_location_t &, +extern void dump_generic_expr (const dump_metadata_t &, dump_flags_t, tree); +extern void dump_gimple_stmt_loc (const dump_metadata_t &, + const dump_user_location_t &, dump_flags_t, gimple *, int); -extern void dump_gimple_stmt (dump_flags_t, dump_flags_t, gimple *, int); -extern void dump_gimple_expr_loc (dump_flags_t, const dump_location_t &, +extern void dump_gimple_stmt (const dump_metadata_t &, dump_flags_t, gimple *, int); +extern void dump_gimple_expr_loc (const dump_metadata_t &, + const dump_user_location_t &, dump_flags_t, gimple *, int); -extern void dump_gimple_expr (dump_flags_t, dump_flags_t, gimple *, int); -extern void dump_symtab_node (dump_flags_t, symtab_node *); +extern void dump_gimple_expr (const dump_metadata_t &, dump_flags_t, gimple *, int); +extern void dump_symtab_node (const dump_metadata_t &, symtab_node *); template<unsigned int N, typename C> -void dump_dec (dump_flags_t, const poly_int<N, C> &); +void dump_dec (const dump_metadata_t &, const poly_int<N, C> &); extern void dump_dec (dump_flags_t, const poly_wide_int &, signop); extern void dump_hex (dump_flags_t, const poly_wide_int &); @@ -551,7 +592,9 @@ leading to a dump message. */ extern unsigned int get_dump_scope_depth (); -extern void dump_begin_scope (const char *name, const dump_location_t &loc); +extern void dump_begin_scope (const char *name, + const dump_user_location_t &user_location, + const dump_impl_location_t &impl_location); extern void dump_end_scope (); /* Implementation detail of the AUTO_DUMP_SCOPE macro below. @@ -563,10 +606,13 @@ class auto_dump_scope { public: - auto_dump_scope (const char *name, dump_location_t loc) + auto_dump_scope (const char *name, + const dump_user_location_t &user_location, + const dump_impl_location_t &impl_location + = dump_impl_location_t ()) { if (dump_enabled_p ()) - dump_begin_scope (name, loc); + dump_begin_scope (name, user_location, impl_location); } ~auto_dump_scope () { @@ -576,7 +622,7 @@ }; /* A macro for calling: - dump_begin_scope (NAME, LOC); + dump_begin_scope (NAME, USER_LOC); via an RAII object, thus printing "=== MSG ===\n" to the dumpfile etc, and then calling dump_end_scope (); @@ -587,8 +633,8 @@ top level implicitly default to MSG_PRIORITY_USER_FACING, whereas those in a nested scope implicitly default to MSG_PRIORITY_INTERNALS. */ -#define AUTO_DUMP_SCOPE(NAME, LOC) \ - auto_dump_scope scope (NAME, LOC) +#define AUTO_DUMP_SCOPE(NAME, USER_LOC) \ + auto_dump_scope scope (NAME, USER_LOC) extern void dump_function (int phase, tree fn); extern void print_combine_total_stats (void); @@ -602,7 +648,7 @@ /* In cfghooks.c */ extern void dump_bb (FILE *, basic_block, int, dump_flags_t); -struct opt_pass; +class opt_pass; namespace gcc {