+/* Worker for cgraph_only_called_directly_p. */
+
+static bool
+cgraph_not_only_called_directly_p_1 (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
+{
+ return !cgraph_only_called_directly_or_aliased_p (node);
+}
+
+/* Return true when function NODE and all its aliases are only called
+ directly.
+ i.e. it is not externally visible, address was not taken and
+ it is not used in any other non-standard way. */
+
+bool
+cgraph_only_called_directly_p (struct cgraph_node *node)
+{
+ gcc_assert (cgraph_function_or_thunk_node (node, NULL) == node);
+ return !cgraph_for_node_and_aliases (node, cgraph_not_only_called_directly_p_1,
+ NULL, true);
+}
+
+
+/* Collect all callers of NODE. Worker for collect_callers_of_node. */
+
+static bool
+collect_callers_of_node_1 (struct cgraph_node *node, void *data)
+{
+ VEC (cgraph_edge_p, heap) ** redirect_callers = (VEC (cgraph_edge_p, heap) **)data;
+ struct cgraph_edge *cs;
+ enum availability avail;
+ cgraph_function_or_thunk_node (node, &avail);
+
+ if (avail > AVAIL_OVERWRITABLE)
+ for (cs = node->callers; cs != NULL; cs = cs->next_caller)
+ if (!cs->indirect_inlining_edge)
+ VEC_safe_push (cgraph_edge_p, heap, *redirect_callers, cs);
+ return false;
+}
+
+/* Collect all callers of NODE and its aliases that are known to lead to NODE
+ (i.e. are not overwritable). */
+
+VEC (cgraph_edge_p, heap) *
+collect_callers_of_node (struct cgraph_node *node)
+{
+ VEC (cgraph_edge_p, heap) * redirect_callers = NULL;
+ cgraph_for_node_and_aliases (node, collect_callers_of_node_1,
+ &redirect_callers, false);
+ return redirect_callers;
+}
+