===================================================================
@@ -855,6 +855,9 @@ dep_cost_1 (dep_t link, dw_t dw)
rtx used = DEP_CON (link);
int cost;
+ if (DEP_COST (link) != UNKNOWN_DEP_COST)
+ return DEP_COST (link);
+
/* A USE insn should never require the value used to be computed.
This allows the computation of a function's result and parameter
values to overlap the return and call. We don't care about the
@@ -912,6 +915,7 @@ dep_cost_1 (dep_t link, dw_t dw)
cost = 0;
}
+ DEP_COST (link) = cost;
return cost;
}
@@ -4874,11 +4878,20 @@ fix_recovery_deps (basic_block rec)
void
sched_change_pattern (rtx insn, rtx new_pat)
{
+ sd_iterator_def sd_it;
+ dep_t dep;
int t;
t = validate_change (insn, &PATTERN (insn), new_pat, 0);
gcc_assert (t);
dfa_clear_single_insn_cache (insn);
+
+ for (sd_it = sd_iterator_start (insn, SD_LIST_FORW | SD_LIST_BACK);
+ sd_iterator_cond (&sd_it, &dep);)
+ {
+ DEP_COST (dep) = UNKNOWN_DEP_COST;
+ sd_iterator_next (&sd_it);
+ }
}
/* Change pattern of INSN to NEW_PAT. Invalidate cached haifa
===================================================================
@@ -107,6 +107,7 @@ init_dep_1 (dep_t dep, rtx pro, rtx con,
DEP_CON (dep) = con;
DEP_TYPE (dep) = type;
DEP_STATUS (dep) = ds;
+ DEP_COST (dep) = UNKNOWN_DEP_COST;
}
/* Init DEP with the arguments.
===================================================================
@@ -239,6 +239,9 @@ struct _dep
/* Dependency status. This field holds all dependency types and additional
information for speculative dependencies. */
ds_t status;
+
+ /* Cached cost of the dependency. */
+ int cost;
};
typedef struct _dep dep_def;
@@ -248,6 +251,9 @@ typedef dep_def *dep_t;
#define DEP_CON(D) ((D)->con)
#define DEP_TYPE(D) ((D)->type)
#define DEP_STATUS(D) ((D)->status)
+#define DEP_COST(D) ((D)->cost)
+
+#define UNKNOWN_DEP_COST INT_MIN
/* Functions to work with dep. */