aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/dojump.c75
-rw-r--r--gcc/dojump.h21
-rw-r--r--gcc/expr.c9
4 files changed, 66 insertions, 52 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 25026fc..c930bd2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,18 @@
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.
+
+2018-10-02 Eric Botcazou <ebotcazou@adacore.com>
+
* reorg.c (make_return_insns): Use emit_copy_of_insn_after for the
insns in the delay slot and add_insn_after for the jump insn.
diff --git a/gcc/dojump.c b/gcc/dojump.c
index 56c82c5f..9dccc72 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -38,6 +38,8 @@ along with GCC; see the file COPYING3. If not see
#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_pending_stack_adjust *save)
}
}
-/* 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 mode, int bitnum)
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, tree op1,
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, machine_mode mode,
}
}
+/* 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.
diff --git a/gcc/dojump.h b/gcc/dojump.h
index b768229..f948ee9 100644
--- a/gcc/dojump.h
+++ b/gcc/dojump.h
@@ -56,29 +56,22 @@ extern void save_pending_stack_adjust (saved_pending_stack_adjust *);
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 */
diff --git a/gcc/expr.c b/gcc/expr.c
index 583c7f0..03e5dc4 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -11155,10 +11155,11 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
{
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 ();