dumpfile.c: add indentation via DUMP_VECT_SCOPE
commitb18ceb23391902f41a487bde30862e1c8345b30c
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Jun 2018 09:56:40 +0000 (29 09:56 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Jun 2018 09:56:40 +0000 (29 09:56 +0000)
tree51378b372948340b17f7da85b6fb2375dfa3a031
parent106790efc5197862857c08afef585fb75734ad2a
dumpfile.c: add indentation via DUMP_VECT_SCOPE

This patch adds a concept of nested "scopes" to dumpfile.c's dump_*_loc
calls, and wires it up to the DUMP_VECT_SCOPE macro in tree-vectorizer.h,
so that the nested structure is shown in -fopt-info by indentation.

For example, this converts -fopt-info-all 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 that the "symbolic number of iterations" message is within
the "=== analyze_loop_nest ===" (and not within the
"=== vect_analyze_loop_form ===").

This is also enabling work for followups involving optimization records
(allowing the records to directly capture the nested structure of the
dump messages).

gcc/ChangeLog:
* dumpfile.c (dump_loc): Add indentation based on scope depth.
(dump_scope_depth): New variable.
(get_dump_scope_depth): New function.
(dump_begin_scope): New function.
(dump_end_scope): New function.
* dumpfile.h (get_dump_scope_depth): New declaration.
(dump_begin_scope): New declaration.
(dump_end_scope): New declaration.
(class auto_dump_scope): New class.
(AUTO_DUMP_SCOPE): New macro.
* tree-vectorizer.h (DUMP_VECT_SCOPE): Reimplement in terms of
AUTO_DUMP_SCOPE.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262246 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/dumpfile.c
gcc/dumpfile.h
gcc/tree-vectorizer.h