aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2007-04-22 17:33:32 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2007-04-22 15:33:32 +0000
commit395a40e0e28129430ca707dad8475fefad3d8782 (patch)
tree7a5b02a557aae27620a13c42bc29913de6d67d9e /gcc
parentb7716a8e90c72b98b9f92f20c1fa142e6573e05d (diff)
downloadgcc-395a40e0e28129430ca707dad8475fefad3d8782.zip
gcc-395a40e0e28129430ca707dad8475fefad3d8782.tar.gz
gcc-395a40e0e28129430ca707dad8475fefad3d8782.tar.bz2
misc.c (gnat_expand_body): Don't call target for destructors, avoid redundant check on syntax errors.
* ada/misc.c (gnat_expand_body): Don't call target for destructors, 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. From-SVN: r124044
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/misc.c11
-rw-r--r--gcc/c-common.c14
-rw-r--r--gcc/cgraphunit.c13
-rw-r--r--gcc/final.c10
6 files changed, 25 insertions, 36 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 27a7457..b9c27f5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index eab7715..2ba34f3 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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
diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c
index 8c53961..7d4ffde 100644
--- a/gcc/ada/misc.c
+++ b/gcc/ada/misc.c
@@ -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
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 761a9b4..cedaa42 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -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. */
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 416cf3e..13079a2 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -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
diff --git a/gcc/final.c b/gcc/final.c
index a18f029..ebc1efe 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -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;
}