gimple.h 150 KB

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