diff options
author | David Malcolm <dmalcolm@redhat.com> | 2018-06-08 12:50:19 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2018-06-08 12:50:19 +0000 |
commit | 4af78ef8695b08bd9b7061b350631d2ca5682470 (patch) | |
tree | 9b0395fcd2992bfb4e0d71fc9ccf656400b80e1f /gcc/dumpfile.c | |
parent | a7efc32b58491ec3b1293c41354ff96d458ef884 (diff) | |
download | gcc-4af78ef8695b08bd9b7061b350631d2ca5682470.zip gcc-4af78ef8695b08bd9b7061b350631d2ca5682470.tar.gz gcc-4af78ef8695b08bd9b7061b350631d2ca5682470.tar.bz2 |
Convert dump and optgroup flags to enums
gcc/brig/ChangeLog:
* brigfrontend/brig-to-generic.cc
(brig_to_generic::write_globals): Use TDF_NONE rather than 0.
(dump_function): Likewise.
gcc/c-family/ChangeLog:
* c-pretty-print.c (c_pretty_printer::statement): Use TDF_NONE
rather than 0.
gcc/ChangeLog:
* cfg.c (debug): Use TDF_NONE rather than 0.
* cfghooks.c (debug): Likewise.
* dumpfile.c (DUMP_FILE_INFO): Likewise; also for OPTGROUP.
(struct dump_option_value_info): Convert to...
(struct kv_pair): ...this template type.
(dump_options): Convert to kv_pair<dump_flags_t>; use TDF_NONE
rather than 0.
(optinfo_verbosity_options): Likewise.
(optgroup_options): Convert to kv_pair<optgroup_flags_t>; use
OPTGROUP_NONE.
(gcc::dump_manager::dump_register): Use optgroup_flags_t rather
than int for "optgroup_flags" param.
(dump_generic_expr_loc): Use dump_flags_t rather than int for
"dump_kind" param.
(dump_dec): Likewise.
(dump_finish): Use TDF_NONE rather than 0.
(gcc::dump_manager::opt_info_enable_passes): Use optgroup_flags_t
rather than int for "optgroup_flags" param. Use TDF_NONE rather
than 0. Update for change to option_ptr.
(opt_info_switch_p_1): Convert "optgroup_flags" param from int *
to optgroup_flags_t *. Use TDF_NONE and OPTGROUP_NONE rather than
0. Update for changes to optinfo_verbosity_options and
optgroup_options.
(opt_info_switch_p): Convert optgroup_flags from int to
optgroup_flags_t.
(dump_basic_block): Use dump_flags_t rather than int
for "dump_kind" param.
* dumpfile.h (TDF_ADDRESS, TDF_SLIM, TDF_RAW, TDF_DETAILS,
TDF_STATS, TDF_BLOCKS, TDF_VOPS, TDF_LINENO, TDF_UID)
TDF_STMTADDR, TDF_GRAPH, TDF_MEMSYMS, TDF_RHS_ONLY, TDF_ASMNAME,
TDF_EH, TDF_NOUID, TDF_ALIAS, TDF_ENUMERATE_LOCALS, TDF_CSELIB,
TDF_SCEV, TDF_GIMPLE, TDF_FOLDING, MSG_OPTIMIZED_LOCATIONS,
MSG_MISSED_OPTIMIZATION, MSG_NOTE, MSG_ALL, TDF_COMPARE_DEBUG,
TDF_NONE): Convert from macros to...
(enum dump_flag): ...this new enum.
(dump_flags_t): Update to use enum.
(operator|, operator&, operator~, operator|=, operator&=):
Implement for dump_flags_t.
(OPTGROUP_NONE, OPTGROUP_IPA, OPTGROUP_LOOP, OPTGROUP_INLINE,
OPTGROUP_OMP, OPTGROUP_VEC, OPTGROUP_OTHER, OPTGROUP_ALL):
Convert from macros to...
(enum optgroup_flag): ...this new enum.
(optgroup_flags_t): New typedef.
(operator|, operator|=): Implement for optgroup_flags_t.
(struct dump_file_info): Convert field "alt_flags" to
dump_flags_t. Convert field "optgroup_flags" to
optgroup_flags_t.
(dump_basic_block): Use dump_flags_t rather than int for param.
(dump_generic_expr_loc): Likewise.
(dump_dec): Likewise.
(dump_register): Convert param "optgroup_flags" to
optgroup_flags_t.
(opt_info_enable_passes): Likewise.
* early-remat.c (early_remat::dump_edge_list): Use TDF_NONE rather
than 0.
* gimple-pretty-print.c (debug): Likewise.
* gimple-ssa-store-merging.c (bswap_replace): Likewise.
(merged_store_group::apply_stores): Likewise.
* gimple-ssa-strength-reduction.c (insert_initializers): Likewise.
* gimple.c (verify_gimple_pp): Likewise.
* graphite-poly.c (print_pbb_body): Likewise.
* passes.c (pass_manager::register_one_dump_file): Convert
local "optgroup_flags" to optgroup_flags_t.
* print-tree.c (print_node): Use TDF_NONE rather than 0.
(debug): Likewise.
(debug_body): Likewise.
* tree-pass.h (struct pass_data): Convert field "optgroup_flags"
to optgroup_flags_t.
* tree-pretty-print.c (print_struct_decl): Use TDF_NONE rather
than 0.
* tree-ssa-math-opts.c (convert_mult_to_fma_1): Likewise.
(convert_mult_to_fma): Likewise.
* tree-ssa-reassoc.c (undistribute_ops_list): Likewise.
* tree-ssa-sccvn.c (vn_eliminate): Likewise.
* tree-vect-data-refs.c (dump_lower_bound): Convert param
"dump_kind" to dump_flags_t.
From-SVN: r261325
Diffstat (limited to 'gcc/dumpfile.c')
-rw-r--r-- | gcc/dumpfile.c | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c index 0f16d4f..e94e274 100644 --- a/gcc/dumpfile.c +++ b/gcc/dumpfile.c @@ -50,8 +50,8 @@ const char *dump_file_name; dump_flags_t dump_flags; #define DUMP_FILE_INFO(suffix, swtch, dkind, num) \ - {suffix, swtch, NULL, NULL, NULL, NULL, NULL, dkind, 0, 0, 0, 0, 0, num, \ - false, false} + {suffix, swtch, NULL, NULL, NULL, NULL, NULL, dkind, TDF_NONE, TDF_NONE, \ + OPTGROUP_NONE, 0, 0, num, false, false} /* Table of tree dump switches. This must be consistent with the TREE_DUMP_INDEX enumeration in dumpfile.h. */ @@ -74,15 +74,16 @@ static struct dump_file_info dump_files[TDI_end] = }; /* Define a name->number mapping for a dump flag value. */ -struct dump_option_value_info +template <typename ValueType> +struct kv_pair { const char *const name; /* the name of the value */ - const dump_flags_t value; /* the value of the name */ + const ValueType value; /* the value of the name */ }; /* Table of dump options. This must be consistent with the TDF_* flags in dumpfile.h and opt_info_options below. */ -static const struct dump_option_value_info dump_options[] = +static const kv_pair<dump_flags_t> dump_options[] = { {"address", TDF_ADDRESS}, {"asmname", TDF_ASMNAME}, @@ -114,23 +115,23 @@ static const struct dump_option_value_info dump_options[] = {"all", dump_flags_t (~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_GRAPH | TDF_STMTADDR | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV | TDF_GIMPLE))}, - {NULL, 0} + {NULL, TDF_NONE} }; /* A subset of the dump_options table which is used for -fopt-info types. This must be consistent with the MSG_* flags in dumpfile.h. */ -static const struct dump_option_value_info optinfo_verbosity_options[] = +static const kv_pair<dump_flags_t> optinfo_verbosity_options[] = { {"optimized", MSG_OPTIMIZED_LOCATIONS}, {"missed", MSG_MISSED_OPTIMIZATION}, {"note", MSG_NOTE}, {"all", MSG_ALL}, - {NULL, 0} + {NULL, TDF_NONE} }; /* Flags used for -fopt-info groups. */ -static const struct dump_option_value_info optgroup_options[] = +static const kv_pair<optgroup_flags_t> optgroup_options[] = { {"ipa", OPTGROUP_IPA}, {"loop", OPTGROUP_LOOP}, @@ -138,7 +139,7 @@ static const struct dump_option_value_info optgroup_options[] = {"omp", OPTGROUP_OMP}, {"vec", OPTGROUP_VEC}, {"optall", OPTGROUP_ALL}, - {NULL, 0} + {NULL, OPTGROUP_NONE} }; gcc::dump_manager::dump_manager (): @@ -173,7 +174,8 @@ gcc::dump_manager::~dump_manager () unsigned int gcc::dump_manager:: dump_register (const char *suffix, const char *swtch, const char *glob, - dump_kind dkind, int optgroup_flags, bool take_ownership) + dump_kind dkind, optgroup_flags_t optgroup_flags, + bool take_ownership) { int num = m_next_dump++; @@ -425,7 +427,7 @@ dump_generic_expr (dump_flags_t dump_kind, dump_flags_t extra_dump_flags, location. */ void -dump_generic_expr_loc (int dump_kind, source_location loc, +dump_generic_expr_loc (dump_flags_t dump_kind, source_location loc, dump_flags_t extra_dump_flags, tree t) { if (dump_file && (dump_kind & pflags)) @@ -492,7 +494,7 @@ dump_printf_loc (dump_flags_t dump_kind, source_location loc, template<unsigned int N, typename C> void -dump_dec (int dump_kind, const poly_int<N, C> &value) +dump_dec (dump_flags_t dump_kind, const poly_int<N, C> &value) { STATIC_ASSERT (poly_coeff_traits<C>::signedness >= 0); signop sgn = poly_coeff_traits<C>::signedness ? SIGNED : UNSIGNED; @@ -503,11 +505,11 @@ dump_dec (int dump_kind, const poly_int<N, C> &value) print_dec (value, alt_dump_file, sgn); } -template void dump_dec (int, const poly_uint16 &); -template void dump_dec (int, const poly_int64 &); -template void dump_dec (int, const poly_uint64 &); -template void dump_dec (int, const poly_offset_int &); -template void dump_dec (int, const poly_widest_int &); +template void dump_dec (dump_flags_t, const poly_uint16 &); +template void dump_dec (dump_flags_t, const poly_int64 &); +template void dump_dec (dump_flags_t, const poly_uint64 &); +template void dump_dec (dump_flags_t, const poly_offset_int &); +template void dump_dec (dump_flags_t, const poly_widest_int &); /* Start a dump for PHASE. Store user-supplied dump flags in *FLAG_PTR. Return the number of streams opened. Set globals @@ -581,9 +583,9 @@ dump_finish (int phase) dfi->pstream = NULL; dump_file = NULL; alt_dump_file = NULL; - dump_flags = TDI_none; - alt_flags = 0; - pflags = 0; + dump_flags = TDF_NONE; + alt_flags = TDF_NONE; + pflags = TDF_NONE; } /* Begin a tree dump for PHASE. Stores any user supplied flag in @@ -749,7 +751,7 @@ dump_enable_all (dump_kind dkind, dump_flags_t flags, const char *filename) int gcc::dump_manager:: -opt_info_enable_passes (int optgroup_flags, dump_flags_t flags, +opt_info_enable_passes (optgroup_flags_t optgroup_flags, dump_flags_t flags, const char *filename) { int n = 0; @@ -816,11 +818,11 @@ dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob) return 0; ptr = option_value; - flags = 0; + flags = TDF_NONE; while (*ptr) { - const struct dump_option_value_info *option_ptr; + const struct kv_pair<dump_flags_t> *option_ptr; const char *end_ptr; const char *eq_ptr; unsigned length; @@ -902,8 +904,8 @@ dump_switch_p (const char *arg) and filename. Return non-zero if it is a recognized switch. */ static int -opt_info_switch_p_1 (const char *arg, dump_flags_t *flags, int *optgroup_flags, - char **filename) +opt_info_switch_p_1 (const char *arg, dump_flags_t *flags, + optgroup_flags_t *optgroup_flags, char **filename) { const char *option_value; const char *ptr; @@ -912,15 +914,14 @@ opt_info_switch_p_1 (const char *arg, dump_flags_t *flags, int *optgroup_flags, ptr = option_value; *filename = NULL; - *flags = 0; - *optgroup_flags = 0; + *flags = TDF_NONE; + *optgroup_flags = OPTGROUP_NONE; if (!ptr) return 1; /* Handle '-fopt-info' without any additional options. */ while (*ptr) { - const struct dump_option_value_info *option_ptr; const char *end_ptr; const char *eq_ptr; unsigned length; @@ -937,8 +938,8 @@ opt_info_switch_p_1 (const char *arg, dump_flags_t *flags, int *optgroup_flags, end_ptr = ptr + strlen (ptr); length = end_ptr - ptr; - for (option_ptr = optinfo_verbosity_options; option_ptr->name; - option_ptr++) + for (const kv_pair<dump_flags_t> *option_ptr = optinfo_verbosity_options; + option_ptr->name; option_ptr++) if (strlen (option_ptr->name) == length && !memcmp (option_ptr->name, ptr, length)) { @@ -946,7 +947,8 @@ opt_info_switch_p_1 (const char *arg, dump_flags_t *flags, int *optgroup_flags, goto found; } - for (option_ptr = optgroup_options; option_ptr->name; option_ptr++) + for (const kv_pair<optgroup_flags_t> *option_ptr = optgroup_options; + option_ptr->name; option_ptr++) if (strlen (option_ptr->name) == length && !memcmp (option_ptr->name, ptr, length)) { @@ -981,7 +983,7 @@ int opt_info_switch_p (const char *arg) { dump_flags_t flags; - int optgroup_flags; + optgroup_flags_t optgroup_flags; char *filename; static char *file_seen = NULL; gcc::dump_manager *dumps = g->get_dumps (); @@ -1012,7 +1014,7 @@ opt_info_switch_p (const char *arg) /* Print basic block on the dump streams. */ void -dump_basic_block (int dump_kind, basic_block bb, int indent) +dump_basic_block (dump_flags_t dump_kind, basic_block bb, int indent) { if (dump_file && (dump_kind & pflags)) dump_bb (dump_file, bb, indent, TDF_DETAILS); |