Dump default defs for arguments, static chain and decl-by-reference

2015-12-14  Tom de Vries  <tom@codesourcery.com>

	PR other/68882
	* gimple-pretty-print.c (dump_ssaname_info_to_file): New function.
	* gimple-pretty-print.h (dump_ssaname_info_to_file): Declare.
	* tree-cfg.c (dump_default_def): New function.
	(dump_function_to_file): Dump default defs for arguments, static chain,
	and decl-by-reference.

From-SVN: r231630
This commit is contained in:
Tom de Vries 2015-12-14 19:29:48 +00:00 committed by Tom de Vries
parent 44eba92d0a
commit 0482b001d4
4 changed files with 67 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2015-12-14 Tom de Vries <tom@codesourcery.com>
PR other/68882
* gimple-pretty-print.c (dump_ssaname_info_to_file): New function.
* gimple-pretty-print.h (dump_ssaname_info_to_file): Declare.
* tree-cfg.c (dump_default_def): New function.
(dump_function_to_file): Dump default defs for arguments, static chain,
and decl-by-reference.
2015-12-14 Nathan Sidwell <nathan@acm.org>
* config/nvptx/nvptx.h (PARM_BOUNDARY): Set to 32.

View File

@ -1887,6 +1887,17 @@ dump_ssaname_info (pretty_printer *buffer, tree node, int spc)
}
}
/* As dump_ssaname_info, but dump to FILE. */
void
dump_ssaname_info_to_file (FILE *file, tree node, int spc)
{
pretty_printer buffer;
pp_needs_newline (&buffer) = true;
buffer.buffer->stream = file;
dump_ssaname_info (&buffer, node, spc);
pp_flush (&buffer);
}
/* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
The caller is responsible for calling pp_flush on BUFFER to finalize

View File

@ -34,5 +34,6 @@ extern void print_gimple_expr (FILE *, gimple *, int, int);
extern void pp_gimple_stmt_1 (pretty_printer *, gimple *, int, int);
extern void gimple_dump_bb (FILE *, basic_block, int, int);
extern void gimple_dump_bb_for_graph (pretty_printer *, basic_block);
extern void dump_ssaname_info_to_file (FILE *, tree, int);
#endif /* ! GCC_GIMPLE_PRETTY_PRINT_H */

View File

@ -7312,6 +7312,23 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
return bb;
}
/* Dump default def DEF to file FILE using FLAGS and indentation
SPC. */
static void
dump_default_def (FILE *file, tree def, int spc, int flags)
{
for (int i = 0; i < spc; ++i)
fprintf (file, " ");
dump_ssaname_info_to_file (file, def, spc);
print_generic_expr (file, TREE_TYPE (def), flags);
fprintf (file, " ");
print_generic_expr (file, def, flags);
fprintf (file, " = ");
print_generic_expr (file, SSA_NAME_VAR (def), flags);
fprintf (file, ";\n");
}
/* Dump FUNCTION_DECL FN to file FILE using FLAGS (see TDF_* in dumpfile.h)
*/
@ -7391,6 +7408,35 @@ dump_function_to_file (tree fndecl, FILE *file, int flags)
ignore_topmost_bind = true;
fprintf (file, "{\n");
if (gimple_in_ssa_p (fun)
&& (flags & TDF_ALIAS))
{
for (arg = DECL_ARGUMENTS (fndecl); arg != NULL;
arg = DECL_CHAIN (arg))
{
tree def = ssa_default_def (fun, arg);
if (def)
dump_default_def (file, def, 2, flags);
}
tree res = DECL_RESULT (fun->decl);
if (res != NULL_TREE
&& DECL_BY_REFERENCE (res))
{
tree def = ssa_default_def (fun, res);
if (def)
dump_default_def (file, def, 2, flags);
}
tree static_chain = fun->static_chain_decl;
if (static_chain != NULL_TREE)
{
tree def = ssa_default_def (fun, static_chain);
if (def)
dump_default_def (file, def, 2, flags);
}
}
if (!vec_safe_is_empty (fun->local_decls))
FOR_EACH_LOCAL_DECL (fun, ix, var)
{