diff options
author | Kazu Hirata <kazu@cs.umass.edu> | 2005-02-22 15:42:25 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2005-02-22 15:42:25 +0000 |
commit | e2c879a1333c185ffac0e8c4da749ac1a09ca6ce (patch) | |
tree | d3f550f669389b94a6ae1c48cf11123e7ac1e744 /gcc | |
parent | 554beb3a44a24e429ea64b3b77bd7c95990b4849 (diff) | |
download | gcc-e2c879a1333c185ffac0e8c4da749ac1a09ca6ce.zip gcc-e2c879a1333c185ffac0e8c4da749ac1a09ca6ce.tar.gz gcc-e2c879a1333c185ffac0e8c4da749ac1a09ca6ce.tar.bz2 |
cfg.c (cached_make_edge): Call make_edge if edge cache is not available.
* cfg.c (cached_make_edge): Call make_edge if edge cache is
not available. Use tail calls wherever possible.
(make_edge): Call unchecked_make_edge to create an edge.
From-SVN: r95396
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cfg.c | 61 |
2 files changed, 34 insertions, 33 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 83a8a0f..a7274af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-02-22 Kazu Hirata <kazu@cs.umass.edu> + + * cfg.c (cached_make_edge): Call make_edge if edge cache is + not available. Use tail calls wherever possible. + (make_edge): Call unchecked_make_edge to create an edge. + 2005-02-22 Diego Novillo <dnovillo@redhat.com> * tree-into-ssa.c (rewrite_blocks): Move debug dumps from ... @@ -273,43 +273,29 @@ unchecked_make_edge (basic_block src, basic_block dst, int flags) edge cached_make_edge (sbitmap *edge_cache, basic_block src, basic_block dst, int flags) { - int use_edge_cache; - edge e; - - /* Don't bother with edge cache for ENTRY or EXIT, if there aren't that - many edges to them, or we didn't allocate memory for it. */ - use_edge_cache = (edge_cache - && src != ENTRY_BLOCK_PTR && dst != EXIT_BLOCK_PTR); + if (edge_cache == NULL + || src == ENTRY_BLOCK_PTR + || dst == EXIT_BLOCK_PTR) + return make_edge (src, dst, flags); - /* Make sure we don't add duplicate edges. */ - switch (use_edge_cache) + /* Does the requested edge already exist? */ + if (! TEST_BIT (edge_cache[src->index], dst->index)) { - default: - /* Quick test for non-existence of the edge. */ - if (! TEST_BIT (edge_cache[src->index], dst->index)) - break; - - /* The edge exists; early exit if no work to do. */ - if (flags == 0) - return NULL; - - /* Fall through. */ - case 0: - e = find_edge (src, dst); - if (e) - { - e->flags |= flags; - return NULL; - } - break; + /* The edge does not exist. Create one and update the + cache. */ + SET_BIT (edge_cache[src->index], dst->index); + return unchecked_make_edge (src, dst, flags); } - e = unchecked_make_edge (src, dst, flags); - - if (use_edge_cache) - SET_BIT (edge_cache[src->index], dst->index); + /* At this point, we know that the requested edge exists. Adjust + flags if necessary. */ + if (flags) + { + edge e = find_edge (src, dst); + e->flags |= flags; + } - return e; + return NULL; } /* Create an edge connecting SRC and DEST with flags FLAGS. Return newly @@ -318,7 +304,16 @@ cached_make_edge (sbitmap *edge_cache, basic_block src, basic_block dst, int fla edge make_edge (basic_block src, basic_block dest, int flags) { - return cached_make_edge (NULL, src, dest, flags); + edge e = find_edge (src, dest); + + /* Make sure we don't add duplicate edges. */ + if (e) + { + e->flags |= flags; + return NULL; + } + + return unchecked_make_edge (src, dest, flags); } /* Create an edge connecting SRC to DEST and set probability by knowing |