diff options
Diffstat (limited to 'gcc/tree-nested.c')
-rw-r--r-- | gcc/tree-nested.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 4c8eda9..4579b4c 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -104,6 +104,7 @@ struct nesting_info tree chain_decl; tree nl_goto_field; + bool thunk_p; bool any_parm_remapped; bool any_tramp_created; bool any_descr_created; @@ -834,6 +835,7 @@ create_nesting_tree (struct cgraph_node *cgn) info->mem_refs = new hash_set<tree *>; info->suppress_expansion = BITMAP_ALLOC (&nesting_info_bitmap_obstack); info->context = cgn->decl; + info->thunk_p = cgn->thunk.thunk_p; for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested) { @@ -2786,6 +2788,8 @@ convert_all_function_calls (struct nesting_info *root) within the debugger. */ FOR_EACH_NEST_INFO (n, root) { + if (n->thunk_p) + continue; tree decl = n->context; if (!optimize) { @@ -2806,6 +2810,14 @@ convert_all_function_calls (struct nesting_info *root) chain_count += DECL_STATIC_CHAIN (decl); } + FOR_EACH_NEST_INFO (n, root) + if (n->thunk_p) + { + tree decl = n->context; + tree alias = cgraph_node::get (decl)->thunk.alias; + DECL_STATIC_CHAIN (decl) = DECL_STATIC_CHAIN (alias); + } + /* Walk the functions and perform transformations. Note that these transformations can induce new uses of the static chain, which in turn require re-examining all users of the decl. */ @@ -2825,12 +2837,22 @@ convert_all_function_calls (struct nesting_info *root) FOR_EACH_NEST_INFO (n, root) { + if (n->thunk_p) + continue; tree decl = n->context; walk_function (convert_tramp_reference_stmt, convert_tramp_reference_op, n); walk_function (convert_gimple_call, NULL, n); chain_count += DECL_STATIC_CHAIN (decl); } + + FOR_EACH_NEST_INFO (n, root) + if (n->thunk_p) + { + tree decl = n->context; + tree alias = cgraph_node::get (decl)->thunk.alias; + DECL_STATIC_CHAIN (decl) = DECL_STATIC_CHAIN (alias); + } } while (chain_count != old_chain_count); @@ -3055,12 +3077,13 @@ build_init_call_stmt (struct nesting_info *info, tree decl, tree field, static void finalize_nesting_tree_1 (struct nesting_info *root) { - gimple_seq stmt_list; + gimple_seq stmt_list = NULL; gimple *stmt; tree context = root->context; struct function *sf; - stmt_list = NULL; + if (root->thunk_p) + return; /* If we created a non-local frame type or decl, we need to lay them out at this time. */ @@ -3340,7 +3363,8 @@ unnest_nesting_tree_1 (struct nesting_info *root) if (node->origin) { node->unnest (); - cgraph_node::finalize_function (root->context, true); + if (!root->thunk_p) + cgraph_node::finalize_function (root->context, true); } } @@ -3380,7 +3404,8 @@ gimplify_all_functions (struct cgraph_node *root) if (!gimple_body (root->decl)) gimplify_function_tree (root->decl); for (iter = root->nested; iter; iter = iter->next_nested) - gimplify_all_functions (iter); + if (!iter->thunk.thunk_p) + gimplify_all_functions (iter); } /* Main entry point for this pass. Process FNDECL and all of its nested |