From patchwork Fri Jul 16 03:22:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 59064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 7AF70B6EF0 for ; Fri, 16 Jul 2010 13:22:35 +1000 (EST) Received: (qmail 19008 invoked by alias); 16 Jul 2010 03:22:33 -0000 Received: (qmail 18997 invoked by uid 22791); 16 Jul 2010 03:22:32 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Jul 2010 03:22:26 +0000 Received: (qmail 29146 invoked from network); 16 Jul 2010 03:22:24 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 16 Jul 2010 03:22:24 -0000 Date: Thu, 15 Jul 2010 20:22:24 -0700 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Subject: [PATCH] make the middle-end use build_function_type_list Message-ID: <20100716032222.GA12333@codesourcery.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch is actually a patch of Kazu's from the oldlto branch; I've just brought it forward to mainline and whatnot. Tested on x86_64-unknown-linux-gnu. OK to commit? -Nathan * tree.c (build_common_builtin_nodes): Use build_function_type_list instead of build_function_type. * tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Likewise. * cgraphunit.c (cgraph_build_static_cdtor): Likewise. Index: tree.c =================================================================== --- tree.c (revision 162241) +++ tree.c (working copy) @@ -9149,15 +9149,14 @@ local_define_builtin (const char *name, void build_common_builtin_nodes (void) { - tree tmp, tmp2, ftype; + tree tmp, ftype; if (built_in_decls[BUILT_IN_MEMCPY] == NULL || built_in_decls[BUILT_IN_MEMMOVE] == NULL) { - tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, const_ptr_type_node, tmp); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - ftype = build_function_type (ptr_type_node, tmp); + ftype = build_function_type_list (ptr_type_node, + ptr_type_node, const_ptr_type_node, + size_type_node, NULL_TREE); if (built_in_decls[BUILT_IN_MEMCPY] == NULL) local_define_builtin ("__builtin_memcpy", ftype, BUILT_IN_MEMCPY, @@ -9169,28 +9168,26 @@ build_common_builtin_nodes (void) if (built_in_decls[BUILT_IN_MEMCMP] == NULL) { - tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, const_ptr_type_node, tmp); - tmp = tree_cons (NULL_TREE, const_ptr_type_node, tmp); - ftype = build_function_type (integer_type_node, tmp); + ftype = build_function_type_list (integer_type_node, const_ptr_type_node, + const_ptr_type_node, size_type_node, + NULL_TREE); local_define_builtin ("__builtin_memcmp", ftype, BUILT_IN_MEMCMP, "memcmp", ECF_PURE | ECF_NOTHROW); } if (built_in_decls[BUILT_IN_MEMSET] == NULL) { - tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, integer_type_node, tmp); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - ftype = build_function_type (ptr_type_node, tmp); + ftype = build_function_type_list (ptr_type_node, + ptr_type_node, integer_type_node, + size_type_node, NULL_TREE); local_define_builtin ("__builtin_memset", ftype, BUILT_IN_MEMSET, "memset", ECF_NOTHROW); } if (built_in_decls[BUILT_IN_ALLOCA] == NULL) { - tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); - ftype = build_function_type (ptr_type_node, tmp); + ftype = build_function_type_list (ptr_type_node, + size_type_node, NULL_TREE); local_define_builtin ("__builtin_alloca", ftype, BUILT_IN_ALLOCA, "alloca", ECF_MALLOC | ECF_NOTHROW); } @@ -9199,60 +9196,53 @@ build_common_builtin_nodes (void) if (flag_stack_check) TREE_NOTHROW (built_in_decls[BUILT_IN_ALLOCA]) = 0; - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, + ptr_type_node, ptr_type_node, + ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_init_trampoline", ftype, BUILT_IN_INIT_TRAMPOLINE, "__builtin_init_trampoline", ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (ptr_type_node, tmp); + ftype = build_function_type_list (ptr_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_adjust_trampoline", ftype, BUILT_IN_ADJUST_TRAMPOLINE, "__builtin_adjust_trampoline", ECF_CONST | ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, + ptr_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_nonlocal_goto", ftype, BUILT_IN_NONLOCAL_GOTO, "__builtin_nonlocal_goto", ECF_NORETURN | ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, + ptr_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_setjmp_setup", ftype, BUILT_IN_SETJMP_SETUP, "__builtin_setjmp_setup", ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (ptr_type_node, tmp); + ftype = build_function_type_list (ptr_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_setjmp_dispatcher", ftype, BUILT_IN_SETJMP_DISPATCHER, "__builtin_setjmp_dispatcher", ECF_PURE | ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_setjmp_receiver", ftype, BUILT_IN_SETJMP_RECEIVER, "__builtin_setjmp_receiver", ECF_NOTHROW); - ftype = build_function_type (ptr_type_node, void_list_node); + ftype = build_function_type_list (ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_stack_save", ftype, BUILT_IN_STACK_SAVE, "__builtin_stack_save", ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_stack_restore", ftype, BUILT_IN_STACK_RESTORE, "__builtin_stack_restore", ECF_NOTHROW); - ftype = build_function_type (void_type_node, void_list_node); + ftype = build_function_type_list (void_type_node, NULL_TREE); local_define_builtin ("__builtin_profile_func_enter", ftype, BUILT_IN_PROFILE_FUNC_ENTER, "profile_func_enter", 0); local_define_builtin ("__builtin_profile_func_exit", ftype, @@ -9262,14 +9252,13 @@ build_common_builtin_nodes (void) alternate __cxa_end_cleanup node used to resume from C++ and Java. */ if (targetm.arm_eabi_unwinder) { - ftype = build_function_type (void_type_node, void_list_node); + ftype = build_function_type_list (void_type_node, NULL_TREE); local_define_builtin ("__builtin_cxa_end_cleanup", ftype, BUILT_IN_CXA_END_CLEANUP, "__cxa_end_cleanup", ECF_NORETURN); } - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_unwind_resume", ftype, BUILT_IN_UNWIND_RESUME, (USING_SJLJ_EXCEPTIONS @@ -9282,19 +9271,19 @@ build_common_builtin_nodes (void) landing pad. These functions are PURE instead of CONST to prevent them from being hoisted past the exception edge that will initialize its value in the landing pad. */ - tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node); - ftype = build_function_type (ptr_type_node, tmp); + ftype = build_function_type_list (ptr_type_node, + integer_type_node, NULL_TREE); local_define_builtin ("__builtin_eh_pointer", ftype, BUILT_IN_EH_POINTER, "__builtin_eh_pointer", ECF_PURE | ECF_NOTHROW); - tmp2 = lang_hooks.types.type_for_mode (targetm.eh_return_filter_mode (), 0); - ftype = build_function_type (tmp2, tmp); + tmp = lang_hooks.types.type_for_mode (targetm.eh_return_filter_mode (), 0); + ftype = build_function_type_list (tmp, integer_type_node, NULL_TREE); local_define_builtin ("__builtin_eh_filter", ftype, BUILT_IN_EH_FILTER, "__builtin_eh_filter", ECF_PURE | ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, integer_type_node, tmp); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, + integer_type_node, integer_type_node, + NULL_TREE); local_define_builtin ("__builtin_eh_copy_values", ftype, BUILT_IN_EH_COPY_VALUES, "__builtin_eh_copy_values", ECF_NOTHROW); @@ -9318,11 +9307,8 @@ build_common_builtin_nodes (void) continue; inner_type = TREE_TYPE (type); - tmp = tree_cons (NULL_TREE, inner_type, void_list_node); - tmp = tree_cons (NULL_TREE, inner_type, tmp); - tmp = tree_cons (NULL_TREE, inner_type, tmp); - tmp = tree_cons (NULL_TREE, inner_type, tmp); - ftype = build_function_type (type, tmp); + ftype = build_function_type_list (type, inner_type, inner_type, + inner_type, inner_type, NULL_TREE); mcode = ((enum built_in_function) (BUILT_IN_COMPLEX_MUL_MIN + mode - MIN_MODE_COMPLEX_FLOAT)); Index: cgraphunit.c =================================================================== --- cgraphunit.c (revision 162241) +++ cgraphunit.c (working copy) @@ -2017,7 +2017,7 @@ cgraph_build_static_cdtor (char which, t name = get_file_function_name (which_buf); decl = build_decl (input_location, FUNCTION_DECL, name, - build_function_type (void_type_node, void_list_node)); + build_function_type_list (void_type_node, NULL_TREE)); current_function_decl = decl; resdecl = build_decl (input_location, Index: tree-ssa-loop-prefetch.c =================================================================== --- tree-ssa-loop-prefetch.c (revision 162241) +++ tree-ssa-loop-prefetch.c (working copy) @@ -1903,10 +1903,8 @@ tree_ssa_prefetch_arrays (void) if (!built_in_decls[BUILT_IN_PREFETCH]) { - tree type = build_function_type (void_type_node, - tree_cons (NULL_TREE, - const_ptr_type_node, - NULL_TREE)); + tree type = build_function_type_list (void_type_node, + const_ptr_type_node, NULL_TREE); tree decl = add_builtin_function ("__builtin_prefetch", type, BUILT_IN_PREFETCH, BUILT_IN_NORMAL, NULL, NULL_TREE);