[C++] Remove some unnecesary stuff from expand_body

Jan Hubicka jh@suse.cz
Tue Sep 4 17:17:00 GMT 2007


Hi,
I would like to get rid of expand_body langhook and last user of it is
C++.  This patch removes some stuff that is unnecesary.  Major offender
remains the emit_associated_thunks call I am not quite sure how to deal
with - we can probably construct the thunks in some non-FE specific way
and let cgraph to do the job or move it to different (:)) langhook that
at least won't require cgraph to go trought frontend to get function
out.

Bootstrapped/regtested ppc-linux, OK?

Honza

	* cp/sematics.c (expand_body): Remove unnecesary import_export_decl call,
	DECL_EXTERNAL checks and current_function_decl saving.
Index: cp/semantics.c
===================================================================
--- cp/semantics.c	(revision 128061)
+++ cp/semantics.c	(working copy)
@@ -3131,24 +3131,6 @@ emit_associated_thunks (tree fn)
 void
 expand_body (tree fn)
 {
-  tree saved_function;
-
-  /* Compute the appropriate object-file linkage for inline
-     functions.  */
-  if (DECL_DECLARED_INLINE_P (fn))
-    import_export_decl (fn);
-
-  /* If FN is external, then there's no point in generating RTL for
-     it.  This situation can arise with an inline function under
-     `-fexternal-templates'; we instantiate the function, even though
-     we're not planning on emitting it, in case we get a chance to
-     inline it.  */
-  if (DECL_EXTERNAL (fn))
-    return;
-
-  /* ??? When is this needed?  */
-  saved_function = current_function_decl;
-
   /* Emit any thunks that should be emitted at the same time as FN.  */
   emit_associated_thunks (fn);
 
@@ -3159,8 +3141,6 @@ expand_body (tree fn)
 
   c_expand_body (fn);
 
-  current_function_decl = saved_function;
-
   if (DECL_CLONED_FUNCTION_P (fn))
     {
       /* If this is a clone, go through the other clones now and mark



More information about the Gcc-patches mailing list