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] tree-mudflap.c: Use build_function_type_list.


Hi,

Attached is a patch to use build_function_type_list.

tree-mudflap.c uses constructs like

  build_function_type (rtype, tree_cons (0, arg1, void_list_node))

These days, we have a convenient function build_function_type_list,
which can do all of the above in one shot like so:

  build_function_type_list (rtype, arg1, 0)

The patch implements this idea and remove the now unused macros.  Note
that we want to stop using TREE_LIST in TYPE_ARG_TYPES on the LTO
branch.  This patch effectively hides the implementation details of
TYPE_ARG_TYPES under build_function_type_list.

Tested on x86_64-pc-linux-gnu.  OK to apply to the LTO branch?

p.s.
Frank, we'd like to be able to merge the LTO branch to mainline
without approvals for individual patches when the LTO branch is
complete.  So, if you could review this patch as if you were reviewing
it for mainline, that would be greatly appreciated.

Kazu Hirata

2006-06-10  Kazu Hirata  <kazu@codesourcery.com>

	* tree-mudflap.c (build_function_type_0,
	build_function_type_1, build_function_type_3,
	build_function_type_4): Remove.
	(mudflap_init): Use build_function_type_list.

Index: tree-mudflap.c
===================================================================
--- tree-mudflap.c	(revision 114506)
+++ tree-mudflap.c	(working copy)
@@ -327,18 +327,6 @@ mf_make_mf_cache_struct_type (tree field
   return struct_type;
 }
 
-#define build_function_type_0(rtype)            \
-  build_function_type (rtype, void_list_node)
-#define build_function_type_1(rtype, arg1)                 \
-  build_function_type (rtype, tree_cons (0, arg1, void_list_node))
-#define build_function_type_3(rtype, arg1, arg2, arg3)                  \
-  build_function_type (rtype, tree_cons (0, arg1, tree_cons (0, arg2,   \
-                                                             tree_cons (0, arg3, void_list_node))))
-#define build_function_type_4(rtype, arg1, arg2, arg3, arg4)            \
-  build_function_type (rtype, tree_cons (0, arg1, tree_cons (0, arg2,   \
-                                                             tree_cons (0, arg3, tree_cons (0, arg4, \
-                                                                                            void_list_node)))))
-
 /* Initialize the global tree nodes that correspond to mf-runtime.h
    declarations.  */
 void
@@ -366,15 +354,15 @@ mudflap_init (void)
   mf_cache_structptr_type = build_pointer_type (mf_cache_struct_type);
   mf_cache_array_type = build_array_type (mf_cache_struct_type, 0);
   mf_check_register_fntype =
-    build_function_type_4 (void_type_node, ptr_type_node, size_type_node,
-                           integer_type_node, mf_const_string_type);
+    build_function_type_list (void_type_node, ptr_type_node, size_type_node,
+			      integer_type_node, mf_const_string_type, 0);
   mf_unregister_fntype =
-    build_function_type_3 (void_type_node, ptr_type_node, size_type_node,
-                           integer_type_node);
+    build_function_type_list (void_type_node, ptr_type_node, size_type_node,
+			      integer_type_node, 0);
   mf_init_fntype =
-    build_function_type_0 (void_type_node);
+    build_function_type_list (void_type_node, 0);
   mf_set_options_fntype =
-    build_function_type_1 (integer_type_node, mf_const_string_type);
+    build_function_type_list (integer_type_node, mf_const_string_type, 0);
 
   mf_cache_array_decl = mf_make_builtin (VAR_DECL, "__mf_lookup_cache",
                                          mf_cache_array_type);
@@ -398,10 +386,6 @@ mudflap_init (void)
   mf_set_options_fndecl = mf_make_builtin (FUNCTION_DECL, "__mf_set_options",
                                            mf_set_options_fntype);
 }
-#undef build_function_type_4
-#undef build_function_type_3
-#undef build_function_type_1
-#undef build_function_type_0
 
 
 /* ------------------------------------------------------------------------ */


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