decl.c (java_expand_body): Kill.
authorJan Hubicka <jh@suse.cz>
Tue, 11 Sep 2007 10:39:53 +0000 (12:39 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 11 Sep 2007 10:39:53 +0000 (10:39 +0000)
* decl.c (java_expand_body): Kill.
(LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Kill.

* toplev.c (process_options): all frontends now do unit-at-a-time.
* cgraphunit.c: update comments.
(cgraph_expand_function): call passmanager dirrectly; emit thunks.
* c-decl.c (finish_function): use cgraph_add_new_function.

* method.c (use_thunk): Use tree_rest_of_compilation
* cp-objecp-common.h (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Kill.
(LANG_HOOKS_CALLGRAPH_EMIT_ASSOCIATED_THUNKS): Define.
* cp-tree.h (expand_body): Kill.
(emit_associated_thunks): Declare.
* semantics.c (emit_associated_thunks): Export.
(expand_body): Kill.

* misc.c (gnat_expand_body): Kill.
(LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Kill.

* f95-lang.c (gfc_expand_function): Kill.
(LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Kill.

* function.c (expand_function_end): We are always unit-at-a-time.

From-SVN: r128367

21 files changed:
gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/misc.c
gcc/c-common.c
gcc/c-decl.c
gcc/cgraphunit.c
gcc/cp/ChangeLog
gcc/cp/cp-objcp-common.h
gcc/cp/cp-tree.h
gcc/cp/method.c
gcc/cp/semantics.c
gcc/fortran/ChangeLog
gcc/fortran/f95-lang.c
gcc/function.c
gcc/java/ChangeLog
gcc/java/decl.c
gcc/java/lang.c
gcc/langhooks-def.h
gcc/langhooks.h
gcc/passes.c
gcc/toplev.c

index 1c9a5d01144d551db4529085f26f6a893e8eea50..1706076df997f81c96586c9fe27203271fc2dc7a 100644 (file)
@@ -1,3 +1,11 @@
+2007-09-11  Jan Hubicka <jh@suse.cz>
+
+       * toplev.c (process_options): all frontends now do unit-at-a-time.
+       * cgraphunit.c: update comments.
+       (cgraph_expand_function): call passmanager dirrectly; emit thunks.
+       * c-decl.c (finish_function): use cgraph_add_new_function.
+       * function.c (expand_function_end): We are always unit-at-a-time.
+
 2007-09-11  Richard Sandiford  <richard@codesourcery.com>
 
        * config/mips/mips.c (mips_set_mips16_mode): Use separate anchor
index f1c654ff1a7183e2b3d00ba788d6ec04a3126b49..05182f88f973e59c327274f859adc676f5a0acba 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-11  Jan Hubicka <jh@suse.cz>
+
+       * misc.c (gnat_expand_body): Kill.
+       (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Kill.
+
 2007-09-10  Robert Dewar  <dewar@adacore.com>
 
        * exp_atag.ads, exp_atag.adb, mlib-tgt-tru64.adb, mlib-tgt-aix.adb,
index cad474d2b5f8cf8c8cf4aba26e60b64a54574f4c..473beb059fd542995dd861ecfa16e5b456b8caf1 100644 (file)
@@ -100,7 +100,6 @@ static int gnat_eh_type_covers              (tree, tree);
 static void gnat_parse_file            (int);
 static rtx gnat_expand_expr            (tree, rtx, enum machine_mode, int,
                                         rtx *);
-static void gnat_expand_body           (tree);
 static void internal_error_function    (const char *, va_list *);
 static void gnat_adjust_rli            (record_layout_info);
 static tree gnat_type_max_size         (const_tree);
@@ -149,8 +148,6 @@ static tree gnat_type_max_size              (const_tree);
 #define LANG_HOOKS_DECL_PRINTABLE_NAME gnat_printable_name
 #undef  LANG_HOOKS_DWARF_NAME
 #define LANG_HOOKS_DWARF_NAME          gnat_dwarf_name
-#undef  LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
-#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION gnat_expand_body
 #undef  LANG_HOOKS_GIMPLIFY_EXPR
 #define LANG_HOOKS_GIMPLIFY_EXPR       gnat_gimplify_expr
 #undef  LANG_HOOKS_TYPE_FOR_MODE
@@ -678,14 +675,6 @@ gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode,
   return expand_expr_real (new, target, tmode, modifier, alt_rtl);
 }
 
-/* Generate the RTL for the body of GNU_DECL.  */
-
-static void
-gnat_expand_body (tree gnu_decl)
-{
-  tree_rest_of_compilation (gnu_decl);
-}
-
 /* Adjusts the RLI used to layout a record after all the fields have been
    added.  We only handle the packed case and cause it to use the alignment
    that will pad the record at the end.  */
index 147f5c17763723294bfa39c63a4e630ddee8c850..f6af0525337780e8b09fdc61718ba1f16c0ecd6e 100644 (file)
@@ -4577,15 +4577,6 @@ c_expand_expr (tree exp, rtx target, enum machine_mode tmode,
     }
 }
 
-
-/* Generate the RTL for the body of FNDECL.  */
-
-void
-c_expand_body (tree fndecl)
-{
-  tree_rest_of_compilation (fndecl);
-}
-
 /* Hook used by staticp to handle language-specific tree codes.  */
 
 tree
index bb790a2b7bb01ad51b2757cd4f3bc8881ec65042..83fc7b9e1611cc8b59d6d426c5c908819ac3252f 100644 (file)
@@ -6799,7 +6799,7 @@ finish_function (void)
             This should be cleaned up later and this conditional removed.  */
          if (cgraph_global_info_ready)
            {
-             c_expand_body (fndecl);
+             cgraph_add_new_function (fndecl, false);
              return;
            }
 
index 61d834dd13565ef50758f64114df48fdcaa8bf32..0218d260066863574f4a94bb8364a8afe0309997 100644 (file)
@@ -76,15 +76,6 @@ along with GCC; see the file COPYING3.  If not see
       ??? On the tree-ssa genericizing should take place here and we will avoid
       need for these hooks (replacing them by genericizing hook)
 
-    - expand_function callback
-
-      This function is used to expand function and pass it into RTL back-end.
-      Front-end should not make any assumptions about when this function can be
-      called.  In particular cgraph_assemble_pending_functions,
-      varpool_assemble_pending_variables, cgraph_finalize_function,
-      varpool_finalize_function, cgraph_optimize can cause arbitrarily
-      previously finalized functions to be expanded.
-
     We implement two compilation modes.
 
       - unit-at-a-time:  In this mode analyzing of all functions is deferred
@@ -1074,7 +1065,9 @@ cgraph_expand_function (struct cgraph_node *node)
     }
 
   /* Generate RTL for the body of DECL.  */
-  lang_hooks.callgraph.expand_function (decl);
+  if (lang_hooks.callgraph.emit_associated_thunks)
+    lang_hooks.callgraph.emit_associated_thunks (decl);
+  tree_rest_of_compilation (decl);
 
   /* Make sure that BE didn't give up on compiling.  */
   /* ??? Can happen with nested function of extern inline.  */
index cdbffb1e0702329b861ae96ed1d510d96ab6d236..a73da49014f5c6b9f76baf95a7eeb1db2fb3c88e 100644 (file)
@@ -1,3 +1,13 @@
+2007-09-11  Jan Hubicka <jh@suse.cz>
+
+       * method.c (use_thunk): Use tree_rest_of_compilation
+       * cp-objecp-common.h (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Kill.
+       (LANG_HOOKS_CALLGRAPH_EMIT_ASSOCIATED_THUNKS): Define.
+       * cp-tree.h (expand_body): Kill.
+       (emit_associated_thunks): Declare.
+       * semantics.c (emit_associated_thunks): Export.
+       (expand_body): Kill.
+
 2007-09-09  David Daney  <ddaney@avtrex.com>
 
        PR c++/33324
index 8c8f93377de800d77d81f10a94f29a5dc674720d..dd236131f0a3386138db29f1914c7048a54b8a7a 100644 (file)
@@ -115,8 +115,8 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
 
 #undef LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR
 #define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR cxx_callgraph_analyze_expr
-#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
-#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION expand_body
+#undef LANG_HOOKS_CALLGRAPH_EMIT_ASSOCIATED_THUNKS
+#define LANG_HOOKS_CALLGRAPH_EMIT_ASSOCIATED_THUNKS emit_associated_thunks
 
 #undef LANG_HOOKS_MAKE_TYPE
 #define LANG_HOOKS_MAKE_TYPE cxx_make_type
index 9bd8ed2c30233e711a914850ea9db8081a665e49..5efbdb7a4ac8113a393a253b1209b93e5085df94 100644 (file)
@@ -4639,7 +4639,7 @@ extern tree finish_typeof                 (tree);
 extern tree finish_offsetof                    (tree);
 extern void finish_decl_cleanup                        (tree, tree);
 extern void finish_eh_cleanup                  (tree);
-extern void expand_body                                (tree);
+extern void emit_associated_thunks             (tree);
 extern void finish_mem_initializers            (tree);
 extern tree check_template_template_default_arg (tree);
 extern void expand_or_defer_fn                 (tree);
index 2130454a05a28afbd26a72d3a15c34d8d7a2ec7b..05e21ba97e7b048e32228b38f175ae6b867170c3 100644 (file)
@@ -523,7 +523,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
 
       thunk_fndecl = finish_function (0);
       tree_lowering_passes (thunk_fndecl);
-      expand_body (thunk_fndecl);
+      tree_rest_of_compilation (thunk_fndecl);
     }
 
   pop_from_top_level ();
index 28fe481b43132840ac0ed0fe72c48c9a7b3a2e00..b1641023bd798eae3ce7bf0bb282b86c66689601 100644 (file)
@@ -54,7 +54,6 @@ along with GCC; see the file COPYING3.  If not see
 
 static tree maybe_convert_cond (tree);
 static tree simplify_aggr_init_exprs_r (tree *, int *, void *);
-static void emit_associated_thunks (tree);
 static tree finalize_nrv_r (tree *, int *, void *);
 
 
@@ -3094,7 +3093,7 @@ simplify_aggr_init_expr (tree *tp)
 
 /* Emit all thunks to FN that should be emitted when FN is emitted.  */
 
-static void
+void
 emit_associated_thunks (tree fn)
 {
   /* When we use vcall offsets, we emit thunks with the virtual
@@ -3128,22 +3127,6 @@ emit_associated_thunks (tree fn)
 
 /* Generate RTL for FN.  */
 
-void
-expand_body (tree fn)
-{
-  /* Emit any thunks that should be emitted at the same time as FN.  */
-  emit_associated_thunks (fn);
-
-  /* This function is only called from cgraph, or recursively from
-     emit_associated_thunks.  In neither case should we be currently
-     generating trees for a function.  */
-  gcc_assert (function_depth == 0);
-
-  c_expand_body (fn);
-}
-
-/* Generate RTL for FN.  */
-
 void
 expand_or_defer_fn (tree fn)
 {
index a3a1263e9469e52b0e99bce6f28b58dd0b95dd8e..348d2b064bf0696d0e70e222f9baddb4b60b27bf 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-11  Jan Hubicka <jh@suse.cz>
+
+       * f95-lang.c (gfc_expand_function): Kill.
+       (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Kill.
+
 2007-09-08  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/31547
index b9eb1f852f05acf008c088f06fc70adf4f039551..c5c602bcc81dfdef117392dc8e5c72203f67bcb8 100644 (file)
@@ -98,7 +98,6 @@ int global_bindings_p (void);
 void insert_block (tree);
 static void gfc_clear_binding_stack (void);
 static void gfc_be_parse_file (int);
-static void gfc_expand_function (tree);
 static alias_set_type gfc_get_alias_set (tree);
 
 #undef LANG_HOOKS_NAME
@@ -135,7 +134,6 @@ static alias_set_type gfc_get_alias_set (tree);
 #define LANG_HOOKS_MARK_ADDRESSABLE        gfc_mark_addressable
 #define LANG_HOOKS_TYPE_FOR_MODE           gfc_type_for_mode
 #define LANG_HOOKS_TYPE_FOR_SIZE           gfc_type_for_size
-#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION gfc_expand_function
 #define LANG_HOOKS_CLEAR_BINDING_STACK     gfc_clear_binding_stack
 #define LANG_HOOKS_GET_ALIAS_SET          gfc_get_alias_set
 #define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE  gfc_omp_privatize_by_reference
@@ -194,45 +192,6 @@ static GTY(()) struct binding_level *free_binding_level;
    It is indexed by a RID_... value.  */
 tree *ridpointers = NULL;
 
-/* language-specific flags.  */
-
-static void
-gfc_expand_function (tree fndecl)
-{
-  tree t;
-
-  if (DECL_INITIAL (fndecl)
-      && BLOCK_SUBBLOCKS (DECL_INITIAL (fndecl)))
-    {
-      /* Local static equivalenced variables are never seen by
-        check_global_declarations, so we need to output debug
-        info by hand.  */
-
-      t = BLOCK_SUBBLOCKS (DECL_INITIAL (fndecl));
-      for (t = BLOCK_VARS (t); t; t = TREE_CHAIN (t))
-       if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t)
-           && TREE_STATIC (t))
-         {
-           tree expr = DECL_VALUE_EXPR (t);
-
-           if (TREE_CODE (expr) == COMPONENT_REF
-               && TREE_CODE (TREE_OPERAND (expr, 0)) == VAR_DECL
-               && TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0)))
-                  == UNION_TYPE
-               && varpool_node (TREE_OPERAND (expr, 0))->needed
-               && errorcount == 0 && sorrycount == 0)
-             {
-               timevar_push (TV_SYMOUT);
-               (*debug_hooks->global_decl) (t);
-               timevar_pop (TV_SYMOUT);
-             }
-         }
-    }
-
-  tree_rest_of_compilation (fndecl);
-}
-
-
 /* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
    or validate its data type for an `if' or `while' statement or ?..: exp.
 
index a2956b363a974fecaf0a5dffcd6e18bf2f485419..ffee5982071202d99f4af8aa1b96b48d441f0a25 100644 (file)
@@ -4404,13 +4404,6 @@ expand_function_end (void)
          }
     }
 
-  /* Possibly warn about unused parameters.
-     When frontend does unit-at-a-time, the warning is already
-     issued at finalization time.  */
-  if (warn_unused_parameter
-      && !lang_hooks.callgraph.expand_function)
-    do_warn_unused_parameter (current_function_decl);
-
   /* End any sequences that failed to be closed due to syntax errors.  */
   while (in_sequence_p ())
     end_sequence ();
index f8f5c35261752fb1300364429daaa5d9101248bf..6cc295f33c71ff7e48f84a96dec8ba4165a862da 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-11  Jan Hubicka <jh@suse.cz>
+
+       * decl.c (java_expand_body): Kill.
+       (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Kill.
+
 2007-09-06  Tom Tromey  <tromey@redhat.com>
 
        * jcf-parse.c (parse_class_file): Re-enter the current file.
index 594ccf13d0c7289ba3aae5aaec7e41529271beb2..2cf87c2aa3610a06112f0f1afdb85fe7fadb79ba 100644 (file)
@@ -1862,14 +1862,6 @@ finish_method (tree fndecl)
   cgraph_finalize_function (fndecl, false);
 }
 
-/* Optimize and expand a function's entire body.  */
-
-void
-java_expand_body (tree fndecl)
-{
-  tree_rest_of_compilation (fndecl);
-}
-
 /* We pessimistically marked all methods and fields external until we
    knew what set of classes we were planning to compile.  Now mark those
    associated with CLASS to be generated locally as not external.  */
index 6a453fc9d846960a7601dbe1b478adf3b62ba610..64b168c650c3cc8ff787a6b2745dd684f2aaf32c 100644 (file)
@@ -192,9 +192,6 @@ struct language_function GTY(())
 #undef LANG_HOOKS_GET_CALLEE_FNDECL
 #define LANG_HOOKS_GET_CALLEE_FNDECL java_get_callee_fndecl
 
-#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
-#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION java_expand_body
-
 #undef LANG_HOOKS_CLEAR_BINDING_STACK
 #define LANG_HOOKS_CLEAR_BINDING_STACK java_clear_binding_stack
 
index 4c4be49581d0c3beb32172cd54877ee7e4e8246d..523fc0b4766c8613e3bdf5e81cb557cf3bbae6fa 100644 (file)
@@ -138,11 +138,11 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
 }
 
 #define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR lhd_callgraph_analyze_expr
-#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION NULL
+#define LANG_HOOKS_CALLGRAPH_EMIT_ASSOCIATED_THUNKS NULL
 
 #define LANG_HOOKS_CALLGRAPH_INITIALIZER { \
   LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR, \
-  LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION, \
+  LANG_HOOKS_CALLGRAPH_EMIT_ASSOCIATED_THUNKS, \
 }
 
 #define LANG_HOOKS_FUNCTION_INITIALIZER {      \
index 2b3517e50729fff82b8558a2d84220a239403943..ad925a84c3b15ea219dabff3829a9e9dfd75ac94 100644 (file)
@@ -44,8 +44,8 @@ struct lang_hooks_for_callgraph
      are relevant to use of other declarations, mark them.  */
   tree (*analyze_expr) (tree *, int *, tree);
 
-  /* Produce RTL for function passed as argument.  */
-  void (*expand_function) (tree);
+  /* Emmit thunks associated to function.  */
+  void (*emit_associated_thunks) (tree);
 };
 
 /* Lang hooks for management of language-specific data or status
index 48f4af099d0d76bea403192fde1584b5189a9f60..0bcb7c7b302537703ab3a19c122917b04977cbeb 100644 (file)
@@ -461,8 +461,7 @@ next_pass_1 (struct tree_opt_pass **list, struct tree_opt_pass *pass)
        cgraph_expand_all_functions ()
            for each node N in the cgraph
               cgraph_expand_function (N)
-                  lang_hooks.callgraph.expand_function (DECL (N))
-                       tree_rest_of_compilation (DECL (N))  -> all_passes
+                 tree_rest_of_compilation (DECL (N))  -> all_passes
 */
 
 void
index 76887bc25e08382e42173564687d96162656d8f6..0c4b63840baea8a04b613fcb2969a5ff13dc0c60 100644 (file)
@@ -1785,11 +1785,6 @@ process_options (void)
   if (flag_asynchronous_unwind_tables)
     flag_unwind_tables = 1;
 
-  /* Disable unit-at-a-time mode for frontends not supporting callgraph
-     interface.  */
-  if (flag_unit_at_a_time && ! lang_hooks.callgraph.expand_function)
-    flag_unit_at_a_time = 0;
-
   if (!flag_unit_at_a_time)
     flag_section_anchors = 0;