[04/10] Use indentation to show nesting for -fopt-info

Message ID 1527626483-4723-5-git-send-email-dmalcolm@redhat.com
State New
Headers show
Series
  • RFC: Prototype of compiler-assisted performance analysis
Related show

Commit Message

David Malcolm May 29, 2018, 8:41 p.m.
This converts e.g. from:

test.c:8:3: note: === analyzing loop ===
test.c:8:3: note: === analyze_loop_nest ===
test.c:8:3: note: === vect_analyze_loop_form ===
test.c:8:3: note: === get_loop_niters ===
test.c:8:3: note: symbolic number of iterations is (unsigned int) n_9(D)
test.c:8:3: note: not vectorized: loop contains function calls or data references that cannot be analyzed
test.c:8:3: note: vectorized 0 loops in function

to:

test.c:8:3: note: === analyzing loop ===
test.c:8:3: note:  === analyze_loop_nest ===
test.c:8:3: note:   === vect_analyze_loop_form ===
test.c:8:3: note:    === get_loop_niters ===
test.c:8:3: note:   symbolic number of iterations is (unsigned int) n_9(D)
test.c:8:3: note:   not vectorized: loop contains function calls or data references that cannot be analyzed
test.c:8:3: note: vectorized 0 loops in function

showing the nesting of the optimization analysis and where each
message is being emitted from within it (this is of more use as
the number of messages and the nesting depth increases)

gcc/ChangeLog:
	* optinfo-emit-fopt-info.cc (emit_optinfo_via_fopt_info): Use
	indentation to show nesting.
---
 gcc/optinfo-emit-fopt-info.cc | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
1.8.5.3

Patch

diff --git a/gcc/optinfo-emit-fopt-info.cc b/gcc/optinfo-emit-fopt-info.cc
index b01a301..842681f 100644
--- a/gcc/optinfo-emit-fopt-info.cc
+++ b/gcc/optinfo-emit-fopt-info.cc
@@ -58,7 +58,13 @@  emit_optinfo_via_fopt_info (const optinfo *optinfo)
   if (optinfo->details_p ())
     flags |= TDF_DETAILS;
 
+  /* Source location and "note: ".  */
   dump_loc (flags, optinfo->get_location_t ());
+
+  /* Indentation to show scope nesting.  */
+  dump_printf (flags, "%*s", get_optinfo_scope_depth (), "");
+
+  /* The text itself.  */
   for (unsigned i = 0; i < optinfo->num_items (); i++)
     {
       const optinfo_item *item = optinfo->get_item (i);