Mercurial > hg > CbC > CbC_gcc
comparison gcc/ipa-utils.h @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* Utilities for ipa analysis. | 1 /* Utilities for ipa analysis. |
2 Copyright (C) 2004-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2004-2018 Free Software Foundation, Inc. |
3 Contributed by Kenneth Zadeck <zadeck@naturalbridge.com> | 3 Contributed by Kenneth Zadeck <zadeck@naturalbridge.com> |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify it under | 7 GCC is free software; you can redistribute it and/or modify it under |
53 /* In ipa-devirt.c */ | 53 /* In ipa-devirt.c */ |
54 | 54 |
55 struct odr_type_d; | 55 struct odr_type_d; |
56 typedef odr_type_d *odr_type; | 56 typedef odr_type_d *odr_type; |
57 void build_type_inheritance_graph (void); | 57 void build_type_inheritance_graph (void); |
58 void rebuild_type_inheritance_graph (void); | |
58 void update_type_inheritance_graph (void); | 59 void update_type_inheritance_graph (void); |
59 vec <cgraph_node *> | 60 vec <cgraph_node *> |
60 possible_polymorphic_call_targets (tree, HOST_WIDE_INT, | 61 possible_polymorphic_call_targets (tree, HOST_WIDE_INT, |
61 ipa_polymorphic_call_context, | 62 ipa_polymorphic_call_context, |
62 bool *copletep = NULL, | 63 bool *copletep = NULL, |
176 /* Return true if T is a type with linkage defined. */ | 177 /* Return true if T is a type with linkage defined. */ |
177 | 178 |
178 inline bool | 179 inline bool |
179 type_with_linkage_p (const_tree t) | 180 type_with_linkage_p (const_tree t) |
180 { | 181 { |
181 if (!TYPE_NAME (t) || TREE_CODE (TYPE_NAME (t)) != TYPE_DECL | 182 if (!TYPE_NAME (t) || TREE_CODE (TYPE_NAME (t)) != TYPE_DECL) |
182 || !TYPE_STUB_DECL (t)) | 183 return false; |
183 return false; | 184 |
184 /* In LTO do not get confused by non-C++ produced types or types built | 185 /* To support -fno-lto-odr-type-merigng recognize types with vtables |
185 with -fno-lto-odr-type-merigng. */ | 186 to have linkage. */ |
187 if (RECORD_OR_UNION_TYPE_P (t) | |
188 && TYPE_BINFO (t) && BINFO_VTABLE (TYPE_BINFO (t))) | |
189 return true; | |
190 | |
191 /* After free_lang_data was run and -flto-odr-type-merging we can recongize | |
192 types with linkage by presence of mangled name. */ | |
193 if (DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t))) | |
194 return true; | |
195 | |
186 if (in_lto_p) | 196 if (in_lto_p) |
187 { | 197 return false; |
188 /* To support -fno-lto-odr-type-merigng recognize types with vtables | 198 /* We used to check for TYPE_STUB_DECL but that is set to NULL for forward |
189 to have linkage. */ | 199 declarations. */ |
190 if (RECORD_OR_UNION_TYPE_P (t) | |
191 && TYPE_BINFO (t) && BINFO_VTABLE (TYPE_BINFO (t))) | |
192 return true; | |
193 /* With -flto-odr-type-merging C++ FE specify mangled names | |
194 for all types with the linkage. */ | |
195 return DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t)); | |
196 } | |
197 | 200 |
198 if (!RECORD_OR_UNION_TYPE_P (t) && TREE_CODE (t) != ENUMERAL_TYPE) | 201 if (!RECORD_OR_UNION_TYPE_P (t) && TREE_CODE (t) != ENUMERAL_TYPE) |
199 return false; | 202 return false; |
200 | 203 |
201 /* Builtin types do not define linkage, their TYPE_CONTEXT is NULL. */ | 204 /* Builtin types do not define linkage, their TYPE_CONTEXT is NULL. */ |
211 inline bool | 214 inline bool |
212 type_in_anonymous_namespace_p (const_tree t) | 215 type_in_anonymous_namespace_p (const_tree t) |
213 { | 216 { |
214 gcc_checking_assert (type_with_linkage_p (t)); | 217 gcc_checking_assert (type_with_linkage_p (t)); |
215 | 218 |
216 if (!TREE_PUBLIC (TYPE_STUB_DECL (t))) | 219 /* free_lang_data clears TYPE_STUB_DECL but sets assembler name to |
217 { | 220 "<anon>" */ |
218 /* C++ FE uses magic <anon> as assembler names of anonymous types. | 221 if (DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t))) |
219 verify that this match with type_in_anonymous_namespace_p. */ | 222 return !strcmp ("<anon>", |
220 gcc_checking_assert (!in_lto_p | 223 IDENTIFIER_POINTER |
221 || !DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t)) | 224 (DECL_ASSEMBLER_NAME (TYPE_NAME (t)))); |
222 || !strcmp ("<anon>", | 225 else if (!TYPE_STUB_DECL (t)) |
223 IDENTIFIER_POINTER | 226 return false; |
224 (DECL_ASSEMBLER_NAME (TYPE_NAME (t))))); | 227 else |
225 return true; | 228 return !TREE_PUBLIC (TYPE_STUB_DECL (t)); |
226 } | |
227 return false; | |
228 } | 229 } |
229 | 230 |
230 /* Return true of T is type with One Definition Rule info attached. | 231 /* Return true of T is type with One Definition Rule info attached. |
231 It means that either it is anonymous type or it has assembler name | 232 It means that either it is anonymous type or it has assembler name |
232 set. */ | 233 set. */ |