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