diff mbox series

Privatize do_jump and do_jump_1

Message ID 2328023.PefH6sCUHF@polaris
State New
Headers show
Series Privatize do_jump and do_jump_1 | expand

Commit Message

Eric Botcazou Oct. 2, 2018, 10:56 a.m. UTC
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  <ebotcazou@adacore.com>

	* 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.
diff mbox series

Patch

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 ();