c-decl.c (c_expand_body): Don't call outlining_inline_function.
authorRichard Henderson <rth@redhat.com>
Sun, 6 Jan 2002 03:51:13 +0000 (19:51 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 6 Jan 2002 03:51:13 +0000 (19:51 -0800)
        * c-decl.c (c_expand_body): Don't call outlining_inline_function.
        * integrate.c (output_inline_function): Likewise.
        * toplev.c (rest_of_compilation): Do it here instead.  Move call
        to remove_unnecessary_notes after emitting abstract instance.
        Force an emitted nested function to have its parent emited as well.
        * dwarf2out.c (loc_descriptor_from_tree): Read mode after checking
        for null.
        (rtl_for_decl_location): Do not look at reload data structures
        before reload has run.

        * semantics.c (expand_body): Revert last change.

From-SVN: r48572

gcc/ChangeLog
gcc/c-decl.c
gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/dwarf2out.c
gcc/integrate.c
gcc/toplev.c

index 6746ed0f262600528f86dfc3e1f515472365b766..7a4adfcf54c741403da261d69e63fa05a5763491 100644 (file)
@@ -1,3 +1,15 @@
+2002-01-05  Richard Henderson  <rth@redhat.com>
+
+       * c-decl.c (c_expand_body): Don't call outlining_inline_function.
+       * integrate.c (output_inline_function): Likewise.
+       * toplev.c (rest_of_compilation): Do it here instead.  Move call
+       to remove_unnecessary_notes after emitting abstract instance.
+       Force an emitted nested function to have its parent emited as well.
+       * dwarf2out.c (loc_descriptor_from_tree): Read mode after checking
+       for null.
+       (rtl_for_decl_location): Do not look at reload data structures
+       before reload has run.
+
 2002-01-05  Kazu Hirata  <kazu@hxi.com>
 
        * cse.c: Fix formatting.
index eb29b170a5c86f51447f57859ef52608bb6ffd01..d6e8ac33469b64f0700f0c7fe59502c31bb9fc0e 100644 (file)
@@ -6947,11 +6947,6 @@ c_expand_body (fndecl, nested_p, can_defer_p)
 
   timevar_push (TV_EXPAND);
 
-  if (DECL_INLINE (fndecl))
-    /* Do any preparation such as emitting abstract debug info for the
-       inline before it gets mangled by optimization.  */
-    (*debug_hooks->outlining_inline_function) (fndecl);
-
   if (nested_p)
     {
       /* Make sure that we will evaluate variable-sized types involved
index 591a882ef1559e26a7dcfbe306f6249970b97281..d7fdc572140c111959ab1e47f233763047c80076 100644 (file)
@@ -1,3 +1,7 @@
+2002-01-05  Richard Henderson  <rth@redhat.com>
+
+        * semantics.c (expand_body): Revert last change.
+
 2002-01-04  Jason Merrill  <jason@redhat.com>
 
        * class.c (update_vtable_entry_for_fn): Set delta to zero for a
index 06c1ac21c33634a242e8c47b0d3259f5925b9e70..f17019cc8ee90e17bdcfa5522c8822ef9e8298e6 100644 (file)
@@ -2503,11 +2503,6 @@ expand_body (fn)
      recorded when we finished processing the function.  */
   lineno = STMT_LINENO (DECL_SAVED_TREE (fn));
 
-  if (DECL_INLINE (fn))
-    /* Do any preparation such as emitting abstract debug info for the
-       inline before it gets mangled by optimization.  */
-    (*debug_hooks->outlining_inline_function) (fn);
-
   /* Generate code for the function.  */
   genrtl_finish_function (fn);
 
index 4a94154549497f8df740191db7541b21c1725495..3c114848adb61220be1b68d0425ede4ca51a9f5f 100644 (file)
@@ -7968,7 +7968,6 @@ loc_descriptor_from_tree (loc, addressp)
     case PARM_DECL:
       {
        rtx rtl = rtl_for_decl_location (loc);
-       enum machine_mode mode = GET_MODE (rtl);
 
        if (rtl == NULL_RTX)
          return 0;
@@ -7981,6 +7980,8 @@ loc_descriptor_from_tree (loc, addressp)
          }
        else
          {
+           enum machine_mode mode = GET_MODE (rtl);
+
            if (GET_CODE (rtl) == MEM)
              {
                indirect_p = 1;
@@ -8751,7 +8752,18 @@ rtl_for_decl_location (decl)
   /* Use DECL_RTL as the "location" unless we find something better.  */
   rtl = DECL_RTL_IF_SET (decl);
 
-  if (TREE_CODE (decl) == PARM_DECL)
+  /* When generating abstract instances, ignore everything except
+     constants and symbols living in memory.  */
+  if (! reload_completed)
+    {
+      if (rtl
+         && (CONSTANT_P (rtl)
+             || (GET_CODE (rtl) == MEM
+                 && CONSTANT_P (XEXP (rtl, 0)))))
+       return rtl;
+      rtl = NULL_RTX;
+    }
+  else if (TREE_CODE (decl) == PARM_DECL)
     {
       if (rtl == NULL_RTX || is_pseudo_reg (rtl))
        {
@@ -8816,7 +8828,7 @@ rtl_for_decl_location (decl)
   /* A variable with no DECL_RTL but a DECL_INITIAL is a compile-time constant,
      and will have been substituted directly into all expressions that use it.
      C does not have such a concept, but C++ and other languages do.  */
-  else if (DECL_INITIAL (decl))
+  else if (TREE_CODE (decl) == VAR_DECL && DECL_INITIAL (decl))
     rtl = expand_expr (DECL_INITIAL (decl), NULL_RTX, VOIDmode,
                       EXPAND_INITIALIZER);
 
index 9143e0e09e5aa2d66364f6acf004d7dde8917b44..05717564181f06401067e795b6450ceac2d7099c 100644 (file)
@@ -1,6 +1,6 @@
 /* Procedure integration for GCC.
    Copyright (C) 1988, 1991, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GCC.
@@ -2950,10 +2950,6 @@ output_inline_function (fndecl)
       debug_hooks = &do_nothing_debug_hooks;
     }
 
-  /* Do any preparation, such as emitting abstract debug info for the inline
-     before it gets mangled by optimization.  */
-  (*debug_hooks->outlining_inline_function) (fndecl);
-
   /* Compile this function all the way down to assembly code.  As a
      side effect this destroys the saved RTL representation, but
      that's okay, because we don't need to inline this anymore.  */
index 02e6befb514abade9ae590329343c2f11f4dffb5..61054262b39c05dede006451cae96db32692cce0 100644 (file)
@@ -2363,11 +2363,6 @@ rest_of_compilation (decl)
   if (!cfun->x_whole_function_mode_p)
     identify_blocks ();
 
-  /* Then remove any notes we don't need.  That will make iterating
-     over the instruction sequence faster, and allow the garbage
-     collector to reclaim the memory used by the notes.  */
-  remove_unnecessary_notes ();
-
   /* In function-at-a-time mode, we do not attempt to keep the BLOCK
      tree in sensible shape.  So, we just recalculate it here.  */
   if (cfun->x_whole_function_mode_p)
@@ -2505,6 +2500,29 @@ rest_of_compilation (decl)
        goto exit_rest_of_compilation;
     }
 
+  /* If we're emitting a nested function, make sure its parent gets
+     emitted as well.  Doing otherwise confuses debug info.  */
+  {
+    tree parent;
+    for (parent = DECL_CONTEXT (current_function_decl);
+        parent != NULL_TREE;
+        parent = get_containing_scope (parent))
+      if (TREE_CODE (parent) == FUNCTION_DECL)
+       TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1;
+  }
+
+  /* We are now committed to emitting code for this function.  Do any
+     preparation, such as emitting abstract debug info for the inline
+     before it gets mangled by optimization.  */
+  if (DECL_INLINE (decl))
+    (*debug_hooks->outlining_inline_function) (decl);
+
+  /* Remove any notes we don't need.  That will make iterating
+     over the instruction sequence faster, and allow the garbage
+     collector to reclaim the memory used by the notes.  */
+  remove_unnecessary_notes ();
+  reorder_blocks ();
+
   ggc_collect ();
 
   /* Initialize some variables used by the optimizers.  */