summaryrefslogtreecommitdiff
path: root/gcc/dumpfile.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2018-06-08 12:50:19 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2018-06-08 12:50:19 +0000
commit4af78ef8695b08bd9b7061b350631d2ca5682470 (patch)
tree9b0395fcd2992bfb4e0d71fc9ccf656400b80e1f /gcc/dumpfile.h
parenta7efc32b58491ec3b1293c41354ff96d458ef884 (diff)
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.h')
-rw-r--r--gcc/dumpfile.h231
1 files changed, 171 insertions, 60 deletions
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index 21803a60580..153f91ef57e 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -58,65 +58,175 @@ enum dump_kind
the DUMP_OPTIONS array in dumpfile.c. The TDF_* flags coexist with
MSG_* flags (for -fopt-info) and the bit values must be chosen to
allow that. */
-#define TDF_ADDRESS (1 << 0) /* dump node addresses */
-#define TDF_SLIM (1 << 1) /* don't go wild following links */
-#define TDF_RAW (1 << 2) /* don't unparse the function */
-#define TDF_DETAILS (1 << 3) /* show more detailed info about
- each pass */
-#define TDF_STATS (1 << 4) /* dump various statistics about
- each pass */
-#define TDF_BLOCKS (1 << 5) /* display basic block boundaries */
-#define TDF_VOPS (1 << 6) /* display virtual operands */
-#define TDF_LINENO (1 << 7) /* display statement line numbers */
-#define TDF_UID (1 << 8) /* display decl UIDs */
-
-#define TDF_STMTADDR (1 << 9) /* Address of stmt. */
-
-#define TDF_GRAPH (1 << 10) /* a graph dump is being emitted */
-#define TDF_MEMSYMS (1 << 11) /* display memory symbols in expr.
- Implies TDF_VOPS. */
-
-#define TDF_RHS_ONLY (1 << 12) /* a flag to only print the RHS of
- a gimple stmt. */
-#define TDF_ASMNAME (1 << 13) /* display asm names of decls */
-#define TDF_EH (1 << 14) /* display EH region number
- holding this gimple statement. */
-#define TDF_NOUID (1 << 15) /* omit UIDs from dumps. */
-#define TDF_ALIAS (1 << 16) /* display alias information */
-#define TDF_ENUMERATE_LOCALS (1 << 17) /* Enumerate locals by uid. */
-#define TDF_CSELIB (1 << 18) /* Dump cselib details. */
-#define TDF_SCEV (1 << 19) /* Dump SCEV details. */
-#define TDF_GIMPLE (1 << 20) /* Dump in GIMPLE FE syntax */
-#define TDF_FOLDING (1 << 21) /* Dump folding details. */
-#define MSG_OPTIMIZED_LOCATIONS (1 << 22) /* -fopt-info optimized sources */
-#define MSG_MISSED_OPTIMIZATION (1 << 23) /* missed opportunities */
-#define MSG_NOTE (1 << 24) /* general optimization info */
-#define MSG_ALL (MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION \
- | MSG_NOTE)
-#define TDF_COMPARE_DEBUG (1 << 25) /* Dumping for -fcompare-debug. */
-
-
-/* Value of TDF_NONE is used just for bits filtered by TDF_KIND_MASK. */
-
-#define TDF_NONE 0
+enum dump_flag
+{
+ /* Value of TDF_NONE is used just for bits filtered by TDF_KIND_MASK. */
+ TDF_NONE = 0,
+
+ /* Dump node addresses. */
+ TDF_ADDRESS = (1 << 0),
+
+ /* Don't go wild following links. */
+ TDF_SLIM = (1 << 1),
+
+ /* Don't unparse the function. */
+ TDF_RAW = (1 << 2),
+
+ /* Show more detailed info about each pass. */
+ TDF_DETAILS = (1 << 3),
+
+ /* Dump various statistics about each pass. */
+ TDF_STATS = (1 << 4),
+
+ /* Display basic block boundaries. */
+ TDF_BLOCKS = (1 << 5),
+
+ /* Display virtual operands. */
+ TDF_VOPS = (1 << 6),
+
+ /* Display statement line numbers. */
+ TDF_LINENO = (1 << 7),
+
+ /* Display decl UIDs. */
+ TDF_UID = (1 << 8),
+
+ /* Address of stmt. */
+ TDF_STMTADDR = (1 << 9),
+
+ /* A graph dump is being emitted. */
+ TDF_GRAPH = (1 << 10),
+
+ /* Display memory symbols in expr.
+ Implies TDF_VOPS. */
+ TDF_MEMSYMS = (1 << 11),
+
+ /* A flag to only print the RHS of a gimple stmt. */
+ TDF_RHS_ONLY = (1 << 12),
+
+ /* Display asm names of decls. */
+ TDF_ASMNAME = (1 << 13),
+
+ /* Display EH region number holding this gimple statement. */
+ TDF_EH = (1 << 14),
+
+ /* Omit UIDs from dumps. */
+ TDF_NOUID = (1 << 15),
+
+ /* Display alias information. */
+ TDF_ALIAS = (1 << 16),
+
+ /* Enumerate locals by uid. */
+ TDF_ENUMERATE_LOCALS = (1 << 17),
+
+ /* Dump cselib details. */
+ TDF_CSELIB = (1 << 18),
+
+ /* Dump SCEV details. */
+ TDF_SCEV = (1 << 19),
+
+ /* Dump in GIMPLE FE syntax */
+ TDF_GIMPLE = (1 << 20),
+
+ /* Dump folding details. */
+ TDF_FOLDING = (1 << 21),
+
+ /* -fopt-info optimized sources. */
+ MSG_OPTIMIZED_LOCATIONS = (1 << 22),
+
+ /* Missed opportunities. */
+ MSG_MISSED_OPTIMIZATION = (1 << 23),
+
+ /* General optimization info. */
+ MSG_NOTE = (1 << 24),
+
+ MSG_ALL = (MSG_OPTIMIZED_LOCATIONS
+ | MSG_MISSED_OPTIMIZATION
+ | MSG_NOTE),
+
+ /* Dumping for -fcompare-debug. */
+ TDF_COMPARE_DEBUG = (1 << 25)
+};
+
+/* Dump flags type. */
+
+typedef enum dump_flag dump_flags_t;
+
+static inline dump_flags_t
+operator| (dump_flags_t lhs, dump_flags_t rhs)
+{
+ return (dump_flags_t)((int)lhs | (int)rhs);
+}
+
+static inline dump_flags_t
+operator& (dump_flags_t lhs, dump_flags_t rhs)
+{
+ return (dump_flags_t)((int)lhs & (int)rhs);
+}
+
+static inline dump_flags_t
+operator~ (dump_flags_t flags)
+{
+ return (dump_flags_t)~((int)flags);
+}
+
+static inline dump_flags_t &
+operator|= (dump_flags_t &lhs, dump_flags_t rhs)
+{
+ lhs = (dump_flags_t)((int)lhs | (int)rhs);
+ return lhs;
+}
+
+static inline dump_flags_t &
+operator&= (dump_flags_t &lhs, dump_flags_t rhs)
+{
+ lhs = (dump_flags_t)((int)lhs & (int)rhs);
+ return lhs;
+}
/* Flags to control high-level -fopt-info dumps. Usually these flags
define a group of passes. An optimization pass can be part of
multiple groups. */
-#define OPTGROUP_NONE (0)
-#define OPTGROUP_IPA (1 << 1) /* IPA optimization passes */
-#define OPTGROUP_LOOP (1 << 2) /* Loop optimization passes */
-#define OPTGROUP_INLINE (1 << 3) /* Inlining passes */
-#define OPTGROUP_OMP (1 << 4) /* OMP (Offloading and Multi
- Processing) transformations */
-#define OPTGROUP_VEC (1 << 5) /* Vectorization passes */
-#define OPTGROUP_OTHER (1 << 6) /* All other passes */
-#define OPTGROUP_ALL (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \
- | OPTGROUP_OMP | OPTGROUP_VEC | OPTGROUP_OTHER)
-/* Dump flags type. */
+enum optgroup_flag
+{
+ OPTGROUP_NONE = 0,
+
+ /* IPA optimization passes */
+ OPTGROUP_IPA = (1 << 1),
+
+ /* Loop optimization passes */
+ OPTGROUP_LOOP = (1 << 2),
+
+ /* Inlining passes */
+ OPTGROUP_INLINE = (1 << 3),
-typedef uint64_t dump_flags_t;
+ /* OMP (Offloading and Multi Processing) transformations */
+ OPTGROUP_OMP = (1 << 4),
+
+ /* Vectorization passes */
+ OPTGROUP_VEC = (1 << 5),
+
+ /* All other passes */
+ OPTGROUP_OTHER = (1 << 6),
+
+ OPTGROUP_ALL = (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE
+ | OPTGROUP_OMP | OPTGROUP_VEC | OPTGROUP_OTHER)
+};
+
+typedef enum optgroup_flag optgroup_flags_t;
+
+static inline optgroup_flags_t
+operator| (optgroup_flags_t lhs, optgroup_flags_t rhs)
+{
+ return (optgroup_flags_t)((int)lhs | (int)rhs);
+}
+
+static inline optgroup_flags_t &
+operator|= (optgroup_flags_t &lhs, optgroup_flags_t rhs)
+{
+ lhs = (optgroup_flags_t)((int)lhs | (int)rhs);
+ return lhs;
+}
/* Define a tree dump switch. */
struct dump_file_info
@@ -140,9 +250,9 @@ struct dump_file_info
/* Dump flags. */
dump_flags_t pflags;
/* A pass flags for -fopt-info. */
- int alt_flags;
+ dump_flags_t alt_flags;
/* Flags for -fopt-info given by a user. */
- int optgroup_flags;
+ optgroup_flags_t optgroup_flags;
/* State of pass-specific stream. */
int pstate;
/* State of the -fopt-info stream. */
@@ -166,8 +276,8 @@ extern void dump_printf (dump_flags_t, const char *, ...) ATTRIBUTE_PRINTF_2;
extern void dump_printf_loc (dump_flags_t, source_location,
const char *, ...) ATTRIBUTE_PRINTF_3;
extern void dump_function (int phase, tree fn);
-extern void dump_basic_block (int, basic_block, int);
-extern void dump_generic_expr_loc (int, source_location, int, tree);
+extern void dump_basic_block (dump_flags_t, basic_block, int);
+extern void dump_generic_expr_loc (dump_flags_t, source_location, 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, source_location, dump_flags_t,
gimple *, int);
@@ -176,7 +286,7 @@ extern void print_combine_total_stats (void);
extern bool enable_rtl_dump_file (void);
template<unsigned int N, typename C>
-void dump_dec (int, const poly_int<N, C> &);
+void dump_dec (dump_flags_t, const poly_int<N, C> &);
/* In tree-dump.c */
extern void dump_node (const_tree, dump_flags_t, FILE *);
@@ -214,7 +324,8 @@ public:
SUFFIX, SWTCH, and GLOB. */
unsigned int
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);
/* Allow languages and middle-end to register their dumps before the
optimization passes. */
@@ -275,7 +386,7 @@ private:
dump_enable_all (dump_kind dkind, dump_flags_t flags, const char *filename);
int
- 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);
private: