cgraph.c (cgraph_add_new_function): When in expansion state, do lowering.
authorJan Hubicka <jh@suse.cz>
Wed, 18 Jun 2008 13:39:43 +0000 (15:39 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 18 Jun 2008 13:39:43 +0000 (13:39 +0000)
* cgraph.c (cgraph_add_new_function): When in expansion state, do lowering.

* method.c: Include cgraph.h.
(use_thunk): Use cgraph_add_new_function instead of calling backend directly.

From-SVN: r136892

gcc/ChangeLog
gcc/cgraph.c
gcc/cp/ChangeLog
gcc/cp/method.c

index c4189f893e6753e83c985ea7068ab3df37607599..32fb7e8d3646cef893b946a4bc7bff91ddfbebd7 100644 (file)
@@ -1,3 +1,8 @@
+2008-06-16  Jan Hubicka  <jh@suse.cz>
+
+       * cgraph.c (cgraph_add_new_function): When in expansion state, do
+       lowering.
+
 2008-06-16  Jan Hubicka  <jh@suse.cz>
 
        * tree-outof-ssa.c (pass_out_of_ssa): Do not depend on PROP_alias.
index e6910b5d27b4cd44fce216a716aa272f9be49977..df214d1dba5ac40ff52f2f65951954fe081b10a4 100644 (file)
@@ -1052,6 +1052,21 @@ cgraph_add_new_function (tree fndecl, bool lowered)
        node->local.local = false;
        node->local.finalized = true;
        node->reachable = node->needed = true;
+       if (!lowered && cgraph_state == CGRAPH_STATE_EXPANSION)
+         {
+           push_cfun (DECL_STRUCT_FUNCTION (fndecl));
+           current_function_decl = fndecl;
+           tree_register_cfg_hooks ();
+            tree_lowering_passes (fndecl);
+           bitmap_obstack_initialize (NULL);
+           if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl)))
+             execute_pass_list (pass_early_local_passes.pass.sub);
+           bitmap_obstack_release (NULL);
+           pop_cfun ();
+           current_function_decl = NULL;
+
+           lowered = true;
+         }
        if (lowered)
          node->lowered = true;
        node->next_needed = cgraph_new_nodes;
index bd2c0dec2feb1fef2fe2f7c65927c5005f078956..636ee6aa9d6eebb92a8c367e48a59397bed7ac38 100644 (file)
@@ -1,3 +1,9 @@
+2008-06-16  Jan Hubicka  <jh@suse.cz>
+
+       * method.c: Include cgraph.h.
+       (use_thunk): Use cgraph_add_new_function instead of calling backend
+       directly.
+
 2008-06-15  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * parser.c: Fix comment typo.
index 45358b2c5f4cbb2bd97648fa3b092644ef224a4a..bd63d0cba52ee5699d29f439f60abcc68764e027 100644 (file)
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "tree-pass.h"
 #include "diagnostic.h"
+#include "cgraph.h"
 
 /* Various flags to control the mangling process.  */
 
@@ -523,8 +524,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
       pop_deferring_access_checks ();
 
       thunk_fndecl = finish_function (0);
-      tree_lowering_passes (thunk_fndecl);
-      tree_rest_of_compilation (thunk_fndecl);
+      cgraph_add_new_function (thunk_fndecl, false);
     }
 
   pop_from_top_level ();