summaryrefslogtreecommitdiff
path: root/gcc/tree-nested.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-09-24 11:21:39 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-09-24 11:21:39 +0200
commit9f62cb922fdb83cd32244f3dd7b537d369557a3e (patch)
tree0c79112ec645e731d0045fca38a62354054c2798 /gcc/tree-nested.c
parent78605f0a685eddfb20bcf786f7a004747cc705e8 (diff)
downloadgcc-9f62cb922fdb83cd32244f3dd7b537d369557a3e.tar.gz
cgraphunit.c (cgraph_lower_function): Revert last change.
* cgraphunit.c (cgraph_lower_function): Revert last change. * targhooks.c (default_static_chain): Use !DECL_STATIC_CHAIN instead of DECL_NO_STATIC_CHAIN. * tree-cfg.c (verify_gimple_call): Likewise. * tree-nested.c (get_chain_decl, get_chain_field, convert_tramp_reference_op, convert_gimple_call): Likewise. (convert_all_function_calls): Likewise. Always set or clear DECL_STATIC_CHAIN initially, for !n->outer clear it. (lower_nested_functions): Remove DECL_NO_STATIC_CHAIN checking code. * c-parser.c (c_parser_declaration_or_fndef): Set DECL_STATIC_CHAIN if nested. * print-tree.c (print_node): Handle DECL_STATIC_CHAIN instead of DECL_NO_STATIC_CHAIN. * config/i386/i386.c (ix86_static_chain): Use !DECL_STATIC_CHAIN instead of DECL_NO_STATIC_CHAIN. (ix86_function_regparm, find_drap_reg): Likewise. Don't test decl_function_context. * varasm.c (initializer_constant_valid_p): Likewise. * tree.h (DECL_NO_STATIC_CHAIN): Renamed to ... (DECL_STATIC_CHAIN): ... this. * config/moxie/moxie.c (moxie_static_chain): Use !DECL_STATIC_CHAIN instead of DECL_NO_STATIC_CHAIN. * method.c (make_thunk, make_alias_for): Don't set DECL_NO_STATIC_CHAIN. * decl.c (builtin_function_1, grokfndecl): Likewise. * lex.c (build_lang_decl): Likewise. * gcc-interface/utils.c (gnat_pushdecl): Don't set DECL_NO_STATIC_CHAIN, set DECL_STATIC_CHAIN for nested functions. * testsuite/gcc.target/i386/pr12329.c: Adjust. From-SVN: r152114
Diffstat (limited to 'gcc/tree-nested.c')
-rw-r--r--gcc/tree-nested.c52
1 files changed, 16 insertions, 36 deletions
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index fe938d913e1..706571c59ec 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -353,11 +353,11 @@ get_chain_decl (struct nesting_info *info)
if (dump_file
&& (dump_flags & TDF_DETAILS)
- && DECL_NO_STATIC_CHAIN (info->context))
- fprintf (dump_file, "Resetting no-static-chain for %s\n",
+ && !DECL_STATIC_CHAIN (info->context))
+ fprintf (dump_file, "Setting static-chain for %s\n",
lang_hooks.decl_printable_name (info->context, 2));
- DECL_NO_STATIC_CHAIN (info->context) = 0;
+ DECL_STATIC_CHAIN (info->context) = 1;
}
return decl;
}
@@ -387,11 +387,11 @@ get_chain_field (struct nesting_info *info)
if (dump_file
&& (dump_flags & TDF_DETAILS)
- && DECL_NO_STATIC_CHAIN (info->context))
- fprintf (dump_file, "Resetting no-static-chain for %s\n",
+ && !DECL_STATIC_CHAIN (info->context))
+ fprintf (dump_file, "Setting static-chain for %s\n",
lang_hooks.decl_printable_name (info->context, 2));
- DECL_NO_STATIC_CHAIN (info->context) = 0;
+ DECL_STATIC_CHAIN (info->context) = 1;
}
return field;
}
@@ -1872,7 +1872,7 @@ convert_tramp_reference_op (tree *tp, int *walk_subtrees, void *data)
/* If the nested function doesn't use a static chain, then
it doesn't need a trampoline. */
- if (DECL_NO_STATIC_CHAIN (decl))
+ if (!DECL_STATIC_CHAIN (decl))
break;
/* If we don't want a trampoline, then don't build one. */
@@ -1972,7 +1972,7 @@ convert_gimple_call (gimple_stmt_iterator *gsi, bool *handled_ops_p,
if (!decl)
break;
target_context = decl_function_context (decl);
- if (target_context && !DECL_NO_STATIC_CHAIN (decl))
+ if (target_context && DECL_STATIC_CHAIN (decl))
{
gimple_call_set_chain (stmt, get_static_chain (info, target_context,
&wi->gsi));
@@ -2046,20 +2046,20 @@ convert_all_function_calls (struct nesting_info *root)
int iter_count;
bool any_changed;
- /* First, optimistically set no_static_chain for all decls that haven't
+ /* First, optimistically clear static_chain for all decls that haven't
used the static chain already for variable access. */
FOR_EACH_NEST_INFO (n, root)
{
tree decl = n->context;
- if (n->outer && !n->chain_decl && !n->chain_field)
+ if (!n->outer || (!n->chain_decl && !n->chain_field))
{
- DECL_NO_STATIC_CHAIN (decl) = 1;
+ DECL_STATIC_CHAIN (decl) = 0;
if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "Guessing no-static-chain for %s\n",
+ fprintf (dump_file, "Guessing no static-chain for %s\n",
lang_hooks.decl_printable_name (decl, 2));
}
else
- gcc_assert (!DECL_NO_STATIC_CHAIN (decl));
+ DECL_STATIC_CHAIN (decl) = 1;
}
/* Walk the functions and perform transformations. Note that these
@@ -2081,7 +2081,7 @@ convert_all_function_calls (struct nesting_info *root)
FOR_EACH_NEST_INFO (n, root)
{
tree decl = n->context;
- bool old_no_static_chain = DECL_NO_STATIC_CHAIN (decl);
+ bool old_static_chain = DECL_STATIC_CHAIN (decl);
walk_function (convert_tramp_reference_stmt,
convert_tramp_reference_op, n);
@@ -2089,7 +2089,7 @@ convert_all_function_calls (struct nesting_info *root)
/* If a call to another function created the use of a chain
within this function, we'll have to continue iteration. */
- if (old_no_static_chain && !DECL_NO_STATIC_CHAIN (decl))
+ if (!old_static_chain && DECL_STATIC_CHAIN (decl))
any_changed = true;
}
}
@@ -2337,7 +2337,7 @@ finalize_nesting_tree_1 (struct nesting_info *root)
if (!field)
continue;
- gcc_assert (!DECL_NO_STATIC_CHAIN (i->context));
+ gcc_assert (DECL_STATIC_CHAIN (i->context));
arg3 = build_addr (root->frame_decl, context);
arg2 = build_addr (i->context, context);
@@ -2528,10 +2528,6 @@ lower_nested_functions (tree fndecl)
{
struct cgraph_node *cgn;
struct nesting_info *root;
-#ifdef ENABLE_CHECKING
- struct nesting_info *n;
- bitmap orig_decl_no_static_chain;
-#endif
/* If there are no nested functions, there's nothing to do. */
cgn = cgraph_node (fndecl);
@@ -2548,15 +2544,6 @@ lower_nested_functions (tree fndecl)
bitmap_obstack_initialize (&nesting_info_bitmap_obstack);
root = create_nesting_tree (cgn);
-#ifdef ENABLE_CHECKING
- /* The C++ and Ada front ends set DECL_NO_STATIC_CHAIN in various
- instances where they expect no static chain needed. */
- orig_decl_no_static_chain = BITMAP_ALLOC (&nesting_info_bitmap_obstack);
- FOR_EACH_NEST_INFO (n, root)
- if (DECL_NO_STATIC_CHAIN (n->context))
- bitmap_set_bit (orig_decl_no_static_chain, DECL_UID (n->context));
-#endif
-
walk_all_functions (convert_nonlocal_reference_stmt,
convert_nonlocal_reference_op,
root);
@@ -2570,13 +2557,6 @@ lower_nested_functions (tree fndecl)
finalize_nesting_tree (root);
unnest_nesting_tree (root);
-#ifdef ENABLE_CHECKING
- /* Validate the original settings of DECL_NO_STATIC_CHAIN. */
- FOR_EACH_NEST_INFO (n, root)
- if (bitmap_bit_p (orig_decl_no_static_chain, DECL_UID (n->context)))
- gcc_assert (DECL_NO_STATIC_CHAIN (n->context));
-#endif
-
free_nesting_tree (root);
bitmap_obstack_release (&nesting_info_bitmap_obstack);