1 /* IPA reference lists.
3 Free Software Foundation, Inc.
4 Contributed by Jan Hubicka
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
25 /* How the reference is done. */
26 enum GTY(()) ipa_ref_use
33 /* Type of refering or refered type. */
34 enum GTY(()) ipa_ref_type
40 /* We can have references spanning both callgraph and varpool,
41 so all pointers needs to be of both types. */
42 union GTY(()) ipa_ref_ptr_u
44 struct cgraph_node
* GTY((tag ("IPA_REF_CGRAPH"))) cgraph_node
;
45 struct varpool_node
* GTY((tag ("IPA_REF_VARPOOL"))) varpool_node
;
48 /* Record of reference in callgraph or varpool. */
49 struct GTY(()) ipa_ref
51 union ipa_ref_ptr_u
GTY ((desc ("%1.refering_type"))) refering
;
52 union ipa_ref_ptr_u
GTY ((desc ("%1.refered_type"))) refered
;
54 unsigned int refered_index
;
55 ENUM_BITFIELD (ipa_ref_type
) refering_type
:1;
56 ENUM_BITFIELD (ipa_ref_type
) refered_type
:1;
57 ENUM_BITFIELD (ipa_ref_use
) use
:2;
60 typedef struct ipa_ref ipa_ref_t
;
61 typedef struct ipa_ref
*ipa_ref_ptr
;
64 DEF_VEC_ALLOC_O(ipa_ref_t
,gc
);
65 DEF_VEC_P(ipa_ref_ptr
);
66 DEF_VEC_ALLOC_P(ipa_ref_ptr
,heap
);
68 /* List of references. This is stored in both callgraph and varpool nodes. */
69 struct GTY(()) ipa_ref_list
71 /* Store actual references in references vector. */
72 VEC(ipa_ref_t
,gc
) *references
;
73 /* Refering is vector of pointers to references. It must not live in GGC space
74 or GGC will try to mark middle of references vectors. */
75 VEC(ipa_ref_ptr
,heap
) * GTY((skip
)) refering
;
78 struct ipa_ref
* ipa_record_reference (struct cgraph_node
*,
79 struct varpool_node
*,
81 struct varpool_node
*,
82 enum ipa_ref_use
, gimple
);
84 void ipa_remove_reference (struct ipa_ref
*);
85 void ipa_remove_all_references (struct ipa_ref_list
*);
86 void ipa_remove_all_refering (struct ipa_ref_list
*);
87 void ipa_dump_references (FILE *, struct ipa_ref_list
*);
88 void ipa_dump_refering (FILE *, struct ipa_ref_list
*);
89 void ipa_clone_references (struct cgraph_node
*, struct varpool_node
*, struct ipa_ref_list
*);
90 void ipa_clone_refering (struct cgraph_node
*, struct varpool_node
*, struct ipa_ref_list
*);
91 bool ipa_ref_cannot_lead_to_return (struct ipa_ref
*);