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
This commit is contained in:
Jan Hubicka 2007-04-22 17:33:32 +02:00 committed by Jan Hubicka
parent b7716a8e90
commit 395a40e0e2
6 changed files with 25 additions and 36 deletions

View 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

View 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

View 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

View 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. */

View 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

View 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;
}