aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Belevantsev <abel@ispras.ru>2007-06-14 13:01:25 +0000
committerAndrey Belevantsev <abel@ispras.ru>2007-06-14 13:01:25 +0000
commitef0d073b994df11368b9205af6212f96f1178b92 (patch)
tree557e3819f8849cee0003f396a37678b3f9af03ac
parent22f8c85cb43a71566d22301be76687f00365550b (diff)
* sel-sched.c (moveup_set_rhs): When analyzing an expression,
first check the caches. When a hard dependence/no dependence is found, record this in the caches. * sel-sched-ir.h (struct sel_insn_data): Reorder fields. New fields analyzed_deps, found_deps. (INSN_ANALYZED_DEPS, INSN_FOUND_DEPS): New macros. * sel-sched-ir.c (init_global_and_expr_for_insn, init_insn, init_simplejump): Initialize INSN_ANALYZED_DEPS and INSN_FOUND_DEPS caches. (finish_global_and_expr_1): Free them. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/sel-sched-branch@125707 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.sel-sched15
-rw-r--r--gcc/sel-sched-ir.c12
-rw-r--r--gcc/sel-sched-ir.h38
-rw-r--r--gcc/sel-sched.c32
4 files changed, 83 insertions, 14 deletions
diff --git a/gcc/ChangeLog.sel-sched b/gcc/ChangeLog.sel-sched
index 457ffdb3125..bb92aaf0d97 100644
--- a/gcc/ChangeLog.sel-sched
+++ b/gcc/ChangeLog.sel-sched
@@ -1,5 +1,20 @@
2007-06-14 Andrey Belevantsev <abel@ispras.ru>
+ * sel-sched.c (moveup_set_rhs): When analyzing an expression,
+ first check the caches. When a hard dependence/no dependence
+ is found, record this in the caches.
+
+ * sel-sched-ir.h (struct sel_insn_data): Reorder fields.
+ New fields analyzed_deps, found_deps.
+ (INSN_ANALYZED_DEPS, INSN_FOUND_DEPS): New macros.
+
+ * sel-sched-ir.c (init_global_and_expr_for_insn, init_insn,
+ init_simplejump): Initialize INSN_ANALYZED_DEPS and
+ INSN_FOUND_DEPS caches.
+ (finish_global_and_expr_1): Free them.
+
+2007-06-14 Andrey Belevantsev <abel@ispras.ru>
+
* sel-sched-ir.h (struct _expr): New field changed_on_insns.
(EXPR_CHANGED_ON_INSNS): New macro.
(copy_expr_onside): Declare.
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 9257a9c7023..82d34477a8b 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -1677,6 +1677,9 @@ init_global_and_expr_for_insn (insn_t insn)
init_expr (INSN_EXPR (insn), vinsn_create (insn, force_unique_p), 0,
INSN_PRIORITY (insn), 0, spec_done_ds, 0, NULL);
}
+
+ INSN_ANALYZED_DEPS (insn) = BITMAP_ALLOC (NULL);
+ INSN_FOUND_DEPS (insn) = BITMAP_ALLOC (NULL);
}
static void extend_insn (void);
@@ -1710,6 +1713,9 @@ finish_global_and_expr_insn_1 (insn_t insn)
if (INSN_LUID (insn) > 0)
av_set_clear (&AV_SET (insn));
+
+ BITMAP_FREE (INSN_ANALYZED_DEPS (insn));
+ BITMAP_FREE (INSN_FOUND_DEPS (insn));
}
/* Perform stage 2 of finalization of the INSN's data. */
@@ -2507,6 +2513,9 @@ init_insn (insn_t insn)
change_vinsn_in_expr (expr, vinsn_create (insn, false));
INSN_SEQNO (insn) = ssid->seqno;
+
+ INSN_ANALYZED_DEPS (insn) = BITMAP_ALLOC (NULL);
+ INSN_FOUND_DEPS (insn) = BITMAP_ALLOC (NULL);
}
/* This is used to initialize spurious jumps generated by
@@ -2528,6 +2537,9 @@ init_simplejump (insn_t insn)
0, 0, NULL);
INSN_SEQNO (insn) = get_seqno_of_a_pred (insn);
+
+ INSN_ANALYZED_DEPS (insn) = BITMAP_ALLOC (NULL);
+ INSN_FOUND_DEPS (insn) = BITMAP_ALLOC (NULL);
}
/* This is used to move lv_sets to the first insn of basic block if that
diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index 8459ae9ca26..6d3b5ed14fe 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -552,15 +552,6 @@ struct vinsn_def
a single instruction that is in the stream. */
struct _sel_insn_data
{
- /* Insn is an ASM. */
- bool asm_p;
-
- /* This field is initialized at the beginning of scheduling and is used
- to handle sched group instructions. If it is non-null, then it points
- to the instruction, which should be forced to schedule next. Such
- instructions are unique. */
- insn_t sched_next;
-
/* Every insn in the stream has an associated vinsn. This is used
to reduce memory consumption and give use the fact that many insns
(all of them at the moment) don't change through the scheduler.
@@ -575,15 +566,32 @@ struct _sel_insn_data
int seqno;
- /* True when an insn is scheduled after we've determined that a stall is
- required.
- This is used when emulating the Haifa scheduler for bundling. */
- BOOL_BITFIELD after_stall_p : 1;
+ /* An INSN_LUID bit is set when deps analysis result is already known. */
+ bitmap analyzed_deps;
+
+ /* An INSN_LUID bit is set when a hard dep was found, not set when
+ no dependence is found. This is meaningful only when the analyzed_deps
+ bitmap has its bit set. */
+ bitmap found_deps;
+
+ /* Insn is an ASM. */
+ bool asm_p;
+
+ /* This field is initialized at the beginning of scheduling and is used
+ to handle sched group instructions. If it is non-null, then it points
+ to the instruction, which should be forced to schedule next. Such
+ instructions are unique. */
+ insn_t sched_next;
/* Cycle at which insn was scheduled. It is greater than zero if insn was
scheduled.
This is used for bundling. */
int sched_cycle;
+
+ /* True when an insn is scheduled after we've determined that a stall is
+ required.
+ This is used when emulating the Haifa scheduler for bundling. */
+ BOOL_BITFIELD after_stall_p : 1;
};
typedef struct _sel_insn_data sel_insn_data_def;
@@ -593,11 +601,13 @@ DEF_VEC_O (sel_insn_data_def);
DEF_VEC_ALLOC_O (sel_insn_data_def, heap);
extern VEC (sel_insn_data_def, heap) *s_i_d;
-/* Accessor macros for s_s_i_d. */
+/* Accessor macros for s_i_d. */
#define SID(INSN) (VEC_index (sel_insn_data_def, s_i_d, INSN_LUID (INSN)))
#define INSN_ASM_P(INSN) (SID (INSN)->asm_p)
#define INSN_SCHED_NEXT(INSN) (SID (INSN)->sched_next)
+#define INSN_ANALYZED_DEPS(INSN) (SID (INSN)->analyzed_deps)
+#define INSN_FOUND_DEPS(INSN) (SID (INSN)->found_deps)
#define INSN_EXPR(INSN) (&SID (INSN)->_expr)
#define INSN_VINSN(INSN) (RHS_VINSN (INSN_EXPR (INSN)))
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 90459270599..088a0385aab 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -1688,12 +1688,37 @@ moveup_set_rhs (av_set_t *avp, insn_t insn, bool inside_insn_group)
FOR_EACH_RHS_1 (rhs, i, avp)
{
+ int rhs_uid = INSN_UID (EXPR_INSN_RTX (rhs));
+ bool unique_p = VINSN_UNIQUE_P (RHS_VINSN (rhs));
+
line_start ();
dump_rhs (rhs);
+ /* First check whether we've analyzed this situation already. */
+ if (bitmap_bit_p (INSN_ANALYZED_DEPS (insn), rhs_uid))
+ {
+ if (bitmap_bit_p (INSN_FOUND_DEPS (insn), rhs_uid))
+ {
+ av_set_iter_remove (&i);
+ print (" - removed (cached)");
+ }
+ else
+ print (" - unchanged (cached)");
+
+ line_finish ();
+ continue;
+ }
+
switch (moveup_rhs (rhs, insn, inside_insn_group))
{
case MOVEUP_RHS_NULL:
+ /* Cache that there is a hard dependence. */
+ if (!unique_p)
+ {
+ bitmap_set_bit (INSN_ANALYZED_DEPS (insn), rhs_uid);
+ bitmap_set_bit (INSN_FOUND_DEPS (insn), rhs_uid);
+ }
+
av_set_iter_remove (&i);
print (" - removed");
break;
@@ -1723,6 +1748,13 @@ moveup_set_rhs (av_set_t *avp, insn_t insn, bool inside_insn_group)
}
break;
case MOVEUP_RHS_SAME:
+ /* Cache that there is a no dependence. */
+ if (!unique_p)
+ {
+ bitmap_set_bit (INSN_ANALYZED_DEPS (insn), rhs_uid);
+ bitmap_clear_bit (INSN_FOUND_DEPS (insn), rhs_uid);
+ }
+
print (" - unchanged");
break;
default: