This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++] Avoid one place of frontend calling into targetm
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, mark at codesourcery dot com
- Date: Mon, 23 Apr 2007 02:15:23 +0200
- Subject: [C++] Avoid one place of frontend calling into targetm
Hi,
this patch removes direct call of constructor/destructor target bits and
instead uses the tree representation. Those will all have to go for
LTO. I am especially scared of thunks that probably needs to be attached
to cgraph so we can remove C++'s expand_body bits too.
Bootstrapped/regtested i686-linux, OK?
Honza
* cp/decl2.c (finish_objects): Do not call target constructor/destructor
bits dirrectly.
Index: cp/decl2.c
===================================================================
*** cp/decl2.c (revision 124043)
--- cp/decl2.c (working copy)
*************** finish_objects (int method_type, int ini
*** 2363,2385 ****
/* Finish up. */
finish_compound_stmt (body);
fn = finish_function (0);
- expand_or_defer_fn (fn);
-
- /* When only doing semantic analysis, and no RTL generation, we
- can't call functions that directly emit assembly code; there is
- no assembly file in which to put the code. */
- if (flag_syntax_only)
- return;
! if (targetm.have_ctors_dtors)
{
! rtx fnsym = XEXP (DECL_RTL (fn), 0);
! cgraph_mark_needed_node (cgraph_node (fn));
! if (method_type == 'I')
! (* targetm.asm_out.constructor) (fnsym, initp);
! else
! (* targetm.asm_out.destructor) (fnsym, initp);
}
}
/* The names of the parameters to the function created to handle
--- 2363,2381 ----
/* Finish up. */
finish_compound_stmt (body);
fn = finish_function (0);
! if (method_type == 'I')
{
! DECL_STATIC_CONSTRUCTOR (fn) = 1;
! decl_init_priority_insert (fn, initp);
}
+ else
+ {
+ DECL_STATIC_DESTRUCTOR (fn) = 1;
+ decl_fini_priority_insert (fn, initp);
+ }
+
+ expand_or_defer_fn (fn);
}
/* The names of the parameters to the function created to handle