summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-live.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2009-02-27 20:49:42 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2009-02-27 19:49:42 +0000
commitcff7525fb078f60cffd2050f93eb7a257cf158a4 (patch)
tree88b2c40a53c2a5175a5910476fd385f50ff0d754 /gcc/tree-ssa-live.c
parentc20993b9959c1586b273eba9c50282a7a56064dd (diff)
downloadgcc-cff7525fb078f60cffd2050f93eb7a257cf158a4.tar.gz
re PR debug/39267 (gdb testsuite regressions)
PR debug/39267 * tree.h (TREE_PROTECTED): Fix comment. (BLOCK_HANDLER_BLOCK): Remove. (struct tree_block): Remove handler_block add body_block. (inlined_function_outer_scope_p): New. (is_body_block): Remove. * dbxout.c (dbxout_block): Remove BLOCK_HANDLER_BLOCK. * dwarf2out.c (is_inlined_entry_point): Remove. (add_high_low_attributes): Use inlined_function_outer_scope_p. (gen_block_die): Use is_inlined_entry_point check; remove body block code. * langhooks.h (struct lang_hooks): Remove no_bodu_blocks. * gimplify.c (gimplify_expr): Gimplify body blocks. * tree-ssa-live.c (remove_unused_scope_block_p): Allow removing wrapper block with multiple subblocks. (dump_scope_block): Prettier output; dump more flags and info. (dump_scope_blocks): New. (remove_unused_locals): Use dump_scope_blocks. * tree-flow.h (dump_scope_blocks): Declare. * tree-cfg.c (execute_build_cfg): Dump scope blocks. * stmt.c (is_body_block): Remove. * tree-inline.c (remap_block): Copy BODY_BLOCK info. * langhooks-def.h (LANG_HOOKS_NO_BODY_BLOCKS): Remove. From-SVN: r144474
Diffstat (limited to 'gcc/tree-ssa-live.c')
-rw-r--r--gcc/tree-ssa-live.c83
1 files changed, 62 insertions, 21 deletions
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 81e65f732e1..15166cc8f5e 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -541,8 +541,13 @@ remove_unused_scope_block_p (tree scope)
{
tree next = BLOCK_CHAIN (*t);
tree supercontext = BLOCK_SUPERCONTEXT (*t);
+
*t = BLOCK_SUBBLOCKS (*t);
- gcc_assert (!BLOCK_CHAIN (*t));
+ while (BLOCK_CHAIN (*t))
+ {
+ BLOCK_SUPERCONTEXT (*t) = supercontext;
+ t = &BLOCK_CHAIN (*t);
+ }
BLOCK_CHAIN (*t) = next;
BLOCK_SUPERCONTEXT (*t) = supercontext;
t = &BLOCK_CHAIN (*t);
@@ -556,23 +561,40 @@ remove_unused_scope_block_p (tree scope)
t = &BLOCK_CHAIN (*t);
nsubblocks ++;
}
+
+
+ if (!unused)
+ ;
/* Outer scope is always used. */
- if (!BLOCK_SUPERCONTEXT (scope)
- || TREE_CODE (BLOCK_SUPERCONTEXT (scope)) == FUNCTION_DECL)
+ else if (!BLOCK_SUPERCONTEXT (scope)
+ || TREE_CODE (BLOCK_SUPERCONTEXT (scope)) == FUNCTION_DECL)
+ unused = false;
+ /* Innermost blocks with no live variables nor statements can be always
+ eliminated. */
+ else if (!nsubblocks)
+ ;
+ /* If there are live subblocks and we still have some unused variables
+ or types declared, we must keep them.
+ Before inliing we must not depend on debug info verbosity to keep
+ DECL_UIDs stable. */
+ else if (!cfun->after_inlining && BLOCK_VARS (scope))
unused = false;
- /* If there are more than one live subblocks, it is used. */
- else if (nsubblocks > 1)
+ /* For terse debug info we can eliminate info on unused variables. */
+ else if (debug_info_level == DINFO_LEVEL_NONE
+ || debug_info_level == DINFO_LEVEL_TERSE)
+ ;
+ else if (BLOCK_VARS (scope))
unused = false;
- /* When there is only one subblock, see if it is just wrapper we can
- ignore. Wrappers are not declaring any variables and not changing
- abstract origin. */
- else if (nsubblocks == 1
- && (BLOCK_VARS (scope)
- || ((debug_info_level == DINFO_LEVEL_NORMAL
- || debug_info_level == DINFO_LEVEL_VERBOSE)
- && ((BLOCK_ABSTRACT_ORIGIN (scope)
- != BLOCK_ABSTRACT_ORIGIN (BLOCK_SUPERCONTEXT (scope)))))))
+ /* See if this block is important for representation of inlined function.
+ Inlined functions are always represented by block with
+ block_ultimate_origin being set to FUNCTION_DECL and DECL_SOURCE_LOCATION
+ set... */
+ else if (inlined_function_outer_scope_p (scope))
unused = false;
+ else
+ /* Verfify that only blocks with source location set
+ are entry points to the inlined functions. */
+ gcc_assert (BLOCK_SOURCE_LOCATION (scope) == UNKNOWN_LOCATION);
return unused;
}
@@ -592,14 +614,27 @@ dump_scope_block (FILE *file, int indent, tree scope, int flags)
{
tree var, t;
- fprintf (file, "\n%*sScope block #%i %s\n",indent, "" , BLOCK_NUMBER (scope),
- TREE_USED (scope) ? "" : "(unused)");
- if (BLOCK_ABSTRACT_ORIGIN (scope) && DECL_P (block_ultimate_origin (scope)))
+ fprintf (file, "\n%*s{ Scope block #%i%s%s",indent, "" , BLOCK_NUMBER (scope),
+ TREE_USED (scope) ? "" : " (unused)",
+ BLOCK_ABSTRACT (scope) ? " (abstract)": "");
+ if (BLOCK_SOURCE_LOCATION (scope) != UNKNOWN_LOCATION)
+ {
+ expanded_location s = expand_location (BLOCK_SOURCE_LOCATION (scope));
+ fprintf (file, " %s:%i", s.file, s.line);
+ }
+ if (BLOCK_ABSTRACT_ORIGIN (scope))
{
- fprintf (file, "\n%*sOriginating from ",indent + 1, "");
- print_generic_decl (file, block_ultimate_origin (scope), flags);
- fprintf (file, "\n");
+ tree origin = block_ultimate_origin (scope);
+ if (origin)
+ {
+ fprintf (file, " Originating from :");
+ if (DECL_P (origin))
+ print_generic_decl (file, origin, flags);
+ else
+ fprintf (file, "#%i", BLOCK_NUMBER (origin));
+ }
}
+ fprintf (file, " \n");
for (var = BLOCK_VARS (scope); var; var = TREE_CHAIN (var))
{
bool used = false;
@@ -615,8 +650,14 @@ dump_scope_block (FILE *file, int indent, tree scope, int flags)
}
for (t = BLOCK_SUBBLOCKS (scope); t ; t = BLOCK_CHAIN (t))
dump_scope_block (file, indent + 2, t, flags);
+ fprintf (file, "\n%*s}\n",indent, "");
}
+void
+dump_scope_blocks (FILE *file, int flags)
+{
+ dump_scope_block (file, 0, DECL_INITIAL (current_function_decl), flags);
+}
/* Remove local variables that are not referenced in the IL. */
@@ -760,7 +801,7 @@ remove_unused_locals (void)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Scope blocks after cleanups:\n");
- dump_scope_block (dump_file, 0, DECL_INITIAL (current_function_decl), false);
+ dump_scope_blocks (dump_file, dump_flags);
}
}