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