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 For arg_type SIMD_CLONE_ARG_TYPE_MASK and a mask_mode that is
810 not VOIDmode, this is the number of mask arguments. */
811 HOST_WIDE_INT linear_step;
812};
813
814/* Specific data for a SIMD function clone. */
815
817 /* Number of words in the SIMD lane associated with this clone. */
819
820 /* Number of annotated function arguments in `args'. This is
821 usually the number of named arguments in FNDECL. */
822 unsigned int nargs;
824 /* Max hardware vector size in bits for integral vectors. */
827 /* Max hardware vector size in bits for floating point vectors. */
829
830 /* Machine mode of the mask argument(s), if they are to be passed
831 as bitmasks in integer argument(s). VOIDmode if masks are passed
832 as vectors of characteristic type. */
833 machine_mode mask_mode;
834
835 /* The mangling character for a given vector size. This is used
836 to determine the ISA mangling bit as specified in the Intel
837 Vector ABI. */
838 unsigned char vecsize_mangle;
839
840 /* True if this is the masked, in-branch version of the clone,
841 otherwise false. */
842 unsigned int inbranch : 1;
844 /* Doubly linked list of SIMD clones. */
847 /* Original cgraph node the SIMD clones were created for. */
850 /* Annotated function arguments for the original function. */
851 cgraph_simd_clone_arg GTY((length ("%h.nargs"))) args[1];
852};
854/* Function Multiversioning info. */
856 /* The cgraph_node for which the function version info is stored. */
858 /* Chains all the semantically identical function versions. The
859 first function in this chain is the version_info node of the
860 default function. */
862 /* If this version node corresponds to a dispatcher for function
863 versions, this points to the version info node of the default
864 function, the first node in the chain. */
866 /* If this node corresponds to a function version, this points
867 to the dispatcher function decl, which is the function that must
868 be called to execute the right function version at run-time.
869
870 If this cgraph node is a dispatcher (if dispatcher_function is
871 true, in the cgraph_node struct) for function versions, this
872 points to resolver function, which holds the function body of the
873 dispatcher. The dispatcher decl is an alias to the resolver
874 function decl. */
877 /* The assmbly name of the function set before version mangling. */
880
881#define DEFCIFCODE(code, type, string) CIF_ ## code,
882/* Reasons for inlining failures. */
883
885#include "cif-code.def"
886 CIF_N_REASONS
893};
894
896
897struct cgraph_edge_hasher : ggc_ptr_hash<cgraph_edge>
898{
899 typedef gimple *compare_type;
900
901 static hashval_t hash (cgraph_edge *);
902 static hashval_t hash (gimple *);
903 static bool equal (cgraph_edge *, gimple *);
904};
905
906/* The cgraph data structure.
907 Each function decl has assigned cgraph_node listing callees and callers. */
908
909struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
910{
911 friend class symbol_table;
913 /* Constructor. */
914 explicit cgraph_node ()
920 inlined_to (NULL), rtl (NULL),
921 count (profile_count::uninitialized ()),
922 count_materialization_scale (REG_BR_PROB_BASE), profile_id (0),
923 unit_id (0), tp_first_run (0), thunk (false),
924 used_as_abstract_origin (false),
925 lowered (false), process (false), frequency (NODE_FREQUENCY_NORMAL),
926 only_called_at_startup (false), only_called_at_exit (false),
927 tm_clone (false), dispatcher_function (false),
928 dispatcher_resolver_function (false), is_target_clone (false),
929 calls_comdat_local (false),
930 icf_merged (false), nonfreeing_fn (false), merged_comdat (false),
931 merged_extern_inline (false), parallelized_function (false),
932 split_part (false), indirect_call_target (false), local (false),
933 versionable (false), can_change_signature (false),
934 redefined_extern_inline (false), tm_may_enter_irr (false),
935 ipcp_clone (false), gc_candidate (false),
936 called_by_ifunc_resolver (false), has_omp_variant_constructs (false),
937 m_summary_id (-1)
938 {}
939
940 /* Remove the node from cgraph and all inline clones inlined into it.
941 Skip however removal of FORBIDDEN_NODE and return true if it needs to be
942 removed. This allows to call the function from outer loop walking clone
943 tree. */
944 bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL);
945
946 /* Record all references from cgraph_node that are taken
947 in statement STMT. */
948 void record_stmt_references (gimple *stmt);
949
950 /* Like cgraph_set_call_stmt but walk the clone tree and update all
951 clones sharing the same function body.
952 When WHOLE_SPECULATIVE_EDGES is true, all three components of
953 speculative edge gets updated. Otherwise we update only direct
954 call. */
955 void set_call_stmt_including_clones (gimple *old_stmt, gcall *new_stmt,
956 bool update_speculative = true);
957
958 /* Walk the alias chain to return the function cgraph_node is alias of.
959 Walk through thunk, too.
960 When AVAILABILITY is non-NULL, get minimal availability in the chain.
961 When REF is non-NULL, assume that reference happens in symbol REF
962 when determining the availability. */
963 cgraph_node *function_symbol (enum availability *avail = NULL,
964 struct symtab_node *ref = NULL);
965
966 /* Walk the alias chain to return the function cgraph_node is alias of.
967 Walk through non virtual thunks, too. Thus we return either a function
968 or a virtual thunk node.
969 When AVAILABILITY is non-NULL, get minimal availability in the chain.
970 When REF is non-NULL, assume that reference happens in symbol REF
971 when determining the availability. */
972 cgraph_node *function_or_virtual_thunk_symbol
973 (enum availability *avail = NULL,
974 struct symtab_node *ref = NULL);
975
976 /* Create node representing clone of N executed COUNT times. Decrease
977 the execution counts from original node too.
978 The new clone will have decl set to DECL that may or may not be the same
979 as decl of N.
980
981 When UPDATE_ORIGINAL is true, the counts are subtracted from the original
982 function's profile to reflect the fact that part of execution is handled
983 by node.
984 When CALL_DUPLICATION_HOOK is true, the ipa passes are acknowledged about
985 the new clone. Otherwise the caller is responsible for doing so later.
986
987 If the new node is being inlined into another one, NEW_INLINED_TO should be
988 the outline function the new one is (even indirectly) inlined to.
989 All hooks will see this in node's inlined_to, when invoked.
990 Should be NULL if the node is not inlined.
991
992 SUFFIX is string that is appended to the original name, it should only be
993 NULL if NEW_INLINED_TO is not NULL or if the clone being created is
994 temporary and a record about it should not be added into the ipa-clones
995 dump file. */
996 cgraph_node *create_clone (tree decl, profile_count count,
997 bool update_original,
998 vec<cgraph_edge *> redirect_callers,
999 bool call_duplication_hook,
1000 cgraph_node *new_inlined_to,
1001 ipa_param_adjustments *param_adjustments,
1002 const char *suffix);
1003
1004 /* Create callgraph node clone with new declaration. The actual body will be
1005 copied later at compilation stage. The name of the new clone will be
1006 constructed from the name of the original node, SUFFIX and NUM_SUFFIX. */
1007 cgraph_node *create_virtual_clone (const vec<cgraph_edge *> &redirect_callers,
1008 vec<ipa_replace_map *, va_gc> *tree_map,
1009 ipa_param_adjustments *param_adjustments,
1010 const char * suffix, unsigned num_suffix);
1011
1012 /* Remove the node from the tree of virtual and inline clones and make it a
1013 standalone node - not a clone any more. */
1014 void remove_from_clone_tree ();
1015
1016 /* cgraph node being removed from symbol table; see if its entry can be
1017 replaced by other inline clone. */
1018 cgraph_node *find_replacement (struct clone_info *);
1019
1020 /* Create a new cgraph node which is the new version of
1021 callgraph node. REDIRECT_CALLERS holds the callers
1022 edges which should be redirected to point to
1023 NEW_VERSION. ALL the callees edges of the node
1024 are cloned to the new version node. Return the new
1025 version node.
1026
1027 If non-NULL BLOCK_TO_COPY determine what basic blocks
1028 was copied to prevent duplications of calls that are dead
1029 in the clone.
1030
1031 SUFFIX is string that is appended to the original name. */
1032
1033 cgraph_node *create_version_clone (tree new_decl,
1034 vec<cgraph_edge *> redirect_callers,
1035 bitmap bbs_to_copy,
1036 const char *suffix = NULL);
1037
1038 /* Perform function versioning.
1039 Function versioning includes copying of the tree and
1040 a callgraph update (creating a new cgraph node and updating
1041 its callees and callers).
1042
1043 REDIRECT_CALLERS varray includes the edges to be redirected
1044 to the new version.
1045
1046 TREE_MAP is a mapping of tree nodes we want to replace with
1047 new ones (according to results of prior analysis).
1048
1049 If non-NULL PARAM_ADJUSTMENTS determine how function formal parameters
1050 should be modified in the new version and if it should return void.
1051 If non-NULL BLOCK_TO_COPY determine what basic blocks to copy.
1052 If non_NULL NEW_ENTRY determine new entry BB of the clone.
1053 SUFFIX is a string that will be used to create a new name for the new
1054 function.
1055
1056 If TARGET_ATTRIBUTES is non-null, when creating a new declaration,
1057 add the attributes to DECL_ATTRIBUTES. And call valid_attribute_p
1058 that will promote value of the attribute DECL_FUNCTION_SPECIFIC_TARGET
1059 of the declaration.
1060
1061 If VERSION_DECL is set true, use clone_function_name_numbered for the
1062 function clone. Otherwise, use clone_function_name.
1063
1064 Return the new version's cgraph node. */
1065 cgraph_node *create_version_clone_with_body
1066 (vec<cgraph_edge *> redirect_callers,
1067 vec<ipa_replace_map *, va_gc> *tree_map,
1068 ipa_param_adjustments *param_adjustments,
1069 bitmap bbs_to_copy, basic_block new_entry_block, const char *suffix,
1070 tree target_attributes = NULL_TREE, bool version_decl = true);
1071
1072 /* Insert a new cgraph_function_version_info node into cgraph_fnver_htab
1073 corresponding to cgraph_node. */
1074 cgraph_function_version_info *insert_new_function_version (void);
1075
1076 /* Get the cgraph_function_version_info node corresponding to node. */
1077 cgraph_function_version_info *function_version (void);
1078
1079 /* Discover all functions and variables that are trivially needed, analyze
1080 them as well as all functions and variables referred by them */
1081 void analyze (void);
1082
1083 /* Add thunk alias into callgraph. The alias declaration is ALIAS and it
1084 aliases DECL with an adjustments made into the first parameter.
1085 See comments in struct symtab-thunks.h for detail on the parameters. */
1086 cgraph_node * create_thunk (tree alias, tree, bool this_adjusting,
1087 HOST_WIDE_INT fixed_offset,
1088 HOST_WIDE_INT virtual_value,
1089 HOST_WIDE_INT indirect_offset,
1090 tree virtual_offset,
1091 tree real_alias);
1092
1093
1094 /* Return node that alias is aliasing. */
1095 inline cgraph_node *get_alias_target (void);
1096
1097 /* Given function symbol, walk the alias chain to return the function node
1098 is alias of. Do not walk through thunks.
1099 When AVAILABILITY is non-NULL, get minimal availability in the chain.
1100 When REF is non-NULL, assume that reference happens in symbol REF
1101 when determining the availability. */
1102
1103 cgraph_node *ultimate_alias_target (availability *availability = NULL,
1104 symtab_node *ref = NULL);
1105
1106 /* Call expand_thunk on all callers that are thunks and analyze those
1107 nodes that were expanded. */
1108 void expand_all_artificial_thunks ();
1109
1110 /* Assemble thunks and aliases associated to node. */
1111 void assemble_thunks_and_aliases (void);
1112
1113 /* Expand function specified by node. */
1114 void expand (void);
1115
1116 /* Creates a wrapper from cgraph_node to TARGET node. Thunk is used for this
1117 kind of wrapper method. */
1118 void create_wrapper (cgraph_node *target);
1119
1120 /* Verify cgraph nodes of the cgraph node. */
1121 void DEBUG_FUNCTION verify_node (void);
1122
1123 /* Remove function from symbol table. */
1124 void remove (void);
1125
1126 /* Dump call graph node to file F. */
1127 void dump (FILE *f);
1128
1129 /* Dump call graph node to file F. */
1130 void dump_graphviz (FILE *f);
1131
1132 /* Dump call graph node to stderr. */
1133 void DEBUG_FUNCTION debug (void);
1134
1135 /* When doing LTO, read cgraph_node's body from disk if it is not already
1136 present. */
1137 bool get_untransformed_body ();
1138
1139 /* Prepare function body. When doing LTO, read cgraph_node's body from disk
1140 if it is not already present. When some IPA transformations are scheduled,
1141 apply them. */
1142 bool get_body ();
1143
1144 void materialize_clone (void);
1145
1146 /* Release memory used to represent body of function.
1147 Use this only for functions that are released before being translated to
1148 target code (i.e. RTL). Functions that are compiled to RTL and beyond
1149 are free'd in final.cc via free_after_compilation(). */
1150 void release_body (bool keep_arguments = false);
1151
1152 /* Return the DECL_STRUCT_FUNCTION of the function. */
1153 struct function *get_fun () const;
1154
1155 /* Bring cgraph node local. */
1156 void make_local (void);
1157
1158 /* Likewise indicate that a node is having address taken. */
1159 void mark_address_taken (void);
1160
1161 /* Set finalization priority to PRIORITY. */
1162 void set_fini_priority (priority_type priority);
1163
1164 /* Return the finalization priority. */
1165 priority_type get_fini_priority (void);
1166
1167 /* Create edge from a given function to CALLEE in the cgraph. */
1168 cgraph_edge *create_edge (cgraph_node *callee,
1169 gcall *call_stmt, profile_count count,
1170 bool cloning_p = false);
1171
1172 /* Create an indirect edge with a yet-undetermined callee where the call
1173 statement destination is a formal parameter of the caller with index
1174 PARAM_INDEX. */
1175 cgraph_edge *create_indirect_edge (gcall *call_stmt, int ecf_flags,
1176 profile_count count,
1177 bool cloning_p = false);
1178
1179 /* Like cgraph_create_edge walk the clone tree and update all clones sharing
1180 same function body. If clones already have edge for OLD_STMT; only
1181 update the edge same way as cgraph_set_call_stmt_including_clones does. */
1182 void create_edge_including_clones (cgraph_node *callee,
1183 gimple *old_stmt, gcall *stmt,
1184 profile_count count,
1185 cgraph_inline_failed_t reason);
1186
1187 /* Return the callgraph edge representing the GIMPLE_CALL statement
1188 CALL_STMT. */
1189 cgraph_edge *get_edge (gimple *call_stmt);
1190
1191 /* Collect all callers of cgraph_node and its aliases that are known to lead
1192 to NODE (i.e. are not overwritable) and that are not thunks. */
1193 auto_vec<cgraph_edge *> collect_callers (void);
1194
1195 /* Remove all callers from the node. */
1196 void remove_callers (void);
1197
1198 /* Remove all callees from the node. */
1199 void remove_callees (void);
1200
1201 /* Return function availability. See cgraph.h for description of individual
1202 return values. */
1203 enum availability get_availability (symtab_node *ref = NULL);
1204
1205 /* Set TREE_NOTHROW on cgraph_node's decl and on aliases of the node
1206 if any to NOTHROW. */
1207 bool set_nothrow_flag (bool nothrow);
1208
1209 /* SET DECL_IS_MALLOC on cgraph_node's decl and on aliases of the node
1210 if any. */
1211 bool set_malloc_flag (bool malloc_p);
1212
1213 /* SET TREE_THIS_VOLATILE on cgraph_node's decl and on aliases of the node
1214 if any. */
1215 bool set_noreturn_flag (bool noreturn_p);
1216
1217 /* If SET_CONST is true, mark function, aliases and thunks to be ECF_CONST.
1218 If SET_CONST if false, clear the flag.
1219
1220 When setting the flag be careful about possible interposition and
1221 do not set the flag for functions that can be interposed and set pure
1222 flag for functions that can bind to other definition.
1223
1224 Return true if any change was done. */
1225
1226 bool set_const_flag (bool set_const, bool looping);
1227
1228 /* Set DECL_PURE_P on cgraph_node's decl and on aliases of the node
1229 if any to PURE.
1230
1231 When setting the flag, be careful about possible interposition.
1232 Return true if any change was done. */
1233
1234 bool set_pure_flag (bool pure, bool looping);
1235
1236 /* Add attribute ATTR to cgraph_node's decl and on aliases of the node
1237 if any. */
1238 bool add_detected_attribute (const char *attr);
1239
1240 /* Call callback on function and aliases associated to the function.
1241 When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are
1242 skipped. */
1243
1244 bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *,
1245 void *),
1246 void *data, bool include_overwritable);
1247
1248 /* Call callback on cgraph_node, thunks and aliases associated to NODE.
1249 When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are
1250 skipped. When EXCLUDE_VIRTUAL_THUNKS is true, virtual thunks are
1251 skipped. */
1252 bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node,
1253 void *data),
1254 void *data,
1255 bool include_overwritable,
1256 bool exclude_virtual_thunks = false);
1257
1258 /* Likewise indicate that a node is needed, i.e. reachable via some
1259 external means. */
1260 inline void mark_force_output (void);
1261
1262 /* Return true when function can be marked local. */
1263 bool local_p (void);
1264
1265 /* Return true if cgraph_node can be made local for API change.
1266 Extern inline functions and C++ COMDAT functions can be made local
1267 at the expense of possible code size growth if function is used in multiple
1268 compilation units. */
1269 bool can_be_local_p (void);
1270
1271 /* Return true when cgraph_node cannot return or throw and thus
1272 it is safe to ignore its side effects for IPA analysis. */
1273 bool cannot_return_p (void);
1274
1275 /* Return true when function cgraph_node and all its aliases are only called
1276 directly.
1277 i.e. it is not externally visible, address was not taken and
1278 it is not used in any other non-standard way. */
1279 bool only_called_directly_p (void);
1280
1281 /* Turn profile to global0. Walk into inlined functions. */
1282 void make_profile_local ();
1283
1284 /* Turn profile to global0. Walk into inlined functions. */
1285 void make_profile_global0 (profile_quality quality);
1286
1287 /* Scale profile by NUM/DEN. Walk into inlined funtion. */
1288 void apply_scale (profile_count num, profile_count den);
1289
1290 /* Scale profile to given IPA_COUNT.
1291 IPA_COUNT should pass ipa_p () with a single exception.
1292 It can be also GUESSED_LOCAL in case we want to
1293 drop any IPA info about the profile. */
1294 void scale_profile_to (profile_count ipa_count);
1295
1296 /* Return true when function is only called directly or it has alias.
1297 i.e. it is not externally visible, address was not taken and
1298 it is not used in any other non-standard way. */
1299 inline bool only_called_directly_or_aliased_p (void);
1300
1301 /* Return true when function cgraph_node can be expected to be removed
1302 from program when direct calls in this compilation unit are removed.
1303
1304 As a special case COMDAT functions are
1305 cgraph_can_remove_if_no_direct_calls_p while the are not
1306 cgraph_only_called_directly_p (it is possible they are called from other
1307 unit)
1308
1309 This function behaves as cgraph_only_called_directly_p because eliminating
1310 all uses of COMDAT function does not make it necessarily disappear from
1311 the program unless we are compiling whole program or we do LTO. In this
1312 case we know we win since dynamic linking will not really discard the
1313 linkonce section.
1314
1315 If WILL_INLINE is true, assume that function will be inlined into all the
1316 direct calls. */
1317 bool will_be_removed_from_program_if_no_direct_calls_p
1318 (bool will_inline = false);
1319
1320 /* Return true when function can be removed from callgraph
1321 if all direct calls and references are eliminated. The function does
1322 not take into account comdat groups. */
1323 bool can_remove_if_no_direct_calls_and_refs_p (void);
1324
1325 /* Return true when function cgraph_node and its aliases can be removed from
1326 callgraph if all direct calls are eliminated.
1327 If WILL_INLINE is true, assume that function will be inlined into all the
1328 direct calls. */
1329 bool can_remove_if_no_direct_calls_p (bool will_inline = false);
1330
1331 /* Return true when callgraph node is a function with Gimple body defined
1332 in current unit. Functions can also be define externally or they
1333 can be thunks with no Gimple representation.
1334
1335 Note that at WPA stage, the function body may not be present in memory. */
1336 inline bool has_gimple_body_p (void);
1337
1338 /* Return true if this node represents a former, i.e. an expanded, thunk. */
1339 bool former_thunk_p (void);
1340
1341 /* Check if function calls comdat local. This is used to recompute
1342 calls_comdat_local flag after function transformations. */
1343 bool check_calls_comdat_local_p ();
1344
1345 /* Return true if function should be optimized for size. */
1346 enum optimize_size_level optimize_for_size_p (void);
1347
1348 /* Dump the callgraph to file F. */
1349 static void dump_cgraph (FILE *f);
1350
1351 /* Dump the call graph to stderr. */
1352 static inline
1353 void debug_cgraph (void)
1354 {
1355 dump_cgraph (stderr);
1356 }
1358 /* Get summary id of the node. */
1359 inline int get_summary_id ()
1360 {
1361 return m_summary_id;
1362 }
1363
1364 /* Adds DECL to the FN_V structure of semantically identical functions. */
1365 static void add_function_version (cgraph_function_version_info *fn_v,
1366 tree decl);
1367
1368 /* Remove the cgraph_function_version_info and cgraph_node for DECL. This
1369 DECL is a duplicate declaration. */
1370 static void delete_function_version_by_decl (tree decl);
1371
1372 static void delete_function_version (cgraph_function_version_info *);
1373
1374 /* Add the function FNDECL to the call graph.
1375 Unlike finalize_function, this function is intended to be used
1376 by middle end and allows insertion of new function at arbitrary point
1377 of compilation. The function can be either in high, low or SSA form
1378 GIMPLE.
1379
1380 The function is assumed to be reachable and have address taken (so no
1381 API breaking optimizations are performed on it).
1382
1383 Main work done by this function is to enqueue the function for later
1384 processing to avoid need the passes to be re-entrant. */
1385 static void add_new_function (tree fndecl, bool lowered);
1387 /* Return callgraph node for given symbol and check it is a function. */
1388 static inline cgraph_node *get (const_tree decl)
1389 {
1390 gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL);
1392 }
1393
1394 /* DECL has been parsed. Take it, queue it, compile it at the whim of the
1395 logic in effect. If NO_COLLECT is true, then our caller cannot stand to
1396 have the garbage collector run at the moment. We would need to either
1397 create a new GC context, or just not compile right now. */
1398 static void finalize_function (tree, bool);
1399
1400 /* Return cgraph node assigned to DECL. Create new one when needed. */
1401 static cgraph_node * create (tree decl);
1402
1403 /* Try to find a call graph node for declaration DECL and if it does not
1404 exist or if it corresponds to an inline clone, create a new one. */
1405 static cgraph_node * get_create (tree);
1406
1407 /* Return local info for the compiled function. */
1408 static cgraph_node *local_info_node (tree decl);
1409
1410 /* Return RTL info for the compiled function. */
1411 static struct cgraph_rtl_info *rtl_info (const_tree);
1412
1413 /* Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME.
1414 Return NULL if there's no such node. */
1415 static cgraph_node *get_for_asmname (tree asmname);
1416
1417 /* Attempt to mark ALIAS as an alias to DECL. Return alias node if
1418 successful and NULL otherwise.
1419 Same body aliases are output whenever the body of DECL is output,
1420 and cgraph_node::get (ALIAS) transparently
1421 returns cgraph_node::get (DECL). */
1422 static cgraph_node * create_same_body_alias (tree alias, tree decl);
1423
1424 /* Verify whole cgraph structure. */
1425 static void DEBUG_FUNCTION verify_cgraph_nodes (void);
1426
1427 /* Verify cgraph, if consistency checking is enabled. */
1428 static inline void checking_verify_cgraph_nodes (void);
1429
1430 /* Worker to bring NODE local. */
1431 static bool make_local (cgraph_node *node, void *);
1432
1433 /* Mark ALIAS as an alias to DECL. DECL_NODE is cgraph node representing
1434 the function body is associated
1435 with (not necessarily cgraph_node (DECL). */
1436 static cgraph_node *create_alias (tree alias, tree target);
1437
1438 /* Return true if NODE has thunk. */
1439 static bool has_thunk_p (cgraph_node *node, void *);
1443 /* List of edges representing indirect calls with a yet undetermined
1444 callee. */
1450 /* For functions with many calls sites it holds map from call expression
1451 to the edge to speed up cgraph_edge function. */
1453 /* Declaration node used to be clone of. */
1455
1456 /* If this is a SIMD clone, this points to the SIMD specific
1457 information for it. */
1459 /* If this function has SIMD clones, this points to the first clone. */
1461
1462 /* Interprocedural passes scheduled to have their transform functions
1463 applied next time we execute local pass on them. We maintain it
1464 per-function in order to allow IPA passes to introduce new functions. */
1466
1467 /* For inline clones this points to the function they will be
1468 inlined into. */
1470
1471 struct cgraph_rtl_info *rtl;
1473 /* Expected number of executions: calculated in profile.cc. */
1475 /* How to scale counts at materialization time; used to merge
1476 LTO units with different number of profile runs. */
1478 /* ID assigned by the profiling. */
1479 unsigned int profile_id;
1480 /* ID of the translation unit. */
1482 /* Time profiler: first run of function. */
1483 int tp_first_run;
1485 /* True when symbol is a thunk. */
1486 unsigned thunk : 1;
1487 /* Set when decl is an abstract function pointed to by the
1488 ABSTRACT_DECL_ORIGIN of a reachable function. */
1490 /* Set once the function is lowered (i.e. its CFG is built). */
1491 unsigned lowered : 1;
1492 /* Set once the function has been instantiated and its callee
1493 lists created. */
1494 unsigned process : 1;
1495 /* How commonly executed the node is. Initialized during branch
1496 probabilities pass. */
1497 ENUM_BITFIELD (node_frequency) frequency : 2;
1498 /* True when function can only be called at startup (from static ctor). */
1500 /* True when function can only be called at startup (from static dtor). */
1501 unsigned only_called_at_exit : 1;
1502 /* True when function is the transactional clone of a function which
1503 is called only from inside transactions. */
1504 /* ?? We should be able to remove this. We have enough bits in
1505 cgraph to calculate it. */
1506 unsigned tm_clone : 1;
1507 /* True if this decl is a dispatcher for function versions. */
1509 /* True if this decl is a resolver for function versions. */
1510 unsigned dispatcher_resolver_function : 1;
1511 /* True this is part of a multiversioned set and this version comes from a
1512 target_clone attribute. Or if this is a dispatched symbol or resolver
1513 and the default version comes from a target_clones. */
1514 unsigned is_target_clone : 1;
1515 /* True if this decl calls a COMDAT-local function. This is set up in
1516 compute_fn_summary and inline_call. */
1518 /* True if node has been created by merge operation in IPA-ICF. */
1519 unsigned icf_merged: 1;
1520 /* True if call to node can't result in a call to free, munmap or
1521 other operation that could make previously non-trapping memory
1522 accesses trapping. */
1523 unsigned nonfreeing_fn : 1;
1524 /* True if there was multiple COMDAT bodies merged by lto-symtab. */
1525 unsigned merged_comdat : 1;
1526 /* True if this def was merged with extern inlines. */
1528 /* True if function was created to be executed in parallel. */
1530 /* True if function is part split out by ipa-split. */
1531 unsigned split_part : 1;
1532 /* True if the function appears as possible target of indirect call. */
1533 unsigned indirect_call_target : 1;
1534 /* Set when function is visible in current compilation unit only and
1535 its address is never taken. */
1536 unsigned local : 1;
1537 /* False when there is something makes versioning impossible. */
1538 unsigned versionable : 1;
1539 /* False when function calling convention and signature cannot be changed.
1540 This is the case when __builtin_apply_args is used. */
1541 unsigned can_change_signature : 1;
1542 /* True when the function has been originally extern inline, but it is
1543 redefined now. */
1545 /* True if the function may enter serial irrevocable mode. */
1546 unsigned tm_may_enter_irr : 1;
1547 /* True if this was a clone created by ipa-cp. */
1548 unsigned ipcp_clone : 1;
1549 /* True if the function should only be emitted if it is used. This flag
1550 is set for local SIMD clones when they are created and cleared if the
1551 vectorizer uses them. */
1552 unsigned gc_candidate : 1;
1553 /* Set if the function is called by an IFUNC resolver. */
1555 /* True if the function contains unresolved OpenMP metadirectives. */
1556 unsigned has_omp_variant_constructs : 1;
1557
1558private:
1560 /* Summary id that is recycled. */
1561 int m_summary_id;
1562
1563 /* Worker for call_for_symbol_and_aliases. */
1564 bool call_for_symbol_and_aliases_1 (bool (*callback) (cgraph_node *,
1565 void *),
1566 void *data, bool include_overwritable);
1567};
1568
1569/* A cgraph node set is a collection of cgraph nodes. A cgraph node
1570 can appear in multiple sets. */
1579
1580struct varpool_node;
1581
1582/* A varpool node set is a collection of varpool nodes. A varpool node
1583 can appear in multiple sets. */
1588};
1590/* Iterator structure for cgraph node sets. */
1594 unsigned index;
1595};
1597/* Iterator structure for varpool node sets. */
1601 unsigned index;
1602};
1603
1604/* Context of polymorphic call. It represent information about the type of
1605 instance that may reach the call. This is used by ipa-devirt walkers of the
1606 type inheritance graph. */
1607
1609public:
1610 /* The called object appears in an object of type OUTER_TYPE
1611 at offset OFFSET. When information is not 100% reliable, we
1612 use SPECULATIVE_OUTER_TYPE and SPECULATIVE_OFFSET. */
1613 HOST_WIDE_INT offset;
1614 HOST_WIDE_INT speculative_offset;
1617 /* True if outer object may be in construction or destruction. */
1619 /* True if outer object may be of derived type. */
1620 unsigned maybe_derived_type : 1;
1621 /* True if speculative outer object may be of derived type. We always
1622 speculate that construction does not happen. */
1623 unsigned speculative_maybe_derived_type : 1;
1624 /* True if the context is invalid and all calls should be redirected
1625 to BUILTIN_UNREACHABLE. */
1626 unsigned invalid : 1;
1627 /* True if the outer type is dynamic. */
1628 unsigned dynamic : 1;
1629
1630 /* Build empty "I know nothing" context. */
1632 /* Build polymorphic call context for indirect call E. */
1634 /* Build polymorphic call context for IP invariant CST.
1635 If specified, OTR_TYPE specify the type of polymorphic call
1636 that takes CST+OFFSET as a parameter. */
1637 ipa_polymorphic_call_context (tree cst, tree otr_type = NULL,
1638 HOST_WIDE_INT offset = 0);
1639 /* Build context for pointer REF contained in FNDECL at statement STMT.
1640 if INSTANCE is non-NULL, return pointer to the object described by
1641 the context. */
1642 ipa_polymorphic_call_context (tree fndecl, tree ref, gimple *stmt,
1643 tree *instance = NULL);
1644
1645 /* Look for vtable stores or constructor calls to work out dynamic type
1646 of memory location. */
1647 bool get_dynamic_type (tree, tree, tree, gimple *, unsigned *);
1648
1649 /* Make context non-speculative. */
1650 void clear_speculation ();
1651
1652 /* Produce context specifying all derived types of OTR_TYPE. If OTR_TYPE is
1653 NULL, the context is set to dummy "I know nothing" setting. */
1654 void clear_outer_type (tree otr_type = NULL);
1655
1656 /* Walk container types and modify context to point to actual class
1657 containing OTR_TYPE (if non-NULL) as base class.
1658 Return true if resulting context is valid.
1659
1660 When CONSIDER_PLACEMENT_NEW is false, reject contexts that may be made
1661 valid only via allocation of new polymorphic type inside by means
1662 of placement new.
1663
1664 When CONSIDER_BASES is false, only look for actual fields, not base types
1665 of TYPE. */
1666 bool restrict_to_inner_class (tree otr_type,
1667 bool consider_placement_new = true,
1668 bool consider_bases = true);
1669
1670 /* Adjust all offsets in contexts by given number of bits. */
1671 void offset_by (HOST_WIDE_INT);
1672 /* Use when we cannot track dynamic type change. This speculatively assume
1673 type change is not happening. */
1674 void possible_dynamic_type_change (bool, tree otr_type = NULL);
1675 /* Assume that both THIS and a given context is valid and strengthen THIS
1676 if possible. Return true if any strengthening was made.
1677 If actual type the context is being used in is known, OTR_TYPE should be
1678 set accordingly. This improves quality of combined result. */
1681
1682 /* Return TRUE if context is fully useless. */
1683 bool useless_p () const;
1684 /* Return TRUE if this context conveys the same information as X. */
1685 bool equal_to (const ipa_polymorphic_call_context &x) const;
1686
1687 /* Dump human readable context to F. If NEWLINE is true, it will be
1688 terminated by a newline. */
1689 void dump (FILE *f, bool newline = true) const;
1690 void DEBUG_FUNCTION debug () const;
1691
1692 /* LTO streaming. */
1693 void stream_out (struct output_block *) const;
1694 void stream_in (class lto_input_block *, class data_in *data_in);
1695
1696private:
1697 bool combine_speculation_with (tree, HOST_WIDE_INT, bool, tree);
1698 bool meet_speculation_with (tree, HOST_WIDE_INT, bool, tree);
1699 void set_by_decl (tree, HOST_WIDE_INT);
1700 bool set_by_invariant (tree, tree, HOST_WIDE_INT);
1701 bool speculation_consistent_p (tree, HOST_WIDE_INT, bool, tree) const;
1702 void make_speculative (tree otr_type = NULL);
1703};
1704
1705/* Structure containing additional information about an indirect call. */
1706
1708{
1709public:
1710 /* When agg_content is set, an offset where the call pointer is located
1711 within the aggregate. */
1712 HOST_WIDE_INT offset;
1713 /* Context of the polymorphic call; use only when POLYMORPHIC flag is set. */
1715 /* OBJ_TYPE_REF_TOKEN of a polymorphic call (if polymorphic is set). */
1716 HOST_WIDE_INT otr_token;
1717 /* Type of the object from OBJ_TYPE_REF_OBJECT. */
1719 /* Index of the parameter that is called. */
1721 /* ECF flags determined from the caller. */
1722 int ecf_flags;
1724 /* Number of speculative call targets, it's less than GCOV_TOPN_VALUES. */
1725 unsigned num_speculative_call_targets : 16;
1726
1727 /* Set when the call is a virtual call with the parameter being the
1728 associated object pointer rather than a simple direct call. */
1729 unsigned polymorphic : 1;
1730 /* Set when the call is a call of a pointer loaded from contents of an
1731 aggregate at offset. */
1732 unsigned agg_contents : 1;
1733 /* Set when this is a call through a member pointer. */
1734 unsigned member_ptr : 1;
1735 /* When the agg_contents bit is set, this one determines whether the
1736 destination is loaded from a parameter passed by reference. */
1737 unsigned by_ref : 1;
1738 /* When the agg_contents bit is set, this one determines whether we can
1739 deduce from the function body that the loaded value from the reference is
1740 never modified between the invocation of the function and the load
1741 point. */
1742 unsigned guaranteed_unmodified : 1;
1743 /* For polymorphic calls this specify whether the virtual table pointer
1744 may have changed in between function entry and the call. */
1745 unsigned vptr_changed : 1;
1747
1748class GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"),
1749 for_user)) cgraph_edge
1751public:
1752 friend struct cgraph_node;
1753 friend class symbol_table;
1754
1755 /* Remove EDGE from the cgraph. */
1756 static void remove (cgraph_edge *edge);
1757
1758 /* Change field call_stmt of edge E to NEW_STMT. If UPDATE_DERIVED_EDGES and
1759 E is any component of speculative edge, then update all components.
1760 Speculations can be resolved in the process and EDGE can be removed and
1761 deallocated. Return the edge that now represents the call. If
1762 UPDATE_DERIVED_EDGES and E is a part of a callback edge, update all
1763 associated edges and return the callback-carrying edge. */
1764 static cgraph_edge *set_call_stmt (cgraph_edge *e, gcall *new_stmt,
1765 bool update_derived_edges = true);
1766
1767 /* Redirect callee of the edge to N. The function does not update underlying
1768 call expression. */
1769 void redirect_callee (cgraph_node *n);
1770
1771 /* If the edge does not lead to a thunk, simply redirect it to N. Otherwise
1772 create one or more equivalent thunks for N and redirect E to the first in
1773 the chain. Note that it is then necessary to call
1774 n->expand_all_artificial_thunks once all callers are redirected. */
1776
1777 /* Make an indirect edge with an unknown callee an ordinary edge leading to
1778 CALLEE. Speculations can be resolved in the process and EDGE can be
1779 removed and deallocated. Return the edge that now represents the
1780 call. */
1782
1783 /* Turn edge into speculative call calling N2. Update
1784 the profile so the direct call is taken COUNT times
1785 with FREQUENCY. speculative_id is used to link direct calls with their
1786 corresponding IPA_REF_ADDR references when representing speculative calls.
1787 */
1789 unsigned int speculative_id = 0);
1790
1791 /* Create a callback edge, representing an indirect call to n2
1792 passed to a function by argument. Sets has_callback flag of the original
1793 edge. Both edges are attached to the same call statement. Returns created
1794 callback edge. */
1795 cgraph_edge *make_callback (cgraph_node *n2, unsigned int callback_hash);
1796
1797 /* Returns the callback-carrying edge of a callback edge or NULL, if such edge
1798 cannot be found. An edge is considered callback-carrying, if it has it's
1799 has_callback flag set and shares it's call statement with the edge
1800 this method is caled on. */
1802
1803 /* Returns the first callback edge in the list of callees of the caller node.
1804 Note that the edges might be in arbitrary order. Must be called on a
1805 callback or callback-carrying edge. */
1807
1808 /* Given a callback edge, returns the next callback edge belonging to the same
1809 callback-carrying edge. Must be called on a callback edge, not the
1810 callback-carrying edge. */
1812
1813 /* When called on a callback-carrying edge, removes all of its attached
1814 callback edges and sets has_callback to FALSE. */
1815 void purge_callback_edges ();
1816
1817 /* Speculative call consists of an indirect edge and one or more
1818 direct edge+ref pairs. Speculative will expand to the following sequence:
1819
1820 if (call_dest == target1) // reference to target1
1821 target1 (); // direct call to target1
1822 else if (call_dest == target2) // reference to targt2
1823 target2 (); // direct call to target2
1824 else
1825 call_dest (); // indirect call
1826
1827 Before the expansion we will have indirect call and the direct call+ref
1828 pairs all linked to single statement.
1829
1830 Note that ref may point to different symbol than the corresponding call
1831 becuase the speculated edge may have been optimized (redirected to
1832 a clone) or inlined.
1833
1834 Given an edge which is part of speculative call, return the first
1835 direct call edge in the speculative call sequence.
1836
1837 In the example above called on any cgraph edge in the sequence it will
1838 return direct call to target1. */
1840
1841 /* Return next speculative call target or NULL if there is none.
1842 All targets are required to form an interval in the callee list.
1844 In example above, if called on call to target1 it will return call to
1845 target2. */
1847 {
1848 cgraph_edge *e = this;
1850
1851 if (e->next_callee && e->next_callee->speculative
1852 && e->next_callee->call_stmt == e->call_stmt
1853 && e->next_callee->lto_stmt_uid == e->lto_stmt_uid)
1854 return e->next_callee;
1855 return NULL;
1856 }
1858 /* When called on any edge in the speculative call return the (unique)
1859 indirect call edge in the speculative call sequence. */
1861 {
1863 if (!callee)
1864 return this;
1865 for (cgraph_edge *e2 = caller->indirect_calls;
1866 true; e2 = e2->next_callee)
1867 if (e2->speculative
1868 && call_stmt == e2->call_stmt
1869 && lto_stmt_uid == e2->lto_stmt_uid)
1870 return e2;
1871 }
1872
1873 /* When called on any edge in speculative call and when given any target
1874 of ref which is speculated to it returns the corresponding direct call.
1875
1876 In example above if called on function target2 it will return call to
1877 target2. */
1878 cgraph_edge *speculative_call_for_target (cgraph_node *);
1880 /* Return REF corresponding to direct call in the specualtive call
1881 sequence. */
1883 {
1884 ipa_ref *ref;
1885
1887 for (unsigned int i = 0; caller->iterate_reference (i, ref); i++)
1888 if (ref->speculative && ref->speculative_id == speculative_id
1889 && ref->stmt == (gimple *)call_stmt
1890 && ref->lto_stmt_uid == lto_stmt_uid)
1891 return ref;
1892 gcc_unreachable ();
1893 }
1894
1895 /* Speculative call edge turned out to be direct call to CALLEE_DECL. Remove
1896 the speculative call sequence and return edge representing the call, the
1897 original EDGE can be removed and deallocated. It is up to caller to
1898 redirect the call as appropriate. Return the edge that now represents the
1899 call.
1900
1901 For "speculative" indirect call that contains multiple "speculative"
1902 targets (i.e. edge->indirect_info->num_speculative_call_targets > 1),
1903 decrease the count and only remove current direct edge.
1904
1905 If no speculative direct call left to the speculative indirect call, remove
1906 the speculative of both the indirect call and corresponding direct edge.
1907
1908 It is up to caller to iteratively resolve each "speculative" direct call
1909 and redirect the call as appropriate. */
1910 static cgraph_edge *resolve_speculation (cgraph_edge *edge,
1911 tree callee_decl = NULL);
1912
1913 /* If necessary, change the function declaration in the call statement
1914 associated with edge E so that it corresponds to the edge callee.
1915 Speculations can be resolved in the process and EDGE can be removed and
1916 deallocated.
1917
1918 The edge could be one of speculative direct call generated from speculative
1919 indirect call. In this circumstance, decrease the speculative targets
1920 count (i.e. num_speculative_call_targets) and redirect call stmt to the
1921 corresponding i-th target. If no speculative direct call left to the
1922 speculative indirect call, remove "speculative" of the indirect call and
1923 also redirect stmt to it's final direct target.
1924
1925 When called from within tree-inline, KILLED_SSAs has to contain the
1926 pointer to killed_new_ssa_names within the copy_body_data structure and
1927 SSAs discovered to be useless (if LHS is removed) will be added to it,
1928 otherwise it needs to be NULL.
1929
1930 It is up to caller to iteratively transform each "speculative"
1931 direct call as appropriate. */
1932 static gimple *redirect_call_stmt_to_callee (cgraph_edge *e,
1933 hash_set <tree>
1934 *killed_ssas = nullptr);
1935
1936 /* Create clone of edge in the node N represented
1937 by CALL_EXPR the callgraph. */
1938 cgraph_edge * clone (cgraph_node *n, gcall *call_stmt, unsigned stmt_uid,
1940 bool update_original);
1941
1942 /* Verify edge count and frequency. */
1943 bool verify_count ();
1944
1945 /* Return true when call of edge cannot lead to return from caller
1946 and thus it is safe to ignore its side effects for IPA analysis
1947 when computing side effects of the caller. */
1948 bool cannot_lead_to_return_p (void);
1949
1950 /* Return true when the edge represents a direct recursion. */
1951 bool recursive_p (void);
1952
1953 /* Return true if the edge may be considered hot after scalling its count. */
1954 bool maybe_hot_p ();
1955
1956 /* Return true if the edge may be considered hot after scalling its count
1957 (i.e. assume that optimization would reduce runtime for callee,
1958 possibly significantly). */
1959 bool maybe_hot_p (sreal scale);
1960
1961 /* Get unique identifier of the edge. */
1962 inline int get_uid ()
1963 {
1964 return m_uid;
1966
1967 /* Get summary id of the edge. */
1968 inline int get_summary_id ()
1969 {
1970 return m_summary_id;
1971 }
1972
1973 /* Rebuild cgraph edges for current function node. This needs to be run after
1974 passes that don't update the cgraph. */
1975 static unsigned int rebuild_edges (void);
1976
1977 /* Rebuild cgraph references for current function node. This needs to be run
1978 after passes that don't update the cgraph. */
1979 static void rebuild_references (void);
1980
1981 /* During LTO stream in this can be used to check whether call can possibly
1982 be internal to the current translation unit. */
1983 bool possibly_call_in_translation_unit_p (void);
1984
1985 /* Return num_speculative_targets of this edge. */
1988 /* Expected number of executions: calculated in profile.cc. */
1997 /* Additional information about an indirect call. Not cleared when an edge
1998 becomes direct. */
2000 void *GTY ((skip (""))) aux;
2001 /* When equal to CIF_OK, inline this call. Otherwise, points to the
2002 explanation why function was not inlined. */
2004 /* The stmt_uid of call_stmt. This is used by LTO to recover the call_stmt
2005 when the function is serialized in. */
2006 unsigned int lto_stmt_uid;
2007 /* speculative id is used to link direct calls with their corresponding
2008 IPA_REF_ADDR references when representing speculative calls. */
2009 unsigned int speculative_id : 16;
2010 /* Whether this edge was made direct by indirect inlining. */
2011 unsigned int indirect_inlining_edge : 1;
2012 /* Whether this edge describes an indirect call with an undetermined
2013 callee. */
2014 unsigned int indirect_unknown_callee : 1;
2015 /* Whether this edge is still a dangling */
2016 /* True if the corresponding CALL stmt cannot be inlined. */
2017 unsigned int call_stmt_cannot_inline_p : 1;
2018 /* Can this call throw externally? */
2019 unsigned int can_throw_external : 1;
2020 /* Edges with SPECULATIVE flag represents indirect calls that was
2021 speculatively turned into direct (i.e. by profile feedback).
2022 The final code sequence will have form:
2023
2024 if (call_target == expected_fn)
2025 expected_fn ();
2026 else
2027 call_target ();
2028
2029 Every speculative call is represented by three components attached
2030 to a same call statement:
2031 1) a direct call (to expected_fn)
2032 2) an indirect call (to call_target)
2033 3) a IPA_REF_ADDR reference to expected_fn.
2035 Optimizers may later redirect direct call to clone, so 1) and 3)
2036 do not need to necessarily agree with destination. */
2037 unsigned int speculative : 1;
2038 /* Edges with CALLBACK flag represent indirect calls to functions passed
2039 to their callers by argument. This is useful in cases, where the body
2040 of these caller functions is not known, e. g. qsort in glibc or
2041 GOMP_parallel in libgomp. These edges are never made into real calls,
2042 but are used instead to optimize these callback functions and later replace
2043 their addresses with their optimized versions. Edges with this flag set
2044 share their call statement with their callback-carrying edge. */
2045 unsigned int callback : 1;
2046 /* Edges with this flag set have one or more callback edges attached. They
2047 share their call statements with this edge. This flag represents the fact
2048 that the callee of this edge takes a function and it's parameters by
2049 argument and calls it at a later time. */
2050 unsigned int has_callback : 1;
2051 /* Used to pair callback edges and the attributes that originated them
2052 together. Currently the index of the callback argument, retrieved
2053 from the attribute. */
2054 unsigned int callback_id : 16;
2055 /* Set to true when caller is a constructor or destructor of polymorphic
2056 type. */
2057 unsigned in_polymorphic_cdtor : 1;
2058
2059 /* Return true if call must bind to current definition. */
2060 bool binds_to_current_def_p ();
2061
2062 /* Expected frequency of executions within the function.
2063 When set to CGRAPH_FREQ_BASE, the edge is expected to be called once
2064 per function call. The range is 0 to CGRAPH_FREQ_MAX. */
2065 int frequency ();
2066
2067 /* Expected frequency of executions within the function. */
2069
2070 /* Expected frequency of executions within the function.
2071 If edge is speculative, sum all its indirect targets. */
2073private:
2074 /* Unique id of the edge. */
2076
2077 /* Summary id that is recycled. */
2078 int m_summary_id;
2079
2080 /* Remove the edge from the list of the callers of the callee. */
2081 void remove_caller (void);
2082
2083 /* Remove the edge from the list of the callees of the caller. */
2084 void remove_callee (void);
2085
2086 /* Set callee N of call graph edge and add it to the corresponding set of
2087 callers. */
2088 void set_callee (cgraph_node *n);
2089
2090 /* Output flags of edge to a file F. */
2091 void dump_edge_flags (FILE *f);
2092
2093 /* Dump edge to stderr. */
2094 void DEBUG_FUNCTION debug (void);
2095
2096 /* Verify that call graph edge corresponds to DECL from the associated
2097 statement. Return true if the verification should fail. */
2098 bool verify_corresponds_to_fndecl (tree decl);
2100
2101#define CGRAPH_FREQ_BASE 1000
2102#define CGRAPH_FREQ_MAX 100000
2103
2104/* The varpool data structure.
2105 Each static variable decl has assigned varpool_node. */
2106
2107struct GTY((tag ("SYMTAB_VARIABLE"))) varpool_node : public symtab_node
2108{
2109 /* Constructor. */
2110 explicit varpool_node ()
2113 {}
2114
2115 /* Dump given varpool node to F. */
2116 void dump (FILE *f);
2117
2118 /* Dump given varpool node to stderr. */
2119 void DEBUG_FUNCTION debug (void);
2120
2121 /* Remove variable from symbol table. */
2122 void remove (void);
2123
2124 /* Remove node initializer when it is no longer needed. */
2125 void remove_initializer (void);
2126
2127 void analyze (void);
2128
2129 /* Return variable availability. */
2131
2132 /* When doing LTO, read variable's constructor from disk if
2133 it is not already present. */
2134 tree get_constructor (void);
2135
2136 /* Return true if variable has constructor that can be used for folding. */
2137 bool ctor_useable_for_folding_p (void);
2138
2139 /* For given variable pool node, walk the alias chain to return the function
2140 the variable is alias of. Do not walk through thunks.
2141 When AVAILABILITY is non-NULL, get minimal availability in the chain.
2142 When REF is non-NULL, assume that reference happens in symbol REF
2143 when determining the availability. */
2146
2147 /* Return node that alias is aliasing. */
2148 inline varpool_node *get_alias_target (void);
2149
2150 /* Output one variable, if necessary. Return whether we output it. */
2151 bool assemble_decl (void);
2152
2153 /* For variables in named sections make sure get_variable_section
2154 is called before we switch to those sections. Then section
2155 conflicts between read-only and read-only requiring relocations
2156 sections can be resolved. */
2157 void finalize_named_section_flags (void);
2158
2159 /* Call callback on varpool symbol and aliases associated to varpool symbol.
2160 When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are
2161 skipped. */
2162 bool call_for_symbol_and_aliases (bool (*callback) (varpool_node *, void *),
2163 void *data,
2164 bool include_overwritable);
2165
2166 /* Return true when variable should be considered externally visible. */
2167 bool externally_visible_p (void);
2168
2169 /* Return true when all references to variable must be visible
2170 in ipa_ref_list.
2171 i.e. if the variable is not externally visible or not used in some magic
2172 way (asm statement or such).
2173 The magic uses are all summarized in force_output flag. */
2174 inline bool all_refs_explicit_p ();
2175
2176 /* Return true when variable can be removed from variable pool
2177 if all direct calls are eliminated. */
2178 inline bool can_remove_if_no_refs_p (void);
2179
2180 /* Add the variable DECL to the varpool.
2181 Unlike finalize_decl function is intended to be used
2182 by middle end and allows insertion of new variable at arbitrary point
2183 of compilation. */
2184 static void add (tree decl);
2185
2186 /* Return varpool node for given symbol and check it is a function. */
2187 static inline varpool_node *get (const_tree decl);
2188
2189 /* Mark DECL as finalized. By finalizing the declaration, frontend instruct
2190 the middle end to output the variable to asm file, if needed or externally
2191 visible. */
2192 static void finalize_decl (tree decl);
2193
2194 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
2195 Extra name aliases are output whenever DECL is output. */
2197
2198 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
2199 Extra name aliases are output whenever DECL is output. */
2200 static varpool_node * create_alias (tree, tree);
2201
2202 /* Dump the variable pool to F. */
2203 static void dump_varpool (FILE *f);
2204
2205 /* Dump the variable pool to stderr. */
2206 static void DEBUG_FUNCTION debug_varpool (void);
2207
2208 /* Allocate new callgraph node and insert it into basic data structures. */
2209 static varpool_node *create_empty (void);
2210
2211 /* Return varpool node assigned to DECL. Create new one when needed. */
2212 static varpool_node *get_create (tree decl);
2213
2214 /* Given an assembler name, lookup node. */
2216
2217 /* Set when variable is scheduled to be assembled. */
2218 unsigned output : 1;
2220 /* Set if the variable is dynamically initialized, except for
2221 function local statics. */
2222 unsigned dynamically_initialized : 1;
2223
2224 ENUM_BITFIELD(tls_model) tls_model : 3;
2225
2226 /* Set if the variable is known to be used by single function only.
2227 This is computed by ipa_single_use pass and used by late optimizations
2228 in places where optimization would be valid for local static variable
2229 if we did not do any inter-procedural code movement. */
2230 unsigned used_by_single_function : 1;
2231
2232private:
2233 /* Assemble thunks and aliases associated to varpool node. */
2234 void assemble_aliases (void);
2235
2236 /* Worker for call_for_node_and_aliases. */
2237 bool call_for_symbol_and_aliases_1 (bool (*callback) (varpool_node *, void *),
2238 void *data,
2239 bool include_overwritable);
2240};
2242/* Every top level asm statement is put into a asm_node. */
2243
2244struct GTY ((tag ("TOPLEVEL_ASM"))) asm_node: public toplevel_node {
2245 explicit asm_node (tree asm_str)
2247 {}
2248 /* Next asm node. */
2249 asm_node *next;
2250 /* String for this asm node. */
2251 tree asm_str;
2252};
2253
2254/* Report whether or not THIS symtab node is a function, aka cgraph_node. */
2255
2256template <>
2257template <>
2258inline bool
2260{
2261 return p && p->type == SYMTAB_FUNCTION;
2262}
2263
2264/* Report whether or not THIS symtab node is a variable, aka varpool_node. */
2265
2266template <>
2267template <>
2268inline bool
2270{
2271 return p && p->type == SYMTAB_VARIABLE;
2272}
2273
2274/* Report whether or not THIS toplevel node is a function, aka cgraph_node. */
2275
2276template <>
2277template <>
2278inline bool
2280{
2281 return p && p->type == SYMTAB_FUNCTION;
2282}
2283
2284/* Report whether or not THIS toplevel node is a variable, aka varpool_node. */
2285
2286template <>
2287template <>
2288inline bool
2290{
2291 return p && p->type == SYMTAB_VARIABLE;
2292}
2293
2294/* Report whether or not THIS toplevel node is a symtab_node. */
2295
2296template <>
2297template <>
2298inline bool
2300{
2301 return p && p->type >= SYMTAB_SYMBOL;
2302}
2303
2304/* Report whether or not THIS toplevel node is a toplevel assembly, aka
2305 asm_node. */
2306
2307template <>
2308template <>
2309inline bool
2311{
2312 return p && p->type == TOPLEVEL_ASM;
2315typedef void (*cgraph_edge_hook)(cgraph_edge *, void *);
2316typedef void (*cgraph_node_hook)(cgraph_node *, void *);
2317typedef void (*varpool_node_hook)(varpool_node *, void *);
2318typedef void (*cgraph_2edge_hook)(cgraph_edge *, cgraph_edge *, void *);
2319typedef void (*cgraph_2node_hook)(cgraph_node *, cgraph_node *, void *);
2320
2327/* Map from a symbol to initialization/finalization priorities. */
2328struct GTY(()) symbol_priority_map {
2331};
2332
2334{
2335 /* Frontend is parsing and finalizing functions. */
2336 PARSING,
2337 /* Callgraph is being constructed. It is safe to add new functions. */
2339 /* Callgraph is being streamed-in at LTO time. */
2341 /* Callgraph is built and early IPA passes are being run. */
2342 IPA,
2343 /* Callgraph is built and all functions are transformed to SSA form. */
2345 /* All inline decisions are done; it is now possible to remove extern inline
2346 functions and virtual call targets. */
2348 /* Functions are now ordered and being passed to RTL expanders. */
2349 EXPANSION,
2350 /* All cgraph expansion is done. */
2352};
2354struct asmname_hasher : ggc_ptr_hash <symtab_node>
2355{
2356 typedef const_tree compare_type;
2357
2358 static hashval_t hash (symtab_node *n);
2359 static bool equal (symtab_node *n, const_tree t);
2360};
2361
2362/* Core summaries maintained about symbols. */
2364struct thunk_info;
2365template <class T> class function_summary;
2366typedef function_summary <thunk_info *> thunk_summary;
2368struct clone_info;
2369template <class T> class function_summary;
2370typedef function_summary <clone_info *> clone_summary;
2371
2372class GTY((tag ("SYMTAB"))) symbol_table
2374public:
2375 friend struct symtab_node;
2393 {
2394 }
2395
2396 /* Initialize callgraph dump file. */
2397 void initialize (void);
2398
2399 /* Register a top-level asm statement ASM_STR. */
2400 inline asm_node *finalize_toplevel_asm (tree asm_str);
2401
2402 /* Analyze the whole compilation unit once it is parsed completely. */
2403 void finalize_compilation_unit (void);
2404
2405 /* C++ frontend produce same body aliases all over the place, even before PCH
2406 gets streamed out. It relies on us linking the aliases with their function
2407 in order to do the fixups, but ipa-ref is not PCH safe. Consequently we
2408 first produce aliases without links, but once C++ FE is sure it won't
2409 stream PCH we build the links via this function. */
2410 void process_same_body_aliases (void);
2411
2412 /* Perform simple optimizations based on callgraph. */
2413 void compile (void);
2414
2415 /* Process CGRAPH_NEW_FUNCTIONS and perform actions necessary to add these
2416 functions into callgraph in a way so they look like ordinary reachable
2417 functions inserted into callgraph already at construction time. */
2418 void process_new_functions (void);
2419
2420 /* Register a symbol NODE. */
2422
2423 inline void
2424 clear_asm_symbols (void)
2425 {
2426 asmnodes = NULL;
2428 }
2429
2430 /* Perform reachability analysis and reclaim all unreachable nodes. */
2431 bool remove_unreachable_nodes (FILE *file);
2432
2433 /* Optimization of function bodies might've rendered some variables as
2434 unnecessary so we want to avoid these from being compiled. Re-do
2435 reachability starting from variables that are either externally visible
2436 or was referred from the asm output routines. */
2437 void remove_unreferenced_decls (void);
2438
2439 /* Unregister a symbol NODE. */
2440 inline void unregister (symtab_node *node);
2441
2442 /* Allocate new callgraph node and insert it into basic data structures. */
2443 cgraph_node *create_empty (void);
2444
2445 /* Release a callgraph NODE. */
2446 void release_symbol (cgraph_node *node);
2447
2448 /* Output all variables enqueued to be assembled. */
2449 bool output_variables (void);
2450
2451 /* Weakrefs may be associated to external decls and thus not output
2452 at expansion time. Emit all necessary aliases. */
2453 void output_weakrefs (void);
2454
2455 /* Return first static symbol with definition. */
2456 inline symtab_node *first_symbol (void);
2458 /* Return first assembler symbol. */
2459 inline asm_node *
2460 first_asm_symbol (void)
2461 {
2462 return asmnodes;
2463 }
2464
2465 /* Return first static symbol with definition. */
2466 inline symtab_node *first_defined_symbol (void);
2467
2468 /* Return first variable. */
2469 inline varpool_node *first_variable (void);
2470
2471 /* Return next variable after NODE. */
2472 inline varpool_node *next_variable (varpool_node *node);
2473
2474 /* Return first static variable with initializer. */
2475 inline varpool_node *first_static_initializer (void);
2476
2477 /* Return next static variable with initializer after NODE. */
2478 inline varpool_node *next_static_initializer (varpool_node *node);
2479
2480 /* Return first static variable with definition. */
2481 inline varpool_node *first_defined_variable (void);
2482
2483 /* Return next static variable with definition after NODE. */
2484 inline varpool_node *next_defined_variable (varpool_node *node);
2485
2486 /* Return first function with body defined. */
2487 inline cgraph_node *first_defined_function (void);
2488
2489 /* Return next function with body defined after NODE. */
2490 inline cgraph_node *next_defined_function (cgraph_node *node);
2491
2492 /* Return first function. */
2493 inline cgraph_node *first_function (void);
2494
2495 /* Return next function. */
2496 inline cgraph_node *next_function (cgraph_node *node);
2497
2498 /* Return first function with body defined. */
2499 cgraph_node *first_function_with_gimple_body (void);
2500
2501 /* Return next reachable static variable with initializer after NODE. */
2502 inline cgraph_node *next_function_with_gimple_body (cgraph_node *node);
2503
2504 /* Register HOOK to be called with DATA on each removed edge. */
2505 cgraph_edge_hook_list *add_edge_removal_hook (cgraph_edge_hook hook,
2506 void *data);
2507
2508 /* Remove ENTRY from the list of hooks called on removing edges. */
2509 void remove_edge_removal_hook (cgraph_edge_hook_list *entry);
2510
2511 /* Register HOOK to be called with DATA on each removed node. */
2512 cgraph_node_hook_list *add_cgraph_removal_hook (cgraph_node_hook hook,
2513 void *data);
2514
2515 /* Remove ENTRY from the list of hooks called on removing nodes. */
2516 void remove_cgraph_removal_hook (cgraph_node_hook_list *entry);
2517
2518 /* Register HOOK to be called with DATA on each removed node. */
2519 varpool_node_hook_list *add_varpool_removal_hook (varpool_node_hook hook,
2520 void *data);
2521
2522 /* Remove ENTRY from the list of hooks called on removing nodes. */
2523 void remove_varpool_removal_hook (varpool_node_hook_list *entry);
2524
2525 /* Register HOOK to be called with DATA on each inserted node. */
2526 cgraph_node_hook_list *add_cgraph_insertion_hook (cgraph_node_hook hook,
2527 void *data);
2528
2529 /* Remove ENTRY from the list of hooks called on inserted nodes. */
2530 void remove_cgraph_insertion_hook (cgraph_node_hook_list *entry);
2531
2532 /* Register HOOK to be called with DATA on each inserted node. */
2533 varpool_node_hook_list *add_varpool_insertion_hook (varpool_node_hook hook,
2534 void *data);
2535
2536 /* Remove ENTRY from the list of hooks called on inserted nodes. */
2537 void remove_varpool_insertion_hook (varpool_node_hook_list *entry);
2538
2539 /* Register HOOK to be called with DATA on each duplicated edge. */
2540 cgraph_2edge_hook_list *add_edge_duplication_hook (cgraph_2edge_hook hook,
2541 void *data);
2542 /* Remove ENTRY from the list of hooks called on duplicating edges. */
2543 void remove_edge_duplication_hook (cgraph_2edge_hook_list *entry);
2544
2545 /* Register HOOK to be called with DATA on each duplicated node. */
2546 cgraph_2node_hook_list *add_cgraph_duplication_hook (cgraph_2node_hook hook,
2547 void *data);
2548
2549 /* Remove ENTRY from the list of hooks called on duplicating nodes. */
2550 void remove_cgraph_duplication_hook (cgraph_2node_hook_list *entry);
2551
2552 /* Call all edge removal hooks. */
2553 void call_edge_removal_hooks (cgraph_edge *e);
2554
2555 /* Call all node insertion hooks. */
2556 void call_cgraph_insertion_hooks (cgraph_node *node);
2557
2558 /* Call all node removal hooks. */
2559 void call_cgraph_removal_hooks (cgraph_node *node);
2560
2561 /* Call all node duplication hooks. */
2562 void call_cgraph_duplication_hooks (cgraph_node *node, cgraph_node *node2);
2563
2564 /* Call all edge duplication hooks. */
2565 void call_edge_duplication_hooks (cgraph_edge *cs1, cgraph_edge *cs2);
2566
2567 /* Call all node removal hooks. */
2568 void call_varpool_removal_hooks (varpool_node *node);
2569
2570 /* Call all node insertion hooks. */
2571 void call_varpool_insertion_hooks (varpool_node *node);
2572
2573 /* Arrange node to be first in its entry of assembler_name_hash. */
2574 void symtab_prevail_in_asm_name_hash (symtab_node *node);
2575
2576 /* Initialize asm name hash unless. */
2577 void symtab_initialize_asm_name_hash (void);
2578
2579 /* Set the DECL_ASSEMBLER_NAME and update symtab hashtables. */
2581
2582 /* Dump symbol table to F. */
2583 void dump (FILE *f);
2584
2585 /* Dump symbol table to F in graphviz format. */
2586 void dump_graphviz (FILE *f);
2587
2588 /* Dump symbol table to stderr. */
2590
2591 /* Assign a new summary ID for the callgraph NODE. */
2592 inline int assign_summary_id (cgraph_node *node)
2593 {
2594 if (!cgraph_released_summary_ids.is_empty ())
2595 node->m_summary_id = cgraph_released_summary_ids.pop ();
2596 else
2597 node->m_summary_id = cgraph_max_summary_id++;
2598
2599 return node->m_summary_id;
2601
2602 /* Assign a new summary ID for the callgraph EDGE. */
2603 inline int assign_summary_id (cgraph_edge *edge)
2604 {
2605 if (!edge_released_summary_ids.is_empty ())
2606 edge->m_summary_id = edge_released_summary_ids.pop ();
2607 else
2608 edge->m_summary_id = edges_max_summary_id++;
2609
2610 return edge->m_summary_id;
2611 }
2612
2613 /* Return true if assembler names NAME1 and NAME2 leads to the same symbol
2614 name. */
2615 static bool assembler_names_equal_p (const char *name1, const char *name2);
2617 int cgraph_count;
2621 int edges_count;
2622 int edges_max_uid;
2624
2625 /* Vector of released summary IDS for cgraph nodes. */
2627
2628 /* Vector of released summary IDS for cgraph nodes. */
2630
2631 /* Return symbol used to separate symbol name from suffix. */
2634 symtab_node* GTY(()) nodes;
2635 asm_node* GTY(()) asmnodes;
2637
2638 /* The order index of the next symtab node to be created. This is
2639 used so that we can sort the cgraph nodes in order by when we saw
2640 them, to support -fno-toplevel-reorder. */
2642
2643 /* Maximal unit ID used. */
2645
2646 /* Set when whole unit has been analyzed so we can access global info. */
2647 bool global_info_ready;
2648 /* What state callgraph is in right now. */
2649 enum symtab_state state;
2650 /* Set when the cgraph is fully build and the basic flags are computed. */
2652
2654
2655 /* Hash table used to hold sections. */
2657
2658 /* Hash table used to convert assembler names into nodes. */
2660
2661 /* Hash table used to hold init priorities. */
2664 FILE* GTY ((skip)) dump_file;
2666 FILE* GTY ((skip)) ipa_clones_dump_file;
2667
2669
2670 /* Thunk annotations. */
2672
2673 /* Virtual clone annotations. */
2675
2676private:
2677 /* Allocate a cgraph_edge structure and fill it with data according to the
2678 parameters of which only CALLEE can be NULL (when creating an indirect
2679 call edge). CLONING_P should be set if properties that are copied from an
2680 original edge should not be calculated. */
2682 gcall *call_stmt, profile_count count,
2683 bool indir_unknown_callee, bool cloning_p);
2684
2685 /* Put the edge onto the free list. */
2686 void free_edge (cgraph_edge *e);
2687
2688 /* Insert NODE to assembler name hash. */
2689 void insert_to_assembler_name_hash (symtab_node *node, bool with_clones);
2690
2691 /* Remove NODE from assembler name hash. */
2692 void unlink_from_assembler_name_hash (symtab_node *node, bool with_clones);
2693
2694 /* Hash asmnames ignoring the user specified marks. */
2695 static hashval_t decl_assembler_name_hash (const_tree asmname);
2696
2697 /* Compare ASMNAME with the DECL_ASSEMBLER_NAME of DECL. */
2698 static bool decl_assembler_name_equal (tree decl, const_tree asmname);
2699
2700 friend struct asmname_hasher;
2701
2702 /* List of hooks triggered when an edge is removed. */
2704 /* List of hooks trigger_red when a cgraph node is removed. */
2706 /* List of hooks triggered when an edge is duplicated. */
2708 /* List of hooks triggered when a node is duplicated. */
2710 /* List of hooks triggered when an function is inserted. */
2712 /* List of hooks triggered when an variable is inserted. */
2714 /* List of hooks triggered when a node is removed. */
2716};
2717
2718extern GTY(()) symbol_table *symtab;
2719
2721
2722inline hashval_t
2724{
2726 (DECL_ASSEMBLER_NAME (n->decl));
2728
2729inline bool
2731{
2732 return symbol_table::decl_assembler_name_equal (n->decl, t);
2733}
2734
2735/* In cgraph.cc */
2736void cgraph_cc_finalize (void);
2738cgraph_indirect_call_info *cgraph_allocate_init_indirect_info (void);
2739
2740void cgraph_update_edges_for_call_stmt (gimple *, tree, gimple *);
2742
2745
2746/* In cgraphunit.cc */
2747void cgraphunit_cc_finalize (void);
2748int tp_first_run_node_cmp (const void *pa, const void *pb);
2749
2750/* In symtab-thunks.cc */
2751void symtab_thunks_cc_finalize (void);
2752
2753/* Initialize datastructures so DECL is a function in lowered gimple form.
2754 IN_SSA is true if the gimple is in SSA. */
2755basic_block init_lowered_empty_function (tree, bool, profile_count);
2756
2757tree thunk_adjust (gimple_stmt_iterator *, tree, bool, HOST_WIDE_INT, tree,
2758 HOST_WIDE_INT);
2759/* In cgraphclones.cc */
2760
2761tree clone_function_name_numbered (const char *name, const char *suffix);
2762tree clone_function_name_numbered (tree decl, const char *suffix);
2763tree clone_function_name (const char *name, const char *suffix,
2764 unsigned long number);
2765tree clone_function_name (tree decl, const char *suffix,
2766 unsigned long number);
2767tree clone_function_name (tree decl, const char *suffix);
2768tree clone_identifier (tree decl, const char *suffix,
2769 bool filter_suffix = false);
2770
2771void tree_function_versioning (tree, tree, vec<ipa_replace_map *, va_gc> *,
2772 ipa_param_adjustments *,
2773 bool, bitmap, basic_block);
2774
2775void dump_callgraph_transformation (const cgraph_node *original,
2776 const cgraph_node *clone,
2777 const char *suffix);
2778void set_new_clone_decl_and_node_flags (cgraph_node *new_node);
2779/* In cgraphbuild.cc */
2782
2783/* In ipa.cc */
2784void cgraph_build_static_cdtor (char which, tree body, int priority);
2785bool ipa_discover_variable_flags (void);
2786
2787/* In varpool.cc */
2789
2790/* In ipa-inline-analysis.cc */
2791void initialize_inline_failed (struct cgraph_edge *);
2792bool speculation_useful_p (struct cgraph_edge *e, bool anticipate_inlining);
2793
2794/* Return true when the symbol is real symbol, i.e. it is not inline clone
2795 or abstract function kept for debug info purposes only. */
2796inline bool
2798{
2799 cgraph_node *cnode;
2800
2801 if (DECL_ABSTRACT_P (decl))
2802 return false;
2804 return false;
2805 if (!is_a <cgraph_node *> (this))
2806 return true;
2807 cnode = dyn_cast <cgraph_node *> (this);
2808 if (cnode->inlined_to)
2809 return false;
2810 return true;
2811}
2812
2813/* Return true if DECL should have entry in symbol table if used.
2814 Those are functions and static & external variables. */
2815
2816inline bool
2818{
2819 return (TREE_CODE (decl) == FUNCTION_DECL
2820 || (VAR_P (decl)
2821 && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))));
2823
2824inline bool
2826{
2827 symtab_node *source = this;
2828
2829 if (cgraph_node *cn = dyn_cast <cgraph_node *> (target))
2830 {
2831 if (cn->inlined_to)
2832 source = cn->inlined_to;
2833 }
2834 if (cgraph_node *cn = dyn_cast <cgraph_node *> (target))
2835 {
2836 if (cn->inlined_to)
2837 target = cn->inlined_to;
2838 }
2839
2840 return source->get_comdat_group () == target->get_comdat_group ();
2841}
2842
2843/* Return node that alias is aliasing. */
2844
2845inline symtab_node *
2847{
2848 ipa_ref *ref = NULL;
2849 iterate_reference (0, ref);
2851 return ref->referred;
2852}
2853
2854/* Return the DECL (or identifier) that alias is aliasing. Unlike the above,
2855 this works whether or not the alias has been analyzed already. */
2856
2857inline tree
2859{
2860 if (alias_target)
2861 return alias_target;
2862 return get_alias_target ()->decl;
2863}
2864
2865/* Return next reachable static symbol with initializer after the node. */
2866
2867inline symtab_node *
2869{
2870 symtab_node *node1 = next;
2871
2872 for (; node1; node1 = node1->next)
2873 if (node1->definition)
2874 return node1;
2875
2876 return NULL;
2877}
2878
2879/* Iterates I-th reference in the list, REF is also set. */
2880
2881inline ipa_ref *
2883{
2884 ref_list.references.iterate (i, &ref);
2885
2886 return ref;
2887}
2888
2889/* Iterates I-th referring item in the list, REF is also set. */
2890
2891inline ipa_ref *
2893{
2894 ref_list.referring.iterate (i, &ref);
2895
2896 return ref;
2897}
2898
2899/* Iterates I-th referring alias item in the list, REF is also set. */
2900
2901inline ipa_ref *
2903{
2904 ref_list.referring.iterate (i, &ref);
2905
2906 if (ref && ref->use != IPA_REF_ALIAS)
2907 return NULL;
2908
2909 return ref;
2910}
2911
2912/* Return true if list contains an alias. */
2913
2914inline bool
2916{
2917 ipa_ref *ref = NULL;
2918
2919 return (iterate_direct_aliases (0, ref) != NULL);
2920}
2921
2922/* Return true when RESOLUTION indicate that linker will use
2923 the symbol from non-LTO object files. */
2924
2925inline bool
2926resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution resolution)
2927{
2928 return (resolution == LDPR_PREVAILING_DEF
2929 || resolution == LDPR_PREEMPTED_REG
2930 || resolution == LDPR_RESOLVED_EXEC
2931 || resolution == LDPR_RESOLVED_DYN);
2932}
2933
2934/* Return true when symtab_node is known to be used from other (non-LTO)
2935 object file. Known only when doing LTO via linker plugin. */
2936
2937inline bool
2939{
2940 if (!TREE_PUBLIC (decl) || DECL_EXTERNAL (decl))
2941 return false;
2943 return true;
2944 return false;
2945}
2946
2947/* Return varpool node for given symbol and check it is a function. */
2948
2949inline varpool_node *
2951{
2952 gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
2954}
2955
2956/* Register a symbol NODE. */
2957
2958inline void
2960{
2961 node->next = nodes;
2962 node->previous = NULL;
2963
2964 if (nodes)
2965 nodes->previous = node;
2966 nodes = node;
2967
2968 nodes->m_uid = cgraph_max_uid++;
2969
2970 if (node->order == -1)
2971 node->order = order++;
2972}
2973
2974/* Register a top-level asm statement ASM_STR. */
2975
2976asm_node *
2978{
2979 asm_node *node;
2980
2981 node = new (ggc_cleared_alloc<asm_node> ()) asm_node (asm_str);
2982 node->order = order++;
2983
2984 if (asmnodes == NULL)
2985 asmnodes = node;
2986 else
2987 asm_last_node->next = node;
2988
2990 return node;
2991}
2993/* Unregister a symbol NODE. */
2994inline void
2996{
2997 if (node->previous)
2998 node->previous->next = node->next;
2999 else
3000 nodes = node->next;
3001
3002 if (node->next)
3003 node->next->previous = node->previous;
3004
3005 node->next = NULL;
3006 node->previous = NULL;
3007}
3008
3009/* Release a callgraph NODE with UID and put in to the list of free nodes. */
3010
3011inline void
3013{
3014 cgraph_count--;
3015 if (node->m_summary_id != -1)
3016 cgraph_released_summary_ids.safe_push (node->m_summary_id);
3017 ggc_free (node);
3018}
3020/* Return first static symbol with definition. */
3021inline symtab_node *
3023{
3024 return nodes;
3026
3027/* Walk all symbols. */
3028#define FOR_EACH_SYMBOL(node) \
3029 for ((node) = symtab->first_symbol (); (node); (node) = (node)->next)
3031/* Return first static symbol with definition. */
3032inline symtab_node *
3034{
3036
3037 for (node = nodes; node; node = node->next)
3038 if (node->definition)
3039 return node;
3040
3041 return NULL;
3043
3044/* Walk all symbols with definitions in current unit. */
3045#define FOR_EACH_DEFINED_SYMBOL(node) \
3046 for ((node) = symtab->first_defined_symbol (); (node); \
3047 (node) = node->next_defined_symbol ())
3049/* Return first variable. */
3050inline varpool_node *
3052{
3054 for (node = nodes; node; node = node->next)
3056 return vnode;
3057 return NULL;
3058}
3060/* Return next variable after NODE. */
3061inline varpool_node *
3063{
3064 symtab_node *node1 = node->next;
3065 for (; node1; node1 = node1->next)
3066 if (varpool_node *vnode1 = dyn_cast <varpool_node *> (node1))
3067 return vnode1;
3068 return NULL;
3069}
3070/* Walk all variables. */
3071#define FOR_EACH_VARIABLE(node) \
3072 for ((node) = symtab->first_variable (); \
3073 (node); \
3074 (node) = symtab->next_variable ((node)))
3076/* Return first static variable with initializer. */
3077inline varpool_node *
3079{
3081 for (node = nodes; node; node = node->next)
3082 {
3084 if (vnode && DECL_INITIAL (node->decl))
3085 return vnode;
3086 }
3087 return NULL;
3088}
3090/* Return next static variable with initializer after NODE. */
3091inline varpool_node *
3093{
3094 symtab_node *node1 = node->next;
3095 for (; node1; node1 = node1->next)
3096 {
3097 varpool_node *vnode1 = dyn_cast <varpool_node *> (node1);
3098 if (vnode1 && DECL_INITIAL (node1->decl))
3099 return vnode1;
3100 }
3101 return NULL;
3103
3104/* Walk all static variables with initializer set. */
3105#define FOR_EACH_STATIC_INITIALIZER(node) \
3106 for ((node) = symtab->first_static_initializer (); (node); \
3107 (node) = symtab->next_static_initializer (node))
3109/* Return first static variable with definition. */
3110inline varpool_node *
3112{
3114 for (node = nodes; node; node = node->next)
3115 {
3117 if (vnode && vnode->definition)
3118 return vnode;
3119 }
3120 return NULL;
3121}
3123/* Return next static variable with definition after NODE. */
3124inline varpool_node *
3126{
3127 symtab_node *node1 = node->next;
3128 for (; node1; node1 = node1->next)
3129 {
3130 varpool_node *vnode1 = dyn_cast <varpool_node *> (node1);
3131 if (vnode1 && vnode1->definition)
3132 return vnode1;
3133 }
3134 return NULL;
3135}
3136/* Walk all variables with definitions in current unit. */
3137#define FOR_EACH_DEFINED_VARIABLE(node) \
3138 for ((node) = symtab->first_defined_variable (); (node); \
3139 (node) = symtab->next_defined_variable (node))
3141/* Return first function with body defined. */
3142inline cgraph_node *
3144{
3146 for (node = nodes; node; node = node->next)
3147 {
3149 if (cn && cn->definition)
3150 return cn;
3151 }
3152 return NULL;
3153}
3155/* Return next function with body defined after NODE. */
3156inline cgraph_node *
3158{
3159 symtab_node *node1 = node->next;
3160 for (; node1; node1 = node1->next)
3161 {
3163 if (cn1 && cn1->definition)
3164 return cn1;
3165 }
3166 return NULL;
3168
3169/* Walk all functions with body defined. */
3170#define FOR_EACH_DEFINED_FUNCTION(node) \
3171 for ((node) = symtab->first_defined_function (); (node); \
3172 (node) = symtab->next_defined_function ((node)))
3174/* Return first function. */
3175inline cgraph_node *
3177{
3179 for (node = nodes; node; node = node->next)
3181 return cn;
3182 return NULL;
3183}
3185/* Return next function. */
3186inline cgraph_node *
3188{
3189 symtab_node *node1 = node->next;
3190 for (; node1; node1 = node1->next)
3191 if (cgraph_node *cn1 = dyn_cast <cgraph_node *> (node1))
3192 return cn1;
3193 return NULL;
3194}
3196/* Return first function with body defined. */
3197inline cgraph_node *
3199{
3201 for (node = nodes; node; node = node->next)
3202 {
3204 if (cn && cn->has_gimple_body_p ())
3205 return cn;
3206 }
3207 return NULL;
3208}
3210/* Return next reachable static variable with initializer after NODE. */
3211inline cgraph_node *
3213{
3214 symtab_node *node1 = node->next;
3215 for (; node1; node1 = node1->next)
3216 {
3218 if (cn1 && cn1->has_gimple_body_p ())
3219 return cn1;
3220 }
3221 return NULL;
3223
3224/* Walk all functions. */
3225#define FOR_EACH_FUNCTION(node) \
3226 for ((node) = symtab->first_function (); (node); \
3227 (node) = symtab->next_function ((node)))
3228
3229/* Walk all functions but precompute so a node can be deleted if needed. */
3230#define FOR_EACH_FUNCTION_REMOVABLE(node) \
3231 cgraph_node *next; \
3232 for ((node) = symtab->first_function (), \
3233 next = (node) ? symtab->next_function ((node)) : NULL; (node); \
3234 (node) = next, next = (node) ? symtab->next_function ((node)) : NULL)
3235
3236/* Return true when callgraph node is a function with Gimple body defined
3237 in current unit. Functions can also be define externally or they
3238 can be thunks with no Gimple representation.
3239
3240 Note that at WPA stage, the function body may not be present in memory. */
3241
3242inline bool
3244{
3245 return definition && !thunk && !alias;
3247
3248/* Walk all functions with body defined. */
3249#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \
3250 for ((node) = symtab->first_function_with_gimple_body (); (node); \
3251 (node) = symtab->next_function_with_gimple_body (node))
3252
3253/* Uniquize all constants that appear in memory.
3254 Each constant in memory thus far output is recorded
3255 in `const_desc_table'. */
3257struct GTY((for_user)) constant_descriptor_tree {
3258 /* A MEM for the constant. */
3260
3261 /* The value of the constant. */
3262 tree value;
3263
3264 /* Hash of value. Computing the hash from value each time
3265 hashfn is called can't work properly, as that means recursive
3266 use of the hash table during hash table expansion. */
3267 hashval_t hash;
3268};
3269
3270/* Return true when function is only called directly or it has alias.
3271 i.e. it is not externally visible, address was not taken and
3272 it is not used in any other non-standard way. */
3273
3274inline bool
3276{
3278 return (!force_output && !address_taken
3279 && !ifunc_resolver
3281 && !DECL_VIRTUAL_P (decl)
3285 && !externally_visible);
3286}
3287
3288/* Return true when function can be removed from callgraph
3289 if all direct calls are eliminated. */
3290
3291inline bool
3293{
3295 /* Extern inlines can always go, we will use the external definition. */
3296 if (DECL_EXTERNAL (decl))
3297 return true;
3298 /* When function is needed, we cannot remove it. */
3300 return false;
3303 return false;
3304 /* Only COMDAT functions can be removed if externally visible. */
3306 && ((!DECL_COMDAT (decl) || ifunc_resolver)
3307 || forced_by_abi
3309 return false;
3310 return true;
3311}
3312
3313/* Verify cgraph, if consistency checking is enabled. */
3314
3315inline void
3317{
3318 if (flag_checking)
3320}
3321
3322/* Return true when variable can be removed from variable pool
3323 if all direct calls are eliminated. */
3324
3325inline bool
3327{
3328 if (DECL_EXTERNAL (decl))
3329 return true;
3331 && ((DECL_COMDAT (decl)
3332 && !forced_by_abi
3336}
3337
3338/* Return true when all references to variable must be visible in ipa_ref_list.
3339 i.e. if the variable is not externally visible or not used in some magic
3340 way (asm statement or such).
3341 The magic uses are all summarized in force_output flag. */
3342
3343inline bool
3345{
3346 return (definition
3349 && !force_output);
3350}
3351
3352struct tree_descriptor_hasher : ggc_ptr_hash<constant_descriptor_tree>
3353{
3354 static hashval_t hash (constant_descriptor_tree *);
3355 static bool equal (constant_descriptor_tree *, constant_descriptor_tree *);
3356};
3357
3358/* Constant pool accessor function. */
3359hash_table<tree_descriptor_hasher> *constant_pool_htab (void);
3360
3361/* Return node that alias is aliasing. */
3362
3363inline cgraph_node *
3365{
3367}
3368
3369/* Return node that alias is aliasing. */
3370
3371inline varpool_node *
3373{
3375}
3376
3377/* Walk the alias chain to return the symbol NODE is alias of.
3378 If NODE is not an alias, return NODE.
3379 When AVAILABILITY is non-NULL, get minimal availability in the chain.
3380 When REF is non-NULL, assume that reference happens in symbol REF
3381 when determining the availability. */
3382
3383inline symtab_node *
3385 symtab_node *ref)
3386{
3387 if (!alias)
3388 {
3389 if (availability)
3391 return this;
3392 }
3393
3395}
3396
3397/* Given function symbol, walk the alias chain to return the function node
3398 is alias of. Do not walk through thunks.
3399 When AVAILABILITY is non-NULL, get minimal availability in the chain.
3400 When REF is non-NULL, assume that reference happens in symbol REF
3401 when determining the availability. */
3402
3403inline cgraph_node *
3405 symtab_node *ref)
3406{
3409 if (!n && availability)
3411 return n;
3412}
3413
3414/* For given variable pool node, walk the alias chain to return the function
3415 the variable is alias of. Do not walk through thunks.
3416 When AVAILABILITY is non-NULL, get minimal availability in the chain.
3417 When REF is non-NULL, assume that reference happens in symbol REF
3418 when determining the availability. */
3419
3420inline varpool_node *
3422 symtab_node *ref)
3423{
3426
3427 if (!n && availability)
3429 return n;
3430}
3431
3432/* Set callee N of call graph edge and add it to the corresponding set of
3433 callers. */
3434
3435inline void
3437{
3438 prev_caller = NULL;
3439 if (n->callers)
3440 n->callers->prev_caller = this;
3441 next_caller = n->callers;
3442 n->callers = this;
3443 callee = n;
3444}
3445
3446/* Return true when the edge represents a direct recursion. */
3447
3448inline bool
3450{
3451 cgraph_node *c = callee->ultimate_alias_target ();
3452 if (caller->inlined_to)
3453 return caller->inlined_to->decl == c->decl;
3454 else
3455 return caller->decl == c->decl;
3456}
3457
3458/* Remove the edge from the list of the callers of the callee. */
3459
3460inline void
3462{
3464 if (prev_caller)
3465 prev_caller->next_caller = next_caller;
3466 if (next_caller)
3467 next_caller->prev_caller = prev_caller;
3468 if (!prev_caller)
3469 callee->callers = next_caller;
3470}
3471
3472/* Return true if call must bind to current definition. */
3473
3474inline bool
3476{
3477 if (callee)
3478 return callee->binds_to_current_def_p (caller);
3479 else
3480 return false;
3481}
3482
3483/* Expected frequency of executions within the function.
3484 When set to CGRAPH_FREQ_BASE, the edge is expected to be called once
3485 per function call. The range is 0 to CGRAPH_FREQ_MAX. */
3486
3487inline int
3489{
3490 return count.to_cgraph_frequency (caller->inlined_to
3491 ? caller->inlined_to->count
3492 : caller->count);
3493}
3494
3496/* Return true if the TM_CLONE bit is set for a given FNDECL. */
3497inline bool
3499{
3500 cgraph_node *n = cgraph_node::get (fndecl);
3501 if (n)
3502 return n->tm_clone;
3503 return false;
3504}
3505
3506/* Likewise indicate that a node is needed, i.e. reachable via some
3507 external means. */
3508
3509inline void
3511{
3512 force_output = 1;
3514}
3515
3516/* Return true if function should be optimized for size. */
3517
3518inline enum optimize_size_level
3520{
3521 if (opt_for_fn (decl, optimize_size))
3522 return OPTIMIZE_SIZE_MAX;
3523 if (count == profile_count::zero ())
3524 return OPTIMIZE_SIZE_MAX;
3527 else
3528 return OPTIMIZE_SIZE_NO;
3529}
3530
3531/* Return symtab_node for NODE or create one if it is not present
3532 in symtab. */
3533
3534inline symtab_node *
3536{
3537 if (VAR_P (node))
3539 else
3541}
3542
3543/* Return availability of NODE when referenced from REF. */
3544
3545inline enum availability
3547{
3548 if (is_a <cgraph_node *> (this))
3549 return dyn_cast <cgraph_node *> (this)->get_availability (ref);
3550 else
3551 return dyn_cast <varpool_node *> (this)->get_availability (ref);
3552}
3553
3554/* Call callback on symtab node and aliases associated to this node.
3555 When INCLUDE_OVERWRITABLE is false, overwritable symbols are skipped. */
3556
3557inline bool
3559 void *),
3560 void *data,
3561 bool include_overwritable)
3562{
3563 if (include_overwritable
3565 {
3566 if (callback (this, data))
3567 return true;
3568 }
3569 if (has_aliases_p ())
3570 return call_for_symbol_and_aliases_1 (callback, data, include_overwritable);
3571 return false;
3572}
3573
3574/* Call callback on function and aliases associated to the function.
3575 When INCLUDE_OVERWRITABLE is false, overwritable symbols are
3576 skipped. */
3577
3578inline bool
3580 void *),
3581 void *data,
3582 bool include_overwritable)
3583{
3584 if (include_overwritable
3586 {
3587 if (callback (this, data))
3588 return true;
3589 }
3590 if (has_aliases_p ())
3591 return call_for_symbol_and_aliases_1 (callback, data, include_overwritable);
3592 return false;
3593}
3594
3595/* Call callback on varpool symbol and aliases associated to varpool symbol.
3596 When INCLUDE_OVERWRITABLE is false, overwritable symbols are
3597 skipped. */
3598
3599inline bool
3601 void *),
3602 void *data,
3603 bool include_overwritable)
3604{
3605 if (include_overwritable
3607 {
3608 if (callback (this, data))
3609 return true;
3610 }
3611 if (has_aliases_p ())
3612 return call_for_symbol_and_aliases_1 (callback, data, include_overwritable);
3613 return false;
3614}
3615
3616/* Return true if reference may be used in address compare. */
3617
3618inline bool
3620{
3621 if (use != IPA_REF_ADDR)
3622 return false;
3623 /* Addresses taken from virtual tables are never compared. */
3625 && DECL_VIRTUAL_P (referring->decl))
3626 return false;
3627 return referred->address_can_be_compared_p ();
3628}
3629
3630/* Build polymorphic call context for indirect call E. */
3631
3632inline
3634{
3635 gcc_checking_assert (e->indirect_info->polymorphic);
3636 *this = e->indirect_info->context;
3637}
3638
3639/* Build empty "I know nothing" context. */
3640
3641inline
3643{
3646 invalid = false;
3647}
3648
3649/* Make context non-speculative. */
3650
3651inline void
3653{
3657}
3658
3659/* Produce context specifying all derived types of OTR_TYPE. If OTR_TYPE is
3660 NULL, the context is set to dummy "I know nothing" setting. */
3661
3662inline void
3664{
3665 outer_type = otr_type ? TYPE_MAIN_VARIANT (otr_type) : NULL;
3666 offset = 0;
3667 maybe_derived_type = true;
3668 maybe_in_construction = true;
3669 dynamic = true;
3670}
3671
3672/* Adjust all offsets in contexts by OFF bits. */
3673
3674inline void
3676{
3677 if (outer_type)
3678 offset += off;
3680 speculative_offset += off;
3681}
3682
3683/* Return TRUE if context is fully useless. */
3684
3685inline bool
3687{
3688 return (!outer_type && !speculative_outer_type);
3689}
3690
3691/* When using fprintf (or similar), problems can arise with
3692 transient generated strings. Many string-generation APIs
3693 only support one result being alive at once (e.g. by
3694 returning a pointer to a statically-allocated buffer).
3695
3696 If there is more than one generated string within one
3697 fprintf call: the first string gets evicted or overwritten
3698 by the second, before fprintf is fully evaluated.
3699 See e.g. PR/53136.
3700
3701 This function provides a workaround for this, by providing
3702 a simple way to create copies of these transient strings,
3703 without the need to have explicit cleanup:
3704
3705 fprintf (dumpfile, "string 1: %s string 2:%s\n",
3706 xstrdup_for_dump (EXPR_1),
3707 xstrdup_for_dump (EXPR_2));
3708
3709 This is actually a simple wrapper around ggc_strdup, but
3710 the name documents the intent. We require that no GC can occur
3711 within the fprintf call. */
3712
3713inline const char *
3714xstrdup_for_dump (const char *transient_str)
3715{
3716 return ggc_strdup (transient_str);
3717}
3718
3719/* During LTO stream-in this predicate can be used to check whether node
3720 in question prevails in the linking to save some memory usage. */
3721inline bool
3723{
3724 return definition && ((!TREE_PUBLIC (decl) && !DECL_EXTERNAL (decl))
3726}
3727
3728extern GTY(()) symbol_table *saved_symtab;
3729
3730#if CHECKING_P
3731
3732namespace selftest {
3733
3734/* An RAII-style class for use in selftests for temporarily using a different
3735 symbol_table, so that such tests can be isolated from each other. */
3736
3737class symbol_table_test
3738{
3739 public:
3740 /* Constructor. Override "symtab". */
3741 symbol_table_test ();
3742
3743 /* Destructor. Restore the saved_symtab. */
3744 ~symbol_table_test ();
3745};
3746
3747} // namespace selftest
3748
3749#endif /* CHECKING_P */
3750
3751#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:2062
bool cgraph_function_possibly_inlined_p(tree decl)
Definition cgraph.cc:2731
symbol_table * symtab
Definition cgraph.cc:82
cgraph_inline_failed_type_t cgraph_inline_failed_type(cgraph_inline_failed_t reason)
Definition cgraph.cc:2430
cgraph_indirect_call_info * cgraph_allocate_init_indirect_info(void)
Definition cgraph.cc:1168
const char *const cgraph_availability_names[]
Definition cgraph.cc:2446
void release_function_body(tree decl)
Definition cgraph.cc:2166
symbol_table * saved_symtab
Definition cgraph.cc:4790
void cgraph_cc_finalize(void)
Definition cgraph.cc:4639
const char * cgraph_inline_failed_string(cgraph_inline_failed_t reason)
Definition cgraph.cc:2412
symtab_state
Definition cgraph.h:2331
@ LTO_STREAMING
Definition cgraph.h:2337
@ IPA
Definition cgraph.h:2339
@ PARSING
Definition cgraph.h:2333
@ EXPANSION
Definition cgraph.h:2346
@ IPA_SSA_AFTER_INLINING
Definition cgraph.h:2344
@ FINISHED
Definition cgraph.h:2348
@ IPA_SSA
Definition cgraph.h:2341
@ CONSTRUCTION
Definition cgraph.h:2335
const char * cgraph_inline_failed_string(cgraph_inline_failed_t)
Definition cgraph.cc:2412
void(* cgraph_edge_hook)(cgraph_edge *, void *)
Definition cgraph.h:2312
const char * xstrdup_for_dump(const char *transient_str)
Definition cgraph.h:3711
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:2313
tree ctor_for_folding(tree)
Definition varpool.cc:393
struct varpool_node_set_def * varpool_node_set
Definition cgraph.h:1576
cgraph_inline_failed_type_t cgraph_inline_failed_type(cgraph_inline_failed_t)
Definition cgraph.cc:2430
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:2166
void(* cgraph_2node_hook)(cgraph_node *, cgraph_node *, void *)
Definition cgraph.h:2316
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:888
@ CIF_FINAL_NORMAL
Definition cgraph.h:889
@ CIF_FINAL_ERROR
Definition cgraph.h:890
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:2731
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:1575
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:2315
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:3495
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:1168
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:2814
ipa_opt_pass_d * ipa_opt_pass
Definition cgraph.h:38
void cgraph_update_edges_for_call_stmt(gimple *, tree, gimple *)
Definition cgraph.cc:2062
function_summary< thunk_info * > thunk_summary
Definition cgraph.h:2363
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:2314
function_summary< clone_info * > clone_summary
Definition cgraph.h:2367
vec< cgraph_node * > cgraph_new_nodes
Definition cgraphunit.cc:217
void cgraph_cc_finalize(void)
Definition cgraph.cc:4639
cgraph_inline_failed_t
Definition cgraph.h:882
void debuginfo_init(void)
Definition cgraphunit.cc:2499
bool resolution_used_from_other_file_p(enum ld_plugin_symbol_resolution resolution)
Definition cgraph.h:2923
Definition cgraph.h:1747
ipa_ref * speculative_call_target_ref()
Definition cgraph.h:1879
void purge_callback_edges()
Definition cgraph.cc:1435
cgraph_edge * speculative_call_indirect_edge()
Definition cgraph.h:1857
unsigned int indirect_inlining_edge
Definition cgraph.h:2008
void remove_caller(void)
Definition cgraph.cc:1228
profile_count count
Definition cgraph.h:1986
cgraph_node * callee
Definition cgraph.h:1988
void dump_edge_flags(FILE *f)
Definition cgraph.cc:2452
static cgraph_edge * make_direct(cgraph_edge *edge, cgraph_node *callee)
Definition cgraph.cc:1605
bool binds_to_current_def_p()
Definition cgraph.h:3472
unsigned int callback
Definition cgraph.h:2042
cgraph_edge * prev_caller
Definition cgraph.h:1989
cgraph_edge * next_caller
Definition cgraph.h:1990
unsigned int can_throw_external
Definition cgraph.h:2016
static cgraph_edge * resolve_speculation(cgraph_edge *edge, tree callee_decl=NULL)
Definition cgraph.cc:1518
int m_summary_id
Definition cgraph.h:2075
int m_uid
Definition cgraph.h:2072
void redirect_callee(cgraph_node *n)
Definition cgraph.cc:1679
unsigned in_polymorphic_cdtor
Definition cgraph.h:2054
cgraph_edge * next_speculative_call_target()
Definition cgraph.h:1843
sreal sreal_frequency()
Definition cgraph.cc:4687
unsigned int speculative_id
Definition cgraph.h:2006
cgraph_indirect_call_info * indirect_info
Definition cgraph.h:1996
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:1302
static void rebuild_references(void)
Definition cgraphbuild.cc:451
friend class symbol_table
Definition cgraph.h:1750
unsigned int call_stmt_cannot_inline_p
Definition cgraph.h:2014
int get_summary_id()
Definition cgraph.h:1965
int num_speculative_call_targets_p(void)
Definition cgraph.cc:4752
void set_callee(cgraph_node *n)
Definition cgraph.h:3433
bool maybe_hot_p()
Definition cgraph.cc:3423
cgraph_edge * get_callback_carrying_edge()
Definition cgraph.cc:1382
unsigned int lto_stmt_uid
Definition cgraph.h:2003
void DEBUG_FUNCTION debug(void)
Definition cgraph.cc:2480
bool possibly_call_in_translation_unit_p(void)
Definition cgraph.cc:4718
cgraph_edge * speculative_call_for_target(cgraph_node *)
Definition cgraph.cc:1588
cgraph_node * caller
Definition cgraph.h:1987
enum cgraph_inline_failed_t inline_failed
Definition cgraph.h:2000
unsigned int speculative
Definition cgraph.h:2034
void remove_callee(void)
Definition cgraph.h:3458
static void remove(cgraph_edge *edge)
Definition cgraph.cc:1264
cgraph_edge * first_callback_edge()
Definition cgraph.cc:1400
static gimple * redirect_call_stmt_to_callee(cgraph_edge *e, hash_set< tree > *killed_ssas=nullptr)
Definition cgraph.cc:1738
bool verify_count()
Definition cgraph.cc:3668
unsigned int indirect_unknown_callee
Definition cgraph.h:2011
int get_uid()
Definition cgraph.h:1959
bool cannot_lead_to_return_p(void)
Definition cgraph.cc:3336
unsigned int callback_id
Definition cgraph.h:2051
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:1418
cgraph_edge * make_callback(cgraph_node *n2, unsigned int callback_hash)
Definition cgraph.cc:1350
sreal combined_sreal_frequency()
Definition cgraph.cc:4698
bool recursive_p(void)
Definition cgraph.h:3446
int frequency()
Definition cgraph.h:3485
unsigned int has_callback
Definition cgraph.h:2047
cgraph_edge * first_speculative_call_target()
Definition cgraph.cc:1454
cgraph_edge * next_callee
Definition cgraph.h:1992
void * aux
Definition cgraph.h:1997
static cgraph_edge * set_call_stmt(cgraph_edge *e, gcall *new_stmt, bool update_derived_edges=true)
Definition cgraph.cc:962
gcall * call_stmt
Definition cgraph.h:1993
bool verify_corresponds_to_fndecl(tree decl)
Definition cgraph.cc:3702
friend struct cgraph_node
Definition cgraph.h:1749
cgraph_edge * prev_callee
Definition cgraph.h:1991
void redirect_callee_duplicating_thunks(cgraph_node *n)
Definition cgraphclones.cc:278
Definition cgraph.h:1706
HOST_WIDE_INT otr_token
Definition cgraph.h:1714
tree otr_type
Definition cgraph.h:1716
int ecf_flags
Definition cgraph.h:1720
unsigned agg_contents
Definition cgraph.h:1730
unsigned polymorphic
Definition cgraph.h:1727
unsigned member_ptr
Definition cgraph.h:1732
unsigned guaranteed_unmodified
Definition cgraph.h:1740
unsigned vptr_changed
Definition cgraph.h:1743
HOST_WIDE_INT offset
Definition cgraph.h:1710
int param_index
Definition cgraph.h:1718
unsigned by_ref
Definition cgraph.h:1735
ipa_polymorphic_call_context context
Definition cgraph.h:1712
unsigned num_speculative_call_targets
Definition cgraph.h:1723
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:1606
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:3672
bool speculation_consistent_p(tree, HOST_WIDE_INT, bool, tree) const
Definition ipa-polymorphic-call.cc:1856
tree outer_type
Definition cgraph.h:1613
unsigned invalid
Definition cgraph.h:1624
unsigned speculative_maybe_derived_type
Definition cgraph.h:1621
HOST_WIDE_INT speculative_offset
Definition cgraph.h:1612
void DEBUG_FUNCTION debug() const
Definition ipa-polymorphic-call.cc:655
unsigned dynamic
Definition cgraph.h:1626
void clear_speculation()
Definition cgraph.h:3649
void clear_outer_type(tree otr_type=NULL)
Definition cgraph.h:3660
unsigned maybe_in_construction
Definition cgraph.h:1616
bool useless_p() const
Definition cgraph.h:3683
ipa_polymorphic_call_context()
Definition cgraph.h:3639
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:1614
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:1611
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:1618
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:2370
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:3122
int order
Definition cgraph.h:2638
varpool_node * first_variable(void)
Definition cgraph.h:3048
cgraph_node * first_defined_function(void)
Definition cgraph.h:3140
void change_decl_assembler_name(tree decl, tree name)
Definition symtab.cc:274
varpool_node * next_static_initializer(varpool_node *node)
Definition cgraph.h:3089
hash_table< asmname_hasher > * assembler_name_hash
Definition cgraph.h:2656
void free_edge(cgraph_edge *e)
Definition cgraph.cc:1250
vec< int > edge_released_summary_ids
Definition cgraph.h:2626
int assign_summary_id(cgraph_edge *edge)
Definition cgraph.h:2600
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:2710
static bool decl_assembler_name_equal(tree decl, const_tree asmname)
Definition symtab.cc:142
symbol_table()
Definition cgraph.h:2376
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:1067
symtab_node * first_defined_symbol(void)
Definition cgraph.h:3030
bool global_info_ready
Definition cgraph.h:2644
void clear_asm_symbols(void)
Definition cgraph.h:2421
bool function_flags_ready
Definition cgraph.h:2648
thunk_summary * m_thunks
Definition cgraph.h:2668
friend struct cgraph_edge
Definition cgraph.h:2374
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:2700
asm_node * asmnodes
Definition cgraph.h:2632
void call_cgraph_duplication_hooks(cgraph_node *node, cgraph_node *node2)
Definition cgraph.cc:644
friend struct symtab_node
Definition cgraph.h:2372
int edges_count
Definition cgraph.h:2618
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:2663
cgraph_node * next_defined_function(cgraph_node *node)
Definition cgraph.h:3154
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:2457
void release_symbol(cgraph_node *node)
Definition cgraph.h:3009
cgraph_2node_hook_list * m_first_cgraph_duplicated_hook
Definition cgraph.h:2706
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:3184
hash_table< section_name_hasher > * section_hash
Definition cgraph.h:2653
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:2992
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:2712
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:2671
hash_set< const cgraph_node * > cloned_nodes
Definition cgraph.h:2665
void initialize(void)
Definition cgraph.cc:430
cgraph_node * next_function_with_gimple_body(cgraph_node *node)
Definition cgraph.h:3209
int cgraph_max_summary_id
Definition cgraph.h:2616
void call_cgraph_insertion_hooks(cgraph_node *node)
Definition cgraph.cc:532
FILE * dump_file
Definition cgraph.h:2661
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:2697
int cgraph_max_uid
Definition cgraph.h:2615
void dump_graphviz(FILE *f)
Definition symtab.cc:1058
bool cpp_implicit_aliases_done
Definition cgraph.h:2650
cgraph_node_hook_list * m_first_cgraph_removal_hook
Definition cgraph.h:2702
asm_node * finalize_toplevel_asm(tree asm_str)
Definition cgraph.h:2974
cgraph_node * create_empty(void)
Definition cgraph.cc:442
symtab_node * first_symbol(void)
Definition cgraph.h:3019
int cgraph_count
Definition cgraph.h:2614
cgraph_node * first_function(void)
Definition cgraph.h:3173
void call_cgraph_removal_hooks(cgraph_node *node)
Definition cgraph.cc:520
int max_unit
Definition cgraph.h:2641
vec< int > cgraph_released_summary_ids
Definition cgraph.h:2623
enum symtab_state state
Definition cgraph.h:2646
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:3075
int assign_summary_id(cgraph_node *node)
Definition cgraph.h:2589
cgraph_node_hook_list * m_first_cgraph_insertion_hook
Definition cgraph.h:2708
symtab_node * nodes
Definition cgraph.h:2631
void dump(FILE *f)
Definition symtab.cc:1049
void register_symbol(symtab_node *node)
Definition cgraph.h:2956
void call_varpool_insertion_hooks(varpool_node *node)
Definition varpool.cc:123
varpool_node * first_defined_variable(void)
Definition cgraph.h:3108
int edges_max_uid
Definition cgraph.h:2619
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:2704
cgraph_node * first_function_with_gimple_body(void)
Definition cgraph.h:3195
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:3059
void unlink_from_assembler_name_hash(symtab_node *node, bool with_clones)
Definition symtab.cc:203
friend struct cgraph_node
Definition cgraph.h:2373
void call_varpool_removal_hooks(varpool_node *node)
Definition varpool.cc:82
asm_node * asm_last_node
Definition cgraph.h:2633
hash_map< symtab_node *, symbol_priority_map > * init_priority_hash
Definition cgraph.h:2659
int edges_max_summary_id
Definition cgraph.h:2620
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:2241
tree asm_str
Definition cgraph.h:2248
asm_node * next
Definition cgraph.h:2246
asm_node(tree asm_str)
Definition cgraph.h:2242
Definition cgraph.h:2352
static bool equal(symtab_node *n, const_tree t)
Definition cgraph.h:2727
static hashval_t hash(symtab_node *n)
Definition cgraph.h:2720
const_tree compare_type
Definition cgraph.h:2353
Definition cgraph.cc:99
Definition cgraph.cc:106
Definition cgraph.h:896
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:897
Definition cgraph.cc:85
Definition cgraph.h:853
tree assembler_name
Definition cgraph.h:876
cgraph_node * this_node
Definition cgraph.h:855
cgraph_function_version_info * next
Definition cgraph.h:863
cgraph_function_version_info * prev
Definition cgraph.h:859
tree dispatcher_resolver
Definition cgraph.h:873
Definition cgraph.cc:92
Definition cgraph.h:1570
hash_map< cgraph_node *, size_t > * map
Definition cgraph.h:1571
vec< cgraph_node * > nodes
Definition cgraph.h:1572
Definition cgraph.h:1590
cgraph_node_set set
Definition cgraph.h:1591
unsigned index
Definition cgraph.h:1592
Definition cgraph.h:908
static cgraph_node * get(const_tree decl)
Definition cgraph.h:1386
cgraph_edge * indirect_calls
Definition cgraph.h:1443
void scale_profile_to(profile_count ipa_count)
Definition cgraph.cc:287
unsigned only_called_at_startup
Definition cgraph.h:1497
cgraph_node()
Definition cgraph.h:912
void DEBUG_FUNCTION debug(void)
Definition cgraph.cc:2711
void create_wrapper(cgraph_node *target)
Definition cgraphunit.cc:2641
struct cgraph_rtl_info * rtl
Definition cgraph.h:1469
bool can_remove_if_no_direct_calls_p(bool will_inline=false)
Definition cgraph.cc:3440
static void dump_cgraph(FILE *f)
Definition cgraph.cc:2719
enum node_frequency frequency
Definition cgraph.h:1495
void make_local(void)
Definition cgraph.cc:2895
enum availability get_availability(symtab_node *ref=NULL)
Definition cgraph.cc:2741
unsigned split_part
Definition cgraph.h:1529
unsigned nonfreeing_fn
Definition cgraph.h:1521
bool former_thunk_p(void)
Definition cgraph.cc:4773
void DEBUG_FUNCTION verify_node(void)
Definition cgraph.cc:3892
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:1475
unsigned int profile_id
Definition cgraph.h:1477
cgraph_edge * create_edge(cgraph_node *callee, gcall *call_stmt, profile_count count, bool cloning_p=false)
Definition cgraph.cc:1144
unsigned thunk
Definition cgraph.h:1484
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:3223
unsigned tm_clone
Definition cgraph.h:1504
bool can_remove_if_no_direct_calls_and_refs_p(void)
Definition cgraph.h:3289
bool get_body()
Definition cgraph.cc:4579
unsigned lowered
Definition cgraph.h:1489
int unit_id
Definition cgraph.h:1479
cgraph_edge * callers
Definition cgraph.h:1440
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:2241
unsigned icf_merged
Definition cgraph.h:1517
cgraph_node * next_sibling_clone
Definition cgraph.h:1444
cgraph_node * find_replacement(struct clone_info *)
Definition cgraphclones.cc:737
void remove_callees(void)
Definition cgraph.cc:2096
static void checking_verify_cgraph_nodes(void)
Definition cgraph.h:3313
cgraph_node * clones
Definition cgraph.h:1446
unsigned can_change_signature
Definition cgraph.h:1539
unsigned is_target_clone
Definition cgraph.h:1512
static void DEBUG_FUNCTION verify_cgraph_nodes(void)
Definition cgraph.cc:4439
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:3361
bool check_calls_comdat_local_p()
Definition cgraph.cc:4760
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:4488
bool has_gimple_body_p(void)
Definition cgraph.h:3240
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:4676
void remove_from_clone_tree()
Definition cgraphclones.cc:1182
unsigned calls_comdat_local
Definition cgraph.h:1515
cgraph_node * inlined_to
Definition cgraph.h:1467
cgraph_edge * create_indirect_edge(gcall *call_stmt, int ecf_flags, profile_count count, bool cloning_p=false)
Definition cgraph.cc:1184
friend class symbol_table
Definition cgraph.h:909
void make_profile_local()
Definition cgraph.cc:185
bool local_p(void)
Definition ipa-visibility.cc:113
cgraph_node * clone_of
Definition cgraph.h:1447
bool cannot_return_p(void)
Definition cgraph.cc:3320
static void delete_function_version_by_decl(tree decl)
Definition cgraph.cc:359
void dump(FILE *f)
Definition cgraph.cc:2494
priority_type get_fini_priority(void)
Definition symtab.cc:1857
bool set_malloc_flag(bool malloc_p)
Definition cgraph.cc:2990
bool call_for_symbol_and_aliases(bool(*callback)(cgraph_node *, void *), void *data, bool include_overwritable)
Definition cgraph.h:3576
unsigned gc_candidate
Definition cgraph.h:1550
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:4461
struct function * get_fun() const
Definition cgraph.cc:4621
void mark_force_output(void)
Definition cgraph.h:3507
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:1499
void dump_graphviz(FILE *f)
Definition cgraph.cc:2695
void release_body(bool keep_arguments=false)
Definition cgraph.cc:2208
profile_count count
Definition cgraph.h:1472
static cgraph_node * get_create(tree)
Definition cgraph.cc:687
bool set_nothrow_flag(bool nothrow)
Definition cgraph.cc:2942
cgraph_simd_clone * simdclone
Definition cgraph.h:1456
unsigned called_by_ifunc_resolver
Definition cgraph.h:1552
bool set_noreturn_flag(bool noreturn_p)
Definition cgraph.cc:3085
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:1463
static cgraph_node * create_alias(tree alias, tree target)
Definition cgraph.cc:718
cgraph_edge * callees
Definition cgraph.h:1439
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:1450
unsigned indirect_call_target
Definition cgraph.h:1531
bool call_for_symbol_and_aliases_1(bool(*callback)(cgraph_node *, void *), void *data, bool include_overwritable)
Definition cgraph.cc:4655
bool only_called_directly_p(void)
Definition cgraph.cc:3571
void assemble_thunks_and_aliases(void)
Definition cgraphunit.cc:1778
unsigned ipcp_clone
Definition cgraph.h:1546
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:2815
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:2827
unsigned merged_comdat
Definition cgraph.h:1523
unsigned dispatcher_resolver_function
Definition cgraph.h:1508
static cgraph_node * local_info_node(tree decl)
Definition cgraph.cc:2375
void materialize_clone(void)
Definition cgraphclones.cc:1198
unsigned parallelized_function
Definition cgraph.h:1527
static void debug_cgraph(void)
Definition cgraph.h:1351
unsigned versionable
Definition cgraph.h:1536
int m_summary_id
Definition cgraph.h:1559
unsigned has_omp_variant_constructs
Definition cgraph.h:1554
auto_vec< cgraph_edge * > collect_callers(void)
Definition cgraph.cc:3601
cgraph_node * prev_sibling_clone
Definition cgraph.h:1445
cgraph_edge * get_edge(gimple *call_stmt)
Definition cgraph.cc:906
unsigned local
Definition cgraph.h:1534
unsigned process
Definition cgraph.h:1492
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:2351
unsigned redefined_extern_inline
Definition cgraph.h:1542
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:1481
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:3512
tree former_clone_of
Definition cgraph.h:1452
bool get_untransformed_body()
Definition cgraph.cc:4510
bool only_called_directly_or_aliased_p(void)
Definition cgraph.h:3272
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:3401
static cgraph_node * get_for_asmname(tree asmname)
Definition cgraph.cc:814
cgraph_node * simd_clones
Definition cgraph.h:1458
unsigned merged_extern_inline
Definition cgraph.h:1525
bool add_detected_attribute(const char *attr)
Definition cgraph.cc:3038
int get_summary_id()
Definition cgraph.h:1357
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:1506
enum optimize_size_level optimize_for_size_p(void)
Definition cgraph.h:3516
bool set_pure_flag(bool pure, bool looping)
Definition cgraph.cc:3306
void remove_callers(void)
Definition cgraph.cc:2133
unsigned used_as_abstract_origin
Definition cgraph.h:1487
unsigned tm_may_enter_irr
Definition cgraph.h:1544
static struct cgraph_rtl_info * rtl_info(const_tree)
Definition cgraph.cc:2387
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:809
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:814
cgraph_node * next_clone
Definition cgraph.h:843
poly_uint64 vecsize_int
Definition cgraph.h:823
unsigned int inbranch
Definition cgraph.h:840
poly_uint64 vecsize_float
Definition cgraph.h:826
machine_mode mask_mode
Definition cgraph.h:831
cgraph_simd_clone_arg args[1]
Definition cgraph.h:849
cgraph_node * prev_clone
Definition cgraph.h:843
poly_uint64 simdlen
Definition cgraph.h:816
cgraph_node * origin
Definition cgraph.h:846
unsigned int nargs
Definition cgraph.h:820
unsigned char vecsize_mangle
Definition cgraph.h:836
Definition symtab-clones.h:25
Definition cgraph.h:3254
hashval_t hash
Definition cgraph.h:3264
rtx rtl
Definition cgraph.h:3256
tree value
Definition cgraph.h:3259
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:3616
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:2325
priority_type fini
Definition cgraph.h:2327
priority_type init
Definition cgraph.h:2326
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:2843
tree get_alias_target_tree()
Definition cgraph.h:2855
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:2879
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:2912
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:2865
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:3543
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:3719
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:3532
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:2899
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:2822
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:3381
const char * get_symtab_type_string() const
Definition symtab.cc:899
bool real_symbol_p(void)
Definition cgraph.h:2794
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:3555
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:2889
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:2935
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:3350
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:1583
hash_map< varpool_node *, size_t > * map
Definition cgraph.h:1584
vec< varpool_node * > nodes
Definition cgraph.h:1585
Definition cgraph.h:1597
varpool_node_set set
Definition cgraph.h:1598
unsigned index
Definition cgraph.h:1599
Definition cgraph.h:2105
bool can_remove_if_no_refs_p(void)
Definition cgraph.h:3323
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:3597
unsigned output
Definition cgraph.h:2215
varpool_node()
Definition cgraph.h:2107
varpool_node * ultimate_alias_target(availability *availability=NULL, symtab_node *ref=NULL)
Definition cgraph.h:3418
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:3369
static varpool_node * get(const_tree decl)
Definition cgraph.h:2947
bool assemble_decl(void)
Definition varpool.cc:560
bool all_refs_explicit_p()
Definition cgraph.h:3341
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:2221
bool ctor_useable_for_folding_p(void)
Definition varpool.cc:319
void remove(void)
Definition varpool.cc:172
unsigned dynamically_initialized
Definition cgraph.h:2219
unsigned used_by_single_function
Definition cgraph.h:2227
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:1091
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:1709
#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:6348
#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