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]

PR7257-related inline flags cleanup


Hi,

This patch is step one in the cleanup of our inline flags mess.

Right now we have the following flags:

- flag_no_inline: User-visible flag.  Supposed to mean that we ignore
  the `inline' keyword - only `always_inline' function are inlined.
  This effectively turned off RTL inlining.
- flag_really_no_inline: Non-visible flag.  Means that the user passed
  flag_no_inline.  Needed because for tree-inlining, flag_no_inline is
  set, historically to disable the RTL inliner.
- flag_inline_functions: User-visible flag.  Supposed to mean that all
  functions are treated as if they are declared `inline'.  This flag
  is turned off by all front end post_options lang_hooks, but is still
  used to set flag_inline_trees
- flag_inline_trees: Non-visible non-flag.  Has the following settings:
    0 : Don't inline anything, ever.
    1 : Inline functions declared 'inline'
    2 : Inline everything.

Now, there are many problems with all of this.  First of all, the
flag_really_no_inline vs. flag_no_inline thing is redundant now that
the RTL inliner is dead.  I'll address that in a follow-up patch.
Second, the backend has checks for flag_inline_functions, but with
tree inlining enabled, this flag is always zeroed out by the language
options processing, so the checks in the backends are unnecessary.
Also, setting this flag to zero means that it won't show up anymore
in -fverbose-asm assembler files.  This is PR7257.

There issues that make it impossible to replace flag_inline_trees
with combinations of flag_no_inline and flag_inline_functions.  The C
and Ada front end unconditionally set flag_inline_trees to 1.  The
result of no longer doing that is that `always_inline' functions are
no longer inlined.  So I don't want to tamper with flag_inline_trees
at this stage, but I plan to do it for 4.1.  (A similar problem for
C++ disappeared when C++ went to always unit-at-a-time mode, so with
a bit of luck perhaps... ;-).

This patch just cleans up flag_inline_function users that are not in
option processing code.  It fixes PR7257, in a way.  Bootstrapped and
tested on x86_64-unknown-linux-gnu.  OK?

Gr.
Steven


gcc/
	* c-opts.c (c_common_post_options): Don't clear
	flag_inline_functions.
	* dojump.c (clear_pending_stack_adjust): Remove check on
	flag_inline_functions, it's always true.
	* config/alpha/alpha.md (movdi_er_maybe_g): Remove splitter
	that can never trigger.
	* config/c4x/c4x.h (TARGET_CPU_CPP_BUILTINS): Don't look at
	flag_inline_trees, now that flag_inline_functions is never
	cleared.
	* config/pdp11/pdp11.h (OPTIMIZATION_OPTIONS): Don't set
	flag_inline_functions at optimization levels greater than
	or equal to 3.  This is already done by default.

ada/
	* misc.c (gnat_post_options): Don't clear
	flag_inline_functions.

cp/
	* decl.c (cxx_init_decl_processing): Don't clear
	flag_inline_functions.

fortran/	
	* options.c (gfc_post_options): Don't clear flag_inline_functions.

java/
	* class.c (make_class_data): Don't check flag_inline_functions.
	* lang.c (flag_really_inline): Remove unused flag.
	(java_handle_option): Don't set it here.  Remove special handling
	of flag_inline_functions for Java.
	(java_init): Don't set flag_inline_trees here.  Already done...
	(java_post_options): ...here.  Don't clear flag_inline_functions.

Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.130
diff -u -3 -p -r1.130 c-opts.c
--- c-opts.c	21 Oct 2004 16:31:54 -0000	1.130
+++ c-opts.c	14 Nov 2004 15:32:13 -0000
@@ -945,10 +945,7 @@ c_common_post_options (const char **pfil
   if (!flag_no_inline)
     flag_no_inline = 1;
   if (flag_inline_functions)
-    {
-      flag_inline_trees = 2;
-      flag_inline_functions = 0;
-    }
+    flag_inline_trees = 2;
 
   /* If we are given more than one input file, we must use
      unit-at-a-time mode.  */
Index: dojump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dojump.c,v
retrieving revision 1.30
diff -u -3 -p -r1.30 dojump.c
--- dojump.c	18 Oct 2004 22:06:35 -0000	1.30
+++ dojump.c	14 Nov 2004 15:32:13 -0000
@@ -71,8 +71,7 @@ clear_pending_stack_adjust (void)
   if (optimize > 0
       && (! flag_omit_frame_pointer || current_function_calls_alloca)
       && EXIT_IGNORE_STACK
-      && ! (DECL_INLINE (current_function_decl) && ! flag_no_inline)
-      && ! flag_inline_functions)
+      && ! (DECL_INLINE (current_function_decl) && ! flag_no_inline))
     discard_pending_stack_adjust ();
 }
 
Index: ada/misc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/misc.c,v
retrieving revision 1.93
diff -u -3 -p -r1.93 misc.c
--- ada/misc.c	9 Nov 2004 10:12:21 -0000	1.93
+++ ada/misc.c	14 Nov 2004 15:32:13 -0000
@@ -352,10 +352,7 @@ gnat_post_options (const char **pfilenam
   if (!flag_no_inline)
     flag_no_inline = 1;
   if (flag_inline_functions)
-    {
-      flag_inline_trees = 2;
-      flag_inline_functions = 0;
-    }
+    flag_inline_trees = 2;
 
   return false;
 }
Index: config/alpha/alpha.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.md,v
retrieving revision 1.227
diff -u -3 -p -r1.227 alpha.md
--- config/alpha/alpha.md	28 Oct 2004 17:21:00 -0000	1.227
+++ config/alpha/alpha.md	14 Nov 2004 15:32:14 -0000
@@ -5379,41 +5379,6 @@
 		    (const_int 0)] UNSPEC_LITERAL))]
   "operands[2] = pic_offset_table_rtx;")
 
-;; With RTL inlining, at -O3, rtl is generated, stored, then actually
-;; compiled at the end of compilation.  In the meantime, someone can
-;; re-encode-section-info on some symbol changing it e.g. from global
-;; to local-not-small.  If this happens, we'd have emitted a plain
-;; load rather than a high+losum load and not recognize the insn.
-;;
-;; So if rtl inlining is in effect, we delay the global/not-global
-;; decision until rest_of_compilation by wrapping it in an UNSPEC_SYMBOL.
-
-(define_insn_and_split "movdi_er_maybe_g"
-  [(set (match_operand:DI 0 "register_operand" "=r")
-	(unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
-		   UNSPEC_SYMBOL))]
-  "TARGET_EXPLICIT_RELOCS && flag_inline_functions"
-  "#"
-  ""
-  [(set (match_dup 0) (match_dup 1))]
-{
-  if (local_symbolic_operand (operands[1], Pmode)
-      && !small_symbolic_operand (operands[1], Pmode))
-    {
-      rtx subtarget = no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode);
-      rtx tmp;
-
-      tmp = gen_rtx_HIGH (Pmode, operands[1]);
-      if (reload_completed)
-	tmp = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, tmp);
-      emit_insn (gen_rtx_SET (VOIDmode, subtarget, tmp));
-
-      tmp = gen_rtx_LO_SUM (Pmode, subtarget, operands[1]);
-      emit_insn (gen_rtx_SET (VOIDmode, operands[0], tmp));
-      DONE;
-    }
-})
-
 (define_insn "movdi_er_tlsgd"
   [(set (match_operand:DI 0 "register_operand" "=r")
 	(unspec:DI [(match_operand:DI 1 "register_operand" "r")
Index: config/c4x/c4x.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/c4x/c4x.h,v
retrieving revision 1.149
diff -u -3 -p -r1.149 c4x.h
--- config/c4x/c4x.h	21 Oct 2004 00:53:34 -0000	1.149
+++ config/c4x/c4x.h	14 Nov 2004 15:32:14 -0000
@@ -29,14 +29,12 @@
 #define TARGET_CPU_CPP_BUILTINS()		\
   do						\
     {						\
-      /* ??? HACK.  We shouldn't have flag_inline_trees at all.  */ \
       extern int flag_inline_trees;		\
       if (!TARGET_SMALL)			\
 	builtin_define ("_BIGMODEL");		\
       if (!TARGET_MEMPARM)			\
 	builtin_define ("_REGPARM");		\
-      if (flag_inline_functions			\
-	  || flag_inline_trees)			\
+      if (flag_inline_functions)		\
 	builtin_define ("_INLINE");		\
       if (TARGET_C3X)				\
 	{					\
Index: config/pdp11/pdp11.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pdp11/pdp11.h,v
retrieving revision 1.61
diff -u -3 -p -r1.61 pdp11.h
--- config/pdp11/pdp11.h	7 Jul 2004 19:24:38 -0000	1.61
+++ config/pdp11/pdp11.h	14 Nov 2004 15:32:14 -0000
@@ -1144,8 +1144,6 @@ JMP	FUNCTION	0x0058  0x0000 <- FUNCTION
 {									\
   if (LEVEL >= 3)							\
     {									\
-      if (! SIZE)							\
-        flag_inline_functions		= 1;				\
       flag_omit_frame_pointer		= 1;				\
       /* flag_unroll_loops			= 1; */			\
     }									\
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1327
diff -u -3 -p -r1.1327 decl.c
--- cp/decl.c	12 Nov 2004 21:47:05 -0000	1.1327
+++ cp/decl.c	14 Nov 2004 15:32:15 -0000
@@ -2987,10 +2987,7 @@ cxx_init_decl_processing (void)
       flag_no_inline = 1;
     }
   if (flag_inline_functions)
-    {
-      flag_inline_trees = 2;
-      flag_inline_functions = 0;
-    }
+    flag_inline_trees = 2;
 
   /* Force minimum function alignment if using the least significant
      bit of function pointers to store the virtual bit.  */
Index: fortran/options.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/options.c,v
retrieving revision 1.13
diff -u -3 -p -r1.13 options.c
--- fortran/options.c	31 Oct 2004 01:24:29 -0000	1.13
+++ fortran/options.c	14 Nov 2004 15:32:15 -0000
@@ -109,10 +109,7 @@ gfc_post_options (const char **pfilename
   if (!flag_no_inline)
     flag_no_inline = 1;
   if (flag_inline_functions)
-    {
-      flag_inline_trees = 2;
-      flag_inline_functions = 0;
-    }
+    flag_inline_trees = 2;
 
   /* If -pedantic, warn about the use of GNU extensions.  */
   if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)
Index: java/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.213
diff -u -3 -p -r1.213 class.c
--- java/class.c	2 Nov 2004 16:52:55 -0000	1.213
+++ java/class.c	14 Nov 2004 15:32:15 -0000
@@ -1618,7 +1618,7 @@ make_class_data (tree type)
       tree init;
       if (METHOD_PRIVATE (method)
 	  && ! flag_keep_inline_functions
-	  && (flag_inline_functions || optimize))
+	  && optimize)
 	continue;
       init = make_method_value (method);
       method_count++;
Index: java/lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/lang.c,v
retrieving revision 1.162
diff -u -3 -p -r1.162 lang.c
--- java/lang.c	15 Oct 2004 18:43:10 -0000	1.162
+++ java/lang.c	14 Nov 2004 15:32:15 -0000
@@ -131,10 +131,6 @@ const char *current_encoding = NULL;
 /* When nonzero, print extra version information.  */
 static int v_flag = 0;
 
-/* Set nonzero if the user specified -finline-functions on the command
-   line.  */
-int flag_really_inline = 0;
-
 JCF *current_jcf;
 
 /* Variable controlling how dependency tracking is enabled in
@@ -322,11 +318,6 @@ java_handle_option (size_t scode, const 
       jcf_path_extdirs_arg (arg);
       break;
 
-    case OPT_finline_functions:
-      flag_inline_functions = value;
-      flag_really_inline = value;
-      break;
-
     case OPT_foutput_class_dir_:
       jcf_write_base_directory = arg;
       break;
@@ -355,9 +346,6 @@ java_init (void)
   flag_minimal_debug = 0;
 #endif
 
-  if (flag_inline_functions)
-    flag_inline_trees = 1;
-
   /* FIXME: Indirect dispatch isn't yet compatible with static class
      init optimization.  */
   if (flag_indirect_dispatch)
@@ -603,10 +591,7 @@ java_post_options (const char **pfilenam
   if (!flag_no_inline)
     flag_no_inline = 1;
   if (flag_inline_functions)
-    {
-      flag_inline_trees = 2;
-      flag_inline_functions = 0;
-    }
+    flag_inline_trees = 2;
 
   /* Open input file.  */
 


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