summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-20 20:38:29 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-20 20:38:29 +0000
commit9d95b2b0274da8229a9c7961422e0f7d44d714fd (patch)
tree25c6e4482c10189121acfa2bf0f54130a9876b63 /gcc
parentb71b0310532ccb4edefc4326ed8ff7d945b57df4 (diff)
downloadppe42-gcc-9d95b2b0274da8229a9c7961422e0f7d44d714fd.tar.gz
ppe42-gcc-9d95b2b0274da8229a9c7961422e0f7d44d714fd.zip
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. * utils.c (gnat_finalize): Remove. (end_subprog_body): Directly call cgraph_finalize_function; do not lower the nested functions. * trans-decl.c (build_entry_thunks): Finalize the function; do not lower tree. (gfc_generate_function_code): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87770 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/utils.c19
-rw-r--r--gcc/cgraph.c13
-rw-r--r--gcc/cgraph.h1
-rw-r--r--gcc/cgraphunit.c10
-rw-r--r--gcc/cse.c3
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-decl.c22
-rw-r--r--gcc/reload1.c2
-rw-r--r--gcc/tree-nested.c10
11 files changed, 64 insertions, 43 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d4902b7d078..79e80a517fe 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+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
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 8c1632d23f9..d55030262b3 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index 1a5afb3d9b1..e09c83e7ff8 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -125,7 +125,6 @@ static tree compute_related_constant (tree, tree);
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);
@@ -1793,8 +1792,7 @@ end_subprog_body (tree body)
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
@@ -1820,21 +1818,6 @@ gnat_gimplify_function (tree fndecl)
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);
-}
/* Return a definition for a builtin function named NAME and whose data type
is TYPE. TYPE should be a function type with argument types.
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index f8f0b7cd52a..7206251ac54 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -693,4 +693,17 @@ cgraph_clone_node (struct cgraph_node *n)
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"
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index ca355fec94b..33209f6284b 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -266,6 +266,7 @@ bool cgraph_varpool_assemble_pending_decls (void);
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);
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index e4348ca8b83..7da68540108 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -263,7 +263,7 @@ static tree memory_identifier;
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
@@ -303,8 +303,9 @@ decide_is_function_needed (struct cgraph_node *node, tree decl)
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))
@@ -586,6 +587,9 @@ cgraph_finalize_function (tree decl, bool nested)
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. */
diff --git a/gcc/cse.c b/gcc/cse.c
index fb963287556..b7da8a34978 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5623,7 +5623,8 @@ cse_insn (rtx insn, rtx libcall_insn)
/* 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
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 39f739c444a..c0dfa23fadb 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 8cb308d37b2..cbe36f72c38 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1255,22 +1255,6 @@ create_function_arglist (gfc_symbol * sym)
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
@@ -1431,8 +1415,7 @@ build_entry_thunks (gfc_namespace * ns)
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
@@ -2313,8 +2296,7 @@ gfc_generate_function_code (gfc_namespace * ns)
else
{
gfc_gimplify_function (fndecl);
- lower_nested_functions (fndecl);
- gfc_finalize (fndecl);
+ cgraph_finalize_function (fndecl, false);
}
}
diff --git a/gcc/reload1.c b/gcc/reload1.c
index c63d418b39c..052acc092ff 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -2185,7 +2185,7 @@ set_label_offsets (rtx x, rtx insn, int initial_p)
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:
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 135ac0486a8..d2608a837f0 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -1207,6 +1207,7 @@ finalize_nesting_tree_1 (struct nesting_info *root)
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. */
@@ -1317,6 +1318,15 @@ finalize_nesting_tree_1 (struct nesting_info *root)
/* 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
OpenPOWER on IntegriCloud