+
+ /* Set a personality if required and we already passed EH lowering. */
+ if (lowered
+ && (function_needs_eh_personality (DECL_STRUCT_FUNCTION (fndecl))
+ == eh_personality_lang))
+ DECL_FUNCTION_PERSONALITY (fndecl) = lang_hooks.eh_personality ();
+}
+
+/* Return true if NODE can be made local for API change.
+ Extern inline functions and C++ COMDAT functions can be made local
+ at the expense of possible code size growth if function is used in multiple
+ compilation units. */
+bool
+cgraph_node_can_be_local_p (struct cgraph_node *node)
+{
+ return (!node->needed
+ && ((DECL_COMDAT (node->decl) && !node->same_comdat_group)
+ || !node->local.externally_visible));
+}
+
+/* Make DECL local. FIXME: We shouldn't need to mess with rtl this early,
+ but other code such as notice_global_symbol generates rtl. */
+void
+cgraph_make_decl_local (tree decl)
+{
+ rtx rtl, symbol;
+
+ if (TREE_CODE (decl) == VAR_DECL)
+ DECL_COMMON (decl) = 0;
+ else if (TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ DECL_COMDAT (decl) = 0;
+ DECL_COMDAT_GROUP (decl) = 0;
+ DECL_WEAK (decl) = 0;
+ DECL_EXTERNAL (decl) = 0;
+ }
+ else
+ gcc_unreachable ();
+ TREE_PUBLIC (decl) = 0;
+ if (!DECL_RTL_SET_P (decl))
+ return;
+
+ /* Update rtl flags. */
+ make_decl_rtl (decl);
+
+ rtl = DECL_RTL (decl);
+ if (!MEM_P (rtl))
+ return;
+
+ symbol = XEXP (rtl, 0);
+ if (GET_CODE (symbol) != SYMBOL_REF)
+ return;
+
+ SYMBOL_REF_WEAK (symbol) = DECL_WEAK (decl);
+}
+
+/* Bring NODE local. */
+void
+cgraph_make_node_local (struct cgraph_node *node)
+{
+ gcc_assert (cgraph_node_can_be_local_p (node));
+ if (DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl))
+ {
+ struct cgraph_node *alias;
+ cgraph_make_decl_local (node->decl);
+
+ for (alias = node->same_body; alias; alias = alias->next)
+ cgraph_make_decl_local (alias->decl);
+
+ node->local.externally_visible = false;
+ node->local.local = true;
+ gcc_assert (cgraph_function_body_availability (node) == AVAIL_LOCAL);
+ }
+}
+
+/* Set TREE_NOTHROW on NODE's decl and on same_body aliases of NODE
+ if any to NOTHROW. */
+
+void
+cgraph_set_nothrow_flag (struct cgraph_node *node, bool nothrow)
+{
+ struct cgraph_node *alias;
+ TREE_NOTHROW (node->decl) = nothrow;
+ for (alias = node->same_body; alias; alias = alias->next)
+ TREE_NOTHROW (alias->decl) = nothrow;
+}
+
+/* Set TREE_READONLY on NODE's decl and on same_body aliases of NODE
+ if any to READONLY. */
+
+void
+cgraph_set_readonly_flag (struct cgraph_node *node, bool readonly)
+{
+ struct cgraph_node *alias;
+ TREE_READONLY (node->decl) = readonly;
+ for (alias = node->same_body; alias; alias = alias->next)
+ TREE_READONLY (alias->decl) = readonly;
+}
+
+/* Set DECL_PURE_P on NODE's decl and on same_body aliases of NODE
+ if any to PURE. */
+
+void
+cgraph_set_pure_flag (struct cgraph_node *node, bool pure)
+{
+ struct cgraph_node *alias;
+ DECL_PURE_P (node->decl) = pure;
+ for (alias = node->same_body; alias; alias = alias->next)
+ DECL_PURE_P (alias->decl) = pure;
+}
+
+/* Set DECL_LOOPING_CONST_OR_PURE_P on NODE's decl and on
+ same_body aliases of NODE if any to LOOPING_CONST_OR_PURE. */
+
+void
+cgraph_set_looping_const_or_pure_flag (struct cgraph_node *node,
+ bool looping_const_or_pure)
+{
+ struct cgraph_node *alias;
+ DECL_LOOPING_CONST_OR_PURE_P (node->decl) = looping_const_or_pure;
+ for (alias = node->same_body; alias; alias = alias->next)
+ DECL_LOOPING_CONST_OR_PURE_P (alias->decl) = looping_const_or_pure;