From patchwork Sat Oct 25 09:07:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 402992 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 B3D3B140080 for ; Sat, 25 Oct 2014 20:07:43 +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=dnsXFiZttm/WaH7RSFc6rH2GIrdxBf5JtY8o24tKYB4TcGXWVv Tabjgn++xd1FFTfoB8/1mt++HTmtU1qp1//MM/8BLjFTEqOneoCxHr9aSXSYEgrG bEFtfS32PN6fEMqbPb0K80372Kbdy3lSFbgHKPCksrkMjrIQ4OLEPVzuU= 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=XtlkvUct16ijeF95JCMuslWMw6o=; b=nFwz7s2Gh2XFhduJ5jNS oQ/QsABpTo9dOoN+S3occAm1MOZjvN0nsUchcssqL5tTI8NaJT/c05SyiAwoR0t0 vbq1BMJEjUK6vbRhCNrJRATSIEFw16D9FPAarepG6NnnCfn/P7yvZX5SapmO+Te+ OK9RFjfcI81FAH72iCiqsr4= Received: (qmail 26718 invoked by alias); 25 Oct 2014 09:07:36 -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 26706 invoked by uid 89); 25 Oct 2014 09:07:36 -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-f43.google.com Received: from mail-wg0-f43.google.com (HELO mail-wg0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 25 Oct 2014 09:07:34 +0000 Received: by mail-wg0-f43.google.com with SMTP id n12so2494379wgh.26 for ; Sat, 25 Oct 2014 02:07:31 -0700 (PDT) X-Received: by 10.180.221.36 with SMTP id qb4mr9225721wic.46.1414228051511; Sat, 25 Oct 2014 02:07:31 -0700 (PDT) Received: from localhost ([95.144.14.167]) by mx.google.com with ESMTPSA id bg10sm8171501wjc.47.2014.10.25.02.07.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Oct 2014 02:07:30 -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 find_constant Date: Sat, 25 Oct 2014 10:07:30 +0100 Message-ID: <87bnp01prh.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. It's a bit hard to read, so I've attached a -b version too. 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 (find_constant_1): Delete. (find_constant): Use FOR_EACH_SUBRTX. Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c 2014-10-25 10:05:55.546618859 +0100 +++ gcc/config/i386/i386.c 2014-10-25 10:05:58.575647258 +0100 @@ -46526,21 +46526,23 @@ allocate_next_window (int window_num) return dispatch_window_list1; } -/* Increment the number of immediate operands of an instruction. */ +/* Compute number of immediate operands of an instruction. */ -static int -find_constant_1 (rtx *in_rtx, imm_info *imm_values) +static void +find_constant (rtx in_rtx, imm_info *imm_values) { - if (*in_rtx == 0) - return 0; - - switch ( GET_CODE (*in_rtx)) + if (INSN_P (in_rtx)) + in_rtx = PATTERN (in_rtx); + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, in_rtx, ALL) + if (const_rtx x = *iter) + switch (GET_CODE (x)) { case CONST: case SYMBOL_REF: case CONST_INT: (imm_values->imm)++; - if (x86_64_immediate_operand (*in_rtx, SImode)) + if (x86_64_immediate_operand (CONST_CAST_RTX (x), SImode)) (imm_values->imm32)++; else (imm_values->imm64)++; @@ -46552,7 +46554,7 @@ find_constant_1 (rtx *in_rtx, imm_info * break; case CODE_LABEL: - if (LABEL_KIND (*in_rtx) == LABEL_NORMAL) + if (LABEL_KIND (x) == LABEL_NORMAL) { (imm_values->imm)++; (imm_values->imm32)++; @@ -46562,17 +46564,6 @@ find_constant_1 (rtx *in_rtx, imm_info * default: break; } - - return 0; -} - -/* Compute number of immediate operands of an instruction. */ - -static void -find_constant (rtx in_rtx, imm_info *imm_values) -{ - for_each_rtx (INSN_P (in_rtx) ? &PATTERN (in_rtx) : &in_rtx, - (rtx_function) find_constant_1, (void *) imm_values); } /* Return total size of immediate operands of an instruction along with number