diff options
author | crowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-03-29 03:42:21 +0000 |
---|---|---|
committer | crowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-03-29 03:42:21 +0000 |
commit | c7d898053fac01f0769a105c889ba69f7557d51f (patch) | |
tree | de528ea277ef392f070fe1bc36b914944d19a24d /gcc/tree-data-ref.c | |
parent | 0cf89a0f64c28038d429c36cac39b8aea7a86c36 (diff) | |
download | gcc-c7d898053fac01f0769a105c889ba69f7557d51f.tar.gz |
Add uniform debug dump function names.
Add some overloaded functions that provide uniform debug dump
function names. These names are:
debug: the general debug dumper
debug_verbose: for more details
debug_raw: for the gory details
debug_head: for the heads of declarations, e.g. function heads
debug_body: for the bodies of declarations, e.g. function bodies
Not all types have the last four versions.
The debug functions come in two flavors, those that take pointers
to the type, and those that take references to the type. The first
handles printing of '<nil>' for null pointers. The second assumes
a valid reference, and prints the content.
Example uses are as follows:
cp_token t, *p;
debug (t);
debug (p);
From the debugger, use
call debug (t)
The functions sets implemented are:
debug (only)
basic_block_def, const bitmap_head_def, cp_binding_level,
cp_parser, cp_token, data_reference, die_struct, edge_def,
gimple_statement_d, ira_allocno, ira_allocno_copy, live_range,
lra_live_range, omega_pb_d, pt_solution, const rtx_def, sreal,
tree_live_info_d, _var_map,
vec<cp_token, va_gc>, vec<data_reference_p>, vec<ddr_p>,
vec<rtx>, vec<tree, va_gc>,
debug and debug_raw
simple_bitmap_def
debug and debug_verbose
expr_def, struct loop, vinsn_def
debug, debug_raw, debug_verbose, debug_head, debug_body
const tree_node
This patch is somewhat different from the original plan at
gcc.gnu.org/wiki/cxx-conversion/debugging-dumps. The reason
is that gdb has an incomplete implementation of C++ call syntax;
requiring explicit specification of template arguments and explicit
specification of function arguments even when they have default
values. So, the original plan would have required typing
call dump <cp_token> (t, 0, 0, stderr)
which is undesireable. Instead instead of templates, we overload
plain functions. This adds a small burden of manually adding
the pointer version of dump for each type. Instead of default
function arguments, we simply assume the default values. Most of
the underlying dump functions did not use the options and indent
parameters anyway. Several provide FILE* parameters, but we expect
debugging to use stderr anyway. So, the explicit specification of
arguments was not as valuable as we thought initially. Finally,
a change of name from dump to debug reflect the implicit output
to stderr.
Index: gcc/ChangeLog
2013-03-28 Lawrence Crowl <crowl@google.com>
* Makefile.in: Add several missing include dependences.
(DUMPFILE_H): New.
(test-dump.o): New. This object is not added to any executable,
but is present for ad-hoc testing.
* bitmap.c
(debug (const bitmap_head_def &)): New.
(debug (const bitmap_head_def *)): New.
* bitmap.h
(extern debug (const bitmap_head_def &)): New.
(extern debug (const bitmap_head_def *)): New.
* cfg.c
(debug (edge_def &)): New.
(debug (edge_def *)): New.
* cfghooks.c
(debug (basic_block_def &)): New.
(debug (basic_block_def *)): New.
* dumpfile.h
(dump_node (const_tree, int, FILE *)): Correct source file.
* dwarf2out.c
(debug (die_struct &)): New.
(debug (die_struct *)): New.
* dwarf2out.h
(extern debug (die_struct &)): New.
(extern debug (die_struct *)): New.
* gimple-pretty-print.c
(debug (gimple_statement_d &)): New.
(debug (gimple_statement_d *)): New.
* gimple-pretty-print.h
(extern debug (gimple_statement_d &)): New.
(extern debug (gimple_statement_d *)): New.
* ira-build.c
(debug (ira_allocno_copy &)): New.
(debug (ira_allocno_copy *)): New.
(debug (ira_allocno &)): New.
(debug (ira_allocno *)): New.
* ira-int.h
(extern debug (ira_allocno_copy &)): New.
(extern debug (ira_allocno_copy *)): New.
(extern debug (ira_allocno &)): New.
(extern debug (ira_allocno *)): New.
* ira-lives.c
(debug (live_range &)): New.
(debug (live_range *)): New.
* lra-int.h
(debug (lra_live_range &)): New.
(debug (lra_live_range *)): New.
* lra-lives.c
(debug (lra_live_range &)): New.
(debug (lra_live_range *)): New.
* omega.c
(debug (omega_pb_d &)): New.
(debug (omega_pb_d *)): New.
* omega.h
(extern debug (omega_pb_d &)): New.
(extern debug (omega_pb_d *)): New.
* print-rtl.c
(debug (const rtx_def &)): New.
(debug (const rtx_def *)): New.
* print-tree.c
(debug_tree (tree): Move within file.
(debug_raw (const tree_node &)): New.
(debug_raw (const tree_node *)): New.
(dump_tree_via_hooks (const tree_node *, int)): New.
(debug (const tree_node &)): New.
(debug (const tree_node *)): New.
(debug_verbose (const tree_node &)): New.
(debug_verbose (const tree_node *)): New.
(debug_head (const tree_node &)): New.
(debug_head (const tree_node *)): New.
(debug_body (const tree_node &)): New.
(debug_body (const tree_node *)): New.
(debug_vec_tree (tree): Move and reimplement in terms of dump.
(debug (vec<tree, va_gc> &)): New.
(debug (vec<tree, va_gc> *)): New.
* rtl.h
(extern debug (const rtx_def &)): New.
(extern debug (const rtx_def *)): New.
* sbitmap.c
(debug_raw (simple_bitmap_def &)): New.
(debug_raw (simple_bitmap_def *)): New.
(debug (simple_bitmap_def &)): New.
(debug (simple_bitmap_def *)): New.
* sbitmap.h
(extern debug (simple_bitmap_def &)): New.
(extern debug (simple_bitmap_def *)): New.
(extern debug_raw (simple_bitmap_def &)): New.
(extern debug_raw (simple_bitmap_def *)): New.
* sel-sched-dump.c
(debug (vinsn_def &)): New.
(debug (vinsn_def *)): New.
(debug_verbose (vinsn_def &)): New.
(debug_verbose (vinsn_def *)): New.
(debug (expr_def &)): New.
(debug (expr_def *)): New.
(debug_verbose (expr_def &)): New.
(debug_verbose (expr_def *)): New.
(debug (vec<rtx> &)): New.
(debug (vec<rtx> *)): New.
* sel-sched-dump.h
(extern debug (vinsn_def &)): New.
(extern debug (vinsn_def *)): New.
(extern debug_verbose (vinsn_def &)): New.
(extern debug_verbose (vinsn_def *)): New.
(extern debug (expr_def &)): New.
(extern debug (expr_def *)): New.
(extern debug_verbose (expr_def &)): New.
(extern debug_verbose (expr_def *)): New.
(extern debug (vec<rtx> &)): New.
(extern debug (vec<rtx> *)): New.
* sel-sched-ir.h
(_list_iter_cond_expr): Make inline instead of static.
* sreal.c
(debug (sreal &)): New.
(debug (sreal *)): New.
* sreal.h
(extern debug (sreal &)): New.
(extern debug (sreal *)): New.
* tree.h
(extern debug_raw (const tree_node &)): New.
(extern debug_raw (const tree_node *)): New.
(extern debug (const tree_node &)): New.
(extern debug (const tree_node *)): New.
(extern debug_verbose (const tree_node &)): New.
(extern debug_verbose (const tree_node *)): New.
(extern debug_head (const tree_node &)): New.
(extern debug_head (const tree_node *)): New.
(extern debug_body (const tree_node &)): New.
(extern debug_body (const tree_node *)): New.
(extern debug (vec<tree, va_gc> &)): New.
(extern debug (vec<tree, va_gc> *)): New.
* tree-cfg.c
(debug (struct loop &)): New.
(debug (struct loop *)): New.
(debug_verbose (struct loop &)): New.
(debug_verbose (struct loop *)): New.
* tree-dump.c: Add header dependence.
* tree-flow.h
(extern debug (struct loop &)): New.
(extern debug (struct loop *)): New.
(extern debug_verbose (struct loop &)): New.
(extern debug_verbose (struct loop *)): New.
* tree-data-ref.c
(debug (data_reference &)): New.
(debug (data_reference *)): New.
(debug (vec<data_reference_p> &)): New.
(debug (vec<data_reference_p> *)): New.
(debug (vec<ddr_p> &)): New.
(debug (vec<ddr_p> *)): New.
* tree-data-ref.h
(extern debug (data_reference &)): New.
(extern debug (data_reference *)): New.
(extern debug (vec<data_reference_p> &)): New.
(extern debug (vec<data_reference_p> *)): New.
(extern debug (vec<ddr_p> &)): New.
(extern debug (vec<ddr_p> *)): New.
* tree-ssa-alias.c
(debug (pt_solution &)): New.
(debug (pt_solution *)): New.
* tree-ssa-alias.h
(extern debug (pt_solution &)): New.
(extern debug (pt_solution *)): New.
* tree-ssa-alias.c
(debug (_var_map &)): New.
(debug (_var_map *)): New.
(debug (tree_live_info_d &)): New.
(debug (tree_live_info_d *)): New.
* tree-ssa-alias.h
(extern debug (_var_map &)): New.
(extern debug (_var_map *)): New.
(extern debug (tree_live_info_d &)): New.
(extern debug (tree_live_info_d *)): New.
Index: gcc/cp/ChangeLog
2013-03-28 Lawrence Crowl <crowl@google.com>
* Make-lang.in
(CXX_PARSER_H): Add header dependence.
* cp-tree.h
(extern debug (cp_binding_level &)): New.
(extern debug (cp_binding_level *)): New.
* name-lookup.h
(debug (cp_binding_level &)): New.
(debug (cp_binding_level *)): New.
* parser.c
(debug (cp_parser &)): New.
(debug (cp_parser *)): New.
(debug (cp_token &)): New.
(debug (cp_token *)): New.
(debug (vec<cp_token, va_gc> &)): New.
(debug (vec<cp_token, va_gc> *)): New.
* parser.c: Add header dependence.
(extern debug (cp_parser &)): New.
(extern debug (cp_parser *)): New.
(extern debug (cp_token &)): New.
(extern debug (cp_token *)): New.
(extern debug (vec<cp_token, va_gc> &)): New.
(extern debug (vec<cp_token, va_gc> *)): New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197224 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r-- | gcc/tree-data-ref.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index a387d8202e6..10431c09237 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -149,6 +149,24 @@ dump_data_references (FILE *file, vec<data_reference_p> datarefs) dump_data_reference (file, dr); } +/* Unified dump into FILE all the data references from DATAREFS. */ + +DEBUG_FUNCTION void +debug (vec<data_reference_p> &ref) +{ + dump_data_references (stderr, ref); +} + +DEBUG_FUNCTION void +debug (vec<data_reference_p> *ptr) +{ + if (ptr) + debug (*ptr); + else + fprintf (stderr, "<nil>\n"); +} + + /* Dump into STDERR all the data references from DATAREFS. */ DEBUG_FUNCTION void @@ -190,6 +208,24 @@ dump_data_reference (FILE *outf, fprintf (outf, "#)\n"); } +/* Unified dump function for a DATA_REFERENCE structure. */ + +DEBUG_FUNCTION void +debug (data_reference &ref) +{ + dump_data_reference (stderr, &ref); +} + +DEBUG_FUNCTION void +debug (data_reference *ptr) +{ + if (ptr) + debug (*ptr); + else + fprintf (stderr, "<nil>\n"); +} + + /* Dumps the affine function described by FN to the file OUTF. */ static void @@ -442,6 +478,22 @@ dump_data_dependence_relations (FILE *file, dump_data_dependence_relation (file, ddr); } +DEBUG_FUNCTION void +debug (vec<ddr_p> &ref) +{ + dump_data_dependence_relations (stderr, ref); +} + +DEBUG_FUNCTION void +debug (vec<ddr_p> *ptr) +{ + if (ptr) + debug (*ptr); + else + fprintf (stderr, "<nil>\n"); +} + + /* Dump to STDERR all the dependence relations from DDRS. */ DEBUG_FUNCTION void |