* Scheduler cleanups, 3/N
@ 2011-03-24 13:12 Bernd Schmidt
2011-03-31 13:45 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Bernd Schmidt @ 2011-03-24 13:12 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 260 bytes --]
This caches dependency costs. The target adjust_cost macro can be quite
expensive. This may not make much of a difference now, but in the final
backtracking scheduler patches (which I'm omitting for the moment) we
look at these costs a bit more often.
Bernd
[-- Attachment #2: depcost.diff --]
[-- Type: text/plain, Size: 2532 bytes --]
gcc/
* sched-int.h (struct _dep): New member COST.
(DEP_COST): New macro.
(UNKNOWN_DEP_COST): Define.
* sched-deps.c (init_dep_1): Initialize cost member.
* haifa-sched.c (dep_cost_1): Use precomputed cost if available,
compute and set it otherwise.
(sched_change_pattern): Reset costs of dependencies.
Index: gcc/haifa-sched.c
===================================================================
--- gcc/haifa-sched.c.orig
+++ gcc/haifa-sched.c
@@ -845,6 +845,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
@@ -902,6 +905,7 @@ dep_cost_1 (dep_t link, dw_t dw)
cost = 0;
}
+ DEP_COST (link) = cost;
return cost;
}
@@ -4854,11 +4858,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
Index: gcc/sched-deps.c
===================================================================
--- gcc/sched-deps.c.orig
+++ gcc/sched-deps.c
@@ -106,6 +106,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.
Index: gcc/sched-int.h
===================================================================
--- gcc/sched-int.h.orig
+++ gcc/sched-int.h
@@ -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. */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Scheduler cleanups, 3/N
2011-03-24 13:12 Scheduler cleanups, 3/N Bernd Schmidt
@ 2011-03-31 13:45 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2011-03-31 13:45 UTC (permalink / raw)
To: Bernd Schmidt; +Cc: GCC Patches
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 03/24/11 07:11, Bernd Schmidt wrote:
> This caches dependency costs. The target adjust_cost macro can be quite
> expensive. This may not make much of a difference now, but in the final
> backtracking scheduler patches (which I'm omitting for the moment) we
> look at these costs a bit more often.
OK.
jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJNlILDAAoJEBRtltQi2kC7H2wH/32ILTHA9+jAROHzIs0GBrvU
t2w6ir6R2ZpMFWTpOVUoDF1Hzx/SIw8AQjxY0bpFIdZoUuyRSv8O/SOBJuhgOsi9
s0VZBcfKc56sp5oDKVWsPzQ2V8sjR3IhSkA0YcdsVv/Z9cZNDRKmeqCc7mHdTDa5
i4m+WWcRpFquM8tDfzjz4NcS/hxBP5I1+u36fDiGcDexsGVqH+Ev9VNABsKxaMZI
1sCF2GcC58IpFa1yA9AZQwiKgitwhMzcqliyxkNfNGcmydE7OQhqQMDuk8PVzFaE
4iCmhPFOXjBOe5EcpOEQipKupDWEbHfOV5MT1RWUKTODjltQMgKeAwwquMtFt/0=
=4PES
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-31 13:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-24 13:12 Scheduler cleanups, 3/N Bernd Schmidt
2011-03-31 13:45 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).