Commit aae0390e by Jeffrey A Law Committed by Jeff Law

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
parent 81631c48
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> Sun Oct 17 11:02:52 1999 Mark Mitchell <mark@codesourcery.com>
* Makefile.in (ggc-common.o): Depend on genrtl.h. * Makefile.in (ggc-common.o): Depend on genrtl.h.
......
...@@ -248,8 +248,14 @@ static int *insn_luid; ...@@ -248,8 +248,14 @@ static int *insn_luid;
#define INSN_LUID(INSN) (insn_luid[INSN_UID (INSN)]) #define INSN_LUID(INSN) (insn_luid[INSN_UID (INSN)])
/* To speed up the test for duplicate dependency links we keep a record /* 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 Each insn has an associated bitmap for its dependencies. Each bitmap
has enough entries to represent a dependency on any other insn in the has enough entries to represent a dependency on any other insn in the
insn chain. */ insn chain. */
...@@ -794,7 +800,8 @@ add_dependence (insn, elem, dep_type) ...@@ -794,7 +800,8 @@ add_dependence (insn, elem, dep_type)
/* If we already have a true dependency for ELEM, then we do not /* If we already have a true dependency for ELEM, then we do not
need to do anything. Avoiding the list walk below can cut need to do anything. Avoiding the list walk below can cut
compile times dramatically for some code. */ 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; return;
/* Check that we don't already have this dependence. */ /* Check that we don't already have this dependence. */
...@@ -808,7 +815,7 @@ add_dependence (insn, elem, dep_type) ...@@ -808,7 +815,7 @@ add_dependence (insn, elem, dep_type)
/* If we are adding a true dependency to INSN's LOG_LINKs, then /* If we are adding a true dependency to INSN's LOG_LINKs, then
note that in the bitmap cache of true dependency information. */ 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)); SET_BIT (true_dependency_cache[INSN_LUID (insn)], INSN_LUID (elem));
return; return;
} }
...@@ -844,7 +851,7 @@ remove_dependence (insn, elem) ...@@ -844,7 +851,7 @@ remove_dependence (insn, elem)
/* If we are removing a true dependency from the LOG_LINKS list, /* If we are removing a true dependency from the LOG_LINKS list,
make sure to remove it from the cache too. */ 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)], RESET_BIT (true_dependency_cache[INSN_LUID (insn)],
INSN_LUID (elem)); INSN_LUID (elem));
...@@ -6876,9 +6883,15 @@ schedule_insns (dump_file) ...@@ -6876,9 +6883,15 @@ schedule_insns (dump_file)
/* ?!? We could save some memory by computing a per-region luid mapping /* ?!? 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 which could reduce both the number of vectors in the cache and the size
of each vector. */ of each vector. Instead we just avoid the cache entirely unless the
true_dependency_cache = sbitmap_vector_alloc (luid, luid); average number of instructions in a basic block is very high. See
sbitmap_vector_zero (true_dependency_cache, luid); 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; nr_regions = 0;
rgn_table = (region *) alloca ((n_basic_blocks) * sizeof (region)); rgn_table = (region *) alloca ((n_basic_blocks) * sizeof (region));
...@@ -7047,7 +7060,11 @@ schedule_insns (dump_file) ...@@ -7047,7 +7060,11 @@ schedule_insns (dump_file)
fprintf (dump, "\n\n"); fprintf (dump, "\n\n");
} }
free (true_dependency_cache); if (true_dependency_cache)
{
free (true_dependency_cache);
true_depdency_cache = NULL;
}
free (cant_move); free (cant_move);
free (fed_by_spec_load); free (fed_by_spec_load);
free (is_load_insn); free (is_load_insn);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment