From patchwork Sun Mar 25 23:27:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 148608 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 8E322B6EE7 for ; Mon, 26 Mar 2012 10:27:33 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1333322854; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:Date:Message-ID:Subject:From:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=zujCZIZ 152bAmqpq/4fPpY42rQw=; b=mGkR2j8fcinoX/Az7RG3pyXXCHfViVeohTATwZz syq3VrOKNLdp1lOu7g7yCHfvPrZDqn/wK2JE+ijbgVM0uZYIj570Dpef+MuC8Qzc 1ksB4iSrzYkIngnlJf1EE0q/qLDoMirrE+IDHt81ex81EXc+HxFsUPOO28XOvkk/ y+cM= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:Date:Message-ID:Subject:From:To:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=VL3NpK/WuLULxBnt5H3Ip9+k+ksF4lJCjySnPACJLYBgjiwExq6IjN9OPMWM49 HTLfi6SvYioQ6awqG6MUdJy23c7UMq3TIbFPhvV4vxWYTldF0y9w5c1Fp2rySU7/ tw73G+O4yP18bgOncO2U5IzzUYjijm0SWwpeELw0UkSTs=; Received: (qmail 18064 invoked by alias); 25 Mar 2012 23:27:29 -0000 Received: (qmail 18055 invoked by uid 22791); 25 Mar 2012 23:27:28 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_FN X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 25 Mar 2012 23:27:09 +0000 Received: by ghbz2 with SMTP id z2so3706888ghb.20 for ; Sun, 25 Mar 2012 16:27:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.200.197 with SMTP id z45mr19767977yhn.99.1332718028514; Sun, 25 Mar 2012 16:27:08 -0700 (PDT) Received: by 10.100.146.5 with HTTP; Sun, 25 Mar 2012 16:27:08 -0700 (PDT) Date: Mon, 26 Mar 2012 01:27:08 +0200 Message-ID: Subject: [patch] Call assemble_external only from final.c and from MI-thunk hooks From: Steven Bosscher To: GCC Patches , Jeff Law 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 Hello, This patch removes all calls to assemble_external from places other than final.c and MI-thunk generators. This is step 2 toward addressing PR17982 on the trunk for GCC 4.8. The next, and final, step will be to change pending_assemble_externals to pending_assemble_visibility, and fold assemble_external_real() back into assemble_external. Bootstrapped & tested all default languages on x86_64-unknown-linux-gnu and on powerpc64-unknown-linux-gnu. Also cross-built c and c++ to mips-elf and tested on mips-sim (mips-elf was the only target I could find that really emits something for its ASM_OUTPUT_EXTERNAL target macro and has a sim in gdb. I hard-coded mips_output_external, by replacing "if (!TARGET_EXPLICIT_RELOCS && ..." with "if (1 && ..."). OK for trunk? Ciao! Steven * toplev.c (check_global_declaration_1): Do not call assemble_external. * expr.c (emit_block_move_libcall_fn): Likewise. (clear_storage_libcall_fn): Likewise. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * calls.c (rtx_for_function_call): Likewise. * toplev.c (check_global_declaration_1): Do not call assemble_external. * expr.c (emit_block_move_libcall_fn): Likewise. (clear_storage_libcall_fn): Likewise. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * calls.c (rtx_for_function_call): Likewise. Index: toplev.c =================================================================== --- toplev.c (revision 185768) +++ toplev.c (working copy) @@ -486,7 +486,6 @@ check_global_declaration_1 (tree decl) warning (OPT_Wunused_function, "%q+F declared % but never defined", decl); /* This symbol is effectively an "extern" declaration now. */ TREE_PUBLIC (decl) = 1; - assemble_external (decl); } /* Warn about static fns or vars defined but not used. */ @@ -591,7 +590,7 @@ compile_file (void) output_shared_constant_pool (); output_object_blocks (); - finish_tm_clone_pairs (); + finish_tm_clone_pairs (); /* Write out any pending weak symbol declarations. */ weak_finish (); Index: expr.c =================================================================== --- expr.c (revision 185768) +++ expr.c (working copy) @@ -1375,8 +1375,7 @@ emit_block_move_via_libcall (rtx dst, rtx src, rtx } /* A subroutine of emit_block_move_via_libcall. Create the tree node - for the function we use for block copies. The first time FOR_CALL - is true, we call assemble_external. */ + for the function we use for block copies. */ static GTY(()) tree block_move_fn; @@ -1419,7 +1418,6 @@ emit_block_move_libcall_fn (int for_call) { emitted_extern = true; make_decl_rtl (block_move_fn); - assemble_external (block_move_fn); } return block_move_fn; @@ -2747,8 +2745,7 @@ set_storage_via_libcall (rtx object, rtx size, rtx } /* A subroutine of set_storage_via_libcall. Create the tree node - for the function we use for block clears. The first time FOR_CALL - is true, we call assemble_external. */ + for the function we use for block clears. */ tree block_clear_fn; @@ -2791,7 +2788,6 @@ clear_storage_libcall_fn (int for_call) { emitted_extern = true; make_decl_rtl (block_clear_fn); - assemble_external (block_clear_fn); } return block_clear_fn; @@ -7413,11 +7409,8 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enu result = XEXP (result, 0); /* ??? Is this needed anymore? */ - if (DECL_P (exp) && !TREE_USED (exp) == 0) - { - assemble_external (exp); - TREE_USED (exp) = 1; - } + if (DECL_P (exp)) + TREE_USED (exp) = 1; if (modifier != EXPAND_INITIALIZER && modifier != EXPAND_CONST_ADDRESS @@ -9012,11 +9005,7 @@ expand_expr_real_1 (tree exp, rtx target, enum mac /* Ensure variable marked as used even if it doesn't go through a parser. If it hasn't be used yet, write out an external definition. */ - if (! TREE_USED (exp)) - { - assemble_external (exp); - TREE_USED (exp) = 1; - } + TREE_USED (exp) = 1; /* Show we haven't gotten RTL for this yet. */ temp = 0; Index: calls.c =================================================================== --- calls.c (revision 185768) +++ calls.c (working copy) @@ -1642,13 +1642,8 @@ rtx_for_function_call (tree fndecl, tree addr) /* Get the function to call, in the form of RTL. */ if (fndecl) { - /* If this is the first use of the function, see if we need to - make an external definition for it. */ if (!TREE_USED (fndecl) && fndecl != current_function_decl) - { - assemble_external (fndecl); - TREE_USED (fndecl) = 1; - } + TREE_USED (fndecl) = 1; /* Get a SYMBOL_REF rtx for the function address. */ funexp = XEXP (DECL_RTL (fndecl), 0);