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]

[lto] fortran/f95-lang.c: Use build_function_type_list instead of build_function_type.


Hi,

Tested on x86_64-pc-linux-gnu.  Committed to the LTO branch as
obvious.

Kazu Hirata

2006-08-08  Kazu Hirata  <kazu@codesourcery.com>

	* f95-lang.c (build_builtin_fntypes,
	gfc_init_builtin_functions): Use build_function_type_list
	instead of build_function_type.

Index: fortran/f95-lang.c
===================================================================
*** fortran/f95-lang.c	(revision 116011)
--- fortran/f95-lang.c	(working copy)
*************** gfc_define_builtin (const char * name,
*** 802,819 ****
  static void
  build_builtin_fntypes (tree * fntype, tree type)
  {
-   tree tmp;
- 
    /* type (*) (type) */
!   tmp = tree_cons (NULL_TREE, type, void_list_node);
!   fntype[0] = build_function_type (type, tmp);
    /* type (*) (type, type) */
!   tmp = tree_cons (NULL_TREE, type, tmp);
!   fntype[1] = build_function_type (type, tmp);
!   /* type (*) (int, type) */
!   tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node);
!   tmp = tree_cons (NULL_TREE, type, tmp);
!   fntype[2] = build_function_type (type, tmp);
  }
  
  static tree
--- 802,816 ----
  static void
  build_builtin_fntypes (tree * fntype, tree type)
  {
    /* type (*) (type) */
!   fntype[0] = build_function_type_list (type, type, NULL_TREE);
    /* type (*) (type, type) */
!   fntype[1] = build_function_type_list (type,
! 					type, type, NULL_TREE);
!   /* type (*) (type, int) */
!   fntype[2] = build_function_type_list (type,
! 					type, integer_type_node,
! 					NULL_TREE);
  }
  
  static tree
*************** gfc_init_builtin_functions (void)
*** 873,879 ****
    tree func_cdouble_double;
    tree func_clongdouble_longdouble;
    tree ftype;
-   tree tmp;
    tree builtin_types[(int) BT_LAST + 1];
  
    build_builtin_fntypes (mfunc_float, float_type_node);
--- 870,875 ----
*************** gfc_init_builtin_functions (void)
*** 883,897 ****
    build_builtin_fntypes (mfunc_cdouble, complex_double_type_node);
    build_builtin_fntypes (mfunc_clongdouble, complex_long_double_type_node);
  
!   tmp = tree_cons (NULL_TREE, complex_float_type_node, void_list_node);
!   func_cfloat_float = build_function_type (float_type_node, tmp);
  
!   tmp = tree_cons (NULL_TREE, complex_double_type_node, void_list_node);
!   func_cdouble_double = build_function_type (double_type_node, tmp);
  
-   tmp = tree_cons (NULL_TREE, complex_long_double_type_node, void_list_node);
    func_clongdouble_longdouble =
!     build_function_type (long_double_type_node, tmp);
  
  #include "mathbuiltins.def"
  
--- 879,896 ----
    build_builtin_fntypes (mfunc_cdouble, complex_double_type_node);
    build_builtin_fntypes (mfunc_clongdouble, complex_long_double_type_node);
  
!   func_cfloat_float = build_function_type_list (float_type_node,
! 						complex_float_type_node,
! 						NULL_TREE);
  
!   func_cdouble_double = build_function_type_list (double_type_node,
! 						  complex_double_type_node,
! 						  NULL_TREE);
  
    func_clongdouble_longdouble =
!     build_function_type_list (long_double_type_node,
! 			      complex_long_double_type_node,
! 			      NULL_TREE);
  
  #include "mathbuiltins.def"
  
*************** gfc_init_builtin_functions (void)
*** 935,1065 ****
  
    /* Other builtin functions we use.  */
  
!   tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node);
!   ftype = build_function_type (integer_type_node, tmp);
    gfc_define_builtin ("__builtin_clz", ftype, BUILT_IN_CLZ,
  		      "__builtin_clz", true);
  
!   tmp = tree_cons (NULL_TREE, long_integer_type_node, void_list_node);
!   ftype = build_function_type (integer_type_node, tmp);
    gfc_define_builtin ("__builtin_clzl", ftype, BUILT_IN_CLZL,
  		      "__builtin_clzl", true);
  
!   tmp = tree_cons (NULL_TREE, long_long_integer_type_node, void_list_node);
!   ftype = build_function_type (integer_type_node, tmp);
    gfc_define_builtin ("__builtin_clzll", ftype, BUILT_IN_CLZLL,
  		      "__builtin_clzll", true);
  
!   tmp = tree_cons (NULL_TREE, long_integer_type_node, void_list_node);
!   tmp = tree_cons (NULL_TREE, long_integer_type_node, tmp);
!   ftype = build_function_type (long_integer_type_node, tmp);
    gfc_define_builtin ("__builtin_expect", ftype, BUILT_IN_EXPECT,
  		      "__builtin_expect", true);
  
  #define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \
    builtin_types[(int) ENUM] = VALUE;
! #define DEF_FUNCTION_TYPE_0(ENUM, RETURN)		\
!   builtin_types[(int) ENUM]				\
!     = build_function_type (builtin_types[(int) RETURN],	\
! 			   void_list_node);
! #define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1)				\
!   builtin_types[(int) ENUM]						\
!     = build_function_type (builtin_types[(int) RETURN],			\
! 			   tree_cons (NULL_TREE,			\
! 				      builtin_types[(int) ARG1],	\
! 				      void_list_node));
! #define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2)	\
!   builtin_types[(int) ENUM]				\
!     = build_function_type				\
!       (builtin_types[(int) RETURN],			\
!        tree_cons (NULL_TREE,				\
! 		  builtin_types[(int) ARG1],		\
! 		  tree_cons (NULL_TREE,			\
! 			     builtin_types[(int) ARG2],	\
! 			     void_list_node)));
! #define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3)		 \
!   builtin_types[(int) ENUM]						 \
!     = build_function_type						 \
!       (builtin_types[(int) RETURN],					 \
!        tree_cons (NULL_TREE,						 \
! 		  builtin_types[(int) ARG1],				 \
! 		  tree_cons (NULL_TREE,					 \
! 			     builtin_types[(int) ARG2],			 \
! 			     tree_cons (NULL_TREE,			 \
! 					builtin_types[(int) ARG3],	 \
! 					void_list_node))));
  #define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4)	\
    builtin_types[(int) ENUM]						\
!     = build_function_type						\
!       (builtin_types[(int) RETURN],					\
!        tree_cons (NULL_TREE,						\
! 		  builtin_types[(int) ARG1],				\
! 		  tree_cons (NULL_TREE,					\
! 			     builtin_types[(int) ARG2],			\
! 			     tree_cons					\
! 			     (NULL_TREE,				\
! 			      builtin_types[(int) ARG3],		\
! 			      tree_cons (NULL_TREE,			\
! 					 builtin_types[(int) ARG4],	\
! 					 void_list_node)))));
  #define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5)	\
    builtin_types[(int) ENUM]						\
!     = build_function_type						\
!       (builtin_types[(int) RETURN],					\
!        tree_cons (NULL_TREE,						\
! 		  builtin_types[(int) ARG1],				\
! 		  tree_cons (NULL_TREE,					\
! 			     builtin_types[(int) ARG2],			\
! 			     tree_cons					\
! 			     (NULL_TREE,				\
! 			      builtin_types[(int) ARG3],		\
! 			      tree_cons (NULL_TREE,			\
! 					 builtin_types[(int) ARG4],	\
! 					 tree_cons (NULL_TREE,		\
! 					      builtin_types[(int) ARG5],\
! 					      void_list_node))))));
! #define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
! 			    ARG6)					\
    builtin_types[(int) ENUM]						\
!     = build_function_type						\
!       (builtin_types[(int) RETURN],					\
!        tree_cons (NULL_TREE,						\
! 		  builtin_types[(int) ARG1],				\
! 		  tree_cons (NULL_TREE,					\
! 			     builtin_types[(int) ARG2],			\
! 			     tree_cons					\
! 			     (NULL_TREE,				\
! 			      builtin_types[(int) ARG3],		\
! 			      tree_cons					\
! 			      (NULL_TREE,				\
! 			       builtin_types[(int) ARG4],		\
! 			       tree_cons (NULL_TREE,			\
! 					 builtin_types[(int) ARG5],	\
! 					 tree_cons (NULL_TREE,		\
! 					      builtin_types[(int) ARG6],\
! 					      void_list_node)))))));
! #define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
! 			    ARG6, ARG7)					\
    builtin_types[(int) ENUM]						\
!     = build_function_type						\
!       (builtin_types[(int) RETURN],					\
!        tree_cons (NULL_TREE,						\
! 		  builtin_types[(int) ARG1],				\
! 		  tree_cons (NULL_TREE,					\
! 			     builtin_types[(int) ARG2],			\
! 			     tree_cons					\
! 			     (NULL_TREE,				\
! 			      builtin_types[(int) ARG3],		\
! 			      tree_cons					\
! 			      (NULL_TREE,				\
! 			       builtin_types[(int) ARG4],		\
! 			       tree_cons (NULL_TREE,			\
! 					 builtin_types[(int) ARG5],	\
! 					 tree_cons (NULL_TREE,		\
! 					      builtin_types[(int) ARG6],\
! 					 tree_cons (NULL_TREE,		\
! 					      builtin_types[(int) ARG6], \
! 					      void_list_node))))))));
  #define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN)				\
    builtin_types[(int) ENUM]						\
      = build_function_type (builtin_types[(int) RETURN], NULL_TREE);
--- 934,1024 ----
  
    /* Other builtin functions we use.  */
  
!   ftype = build_function_type_list (integer_type_node,
! 				    integer_type_node, NULL_TREE);
    gfc_define_builtin ("__builtin_clz", ftype, BUILT_IN_CLZ,
  		      "__builtin_clz", true);
  
!   ftype = build_function_type_list (integer_type_node,
! 				    long_integer_type_node, NULL_TREE);
    gfc_define_builtin ("__builtin_clzl", ftype, BUILT_IN_CLZL,
  		      "__builtin_clzl", true);
  
!   ftype = build_function_type_list (integer_type_node,
! 				    long_long_integer_type_node, NULL_TREE);
    gfc_define_builtin ("__builtin_clzll", ftype, BUILT_IN_CLZLL,
  		      "__builtin_clzll", true);
  
!   ftype = build_function_type_list (long_integer_type_node,
! 				    long_integer_type_node,
! 				    long_integer_type_node, NULL_TREE);
    gfc_define_builtin ("__builtin_expect", ftype, BUILT_IN_EXPECT,
  		      "__builtin_expect", true);
  
  #define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \
    builtin_types[(int) ENUM] = VALUE;
! #define DEF_FUNCTION_TYPE_0(ENUM, RETURN)			\
!   builtin_types[(int) ENUM]					\
!     = build_function_type_list (builtin_types[(int) RETURN],	\
! 				NULL_TREE);
! #define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1)			\
!   builtin_types[(int) ENUM]					\
!     = build_function_type_list (builtin_types[(int) RETURN],	\
! 				builtin_types[(int) ARG1],	\
! 				NULL_TREE);
! #define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2)		\
!   builtin_types[(int) ENUM]					\
!     = build_function_type_list (builtin_types[(int) RETURN],	\
! 				builtin_types[(int) ARG1],	\
! 				builtin_types[(int) ARG2],	\
! 				NULL_TREE);
! #define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3)	\
!   builtin_types[(int) ENUM]					\
!     = build_function_type_list (builtin_types[(int) RETURN],	\
! 				builtin_types[(int) ARG1],	\
! 				builtin_types[(int) ARG2],	\
! 				builtin_types[(int) ARG3],	\
! 				NULL_TREE);
  #define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4)	\
    builtin_types[(int) ENUM]						\
!     = build_function_type_list (builtin_types[(int) RETURN],		\
! 				builtin_types[(int) ARG1],		\
! 				builtin_types[(int) ARG2],		\
! 				builtin_types[(int) ARG3],		\
! 				builtin_types[(int) ARG4],		\
! 				NULL_TREE);
  #define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5)	\
    builtin_types[(int) ENUM]						\
!     = build_function_type_list (builtin_types[(int) RETURN],		\
! 				builtin_types[(int) ARG1],		\
! 				builtin_types[(int) ARG2],		\
! 				builtin_types[(int) ARG3],		\
! 				builtin_types[(int) ARG4],		\
! 				builtin_types[(int) ARG5],		\
! 				NULL_TREE);
! #define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4,	\
! 			    ARG5, ARG6)					\
    builtin_types[(int) ENUM]						\
!     = build_function_type_list (builtin_types[(int) RETURN],		\
! 				builtin_types[(int) ARG1],		\
! 				builtin_types[(int) ARG2],		\
! 				builtin_types[(int) ARG3],		\
! 				builtin_types[(int) ARG4],		\
! 				builtin_types[(int) ARG5],		\
! 				builtin_types[(int) ARG6],		\
! 				NULL_TREE);
! #define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4,	\
! 			    ARG5, ARG6, ARG7)				\
    builtin_types[(int) ENUM]						\
!     = build_function_type_list (builtin_types[(int) RETURN],		\
! 				builtin_types[(int) ARG1],		\
! 				builtin_types[(int) ARG2],		\
! 				builtin_types[(int) ARG3],		\
! 				builtin_types[(int) ARG4],		\
! 				builtin_types[(int) ARG5],		\
! 				builtin_types[(int) ARG6],		\
! 				builtin_types[(int) ARG7],		\
! 				NULL_TREE);
  #define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN)				\
    builtin_types[(int) ENUM]						\
      = build_function_type (builtin_types[(int) RETURN], NULL_TREE);


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