diff options
author | bernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-27 14:17:36 +0000 |
---|---|---|
committer | bernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-27 14:17:36 +0000 |
commit | 6c2d9e41bd78b2d0671431f523933ff3606db874 (patch) | |
tree | c11396d3bdf8e3a81e9606d61321ebfaf8526942 /gcc/sched-deps.c | |
parent | 414a9d63ca2871b389705f0e34b2bddacdfa9009 (diff) | |
download | gcc-6c2d9e41bd78b2d0671431f523933ff3606db874.tar.gz |
* sched-int.h (struct _haifa_deps_insn_data): New members cond
and reverse_cond.
(INSN_COND, INSN_REVERSE_COND): New macros.
* sched-deps.c (deps_analyze_insn): Call sched_get_condition_with_rev
once.
(sched_get_condition_with_rev): Cache the results, and look them up
if possible.
(sched_analyze_insn): Destroy INSN_COND of previous insns if they
are clobbered by the current insn.
* target.def (exposed_pipline): New sched data hook.
* doc/tm.texi.in: TARGET_SCHED_EXPOSED_PIPELINE: Add hook.
* doc/tm.texi: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174336 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sched-deps.c')
-rw-r--r-- | gcc/sched-deps.c | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index 09bf65d9093..343d03ce962 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -488,13 +488,27 @@ deps_may_trap_p (const_rtx mem) /* 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 - 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 sched_get_condition_with_rev (const_rtx insn, bool *rev) { rtx pat = PATTERN (insn); 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) return 0; @@ -502,7 +516,10 @@ sched_get_condition_with_rev (const_rtx insn, bool *rev) *rev = false; 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)) return 0; @@ -510,7 +527,10 @@ sched_get_condition_with_rev (const_rtx insn, bool *rev) src = SET_SRC (pc_set (insn)); 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) { rtx cond = XEXP (src, 0); @@ -521,6 +541,8 @@ sched_get_condition_with_rev (const_rtx insn, bool *rev) if (rev) *rev = true; + INSN_COND (insn) = cond; + INSN_REVERSE_COND (insn) = true; return cond; } @@ -2818,6 +2840,8 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx insn) } else { + regset_head set_or_clobbered; + EXECUTE_IF_SET_IN_REG_SET (reg_pending_uses, 0, i, rsi) { struct deps_reg *reg_last = &deps->reg_last[i]; @@ -2848,6 +2872,25 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx insn) } } + if (targetm.sched.exposed_pipeline) + { + INIT_REG_SET (&set_or_clobbered); + bitmap_ior (&set_or_clobbered, reg_pending_clobbers, + reg_pending_sets); + EXECUTE_IF_SET_IN_REG_SET (&set_or_clobbered, 0, i, rsi) + { + struct deps_reg *reg_last = &deps->reg_last[i]; + rtx list; + for (list = reg_last->uses; list; list = XEXP (list, 1)) + { + rtx other = XEXP (list, 0); + if (INSN_COND (other) != const_true_rtx + && refers_to_regno_p (i, i + 1, INSN_COND (other), NULL)) + INSN_COND (other) = const_true_rtx; + } + } + } + /* If the current insn is conditional, we can't free any of the lists. */ if (sched_has_condition_p (insn)) @@ -3222,6 +3265,10 @@ deps_analyze_insn (struct deps_desc *deps, rtx insn) if (sched_deps_info->start_insn) sched_deps_info->start_insn (insn); + /* Record the condition for this insn. */ + if (NONDEBUG_INSN_P (insn)) + sched_get_condition_with_rev (insn, NULL); + if (NONJUMP_INSN_P (insn) || DEBUG_INSN_P (insn) || JUMP_P (insn)) { /* Make each JUMP_INSN (but not a speculative check) |