aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@codesourcery.com>2011-07-13 10:18:32 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2011-07-13 10:18:32 +0000
commita19af9c4e401e168f46180adab9210a6fdb1757e (patch)
treefb8bf8be019b0110f5a291264ebbc7b8c6c33ab7 /gcc
parent2d1efe2d2d19872257bffb1561838805eb5f4fab (diff)
downloadgcc-a19af9c4e401e168f46180adab9210a6fdb1757e.zip
gcc-a19af9c4e401e168f46180adab9210a6fdb1757e.tar.gz
gcc-a19af9c4e401e168f46180adab9210a6fdb1757e.tar.bz2
sched-int.h (struct _dep): Add member cost.
* sched-int.h (struct _dep): Add member cost. (DEP_COST, UNKNOWN_DEP_COST): New macros. * sched-deps.c (init_dep_1): Initialize DEP_COST. * haifa-sched.c (dep_cost_1): Use and set DEP_COST. (sched_change_pattern): Reset it for dependent insns. From-SVN: r176226
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/haifa-sched.c14
-rw-r--r--gcc/sched-deps.c1
-rw-r--r--gcc/sched-int.h6
4 files changed, 29 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6b83a43..3e604c4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2011-07-13 Bernd Schmidt <bernds@codesourcery.com>
+
+ * sched-int.h (struct _dep): Add member cost.
+ (DEP_COST, UNKNOWN_DEP_COST): New macros.
+ * sched-deps.c (init_dep_1): Initialize DEP_COST.
+ * haifa-sched.c (dep_cost_1): Use and set DEP_COST.
+ (sched_change_pattern): Reset it for dependent insns.
+
2011-07-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* Makefile.in (CRT0STUFF_T_CFLAGS): Remove.
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index f4caecd..bc36d07 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -854,6 +854,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
@@ -911,6 +914,7 @@ dep_cost_1 (dep_t link, dw_t dw)
cost = 0;
}
+ DEP_COST (link) = cost;
return cost;
}
@@ -4865,11 +4869,21 @@ 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_LIST_RES_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
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 343d03c..4ceea72 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -107,6 +107,7 @@ init_dep_1 (dep_t dep, rtx pro, rtx con, enum reg_note type, ds_t ds)
DEP_CON (dep) = con;
DEP_TYPE (dep) = type;
DEP_STATUS (dep) = ds;
+ DEP_COST (dep) = UNKNOWN_DEP_COST;
}
/* Init DEP with the arguments.
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index f310f8a..8b39a22 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -215,6 +215,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;
@@ -224,6 +227,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. */