* ada/misc.c (gnat_expand_body): Don't call target for destructors,
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 22 Apr 2007 15:33:32 +0000 (15:33 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 22 Apr 2007 15:33:32 +0000 (15:33 +0000)
avoid redundant check on syntax errors.

* final.c (rest_of_handle_final): Call
targetm.asm_out.constructor/targetm.asm_out.destructor
* cgraphunit.c (cgraph_build_static_cdtor): Don't do it here; set
proper priority via decl_*_priority_insert.
* c-common.c (c_expand_body): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124044 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/misc.c
gcc/c-common.c
gcc/cgraphunit.c
gcc/final.c

index 27a7457..b9c27f5 100644 (file)
@@ -1,3 +1,11 @@
+2007-04-22  Jan Hubicka  <jh@suse.cz>
+
+       * final.c (rest_of_handle_final): Call
+       targetm.asm_out.constructor/targetm.asm_out.destructor
+       * cgraphunit.c (cgraph_build_static_cdtor): Don't do it here; set
+       proper priority via decl_*_priority_insert.
+       * c-common.c (c_expand_body): Likewise.
+
 2007-04-22  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/29789
index eab7715..2ba34f3 100644 (file)
@@ -1,3 +1,8 @@
+2007-04-21  Jan Hubicka  <jh@suse.cz>
+
+       * misc.c (gnat_expand_body): Don't call target for destructors,
+       avoid redundant check on syntax errors.
+
 2007-04-21  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        * ada-tree.h (lang_tree_node): Use GENERIC_NEXT
index 8c53961..7d4ffde 100644 (file)
@@ -676,18 +676,7 @@ gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode,
 static void
 gnat_expand_body (tree gnu_decl)
 {
-  if (!DECL_INITIAL (gnu_decl) || DECL_INITIAL (gnu_decl) == error_mark_node)
-    return;
-
   tree_rest_of_compilation (gnu_decl);
-
-  if (DECL_STATIC_CONSTRUCTOR (gnu_decl) && targetm.have_ctors_dtors)
-    targetm.asm_out.constructor (XEXP (DECL_RTL (gnu_decl), 0),
-                                 DEFAULT_INIT_PRIORITY);
-
-  if (DECL_STATIC_DESTRUCTOR (gnu_decl) && targetm.have_ctors_dtors)
-    targetm.asm_out.destructor (XEXP (DECL_RTL (gnu_decl), 0),
-                                DEFAULT_INIT_PRIORITY);
 }
 
 /* Adjusts the RLI used to layout a record after all the fields have been
index 761a9b4..cedaa42 100644 (file)
@@ -4295,21 +4295,7 @@ c_expand_expr (tree exp, rtx target, enum machine_mode tmode,
 void
 c_expand_body (tree fndecl)
 {
-
-  if (!DECL_INITIAL (fndecl)
-      || DECL_INITIAL (fndecl) == error_mark_node)
-    return;
-
   tree_rest_of_compilation (fndecl);
-
-  if (DECL_STATIC_CONSTRUCTOR (fndecl)
-      && targetm.have_ctors_dtors)
-    targetm.asm_out.constructor (XEXP (DECL_RTL (fndecl), 0),
-                                decl_init_priority_lookup (fndecl));
-  if (DECL_STATIC_DESTRUCTOR (fndecl)
-      && targetm.have_ctors_dtors)
-    targetm.asm_out.destructor (XEXP (DECL_RTL (fndecl), 0),
-                               decl_fini_priority_lookup (fndecl));
 }
 
 /* Hook used by staticp to handle language-specific tree codes.  */
index 416cf3e..13079a2 100644 (file)
@@ -1366,9 +1366,11 @@ cgraph_build_static_cdtor (char which, tree body, int priority)
     {
     case 'I':
       DECL_STATIC_CONSTRUCTOR (decl) = 1;
+      decl_init_priority_insert (decl, priority);
       break;
     case 'D':
       DECL_STATIC_DESTRUCTOR (decl) = 1;
+      decl_fini_priority_insert (decl, priority);
       break;
     default:
       gcc_unreachable ();
@@ -1378,17 +1380,6 @@ cgraph_build_static_cdtor (char which, tree body, int priority)
 
   cgraph_add_new_function (decl, false);
   cgraph_mark_needed_node (cgraph_node (decl));
-
-  if (targetm.have_ctors_dtors)
-    {
-      void (*fn) (rtx, int);
-
-      if (which == 'I')
-       fn = targetm.asm_out.constructor;
-      else
-       fn = targetm.asm_out.destructor;
-      fn (XEXP (DECL_RTL (decl), 0), priority);
-    }
 }
 
 void
index a18f029..ebc1efe 100644 (file)
@@ -4043,6 +4043,16 @@ rest_of_handle_final (void)
   timevar_push (TV_SYMOUT);
   (*debug_hooks->function_decl) (current_function_decl);
   timevar_pop (TV_SYMOUT);
+  if (DECL_STATIC_CONSTRUCTOR (current_function_decl)
+      && targetm.have_ctors_dtors)
+    targetm.asm_out.constructor (XEXP (DECL_RTL (current_function_decl), 0),
+                                decl_init_priority_lookup
+                                  (current_function_decl));
+  if (DECL_STATIC_DESTRUCTOR (current_function_decl)
+      && targetm.have_ctors_dtors)
+    targetm.asm_out.destructor (XEXP (DECL_RTL (current_function_decl), 0),
+                               decl_fini_priority_lookup
+                                 (current_function_decl));
   return 0;
 }