21#ifndef GCC_SYMBOL_SUMMARY_H
22#define GCC_SYMBOL_SUMMARY_H
153 disable_insertion_hook ();
154 m_symtab->remove_cgraph_removal_hook (m_symtab_removal_hook);
155 disable_duplication_hook ();
191 template<
typename Arg,
bool (*f)(const T &, Arg)>
194 m_map.template traverse <f> (
a);
202 T **v = &m_map.get_or_insert (node->
get_uid (), &existed);
204 *v = this->allocate_new ();
212 T **v = m_map.get (node->get_uid ());
221 T **v = m_map.get (uid);
279 this->unregister_hooks ();
282 typedef typename hash_map <map_hash, T *>::iterator map_iterator;
283 for (map_iterator it = m_map.begin (); it != m_map.end (); ++it)
284 this->release ((*it).second);
293 summary->insert (node, summary->get_create (node));
302 summary->remove (node);
311 T *v = summary->get (node);
314 summary->duplicate (node, node2, v, summary->get_create (node2));
341template<
typename T,
typename U>
356template <
class T,
class V>
366template <
class T,
class V>
379 template<
typename Arg,
bool (*f)(const T &, Arg)>
382 for (
unsigned i = 0;
i < m_vector->length ();
i++)
383 if ((*m_vector[
i]) !=
NULL)
384 f ((*m_vector)[
i],
a);
393 id = this->m_symtab->assign_summary_id (node);
395 if ((
unsigned int)
id >= m_vector->length ())
397 this->m_symtab->cgraph_max_summary_id);
399 if ((*m_vector)[
id] ==
NULL)
400 (*m_vector)[
id] = this->allocate_new ();
402 return (*m_vector)[
id];
408 return exists (node) ? (*m_vector)[node->get_summary_id ()] :
NULL;
417 this->release ((*m_vector)[
id]);
427 && (
unsigned int)id < m_vector->length ()
428 && (*m_vector)[
id] !=
NULL);
442 bool is_ggc ()
final override;
453template <typename T, typename V>
465template <
typename T,
typename V>
468 this->unregister_hooks ();
471 for (
unsigned i = 0;
i < m_vector->length ();
i++)
472 if ((*m_vector)[
i] !=
NULL)
473 this->release ((*m_vector)[
i]);
477template <
typename T,
typename V>
483 summary->insert (node, summary->get_create (node));
486template <
typename T,
typename V>
493 if (summary->exists (node))
494 summary->remove (node);
497template <
typename T,
typename V>
504 T *v = summary->get (node);
508 T *duplicate = summary->get_create (node2);
509 summary->duplicate (node, node2, v, duplicate);
513template <
typename T,
typename V>
658 m_symtab->remove_edge_removal_hook (m_symtab_removal_hook);
659 disable_duplication_hook ();
690 template<
typename Arg,
bool (*f)(const T &, Arg)>
693 m_map.template traverse <f> (
a);
701 T **v = &m_map.get_or_insert (
edge->get_uid (), &existed);
703 *v = this->allocate_new ();
711 T **v = m_map.get (
edge->get_uid ());
719 int uid =
edge->get_uid ();
720 T **v = m_map.get (uid);
731 return m_map.get (
edge->get_uid ()) !=
NULL;
757 template <
typename U>
friend void gt_ggc_mx (call_summary <U *> *
const &);
758 template <
typename U>
friend void gt_pch_nx (call_summary <U *> *
const &);
759 template <
typename U>
friend void gt_pch_nx (call_summary <U *> *
const &,
766 this->unregister_hooks ();
769 typedef typename hash_map <map_hash, T *>::iterator map_iterator;
770 for (map_iterator it = m_map.begin (); it != m_map.end (); ++it)
771 this->release ((*it).second);
779 summary->remove (
edge);
788 T *edge1_summary =
NULL;
790 if (summary->m_initialize_when_cloning)
791 edge1_summary = summary->get_create (edge1);
793 edge1_summary = summary->get (edge1);
796 summary->duplicate (edge1, edge2, edge1_summary,
797 summary->get_create (edge2));
825template <
class T,
class V>
835template <
class T,
class V>
853 template<
typename Arg,
bool (*f)(const T &, Arg)>
856 for (
unsigned i = 0;
i < m_vector->length ();
i++)
857 if ((*m_vector[
i]) !=
NULL)
858 f ((*m_vector)[
i],
a);
865 int id =
edge->get_summary_id ();
867 id = this->m_symtab->assign_summary_id (
edge);
869 if ((
unsigned)
id >= m_vector->length ())
872 if ((*m_vector)[
id] ==
NULL)
873 (*m_vector)[
id] = this->allocate_new ();
875 return (*m_vector)[
id];
881 return exists (
edge) ? (*m_vector)[
edge->get_summary_id ()] :
NULL;
890 int id =
edge->get_summary_id ();
891 this->release ((*m_vector)[
id]);
899 int id =
edge->get_summary_id ();
901 && (
unsigned)id < m_vector->length ()
902 && (*m_vector)[
id] !=
NULL);
913 bool is_ggc ()
final override;
924template <typename T, typename V>
927 this->unregister_hooks ();
930 for (
unsigned i = 0;
i < m_vector->length ();
i++)
931 if ((*m_vector)[
i] !=
NULL)
932 this->release ((*m_vector)[
i]);
936template <
typename T,
typename V>
941 summary->remove (
edge);
944template <
typename T,
typename V>
950 T *edge1_summary =
NULL;
952 if (summary->m_initialize_when_cloning)
953 edge1_summary = summary->get_create (edge1);
955 edge1_summary = summary->get (edge1);
959 T *duplicate = summary->get_create (edge2);
960 summary->duplicate (edge1, edge2, edge1_summary, duplicate);
964template <
typename T,
typename V>
987 void *cookie ATTRIBUTE_UNUSED)
1006template <
typename T>
symbol_table * symtab
Definition cgraph.cc:81
void(* cgraph_edge_hook)(cgraph_edge *, void *)
Definition cgraph.h:2165
void(* cgraph_node_hook)(cgraph_node *, void *)
Definition cgraph.h:2166
void(* cgraph_2node_hook)(cgraph_node *, cgraph_node *, void *)
Definition cgraph.h:2169
void(* cgraph_2edge_hook)(cgraph_edge *, cgraph_edge *, void *)
Definition cgraph.h:2168
call_summary(symbol_table *symtab, bool ggc=false CXX_MEM_STAT_INFO)
Definition symbol-summary.h:679
hash_map< map_hash, T * > m_map
Definition symbol-summary.h:755
T * get(cgraph_edge *edge) ATTRIBUTE_PURE
Definition symbol-summary.h:709
bool m_ggc
Definition symbol-summary.h:743
int_hash< int, 0, -1 > map_hash
Definition symbol-summary.h:752
friend void gt_pch_nx(call_summary< U * > *const &)
friend void gt_pch_nx(call_summary< U * > *const &, gt_pointer_operator, void *)
bool is_ggc() final override
Definition symbol-summary.h:747
bool exists(cgraph_edge *edge)
Definition symbol-summary.h:729
T * get_create(cgraph_edge *edge)
Definition symbol-summary.h:698
void traverse(Arg a) const
Definition symbol-summary.h:691
friend void gt_ggc_mx(call_summary< U * > *const &)
void remove(cgraph_edge *edge)
Definition symbol-summary.h:717
Definition symbol-summary.h:566
cgraph_2edge_hook m_symtab_duplication
Definition symbol-summary.h:637
T * allocate_new()
Definition symbol-summary.h:611
virtual void remove(cgraph_edge *, T *)
Definition symbol-summary.h:582
object_allocator< T > m_allocator
Definition symbol-summary.h:651
bool m_initialize_when_cloning
Definition symbol-summary.h:644
cgraph_edge_hook m_symtab_removal
Definition symbol-summary.h:635
symbol_table * m_symtab
Definition symbol-summary.h:632
cgraph_edge_hook_list * m_symtab_removal_hook
Definition symbol-summary.h:640
void unregister_hooks()
Definition symbol-summary.h:656
void enable_duplication_hook()
Definition symbol-summary.h:591
virtual void duplicate(cgraph_edge *, cgraph_edge *, T *, T *)
Definition symbol-summary.h:585
cgraph_2edge_hook_list * m_symtab_duplication_hook
Definition symbol-summary.h:642
call_summary_base(symbol_table *symtab, cgraph_edge_hook symtab_removal, cgraph_2edge_hook symtab_duplication CXX_MEM_STAT_INFO)
Definition symbol-summary.h:569
void release(T *item)
Definition symbol-summary.h:620
void disable_duplication_hook()
Definition symbol-summary.h:600
Definition symbol-summary.h:667
Definition genoutput.cc:150
T * get(cgraph_edge *edge) ATTRIBUTE_PURE
Definition symbol-summary.h:879
void remove(cgraph_edge *edge)
Definition symbol-summary.h:886
void traverse(Arg a) const
Definition symbol-summary.h:854
T * get_create(cgraph_edge *edge)
Definition symbol-summary.h:863
bool exists(cgraph_edge *edge)
Definition symbol-summary.h:897
fast_call_summary(symbol_table *symtab CXX_MEM_STAT_INFO)
Definition symbol-summary.h:840
Definition symbol-summary.h:827
void remove(cgraph_node *node)
Definition symbol-summary.h:412
T * get(cgraph_node *node) ATTRIBUTE_PURE
Definition symbol-summary.h:406
void traverse(Arg a) const
Definition symbol-summary.h:380
T * get_create(cgraph_node *node)
Definition symbol-summary.h:389
bool exists(cgraph_node *node)
Definition symbol-summary.h:423
Definition symbol-summary.h:358
friend void gt_pch_nx(function_summary< U * > *const &)
void traverse(Arg a) const
Definition symbol-summary.h:192
hash_map< map_hash, T * > m_map
Definition symbol-summary.h:259
bool is_ggc() final override
Definition symbol-summary.h:251
void remove(cgraph_node *node)
Definition symbol-summary.h:218
int_hash< int, 0, -1 > map_hash
Definition symbol-summary.h:256
T * get(cgraph_node *node) ATTRIBUTE_PURE
Definition symbol-summary.h:210
bool m_ggc
Definition symbol-summary.h:247
friend void gt_ggc_mx(function_summary< U * > *const &)
friend void gt_pch_nx(function_summary< U * > *const &, gt_pointer_operator, void *)
T * get_create(cgraph_node *node)
Definition symbol-summary.h:199
bool exists(cgraph_node *node)
Definition symbol-summary.h:230
Definition symbol-summary.h:28
virtual void remove(cgraph_node *, T *)
Definition symbol-summary.h:57
cgraph_node_hook_list * m_symtab_removal_hook
Definition symbol-summary.h:137
virtual void insert(cgraph_node *, T *)
Definition symbol-summary.h:49
cgraph_2node_hook m_symtab_duplication
Definition symbol-summary.h:132
void disable_duplication_hook()
Definition symbol-summary.h:93
void disable_insertion_hook()
Definition symbol-summary.h:75
cgraph_node_hook_list * m_symtab_insertion_hook
Definition symbol-summary.h:135
symbol_table * m_symtab
Definition symbol-summary.h:125
T * allocate_new()
Definition symbol-summary.h:104
cgraph_node_hook m_symtab_insertion
Definition symbol-summary.h:128
cgraph_2node_hook_list * m_symtab_duplication_hook
Definition symbol-summary.h:139
void enable_insertion_hook()
Definition symbol-summary.h:67
void unregister_hooks()
Definition symbol-summary.h:151
cgraph_node_hook m_symtab_removal
Definition symbol-summary.h:130
virtual void duplicate(cgraph_node *, cgraph_node *, T *, T *)
Definition symbol-summary.h:60
function_summary_base(symbol_table *symtab, cgraph_node_hook symtab_insertion, cgraph_node_hook symtab_removal, cgraph_2node_hook symtab_duplication CXX_MEM_STAT_INFO)
Definition symbol-summary.h:31
void enable_duplication_hook()
Definition symbol-summary.h:85
void release(T *item)
Definition symbol-summary.h:113
object_allocator< T > m_allocator
Definition symbol-summary.h:146
Definition symbol-summary.h:163
Definition alloc-pool.h:482
cgraph_2edge_hook_list * add_edge_duplication_hook(cgraph_2edge_hook hook, void *data)
Definition cgraph.cc:422
void remove_cgraph_duplication_hook(cgraph_2node_hook_list *entry)
Definition cgraph.cc:480
cgraph_node_hook_list * add_cgraph_insertion_hook(cgraph_node_hook hook, void *data)
Definition cgraph.cc:393
void remove_cgraph_insertion_hook(cgraph_node_hook_list *entry)
Definition cgraph.cc:410
cgraph_2node_hook_list * add_cgraph_duplication_hook(cgraph_2node_hook hook, void *data)
Definition cgraph.cc:463
cgraph_node_hook_list * add_cgraph_removal_hook(cgraph_node_hook hook, void *data)
Definition cgraph.cc:339
cgraph_edge_hook_list * add_edge_removal_hook(cgraph_edge_hook hook, void *data)
Definition cgraph.cc:298
void remove_edge_duplication_hook(cgraph_2edge_hook_list *entry)
Definition cgraph.cc:439
class edge_def * edge
Definition coretypes.h:352
#define GTY(x)
Definition coretypes.h:41
void(* gt_pointer_operator)(void *, void *, void *)
Definition coretypes.h:472
void final(rtx_insn *first, FILE *file, int optimize_p)
Definition final.cc:2002
static void function_summary(const coverage_info *)
Definition gcov.cc:2764
void * ggc_internal_alloc(size_t size, void(*f)(void *), size_t, size_t MEM_STAT_DECL)
Definition ggc-none.cc:44
#define ggc_test_and_set_mark(EXPR)
Definition ggc.h:81
void ggc_delete(T *ptr)
Definition ggc.h:255
i
Definition poly-int.h:776
Ca & a
Definition poly-int.h:770
#define PASS_MEM_STAT
Definition statistics.h:54
#define MEM_STAT_DECL
Definition statistics.h:52
#define CXX_MEM_STAT_INFO
Definition statistics.h:58
int get_uid()
Definition cgraph.h:1303
int get_summary_id()
Definition cgraph.h:1309
Definition collect2.cc:168
Definition hash-traits.h:122
Definition symbol-summary.h:343
static const bool value
Definition symbol-summary.h:344
void gt_pch_nx(function_summary< T * > *const &)
Definition symbol-summary.h:327
void gt_ggc_mx(function_summary< T * > *const &summary)
Definition symbol-summary.h:319
#define NULL
Definition system.h:50
#define gcc_unreachable()
Definition system.h:848
#define true
Definition system.h:894
#define false
Definition system.h:895
#define gcc_checking_assert(EXPR)
Definition system.h:828
void vec_safe_grow_cleared(vec< T, A, vl_embed > *&v, unsigned len, bool exact=false CXX_MEM_STAT_INFO)
Definition vec.h:768
void vec_alloc(vec< T, A, vl_embed > *&v, unsigned nelems CXX_MEM_STAT_INFO)
Definition vec.h:735
void vec_free(vec< T, A, vl_embed > *&v)
Definition vec.h:746