+2004-09-20 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/16460
+
+ * cgraph.c (cgraph_unnest_node): New function.
+ (c_finalize): Rename to ....
+ (c_warn_unused_result_recursivly): ... this one; do only the warning
+ (finish_function): Finalize the toplevel function; do not lower nested tree.
+ * cgraph.h (cgraph_unnest_node): Declare.
+ * cgraphunit.c (decide_is_function_needed): Do not use cgraph
+ nestedness datastructure.
+ * cse.c (cse_insn): Do not cprop nonlocal LABEL_REFs.
+ * reload1.c (set_label_offsets): Fix call of set_label_offsets.
+ * tree-nested.c (finlize_nesting_tree_1): Use un-nesting code.
+
2004-09-20 Richard Henderson <rth@redhat.com>
* config/alpha/alpha.c (some_small_symbolic_operand_int): Rename
+2004-09-20 Jan Hubicka <jh@suse.cz>
+
+ * utils.c (gnat_finalize): Remove.
+ (end_subprog_body): Directly call cgraph_finalize_function;
+ do not lower the nested functions.
+
2004-09-20 Robert Dewar <dewar@gnat.com>
PR ada/17540
static tree split_plus (tree, tree *);
static bool value_zerop (tree);
static void gnat_gimplify_function (tree);
-static void gnat_finalize (tree);
static tree float_type_for_precision (int, enum machine_mode);
static tree convert_to_fat_pointer (tree, tree);
static tree convert_to_thin_pointer (tree, tree);
if (!DECL_CONTEXT (fndecl))
{
gnat_gimplify_function (fndecl);
- lower_nested_functions (fndecl);
- gnat_finalize (fndecl);
+ cgraph_finalize_function (fndecl, false);
}
else
/* Register this function with cgraph just far enough to get it
for (cgn = cgn->nested; cgn; cgn = cgn->next_nested)
gnat_gimplify_function (cgn->decl);
}
-
-/* Give FNDECL and all its nested functions to cgraph for compilation. */
-
-static void
-gnat_finalize (tree fndecl)
-{
- struct cgraph_node *cgn;
-
- /* Finalize all nested functions now. */
- cgn = cgraph_node (fndecl);
- for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
- gnat_finalize (cgn->decl);
-
- cgraph_finalize_function (fndecl, false);
-}
\f
/* Return a definition for a builtin function named NAME and whose data type
is TYPE. TYPE should be a function type with argument types.
return new;
}
+
+/* NODE is no longer nested function; update cgraph accordingly. */
+void
+cgraph_unnest_node (struct cgraph_node *node)
+{
+ struct cgraph_node **node2 = &node->origin->nested;
+ gcc_assert (node->origin);
+
+ while (*node2 != node)
+ node2 = &(*node2)->next_nested;
+ *node2 = node->next_nested;
+ node->origin = NULL;
+}
#include "gt-cgraph.h"
void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *);
bool cgraph_function_possibly_inlined_p (tree);
+void cgraph_unnest_node (struct cgraph_node *node);
/* In cgraphunit.c */
bool cgraph_assemble_pending_functions (void);
static bool
decide_is_function_needed (struct cgraph_node *node, tree decl)
{
- struct cgraph_node *origin;
+ tree origin;
/* If we decided it was needed before, but at the time we didn't have
the body of the function available, then it's still needed. We have
return false;
/* Nested functions of extern inline function shall not be emit unless
we inlined the origin. */
- for (origin = node->origin; origin; origin = origin->origin)
- if (DECL_EXTERNAL (origin->decl))
+ for (origin = decl_function_context (decl); origin;
+ origin = decl_function_context (origin))
+ if (DECL_EXTERNAL (origin))
return false;
/* We want to emit COMDAT functions only when absolutely necessary. */
if (DECL_COMDAT (decl))
notice_global_symbol (decl);
node->decl = decl;
node->local.finalized = true;
+ if (node->nested)
+ lower_nested_functions (decl);
+ gcc_assert (!node->nested);
/* If not unit at a time, then we need to create the call graph
now, so that called functions can be queued and emitted now. */
/* If this SET is now setting PC to a label, we know it used to
be a conditional or computed branch. */
- else if (dest == pc_rtx && GET_CODE (src) == LABEL_REF)
+ else if (dest == pc_rtx && GET_CODE (src) == LABEL_REF
+ && !LABEL_REF_NONLOCAL_P (src))
{
/* Now emit a BARRIER after the unconditional jump. */
if (NEXT_INSN (insn) == 0
+2004-09-20 Jan Hubicka <jh@suse.cz>
+
+ * trans-decl.c (build_entry_thunks): Finalize the function; do not lower
+ tree.
+ (gfc_generate_function_code): Likewise.
+
2004-09-20 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/15957
DECL_ARGUMENTS (fndecl) = arglist;
}
-
-/* Finalize DECL and all nested functions with cgraph. */
-
-static void
-gfc_finalize (tree decl)
-{
- struct cgraph_node *cgn;
-
- cgn = cgraph_node (decl);
- for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
- gfc_finalize (cgn->decl);
-
- cgraph_finalize_function (decl, false);
-}
-
-
/* Convert FNDECL's code to GIMPLE and handle any nested functions. */
static void
current_function_decl = NULL_TREE;
gfc_gimplify_function (thunk_fndecl);
- lower_nested_functions (thunk_fndecl);
- gfc_finalize (thunk_fndecl);
+ cgraph_finalize_function (thunk_fndecl, false);
/* We share the symbols in the formal argument list with other entry
points and the master function. Clear them so that they are
else
{
gfc_gimplify_function (fndecl);
- lower_nested_functions (fndecl);
- gfc_finalize (fndecl);
+ cgraph_finalize_function (fndecl, false);
}
}
return;
case LABEL_REF:
- set_label_offsets (XEXP (SET_SRC (x), 0), insn, initial_p);
+ set_label_offsets (SET_SRC (x), insn, initial_p);
return;
case IF_THEN_ELSE:
tree stmt_list = NULL;
tree context = root->context;
struct function *sf;
+ struct cgraph_node *node;
/* If we created a non-local frame type or decl, we need to lay them
out at this time. */
/* Dump the translated tree function. */
dump_function (TDI_nested, root->context);
+ node = cgraph_node (root->context);
+
+ /* For nested functions update the cgraph to reflect unnesting.
+ We also delay finalizing of these functions up to this point. */
+ if (node->origin)
+ {
+ cgraph_unnest_node (cgraph_node (root->context));
+ cgraph_finalize_function (root->context, true);
+ }
}
static void