This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] Fix inlining
- From: Paul Brook <paul at nowt dot org>
- To: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Sun, 30 Nov 2003 13:43:07 +0000
- Subject: [gfortran] Fix inlining
Patch below sets the tree inlining flags in the same way as the C frontend.
I haven't checked if inlining actually works, but it doesn't seem to break
anything.
Tested on i686-linux.
Applied to tree-ssa branch.
Paul
2003-11-30 Paul Brook <paul@nowt.org>
* f95-lang.c (gfc_post_options): Move ...
* options.c (gfc_post_options): .. to here. Handle inlining options.
* gfortran.h (gfc_post_options): Add prototype.
diff -urpxCVS clean/tree-ssa/gcc/fortran/f95-lang.c new-gcc/gcc/fortran/
f95-lang.c
--- clean/tree-ssa/gcc/fortran/f95-lang.c
+++ new-gcc/gcc/fortran/f95-lang.c
@@ -326,24 +326,6 @@ gfc_init (void)
}
-/* Finalize commandline options. */
-
-static bool
-gfc_post_options (const char **pfilename)
-{
- const char *filename = *pfilename;
-
- /* Verify the input file name. */
- if (!filename || strcmp (filename, "-") == 0)
- {
- filename = "";
- }
-
- gfc_option.source = filename;
-
- return false;
-}
-
static void
gfc_finish (void)
{
diff -urpxCVS clean/tree-ssa/gcc/fortran/gfortran.h new-gcc/gcc/fortran/
gfortran.h
--- clean/tree-ssa/gcc/fortran/gfortran.h
+++ new-gcc/gcc/fortran/gfortran.h
@@ -1333,6 +1333,7 @@ void gfc_done_2 (void);
/* options.c */
unsigned int gfc_init_options (unsigned int, const char **);
int gfc_handle_option (size_t, const char *, int);
+bool gfc_post_options (const char **);
/* iresolve.c */
char * gfc_get_string (const char *, ...) ATTRIBUTE_PRINTF_1;
diff -urpxCVS clean/tree-ssa/gcc/fortran/options.c new-gcc/gcc/fortran/
options.c
--- clean/tree-ssa/gcc/fortran/options.c
+++ new-gcc/gcc/fortran/options.c
@@ -30,6 +30,7 @@ Boston, MA 02111-1307, USA. */
#include "intl.h"
#include "opts.h"
#include "options.h"
+#include "tree-inline.h"
#include "gfortran.h"
@@ -76,6 +77,40 @@ gfc_init_options (unsigned int argc ATTR
}
+/* Finalize commandline options. */
+
+bool
+gfc_post_options (const char **pfilename)
+{
+ const char *filename = *pfilename;
+
+ /* Verify the input file name. */
+ if (!filename || strcmp (filename, "-") == 0)
+ {
+ filename = "";
+ }
+
+ gfc_option.source = filename;
+
+ flag_inline_trees = 1;
+
+ /* Use tree inlining if possible. Function instrumentation is only
+ done in the RTL level, so we disable tree inlining. */
+ if (! flag_instrument_function_entry_exit)
+ {
+ if (!flag_no_inline)
+ flag_no_inline = 1;
+ if (flag_inline_functions)
+ {
+ flag_inline_trees = 2;
+ flag_inline_functions = 0;
+ }
+ }
+
+ return false;
+}
+
+
/* Set the options for -Wall. */
static void