/* Set THIS to be a duplicate of CTX. Copy all relevant info. */
void
-ipa_call_context::duplicate_from (const ipa_call_context &ctx)
+ipa_cached_call_context::duplicate_from (const ipa_call_context &ctx)
{
m_node = ctx.m_node;
m_possible_truths = ctx.m_possible_truths;
m_avals.m_known_value_ranges = vNULL;
}
-/* Release memory used by known_vals/contexts/aggs vectors.
- If ALL is true release also inline_param_summary.
- This happens when context was previously duplicated to be stored
- into cache. */
+/* Release memory used by known_vals/contexts/aggs vectors. and
+ inline_param_summary. */
void
-ipa_call_context::release (bool all)
+ipa_cached_call_context::release ()
{
/* See if context is initialized at first place. */
if (!m_node)
return;
- ipa_release_agg_values (m_avals.m_known_aggs, all);
- if (all)
- {
- m_avals.m_known_vals.release ();
- m_avals.m_known_contexts.release ();
- m_inline_param_summary.release ();
- }
+ ipa_release_agg_values (m_avals.m_known_aggs, true);
+ m_avals.m_known_vals.release ();
+ m_avals.m_known_contexts.release ();
+ m_inline_param_summary.release ();
}
/* Return true if CTX describes the same call context as THIS. */
ipa_call_summary *dst_data);
};
+class ipa_cached_call_context;
+
/* This object describe a context of call. That is a summary of known
information about its parameters. Main purpose of this context is
to give more realistic estimations of function runtime, size and
sreal *ret_time,
sreal *ret_nonspecialized_time,
ipa_hints *ret_hints);
- void duplicate_from (const ipa_call_context &ctx);
- void release (bool all = false);
bool equal_to (const ipa_call_context &);
bool exists_p ()
{
/* Even after having calculated clauses, the information about argument
values is used to resolve indirect calls. */
ipa_call_arg_values m_avals;
+
+ friend ipa_cached_call_context;
+};
+
+/* Variant of ipa_call_context that is stored in a cache over a longer period
+ of time. */
+
+class ipa_cached_call_context : public ipa_call_context
+{
+public:
+ void duplicate_from (const ipa_call_context &ctx);
+ void release ();
};
extern fast_call_summary <ipa_call_summary *, va_heap> *ipa_call_summaries;
class node_context_cache_entry
{
public:
- ipa_call_context ctx;
+ ipa_cached_call_context ctx;
sreal time, nonspec_time;
int size;
ipa_hints hints;
node_context_cache_miss++;
else
node_context_cache_clear++;
- e->entry.ctx.release (true);
+ e->entry.ctx.release ();
ctx.estimate_size_and_time (&size, &min_size,
&time, &nonspec_time, &hints);
e->entry.size = size;