Commit f0898307 by Sergey Grechanik Committed by Alexander Monakov

sched-deps.c (sched_get_condition_with_rev): Rename to ...

2011-08-11  Sergey Grechanik  <mouseentity@ispras.ru>
	    Alexander Monakov  <amonakov@ispras.ru>

	* sched-deps.c (sched_get_condition_with_rev): Rename to ...
	(sched_get_condition_with_rev_uncached): ... this.  Factor out
	condition caching logic into ...
	(sched_get_condition_with_rev): ... this.  Reimplement.  Do not
	attempt to use cache for instructions with zero luid.
	(sched_analyze_insn): Use INSN_CACHED_COND instead of INSN_COND.
	* sched-int.h (INSN_COND): Rename to INSN_CACHED_COND.


Co-Authored-By: Alexander Monakov <amonakov@ispras.ru>

From-SVN: r177657
parent 0d9439b0
2011-08-11 Sergey Grechanik <mouseentity@ispras.ru> 2011-08-11 Sergey Grechanik <mouseentity@ispras.ru>
Alexander Monakov <amonakov@ispras.ru>
* sched-deps.c (sched_get_condition_with_rev): Rename to ...
(sched_get_condition_with_rev_uncached): ... this. Factor out
condition caching logic into ...
(sched_get_condition_with_rev): ... this. Reimplement. Do not
attempt to use cache for instructions with zero luid.
(sched_analyze_insn): Use INSN_CACHED_COND instead of INSN_COND.
* sched-int.h (INSN_COND): Rename to INSN_CACHED_COND.
2011-08-11 Sergey Grechanik <mouseentity@ispras.ru>
* sel-sched-ir.c (get_seqno_of_a_pred): Rename to * sel-sched-ir.c (get_seqno_of_a_pred): Rename to
get_seqno_for_a_jump. Update the caller. get_seqno_for_a_jump. Update the caller.
......
...@@ -499,27 +499,13 @@ deps_may_trap_p (const_rtx mem) ...@@ -499,27 +499,13 @@ deps_may_trap_p (const_rtx mem)
/* Find the condition under which INSN is executed. If REV is not NULL, /* Find the condition under which INSN is executed. If REV is not NULL,
it is set to TRUE when the returned comparison should be reversed it is set to TRUE when the returned comparison should be reversed
to get the actual condition. to get the actual condition. */
We only do actual work the first time we come here for an insn; the
results are cached in INSN_COND and INSN_REVERSE_COND. */
static rtx static rtx
sched_get_condition_with_rev (const_rtx insn, bool *rev) sched_get_condition_with_rev_uncached (const_rtx insn, bool *rev)
{ {
rtx pat = PATTERN (insn); rtx pat = PATTERN (insn);
rtx src; rtx src;
if (INSN_COND (insn) == const_true_rtx)
return NULL_RTX;
if (INSN_COND (insn) != NULL_RTX)
{
if (rev)
*rev = INSN_REVERSE_COND (insn);
return INSN_COND (insn);
}
INSN_COND (insn) = const_true_rtx;
INSN_REVERSE_COND (insn) = false;
if (pat == 0) if (pat == 0)
return 0; return 0;
...@@ -527,10 +513,7 @@ sched_get_condition_with_rev (const_rtx insn, bool *rev) ...@@ -527,10 +513,7 @@ sched_get_condition_with_rev (const_rtx insn, bool *rev)
*rev = false; *rev = false;
if (GET_CODE (pat) == COND_EXEC) if (GET_CODE (pat) == COND_EXEC)
{ return COND_EXEC_TEST (pat);
INSN_COND (insn) = COND_EXEC_TEST (pat);
return COND_EXEC_TEST (pat);
}
if (!any_condjump_p (insn) || !onlyjump_p (insn)) if (!any_condjump_p (insn) || !onlyjump_p (insn))
return 0; return 0;
...@@ -538,10 +521,7 @@ sched_get_condition_with_rev (const_rtx insn, bool *rev) ...@@ -538,10 +521,7 @@ sched_get_condition_with_rev (const_rtx insn, bool *rev)
src = SET_SRC (pc_set (insn)); src = SET_SRC (pc_set (insn));
if (XEXP (src, 2) == pc_rtx) if (XEXP (src, 2) == pc_rtx)
{ return XEXP (src, 0);
INSN_COND (insn) = XEXP (src, 0);
return XEXP (src, 0);
}
else if (XEXP (src, 1) == pc_rtx) else if (XEXP (src, 1) == pc_rtx)
{ {
rtx cond = XEXP (src, 0); rtx cond = XEXP (src, 0);
...@@ -552,14 +532,47 @@ sched_get_condition_with_rev (const_rtx insn, bool *rev) ...@@ -552,14 +532,47 @@ sched_get_condition_with_rev (const_rtx insn, bool *rev)
if (rev) if (rev)
*rev = true; *rev = true;
INSN_COND (insn) = cond;
INSN_REVERSE_COND (insn) = true;
return cond; return cond;
} }
return 0; return 0;
} }
/* Caching variant of sched_get_condition_with_rev_uncached.
We only do actual work the first time we come here for an insn; the
results are cached in INSN_CACHED_COND and INSN_REVERSE_COND. */
static rtx
sched_get_condition_with_rev (const_rtx insn, bool *rev)
{
bool tmp;
if (INSN_LUID (insn) == 0)
return sched_get_condition_with_rev_uncached (insn, rev);
if (INSN_CACHED_COND (insn) == const_true_rtx)
return NULL_RTX;
if (INSN_CACHED_COND (insn) != NULL_RTX)
{
if (rev)
*rev = INSN_REVERSE_COND (insn);
return INSN_CACHED_COND (insn);
}
INSN_CACHED_COND (insn) = sched_get_condition_with_rev_uncached (insn, &tmp);
INSN_REVERSE_COND (insn) = tmp;
if (INSN_CACHED_COND (insn) == NULL_RTX)
{
INSN_CACHED_COND (insn) = const_true_rtx;
return NULL_RTX;
}
if (rev)
*rev = INSN_REVERSE_COND (insn);
return INSN_CACHED_COND (insn);
}
/* True when we can find a condition under which INSN is executed. */ /* True when we can find a condition under which INSN is executed. */
static bool static bool
sched_has_condition_p (const_rtx insn) sched_has_condition_p (const_rtx insn)
...@@ -2910,9 +2923,9 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx insn) ...@@ -2910,9 +2923,9 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx insn)
for (list = reg_last->uses; list; list = XEXP (list, 1)) for (list = reg_last->uses; list; list = XEXP (list, 1))
{ {
rtx other = XEXP (list, 0); rtx other = XEXP (list, 0);
if (INSN_COND (other) != const_true_rtx if (INSN_CACHED_COND (other) != const_true_rtx
&& refers_to_regno_p (i, i + 1, INSN_COND (other), NULL)) && refers_to_regno_p (i, i + 1, INSN_CACHED_COND (other), NULL))
INSN_COND (other) = const_true_rtx; INSN_CACHED_COND (other) = const_true_rtx;
} }
} }
} }
......
...@@ -875,7 +875,7 @@ extern VEC(haifa_deps_insn_data_def, heap) *h_d_i_d; ...@@ -875,7 +875,7 @@ extern VEC(haifa_deps_insn_data_def, heap) *h_d_i_d;
#define INSN_RESOLVED_FORW_DEPS(INSN) (HDID (INSN)->resolved_forw_deps) #define INSN_RESOLVED_FORW_DEPS(INSN) (HDID (INSN)->resolved_forw_deps)
#define INSN_HARD_BACK_DEPS(INSN) (HDID (INSN)->hard_back_deps) #define INSN_HARD_BACK_DEPS(INSN) (HDID (INSN)->hard_back_deps)
#define INSN_SPEC_BACK_DEPS(INSN) (HDID (INSN)->spec_back_deps) #define INSN_SPEC_BACK_DEPS(INSN) (HDID (INSN)->spec_back_deps)
#define INSN_COND(INSN) (HDID (INSN)->cond) #define INSN_CACHED_COND(INSN) (HDID (INSN)->cond)
#define INSN_REVERSE_COND(INSN) (HDID (INSN)->reverse_cond) #define INSN_REVERSE_COND(INSN) (HDID (INSN)->reverse_cond)
#define CANT_MOVE(INSN) (HDID (INSN)->cant_move) #define CANT_MOVE(INSN) (HDID (INSN)->cant_move)
#define CANT_MOVE_BY_LUID(LUID) (VEC_index (haifa_deps_insn_data_def, h_d_i_d, \ #define CANT_MOVE_BY_LUID(LUID) (VEC_index (haifa_deps_insn_data_def, h_d_i_d, \
......
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