This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[sel-sched] Merge with trunk
- From: Andrey Belevantsev <abel at ispras dot ru>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 27 Dec 2007 18:41:43 +0300
- Subject: [sel-sched] Merge with trunk
Hello,
I have merged the sel-sched branch with trunk rev. 130104. The patch
below shows only minor changes within the selective scheduler itself.
Tested on ia64.
Andrey
2007-12-27 Andrey Belevantsev <abel@ispras.ru>
Merge with trunk r.130104.
* sel-sched-dump.c (sel_print_insn): Constify the first parameter.
* sel-sched-dump.h (sel_print_insn): Likewise.
* sel-sched-ir.c (sel_rtx_equal_p): Fix formatting.
(av_set_split_usefulness): Avoid division by zero.
* sel-sched.c (speculate_expr): Avoid combined data and control
speculation when pipelining.
(fill_vec_av_set): Do not try to rename data speculative insns.
diff -r 052dfa81ff3a -r 7d24774c0518 gcc/sel-sched-dump.c
--- a/gcc/sel-sched-dump.c Tue Nov 13 11:59:00 2007 +0000
+++ b/gcc/sel-sched-dump.c Tue Nov 27 10:53:03 2007 +0000
@@ -700,7 +700,7 @@ dump_hard_reg_set (const char *prefix, H
/* Pretty print INSN. This is used as a hook. */
const char *
-sel_print_insn (rtx insn, int aligned ATTRIBUTE_UNUSED)
+sel_print_insn (const_rtx insn, int aligned ATTRIBUTE_UNUSED)
{
static char buf[80];
diff -r 052dfa81ff3a -r 7d24774c0518 gcc/sel-sched-dump.h
--- a/gcc/sel-sched-dump.h Tue Nov 13 11:59:00 2007 +0000
+++ b/gcc/sel-sched-dump.h Tue Nov 27 10:53:03 2007 +0000
@@ -181,7 +181,7 @@ extern bool new_line;
/* Functions from sel-sched-dump.c. */
-extern const char * sel_print_insn (rtx, int);
+extern const char * sel_print_insn (const_rtx, int);
extern void free_sel_dump_data (void);
extern void setup_sched_dumps (void);
diff -r 052dfa81ff3a -r 7d24774c0518 gcc/sel-sched-ir.c
--- a/gcc/sel-sched-ir.c Tue Nov 13 11:59:00 2007 +0000
+++ b/gcc/sel-sched-ir.c Tue Nov 27 10:53:03 2007 +0000
@@ -990,18 +990,16 @@ sel_rtx_equal_p (rtx x, rtx y)
return 0;
/* Support ia64 speculation. */
- {
- if (GET_CODE (x) == UNSPEC
- && (targetm.sched.skip_rtx_p == NULL
- || targetm.sched.skip_rtx_p (x)))
- return sel_rtx_equal_p (XVECEXP (x, 0, 0), y);
-
- if (GET_CODE (y) == UNSPEC
- && (targetm.sched.skip_rtx_p == NULL
- || targetm.sched.skip_rtx_p (y)))
- return sel_rtx_equal_p (x, XVECEXP (y, 0, 0));
- }
-
+ if (GET_CODE (x) == UNSPEC
+ && (targetm.sched.skip_rtx_p == NULL
+ || targetm.sched.skip_rtx_p (x)))
+ return sel_rtx_equal_p (XVECEXP (x, 0, 0), y);
+
+ if (GET_CODE (y) == UNSPEC
+ && (targetm.sched.skip_rtx_p == NULL
+ || targetm.sched.skip_rtx_p (y)))
+ return sel_rtx_equal_p (x, XVECEXP (y, 0, 0));
+
code = GET_CODE (x);
/* Rtx's of different codes cannot be equal. */
if (code != GET_CODE (y))
@@ -2198,7 +2196,9 @@ av_set_split_usefulness (av_set_t *avp,
expr_t expr;
FOR_EACH_RHS_1 (expr, i, avp)
- EXPR_USEFULNESS (expr) = (EXPR_USEFULNESS (expr) * prob) / all_prob;
+ EXPR_USEFULNESS (expr) = (all_prob
+ ? (EXPR_USEFULNESS (expr) * prob) / all_prob
+ : 0);
}
/* Leave in AVP only those expressions, which are present in AV,
diff -r 052dfa81ff3a -r 7d24774c0518 gcc/sel-sched.c
--- a/gcc/sel-sched.c Tue Nov 13 11:59:00 2007 +0000
+++ b/gcc/sel-sched.c Tue Nov 27 10:53:03 2007 +0000
@@ -1468,6 +1468,9 @@ find_best_reg_for_rhs (rhs_t rhs, blist_
/* Flag to enable / disable ia64 speculation. */
static bool sel_speculation_p = true;
+static bool speculate_expr (expr_t, ds_t);
+static ds_t get_spec_check_type_for_insn (insn_t, expr_t);
+
/* Return true if dependence described by DS can be overcomed. */
static bool
can_overcome_dep_p (ds_t ds)
@@ -1498,9 +1501,6 @@ can_overcome_dep_p (ds_t ds)
return true;
}
-
-static bool speculate_expr (expr_t, ds_t);
-static ds_t get_spec_check_type_for_insn (insn_t, expr_t);
/* Get a speculation check instruction.
C_RHS is a speculative expression,
@@ -1634,6 +1634,12 @@ speculate_expr (expr_t expr, ds_t ds)
ds_t target_ds = (ds & SPECULATIVE);
ds_t current_ds = EXPR_SPEC_DONE_DS (expr);
ds_t combined_ds = ds_full_merge (current_ds, target_ds, NULL_RTX, NULL_RTX);
+
+ /* ??? Do not allow both kind of speculations when pipelining. */
+ if (pipelining_p
+ && (combined_ds & DATA_SPEC)
+ && (combined_ds & CONTROL_SPEC))
+ return false;
if (apply_spec_to_expr (expr, combined_ds))
/* We already have all necessary speculations. */
@@ -1947,7 +1953,7 @@ moveup_rhs (rhs_t insn_to_move_up, insn_
if (can_overcome_dep_p (*rhs_dsp))
{
- if (speculate_expr (insn_to_move_up, *rhs_dsp))
+ if (speculate_expr (insn_to_move_up, *rhs_dsp))
{
/* Speculation was successful. */
*rhs_dsp = 0;
@@ -3339,7 +3345,9 @@ fill_vec_av_set (av_set_t av, blist_t bn
(target_available == false
&& !EXPR_SEPARABLE_P (rhs))
/* Don't try to find a register for low-priority expression. */
- || n >= max_insns_to_rename)
+ || n >= max_insns_to_rename
+ /* ??? FIXME: Don't try to rename data speculation. */
+ || (EXPR_SPEC_DONE_DS (rhs) & BEGIN_DATA))
{
succ++;
VEC_unordered_remove (rhs_t, vec_av_set, n);