From patchwork Sun Aug 3 14:08:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 376032 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 877451400AA for ; Mon, 4 Aug 2014 00:08:46 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=YC2CO4egu/DF8w0xPxsb9OGqLS0sn BQpZjWhSwOnHsHUkJu9cJPd0F43oJ1GCHvA/V/IMCKe2KHj+Pt4aKOvY9fFAnEPN mwzAsPGiVeoqscArptS6k8wW5csfXLDzLSiGhRJ+8CtlhueShPzGujI3CxDP4U2R IJbgdqfhOyO4VM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=7oSFmchzuGPDcTcveaWYoStyklA=; b=Zo7 sOKEAo7CG7XpS/GuzGfwgx41QMJMBXrkGI5slsrWLXb3qXGIKiYQv+gX1t9SPrSE vfrBSPBUc25bONRUhQD/3Ld1d0nGvoxqO8LHA9aM3recRGBr/NXeDzpG/Lp2ew2z ik+mn6CtEES8USKTog2tYJTUAxpzKGaM05YGO4MU= Received: (qmail 8375 invoked by alias); 3 Aug 2014 14:08:40 -0000 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 Received: (qmail 8366 invoked by uid 89); 3 Aug 2014 14:08:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-wi0-f179.google.com Received: from mail-wi0-f179.google.com (HELO mail-wi0-f179.google.com) (209.85.212.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 03 Aug 2014 14:08:38 +0000 Received: by mail-wi0-f179.google.com with SMTP id f8so3644713wiw.0 for ; Sun, 03 Aug 2014 07:08:35 -0700 (PDT) X-Received: by 10.180.212.77 with SMTP id ni13mr22163121wic.42.1407074915907; Sun, 03 Aug 2014 07:08:35 -0700 (PDT) Received: from localhost ([95.145.138.172]) by mx.google.com with ESMTPSA id k6sm36106598wjq.5.2014.08.03.07.08.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Aug 2014 07:08:35 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [PATCH 22/50] final.c:mark_symbol_refs_as_used References: <87y4v5d77q.fsf@googlemail.com> Date: Sun, 03 Aug 2014 15:08:35 +0100 In-Reply-To: <87y4v5d77q.fsf@googlemail.com> (Richard Sandiford's message of "Sun, 03 Aug 2014 14:38:01 +0100") Message-ID: <87bns1acnw.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 gcc/ * final.c: Include rtl-iter.h. (mark_symbol_ref_as_used): Delete. (mark_symbol_refs_as_used): Use FOR_EACH_SUBRTX instead of for_each_rtx. Index: gcc/final.c =================================================================== --- gcc/final.c 2014-08-03 11:25:10.029955339 +0100 +++ gcc/final.c 2014-08-03 11:25:26.329116482 +0100 @@ -81,6 +81,7 @@ Software Foundation; either version 3, o #include "tree-pretty-print.h" /* for dump_function_header */ #include "asan.h" #include "wide-int-print.h" +#include "rtl-iter.h" #ifdef XCOFF_DEBUGGING_INFO #include "xcoffout.h" /* Needed for external data @@ -3774,38 +3775,19 @@ output_asm_label (rtx x) assemble_name (asm_out_file, buf); } -/* Helper rtx-iteration-function for mark_symbol_refs_as_used and - output_operand. Marks SYMBOL_REFs as referenced through use of - assemble_external. */ - -static int -mark_symbol_ref_as_used (rtx *xp, void *dummy ATTRIBUTE_UNUSED) -{ - rtx x = *xp; - - /* If we have a used symbol, we may have to emit assembly - annotations corresponding to whether the symbol is external, weak - or has non-default visibility. */ - if (GET_CODE (x) == SYMBOL_REF) - { - tree t; - - t = SYMBOL_REF_DECL (x); - if (t) - assemble_external (t); - - return -1; - } - - return 0; -} - /* Marks SYMBOL_REFs in x as referenced through use of assemble_external. */ void mark_symbol_refs_as_used (rtx x) { - for_each_rtx (&x, mark_symbol_ref_as_used, NULL); + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, x, ALL) + { + const_rtx x = *iter; + if (GET_CODE (x) == SYMBOL_REF) + if (tree t = SYMBOL_REF_DECL (x)) + assemble_external (t); + } } /* Print operand X using machine-dependent assembler syntax. @@ -3831,7 +3813,7 @@ output_operand (rtx x, int code ATTRIBUT if (x == NULL_RTX) return; - for_each_rtx (&x, mark_symbol_ref_as_used, NULL); + mark_symbol_refs_as_used (x); } /* Print a memory reference operand for address X using