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]

[PATCH][3.4] Fix PR15366, -fno-inline-functions is ignored for staticfunctions


Third variant, for 3.4.

Ok for branch?

Thanks,
Richard.


2005-08-31  Richard Guenther  <rguenther@suse.de>

	* common.opt: Add -fflag-inline-functions-called-once.
	* flags.h: Likewise.
	* opts.c (decode_options): Handle flag_inline_functions_called_once.
	* toplev.c: Likewise.
	* cgraphunit.c (cgraph_decide_inlining): Honour
	flag_inline_functions_called_once.
	* doc/invoke.texi: Document new flag.

Index: cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.46.2.6
diff -c -3 -p -r1.46.2.6 cgraphunit.c
*** cgraphunit.c	5 May 2004 23:24:28 -0000	1.46.2.6
--- cgraphunit.c	31 Aug 2005 13:02:37 -0000
*************** cgraph_decide_inlining (void)
*** 1330,1336 ****
--- 1330,1340 ----
  	if (node->aux || node->output)
  	  abort ();
  #endif
+     }
  
+   if (!flag_really_no_inline
+       && flag_inline_functions_called_once)
+     {
        if (cgraph_dump_file)
  	fprintf (cgraph_dump_file, "\nDeciding on functions called once:\n");
  
Index: common.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/common.opt,v
retrieving revision 1.24.4.2
diff -c -3 -p -r1.24.4.2 common.opt
*** common.opt	28 Oct 2004 03:43:09 -0000	1.24.4.2
--- common.opt	31 Aug 2005 13:02:37 -0000
*************** finline-functions
*** 397,402 ****
--- 397,406 ----
  Common
  Integrate simple functions into their callers
  
+ finline-functions-called-once
+ Common
+ Integrate functions called once into their callers
+ 
  finline-limit-
  Common RejectNegative Joined UInteger
  
Index: flags.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flags.h,v
retrieving revision 1.127.4.1
diff -c -3 -p -r1.127.4.1 flags.h
*** flags.h	18 Feb 2004 00:09:04 -0000	1.127.4.1
--- flags.h	31 Aug 2005 13:02:37 -0000
*************** extern int flag_rerun_loop_opt;
*** 383,388 ****
--- 383,392 ----
  
  extern int flag_inline_functions;
  
+ /* Nonzero means to make functions called once inline candidates.  */
+ 
+ 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: opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/opts.c,v
retrieving revision 1.51.4.3
diff -c -3 -p -r1.51.4.3 opts.c
*** opts.c	18 Feb 2004 00:09:04 -0000	1.51.4.3
--- opts.c	31 Aug 2005 13:02:37 -0000
*************** decode_options (unsigned int argc, const
*** 565,570 ****
--- 565,571 ----
        flag_reorder_blocks = 1;
        flag_reorder_functions = 1;
        flag_unit_at_a_time = 1;
+       flag_inline_functions_called_once = 1;
      }
  
    if (optimize >= 3)
*************** common_handle_option (size_t scode, cons
*** 1064,1069 ****
--- 1065,1074 ----
        flag_inline_functions = value;
        break;
  
+     case OPT_finline_functions_called_once:
+       flag_inline_functions_called_once = value;
+       break;
+ 
      case OPT_finline_limit_:
      case OPT_finline_limit_eq:
        set_param_value ("max-inline-insns-single", value / 2);
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.863.4.15
diff -c -3 -p -r1.863.4.15 toplev.c
*** toplev.c	9 Mar 2005 00:50:25 -0000	1.863.4.15
--- toplev.c	31 Aug 2005 13:02:37 -0000
*************** int flag_rerun_loop_opt;
*** 724,729 ****
--- 724,734 ----
  
  int flag_inline_functions;
  
+ /* Nonzero for -finline-functions-called-once: ok to inline functions that
+    are called 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_
*** 1064,1069 ****
--- 1069,1075 ----
    {"force-addr", &flag_force_addr, 1 },
    {"function-cse", &flag_no_function_cse, 0 },
    {"inline-functions", &flag_inline_functions, 1 },
+   {"inline-functions-called-once", &flag_inline_functions_called_once, 1 },
    {"keep-inline-functions", &flag_keep_inline_functions, 1 },
    {"inline", &flag_no_inline, 0 },
    {"keep-static-consts", &flag_keep_static_consts, 1 },
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.390.2.40
diff -c -3 -p -r1.390.2.40 invoke.texi
*** doc/invoke.texi	22 Apr 2005 06:49:59 -0000	1.390.2.40
--- doc/invoke.texi	31 Aug 2005 13:02:39 -0000
*************** in the following sections.
*** 271,277 ****
  -fforce-addr  -fforce-mem  -ffunction-sections @gol
  -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -floop-optimize @gol
  -fcrossjumping  -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
--- 271,278 ----
  -fforce-addr  -fforce-mem  -ffunction-sections @gol
  -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -floop-optimize @gol
  -fcrossjumping  -fif-conversion  -fif-conversion2 @gol
! -finline-functions -finline-functions-called-once @gol 
! -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
*************** assembler code in its own right.
*** 3758,3763 ****
--- 3759,3775 ----
  
  Enabled at level @option{-O3}.
  
+ @item -finline-functions-called-once
+ @opindex finline-functions-called-once
+ Integrate functions called once into their callers.  The compiler
+ heuristically decides which functions are simple enough to be worth
+ integrating in this way.
+ 
+ If the call to the given function is integrated then the function is
+ not output as assembler code in its own right.
+ 
+ Enabled at levels @option{-O2}, @option{-O3}.
+ 
  @item -finline-limit=@var{n}
  @opindex finline-limit
  By default, GCC limits the size of functions that can be inlined.  This flag


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