From patchwork Sat Oct 25 09:54:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 403016 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 0735B140077 for ; Sat, 25 Oct 2014 20:55:03 +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=JIq5/xcljyxtLakY6ocQ11HrL9eMZYK06CDNZ9hltr6sC5iot0 GOuQGfNRWhwb2eV+ZzSwjuoH9BqNFMu/dqi4FoXTECEfbUqBYa1skx7izqoq7HYp iUWH3WtNqnreUC2ERsZjZcB1yfP/kMggHtx8Len/tjIc4M8O74OBnJQEA= 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=4h2fjWdYeOW553NbikJpSCcrx14=; b=iDljaeOzz3jBV4hVV6NW 2a2w+kqBT6tsDJrPG4GIqGeEizJpgRjqDI2rWocu20P+KzXDLoFWti88ZGnNMqZd bRRVtXQFgNeu8V1dhDRqa1z10tjfdmBKCNHy4nSDY5i695RvmMwPfA7bzVVQKjdE B+5pu9Oi67TG0vrBjJmW9R8= Received: (qmail 6180 invoked by alias); 25 Oct 2014 09:54:57 -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 6170 invoked by uid 89); 25 Oct 2014 09:54:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f180.google.com Received: from mail-wi0-f180.google.com (HELO mail-wi0-f180.google.com) (209.85.212.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 25 Oct 2014 09:54:55 +0000 Received: by mail-wi0-f180.google.com with SMTP id em10so2957419wid.13 for ; Sat, 25 Oct 2014 02:54:52 -0700 (PDT) X-Received: by 10.194.239.10 with SMTP id vo10mr10611892wjc.29.1414230892856; Sat, 25 Oct 2014 02:54:52 -0700 (PDT) Received: from localhost ([95.144.14.167]) by mx.google.com with ESMTPSA id dg3sm4650495wib.14.2014.10.25.02.54.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Oct 2014 02:54:52 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, joern.rennecke@embecosm.com, rdsandiford@googlemail.com Cc: joern.rennecke@embecosm.com Subject: [ARC] RFA: Use new rtl iterators in small_data_pattern Date: Sat, 25 Oct 2014 10:54:51 +0100 Message-ID: <87h9yswk2c.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 arc-elf. OK to install? Thanks, Richard gcc/ * config/arc/arc.c (arc_rewrite_small_data_p): Constify argument. (small_data_pattern_1): Delete. (small_data_pattern): Use FOR_EACH_SUBRTX. Index: gcc/config/arc/arc.c =================================================================== --- gcc/config/arc/arc.c 2014-10-25 09:51:25.501884042 +0100 +++ gcc/config/arc/arc.c 2014-10-25 09:51:25.901887608 +0100 @@ -6337,7 +6337,7 @@ arc_in_small_data_p (const_tree decl) as a gp+symref. */ static bool -arc_rewrite_small_data_p (rtx x) +arc_rewrite_small_data_p (const_rtx x) { if (GET_CODE (x) == CONST) x = XEXP (x, 0); @@ -6387,26 +6387,25 @@ arc_rewrite_small_data (rtx op) return op; } -/* A for_each_rtx callback for small_data_pattern. */ - -static int -small_data_pattern_1 (rtx *loc, void *data ATTRIBUTE_UNUSED) -{ - if (GET_CODE (*loc) == PLUS - && rtx_equal_p (XEXP (*loc, 0), pic_offset_table_rtx)) - return -1; - - return arc_rewrite_small_data_p (*loc); -} - /* Return true if OP refers to small data symbols directly, not through a PLUS. */ bool small_data_pattern (rtx op, enum machine_mode) { - return (GET_CODE (op) != SEQUENCE - && for_each_rtx (&op, small_data_pattern_1, 0)); + if (GET_CODE (op) == SEQUENCE) + return false; + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, op, ALL) + { + const_rtx x = *iter; + if (GET_CODE (x) == PLUS + && rtx_equal_p (XEXP (x, 0), pic_offset_table_rtx)) + iter.skip_subrtxes (); + else if (arc_rewrite_small_data_p (x)) + return true; + } + return false; } /* Return true if OP is an acceptable memory operand for ARCompact