This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR optimization/12324


> On Thu, Oct 16, 2003 at 10:40:56PM +0200, Jan Hubicka wrote:
> > !       /* By using GCC extension we may produce constructors we never use,
> > !          so ensure that the function is not emit unless it is needed.  */
> > !       if (!flag_unit_at_a_time)
> > !         DECL_DEFER_OUTPUT (decl) = 1;
> 
> Rather than scatter this kind of thing about, wouldn't it be better
> to make unit-at-a-time ignore this setting?

OK, more I was thinking about it I found that all the individual
problems I hit when I tried to do so 2 months ago are gone, so only what
I have to deffer right now are forward declarations (.comm symbols).

Is the attached patch OK?  (I will work on making comm symbols to go
into varpool as well, but it needs some work and perhaps I should delay
that for next development cycle)

Fri Oct 17 15:00:53 CEST 2003  Jan Hubicka  <jh@suse.cz>
	* toplev.c  (rest_of_decl_compilation): Do not deffer when compiling in
	unit-at-a-time mode.
*** ../gcc.old/toplev.c	Sat Sep 27 23:30:43 2003
--- toplev.c	Fri Oct 17 15:00:03 2003
*************** rest_of_decl_compilation (tree decl,
*** 1901,1908 ****
  	make_decl_rtl (decl, asmspec);
  
        /* Don't output anything when a tentative file-scope definition
! 	 is seen.  But at end of compilation, do output code for them.  */
!       if ((at_end || !DECL_DEFER_OUTPUT (decl)) && !DECL_EXTERNAL (decl))
  	{
  	  if (flag_unit_at_a_time && !cgraph_global_info_ready
  	      && TREE_CODE (decl) != FUNCTION_DECL && top_level)
--- 1901,1915 ----
  	make_decl_rtl (decl, asmspec);
  
        /* Don't output anything when a tentative file-scope definition
! 	 is seen.  But at end of compilation, do output code for them.
! 
! 	 We do output all variables when unit-at-a-time is active and rely on
! 	 callgraph code to defer them except for forward declarations
! 	 (see gcc.c-torture/compile/920624-1.c) */
!       if ((at_end
! 	   || (!DECL_DEFER_OUTPUT (decl)
! 	       || (flag_unit_at_a_time && DECL_INITIAL (decl))))
! 	  && !DECL_EXTERNAL (decl))
  	{
  	  if (flag_unit_at_a_time && !cgraph_global_info_ready
  	      && TREE_CODE (decl) != FUNCTION_DECL && top_level)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]