aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1999-10-17 21:27:56 +0000
committerJeff Law <law@gcc.gnu.org>1999-10-17 15:27:56 -0600
commitaae0390e20fec7d53bb9ba5597928df554c10a82 (patch)
treec0a94172c67a3c129ecf60256c13ef06eebbb444
parent81631c486ea7b8a6909e40e5f7f9c560a1039f54 (diff)
downloadgcc-aae0390e20fec7d53bb9ba5597928df554c10a82.zip
gcc-aae0390e20fec7d53bb9ba5597928df554c10a82.tar.gz
gcc-aae0390e20fec7d53bb9ba5597928df554c10a82.tar.bz2
haifa-sched.c (add_dependence): Only check/update the cache if it exists.
* haifa-sched.c (add_dependence): Only check/update the cache if it exists. (remove_dependence): Likewise. (schedule_insns): Only create the true_dependency_cache if the average number of instructions in a basic block is very large. From-SVN: r30058
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/haifa-sched.c33
2 files changed, 33 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1a161f52..e4feac5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+Sun Oct 17 15:22:50 1999 Jeffrey A Law (law@cygnus.com)
+
+ * haifa-sched.c (add_dependence): Only check/update the cache
+ if it exists.
+ (remove_dependence): Likewise.
+ (schedule_insns): Only create the true_dependency_cache if the
+ average number of instructions in a basic block is very large.
+
Sun Oct 17 11:02:52 1999 Mark Mitchell <mark@codesourcery.com>
* Makefile.in (ggc-common.o): Depend on genrtl.h.
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 7279226..9fd844b 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -248,8 +248,14 @@ static int *insn_luid;
#define INSN_LUID(INSN) (insn_luid[INSN_UID (INSN)])
/* To speed up the test for duplicate dependency links we keep a record
- of true dependencies created by add_dependence.
+ of true dependencies created by add_dependence when the average number
+ of instructions in a basic block is very large.
+ Studies have shown that there is typically around 5 instructions between
+ branches for typical C code. So we can make a guess that the average
+ basic block is approximately 5 instructions long; we will choose 100X
+ the average size as a very large basic block.
+
Each insn has an associated bitmap for its dependencies. Each bitmap
has enough entries to represent a dependency on any other insn in the
insn chain. */
@@ -794,7 +800,8 @@ add_dependence (insn, elem, dep_type)
/* If we already have a true dependency for ELEM, then we do not
need to do anything. Avoiding the list walk below can cut
compile times dramatically for some code. */
- if (TEST_BIT (true_dependency_cache[INSN_LUID (insn)], INSN_LUID (elem)))
+ if (true_dependency_cache
+ && TEST_BIT (true_dependency_cache[INSN_LUID (insn)], INSN_LUID (elem)))
return;
/* Check that we don't already have this dependence. */
@@ -808,7 +815,7 @@ add_dependence (insn, elem, dep_type)
/* If we are adding a true dependency to INSN's LOG_LINKs, then
note that in the bitmap cache of true dependency information. */
- if ((int)dep_type == 0)
+ if ((int)dep_type == 0 && true_dependency_cache)
SET_BIT (true_dependency_cache[INSN_LUID (insn)], INSN_LUID (elem));
return;
}
@@ -844,7 +851,7 @@ remove_dependence (insn, elem)
/* If we are removing a true dependency from the LOG_LINKS list,
make sure to remove it from the cache too. */
- if (REG_NOTE_KIND (link) == 0)
+ if (REG_NOTE_KIND (link) == 0 && true_dependency_cache)
RESET_BIT (true_dependency_cache[INSN_LUID (insn)],
INSN_LUID (elem));
@@ -6876,9 +6883,15 @@ schedule_insns (dump_file)
/* ?!? We could save some memory by computing a per-region luid mapping
which could reduce both the number of vectors in the cache and the size
- of each vector. */
- true_dependency_cache = sbitmap_vector_alloc (luid, luid);
- sbitmap_vector_zero (true_dependency_cache, luid);
+ of each vector. Instead we just avoid the cache entirely unless the
+ average number of instructions in a basic block is very high. See
+ the comment before the declaration of true_dependency_cache for
+ what we consider "very high". */
+ if (luid / n_basic_blocks > 100 * 5)
+ {
+ true_dependency_cache = sbitmap_vector_alloc (luid, luid);
+ sbitmap_vector_zero (true_dependency_cache, luid);
+ }
nr_regions = 0;
rgn_table = (region *) alloca ((n_basic_blocks) * sizeof (region));
@@ -7047,7 +7060,11 @@ schedule_insns (dump_file)
fprintf (dump, "\n\n");
}
- free (true_dependency_cache);
+ if (true_dependency_cache)
+ {
+ free (true_dependency_cache);
+ true_depdency_cache = NULL;
+ }
free (cant_move);
free (fed_by_spec_load);
free (is_load_insn);