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] Use void_list_node more in Fortran FE, don't make MAIN__ call varargs


Hi!

As discussed in the PR, this patch just makes MAIN__ call non-varargs (for
other calls more work is needed) and slightly optimizes by sharing
void_list_node by more function types.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2010-08-17  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/45304
	* trans-decl.c (build_library_function_decl_1): Chain on
	void_list_node instead of creating a new TREE_LIST.
	* trans-intrinsic.c (gfc_get_intrinsic_lib_fndecl): Likewise.
	* trans-types.c (gfc_get_function_type): Likewise.  Set
	typelist to void_list_node for the main program.

--- gcc/fortran/trans-decl.c.jj	2010-08-16 19:24:22.000000000 +0200
+++ gcc/fortran/trans-decl.c	2010-08-17 10:32:38.000000000 +0200
@@ -2353,7 +2353,7 @@ build_library_function_decl_1 (tree name
   if (nargs >= 0)
     {
       /* Terminate the list.  */
-      arglist = gfc_chainon_list (arglist, void_type_node);
+      arglist = chainon (arglist, void_list_node);
     }
 
   /* Build the function type and decl.  */
--- gcc/fortran/trans-intrinsic.c.jj	2010-08-11 21:08:00.000000000 +0200
+++ gcc/fortran/trans-intrinsic.c	2010-08-17 10:33:24.000000000 +0200
@@ -684,7 +684,7 @@ gfc_get_intrinsic_lib_fndecl (gfc_intrin
       type = gfc_typenode_for_spec (&actual->expr->ts);
       argtypes = gfc_chainon_list (argtypes, type);
     }
-  argtypes = gfc_chainon_list (argtypes, void_type_node);
+  argtypes = chainon (argtypes, void_list_node);
   type = build_function_type (gfc_typenode_for_spec (ts), argtypes);
   fndecl = build_decl (input_location,
 		       FUNCTION_DECL, get_identifier (name), type);
--- gcc/fortran/trans-types.c.jj	2010-07-29 17:16:10.000000000 +0200
+++ gcc/fortran/trans-types.c	2010-08-17 10:35:24.000000000 +0200
@@ -2356,7 +2356,9 @@ gfc_get_function_type (gfc_symbol * sym)
     typelist = gfc_chainon_list (typelist, gfc_charlen_type_node);
 
   if (typelist)
-    typelist = gfc_chainon_list (typelist, void_type_node);
+    typelist = chainon (typelist, void_list_node);
+  else if (sym->attr.is_main_program)
+    typelist = void_list_node;
 
   if (alternate_return)
     type = integer_type_node;

	Jakub


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