From patchwork Sat Oct 25 09:45:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 403011 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 3C3F8140097 for ; Sat, 25 Oct 2014 20:45:23 +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=n1G27Mvseq/FMZ0MWzGeTu4xfBq70MRO1RYxHrXRx9tJ42nfq1 6AqXwkZlaM8EUDdq4VngGIs8h6paC0XvFauVlqOAbSAjEopedIhIP9TfXJ774DYD hWK5MT19+4Qw9cC9Y9CLw/EkLUSv4wajknj0iMsA9pkJSZjX+rJJ8BsVc= 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=enWxyPLJ3sXz6ryeI+ff6wPA5Z4=; b=yD995ktbI8Qp1kVUA5uf tU/zhPvi5g/ZxPvjTSeP18jbUcBv++Dxyw8vWFGK2gDbFzpTiDfeMxbfMFfhgUR8 VUJQr6bjjCyrdOfNRskuO9JiXsL2e+4mKJJbT44PhqaPsBKQB13Z3NCjOatyKFao ml/Vhr+X3rgx1dsyngSm9zw= Received: (qmail 29938 invoked by alias); 25 Oct 2014 09:45:17 -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 29927 invoked by uid 89); 25 Oct 2014 09:45:16 -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-f42.google.com Received: from mail-wg0-f42.google.com (HELO mail-wg0-f42.google.com) (74.125.82.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 25 Oct 2014 09:45:15 +0000 Received: by mail-wg0-f42.google.com with SMTP id k14so604776wgh.13 for ; Sat, 25 Oct 2014 02:45:12 -0700 (PDT) X-Received: by 10.194.108.104 with SMTP id hj8mr10656590wjb.28.1414230312768; Sat, 25 Oct 2014 02:45:12 -0700 (PDT) Received: from localhost ([95.144.14.167]) by mx.google.com with ESMTPSA id eg8sm4621694wib.15.2014.10.25.02.45.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Oct 2014 02:45:11 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, nickc@redhat.com, aoliva@redhat.com, rdsandiford@googlemail.com Cc: nickc@redhat.com, aoliva@redhat.com Subject: [FRV] RFA: Use new rtl iterators in frv_ifcvt_modify_tests Date: Sat, 25 Oct 2014 10:45:11 +0100 Message-ID: <8738acxz2w.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. In this particular cases there's a find_all_hard_regs function that can be used instead, although rtl.h needs to be included after hard-reg-set.h in order to get the declaration: #ifdef HARD_CONST extern void find_all_hard_regs (const_rtx, HARD_REG_SET *); extern void find_all_hard_reg_sets (const_rtx, HARD_REG_SET *, bool); #endif Tested by making sure there were no code changes for gcc.dg, gcc.c-torture and g++.dg for frv-elf. OK to install? Thanks, Richard gcc/ * config/frv/frv.c: Move include of rtl.h after hard-reg-set.h. (frv_clear_registers_used): Delete. (frv_ifcvt_modify_tests): Use find_all_hard_regs. Index: gcc/config/frv/frv.c =================================================================== --- gcc/config/frv/frv.c 2014-10-25 09:48:52.218530218 +0100 +++ gcc/config/frv/frv.c 2014-10-25 09:51:22.658858701 +0100 @@ -21,13 +21,13 @@ the Free Software Foundation; either ver #include "system.h" #include "coretypes.h" #include "tm.h" -#include "rtl.h" #include "tree.h" #include "varasm.h" #include "stor-layout.h" #include "stringpool.h" #include "regs.h" #include "hard-reg-set.h" +#include "rtl.h" #include "insn-config.h" #include "conditions.h" #include "insn-flags.h" @@ -326,7 +326,6 @@ static rtx frv_expand_mwtacc_builtin (e static rtx frv_expand_noargs_builtin (enum insn_code); static void frv_split_iacc_move (rtx, rtx); static rtx frv_emit_comparison (enum rtx_code, rtx, rtx); -static int frv_clear_registers_used (rtx *, void *); static void frv_ifcvt_add_insn (rtx, rtx, int); static rtx frv_ifcvt_rewrite_mem (rtx, enum machine_mode, rtx); static rtx frv_ifcvt_load_value (rtx, rtx); @@ -5185,33 +5184,6 @@ frv_split_abs (rtx operands[]) } -/* An internal function called by for_each_rtx to clear in a hard_reg set each - register used in an insn. */ - -static int -frv_clear_registers_used (rtx *ptr, void *data) -{ - if (GET_CODE (*ptr) == REG) - { - int regno = REGNO (*ptr); - HARD_REG_SET *p_regs = (HARD_REG_SET *)data; - - if (regno < FIRST_PSEUDO_REGISTER) - { - int reg_max = regno + HARD_REGNO_NREGS (regno, GET_MODE (*ptr)); - - while (regno < reg_max) - { - CLEAR_HARD_REG_BIT (*p_regs, regno); - regno++; - } - } - } - - return 0; -} - - /* Initialize machine-specific if-conversion data. On the FR-V, we don't have any extra fields per se, but it is useful hook to initialize the static storage. */ @@ -5404,9 +5376,11 @@ frv_ifcvt_modify_tests (ce_if_block *ce_ rtx pattern; rtx set; int skip_nested_if = FALSE; + HARD_REG_SET mentioned_regs; - for_each_rtx (&PATTERN (insn), frv_clear_registers_used, - (void *)&tmp_reg->regs); + CLEAR_HARD_REG_SET (mentioned_regs); + find_all_hard_regs (PATTERN (insn), &mentioned_regs); + AND_COMPL_HARD_REG_SET (tmp_reg->regs, mentioned_regs); pattern = PATTERN (insn); if (GET_CODE (pattern) == COND_EXEC) @@ -5442,8 +5416,8 @@ frv_ifcvt_modify_tests (ce_if_block *ce_ } if (! skip_nested_if) - for_each_rtx (&PATTERN (insn), frv_clear_registers_used, - (void *)&frv_ifcvt.nested_cc_ok_rewrite); + AND_COMPL_HARD_REG_SET (frv_ifcvt.nested_cc_ok_rewrite, + mentioned_regs); } if (insn == last_insn)