diff options
author | Jan Hubicka <jh@suse.cz> | 2005-06-09 18:21:36 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2005-06-09 16:21:36 +0000 |
commit | 30be951ac7b465e1f10da0f70744364a8e678366 (patch) | |
tree | 2fd919060d8ecfb55a3a393c028c7ba1f01c5856 /gcc | |
parent | 2ffa9a0ce504d59abfa34e2b92d0f3e1aa3f6218 (diff) | |
download | gcc-30be951ac7b465e1f10da0f70744364a8e678366.zip gcc-30be951ac7b465e1f10da0f70744364a8e678366.tar.gz gcc-30be951ac7b465e1f10da0f70744364a8e678366.tar.bz2 |
cgraphunit.c (cgraph_create_edges): Do not walk BLOCK; finalize local statics when doing unit-at-a-time.
* cgraphunit.c (cgraph_create_edges): Do not walk BLOCK; finalize
local statics when doing unit-at-a-time.
(cgraph_varpool_assemble_pending_decls): Output debug info.
* dwarf2out.c (decls_for_scope): Skip local statics.
(dwarf2out_decl): Handle local statics.
* passes.c (rest_of_decl_compilation): Do not differentiate
local and global statics in unit-at-a-time.
* tree-inline.c (remap_decls): Put local static into
unexpanded_vars_list rather than introducing duplicated VAR_DECL
node.
From-SVN: r100802
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/cgraphunit.c | 37 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 9 | ||||
-rw-r--r-- | gcc/passes.c | 2 | ||||
-rw-r--r-- | gcc/tree-inline.c | 11 |
5 files changed, 53 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d647b3d..9eb7ed5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2005-06-09 Jan Hubicka <jh@suse.cz> + + * cgraphunit.c (cgraph_create_edges): Do not walk BLOCK; finalize + local statics when doing unit-at-a-time. + (cgraph_varpool_assemble_pending_decls): Output debug info. + * dwarf2out.c (decls_for_scope): Skip local statics. + (dwarf2out_decl): Handle local statics. + * passes.c (rest_of_decl_compilation): Do not differentiate + local and global statics in unit-at-a-time. + * tree-inline.c (remap_decls): Put local static into + unexpanded_vars_list rather than introducing duplicated VAR_DECL + node. + 2005-06-09 Daniel Berlin <dberlin@dberlin.org> * config/rs6000/rs6000.c: (rs6000_insn_valid_within_doloop): Fix diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 0cedbd6..67d5e49 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -543,26 +543,19 @@ cgraph_create_edges (struct cgraph_node *node, tree body) walk_tree (bsi_stmt_ptr (bsi), record_reference, node, visited_nodes); } - /* Walk over any private statics that may take addresses of functions. */ - if (TREE_CODE (DECL_INITIAL (body)) == BLOCK) + /* Look for initializers of constant variables and private statics. */ + for (step = DECL_STRUCT_FUNCTION (body)->unexpanded_var_list; + step; + step = TREE_CHAIN (step)) { - for (step = BLOCK_VARS (DECL_INITIAL (body)); - step; - step = TREE_CHAIN (step)) - if (DECL_INITIAL (step)) - walk_tree (&DECL_INITIAL (step), record_reference, node, visited_nodes); + tree decl = TREE_VALUE (step); + if (TREE_CODE (decl) == VAR_DECL + && (TREE_STATIC (decl) && !DECL_EXTERNAL (decl)) + && flag_unit_at_a_time) + cgraph_varpool_finalize_decl (decl); + else if (TREE_CODE (decl) == VAR_DECL && DECL_INITIAL (decl)) + walk_tree (&DECL_INITIAL (decl), record_reference, node, visited_nodes); } - - /* Also look here for private statics. */ - if (DECL_STRUCT_FUNCTION (body)) - for (step = DECL_STRUCT_FUNCTION (body)->unexpanded_var_list; - step; - step = TREE_CHAIN (step)) - { - tree decl = TREE_VALUE (step); - if (DECL_INITIAL (decl) && TREE_STATIC (decl)) - walk_tree (&DECL_INITIAL (decl), record_reference, node, visited_nodes); - } pointer_set_destroy (visited_nodes); visited_nodes = NULL; @@ -743,6 +736,14 @@ cgraph_varpool_assemble_pending_decls (void) if (!TREE_ASM_WRITTEN (decl) && !node->alias && !DECL_EXTERNAL (decl)) { assemble_variable (decl, 0, 1, 0); + /* Local static vairables are neever seen by check_global_declarations + so we need to output debug info by hand. */ + if (decl_function_context (decl) && errorcount == 0 && sorrycount == 0) + { + timevar_push (TV_SYMOUT); + (*debug_hooks->global_decl) (decl); + timevar_pop (TV_SYMOUT); + } changed = true; } node->next_needed = NULL; diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 2fe28d5..1ae4990 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -12523,6 +12523,11 @@ decls_for_scope (tree stmt, dw_die_ref context_die, int depth) if (die != NULL && die->die_parent == NULL) add_child_die (context_die, die); + /* Do not produce debug information for static variables since + these might be optimized out. We are called for these later + in cgraph_varpool_analyze_pending_decls. */ + if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)) + ; else gen_decl_die (decl, context_die); } @@ -13070,6 +13075,10 @@ dwarf2out_decl (tree decl) if (DECL_EXTERNAL (decl) && !TREE_USED (decl)) return; + /* For local statics lookup proper context die. */ + if (TREE_STATIC (decl) && decl_function_context (decl)) + context_die = lookup_decl_die (DECL_CONTEXT (decl)); + /* If we are in terse mode, don't generate any DIEs to represent any variable declarations or definitions. */ if (debug_info_level <= DINFO_LEVEL_TERSE) diff --git a/gcc/passes.c b/gcc/passes.c index 369a2a5..93126b0 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -227,7 +227,7 @@ rest_of_decl_compilation (tree decl, && !DECL_EXTERNAL (decl)) { if (flag_unit_at_a_time && !cgraph_global_info_ready - && TREE_CODE (decl) != FUNCTION_DECL && top_level) + && TREE_CODE (decl) != FUNCTION_DECL) cgraph_varpool_finalize_decl (decl); else assemble_variable (decl, top_level, at_end, 0); diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 6d2ef06..db4b1e9 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -385,6 +385,17 @@ remap_decls (tree decls, inline_data *id) { tree new_var; + /* We can not chain the local static declarations into the unexpanded_var_list + as we can't duplicate them or break one decl rule. Go ahead and link + them into unexpanded_var_list. */ + if (!lang_hooks.tree_inlining.auto_var_in_fn_p (old_var, id->callee) + && !DECL_EXTERNAL (old_var)) + { + cfun->unexpanded_var_list = tree_cons (NULL_TREE, old_var, + cfun->unexpanded_var_list); + continue; + } + /* Remap the variable. */ new_var = remap_decl (old_var, id); |