]> gcc.gnu.org Git - gcc.git/commitdiff
function.c: Define current_function_cannot_inline.
authorJason Merrill <jason@yorick.cygnus.com>
Mon, 8 Jun 1998 10:52:37 +0000 (10:52 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 8 Jun 1998 10:52:37 +0000 (06:52 -0400)
* function.c: Define current_function_cannot_inline.
(push_function_context_to): Save it.
(pop_function_context_from): Restore it.
* function.h (struct function): Provide it a home.
* output.h: Declare it.
* integrate.c (function_cannot_inline_p): Check it.
* decl.c (cp_finish_decl): Disable inlining of extern inlines
with static variables.

From-SVN: r20332

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/function.c
gcc/function.h
gcc/integrate.c
gcc/output.h

index ff1a1e4e3d845366e5bc11903782a824a3ecf4a7..07b0a2bf7d4753440e756264debab22d023deef0 100644 (file)
@@ -1,3 +1,12 @@
+Mon Jun  8 01:21:13 1998  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * function.c: Define current_function_cannot_inline.
+       (push_function_context_to): Save it.
+       (pop_function_context_from): Restore it.
+       * function.h (struct function): Provide it a home.
+       * output.h: Declare it.
+       * integrate.c (function_cannot_inline_p): Check it.
+
 Mon Jun  8 10:43:15 1998  Richard Henderson  <rth@cygnus.com>
 
        * expr.c (force_operand): Detect PIC address loads before 
index 07178e742ac502982032f4244ecce1bdee577e7e..912b332332ced8cf67134906c27d7469e13a74d0 100644 (file)
@@ -1,3 +1,8 @@
+1998-06-08  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl.c (cp_finish_decl): Disable inlining of extern inlines
+       with static variables.
+
 1998-06-08  Mark Mitchell  <mark@markmitchell.com>
 
        * init.c (build_offset_ref): Correct previous change to use build,
index 67720731f59dc0cdd42474ec0f94a06e4d6ac365..0505cc618a0245de5420e6ef13e51690eb93095f 100644 (file)
@@ -6992,35 +6992,20 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
       if (was_temp)
        end_temporary_allocation ();
 
-      /* Extern inline function static data has external linkage.  */
+      /* Extern inline function static data has external linkage.
+         Instead of trying to deal with that, we disable inlining of
+         such functions.  The ASM_WRITTEN check is to avoid hitting this
+         for __FUNCTION__.  */
       if (TREE_CODE (decl) == VAR_DECL
          && TREE_STATIC (decl)
+         && ! TREE_ASM_WRITTEN (decl)
          && current_function_decl
          && DECL_CONTEXT (decl) == current_function_decl
          && DECL_THIS_INLINE (current_function_decl)
          && TREE_PUBLIC (current_function_decl))
        {
-         if (DECL_INTERFACE_KNOWN (current_function_decl))
-           {
-             TREE_PUBLIC (decl) = 1;
-             DECL_EXTERNAL (decl) = DECL_EXTERNAL (current_function_decl);
-           }
-         /* We can only do this if we can use common or weak, and we
-            can't if it has been initialized and we don't support weak.  */
-         else if (DECL_INITIAL (decl) == NULL_TREE
-                  || DECL_INITIAL (decl) == error_mark_node)
-           {
-             TREE_PUBLIC (decl) = 1;
-             DECL_COMMON (decl) = 1;
-           }
-         else if (flag_weak)
-           make_decl_one_only (decl);
-
-         if (TREE_PUBLIC (decl))
-           DECL_ASSEMBLER_NAME (decl)
-             = build_static_name (current_function_decl, DECL_NAME (decl));
-         else if (! DECL_ARTIFICIAL (decl))
-           cp_warning_at ("sorry: semantics of inline function static data `%#D' are wrong (you'll wind up with multiple copies)", decl);
+         current_function_cannot_inline
+           = "function with static variable cannot be inline";
        }
 
       else if (TREE_CODE (decl) == VAR_DECL
index 00e7546b26882160d6654c97a03a4a297ac4643f..f8e3cd40667537bcd3b8301210ae4ebf2ef455cc 100644 (file)
@@ -214,6 +214,9 @@ int current_function_uses_pic_offset_table;
 /* The arg pointer hard register, or the pseudo into which it was copied.  */
 rtx current_function_internal_arg_pointer;
 
+/* Language-specific reason why the current function cannot be made inline.  */
+char *current_function_cannot_inline;
+
 /* The FUNCTION_DECL for an inline function currently being expanded.  */
 tree inline_function_decl;
 
@@ -507,6 +510,7 @@ push_function_context_to (context)
   p->uses_const_pool = current_function_uses_const_pool;
   p->uses_pic_offset_table = current_function_uses_pic_offset_table;
   p->internal_arg_pointer = current_function_internal_arg_pointer;
+  p->cannot_inline = current_function_cannot_inline;
   p->max_parm_reg = max_parm_reg;
   p->parm_reg_stack_loc = parm_reg_stack_loc;
   p->outgoing_args_size = current_function_outgoing_args_size;
@@ -588,6 +592,7 @@ pop_function_context_from (context)
   current_function_uses_const_pool = p->uses_const_pool;
   current_function_uses_pic_offset_table = p->uses_pic_offset_table;
   current_function_internal_arg_pointer = p->internal_arg_pointer;
+  current_function_cannot_inline = p->cannot_inline;
   max_parm_reg = p->max_parm_reg;
   parm_reg_stack_loc = p->parm_reg_stack_loc;
   current_function_outgoing_args_size = p->outgoing_args_size;
@@ -5319,6 +5324,7 @@ init_function_start (subr, filename, line)
   current_function_epilogue_delay_list = 0;
   current_function_uses_const_pool = 0;
   current_function_uses_pic_offset_table = 0;
+  current_function_cannot_inline = 0;
 
   /* We have not yet needed to make a label to jump to for tail-recursion.  */
   tail_recursion_label = 0;
index 59a149d448164dfa6855fac2f272374f31b2c5a0..e06366c9478dfb12ce800b97bbcc36c9b0919ddd 100644 (file)
@@ -102,6 +102,7 @@ struct function
   rtx tail_recursion_label;
   rtx tail_recursion_reentry;
   rtx internal_arg_pointer;
+  char *cannot_inline;
   rtx arg_pointer_save_area;
   tree rtl_expr_chain;
   rtx last_parm_insn;
index ef78b0a924813af3f23d4ece4e2fc8f5424d76ba..518f1c0c12f98b802a550c03eb8940a480494750 100644 (file)
@@ -132,6 +132,9 @@ function_cannot_inline_p (fndecl)
   if (current_function_contains_functions)
     return "function with nested functions cannot be inline";
 
+  if (current_function_cannot_inline)
+    return current_function_cannot_inline;
+
   /* If its not even close, don't even look.  */
   if (!DECL_INLINE (fndecl) && get_max_uid () > 3 * max_insns)
     return "function too large to be inline";
index c3c0381ded6a20b67679236c58dc0021421aa233..dd9ad82a6bcf63ef247bac1039d8ebf5da86d348 100644 (file)
@@ -437,6 +437,9 @@ extern int current_function_uses_pic_offset_table;
 /* This is nonzero if the current function uses the constant pool.  */
 extern int current_function_uses_const_pool;
 
+/* Language-specific reason why the current function cannot be made inline.  */
+extern char *current_function_cannot_inline;
+
 /* The line number of the beginning of the current function.
    sdbout.c needs this so that it can output relative linenumbers.  */
 
This page took 0.10926 seconds and 5 git commands to generate.