Commit be099f37 by Eric Botcazou Committed by Eric Botcazou

dojump.h (do_jump): Delete.

	* 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.

From-SVN: r264781
parent 5d11b4bf
2018-10-02 Eric Botcazou <ebotcazou@adacore.com> 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 * 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. insns in the delay slot and add_insn_after for the jump insn.
...@@ -38,6 +38,8 @@ along with GCC; see the file COPYING3. If not see ...@@ -38,6 +38,8 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h" #include "langhooks.h"
static bool prefer_and_bit_test (scalar_int_mode, int); 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, static void do_jump_by_parts_greater (scalar_int_mode, tree, tree, int,
rtx_code_label *, rtx_code_label *, rtx_code_label *, rtx_code_label *,
profile_probability); profile_probability);
...@@ -118,38 +120,6 @@ restore_pending_stack_adjust (saved_pending_stack_adjust *save) ...@@ -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. */ /* Used internally by prefer_and_bit_test. */
static GTY(()) rtx and_reg; static GTY(()) rtx and_reg;
...@@ -197,7 +167,7 @@ prefer_and_bit_test (scalar_int_mode mode, int bitnum) ...@@ -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. OP0 CODE OP1 . IF_FALSE_LABEL and IF_TRUE_LABEL like in do_jump.
PROB is probability of jump to if_true_label. */ PROB is probability of jump to if_true_label. */
void static void
do_jump_1 (enum tree_code code, tree op0, tree op1, do_jump_1 (enum tree_code code, tree op0, tree op1,
rtx_code_label *if_false_label, rtx_code_label *if_true_label, rtx_code_label *if_false_label, rtx_code_label *if_true_label,
profile_probability prob) profile_probability prob)
...@@ -417,7 +387,7 @@ do_jump_1 (enum tree_code code, tree op0, tree op1, ...@@ -417,7 +387,7 @@ do_jump_1 (enum tree_code code, tree op0, tree op1,
PROB is probability of jump to if_true_label. */ PROB is probability of jump to if_true_label. */
void static void
do_jump (tree exp, rtx_code_label *if_false_label, do_jump (tree exp, rtx_code_label *if_false_label,
rtx_code_label *if_true_label, profile_probability prob) rtx_code_label *if_true_label, profile_probability prob)
{ {
...@@ -946,6 +916,43 @@ split_comparison (enum rtx_code code, machine_mode mode, ...@@ -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. /* 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. The decision as to signed or unsigned comparison must be made by the caller.
......
...@@ -56,29 +56,22 @@ extern void save_pending_stack_adjust (saved_pending_stack_adjust *); ...@@ -56,29 +56,22 @@ extern void save_pending_stack_adjust (saved_pending_stack_adjust *);
extern void restore_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 bool split_comparison (enum rtx_code, machine_mode,
extern void jumpifnot (tree exp, rtx_code_label *label, enum rtx_code *, enum rtx_code *);
profile_probability prob);
extern void jumpifnot_1 (enum tree_code, tree, tree, rtx_code_label *,
profile_probability);
/* Generate code to evaluate EXP and jump to LABEL if the value is nonzero. */ /* 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 (tree exp, rtx_code_label *label, profile_probability prob);
extern void jumpif_1 (enum tree_code, tree, tree, rtx_code_label *, extern void jumpif_1 (enum tree_code, tree, tree, rtx_code_label *,
profile_probability); profile_probability);
/* Generate code to evaluate EXP and jump to IF_FALSE_LABEL if /* Generate code to evaluate EXP and jump to LABEL if the value is zero. */
the result is zero, or IF_TRUE_LABEL if the result is one. */ extern void jumpifnot (tree exp, rtx_code_label *label,
extern void do_jump (tree exp, rtx_code_label *if_false_label, profile_probability prob);
rtx_code_label *if_true_label, profile_probability prob); extern void jumpifnot_1 (enum tree_code, tree, tree, rtx_code_label *,
extern void do_jump_1 (enum tree_code, tree, tree, rtx_code_label *, profile_probability);
rtx_code_label *, profile_probability);
extern void do_compare_rtx_and_jump (rtx, rtx, enum rtx_code, int, extern void do_compare_rtx_and_jump (rtx, rtx, enum rtx_code, int,
machine_mode, rtx, rtx_code_label *, machine_mode, rtx, rtx_code_label *,
rtx_code_label *, profile_probability); rtx_code_label *, profile_probability);
extern bool split_comparison (enum rtx_code, machine_mode,
enum rtx_code *, enum rtx_code *);
#endif /* GCC_DOJUMP_H */ #endif /* GCC_DOJUMP_H */
...@@ -11155,10 +11155,11 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, ...@@ -11155,10 +11155,11 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
{ {
rtx_code_label *label = gen_label_rtx (); rtx_code_label *label = gen_label_rtx ();
int value = TREE_CODE (rhs) == BIT_IOR_EXPR; int value = TREE_CODE (rhs) == BIT_IOR_EXPR;
do_jump (TREE_OPERAND (rhs, 1), profile_probability prob = profile_probability::uninitialized ();
value ? label : 0, if (value)
value ? 0 : label, jumpifnot (TREE_OPERAND (rhs, 1), label, prob);
profile_probability::uninitialized ()); else
jumpif (TREE_OPERAND (rhs, 1), label, prob);
expand_assignment (lhs, build_int_cst (TREE_TYPE (rhs), value), expand_assignment (lhs, build_int_cst (TREE_TYPE (rhs), value),
false); false);
do_pending_stack_adjust (); do_pending_stack_adjust ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment