From patchwork Sat Oct 25 09:03:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 402991 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 35322140080 for ; Sat, 25 Oct 2014 20:04:11 +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=bsAAJeKMQlHTisnG2R7f1uEXTurm92jSLC6WgE+p5eHtoQVnRz Upr8sPpJyORik381s2Vb5x52sWRESswkRzrw0Gy6EqJ1ldcTVDWpimPq3YQtMY9o dPXn4XahgDe62Gmalklo1QiB1wAh63NnYoFXMGsH5zppBgoGnzPAJDtvA= 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=MKDpKh6AstGDFqyIFmX6chOHZq4=; b=UvvMKsG419NG/XbWvyTq 1DuY7CPUNYnKUG9MkKLYPFADXt8kTWWAKed6CB4ysdMPtR7QFBwgxyYuKggPd00z Z/2/NyrzZhooKtbgjNUfjCRO22G+gBCGvfXcHpNagjXrS4n0ixyQbmM55S9/s2Mp H+rG7wqhtwQG2WXVDsYIUWI= Received: (qmail 24947 invoked by alias); 25 Oct 2014 09:04:04 -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 24935 invoked by uid 89); 25 Oct 2014 09:04:03 -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-wg0-f50.google.com Received: from mail-wg0-f50.google.com (HELO mail-wg0-f50.google.com) (74.125.82.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 25 Oct 2014 09:04:02 +0000 Received: by mail-wg0-f50.google.com with SMTP id z12so333wgg.21 for ; Sat, 25 Oct 2014 02:03:59 -0700 (PDT) X-Received: by 10.180.210.167 with SMTP id mv7mr9425014wic.15.1414227839375; Sat, 25 Oct 2014 02:03:59 -0700 (PDT) Received: from localhost ([95.144.14.167]) by mx.google.com with ESMTPSA id hu3sm8188828wjb.17.2014.10.25.02.03.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Oct 2014 02:03:58 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rth@redhat.com, hubicka@ucw.cz, ubizjak@gmail.com, rdsandiford@googlemail.com Cc: rth@redhat.com, hubicka@ucw.cz, ubizjak@gmail.com Subject: [x86] RFA: Use new rtl iterators in x86_extended_reg_mentioned_p Date: Sat, 25 Oct 2014 10:03:58 +0100 Message-ID: <87fvec1pxd.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 x86_64-linux-gnu, and also by a boostrap. OK to install? Thanks, Richard gcc/ * config/i386/i386.c (extended_reg_mentioned_1): Delete. (x86_extended_reg_mentioned_p): Use FOR_EACH_SUBRTX. Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c 2014-10-25 09:51:15.189792126 +0100 +++ gcc/config/i386/i386.c 2014-10-25 09:51:15.606795843 +0100 @@ -39688,25 +39688,20 @@ x86_extended_QIreg_mentioned_p (rtx_insn return false; } -/* Return nonzero when P points to register encoded via REX prefix. - Called via for_each_rtx. */ -static int -extended_reg_mentioned_1 (rtx *p, void *) -{ - unsigned int regno; - if (!REG_P (*p)) - return 0; - regno = REGNO (*p); - return REX_INT_REGNO_P (regno) || REX_SSE_REGNO_P (regno); -} - /* Return true when INSN mentions register that must be encoded using REX prefix. */ bool x86_extended_reg_mentioned_p (rtx insn) { - return for_each_rtx (INSN_P (insn) ? &PATTERN (insn) : &insn, - extended_reg_mentioned_1, NULL); + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, INSN_P (insn) ? PATTERN (insn) : insn, NONCONST) + { + const_rtx x = *iter; + if (REG_P (x) + && (REX_INT_REGNO_P (REGNO (x)) || REX_SSE_REGNO_P (REGNO (x)))) + return true; + } + return false; } /* If profitable, negate (without causing overflow) integer constant