gimple.h 136 KB

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