summaryrefslogtreecommitdiff
path: root/gcc/dumpfile.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2018-10-04 17:41:08 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2018-10-04 17:41:08 +0000
commit7db960c5b6adad2fd11789870aa514985ea0da04 (patch)
treed01b112eba4bb441f9238c70760336301eaddcd7 /gcc/dumpfile.h
parent5e1b4477fa0c1eca86d2b67808ffee5ac969acd4 (diff)
Add -fopt-info-internals
This patch introduces a verbosity level to dump messages: "user-facing" vs "internals". By default, messages at the top-level dump scope are "user-facing", whereas those that are in nested scopes are implicitly "internals", and are filtered out by -fopt-info unless a new "-internals" sub-option of "-fopt-info" is supplied (intended purely for use by GCC developers). Dumpfiles are unaffected by the change. Given that the vectorizer is the only subsystem using AUTO_DUMP_SCOPE (via DUMP_VECT_SCOPE), this only affects the vectorizer. Filtering out these implementation-detail messages goes a long way towards making -fopt-info-vec-all more accessible to advanced end-users; the follow-up patch restores the most pertinent missing details. gcc/ChangeLog: * doc/invoke.texi (-fopt-info): Document new "internals" sub-option. * dump-context.h (dump_context::apply_dump_filter_p): New decl. * dumpfile.c (dump_options): Update for renaming of MSG_ALL to MSG_ALL_KINDS. (optinfo_verbosity_options): Add "internals". (kind_as_string): Update for renaming of MSG_ALL to MSG_ALL_KINDS. (dump_context::apply_dump_filter_p): New member function. (dump_context::dump_loc): Use apply_dump_filter_p rather than explicitly masking the dump_kind. (dump_context::begin_scope): Increment the scope depth first. Use apply_dump_filter_p rather than explicitly masking the dump_kind. (dump_context::emit_item): Use apply_dump_filter_p rather than explicitly masking the dump_kind. (dump_dec): Likewise. (dump_hex): Likewise. (dump_switch_p_1): Default to MSG_ALL_PRIORITIES. (opt_info_switch_p_1): Default to MSG_PRIORITY_USER_FACING. (opt_info_switch_p): Update handling of default MSG_OPTIMIZED_LOCATIONS to cope with default of MSG_PRIORITY_USER_FACING. (dump_basic_block): Use apply_dump_filter_p rather than explicitly masking the dump_kind. (selftest::test_capture_of_dump_calls): Update test_dump_context instances to use MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING rather than MSG_ALL. Generalize scope test to be run at all four combinations of with/without MSG_PRIORITY_USER_FACING and MSG_PRIORITY_INTERNALS, adding examples of explicit priority for each of the two values. * dumpfile.h (enum dump_flag): Add comment about the MSG_* flags. Rename MSG_ALL to MSG_ALL_KINDS. Add MSG_PRIORITY_USER_FACING, MSG_PRIORITY_INTERNALS, and MSG_ALL_PRIORITIES, updating the values for TDF_COMPARE_DEBUG and TDF_ALL_VALUES. (AUTO_DUMP_SCOPE): Add a note to the comment about the interaction with MSG_PRIORITY_*. * tree-vect-loop-manip.c (vect_loop_versioning): Mark versioning dump messages as MSG_PRIORITY_USER_FACING. * tree-vectorizer.h (DUMP_VECT_SCOPE): Add a note to the comment about the interaction with MSG_PRIORITY_*. gcc/testsuite/ChangeLog: * gcc.dg/plugin/dump-1.c: Update expected output for test_scopes due to "-internals" not being selected. * gcc.dg/plugin/dump-2.c: New test, based on dump-1.c, with "-internals" added to re-enable the output from test_scopes. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add dump-2.c. From-SVN: r264851
Diffstat (limited to 'gcc/dumpfile.h')
-rw-r--r--gcc/dumpfile.h41
1 files changed, 35 insertions, 6 deletions
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index 057ca46746e..59339057c1b 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -145,6 +145,9 @@ enum dump_flag
/* Dump folding details. */
TDF_FOLDING = (1 << 21),
+ /* MSG_* flags for expressing the kinds of message to
+ be emitted by -fopt-info. */
+
/* -fopt-info optimized sources. */
MSG_OPTIMIZED_LOCATIONS = (1 << 22),
@@ -154,15 +157,37 @@ enum dump_flag
/* General optimization info. */
MSG_NOTE = (1 << 24),
- MSG_ALL = (MSG_OPTIMIZED_LOCATIONS
- | MSG_MISSED_OPTIMIZATION
- | MSG_NOTE),
+ /* Mask for selecting MSG_-kind flags. */
+ MSG_ALL_KINDS = (MSG_OPTIMIZED_LOCATIONS
+ | MSG_MISSED_OPTIMIZATION
+ | MSG_NOTE),
+
+ /* MSG_PRIORITY_* flags for expressing the priority levels of message
+ to be emitted by -fopt-info, and filtering on them.
+ By default, messages at the top-level dump scope are "user-facing",
+ whereas those that are in nested scopes are implicitly "internals".
+ This behavior can be overridden for a given dump message by explicitly
+ specifying one of the MSG_PRIORITY_* flags.
+
+ By default, dump files show both kinds of message, whereas -fopt-info
+ only shows "user-facing" messages, and requires the "-internals"
+ sub-option of -fopt-info to show the internal messages. */
+
+ /* Implicitly supplied for messages at the top-level dump scope. */
+ MSG_PRIORITY_USER_FACING = (1 << 25),
+
+ /* Implicitly supplied for messages within nested dump scopes. */
+ MSG_PRIORITY_INTERNALS = (1 << 26),
+
+ /* Mask for selecting MSG_PRIORITY_* flags. */
+ MSG_ALL_PRIORITIES = (MSG_PRIORITY_USER_FACING
+ | MSG_PRIORITY_INTERNALS),
/* Dumping for -fcompare-debug. */
- TDF_COMPARE_DEBUG = (1 << 25),
+ TDF_COMPARE_DEBUG = (1 << 27),
/* All values. */
- TDF_ALL_VALUES = (1 << 26) - 1
+ TDF_ALL_VALUES = (1 << 28) - 1
};
/* Dump flags type. */
@@ -549,7 +574,11 @@ class auto_dump_scope
and then calling
dump_end_scope ();
once the object goes out of scope, thus capturing the nesting of
- the scopes. */
+ the scopes.
+
+ These scopes affect dump messages within them: dump messages at the
+ 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)