From patchwork Sun Aug 3 14:11:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 376036 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 145951400AA for ; Mon, 4 Aug 2014 00:11:43 +1000 (EST) 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:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=SXgb0I9T55FyTmSN52wWpvpWEQndR lmUU9SCe3ud17KIisV15n59qZi5yw/mb3e/LJqgYcwMqu71EDJVO78zR+bdacep6 jlabwwmfxam7yjNJrEooXrVMm6zMFWprAeko6EWyOerg8yRI6v5nBX4fLxQ9TcjG /Q09nMibP101ic= 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:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=J7KaykvAiHDaP5b6AdGkI5fw5DU=; b=FnV oH4nHqfdyYlsoQbSmir/9VwjAYpOwFIc6pgS1tOLLs2Wi4ichjLsQNDTNQfJYUxj kUqEHO4taLS09NFkxzBOPGIip8Ey7Pj9H5dA74cpAtCQI1L00WTEwY6QI9gf+18n qqiPnLPf99OBBqXSzQf2bNWcjecGeIN3ER2iR/lA= Received: (qmail 17180 invoked by alias); 3 Aug 2014 14:11:34 -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 17166 invoked by uid 89); 3 Aug 2014 14:11:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 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; Sun, 03 Aug 2014 14:11:32 +0000 Received: by mail-wg0-f43.google.com with SMTP id l18so6344322wgh.2 for ; Sun, 03 Aug 2014 07:11:29 -0700 (PDT) X-Received: by 10.194.62.110 with SMTP id x14mr24119782wjr.15.1407075089139; Sun, 03 Aug 2014 07:11:29 -0700 (PDT) Received: from localhost ([95.145.138.172]) by mx.google.com with ESMTPSA id hp6sm30262441wib.23.2014.08.03.07.11.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Aug 2014 07:11:28 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [PATCH 26/50] jump.c:returnjump_p References: <87y4v5d77q.fsf@googlemail.com> Date: Sun, 03 Aug 2014 15:11:28 +0100 In-Reply-To: <87y4v5d77q.fsf@googlemail.com> (Richard Sandiford's message of "Sun, 03 Aug 2014 14:38:01 +0100") Message-ID: <87tx5t8xyn.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 gcc/ * jump.c: Include rtl-iter.h. (returnjump_p_1): Delete. (returnjump_p): Use FOR_EACH_SUBRTX rather than for_each_rtx. Remove handling of null rtxes. Index: gcc/jump.c =================================================================== --- gcc/jump.c 2014-08-03 11:25:09.957954627 +0100 +++ gcc/jump.c 2014-08-03 11:25:27.442127486 +0100 @@ -54,6 +54,7 @@ Software Foundation; either version 3, o #include "predict.h" #include "tree-pass.h" #include "target.h" +#include "rtl-iter.h" /* Optimize jump y; x: ... y: jumpif... x? Don't know if it is worth bothering with. */ @@ -68,7 +69,6 @@ static void mark_jump_label_1 (rtx, rtx, static void mark_jump_label_asm (rtx, rtx); static void redirect_exp_1 (rtx *, rtx, rtx, rtx); static int invert_exp_1 (rtx, rtx); -static int returnjump_p_1 (rtx *, void *); /* Worker for rebuild_jump_labels and rebuild_jump_labels_chain. */ static void @@ -920,39 +920,35 @@ condjump_label (const_rtx insn) return NULL_RTX; } -/* Return true if INSN is a (possibly conditional) return insn. */ - -static int -returnjump_p_1 (rtx *loc, void *data ATTRIBUTE_UNUSED) -{ - rtx x = *loc; - - if (x == NULL) - return false; - - switch (GET_CODE (x)) - { - case RETURN: - case SIMPLE_RETURN: - case EH_RETURN: - return true; - - case SET: - return SET_IS_RETURN_P (x); - - default: - return false; - } -} - /* Return TRUE if INSN is a return jump. */ int returnjump_p (rtx insn) { - if (!JUMP_P (insn)) - return 0; - return for_each_rtx (&PATTERN (insn), returnjump_p_1, NULL); + if (JUMP_P (insn)) + { + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, PATTERN (insn), NONCONST) + { + const_rtx x = *iter; + switch (GET_CODE (x)) + { + case RETURN: + case SIMPLE_RETURN: + case EH_RETURN: + return true; + + case SET: + if (SET_IS_RETURN_P (x)) + return true; + break; + + default: + break; + } + } + } + return false; } /* Return true if INSN is a (possibly conditional) return insn. */