This is the mail archive of the gcc@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: C compile time


> > > Hmm, so we have combination of these two problems...
> > > 
> > > In case it is easy for you to do so, can you also
> > > compare -O2
> > > -funit-at-a-time -fno-inline-functions and -O2
> > > -fno-inline-functions.
> > 
> > Do you mean -O3 here? -fno-inline-functions
> > -funit-at-a-time -O2 was exactly the same as
> > -funit-at-a-time -O2.
> 
> Hmm, I realize there is no way to disable inlining functions once.
> I will prepare patch and then come back :)

Here it comes.  Bootstrap in progress, OK assuming it psses?
Dara: with this patch you -O2 -funit-at-a-time should enable unit at a
time compilation only, while -O2 -finline-functions-called-once will be
what -O2 -funit-at-a-time is now.

Honza

Thu Jun 19 23:28:51 CEST 2003  Jan Hubicka  <jh@suse.cz>
	* cgraphunit.c (cgraph_optimize): Inline functions called once
	only with flag_inline_functions_called_once.
	* flags.h (flag_inline_functions_called_once): Declare.
	* toplev.c (flag_inline_functions_called_once): Global variable.
	(lang_independent_options): Add optimize-functions-called-once.
	(parse_options_and_default_flags): Set
	flag_inline_functions_called_once at -O3.
	(process_options): flag_inline_functions_called_once imply
	flag_unit_at_a_time.
	* invoke.texi (-finline-functions-called-once): Document.
Index: cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 cgraphunit.c
*** cgraphunit.c	12 May 2003 09:46:25 -0000	1.5
--- cgraphunit.c	19 Jun 2003 21:26:41 -0000
*************** cgraph_optimize ()
*** 454,460 ****
  
    cgraph_mark_local_functions ();
  
!   cgraph_mark_functions_to_inline_once ();
  
    cgraph_global_info_ready = true;
    if (!quiet_flag)
--- 454,461 ----
  
    cgraph_mark_local_functions ();
  
!   if (flag_inline_functions_called_once)
!     cgraph_mark_functions_to_inline_once ();
  
    cgraph_global_info_ready = true;
    if (!quiet_flag)
Index: flags.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flags.h,v
retrieving revision 1.111
diff -c -3 -p -r1.111 flags.h
*** flags.h	15 Jun 2003 08:29:58 -0000	1.111
--- flags.h	19 Jun 2003 21:26:42 -0000
*************** extern int flag_rerun_loop_opt;
*** 377,382 ****
--- 377,386 ----
  
  extern int flag_inline_functions;
  
+ /* Nonzero means make functions that are called just once.  */
+ 
+ extern int flag_inline_functions_called_once;
+ 
  /* Nonzero for -fkeep-inline-functions: even if we make a function
     go inline everywhere, keep its definition around for debugging
     purposes.  */
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.771
diff -c -3 -p -r1.771 toplev.c
*** toplev.c	15 Jun 2003 08:29:59 -0000	1.771
--- toplev.c	19 Jun 2003 21:26:43 -0000
*************** int flag_rerun_loop_opt;
*** 706,711 ****
--- 707,716 ----
  
  int flag_inline_functions;
  
+ /* Nonzero means make functions that are called just once.  */
+ 
+ int flag_inline_functions_called_once;
+ 
  /* Nonzero for -fkeep-inline-functions: even if we make a function
     go inline everywhere, keep its definition around for debugging
     purposes.  */
*************** static const lang_independent_options f_
*** 1097,1102 ****
--- 1102,1109 ----
     N_("Allow function addresses to be held in registers") },
    {"inline-functions", &flag_inline_functions, 1,
     N_("Integrate simple functions into their callers") },
+   {"inline-functions-called-once", &flag_inline_functions_called_once, 1,
+    N_("Integrate simple functions into their callers when they are called just once") },
    {"keep-inline-functions", &flag_keep_inline_functions, 1,
     N_("Generate code for funcs even if they are fully inlined") },
    {"inline", &flag_no_inline, 0,
*************** parse_options_and_default_flags (int arg
*** 5062,5067 ****
--- 5075,5081 ----
        flag_rename_registers = 1;
        flag_unswitch_loops = 1;
        flag_unit_at_a_time = 1;
+       flag_inline_functions_called_once = 1;
      }
  
    if (optimize < 2 || optimize_size)
*************** process_options (void)
*** 5278,5283 ****
--- 5292,5300 ----
      flag_asynchronous_unwind_tables = 1;
    if (flag_asynchronous_unwind_tables)
      flag_unwind_tables = 1;
+ 
+   if (flag_inline_functions_called_once)
+     flag_unit_at_a_time = 1;
  
    /* Disable unit-at-a-time mode for frontends not supporting callgraph
       interface.  */
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.291
diff -c -3 -p -r1.291 invoke.texi
*** doc/invoke.texi	13 Jun 2003 10:11:45 -0000	1.291
--- doc/invoke.texi	19 Jun 2003 21:26:48 -0000
*************** in the following sections.
*** 265,271 ****
  -fforce-addr  -fforce-mem  -ffunction-sections @gol
  -fgcse  -fgcse-lm  -fgcse-sm  -floop-optimize  -fcrossjumping @gol
  -fif-conversion  -fif-conversion2 @gol
! -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
  -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
  -fmove-all-movables  -fnew-ra  -fno-branch-count-reg @gol
  -fno-default-inline  -fno-defer-pop @gol
--- 265,272 ----
  -fforce-addr  -fforce-mem  -ffunction-sections @gol
  -fgcse  -fgcse-lm  -fgcse-sm  -floop-optimize  -fcrossjumping @gol
  -fif-conversion  -fif-conversion2 @gol
! -finline-functions  -finline-limit=@var{n} @gol
! -finline-functions-called-once  -fkeep-inline-functions @gol
  -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
  -fmove-all-movables  -fnew-ra  -fno-branch-count-reg @gol
  -fno-default-inline  -fno-defer-pop @gol
*************** integrating in this way.
*** 3611,3616 ****
--- 3612,3625 ----
  If all calls to a given function are integrated, and the function is
  declared @code{static}, then the function is normally not output as
  assembler code in its own right.
+ 
+ Enabled at level @option{-O3}.
+ 
+ @item -finline-functions-called-once
+ @opindex finline-functions-called-once
+ Integrate functions into their callers when they are called just once
+ and their address is not taken, so the orignal function body does not need
+ to be assembled.  Implies @option{-funit-at-a-time}
  
  Enabled at level @option{-O3}.
  


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