]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ipa-ref.h
Update copyright years.
[thirdparty/gcc.git] / gcc / ipa-ref.h
CommitLineData
369451ec 1/* IPA reference lists.
cbe34bb5 2 Copyright (C) 2010-2017 Free Software Foundation, Inc.
369451ec
JH
3 Contributed by Jan Hubicka
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
f1717f8d
KC
21#ifndef GCC_IPA_REF_H
22#define GCC_IPA_REF_H
23
369451ec 24struct cgraph_node;
2c8326a5 25class varpool_node;
5e20cdc9 26class symtab_node;
5932a4d4 27
369451ec
JH
28
29/* How the reference is done. */
30enum GTY(()) ipa_ref_use
31{
32 IPA_REF_LOAD,
33 IPA_REF_STORE,
39e2db00 34 IPA_REF_ADDR,
d5e254e1
IE
35 IPA_REF_ALIAS,
36 IPA_REF_CHKP
369451ec
JH
37};
38
369451ec
JH
39/* Record of reference in callgraph or varpool. */
40struct GTY(()) ipa_ref
41{
d122681a
ML
42public:
43 /* Remove reference. */
44 void remove_reference ();
45
46 /* Return true when execution of reference can lead to return from
47 function. */
48 bool cannot_lead_to_return ();
49
5ebd0e61
ML
50 /* Return true if refernece may be used in address compare. */
51 bool address_matters_p ();
52
d122681a
ML
53 /* Return reference list this reference is in. */
54 struct ipa_ref_list * referring_ref_list (void);
55
56 /* Return reference list this reference is in. */
57 struct ipa_ref_list * referred_ref_list (void);
58
5e20cdc9
DM
59 symtab_node *referring;
60 symtab_node *referred;
355fe088 61 gimple *stmt;
042ae7d2 62 unsigned int lto_stmt_uid;
5932a4d4 63 unsigned int referred_index;
d5e254e1 64 ENUM_BITFIELD (ipa_ref_use) use:3;
042ae7d2 65 unsigned int speculative:1;
369451ec
JH
66};
67
68typedef struct ipa_ref ipa_ref_t;
69typedef struct ipa_ref *ipa_ref_ptr;
70
369451ec
JH
71
72/* List of references. This is stored in both callgraph and varpool nodes. */
73struct GTY(()) ipa_ref_list
74{
d122681a
ML
75public:
76 /* Return first reference in list or NULL if empty. */
77 struct ipa_ref *first_reference (void)
78 {
79 if (!vec_safe_length (references))
80 return NULL;
81 return &(*references)[0];
82 }
83
84 /* Return first referring ref in list or NULL if empty. */
85 struct ipa_ref *first_referring (void)
86 {
87 if (!referring.length ())
88 return NULL;
89 return referring[0];
90 }
91
e55637b7
ML
92 /* Return first referring alias. */
93 struct ipa_ref *first_alias (void)
94 {
95 struct ipa_ref *r = first_referring ();
96
97 return r && r->use == IPA_REF_ALIAS ? r : NULL;
98 }
99
100 /* Return last referring alias. */
101 struct ipa_ref *last_alias (void)
102 {
103 unsigned int i = 0;
104
105 for(i = 0; i < referring.length (); i++)
106 if (referring[i]->use != IPA_REF_ALIAS)
107 break;
108
109 return i == 0 ? NULL : referring[i - 1];
110 }
111
112 /* Return true if the symbol has an alias. */
113 bool inline has_aliases_p (void)
114 {
115 return first_alias ();
116 }
117
d122681a
ML
118 /* Clear reference list. */
119 void clear (void)
120 {
121 referring.create (0);
122 references = NULL;
123 }
124
125 /* Return number of references. */
126 unsigned int nreferences (void)
127 {
128 return vec_safe_length (references);
129 }
130
369451ec 131 /* Store actual references in references vector. */
9771b263 132 vec<ipa_ref_t, va_gc> *references;
073a8998 133 /* Referring is vector of pointers to references. It must not live in GGC space
369451ec 134 or GGC will try to mark middle of references vectors. */
9771b263 135 vec<ipa_ref_ptr> GTY((skip)) referring;
369451ec 136};
f1717f8d
KC
137
138#endif /* GCC_IPA_REF_H */