From patchwork Sat Oct 25 09:17:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 402996 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 D9C00140077 for ; Sat, 25 Oct 2014 20:17:44 +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=E1cfLbJ3me1iT3OE4jyH6M62YJz7wUk+vrwktHUFxrCfoq8gB0 Cp7rB/InYPCdsmxywj5nhy/QZchsfiKsIf+UibwB9cFWLVsnkmF8QYab2Rb2W2Ih Cqilcfrv8yAgGj1msAlLpDWFex/uTGOsfaBU1XyUF58fguIfSAbU1w9Iw= 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=MYyMi9XnNX2/9Fxy0jdqyvCQD+4=; b=S/6BL4eIIAwKlal2Decm 6zGlTXYkBA13d231EqMlioMShR2uxTx+0n5u4D9IUWOxbj+TUAqdwtvGa53pIJXT jpkA/yBpt0cI5875aWU3o27eL0cTGem951dJfKBNKSEdq3PpoacSwtYIaeA0C8Pn 6lXBDEW5YDsl2zMkBTbfUH4= Received: (qmail 4095 invoked by alias); 25 Oct 2014 09:17:37 -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 4081 invoked by uid 89); 25 Oct 2014 09:17:37 -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-wg0-f44.google.com Received: from mail-wg0-f44.google.com (HELO mail-wg0-f44.google.com) (74.125.82.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 25 Oct 2014 09:17:36 +0000 Received: by mail-wg0-f44.google.com with SMTP id y10so2498946wgg.3 for ; Sat, 25 Oct 2014 02:17:33 -0700 (PDT) X-Received: by 10.180.206.202 with SMTP id lq10mr9506565wic.44.1414228653019; Sat, 25 Oct 2014 02:17:33 -0700 (PDT) Received: from localhost ([95.144.14.167]) by mx.google.com with ESMTPSA id h8sm8197083wjs.43.2014.10.25.02.17.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Oct 2014 02:17:32 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, augustine.sterling@gmail.com, rdsandiford@googlemail.com Cc: augustine.sterling@gmail.com Subject: [xtensa] RFA: Use new rtl iterators in xtensa_tls_referenced_p Date: Sat, 25 Oct 2014 10:17:32 +0100 Message-ID: <87siiczexf.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 xtensa-elf. OK to install? Thanks, Richard gcc/ * config/xtensa/xtensa.c: Include rtl-iter.h. (xtensa_tls_referenced_p_1): Delete. (xtensa_tls_referenced_p): Use FOR_EACH_SUBRTX. Index: gcc/config/xtensa/xtensa.c =================================================================== --- gcc/config/xtensa/xtensa.c 2014-10-25 09:48:52.858535844 +0100 +++ gcc/config/xtensa/xtensa.c 2014-10-25 09:51:17.602813634 +0100 @@ -66,6 +66,7 @@ Software Foundation; either version 3, o #include "gimplify.h" #include "df.h" #include "builtins.h" +#include "rtl-iter.h" /* Enumeration for all of the relational tests, so that we can build @@ -1986,34 +1987,6 @@ xtensa_mode_dependent_address_p (const_r return constantpool_address_p (addr); } -/* Helper for xtensa_tls_referenced_p. */ - -static int -xtensa_tls_referenced_p_1 (rtx *x, void *data ATTRIBUTE_UNUSED) -{ - if (GET_CODE (*x) == SYMBOL_REF) - return SYMBOL_REF_TLS_MODEL (*x) != 0; - - /* Ignore TLS references that have already been legitimized. */ - if (GET_CODE (*x) == UNSPEC) - { - switch (XINT (*x, 1)) - { - case UNSPEC_TPOFF: - case UNSPEC_DTPOFF: - case UNSPEC_TLS_FUNC: - case UNSPEC_TLS_ARG: - case UNSPEC_TLS_CALL: - return -1; - default: - break; - } - } - - return 0; -} - - /* Return TRUE if X contains any TLS symbol references. */ bool @@ -2022,7 +1995,29 @@ xtensa_tls_referenced_p (rtx x) if (! TARGET_HAVE_TLS) return false; - return for_each_rtx (&x, xtensa_tls_referenced_p_1, NULL); + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, x, ALL) + { + const_rtx x = *iter; + if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) != 0) + return true; + + /* Ignore TLS references that have already been legitimized. */ + if (GET_CODE (x) == UNSPEC) + switch (XINT (x, 1)) + { + case UNSPEC_TPOFF: + case UNSPEC_DTPOFF: + case UNSPEC_TLS_FUNC: + case UNSPEC_TLS_ARG: + case UNSPEC_TLS_CALL: + iter.skip_subrtxes (); + break; + default: + break; + } + } + return false; }