From patchwork Tue Oct 2 10:56:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 977702 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-486773-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="KwXvktoj"; dkim-atps=neutral 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 42PbgN0jRZz9sj9 for ; Tue, 2 Oct 2018 20:56:31 +1000 (AEST) 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:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=X2Nsekwj3CkAw51y qCqa4E64V1bJOZL/TUI3s+ljvAOO6ey1dezPNAW7tJpmhvZXMDA6sPK/WNaN9/vO 7VynEOQasE2TNtl2pMBfO+hQbzlDao2HV1YWbChxCFrhi+nhp5OYgvsWBjC1sMuQ H65JhK4SdjbC5B6kEr6FApt6h8s= 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:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=Rg1JrBfEwa9RPX4Ugcg00A N0FDA=; b=KwXvktojJ1CVNQRELu7SztS7GS110aMpPVBesref7NjbMCiLt4Ho6G CFL06wyrMycJYh+npQB+G1vqCVbrnfTgYx3z6mdR85+/3dV3PePa3dGDbB79/WZV xWYHnSkMWYkKxSXUokNy7LLXSQ+M3qDOPkEUwyYEpzROYJUA/G9dA= Received: (qmail 113325 invoked by alias); 2 Oct 2018 10:56:25 -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 113309 invoked by uid 89); 2 Oct 2018 10:56:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=CODE, scalar_int_mode X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 02 Oct 2018 10:56:22 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id A86288138B for ; Tue, 2 Oct 2018 12:56:20 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SS_Ghc2avRyI for ; Tue, 2 Oct 2018 12:56:20 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 7A27481368 for ; Tue, 2 Oct 2018 12:56:20 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Privatize do_jump and do_jump_1 Date: Tue, 02 Oct 2018 12:56:19 +0200 Message-ID: <2328023.PefH6sCUHF@polaris> MIME-Version: 1.0 There is a single, convoluted use of do_jump outside dojump.c and no uses of do_jump_1 at all. Tested on x86-64/Linux, applied on the mainline as obvious. 2018-10-02 Eric Botcazou * dojump.h (do_jump): Delete. (do_jump_1): Likewise. (split_comparison): Move around. * dojump.c (do_jump): Make static. (do_jump_1): Likewise. (jumpifnot): Move around. (jumpifnot_1): Likewise. (jumpif): Likewise. (jumpif_1): Likewise. * expr.c (expand_expr_real_1): Call jumpif[not] instead of do_jump. Index: dojump.h =================================================================== --- dojump.h (revision 264732) +++ dojump.h (working copy) @@ -56,29 +56,22 @@ extern void save_pending_stack_adjust (s extern void restore_pending_stack_adjust (saved_pending_stack_adjust *); -/* Generate code to evaluate EXP and jump to LABEL if the value is zero. */ -extern void jumpifnot (tree exp, rtx_code_label *label, - profile_probability prob); -extern void jumpifnot_1 (enum tree_code, tree, tree, rtx_code_label *, - profile_probability); +extern bool split_comparison (enum rtx_code, machine_mode, + enum rtx_code *, enum rtx_code *); /* Generate code to evaluate EXP and jump to LABEL if the value is nonzero. */ extern void jumpif (tree exp, rtx_code_label *label, profile_probability prob); extern void jumpif_1 (enum tree_code, tree, tree, rtx_code_label *, profile_probability); -/* Generate code to evaluate EXP and jump to IF_FALSE_LABEL if - the result is zero, or IF_TRUE_LABEL if the result is one. */ -extern void do_jump (tree exp, rtx_code_label *if_false_label, - rtx_code_label *if_true_label, profile_probability prob); -extern void do_jump_1 (enum tree_code, tree, tree, rtx_code_label *, - rtx_code_label *, profile_probability); +/* Generate code to evaluate EXP and jump to LABEL if the value is zero. */ +extern void jumpifnot (tree exp, rtx_code_label *label, + profile_probability prob); +extern void jumpifnot_1 (enum tree_code, tree, tree, rtx_code_label *, + profile_probability); extern void do_compare_rtx_and_jump (rtx, rtx, enum rtx_code, int, machine_mode, rtx, rtx_code_label *, rtx_code_label *, profile_probability); -extern bool split_comparison (enum rtx_code, machine_mode, - enum rtx_code *, enum rtx_code *); - #endif /* GCC_DOJUMP_H */ Index: dojump.c =================================================================== --- dojump.c (revision 264732) +++ dojump.c (working copy) @@ -38,6 +38,8 @@ along with GCC; see the file COPYING3. #include "langhooks.h" static bool prefer_and_bit_test (scalar_int_mode, int); +static void do_jump (tree, rtx_code_label *, rtx_code_label *, + profile_probability); static void do_jump_by_parts_greater (scalar_int_mode, tree, tree, int, rtx_code_label *, rtx_code_label *, profile_probability); @@ -118,38 +120,6 @@ restore_pending_stack_adjust (saved_pend } } -/* Expand conditional expressions. */ - -/* Generate code to evaluate EXP and jump to LABEL if the value is zero. */ - -void -jumpifnot (tree exp, rtx_code_label *label, profile_probability prob) -{ - do_jump (exp, label, NULL, prob.invert ()); -} - -void -jumpifnot_1 (enum tree_code code, tree op0, tree op1, rtx_code_label *label, - profile_probability prob) -{ - do_jump_1 (code, op0, op1, label, NULL, prob.invert ()); -} - -/* Generate code to evaluate EXP and jump to LABEL if the value is nonzero. */ - -void -jumpif (tree exp, rtx_code_label *label, profile_probability prob) -{ - do_jump (exp, NULL, label, prob); -} - -void -jumpif_1 (enum tree_code code, tree op0, tree op1, - rtx_code_label *label, profile_probability prob) -{ - do_jump_1 (code, op0, op1, NULL, label, prob); -} - /* Used internally by prefer_and_bit_test. */ static GTY(()) rtx and_reg; @@ -197,7 +167,7 @@ prefer_and_bit_test (scalar_int_mode mod OP0 CODE OP1 . IF_FALSE_LABEL and IF_TRUE_LABEL like in do_jump. PROB is probability of jump to if_true_label. */ -void +static void do_jump_1 (enum tree_code code, tree op0, tree op1, rtx_code_label *if_false_label, rtx_code_label *if_true_label, profile_probability prob) @@ -417,7 +387,7 @@ do_jump_1 (enum tree_code code, tree op0 PROB is probability of jump to if_true_label. */ -void +static void do_jump (tree exp, rtx_code_label *if_false_label, rtx_code_label *if_true_label, profile_probability prob) { @@ -946,6 +916,43 @@ split_comparison (enum rtx_code code, ma } } +/* Generate code to evaluate EXP and jump to LABEL if the value is nonzero. + PROB is probability of jump to LABEL. */ + +void +jumpif (tree exp, rtx_code_label *label, profile_probability prob) +{ + do_jump (exp, NULL, label, prob); +} + +/* Similar to jumpif but dealing with exploded comparisons of the type + OP0 CODE OP1 . LABEL and PROB are like in jumpif. */ + +void +jumpif_1 (enum tree_code code, tree op0, tree op1, rtx_code_label *label, + profile_probability prob) +{ + do_jump_1 (code, op0, op1, NULL, label, prob); +} + +/* Generate code to evaluate EXP and jump to LABEL if the value is zero. + PROB is probability of jump to LABEL. */ + +void +jumpifnot (tree exp, rtx_code_label *label, profile_probability prob) +{ + do_jump (exp, label, NULL, prob.invert ()); +} + +/* Similar to jumpifnot but dealing with exploded comparisons of the type + OP0 CODE OP1 . LABEL and PROB are like in jumpifnot. */ + +void +jumpifnot_1 (enum tree_code code, tree op0, tree op1, rtx_code_label *label, + profile_probability prob) +{ + do_jump_1 (code, op0, op1, label, NULL, prob.invert ()); +} /* Like do_compare_and_jump but expects the values to compare as two rtx's. The decision as to signed or unsigned comparison must be made by the caller. Index: expr.c =================================================================== --- expr.c (revision 264732) +++ expr.c (working copy) @@ -11155,10 +11155,11 @@ expand_expr_real_1 (tree exp, rtx target { rtx_code_label *label = gen_label_rtx (); int value = TREE_CODE (rhs) == BIT_IOR_EXPR; - do_jump (TREE_OPERAND (rhs, 1), - value ? label : 0, - value ? 0 : label, - profile_probability::uninitialized ()); + profile_probability prob = profile_probability::uninitialized (); + if (value) + jumpifnot (TREE_OPERAND (rhs, 1), label, prob); + else + jumpif (TREE_OPERAND (rhs, 1), label, prob); expand_assignment (lhs, build_int_cst (TREE_TYPE (rhs), value), false); do_pending_stack_adjust ();