GCC Middle and Back End API Reference
cgraph.h
Go to the documentation of this file.
1/* Callgraph handling code.
2 Copyright (C) 2003-2025 Free Software Foundation, Inc.
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
21#ifndef GCC_CGRAPH_H
22#define GCC_CGRAPH_H
23
24#include "profile-count.h"
25#include "ipa-ref.h"
26#include "plugin-api.h"
28
29extern void debuginfo_early_init (void);
30extern void debuginfo_init (void);
31extern void debuginfo_fini (void);
32extern void debuginfo_start (void);
33extern void debuginfo_stop (void);
34extern void debuginfo_early_start (void);
35extern void debuginfo_early_stop (void);
36
37class ipa_opt_pass_d;
39
40/* Toplevel consists of functions, variables and assembly.
41 Make sure toplevel_type_names in symtab.cc is kept in sync
42 with this.
43 TODO: add labels and CONST_DECLs. */
53
54/* Section names are stored as reference counted strings in GGC safe hashtable
55 (to make them survive through PCH). */
56
57struct GTY((for_user)) section_hash_entry
58{
60 char *name; /* As long as this datastructure stays in GGC, we cannot put
61 string at the tail of structure of GGC dies in horrible
62 way */
63};
64
65struct section_name_hasher : ggc_ptr_hash<section_hash_entry>
66{
67 typedef const char *compare_type;
68
69 static hashval_t hash (section_hash_entry *);
70 static bool equal (section_hash_entry *, const char *);
71};
72
74{
75 /* Not yet set by cgraph_function_body_availability. */
77 /* Function body/variable initializer is unknown. */
79 /* Function body/variable initializer is known but might be replaced
80 by a different one from other compilation unit and thus needs to
81 be dealt with a care. Like AVAIL_NOT_AVAILABLE it can have
82 arbitrary side effects on escaping variables and functions, while
83 like AVAILABLE it might access static variables. */
85 /* Function body/variable initializer is known and will be used in final
86 program. */
88 /* Function body/variable initializer is known and all it's uses are
89 explicitly visible within current unit (i.e. it's address is never taken
90 and it is not exported to other units). Currently used only for
91 functions. */
93};
94
95/* Classification of symbols WRT partitioning. */
97{
98 /* External declarations are ignored by partitioning algorithms and they are
99 added into the boundary later via compute_ltrans_boundary. */
101 /* Partitioned symbols are put into one of partitions. */
103 /* Duplicated symbols (such as comdat or constant pool references) are
104 copied into every node needing them via add_symbol_to_partition. */
106};
107
108/* Base of all toplevel entries.
109 Inherited by symtab_node and asm_node. */
110struct GTY ((desc ("%h.type"), tag ("TOPLEVEL_BASE"))) toplevel_node {
111 /* Constructor. */
113 : lto_file_data (NULL), order (-1), type (t)
114 {}
115
116 /* File stream where this node is being written to. */
118
119 /* Ordering of all cgraph nodes. */
120 int order;
121
122 /* Type of the node. */
123 ENUM_BITFIELD (toplevel_type) type : 8;
124};
125
126/* Base of all entries in the symbol table.
127 The symtab_node is inherited by cgraph and varpol nodes. */
128struct GTY ((tag ("SYMTAB_SYMBOL"),
129 chain_next ("%h.next"), chain_prev ("%h.previous")))
132public:
133 friend class symbol_table;
152 {}
153
154 /* Return name. */
155 const char *name () const;
156
157 /* Return dump name. */
158 const char *dump_name () const;
159
160 /* Return asm name. */
161 const char *asm_name () const;
162
163 /* Return dump name with assembler name. */
164 const char *dump_asm_name () const;
165
166 /* Return visibility name. */
167 const char *get_visibility_string () const;
168
169 /* Return type_name name. */
170 const char *get_symtab_type_string () const;
171
172 /* Add node into symbol table. This function is not used directly, but via
173 cgraph/varpool node creation routines. */
174 void register_symbol (void);
175
176 /* Remove symbol from symbol table. */
177 void remove (void);
178
179 /* Undo any definition or use of the symbol. */
180 void reset (bool preserve_comdat_group = false);
181
182 /* Dump symtab node to F. */
183 void dump (FILE *f);
184
185 /* Dump symtab callgraph in graphviz format. */
186 void dump_graphviz (FILE *f);
187
188 /* Dump symtab node to stderr. */
189 void DEBUG_FUNCTION debug (void);
190
191 /* Verify consistency of node. */
192 void DEBUG_FUNCTION verify (void);
193
194 /* Return ipa reference from this symtab_node to
195 REFERRED_NODE or REFERRED_VARPOOL_NODE. USE_TYPE specify type
196 of the use and STMT the statement (if it exists). */
197 ipa_ref *create_reference (symtab_node *referred_node,
198 enum ipa_ref_use use_type);
199
200 /* Return ipa reference from this symtab_node to
201 REFERRED_NODE or REFERRED_VARPOOL_NODE. USE_TYPE specify type
202 of the use and STMT the statement (if it exists). */
203 ipa_ref *create_reference (symtab_node *referred_node,
204 enum ipa_ref_use use_type, gimple *stmt);
205
206 /* If VAL is a reference to a function or a variable, add a reference from
207 this symtab_node to the corresponding symbol table node. Return the new
208 reference or NULL if none was created. */
209 ipa_ref *maybe_create_reference (tree val, gimple *stmt);
210
211 /* Clone all references from symtab NODE to this symtab_node. */
212 void clone_references (symtab_node *node);
213
214 /* Remove all stmt references in non-speculative references.
215 Those are not maintained during inlining & clonning.
216 The exception are speculative references that are updated along
217 with callgraph edges associated with them. */
218 void clone_referring (symtab_node *node);
219
220 /* Clone reference REF to this symtab_node and set its stmt to STMT. */
221 ipa_ref *clone_reference (ipa_ref *ref, gimple *stmt);
222
223 /* Find the structure describing a reference to REFERRED_NODE of USE_TYPE and
224 associated with statement STMT or LTO_STMT_UID. */
225 ipa_ref *find_reference (symtab_node *referred_node, gimple *stmt,
226 unsigned int lto_stmt_uid,
227 enum ipa_ref_use use_type);
228
229 /* Remove all references that are associated with statement STMT. */
230 void remove_stmt_references (gimple *stmt);
231
232 /* Remove all stmt references in non-speculative references.
233 Those are not maintained during inlining & clonning.
234 The exception are speculative references that are updated along
235 with callgraph edges associated with them. */
236 void clear_stmts_in_references (void);
237
238 /* Remove all references in ref list. */
239 void remove_all_references (void);
240
241 /* Remove all referring items in ref list. */
242 void remove_all_referring (void);
243
244 /* Dump references in ref list to FILE. */
245 void dump_references (FILE *file);
246
247 /* Dump referring in list to FILE. */
248 void dump_referring (FILE *);
250 /* Get number of references for this node. */
251 inline unsigned num_references (void)
252 {
253 return ref_list.references.length ();
254 }
255
256 /* Iterates I-th reference in the list, REF is also set. */
257 ipa_ref *iterate_reference (unsigned i, ipa_ref *&ref);
258
259 /* Iterates I-th referring item in the list, REF is also set. */
260 ipa_ref *iterate_referring (unsigned i, ipa_ref *&ref);
261
262 /* Iterates I-th referring alias item in the list, REF is also set. */
263 ipa_ref *iterate_direct_aliases (unsigned i, ipa_ref *&ref);
264
265 /* Return true if symtab node and TARGET represents
266 semantically equivalent symbols. */
267 bool semantically_equivalent_p (symtab_node *target);
268
269 /* Classify symbol symtab node for partitioning. */
270 enum symbol_partitioning_class get_partitioning_class (void);
272 /* Return comdat group. */
274 {
275 return x_comdat_group;
276 }
278 /* Return comdat group as identifier_node. */
280 {
281 if (x_comdat_group && TREE_CODE (x_comdat_group) != IDENTIFIER_NODE)
283 return x_comdat_group;
284 }
286 /* Set comdat group. */
287 void set_comdat_group (tree group)
288 {
289 gcc_checking_assert (!group || TREE_CODE (group) == IDENTIFIER_NODE
290 || DECL_P (group));
291 x_comdat_group = group;
292 }
294 /* Return section as string. */
295 const char * get_section () const
296 {
297 if (!x_section)
298 return NULL;
299 return x_section->name;
300 }
301
302 /* Remove node from same comdat group. */
303 void remove_from_same_comdat_group (void);
304
305 /* Add this symtab_node to the same comdat group that OLD is in. */
306 void add_to_same_comdat_group (symtab_node *old_node);
307
308 /* Dissolve the same_comdat_group list in which NODE resides. */
309 void dissolve_same_comdat_group_list (void);
310
311 /* Return true when symtab_node is known to be used from other (non-LTO)
312 object file. Known only when doing LTO via linker plugin. */
313 bool used_from_object_file_p (void);
314
315 /* Walk the alias chain to return the symbol NODE is alias of.
316 If NODE is not an alias, return NODE.
317 When AVAILABILITY is non-NULL, get minimal availability in the chain.
318 When REF is non-NULL, assume that reference happens in symbol REF
319 when determining the availability. */
320 symtab_node *ultimate_alias_target (enum availability *avail = NULL,
321 struct symtab_node *ref = NULL);
322
323 /* Return next reachable static symbol with initializer after NODE. */
324 inline symtab_node *next_defined_symbol (void);
325
326 /* Add reference recording that symtab node is alias of TARGET.
327 If TRANSPARENT is true make the alias to be transparent alias.
328 The function can fail in the case of aliasing cycles; in this case
329 it returns false. */
330 bool resolve_alias (symtab_node *target, bool transparent = false);
331
332 /* C++ FE sometimes change linkage flags after producing same
333 body aliases. */
334 void fixup_same_cpp_alias_visibility (symtab_node *target);
335
336 /* Call callback on symtab node and aliases associated to this node.
337 When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are
338 skipped. */
339 bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *),
340 void *data,
341 bool include_overwrite);
342
343 /* If node cannot be interposable by static or dynamic linker to point to
344 different definition, return this symbol. Otherwise look for alias with
345 such property and if none exists, introduce new one. */
346 symtab_node *noninterposable_alias (void);
347
348 /* Return node that alias is aliasing. */
349 inline symtab_node *get_alias_target (void);
350
351 /* Return DECL that alias is aliasing. */
352 inline tree get_alias_target_tree ();
353
354 /* Set section for symbol and its aliases. */
355 void set_section (const char *section);
356
357 /* Like set_section, but copying the section name from another node. */
358 void set_section (const symtab_node &other);
359
360 /* Set section, do not recurse into aliases.
361 When one wants to change section of symbol and its aliases,
362 use set_section. */
363 void set_section_for_node (const char *section);
364
365 /* Like set_section_for_node, but copying the section name from another
366 node. */
367 void set_section_for_node (const symtab_node &other);
368
369 /* Set initialization priority to PRIORITY. */
370 void set_init_priority (priority_type priority);
371
372 /* Return the initialization priority. */
373 priority_type get_init_priority ();
374
375 /* Return availability of NODE when referenced from REF. */
376 enum availability get_availability (symtab_node *ref = NULL);
377
378 /* During LTO stream-in this predicate can be used to check whether node
379 in question prevails in the linking to save some memory usage. */
380 bool prevailing_p (void);
381
382 /* Return true if NODE binds to current definition in final executable
383 when referenced from REF. If REF is NULL return conservative value
384 for any reference. */
385 bool binds_to_current_def_p (symtab_node *ref = NULL);
386
387 /* Make DECL local. */
388 void make_decl_local (void);
389
390 /* Copy visibility from N. */
391 void copy_visibility_from (symtab_node *n);
392
393 /* Return desired alignment of the definition. This is NOT alignment useful
394 to access THIS, because THIS may be interposable and DECL_ALIGN should
395 be used instead. It however must be guaranteed when output definition
396 of THIS. */
397 unsigned int definition_alignment ();
398
399 /* Return true if alignment can be increased. */
400 bool can_increase_alignment_p ();
401
402 /* Increase alignment of symbol to ALIGN. */
403 void increase_alignment (unsigned int align);
404
405 /* Return true if list contains an alias. */
406 bool has_aliases_p (void);
407
408 /* Return true when the symbol is real symbol, i.e. it is not inline clone
409 or abstract function kept for debug info purposes only. */
410 bool real_symbol_p (void);
411
412 /* Return true when the symbol needs to be output to the LTO symbol table. */
413 bool output_to_lto_symbol_table_p (void);
414
415 /* Determine if symbol declaration is needed. That is, visible to something
416 either outside this translation unit, something magic in the system
417 configury. This function is used just during symbol creation. */
418 bool needed_p (void);
419
420 /* Return true if this symbol is a function from the C frontend specified
421 directly in RTL form (with "__RTL"). */
422 bool native_rtl_p () const;
423
424 /* Return true when there are references to the node. */
425 bool referred_to_p (bool include_self = true);
426
427 /* Return true if symbol can be discarded by linker from the binary.
428 Assume that symbol is used (so there is no need to take into account
429 garbage collecting linkers)
430
431 This can happen for comdats, commons and weaks when they are prevailed
432 by other definition at static linking time. */
433 inline bool
434 can_be_discarded_p (void)
435 {
436 return ((DECL_EXTERNAL (decl)
438 || ((get_comdat_group ()
439 || DECL_COMMON (decl)
441 && ((resolution != LDPR_PREVAILING_DEF
442 && resolution != LDPR_PREVAILING_DEF_IRONLY_EXP)
443 || flag_incremental_link)
444 && resolution != LDPR_PREVAILING_DEF_IRONLY));
445 }
446
447 /* Return true if NODE is local to a particular COMDAT group, and must not
448 be named from outside the COMDAT. This is used for C++ decloned
449 constructors. */
450 inline bool comdat_local_p (void)
451 {
452 return (same_comdat_group && !TREE_PUBLIC (decl));
453 }
454
455 /* Return true if ONE and TWO are part of the same COMDAT group. */
456 inline bool in_same_comdat_group_p (symtab_node *target);
457
458 /* Return true if symbol is known to be nonzero, assume that
459 flag_delete_null_pointer_checks is equal to delete_null_pointer_checks. */
460 bool nonzero_address (bool delete_null_pointer_checks);
461
462 /* Return true if symbol is known to be nonzero. */
463 bool nonzero_address ();
464
465 /* Return 0 if symbol is known to have different address than S2,
466 Return 1 if symbol is known to have same address as S2,
467 return 2 otherwise.
468
469 If MEMORY_ACCESSED is true, assume that both memory pointer to THIS
470 and S2 is going to be accessed. This eliminates the situations when
471 either THIS or S2 is NULL and is useful for comparing bases when deciding
472 about memory aliasing. */
473 int equal_address_to (symtab_node *s2, bool memory_accessed = false);
474
475 /* Return true if symbol's address may possibly be compared to other
476 symbol's address. */
477 bool address_matters_p ();
478
479 /* Return true if NODE's address can be compared. This use properties
480 of NODE only and does not look if the address is actually taken in
481 interesting way. For that use ADDRESS_MATTERS_P instead. */
482 bool address_can_be_compared_p (void);
483
484 /* Return symbol table node associated with DECL, if any,
485 and NULL otherwise. */
486 static inline symtab_node *get (const_tree decl)
487 {
488 /* Check that we are called for sane type of object - functions
489 and static or external variables. */
490 gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL
491 || (TREE_CODE (decl) == VAR_DECL
493 || in_lto_p)));
494 /* Check that the mapping is sane - perhaps this check can go away,
495 but at the moment frontends tends to corrupt the mapping by calling
496 memcpy/memset on the tree nodes. */
497 gcc_checking_assert (!decl->decl_with_vis.symtab_node
498 || decl->decl_with_vis.symtab_node->decl == decl);
499 return decl->decl_with_vis.symtab_node;
500 }
501
502 /* Try to find a symtab node for declaration DECL and if it does not
503 exist or if it corresponds to an inline clone, create a new one. */
504 static inline symtab_node * get_create (tree node);
505
506 /* Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME.
507 Return NULL if there's no such node. */
508 static symtab_node *get_for_asmname (const_tree asmname);
509
510 /* Check symbol table for callees of IFUNC resolvers. */
511 static void check_ifunc_callee_symtab_nodes (void);
512
513 /* Verify symbol table for internal consistency. */
514 static DEBUG_FUNCTION void verify_symtab_nodes (void);
515
516 /* Perform internal consistency checks, if they are enabled. */
517 static inline void checking_verify_symtab_nodes (void);
519 /* Get unique identifier of the node. */
520 inline int get_uid () const
521 {
522 return m_uid;
523 }
525 /* The symbols resolution. */
526 ENUM_BITFIELD (ld_plugin_symbol_resolution) resolution : 8;
527
528 /*** Flags representing the symbol type. ***/
529
530 /* True when symbol corresponds to a definition in current unit.
531 set via finalize_function or finalize_decl */
532 unsigned definition : 1;
533 /* True when symbol is an alias.
534 Set by assemble_alias. */
535 unsigned alias : 1;
536 /* When true the alias is translated into its target symbol either by GCC
537 or assembler (it also may just be a duplicate declaration of the same
538 linker name).
539
540 Currently transparent aliases come in three different flavors
541 - aliases having the same assembler name as their target (aka duplicated
542 declarations). In this case the assembler names compare via
543 assembler_names_equal_p and weakref is false
544 - aliases that are renamed at a time being output to final file
545 by varasm.cc. For those DECL_ASSEMBLER_NAME have
546 IDENTIFIER_TRANSPARENT_ALIAS set and thus also their assembler
547 name must be unique.
548 Weakrefs belong to this category when we target assembler without
549 .weakref directive.
550 - weakrefs that are renamed by assembler via .weakref directive.
551 In this case the alias may or may not be definition (depending if
552 target declaration was seen by the compiler), weakref is set.
553 Unless we are before renaming statics, assembler names are different.
554
555 Given that we now support duplicate declarations, the second option is
556 redundant and will be removed. */
557 unsigned transparent_alias : 1;
558 /* True when alias is a weakref. */
559 unsigned weakref : 1;
560 /* C++ frontend produce same body aliases and extra name aliases for
561 virtual functions and vtables that are obviously equivalent.
562 Those aliases are bit special, especially because C++ frontend
563 visibility code is so ugly it cannot get them right at first time
564 and their visibility needs to be copied from their "masters" at
565 the end of parsing. */
566 unsigned cpp_implicit_alias : 1;
567 /* The alias is a symbol version. */
568 unsigned symver : 1;
569 /* Set once the definition was analyzed. The list of references and
570 other properties are built during analysis. */
571 unsigned analyzed : 1;
572 /* Set for write-only variables. */
573 unsigned writeonly : 1;
574 /* Visibility of symbol was used for further optimization; do not
575 permit further changes. */
576 unsigned refuse_visibility_changes : 1;
577
578 /*** Visibility and linkage flags. ***/
580 /* Set when function is visible by other units. */
581 unsigned externally_visible : 1;
582 /* Don't reorder to other symbols having this set. */
583 unsigned no_reorder : 1;
584 /* The symbol will be assumed to be used in an invisible way (like
585 by an toplevel asm statement). */
586 unsigned force_output : 1;
587 /* Like FORCE_OUTPUT, but in the case it is ABI requiring the symbol to be
588 exported. Unlike FORCE_OUTPUT this flag gets cleared to symbols promoted
589 to static and it does not inhibit optimization. */
590 unsigned forced_by_abi : 1;
591 /* True when the name is known to be unique and thus it does not need mangling. */
592 unsigned unique_name : 1;
593 /* Specify whether the section was set by user or by
594 compiler via -ffunction-sections. */
595 unsigned implicit_section : 1;
596 /* True when body and other characteristics have been removed by
597 symtab_remove_unreachable_nodes. */
598 unsigned body_removed : 1;
599 /* True when symbol should comply to -fsemantic-interposition flag. */
600 unsigned semantic_interposition : 1;
601
602 /*** WHOPR Partitioning flags.
603 These flags are used at ltrans stage when only part of the callgraph is
604 available. ***/
606 /* Set when variable is used from other LTRANS partition. */
607 unsigned used_from_other_partition : 1;
608 /* Set when function is available in the other LTRANS partition.
609 During WPA output it is used to mark nodes that are present in
610 multiple partitions. */
611 unsigned in_other_partition : 1;
612
613
614
615 /*** other flags. ***/
617 /* Set when symbol has address taken. */
618 unsigned address_taken : 1;
619 /* Set when init priority is set. */
620 unsigned in_init_priority_hash : 1;
621
622 /* Set when symbol needs to be streamed into LTO bytecode for LTO, or in case
623 of offloading, for separate compilation for a different target. */
624 unsigned need_lto_streaming : 1;
626 /* Set when symbol can be streamed into bytecode for offloading. */
627 unsigned offloadable : 1;
629 /* Set when symbol is an IFUNC resolver. */
630 unsigned ifunc_resolver : 1;
631
633 /* Declaration representing the symbol. */
634 tree decl;
636 /* Linked list of symbol table entries starting with symtab_nodes. */
639
640 /* Linked list of symbols with the same asm name. There may be multiple
641 entries for single symbol name during LTO, because symbols are renamed
642 only after partitioning.
643
644 Because inline clones are kept in the assembler name has, they also produce
645 duplicate entries.
646
647 There are also several long standing bugs where frontends and builtin
648 code produce duplicated decls. */
652 /* Circular list of nodes in the same comdat group if non-NULL. */
655 /* Vectors of referring and referenced entities. */
656 ipa_ref_list GTY((skip)) ref_list;
657
658 /* Alias target. May be either DECL pointer or ASSEMBLER_NAME pointer
659 depending to what was known to frontend on the creation time.
660 Once alias is resolved, this pointer become NULL. */
662
663 void *GTY ((skip)) aux;
665 /* Comdat group the symbol is in. Can be private if GGC allowed that. */
668 /* Section name. Again can be private, if allowed. */
670
671protected:
672 /* Dump base fields of symtab nodes to F. Not to be used directly. */
673 void dump_base (FILE *);
674
675 /* Verify common part of symtab node. */
676 bool DEBUG_FUNCTION verify_base (void);
677
678 /* Remove node from symbol table. This function is not used directly, but via
679 cgraph/varpool node removal routines. */
680 void unregister (struct clone_info *);
681
682 /* Return the initialization and finalization priority information for
683 DECL. If there is no previous priority information, a freshly
684 allocated structure is returned. */
685 struct symbol_priority_map *priority_info (void);
686
687 /* Worker for call_for_symbol_and_aliases_1. */
688 bool call_for_symbol_and_aliases_1 (bool (*callback) (symtab_node *, void *),
689 void *data,
690 bool include_overwrite);
691private:
692 /* Unique id of the node. */
693 int m_uid;
694
695 /* Workers for set_section. */
696 static bool set_section_from_string (symtab_node *n, void *s);
697 static bool set_section_from_node (symtab_node *n, void *o);
698
699 /* Worker for symtab_resolve_alias. */
700 static bool set_implicit_section (symtab_node *n, void *);
701
702 /* Worker searching noninterposable alias. */
703 static bool noninterposable_alias (symtab_node *node, void *data);
704
705 /* Worker for ultimate_alias_target. */
707 symtab_node *ref = NULL);
708
709 /* Get dump name with normal or assembly name. */
710 const char *get_dump_name (bool asm_name_p) const;
711};
713inline void
715{
716 if (flag_checking)
718}
720/* Walk all aliases for NODE. */
721#define FOR_EACH_ALIAS(NODE, ALIAS) \
722 for (unsigned ALIAS##_iter_ = 0; \
723 (NODE)->iterate_direct_aliases (ALIAS##_iter_, ALIAS); \
724 ALIAS##_iter_++)
725
726/* This is the information that is put into the cgraph local structure
727 to recover a function. */
728struct lto_file_decl_data;
729
730extern const char * const cgraph_availability_names[];
731extern const char * const ld_plugin_symbol_resolution_names[];
732extern const char * const tls_model_names[];
733
734/* Represent which DECL tree (or reference to such tree)
735 will be replaced by another tree while versioning. */
736struct GTY(()) ipa_replace_map
738 /* The new (replacing) tree. */
740 /* Parameter number to replace, when old_tree is NULL. */
741 int parm_num;
742 /* Set if the newly added reference should not be an address one, but a load
743 one from the operand of the ADDR_EXPR in NEW_TREE. This is for cases when
744 the corresponding parameter p is used only as *p. */
745 unsigned force_load_ref : 1;
764};
765
766/* Function arguments in the original function of a SIMD clone.
767 Supplementary data for `struct simd_clone'. */
768
769struct GTY(()) cgraph_simd_clone_arg {
770 /* Original function argument as it originally existed in
771 DECL_ARGUMENTS. */
773
774 /* orig_arg's function (or for extern functions type from
775 TYPE_ARG_TYPES). */
777
778 /* If argument is a vector, this holds the vector version of
779 orig_arg that after adjusting the argument types will live in
780 DECL_ARGUMENTS. Otherwise, this is NULL.
781
782 This basically holds:
783 vector(simdlen) __typeof__(orig_arg) new_arg. */
786 /* vector_arg's type (or for extern functions new vector type. */
788
789 /* If argument is a vector, this holds the array where the simd
790 argument is held while executing the simd clone function. This
791 is a local variable in the cloned function. Its content is
792 copied from vector_arg upon entry to the clone.
793
794 This basically holds:
795 __typeof__(orig_arg) simd_array[simdlen]. */
797
798 /* A SIMD clone's argument can be either linear (constant or
799 variable), uniform, or vector. */
802 /* Variable alignment if available, otherwise 0. */
803 unsigned int alignment;
804
805 /* For arg_type SIMD_CLONE_ARG_TYPE_LINEAR_*CONSTANT_STEP this is
806 the constant linear step, if arg_type is
807 SIMD_CLONE_ARG_TYPE_LINEAR_*VARIABLE_STEP, this is index of
808 the uniform argument holding the step, otherwise 0. */
809 HOST_WIDE_INT linear_step;
810};
811
812/* Specific data for a SIMD function clone. */
813
815 /* Number of words in the SIMD lane associated with this clone. */
817
818 /* Number of annotated function arguments in `args'. This is
819 usually the number of named arguments in FNDECL. */
820 unsigned int nargs;
822 /* Max hardware vector size in bits for integral vectors. */
825 /* Max hardware vector size in bits for floating point vectors. */
827
828 /* Machine mode of the mask argument(s), if they are to be passed
829 as bitmasks in integer argument(s). VOIDmode if masks are passed
830 as vectors of characteristic type. */
831 machine_mode mask_mode;
832
833 /* The mangling character for a given vector size. This is used
834 to determine the ISA mangling bit as specified in the Intel
835 Vector ABI. */
836 unsigned char vecsize_mangle;
837
838 /* True if this is the masked, in-branch version of the clone,
839 otherwise false. */
840 unsigned int inbranch : 1;
842 /* Doubly linked list of SIMD clones. */
845 /* Original cgraph node the SIMD clones were created for. */
848 /* Annotated function arguments for the original function. */
849 cgraph_simd_clone_arg GTY((length ("%h.nargs"))) args[1];
850};
852/* Function Multiversioning info. */
854 /* The cgraph_node for which the function version info is stored. */
856 /* Chains all the semantically identical function versions. The
857 first function in this chain is the version_info node of the
858 default function. */
860 /* If this version node corresponds to a dispatcher for function
861 versions, this points to the version info node of the default
862 function, the first node in the chain. */
864 /* If this node corresponds to a function version, this points
865 to the dispatcher function decl, which is the function that must
866 be called to execute the right function version at run-time.
867
868 If this cgraph node is a dispatcher (if dispatcher_function is
869 true, in the cgraph_node struct) for function versions, this
870 points to resolver function, which holds the function body of the
871 dispatcher. The dispatcher decl is an alias to the resolver
872 function decl. */
875 /* The assmbly name of the function set before version mangling. */
878
879#define DEFCIFCODE(code, type, string) CIF_ ## code,
880/* Reasons for inlining failures. */
881
883#include "cif-code.def"
884 CIF_N_REASONS
891};
892
894
895struct cgraph_edge_hasher : ggc_ptr_hash<cgraph_edge>
896{
897 typedef gimple *compare_type;
898
899 static hashval_t hash (cgraph_edge *);
900 static hashval_t hash (gimple *);
901 static bool equal (cgraph_edge *, gimple *);
902};
903
904/* The cgraph data structure.
905 Each function decl has assigned cgraph_node listing callees and callers. */
906
907struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
908{
909 friend class symbol_table;
911 /* Constructor. */
912 explicit cgraph_node ()
918 inlined_to (NULL), rtl (NULL),
919 count (profile_count::uninitialized ()),
920 count_materialization_scale (REG_BR_PROB_BASE), profile_id (0),
921 unit_id (0), tp_first_run (0), thunk (false),
922 used_as_abstract_origin (false),
923 lowered (false), process (false), frequency (NODE_FREQUENCY_NORMAL),
924 only_called_at_startup (false), only_called_at_exit (false),
925 tm_clone (false), dispatcher_function (false),
926 dispatcher_resolver_function (false), is_target_clone (false),
927 calls_comdat_local (false),
928 icf_merged (false), nonfreeing_fn (false), merged_comdat (false),
929 merged_extern_inline (false), parallelized_function (false),
930 split_part (false), indirect_call_target (false), local (false),
931 versionable (false), can_change_signature (false),
932 redefined_extern_inline (false), tm_may_enter_irr (false),
933 ipcp_clone (false), gc_candidate (false),
934 called_by_ifunc_resolver (false), has_omp_variant_constructs (false),
935 m_summary_id (-1)
936 {}
937
938 /* Remove the node from cgraph and all inline clones inlined into it.
939 Skip however removal of FORBIDDEN_NODE and return true if it needs to be
940 removed. This allows to call the function from outer loop walking clone
941 tree. */
942 bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL);
943
944 /* Record all references from cgraph_node that are taken
945 in statement STMT. */
946 void record_stmt_references (gimple *stmt);
947
948 /* Like cgraph_set_call_stmt but walk the clone tree and update all
949 clones sharing the same function body.
950 When WHOLE_SPECULATIVE_EDGES is true, all three components of
951 speculative edge gets updated. Otherwise we update only direct
952 call. */
953 void set_call_stmt_including_clones (gimple *old_stmt, gcall *new_stmt,
954 bool update_speculative = true);
955
956 /* Walk the alias chain to return the function cgraph_node is alias of.
957 Walk through thunk, too.
958 When AVAILABILITY is non-NULL, get minimal availability in the chain.
959 When REF is non-NULL, assume that reference happens in symbol REF
960 when determining the availability. */
961 cgraph_node *function_symbol (enum availability *avail = NULL,
962 struct symtab_node *ref = NULL);
963
964 /* Walk the alias chain to return the function cgraph_node is alias of.
965 Walk through non virtual thunks, too. Thus we return either a function
966 or a virtual thunk node.
967 When AVAILABILITY is non-NULL, get minimal availability in the chain.
968 When REF is non-NULL, assume that reference happens in symbol REF
969 when determining the availability. */
970 cgraph_node *function_or_virtual_thunk_symbol
971 (enum availability *avail = NULL,
972 struct symtab_node *ref = NULL);
973
974 /* Create node representing clone of N executed COUNT times. Decrease
975 the execution counts from original node too.
976 The new clone will have decl set to DECL that may or may not be the same
977 as decl of N.
978
979 When UPDATE_ORIGINAL is true, the counts are subtracted from the original
980 function's profile to reflect the fact that part of execution is handled
981 by node.
982 When CALL_DUPLICATION_HOOK is true, the ipa passes are acknowledged about
983 the new clone. Otherwise the caller is responsible for doing so later.
984
985 If the new node is being inlined into another one, NEW_INLINED_TO should be
986 the outline function the new one is (even indirectly) inlined to.
987 All hooks will see this in node's inlined_to, when invoked.
988 Should be NULL if the node is not inlined.
989
990 SUFFIX is string that is appended to the original name, it should only be
991 NULL if NEW_INLINED_TO is not NULL or if the clone being created is
992 temporary and a record about it should not be added into the ipa-clones
993 dump file. */
994 cgraph_node *create_clone (tree decl, profile_count count,
995 bool update_original,
996 vec<cgraph_edge *> redirect_callers,
997 bool call_duplication_hook,
998 cgraph_node *new_inlined_to,
999 ipa_param_adjustments *param_adjustments,
1000 const char *suffix);
1001
1002 /* Create callgraph node clone with new declaration. The actual body will be
1003 copied later at compilation stage. The name of the new clone will be
1004 constructed from the name of the original node, SUFFIX and NUM_SUFFIX. */
1005 cgraph_node *create_virtual_clone (const vec<cgraph_edge *> &redirect_callers,
1006 vec<ipa_replace_map *, va_gc> *tree_map,
1007 ipa_param_adjustments *param_adjustments,
1008 const char * suffix, unsigned num_suffix);
1009
1010 /* Remove the node from the tree of virtual and inline clones and make it a
1011 standalone node - not a clone any more. */
1012 void remove_from_clone_tree ();
1013
1014 /* cgraph node being removed from symbol table; see if its entry can be
1015 replaced by other inline clone. */
1016 cgraph_node *find_replacement (struct clone_info *);
1017
1018 /* Create a new cgraph node which is the new version of
1019 callgraph node. REDIRECT_CALLERS holds the callers
1020 edges which should be redirected to point to
1021 NEW_VERSION. ALL the callees edges of the node
1022 are cloned to the new version node. Return the new
1023 version node.
1024
1025 If non-NULL BLOCK_TO_COPY determine what basic blocks
1026 was copied to prevent duplications of calls that are dead
1027 in the clone.
1028
1029 SUFFIX is string that is appended to the original name. */
1030
1031 cgraph_node *create_version_clone (tree new_decl,
1032 vec<cgraph_edge *> redirect_callers,
1033 bitmap bbs_to_copy,
1034 const char *suffix = NULL);
1035
1036 /* Perform function versioning.
1037 Function versioning includes copying of the tree and
1038 a callgraph update (creating a new cgraph node and updating
1039 its callees and callers).
1040
1041 REDIRECT_CALLERS varray includes the edges to be redirected
1042 to the new version.
1043
1044 TREE_MAP is a mapping of tree nodes we want to replace with
1045 new ones (according to results of prior analysis).
1046
1047 If non-NULL PARAM_ADJUSTMENTS determine how function formal parameters
1048 should be modified in the new version and if it should return void.
1049 If non-NULL BLOCK_TO_COPY determine what basic blocks to copy.
1050 If non_NULL NEW_ENTRY determine new entry BB of the clone.
1051 SUFFIX is a string that will be used to create a new name for the new
1052 function.
1053
1054 If TARGET_ATTRIBUTES is non-null, when creating a new declaration,
1055 add the attributes to DECL_ATTRIBUTES. And call valid_attribute_p
1056 that will promote value of the attribute DECL_FUNCTION_SPECIFIC_TARGET
1057 of the declaration.
1058
1059 If VERSION_DECL is set true, use clone_function_name_numbered for the
1060 function clone. Otherwise, use clone_function_name.
1061
1062 Return the new version's cgraph node. */
1063 cgraph_node *create_version_clone_with_body
1064 (vec<cgraph_edge *> redirect_callers,
1065 vec<ipa_replace_map *, va_gc> *tree_map,
1066 ipa_param_adjustments *param_adjustments,
1067 bitmap bbs_to_copy, basic_block new_entry_block, const char *suffix,
1068 tree target_attributes = NULL_TREE, bool version_decl = true);
1069
1070 /* Insert a new cgraph_function_version_info node into cgraph_fnver_htab
1071 corresponding to cgraph_node. */
1072 cgraph_function_version_info *insert_new_function_version (void);
1073
1074 /* Get the cgraph_function_version_info node corresponding to node. */
1075 cgraph_function_version_info *function_version (void);
1076
1077 /* Discover all functions and variables that are trivially needed, analyze
1078 them as well as all functions and variables referred by them */
1079 void analyze (void);
1080
1081 /* Add thunk alias into callgraph. The alias declaration is ALIAS and it
1082 aliases DECL with an adjustments made into the first parameter.
1083 See comments in struct symtab-thunks.h for detail on the parameters. */
1084 cgraph_node * create_thunk (tree alias, tree, bool this_adjusting,
1085 HOST_WIDE_INT fixed_offset,
1086 HOST_WIDE_INT virtual_value,
1087 HOST_WIDE_INT indirect_offset,
1088 tree virtual_offset,
1089 tree real_alias);
1090
1091
1092 /* Return node that alias is aliasing. */
1093 inline cgraph_node *get_alias_target (void);
1094
1095 /* Given function symbol, walk the alias chain to return the function node
1096 is alias of. Do not walk through thunks.
1097 When AVAILABILITY is non-NULL, get minimal availability in the chain.
1098 When REF is non-NULL, assume that reference happens in symbol REF
1099 when determining the availability. */
1100
1101 cgraph_node *ultimate_alias_target (availability *availability = NULL,
1102 symtab_node *ref = NULL);
1103
1104 /* Call expand_thunk on all callers that are thunks and analyze those
1105 nodes that were expanded. */
1106 void expand_all_artificial_thunks ();
1107
1108 /* Assemble thunks and aliases associated to node. */
1109 void assemble_thunks_and_aliases (void);
1110
1111 /* Expand function specified by node. */
1112 void expand (void);
1113
1114 /* Creates a wrapper from cgraph_node to TARGET node. Thunk is used for this
1115 kind of wrapper method. */
1116 void create_wrapper (cgraph_node *target);
1117
1118 /* Verify cgraph nodes of the cgraph node. */
1119 void DEBUG_FUNCTION verify_node (void);
1120
1121 /* Remove function from symbol table. */
1122 void remove (void);
1123
1124 /* Dump call graph node to file F. */
1125 void dump (FILE *f);
1126
1127 /* Dump call graph node to file F. */
1128 void dump_graphviz (FILE *f);
1129
1130 /* Dump call graph node to stderr. */
1131 void DEBUG_FUNCTION debug (void);
1132
1133 /* When doing LTO, read cgraph_node's body from disk if it is not already
1134 present. */
1135 bool get_untransformed_body ();
1136
1137 /* Prepare function body. When doing LTO, read cgraph_node's body from disk
1138 if it is not already present. When some IPA transformations are scheduled,
1139 apply them. */
1140 bool get_body ();
1141
1142 void materialize_clone (void);
1143
1144 /* Release memory used to represent body of function.
1145 Use this only for functions that are released before being translated to
1146 target code (i.e. RTL). Functions that are compiled to RTL and beyond
1147 are free'd in final.cc via free_after_compilation(). */
1148 void release_body (bool keep_arguments = false);
1149
1150 /* Return the DECL_STRUCT_FUNCTION of the function. */
1151 struct function *get_fun () const;
1152
1153 /* Bring cgraph node local. */
1154 void make_local (void);
1155
1156 /* Likewise indicate that a node is having address taken. */
1157 void mark_address_taken (void);
1158
1159 /* Set finalization priority to PRIORITY. */
1160 void set_fini_priority (priority_type priority);
1161
1162 /* Return the finalization priority. */
1163 priority_type get_fini_priority (void);
1164
1165 /* Create edge from a given function to CALLEE in the cgraph. */
1166 cgraph_edge *create_edge (cgraph_node *callee,
1167 gcall *call_stmt, profile_count count,
1168 bool cloning_p = false);
1169
1170 /* Create an indirect edge with a yet-undetermined callee where the call
1171 statement destination is a formal parameter of the caller with index
1172 PARAM_INDEX. */
1173 cgraph_edge *create_indirect_edge (gcall *call_stmt, int ecf_flags,
1174 profile_count count,
1175 bool cloning_p = false);
1176
1177 /* Like cgraph_create_edge walk the clone tree and update all clones sharing
1178 same function body. If clones already have edge for OLD_STMT; only
1179 update the edge same way as cgraph_set_call_stmt_including_clones does. */
1180 void create_edge_including_clones (cgraph_node *callee,
1181 gimple *old_stmt, gcall *stmt,
1182 profile_count count,
1183 cgraph_inline_failed_t reason);
1184
1185 /* Return the callgraph edge representing the GIMPLE_CALL statement
1186 CALL_STMT. */
1187 cgraph_edge *get_edge (gimple *call_stmt);
1188
1189 /* Collect all callers of cgraph_node and its aliases that are known to lead
1190 to NODE (i.e. are not overwritable) and that are not thunks. */
1191 auto_vec<cgraph_edge *> collect_callers (void);
1192
1193 /* Remove all callers from the node. */
1194 void remove_callers (void);
1195
1196 /* Remove all callees from the node. */
1197 void remove_callees (void);
1198
1199 /* Return function availability. See cgraph.h for description of individual
1200 return values. */
1201 enum availability get_availability (symtab_node *ref = NULL);
1202
1203 /* Set TREE_NOTHROW on cgraph_node's decl and on aliases of the node
1204 if any to NOTHROW. */
1205 bool set_nothrow_flag (bool nothrow);
1206
1207 /* SET DECL_IS_MALLOC on cgraph_node's decl and on aliases of the node
1208 if any. */
1209 bool set_malloc_flag (bool malloc_p);
1210
1211 /* SET TREE_THIS_VOLATILE on cgraph_node's decl and on aliases of the node
1212 if any. */
1213 bool set_noreturn_flag (bool noreturn_p);
1214
1215 /* If SET_CONST is true, mark function, aliases and thunks to be ECF_CONST.
1216 If SET_CONST if false, clear the flag.
1217
1218 When setting the flag be careful about possible interposition and
1219 do not set the flag for functions that can be interposed and set pure
1220 flag for functions that can bind to other definition.
1221
1222 Return true if any change was done. */
1223
1224 bool set_const_flag (bool set_const, bool looping);
1225
1226 /* Set DECL_PURE_P on cgraph_node's decl and on aliases of the node
1227 if any to PURE.
1228
1229 When setting the flag, be careful about possible interposition.
1230 Return true if any change was done. */
1231
1232 bool set_pure_flag (bool pure, bool looping);
1233
1234 /* Add attribute ATTR to cgraph_node's decl and on aliases of the node
1235 if any. */
1236 bool add_detected_attribute (const char *attr);
1237
1238 /* Call callback on function and aliases associated to the function.
1239 When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are
1240 skipped. */
1241
1242 bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *,
1243 void *),
1244 void *data, bool include_overwritable);
1245
1246 /* Call callback on cgraph_node, thunks and aliases associated to NODE.
1247 When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are
1248 skipped. When EXCLUDE_VIRTUAL_THUNKS is true, virtual thunks are
1249 skipped. */
1250 bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node,
1251 void *data),
1252 void *data,
1253 bool include_overwritable,
1254 bool exclude_virtual_thunks = false);
1255
1256 /* Likewise indicate that a node is needed, i.e. reachable via some
1257 external means. */
1258 inline void mark_force_output (void);
1259
1260 /* Return true when function can be marked local. */
1261 bool local_p (void);
1262
1263 /* Return true if cgraph_node can be made local for API change.
1264 Extern inline functions and C++ COMDAT functions can be made local
1265 at the expense of possible code size growth if function is used in multiple
1266 compilation units. */
1267 bool can_be_local_p (void);
1268
1269 /* Return true when cgraph_node cannot return or throw and thus
1270 it is safe to ignore its side effects for IPA analysis. */
1271 bool cannot_return_p (void);
1272
1273 /* Return true when function cgraph_node and all its aliases are only called
1274 directly.
1275 i.e. it is not externally visible, address was not taken and
1276 it is not used in any other non-standard way. */
1277 bool only_called_directly_p (void);
1278
1279 /* Turn profile to global0. Walk into inlined functions. */
1280 void make_profile_local ();
1281
1282 /* Turn profile to global0. Walk into inlined functions. */
1283 void make_profile_global0 (profile_quality quality);
1284
1285 /* Scale profile by NUM/DEN. Walk into inlined funtion. */
1286 void apply_scale (profile_count num, profile_count den);
1287
1288 /* Scale profile to given IPA_COUNT.
1289 IPA_COUNT should pass ipa_p () with a single exception.
1290 It can be also GUESSED_LOCAL in case we want to
1291 drop any IPA info about the profile. */
1292 void scale_profile_to (profile_count ipa_count);
1293
1294 /* Return true when function is only called directly or it has alias.
1295 i.e. it is not externally visible, address was not taken and
1296 it is not used in any other non-standard way. */
1297 inline bool only_called_directly_or_aliased_p (void);
1298
1299 /* Return true when function cgraph_node can be expected to be removed
1300 from program when direct calls in this compilation unit are removed.
1301
1302 As a special case COMDAT functions are
1303 cgraph_can_remove_if_no_direct_calls_p while the are not
1304 cgraph_only_called_directly_p (it is possible they are called from other
1305 unit)
1306
1307 This function behaves as cgraph_only_called_directly_p because eliminating
1308 all uses of COMDAT function does not make it necessarily disappear from
1309 the program unless we are compiling whole program or we do LTO. In this
1310 case we know we win since dynamic linking will not really discard the
1311 linkonce section.
1312
1313 If WILL_INLINE is true, assume that function will be inlined into all the
1314 direct calls. */
1315 bool will_be_removed_from_program_if_no_direct_calls_p
1316 (bool will_inline = false);
1317
1318 /* Return true when function can be removed from callgraph
1319 if all direct calls and references are eliminated. The function does
1320 not take into account comdat groups. */
1321 bool can_remove_if_no_direct_calls_and_refs_p (void);
1322
1323 /* Return true when function cgraph_node and its aliases can be removed from
1324 callgraph if all direct calls are eliminated.
1325 If WILL_INLINE is true, assume that function will be inlined into all the
1326 direct calls. */
1327 bool can_remove_if_no_direct_calls_p (bool will_inline = false);
1328
1329 /* Return true when callgraph node is a function with Gimple body defined
1330 in current unit. Functions can also be define externally or they
1331 can be thunks with no Gimple representation.
1332
1333 Note that at WPA stage, the function body may not be present in memory. */
1334 inline bool has_gimple_body_p (void);
1335
1336 /* Return true if this node represents a former, i.e. an expanded, thunk. */
1337 bool former_thunk_p (void);
1338
1339 /* Check if function calls comdat local. This is used to recompute
1340 calls_comdat_local flag after function transformations. */
1341 bool check_calls_comdat_local_p ();
1342
1343 /* Return true if function should be optimized for size. */
1344 enum optimize_size_level optimize_for_size_p (void);
1345
1346 /* Dump the callgraph to file F. */
1347 static void dump_cgraph (FILE *f);
1348
1349 /* Dump the call graph to stderr. */
1350 static inline
1351 void debug_cgraph (void)
1352 {
1353 dump_cgraph (stderr);
1354 }
1356 /* Get summary id of the node. */
1357 inline int get_summary_id ()
1358 {
1359 return m_summary_id;
1360 }
1361
1362 /* Adds DECL to the FN_V structure of semantically identical functions. */
1363 static void add_function_version (cgraph_function_version_info *fn_v,
1364 tree decl);
1365
1366 /* Remove the cgraph_function_version_info and cgraph_node for DECL. This
1367 DECL is a duplicate declaration. */
1368 static void delete_function_version_by_decl (tree decl);
1369
1370 static void delete_function_version (cgraph_function_version_info *);
1371
1372 /* Add the function FNDECL to the call graph.
1373 Unlike finalize_function, this function is intended to be used
1374 by middle end and allows insertion of new function at arbitrary point
1375 of compilation. The function can be either in high, low or SSA form
1376 GIMPLE.
1377
1378 The function is assumed to be reachable and have address taken (so no
1379 API breaking optimizations are performed on it).
1380
1381 Main work done by this function is to enqueue the function for later
1382 processing to avoid need the passes to be re-entrant. */
1383 static void add_new_function (tree fndecl, bool lowered);
1385 /* Return callgraph node for given symbol and check it is a function. */
1386 static inline cgraph_node *get (const_tree decl)
1387 {
1388 gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL);
1390 }
1391
1392 /* DECL has been parsed. Take it, queue it, compile it at the whim of the
1393 logic in effect. If NO_COLLECT is true, then our caller cannot stand to
1394 have the garbage collector run at the moment. We would need to either
1395 create a new GC context, or just not compile right now. */
1396 static void finalize_function (tree, bool);
1397
1398 /* Return cgraph node assigned to DECL. Create new one when needed. */
1399 static cgraph_node * create (tree decl);
1400
1401 /* Try to find a call graph node for declaration DECL and if it does not
1402 exist or if it corresponds to an inline clone, create a new one. */
1403 static cgraph_node * get_create (tree);
1404
1405 /* Return local info for the compiled function. */
1406 static cgraph_node *local_info_node (tree decl);
1407
1408 /* Return RTL info for the compiled function. */
1409 static struct cgraph_rtl_info *rtl_info (const_tree);
1410
1411 /* Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME.
1412 Return NULL if there's no such node. */
1413 static cgraph_node *get_for_asmname (tree asmname);
1414
1415 /* Attempt to mark ALIAS as an alias to DECL. Return alias node if
1416 successful and NULL otherwise.
1417 Same body aliases are output whenever the body of DECL is output,
1418 and cgraph_node::get (ALIAS) transparently
1419 returns cgraph_node::get (DECL). */
1420 static cgraph_node * create_same_body_alias (tree alias, tree decl);
1421
1422 /* Verify whole cgraph structure. */
1423 static void DEBUG_FUNCTION verify_cgraph_nodes (void);
1424
1425 /* Verify cgraph, if consistency checking is enabled. */
1426 static inline void checking_verify_cgraph_nodes (void);
1427
1428 /* Worker to bring NODE local. */
1429 static bool make_local (cgraph_node *node, void *);
1430
1431 /* Mark ALIAS as an alias to DECL. DECL_NODE is cgraph node representing
1432 the function body is associated
1433 with (not necessarily cgraph_node (DECL). */
1434 static cgraph_node *create_alias (tree alias, tree target);
1435
1436 /* Return true if NODE has thunk. */
1437 static bool has_thunk_p (cgraph_node *node, void *);
1441 /* List of edges representing indirect calls with a yet undetermined
1442 callee. */
1448 /* For functions with many calls sites it holds map from call expression
1449 to the edge to speed up cgraph_edge function. */
1451 /* Declaration node used to be clone of. */
1453
1454 /* If this is a SIMD clone, this points to the SIMD specific
1455 information for it. */
1457 /* If this function has SIMD clones, this points to the first clone. */
1459
1460 /* Interprocedural passes scheduled to have their transform functions
1461 applied next time we execute local pass on them. We maintain it
1462 per-function in order to allow IPA passes to introduce new functions. */
1464
1465 /* For inline clones this points to the function they will be
1466 inlined into. */
1468
1469 struct cgraph_rtl_info *rtl;
1471 /* Expected number of executions: calculated in profile.cc. */
1473 /* How to scale counts at materialization time; used to merge
1474 LTO units with different number of profile runs. */
1476 /* ID assigned by the profiling. */
1477 unsigned int profile_id;
1478 /* ID of the translation unit. */
1480 /* Time profiler: first run of function. */
1481 int tp_first_run;
1483 /* True when symbol is a thunk. */
1484 unsigned thunk : 1;
1485 /* Set when decl is an abstract function pointed to by the
1486 ABSTRACT_DECL_ORIGIN of a reachable function. */
1488 /* Set once the function is lowered (i.e. its CFG is built). */
1489 unsigned lowered : 1;
1490 /* Set once the function has been instantiated and its callee
1491 lists created. */
1492 unsigned process : 1;
1493 /* How commonly executed the node is. Initialized during branch
1494 probabilities pass. */
1495 ENUM_BITFIELD (node_frequency) frequency : 2;
1496 /* True when function can only be called at startup (from static ctor). */
1498 /* True when function can only be called at startup (from static dtor). */
1499 unsigned only_called_at_exit : 1;
1500 /* True when function is the transactional clone of a function which
1501 is called only from inside transactions. */
1502 /* ?? We should be able to remove this. We have enough bits in
1503 cgraph to calculate it. */
1504 unsigned tm_clone : 1;
1505 /* True if this decl is a dispatcher for function versions. */
1507 /* True if this decl is a resolver for function versions. */
1508 unsigned dispatcher_resolver_function : 1;
1509 /* True this is part of a multiversioned set and this version comes from a
1510 target_clone attribute. Or if this is a dispatched symbol or resolver
1511 and the default version comes from a target_clones. */
1512 unsigned is_target_clone : 1;
1513 /* True if this decl calls a COMDAT-local function. This is set up in
1514 compute_fn_summary and inline_call. */
1516 /* True if node has been created by merge operation in IPA-ICF. */
1517 unsigned icf_merged: 1;
1518 /* True if call to node can't result in a call to free, munmap or
1519 other operation that could make previously non-trapping memory
1520 accesses trapping. */
1521 unsigned nonfreeing_fn : 1;
1522 /* True if there was multiple COMDAT bodies merged by lto-symtab. */
1523 unsigned merged_comdat : 1;
1524 /* True if this def was merged with extern inlines. */
1526 /* True if function was created to be executed in parallel. */
1528 /* True if function is part split out by ipa-split. */
1529 unsigned split_part : 1;
1530 /* True if the function appears as possible target of indirect call. */
1531 unsigned indirect_call_target : 1;
1532 /* Set when function is visible in current compilation unit only and
1533 its address is never taken. */
1534 unsigned local : 1;
1535 /* False when there is something makes versioning impossible. */
1536 unsigned versionable : 1;
1537 /* False when function calling convention and signature cannot be changed.
1538 This is the case when __builtin_apply_args is used. */
1539 unsigned can_change_signature : 1;
1540 /* True when the function has been originally extern inline, but it is
1541 redefined now. */
1543 /* True if the function may enter serial irrevocable mode. */
1544 unsigned tm_may_enter_irr : 1;
1545 /* True if this was a clone created by ipa-cp. */
1546 unsigned ipcp_clone : 1;
1547 /* True if the function should only be emitted if it is used. This flag
1548 is set for local SIMD clones when they are created and cleared if the
1549 vectorizer uses them. */
1550 unsigned gc_candidate : 1;
1551 /* Set if the function is called by an IFUNC resolver. */
1553 /* True if the function contains unresolved OpenMP metadirectives. */
1554 unsigned has_omp_variant_constructs : 1;
1555
1556private:
1558 /* Summary id that is recycled. */
1559 int m_summary_id;
1560
1561 /* Worker for call_for_symbol_and_aliases. */
1562 bool call_for_symbol_and_aliases_1 (bool (*callback) (cgraph_node *,
1563 void *),
1564 void *data, bool include_overwritable);
1565};
1566
1567/* A cgraph node set is a collection of cgraph nodes. A cgraph node
1568 can appear in multiple sets. */
1577
1578struct varpool_node;
1579
1580/* A varpool node set is a collection of varpool nodes. A varpool node
1581 can appear in multiple sets. */
1586};
1588/* Iterator structure for cgraph node sets. */
1592 unsigned index;
1593};
1595/* Iterator structure for varpool node sets. */
1599 unsigned index;
1600};
1601
1602/* Context of polymorphic call. It represent information about the type of
1603 instance that may reach the call. This is used by ipa-devirt walkers of the
1604 type inheritance graph. */
1605
1607public:
1608 /* The called object appears in an object of type OUTER_TYPE
1609 at offset OFFSET. When information is not 100% reliable, we
1610 use SPECULATIVE_OUTER_TYPE and SPECULATIVE_OFFSET. */
1611 HOST_WIDE_INT offset;
1612 HOST_WIDE_INT speculative_offset;
1615 /* True if outer object may be in construction or destruction. */
1617 /* True if outer object may be of derived type. */
1618 unsigned maybe_derived_type : 1;
1619 /* True if speculative outer object may be of derived type. We always
1620 speculate that construction does not happen. */
1621 unsigned speculative_maybe_derived_type : 1;
1622 /* True if the context is invalid and all calls should be redirected
1623 to BUILTIN_UNREACHABLE. */
1624 unsigned invalid : 1;
1625 /* True if the outer type is dynamic. */
1626 unsigned dynamic : 1;
1627
1628 /* Build empty "I know nothing" context. */
1630 /* Build polymorphic call context for indirect call E. */
1632 /* Build polymorphic call context for IP invariant CST.
1633 If specified, OTR_TYPE specify the type of polymorphic call
1634 that takes CST+OFFSET as a parameter. */
1635 ipa_polymorphic_call_context (tree cst, tree otr_type = NULL,
1636 HOST_WIDE_INT offset = 0);
1637 /* Build context for pointer REF contained in FNDECL at statement STMT.
1638 if INSTANCE is non-NULL, return pointer to the object described by
1639 the context. */
1640 ipa_polymorphic_call_context (tree fndecl, tree ref, gimple *stmt,
1641 tree *instance = NULL);
1642
1643 /* Look for vtable stores or constructor calls to work out dynamic type
1644 of memory location. */
1645 bool get_dynamic_type (tree, tree, tree, gimple *, unsigned *);
1646
1647 /* Make context non-speculative. */
1648 void clear_speculation ();
1649
1650 /* Produce context specifying all derived types of OTR_TYPE. If OTR_TYPE is
1651 NULL, the context is set to dummy "I know nothing" setting. */
1652 void clear_outer_type (tree otr_type = NULL);
1653
1654 /* Walk container types and modify context to point to actual class
1655 containing OTR_TYPE (if non-NULL) as base class.
1656 Return true if resulting context is valid.
1657
1658 When CONSIDER_PLACEMENT_NEW is false, reject contexts that may be made
1659 valid only via allocation of new polymorphic type inside by means
1660 of placement new.
1661
1662 When CONSIDER_BASES is false, only look for actual fields, not base types
1663 of TYPE. */
1664 bool restrict_to_inner_class (tree otr_type,
1665 bool consider_placement_new = true,
1666 bool consider_bases = true);
1667
1668 /* Adjust all offsets in contexts by given number of bits. */
1669 void offset_by (HOST_WIDE_INT);
1670 /* Use when we cannot track dynamic type change. This speculatively assume
1671 type change is not happening. */
1672 void possible_dynamic_type_change (bool, tree otr_type = NULL);
1673 /* Assume that both THIS and a given context is valid and strengthen THIS
1674 if possible. Return true if any strengthening was made.
1675 If actual type the context is being used in is known, OTR_TYPE should be
1676 set accordingly. This improves quality of combined result. */
1679
1680 /* Return TRUE if context is fully useless. */
1681 bool useless_p () const;
1682 /* Return TRUE if this context conveys the same information as X. */
1683 bool equal_to (const ipa_polymorphic_call_context &x) const;
1684
1685 /* Dump human readable context to F. If NEWLINE is true, it will be
1686 terminated by a newline. */
1687 void dump (FILE *f, bool newline = true) const;
1688 void DEBUG_FUNCTION debug () const;
1689
1690 /* LTO streaming. */
1691 void stream_out (struct output_block *) const;
1692 void stream_in (class lto_input_block *, class data_in *data_in);
1693
1694private:
1695 bool combine_speculation_with (tree, HOST_WIDE_INT, bool, tree);
1696 bool meet_speculation_with (tree, HOST_WIDE_INT, bool, tree);
1697 void set_by_decl (tree, HOST_WIDE_INT);
1698 bool set_by_invariant (tree, tree, HOST_WIDE_INT);
1699 bool speculation_consistent_p (tree, HOST_WIDE_INT, bool, tree) const;
1700 void make_speculative (tree otr_type = NULL);
1701};
1702
1703/* Structure containing additional information about an indirect call. */
1704
1706{
1707public:
1708 /* When agg_content is set, an offset where the call pointer is located
1709 within the aggregate. */
1710 HOST_WIDE_INT offset;
1711 /* Context of the polymorphic call; use only when POLYMORPHIC flag is set. */
1713 /* OBJ_TYPE_REF_TOKEN of a polymorphic call (if polymorphic is set). */
1714 HOST_WIDE_INT otr_token;
1715 /* Type of the object from OBJ_TYPE_REF_OBJECT. */
1717 /* Index of the parameter that is called. */
1719 /* ECF flags determined from the caller. */
1720 int ecf_flags;
1722 /* Number of speculative call targets, it's less than GCOV_TOPN_VALUES. */
1723 unsigned num_speculative_call_targets : 16;
1724
1725 /* Set when the call is a virtual call with the parameter being the
1726 associated object pointer rather than a simple direct call. */
1727 unsigned polymorphic : 1;
1728 /* Set when the call is a call of a pointer loaded from contents of an
1729 aggregate at offset. */
1730 unsigned agg_contents : 1;
1731 /* Set when this is a call through a member pointer. */
1732 unsigned member_ptr : 1;
1733 /* When the agg_contents bit is set, this one determines whether the
1734 destination is loaded from a parameter passed by reference. */
1735 unsigned by_ref : 1;
1736 /* When the agg_contents bit is set, this one determines whether we can
1737 deduce from the function body that the loaded value from the reference is
1738 never modified between the invocation of the function and the load
1739 point. */
1740 unsigned guaranteed_unmodified : 1;
1741 /* For polymorphic calls this specify whether the virtual table pointer
1742 may have changed in between function entry and the call. */
1743 unsigned vptr_changed : 1;
1745
1746class GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"),
1747 for_user)) cgraph_edge
1749public:
1750 friend struct cgraph_node;
1751 friend class symbol_table;
1752
1753 /* Remove EDGE from the cgraph. */
1754 static void remove (cgraph_edge *edge);
1755
1756 /* Change field call_stmt of edge E to NEW_STMT. If UPDATE_DERIVED_EDGES and
1757 E is any component of speculative edge, then update all components.
1758 Speculations can be resolved in the process and EDGE can be removed and
1759 deallocated. Return the edge that now represents the call. If
1760 UPDATE_DERIVED_EDGES and E is a part of a callback edge, update all
1761 associated edges and return the callback-carrying edge. */
1762 static cgraph_edge *set_call_stmt (cgraph_edge *e, gcall *new_stmt,
1763 bool update_derived_edges = true);
1764
1765 /* Redirect callee of the edge to N. The function does not update underlying
1766 call expression. */
1767 void redirect_callee (cgraph_node *n);
1768
1769 /* If the edge does not lead to a thunk, simply redirect it to N. Otherwise
1770 create one or more equivalent thunks for N and redirect E to the first in
1771 the chain. Note that it is then necessary to call
1772 n->expand_all_artificial_thunks once all callers are redirected. */
1774
1775 /* Make an indirect edge with an unknown callee an ordinary edge leading to
1776 CALLEE. Speculations can be resolved in the process and EDGE can be
1777 removed and deallocated. Return the edge that now represents the
1778 call. */
1780
1781 /* Turn edge into speculative call calling N2. Update
1782 the profile so the direct call is taken COUNT times
1783 with FREQUENCY. speculative_id is used to link direct calls with their
1784 corresponding IPA_REF_ADDR references when representing speculative calls.
1785 */
1787 unsigned int speculative_id = 0);
1788
1789 /* Create a callback edge, representing an indirect call to n2
1790 passed to a function by argument. Sets has_callback flag of the original
1791 edge. Both edges are attached to the same call statement. Returns created
1792 callback edge. */
1793 cgraph_edge *make_callback (cgraph_node *n2, unsigned int callback_hash);
1794
1795 /* Returns the callback-carrying edge of a callback edge or NULL, if such edge
1796 cannot be found. An edge is considered callback-carrying, if it has it's
1797 has_callback flag set and shares it's call statement with the edge
1798 this method is caled on. */
1800
1801 /* Returns the first callback edge in the list of callees of the caller node.
1802 Note that the edges might be in arbitrary order. Must be called on a
1803 callback or callback-carrying edge. */
1805
1806 /* Given a callback edge, returns the next callback edge belonging to the same
1807 callback-carrying edge. Must be called on a callback edge, not the
1808 callback-carrying edge. */
1810
1811 /* When called on a callback-carrying edge, removes all of its attached
1812 callback edges and sets has_callback to FALSE. */
1813 void purge_callback_edges ();
1814
1815 /* Speculative call consists of an indirect edge and one or more
1816 direct edge+ref pairs. Speculative will expand to the following sequence:
1817
1818 if (call_dest == target1) // reference to target1
1819 target1 (); // direct call to target1
1820 else if (call_dest == target2) // reference to targt2
1821 target2 (); // direct call to target2
1822 else
1823 call_dest (); // indirect call
1824
1825 Before the expansion we will have indirect call and the direct call+ref
1826 pairs all linked to single statement.
1827
1828 Note that ref may point to different symbol than the corresponding call
1829 becuase the speculated edge may have been optimized (redirected to
1830 a clone) or inlined.
1831
1832 Given an edge which is part of speculative call, return the first
1833 direct call edge in the speculative call sequence.
1834
1835 In the example above called on any cgraph edge in the sequence it will
1836 return direct call to target1. */
1838
1839 /* Return next speculative call target or NULL if there is none.
1840 All targets are required to form an interval in the callee list.
1842 In example above, if called on call to target1 it will return call to
1843 target2. */
1845 {
1846 cgraph_edge *e = this;
1848
1849 if (e->next_callee && e->next_callee->speculative
1850 && e->next_callee->call_stmt == e->call_stmt
1851 && e->next_callee->lto_stmt_uid == e->lto_stmt_uid)
1852 return e->next_callee;
1853 return NULL;
1854 }
1856 /* When called on any edge in the speculative call return the (unique)
1857 indirect call edge in the speculative call sequence. */
1859 {
1861 if (!callee)
1862 return this;
1863 for (cgraph_edge *e2 = caller->indirect_calls;
1864 true; e2 = e2->next_callee)
1865 if (e2->speculative
1866 && call_stmt == e2->call_stmt
1867 && lto_stmt_uid == e2->lto_stmt_uid)
1868 return e2;
1869 }
1870
1871 /* When called on any edge in speculative call and when given any target
1872 of ref which is speculated to it returns the corresponding direct call.
1873
1874 In example above if called on function target2 it will return call to
1875 target2. */
1876 cgraph_edge *speculative_call_for_target (cgraph_node *);
1878 /* Return REF corresponding to direct call in the specualtive call
1879 sequence. */
1881 {
1882 ipa_ref *ref;
1883
1885 for (unsigned int i = 0; caller->iterate_reference (i, ref); i++)
1886 if (ref->speculative && ref->speculative_id == speculative_id
1887 && ref->stmt == (gimple *)call_stmt
1888 && ref->lto_stmt_uid == lto_stmt_uid)
1889 return ref;
1890 gcc_unreachable ();
1891 }
1892
1893 /* Speculative call edge turned out to be direct call to CALLEE_DECL. Remove
1894 the speculative call sequence and return edge representing the call, the
1895 original EDGE can be removed and deallocated. It is up to caller to
1896 redirect the call as appropriate. Return the edge that now represents the
1897 call.
1898
1899 For "speculative" indirect call that contains multiple "speculative"
1900 targets (i.e. edge->indirect_info->num_speculative_call_targets > 1),
1901 decrease the count and only remove current direct edge.
1902
1903 If no speculative direct call left to the speculative indirect call, remove
1904 the speculative of both the indirect call and corresponding direct edge.
1905
1906 It is up to caller to iteratively resolve each "speculative" direct call
1907 and redirect the call as appropriate. */
1908 static cgraph_edge *resolve_speculation (cgraph_edge *edge,
1909 tree callee_decl = NULL);
1910
1911 /* If necessary, change the function declaration in the call statement
1912 associated with edge E so that it corresponds to the edge callee.
1913 Speculations can be resolved in the process and EDGE can be removed and
1914 deallocated.
1915
1916 The edge could be one of speculative direct call generated from speculative
1917 indirect call. In this circumstance, decrease the speculative targets
1918 count (i.e. num_speculative_call_targets) and redirect call stmt to the
1919 corresponding i-th target. If no speculative direct call left to the
1920 speculative indirect call, remove "speculative" of the indirect call and
1921 also redirect stmt to it's final direct target.
1922
1923 When called from within tree-inline, KILLED_SSAs has to contain the
1924 pointer to killed_new_ssa_names within the copy_body_data structure and
1925 SSAs discovered to be useless (if LHS is removed) will be added to it,
1926 otherwise it needs to be NULL.
1927
1928 It is up to caller to iteratively transform each "speculative"
1929 direct call as appropriate. */
1930 static gimple *redirect_call_stmt_to_callee (cgraph_edge *e,
1931 hash_set <tree>
1932 *killed_ssas = nullptr);
1933
1934 /* Create clone of edge in the node N represented
1935 by CALL_EXPR the callgraph. */
1936 cgraph_edge * clone (cgraph_node *n, gcall *call_stmt, unsigned stmt_uid,
1938 bool update_original);
1939
1940 /* Verify edge count and frequency. */
1941 bool verify_count ();
1942
1943 /* Return true when call of edge cannot lead to return from caller
1944 and thus it is safe to ignore its side effects for IPA analysis
1945 when computing side effects of the caller. */
1946 bool cannot_lead_to_return_p (void);
1947
1948 /* Return true when the edge represents a direct recursion. */
1949 bool recursive_p (void);
1950
1951 /* Return true if the edge may be considered hot after scalling its count. */
1952 bool maybe_hot_p ();
1953
1954 /* Return true if the edge may be considered hot after scalling its count
1955 (i.e. assume that optimization would reduce runtime for callee,
1956 possibly significantly). */
1957 bool maybe_hot_p (sreal scale);
1958
1959 /* Get unique identifier of the edge. */
1960 inline int get_uid ()
1961 {
1962 return m_uid;
1964
1965 /* Get summary id of the edge. */
1966 inline int get_summary_id ()
1967 {
1968 return m_summary_id;
1969 }
1970
1971 /* Rebuild cgraph edges for current function node. This needs to be run after
1972 passes that don't update the cgraph. */
1973 static unsigned int rebuild_edges (void);
1974
1975 /* Rebuild cgraph references for current function node. This needs to be run
1976 after passes that don't update the cgraph. */
1977 static void rebuild_references (void);
1978
1979 /* During LTO stream in this can be used to check whether call can possibly
1980 be internal to the current translation unit. */
1981 bool possibly_call_in_translation_unit_p (void);
1982
1983 /* Return num_speculative_targets of this edge. */
1986 /* Expected number of executions: calculated in profile.cc. */
1995 /* Additional information about an indirect call. Not cleared when an edge
1996 becomes direct. */
1998 void *GTY ((skip (""))) aux;
1999 /* When equal to CIF_OK, inline this call. Otherwise, points to the
2000 explanation why function was not inlined. */
2002 /* The stmt_uid of call_stmt. This is used by LTO to recover the call_stmt
2003 when the function is serialized in. */
2004 unsigned int lto_stmt_uid;
2005 /* speculative id is used to link direct calls with their corresponding
2006 IPA_REF_ADDR references when representing speculative calls. */
2007 unsigned int speculative_id : 16;
2008 /* Whether this edge was made direct by indirect inlining. */
2009 unsigned int indirect_inlining_edge : 1;
2010 /* Whether this edge describes an indirect call with an undetermined
2011 callee. */
2012 unsigned int indirect_unknown_callee : 1;
2013 /* Whether this edge is still a dangling */
2014 /* True if the corresponding CALL stmt cannot be inlined. */
2015 unsigned int call_stmt_cannot_inline_p : 1;
2016 /* Can this call throw externally? */
2017 unsigned int can_throw_external : 1;
2018 /* Edges with SPECULATIVE flag represents indirect calls that was
2019 speculatively turned into direct (i.e. by profile feedback).
2020 The final code sequence will have form:
2021
2022 if (call_target == expected_fn)
2023 expected_fn ();
2024 else
2025 call_target ();
2026
2027 Every speculative call is represented by three components attached
2028 to a same call statement:
2029 1) a direct call (to expected_fn)
2030 2) an indirect call (to call_target)
2031 3) a IPA_REF_ADDR reference to expected_fn.
2033 Optimizers may later redirect direct call to clone, so 1) and 3)
2034 do not need to necessarily agree with destination. */
2035 unsigned int speculative : 1;
2036 /* Edges with CALLBACK flag represent indirect calls to functions passed
2037 to their callers by argument. This is useful in cases, where the body
2038 of these caller functions is not known, e. g. qsort in glibc or
2039 GOMP_parallel in libgomp. These edges are never made into real calls,
2040 but are used instead to optimize these callback functions and later replace
2041 their addresses with their optimized versions. Edges with this flag set
2042 share their call statement with their callback-carrying edge. */
2043 unsigned int callback : 1;
2044 /* Edges with this flag set have one or more callback edges attached. They
2045 share their call statements with this edge. This flag represents the fact
2046 that the callee of this edge takes a function and it's parameters by
2047 argument and calls it at a later time. */
2048 unsigned int has_callback : 1;
2049 /* Used to pair callback edges and the attributes that originated them
2050 together. Currently the index of the callback argument, retrieved
2051 from the attribute. */
2052 unsigned int callback_id : 16;
2053 /* Set to true when caller is a constructor or destructor of polymorphic
2054 type. */
2055 unsigned in_polymorphic_cdtor : 1;
2056
2057 /* Return true if call must bind to current definition. */
2058 bool binds_to_current_def_p ();
2059
2060 /* Expected frequency of executions within the function.
2061 When set to CGRAPH_FREQ_BASE, the edge is expected to be called once
2062 per function call. The range is 0 to CGRAPH_FREQ_MAX. */
2063 int frequency ();
2064
2065 /* Expected frequency of executions within the function. */
2067
2068 /* Expected frequency of executions within the function.
2069 If edge is speculative, sum all its indirect targets. */
2071private:
2072 /* Unique id of the edge. */
2074
2075 /* Summary id that is recycled. */
2076 int m_summary_id;
2077
2078 /* Remove the edge from the list of the callers of the callee. */
2079 void remove_caller (void);
2080
2081 /* Remove the edge from the list of the callees of the caller. */
2082 void remove_callee (void);
2083
2084 /* Set callee N of call graph edge and add it to the corresponding set of
2085 callers. */
2086 void set_callee (cgraph_node *n);
2087
2088 /* Output flags of edge to a file F. */
2089 void dump_edge_flags (FILE *f);
2090
2091 /* Dump edge to stderr. */
2092 void DEBUG_FUNCTION debug (void);
2093
2094 /* Verify that call graph edge corresponds to DECL from the associated
2095 statement. Return true if the verification should fail. */
2096 bool verify_corresponds_to_fndecl (tree decl);
2098
2099#define CGRAPH_FREQ_BASE 1000
2100#define CGRAPH_FREQ_MAX 100000
2101
2102/* The varpool data structure.
2103 Each static variable decl has assigned varpool_node. */
2104
2105struct GTY((tag ("SYMTAB_VARIABLE"))) varpool_node : public symtab_node
2106{
2107 /* Constructor. */
2108 explicit varpool_node ()
2111 {}
2112
2113 /* Dump given varpool node to F. */
2114 void dump (FILE *f);
2115
2116 /* Dump given varpool node to stderr. */
2117 void DEBUG_FUNCTION debug (void);
2118
2119 /* Remove variable from symbol table. */
2120 void remove (void);
2121
2122 /* Remove node initializer when it is no longer needed. */
2123 void remove_initializer (void);
2124
2125 void analyze (void);
2126
2127 /* Return variable availability. */
2129
2130 /* When doing LTO, read variable's constructor from disk if
2131 it is not already present. */
2132 tree get_constructor (void);
2133
2134 /* Return true if variable has constructor that can be used for folding. */
2135 bool ctor_useable_for_folding_p (void);
2136
2137 /* For given variable pool node, walk the alias chain to return the function
2138 the variable is alias of. Do not walk through thunks.
2139 When AVAILABILITY is non-NULL, get minimal availability in the chain.
2140 When REF is non-NULL, assume that reference happens in symbol REF
2141 when determining the availability. */
2144
2145 /* Return node that alias is aliasing. */
2146 inline varpool_node *get_alias_target (void);
2147
2148 /* Output one variable, if necessary. Return whether we output it. */
2149 bool assemble_decl (void);
2150
2151 /* For variables in named sections make sure get_variable_section
2152 is called before we switch to those sections. Then section
2153 conflicts between read-only and read-only requiring relocations
2154 sections can be resolved. */
2155 void finalize_named_section_flags (void);
2156
2157 /* Call callback on varpool symbol and aliases associated to varpool symbol.
2158 When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are
2159 skipped. */
2160 bool call_for_symbol_and_aliases (bool (*callback) (varpool_node *, void *),
2161 void *data,
2162 bool include_overwritable);
2163
2164 /* Return true when variable should be considered externally visible. */
2165 bool externally_visible_p (void);
2166
2167 /* Return true when all references to variable must be visible
2168 in ipa_ref_list.
2169 i.e. if the variable is not externally visible or not used in some magic
2170 way (asm statement or such).
2171 The magic uses are all summarized in force_output flag. */
2172 inline bool all_refs_explicit_p ();
2173
2174 /* Return true when variable can be removed from variable pool
2175 if all direct calls are eliminated. */
2176 inline bool can_remove_if_no_refs_p (void);
2177
2178 /* Add the variable DECL to the varpool.
2179 Unlike finalize_decl function is intended to be used
2180 by middle end and allows insertion of new variable at arbitrary point
2181 of compilation. */
2182 static void add (tree decl);
2183
2184 /* Return varpool node for given symbol and check it is a function. */
2185 static inline varpool_node *get (const_tree decl);
2186
2187 /* Mark DECL as finalized. By finalizing the declaration, frontend instruct
2188 the middle end to output the variable to asm file, if needed or externally
2189 visible. */
2190 static void finalize_decl (tree decl);
2191
2192 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
2193 Extra name aliases are output whenever DECL is output. */
2195
2196 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
2197 Extra name aliases are output whenever DECL is output. */
2198 static varpool_node * create_alias (tree, tree);
2199
2200 /* Dump the variable pool to F. */
2201 static void dump_varpool (FILE *f);
2202
2203 /* Dump the variable pool to stderr. */
2204 static void DEBUG_FUNCTION debug_varpool (void);
2205
2206 /* Allocate new callgraph node and insert it into basic data structures. */
2207 static varpool_node *create_empty (void);
2208
2209 /* Return varpool node assigned to DECL. Create new one when needed. */
2210 static varpool_node *get_create (tree decl);
2211
2212 /* Given an assembler name, lookup node. */
2214
2215 /* Set when variable is scheduled to be assembled. */
2216 unsigned output : 1;
2218 /* Set if the variable is dynamically initialized, except for
2219 function local statics. */
2220 unsigned dynamically_initialized : 1;
2221
2222 ENUM_BITFIELD(tls_model) tls_model : 3;
2223
2224 /* Set if the variable is known to be used by single function only.
2225 This is computed by ipa_single_use pass and used by late optimizations
2226 in places where optimization would be valid for local static variable
2227 if we did not do any inter-procedural code movement. */
2228 unsigned used_by_single_function : 1;
2229
2230private:
2231 /* Assemble thunks and aliases associated to varpool node. */
2232 void assemble_aliases (void);
2233
2234 /* Worker for call_for_node_and_aliases. */
2235 bool call_for_symbol_and_aliases_1 (bool (*callback) (varpool_node *, void *),
2236 void *data,
2237 bool include_overwritable);
2238};
2240/* Every top level asm statement is put into a asm_node. */
2241
2242struct GTY ((tag ("TOPLEVEL_ASM"))) asm_node: public toplevel_node {
2243 explicit asm_node (tree asm_str)
2245 {}
2246 /* Next asm node. */
2247 asm_node *next;
2248 /* String for this asm node. */
2249 tree asm_str;
2250};
2251
2252/* Report whether or not THIS symtab node is a function, aka cgraph_node. */
2253
2254template <>
2255template <>
2256inline bool
2258{
2259 return p && p->type == SYMTAB_FUNCTION;
2260}
2261
2262/* Report whether or not THIS symtab node is a variable, aka varpool_node. */
2263
2264template <>
2265template <>
2266inline bool
2268{
2269 return p && p->type == SYMTAB_VARIABLE;
2270}
2271
2272/* Report whether or not THIS toplevel node is a function, aka cgraph_node. */
2273
2274template <>
2275template <>
2276inline bool
2278{
2279 return p && p->type == SYMTAB_FUNCTION;
2280}
2281
2282/* Report whether or not THIS toplevel node is a variable, aka varpool_node. */
2283
2284template <>
2285template <>
2286inline bool
2288{
2289 return p && p->type == SYMTAB_VARIABLE;
2290}
2291
2292/* Report whether or not THIS toplevel node is a symtab_node. */
2293
2294template <>
2295template <>
2296inline bool
2298{
2299 return p && p->type >= SYMTAB_SYMBOL;
2300}
2301
2302/* Report whether or not THIS toplevel node is a toplevel assembly, aka
2303 asm_node. */
2304
2305template <>
2306template <>
2307inline bool
2309{
2310 return p && p->type == TOPLEVEL_ASM;
2313typedef void (*cgraph_edge_hook)(cgraph_edge *, void *);
2314typedef void (*cgraph_node_hook)(cgraph_node *, void *);
2315typedef void (*varpool_node_hook)(varpool_node *, void *);
2316typedef void (*cgraph_2edge_hook)(cgraph_edge *, cgraph_edge *, void *);
2317typedef void (*cgraph_2node_hook)(cgraph_node *, cgraph_node *, void *);
2318
2325/* Map from a symbol to initialization/finalization priorities. */
2326struct GTY(()) symbol_priority_map {
2329};
2330
2332{
2333 /* Frontend is parsing and finalizing functions. */
2334 PARSING,
2335 /* Callgraph is being constructed. It is safe to add new functions. */
2337 /* Callgraph is being streamed-in at LTO time. */
2339 /* Callgraph is built and early IPA passes are being run. */
2340 IPA,
2341 /* Callgraph is built and all functions are transformed to SSA form. */
2343 /* All inline decisions are done; it is now possible to remove extern inline
2344 functions and virtual call targets. */
2346 /* Functions are now ordered and being passed to RTL expanders. */
2347 EXPANSION,
2348 /* All cgraph expansion is done. */
2350};
2352struct asmname_hasher : ggc_ptr_hash <symtab_node>
2353{
2354 typedef const_tree compare_type;
2355
2356 static hashval_t hash (symtab_node *n);
2357 static bool equal (symtab_node *n, const_tree t);
2358};
2359
2360/* Core summaries maintained about symbols. */
2362struct thunk_info;
2363template <class T> class function_summary;
2364typedef function_summary <thunk_info *> thunk_summary;
2366struct clone_info;
2367template <class T> class function_summary;
2368typedef function_summary <clone_info *> clone_summary;
2369
2370class GTY((tag ("SYMTAB"))) symbol_table
2372public:
2373 friend struct symtab_node;
2391 {
2392 }
2393
2394 /* Initialize callgraph dump file. */
2395 void initialize (void);
2396
2397 /* Register a top-level asm statement ASM_STR. */
2398 inline asm_node *finalize_toplevel_asm (tree asm_str);
2399
2400 /* Analyze the whole compilation unit once it is parsed completely. */
2401 void finalize_compilation_unit (void);
2402
2403 /* C++ frontend produce same body aliases all over the place, even before PCH
2404 gets streamed out. It relies on us linking the aliases with their function
2405 in order to do the fixups, but ipa-ref is not PCH safe. Consequently we
2406 first produce aliases without links, but once C++ FE is sure it won't
2407 stream PCH we build the links via this function. */
2408 void process_same_body_aliases (void);
2409
2410 /* Perform simple optimizations based on callgraph. */
2411 void compile (void);
2412
2413 /* Process CGRAPH_NEW_FUNCTIONS and perform actions necessary to add these
2414 functions into callgraph in a way so they look like ordinary reachable
2415 functions inserted into callgraph already at construction time. */
2416 void process_new_functions (void);
2417
2418 /* Register a symbol NODE. */
2420
2421 inline void
2422 clear_asm_symbols (void)
2423 {
2424 asmnodes = NULL;
2426 }
2427
2428 /* Perform reachability analysis and reclaim all unreachable nodes. */
2429 bool remove_unreachable_nodes (FILE *file);
2430
2431 /* Optimization of function bodies might've rendered some variables as
2432 unnecessary so we want to avoid these from being compiled. Re-do
2433 reachability starting from variables that are either externally visible
2434 or was referred from the asm output routines. */
2435 void remove_unreferenced_decls (void);
2436
2437 /* Unregister a symbol NODE. */
2438 inline void unregister (symtab_node *node);
2439
2440 /* Allocate new callgraph node and insert it into basic data structures. */
2441 cgraph_node *create_empty (void);
2442
2443 /* Release a callgraph NODE. */
2444 void release_symbol (cgraph_node *node);
2445
2446 /* Output all variables enqueued to be assembled. */
2447 bool output_variables (void);
2448
2449 /* Weakrefs may be associated to external decls and thus not output
2450 at expansion time. Emit all necessary aliases. */
2451 void output_weakrefs (void);
2452
2453 /* Return first static symbol with definition. */
2454 inline symtab_node *first_symbol (void);
2456 /* Return first assembler symbol. */
2457 inline asm_node *
2458 first_asm_symbol (void)
2459 {
2460 return asmnodes;
2461 }
2462
2463 /* Return first static symbol with definition. */
2464 inline symtab_node *first_defined_symbol (void);
2465
2466 /* Return first variable. */
2467 inline varpool_node *first_variable (void);
2468
2469 /* Return next variable after NODE. */
2470 inline varpool_node *next_variable (varpool_node *node);
2471
2472 /* Return first static variable with initializer. */
2473 inline varpool_node *first_static_initializer (void);
2474
2475 /* Return next static variable with initializer after NODE. */
2476 inline varpool_node *next_static_initializer (varpool_node *node);
2477
2478 /* Return first static variable with definition. */
2479 inline varpool_node *first_defined_variable (void);
2480
2481 /* Return next static variable with definition after NODE. */
2482 inline varpool_node *next_defined_variable (varpool_node *node);
2483
2484 /* Return first function with body defined. */
2485 inline cgraph_node *first_defined_function (void);
2486
2487 /* Return next function with body defined after NODE. */
2488 inline cgraph_node *next_defined_function (cgraph_node *node);
2489
2490 /* Return first function. */
2491 inline cgraph_node *first_function (void);
2492
2493 /* Return next function. */
2494 inline cgraph_node *next_function (cgraph_node *node);
2495
2496 /* Return first function with body defined. */
2497 cgraph_node *first_function_with_gimple_body (void);
2498
2499 /* Return next reachable static variable with initializer after NODE. */
2500 inline cgraph_node *next_function_with_gimple_body (cgraph_node *node);
2501
2502 /* Register HOOK to be called with DATA on each removed edge. */
2503 cgraph_edge_hook_list *add_edge_removal_hook (cgraph_edge_hook hook,
2504 void *data);
2505
2506 /* Remove ENTRY from the list of hooks called on removing edges. */
2507 void remove_edge_removal_hook (cgraph_edge_hook_list *entry);
2508
2509 /* Register HOOK to be called with DATA on each removed node. */
2510 cgraph_node_hook_list *add_cgraph_removal_hook (cgraph_node_hook hook,
2511 void *data);
2512
2513 /* Remove ENTRY from the list of hooks called on removing nodes. */
2514 void remove_cgraph_removal_hook (cgraph_node_hook_list *entry);
2515
2516 /* Register HOOK to be called with DATA on each removed node. */
2517 varpool_node_hook_list *add_varpool_removal_hook (varpool_node_hook hook,
2518 void *data);
2519
2520 /* Remove ENTRY from the list of hooks called on removing nodes. */
2521 void remove_varpool_removal_hook (varpool_node_hook_list *entry);
2522
2523 /* Register HOOK to be called with DATA on each inserted node. */
2524 cgraph_node_hook_list *add_cgraph_insertion_hook (cgraph_node_hook hook,
2525 void *data);
2526
2527 /* Remove ENTRY from the list of hooks called on inserted nodes. */
2528 void remove_cgraph_insertion_hook (cgraph_node_hook_list *entry);
2529
2530 /* Register HOOK to be called with DATA on each inserted node. */
2531 varpool_node_hook_list *add_varpool_insertion_hook (varpool_node_hook hook,
2532 void *data);
2533
2534 /* Remove ENTRY from the list of hooks called on inserted nodes. */
2535 void remove_varpool_insertion_hook (varpool_node_hook_list *entry);
2536
2537 /* Register HOOK to be called with DATA on each duplicated edge. */
2538 cgraph_2edge_hook_list *add_edge_duplication_hook (cgraph_2edge_hook hook,
2539 void *data);
2540 /* Remove ENTRY from the list of hooks called on duplicating edges. */
2541 void remove_edge_duplication_hook (cgraph_2edge_hook_list *entry);
2542
2543 /* Register HOOK to be called with DATA on each duplicated node. */
2544 cgraph_2node_hook_list *add_cgraph_duplication_hook (cgraph_2node_hook hook,
2545 void *data);
2546
2547 /* Remove ENTRY from the list of hooks called on duplicating nodes. */
2548 void remove_cgraph_duplication_hook (cgraph_2node_hook_list *entry);
2549
2550 /* Call all edge removal hooks. */
2551 void call_edge_removal_hooks (cgraph_edge *e);
2552
2553 /* Call all node insertion hooks. */
2554 void call_cgraph_insertion_hooks (cgraph_node *node);
2555
2556 /* Call all node removal hooks. */
2557 void call_cgraph_removal_hooks (cgraph_node *node);
2558
2559 /* Call all node duplication hooks. */
2560 void call_cgraph_duplication_hooks (cgraph_node *node, cgraph_node *node2);
2561
2562 /* Call all edge duplication hooks. */
2563 void call_edge_duplication_hooks (cgraph_edge *cs1, cgraph_edge *cs2);
2564
2565 /* Call all node removal hooks. */
2566 void call_varpool_removal_hooks (varpool_node *node);
2567
2568 /* Call all node insertion hooks. */
2569 void call_varpool_insertion_hooks (varpool_node *node);
2570
2571 /* Arrange node to be first in its entry of assembler_name_hash. */
2572 void symtab_prevail_in_asm_name_hash (symtab_node *node);
2573
2574 /* Initialize asm name hash unless. */
2575 void symtab_initialize_asm_name_hash (void);
2576
2577 /* Set the DECL_ASSEMBLER_NAME and update symtab hashtables. */
2579
2580 /* Dump symbol table to F. */
2581 void dump (FILE *f);
2582
2583 /* Dump symbol table to F in graphviz format. */
2584 void dump_graphviz (FILE *f);
2585
2586 /* Dump symbol table to stderr. */
2588
2589 /* Assign a new summary ID for the callgraph NODE. */
2590 inline int assign_summary_id (cgraph_node *node)
2591 {
2592 if (!cgraph_released_summary_ids.is_empty ())
2593 node->m_summary_id = cgraph_released_summary_ids.pop ();
2594 else
2595 node->m_summary_id = cgraph_max_summary_id++;
2596
2597 return node->m_summary_id;
2599
2600 /* Assign a new summary ID for the callgraph EDGE. */
2601 inline int assign_summary_id (cgraph_edge *edge)
2602 {
2603 if (!edge_released_summary_ids.is_empty ())
2604 edge->m_summary_id = edge_released_summary_ids.pop ();
2605 else
2606 edge->m_summary_id = edges_max_summary_id++;
2607
2608 return edge->m_summary_id;
2609 }
2610
2611 /* Return true if assembler names NAME1 and NAME2 leads to the same symbol
2612 name. */
2613 static bool assembler_names_equal_p (const char *name1, const char *name2);
2615 int cgraph_count;
2619 int edges_count;
2620 int edges_max_uid;
2622
2623 /* Vector of released summary IDS for cgraph nodes. */
2625
2626 /* Vector of released summary IDS for cgraph nodes. */
2628
2629 /* Return symbol used to separate symbol name from suffix. */
2632 symtab_node* GTY(()) nodes;
2633 asm_node* GTY(()) asmnodes;
2635
2636 /* The order index of the next symtab node to be created. This is
2637 used so that we can sort the cgraph nodes in order by when we saw
2638 them, to support -fno-toplevel-reorder. */
2640
2641 /* Maximal unit ID used. */
2643
2644 /* Set when whole unit has been analyzed so we can access global info. */
2645 bool global_info_ready;
2646 /* What state callgraph is in right now. */
2647 enum symtab_state state;
2648 /* Set when the cgraph is fully build and the basic flags are computed. */
2650
2652
2653 /* Hash table used to hold sections. */
2655
2656 /* Hash table used to convert assembler names into nodes. */
2658
2659 /* Hash table used to hold init priorities. */
2662 FILE* GTY ((skip)) dump_file;
2664 FILE* GTY ((skip)) ipa_clones_dump_file;
2665
2667
2668 /* Thunk annotations. */
2670
2671 /* Virtual clone annotations. */
2673
2674private:
2675 /* Allocate a cgraph_edge structure and fill it with data according to the
2676 parameters of which only CALLEE can be NULL (when creating an indirect
2677 call edge). CLONING_P should be set if properties that are copied from an
2678 original edge should not be calculated. */
2680 gcall *call_stmt, profile_count count,
2681 bool indir_unknown_callee, bool cloning_p);
2682
2683 /* Put the edge onto the free list. */
2684 void free_edge (cgraph_edge *e);
2685
2686 /* Insert NODE to assembler name hash. */
2687 void insert_to_assembler_name_hash (symtab_node *node, bool with_clones);
2688
2689 /* Remove NODE from assembler name hash. */
2690 void unlink_from_assembler_name_hash (symtab_node *node, bool with_clones);
2691
2692 /* Hash asmnames ignoring the user specified marks. */
2693 static hashval_t decl_assembler_name_hash (const_tree asmname);
2694
2695 /* Compare ASMNAME with the DECL_ASSEMBLER_NAME of DECL. */
2696 static bool decl_assembler_name_equal (tree decl, const_tree asmname);
2697
2698 friend struct asmname_hasher;
2699
2700 /* List of hooks triggered when an edge is removed. */
2702 /* List of hooks trigger_red when a cgraph node is removed. */
2704 /* List of hooks triggered when an edge is duplicated. */
2706 /* List of hooks triggered when a node is duplicated. */
2708 /* List of hooks triggered when an function is inserted. */
2710 /* List of hooks triggered when an variable is inserted. */
2712 /* List of hooks triggered when a node is removed. */
2714};
2715
2716extern GTY(()) symbol_table *symtab;
2717
2719
2720inline hashval_t
2722{
2724 (DECL_ASSEMBLER_NAME (n->decl));
2726
2727inline bool
2729{
2730 return symbol_table::decl_assembler_name_equal (n->decl, t);
2731}
2732
2733/* In cgraph.cc */
2734void cgraph_cc_finalize (void);
2736cgraph_indirect_call_info *cgraph_allocate_init_indirect_info (void);
2737
2738void cgraph_update_edges_for_call_stmt (gimple *, tree, gimple *);
2740
2743
2744/* In cgraphunit.cc */
2745void cgraphunit_cc_finalize (void);
2746int tp_first_run_node_cmp (const void *pa, const void *pb);
2747
2748/* In symtab-thunks.cc */
2749void symtab_thunks_cc_finalize (void);
2750
2751/* Initialize datastructures so DECL is a function in lowered gimple form.
2752 IN_SSA is true if the gimple is in SSA. */
2753basic_block init_lowered_empty_function (tree, bool, profile_count);
2754
2755tree thunk_adjust (gimple_stmt_iterator *, tree, bool, HOST_WIDE_INT, tree,
2756 HOST_WIDE_INT);
2757/* In cgraphclones.cc */
2758
2759tree clone_function_name_numbered (const char *name, const char *suffix);
2760tree clone_function_name_numbered (tree decl, const char *suffix);
2761tree clone_function_name (const char *name, const char *suffix,
2762 unsigned long number);
2763tree clone_function_name (tree decl, const char *suffix,
2764 unsigned long number);
2765tree clone_function_name (tree decl, const char *suffix);
2766tree clone_identifier (tree decl, const char *suffix,
2767 bool filter_suffix = false);
2768
2769void tree_function_versioning (tree, tree, vec<ipa_replace_map *, va_gc> *,
2770 ipa_param_adjustments *,
2771 bool, bitmap, basic_block);
2772
2773void dump_callgraph_transformation (const cgraph_node *original,
2774 const cgraph_node *clone,
2775 const char *suffix);
2776void set_new_clone_decl_and_node_flags (cgraph_node *new_node);
2777/* In cgraphbuild.cc */
2780
2781/* In ipa.cc */
2782void cgraph_build_static_cdtor (char which, tree body, int priority);
2783bool ipa_discover_variable_flags (void);
2784
2785/* In varpool.cc */
2787
2788/* In ipa-inline-analysis.cc */
2789void initialize_inline_failed (struct cgraph_edge *);
2790bool speculation_useful_p (struct cgraph_edge *e, bool anticipate_inlining);
2791
2792/* Return true when the symbol is real symbol, i.e. it is not inline clone
2793 or abstract function kept for debug info purposes only. */
2794inline bool
2796{
2797 cgraph_node *cnode;
2798
2799 if (DECL_ABSTRACT_P (decl))
2800 return false;
2802 return false;
2803 if (!is_a <cgraph_node *> (this))
2804 return true;
2805 cnode = dyn_cast <cgraph_node *> (this);
2806 if (cnode->inlined_to)
2807 return false;
2808 return true;
2809}
2810
2811/* Return true if DECL should have entry in symbol table if used.
2812 Those are functions and static & external variables. */
2813
2814inline bool
2816{
2817 return (TREE_CODE (decl) == FUNCTION_DECL
2818 || (VAR_P (decl)
2819 && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))));
2821
2822inline bool
2824{
2825 symtab_node *source = this;
2826
2827 if (cgraph_node *cn = dyn_cast <cgraph_node *> (target))
2828 {
2829 if (cn->inlined_to)
2830 source = cn->inlined_to;
2831 }
2832 if (cgraph_node *cn = dyn_cast <cgraph_node *> (target))
2833 {
2834 if (cn->inlined_to)
2835 target = cn->inlined_to;
2836 }
2837
2838 return source->get_comdat_group () == target->get_comdat_group ();
2839}
2840
2841/* Return node that alias is aliasing. */
2842
2843inline symtab_node *
2845{
2846 ipa_ref *ref = NULL;
2847 iterate_reference (0, ref);
2849 return ref->referred;
2850}
2851
2852/* Return the DECL (or identifier) that alias is aliasing. Unlike the above,
2853 this works whether or not the alias has been analyzed already. */
2854
2855inline tree
2857{
2858 if (alias_target)
2859 return alias_target;
2860 return get_alias_target ()->decl;
2861}
2862
2863/* Return next reachable static symbol with initializer after the node. */
2864
2865inline symtab_node *
2867{
2868 symtab_node *node1 = next;
2869
2870 for (; node1; node1 = node1->next)
2871 if (node1->definition)
2872 return node1;
2873
2874 return NULL;
2875}
2876
2877/* Iterates I-th reference in the list, REF is also set. */
2878
2879inline ipa_ref *
2881{
2882 ref_list.references.iterate (i, &ref);
2883
2884 return ref;
2885}
2886
2887/* Iterates I-th referring item in the list, REF is also set. */
2888
2889inline ipa_ref *
2891{
2892 ref_list.referring.iterate (i, &ref);
2893
2894 return ref;
2895}
2896
2897/* Iterates I-th referring alias item in the list, REF is also set. */
2898
2899inline ipa_ref *
2901{
2902 ref_list.referring.iterate (i, &ref);
2903
2904 if (ref && ref->use != IPA_REF_ALIAS)
2905 return NULL;
2906
2907 return ref;
2908}
2909
2910/* Return true if list contains an alias. */
2911
2912inline bool
2914{
2915 ipa_ref *ref = NULL;
2916
2917 return (iterate_direct_aliases (0, ref) != NULL);
2918}
2919
2920/* Return true when RESOLUTION indicate that linker will use
2921 the symbol from non-LTO object files. */
2922
2923inline bool
2924resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution resolution)
2925{
2926 return (resolution == LDPR_PREVAILING_DEF
2927 || resolution == LDPR_PREEMPTED_REG
2928 || resolution == LDPR_RESOLVED_EXEC
2929 || resolution == LDPR_RESOLVED_DYN);
2930}
2931
2932/* Return true when symtab_node is known to be used from other (non-LTO)
2933 object file. Known only when doing LTO via linker plugin. */
2934
2935inline bool
2937{
2938 if (!TREE_PUBLIC (decl) || DECL_EXTERNAL (decl))
2939 return false;
2941 return true;
2942 return false;
2943}
2944
2945/* Return varpool node for given symbol and check it is a function. */
2946
2947inline varpool_node *
2949{
2950 gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
2952}
2953
2954/* Register a symbol NODE. */
2955
2956inline void
2958{
2959 node->next = nodes;
2960 node->previous = NULL;
2961
2962 if (nodes)
2963 nodes->previous = node;
2964 nodes = node;
2965
2966 nodes->m_uid = cgraph_max_uid++;
2967
2968 if (node->order == -1)
2969 node->order = order++;
2970}
2971
2972/* Register a top-level asm statement ASM_STR. */
2973
2974asm_node *
2976{
2977 asm_node *node;
2978
2979 node = new (ggc_cleared_alloc<asm_node> ()) asm_node (asm_str);
2980 node->order = order++;
2981
2982 if (asmnodes == NULL)
2983 asmnodes = node;
2984 else
2985 asm_last_node->next = node;
2986
2988 return node;
2989}
2991/* Unregister a symbol NODE. */
2992inline void
2994{
2995 if (node->previous)
2996 node->previous->next = node->next;
2997 else
2998 nodes = node->next;
2999
3000 if (node->next)
3001 node->next->previous = node->previous;
3002
3003 node->next = NULL;
3004 node->previous = NULL;
3005}
3006
3007/* Release a callgraph NODE with UID and put in to the list of free nodes. */
3008
3009inline void
3011{
3012 cgraph_count--;
3013 if (node->m_summary_id != -1)
3014 cgraph_released_summary_ids.safe_push (node->m_summary_id);
3015 ggc_free (node);
3016}
3018/* Return first static symbol with definition. */
3019inline symtab_node *
3021{
3022 return nodes;
3024
3025/* Walk all symbols. */
3026#define FOR_EACH_SYMBOL(node) \
3027 for ((node) = symtab->first_symbol (); (node); (node) = (node)->next)
3029/* Return first static symbol with definition. */
3030inline symtab_node *
3032{
3034
3035 for (node = nodes; node; node = node->next)
3036 if (node->definition)
3037 return node;
3038
3039 return NULL;
3041
3042/* Walk all symbols with definitions in current unit. */
3043#define FOR_EACH_DEFINED_SYMBOL(node) \
3044 for ((node) = symtab->first_defined_symbol (); (node); \
3045 (node) = node->next_defined_symbol ())
3047/* Return first variable. */
3048inline varpool_node *
3050{
3052 for (node = nodes; node; node = node->next)
3054 return vnode;
3055 return NULL;
3056}
3058/* Return next variable after NODE. */
3059inline varpool_node *
3061{
3062 symtab_node *node1 = node->next;
3063 for (; node1; node1 = node1->next)
3064 if (varpool_node *vnode1 = dyn_cast <varpool_node *> (node1))
3065 return vnode1;
3066 return NULL;
3067}
3068/* Walk all variables. */
3069#define FOR_EACH_VARIABLE(node) \
3070 for ((node) = symtab->first_variable (); \
3071 (node); \
3072 (node) = symtab->next_variable ((node)))
3074/* Return first static variable with initializer. */
3075inline varpool_node *
3077{
3079 for (node = nodes; node; node = node->next)
3080 {
3082 if (vnode && DECL_INITIAL (node->decl))
3083 return vnode;
3084 }
3085 return NULL;
3086}
3088/* Return next static variable with initializer after NODE. */
3089inline varpool_node *
3091{
3092 symtab_node *node1 = node->next;
3093 for (; node1; node1 = node1->next)
3094 {
3095 varpool_node *vnode1 = dyn_cast <varpool_node *> (node1);
3096 if (vnode1 && DECL_INITIAL (node1->decl))
3097 return vnode1;
3098 }
3099 return NULL;
3101
3102/* Walk all static variables with initializer set. */
3103#define FOR_EACH_STATIC_INITIALIZER(node) \
3104 for ((node) = symtab->first_static_initializer (); (node); \
3105 (node) = symtab->next_static_initializer (node))
3107/* Return first static variable with definition. */
3108inline varpool_node *
3110{
3112 for (node = nodes; node; node = node->next)
3113 {
3115 if (vnode && vnode->definition)
3116 return vnode;
3117 }
3118 return NULL;
3119}
3121/* Return next static variable with definition after NODE. */
3122inline varpool_node *
3124{
3125 symtab_node *node1 = node->next;
3126 for (; node1; node1 = node1->next)
3127 {
3128 varpool_node *vnode1 = dyn_cast <varpool_node *> (node1);
3129 if (vnode1 && vnode1->definition)
3130 return vnode1;
3131 }
3132 return NULL;
3133}
3134/* Walk all variables with definitions in current unit. */
3135#define FOR_EACH_DEFINED_VARIABLE(node) \
3136 for ((node) = symtab->first_defined_variable (); (node); \
3137 (node) = symtab->next_defined_variable (node))
3139/* Return first function with body defined. */
3140inline cgraph_node *
3142{
3144 for (node = nodes; node; node = node->next)
3145 {
3147 if (cn && cn->definition)
3148 return cn;
3149 }
3150 return NULL;
3151}
3153/* Return next function with body defined after NODE. */
3154inline cgraph_node *
3156{
3157 symtab_node *node1 = node->next;
3158 for (; node1; node1 = node1->next)
3159 {
3161 if (cn1 && cn1->definition)
3162 return cn1;
3163 }
3164 return NULL;
3166
3167/* Walk all functions with body defined. */
3168#define FOR_EACH_DEFINED_FUNCTION(node) \
3169 for ((node) = symtab->first_defined_function (); (node); \
3170 (node) = symtab->next_defined_function ((node)))
3172/* Return first function. */
3173inline cgraph_node *
3175{
3177 for (node = nodes; node; node = node->next)
3179 return cn;
3180 return NULL;
3181}
3183/* Return next function. */
3184inline cgraph_node *
3186{
3187 symtab_node *node1 = node->next;
3188 for (; node1; node1 = node1->next)
3189 if (cgraph_node *cn1 = dyn_cast <cgraph_node *> (node1))
3190 return cn1;
3191 return NULL;
3192}
3194/* Return first function with body defined. */
3195inline cgraph_node *
3197{
3199 for (node = nodes; node; node = node->next)
3200 {
3202 if (cn && cn->has_gimple_body_p ())
3203 return cn;
3204 }
3205 return NULL;
3206}
3208/* Return next reachable static variable with initializer after NODE. */
3209inline cgraph_node *
3211{
3212 symtab_node *node1 = node->next;
3213 for (; node1; node1 = node1->next)
3214 {
3216 if (cn1 && cn1->has_gimple_body_p ())
3217 return cn1;
3218 }
3219 return NULL;
3221
3222/* Walk all functions. */
3223#define FOR_EACH_FUNCTION(node) \
3224 for ((node) = symtab->first_function (); (node); \
3225 (node) = symtab->next_function ((node)))
3226
3227/* Walk all functions but precompute so a node can be deleted if needed. */
3228#define FOR_EACH_FUNCTION_REMOVABLE(node) \
3229 cgraph_node *next; \
3230 for ((node) = symtab->first_function (), \
3231 next = (node) ? symtab->next_function ((node)) : NULL; (node); \
3232 (node) = next, next = (node) ? symtab->next_function ((node)) : NULL)
3233
3234/* Return true when callgraph node is a function with Gimple body defined
3235 in current unit. Functions can also be define externally or they
3236 can be thunks with no Gimple representation.
3237
3238 Note that at WPA stage, the function body may not be present in memory. */
3239
3240inline bool
3242{
3243 return definition && !thunk && !alias;
3245
3246/* Walk all functions with body defined. */
3247#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \
3248 for ((node) = symtab->first_function_with_gimple_body (); (node); \
3249 (node) = symtab->next_function_with_gimple_body (node))
3250
3251/* Uniquize all constants that appear in memory.
3252 Each constant in memory thus far output is recorded
3253 in `const_desc_table'. */
3255struct GTY((for_user)) constant_descriptor_tree {
3256 /* A MEM for the constant. */
3258
3259 /* The value of the constant. */
3260 tree value;
3261
3262 /* Hash of value. Computing the hash from value each time
3263 hashfn is called can't work properly, as that means recursive
3264 use of the hash table during hash table expansion. */
3265 hashval_t hash;
3266};
3267
3268/* Return true when function is only called directly or it has alias.
3269 i.e. it is not externally visible, address was not taken and
3270 it is not used in any other non-standard way. */
3271
3272inline bool
3274{
3276 return (!force_output && !address_taken
3277 && !ifunc_resolver
3279 && !DECL_VIRTUAL_P (decl)
3283 && !externally_visible);
3284}
3285
3286/* Return true when function can be removed from callgraph
3287 if all direct calls are eliminated. */
3288
3289inline bool
3291{
3293 /* Extern inlines can always go, we will use the external definition. */
3294 if (DECL_EXTERNAL (decl))
3295 return true;
3296 /* When function is needed, we cannot remove it. */
3298 return false;
3301 return false;
3302 /* Only COMDAT functions can be removed if externally visible. */
3304 && ((!DECL_COMDAT (decl) || ifunc_resolver)
3305 || forced_by_abi
3307 return false;
3308 return true;
3309}
3310
3311/* Verify cgraph, if consistency checking is enabled. */
3312
3313inline void
3315{
3316 if (flag_checking)
3318}
3319
3320/* Return true when variable can be removed from variable pool
3321 if all direct calls are eliminated. */
3322
3323inline bool
3325{
3326 if (DECL_EXTERNAL (decl))
3327 return true;
3329 && ((DECL_COMDAT (decl)
3330 && !forced_by_abi
3334}
3335
3336/* Return true when all references to variable must be visible in ipa_ref_list.
3337 i.e. if the variable is not externally visible or not used in some magic
3338 way (asm statement or such).
3339 The magic uses are all summarized in force_output flag. */
3340
3341inline bool
3343{
3344 return (definition
3347 && !force_output);
3348}
3349
3350struct tree_descriptor_hasher : ggc_ptr_hash<constant_descriptor_tree>
3351{
3352 static hashval_t hash (constant_descriptor_tree *);
3353 static bool equal (constant_descriptor_tree *, constant_descriptor_tree *);
3354};
3355
3356/* Constant pool accessor function. */
3357hash_table<tree_descriptor_hasher> *constant_pool_htab (void);
3358
3359/* Return node that alias is aliasing. */
3360
3361inline cgraph_node *
3363{
3365}
3366
3367/* Return node that alias is aliasing. */
3368
3369inline varpool_node *
3371{
3373}
3374
3375/* Walk the alias chain to return the symbol NODE is alias of.
3376 If NODE is not an alias, return NODE.
3377 When AVAILABILITY is non-NULL, get minimal availability in the chain.
3378 When REF is non-NULL, assume that reference happens in symbol REF
3379 when determining the availability. */
3380
3381inline symtab_node *
3383 symtab_node *ref)
3384{
3385 if (!alias)
3386 {
3387 if (availability)
3389 return this;
3390 }
3391
3393}
3394
3395/* Given function symbol, walk the alias chain to return the function node
3396 is alias of. Do not walk through thunks.
3397 When AVAILABILITY is non-NULL, get minimal availability in the chain.
3398 When REF is non-NULL, assume that reference happens in symbol REF
3399 when determining the availability. */
3400
3401inline cgraph_node *
3403 symtab_node *ref)
3404{
3407 if (!n && availability)
3409 return n;
3410}
3411
3412/* For given variable pool node, walk the alias chain to return the function
3413 the variable is alias of. Do not walk through thunks.
3414 When AVAILABILITY is non-NULL, get minimal availability in the chain.
3415 When REF is non-NULL, assume that reference happens in symbol REF
3416 when determining the availability. */
3417
3418inline varpool_node *
3420 symtab_node *ref)
3421{
3424
3425 if (!n && availability)
3427 return n;
3428}
3429
3430/* Set callee N of call graph edge and add it to the corresponding set of
3431 callers. */
3432
3433inline void
3435{
3436 prev_caller = NULL;
3437 if (n->callers)
3438 n->callers->prev_caller = this;
3439 next_caller = n->callers;
3440 n->callers = this;
3441 callee = n;
3442}
3443
3444/* Return true when the edge represents a direct recursion. */
3445
3446inline bool
3448{
3449 cgraph_node *c = callee->ultimate_alias_target ();
3450 if (caller->inlined_to)
3451 return caller->inlined_to->decl == c->decl;
3452 else
3453 return caller->decl == c->decl;
3454}
3455
3456/* Remove the edge from the list of the callers of the callee. */
3457
3458inline void
3460{
3462 if (prev_caller)
3463 prev_caller->next_caller = next_caller;
3464 if (next_caller)
3465 next_caller->prev_caller = prev_caller;
3466 if (!prev_caller)
3467 callee->callers = next_caller;
3468}
3469
3470/* Return true if call must bind to current definition. */
3471
3472inline bool
3474{
3475 if (callee)
3476 return callee->binds_to_current_def_p (caller);
3477 else
3478 return false;
3479}
3480
3481/* Expected frequency of executions within the function.
3482 When set to CGRAPH_FREQ_BASE, the edge is expected to be called once
3483 per function call. The range is 0 to CGRAPH_FREQ_MAX. */
3484
3485inline int
3487{
3488 return count.to_cgraph_frequency (caller->inlined_to
3489 ? caller->inlined_to->count
3490 : caller->count);
3491}
3492
3494/* Return true if the TM_CLONE bit is set for a given FNDECL. */
3495inline bool
3497{
3498 cgraph_node *n = cgraph_node::get (fndecl);
3499 if (n)
3500 return n->tm_clone;
3501 return false;
3502}
3503
3504/* Likewise indicate that a node is needed, i.e. reachable via some
3505 external means. */
3506
3507inline void
3509{
3510 force_output = 1;
3512}
3513
3514/* Return true if function should be optimized for size. */
3515
3516inline enum optimize_size_level
3518{
3519 if (opt_for_fn (decl, optimize_size))
3520 return OPTIMIZE_SIZE_MAX;
3521 if (count == profile_count::zero ())
3522 return OPTIMIZE_SIZE_MAX;
3525 else
3526 return OPTIMIZE_SIZE_NO;
3527}
3528
3529/* Return symtab_node for NODE or create one if it is not present
3530 in symtab. */
3531
3532inline symtab_node *
3534{
3535 if (VAR_P (node))
3537 else
3539}
3540
3541/* Return availability of NODE when referenced from REF. */
3542
3543inline enum availability
3545{
3546 if (is_a <cgraph_node *> (this))
3547 return dyn_cast <cgraph_node *> (this)->get_availability (ref);
3548 else
3549 return dyn_cast <varpool_node *> (this)->get_availability (ref);
3550}
3551
3552/* Call callback on symtab node and aliases associated to this node.
3553 When INCLUDE_OVERWRITABLE is false, overwritable symbols are skipped. */
3554
3555inline bool
3557 void *),
3558 void *data,
3559 bool include_overwritable)
3560{
3561 if (include_overwritable
3563 {
3564 if (callback (this, data))
3565 return true;
3566 }
3567 if (has_aliases_p ())
3568 return call_for_symbol_and_aliases_1 (callback, data, include_overwritable);
3569 return false;
3570}
3571
3572/* Call callback on function and aliases associated to the function.
3573 When INCLUDE_OVERWRITABLE is false, overwritable symbols are
3574 skipped. */
3575
3576inline bool
3578 void *),
3579 void *data,
3580 bool include_overwritable)
3581{
3582 if (include_overwritable
3584 {
3585 if (callback (this, data))
3586 return true;
3587 }
3588 if (has_aliases_p ())
3589 return call_for_symbol_and_aliases_1 (callback, data, include_overwritable);
3590 return false;
3591}
3592
3593/* Call callback on varpool symbol and aliases associated to varpool symbol.
3594 When INCLUDE_OVERWRITABLE is false, overwritable symbols are
3595 skipped. */
3596
3597inline bool
3599 void *),
3600 void *data,
3601 bool include_overwritable)
3602{
3603 if (include_overwritable
3605 {
3606 if (callback (this, data))
3607 return true;
3608 }
3609 if (has_aliases_p ())
3610 return call_for_symbol_and_aliases_1 (callback, data, include_overwritable);
3611 return false;
3612}
3613
3614/* Return true if reference may be used in address compare. */
3615
3616inline bool
3618{
3619 if (use != IPA_REF_ADDR)
3620 return false;
3621 /* Addresses taken from virtual tables are never compared. */
3623 && DECL_VIRTUAL_P (referring->decl))
3624 return false;
3625 return referred->address_can_be_compared_p ();
3626}
3627
3628/* Build polymorphic call context for indirect call E. */
3629
3630inline
3632{
3633 gcc_checking_assert (e->indirect_info->polymorphic);
3634 *this = e->indirect_info->context;
3635}
3636
3637/* Build empty "I know nothing" context. */
3638
3639inline
3641{
3644 invalid = false;
3645}
3646
3647/* Make context non-speculative. */
3648
3649inline void
3651{
3655}
3656
3657/* Produce context specifying all derived types of OTR_TYPE. If OTR_TYPE is
3658 NULL, the context is set to dummy "I know nothing" setting. */
3659
3660inline void
3662{
3663 outer_type = otr_type ? TYPE_MAIN_VARIANT (otr_type) : NULL;
3664 offset = 0;
3665 maybe_derived_type = true;
3666 maybe_in_construction = true;
3667 dynamic = true;
3668}
3669
3670/* Adjust all offsets in contexts by OFF bits. */
3671
3672inline void
3674{
3675 if (outer_type)
3676 offset += off;
3678 speculative_offset += off;
3679}
3680
3681/* Return TRUE if context is fully useless. */
3682
3683inline bool
3685{
3686 return (!outer_type && !speculative_outer_type);
3687}
3688
3689/* When using fprintf (or similar), problems can arise with
3690 transient generated strings. Many string-generation APIs
3691 only support one result being alive at once (e.g. by
3692 returning a pointer to a statically-allocated buffer).
3693
3694 If there is more than one generated string within one
3695 fprintf call: the first string gets evicted or overwritten
3696 by the second, before fprintf is fully evaluated.
3697 See e.g. PR/53136.
3698
3699 This function provides a workaround for this, by providing
3700 a simple way to create copies of these transient strings,
3701 without the need to have explicit cleanup:
3702
3703 fprintf (dumpfile, "string 1: %s string 2:%s\n",
3704 xstrdup_for_dump (EXPR_1),
3705 xstrdup_for_dump (EXPR_2));
3706
3707 This is actually a simple wrapper around ggc_strdup, but
3708 the name documents the intent. We require that no GC can occur
3709 within the fprintf call. */
3710
3711inline const char *
3712xstrdup_for_dump (const char *transient_str)
3713{
3714 return ggc_strdup (transient_str);
3715}
3716
3717/* During LTO stream-in this predicate can be used to check whether node
3718 in question prevails in the linking to save some memory usage. */
3719inline bool
3721{
3722 return definition && ((!TREE_PUBLIC (decl) && !DECL_EXTERNAL (decl))
3724}
3725
3726extern GTY(()) symbol_table *saved_symtab;
3727
3728#if CHECKING_P
3729
3730namespace selftest {
3731
3732/* An RAII-style class for use in selftests for temporarily using a different
3733 symbol_table, so that such tests can be isolated from each other. */
3734
3735class symbol_table_test
3736{
3737 public:
3738 /* Constructor. Override "symtab". */
3739 symbol_table_test ();
3740
3741 /* Destructor. Restore the saved_symtab. */
3742 ~symbol_table_test ();
3743};
3744
3745} // namespace selftest
3746
3747#endif /* CHECKING_P */
3748
3749#endif /* GCC_CGRAPH_H */
gcov_type apply_scale(gcov_type freq, gcov_type scale)
Definition basic-block.h:573
void cgraph_update_edges_for_call_stmt(gimple *old_stmt, tree old_decl, gimple *new_stmt)
Definition cgraph.cc:2061
bool cgraph_function_possibly_inlined_p(tree decl)
Definition cgraph.cc:2730
symbol_table * symtab
Definition cgraph.cc:82
cgraph_inline_failed_type_t cgraph_inline_failed_type(cgraph_inline_failed_t reason)
Definition cgraph.cc:2429
cgraph_indirect_call_info * cgraph_allocate_init_indirect_info(void)
Definition cgraph.cc:1167
const char *const cgraph_availability_names[]
Definition cgraph.cc:2445
void release_function_body(tree decl)
Definition cgraph.cc:2165
symbol_table * saved_symtab
Definition cgraph.cc:4789
void cgraph_cc_finalize(void)
Definition cgraph.cc:4638
const char * cgraph_inline_failed_string(cgraph_inline_failed_t reason)
Definition cgraph.cc:2411
symtab_state
Definition cgraph.h:2329
@ LTO_STREAMING
Definition cgraph.h:2335
@ IPA
Definition cgraph.h:2337
@ PARSING
Definition cgraph.h:2331
@ EXPANSION
Definition cgraph.h:2344
@ IPA_SSA_AFTER_INLINING
Definition cgraph.h:2342
@ FINISHED
Definition cgraph.h:2346
@ IPA_SSA
Definition cgraph.h:2339
@ CONSTRUCTION
Definition cgraph.h:2333
const char * cgraph_inline_failed_string(cgraph_inline_failed_t)
Definition cgraph.cc:2411
void(* cgraph_edge_hook)(cgraph_edge *, void *)
Definition cgraph.h:2310
const char * xstrdup_for_dump(const char *transient_str)
Definition cgraph.h:3709
void debuginfo_early_stop(void)
Definition cgraphunit.cc:2547
void debuginfo_start(void)
Definition cgraphunit.cc:2523
void(* cgraph_node_hook)(cgraph_node *, void *)
Definition cgraph.h:2311
tree ctor_for_folding(tree)
Definition varpool.cc:393
struct varpool_node_set_def * varpool_node_set
Definition cgraph.h:1574
cgraph_inline_failed_type_t cgraph_inline_failed_type(cgraph_inline_failed_t)
Definition cgraph.cc:2429
bool ipa_discover_variable_flags(void)
Definition ipa.cc:785
void symtab_thunks_cc_finalize(void)
Definition symtab-thunks.cc:663
void release_function_body(tree)
Definition cgraph.cc:2165
void(* cgraph_2node_hook)(cgraph_node *, cgraph_node *, void *)
Definition cgraph.h:2314
int compute_call_stmt_bb_frequency(tree, basic_block bb)
Definition cgraphbuild.cc:203
void debuginfo_early_init(void)
Definition cgraphunit.cc:2483
cgraph_inline_failed_type_t
Definition cgraph.h:886
@ CIF_FINAL_NORMAL
Definition cgraph.h:887
@ CIF_FINAL_ERROR
Definition cgraph.h:888
void set_new_clone_decl_and_node_flags(cgraph_node *new_node)
Definition cgraphclones.cc:165
bool speculation_useful_p(struct cgraph_edge *e, bool anticipate_inlining)
Definition ipa-inline.cc:1959
bool cgraph_function_possibly_inlined_p(tree)
Definition cgraph.cc:2730
symbol_table * symtab
Definition cgraph.cc:82
void debuginfo_stop(void)
Definition cgraphunit.cc:2531
void record_references_in_initializer(tree, bool)
Definition cgraphbuild.cc:390
cgraph_node_set_def * cgraph_node_set
Definition cgraph.h:1573
basic_block init_lowered_empty_function(tree, bool, profile_count)
Definition cgraphunit.cc:1732
tree clone_function_name_numbered(const char *name, const char *suffix)
Definition cgraphclones.cc:508
void tree_function_versioning(tree, tree, vec< ipa_replace_map *, va_gc > *, ipa_param_adjustments *, bool, bitmap, basic_block)
Definition tree-inline.cc:6329
hash_table< tree_descriptor_hasher > * constant_pool_htab(void)
Definition varasm.cc:3359
void(* cgraph_2edge_hook)(cgraph_edge *, cgraph_edge *, void *)
Definition cgraph.h:2313
void dump_callgraph_transformation(const cgraph_node *original, const cgraph_node *clone, const char *suffix)
Definition cgraphclones.cc:322
bool decl_is_tm_clone(const_tree fndecl)
Definition cgraph.h:3493
void cgraphunit_cc_finalize(void)
Definition cgraphunit.cc:2626
tree clone_function_name(const char *name, const char *suffix, unsigned long number)
Definition cgraphclones.cc:539
cgraph_indirect_call_info * cgraph_allocate_init_indirect_info(void)
Definition cgraph.cc:1167
void cgraph_build_static_cdtor(char which, tree body, int priority)
Definition ipa.cc:938
availability
Definition cgraph.h:74
@ AVAIL_UNSET
Definition cgraph.h:76
@ AVAIL_LOCAL
Definition cgraph.h:92
@ AVAIL_NOT_AVAILABLE
Definition cgraph.h:78
@ AVAIL_INTERPOSABLE
Definition cgraph.h:84
@ AVAIL_AVAILABLE
Definition cgraph.h:87
void debuginfo_early_start(void)
Definition cgraphunit.cc:2539
int tp_first_run_node_cmp(const void *pa, const void *pb)
Definition cgraphunit.cc:1949
void debuginfo_fini(void)
Definition cgraphunit.cc:2512
symbol_partitioning_class
Definition cgraph.h:97
@ SYMBOL_EXTERNAL
Definition cgraph.h:100
@ SYMBOL_PARTITION
Definition cgraph.h:102
@ SYMBOL_DUPLICATE
Definition cgraph.h:105
tree thunk_adjust(gimple_stmt_iterator *, tree, bool, HOST_WIDE_INT, tree, HOST_WIDE_INT)
Definition symtab-thunks.cc:190
void initialize_inline_failed(struct cgraph_edge *)
Definition ipa-inline-analysis.cc:104
tree clone_identifier(tree decl, const char *suffix, bool filter_suffix=false)
Definition cgraphclones.cc:600
bool decl_in_symtab_p(const_tree decl)
Definition cgraph.h:2812
ipa_opt_pass_d * ipa_opt_pass
Definition cgraph.h:38
void cgraph_update_edges_for_call_stmt(gimple *, tree, gimple *)
Definition cgraph.cc:2061
function_summary< thunk_info * > thunk_summary
Definition cgraph.h:2361
toplevel_type
Definition cgraph.h:45
@ TOPLEVEL_MAX
Definition cgraph.h:51
@ TOPLEVEL_ASM
Definition cgraph.h:47
@ TOPLEVEL_BASE
Definition cgraph.h:46
@ SYMTAB_FUNCTION
Definition cgraph.h:49
@ SYMTAB_SYMBOL
Definition cgraph.h:48
@ SYMTAB_VARIABLE
Definition cgraph.h:50
const char *const ld_plugin_symbol_resolution_names[]
Definition symtab.cc:45
const char *const tls_model_names[]
Definition varpool.cc:40
cgraph_simd_clone_arg_type
Definition cgraph.h:747
@ SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP
Definition cgraph.h:751
@ SIMD_CLONE_ARG_TYPE_LINEAR_REF_VARIABLE_STEP
Definition cgraph.h:756
@ SIMD_CLONE_ARG_TYPE_LINEAR_VAL_VARIABLE_STEP
Definition cgraph.h:760
@ SIMD_CLONE_ARG_TYPE_VECTOR
Definition cgraph.h:748
@ SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_VARIABLE_STEP
Definition cgraph.h:758
@ SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP
Definition cgraph.h:757
@ SIMD_CLONE_ARG_TYPE_LINEAR_VARIABLE_STEP
Definition cgraph.h:752
@ SIMD_CLONE_ARG_TYPE_MASK
Definition cgraph.h:761
@ SIMD_CLONE_ARG_TYPE_UNIFORM
Definition cgraph.h:749
@ SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP
Definition cgraph.h:755
@ SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP
Definition cgraph.h:759
void(* varpool_node_hook)(varpool_node *, void *)
Definition cgraph.h:2312
function_summary< clone_info * > clone_summary
Definition cgraph.h:2365
vec< cgraph_node * > cgraph_new_nodes
Definition cgraphunit.cc:217
void cgraph_cc_finalize(void)
Definition cgraph.cc:4638
cgraph_inline_failed_t
Definition cgraph.h:880
void debuginfo_init(void)
Definition cgraphunit.cc:2499
bool resolution_used_from_other_file_p(enum ld_plugin_symbol_resolution resolution)
Definition cgraph.h:2921
Definition cgraph.h:1745
ipa_ref * speculative_call_target_ref()
Definition cgraph.h:1877
void purge_callback_edges()
Definition cgraph.cc:1434
cgraph_edge * speculative_call_indirect_edge()
Definition cgraph.h:1855
unsigned int indirect_inlining_edge
Definition cgraph.h:2006
void remove_caller(void)
Definition cgraph.cc:1227
profile_count count
Definition cgraph.h:1984
cgraph_node * callee
Definition cgraph.h:1986
void dump_edge_flags(FILE *f)
Definition cgraph.cc:2451
static cgraph_edge * make_direct(cgraph_edge *edge, cgraph_node *callee)
Definition cgraph.cc:1604
bool binds_to_current_def_p()
Definition cgraph.h:3470
unsigned int callback
Definition cgraph.h:2040
cgraph_edge * prev_caller
Definition cgraph.h:1987
cgraph_edge * next_caller
Definition cgraph.h:1988
unsigned int can_throw_external
Definition cgraph.h:2014
static cgraph_edge * resolve_speculation(cgraph_edge *edge, tree callee_decl=NULL)
Definition cgraph.cc:1517
int m_summary_id
Definition cgraph.h:2073
int m_uid
Definition cgraph.h:2070
void redirect_callee(cgraph_node *n)
Definition cgraph.cc:1678
unsigned in_polymorphic_cdtor
Definition cgraph.h:2052
cgraph_edge * next_speculative_call_target()
Definition cgraph.h:1841
sreal sreal_frequency()
Definition cgraph.cc:4686
unsigned int speculative_id
Definition cgraph.h:2004
cgraph_indirect_call_info * indirect_info
Definition cgraph.h:1994
static unsigned int rebuild_edges(void)
Definition cgraphbuild.cc:406
cgraph_edge * make_speculative(cgraph_node *n2, profile_count direct_count, unsigned int speculative_id=0)
Definition cgraph.cc:1301
static void rebuild_references(void)
Definition cgraphbuild.cc:451
friend class symbol_table
Definition cgraph.h:1748
unsigned int call_stmt_cannot_inline_p
Definition cgraph.h:2012
int get_summary_id()
Definition cgraph.h:1963
int num_speculative_call_targets_p(void)
Definition cgraph.cc:4751
void set_callee(cgraph_node *n)
Definition cgraph.h:3431
bool maybe_hot_p()
Definition cgraph.cc:3422
cgraph_edge * get_callback_carrying_edge()
Definition cgraph.cc:1381
unsigned int lto_stmt_uid
Definition cgraph.h:2001
void DEBUG_FUNCTION debug(void)
Definition cgraph.cc:2479
bool possibly_call_in_translation_unit_p(void)
Definition cgraph.cc:4717
cgraph_edge * speculative_call_for_target(cgraph_node *)
Definition cgraph.cc:1587
cgraph_node * caller
Definition cgraph.h:1985
enum cgraph_inline_failed_t inline_failed
Definition cgraph.h:1998
unsigned int speculative
Definition cgraph.h:2032
void remove_callee(void)
Definition cgraph.h:3456
static void remove(cgraph_edge *edge)
Definition cgraph.cc:1263
cgraph_edge * first_callback_edge()
Definition cgraph.cc:1399
static gimple * redirect_call_stmt_to_callee(cgraph_edge *e, hash_set< tree > *killed_ssas=nullptr)
Definition cgraph.cc:1737
bool verify_count()
Definition cgraph.cc:3667
unsigned int indirect_unknown_callee
Definition cgraph.h:2009
int get_uid()
Definition cgraph.h:1957
bool cannot_lead_to_return_p(void)
Definition cgraph.cc:3335
unsigned int callback_id
Definition cgraph.h:2049
cgraph_edge * clone(cgraph_node *n, gcall *call_stmt, unsigned stmt_uid, profile_count num, profile_count den, bool update_original)
Definition cgraphclones.cc:98
cgraph_edge * next_callback_edge()
Definition cgraph.cc:1417
cgraph_edge * make_callback(cgraph_node *n2, unsigned int callback_hash)
Definition cgraph.cc:1349
sreal combined_sreal_frequency()
Definition cgraph.cc:4697
bool recursive_p(void)
Definition cgraph.h:3444
int frequency()
Definition cgraph.h:3483
unsigned int has_callback
Definition cgraph.h:2045
cgraph_edge * first_speculative_call_target()
Definition cgraph.cc:1453
cgraph_edge * next_callee
Definition cgraph.h:1990
void * aux
Definition cgraph.h:1995
static cgraph_edge * set_call_stmt(cgraph_edge *e, gcall *new_stmt, bool update_derived_edges=true)
Definition cgraph.cc:961
gcall * call_stmt
Definition cgraph.h:1991
bool verify_corresponds_to_fndecl(tree decl)
Definition cgraph.cc:3701
friend struct cgraph_node
Definition cgraph.h:1747
cgraph_edge * prev_callee
Definition cgraph.h:1989
void redirect_callee_duplicating_thunks(cgraph_node *n)
Definition cgraphclones.cc:278
Definition cgraph.h:1704
HOST_WIDE_INT otr_token
Definition cgraph.h:1712
tree otr_type
Definition cgraph.h:1714
int ecf_flags
Definition cgraph.h:1718
unsigned agg_contents
Definition cgraph.h:1728
unsigned polymorphic
Definition cgraph.h:1725
unsigned member_ptr
Definition cgraph.h:1730
unsigned guaranteed_unmodified
Definition cgraph.h:1738
unsigned vptr_changed
Definition cgraph.h:1741
HOST_WIDE_INT offset
Definition cgraph.h:1708
int param_index
Definition cgraph.h:1716
unsigned by_ref
Definition cgraph.h:1733
ipa_polymorphic_call_context context
Definition cgraph.h:1710
unsigned num_speculative_call_targets
Definition cgraph.h:1721
Definition lto-streamer.h:756
Definition genoutput.cc:150
Definition symbol-summary.h:163
Definition hash-map.h:40
Definition hash-set.h:37
Definition hash-table.h:375
Definition tree-pass.h:142
Definition ipa-param-manipulation.h:211
Definition cgraph.h:1604
void dump(FILE *f, bool newline=true) const
Definition ipa-polymorphic-call.cc:616
bool combine_speculation_with(tree, HOST_WIDE_INT, bool, tree)
Definition ipa-polymorphic-call.cc:1914
void offset_by(HOST_WIDE_INT)
Definition cgraph.h:3670
bool speculation_consistent_p(tree, HOST_WIDE_INT, bool, tree) const
Definition ipa-polymorphic-call.cc:1856
tree outer_type
Definition cgraph.h:1611
unsigned invalid
Definition cgraph.h:1622
unsigned speculative_maybe_derived_type
Definition cgraph.h:1619
HOST_WIDE_INT speculative_offset
Definition cgraph.h:1610
void DEBUG_FUNCTION debug() const
Definition ipa-polymorphic-call.cc:655
unsigned dynamic
Definition cgraph.h:1624
void clear_speculation()
Definition cgraph.h:3647
void clear_outer_type(tree otr_type=NULL)
Definition cgraph.h:3658
unsigned maybe_in_construction
Definition cgraph.h:1614
bool useless_p() const
Definition cgraph.h:3681
ipa_polymorphic_call_context()
Definition cgraph.h:3637
bool meet_with(ipa_polymorphic_call_context, tree otr_type=NULL)
Definition ipa-polymorphic-call.cc:2427
bool set_by_invariant(tree, tree, HOST_WIDE_INT)
Definition ipa-polymorphic-call.cc:760
tree speculative_outer_type
Definition cgraph.h:1612
void make_speculative(tree otr_type=NULL)
Definition ipa-polymorphic-call.cc:2337
bool equal_to(const ipa_polymorphic_call_context &x) const
Definition ipa-polymorphic-call.cc:2375
HOST_WIDE_INT offset
Definition cgraph.h:1609
void possible_dynamic_type_change(bool, tree otr_type=NULL)
Definition ipa-polymorphic-call.cc:2362
bool get_dynamic_type(tree, tree, tree, gimple *, unsigned *)
Definition ipa-polymorphic-call.cc:1566
void set_by_decl(tree, HOST_WIDE_INT)
Definition ipa-polymorphic-call.cc:731
void stream_in(class lto_input_block *, class data_in *data_in)
Definition ipa-polymorphic-call.cc:693
void stream_out(struct output_block *) const
Definition ipa-polymorphic-call.cc:663
bool restrict_to_inner_class(tree otr_type, bool consider_placement_new=true, bool consider_bases=true)
Definition ipa-polymorphic-call.cc:129
bool meet_speculation_with(tree, HOST_WIDE_INT, bool, tree)
Definition ipa-polymorphic-call.cc:2011
unsigned maybe_derived_type
Definition cgraph.h:1616
bool combine_with(ipa_polymorphic_call_context, tree otr_type=NULL)
Definition ipa-polymorphic-call.cc:2107
Definition lto-streamer.h:338
Definition sreal.h:41
Definition cgraph.h:2368
varpool_node_hook_list * add_varpool_removal_hook(varpool_node_hook hook, void *data)
Definition varpool.cc:53
varpool_node * next_defined_variable(varpool_node *node)
Definition cgraph.h:3120
int order
Definition cgraph.h:2636
varpool_node * first_variable(void)
Definition cgraph.h:3046
cgraph_node * first_defined_function(void)
Definition cgraph.h:3138
void change_decl_assembler_name(tree decl, tree name)
Definition symtab.cc:274
varpool_node * next_static_initializer(varpool_node *node)
Definition cgraph.h:3087
hash_table< asmname_hasher > * assembler_name_hash
Definition cgraph.h:2654
void free_edge(cgraph_edge *e)
Definition cgraph.cc:1249
vec< int > edge_released_summary_ids
Definition cgraph.h:2624
int assign_summary_id(cgraph_edge *edge)
Definition cgraph.h:2598
cgraph_2edge_hook_list * add_edge_duplication_hook(cgraph_2edge_hook hook, void *data)
Definition cgraph.cc:574
static char symbol_suffix_separator()
Definition symtab.cc:2578
void remove_cgraph_duplication_hook(cgraph_2node_hook_list *entry)
Definition cgraph.cc:632
void DEBUG_FUNCTION debug(void)
Definition symtab.cc:1068
varpool_node_hook_list * m_first_varpool_insertion_hook
Definition cgraph.h:2708
static bool decl_assembler_name_equal(tree decl, const_tree asmname)
Definition symtab.cc:142
symbol_table()
Definition cgraph.h:2374
cgraph_edge * create_edge(cgraph_node *caller, cgraph_node *callee, gcall *call_stmt, profile_count count, bool indir_unknown_callee, bool cloning_p)
Definition cgraph.cc:1066
symtab_node * first_defined_symbol(void)
Definition cgraph.h:3028
bool global_info_ready
Definition cgraph.h:2642
void clear_asm_symbols(void)
Definition cgraph.h:2419
bool function_flags_ready
Definition cgraph.h:2646
thunk_summary * m_thunks
Definition cgraph.h:2666
friend struct cgraph_edge
Definition cgraph.h:2372
bool output_variables(void)
Definition varpool.cc:729
void remove_varpool_removal_hook(varpool_node_hook_list *entry)
Definition varpool.cc:70
cgraph_edge_hook_list * m_first_edge_removal_hook
Definition cgraph.h:2698
asm_node * asmnodes
Definition cgraph.h:2630
void call_cgraph_duplication_hooks(cgraph_node *node, cgraph_node *node2)
Definition cgraph.cc:644
friend struct symtab_node
Definition cgraph.h:2370
int edges_count
Definition cgraph.h:2616
void compile(void)
Definition cgraphunit.cc:2336
static bool assembler_names_equal_p(const char *name1, const char *name2)
Definition symtab.cc:104
FILE * ipa_clones_dump_file
Definition cgraph.h:2661
cgraph_node * next_defined_function(cgraph_node *node)
Definition cgraph.h:3152
void remove_varpool_insertion_hook(varpool_node_hook_list *entry)
Definition varpool.cc:111
void call_edge_removal_hooks(cgraph_edge *e)
Definition cgraph.cc:479
asm_node * first_asm_symbol(void)
Definition cgraph.h:2455
void release_symbol(cgraph_node *node)
Definition cgraph.h:3007
cgraph_2node_hook_list * m_first_cgraph_duplicated_hook
Definition cgraph.h:2704
cgraph_node_hook_list * add_cgraph_insertion_hook(cgraph_node_hook hook, void *data)
Definition cgraph.cc:545
cgraph_node * next_function(cgraph_node *node)
Definition cgraph.h:3182
hash_table< section_name_hasher > * section_hash
Definition cgraph.h:2651
void output_weakrefs(void)
Definition cgraphunit.cc:2306
bool remove_unreachable_nodes(FILE *file)
Definition ipa.cc:310
void remove_cgraph_insertion_hook(cgraph_node_hook_list *entry)
Definition cgraph.cc:562
void unregister(symtab_node *node)
Definition cgraph.h:2990
cgraph_2node_hook_list * add_cgraph_duplication_hook(cgraph_2node_hook hook, void *data)
Definition cgraph.cc:615
void process_same_body_aliases(void)
Definition cgraphunit.cc:719
varpool_node_hook_list * m_first_varpool_removal_hook
Definition cgraph.h:2710
cgraph_node_hook_list * add_cgraph_removal_hook(cgraph_node_hook hook, void *data)
Definition cgraph.cc:491
clone_summary * m_clones
Definition cgraph.h:2669
hash_set< const cgraph_node * > cloned_nodes
Definition cgraph.h:2663
void initialize(void)
Definition cgraph.cc:430
cgraph_node * next_function_with_gimple_body(cgraph_node *node)
Definition cgraph.h:3207
int cgraph_max_summary_id
Definition cgraph.h:2614
void call_cgraph_insertion_hooks(cgraph_node *node)
Definition cgraph.cc:532
FILE * dump_file
Definition cgraph.h:2659
static hashval_t decl_assembler_name_hash(const_tree asmname)
Definition symtab.cc:82
varpool_node_hook_list * add_varpool_insertion_hook(varpool_node_hook hook, void *data)
Definition varpool.cc:94
void finalize_compilation_unit(void)
Definition cgraphunit.cc:2555
void process_new_functions(void)
Definition cgraphunit.cc:300
void symtab_initialize_asm_name_hash(void)
Definition symtab.cc:260
friend struct asmname_hasher
Definition cgraph.h:2695
int cgraph_max_uid
Definition cgraph.h:2613
void dump_graphviz(FILE *f)
Definition symtab.cc:1058
bool cpp_implicit_aliases_done
Definition cgraph.h:2648
cgraph_node_hook_list * m_first_cgraph_removal_hook
Definition cgraph.h:2700
asm_node * finalize_toplevel_asm(tree asm_str)
Definition cgraph.h:2972
cgraph_node * create_empty(void)
Definition cgraph.cc:442
symtab_node * first_symbol(void)
Definition cgraph.h:3017
int cgraph_count
Definition cgraph.h:2612
cgraph_node * first_function(void)
Definition cgraph.h:3171
void call_cgraph_removal_hooks(cgraph_node *node)
Definition cgraph.cc:520
int max_unit
Definition cgraph.h:2639
vec< int > cgraph_released_summary_ids
Definition cgraph.h:2621
enum symtab_state state
Definition cgraph.h:2644
void remove_edge_removal_hook(cgraph_edge_hook_list *entry)
Definition cgraph.cc:467
cgraph_edge_hook_list * add_edge_removal_hook(cgraph_edge_hook hook, void *data)
Definition cgraph.cc:450
varpool_node * first_static_initializer(void)
Definition cgraph.h:3073
int assign_summary_id(cgraph_node *node)
Definition cgraph.h:2587
cgraph_node_hook_list * m_first_cgraph_insertion_hook
Definition cgraph.h:2706
symtab_node * nodes
Definition cgraph.h:2629
void dump(FILE *f)
Definition symtab.cc:1049
void register_symbol(symtab_node *node)
Definition cgraph.h:2954
void call_varpool_insertion_hooks(varpool_node *node)
Definition varpool.cc:123
varpool_node * first_defined_variable(void)
Definition cgraph.h:3106
int edges_max_uid
Definition cgraph.h:2617
void remove_cgraph_removal_hook(cgraph_node_hook_list *entry)
Definition cgraph.cc:508
void symtab_prevail_in_asm_name_hash(symtab_node *node)
Definition symtab.cc:251
cgraph_2edge_hook_list * m_first_edge_duplicated_hook
Definition cgraph.h:2702
cgraph_node * first_function_with_gimple_body(void)
Definition cgraph.h:3193
void insert_to_assembler_name_hash(symtab_node *node, bool with_clones)
Definition symtab.cc:162
void call_edge_duplication_hooks(cgraph_edge *cs1, cgraph_edge *cs2)
Definition cgraph.cc:603
void remove_edge_duplication_hook(cgraph_2edge_hook_list *entry)
Definition cgraph.cc:591
varpool_node * next_variable(varpool_node *node)
Definition cgraph.h:3057
void unlink_from_assembler_name_hash(symtab_node *node, bool with_clones)
Definition symtab.cc:203
friend struct cgraph_node
Definition cgraph.h:2371
void call_varpool_removal_hooks(varpool_node *node)
Definition varpool.cc:82
asm_node * asm_last_node
Definition cgraph.h:2631
hash_map< symtab_node *, symbol_priority_map > * init_priority_hash
Definition cgraph.h:2657
int edges_max_summary_id
Definition cgraph.h:2618
void remove_unreferenced_decls(void)
Definition varpool.cc:625
bool debug
Definition collect-utils.cc:34
struct basic_block_def * basic_block
Definition coretypes.h:372
struct rtx_def * rtx
Definition coretypes.h:57
optimize_size_level
Definition coretypes.h:477
@ OPTIMIZE_SIZE_BALANCED
Definition coretypes.h:481
@ OPTIMIZE_SIZE_NO
Definition coretypes.h:479
@ OPTIMIZE_SIZE_MAX
Definition coretypes.h:483
class edge_def * edge
Definition coretypes.h:369
tls_model
Definition coretypes.h:212
@ TLS_MODEL_NONE
Definition coretypes.h:213
node_frequency
Definition coretypes.h:271
@ NODE_FREQUENCY_NORMAL
Definition coretypes.h:279
@ NODE_FREQUENCY_UNLIKELY_EXECUTED
Definition coretypes.h:274
const union tree_node * const_tree
Definition coretypes.h:98
#define GTY(x)
Definition coretypes.h:41
class bitmap_head * bitmap
Definition coretypes.h:51
union tree_node * tree
Definition coretypes.h:97
static unsigned int count[debug_counter_number_of_counters]
Definition dbgcnt.cc:50
void change_decl_assembler_name(tree, tree)
void ggc_free(void *)
Definition genmatch.cc:52
T * ggc_cleared_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:217
#define ggc_strdup(S)
Definition ggc.h:281
bool set_comdat_group(symtab_node *symbol, void *head_p)
Definition ipa-comdats.cc:208
ipa_ref_use
Definition ipa-ref.h:31
@ IPA_REF_ALIAS
Definition ipa-ref.h:35
@ IPA_REF_ADDR
Definition ipa-ref.h:34
static int frequency
Definition ira-costs.cc:107
bool is_a(U *p)
Definition is-a.h:230
T dyn_cast(U *p)
Definition is-a.h:280
Definition custom-sarif-properties/state-graphs.h:33
const json::string_property function
Definition dump-context.h:31
void dump(const T &obj)
Definition dump.h:70
section * get_section(const char *, unsigned int, tree, bool not_existing=false)
Definition varasm.cc:291
poly_int< NUM_POLY_INT_COEFFS, unsigned HOST_WIDE_INT > poly_uint64
Definition poly-int-types.h:25
i
Definition poly-int.h:776
profile_quality
Definition profile-count.h:30
#define REG_BR_PROB_BASE
Definition profile-count.h:75
rtx find_replacement(rtx *loc)
Definition reload.cc:6383
Definition cgraph.h:2239
tree asm_str
Definition cgraph.h:2246
asm_node * next
Definition cgraph.h:2244
asm_node(tree asm_str)
Definition cgraph.h:2240
Definition cgraph.h:2350
static bool equal(symtab_node *n, const_tree t)
Definition cgraph.h:2725
static hashval_t hash(symtab_node *n)
Definition cgraph.h:2718
const_tree compare_type
Definition cgraph.h:2351
Definition cgraph.cc:99
Definition cgraph.cc:106
Definition cgraph.h:894
static bool equal(cgraph_edge *, gimple *)
Definition cgraph.cc:851
static hashval_t hash(cgraph_edge *)
Definition cgraph.cc:831
gimple * compare_type
Definition cgraph.h:895
Definition cgraph.cc:85
Definition cgraph.h:851
tree assembler_name
Definition cgraph.h:874
cgraph_node * this_node
Definition cgraph.h:853
cgraph_function_version_info * next
Definition cgraph.h:861
cgraph_function_version_info * prev
Definition cgraph.h:857
tree dispatcher_resolver
Definition cgraph.h:871
Definition cgraph.cc:92
Definition cgraph.h:1568
hash_map< cgraph_node *, size_t > * map
Definition cgraph.h:1569
vec< cgraph_node * > nodes
Definition cgraph.h:1570
Definition cgraph.h:1588
cgraph_node_set set
Definition cgraph.h:1589
unsigned index
Definition cgraph.h:1590
Definition cgraph.h:906
static cgraph_node * get(const_tree decl)
Definition cgraph.h:1384
cgraph_edge * indirect_calls
Definition cgraph.h:1441
void scale_profile_to(profile_count ipa_count)
Definition cgraph.cc:287
unsigned only_called_at_startup
Definition cgraph.h:1495
cgraph_node()
Definition cgraph.h:910
void DEBUG_FUNCTION debug(void)
Definition cgraph.cc:2710
void create_wrapper(cgraph_node *target)
Definition cgraphunit.cc:2641
struct cgraph_rtl_info * rtl
Definition cgraph.h:1467
bool can_remove_if_no_direct_calls_p(bool will_inline=false)
Definition cgraph.cc:3439
static void dump_cgraph(FILE *f)
Definition cgraph.cc:2718
enum node_frequency frequency
Definition cgraph.h:1493
void make_local(void)
Definition cgraph.cc:2894
enum availability get_availability(symtab_node *ref=NULL)
Definition cgraph.cc:2740
unsigned split_part
Definition cgraph.h:1527
unsigned nonfreeing_fn
Definition cgraph.h:1519
bool former_thunk_p(void)
Definition cgraph.cc:4772
void DEBUG_FUNCTION verify_node(void)
Definition cgraph.cc:3891
cgraph_node * create_thunk(tree alias, tree, bool this_adjusting, HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, HOST_WIDE_INT indirect_offset, tree virtual_offset, tree real_alias)
Definition cgraph.cc:769
int count_materialization_scale
Definition cgraph.h:1473
unsigned int profile_id
Definition cgraph.h:1475
cgraph_edge * create_edge(cgraph_node *callee, gcall *call_stmt, profile_count count, bool cloning_p=false)
Definition cgraph.cc:1143
unsigned thunk
Definition cgraph.h:1482
void analyze(void)
Definition cgraphunit.cc:626
cgraph_function_version_info * insert_new_function_version(void)
Definition cgraph.cc:321
bool set_const_flag(bool set_const, bool looping)
Definition cgraph.cc:3222
unsigned tm_clone
Definition cgraph.h:1502
bool can_remove_if_no_direct_calls_and_refs_p(void)
Definition cgraph.h:3287
bool get_body()
Definition cgraph.cc:4578
unsigned lowered
Definition cgraph.h:1487
int unit_id
Definition cgraph.h:1477
cgraph_edge * callers
Definition cgraph.h:1438
void set_call_stmt_including_clones(gimple *old_stmt, gcall *new_stmt, bool update_speculative=true)
Definition cgraphclones.cc:832
void expand_all_artificial_thunks()
Definition cgraphclones.cc:291
void remove(void)
Definition cgraph.cc:2240
unsigned icf_merged
Definition cgraph.h:1515
cgraph_node * next_sibling_clone
Definition cgraph.h:1442
cgraph_node * find_replacement(struct clone_info *)
Definition cgraphclones.cc:737
void remove_callees(void)
Definition cgraph.cc:2095
static void checking_verify_cgraph_nodes(void)
Definition cgraph.h:3311
cgraph_node * clones
Definition cgraph.h:1444
unsigned can_change_signature
Definition cgraph.h:1537
unsigned is_target_clone
Definition cgraph.h:1510
static void DEBUG_FUNCTION verify_cgraph_nodes(void)
Definition cgraph.cc:4438
static void add_function_version(cgraph_function_version_info *fn_v, tree decl)
Definition cgraph.cc:375
cgraph_node * get_alias_target(void)
Definition cgraph.h:3359
bool check_calls_comdat_local_p()
Definition cgraph.cc:4759
static cgraph_node * create_same_body_alias(tree alias, tree decl)
Definition cgraph.cc:744
void record_stmt_references(gimple *stmt)
Definition cgraphbuild.cc:273
cgraph_node * function_or_virtual_thunk_symbol(enum availability *avail=NULL, struct symtab_node *ref=NULL)
Definition cgraph.cc:4487
bool has_gimple_body_p(void)
Definition cgraph.h:3238
static void add_new_function(tree fndecl, bool lowered)
Definition cgraphunit.cc:528
static bool has_thunk_p(cgraph_node *node, void *)
Definition cgraph.cc:4675
void remove_from_clone_tree()
Definition cgraphclones.cc:1182
unsigned calls_comdat_local
Definition cgraph.h:1513
cgraph_node * inlined_to
Definition cgraph.h:1465
cgraph_edge * create_indirect_edge(gcall *call_stmt, int ecf_flags, profile_count count, bool cloning_p=false)
Definition cgraph.cc:1183
friend class symbol_table
Definition cgraph.h:907
void make_profile_local()
Definition cgraph.cc:185
bool local_p(void)
Definition ipa-visibility.cc:113
cgraph_node * clone_of
Definition cgraph.h:1445
bool cannot_return_p(void)
Definition cgraph.cc:3319
static void delete_function_version_by_decl(tree decl)
Definition cgraph.cc:359
void dump(FILE *f)
Definition cgraph.cc:2493
priority_type get_fini_priority(void)
Definition symtab.cc:1857
bool set_malloc_flag(bool malloc_p)
Definition cgraph.cc:2989
bool call_for_symbol_and_aliases(bool(*callback)(cgraph_node *, void *), void *data, bool include_overwritable)
Definition cgraph.h:3574
unsigned gc_candidate
Definition cgraph.h:1548
void apply_scale(profile_count num, profile_count den)
Definition cgraph.cc:265
cgraph_node * function_symbol(enum availability *avail=NULL, struct symtab_node *ref=NULL)
Definition cgraph.cc:4460
struct function * get_fun() const
Definition cgraph.cc:4620
void mark_force_output(void)
Definition cgraph.h:3505
void create_edge_including_clones(cgraph_node *callee, gimple *old_stmt, gcall *stmt, profile_count count, cgraph_inline_failed_t reason)
Definition cgraphclones.cc:892
unsigned only_called_at_exit
Definition cgraph.h:1497
void dump_graphviz(FILE *f)
Definition cgraph.cc:2694
void release_body(bool keep_arguments=false)
Definition cgraph.cc:2207
profile_count count
Definition cgraph.h:1470
static cgraph_node * get_create(tree)
Definition cgraph.cc:687
bool set_nothrow_flag(bool nothrow)
Definition cgraph.cc:2941
cgraph_simd_clone * simdclone
Definition cgraph.h:1454
unsigned called_by_ifunc_resolver
Definition cgraph.h:1550
bool set_noreturn_flag(bool noreturn_p)
Definition cgraph.cc:3084
cgraph_node * create_version_clone_with_body(vec< cgraph_edge * > redirect_callers, vec< ipa_replace_map *, va_gc > *tree_map, ipa_param_adjustments *param_adjustments, bitmap bbs_to_copy, basic_block new_entry_block, const char *suffix, tree target_attributes=NULL_TREE, bool version_decl=true)
Definition cgraphclones.cc:1077
void expand(void)
Definition cgraphunit.cc:1821
vec< ipa_opt_pass, va_heap, vl_ptr > ipa_transforms_to_apply
Definition cgraph.h:1461
static cgraph_node * create_alias(tree alias, tree target)
Definition cgraph.cc:718
cgraph_edge * callees
Definition cgraph.h:1437
bool remove_symbol_and_inline_clones(cgraph_node *forbidden_node=NULL)
Definition cgraphclones.cc:945
hash_table< cgraph_edge_hasher > * call_site_hash
Definition cgraph.h:1448
unsigned indirect_call_target
Definition cgraph.h:1529
bool call_for_symbol_and_aliases_1(bool(*callback)(cgraph_node *, void *), void *data, bool include_overwritable)
Definition cgraph.cc:4654
bool only_called_directly_p(void)
Definition cgraph.cc:3570
void assemble_thunks_and_aliases(void)
Definition cgraphunit.cc:1778
unsigned ipcp_clone
Definition cgraph.h:1544
cgraph_function_version_info * function_version(void)
Definition cgraph.cc:172
static void finalize_function(tree, bool)
Definition cgraphunit.cc:450
bool can_be_local_p(void)
Definition cgraph.cc:2814
bool call_for_symbol_thunks_and_aliases(bool(*callback)(cgraph_node *node, void *data), void *data, bool include_overwritable, bool exclude_virtual_thunks=false)
Definition cgraph.cc:2826
unsigned merged_comdat
Definition cgraph.h:1521
unsigned dispatcher_resolver_function
Definition cgraph.h:1506
static cgraph_node * local_info_node(tree decl)
Definition cgraph.cc:2374
void materialize_clone(void)
Definition cgraphclones.cc:1198
unsigned parallelized_function
Definition cgraph.h:1525
static void debug_cgraph(void)
Definition cgraph.h:1349
unsigned versionable
Definition cgraph.h:1534
int m_summary_id
Definition cgraph.h:1557
unsigned has_omp_variant_constructs
Definition cgraph.h:1552
auto_vec< cgraph_edge * > collect_callers(void)
Definition cgraph.cc:3600
cgraph_node * prev_sibling_clone
Definition cgraph.h:1443
cgraph_edge * get_edge(gimple *call_stmt)
Definition cgraph.cc:905
unsigned local
Definition cgraph.h:1532
unsigned process
Definition cgraph.h:1490
static void delete_function_version(cgraph_function_version_info *)
Definition cgraph.cc:338
void make_profile_global0(profile_quality quality)
Definition cgraph.cc:207
void mark_address_taken(void)
Definition cgraph.cc:2350
unsigned redefined_extern_inline
Definition cgraph.h:1540
cgraph_node * create_virtual_clone(const vec< cgraph_edge * > &redirect_callers, vec< ipa_replace_map *, va_gc > *tree_map, ipa_param_adjustments *param_adjustments, const char *suffix, unsigned num_suffix)
Definition cgraphclones.cc:645
int tp_first_run
Definition cgraph.h:1479
static cgraph_node * create(tree decl)
Definition cgraph.cc:658
bool will_be_removed_from_program_if_no_direct_calls_p(bool will_inline=false)
Definition cgraph.cc:3511
tree former_clone_of
Definition cgraph.h:1450
bool get_untransformed_body()
Definition cgraph.cc:4509
bool only_called_directly_or_aliased_p(void)
Definition cgraph.h:3270
cgraph_node * create_version_clone(tree new_decl, vec< cgraph_edge * > redirect_callers, bitmap bbs_to_copy, const char *suffix=NULL)
Definition cgraphclones.cc:998
cgraph_node * ultimate_alias_target(availability *availability=NULL, symtab_node *ref=NULL)
Definition cgraph.h:3399
static cgraph_node * get_for_asmname(tree asmname)
Definition cgraph.cc:814
cgraph_node * simd_clones
Definition cgraph.h:1456
unsigned merged_extern_inline
Definition cgraph.h:1523
bool add_detected_attribute(const char *attr)
Definition cgraph.cc:3037
int get_summary_id()
Definition cgraph.h:1355
cgraph_node * create_clone(tree decl, profile_count count, bool update_original, vec< cgraph_edge * > redirect_callers, bool call_duplication_hook, cgraph_node *new_inlined_to, ipa_param_adjustments *param_adjustments, const char *suffix)
Definition cgraphclones.cc:385
void set_fini_priority(priority_type priority)
Definition symtab.cc:1910
unsigned dispatcher_function
Definition cgraph.h:1504
enum optimize_size_level optimize_for_size_p(void)
Definition cgraph.h:3514
bool set_pure_flag(bool pure, bool looping)
Definition cgraph.cc:3305
void remove_callers(void)
Definition cgraph.cc:2132
unsigned used_as_abstract_origin
Definition cgraph.h:1485
unsigned tm_may_enter_irr
Definition cgraph.h:1542
static struct cgraph_rtl_info * rtl_info(const_tree)
Definition cgraph.cc:2386
Definition rtl.h:4629
Definition cgraph.h:767
unsigned int alignment
Definition cgraph.h:801
tree orig_arg
Definition cgraph.h:770
HOST_WIDE_INT linear_step
Definition cgraph.h:807
enum cgraph_simd_clone_arg_type arg_type
Definition cgraph.h:798
tree orig_type
Definition cgraph.h:774
tree vector_arg
Definition cgraph.h:782
tree vector_type
Definition cgraph.h:785
tree simd_array
Definition cgraph.h:794
Definition cgraph.h:812
cgraph_node * next_clone
Definition cgraph.h:841
poly_uint64 vecsize_int
Definition cgraph.h:821
unsigned int inbranch
Definition cgraph.h:838
poly_uint64 vecsize_float
Definition cgraph.h:824
machine_mode mask_mode
Definition cgraph.h:829
cgraph_simd_clone_arg args[1]
Definition cgraph.h:847
cgraph_node * prev_clone
Definition cgraph.h:841
poly_uint64 simdlen
Definition cgraph.h:814
cgraph_node * origin
Definition cgraph.h:844
unsigned int nargs
Definition cgraph.h:818
unsigned char vecsize_mangle
Definition cgraph.h:834
Definition symtab-clones.h:25
Definition cgraph.h:3252
hashval_t hash
Definition cgraph.h:3262
rtx rtl
Definition cgraph.h:3254
tree value
Definition cgraph.h:3257
Definition genautomata.cc:499
Definition gimple.h:352
Definition hash-traits.h:321
Definition gimple-iterator.h:26
Definition gimple.h:221
Definition ipa-ref.h:75
Definition ipa-ref.h:40
unsigned int speculative
Definition ipa-ref.h:67
enum ipa_ref_use use
Definition ipa-ref.h:66
gimple * stmt
Definition ipa-ref.h:60
symtab_node * referred
Definition ipa-ref.h:59
unsigned int speculative_id
Definition ipa-ref.h:65
bool address_matters_p()
Definition cgraph.h:3614
unsigned int lto_stmt_uid
Definition ipa-ref.h:61
symtab_node * referring
Definition ipa-ref.h:58
Definition cgraph.h:735
unsigned force_load_ref
Definition cgraph.h:743
tree new_tree
Definition cgraph.h:737
int parm_num
Definition cgraph.h:739
static bool test(U *p)
Definition lto-streamer.h:567
Definition lto-streamer.h:709
Definition profile-count.h:765
static profile_count zero()
Definition profile-count.h:813
Definition cgraph.h:58
int ref_count
Definition cgraph.h:59
char * name
Definition cgraph.h:60
Definition cgraph.h:66
const char * compare_type
Definition cgraph.h:67
static hashval_t hash(section_hash_entry *)
Definition symtab.cc:365
static bool equal(section_hash_entry *, const char *)
Definition symtab.cc:373
Definition cgraph.h:2323
priority_type fini
Definition cgraph.h:2325
priority_type init
Definition cgraph.h:2324
Definition cgraph.h:129
static bool set_implicit_section(symtab_node *n, void *)
Definition symtab.cc:1928
unsigned in_init_priority_hash
Definition cgraph.h:618
void dump_graphviz(FILE *f)
Definition symtab.cc:1042
symtab_node * get_alias_target(void)
Definition cgraph.h:2841
tree get_alias_target_tree()
Definition cgraph.h:2853
unsigned used_from_other_partition
Definition cgraph.h:605
const char * get_visibility_string() const
Definition symtab.cc:890
tree get_comdat_group_id()
Definition cgraph.h:277
tree x_comdat_group
Definition cgraph.h:664
void add_to_same_comdat_group(symtab_node *old_node)
Definition symtab.cc:495
tree alias_target
Definition cgraph.h:659
bool native_rtl_p() const
Definition cgraphunit.cc:227
ipa_ref * iterate_reference(unsigned i, ipa_ref *&ref)
Definition cgraph.h:2877
void dump(FILE *f)
Definition symtab.cc:1033
unsigned weakref
Definition cgraph.h:557
symtab_node * next
Definition cgraph.h:635
unsigned address_taken
Definition cgraph.h:616
bool address_matters_p()
Definition symtab.cc:2466
unsigned definition
Definition cgraph.h:530
static symtab_node * get(const_tree decl)
Definition cgraph.h:484
bool referred_to_p(bool include_self=true)
Definition cgraphunit.cc:424
priority_type get_init_priority()
Definition symtab.cc:1845
unsigned num_references(void)
Definition cgraph.h:249
ipa_ref * clone_reference(ipa_ref *ref, gimple *stmt)
Definition symtab.cc:743
void clone_references(symtab_node *node)
Definition symtab.cc:703
bool output_to_lto_symbol_table_p(void)
Definition symtab.cc:2650
const char * dump_asm_name() const
Definition symtab.cc:599
section_hash_entry * x_section
Definition cgraph.h:667
unsigned externally_visible
Definition cgraph.h:579
static DEBUG_FUNCTION void verify_symtab_nodes(void)
Definition symtab.cc:1482
void copy_visibility_from(symtab_node *n)
Definition symtab.cc:1599
bool has_aliases_p(void)
Definition cgraph.h:2910
struct symbol_priority_map * priority_info(void)
Definition symtab.cc:1870
const char * get_dump_name(bool asm_name_p) const
Definition symtab.cc:580
void unregister(struct clone_info *)
Definition symtab.cc:452
unsigned unique_name
Definition cgraph.h:590
void DEBUG_FUNCTION debug(void)
Definition symtab.cc:1098
void set_section(const char *section)
Definition symtab.cc:1828
const char * get_section() const
Definition cgraph.h:293
unsigned need_lto_streaming
Definition cgraph.h:622
symtab_node * next_defined_symbol(void)
Definition cgraph.h:2863
unsigned cpp_implicit_alias
Definition cgraph.h:564
void set_comdat_group(tree group)
Definition cgraph.h:285
void dump_base(FILE *)
Definition symtab.cc:907
void DEBUG_FUNCTION verify(void)
Definition symtab.cc:1370
bool call_for_symbol_and_aliases_1(bool(*callback)(symtab_node *, void *), void *data, bool include_overwrite)
Definition symtab.cc:2426
const char * name() const
Definition symtab.cc:567
void clear_stmts_in_references(void)
Definition symtab.cc:801
static void check_ifunc_callee_symtab_nodes(void)
Definition symtab.cc:1450
unsigned forced_by_abi
Definition cgraph.h:588
ipa_ref * find_reference(symtab_node *referred_node, gimple *stmt, unsigned int lto_stmt_uid, enum ipa_ref_use use_type)
Definition symtab.cc:761
enum availability get_availability(symtab_node *ref=NULL)
Definition cgraph.h:3541
void set_section_for_node(const char *section)
Definition symtab.cc:1752
symtab_node * ultimate_alias_target_1(enum availability *avail=NULL, symtab_node *ref=NULL)
Definition symtab.cc:1654
void remove_from_same_comdat_group(void)
Definition symtab.cc:429
friend class symbol_table
Definition cgraph.h:131
ipa_ref * maybe_create_reference(tree val, gimple *stmt)
Definition symtab.cc:672
int get_uid() const
Definition cgraph.h:518
symtab_node * same_comdat_group
Definition cgraph.h:651
void remove_all_references(void)
Definition symtab.cc:825
bool prevailing_p(void)
Definition cgraph.h:3717
unsigned no_reorder
Definition cgraph.h:581
void * aux
Definition cgraph.h:661
int equal_address_to(symtab_node *s2, bool memory_accessed=false)
Definition symtab.cc:2314
unsigned transparent_alias
Definition cgraph.h:555
unsigned implicit_section
Definition cgraph.h:593
bool address_can_be_compared_p(void)
Definition cgraph.cc:150
enum ld_plugin_symbol_resolution resolution
Definition cgraph.h:524
void clone_referring(symtab_node *node)
Definition symtab.cc:723
bool resolve_alias(symtab_node *target, bool transparent=false)
Definition symtab.cc:1940
symtab_node * previous_sharing_asm_name
Definition cgraph.h:648
bool can_be_discarded_p(void)
Definition cgraph.h:432
void remove_stmt_references(gimple *stmt)
Definition symtab.cc:782
unsigned semantic_interposition
Definition cgraph.h:598
static symtab_node * get_for_asmname(const_tree asmname)
Definition symtab.cc:1077
static symtab_node * get_create(tree node)
Definition cgraph.h:3530
unsigned refuse_visibility_changes
Definition cgraph.h:574
symtab_node(toplevel_type t)
Definition cgraph.h:134
ipa_ref * create_reference(symtab_node *referred_node, enum ipa_ref_use use_type)
Definition symtab.cc:609
void dump_references(FILE *file)
Definition symtab.cc:845
enum symbol_partitioning_class get_partitioning_class(void)
Definition symtab.cc:2169
tree decl
Definition cgraph.h:632
void dissolve_same_comdat_group_list(void)
Definition symtab.cc:530
unsigned symver
Definition cgraph.h:566
unsigned alias
Definition cgraph.h:533
symtab_node * previous
Definition cgraph.h:636
void make_decl_local(void)
Definition symtab.cc:1534
bool binds_to_current_def_p(symtab_node *ref=NULL)
Definition symtab.cc:2593
ipa_ref * iterate_direct_aliases(unsigned i, ipa_ref *&ref)
Definition cgraph.h:2897
bool semantically_equivalent_p(symtab_node *target)
Definition symtab.cc:2135
void remove_all_referring(void)
Definition symtab.cc:835
void reset(bool preserve_comdat_group=false)
Definition cgraphunit.cc:391
unsigned offloadable
Definition cgraph.h:625
void fixup_same_cpp_alias_visibility(symtab_node *target)
Definition symtab.cc:1716
bool in_same_comdat_group_p(symtab_node *target)
Definition cgraph.h:2820
const char * dump_name() const
Definition symtab.cc:593
static bool set_section_from_node(symtab_node *n, void *o)
Definition symtab.cc:1818
unsigned writeonly
Definition cgraph.h:571
const char * asm_name() const
Definition symtab.cc:557
unsigned int definition_alignment()
Definition symtab.cc:2567
void dump_referring(FILE *)
Definition symtab.cc:862
unsigned body_removed
Definition cgraph.h:596
symtab_node * noninterposable_alias(void)
Definition symtab.cc:2058
static void checking_verify_symtab_nodes(void)
Definition cgraph.h:712
ipa_ref_list ref_list
Definition cgraph.h:654
bool DEBUG_FUNCTION verify_base(void)
Definition symtab.cc:1115
unsigned force_output
Definition cgraph.h:584
static bool set_section_from_string(symtab_node *n, void *s)
Definition symtab.cc:1808
void register_symbol(void)
Definition symtab.cc:412
tree get_comdat_group()
Definition cgraph.h:271
symtab_node * ultimate_alias_target(enum availability *avail=NULL, struct symtab_node *ref=NULL)
Definition cgraph.h:3379
const char * get_symtab_type_string() const
Definition symtab.cc:899
bool real_symbol_p(void)
Definition cgraph.h:2792
unsigned analyzed
Definition cgraph.h:569
bool nonzero_address()
Definition symtab.cc:2300
void remove(void)
Definition symtab.cc:484
bool call_for_symbol_and_aliases(bool(*callback)(symtab_node *, void *), void *data, bool include_overwrite)
Definition cgraph.h:3553
int m_uid
Definition cgraph.h:691
bool comdat_local_p(void)
Definition cgraph.h:448
bool needed_p(void)
Definition cgraphunit.cc:240
unsigned in_other_partition
Definition cgraph.h:609
ipa_ref * iterate_referring(unsigned i, ipa_ref *&ref)
Definition cgraph.h:2887
symtab_node * next_sharing_asm_name
Definition cgraph.h:647
void set_init_priority(priority_type priority)
Definition symtab.cc:1891
bool used_from_object_file_p(void)
Definition cgraph.h:2933
bool can_increase_alignment_p()
Definition symtab.cc:2475
unsigned ifunc_resolver
Definition cgraph.h:628
Definition symtab-thunks.h:36
Definition cgraph.h:110
enum toplevel_type type
Definition cgraph.h:123
int order
Definition cgraph.h:120
struct lto_file_decl_data * lto_file_data
Definition cgraph.h:117
toplevel_node(toplevel_type t)
Definition cgraph.h:112
Definition cgraph.h:3348
static bool equal(constant_descriptor_tree *, constant_descriptor_tree *)
Definition varasm.cc:3490
static hashval_t hash(constant_descriptor_tree *)
Definition varasm.cc:3367
Definition vec.h:283
Definition varpool.cc:45
Definition cgraph.h:1581
hash_map< varpool_node *, size_t > * map
Definition cgraph.h:1582
vec< varpool_node * > nodes
Definition cgraph.h:1583
Definition cgraph.h:1595
varpool_node_set set
Definition cgraph.h:1596
unsigned index
Definition cgraph.h:1597
Definition cgraph.h:2103
bool can_remove_if_no_refs_p(void)
Definition cgraph.h:3321
static void dump_varpool(FILE *f)
Definition varpool.cc:244
void remove_initializer(void)
Definition varpool.cc:192
static varpool_node * create_extra_name_alias(tree alias, tree decl)
Definition varpool.cc:792
void dump(FILE *f)
Definition varpool.cc:210
bool call_for_symbol_and_aliases_1(bool(*callback)(varpool_node *, void *), void *data, bool include_overwritable)
Definition varpool.cc:815
bool externally_visible_p(void)
Definition ipa-visibility.cc:263
void analyze(void)
Definition varpool.cc:518
static varpool_node * create_empty(void)
Definition varpool.cc:136
void DEBUG_FUNCTION debug(void)
Definition varpool.cc:237
static varpool_node * get_create(tree decl)
Definition varpool.cc:143
static varpool_node * get_for_asmname(tree asmname)
Definition varpool.cc:263
bool call_for_symbol_and_aliases(bool(*callback)(varpool_node *, void *), void *data, bool include_overwritable)
Definition cgraph.h:3595
unsigned output
Definition cgraph.h:2213
varpool_node()
Definition cgraph.h:2105
varpool_node * ultimate_alias_target(availability *availability=NULL, symtab_node *ref=NULL)
Definition cgraph.h:3416
static varpool_node * create_alias(tree, tree)
Definition varpool.cc:772
static void add(tree decl)
Definition varpool.cc:470
tree get_constructor(void)
Definition varpool.cc:275
varpool_node * get_alias_target(void)
Definition cgraph.h:3367
static varpool_node * get(const_tree decl)
Definition cgraph.h:2945
bool assemble_decl(void)
Definition varpool.cc:560
bool all_refs_explicit_p()
Definition cgraph.h:3339
void assemble_aliases(void)
Definition varpool.cc:540
static void finalize_decl(tree decl)
Definition cgraphunit.cc:966
availability get_availability(symtab_node *ref=NULL)
Definition varpool.cc:485
enum tls_model tls_model
Definition cgraph.h:2219
bool ctor_useable_for_folding_p(void)
Definition varpool.cc:319
void remove(void)
Definition varpool.cc:172
unsigned dynamically_initialized
Definition cgraph.h:2217
unsigned used_by_single_function
Definition cgraph.h:2225
static void DEBUG_FUNCTION debug_varpool(void)
Definition varpool.cc:256
void finalize_named_section_flags(void)
Definition varpool.cc:715
Definition vec.h:450
Definition vec.h:271
#define NULL
Definition system.h:50
#define gcc_assert(EXPR)
Definition system.h:814
#define gcc_unreachable()
Definition system.h:841
#define false
Definition system.h:888
#define DEBUG_FUNCTION
Definition system.h:1236
#define gcc_checking_assert(EXPR)
Definition system.h:821
unsigned short priority_type
Definition tree-core.h:1093
use_type
Definition tree-ssa-loop-ivopts.cc:195
static void mark_address_taken(tree ref)
Definition tree-ssa-operands.cc:619
static unsigned int increase_alignment(void)
Definition tree-vectorizer.cc:1706
#define DECL_ASSEMBLER_NAME(NODE)
Definition tree.h:3307
#define DECL_HAS_VALUE_EXPR_P(NODE)
Definition tree.h:3070
#define DECL_SECTION_NAME(NODE)
Definition tree.h:3344
#define DECL_STATIC_CONSTRUCTOR(NODE)
Definition tree.h:3547
#define TYPE_MAIN_VARIANT(NODE)
Definition tree.h:2365
#define DECL_WEAK(NODE)
Definition tree.h:3274
#define DECL_STATIC_DESTRUCTOR(NODE)
Definition tree.h:3550
#define TREE_CODE(NODE)
Definition tree.h:325
#define DECL_ABSTRACT_P(NODE)
Definition tree.h:2973
#define DECL_COMDAT(NODE)
Definition tree.h:3289
#define opt_for_fn(fndecl, opt)
Definition tree.h:6331
#define DECL_INITIAL(NODE)
Definition tree.h:2893
#define TREE_STATIC(NODE)
Definition tree.h:773
#define DECL_COMMON(NODE)
Definition tree.h:3265
#define DECL_EXTERNAL(NODE)
Definition tree.h:2987
#define TREE_PUBLIC(NODE)
Definition tree.h:858
#define DECL_VIRTUAL_P(NODE)
Definition tree.h:3002
#define VAR_P(NODE)
Definition tree.h:236
#define NULL_TREE
Definition tree.h:318
#define DECL_P(NODE)
Definition tree.h:232
Definition output.h:517
static bool set_implicit_section(struct symtab_node *n, void *data)
Definition varasm.cc:476
constexpr vnull vNULL
Definition vec.h:569