aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-inline.h
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.h
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.h')
-rw-r--r--gcc/ipa-inline.h44
1 files changed, 17 insertions, 27 deletions
diff --git a/gcc/ipa-inline.h b/gcc/ipa-inline.h
index 06bd38e..15825bc 100644
--- a/gcc/ipa-inline.h
+++ b/gcc/ipa-inline.h
@@ -38,7 +38,7 @@ struct edge_growth_cache_entry
hints (hints) {}
};
-extern vec<edge_growth_cache_entry> edge_growth_cache;
+extern call_summary<edge_growth_cache_entry *> *edge_growth_cache;
/* In ipa-inline-analysis.c */
int estimate_size_after_inlining (struct cgraph_node *, struct cgraph_edge *);
@@ -47,7 +47,6 @@ bool growth_likely_positive (struct cgraph_node *, int);
int do_estimate_edge_size (struct cgraph_edge *edge);
sreal do_estimate_edge_time (struct cgraph_edge *edge);
ipa_hints do_estimate_edge_hints (struct cgraph_edge *edge);
-void initialize_growth_caches (void);
void free_growth_caches (void);
/* In ipa-inline.c */
@@ -69,11 +68,12 @@ extern int nfunctions_inlined;
static inline int
estimate_edge_size (struct cgraph_edge *edge)
{
- int ret;
- if ((int)edge_growth_cache.length () <= edge->uid
- || !(ret = edge_growth_cache[edge->uid].size))
+ edge_growth_cache_entry *entry;
+ if (edge_growth_cache == NULL
+ || (entry = edge_growth_cache->get (edge)) == NULL
+ || entry->size == 0)
return do_estimate_edge_size (edge);
- return ret - (ret > 0);
+ return entry->size - (entry->size > 0);
}
/* Return estimated callee growth after inlining EDGE. */
@@ -92,13 +92,14 @@ estimate_edge_growth (struct cgraph_edge *edge)
static inline sreal
estimate_edge_time (struct cgraph_edge *edge, sreal *nonspec_time = NULL)
{
- sreal ret;
- if ((int)edge_growth_cache.length () <= edge->uid
- || !edge_growth_cache[edge->uid].size)
+ edge_growth_cache_entry *entry;
+ if (edge_growth_cache == NULL
+ || (entry = edge_growth_cache->get (edge)) == NULL
+ || entry->time == 0)
return do_estimate_edge_time (edge);
if (nonspec_time)
- *nonspec_time = edge_growth_cache[edge->uid].nonspec_time;
- return edge_growth_cache[edge->uid].time;
+ *nonspec_time = edge_growth_cache->get (edge)->nonspec_time;
+ return entry->time;
}
@@ -108,23 +109,12 @@ estimate_edge_time (struct cgraph_edge *edge, sreal *nonspec_time = NULL)
static inline ipa_hints
estimate_edge_hints (struct cgraph_edge *edge)
{
- ipa_hints ret;
- if ((int)edge_growth_cache.length () <= edge->uid
- || !(ret = edge_growth_cache[edge->uid].hints))
+ edge_growth_cache_entry *entry;
+ if (edge_growth_cache == NULL
+ || (entry = edge_growth_cache->get (edge)) == NULL
+ || entry->hints == 0)
return do_estimate_edge_hints (edge);
- return ret - 1;
-}
-
-/* Reset cached value for EDGE. */
-
-static inline void
-reset_edge_growth_cache (struct cgraph_edge *edge)
-{
- if ((int)edge_growth_cache.length () > edge->uid)
- {
- struct edge_growth_cache_entry zero (0, 0, 0, 0);
- edge_growth_cache[edge->uid] = zero;
- }
+ return entry->hints - 1;
}
#endif /* GCC_IPA_INLINE_H */