aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-inline-analysis.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2018-06-08 14:31:09 +0200
committerMartin Liska <marxin@gcc.gnu.org>2018-06-08 12:31:09 +0000
commit9fb50ad822bd57786b12a2fc90c61032c519a621 (patch)
tree167105a5677e1cdfe7a5f9f9b37b02b13340a447 /gcc/ipa-inline-analysis.c
parent1ac2bdb45faaa455afcb3b77eb824dde429c27fb (diff)
downloadgcc-9fb50ad822bd57786b12a2fc90c61032c519a621.zip
gcc-9fb50ad822bd57786b12a2fc90c61032c519a621.tar.gz
gcc-9fb50ad822bd57786b12a2fc90c61032c519a621.tar.bz2
Port edge_growth_cache to call_summary.
2018-06-08 Martin Liska <mliska@suse.cz> * ipa-inline-analysis.c (inline_edge_removal_hook): Remove. (initialize_growth_caches): Remove. (free_growth_caches): Likewise. (do_estimate_edge_time): Use edge_growth_cache. (do_estimate_edge_size): Likewise. (do_estimate_edge_hints): Likewise. * ipa-inline.c (reset_edge_caches): Likewise. (recursive_inlining): Likewise. (inline_small_functions): Likewise. * ipa-inline.h (initialize_growth_caches): Remove. (estimate_edge_size): Likewise. (estimate_edge_time): Likewise. (estimate_edge_hints): Likewise. (reset_edge_growth_cache): Likewise. * symbol-summary.h (call_summary::remove): New method. From-SVN: r261318
Diffstat (limited to 'gcc/ipa-inline-analysis.c')
-rw-r--r--gcc/ipa-inline-analysis.c57
1 files changed, 14 insertions, 43 deletions
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 2e30a6d..9a72673 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -51,9 +51,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimplify.h"
/* Cached node/edge growths. */
-vec<edge_growth_cache_entry> edge_growth_cache;
-static struct cgraph_edge_hook_list *edge_removal_hook_holder;
-
+call_summary<edge_growth_cache_entry *> *edge_growth_cache = NULL;
/* Give initial reasons why inlining would fail on EDGE. This gets either
nullified or usually overwritten by more precise reasons later. */
@@ -80,40 +78,13 @@ initialize_inline_failed (struct cgraph_edge *e)
}
-/* Keep edge cache consistent across edge removal. */
-
-static void
-inline_edge_removal_hook (struct cgraph_edge *edge,
- void *data ATTRIBUTE_UNUSED)
-{
- reset_edge_growth_cache (edge);
-}
-
-
-/* Initialize growth caches. */
-
-void
-initialize_growth_caches (void)
-{
- if (!edge_removal_hook_holder)
- edge_removal_hook_holder =
- symtab->add_edge_removal_hook (&inline_edge_removal_hook, NULL);
- if (symtab->edges_max_uid)
- edge_growth_cache.safe_grow_cleared (symtab->edges_max_uid);
-}
-
-
/* Free growth caches. */
void
free_growth_caches (void)
{
- if (edge_removal_hook_holder)
- {
- symtab->remove_edge_removal_hook (edge_removal_hook_holder);
- edge_removal_hook_holder = NULL;
- }
- edge_growth_cache.release ();
+ delete edge_growth_cache;
+ edge_growth_cache = NULL;
}
/* Return hints derrived from EDGE. */
@@ -188,17 +159,17 @@ do_estimate_edge_time (struct cgraph_edge *edge)
gcc_checking_assert (time >= 0);
/* When caching, update the cache entry. */
- if (edge_growth_cache.exists ())
+ if (edge_growth_cache != NULL)
{
ipa_fn_summaries->get_create (edge->callee)->min_size = min_size;
- if ((int) edge_growth_cache.length () <= edge->uid)
- edge_growth_cache.safe_grow_cleared (symtab->edges_max_uid);
- edge_growth_cache[edge->uid].time = time;
- edge_growth_cache[edge->uid].nonspec_time = nonspec_time;
+ edge_growth_cache_entry *entry
+ = edge_growth_cache->get_create (edge);
+ entry->time = time;
+ entry->nonspec_time = nonspec_time;
- edge_growth_cache[edge->uid].size = size + (size >= 0);
+ entry->size = size + (size >= 0);
hints |= simple_edge_hints (edge);
- edge_growth_cache[edge->uid].hints = hints + 1;
+ entry->hints = hints + 1;
}
return time;
}
@@ -219,10 +190,10 @@ do_estimate_edge_size (struct cgraph_edge *edge)
/* When we do caching, use do_estimate_edge_time to populate the entry. */
- if (edge_growth_cache.exists ())
+ if (edge_growth_cache != NULL)
{
do_estimate_edge_time (edge);
- size = edge_growth_cache[edge->uid].size;
+ size = edge_growth_cache->get (edge)->size;
gcc_checking_assert (size);
return size - (size > 0);
}
@@ -260,10 +231,10 @@ do_estimate_edge_hints (struct cgraph_edge *edge)
/* When we do caching, use do_estimate_edge_time to populate the entry. */
- if (edge_growth_cache.exists ())
+ if (edge_growth_cache != NULL)
{
do_estimate_edge_time (edge);
- hints = edge_growth_cache[edge->uid].hints;
+ hints = edge_growth_cache->get (edge)->hints;
gcc_checking_assert (hints);
return hints - 1;
}