gimple.h 153 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570
  1. /* Gimple IR definitions.
  2. Copyright (C) 2007-2019 Free Software Foundation, Inc.
  3. Contributed by Aldy Hernandez <aldyh@redhat.com>
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 3, or (at your option) any later
  8. version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_GIMPLE_H
  17. #define GCC_GIMPLE_H
  18. #include "tree-ssa-alias.h"
  19. #include "gimple-expr.h"
  20. typedef gimple *gimple_seq_node;
  21. enum gimple_code {
  22. #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
  23. #include "gimple.def"
  24. #undef DEFGSCODE
  25. LAST_AND_UNUSED_GIMPLE_CODE
  26. };
  27. extern const char *const gimple_code_name[];
  28. extern const unsigned char gimple_rhs_class_table[];
  29. /* Strip the outermost pointer, from tr1/type_traits. */
  30. template<typename T> struct remove_pointer { typedef T type; };
  31. template<typename T> struct remove_pointer<T *> { typedef T type; };
  32. /* Error out if a gimple tuple is addressed incorrectly. */
  33. #if defined ENABLE_GIMPLE_CHECKING
  34. #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
  35. extern void gimple_check_failed (const gimple *, const char *, int, \
  36. const char *, enum gimple_code, \
  37. enum tree_code) ATTRIBUTE_NORETURN \
  38. ATTRIBUTE_COLD;
  39. #define GIMPLE_CHECK(GS, CODE) \
  40. do { \
  41. const gimple *__gs = (GS); \
  42. if (gimple_code (__gs) != (CODE)) \
  43. gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
  44. (CODE), ERROR_MARK); \
  45. } while (0)
  46. template <typename T>
  47. static inline T
  48. GIMPLE_CHECK2(const gimple *gs,
  49. #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
  50. const char *file = __builtin_FILE (),
  51. int line = __builtin_LINE (),
  52. const char *fun = __builtin_FUNCTION ())
  53. #else
  54. const char *file = __FILE__,
  55. int line = __LINE__,
  56. const char *fun = NULL)
  57. #endif
  58. {
  59. T ret = dyn_cast <T> (gs);
  60. if (!ret)
  61. gimple_check_failed (gs, file, line, fun,
  62. remove_pointer<T>::type::code_, ERROR_MARK);
  63. return ret;
  64. }
  65. template <typename T>
  66. static inline T
  67. GIMPLE_CHECK2(gimple *gs,
  68. #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
  69. const char *file = __builtin_FILE (),
  70. int line = __builtin_LINE (),
  71. const char *fun = __builtin_FUNCTION ())
  72. #else
  73. const char *file = __FILE__,
  74. int line = __LINE__,
  75. const char *fun = NULL)
  76. #endif
  77. {
  78. T ret = dyn_cast <T> (gs);
  79. if (!ret)
  80. gimple_check_failed (gs, file, line, fun,
  81. remove_pointer<T>::type::code_, ERROR_MARK);
  82. return ret;
  83. }
  84. #else /* not ENABLE_GIMPLE_CHECKING */
  85. #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
  86. #define GIMPLE_CHECK(GS, CODE) (void)0
  87. template <typename T>
  88. static inline T
  89. GIMPLE_CHECK2(gimple *gs)
  90. {
  91. return as_a <T> (gs);
  92. }
  93. template <typename T>
  94. static inline T
  95. GIMPLE_CHECK2(const gimple *gs)
  96. {
  97. return as_a <T> (gs);
  98. }
  99. #endif
  100. /* Class of GIMPLE expressions suitable for the RHS of assignments. See
  101. get_gimple_rhs_class. */
  102. enum gimple_rhs_class
  103. {
  104. GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
  105. GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
  106. GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
  107. GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
  108. GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
  109. name, a _DECL, a _REF, etc. */
  110. };
  111. /* Specific flags for individual GIMPLE statements. These flags are
  112. always stored in gimple.subcode and they may only be
  113. defined for statement codes that do not use subcodes.
  114. Values for the masks can overlap as long as the overlapping values
  115. are never used in the same statement class.
  116. The maximum mask value that can be defined is 1 << 15 (i.e., each
  117. statement code can hold up to 16 bitflags).
  118. Keep this list sorted. */
  119. enum gf_mask {
  120. GF_ASM_INPUT = 1 << 0,
  121. GF_ASM_VOLATILE = 1 << 1,
  122. GF_ASM_INLINE = 1 << 2,
  123. GF_CALL_FROM_THUNK = 1 << 0,
  124. GF_CALL_RETURN_SLOT_OPT = 1 << 1,
  125. GF_CALL_TAILCALL = 1 << 2,
  126. GF_CALL_VA_ARG_PACK = 1 << 3,
  127. GF_CALL_NOTHROW = 1 << 4,
  128. GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
  129. GF_CALL_INTERNAL = 1 << 6,
  130. GF_CALL_CTRL_ALTERING = 1 << 7,
  131. GF_CALL_MUST_TAIL_CALL = 1 << 9,
  132. GF_CALL_BY_DESCRIPTOR = 1 << 10,
  133. GF_CALL_NOCF_CHECK = 1 << 11,
  134. GF_OMP_PARALLEL_COMBINED = 1 << 0,
  135. GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
  136. GF_OMP_TASK_TASKLOOP = 1 << 0,
  137. GF_OMP_TASK_TASKWAIT = 1 << 1,
  138. GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
  139. GF_OMP_FOR_KIND_FOR = 0,
  140. GF_OMP_FOR_KIND_DISTRIBUTE = 1,
  141. GF_OMP_FOR_KIND_TASKLOOP = 2,
  142. GF_OMP_FOR_KIND_OACC_LOOP = 4,
  143. GF_OMP_FOR_KIND_GRID_LOOP = 5,
  144. /* Flag for SIMD variants of OMP_FOR kinds. */
  145. GF_OMP_FOR_SIMD = 1 << 3,
  146. GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
  147. GF_OMP_FOR_COMBINED = 1 << 4,
  148. GF_OMP_FOR_COMBINED_INTO = 1 << 5,
  149. /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
  150. statements. */
  151. GF_OMP_FOR_GRID_PHONY = 1 << 6,
  152. /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP
  153. loop statements. */
  154. GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 6,
  155. GF_OMP_FOR_GRID_GROUP_ITER = 1 << 7,
  156. GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
  157. GF_OMP_TARGET_KIND_REGION = 0,
  158. GF_OMP_TARGET_KIND_DATA = 1,
  159. GF_OMP_TARGET_KIND_UPDATE = 2,
  160. GF_OMP_TARGET_KIND_ENTER_DATA = 3,
  161. GF_OMP_TARGET_KIND_EXIT_DATA = 4,
  162. GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
  163. GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
  164. GF_OMP_TARGET_KIND_OACC_DATA = 7,
  165. GF_OMP_TARGET_KIND_OACC_UPDATE = 8,
  166. GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9,
  167. GF_OMP_TARGET_KIND_OACC_DECLARE = 10,
  168. GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11,
  169. GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
  170. GF_OMP_TEAMS_HOST = 1 << 1,
  171. /* True on an GIMPLE_OMP_RETURN statement if the return does not require
  172. a thread synchronization via some sort of barrier. The exact barrier
  173. that would otherwise be emitted is dependent on the OMP statement with
  174. which this return is associated. */
  175. GF_OMP_RETURN_NOWAIT = 1 << 0,
  176. GF_OMP_SECTION_LAST = 1 << 0,
  177. GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 3) - 1,
  178. GF_OMP_ATOMIC_NEED_VALUE = 1 << 3,
  179. GF_PREDICT_TAKEN = 1 << 15
  180. };
  181. /* This subcode tells apart different kinds of stmts that are not used
  182. for codegen, but rather to retain debug information. */
  183. enum gimple_debug_subcode {
  184. GIMPLE_DEBUG_BIND = 0,
  185. GIMPLE_DEBUG_SOURCE_BIND = 1,
  186. GIMPLE_DEBUG_BEGIN_STMT = 2,
  187. GIMPLE_DEBUG_INLINE_ENTRY = 3
  188. };
  189. /* Masks for selecting a pass local flag (PLF) to work on. These
  190. masks are used by gimple_set_plf and gimple_plf. */
  191. enum plf_mask {
  192. GF_PLF_1 = 1 << 0,
  193. GF_PLF_2 = 1 << 1
  194. };
  195. /* Data structure definitions for GIMPLE tuples. NOTE: word markers
  196. are for 64 bit hosts. */
  197. struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
  198. chain_next ("%h.next"), variable_size))
  199. gimple
  200. {
  201. /* [ WORD 1 ]
  202. Main identifying code for a tuple. */
  203. ENUM_BITFIELD(gimple_code) code : 8;
  204. /* Nonzero if a warning should not be emitted on this tuple. */
  205. unsigned int no_warning : 1;
  206. /* Nonzero if this tuple has been visited. Passes are responsible
  207. for clearing this bit before using it. */
  208. unsigned int visited : 1;
  209. /* Nonzero if this tuple represents a non-temporal move. */
  210. unsigned int nontemporal_move : 1;
  211. /* Pass local flags. These flags are free for any pass to use as
  212. they see fit. Passes should not assume that these flags contain
  213. any useful value when the pass starts. Any initial state that
  214. the pass requires should be set on entry to the pass. See
  215. gimple_set_plf and gimple_plf for usage. */
  216. unsigned int plf : 2;
  217. /* Nonzero if this statement has been modified and needs to have its
  218. operands rescanned. */
  219. unsigned modified : 1;
  220. /* Nonzero if this statement contains volatile operands. */
  221. unsigned has_volatile_ops : 1;
  222. /* Padding to get subcode to 16 bit alignment. */
  223. unsigned pad : 1;
  224. /* The SUBCODE field can be used for tuple-specific flags for tuples
  225. that do not require subcodes. Note that SUBCODE should be at
  226. least as wide as tree codes, as several tuples store tree codes
  227. in there. */
  228. unsigned int subcode : 16;
  229. /* UID of this statement. This is used by passes that want to
  230. assign IDs to statements. It must be assigned and used by each
  231. pass. By default it should be assumed to contain garbage. */
  232. unsigned uid;
  233. /* [ WORD 2 ]
  234. Locus information for debug info. */
  235. location_t location;
  236. /* Number of operands in this tuple. */
  237. unsigned num_ops;
  238. /* [ WORD 3 ]
  239. Basic block holding this statement. */
  240. basic_block bb;
  241. /* [ WORD 4-5 ]
  242. Linked lists of gimple statements. The next pointers form
  243. a NULL terminated list, the prev pointers are a cyclic list.
  244. A gimple statement is hence also a double-ended list of
  245. statements, with the pointer itself being the first element,
  246. and the prev pointer being the last. */
  247. gimple *next;
  248. gimple *GTY((skip)) prev;
  249. };
  250. /* Base structure for tuples with operands. */
  251. /* This gimple subclass has no tag value. */
  252. struct GTY(())
  253. gimple_statement_with_ops_base : public gimple
  254. {
  255. /* [ WORD 1-6 ] : base class */
  256. /* [ WORD 7 ]
  257. SSA operand vectors. NOTE: It should be possible to
  258. amalgamate these vectors with the operand vector OP. However,
  259. the SSA operand vectors are organized differently and contain
  260. more information (like immediate use chaining). */
  261. struct use_optype_d GTY((skip (""))) *use_ops;
  262. };
  263. /* Statements that take register operands. */
  264. struct GTY((tag("GSS_WITH_OPS")))
  265. gimple_statement_with_ops : public gimple_statement_with_ops_base
  266. {
  267. /* [ WORD 1-7 ] : base class */
  268. /* [ WORD 8 ]
  269. Operand vector. NOTE! This must always be the last field
  270. of this structure. In particular, this means that this
  271. structure cannot be embedded inside another one. */
  272. tree GTY((length ("%h.num_ops"))) op[1];
  273. };
  274. /* Base for statements that take both memory and register operands. */
  275. struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
  276. gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
  277. {
  278. /* [ WORD 1-7 ] : base class */
  279. /* [ WORD 8-9 ]
  280. Virtual operands for this statement. The GC will pick them
  281. up via the ssa_names array. */
  282. tree GTY((skip (""))) vdef;
  283. tree GTY((skip (""))) vuse;
  284. };
  285. /* Statements that take both memory and register operands. */
  286. struct GTY((tag("GSS_WITH_MEM_OPS")))
  287. gimple_statement_with_memory_ops :
  288. public gimple_statement_with_memory_ops_base
  289. {
  290. /* [ WORD 1-9 ] : base class */
  291. /* [ WORD 10 ]
  292. Operand vector. NOTE! This must always be the last field
  293. of this structure. In particular, this means that this
  294. structure cannot be embedded inside another one. */
  295. tree GTY((length ("%h.num_ops"))) op[1];
  296. };
  297. /* Call statements that take both memory and register operands. */
  298. struct GTY((tag("GSS_CALL")))
  299. gcall : public gimple_statement_with_memory_ops_base
  300. {
  301. /* [ WORD 1-9 ] : base class */
  302. /* [ WORD 10-13 ] */
  303. struct pt_solution call_used;
  304. struct pt_solution call_clobbered;
  305. /* [ WORD 14 ] */
  306. union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
  307. tree GTY ((tag ("0"))) fntype;
  308. enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
  309. } u;
  310. /* [ WORD 15 ]
  311. Operand vector. NOTE! This must always be the last field
  312. of this structure. In particular, this means that this
  313. structure cannot be embedded inside another one. */
  314. tree GTY((length ("%h.num_ops"))) op[1];
  315. static const enum gimple_code code_ = GIMPLE_CALL;
  316. };
  317. /* OMP statements. */
  318. struct GTY((tag("GSS_OMP")))
  319. gimple_statement_omp : public gimple
  320. {
  321. /* [ WORD 1-6 ] : base class */
  322. /* [ WORD 7 ] */
  323. gimple_seq body;
  324. };
  325. /* GIMPLE_BIND */
  326. struct GTY((tag("GSS_BIND")))
  327. gbind : public gimple
  328. {
  329. /* [ WORD 1-6 ] : base class */
  330. /* [ WORD 7 ]
  331. Variables declared in this scope. */
  332. tree vars;
  333. /* [ WORD 8 ]
  334. This is different than the BLOCK field in gimple,
  335. which is analogous to TREE_BLOCK (i.e., the lexical block holding
  336. this statement). This field is the equivalent of BIND_EXPR_BLOCK
  337. in tree land (i.e., the lexical scope defined by this bind). See
  338. gimple-low.c. */
  339. tree block;
  340. /* [ WORD 9 ] */
  341. gimple_seq body;
  342. };
  343. /* GIMPLE_CATCH */
  344. struct GTY((tag("GSS_CATCH")))
  345. gcatch : public gimple
  346. {
  347. /* [ WORD 1-6 ] : base class */
  348. /* [ WORD 7 ] */
  349. tree types;
  350. /* [ WORD 8 ] */
  351. gimple_seq handler;
  352. };
  353. /* GIMPLE_EH_FILTER */
  354. struct GTY((tag("GSS_EH_FILTER")))
  355. geh_filter : public gimple
  356. {
  357. /* [ WORD 1-6 ] : base class */
  358. /* [ WORD 7 ]
  359. Filter types. */
  360. tree types;
  361. /* [ WORD 8 ]
  362. Failure actions. */
  363. gimple_seq failure;
  364. };
  365. /* GIMPLE_EH_ELSE */
  366. struct GTY((tag("GSS_EH_ELSE")))
  367. geh_else : public gimple
  368. {
  369. /* [ WORD 1-6 ] : base class */
  370. /* [ WORD 7,8 ] */
  371. gimple_seq n_body, e_body;
  372. };
  373. /* GIMPLE_EH_MUST_NOT_THROW */
  374. struct GTY((tag("GSS_EH_MNT")))
  375. geh_mnt : public gimple
  376. {
  377. /* [ WORD 1-6 ] : base class */
  378. /* [ WORD 7 ] Abort function decl. */
  379. tree fndecl;
  380. };
  381. /* GIMPLE_PHI */
  382. struct GTY((tag("GSS_PHI")))
  383. gphi : public gimple
  384. {
  385. /* [ WORD 1-6 ] : base class */
  386. /* [ WORD 7 ] */
  387. unsigned capacity;
  388. unsigned nargs;
  389. /* [ WORD 8 ] */
  390. tree result;
  391. /* [ WORD 9 ] */
  392. struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
  393. };
  394. /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
  395. struct GTY((tag("GSS_EH_CTRL")))
  396. gimple_statement_eh_ctrl : public gimple
  397. {
  398. /* [ WORD 1-6 ] : base class */
  399. /* [ WORD 7 ]
  400. Exception region number. */
  401. int region;
  402. };
  403. struct GTY((tag("GSS_EH_CTRL")))
  404. gresx : public gimple_statement_eh_ctrl
  405. {
  406. /* No extra fields; adds invariant:
  407. stmt->code == GIMPLE_RESX. */
  408. };
  409. struct GTY((tag("GSS_EH_CTRL")))
  410. geh_dispatch : public gimple_statement_eh_ctrl
  411. {
  412. /* No extra fields; adds invariant:
  413. stmt->code == GIMPLE_EH_DISPATH. */
  414. };
  415. /* GIMPLE_TRY */
  416. struct GTY((tag("GSS_TRY")))
  417. gtry : public gimple
  418. {
  419. /* [ WORD 1-6 ] : base class */
  420. /* [ WORD 7 ]
  421. Expression to evaluate. */
  422. gimple_seq eval;
  423. /* [ WORD 8 ]
  424. Cleanup expression. */
  425. gimple_seq cleanup;
  426. };
  427. /* Kind of GIMPLE_TRY statements. */
  428. enum gimple_try_flags
  429. {
  430. /* A try/catch. */
  431. GIMPLE_TRY_CATCH = 1 << 0,
  432. /* A try/finally. */
  433. GIMPLE_TRY_FINALLY = 1 << 1,
  434. GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
  435. /* Analogous to TRY_CATCH_IS_CLEANUP. */
  436. GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
  437. };
  438. /* GIMPLE_WITH_CLEANUP_EXPR */
  439. struct GTY((tag("GSS_WCE")))
  440. gimple_statement_wce : public gimple
  441. {
  442. /* [ WORD 1-6 ] : base class */
  443. /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
  444. executed if an exception is thrown, not on normal exit of its
  445. scope. This flag is analogous to the CLEANUP_EH_ONLY flag
  446. in TARGET_EXPRs. */
  447. /* [ WORD 7 ]
  448. Cleanup expression. */
  449. gimple_seq cleanup;
  450. };
  451. /* GIMPLE_ASM */
  452. struct GTY((tag("GSS_ASM")))
  453. gasm : public gimple_statement_with_memory_ops_base
  454. {
  455. /* [ WORD 1-9 ] : base class */
  456. /* [ WORD 10 ]
  457. __asm__ statement. */
  458. const char *string;
  459. /* [ WORD 11 ]
  460. Number of inputs, outputs, clobbers, labels. */
  461. unsigned char ni;
  462. unsigned char no;
  463. unsigned char nc;
  464. unsigned char nl;
  465. /* [ WORD 12 ]
  466. Operand vector. NOTE! This must always be the last field
  467. of this structure. In particular, this means that this
  468. structure cannot be embedded inside another one. */
  469. tree GTY((length ("%h.num_ops"))) op[1];
  470. };
  471. /* GIMPLE_OMP_CRITICAL */
  472. struct GTY((tag("GSS_OMP_CRITICAL")))
  473. gomp_critical : public gimple_statement_omp
  474. {
  475. /* [ WORD 1-7 ] : base class */
  476. /* [ WORD 8 ] */
  477. tree clauses;
  478. /* [ WORD 9 ]
  479. Critical section name. */
  480. tree name;
  481. };
  482. struct GTY(()) gimple_omp_for_iter {
  483. /* Condition code. */
  484. enum tree_code cond;
  485. /* Index variable. */
  486. tree index;
  487. /* Initial value. */
  488. tree initial;
  489. /* Final value. */
  490. tree final;
  491. /* Increment. */
  492. tree incr;
  493. };
  494. /* GIMPLE_OMP_FOR */
  495. struct GTY((tag("GSS_OMP_FOR")))
  496. gomp_for : public gimple_statement_omp
  497. {
  498. /* [ WORD 1-7 ] : base class */
  499. /* [ WORD 8 ] */
  500. tree clauses;
  501. /* [ WORD 9 ]
  502. Number of elements in iter array. */
  503. size_t collapse;
  504. /* [ WORD 10 ] */
  505. struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
  506. /* [ WORD 11 ]
  507. Pre-body evaluated before the loop body begins. */
  508. gimple_seq pre_body;
  509. };
  510. /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
  511. struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
  512. gimple_statement_omp_parallel_layout : public gimple_statement_omp
  513. {
  514. /* [ WORD 1-7 ] : base class */
  515. /* [ WORD 8 ]
  516. Clauses. */
  517. tree clauses;
  518. /* [ WORD 9 ]
  519. Child function holding the body of the parallel region. */
  520. tree child_fn;
  521. /* [ WORD 10 ]
  522. Shared data argument. */
  523. tree data_arg;
  524. };
  525. /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
  526. struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
  527. gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
  528. {
  529. /* No extra fields; adds invariant:
  530. stmt->code == GIMPLE_OMP_PARALLEL
  531. || stmt->code == GIMPLE_OMP_TASK
  532. || stmt->code == GIMPLE_OMP_TEAMS. */
  533. };
  534. /* GIMPLE_OMP_PARALLEL */
  535. struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
  536. gomp_parallel : public gimple_statement_omp_taskreg
  537. {
  538. /* No extra fields; adds invariant:
  539. stmt->code == GIMPLE_OMP_PARALLEL. */
  540. };
  541. /* GIMPLE_OMP_TARGET */
  542. struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
  543. gomp_target : public gimple_statement_omp_parallel_layout
  544. {
  545. /* No extra fields; adds invariant:
  546. stmt->code == GIMPLE_OMP_TARGET. */
  547. };
  548. /* GIMPLE_OMP_TASK */
  549. struct GTY((tag("GSS_OMP_TASK")))
  550. gomp_task : public gimple_statement_omp_taskreg
  551. {
  552. /* [ WORD 1-10 ] : base class */
  553. /* [ WORD 11 ]
  554. Child function holding firstprivate initialization if needed. */
  555. tree copy_fn;
  556. /* [ WORD 12-13 ]
  557. Size and alignment in bytes of the argument data block. */
  558. tree arg_size;
  559. tree arg_align;
  560. };
  561. /* GIMPLE_OMP_SECTION */
  562. /* Uses struct gimple_statement_omp. */
  563. /* GIMPLE_OMP_SECTIONS */
  564. struct GTY((tag("GSS_OMP_SECTIONS")))
  565. gomp_sections : public gimple_statement_omp
  566. {
  567. /* [ WORD 1-7 ] : base class */
  568. /* [ WORD 8 ] */
  569. tree clauses;
  570. /* [ WORD 9 ]
  571. The control variable used for deciding which of the sections to
  572. execute. */
  573. tree control;
  574. };
  575. /* GIMPLE_OMP_CONTINUE.
  576. Note: This does not inherit from gimple_statement_omp, because we
  577. do not need the body field. */
  578. struct GTY((tag("GSS_OMP_CONTINUE")))
  579. gomp_continue : public gimple
  580. {
  581. /* [ WORD 1-6 ] : base class */
  582. /* [ WORD 7 ] */
  583. tree control_def;
  584. /* [ WORD 8 ] */
  585. tree control_use;
  586. };
  587. /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP. */
  588. struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
  589. gimple_statement_omp_single_layout : public gimple_statement_omp
  590. {
  591. /* [ WORD 1-7 ] : base class */
  592. /* [ WORD 8 ] */
  593. tree clauses;
  594. };
  595. struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
  596. gomp_single : public gimple_statement_omp_single_layout
  597. {
  598. /* No extra fields; adds invariant:
  599. stmt->code == GIMPLE_OMP_SINGLE. */
  600. };
  601. struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
  602. gomp_teams : public gimple_statement_omp_taskreg
  603. {
  604. /* No extra fields; adds invariant:
  605. stmt->code == GIMPLE_OMP_TEAMS. */
  606. };
  607. struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
  608. gomp_ordered : public gimple_statement_omp_single_layout
  609. {
  610. /* No extra fields; adds invariant:
  611. stmt->code == GIMPLE_OMP_ORDERED. */
  612. };
  613. /* GIMPLE_OMP_ATOMIC_LOAD.
  614. Note: This is based on gimple, not g_s_omp, because g_s_omp
  615. contains a sequence, which we don't need here. */
  616. struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
  617. gomp_atomic_load : public gimple
  618. {
  619. /* [ WORD 1-6 ] : base class */
  620. /* [ WORD 7-8 ] */
  621. tree rhs, lhs;
  622. };
  623. /* GIMPLE_OMP_ATOMIC_STORE.
  624. See note on GIMPLE_OMP_ATOMIC_LOAD. */
  625. struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
  626. gimple_statement_omp_atomic_store_layout : public gimple
  627. {
  628. /* [ WORD 1-6 ] : base class */
  629. /* [ WORD 7 ] */
  630. tree val;
  631. };
  632. struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
  633. gomp_atomic_store :
  634. public gimple_statement_omp_atomic_store_layout
  635. {
  636. /* No extra fields; adds invariant:
  637. stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
  638. };
  639. struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
  640. gimple_statement_omp_return :
  641. public gimple_statement_omp_atomic_store_layout
  642. {
  643. /* No extra fields; adds invariant:
  644. stmt->code == GIMPLE_OMP_RETURN. */
  645. };
  646. /* GIMPLE_TRANSACTION. */
  647. /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
  648. /* The __transaction_atomic was declared [[outer]] or it is
  649. __transaction_relaxed. */
  650. #define GTMA_IS_OUTER (1u << 0)
  651. #define GTMA_IS_RELAXED (1u << 1)
  652. #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
  653. /* The transaction is seen to not have an abort. */
  654. #define GTMA_HAVE_ABORT (1u << 2)
  655. /* The transaction is seen to have loads or stores. */
  656. #define GTMA_HAVE_LOAD (1u << 3)
  657. #define GTMA_HAVE_STORE (1u << 4)
  658. /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
  659. #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
  660. /* The transaction WILL enter serial irrevocable mode.
  661. An irrevocable block post-dominates the entire transaction, such
  662. that all invocations of the transaction will go serial-irrevocable.
  663. In such case, we don't bother instrumenting the transaction, and
  664. tell the runtime that it should begin the transaction in
  665. serial-irrevocable mode. */
  666. #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
  667. /* The transaction contains no instrumentation code whatsover, most
  668. likely because it is guaranteed to go irrevocable upon entry. */
  669. #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
  670. struct GTY((tag("GSS_TRANSACTION")))
  671. gtransaction : public gimple_statement_with_memory_ops_base
  672. {
  673. /* [ WORD 1-9 ] : base class */
  674. /* [ WORD 10 ] */
  675. gimple_seq body;
  676. /* [ WORD 11-13 ] */
  677. tree label_norm;
  678. tree label_uninst;
  679. tree label_over;
  680. };
  681. #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
  682. enum gimple_statement_structure_enum {
  683. #include "gsstruct.def"
  684. LAST_GSS_ENUM
  685. };
  686. #undef DEFGSSTRUCT
  687. /* A statement with the invariant that
  688. stmt->code == GIMPLE_COND
  689. i.e. a conditional jump statement. */
  690. struct GTY((tag("GSS_WITH_OPS")))
  691. gcond : public gimple_statement_with_ops
  692. {
  693. /* no additional fields; this uses the layout for GSS_WITH_OPS. */
  694. static const enum gimple_code code_ = GIMPLE_COND;
  695. };
  696. /* A statement with the invariant that
  697. stmt->code == GIMPLE_DEBUG
  698. i.e. a debug statement. */
  699. struct GTY((tag("GSS_WITH_OPS")))
  700. gdebug : public gimple_statement_with_ops
  701. {
  702. /* no additional fields; this uses the layout for GSS_WITH_OPS. */
  703. };
  704. /* A statement with the invariant that
  705. stmt->code == GIMPLE_GOTO
  706. i.e. a goto statement. */
  707. struct GTY((tag("GSS_WITH_OPS")))
  708. ggoto : public gimple_statement_with_ops
  709. {
  710. /* no additional fields; this uses the layout for GSS_WITH_OPS. */
  711. };
  712. /* A statement with the invariant that
  713. stmt->code == GIMPLE_LABEL
  714. i.e. a label statement. */
  715. struct GTY((tag("GSS_WITH_OPS")))
  716. glabel : public gimple_statement_with_ops
  717. {
  718. /* no additional fields; this uses the layout for GSS_WITH_OPS. */
  719. };
  720. /* A statement with the invariant that
  721. stmt->code == GIMPLE_SWITCH
  722. i.e. a switch statement. */
  723. struct GTY((tag("GSS_WITH_OPS")))
  724. gswitch : public gimple_statement_with_ops
  725. {
  726. /* no additional fields; this uses the layout for GSS_WITH_OPS. */
  727. };
  728. /* A statement with the invariant that
  729. stmt->code == GIMPLE_ASSIGN
  730. i.e. an assignment statement. */
  731. struct GTY((tag("GSS_WITH_MEM_OPS")))
  732. gassign : public gimple_statement_with_memory_ops
  733. {
  734. static const enum gimple_code code_ = GIMPLE_ASSIGN;
  735. /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
  736. };
  737. /* A statement with the invariant that
  738. stmt->code == GIMPLE_RETURN
  739. i.e. a return statement. */
  740. struct GTY((tag("GSS_WITH_MEM_OPS")))
  741. greturn : public gimple_statement_with_memory_ops
  742. {
  743. /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
  744. };
  745. template <>
  746. template <>
  747. inline bool
  748. is_a_helper <gasm *>::test (gimple *gs)
  749. {
  750. return gs->code == GIMPLE_ASM;
  751. }
  752. template <>
  753. template <>
  754. inline bool
  755. is_a_helper <gassign *>::test (gimple *gs)
  756. {
  757. return gs->code == GIMPLE_ASSIGN;
  758. }
  759. template <>
  760. template <>
  761. inline bool
  762. is_a_helper <const gassign *>::test (const gimple *gs)
  763. {
  764. return gs->code == GIMPLE_ASSIGN;
  765. }
  766. template <>
  767. template <>
  768. inline bool
  769. is_a_helper <gbind *>::test (gimple *gs)
  770. {
  771. return gs->code == GIMPLE_BIND;
  772. }
  773. template <>
  774. template <>
  775. inline bool
  776. is_a_helper <gcall *>::test (gimple *gs)
  777. {
  778. return gs->code == GIMPLE_CALL;
  779. }
  780. template <>
  781. template <>
  782. inline bool
  783. is_a_helper <gcatch *>::test (gimple *gs)
  784. {
  785. return gs->code == GIMPLE_CATCH;
  786. }
  787. template <>
  788. template <>
  789. inline bool
  790. is_a_helper <gcond *>::test (gimple *gs)
  791. {
  792. return gs->code == GIMPLE_COND;
  793. }
  794. template <>
  795. template <>
  796. inline bool
  797. is_a_helper <const gcond *>::test (const gimple *gs)
  798. {
  799. return gs->code == GIMPLE_COND;
  800. }
  801. template <>
  802. template <>
  803. inline bool
  804. is_a_helper <gdebug *>::test (gimple *gs)
  805. {
  806. return gs->code == GIMPLE_DEBUG;
  807. }
  808. template <>
  809. template <>
  810. inline bool
  811. is_a_helper <ggoto *>::test (gimple *gs)
  812. {
  813. return gs->code == GIMPLE_GOTO;
  814. }
  815. template <>
  816. template <>
  817. inline bool
  818. is_a_helper <glabel *>::test (gimple *gs)
  819. {
  820. return gs->code == GIMPLE_LABEL;
  821. }
  822. template <>
  823. template <>
  824. inline bool
  825. is_a_helper <gresx *>::test (gimple *gs)
  826. {
  827. return gs->code == GIMPLE_RESX;
  828. }
  829. template <>
  830. template <>
  831. inline bool
  832. is_a_helper <geh_dispatch *>::test (gimple *gs)
  833. {
  834. return gs->code == GIMPLE_EH_DISPATCH;
  835. }
  836. template <>
  837. template <>
  838. inline bool
  839. is_a_helper <geh_else *>::test (gimple *gs)
  840. {
  841. return gs->code == GIMPLE_EH_ELSE;
  842. }
  843. template <>
  844. template <>
  845. inline bool
  846. is_a_helper <geh_filter *>::test (gimple *gs)
  847. {
  848. return gs->code == GIMPLE_EH_FILTER;
  849. }
  850. template <>
  851. template <>
  852. inline bool
  853. is_a_helper <geh_mnt *>::test (gimple *gs)
  854. {
  855. return gs->code == GIMPLE_EH_MUST_NOT_THROW;
  856. }
  857. template <>
  858. template <>
  859. inline bool
  860. is_a_helper <gomp_atomic_load *>::test (gimple *gs)
  861. {
  862. return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
  863. }
  864. template <>
  865. template <>
  866. inline bool
  867. is_a_helper <gomp_atomic_store *>::test (gimple *gs)
  868. {
  869. return gs->code == GIMPLE_OMP_ATOMIC_STORE;
  870. }
  871. template <>
  872. template <>
  873. inline bool
  874. is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
  875. {
  876. return gs->code == GIMPLE_OMP_RETURN;
  877. }
  878. template <>
  879. template <>
  880. inline bool
  881. is_a_helper <gomp_continue *>::test (gimple *gs)
  882. {
  883. return gs->code == GIMPLE_OMP_CONTINUE;
  884. }
  885. template <>
  886. template <>
  887. inline bool
  888. is_a_helper <gomp_critical *>::test (gimple *gs)
  889. {
  890. return gs->code == GIMPLE_OMP_CRITICAL;
  891. }
  892. template <>
  893. template <>
  894. inline bool
  895. is_a_helper <gomp_ordered *>::test (gimple *gs)
  896. {
  897. return gs->code == GIMPLE_OMP_ORDERED;
  898. }
  899. template <>
  900. template <>
  901. inline bool
  902. is_a_helper <gomp_for *>::test (gimple *gs)
  903. {
  904. return gs->code == GIMPLE_OMP_FOR;
  905. }
  906. template <>
  907. template <>
  908. inline bool
  909. is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
  910. {
  911. return (gs->code == GIMPLE_OMP_PARALLEL
  912. || gs->code == GIMPLE_OMP_TASK
  913. || gs->code == GIMPLE_OMP_TEAMS);
  914. }
  915. template <>
  916. template <>
  917. inline bool
  918. is_a_helper <gomp_parallel *>::test (gimple *gs)
  919. {
  920. return gs->code == GIMPLE_OMP_PARALLEL;
  921. }
  922. template <>
  923. template <>
  924. inline bool
  925. is_a_helper <gomp_target *>::test (gimple *gs)
  926. {
  927. return gs->code == GIMPLE_OMP_TARGET;
  928. }
  929. template <>
  930. template <>
  931. inline bool
  932. is_a_helper <gomp_sections *>::test (gimple *gs)
  933. {
  934. return gs->code == GIMPLE_OMP_SECTIONS;
  935. }
  936. template <>
  937. template <>
  938. inline bool
  939. is_a_helper <gomp_single *>::test (gimple *gs)
  940. {
  941. return gs->code == GIMPLE_OMP_SINGLE;
  942. }
  943. template <>
  944. template <>
  945. inline bool
  946. is_a_helper <gomp_teams *>::test (gimple *gs)
  947. {
  948. return gs->code == GIMPLE_OMP_TEAMS;
  949. }
  950. template <>
  951. template <>
  952. inline bool
  953. is_a_helper <gomp_task *>::test (gimple *gs)
  954. {
  955. return gs->code == GIMPLE_OMP_TASK;
  956. }
  957. template <>
  958. template <>
  959. inline bool
  960. is_a_helper <gphi *>::test (gimple *gs)
  961. {
  962. return gs->code == GIMPLE_PHI;
  963. }
  964. template <>
  965. template <>
  966. inline bool
  967. is_a_helper <greturn *>::test (gimple *gs)
  968. {
  969. return gs->code == GIMPLE_RETURN;
  970. }
  971. template <>
  972. template <>
  973. inline bool
  974. is_a_helper <gswitch *>::test (gimple *gs)
  975. {
  976. return gs->code == GIMPLE_SWITCH;
  977. }
  978. template <>
  979. template <>
  980. inline bool
  981. is_a_helper <gtransaction *>::test (gimple *gs)
  982. {
  983. return gs->code == GIMPLE_TRANSACTION;
  984. }
  985. template <>
  986. template <>
  987. inline bool
  988. is_a_helper <gtry *>::test (gimple *gs)
  989. {
  990. return gs->code == GIMPLE_TRY;
  991. }
  992. template <>
  993. template <>
  994. inline bool
  995. is_a_helper <gimple_statement_wce *>::test (gimple *gs)
  996. {
  997. return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
  998. }
  999. template <>
  1000. template <>
  1001. inline bool
  1002. is_a_helper <const gasm *>::test (const gimple *gs)
  1003. {
  1004. return gs->code == GIMPLE_ASM;
  1005. }
  1006. template <>
  1007. template <>
  1008. inline bool
  1009. is_a_helper <const gbind *>::test (const gimple *gs)
  1010. {
  1011. return gs->code == GIMPLE_BIND;
  1012. }
  1013. template <>
  1014. template <>
  1015. inline bool
  1016. is_a_helper <const gcall *>::test (const gimple *gs)
  1017. {
  1018. return gs->code == GIMPLE_CALL;
  1019. }
  1020. template <>
  1021. template <>
  1022. inline bool
  1023. is_a_helper <const gcatch *>::test (const gimple *gs)
  1024. {
  1025. return gs->code == GIMPLE_CATCH;
  1026. }
  1027. template <>
  1028. template <>
  1029. inline bool
  1030. is_a_helper <const gresx *>::test (const gimple *gs)
  1031. {
  1032. return gs->code == GIMPLE_RESX;
  1033. }
  1034. template <>
  1035. template <>
  1036. inline bool
  1037. is_a_helper <const geh_dispatch *>::test (const gimple *gs)
  1038. {
  1039. return gs->code == GIMPLE_EH_DISPATCH;
  1040. }
  1041. template <>
  1042. template <>
  1043. inline bool
  1044. is_a_helper <const geh_filter *>::test (const gimple *gs)
  1045. {
  1046. return gs->code == GIMPLE_EH_FILTER;
  1047. }
  1048. template <>
  1049. template <>
  1050. inline bool
  1051. is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
  1052. {
  1053. return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
  1054. }
  1055. template <>
  1056. template <>
  1057. inline bool
  1058. is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
  1059. {
  1060. return gs->code == GIMPLE_OMP_ATOMIC_STORE;
  1061. }
  1062. template <>
  1063. template <>
  1064. inline bool
  1065. is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
  1066. {
  1067. return gs->code == GIMPLE_OMP_RETURN;
  1068. }
  1069. template <>
  1070. template <>
  1071. inline bool
  1072. is_a_helper <const gomp_continue *>::test (const gimple *gs)
  1073. {
  1074. return gs->code == GIMPLE_OMP_CONTINUE;
  1075. }
  1076. template <>
  1077. template <>
  1078. inline bool
  1079. is_a_helper <const gomp_critical *>::test (const gimple *gs)
  1080. {
  1081. return gs->code == GIMPLE_OMP_CRITICAL;
  1082. }
  1083. template <>
  1084. template <>
  1085. inline bool
  1086. is_a_helper <const gomp_ordered *>::test (const gimple *gs)
  1087. {
  1088. return gs->code == GIMPLE_OMP_ORDERED;
  1089. }
  1090. template <>
  1091. template <>
  1092. inline bool
  1093. is_a_helper <const gomp_for *>::test (const gimple *gs)
  1094. {
  1095. return gs->code == GIMPLE_OMP_FOR;
  1096. }
  1097. template <>
  1098. template <>
  1099. inline bool
  1100. is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
  1101. {
  1102. return (gs->code == GIMPLE_OMP_PARALLEL
  1103. || gs->code == GIMPLE_OMP_TASK
  1104. || gs->code == GIMPLE_OMP_TEAMS);
  1105. }
  1106. template <>
  1107. template <>
  1108. inline bool
  1109. is_a_helper <const gomp_parallel *>::test (const gimple *gs)
  1110. {
  1111. return gs->code == GIMPLE_OMP_PARALLEL;
  1112. }
  1113. template <>
  1114. template <>
  1115. inline bool
  1116. is_a_helper <const gomp_target *>::test (const gimple *gs)
  1117. {
  1118. return gs->code == GIMPLE_OMP_TARGET;
  1119. }
  1120. template <>
  1121. template <>
  1122. inline bool
  1123. is_a_helper <const gomp_sections *>::test (const gimple *gs)
  1124. {
  1125. return gs->code == GIMPLE_OMP_SECTIONS;
  1126. }
  1127. template <>
  1128. template <>
  1129. inline bool
  1130. is_a_helper <const gomp_single *>::test (const gimple *gs)
  1131. {
  1132. return gs->code == GIMPLE_OMP_SINGLE;
  1133. }
  1134. template <>
  1135. template <>
  1136. inline bool
  1137. is_a_helper <const gomp_teams *>::test (const gimple *gs)
  1138. {
  1139. return gs->code == GIMPLE_OMP_TEAMS;
  1140. }
  1141. template <>
  1142. template <>
  1143. inline bool
  1144. is_a_helper <const gomp_task *>::test (const gimple *gs)
  1145. {
  1146. return gs->code == GIMPLE_OMP_TASK;
  1147. }
  1148. template <>
  1149. template <>
  1150. inline bool
  1151. is_a_helper <const gphi *>::test (const gimple *gs)
  1152. {
  1153. return gs->code == GIMPLE_PHI;
  1154. }
  1155. template <>
  1156. template <>
  1157. inline bool
  1158. is_a_helper <const gtransaction *>::test (const gimple *gs)
  1159. {
  1160. return gs->code == GIMPLE_TRANSACTION;
  1161. }
  1162. /* Offset in bytes to the location of the operand vector.
  1163. Zero if there is no operand vector for this tuple structure. */
  1164. extern size_t const gimple_ops_offset_[];
  1165. /* Map GIMPLE codes to GSS codes. */
  1166. extern enum gimple_statement_structure_enum const gss_for_code_[];
  1167. /* This variable holds the currently expanded gimple statement for purposes
  1168. of comminucating the profile info to the builtin expanders. */
  1169. extern gimple *currently_expanding_gimple_stmt;
  1170. gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
  1171. greturn *gimple_build_return (tree);
  1172. void gimple_call_reset_alias_info (gcall *);
  1173. gcall *gimple_build_call_vec (tree, vec<tree> );
  1174. gcall *gimple_build_call (tree, unsigned, ...);
  1175. gcall *gimple_build_call_valist (tree, unsigned, va_list);
  1176. gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
  1177. gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
  1178. gcall *gimple_build_call_from_tree (tree, tree);
  1179. gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
  1180. gassign *gimple_build_assign (tree, enum tree_code,
  1181. tree, tree, tree CXX_MEM_STAT_INFO);
  1182. gassign *gimple_build_assign (tree, enum tree_code,
  1183. tree, tree CXX_MEM_STAT_INFO);
  1184. gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
  1185. gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
  1186. gcond *gimple_build_cond_from_tree (tree, tree, tree);
  1187. void gimple_cond_set_condition_from_tree (gcond *, tree);
  1188. glabel *gimple_build_label (tree label);
  1189. ggoto *gimple_build_goto (tree dest);
  1190. gimple *gimple_build_nop (void);
  1191. gbind *gimple_build_bind (tree, gimple_seq, tree);
  1192. gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
  1193. vec<tree, va_gc> *, vec<tree, va_gc> *,
  1194. vec<tree, va_gc> *);
  1195. gcatch *gimple_build_catch (tree, gimple_seq);
  1196. geh_filter *gimple_build_eh_filter (tree, gimple_seq);
  1197. geh_mnt *gimple_build_eh_must_not_throw (tree);
  1198. geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
  1199. gtry *gimple_build_try (gimple_seq, gimple_seq,
  1200. enum gimple_try_flags);
  1201. gimple *gimple_build_wce (gimple_seq);
  1202. gresx *gimple_build_resx (int);
  1203. gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
  1204. gswitch *gimple_build_switch (tree, tree, vec<tree> );
  1205. geh_dispatch *gimple_build_eh_dispatch (int);
  1206. gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
  1207. gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
  1208. gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
  1209. gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
  1210. gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
  1211. gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
  1212. gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
  1213. gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
  1214. tree, tree);
  1215. gimple *gimple_build_omp_section (gimple_seq);
  1216. gimple *gimple_build_omp_master (gimple_seq);
  1217. gimple *gimple_build_omp_grid_body (gimple_seq);
  1218. gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
  1219. gomp_continue *gimple_build_omp_continue (tree, tree);
  1220. gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
  1221. gimple *gimple_build_omp_return (bool);
  1222. gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
  1223. gimple *gimple_build_omp_sections_switch (void);
  1224. gomp_single *gimple_build_omp_single (gimple_seq, tree);
  1225. gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
  1226. gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
  1227. gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
  1228. enum omp_memory_order);
  1229. gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
  1230. gtransaction *gimple_build_transaction (gimple_seq);
  1231. extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
  1232. extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
  1233. void gimple_seq_add_seq (gimple_seq *, gimple_seq);
  1234. void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
  1235. extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
  1236. location_t);
  1237. extern void annotate_all_with_location (gimple_seq, location_t);
  1238. bool empty_body_p (gimple_seq);
  1239. gimple_seq gimple_seq_copy (gimple_seq);
  1240. bool gimple_call_same_target_p (const gimple *, const gimple *);
  1241. int gimple_call_flags (const gimple *);
  1242. int gimple_call_arg_flags (const gcall *, unsigned);
  1243. int gimple_call_return_flags (const gcall *);
  1244. bool gimple_call_nonnull_result_p (gcall *);
  1245. tree gimple_call_nonnull_arg (gcall *);
  1246. bool gimple_assign_copy_p (gimple *);
  1247. bool gimple_assign_ssa_name_copy_p (gimple *);
  1248. bool gimple_assign_unary_nop_p (gimple *);
  1249. void gimple_set_bb (gimple *, basic_block);
  1250. void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
  1251. void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
  1252. tree, tree, tree);
  1253. tree gimple_get_lhs (const gimple *);
  1254. void gimple_set_lhs (gimple *, tree);
  1255. gimple *gimple_copy (gimple *);
  1256. bool gimple_has_side_effects (const gimple *);
  1257. bool gimple_could_trap_p_1 (gimple *, bool, bool);
  1258. bool gimple_could_trap_p (gimple *);
  1259. bool gimple_assign_rhs_could_trap_p (gimple *);
  1260. extern void dump_gimple_statistics (void);
  1261. unsigned get_gimple_rhs_num_ops (enum tree_code);
  1262. extern tree canonicalize_cond_expr_cond (tree);
  1263. gcall *gimple_call_copy_skip_args (gcall *, bitmap);
  1264. extern bool gimple_compare_field_offset (tree, tree);
  1265. extern tree gimple_unsigned_type (tree);
  1266. extern tree gimple_signed_type (tree);
  1267. extern alias_set_type gimple_get_alias_set (tree);
  1268. extern bool gimple_ior_addresses_taken (bitmap, gimple *);
  1269. extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
  1270. extern combined_fn gimple_call_combined_fn (const gimple *);
  1271. extern bool gimple_call_builtin_p (const gimple *);
  1272. extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
  1273. extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
  1274. extern bool gimple_asm_clobbers_memory_p (const gasm *);
  1275. extern void dump_decl_set (FILE *, bitmap);
  1276. extern bool nonfreeing_call_p (gimple *);
  1277. extern bool nonbarrier_call_p (gimple *);
  1278. extern bool infer_nonnull_range (gimple *, tree);
  1279. extern bool infer_nonnull_range_by_dereference (gimple *, tree);
  1280. extern bool infer_nonnull_range_by_attribute (gimple *, tree);
  1281. extern void sort_case_labels (vec<tree>);
  1282. extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
  1283. extern void gimple_seq_set_location (gimple_seq, location_t);
  1284. extern void gimple_seq_discard (gimple_seq);
  1285. extern void maybe_remove_unused_call_args (struct function *, gimple *);
  1286. extern bool gimple_inexpensive_call_p (gcall *);
  1287. extern bool stmt_can_terminate_bb_p (gimple *);
  1288. /* Formal (expression) temporary table handling: multiple occurrences of
  1289. the same scalar expression are evaluated into the same temporary. */
  1290. typedef struct gimple_temp_hash_elt
  1291. {
  1292. tree val; /* Key */
  1293. tree temp; /* Value */
  1294. } elt_t;
  1295. /* Get the number of the next statement uid to be allocated. */
  1296. static inline unsigned int
  1297. gimple_stmt_max_uid (struct function *fn)
  1298. {
  1299. return fn->last_stmt_uid;
  1300. }
  1301. /* Set the number of the next statement uid to be allocated. */
  1302. static inline void
  1303. set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
  1304. {
  1305. fn->last_stmt_uid = maxid;
  1306. }
  1307. /* Set the number of the next statement uid to be allocated. */
  1308. static inline unsigned int
  1309. inc_gimple_stmt_max_uid (struct function *fn)
  1310. {
  1311. return fn->last_stmt_uid++;
  1312. }
  1313. /* Return the first node in GIMPLE sequence S. */
  1314. static inline gimple_seq_node
  1315. gimple_seq_first (gimple_seq s)
  1316. {
  1317. return s;
  1318. }
  1319. /* Return the first statement in GIMPLE sequence S. */
  1320. static inline gimple *
  1321. gimple_seq_first_stmt (gimple_seq s)
  1322. {
  1323. gimple_seq_node n = gimple_seq_first (s);
  1324. return n;
  1325. }
  1326. /* Return the first statement in GIMPLE sequence S as a gbind *,
  1327. verifying that it has code GIMPLE_BIND in a checked build. */
  1328. static inline gbind *
  1329. gimple_seq_first_stmt_as_a_bind (gimple_seq s)
  1330. {
  1331. gimple_seq_node n = gimple_seq_first (s);
  1332. return as_a <gbind *> (n);
  1333. }
  1334. /* Return the last node in GIMPLE sequence S. */
  1335. static inline gimple_seq_node
  1336. gimple_seq_last (gimple_seq s)
  1337. {
  1338. return s ? s->prev : NULL;
  1339. }
  1340. /* Return the last statement in GIMPLE sequence S. */
  1341. static inline gimple *
  1342. gimple_seq_last_stmt (gimple_seq s)
  1343. {
  1344. gimple_seq_node n = gimple_seq_last (s);
  1345. return n;
  1346. }
  1347. /* Set the last node in GIMPLE sequence *PS to LAST. */
  1348. static inline void
  1349. gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
  1350. {
  1351. (*ps)->prev = last;
  1352. }
  1353. /* Set the first node in GIMPLE sequence *PS to FIRST. */
  1354. static inline void
  1355. gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
  1356. {
  1357. *ps = first;
  1358. }
  1359. /* Return true if GIMPLE sequence S is empty. */
  1360. static inline bool
  1361. gimple_seq_empty_p (gimple_seq s)
  1362. {
  1363. return s == NULL;
  1364. }
  1365. /* Allocate a new sequence and initialize its first element with STMT. */
  1366. static inline gimple_seq
  1367. gimple_seq_alloc_with_stmt (gimple *stmt)
  1368. {
  1369. gimple_seq seq = NULL;
  1370. gimple_seq_add_stmt (&seq, stmt);
  1371. return seq;
  1372. }
  1373. /* Returns the sequence of statements in BB. */
  1374. static inline gimple_seq
  1375. bb_seq (const_basic_block bb)
  1376. {
  1377. return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
  1378. }
  1379. static inline gimple_seq *
  1380. bb_seq_addr (basic_block bb)
  1381. {
  1382. return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
  1383. }
  1384. /* Sets the sequence of statements in BB to SEQ. */
  1385. static inline void
  1386. set_bb_seq (basic_block bb, gimple_seq seq)
  1387. {
  1388. gcc_checking_assert (!(bb->flags & BB_RTL));
  1389. bb->il.gimple.seq = seq;
  1390. }
  1391. /* Return the code for GIMPLE statement G. */
  1392. static inline enum gimple_code
  1393. gimple_code (const gimple *g)
  1394. {
  1395. return g->code;
  1396. }
  1397. /* Return the GSS code used by a GIMPLE code. */
  1398. static inline enum gimple_statement_structure_enum
  1399. gss_for_code (enum gimple_code code)
  1400. {
  1401. gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
  1402. return gss_for_code_[code];
  1403. }
  1404. /* Return which GSS code is used by GS. */
  1405. static inline enum gimple_statement_structure_enum
  1406. gimple_statement_structure (gimple *gs)
  1407. {
  1408. return gss_for_code (gimple_code (gs));
  1409. }
  1410. /* Return true if statement G has sub-statements. This is only true for
  1411. High GIMPLE statements. */
  1412. static inline bool
  1413. gimple_has_substatements (gimple *g)
  1414. {
  1415. switch (gimple_code (g))
  1416. {
  1417. case GIMPLE_BIND:
  1418. case GIMPLE_CATCH:
  1419. case GIMPLE_EH_FILTER:
  1420. case GIMPLE_EH_ELSE:
  1421. case GIMPLE_TRY:
  1422. case GIMPLE_OMP_FOR:
  1423. case GIMPLE_OMP_MASTER:
  1424. case GIMPLE_OMP_TASKGROUP:
  1425. case GIMPLE_OMP_ORDERED:
  1426. case GIMPLE_OMP_SECTION:
  1427. case GIMPLE_OMP_PARALLEL:
  1428. case GIMPLE_OMP_TASK:
  1429. case GIMPLE_OMP_SECTIONS:
  1430. case GIMPLE_OMP_SINGLE:
  1431. case GIMPLE_OMP_TARGET:
  1432. case GIMPLE_OMP_TEAMS:
  1433. case GIMPLE_OMP_CRITICAL:
  1434. case GIMPLE_WITH_CLEANUP_EXPR:
  1435. case GIMPLE_TRANSACTION:
  1436. case GIMPLE_OMP_GRID_BODY:
  1437. return true;
  1438. default:
  1439. return false;
  1440. }
  1441. }
  1442. /* Return the basic block holding statement G. */
  1443. static inline basic_block
  1444. gimple_bb (const gimple *g)
  1445. {
  1446. return g->bb;
  1447. }
  1448. /* Return the lexical scope block holding statement G. */
  1449. static inline tree
  1450. gimple_block (const gimple *g)
  1451. {
  1452. return LOCATION_BLOCK (g->location);
  1453. }
  1454. /* Set BLOCK to be the lexical scope block holding statement G. */
  1455. static inline void
  1456. gimple_set_block (gimple *g, tree block)
  1457. {
  1458. g->location = set_block (g->location, block);
  1459. }
  1460. /* Return location information for statement G. */
  1461. static inline location_t
  1462. gimple_location (const gimple *g)
  1463. {
  1464. return g->location;
  1465. }
  1466. /* Return location information for statement G if g is not NULL.
  1467. Otherwise, UNKNOWN_LOCATION is returned. */
  1468. static inline location_t
  1469. gimple_location_safe (const gimple *g)
  1470. {
  1471. return g ? gimple_location (g) : UNKNOWN_LOCATION;
  1472. }
  1473. /* Set location information for statement G. */
  1474. static inline void
  1475. gimple_set_location (gimple *g, location_t location)
  1476. {
  1477. g->location = location;
  1478. }
  1479. /* Return true if G contains location information. */
  1480. static inline bool
  1481. gimple_has_location (const gimple *g)
  1482. {
  1483. return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
  1484. }
  1485. /* Return non-artificial location information for statement G. */
  1486. static inline location_t
  1487. gimple_nonartificial_location (const gimple *g)
  1488. {
  1489. location_t *ploc = NULL;
  1490. if (tree block = gimple_block (g))
  1491. ploc = block_nonartificial_location (block);
  1492. return ploc ? *ploc : gimple_location (g);
  1493. }
  1494. /* Return the file name of the location of STMT. */
  1495. static inline const char *
  1496. gimple_filename (const gimple *stmt)
  1497. {
  1498. return LOCATION_FILE (gimple_location (stmt));
  1499. }
  1500. /* Return the line number of the location of STMT. */
  1501. static inline int
  1502. gimple_lineno (const gimple *stmt)
  1503. {
  1504. return LOCATION_LINE (gimple_location (stmt));
  1505. }
  1506. /* Determine whether SEQ is a singleton. */
  1507. static inline bool
  1508. gimple_seq_singleton_p (gimple_seq seq)
  1509. {
  1510. return ((gimple_seq_first (seq) != NULL)
  1511. && (gimple_seq_first (seq) == gimple_seq_last (seq)));
  1512. }
  1513. /* Return true if no warnings should be emitted for statement STMT. */
  1514. static inline bool
  1515. gimple_no_warning_p (const gimple *stmt)
  1516. {
  1517. return stmt->no_warning;
  1518. }
  1519. /* Set the no_warning flag of STMT to NO_WARNING. */
  1520. static inline void
  1521. gimple_set_no_warning (gimple *stmt, bool no_warning)
  1522. {
  1523. stmt->no_warning = (unsigned) no_warning;
  1524. }
  1525. /* Set the visited status on statement STMT to VISITED_P.
  1526. Please note that this 'visited' property of the gimple statement is
  1527. supposed to be undefined at pass boundaries. This means that a
  1528. given pass should not assume it contains any useful value when the
  1529. pass starts and thus can set it to any value it sees fit.
  1530. You can learn more about the visited property of the gimple
  1531. statement by reading the comments of the 'visited' data member of
  1532. struct gimple.
  1533. */
  1534. static inline void
  1535. gimple_set_visited (gimple *stmt, bool visited_p)
  1536. {
  1537. stmt->visited = (unsigned) visited_p;
  1538. }
  1539. /* Return the visited status for statement STMT.
  1540. Please note that this 'visited' property of the gimple statement is
  1541. supposed to be undefined at pass boundaries. This means that a
  1542. given pass should not assume it contains any useful value when the
  1543. pass starts and thus can set it to any value it sees fit.
  1544. You can learn more about the visited property of the gimple
  1545. statement by reading the comments of the 'visited' data member of
  1546. struct gimple. */
  1547. static inline bool
  1548. gimple_visited_p (gimple *stmt)
  1549. {
  1550. return stmt->visited;
  1551. }
  1552. /* Set pass local flag PLF on statement STMT to VAL_P.
  1553. Please note that this PLF property of the gimple statement is
  1554. supposed to be undefined at pass boundaries. This means that a
  1555. given pass should not assume it contains any useful value when the
  1556. pass starts and thus can set it to any value it sees fit.
  1557. You can learn more about the PLF property by reading the comment of
  1558. the 'plf' data member of struct gimple_statement_structure. */
  1559. static inline void
  1560. gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
  1561. {
  1562. if (val_p)
  1563. stmt->plf |= (unsigned int) plf;
  1564. else
  1565. stmt->plf &= ~((unsigned int) plf);
  1566. }
  1567. /* Return the value of pass local flag PLF on statement STMT.
  1568. Please note that this 'plf' property of the gimple statement is
  1569. supposed to be undefined at pass boundaries. This means that a
  1570. given pass should not assume it contains any useful value when the
  1571. pass starts and thus can set it to any value it sees fit.
  1572. You can learn more about the plf property by reading the comment of
  1573. the 'plf' data member of struct gimple_statement_structure. */
  1574. static inline unsigned int
  1575. gimple_plf (gimple *stmt, enum plf_mask plf)
  1576. {
  1577. return stmt->plf & ((unsigned int) plf);
  1578. }
  1579. /* Set the UID of statement.
  1580. Please note that this UID property is supposed to be undefined at
  1581. pass boundaries. This means that a given pass should not assume it
  1582. contains any useful value when the pass starts and thus can set it
  1583. to any value it sees fit. */
  1584. static inline void
  1585. gimple_set_uid (gimple *g, unsigned uid)
  1586. {
  1587. g->uid = uid;
  1588. }
  1589. /* Return the UID of statement.
  1590. Please note that this UID property is supposed to be undefined at
  1591. pass boundaries. This means that a given pass should not assume it
  1592. contains any useful value when the pass starts and thus can set it
  1593. to any value it sees fit. */
  1594. static inline unsigned
  1595. gimple_uid (const gimple *g)
  1596. {
  1597. return g->uid;
  1598. }
  1599. /* Make statement G a singleton sequence. */
  1600. static inline void
  1601. gimple_init_singleton (gimple *g)
  1602. {
  1603. g->next = NULL;
  1604. g->prev = g;
  1605. }
  1606. /* Return true if GIMPLE statement G has register or memory operands. */
  1607. static inline bool
  1608. gimple_has_ops (const gimple *g)
  1609. {
  1610. return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
  1611. }
  1612. template <>
  1613. template <>
  1614. inline bool
  1615. is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
  1616. {
  1617. return gimple_has_ops (gs);
  1618. }
  1619. template <>
  1620. template <>
  1621. inline bool
  1622. is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
  1623. {
  1624. return gimple_has_ops (gs);
  1625. }
  1626. /* Return true if GIMPLE statement G has memory operands. */
  1627. static inline bool
  1628. gimple_has_mem_ops (const gimple *g)
  1629. {
  1630. return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
  1631. }
  1632. template <>
  1633. template <>
  1634. inline bool
  1635. is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
  1636. {
  1637. return gimple_has_mem_ops (gs);
  1638. }
  1639. template <>
  1640. template <>
  1641. inline bool
  1642. is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
  1643. {
  1644. return gimple_has_mem_ops (gs);
  1645. }
  1646. /* Return the set of USE operands for statement G. */
  1647. static inline struct use_optype_d *
  1648. gimple_use_ops (const gimple *g)
  1649. {
  1650. const gimple_statement_with_ops *ops_stmt =
  1651. dyn_cast <const gimple_statement_with_ops *> (g);
  1652. if (!ops_stmt)
  1653. return NULL;
  1654. return ops_stmt->use_ops;
  1655. }
  1656. /* Set USE to be the set of USE operands for statement G. */
  1657. static inline void
  1658. gimple_set_use_ops (gimple *g, struct use_optype_d *use)
  1659. {
  1660. gimple_statement_with_ops *ops_stmt =
  1661. as_a <gimple_statement_with_ops *> (g);
  1662. ops_stmt->use_ops = use;
  1663. }
  1664. /* Return the single VUSE operand of the statement G. */
  1665. static inline tree
  1666. gimple_vuse (const gimple *g)
  1667. {
  1668. const gimple_statement_with_memory_ops *mem_ops_stmt =
  1669. dyn_cast <const gimple_statement_with_memory_ops *> (g);
  1670. if (!mem_ops_stmt)
  1671. return NULL_TREE;
  1672. return mem_ops_stmt->vuse;
  1673. }
  1674. /* Return the single VDEF operand of the statement G. */
  1675. static inline tree
  1676. gimple_vdef (const gimple *g)
  1677. {
  1678. const gimple_statement_with_memory_ops *mem_ops_stmt =
  1679. dyn_cast <const gimple_statement_with_memory_ops *> (g);
  1680. if (!mem_ops_stmt)
  1681. return NULL_TREE;
  1682. return mem_ops_stmt->vdef;
  1683. }
  1684. /* Return the single VUSE operand of the statement G. */
  1685. static inline tree *
  1686. gimple_vuse_ptr (gimple *g)
  1687. {
  1688. gimple_statement_with_memory_ops *mem_ops_stmt =
  1689. dyn_cast <gimple_statement_with_memory_ops *> (g);
  1690. if (!mem_ops_stmt)
  1691. return NULL;
  1692. return &mem_ops_stmt->vuse;
  1693. }
  1694. /* Return the single VDEF operand of the statement G. */
  1695. static inline tree *
  1696. gimple_vdef_ptr (gimple *g)
  1697. {
  1698. gimple_statement_with_memory_ops *mem_ops_stmt =
  1699. dyn_cast <gimple_statement_with_memory_ops *> (g);
  1700. if (!mem_ops_stmt)
  1701. return NULL;
  1702. return &mem_ops_stmt->vdef;
  1703. }
  1704. /* Set the single VUSE operand of the statement G. */
  1705. static inline void
  1706. gimple_set_vuse (gimple *g, tree vuse)
  1707. {
  1708. gimple_statement_with_memory_ops *mem_ops_stmt =
  1709. as_a <gimple_statement_with_memory_ops *> (g);
  1710. mem_ops_stmt->vuse = vuse;
  1711. }
  1712. /* Set the single VDEF operand of the statement G. */
  1713. static inline void
  1714. gimple_set_vdef (gimple *g, tree vdef)
  1715. {
  1716. gimple_statement_with_memory_ops *mem_ops_stmt =
  1717. as_a <gimple_statement_with_memory_ops *> (g);
  1718. mem_ops_stmt->vdef = vdef;
  1719. }
  1720. /* Return true if statement G has operands and the modified field has
  1721. been set. */
  1722. static inline bool
  1723. gimple_modified_p (const gimple *g)
  1724. {
  1725. return (gimple_has_ops (g)) ? (bool) g->modified : false;
  1726. }
  1727. /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
  1728. a MODIFIED field. */
  1729. static inline void
  1730. gimple_set_modified (gimple *s, bool modifiedp)
  1731. {
  1732. if (gimple_has_ops (s))
  1733. s->modified = (unsigned) modifiedp;
  1734. }
  1735. /* Return the tree code for the expression computed by STMT. This is
  1736. only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
  1737. GIMPLE_CALL, return CALL_EXPR as the expression code for
  1738. consistency. This is useful when the caller needs to deal with the
  1739. three kinds of computation that GIMPLE supports. */
  1740. static inline enum tree_code
  1741. gimple_expr_code (const gimple *stmt)
  1742. {
  1743. enum gimple_code code = gimple_code (stmt);
  1744. if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
  1745. return (enum tree_code) stmt->subcode;
  1746. else
  1747. {
  1748. gcc_gimple_checking_assert (code == GIMPLE_CALL);
  1749. return CALL_EXPR;
  1750. }
  1751. }
  1752. /* Return true if statement STMT contains volatile operands. */
  1753. static inline bool
  1754. gimple_has_volatile_ops (const gimple *stmt)
  1755. {
  1756. if (gimple_has_mem_ops (stmt))
  1757. return stmt->has_volatile_ops;
  1758. else
  1759. return false;
  1760. }
  1761. /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
  1762. static inline void
  1763. gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
  1764. {
  1765. if (gimple_has_mem_ops (stmt))
  1766. stmt->has_volatile_ops = (unsigned) volatilep;
  1767. }
  1768. /* Return true if STMT is in a transaction. */
  1769. static inline bool
  1770. gimple_in_transaction (const gimple *stmt)
  1771. {
  1772. return bb_in_transaction (gimple_bb (stmt));
  1773. }
  1774. /* Return true if statement STMT may access memory. */
  1775. static inline bool
  1776. gimple_references_memory_p (gimple *stmt)
  1777. {
  1778. return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
  1779. }
  1780. /* Return the subcode for OMP statement S. */
  1781. static inline unsigned
  1782. gimple_omp_subcode (const gimple *s)
  1783. {
  1784. gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
  1785. && gimple_code (s) <= GIMPLE_OMP_TEAMS);
  1786. return s->subcode;
  1787. }
  1788. /* Set the subcode for OMP statement S to SUBCODE. */
  1789. static inline void
  1790. gimple_omp_set_subcode (gimple *s, unsigned int subcode)
  1791. {
  1792. /* We only have 16 bits for the subcode. Assert that we are not
  1793. overflowing it. */
  1794. gcc_gimple_checking_assert (subcode < (1 << 16));
  1795. s->subcode = subcode;
  1796. }
  1797. /* Set the nowait flag on OMP_RETURN statement S. */
  1798. static inline void
  1799. gimple_omp_return_set_nowait (gimple *s)
  1800. {
  1801. GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
  1802. s->subcode |= GF_OMP_RETURN_NOWAIT;
  1803. }
  1804. /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
  1805. flag set. */
  1806. static inline bool
  1807. gimple_omp_return_nowait_p (const gimple *g)
  1808. {
  1809. GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
  1810. return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
  1811. }
  1812. /* Set the LHS of OMP return. */
  1813. static inline void
  1814. gimple_omp_return_set_lhs (gimple *g, tree lhs)
  1815. {
  1816. gimple_statement_omp_return *omp_return_stmt =
  1817. as_a <gimple_statement_omp_return *> (g);
  1818. omp_return_stmt->val = lhs;
  1819. }
  1820. /* Get the LHS of OMP return. */
  1821. static inline tree
  1822. gimple_omp_return_lhs (const gimple *g)
  1823. {
  1824. const gimple_statement_omp_return *omp_return_stmt =
  1825. as_a <const gimple_statement_omp_return *> (g);
  1826. return omp_return_stmt->val;
  1827. }
  1828. /* Return a pointer to the LHS of OMP return. */
  1829. static inline tree *
  1830. gimple_omp_return_lhs_ptr (gimple *g)
  1831. {
  1832. gimple_statement_omp_return *omp_return_stmt =
  1833. as_a <gimple_statement_omp_return *> (g);
  1834. return &omp_return_stmt->val;
  1835. }
  1836. /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
  1837. flag set. */
  1838. static inline bool
  1839. gimple_omp_section_last_p (const gimple *g)
  1840. {
  1841. GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
  1842. return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
  1843. }
  1844. /* Set the GF_OMP_SECTION_LAST flag on G. */
  1845. static inline void
  1846. gimple_omp_section_set_last (gimple *g)
  1847. {
  1848. GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
  1849. g->subcode |= GF_OMP_SECTION_LAST;
  1850. }
  1851. /* Return true if OMP parallel statement G has the
  1852. GF_OMP_PARALLEL_COMBINED flag set. */
  1853. static inline bool
  1854. gimple_omp_parallel_combined_p (const gimple *g)
  1855. {
  1856. GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
  1857. return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
  1858. }
  1859. /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
  1860. value of COMBINED_P. */
  1861. static inline void
  1862. gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
  1863. {
  1864. GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
  1865. if (combined_p)
  1866. g->subcode |= GF_OMP_PARALLEL_COMBINED;
  1867. else
  1868. g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
  1869. }
  1870. /* Return true if OMP atomic load/store statement G has the
  1871. GF_OMP_ATOMIC_NEED_VALUE flag set. */
  1872. static inline bool
  1873. gimple_omp_atomic_need_value_p (const gimple *g)
  1874. {
  1875. if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
  1876. GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
  1877. return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
  1878. }
  1879. /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
  1880. static inline void
  1881. gimple_omp_atomic_set_need_value (gimple *g)
  1882. {
  1883. if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
  1884. GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
  1885. g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
  1886. }
  1887. /* Return the memory order of the OMP atomic load/store statement G. */
  1888. static inline enum omp_memory_order
  1889. gimple_omp_atomic_memory_order (const gimple *g)
  1890. {
  1891. if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
  1892. GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
  1893. return (enum omp_memory_order)
  1894. (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER);
  1895. }
  1896. /* Set the memory order on G. */
  1897. static inline void
  1898. gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
  1899. {
  1900. if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
  1901. GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
  1902. g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
  1903. | (mo & GF_OMP_ATOMIC_MEMORY_ORDER));
  1904. }
  1905. /* Return the number of operands for statement GS. */
  1906. static inline unsigned
  1907. gimple_num_ops (const gimple *gs)
  1908. {
  1909. return gs->num_ops;
  1910. }
  1911. /* Set the number of operands for statement GS. */
  1912. static inline void
  1913. gimple_set_num_ops (gimple *gs, unsigned num_ops)
  1914. {
  1915. gs->num_ops = num_ops;
  1916. }
  1917. /* Return the array of operands for statement GS. */
  1918. static inline tree *
  1919. gimple_ops (gimple *gs)
  1920. {
  1921. size_t off;
  1922. /* All the tuples have their operand vector at the very bottom
  1923. of the structure. Note that those structures that do not
  1924. have an operand vector have a zero offset. */
  1925. off = gimple_ops_offset_[gimple_statement_structure (gs)];
  1926. gcc_gimple_checking_assert (off != 0);
  1927. return (tree *) ((char *) gs + off);
  1928. }
  1929. /* Return operand I for statement GS. */
  1930. static inline tree
  1931. gimple_op (const gimple *gs, unsigned i)
  1932. {
  1933. if (gimple_has_ops (gs))
  1934. {
  1935. gcc_gimple_checking_assert (i < gimple_num_ops (gs));
  1936. return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
  1937. }
  1938. else
  1939. return NULL_TREE;
  1940. }
  1941. /* Return a pointer to operand I for statement GS. */
  1942. static inline tree *
  1943. gimple_op_ptr (gimple *gs, unsigned i)
  1944. {
  1945. if (gimple_has_ops (gs))
  1946. {
  1947. gcc_gimple_checking_assert (i < gimple_num_ops (gs));
  1948. return gimple_ops (gs) + i;
  1949. }
  1950. else
  1951. return NULL;
  1952. }
  1953. /* Set operand I of statement GS to OP. */
  1954. static inline void
  1955. gimple_set_op (gimple *gs, unsigned i, tree op)
  1956. {
  1957. gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
  1958. /* Note. It may be tempting to assert that OP matches
  1959. is_gimple_operand, but that would be wrong. Different tuples
  1960. accept slightly different sets of tree operands. Each caller
  1961. should perform its own validation. */
  1962. gimple_ops (gs)[i] = op;
  1963. }
  1964. /* Return true if GS is a GIMPLE_ASSIGN. */
  1965. static inline bool
  1966. is_gimple_assign (const gimple *gs)
  1967. {
  1968. return gimple_code (gs) == GIMPLE_ASSIGN;
  1969. }
  1970. /* Determine if expression CODE is one of the valid expressions that can
  1971. be used on the RHS of GIMPLE assignments. */
  1972. static inline enum gimple_rhs_class
  1973. get_gimple_rhs_class (enum tree_code code)
  1974. {
  1975. return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
  1976. }
  1977. /* Return the LHS of assignment statement GS. */
  1978. static inline tree
  1979. gimple_assign_lhs (const gassign *gs)
  1980. {
  1981. return gs->op[0];
  1982. }
  1983. static inline tree
  1984. gimple_assign_lhs (const gimple *gs)
  1985. {
  1986. const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
  1987. return gimple_assign_lhs (ass);
  1988. }
  1989. /* Return a pointer to the LHS of assignment statement GS. */
  1990. static inline tree *
  1991. gimple_assign_lhs_ptr (gassign *gs)
  1992. {
  1993. return &gs->op[0];
  1994. }
  1995. static inline tree *
  1996. gimple_assign_lhs_ptr (gimple *gs)
  1997. {
  1998. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  1999. return gimple_assign_lhs_ptr (ass);
  2000. }
  2001. /* Set LHS to be the LHS operand of assignment statement GS. */
  2002. static inline void
  2003. gimple_assign_set_lhs (gassign *gs, tree lhs)
  2004. {
  2005. gs->op[0] = lhs;
  2006. if (lhs && TREE_CODE (lhs) == SSA_NAME)
  2007. SSA_NAME_DEF_STMT (lhs) = gs;
  2008. }
  2009. static inline void
  2010. gimple_assign_set_lhs (gimple *gs, tree lhs)
  2011. {
  2012. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2013. gimple_assign_set_lhs (ass, lhs);
  2014. }
  2015. /* Return the first operand on the RHS of assignment statement GS. */
  2016. static inline tree
  2017. gimple_assign_rhs1 (const gassign *gs)
  2018. {
  2019. return gs->op[1];
  2020. }
  2021. static inline tree
  2022. gimple_assign_rhs1 (const gimple *gs)
  2023. {
  2024. const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
  2025. return gimple_assign_rhs1 (ass);
  2026. }
  2027. /* Return a pointer to the first operand on the RHS of assignment
  2028. statement GS. */
  2029. static inline tree *
  2030. gimple_assign_rhs1_ptr (gassign *gs)
  2031. {
  2032. return &gs->op[1];
  2033. }
  2034. static inline tree *
  2035. gimple_assign_rhs1_ptr (gimple *gs)
  2036. {
  2037. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2038. return gimple_assign_rhs1_ptr (ass);
  2039. }
  2040. /* Set RHS to be the first operand on the RHS of assignment statement GS. */
  2041. static inline void
  2042. gimple_assign_set_rhs1 (gassign *gs, tree rhs)
  2043. {
  2044. gs->op[1] = rhs;
  2045. }
  2046. static inline void
  2047. gimple_assign_set_rhs1 (gimple *gs, tree rhs)
  2048. {
  2049. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2050. gimple_assign_set_rhs1 (ass, rhs);
  2051. }
  2052. /* Return the second operand on the RHS of assignment statement GS.
  2053. If GS does not have two operands, NULL is returned instead. */
  2054. static inline tree
  2055. gimple_assign_rhs2 (const gassign *gs)
  2056. {
  2057. if (gimple_num_ops (gs) >= 3)
  2058. return gs->op[2];
  2059. else
  2060. return NULL_TREE;
  2061. }
  2062. static inline tree
  2063. gimple_assign_rhs2 (const gimple *gs)
  2064. {
  2065. const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
  2066. return gimple_assign_rhs2 (ass);
  2067. }
  2068. /* Return a pointer to the second operand on the RHS of assignment
  2069. statement GS. */
  2070. static inline tree *
  2071. gimple_assign_rhs2_ptr (gassign *gs)
  2072. {
  2073. gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
  2074. return &gs->op[2];
  2075. }
  2076. static inline tree *
  2077. gimple_assign_rhs2_ptr (gimple *gs)
  2078. {
  2079. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2080. return gimple_assign_rhs2_ptr (ass);
  2081. }
  2082. /* Set RHS to be the second operand on the RHS of assignment statement GS. */
  2083. static inline void
  2084. gimple_assign_set_rhs2 (gassign *gs, tree rhs)
  2085. {
  2086. gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
  2087. gs->op[2] = rhs;
  2088. }
  2089. static inline void
  2090. gimple_assign_set_rhs2 (gimple *gs, tree rhs)
  2091. {
  2092. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2093. return gimple_assign_set_rhs2 (ass, rhs);
  2094. }
  2095. /* Return the third operand on the RHS of assignment statement GS.
  2096. If GS does not have two operands, NULL is returned instead. */
  2097. static inline tree
  2098. gimple_assign_rhs3 (const gassign *gs)
  2099. {
  2100. if (gimple_num_ops (gs) >= 4)
  2101. return gs->op[3];
  2102. else
  2103. return NULL_TREE;
  2104. }
  2105. static inline tree
  2106. gimple_assign_rhs3 (const gimple *gs)
  2107. {
  2108. const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
  2109. return gimple_assign_rhs3 (ass);
  2110. }
  2111. /* Return a pointer to the third operand on the RHS of assignment
  2112. statement GS. */
  2113. static inline tree *
  2114. gimple_assign_rhs3_ptr (gimple *gs)
  2115. {
  2116. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2117. gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
  2118. return &ass->op[3];
  2119. }
  2120. /* Set RHS to be the third operand on the RHS of assignment statement GS. */
  2121. static inline void
  2122. gimple_assign_set_rhs3 (gassign *gs, tree rhs)
  2123. {
  2124. gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
  2125. gs->op[3] = rhs;
  2126. }
  2127. static inline void
  2128. gimple_assign_set_rhs3 (gimple *gs, tree rhs)
  2129. {
  2130. gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
  2131. gimple_assign_set_rhs3 (ass, rhs);
  2132. }
  2133. /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
  2134. which expect to see only two operands. */
  2135. static inline void
  2136. gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
  2137. tree op1, tree op2)
  2138. {
  2139. gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
  2140. }
  2141. /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
  2142. which expect to see only one operands. */
  2143. static inline void
  2144. gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
  2145. tree op1)
  2146. {
  2147. gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
  2148. }
  2149. /* Returns true if GS is a nontemporal move. */
  2150. static inline bool
  2151. gimple_assign_nontemporal_move_p (const gassign *gs)
  2152. {
  2153. return gs->nontemporal_move;
  2154. }
  2155. /* Sets nontemporal move flag of GS to NONTEMPORAL. */
  2156. static inline void
  2157. gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
  2158. {
  2159. GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
  2160. gs->nontemporal_move = nontemporal;
  2161. }
  2162. /* Return the code of the expression computed on the rhs of assignment
  2163. statement GS. In case that the RHS is a single object, returns the
  2164. tree code of the object. */
  2165. static inline enum tree_code
  2166. gimple_assign_rhs_code (const gassign *gs)
  2167. {
  2168. enum tree_code code = (enum tree_code) gs->subcode;
  2169. /* While we initially set subcode to the TREE_CODE of the rhs for
  2170. GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
  2171. in sync when we rewrite stmts into SSA form or do SSA propagations. */
  2172. if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
  2173. code = TREE_CODE (gs->op[1]);
  2174. return code;
  2175. }
  2176. static inline enum tree_code
  2177. gimple_assign_rhs_code (const gimple *gs)
  2178. {
  2179. const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
  2180. return gimple_assign_rhs_code (ass);
  2181. }
  2182. /* Set CODE to be the code for the expression computed on the RHS of
  2183. assignment S. */
  2184. static inline void
  2185. gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
  2186. {
  2187. GIMPLE_CHECK (s, GIMPLE_ASSIGN);
  2188. s->subcode = code;
  2189. }
  2190. /* Return the gimple rhs class of the code of the expression computed on
  2191. the rhs of assignment statement GS.
  2192. This will never return GIMPLE_INVALID_RHS. */
  2193. static inline enum gimple_rhs_class
  2194. gimple_assign_rhs_class (const gimple *gs)
  2195. {
  2196. return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
  2197. }
  2198. /* Return true if GS is an assignment with a singleton RHS, i.e.,
  2199. there is no operator associated with the assignment itself.
  2200. Unlike gimple_assign_copy_p, this predicate returns true for
  2201. any RHS operand, including those that perform an operation
  2202. and do not have the semantics of a copy, such as COND_EXPR. */
  2203. static inline bool
  2204. gimple_assign_single_p (const gimple *gs)
  2205. {
  2206. return (is_gimple_assign (gs)
  2207. && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
  2208. }
  2209. /* Return true if GS performs a store to its lhs. */
  2210. static inline bool
  2211. gimple_store_p (const gimple *gs)
  2212. {
  2213. tree lhs = gimple_get_lhs (gs);
  2214. return lhs && !is_gimple_reg (lhs);
  2215. }
  2216. /* Return true if GS is an assignment that loads from its rhs1. */
  2217. static inline bool
  2218. gimple_assign_load_p (const gimple *gs)
  2219. {
  2220. tree rhs;
  2221. if (!gimple_assign_single_p (gs))
  2222. return false;
  2223. rhs = gimple_assign_rhs1 (gs);
  2224. if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
  2225. return true;
  2226. rhs = get_base_address (rhs);
  2227. return (DECL_P (rhs)
  2228. || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
  2229. }
  2230. /* Return true if S is a type-cast assignment. */
  2231. static inline bool
  2232. gimple_assign_cast_p (const gimple *s)
  2233. {
  2234. if (is_gimple_assign (s))
  2235. {
  2236. enum tree_code sc = gimple_assign_rhs_code (s);
  2237. return CONVERT_EXPR_CODE_P (sc)
  2238. || sc == VIEW_CONVERT_EXPR
  2239. || sc == FIX_TRUNC_EXPR;
  2240. }
  2241. return false;
  2242. }
  2243. /* Return true if S is a clobber statement. */
  2244. static inline bool
  2245. gimple_clobber_p (const gimple *s)
  2246. {
  2247. return gimple_assign_single_p (s)
  2248. && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
  2249. }
  2250. /* Return true if GS is a GIMPLE_CALL. */
  2251. static inline bool
  2252. is_gimple_call (const gimple *gs)
  2253. {
  2254. return gimple_code (gs) == GIMPLE_CALL;
  2255. }
  2256. /* Return the LHS of call statement GS. */
  2257. static inline tree
  2258. gimple_call_lhs (const gcall *gs)
  2259. {
  2260. return gs->op[0];
  2261. }
  2262. static inline tree
  2263. gimple_call_lhs (const gimple *gs)
  2264. {
  2265. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2266. return gimple_call_lhs (gc);
  2267. }
  2268. /* Return a pointer to the LHS of call statement GS. */
  2269. static inline tree *
  2270. gimple_call_lhs_ptr (gcall *gs)
  2271. {
  2272. return &gs->op[0];
  2273. }
  2274. static inline tree *
  2275. gimple_call_lhs_ptr (gimple *gs)
  2276. {
  2277. gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
  2278. return gimple_call_lhs_ptr (gc);
  2279. }
  2280. /* Set LHS to be the LHS operand of call statement GS. */
  2281. static inline void
  2282. gimple_call_set_lhs (gcall *gs, tree lhs)
  2283. {
  2284. gs->op[0] = lhs;
  2285. if (lhs && TREE_CODE (lhs) == SSA_NAME)
  2286. SSA_NAME_DEF_STMT (lhs) = gs;
  2287. }
  2288. static inline void
  2289. gimple_call_set_lhs (gimple *gs, tree lhs)
  2290. {
  2291. gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
  2292. gimple_call_set_lhs (gc, lhs);
  2293. }
  2294. /* Return true if call GS calls an internal-only function, as enumerated
  2295. by internal_fn. */
  2296. static inline bool
  2297. gimple_call_internal_p (const gcall *gs)
  2298. {
  2299. return (gs->subcode & GF_CALL_INTERNAL) != 0;
  2300. }
  2301. static inline bool
  2302. gimple_call_internal_p (const gimple *gs)
  2303. {
  2304. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2305. return gimple_call_internal_p (gc);
  2306. }
  2307. /* Return true if call GS is marked as nocf_check. */
  2308. static inline bool
  2309. gimple_call_nocf_check_p (const gcall *gs)
  2310. {
  2311. return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
  2312. }
  2313. /* Mark statement GS as nocf_check call. */
  2314. static inline void
  2315. gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
  2316. {
  2317. if (nocf_check)
  2318. gs->subcode |= GF_CALL_NOCF_CHECK;
  2319. else
  2320. gs->subcode &= ~GF_CALL_NOCF_CHECK;
  2321. }
  2322. /* Return the target of internal call GS. */
  2323. static inline enum internal_fn
  2324. gimple_call_internal_fn (const gcall *gs)
  2325. {
  2326. gcc_gimple_checking_assert (gimple_call_internal_p (gs));
  2327. return gs->u.internal_fn;
  2328. }
  2329. static inline enum internal_fn
  2330. gimple_call_internal_fn (const gimple *gs)
  2331. {
  2332. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2333. return gimple_call_internal_fn (gc);
  2334. }
  2335. /* Return true, if this internal gimple call is unique. */
  2336. static inline bool
  2337. gimple_call_internal_unique_p (const gcall *gs)
  2338. {
  2339. return gimple_call_internal_fn (gs) == IFN_UNIQUE;
  2340. }
  2341. static inline bool
  2342. gimple_call_internal_unique_p (const gimple *gs)
  2343. {
  2344. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2345. return gimple_call_internal_unique_p (gc);
  2346. }
  2347. /* Return true if GS is an internal function FN. */
  2348. static inline bool
  2349. gimple_call_internal_p (const gimple *gs, internal_fn fn)
  2350. {
  2351. return (is_gimple_call (gs)
  2352. && gimple_call_internal_p (gs)
  2353. && gimple_call_internal_fn (gs) == fn);
  2354. }
  2355. /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
  2356. that could alter control flow. */
  2357. static inline void
  2358. gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
  2359. {
  2360. if (ctrl_altering_p)
  2361. s->subcode |= GF_CALL_CTRL_ALTERING;
  2362. else
  2363. s->subcode &= ~GF_CALL_CTRL_ALTERING;
  2364. }
  2365. static inline void
  2366. gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
  2367. {
  2368. gcall *gc = GIMPLE_CHECK2<gcall *> (s);
  2369. gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
  2370. }
  2371. /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
  2372. flag is set. Such call could not be a stmt in the middle of a bb. */
  2373. static inline bool
  2374. gimple_call_ctrl_altering_p (const gcall *gs)
  2375. {
  2376. return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
  2377. }
  2378. static inline bool
  2379. gimple_call_ctrl_altering_p (const gimple *gs)
  2380. {
  2381. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2382. return gimple_call_ctrl_altering_p (gc);
  2383. }
  2384. /* Return the function type of the function called by GS. */
  2385. static inline tree
  2386. gimple_call_fntype (const gcall *gs)
  2387. {
  2388. if (gimple_call_internal_p (gs))
  2389. return NULL_TREE;
  2390. return gs->u.fntype;
  2391. }
  2392. static inline tree
  2393. gimple_call_fntype (const gimple *gs)
  2394. {
  2395. const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
  2396. return gimple_call_fntype (call_stmt);
  2397. }
  2398. /* Set the type of the function called by CALL_STMT to FNTYPE. */
  2399. static inline void
  2400. gimple_call_set_fntype (gcall *call_stmt, tree fntype)
  2401. {
  2402. gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
  2403. call_stmt->u.fntype = fntype;
  2404. }
  2405. /* Return the tree node representing the function called by call
  2406. statement GS. */
  2407. static inline tree
  2408. gimple_call_fn (const gcall *gs)
  2409. {
  2410. return gs->op[1];
  2411. }
  2412. static inline tree
  2413. gimple_call_fn (const gimple *gs)
  2414. {
  2415. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2416. return gimple_call_fn (gc);
  2417. }
  2418. /* Return a pointer to the tree node representing the function called by call
  2419. statement GS. */
  2420. static inline tree *
  2421. gimple_call_fn_ptr (gcall *gs)
  2422. {
  2423. return &gs->op[1];
  2424. }
  2425. static inline tree *
  2426. gimple_call_fn_ptr (gimple *gs)
  2427. {
  2428. gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
  2429. return gimple_call_fn_ptr (gc);
  2430. }
  2431. /* Set FN to be the function called by call statement GS. */
  2432. static inline void
  2433. gimple_call_set_fn (gcall *gs, tree fn)
  2434. {
  2435. gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
  2436. gs->op[1] = fn;
  2437. }
  2438. /* Set FNDECL to be the function called by call statement GS. */
  2439. static inline void
  2440. gimple_call_set_fndecl (gcall *gs, tree decl)
  2441. {
  2442. gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
  2443. gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
  2444. build_pointer_type (TREE_TYPE (decl)), decl);
  2445. }
  2446. static inline void
  2447. gimple_call_set_fndecl (gimple *gs, tree decl)
  2448. {
  2449. gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
  2450. gimple_call_set_fndecl (gc, decl);
  2451. }
  2452. /* Set internal function FN to be the function called by call statement CALL_STMT. */
  2453. static inline void
  2454. gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
  2455. {
  2456. gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
  2457. call_stmt->u.internal_fn = fn;
  2458. }
  2459. /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
  2460. Otherwise return NULL. This function is analogous to
  2461. get_callee_fndecl in tree land. */
  2462. static inline tree
  2463. gimple_call_fndecl (const gcall *gs)
  2464. {
  2465. return gimple_call_addr_fndecl (gimple_call_fn (gs));
  2466. }
  2467. static inline tree
  2468. gimple_call_fndecl (const gimple *gs)
  2469. {
  2470. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2471. return gimple_call_fndecl (gc);
  2472. }
  2473. /* Return the type returned by call statement GS. */
  2474. static inline tree
  2475. gimple_call_return_type (const gcall *gs)
  2476. {
  2477. tree type = gimple_call_fntype (gs);
  2478. if (type == NULL_TREE)
  2479. return TREE_TYPE (gimple_call_lhs (gs));
  2480. /* The type returned by a function is the type of its
  2481. function type. */
  2482. return TREE_TYPE (type);
  2483. }
  2484. /* Return the static chain for call statement GS. */
  2485. static inline tree
  2486. gimple_call_chain (const gcall *gs)
  2487. {
  2488. return gs->op[2];
  2489. }
  2490. static inline tree
  2491. gimple_call_chain (const gimple *gs)
  2492. {
  2493. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2494. return gimple_call_chain (gc);
  2495. }
  2496. /* Return a pointer to the static chain for call statement CALL_STMT. */
  2497. static inline tree *
  2498. gimple_call_chain_ptr (gcall *call_stmt)
  2499. {
  2500. return &call_stmt->op[2];
  2501. }
  2502. /* Set CHAIN to be the static chain for call statement CALL_STMT. */
  2503. static inline void
  2504. gimple_call_set_chain (gcall *call_stmt, tree chain)
  2505. {
  2506. call_stmt->op[2] = chain;
  2507. }
  2508. /* Return the number of arguments used by call statement GS. */
  2509. static inline unsigned
  2510. gimple_call_num_args (const gcall *gs)
  2511. {
  2512. return gimple_num_ops (gs) - 3;
  2513. }
  2514. static inline unsigned
  2515. gimple_call_num_args (const gimple *gs)
  2516. {
  2517. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2518. return gimple_call_num_args (gc);
  2519. }
  2520. /* Return the argument at position INDEX for call statement GS. */
  2521. static inline tree
  2522. gimple_call_arg (const gcall *gs, unsigned index)
  2523. {
  2524. gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
  2525. return gs->op[index + 3];
  2526. }
  2527. static inline tree
  2528. gimple_call_arg (const gimple *gs, unsigned index)
  2529. {
  2530. const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
  2531. return gimple_call_arg (gc, index);
  2532. }
  2533. /* Return a pointer to the argument at position INDEX for call
  2534. statement GS. */
  2535. static inline tree *
  2536. gimple_call_arg_ptr (gcall *gs, unsigned index)
  2537. {
  2538. gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
  2539. return &gs->op[index + 3];
  2540. }
  2541. static inline tree *
  2542. gimple_call_arg_ptr (gimple *gs, unsigned index)
  2543. {
  2544. gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
  2545. return gimple_call_arg_ptr (gc, index);
  2546. }
  2547. /* Set ARG to be the argument at position INDEX for call statement GS. */
  2548. static inline void
  2549. gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
  2550. {
  2551. gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
  2552. gs->op[index + 3] = arg;
  2553. }
  2554. static inline void
  2555. gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
  2556. {
  2557. gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
  2558. gimple_call_set_arg (gc, index, arg);
  2559. }
  2560. /* If TAIL_P is true, mark call statement S as being a tail call
  2561. (i.e., a call just before the exit of a function). These calls are
  2562. candidate for tail call optimization. */
  2563. static inline void
  2564. gimple_call_set_tail (gcall *s, bool tail_p)
  2565. {
  2566. if (tail_p)
  2567. s->subcode |= GF_CALL_TAILCALL;
  2568. else
  2569. s->subcode &= ~GF_CALL_TAILCALL;
  2570. }
  2571. /* Return true if GIMPLE_CALL S is marked as a tail call. */
  2572. static inline bool
  2573. gimple_call_tail_p (gcall *s)
  2574. {
  2575. return (s->subcode & GF_CALL_TAILCALL) != 0;
  2576. }
  2577. /* Mark (or clear) call statement S as requiring tail call optimization. */
  2578. static inline void
  2579. gimple_call_set_must_tail (gcall *s, bool must_tail_p)
  2580. {
  2581. if (must_tail_p)
  2582. s->subcode |= GF_CALL_MUST_TAIL_CALL;
  2583. else
  2584. s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
  2585. }
  2586. /* Return true if call statement has been marked as requiring
  2587. tail call optimization. */
  2588. static inline bool
  2589. gimple_call_must_tail_p (const gcall *s)
  2590. {
  2591. return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
  2592. }
  2593. /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
  2594. slot optimization. This transformation uses the target of the call
  2595. expansion as the return slot for calls that return in memory. */
  2596. static inline void
  2597. gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
  2598. {
  2599. if (return_slot_opt_p)
  2600. s->subcode |= GF_CALL_RETURN_SLOT_OPT;
  2601. else
  2602. s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
  2603. }
  2604. /* Return true if S is marked for return slot optimization. */
  2605. static inline bool
  2606. gimple_call_return_slot_opt_p (gcall *s)
  2607. {
  2608. return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
  2609. }
  2610. /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
  2611. thunk to the thunked-to function. */
  2612. static inline void
  2613. gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
  2614. {
  2615. if (from_thunk_p)
  2616. s->subcode |= GF_CALL_FROM_THUNK;
  2617. else
  2618. s->subcode &= ~GF_CALL_FROM_THUNK;
  2619. }
  2620. /* Return true if GIMPLE_CALL S is a jump from a thunk. */
  2621. static inline bool
  2622. gimple_call_from_thunk_p (gcall *s)
  2623. {
  2624. return (s->subcode & GF_CALL_FROM_THUNK) != 0;
  2625. }
  2626. /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
  2627. argument pack in its argument list. */
  2628. static inline void
  2629. gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
  2630. {
  2631. if (pass_arg_pack_p)
  2632. s->subcode |= GF_CALL_VA_ARG_PACK;
  2633. else
  2634. s->subcode &= ~GF_CALL_VA_ARG_PACK;
  2635. }
  2636. /* Return true if GIMPLE_CALL S is a stdarg call that needs the
  2637. argument pack in its argument list. */
  2638. static inline bool
  2639. gimple_call_va_arg_pack_p (gcall *s)
  2640. {
  2641. return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
  2642. }
  2643. /* Return true if S is a noreturn call. */
  2644. static inline bool
  2645. gimple_call_noreturn_p (const gcall *s)
  2646. {
  2647. return (gimple_call_flags (s) & ECF_NORETURN) != 0;
  2648. }
  2649. static inline bool
  2650. gimple_call_noreturn_p (const gimple *s)
  2651. {
  2652. const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
  2653. return gimple_call_noreturn_p (gc);
  2654. }
  2655. /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
  2656. even if the called function can throw in other cases. */
  2657. static inline void
  2658. gimple_call_set_nothrow (gcall *s, bool nothrow_p)
  2659. {
  2660. if (nothrow_p)
  2661. s->subcode |= GF_CALL_NOTHROW;
  2662. else
  2663. s->subcode &= ~GF_CALL_NOTHROW;
  2664. }
  2665. /* Return true if S is a nothrow call. */
  2666. static inline bool
  2667. gimple_call_nothrow_p (gcall *s)
  2668. {
  2669. return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
  2670. }
  2671. /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
  2672. is known to be emitted for VLA objects. Those are wrapped by
  2673. stack_save/stack_restore calls and hence can't lead to unbounded
  2674. stack growth even when they occur in loops. */
  2675. static inline void
  2676. gimple_call_set_alloca_for_var (gcall *s, bool for_var)
  2677. {
  2678. if (for_var)
  2679. s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
  2680. else
  2681. s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
  2682. }
  2683. /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
  2684. static inline bool
  2685. gimple_call_alloca_for_var_p (gcall *s)
  2686. {
  2687. return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
  2688. }
  2689. /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
  2690. pointers to nested function are descriptors instead of trampolines. */
  2691. static inline void
  2692. gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
  2693. {
  2694. if (by_descriptor_p)
  2695. s->subcode |= GF_CALL_BY_DESCRIPTOR;
  2696. else
  2697. s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
  2698. }
  2699. /* Return true if S is a by-descriptor call. */
  2700. static inline bool
  2701. gimple_call_by_descriptor_p (gcall *s)
  2702. {
  2703. return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
  2704. }
  2705. /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
  2706. static inline void
  2707. gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
  2708. {
  2709. dest_call->subcode = orig_call->subcode;
  2710. }
  2711. /* Return a pointer to the points-to solution for the set of call-used
  2712. variables of the call CALL_STMT. */
  2713. static inline struct pt_solution *
  2714. gimple_call_use_set (gcall *call_stmt)
  2715. {
  2716. return &call_stmt->call_used;
  2717. }
  2718. /* Return a pointer to the points-to solution for the set of call-used
  2719. variables of the call CALL_STMT. */
  2720. static inline struct pt_solution *
  2721. gimple_call_clobber_set (gcall *call_stmt)
  2722. {
  2723. return &call_stmt->call_clobbered;
  2724. }
  2725. /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
  2726. non-NULL lhs. */
  2727. static inline bool
  2728. gimple_has_lhs (gimple *stmt)
  2729. {
  2730. if (is_gimple_assign (stmt))
  2731. return true;
  2732. if (gcall *call = dyn_cast <gcall *> (stmt))
  2733. return gimple_call_lhs (call) != NULL_TREE;
  2734. return false;
  2735. }
  2736. /* Return the code of the predicate computed by conditional statement GS. */
  2737. static inline enum tree_code
  2738. gimple_cond_code (const gcond *gs)
  2739. {
  2740. return (enum tree_code) gs->subcode;
  2741. }
  2742. static inline enum tree_code
  2743. gimple_cond_code (const gimple *gs)
  2744. {
  2745. const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
  2746. return gimple_cond_code (gc);
  2747. }
  2748. /* Set CODE to be the predicate code for the conditional statement GS. */
  2749. static inline void
  2750. gimple_cond_set_code (gcond *gs, enum tree_code code)
  2751. {
  2752. gs->subcode = code;
  2753. }
  2754. /* Return the LHS of the predicate computed by conditional statement GS. */
  2755. static inline tree
  2756. gimple_cond_lhs (const gcond *gs)
  2757. {
  2758. return gs->op[0];
  2759. }
  2760. static inline tree
  2761. gimple_cond_lhs (const gimple *gs)
  2762. {
  2763. const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
  2764. return gimple_cond_lhs (gc);
  2765. }
  2766. /* Return the pointer to the LHS of the predicate computed by conditional
  2767. statement GS. */
  2768. static inline tree *
  2769. gimple_cond_lhs_ptr (gcond *gs)
  2770. {
  2771. return &gs->op[0];
  2772. }
  2773. /* Set LHS to be the LHS operand of the predicate computed by
  2774. conditional statement GS. */
  2775. static inline void
  2776. gimple_cond_set_lhs (gcond *gs, tree lhs)
  2777. {
  2778. gs->op[0] = lhs;
  2779. }
  2780. /* Return the RHS operand of the predicate computed by conditional GS. */
  2781. static inline tree
  2782. gimple_cond_rhs (const gcond *gs)
  2783. {
  2784. return gs->op[1];
  2785. }
  2786. static inline tree
  2787. gimple_cond_rhs (const gimple *gs)
  2788. {
  2789. const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
  2790. return gimple_cond_rhs (gc);
  2791. }
  2792. /* Return the pointer to the RHS operand of the predicate computed by
  2793. conditional GS. */
  2794. static inline tree *
  2795. gimple_cond_rhs_ptr (gcond *gs)
  2796. {
  2797. return &gs->op[1];
  2798. }
  2799. /* Set RHS to be the RHS operand of the predicate computed by
  2800. conditional statement GS. */
  2801. static inline void
  2802. gimple_cond_set_rhs (gcond *gs, tree rhs)
  2803. {
  2804. gs->op[1] = rhs;
  2805. }
  2806. /* Return the label used by conditional statement GS when its
  2807. predicate evaluates to true. */
  2808. static inline tree
  2809. gimple_cond_true_label (const gcond *gs)
  2810. {
  2811. return gs->op[2];
  2812. }
  2813. /* Set LABEL to be the label used by conditional statement GS when its
  2814. predicate evaluates to true. */
  2815. static inline void
  2816. gimple_cond_set_true_label (gcond *gs, tree label)
  2817. {
  2818. gs->op[2] = label;
  2819. }
  2820. /* Set LABEL to be the label used by conditional statement GS when its
  2821. predicate evaluates to false. */
  2822. static inline void
  2823. gimple_cond_set_false_label (gcond *gs, tree label)
  2824. {
  2825. gs->op[3] = label;
  2826. }
  2827. /* Return the label used by conditional statement GS when its
  2828. predicate evaluates to false. */
  2829. static inline tree
  2830. gimple_cond_false_label (const gcond *gs)
  2831. {
  2832. return gs->op[3];
  2833. }
  2834. /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
  2835. static inline void
  2836. gimple_cond_make_false (gcond *gs)
  2837. {
  2838. gimple_cond_set_lhs (gs, boolean_false_node);
  2839. gimple_cond_set_rhs (gs, boolean_false_node);
  2840. gs->subcode = NE_EXPR;
  2841. }
  2842. /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
  2843. static inline void
  2844. gimple_cond_make_true (gcond *gs)
  2845. {
  2846. gimple_cond_set_lhs (gs, boolean_true_node);
  2847. gimple_cond_set_rhs (gs, boolean_false_node);
  2848. gs->subcode = NE_EXPR;
  2849. }
  2850. /* Check if conditional statemente GS is of the form 'if (1 == 1)',
  2851. 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
  2852. static inline bool
  2853. gimple_cond_true_p (const gcond *gs)
  2854. {
  2855. tree lhs = gimple_cond_lhs (gs);
  2856. tree rhs = gimple_cond_rhs (gs);
  2857. enum tree_code code = gimple_cond_code (gs);
  2858. if (lhs != boolean_true_node && lhs != boolean_false_node)
  2859. return false;
  2860. if (rhs != boolean_true_node && rhs != boolean_false_node)
  2861. return false;
  2862. if (code == NE_EXPR && lhs != rhs)
  2863. return true;
  2864. if (code == EQ_EXPR && lhs == rhs)
  2865. return true;
  2866. return false;
  2867. }
  2868. /* Check if conditional statement GS is of the form 'if (1 != 1)',
  2869. 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
  2870. static inline bool
  2871. gimple_cond_false_p (const gcond *gs)
  2872. {
  2873. tree lhs = gimple_cond_lhs (gs);
  2874. tree rhs = gimple_cond_rhs (gs);
  2875. enum tree_code code = gimple_cond_code (gs);
  2876. if (lhs != boolean_true_node && lhs != boolean_false_node)
  2877. return false;
  2878. if (rhs != boolean_true_node && rhs != boolean_false_node)
  2879. return false;
  2880. if (code == NE_EXPR && lhs == rhs)
  2881. return true;
  2882. if (code == EQ_EXPR && lhs != rhs)
  2883. return true;
  2884. return false;
  2885. }
  2886. /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
  2887. static inline void
  2888. gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
  2889. tree rhs)
  2890. {
  2891. gimple_cond_set_code (stmt, code);
  2892. gimple_cond_set_lhs (stmt, lhs);
  2893. gimple_cond_set_rhs (stmt, rhs);
  2894. }
  2895. /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
  2896. static inline tree
  2897. gimple_label_label (const glabel *gs)
  2898. {
  2899. return gs->op[0];
  2900. }
  2901. /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
  2902. GS. */
  2903. static inline void
  2904. gimple_label_set_label (glabel *gs, tree label)
  2905. {
  2906. gs->op[0] = label;
  2907. }
  2908. /* Return the destination of the unconditional jump GS. */
  2909. static inline tree
  2910. gimple_goto_dest (const gimple *gs)
  2911. {
  2912. GIMPLE_CHECK (gs, GIMPLE_GOTO);
  2913. return gimple_op (gs, 0);
  2914. }
  2915. /* Set DEST to be the destination of the unconditonal jump GS. */
  2916. static inline void
  2917. gimple_goto_set_dest (ggoto *gs, tree dest)
  2918. {
  2919. gs->op[0] = dest;
  2920. }
  2921. /* Return the variables declared in the GIMPLE_BIND statement GS. */
  2922. static inline tree
  2923. gimple_bind_vars (const gbind *bind_stmt)
  2924. {
  2925. return bind_stmt->vars;
  2926. }
  2927. /* Set VARS to be the set of variables declared in the GIMPLE_BIND
  2928. statement GS. */
  2929. static inline void
  2930. gimple_bind_set_vars (gbind *bind_stmt, tree vars)
  2931. {
  2932. bind_stmt->vars = vars;
  2933. }
  2934. /* Append VARS to the set of variables declared in the GIMPLE_BIND
  2935. statement GS. */
  2936. static inline void
  2937. gimple_bind_append_vars (gbind *bind_stmt, tree vars)
  2938. {
  2939. bind_stmt->vars = chainon (bind_stmt->vars, vars);
  2940. }
  2941. static inline gimple_seq *
  2942. gimple_bind_body_ptr (gbind *bind_stmt)
  2943. {
  2944. return &bind_stmt->body;
  2945. }
  2946. /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
  2947. static inline gimple_seq
  2948. gimple_bind_body (gbind *gs)
  2949. {
  2950. return *gimple_bind_body_ptr (gs);
  2951. }
  2952. /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
  2953. statement GS. */
  2954. static inline void
  2955. gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
  2956. {
  2957. bind_stmt->body = seq;
  2958. }
  2959. /* Append a statement to the end of a GIMPLE_BIND's body. */
  2960. static inline void
  2961. gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
  2962. {
  2963. gimple_seq_add_stmt (&bind_stmt->body, stmt);
  2964. }
  2965. /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
  2966. static inline void
  2967. gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
  2968. {
  2969. gimple_seq_add_seq (&bind_stmt->body, seq);
  2970. }
  2971. /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
  2972. GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
  2973. static inline tree
  2974. gimple_bind_block (const gbind *bind_stmt)
  2975. {
  2976. return bind_stmt->block;
  2977. }
  2978. /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
  2979. statement GS. */
  2980. static inline void
  2981. gimple_bind_set_block (gbind *bind_stmt, tree block)
  2982. {
  2983. gcc_gimple_checking_assert (block == NULL_TREE
  2984. || TREE_CODE (block) == BLOCK);
  2985. bind_stmt->block = block;
  2986. }
  2987. /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
  2988. static inline unsigned
  2989. gimple_asm_ninputs (const gasm *asm_stmt)
  2990. {
  2991. return asm_stmt->ni;
  2992. }
  2993. /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
  2994. static inline unsigned
  2995. gimple_asm_noutputs (const gasm *asm_stmt)
  2996. {
  2997. return asm_stmt->no;
  2998. }
  2999. /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
  3000. static inline unsigned
  3001. gimple_asm_nclobbers (const gasm *asm_stmt)
  3002. {
  3003. return asm_stmt->nc;
  3004. }
  3005. /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
  3006. static inline unsigned
  3007. gimple_asm_nlabels (const gasm *asm_stmt)
  3008. {
  3009. return asm_stmt->nl;
  3010. }
  3011. /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
  3012. static inline tree
  3013. gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
  3014. {
  3015. gcc_gimple_checking_assert (index < asm_stmt->ni);
  3016. return asm_stmt->op[index + asm_stmt->no];
  3017. }
  3018. /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
  3019. static inline void
  3020. gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
  3021. {
  3022. gcc_gimple_checking_assert (index < asm_stmt->ni
  3023. && TREE_CODE (in_op) == TREE_LIST);
  3024. asm_stmt->op[index + asm_stmt->no] = in_op;
  3025. }
  3026. /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
  3027. static inline tree
  3028. gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
  3029. {
  3030. gcc_gimple_checking_assert (index < asm_stmt->no);
  3031. return asm_stmt->op[index];
  3032. }
  3033. /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
  3034. static inline void
  3035. gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
  3036. {
  3037. gcc_gimple_checking_assert (index < asm_stmt->no
  3038. && TREE_CODE (out_op) == TREE_LIST);
  3039. asm_stmt->op[index] = out_op;
  3040. }
  3041. /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
  3042. static inline tree
  3043. gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
  3044. {
  3045. gcc_gimple_checking_assert (index < asm_stmt->nc);
  3046. return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
  3047. }
  3048. /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
  3049. static inline void
  3050. gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
  3051. {
  3052. gcc_gimple_checking_assert (index < asm_stmt->nc
  3053. && TREE_CODE (clobber_op) == TREE_LIST);
  3054. asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
  3055. }
  3056. /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
  3057. static inline tree
  3058. gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
  3059. {
  3060. gcc_gimple_checking_assert (index < asm_stmt->nl);
  3061. return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
  3062. }
  3063. /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
  3064. static inline void
  3065. gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
  3066. {
  3067. gcc_gimple_checking_assert (index < asm_stmt->nl
  3068. && TREE_CODE (label_op) == TREE_LIST);
  3069. asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
  3070. }
  3071. /* Return the string representing the assembly instruction in
  3072. GIMPLE_ASM ASM_STMT. */
  3073. static inline const char *
  3074. gimple_asm_string (const gasm *asm_stmt)
  3075. {
  3076. return asm_stmt->string;
  3077. }
  3078. /* Return true if ASM_STMT is marked volatile. */
  3079. static inline bool
  3080. gimple_asm_volatile_p (const gasm *asm_stmt)
  3081. {
  3082. return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
  3083. }
  3084. /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
  3085. static inline void
  3086. gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
  3087. {
  3088. if (volatile_p)
  3089. asm_stmt->subcode |= GF_ASM_VOLATILE;
  3090. else
  3091. asm_stmt->subcode &= ~GF_ASM_VOLATILE;
  3092. }
  3093. /* Return true if ASM_STMT is marked inline. */
  3094. static inline bool
  3095. gimple_asm_inline_p (const gasm *asm_stmt)
  3096. {
  3097. return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
  3098. }
  3099. /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
  3100. static inline void
  3101. gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
  3102. {
  3103. if (inline_p)
  3104. asm_stmt->subcode |= GF_ASM_INLINE;
  3105. else
  3106. asm_stmt->subcode &= ~GF_ASM_INLINE;
  3107. }
  3108. /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
  3109. static inline void
  3110. gimple_asm_set_input (gasm *asm_stmt, bool input_p)
  3111. {
  3112. if (input_p)
  3113. asm_stmt->subcode |= GF_ASM_INPUT;
  3114. else
  3115. asm_stmt->subcode &= ~GF_ASM_INPUT;
  3116. }
  3117. /* Return true if asm ASM_STMT is an ASM_INPUT. */
  3118. static inline bool
  3119. gimple_asm_input_p (const gasm *asm_stmt)
  3120. {
  3121. return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
  3122. }
  3123. /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
  3124. static inline tree
  3125. gimple_catch_types (const gcatch *catch_stmt)
  3126. {
  3127. return catch_stmt->types;
  3128. }
  3129. /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
  3130. static inline tree *
  3131. gimple_catch_types_ptr (gcatch *catch_stmt)
  3132. {
  3133. return &catch_stmt->types;
  3134. }
  3135. /* Return a pointer to the GIMPLE sequence representing the body of
  3136. the handler of GIMPLE_CATCH statement CATCH_STMT. */
  3137. static inline gimple_seq *
  3138. gimple_catch_handler_ptr (gcatch *catch_stmt)
  3139. {
  3140. return &catch_stmt->handler;
  3141. }
  3142. /* Return the GIMPLE sequence representing the body of the handler of
  3143. GIMPLE_CATCH statement CATCH_STMT. */
  3144. static inline gimple_seq
  3145. gimple_catch_handler (gcatch *catch_stmt)
  3146. {
  3147. return *gimple_catch_handler_ptr (catch_stmt);
  3148. }
  3149. /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
  3150. static inline void
  3151. gimple_catch_set_types (gcatch *catch_stmt, tree t)
  3152. {
  3153. catch_stmt->types = t;
  3154. }
  3155. /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
  3156. static inline void
  3157. gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
  3158. {
  3159. catch_stmt->handler = handler;
  3160. }
  3161. /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
  3162. static inline tree
  3163. gimple_eh_filter_types (const gimple *gs)
  3164. {
  3165. const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
  3166. return eh_filter_stmt->types;
  3167. }
  3168. /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
  3169. GS. */
  3170. static inline tree *
  3171. gimple_eh_filter_types_ptr (gimple *gs)
  3172. {
  3173. geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
  3174. return &eh_filter_stmt->types;
  3175. }
  3176. /* Return a pointer to the sequence of statement to execute when
  3177. GIMPLE_EH_FILTER statement fails. */
  3178. static inline gimple_seq *
  3179. gimple_eh_filter_failure_ptr (gimple *gs)
  3180. {
  3181. geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
  3182. return &eh_filter_stmt->failure;
  3183. }
  3184. /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
  3185. statement fails. */
  3186. static inline gimple_seq
  3187. gimple_eh_filter_failure (gimple *gs)
  3188. {
  3189. return *gimple_eh_filter_failure_ptr (gs);
  3190. }
  3191. /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
  3192. EH_FILTER_STMT. */
  3193. static inline void
  3194. gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
  3195. {
  3196. eh_filter_stmt->types = types;
  3197. }
  3198. /* Set FAILURE to be the sequence of statements to execute on failure
  3199. for GIMPLE_EH_FILTER EH_FILTER_STMT. */
  3200. static inline void
  3201. gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
  3202. gimple_seq failure)
  3203. {
  3204. eh_filter_stmt->failure = failure;
  3205. }
  3206. /* Get the function decl to be called by the MUST_NOT_THROW region. */
  3207. static inline tree
  3208. gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
  3209. {
  3210. return eh_mnt_stmt->fndecl;
  3211. }
  3212. /* Set the function decl to be called by GS to DECL. */
  3213. static inline void
  3214. gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
  3215. tree decl)
  3216. {
  3217. eh_mnt_stmt->fndecl = decl;
  3218. }
  3219. /* GIMPLE_EH_ELSE accessors. */
  3220. static inline gimple_seq *
  3221. gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
  3222. {
  3223. return &eh_else_stmt->n_body;
  3224. }
  3225. static inline gimple_seq
  3226. gimple_eh_else_n_body (geh_else *eh_else_stmt)
  3227. {
  3228. return *gimple_eh_else_n_body_ptr (eh_else_stmt);
  3229. }
  3230. static inline gimple_seq *
  3231. gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
  3232. {
  3233. return &eh_else_stmt->e_body;
  3234. }
  3235. static inline gimple_seq
  3236. gimple_eh_else_e_body (geh_else *eh_else_stmt)
  3237. {
  3238. return *gimple_eh_else_e_body_ptr (eh_else_stmt);
  3239. }
  3240. static inline void
  3241. gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
  3242. {
  3243. eh_else_stmt->n_body = seq;
  3244. }
  3245. static inline void
  3246. gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
  3247. {
  3248. eh_else_stmt->e_body = seq;
  3249. }
  3250. /* GIMPLE_TRY accessors. */
  3251. /* Return the kind of try block represented by GIMPLE_TRY GS. This is
  3252. either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
  3253. static inline enum gimple_try_flags
  3254. gimple_try_kind (const gimple *gs)
  3255. {
  3256. GIMPLE_CHECK (gs, GIMPLE_TRY);
  3257. return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
  3258. }
  3259. /* Set the kind of try block represented by GIMPLE_TRY GS. */
  3260. static inline void
  3261. gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
  3262. {
  3263. gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
  3264. || kind == GIMPLE_TRY_FINALLY);
  3265. if (gimple_try_kind (gs) != kind)
  3266. gs->subcode = (unsigned int) kind;
  3267. }
  3268. /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
  3269. static inline bool
  3270. gimple_try_catch_is_cleanup (const gimple *gs)
  3271. {
  3272. gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
  3273. return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
  3274. }
  3275. /* Return a pointer to the sequence of statements used as the
  3276. body for GIMPLE_TRY GS. */
  3277. static inline gimple_seq *
  3278. gimple_try_eval_ptr (gimple *gs)
  3279. {
  3280. gtry *try_stmt = as_a <gtry *> (gs);
  3281. return &try_stmt->eval;
  3282. }
  3283. /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
  3284. static inline gimple_seq
  3285. gimple_try_eval (gimple *gs)
  3286. {
  3287. return *gimple_try_eval_ptr (gs);
  3288. }
  3289. /* Return a pointer to the sequence of statements used as the cleanup body for
  3290. GIMPLE_TRY GS. */
  3291. static inline gimple_seq *
  3292. gimple_try_cleanup_ptr (gimple *gs)
  3293. {
  3294. gtry *try_stmt = as_a <gtry *> (gs);
  3295. return &try_stmt->cleanup;
  3296. }
  3297. /* Return the sequence of statements used as the cleanup body for
  3298. GIMPLE_TRY GS. */
  3299. static inline gimple_seq
  3300. gimple_try_cleanup (gimple *gs)
  3301. {
  3302. return *gimple_try_cleanup_ptr (gs);
  3303. }
  3304. /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
  3305. static inline void
  3306. gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
  3307. {
  3308. gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
  3309. if (catch_is_cleanup)
  3310. g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
  3311. else
  3312. g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
  3313. }
  3314. /* Set EVAL to be the sequence of statements to use as the body for
  3315. GIMPLE_TRY TRY_STMT. */
  3316. static inline void
  3317. gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
  3318. {
  3319. try_stmt->eval = eval;
  3320. }
  3321. /* Set CLEANUP to be the sequence of statements to use as the cleanup
  3322. body for GIMPLE_TRY TRY_STMT. */
  3323. static inline void
  3324. gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
  3325. {
  3326. try_stmt->cleanup = cleanup;
  3327. }
  3328. /* Return a pointer to the cleanup sequence for cleanup statement GS. */
  3329. static inline gimple_seq *
  3330. gimple_wce_cleanup_ptr (gimple *gs)
  3331. {
  3332. gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
  3333. return &wce_stmt->cleanup;
  3334. }
  3335. /* Return the cleanup sequence for cleanup statement GS. */
  3336. static inline gimple_seq
  3337. gimple_wce_cleanup (gimple *gs)
  3338. {
  3339. return *gimple_wce_cleanup_ptr (gs);
  3340. }
  3341. /* Set CLEANUP to be the cleanup sequence for GS. */
  3342. static inline void
  3343. gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
  3344. {
  3345. gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
  3346. wce_stmt->cleanup = cleanup;
  3347. }
  3348. /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
  3349. static inline bool
  3350. gimple_wce_cleanup_eh_only (const gimple *gs)
  3351. {
  3352. GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
  3353. return gs->subcode != 0;
  3354. }
  3355. /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
  3356. static inline void
  3357. gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
  3358. {
  3359. GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
  3360. gs->subcode = (unsigned int) eh_only_p;
  3361. }
  3362. /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
  3363. static inline unsigned
  3364. gimple_phi_capacity (const gimple *gs)
  3365. {
  3366. const gphi *phi_stmt = as_a <const gphi *> (gs);
  3367. return phi_stmt->capacity;
  3368. }
  3369. /* Return the number of arguments in GIMPLE_PHI GS. This must always
  3370. be exactly the number of incoming edges for the basic block holding
  3371. GS. */
  3372. static inline unsigned
  3373. gimple_phi_num_args (const gimple *gs)
  3374. {
  3375. const gphi *phi_stmt = as_a <const gphi *> (gs);
  3376. return phi_stmt->nargs;
  3377. }
  3378. /* Return the SSA name created by GIMPLE_PHI GS. */
  3379. static inline tree
  3380. gimple_phi_result (const gphi *gs)
  3381. {
  3382. return gs->result;
  3383. }
  3384. static inline tree
  3385. gimple_phi_result (const gimple *gs)
  3386. {
  3387. const gphi *phi_stmt = as_a <const gphi *> (gs);
  3388. return gimple_phi_result (phi_stmt);
  3389. }
  3390. /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
  3391. static inline tree *
  3392. gimple_phi_result_ptr (gphi *gs)
  3393. {
  3394. return &gs->result;
  3395. }
  3396. static inline tree *
  3397. gimple_phi_result_ptr (gimple *gs)
  3398. {
  3399. gphi *phi_stmt = as_a <gphi *> (gs);
  3400. return gimple_phi_result_ptr (phi_stmt);
  3401. }
  3402. /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
  3403. static inline void
  3404. gimple_phi_set_result (gphi *phi, tree result)
  3405. {
  3406. phi->result = result;
  3407. if (result && TREE_CODE (result) == SSA_NAME)
  3408. SSA_NAME_DEF_STMT (result) = phi;
  3409. }
  3410. /* Return the PHI argument corresponding to incoming edge INDEX for
  3411. GIMPLE_PHI GS. */
  3412. static inline struct phi_arg_d *
  3413. gimple_phi_arg (gphi *gs, unsigned index)
  3414. {
  3415. gcc_gimple_checking_assert (index < gs->nargs);
  3416. return &(gs->args[index]);
  3417. }
  3418. static inline struct phi_arg_d *
  3419. gimple_phi_arg (gimple *gs, unsigned index)
  3420. {
  3421. gphi *phi_stmt = as_a <gphi *> (gs);
  3422. return gimple_phi_arg (phi_stmt, index);
  3423. }
  3424. /* Set PHIARG to be the argument corresponding to incoming edge INDEX
  3425. for GIMPLE_PHI PHI. */
  3426. static inline void
  3427. gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
  3428. {
  3429. gcc_gimple_checking_assert (index < phi->nargs);
  3430. phi->args[index] = *phiarg;
  3431. }
  3432. /* Return the PHI nodes for basic block BB, or NULL if there are no
  3433. PHI nodes. */
  3434. static inline gimple_seq
  3435. phi_nodes (const_basic_block bb)
  3436. {
  3437. gcc_checking_assert (!(bb->flags & BB_RTL));
  3438. return bb->il.gimple.phi_nodes;
  3439. }
  3440. /* Return a pointer to the PHI nodes for basic block BB. */
  3441. static inline gimple_seq *
  3442. phi_nodes_ptr (basic_block bb)
  3443. {
  3444. gcc_checking_assert (!(bb->flags & BB_RTL));
  3445. return &bb->il.gimple.phi_nodes;
  3446. }
  3447. /* Return the tree operand for argument I of PHI node GS. */
  3448. static inline tree
  3449. gimple_phi_arg_def (gphi *gs, size_t index)
  3450. {
  3451. return gimple_phi_arg (gs, index)->def;
  3452. }
  3453. static inline tree
  3454. gimple_phi_arg_def (gimple *gs, size_t index)
  3455. {
  3456. return gimple_phi_arg (gs, index)->def;
  3457. }
  3458. /* Return a pointer to the tree operand for argument I of phi node PHI. */
  3459. static inline tree *
  3460. gimple_phi_arg_def_ptr (gphi *phi, size_t index)
  3461. {
  3462. return &gimple_phi_arg (phi, index)->def;
  3463. }
  3464. /* Return the edge associated with argument I of phi node PHI. */
  3465. static inline edge
  3466. gimple_phi_arg_edge (gphi *phi, size_t i)
  3467. {
  3468. return EDGE_PRED (gimple_bb (phi), i);
  3469. }
  3470. /* Return the source location of gimple argument I of phi node PHI. */
  3471. static inline location_t
  3472. gimple_phi_arg_location (gphi *phi, size_t i)
  3473. {
  3474. return gimple_phi_arg (phi, i)->locus;
  3475. }
  3476. /* Return the source location of the argument on edge E of phi node PHI. */
  3477. static inline location_t
  3478. gimple_phi_arg_location_from_edge (gphi *phi, edge e)
  3479. {
  3480. return gimple_phi_arg (phi, e->dest_idx)->locus;
  3481. }
  3482. /* Set the source location of gimple argument I of phi node PHI to LOC. */
  3483. static inline void
  3484. gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
  3485. {
  3486. gimple_phi_arg (phi, i)->locus = loc;
  3487. }
  3488. /* Return TRUE if argument I of phi node PHI has a location record. */
  3489. static inline bool
  3490. gimple_phi_arg_has_location (gphi *phi, size_t i)
  3491. {
  3492. return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
  3493. }
  3494. /* Return the region number for GIMPLE_RESX RESX_STMT. */
  3495. static inline int
  3496. gimple_resx_region (const gresx *resx_stmt)
  3497. {
  3498. return resx_stmt->region;
  3499. }
  3500. /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
  3501. static inline void
  3502. gimple_resx_set_region (gresx *resx_stmt, int region)
  3503. {
  3504. resx_stmt->region = region;
  3505. }
  3506. /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
  3507. static inline int
  3508. gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
  3509. {
  3510. return eh_dispatch_stmt->region;
  3511. }
  3512. /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
  3513. EH_DISPATCH_STMT. */
  3514. static inline void
  3515. gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
  3516. {
  3517. eh_dispatch_stmt->region = region;
  3518. }
  3519. /* Return the number of labels associated with the switch statement GS. */
  3520. static inline unsigned
  3521. gimple_switch_num_labels (const gswitch *gs)
  3522. {
  3523. unsigned num_ops;
  3524. GIMPLE_CHECK (gs, GIMPLE_SWITCH);
  3525. num_ops = gimple_num_ops (gs);
  3526. gcc_gimple_checking_assert (num_ops > 1);
  3527. return num_ops - 1;
  3528. }
  3529. /* Set NLABELS to be the number of labels for the switch statement GS. */
  3530. static inline void
  3531. gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
  3532. {
  3533. GIMPLE_CHECK (g, GIMPLE_SWITCH);
  3534. gimple_set_num_ops (g, nlabels + 1);
  3535. }
  3536. /* Return the index variable used by the switch statement GS. */
  3537. static inline tree
  3538. gimple_switch_index (const gswitch *gs)
  3539. {
  3540. return gs->op[0];
  3541. }
  3542. /* Return a pointer to the index variable for the switch statement GS. */
  3543. static inline tree *
  3544. gimple_switch_index_ptr (gswitch *gs)
  3545. {
  3546. return &gs->op[0];
  3547. }
  3548. /* Set INDEX to be the index variable for switch statement GS. */
  3549. static inline void
  3550. gimple_switch_set_index (gswitch *gs, tree index)
  3551. {
  3552. gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
  3553. gs->op[0] = index;
  3554. }
  3555. /* Return the label numbered INDEX. The default label is 0, followed by any
  3556. labels in a switch statement. */
  3557. static inline tree
  3558. gimple_switch_label (const gswitch *gs, unsigned index)
  3559. {
  3560. gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
  3561. return gs->op[index + 1];
  3562. }
  3563. /* Set the label number INDEX to LABEL. 0 is always the default label. */
  3564. static inline void
  3565. gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
  3566. {
  3567. gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
  3568. && (label == NULL_TREE
  3569. || TREE_CODE (label) == CASE_LABEL_EXPR));
  3570. gs->op[index + 1] = label;
  3571. }
  3572. /* Return the default label for a switch statement. */
  3573. static inline tree
  3574. gimple_switch_default_label (const gswitch *gs)
  3575. {
  3576. tree label = gimple_switch_label (gs, 0);
  3577. gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
  3578. return label;
  3579. }
  3580. /* Set the default label for a switch statement. */
  3581. static inline void
  3582. gimple_switch_set_default_label (gswitch *gs, tree label)
  3583. {
  3584. gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
  3585. gimple_switch_set_label (gs, 0, label);
  3586. }
  3587. /* Return true if GS is a GIMPLE_DEBUG statement. */
  3588. static inline bool
  3589. is_gimple_debug (const gimple *gs)
  3590. {
  3591. return gimple_code (gs) == GIMPLE_DEBUG;
  3592. }
  3593. /* Return the last nondebug statement in GIMPLE sequence S. */
  3594. static inline gimple *
  3595. gimple_seq_last_nondebug_stmt (gimple_seq s)
  3596. {
  3597. gimple_seq_node n;
  3598. for (n = gimple_seq_last (s);
  3599. n && is_gimple_debug (n);
  3600. n = n->prev)
  3601. if (n->prev == s)
  3602. return NULL;
  3603. return n;
  3604. }
  3605. /* Return true if S is a GIMPLE_DEBUG BIND statement. */
  3606. static inline bool
  3607. gimple_debug_bind_p (const gimple *s)
  3608. {
  3609. if (is_gimple_debug (s))
  3610. return s->subcode == GIMPLE_DEBUG_BIND;
  3611. return false;
  3612. }
  3613. /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
  3614. static inline tree
  3615. gimple_debug_bind_get_var (gimple *dbg)
  3616. {
  3617. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3618. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3619. return gimple_op (dbg, 0);
  3620. }
  3621. /* Return the value bound to the variable in a GIMPLE_DEBUG bind
  3622. statement. */
  3623. static inline tree
  3624. gimple_debug_bind_get_value (gimple *dbg)
  3625. {
  3626. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3627. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3628. return gimple_op (dbg, 1);
  3629. }
  3630. /* Return a pointer to the value bound to the variable in a
  3631. GIMPLE_DEBUG bind statement. */
  3632. static inline tree *
  3633. gimple_debug_bind_get_value_ptr (gimple *dbg)
  3634. {
  3635. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3636. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3637. return gimple_op_ptr (dbg, 1);
  3638. }
  3639. /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
  3640. static inline void
  3641. gimple_debug_bind_set_var (gimple *dbg, tree var)
  3642. {
  3643. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3644. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3645. gimple_set_op (dbg, 0, var);
  3646. }
  3647. /* Set the value bound to the variable in a GIMPLE_DEBUG bind
  3648. statement. */
  3649. static inline void
  3650. gimple_debug_bind_set_value (gimple *dbg, tree value)
  3651. {
  3652. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3653. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3654. gimple_set_op (dbg, 1, value);
  3655. }
  3656. /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
  3657. optimized away. */
  3658. #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
  3659. /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
  3660. statement. */
  3661. static inline void
  3662. gimple_debug_bind_reset_value (gimple *dbg)
  3663. {
  3664. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3665. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3666. gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
  3667. }
  3668. /* Return true if the GIMPLE_DEBUG bind statement is bound to a
  3669. value. */
  3670. static inline bool
  3671. gimple_debug_bind_has_value_p (gimple *dbg)
  3672. {
  3673. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3674. gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
  3675. return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
  3676. }
  3677. #undef GIMPLE_DEBUG_BIND_NOVALUE
  3678. /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
  3679. static inline bool
  3680. gimple_debug_source_bind_p (const gimple *s)
  3681. {
  3682. if (is_gimple_debug (s))
  3683. return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
  3684. return false;
  3685. }
  3686. /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
  3687. static inline tree
  3688. gimple_debug_source_bind_get_var (gimple *dbg)
  3689. {
  3690. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3691. gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
  3692. return gimple_op (dbg, 0);
  3693. }
  3694. /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
  3695. statement. */
  3696. static inline tree
  3697. gimple_debug_source_bind_get_value (gimple *dbg)
  3698. {
  3699. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3700. gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
  3701. return gimple_op (dbg, 1);
  3702. }
  3703. /* Return a pointer to the value bound to the variable in a
  3704. GIMPLE_DEBUG source bind statement. */
  3705. static inline tree *
  3706. gimple_debug_source_bind_get_value_ptr (gimple *dbg)
  3707. {
  3708. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3709. gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
  3710. return gimple_op_ptr (dbg, 1);
  3711. }
  3712. /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
  3713. static inline void
  3714. gimple_debug_source_bind_set_var (gimple *dbg, tree var)
  3715. {
  3716. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3717. gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
  3718. gimple_set_op (dbg, 0, var);
  3719. }
  3720. /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
  3721. statement. */
  3722. static inline void
  3723. gimple_debug_source_bind_set_value (gimple *dbg, tree value)
  3724. {
  3725. GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
  3726. gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
  3727. gimple_set_op (dbg, 1, value);
  3728. }
  3729. /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
  3730. static inline bool
  3731. gimple_debug_begin_stmt_p (const gimple *s)
  3732. {
  3733. if (is_gimple_debug (s))
  3734. return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
  3735. return false;
  3736. }
  3737. /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
  3738. static inline bool
  3739. gimple_debug_inline_entry_p (const gimple *s)
  3740. {
  3741. if (is_gimple_debug (s))
  3742. return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
  3743. return false;
  3744. }
  3745. /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
  3746. static inline bool
  3747. gimple_debug_nonbind_marker_p (const gimple *s)
  3748. {
  3749. if (is_gimple_debug (s))
  3750. return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
  3751. || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
  3752. return false;
  3753. }
  3754. /* Return the line number for EXPR, or return -1 if we have no line
  3755. number information for it. */
  3756. static inline int
  3757. get_lineno (const gimple *stmt)
  3758. {
  3759. location_t loc;
  3760. if (!stmt)
  3761. return -1;
  3762. loc = gimple_location (stmt);
  3763. if (loc == UNKNOWN_LOCATION)
  3764. return -1;
  3765. return LOCATION_LINE (loc);
  3766. }
  3767. /* Return a pointer to the body for the OMP statement GS. */
  3768. static inline gimple_seq *
  3769. gimple_omp_body_ptr (gimple *gs)
  3770. {
  3771. return &static_cast <gimple_statement_omp *> (gs)->body;
  3772. }
  3773. /* Return the body for the OMP statement GS. */
  3774. static inline gimple_seq
  3775. gimple_omp_body (gimple *gs)
  3776. {
  3777. return *gimple_omp_body_ptr (gs);
  3778. }
  3779. /* Set BODY to be the body for the OMP statement GS. */
  3780. static inline void
  3781. gimple_omp_set_body (gimple *gs, gimple_seq body)
  3782. {
  3783. static_cast <gimple_statement_omp *> (gs)->body = body;
  3784. }
  3785. /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
  3786. static inline tree
  3787. gimple_omp_critical_name (const gomp_critical *crit_stmt)
  3788. {
  3789. return crit_stmt->name;
  3790. }
  3791. /* Return a pointer to the name associated with OMP critical statement
  3792. CRIT_STMT. */
  3793. static inline tree *
  3794. gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
  3795. {
  3796. return &crit_stmt->name;
  3797. }
  3798. /* Set NAME to be the name associated with OMP critical statement
  3799. CRIT_STMT. */
  3800. static inline void
  3801. gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
  3802. {
  3803. crit_stmt->name = name;
  3804. }
  3805. /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
  3806. static inline tree
  3807. gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
  3808. {
  3809. return crit_stmt->clauses;
  3810. }
  3811. /* Return a pointer to the clauses associated with OMP critical statement
  3812. CRIT_STMT. */
  3813. static inline tree *
  3814. gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
  3815. {
  3816. return &crit_stmt->clauses;
  3817. }
  3818. /* Set CLAUSES to be the clauses associated with OMP critical statement
  3819. CRIT_STMT. */
  3820. static inline void
  3821. gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
  3822. {
  3823. crit_stmt->clauses = clauses;
  3824. }
  3825. /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
  3826. static inline tree
  3827. gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
  3828. {
  3829. return ord_stmt->clauses;
  3830. }
  3831. /* Return a pointer to the clauses associated with OMP ordered statement
  3832. ORD_STMT. */
  3833. static inline tree *
  3834. gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
  3835. {
  3836. return &ord_stmt->clauses;
  3837. }
  3838. /* Set CLAUSES to be the clauses associated with OMP ordered statement
  3839. ORD_STMT. */
  3840. static inline void
  3841. gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
  3842. {
  3843. ord_stmt->clauses = clauses;
  3844. }
  3845. /* Return the clauses associated with OMP_TASKGROUP statement GS. */
  3846. static inline tree
  3847. gimple_omp_taskgroup_clauses (const gimple *gs)
  3848. {
  3849. GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
  3850. return
  3851. static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
  3852. }
  3853. /* Return a pointer to the clauses associated with OMP taskgroup statement
  3854. GS. */
  3855. static inline tree *
  3856. gimple_omp_taskgroup_clauses_ptr (gimple *gs)
  3857. {
  3858. GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
  3859. return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
  3860. }
  3861. /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
  3862. GS. */
  3863. static inline void
  3864. gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
  3865. {
  3866. GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
  3867. static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
  3868. = clauses;
  3869. }
  3870. /* Return the kind of the OMP_FOR statemement G. */
  3871. static inline int
  3872. gimple_omp_for_kind (const gimple *g)
  3873. {
  3874. GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
  3875. return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
  3876. }
  3877. /* Set the kind of the OMP_FOR statement G. */
  3878. static inline void
  3879. gimple_omp_for_set_kind (gomp_for *g, int kind)
  3880. {
  3881. g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
  3882. | (kind & GF_OMP_FOR_KIND_MASK);
  3883. }
  3884. /* Return true if OMP_FOR statement G has the
  3885. GF_OMP_FOR_COMBINED flag set. */
  3886. static inline bool
  3887. gimple_omp_for_combined_p (const gimple *g)
  3888. {
  3889. GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
  3890. return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
  3891. }
  3892. /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
  3893. the boolean value of COMBINED_P. */
  3894. static inline void
  3895. gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
  3896. {
  3897. if (combined_p)
  3898. g->subcode |= GF_OMP_FOR_COMBINED;
  3899. else
  3900. g->subcode &= ~GF_OMP_FOR_COMBINED;
  3901. }
  3902. /* Return true if the OMP_FOR statement G has the
  3903. GF_OMP_FOR_COMBINED_INTO flag set. */
  3904. static inline bool
  3905. gimple_omp_for_combined_into_p (const gimple *g)
  3906. {
  3907. GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
  3908. return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
  3909. }
  3910. /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
  3911. on the boolean value of COMBINED_P. */
  3912. static inline void
  3913. gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
  3914. {
  3915. if (combined_p)
  3916. g->subcode |= GF_OMP_FOR_COMBINED_INTO;
  3917. else
  3918. g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
  3919. }
  3920. /* Return the clauses associated with the OMP_FOR statement GS. */
  3921. static inline tree
  3922. gimple_omp_for_clauses (const gimple *gs)
  3923. {
  3924. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  3925. return omp_for_stmt->clauses;
  3926. }
  3927. /* Return a pointer to the clauses associated with the OMP_FOR statement
  3928. GS. */
  3929. static inline tree *
  3930. gimple_omp_for_clauses_ptr (gimple *gs)
  3931. {
  3932. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  3933. return &omp_for_stmt->clauses;
  3934. }
  3935. /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
  3936. GS. */
  3937. static inline void
  3938. gimple_omp_for_set_clauses (gimple *gs, tree clauses)
  3939. {
  3940. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  3941. omp_for_stmt->clauses = clauses;
  3942. }
  3943. /* Get the collapse count of the OMP_FOR statement GS. */
  3944. static inline size_t
  3945. gimple_omp_for_collapse (gimple *gs)
  3946. {
  3947. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  3948. return omp_for_stmt->collapse;
  3949. }
  3950. /* Return the condition code associated with the OMP_FOR statement GS. */
  3951. static inline enum tree_code
  3952. gimple_omp_for_cond (const gimple *gs, size_t i)
  3953. {
  3954. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  3955. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  3956. return omp_for_stmt->iter[i].cond;
  3957. }
  3958. /* Set COND to be the condition code for the OMP_FOR statement GS. */
  3959. static inline void
  3960. gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
  3961. {
  3962. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  3963. gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
  3964. && i < omp_for_stmt->collapse);
  3965. omp_for_stmt->iter[i].cond = cond;
  3966. }
  3967. /* Return the index variable for the OMP_FOR statement GS. */
  3968. static inline tree
  3969. gimple_omp_for_index (const gimple *gs, size_t i)
  3970. {
  3971. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  3972. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  3973. return omp_for_stmt->iter[i].index;
  3974. }
  3975. /* Return a pointer to the index variable for the OMP_FOR statement GS. */
  3976. static inline tree *
  3977. gimple_omp_for_index_ptr (gimple *gs, size_t i)
  3978. {
  3979. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  3980. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  3981. return &omp_for_stmt->iter[i].index;
  3982. }
  3983. /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
  3984. static inline void
  3985. gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
  3986. {
  3987. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  3988. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  3989. omp_for_stmt->iter[i].index = index;
  3990. }
  3991. /* Return the initial value for the OMP_FOR statement GS. */
  3992. static inline tree
  3993. gimple_omp_for_initial (const gimple *gs, size_t i)
  3994. {
  3995. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  3996. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  3997. return omp_for_stmt->iter[i].initial;
  3998. }
  3999. /* Return a pointer to the initial value for the OMP_FOR statement GS. */
  4000. static inline tree *
  4001. gimple_omp_for_initial_ptr (gimple *gs, size_t i)
  4002. {
  4003. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4004. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4005. return &omp_for_stmt->iter[i].initial;
  4006. }
  4007. /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
  4008. static inline void
  4009. gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
  4010. {
  4011. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4012. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4013. omp_for_stmt->iter[i].initial = initial;
  4014. }
  4015. /* Return the final value for the OMP_FOR statement GS. */
  4016. static inline tree
  4017. gimple_omp_for_final (const gimple *gs, size_t i)
  4018. {
  4019. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  4020. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4021. return omp_for_stmt->iter[i].final;
  4022. }
  4023. /* Return a pointer to the final value for the OMP_FOR statement GS. */
  4024. static inline tree *
  4025. gimple_omp_for_final_ptr (gimple *gs, size_t i)
  4026. {
  4027. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4028. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4029. return &omp_for_stmt->iter[i].final;
  4030. }
  4031. /* Set FINAL to be the final value for the OMP_FOR statement GS. */
  4032. static inline void
  4033. gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
  4034. {
  4035. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4036. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4037. omp_for_stmt->iter[i].final = final;
  4038. }
  4039. /* Return the increment value for the OMP_FOR statement GS. */
  4040. static inline tree
  4041. gimple_omp_for_incr (const gimple *gs, size_t i)
  4042. {
  4043. const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
  4044. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4045. return omp_for_stmt->iter[i].incr;
  4046. }
  4047. /* Return a pointer to the increment value for the OMP_FOR statement GS. */
  4048. static inline tree *
  4049. gimple_omp_for_incr_ptr (gimple *gs, size_t i)
  4050. {
  4051. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4052. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4053. return &omp_for_stmt->iter[i].incr;
  4054. }
  4055. /* Set INCR to be the increment value for the OMP_FOR statement GS. */
  4056. static inline void
  4057. gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
  4058. {
  4059. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4060. gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
  4061. omp_for_stmt->iter[i].incr = incr;
  4062. }
  4063. /* Return a pointer to the sequence of statements to execute before the OMP_FOR
  4064. statement GS starts. */
  4065. static inline gimple_seq *
  4066. gimple_omp_for_pre_body_ptr (gimple *gs)
  4067. {
  4068. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4069. return &omp_for_stmt->pre_body;
  4070. }
  4071. /* Return the sequence of statements to execute before the OMP_FOR
  4072. statement GS starts. */
  4073. static inline gimple_seq
  4074. gimple_omp_for_pre_body (gimple *gs)
  4075. {
  4076. return *gimple_omp_for_pre_body_ptr (gs);
  4077. }
  4078. /* Set PRE_BODY to be the sequence of statements to execute before the
  4079. OMP_FOR statement GS starts. */
  4080. static inline void
  4081. gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
  4082. {
  4083. gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
  4084. omp_for_stmt->pre_body = pre_body;
  4085. }
  4086. /* Return the kernel_phony of OMP_FOR statement. */
  4087. static inline bool
  4088. gimple_omp_for_grid_phony (const gomp_for *omp_for)
  4089. {
  4090. gcc_checking_assert (gimple_omp_for_kind (omp_for)
  4091. != GF_OMP_FOR_KIND_GRID_LOOP);
  4092. return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
  4093. }
  4094. /* Set kernel_phony flag of OMP_FOR to VALUE. */
  4095. static inline void
  4096. gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
  4097. {
  4098. gcc_checking_assert (gimple_omp_for_kind (omp_for)
  4099. != GF_OMP_FOR_KIND_GRID_LOOP);
  4100. if (value)
  4101. omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
  4102. else
  4103. omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
  4104. }
  4105. /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
  4106. static inline bool
  4107. gimple_omp_for_grid_intra_group (const gomp_for *omp_for)
  4108. {
  4109. gcc_checking_assert (gimple_omp_for_kind (omp_for)
  4110. == GF_OMP_FOR_KIND_GRID_LOOP);
  4111. return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0;
  4112. }
  4113. /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
  4114. static inline void
  4115. gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value)
  4116. {
  4117. gcc_checking_assert (gimple_omp_for_kind (omp_for)
  4118. == GF_OMP_FOR_KIND_GRID_LOOP);
  4119. if (value)
  4120. omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP;
  4121. else
  4122. omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP;
  4123. }
  4124. /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
  4125. groups. */
  4126. static inline bool
  4127. gimple_omp_for_grid_group_iter (const gomp_for *omp_for)
  4128. {
  4129. gcc_checking_assert (gimple_omp_for_kind (omp_for)
  4130. == GF_OMP_FOR_KIND_GRID_LOOP);
  4131. return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0;
  4132. }
  4133. /* Set group_iter flag of OMP_FOR to VALUE. */
  4134. static inline void
  4135. gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value)
  4136. {
  4137. gcc_checking_assert (gimple_omp_for_kind (omp_for)
  4138. == GF_OMP_FOR_KIND_GRID_LOOP);
  4139. if (value)
  4140. omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER;
  4141. else
  4142. omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER;
  4143. }
  4144. /* Return the clauses associated with OMP_PARALLEL GS. */
  4145. static inline tree
  4146. gimple_omp_parallel_clauses (const gimple *gs)
  4147. {
  4148. const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
  4149. return omp_parallel_stmt->clauses;
  4150. }
  4151. /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
  4152. static inline tree *
  4153. gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
  4154. {
  4155. return &omp_parallel_stmt->clauses;
  4156. }
  4157. /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
  4158. static inline void
  4159. gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
  4160. tree clauses)
  4161. {
  4162. omp_parallel_stmt->clauses = clauses;
  4163. }
  4164. /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
  4165. static inline tree
  4166. gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
  4167. {
  4168. return omp_parallel_stmt->child_fn;
  4169. }
  4170. /* Return a pointer to the child function used to hold the body of
  4171. OMP_PARALLEL_STMT. */
  4172. static inline tree *
  4173. gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
  4174. {
  4175. return &omp_parallel_stmt->child_fn;
  4176. }
  4177. /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
  4178. static inline void
  4179. gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
  4180. tree child_fn)
  4181. {
  4182. omp_parallel_stmt->child_fn = child_fn;
  4183. }
  4184. /* Return the artificial argument used to send variables and values
  4185. from the parent to the children threads in OMP_PARALLEL_STMT. */
  4186. static inline tree
  4187. gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
  4188. {
  4189. return omp_parallel_stmt->data_arg;
  4190. }
  4191. /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
  4192. static inline tree *
  4193. gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
  4194. {
  4195. return &omp_parallel_stmt->data_arg;
  4196. }
  4197. /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
  4198. static inline void
  4199. gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
  4200. tree data_arg)
  4201. {
  4202. omp_parallel_stmt->data_arg = data_arg;
  4203. }
  4204. /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
  4205. static inline bool
  4206. gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
  4207. {
  4208. return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
  4209. }
  4210. /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
  4211. static inline void
  4212. gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
  4213. {
  4214. if (value)
  4215. stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
  4216. else
  4217. stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
  4218. }
  4219. /* Return the clauses associated with OMP_TASK GS. */
  4220. static inline tree
  4221. gimple_omp_task_clauses (const gimple *gs)
  4222. {
  4223. const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
  4224. return omp_task_stmt->clauses;
  4225. }
  4226. /* Return a pointer to the clauses associated with OMP_TASK GS. */
  4227. static inline tree *
  4228. gimple_omp_task_clauses_ptr (gimple *gs)
  4229. {
  4230. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4231. return &omp_task_stmt->clauses;
  4232. }
  4233. /* Set CLAUSES to be the list of clauses associated with OMP_TASK
  4234. GS. */
  4235. static inline void
  4236. gimple_omp_task_set_clauses (gimple *gs, tree clauses)
  4237. {
  4238. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4239. omp_task_stmt->clauses = clauses;
  4240. }
  4241. /* Return true if OMP task statement G has the
  4242. GF_OMP_TASK_TASKLOOP flag set. */
  4243. static inline bool
  4244. gimple_omp_task_taskloop_p (const gimple *g)
  4245. {
  4246. GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
  4247. return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
  4248. }
  4249. /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
  4250. value of TASKLOOP_P. */
  4251. static inline void
  4252. gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
  4253. {
  4254. GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
  4255. if (taskloop_p)
  4256. g->subcode |= GF_OMP_TASK_TASKLOOP;
  4257. else
  4258. g->subcode &= ~GF_OMP_TASK_TASKLOOP;
  4259. }
  4260. /* Return true if OMP task statement G has the
  4261. GF_OMP_TASK_TASKWAIT flag set. */
  4262. static inline bool
  4263. gimple_omp_task_taskwait_p (const gimple *g)
  4264. {
  4265. GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
  4266. return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0;
  4267. }
  4268. /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
  4269. value of TASKWAIT_P. */
  4270. static inline void
  4271. gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
  4272. {
  4273. GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
  4274. if (taskwait_p)
  4275. g->subcode |= GF_OMP_TASK_TASKWAIT;
  4276. else
  4277. g->subcode &= ~GF_OMP_TASK_TASKWAIT;
  4278. }
  4279. /* Return the child function used to hold the body of OMP_TASK GS. */
  4280. static inline tree
  4281. gimple_omp_task_child_fn (const gimple *gs)
  4282. {
  4283. const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
  4284. return omp_task_stmt->child_fn;
  4285. }
  4286. /* Return a pointer to the child function used to hold the body of
  4287. OMP_TASK GS. */
  4288. static inline tree *
  4289. gimple_omp_task_child_fn_ptr (gimple *gs)
  4290. {
  4291. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4292. return &omp_task_stmt->child_fn;
  4293. }
  4294. /* Set CHILD_FN to be the child function for OMP_TASK GS. */
  4295. static inline void
  4296. gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
  4297. {
  4298. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4299. omp_task_stmt->child_fn = child_fn;
  4300. }
  4301. /* Return the artificial argument used to send variables and values
  4302. from the parent to the children threads in OMP_TASK GS. */
  4303. static inline tree
  4304. gimple_omp_task_data_arg (const gimple *gs)
  4305. {
  4306. const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
  4307. return omp_task_stmt->data_arg;
  4308. }
  4309. /* Return a pointer to the data argument for OMP_TASK GS. */
  4310. static inline tree *
  4311. gimple_omp_task_data_arg_ptr (gimple *gs)
  4312. {
  4313. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4314. return &omp_task_stmt->data_arg;
  4315. }
  4316. /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
  4317. static inline void
  4318. gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
  4319. {
  4320. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4321. omp_task_stmt->data_arg = data_arg;
  4322. }
  4323. /* Return the clauses associated with OMP_TASK GS. */
  4324. static inline tree
  4325. gimple_omp_taskreg_clauses (const gimple *gs)
  4326. {
  4327. const gimple_statement_omp_taskreg *omp_taskreg_stmt
  4328. = as_a <const gimple_statement_omp_taskreg *> (gs);
  4329. return omp_taskreg_stmt->clauses;
  4330. }
  4331. /* Return a pointer to the clauses associated with OMP_TASK GS. */
  4332. static inline tree *
  4333. gimple_omp_taskreg_clauses_ptr (gimple *gs)
  4334. {
  4335. gimple_statement_omp_taskreg *omp_taskreg_stmt
  4336. = as_a <gimple_statement_omp_taskreg *> (gs);
  4337. return &omp_taskreg_stmt->clauses;
  4338. }
  4339. /* Set CLAUSES to be the list of clauses associated with OMP_TASK
  4340. GS. */
  4341. static inline void
  4342. gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
  4343. {
  4344. gimple_statement_omp_taskreg *omp_taskreg_stmt
  4345. = as_a <gimple_statement_omp_taskreg *> (gs);
  4346. omp_taskreg_stmt->clauses = clauses;
  4347. }
  4348. /* Return the child function used to hold the body of OMP_TASK GS. */
  4349. static inline tree
  4350. gimple_omp_taskreg_child_fn (const gimple *gs)
  4351. {
  4352. const gimple_statement_omp_taskreg *omp_taskreg_stmt
  4353. = as_a <const gimple_statement_omp_taskreg *> (gs);
  4354. return omp_taskreg_stmt->child_fn;
  4355. }
  4356. /* Return a pointer to the child function used to hold the body of
  4357. OMP_TASK GS. */
  4358. static inline tree *
  4359. gimple_omp_taskreg_child_fn_ptr (gimple *gs)
  4360. {
  4361. gimple_statement_omp_taskreg *omp_taskreg_stmt
  4362. = as_a <gimple_statement_omp_taskreg *> (gs);
  4363. return &omp_taskreg_stmt->child_fn;
  4364. }
  4365. /* Set CHILD_FN to be the child function for OMP_TASK GS. */
  4366. static inline void
  4367. gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
  4368. {
  4369. gimple_statement_omp_taskreg *omp_taskreg_stmt
  4370. = as_a <gimple_statement_omp_taskreg *> (gs);
  4371. omp_taskreg_stmt->child_fn = child_fn;
  4372. }
  4373. /* Return the artificial argument used to send variables and values
  4374. from the parent to the children threads in OMP_TASK GS. */
  4375. static inline tree
  4376. gimple_omp_taskreg_data_arg (const gimple *gs)
  4377. {
  4378. const gimple_statement_omp_taskreg *omp_taskreg_stmt
  4379. = as_a <const gimple_statement_omp_taskreg *> (gs);
  4380. return omp_taskreg_stmt->data_arg;
  4381. }
  4382. /* Return a pointer to the data argument for OMP_TASK GS. */
  4383. static inline tree *
  4384. gimple_omp_taskreg_data_arg_ptr (gimple *gs)
  4385. {
  4386. gimple_statement_omp_taskreg *omp_taskreg_stmt
  4387. = as_a <gimple_statement_omp_taskreg *> (gs);
  4388. return &omp_taskreg_stmt->data_arg;
  4389. }
  4390. /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
  4391. static inline void
  4392. gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
  4393. {
  4394. gimple_statement_omp_taskreg *omp_taskreg_stmt
  4395. = as_a <gimple_statement_omp_taskreg *> (gs);
  4396. omp_taskreg_stmt->data_arg = data_arg;
  4397. }
  4398. /* Return the copy function used to hold the body of OMP_TASK GS. */
  4399. static inline tree
  4400. gimple_omp_task_copy_fn (const gimple *gs)
  4401. {
  4402. const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
  4403. return omp_task_stmt->copy_fn;
  4404. }
  4405. /* Return a pointer to the copy function used to hold the body of
  4406. OMP_TASK GS. */
  4407. static inline tree *
  4408. gimple_omp_task_copy_fn_ptr (gimple *gs)
  4409. {
  4410. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4411. return &omp_task_stmt->copy_fn;
  4412. }
  4413. /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
  4414. static inline void
  4415. gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
  4416. {
  4417. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4418. omp_task_stmt->copy_fn = copy_fn;
  4419. }
  4420. /* Return size of the data block in bytes in OMP_TASK GS. */
  4421. static inline tree
  4422. gimple_omp_task_arg_size (const gimple *gs)
  4423. {
  4424. const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
  4425. return omp_task_stmt->arg_size;
  4426. }
  4427. /* Return a pointer to the data block size for OMP_TASK GS. */
  4428. static inline tree *
  4429. gimple_omp_task_arg_size_ptr (gimple *gs)
  4430. {
  4431. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4432. return &omp_task_stmt->arg_size;
  4433. }
  4434. /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
  4435. static inline void
  4436. gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
  4437. {
  4438. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4439. omp_task_stmt->arg_size = arg_size;
  4440. }
  4441. /* Return align of the data block in bytes in OMP_TASK GS. */
  4442. static inline tree
  4443. gimple_omp_task_arg_align (const gimple *gs)
  4444. {
  4445. const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
  4446. return omp_task_stmt->arg_align;
  4447. }
  4448. /* Return a pointer to the data block align for OMP_TASK GS. */
  4449. static inline tree *
  4450. gimple_omp_task_arg_align_ptr (gimple *gs)
  4451. {
  4452. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4453. return &omp_task_stmt->arg_align;
  4454. }
  4455. /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
  4456. static inline void
  4457. gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
  4458. {
  4459. gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
  4460. omp_task_stmt->arg_align = arg_align;
  4461. }
  4462. /* Return the clauses associated with OMP_SINGLE GS. */
  4463. static inline tree
  4464. gimple_omp_single_clauses (const gimple *gs)
  4465. {
  4466. const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
  4467. return omp_single_stmt->clauses;
  4468. }
  4469. /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
  4470. static inline tree *
  4471. gimple_omp_single_clauses_ptr (gimple *gs)
  4472. {
  4473. gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
  4474. return &omp_single_stmt->clauses;
  4475. }
  4476. /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
  4477. static inline void
  4478. gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
  4479. {
  4480. omp_single_stmt->clauses = clauses;
  4481. }
  4482. /* Return the clauses associated with OMP_TARGET GS. */
  4483. static inline tree
  4484. gimple_omp_target_clauses (const gimple *gs)
  4485. {
  4486. const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
  4487. return omp_target_stmt->clauses;
  4488. }
  4489. /* Return a pointer to the clauses associated with OMP_TARGET GS. */
  4490. static inline tree *
  4491. gimple_omp_target_clauses_ptr (gimple *gs)
  4492. {
  4493. gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
  4494. return &omp_target_stmt->clauses;
  4495. }
  4496. /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
  4497. static inline void
  4498. gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
  4499. tree clauses)
  4500. {
  4501. omp_target_stmt->clauses = clauses;
  4502. }
  4503. /* Return the kind of the OMP_TARGET G. */
  4504. static inline int
  4505. gimple_omp_target_kind (const gimple *g)
  4506. {
  4507. GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
  4508. return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
  4509. }
  4510. /* Set the kind of the OMP_TARGET G. */
  4511. static inline void
  4512. gimple_omp_target_set_kind (gomp_target *g, int kind)
  4513. {
  4514. g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
  4515. | (kind & GF_OMP_TARGET_KIND_MASK);
  4516. }
  4517. /* Return the child function used to hold the body of OMP_TARGET_STMT. */
  4518. static inline tree
  4519. gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
  4520. {
  4521. return omp_target_stmt->child_fn;
  4522. }
  4523. /* Return a pointer to the child function used to hold the body of
  4524. OMP_TARGET_STMT. */
  4525. static inline tree *
  4526. gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
  4527. {
  4528. return &omp_target_stmt->child_fn;
  4529. }
  4530. /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
  4531. static inline void
  4532. gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
  4533. tree child_fn)
  4534. {
  4535. omp_target_stmt->child_fn = child_fn;
  4536. }
  4537. /* Return the artificial argument used to send variables and values
  4538. from the parent to the children threads in OMP_TARGET_STMT. */
  4539. static inline tree
  4540. gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
  4541. {
  4542. return omp_target_stmt->data_arg;
  4543. }
  4544. /* Return a pointer to the data argument for OMP_TARGET GS. */
  4545. static inline tree *
  4546. gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
  4547. {
  4548. return &omp_target_stmt->data_arg;
  4549. }
  4550. /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
  4551. static inline void
  4552. gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
  4553. tree data_arg)
  4554. {
  4555. omp_target_stmt->data_arg = data_arg;
  4556. }
  4557. /* Return the clauses associated with OMP_TEAMS GS. */
  4558. static inline tree
  4559. gimple_omp_teams_clauses (const gimple *gs)
  4560. {
  4561. const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
  4562. return omp_teams_stmt->clauses;
  4563. }
  4564. /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
  4565. static inline tree *
  4566. gimple_omp_teams_clauses_ptr (gimple *gs)
  4567. {
  4568. gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
  4569. return &omp_teams_stmt->clauses;
  4570. }
  4571. /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
  4572. static inline void
  4573. gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
  4574. {
  4575. omp_teams_stmt->clauses = clauses;
  4576. }
  4577. /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
  4578. static inline tree
  4579. gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
  4580. {
  4581. return omp_teams_stmt->child_fn;
  4582. }
  4583. /* Return a pointer to the child function used to hold the body of
  4584. OMP_TEAMS_STMT. */
  4585. static inline tree *
  4586. gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
  4587. {
  4588. return &omp_teams_stmt->child_fn;
  4589. }
  4590. /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
  4591. static inline void
  4592. gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
  4593. {
  4594. omp_teams_stmt->child_fn = child_fn;
  4595. }
  4596. /* Return the artificial argument used to send variables and values
  4597. from the parent to the children threads in OMP_TEAMS_STMT. */
  4598. static inline tree
  4599. gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
  4600. {
  4601. return omp_teams_stmt->data_arg;
  4602. }
  4603. /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
  4604. static inline tree *
  4605. gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
  4606. {
  4607. return &omp_teams_stmt->data_arg;
  4608. }
  4609. /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
  4610. static inline void
  4611. gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
  4612. {
  4613. omp_teams_stmt->data_arg = data_arg;
  4614. }
  4615. /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
  4616. static inline bool
  4617. gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
  4618. {
  4619. return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
  4620. }
  4621. /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
  4622. static inline void
  4623. gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
  4624. {
  4625. if (value)
  4626. omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
  4627. else
  4628. omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
  4629. }
  4630. /* Return the host flag of an OMP_TEAMS_STMT. */
  4631. static inline bool
  4632. gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
  4633. {
  4634. return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
  4635. }
  4636. /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
  4637. static inline void
  4638. gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
  4639. {
  4640. if (value)
  4641. omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
  4642. else
  4643. omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
  4644. }
  4645. /* Return the clauses associated with OMP_SECTIONS GS. */
  4646. static inline tree
  4647. gimple_omp_sections_clauses (const gimple *gs)
  4648. {
  4649. const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
  4650. return omp_sections_stmt->clauses;
  4651. }
  4652. /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
  4653. static inline tree *
  4654. gimple_omp_sections_clauses_ptr (gimple *gs)
  4655. {
  4656. gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
  4657. return &omp_sections_stmt->clauses;
  4658. }
  4659. /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
  4660. GS. */
  4661. static inline void
  4662. gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
  4663. {
  4664. gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
  4665. omp_sections_stmt->clauses = clauses;
  4666. }
  4667. /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
  4668. in GS. */
  4669. static inline tree
  4670. gimple_omp_sections_control (const gimple *gs)
  4671. {
  4672. const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
  4673. return omp_sections_stmt->control;
  4674. }
  4675. /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
  4676. GS. */
  4677. static inline tree *
  4678. gimple_omp_sections_control_ptr (gimple *gs)
  4679. {
  4680. gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
  4681. return &omp_sections_stmt->control;
  4682. }
  4683. /* Set CONTROL to be the set of clauses associated with the
  4684. GIMPLE_OMP_SECTIONS in GS. */
  4685. static inline void
  4686. gimple_omp_sections_set_control (gimple *gs, tree control)
  4687. {
  4688. gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
  4689. omp_sections_stmt->control = control;
  4690. }
  4691. /* Set the value being stored in an atomic store. */
  4692. static inline void
  4693. gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
  4694. {
  4695. store_stmt->val = val;
  4696. }
  4697. /* Return the value being stored in an atomic store. */
  4698. static inline tree
  4699. gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
  4700. {
  4701. return store_stmt->val;
  4702. }
  4703. /* Return a pointer to the value being stored in an atomic store. */
  4704. static inline tree *
  4705. gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
  4706. {
  4707. return &store_stmt->val;
  4708. }
  4709. /* Set the LHS of an atomic load. */
  4710. static inline void
  4711. gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
  4712. {
  4713. load_stmt->lhs = lhs;
  4714. }
  4715. /* Get the LHS of an atomic load. */
  4716. static inline tree
  4717. gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
  4718. {
  4719. return load_stmt->lhs;
  4720. }
  4721. /* Return a pointer to the LHS of an atomic load. */
  4722. static inline tree *
  4723. gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
  4724. {
  4725. return &load_stmt->lhs;
  4726. }
  4727. /* Set the RHS of an atomic load. */
  4728. static inline void
  4729. gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
  4730. {
  4731. load_stmt->rhs = rhs;
  4732. }
  4733. /* Get the RHS of an atomic load. */
  4734. static inline tree
  4735. gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
  4736. {
  4737. return load_stmt->rhs;
  4738. }
  4739. /* Return a pointer to the RHS of an atomic load. */
  4740. static inline tree *
  4741. gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
  4742. {
  4743. return &load_stmt->rhs;
  4744. }
  4745. /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
  4746. static inline tree
  4747. gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
  4748. {
  4749. return cont_stmt->control_def;
  4750. }
  4751. /* The same as above, but return the address. */
  4752. static inline tree *
  4753. gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
  4754. {
  4755. return &cont_stmt->control_def;
  4756. }
  4757. /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
  4758. static inline void
  4759. gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
  4760. {
  4761. cont_stmt->control_def = def;
  4762. }
  4763. /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
  4764. static inline tree
  4765. gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
  4766. {
  4767. return cont_stmt->control_use;
  4768. }
  4769. /* The same as above, but return the address. */
  4770. static inline tree *
  4771. gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
  4772. {
  4773. return &cont_stmt->control_use;
  4774. }
  4775. /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
  4776. static inline void
  4777. gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
  4778. {
  4779. cont_stmt->control_use = use;
  4780. }
  4781. /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
  4782. TRANSACTION_STMT. */
  4783. static inline gimple_seq *
  4784. gimple_transaction_body_ptr (gtransaction *transaction_stmt)
  4785. {
  4786. return &transaction_stmt->body;
  4787. }
  4788. /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
  4789. static inline gimple_seq
  4790. gimple_transaction_body (gtransaction *transaction_stmt)
  4791. {
  4792. return transaction_stmt->body;
  4793. }
  4794. /* Return the label associated with a GIMPLE_TRANSACTION. */
  4795. static inline tree
  4796. gimple_transaction_label_norm (const gtransaction *transaction_stmt)
  4797. {
  4798. return transaction_stmt->label_norm;
  4799. }
  4800. static inline tree *
  4801. gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
  4802. {
  4803. return &transaction_stmt->label_norm;
  4804. }
  4805. static inline tree
  4806. gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
  4807. {
  4808. return transaction_stmt->label_uninst;
  4809. }
  4810. static inline tree *
  4811. gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
  4812. {
  4813. return &transaction_stmt->label_uninst;
  4814. }
  4815. static inline tree
  4816. gimple_transaction_label_over (const gtransaction *transaction_stmt)
  4817. {
  4818. return transaction_stmt->label_over;
  4819. }
  4820. static inline tree *
  4821. gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
  4822. {
  4823. return &transaction_stmt->label_over;
  4824. }
  4825. /* Return the subcode associated with a GIMPLE_TRANSACTION. */
  4826. static inline unsigned int
  4827. gimple_transaction_subcode (const gtransaction *transaction_stmt)
  4828. {
  4829. return transaction_stmt->subcode;
  4830. }
  4831. /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
  4832. TRANSACTION_STMT. */
  4833. static inline void
  4834. gimple_transaction_set_body (gtransaction *transaction_stmt,
  4835. gimple_seq body)
  4836. {
  4837. transaction_stmt->body = body;
  4838. }
  4839. /* Set the label associated with a GIMPLE_TRANSACTION. */
  4840. static inline void
  4841. gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
  4842. {
  4843. transaction_stmt->label_norm = label;
  4844. }
  4845. static inline void
  4846. gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
  4847. {
  4848. transaction_stmt->label_uninst = label;
  4849. }
  4850. static inline void
  4851. gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
  4852. {
  4853. transaction_stmt->label_over = label;
  4854. }
  4855. /* Set the subcode associated with a GIMPLE_TRANSACTION. */
  4856. static inline void
  4857. gimple_transaction_set_subcode (gtransaction *transaction_stmt,
  4858. unsigned int subcode)
  4859. {
  4860. transaction_stmt->subcode = subcode;
  4861. }
  4862. /* Return a pointer to the return value for GIMPLE_RETURN GS. */
  4863. static inline tree *
  4864. gimple_return_retval_ptr (greturn *gs)
  4865. {
  4866. return &gs->op[0];
  4867. }
  4868. /* Return the return value for GIMPLE_RETURN GS. */
  4869. static inline tree
  4870. gimple_return_retval (const greturn *gs)
  4871. {
  4872. return gs->op[0];
  4873. }
  4874. /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
  4875. static inline void
  4876. gimple_return_set_retval (greturn *gs, tree retval)
  4877. {
  4878. gs->op[0] = retval;
  4879. }
  4880. /* Returns true when the gimple statement STMT is any of the OMP types. */
  4881. #define CASE_GIMPLE_OMP \
  4882. case GIMPLE_OMP_PARALLEL: \
  4883. case GIMPLE_OMP_TASK: \
  4884. case GIMPLE_OMP_FOR: \
  4885. case GIMPLE_OMP_SECTIONS: \
  4886. case GIMPLE_OMP_SECTIONS_SWITCH: \
  4887. case GIMPLE_OMP_SINGLE: \
  4888. case GIMPLE_OMP_TARGET: \
  4889. case GIMPLE_OMP_TEAMS: \
  4890. case GIMPLE_OMP_SECTION: \
  4891. case GIMPLE_OMP_MASTER: \
  4892. case GIMPLE_OMP_TASKGROUP: \
  4893. case GIMPLE_OMP_ORDERED: \
  4894. case GIMPLE_OMP_CRITICAL: \
  4895. case GIMPLE_OMP_RETURN: \
  4896. case GIMPLE_OMP_ATOMIC_LOAD: \
  4897. case GIMPLE_OMP_ATOMIC_STORE: \
  4898. case GIMPLE_OMP_CONTINUE: \
  4899. case GIMPLE_OMP_GRID_BODY
  4900. static inline bool
  4901. is_gimple_omp (const gimple *stmt)
  4902. {
  4903. switch (gimple_code (stmt))
  4904. {
  4905. CASE_GIMPLE_OMP:
  4906. return true;
  4907. default:
  4908. return false;
  4909. }
  4910. }
  4911. /* Return true if the OMP gimple statement STMT is any of the OpenACC types
  4912. specifically. */
  4913. static inline bool
  4914. is_gimple_omp_oacc (const gimple *stmt)
  4915. {
  4916. gcc_assert (is_gimple_omp (stmt));
  4917. switch (gimple_code (stmt))
  4918. {
  4919. case GIMPLE_OMP_FOR:
  4920. switch (gimple_omp_for_kind (stmt))
  4921. {
  4922. case GF_OMP_FOR_KIND_OACC_LOOP:
  4923. return true;
  4924. default:
  4925. return false;
  4926. }
  4927. case GIMPLE_OMP_TARGET:
  4928. switch (gimple_omp_target_kind (stmt))
  4929. {
  4930. case GF_OMP_TARGET_KIND_OACC_PARALLEL:
  4931. case GF_OMP_TARGET_KIND_OACC_KERNELS:
  4932. case GF_OMP_TARGET_KIND_OACC_DATA:
  4933. case GF_OMP_TARGET_KIND_OACC_UPDATE:
  4934. case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
  4935. case GF_OMP_TARGET_KIND_OACC_DECLARE:
  4936. case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
  4937. return true;
  4938. default:
  4939. return false;
  4940. }
  4941. default:
  4942. return false;
  4943. }
  4944. }
  4945. /* Return true if the OMP gimple statement STMT is offloaded. */
  4946. static inline bool
  4947. is_gimple_omp_offloaded (const gimple *stmt)
  4948. {
  4949. gcc_assert (is_gimple_omp (stmt));
  4950. switch (gimple_code (stmt))
  4951. {
  4952. case GIMPLE_OMP_TARGET:
  4953. switch (gimple_omp_target_kind (stmt))
  4954. {
  4955. case GF_OMP_TARGET_KIND_REGION:
  4956. case GF_OMP_TARGET_KIND_OACC_PARALLEL:
  4957. case GF_OMP_TARGET_KIND_OACC_KERNELS:
  4958. return true;
  4959. default:
  4960. return false;
  4961. }
  4962. default:
  4963. return false;
  4964. }
  4965. }
  4966. /* Returns TRUE if statement G is a GIMPLE_NOP. */
  4967. static inline bool
  4968. gimple_nop_p (const gimple *g)
  4969. {
  4970. return gimple_code (g) == GIMPLE_NOP;
  4971. }
  4972. /* Return true if GS is a GIMPLE_RESX. */
  4973. static inline bool
  4974. is_gimple_resx (const gimple *gs)
  4975. {
  4976. return gimple_code (gs) == GIMPLE_RESX;
  4977. }
  4978. /* Return the type of the main expression computed by STMT. Return
  4979. void_type_node if the statement computes nothing. */
  4980. static inline tree
  4981. gimple_expr_type (const gimple *stmt)
  4982. {
  4983. enum gimple_code code = gimple_code (stmt);
  4984. /* In general we want to pass out a type that can be substituted
  4985. for both the RHS and the LHS types if there is a possibly
  4986. useless conversion involved. That means returning the
  4987. original RHS type as far as we can reconstruct it. */
  4988. if (code == GIMPLE_CALL)
  4989. {
  4990. const gcall *call_stmt = as_a <const gcall *> (stmt);
  4991. if (gimple_call_internal_p (call_stmt))
  4992. switch (gimple_call_internal_fn (call_stmt))
  4993. {
  4994. case IFN_MASK_STORE:
  4995. case IFN_SCATTER_STORE:
  4996. return TREE_TYPE (gimple_call_arg (call_stmt, 3));
  4997. case IFN_MASK_SCATTER_STORE:
  4998. return TREE_TYPE (gimple_call_arg (call_stmt, 4));
  4999. default:
  5000. break;
  5001. }
  5002. return gimple_call_return_type (call_stmt);
  5003. }
  5004. else if (code == GIMPLE_ASSIGN)
  5005. {
  5006. if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
  5007. return TREE_TYPE (gimple_assign_rhs1 (stmt));
  5008. else
  5009. /* As fallback use the type of the LHS. */
  5010. return TREE_TYPE (gimple_get_lhs (stmt));
  5011. }
  5012. else if (code == GIMPLE_COND)
  5013. return boolean_type_node;
  5014. else
  5015. return void_type_node;
  5016. }
  5017. /* Enum and arrays used for allocation stats. Keep in sync with
  5018. gimple.c:gimple_alloc_kind_names. */
  5019. enum gimple_alloc_kind
  5020. {
  5021. gimple_alloc_kind_assign, /* Assignments. */
  5022. gimple_alloc_kind_phi, /* PHI nodes. */
  5023. gimple_alloc_kind_cond, /* Conditionals. */
  5024. gimple_alloc_kind_rest, /* Everything else. */
  5025. gimple_alloc_kind_all
  5026. };
  5027. extern uint64_t gimple_alloc_counts[];
  5028. extern uint64_t gimple_alloc_sizes[];
  5029. /* Return the allocation kind for a given stmt CODE. */
  5030. static inline enum gimple_alloc_kind
  5031. gimple_alloc_kind (enum gimple_code code)
  5032. {
  5033. switch (code)
  5034. {
  5035. case GIMPLE_ASSIGN:
  5036. return gimple_alloc_kind_assign;
  5037. case GIMPLE_PHI:
  5038. return gimple_alloc_kind_phi;
  5039. case GIMPLE_COND:
  5040. return gimple_alloc_kind_cond;
  5041. default:
  5042. return gimple_alloc_kind_rest;
  5043. }
  5044. }
  5045. /* Return true if a location should not be emitted for this statement
  5046. by annotate_all_with_location. */
  5047. static inline bool
  5048. gimple_do_not_emit_location_p (gimple *g)
  5049. {
  5050. return gimple_plf (g, GF_PLF_1);
  5051. }
  5052. /* Mark statement G so a location will not be emitted by
  5053. annotate_one_with_location. */
  5054. static inline void
  5055. gimple_set_do_not_emit_location (gimple *g)
  5056. {
  5057. /* The PLF flags are initialized to 0 when a new tuple is created,
  5058. so no need to initialize it anywhere. */
  5059. gimple_set_plf (g, GF_PLF_1, true);
  5060. }
  5061. #endif /* GCC_GIMPLE_H */