From patchwork Sun Aug 3 14:43:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 376060 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 329661400AA for ; Mon, 4 Aug 2014 00:43:36 +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=J4u71f1JuD0anuZxNsc+aUl6zRAVA 9g1EI8oHa0A7hlpoGsZAyIONSHTrVcuBPvfmYg6ie0JC09lid1tFaIZoXEjewc3D w+F7XJF7L34ZSOvbCBcG8+yW8DagmZQsM4LN4U7aegcYczn9VVyCdPHF3jFeq5B7 dgiwETPjLUnubc= 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=3nl/qofw/vwCUkb6Ea0a8DCSjxg=; b=q1x NYhReyBOZinJK8ICiDs2DzE0HmYak3+VSofWr//jFgfi26ybtc72Fsqj5p122f9m yRzBOBxDyBIq/F+bULalenFiGjulsKJvrucp6ONFuNMRkaS/r8cFFI9rqisX2AsW iQfAeuG6pjfap7LgzN/M/cMUZsmYfGGP/ZafsPKM= Received: (qmail 27731 invoked by alias); 3 Aug 2014 14:43:30 -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 27718 invoked by uid 89); 3 Aug 2014 14:43:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 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-we0-f173.google.com Received: from mail-we0-f173.google.com (HELO mail-we0-f173.google.com) (74.125.82.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 03 Aug 2014 14:43:28 +0000 Received: by mail-we0-f173.google.com with SMTP id q58so6498490wes.4 for ; Sun, 03 Aug 2014 07:43:25 -0700 (PDT) X-Received: by 10.194.90.4 with SMTP id bs4mr24594533wjb.71.1407077005613; Sun, 03 Aug 2014 07:43:25 -0700 (PDT) Received: from localhost ([95.145.138.172]) by mx.google.com with ESMTPSA id gc8sm30571331wic.3.2014.08.03.07.43.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Aug 2014 07:43:25 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [PATCH 49/50] varasm.c:mark_constants References: <87y4v5d77q.fsf@googlemail.com> Date: Sun, 03 Aug 2014 15:43:24 +0100 In-Reply-To: <87y4v5d77q.fsf@googlemail.com> (Richard Sandiford's message of "Sun, 03 Aug 2014 14:38:01 +0100") Message-ID: <8738dd63cj.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 gcc/ * varasm.c (mark_constant): Replace this for_each_rtx callback with... (mark_constants_in_pattern): ...this new function to iterate over all the subrtxes. (mark_constants): Update accordingly. Index: gcc/varasm.c =================================================================== --- gcc/varasm.c 2014-08-03 11:25:33.667189030 +0100 +++ gcc/varasm.c 2014-08-03 11:25:33.944191769 +0100 @@ -3867,38 +3867,38 @@ output_constant_pool_1 (struct constant_ return; } -/* Given a SYMBOL_REF CURRENT_RTX, mark it and all constants it refers - to as used. Emit referenced deferred strings. This function can - be used with for_each_rtx to mark all SYMBOL_REFs in an rtx. */ +/* Mark all constants that are referenced by SYMBOL_REFs in X. + Emit referenced deferred strings. */ -static int -mark_constant (rtx *current_rtx, void *data ATTRIBUTE_UNUSED) +static void +mark_constants_in_pattern (rtx insn) { - rtx x = *current_rtx; - - if (x == NULL_RTX || GET_CODE (x) != SYMBOL_REF) - return 0; - - if (CONSTANT_POOL_ADDRESS_P (x)) - { - struct constant_descriptor_rtx *desc = SYMBOL_REF_CONSTANT (x); - if (desc->mark == 0) - { - desc->mark = 1; - for_each_rtx (&desc->constant, mark_constant, NULL); - } - } - else if (TREE_CONSTANT_POOL_ADDRESS_P (x)) + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, PATTERN (insn), ALL) { - tree decl = SYMBOL_REF_DECL (x); - if (!TREE_ASM_WRITTEN (DECL_INITIAL (decl))) + const_rtx x = *iter; + if (GET_CODE (x) == SYMBOL_REF) { - n_deferred_constants--; - output_constant_def_contents (x); + if (CONSTANT_POOL_ADDRESS_P (x)) + { + struct constant_descriptor_rtx *desc = SYMBOL_REF_CONSTANT (x); + if (desc->mark == 0) + { + desc->mark = 1; + iter.substitute (desc->constant); + } + } + else if (TREE_CONSTANT_POOL_ADDRESS_P (x)) + { + tree decl = SYMBOL_REF_DECL (x); + if (!TREE_ASM_WRITTEN (DECL_INITIAL (decl))) + { + n_deferred_constants--; + output_constant_def_contents (CONST_CAST_RTX (x)); + } + } } } - - return -1; } /* Look through appropriate parts of INSN, marking all entries in the @@ -3923,11 +3923,11 @@ mark_constants (rtx insn) { rtx subinsn = XVECEXP (seq, 0, i); if (INSN_P (subinsn)) - for_each_rtx (&PATTERN (subinsn), mark_constant, NULL); + mark_constants_in_pattern (subinsn); } } else - for_each_rtx (&PATTERN (insn), mark_constant, NULL); + mark_constants_in_pattern (insn); } /* Look through the instructions for this function, and mark all the