12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188 |
- #ifndef GCC_CGRAPH_H
- #define GCC_CGRAPH_H
- enum symtab_type
- {
- SYMTAB_SYMBOL,
- SYMTAB_FUNCTION,
- SYMTAB_VARIABLE
- };
- struct GTY((for_user)) section_hash_entry_d
- {
- int ref_count;
- char *name;
- };
- typedef struct section_hash_entry_d section_hash_entry;
- struct section_name_hasher : ggc_hasher<section_hash_entry *>
- {
- typedef const char *compare_type;
- static hashval_t hash (section_hash_entry *);
- static bool equal (section_hash_entry *, const char *);
- };
- enum availability
- {
-
- AVAIL_UNSET,
-
- AVAIL_NOT_AVAILABLE,
-
- AVAIL_INTERPOSABLE,
-
- AVAIL_AVAILABLE,
-
- AVAIL_LOCAL
- };
- enum symbol_partitioning_class
- {
-
- SYMBOL_EXTERNAL,
-
- SYMBOL_PARTITION,
-
- SYMBOL_DUPLICATE
- };
- class GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"),
- chain_next ("%h.next"), chain_prev ("%h.previous")))
- symtab_node
- {
- public:
-
- const char *name () const;
-
- const char * asm_name () const;
-
- void register_symbol (void);
-
- void remove (void);
-
- void dump (FILE *f);
-
- void DEBUG_FUNCTION debug (void);
-
- void DEBUG_FUNCTION verify (void);
-
- ipa_ref *create_reference (symtab_node *referred_node,
- enum ipa_ref_use use_type);
-
- ipa_ref *create_reference (symtab_node *referred_node,
- enum ipa_ref_use use_type, gimple stmt);
-
- ipa_ref *maybe_create_reference (tree val, enum ipa_ref_use use_type,
- gimple stmt);
-
- void clone_references (symtab_node *node);
-
- void clone_referring (symtab_node *node);
-
- ipa_ref *clone_reference (ipa_ref *ref, gimple stmt);
-
- ipa_ref *find_reference (symtab_node *referred_node, gimple stmt,
- unsigned int lto_stmt_uid);
-
- void remove_stmt_references (gimple stmt);
-
- void clear_stmts_in_references (void);
-
- void remove_all_references (void);
-
- void remove_all_referring (void);
-
- void dump_references (FILE *file);
-
- void dump_referring (FILE *);
-
- inline unsigned num_references (void)
- {
- return ref_list.references ? ref_list.references->length () : 0;
- }
-
- ipa_ref *iterate_reference (unsigned i, ipa_ref *&ref);
-
- ipa_ref *iterate_referring (unsigned i, ipa_ref *&ref);
-
- ipa_ref *iterate_direct_aliases (unsigned i, ipa_ref *&ref);
-
- bool semantically_equivalent_p (symtab_node *target);
-
- enum symbol_partitioning_class get_partitioning_class (void);
-
- tree get_comdat_group ()
- {
- return x_comdat_group;
- }
-
- tree get_comdat_group_id ()
- {
- if (x_comdat_group && TREE_CODE (x_comdat_group) != IDENTIFIER_NODE)
- x_comdat_group = DECL_ASSEMBLER_NAME (x_comdat_group);
- return x_comdat_group;
- }
-
- void set_comdat_group (tree group)
- {
- gcc_checking_assert (!group || TREE_CODE (group) == IDENTIFIER_NODE
- || DECL_P (group));
- x_comdat_group = group;
- }
-
- const char * get_section ()
- {
- if (!x_section)
- return NULL;
- return x_section->name;
- }
-
- void remove_from_same_comdat_group (void);
-
- void add_to_same_comdat_group (symtab_node *old_node);
-
- void dissolve_same_comdat_group_list (void);
-
- bool used_from_object_file_p (void);
-
- symtab_node *ultimate_alias_target (enum availability *avail = NULL);
-
- inline symtab_node *next_defined_symbol (void);
-
- bool resolve_alias (symtab_node *target);
-
- void fixup_same_cpp_alias_visibility (symtab_node *target);
-
- bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *),
- void *data,
- bool include_overwrite);
-
- symtab_node *noninterposable_alias (void);
-
- inline symtab_node *get_alias_target (void);
-
- void set_section (const char *section);
-
- void set_section_for_node (const char *section);
-
- void set_init_priority (priority_type priority);
-
- priority_type get_init_priority ();
-
- enum availability get_availability (void);
-
- void make_decl_local (void);
-
- unsigned int definition_alignment ();
-
- bool can_increase_alignment_p ();
-
- void increase_alignment (unsigned int align);
-
- bool has_aliases_p (void);
-
- bool real_symbol_p (void);
-
- bool needed_p (void);
-
- bool referred_to_p (void);
-
- inline bool
- can_be_discarded_p (void)
- {
- return (DECL_EXTERNAL (decl)
- || (get_comdat_group ()
- && resolution != LDPR_PREVAILING_DEF
- && resolution != LDPR_PREVAILING_DEF_IRONLY
- && resolution != LDPR_PREVAILING_DEF_IRONLY_EXP));
- }
-
- inline bool comdat_local_p (void)
- {
- return (same_comdat_group && !TREE_PUBLIC (decl));
- }
-
- inline bool in_same_comdat_group_p (symtab_node *target);
-
- bool nonzero_address ();
-
- int equal_address_to (symtab_node *s2);
-
- bool address_matters_p ();
-
- bool address_can_be_compared_p (void);
-
- static inline symtab_node *get (const_tree decl)
- {
- #ifdef ENABLE_CHECKING
-
- gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL
- || (TREE_CODE (decl) == VAR_DECL
- && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
- || in_lto_p)));
-
- gcc_checking_assert (!decl->decl_with_vis.symtab_node
- || decl->decl_with_vis.symtab_node->decl == decl);
- #endif
- return decl->decl_with_vis.symtab_node;
- }
-
- static inline symtab_node * get_create (tree node);
-
- static symtab_node *get_for_asmname (const_tree asmname);
-
- static void dump_table (FILE *);
-
- static inline DEBUG_FUNCTION void debug_symtab (void)
- {
- dump_table (stderr);
- }
-
- static DEBUG_FUNCTION void verify_symtab_nodes (void);
-
- ENUM_BITFIELD (symtab_type) type : 8;
-
- ENUM_BITFIELD (ld_plugin_symbol_resolution) resolution : 8;
-
-
- unsigned definition : 1;
-
- unsigned alias : 1;
-
- unsigned weakref : 1;
-
- unsigned cpp_implicit_alias : 1;
-
- unsigned analyzed : 1;
-
- unsigned writeonly : 1;
-
- unsigned refuse_visibility_changes : 1;
-
-
- unsigned externally_visible : 1;
-
- unsigned no_reorder : 1;
-
- unsigned force_output : 1;
-
- unsigned forced_by_abi : 1;
-
- unsigned unique_name : 1;
-
- unsigned implicit_section : 1;
-
- unsigned body_removed : 1;
-
-
- unsigned used_from_other_partition : 1;
-
- unsigned in_other_partition : 1;
-
-
- unsigned address_taken : 1;
-
- unsigned in_init_priority_hash : 1;
-
- unsigned need_lto_streaming : 1;
-
- unsigned offloadable : 1;
-
- int order;
-
- tree decl;
-
- symtab_node *next;
- symtab_node *previous;
-
- symtab_node *next_sharing_asm_name;
- symtab_node *previous_sharing_asm_name;
-
- symtab_node *same_comdat_group;
-
- ipa_ref_list ref_list;
-
- tree alias_target;
-
- struct lto_file_decl_data * lto_file_data;
- PTR GTY ((skip)) aux;
-
- tree x_comdat_group;
-
- section_hash_entry *x_section;
- protected:
-
- void dump_base (FILE *);
-
- bool DEBUG_FUNCTION verify_base (void);
-
- void unregister (void);
-
- struct symbol_priority_map *priority_info (void);
-
- bool call_for_symbol_and_aliases_1 (bool (*callback) (symtab_node *, void *),
- void *data,
- bool include_overwrite);
- private:
-
- static bool set_section (symtab_node *n, void *s);
-
- static bool set_implicit_section (symtab_node *n, void *);
-
- static bool noninterposable_alias (symtab_node *node, void *data);
-
- symtab_node *ultimate_alias_target_1 (enum availability *avail = NULL);
- };
- #define FOR_EACH_ALIAS(node, alias) \
- for (unsigned x_i = 0; node->iterate_direct_aliases (x_i, alias); x_i++)
- struct lto_file_decl_data;
- extern const char * const cgraph_availability_names[];
- extern const char * const ld_plugin_symbol_resolution_names[];
- extern const char * const tls_model_names[];
- struct GTY(()) cgraph_thunk_info {
-
- HOST_WIDE_INT fixed_offset;
- HOST_WIDE_INT virtual_value;
- tree alias;
- bool this_adjusting;
- bool virtual_offset_p;
- bool add_pointer_bounds_args;
-
- bool thunk_p;
- };
- struct GTY(()) cgraph_local_info {
-
- unsigned local : 1;
-
- unsigned versionable : 1;
-
- unsigned can_change_signature : 1;
-
- unsigned redefined_extern_inline : 1;
-
- unsigned tm_may_enter_irr : 1;
- };
- struct GTY(()) cgraph_global_info {
-
- cgraph_node *inlined_to;
- };
- struct GTY(()) cgraph_rtl_info {
- unsigned int preferred_incoming_stack_boundary;
-
- HARD_REG_SET function_used_regs;
-
- unsigned function_used_regs_valid: 1;
- };
- struct GTY(()) ipa_replace_map
- {
-
- tree old_tree;
-
- tree new_tree;
-
- int parm_num;
-
- bool replace_p;
-
- bool ref_p;
- };
- struct GTY(()) cgraph_clone_info
- {
- vec<ipa_replace_map *, va_gc> *tree_map;
- bitmap args_to_skip;
- bitmap combined_args_to_skip;
- };
- enum cgraph_simd_clone_arg_type
- {
- SIMD_CLONE_ARG_TYPE_VECTOR,
- SIMD_CLONE_ARG_TYPE_UNIFORM,
- SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP,
- SIMD_CLONE_ARG_TYPE_LINEAR_VARIABLE_STEP,
- SIMD_CLONE_ARG_TYPE_MASK
- };
- struct GTY(()) cgraph_simd_clone_arg {
-
- tree orig_arg;
-
- tree orig_type;
-
- tree vector_arg;
-
- tree vector_type;
-
- tree simd_array;
-
- enum cgraph_simd_clone_arg_type arg_type;
-
- HOST_WIDE_INT linear_step;
-
- unsigned int alignment;
- };
- struct GTY(()) cgraph_simd_clone {
-
- unsigned int simdlen;
-
- unsigned int nargs;
-
- unsigned int vecsize_int;
-
- unsigned int vecsize_float;
-
- unsigned char vecsize_mangle;
-
- unsigned int inbranch : 1;
-
- unsigned int cilk_elemental : 1;
-
- cgraph_node *prev_clone, *next_clone;
-
- cgraph_node *origin;
-
- cgraph_simd_clone_arg GTY((length ("%h.nargs"))) args[1];
- };
- struct GTY((for_user)) cgraph_function_version_info {
-
- cgraph_node *this_node;
-
- cgraph_function_version_info *prev;
-
- cgraph_function_version_info *next;
-
- tree dispatcher_resolver;
- };
- #define DEFCIFCODE(code, type, string) CIF_ ## code,
- enum cgraph_inline_failed_t {
- #include "cif-code.def"
- CIF_N_REASONS
- };
- enum cgraph_inline_failed_type_t
- {
- CIF_FINAL_NORMAL = 0,
- CIF_FINAL_ERROR
- };
- struct cgraph_edge;
- struct cgraph_edge_hasher : ggc_hasher<cgraph_edge *>
- {
- typedef gimple compare_type;
- static hashval_t hash (cgraph_edge *);
- static hashval_t hash (gimple);
- static bool equal (cgraph_edge *, gimple);
- };
- struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node {
- public:
-
- bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL);
-
- void record_stmt_references (gimple stmt);
-
- void set_call_stmt_including_clones (gimple old_stmt, gcall *new_stmt,
- bool update_speculative = true);
-
- cgraph_node *function_symbol (enum availability *avail = NULL);
-
- cgraph_node *function_or_virtual_thunk_symbol
- (enum availability *avail = NULL);
-
- cgraph_node *create_clone (tree decl, gcov_type count, int freq,
- bool update_original,
- vec<cgraph_edge *> redirect_callers,
- bool call_duplication_hook,
- cgraph_node *new_inlined_to,
- bitmap args_to_skip);
-
- cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers,
- vec<ipa_replace_map *, va_gc> *tree_map,
- bitmap args_to_skip, const char * suffix);
-
- cgraph_node *find_replacement (void);
-
- cgraph_node *create_version_clone (tree new_decl,
- vec<cgraph_edge *> redirect_callers,
- bitmap bbs_to_copy);
-
- cgraph_node *create_version_clone_with_body
- (vec<cgraph_edge *> redirect_callers,
- vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip,
- bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block,
- const char *clone_name);
-
- cgraph_function_version_info *insert_new_function_version (void);
-
- cgraph_function_version_info *function_version (void);
-
- void analyze (void);
-
- cgraph_node * create_thunk (tree alias, tree, bool this_adjusting,
- HOST_WIDE_INT fixed_offset,
- HOST_WIDE_INT virtual_value,
- tree virtual_offset,
- tree real_alias);
-
- inline cgraph_node *get_alias_target (void);
-
- cgraph_node *ultimate_alias_target (availability *availability = NULL);
-
- bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk);
-
- void expand_all_artificial_thunks ();
-
- void assemble_thunks_and_aliases (void);
-
- void expand (void);
-
- void reset (void);
-
- void create_wrapper (cgraph_node *target);
-
- void DEBUG_FUNCTION verify_node (void);
-
- void remove (void);
-
- void dump (FILE *f);
-
- void DEBUG_FUNCTION debug (void);
-
- bool get_untransformed_body (void);
-
- bool get_body (void);
-
- void release_body (bool keep_arguments = false);
-
- struct function *get_fun (void);
-
- void unnest (void);
-
- void make_local (void);
-
- void mark_address_taken (void);
-
- void set_fini_priority (priority_type priority);
-
- priority_type get_fini_priority (void);
-
- cgraph_edge *create_edge (cgraph_node *callee,
- gcall *call_stmt, gcov_type count,
- int freq);
-
- cgraph_edge *create_indirect_edge (gcall *call_stmt, int ecf_flags,
- gcov_type count, int freq,
- bool compute_indirect_info = true);
-
- void create_edge_including_clones (cgraph_node *callee,
- gimple old_stmt, gcall *stmt,
- gcov_type count,
- int freq,
- cgraph_inline_failed_t reason);
-
- cgraph_edge *get_edge (gimple call_stmt);
-
- vec<cgraph_edge *> collect_callers (void);
-
- void remove_callers (void);
-
- void remove_callees (void);
-
- enum availability get_availability (void);
-
- void set_nothrow_flag (bool nothrow);
-
- void set_const_flag (bool readonly, bool looping);
-
- void set_pure_flag (bool pure, bool looping);
-
- bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *,
- void *),
- void *data, bool include_overwritable);
-
- bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node,
- void *data),
- void *data,
- bool include_overwritable,
- bool exclude_virtual_thunks = false);
-
- inline void mark_force_output (void);
-
- bool local_p (void);
-
- bool can_be_local_p (void);
-
- bool cannot_return_p (void);
-
- bool only_called_directly_p (void);
-
- inline bool only_called_directly_or_aliased_p (void);
-
- bool will_be_removed_from_program_if_no_direct_calls_p
- (bool will_inline = false);
-
- bool can_remove_if_no_direct_calls_and_refs_p (void);
-
- bool can_remove_if_no_direct_calls_p (bool will_inline = false);
-
- inline bool has_gimple_body_p (void);
-
- bool optimize_for_size_p (void);
-
- static void dump_cgraph (FILE *f);
-
- static inline
- void debug_cgraph (void)
- {
- dump_cgraph (stderr);
- }
-
- static void record_function_versions (tree decl1, tree decl2);
-
- static void delete_function_version (tree decl);
-
- static void add_new_function (tree fndecl, bool lowered);
-
- static inline cgraph_node *get (const_tree decl)
- {
- gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL);
- return dyn_cast <cgraph_node *> (symtab_node::get (decl));
- }
-
- static void finalize_function (tree, bool);
-
- static cgraph_node * create (tree decl);
-
- static cgraph_node * get_create (tree);
-
- static cgraph_local_info *local_info (tree decl);
-
- static cgraph_rtl_info *rtl_info (tree);
-
- static cgraph_node *get_for_asmname (tree asmname);
-
- static cgraph_node * create_same_body_alias (tree alias, tree decl);
-
- static void DEBUG_FUNCTION verify_cgraph_nodes (void);
-
- static bool make_local (cgraph_node *node, void *);
-
- static cgraph_node *create_alias (tree alias, tree target);
-
- static bool has_thunk_p (cgraph_node *node, void *);
- cgraph_edge *callees;
- cgraph_edge *callers;
-
- cgraph_edge *indirect_calls;
-
- cgraph_node *origin;
-
- cgraph_node *nested;
-
- cgraph_node *next_nested;
-
- cgraph_node *next_sibling_clone;
- cgraph_node *prev_sibling_clone;
- cgraph_node *clones;
- cgraph_node *clone_of;
-
- cgraph_node *instrumented_version;
-
- tree orig_decl;
-
- hash_table<cgraph_edge_hasher> *GTY(()) call_site_hash;
-
- tree former_clone_of;
-
- cgraph_simd_clone *simdclone;
-
- cgraph_node *simd_clones;
-
- vec<ipa_opt_pass> GTY((skip)) ipa_transforms_to_apply;
- cgraph_local_info local;
- cgraph_global_info global;
- cgraph_rtl_info rtl;
- cgraph_clone_info clone;
- cgraph_thunk_info thunk;
-
- gcov_type count;
-
- int count_materialization_scale;
-
- int uid;
-
- int summary_uid;
-
- unsigned int profile_id;
-
- int tp_first_run;
-
- unsigned used_as_abstract_origin : 1;
-
- unsigned lowered : 1;
-
- unsigned process : 1;
-
- ENUM_BITFIELD (node_frequency) frequency : 2;
-
- unsigned only_called_at_startup : 1;
-
- unsigned only_called_at_exit : 1;
-
-
- unsigned tm_clone : 1;
-
- unsigned dispatcher_function : 1;
-
- unsigned calls_comdat_local : 1;
-
- unsigned icf_merged: 1;
-
- unsigned instrumentation_clone : 1;
-
- unsigned nonfreeing_fn : 1;
-
- unsigned merged : 1;
-
- unsigned parallelized_function : 1;
-
- unsigned split_part : 1;
- private:
-
- bool call_for_symbol_and_aliases_1 (bool (*callback) (cgraph_node *,
- void *),
- void *data, bool include_overwritable);
- };
- struct cgraph_node_set_def
- {
- hash_map<cgraph_node *, size_t> *map;
- vec<cgraph_node *> nodes;
- };
- typedef cgraph_node_set_def *cgraph_node_set;
- typedef struct varpool_node_set_def *varpool_node_set;
- class varpool_node;
- struct varpool_node_set_def
- {
- hash_map<varpool_node *, size_t> * map;
- vec<varpool_node *> nodes;
- };
- struct cgraph_node_set_iterator
- {
- cgraph_node_set set;
- unsigned index;
- };
- struct varpool_node_set_iterator
- {
- varpool_node_set set;
- unsigned index;
- };
- class GTY(()) ipa_polymorphic_call_context {
- public:
-
- HOST_WIDE_INT offset;
- HOST_WIDE_INT speculative_offset;
- tree outer_type;
- tree speculative_outer_type;
-
- unsigned maybe_in_construction : 1;
-
- unsigned maybe_derived_type : 1;
-
- unsigned speculative_maybe_derived_type : 1;
-
- unsigned invalid : 1;
-
- unsigned dynamic : 1;
-
- ipa_polymorphic_call_context ();
-
- ipa_polymorphic_call_context (cgraph_edge *e);
-
- ipa_polymorphic_call_context (tree cst, tree otr_type = NULL,
- HOST_WIDE_INT offset = 0);
-
- ipa_polymorphic_call_context (tree fndecl, tree ref, gimple stmt,
- tree *instance = NULL);
-
- bool get_dynamic_type (tree, tree, tree, gimple);
-
- void clear_speculation ();
-
- void clear_outer_type (tree otr_type = NULL);
-
- bool restrict_to_inner_class (tree otr_type,
- bool consider_placement_new = true,
- bool consider_bases = true);
-
- void offset_by (HOST_WIDE_INT);
-
- void possible_dynamic_type_change (bool, tree otr_type = NULL);
-
- bool combine_with (ipa_polymorphic_call_context, tree otr_type = NULL);
- bool meet_with (ipa_polymorphic_call_context, tree otr_type = NULL);
-
- bool useless_p () const;
-
- bool equal_to (const ipa_polymorphic_call_context &x) const;
-
- void dump (FILE *f, bool newline = true) const;
- void DEBUG_FUNCTION debug () const;
-
- void stream_out (struct output_block *) const;
- void stream_in (struct lto_input_block *, struct data_in *data_in);
- private:
- bool combine_speculation_with (tree, HOST_WIDE_INT, bool, tree);
- bool meet_speculation_with (tree, HOST_WIDE_INT, bool, tree);
- void set_by_decl (tree, HOST_WIDE_INT);
- bool set_by_invariant (tree, tree, HOST_WIDE_INT);
- bool speculation_consistent_p (tree, HOST_WIDE_INT, bool, tree) const;
- void make_speculative (tree otr_type = NULL);
- };
- struct GTY(()) cgraph_indirect_call_info
- {
-
- HOST_WIDE_INT offset;
-
- ipa_polymorphic_call_context context;
-
- HOST_WIDE_INT otr_token;
-
- tree otr_type;
-
- int param_index;
-
- int ecf_flags;
-
- int common_target_id;
-
- int common_target_probability;
-
- unsigned polymorphic : 1;
-
- unsigned agg_contents : 1;
-
- unsigned member_ptr : 1;
-
- unsigned by_ref : 1;
-
- unsigned vptr_changed : 1;
- };
- struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"),
- for_user)) cgraph_edge {
- friend class cgraph_node;
-
- void remove (void);
-
- void set_call_stmt (gcall *new_stmt, bool update_speculative = true);
-
- void redirect_callee (cgraph_node *n);
-
- void redirect_callee_duplicating_thunks (cgraph_node *n);
-
- cgraph_edge *make_direct (cgraph_node *callee);
-
- cgraph_edge *make_speculative (cgraph_node *n2, gcov_type direct_count,
- int direct_frequency);
-
- void speculative_call_info (cgraph_edge *&direct, cgraph_edge *&indirect,
- ipa_ref *&reference);
-
- cgraph_edge *resolve_speculation (tree callee_decl = NULL);
-
- gimple redirect_call_stmt_to_callee (void);
-
- cgraph_edge * clone (cgraph_node *n, gcall *call_stmt, unsigned stmt_uid,
- gcov_type count_scale, int freq_scale, bool update_original);
-
- bool verify_count_and_frequency ();
-
- bool cannot_lead_to_return_p (void);
-
- bool recursive_p (void);
-
- bool maybe_hot_p (void);
-
- static unsigned int rebuild_edges (void);
-
- static void rebuild_references (void);
-
- gcov_type count;
- cgraph_node *caller;
- cgraph_node *callee;
- cgraph_edge *prev_caller;
- cgraph_edge *next_caller;
- cgraph_edge *prev_callee;
- cgraph_edge *next_callee;
- gcall *call_stmt;
-
- cgraph_indirect_call_info *indirect_info;
- PTR GTY ((skip (""))) aux;
-
- enum cgraph_inline_failed_t inline_failed;
-
- unsigned int lto_stmt_uid;
-
- int frequency;
-
- int uid;
-
- unsigned int indirect_inlining_edge : 1;
-
- unsigned int indirect_unknown_callee : 1;
-
-
- unsigned int call_stmt_cannot_inline_p : 1;
-
- unsigned int can_throw_external : 1;
-
- unsigned int speculative : 1;
-
- unsigned in_polymorphic_cdtor : 1;
- private:
-
- void remove_caller (void);
-
- void remove_callee (void);
-
- void set_callee (cgraph_node *n);
-
- void dump_edge_flags (FILE *f);
-
- bool verify_corresponds_to_fndecl (tree decl);
- };
- #define CGRAPH_FREQ_BASE 1000
- #define CGRAPH_FREQ_MAX 100000
- class GTY((tag ("SYMTAB_VARIABLE"))) varpool_node : public symtab_node {
- public:
-
- void dump (FILE *f);
-
- void DEBUG_FUNCTION debug (void);
-
- void remove (void);
-
- void remove_initializer (void);
- void analyze (void);
-
- availability get_availability (void);
-
- tree get_constructor (void);
-
- bool ctor_useable_for_folding_p (void);
-
- inline varpool_node *ultimate_alias_target
- (availability *availability = NULL);
-
- inline varpool_node *get_alias_target (void);
-
- bool assemble_decl (void);
-
- void finalize_named_section_flags (void);
-
- bool call_for_symbol_and_aliases (bool (*callback) (varpool_node *, void *),
- void *data,
- bool include_overwritable);
-
- bool externally_visible_p (void);
-
- inline bool all_refs_explicit_p ();
-
- inline bool can_remove_if_no_refs_p (void);
-
- static void add (tree decl);
-
- static inline varpool_node *get (const_tree decl);
-
- static void finalize_decl (tree decl);
-
- static varpool_node * create_extra_name_alias (tree alias, tree decl);
-
- static varpool_node * create_alias (tree, tree);
-
- static void dump_varpool (FILE *f);
-
- static void DEBUG_FUNCTION debug_varpool (void);
-
- static varpool_node *create_empty (void);
-
- static varpool_node *get_create (tree decl);
-
- static varpool_node *get_for_asmname (tree asmname);
-
- unsigned output : 1;
-
- unsigned need_bounds_init : 1;
-
- unsigned dynamically_initialized : 1;
- ENUM_BITFIELD(tls_model) tls_model : 3;
-
- unsigned used_by_single_function : 1;
- private:
-
- void assemble_aliases (void);
-
- bool call_for_symbol_and_aliases_1 (bool (*callback) (varpool_node *, void *),
- void *data,
- bool include_overwritable);
- };
- struct GTY(()) asm_node {
-
- asm_node *next;
-
- tree asm_str;
-
- int order;
- };
- template <>
- template <>
- inline bool
- is_a_helper <cgraph_node *>::test (symtab_node *p)
- {
- return p && p->type == SYMTAB_FUNCTION;
- }
- template <>
- template <>
- inline bool
- is_a_helper <varpool_node *>::test (symtab_node *p)
- {
- return p && p->type == SYMTAB_VARIABLE;
- }
- #define NEXT_FREE_NODE(NODE) dyn_cast<cgraph_node *> ((NODE)->next)
- #define SET_NEXT_FREE_NODE(NODE,NODE2) ((NODE))->next = NODE2
- #define NEXT_FREE_EDGE(EDGE) (EDGE)->prev_caller
- typedef void (*cgraph_edge_hook)(cgraph_edge *, void *);
- typedef void (*cgraph_node_hook)(cgraph_node *, void *);
- typedef void (*varpool_node_hook)(varpool_node *, void *);
- typedef void (*cgraph_2edge_hook)(cgraph_edge *, cgraph_edge *, void *);
- typedef void (*cgraph_2node_hook)(cgraph_node *, cgraph_node *, void *);
- struct cgraph_edge_hook_list;
- struct cgraph_node_hook_list;
- struct varpool_node_hook_list;
- struct cgraph_2edge_hook_list;
- struct cgraph_2node_hook_list;
- struct GTY(()) symbol_priority_map {
- priority_type init;
- priority_type fini;
- };
- enum symtab_state
- {
-
- PARSING,
-
- CONSTRUCTION,
-
- LTO_STREAMING,
-
- IPA,
-
- IPA_SSA,
-
- IPA_SSA_AFTER_INLINING,
-
- EXPANSION,
-
- FINISHED
- };
- struct asmname_hasher
- {
- typedef symtab_node *value_type;
- typedef const_tree compare_type;
- typedef int store_values_directly;
- static hashval_t hash (symtab_node *n);
- static bool equal (symtab_node *n, const_tree t);
- static void ggc_mx (symtab_node *n);
- static void pch_nx (symtab_node *&);
- static void pch_nx (symtab_node *&, gt_pointer_operator, void *);
- static void remove (symtab_node *) {}
- };
- class GTY((tag ("SYMTAB"))) symbol_table
- {
- public:
- friend class symtab_node;
- friend class cgraph_node;
- friend class cgraph_edge;
- symbol_table (): cgraph_max_summary_uid (1)
- {
- }
-
- void initialize (void);
-
- inline asm_node *finalize_toplevel_asm (tree asm_str);
-
- void finalize_compilation_unit (void);
-
- void process_same_body_aliases (void);
-
- void compile (void);
-
- void process_new_functions (void);
-
- void materialize_all_clones (void);
-
- inline void register_symbol (symtab_node *node);
- inline void
- clear_asm_symbols (void)
- {
- asmnodes = NULL;
- asm_last_node = NULL;
- }
-
- bool remove_unreachable_nodes (FILE *file);
-
- void remove_unreferenced_decls (void);
-
- inline void unregister (symtab_node *node);
-
- cgraph_node *create_empty (void);
-
- void release_symbol (cgraph_node *node, int uid);
-
- bool output_variables (void);
-
- void output_weakrefs (void);
-
- inline symtab_node *first_symbol (void);
-
- inline asm_node *
- first_asm_symbol (void)
- {
- return asmnodes;
- }
-
- inline symtab_node *first_defined_symbol (void);
-
- inline varpool_node *first_variable (void);
-
- inline varpool_node *next_variable (varpool_node *node);
-
- inline varpool_node *first_static_initializer (void);
-
- inline varpool_node *next_static_initializer (varpool_node *node);
-
- inline varpool_node *first_defined_variable (void);
-
- inline varpool_node *next_defined_variable (varpool_node *node);
-
- inline cgraph_node *first_defined_function (void);
-
- inline cgraph_node *next_defined_function (cgraph_node *node);
-
- inline cgraph_node *first_function (void);
-
- inline cgraph_node *next_function (cgraph_node *node);
-
- cgraph_node *first_function_with_gimple_body (void);
-
- inline cgraph_node *next_function_with_gimple_body (cgraph_node *node);
-
- cgraph_edge_hook_list *add_edge_removal_hook (cgraph_edge_hook hook,
- void *data);
-
- void remove_edge_removal_hook (cgraph_edge_hook_list *entry);
-
- cgraph_node_hook_list *add_cgraph_removal_hook (cgraph_node_hook hook,
- void *data);
-
- void remove_cgraph_removal_hook (cgraph_node_hook_list *entry);
-
- varpool_node_hook_list *add_varpool_removal_hook (varpool_node_hook hook,
- void *data);
-
- void remove_varpool_removal_hook (varpool_node_hook_list *entry);
-
- cgraph_node_hook_list *add_cgraph_insertion_hook (cgraph_node_hook hook,
- void *data);
-
- void remove_cgraph_insertion_hook (cgraph_node_hook_list *entry);
-
- varpool_node_hook_list *add_varpool_insertion_hook (varpool_node_hook hook,
- void *data);
-
- void remove_varpool_insertion_hook (varpool_node_hook_list *entry);
-
- cgraph_2edge_hook_list *add_edge_duplication_hook (cgraph_2edge_hook hook,
- void *data);
-
- void remove_edge_duplication_hook (cgraph_2edge_hook_list *entry);
-
- cgraph_2node_hook_list *add_cgraph_duplication_hook (cgraph_2node_hook hook,
- void *data);
-
- void remove_cgraph_duplication_hook (cgraph_2node_hook_list *entry);
-
- void call_edge_removal_hooks (cgraph_edge *e);
-
- void call_cgraph_insertion_hooks (cgraph_node *node);
-
- void call_cgraph_removal_hooks (cgraph_node *node);
-
- void call_cgraph_duplication_hooks (cgraph_node *node, cgraph_node *node2);
-
- void call_edge_duplication_hooks (cgraph_edge *cs1, cgraph_edge *cs2);
-
- void call_varpool_removal_hooks (varpool_node *node);
-
- void call_varpool_insertion_hooks (varpool_node *node);
-
- void symtab_prevail_in_asm_name_hash (symtab_node *node);
-
- void symtab_initialize_asm_name_hash (void);
-
- void change_decl_assembler_name (tree decl, tree name);
- int cgraph_count;
- int cgraph_max_uid;
- int cgraph_max_summary_uid;
- int edges_count;
- int edges_max_uid;
- symtab_node* GTY(()) nodes;
- asm_node* GTY(()) asmnodes;
- asm_node* GTY(()) asm_last_node;
- cgraph_node* GTY(()) free_nodes;
-
- cgraph_edge * GTY(()) free_edges;
-
- int order;
-
- bool global_info_ready;
-
- enum symtab_state state;
-
- bool function_flags_ready;
- bool cpp_implicit_aliases_done;
-
- hash_table<section_name_hasher> *GTY(()) section_hash;
-
- hash_table<asmname_hasher> *assembler_name_hash;
-
- hash_map<symtab_node *, symbol_priority_map> *init_priority_hash;
- FILE* GTY ((skip)) dump_file;
- private:
-
- inline cgraph_node * allocate_cgraph_symbol (void);
-
- cgraph_edge *create_edge (cgraph_node *caller, cgraph_node *callee,
- gcall *call_stmt, gcov_type count, int freq,
- bool indir_unknown_callee);
-
- void free_edge (cgraph_edge *e);
-
- void insert_to_assembler_name_hash (symtab_node *node, bool with_clones);
-
- void unlink_from_assembler_name_hash (symtab_node *node, bool with_clones);
-
- static hashval_t decl_assembler_name_hash (const_tree asmname);
-
- static bool decl_assembler_name_equal (tree decl, const_tree asmname);
- friend struct asmname_hasher;
-
- cgraph_edge_hook_list * GTY((skip)) m_first_edge_removal_hook;
-
- cgraph_node_hook_list * GTY((skip)) m_first_cgraph_removal_hook;
-
- cgraph_2edge_hook_list * GTY((skip)) m_first_edge_duplicated_hook;
-
- cgraph_2node_hook_list * GTY((skip)) m_first_cgraph_duplicated_hook;
-
- cgraph_node_hook_list * GTY((skip)) m_first_cgraph_insertion_hook;
-
- varpool_node_hook_list * GTY((skip)) m_first_varpool_insertion_hook;
-
- varpool_node_hook_list * GTY((skip)) m_first_varpool_removal_hook;
- };
- extern GTY(()) symbol_table *symtab;
- extern vec<cgraph_node *> cgraph_new_nodes;
- inline hashval_t
- asmname_hasher::hash (symtab_node *n)
- {
- return symbol_table::decl_assembler_name_hash
- (DECL_ASSEMBLER_NAME (n->decl));
- }
- inline bool
- asmname_hasher::equal (symtab_node *n, const_tree t)
- {
- return symbol_table::decl_assembler_name_equal (n->decl, t);
- }
- extern void gt_ggc_mx (symtab_node *&);
- inline void
- asmname_hasher::ggc_mx (symtab_node *n)
- {
- gt_ggc_mx (n);
- }
- extern void gt_pch_nx (symtab_node *&);
- inline void
- asmname_hasher::pch_nx (symtab_node *&n)
- {
- gt_pch_nx (n);
- }
- inline void
- asmname_hasher::pch_nx (symtab_node *&n, gt_pointer_operator op, void *cookie)
- {
- op (&n, cookie);
- }
- void cgraph_c_finalize (void);
- void release_function_body (tree);
- cgraph_indirect_call_info *cgraph_allocate_init_indirect_info (void);
- void cgraph_update_edges_for_call_stmt (gimple, tree, gimple);
- bool cgraph_function_possibly_inlined_p (tree);
- const char* cgraph_inline_failed_string (cgraph_inline_failed_t);
- cgraph_inline_failed_type_t cgraph_inline_failed_type (cgraph_inline_failed_t);
- extern bool gimple_check_call_matching_types (gimple, tree, bool);
- void cgraphunit_c_finalize (void);
- basic_block init_lowered_empty_function (tree, bool, gcov_type);
- tree clone_function_name_1 (const char *, const char *);
- tree clone_function_name (tree decl, const char *);
- void tree_function_versioning (tree, tree, vec<ipa_replace_map *, va_gc> *,
- bool, bitmap, bool, bitmap, basic_block);
- int compute_call_stmt_bb_frequency (tree, basic_block bb);
- void record_references_in_initializer (tree, bool);
- void cgraph_build_static_cdtor (char which, tree body, int priority);
- bool ipa_discover_readonly_nonaddressable_vars (void);
- tree ctor_for_folding (tree);
- extern bool chkp_function_instrumented_p (tree fndecl);
- inline bool
- symtab_node::real_symbol_p (void)
- {
- cgraph_node *cnode;
- if (DECL_ABSTRACT_P (decl))
- return false;
- if (!is_a <cgraph_node *> (this))
- return true;
- cnode = dyn_cast <cgraph_node *> (this);
- if (cnode->global.inlined_to)
- return false;
- return true;
- }
- static inline bool
- decl_in_symtab_p (const_tree decl)
- {
- return (TREE_CODE (decl) == FUNCTION_DECL
- || (TREE_CODE (decl) == VAR_DECL
- && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))));
- }
- inline bool
- symtab_node::in_same_comdat_group_p (symtab_node *target)
- {
- symtab_node *source = this;
- if (cgraph_node *cn = dyn_cast <cgraph_node *> (target))
- {
- if (cn->global.inlined_to)
- source = cn->global.inlined_to;
- }
- if (cgraph_node *cn = dyn_cast <cgraph_node *> (target))
- {
- if (cn->global.inlined_to)
- target = cn->global.inlined_to;
- }
- return source->get_comdat_group () == target->get_comdat_group ();
- }
- inline symtab_node *
- symtab_node::get_alias_target (void)
- {
- ipa_ref *ref = NULL;
- iterate_reference (0, ref);
- if (ref->use == IPA_REF_CHKP)
- iterate_reference (1, ref);
- gcc_checking_assert (ref->use == IPA_REF_ALIAS);
- return ref->referred;
- }
- inline symtab_node *
- symtab_node::next_defined_symbol (void)
- {
- symtab_node *node1 = next;
- for (; node1; node1 = node1->next)
- if (node1->definition)
- return node1;
- return NULL;
- }
- inline ipa_ref *
- symtab_node::iterate_reference (unsigned i, ipa_ref *&ref)
- {
- vec_safe_iterate (ref_list.references, i, &ref);
- return ref;
- }
- inline ipa_ref *
- symtab_node::iterate_referring (unsigned i, ipa_ref *&ref)
- {
- ref_list.referring.iterate (i, &ref);
- return ref;
- }
- inline ipa_ref *
- symtab_node::iterate_direct_aliases (unsigned i, ipa_ref *&ref)
- {
- ref_list.referring.iterate (i, &ref);
- if (ref && ref->use != IPA_REF_ALIAS)
- return NULL;
- return ref;
- }
- inline bool
- symtab_node::has_aliases_p (void)
- {
- ipa_ref *ref = NULL;
- return (iterate_direct_aliases (0, ref) != NULL);
- }
- inline bool
- resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution resolution)
- {
- return (resolution == LDPR_PREVAILING_DEF
- || resolution == LDPR_PREEMPTED_REG
- || resolution == LDPR_RESOLVED_EXEC
- || resolution == LDPR_RESOLVED_DYN);
- }
- inline bool
- symtab_node::used_from_object_file_p (void)
- {
- if (!TREE_PUBLIC (decl) || DECL_EXTERNAL (decl))
- return false;
- if (resolution_used_from_other_file_p (resolution))
- return true;
- return false;
- }
- inline varpool_node *
- varpool_node::get (const_tree decl)
- {
- gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
- return dyn_cast<varpool_node *> (symtab_node::get (decl));
- }
- inline void
- symbol_table::register_symbol (symtab_node *node)
- {
- node->next = nodes;
- node->previous = NULL;
- if (nodes)
- nodes->previous = node;
- nodes = node;
- node->order = order++;
- }
- asm_node *
- symbol_table::finalize_toplevel_asm (tree asm_str)
- {
- asm_node *node;
- node = ggc_cleared_alloc<asm_node> ();
- node->asm_str = asm_str;
- node->order = order++;
- node->next = NULL;
- if (asmnodes == NULL)
- asmnodes = node;
- else
- asm_last_node->next = node;
- asm_last_node = node;
- return node;
- }
- inline void
- symbol_table::unregister (symtab_node *node)
- {
- if (node->previous)
- node->previous->next = node->next;
- else
- nodes = node->next;
- if (node->next)
- node->next->previous = node->previous;
- node->next = NULL;
- node->previous = NULL;
- }
- inline void
- symbol_table::release_symbol (cgraph_node *node, int uid)
- {
- cgraph_count--;
-
- memset (node, 0, sizeof (*node));
- node->type = SYMTAB_FUNCTION;
- node->uid = uid;
- SET_NEXT_FREE_NODE (node, free_nodes);
- free_nodes = node;
- }
- inline cgraph_node *
- symbol_table::allocate_cgraph_symbol (void)
- {
- cgraph_node *node;
- if (free_nodes)
- {
- node = free_nodes;
- free_nodes = NEXT_FREE_NODE (node);
- }
- else
- {
- node = ggc_cleared_alloc<cgraph_node> ();
- node->uid = cgraph_max_uid++;
- }
- node->summary_uid = cgraph_max_summary_uid++;
- return node;
- }
- inline symtab_node *
- symbol_table::first_symbol (void)
- {
- return nodes;
- }
- #define FOR_EACH_SYMBOL(node) \
- for ((node) = symtab->first_symbol (); (node); (node) = (node)->next)
- inline symtab_node *
- symbol_table::first_defined_symbol (void)
- {
- symtab_node *node;
- for (node = nodes; node; node = node->next)
- if (node->definition)
- return node;
- return NULL;
- }
- #define FOR_EACH_DEFINED_SYMBOL(node) \
- for ((node) = symtab->first_defined_symbol (); (node); \
- (node) = node->next_defined_symbol ())
- inline varpool_node *
- symbol_table::first_variable (void)
- {
- symtab_node *node;
- for (node = nodes; node; node = node->next)
- if (varpool_node *vnode = dyn_cast <varpool_node *> (node))
- return vnode;
- return NULL;
- }
- inline varpool_node *
- symbol_table::next_variable (varpool_node *node)
- {
- symtab_node *node1 = node->next;
- for (; node1; node1 = node1->next)
- if (varpool_node *vnode1 = dyn_cast <varpool_node *> (node1))
- return vnode1;
- return NULL;
- }
- #define FOR_EACH_VARIABLE(node) \
- for ((node) = symtab->first_variable (); \
- (node); \
- (node) = symtab->next_variable ((node)))
- inline varpool_node *
- symbol_table::first_static_initializer (void)
- {
- symtab_node *node;
- for (node = nodes; node; node = node->next)
- {
- varpool_node *vnode = dyn_cast <varpool_node *> (node);
- if (vnode && DECL_INITIAL (node->decl))
- return vnode;
- }
- return NULL;
- }
- inline varpool_node *
- symbol_table::next_static_initializer (varpool_node *node)
- {
- symtab_node *node1 = node->next;
- for (; node1; node1 = node1->next)
- {
- varpool_node *vnode1 = dyn_cast <varpool_node *> (node1);
- if (vnode1 && DECL_INITIAL (node1->decl))
- return vnode1;
- }
- return NULL;
- }
- #define FOR_EACH_STATIC_INITIALIZER(node) \
- for ((node) = symtab->first_static_initializer (); (node); \
- (node) = symtab->next_static_initializer (node))
- inline varpool_node *
- symbol_table::first_defined_variable (void)
- {
- symtab_node *node;
- for (node = nodes; node; node = node->next)
- {
- varpool_node *vnode = dyn_cast <varpool_node *> (node);
- if (vnode && vnode->definition)
- return vnode;
- }
- return NULL;
- }
- inline varpool_node *
- symbol_table::next_defined_variable (varpool_node *node)
- {
- symtab_node *node1 = node->next;
- for (; node1; node1 = node1->next)
- {
- varpool_node *vnode1 = dyn_cast <varpool_node *> (node1);
- if (vnode1 && vnode1->definition)
- return vnode1;
- }
- return NULL;
- }
- #define FOR_EACH_DEFINED_VARIABLE(node) \
- for ((node) = symtab->first_defined_variable (); (node); \
- (node) = symtab->next_defined_variable (node))
- inline cgraph_node *
- symbol_table::first_defined_function (void)
- {
- symtab_node *node;
- for (node = nodes; node; node = node->next)
- {
- cgraph_node *cn = dyn_cast <cgraph_node *> (node);
- if (cn && cn->definition)
- return cn;
- }
- return NULL;
- }
- inline cgraph_node *
- symbol_table::next_defined_function (cgraph_node *node)
- {
- symtab_node *node1 = node->next;
- for (; node1; node1 = node1->next)
- {
- cgraph_node *cn1 = dyn_cast <cgraph_node *> (node1);
- if (cn1 && cn1->definition)
- return cn1;
- }
- return NULL;
- }
- #define FOR_EACH_DEFINED_FUNCTION(node) \
- for ((node) = symtab->first_defined_function (); (node); \
- (node) = symtab->next_defined_function ((node)))
- inline cgraph_node *
- symbol_table::first_function (void)
- {
- symtab_node *node;
- for (node = nodes; node; node = node->next)
- if (cgraph_node *cn = dyn_cast <cgraph_node *> (node))
- return cn;
- return NULL;
- }
- inline cgraph_node *
- symbol_table::next_function (cgraph_node *node)
- {
- symtab_node *node1 = node->next;
- for (; node1; node1 = node1->next)
- if (cgraph_node *cn1 = dyn_cast <cgraph_node *> (node1))
- return cn1;
- return NULL;
- }
- inline cgraph_node *
- symbol_table::first_function_with_gimple_body (void)
- {
- symtab_node *node;
- for (node = nodes; node; node = node->next)
- {
- cgraph_node *cn = dyn_cast <cgraph_node *> (node);
- if (cn && cn->has_gimple_body_p ())
- return cn;
- }
- return NULL;
- }
- inline cgraph_node *
- symbol_table::next_function_with_gimple_body (cgraph_node *node)
- {
- symtab_node *node1 = node->next;
- for (; node1; node1 = node1->next)
- {
- cgraph_node *cn1 = dyn_cast <cgraph_node *> (node1);
- if (cn1 && cn1->has_gimple_body_p ())
- return cn1;
- }
- return NULL;
- }
- #define FOR_EACH_FUNCTION(node) \
- for ((node) = symtab->first_function (); (node); \
- (node) = symtab->next_function ((node)))
- inline bool
- cgraph_node::has_gimple_body_p (void)
- {
- return definition && !thunk.thunk_p && !alias;
- }
- #define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \
- for ((node) = symtab->first_function_with_gimple_body (); (node); \
- (node) = symtab->next_function_with_gimple_body (node))
- struct GTY((for_user)) constant_descriptor_tree {
-
- rtx rtl;
-
- tree value;
-
- hashval_t hash;
- };
- inline bool
- cgraph_node::only_called_directly_or_aliased_p (void)
- {
- gcc_assert (!global.inlined_to);
- return (!force_output && !address_taken
- && !used_from_other_partition
- && !DECL_VIRTUAL_P (decl)
- && !DECL_STATIC_CONSTRUCTOR (decl)
- && !DECL_STATIC_DESTRUCTOR (decl)
- && !used_from_object_file_p ()
- && !externally_visible);
- }
- inline bool
- cgraph_node::can_remove_if_no_direct_calls_and_refs_p (void)
- {
- gcc_checking_assert (!global.inlined_to);
-
- if (instrumentation_clone
- && !chkp_function_instrumented_p (decl))
- return false;
-
- if (DECL_EXTERNAL (decl))
- return true;
-
- if (force_output || used_from_other_partition)
- return false;
- if (DECL_STATIC_CONSTRUCTOR (decl)
- || DECL_STATIC_DESTRUCTOR (decl))
- return false;
-
- if (externally_visible
- && (!DECL_COMDAT (decl)
- || forced_by_abi
- || used_from_object_file_p ()))
- return false;
- return true;
- }
- inline bool
- varpool_node::can_remove_if_no_refs_p (void)
- {
- if (DECL_EXTERNAL (decl))
- return true;
- return (!force_output && !used_from_other_partition
- && ((DECL_COMDAT (decl)
- && !forced_by_abi
- && !used_from_object_file_p ())
- || !externally_visible
- || DECL_HAS_VALUE_EXPR_P (decl)));
- }
- inline bool
- varpool_node::all_refs_explicit_p ()
- {
- return (definition
- && !externally_visible
- && !used_from_other_partition
- && !force_output);
- }
- struct tree_descriptor_hasher : ggc_hasher<constant_descriptor_tree *>
- {
- static hashval_t hash (constant_descriptor_tree *);
- static bool equal (constant_descriptor_tree *, constant_descriptor_tree *);
- };
- hash_table<tree_descriptor_hasher> *constant_pool_htab (void);
- inline cgraph_node *
- cgraph_node::get_alias_target (void)
- {
- return dyn_cast <cgraph_node *> (symtab_node::get_alias_target ());
- }
- inline varpool_node *
- varpool_node::get_alias_target (void)
- {
- return dyn_cast <varpool_node *> (symtab_node::get_alias_target ());
- }
- inline symtab_node *
- symtab_node::ultimate_alias_target (enum availability *availability)
- {
- if (!alias)
- {
- if (availability)
- *availability = get_availability ();
- return this;
- }
- return ultimate_alias_target_1 (availability);
- }
- inline cgraph_node *
- cgraph_node::ultimate_alias_target (enum availability *availability)
- {
- cgraph_node *n = dyn_cast <cgraph_node *>
- (symtab_node::ultimate_alias_target (availability));
- if (!n && availability)
- *availability = AVAIL_NOT_AVAILABLE;
- return n;
- }
- inline varpool_node *
- varpool_node::ultimate_alias_target (availability *availability)
- {
- varpool_node *n = dyn_cast <varpool_node *>
- (symtab_node::ultimate_alias_target (availability));
- if (!n && availability)
- *availability = AVAIL_NOT_AVAILABLE;
- return n;
- }
- inline void
- cgraph_edge::set_callee (cgraph_node *n)
- {
- prev_caller = NULL;
- if (n->callers)
- n->callers->prev_caller = this;
- next_caller = n->callers;
- n->callers = this;
- callee = n;
- }
- inline void
- cgraph_edge::redirect_callee (cgraph_node *n)
- {
-
- remove_callee ();
-
- set_callee (n);
- }
- inline bool
- cgraph_edge::recursive_p (void)
- {
- cgraph_node *c = callee->ultimate_alias_target ();
- if (caller->global.inlined_to)
- return caller->global.inlined_to->decl == c->decl;
- else
- return caller->decl == c->decl;
- }
- inline void
- cgraph_edge::remove_callee (void)
- {
- gcc_assert (!indirect_unknown_callee);
- if (prev_caller)
- prev_caller->next_caller = next_caller;
- if (next_caller)
- next_caller->prev_caller = prev_caller;
- if (!prev_caller)
- callee->callers = next_caller;
- }
- static inline bool
- decl_is_tm_clone (const_tree fndecl)
- {
- cgraph_node *n = cgraph_node::get (fndecl);
- if (n)
- return n->tm_clone;
- return false;
- }
- inline void
- cgraph_node::mark_force_output (void)
- {
- force_output = 1;
- gcc_checking_assert (!global.inlined_to);
- }
- inline bool
- cgraph_node::optimize_for_size_p (void)
- {
- if (opt_for_fn (decl, optimize_size))
- return true;
- if (frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED)
- return true;
- else
- return false;
- }
- inline symtab_node *
- symtab_node::get_create (tree node)
- {
- if (TREE_CODE (node) == VAR_DECL)
- return varpool_node::get_create (node);
- else
- return cgraph_node::get_create (node);
- }
- inline enum availability
- symtab_node::get_availability (void)
- {
- if (is_a <cgraph_node *> (this))
- return dyn_cast <cgraph_node *> (this)->get_availability ();
- else
- return dyn_cast <varpool_node *> (this)->get_availability ();;
- }
- inline bool
- symtab_node::call_for_symbol_and_aliases (bool (*callback) (symtab_node *,
- void *),
- void *data,
- bool include_overwritable)
- {
- if (callback (this, data))
- return true;
- if (has_aliases_p ())
- return call_for_symbol_and_aliases_1 (callback, data, include_overwritable);
- return false;
- }
- inline bool
- cgraph_node::call_for_symbol_and_aliases (bool (*callback) (cgraph_node *,
- void *),
- void *data,
- bool include_overwritable)
- {
- if (callback (this, data))
- return true;
- if (has_aliases_p ())
- return call_for_symbol_and_aliases_1 (callback, data, include_overwritable);
- return false;
- }
- inline bool
- varpool_node::call_for_symbol_and_aliases (bool (*callback) (varpool_node *,
- void *),
- void *data,
- bool include_overwritable)
- {
- if (callback (this, data))
- return true;
- if (has_aliases_p ())
- return call_for_symbol_and_aliases_1 (callback, data, include_overwritable);
- return false;
- }
- inline bool
- symtab_node::address_can_be_compared_p ()
- {
-
- if (DECL_VIRTUAL_P (decl))
- return false;
-
- if (is_a <cgraph_node *> (this)
- && (DECL_CXX_CONSTRUCTOR_P (decl)
- || DECL_CXX_DESTRUCTOR_P (decl)))
- return false;
-
- if (is_a <varpool_node *> (this)
- && (DECL_IN_CONSTANT_POOL (decl)
- || (flag_merge_constants >= 2
- && TREE_READONLY (decl) && !TREE_THIS_VOLATILE (decl))))
- return false;
- return true;
- }
- inline bool
- ipa_ref::address_matters_p ()
- {
- if (use != IPA_REF_ADDR)
- return false;
-
- if (is_a <varpool_node *> (referring)
- && DECL_VIRTUAL_P (referring->decl))
- return false;
- return referred->address_can_be_compared_p ();
- }
- inline
- ipa_polymorphic_call_context::ipa_polymorphic_call_context (cgraph_edge *e)
- {
- gcc_checking_assert (e->indirect_info->polymorphic);
- *this = e->indirect_info->context;
- }
- inline
- ipa_polymorphic_call_context::ipa_polymorphic_call_context ()
- {
- clear_speculation ();
- clear_outer_type ();
- invalid = false;
- }
- inline void
- ipa_polymorphic_call_context::clear_speculation ()
- {
- speculative_outer_type = NULL;
- speculative_offset = 0;
- speculative_maybe_derived_type = false;
- }
- inline void
- ipa_polymorphic_call_context::clear_outer_type (tree otr_type)
- {
- outer_type = otr_type ? TYPE_MAIN_VARIANT (otr_type) : NULL;
- offset = 0;
- maybe_derived_type = true;
- maybe_in_construction = true;
- dynamic = true;
- }
- inline void
- ipa_polymorphic_call_context::offset_by (HOST_WIDE_INT off)
- {
- if (outer_type)
- offset += off;
- if (speculative_outer_type)
- speculative_offset += off;
- }
- inline bool
- ipa_polymorphic_call_context::useless_p () const
- {
- return (!outer_type && !speculative_outer_type);
- }
- static inline bool
- cgraph_local_p (cgraph_node *node)
- {
- if (!node->instrumentation_clone || !node->instrumented_version)
- return node->local.local;
- return node->local.local && node->instrumented_version->local.local;
- }
- static inline const char *
- xstrdup_for_dump (const char *transient_str)
- {
- return ggc_strdup (transient_str);
- }
- #endif
|