INTEGRATE_THRESHOLD patch

Marc Lehmann pcg@goof.com
Mon Feb 2 11:43:00 GMT 1998


Here's the revised version, doing it in the architecture independent part.

Now we can argue about the 1 + 1.5 * nargs formula ;)

1998-02-02  Marc Lehmann  <pcg@goof.com>

	* integrate.c (INTEGRATE_THRESHOLD): Inline only small functions
	when -Os is specified.
	* toplev.c (main): Don't disable flag_inline_functions anymore when
	-Os is in effect.
	
Index: egcs/gcc/integrate.c
===================================================================
RCS file: /home/cvsroot/egcs/gcc/integrate.c,v
retrieving revision 1.1.1.9
diff -u -p -u -p -r1.1.1.9 integrate.c
--- integrate.c	1998/01/23 21:43:57	1.1.1.9
+++ integrate.c	1998/02/02 04:01:29
@@ -52,8 +52,12 @@ extern tree poplevel ();
 /* Default max number of insns a function can have and still be inline.
    This is overridden on RISC machines.  */
 #ifndef INTEGRATE_THRESHOLD
+/* Inlining small functions might save more space then not inlining at
+   all.  Assume 1 instruction for the call and 1.5 insns per argument.  */
 #define INTEGRATE_THRESHOLD(DECL) \
-  (8 * (8 + list_length (DECL_ARGUMENTS (DECL))))
+  (optimize_size \
+   ? (1 + (3 * list_length (DECL_ARGUMENTS (DECL)) / 2)) \
+   : (8 * (8 + list_length (DECL_ARGUMENTS (DECL)))))
 #endif
 
 static rtx initialize_for_inline PROTO((tree, int, int, int, int));
Index: egcs/gcc/toplev.c
===================================================================
RCS file: /home/cvsroot/egcs/gcc/toplev.c,v
retrieving revision 1.1.1.13
diff -u -p -u -p -r1.1.1.13 toplev.c
--- toplev.c	1998/01/30 21:56:19	1.1.1.13
+++ toplev.c	1998/02/02 03:57:15
@@ -3797,12 +3797,6 @@ main (argc, argv, envp)
       flag_inline_functions = 1;
     }
 
-  /* Disable code bloating optimizations if optimizing for size. */
-  if (optimize_size)
-    {
-      flag_inline_functions = 0;
-    }
-
   /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
      modify it.  */
   target_flags = 0;
	



More information about the Gcc mailing list