From patchwork Sat Oct 25 09:15:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 402995 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 0A40F140077 for ; Sat, 25 Oct 2014 20:15:45 +1100 (AEDT) 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:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=qjRuQmNhvN1UOnEet2hAHfow6Z29YHuqNlHl85udSF7dR8NR61 aj3Zol2uaSifLMkzYK01GSN0oIRPRdtTX0uWUb/hRh7ZtHalUhX381nFeioggYDv cABxQINxUUCCeX4Kbqk0gU/ryWNESqZWtZZXaFwE9ihFAXIKwLMjqGvrs= 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:cc:subject:date:message-id:mime-version:content-type; s= default; bh=W0SZuFhcREwTFjxgA2ZqiVYgKlE=; b=G2aD8RHodAXr1WZ18Mpy s7l8BQEx7/oOl/LG+gfsNgyZW4r7n9T1/otSCnUKtxoobaIkI1ycAZuQ2kQbJRVV yZNTBiyCSiZ5QUgwZazr4EU3Jd7LgupuH9ODMzDtFdd7KTHAzuJUi1AZMGlu0JTj 2L0bHDuCBSRWfmZojEHbm8s= Received: (qmail 2332 invoked by alias); 25 Oct 2014 09:15:39 -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 2322 invoked by uid 89); 25 Oct 2014 09:15: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-f171.google.com Received: from mail-wi0-f171.google.com (HELO mail-wi0-f171.google.com) (209.85.212.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 25 Oct 2014 09:15:38 +0000 Received: by mail-wi0-f171.google.com with SMTP id em10so2877040wid.10 for ; Sat, 25 Oct 2014 02:15:35 -0700 (PDT) X-Received: by 10.181.8.72 with SMTP id di8mr10343042wid.1.1414228535212; Sat, 25 Oct 2014 02:15:35 -0700 (PDT) Received: from localhost ([95.144.14.167]) by mx.google.com with ESMTPSA id bg10sm8190161wjc.47.2014.10.25.02.15.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Oct 2014 02:15:34 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, schwab@linux-m68k.org, rdsandiford@googlemail.com Cc: schwab@linux-m68k.org Subject: [m68k] RFA: Use new rtl iterators in m68k_tls_reference_p Date: Sat, 25 Oct 2014 10:15:34 +0100 Message-ID: <87y4s4zf0p.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 This is part of a series to remove uses of for_each_rtx from the ports. Tested by making sure there were no code changes for gcc.dg, gcc.c-torture and g++.dg for m68k-elf. OK to install? Thanks, Richard gcc/ * config/m68k/m68k.c (m68k_tls_reference_p_1): Delete. (m68k_tls_reference_p): Use FOR_EACH_SUBRTX_VAR. Index: gcc/config/m68k/m68k.c =================================================================== --- gcc/config/m68k/m68k.c 2014-10-25 09:51:16.781806316 +0100 +++ gcc/config/m68k/m68k.c 2014-10-25 09:51:17.194809998 +0100 @@ -2671,22 +2671,6 @@ m68k_tls_symbol_p (rtx x) return SYMBOL_REF_TLS_MODEL (x) != 0; } -/* Helper for m68k_tls_referenced_p. */ - -static int -m68k_tls_reference_p_1 (rtx *x_ptr, void *data ATTRIBUTE_UNUSED) -{ - /* Note: this is not the same as m68k_tls_symbol_p. */ - if (GET_CODE (*x_ptr) == SYMBOL_REF) - return SYMBOL_REF_TLS_MODEL (*x_ptr) != 0 ? 1 : 0; - - /* Don't recurse into legitimate TLS references. */ - if (m68k_tls_reference_p (*x_ptr, true)) - return -1; - - return 0; -} - /* If !LEGITIMATE_P, return true if X is a TLS symbol reference, though illegitimate one. If LEGITIMATE_P, return true if X is a legitimate TLS symbol reference. */ @@ -2698,7 +2682,22 @@ m68k_tls_reference_p (rtx x, bool legiti return false; if (!legitimate_p) - return for_each_rtx (&x, m68k_tls_reference_p_1, NULL) == 1 ? true : false; + { + subrtx_var_iterator::array_type array; + FOR_EACH_SUBRTX_VAR (iter, array, x, ALL) + { + rtx x = *iter; + + /* Note: this is not the same as m68k_tls_symbol_p. */ + if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) != 0) + return true; + + /* Don't recurse into legitimate TLS references. */ + if (m68k_tls_reference_p (x, true)) + iter.skip_subrtxes (); + } + return false; + } else { enum m68k_reloc reloc = RELOC_GOT;