rtl.h 148 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374
  1. /* Register Transfer Language (RTL) definitions for GCC
  2. Copyright (C) 1987-2018 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify it under
  5. the terms of the GNU General Public License as published by the Free
  6. Software Foundation; either version 3, or (at your option) any later
  7. version.
  8. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  9. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  11. for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef GCC_RTL_H
  16. #define GCC_RTL_H
  17. /* This file is occasionally included by generator files which expect
  18. machmode.h and other files to exist and would not normally have been
  19. included by coretypes.h. */
  20. #ifdef GENERATOR_FILE
  21. #include "real.h"
  22. #include "fixed-value.h"
  23. #include "statistics.h"
  24. #include "vec.h"
  25. #include "hash-table.h"
  26. #include "hash-set.h"
  27. #include "input.h"
  28. #include "is-a.h"
  29. #endif /* GENERATOR_FILE */
  30. #include "hard-reg-set.h"
  31. /* Value used by some passes to "recognize" noop moves as valid
  32. instructions. */
  33. #define NOOP_MOVE_INSN_CODE INT_MAX
  34. /* Register Transfer Language EXPRESSIONS CODES */
  35. #define RTX_CODE enum rtx_code
  36. enum rtx_code {
  37. #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
  38. #include "rtl.def" /* rtl expressions are documented here */
  39. #undef DEF_RTL_EXPR
  40. LAST_AND_UNUSED_RTX_CODE}; /* A convenient way to get a value for
  41. NUM_RTX_CODE.
  42. Assumes default enum value assignment. */
  43. /* The cast here, saves many elsewhere. */
  44. #define NUM_RTX_CODE ((int) LAST_AND_UNUSED_RTX_CODE)
  45. /* Similar, but since generator files get more entries... */
  46. #ifdef GENERATOR_FILE
  47. # define NON_GENERATOR_NUM_RTX_CODE ((int) MATCH_OPERAND)
  48. #endif
  49. /* Register Transfer Language EXPRESSIONS CODE CLASSES */
  50. enum rtx_class {
  51. /* We check bit 0-1 of some rtx class codes in the predicates below. */
  52. /* Bit 0 = comparison if 0, arithmetic is 1
  53. Bit 1 = 1 if commutative. */
  54. RTX_COMPARE, /* 0 */
  55. RTX_COMM_COMPARE,
  56. RTX_BIN_ARITH,
  57. RTX_COMM_ARITH,
  58. /* Must follow the four preceding values. */
  59. RTX_UNARY, /* 4 */
  60. RTX_EXTRA,
  61. RTX_MATCH,
  62. RTX_INSN,
  63. /* Bit 0 = 1 if constant. */
  64. RTX_OBJ, /* 8 */
  65. RTX_CONST_OBJ,
  66. RTX_TERNARY,
  67. RTX_BITFIELD_OPS,
  68. RTX_AUTOINC
  69. };
  70. #define RTX_OBJ_MASK (~1)
  71. #define RTX_OBJ_RESULT (RTX_OBJ & RTX_OBJ_MASK)
  72. #define RTX_COMPARE_MASK (~1)
  73. #define RTX_COMPARE_RESULT (RTX_COMPARE & RTX_COMPARE_MASK)
  74. #define RTX_ARITHMETIC_MASK (~1)
  75. #define RTX_ARITHMETIC_RESULT (RTX_COMM_ARITH & RTX_ARITHMETIC_MASK)
  76. #define RTX_BINARY_MASK (~3)
  77. #define RTX_BINARY_RESULT (RTX_COMPARE & RTX_BINARY_MASK)
  78. #define RTX_COMMUTATIVE_MASK (~2)
  79. #define RTX_COMMUTATIVE_RESULT (RTX_COMM_COMPARE & RTX_COMMUTATIVE_MASK)
  80. #define RTX_NON_COMMUTATIVE_RESULT (RTX_COMPARE & RTX_COMMUTATIVE_MASK)
  81. extern const unsigned char rtx_length[NUM_RTX_CODE];
  82. #define GET_RTX_LENGTH(CODE) (rtx_length[(int) (CODE)])
  83. extern const char * const rtx_name[NUM_RTX_CODE];
  84. #define GET_RTX_NAME(CODE) (rtx_name[(int) (CODE)])
  85. extern const char * const rtx_format[NUM_RTX_CODE];
  86. #define GET_RTX_FORMAT(CODE) (rtx_format[(int) (CODE)])
  87. extern const enum rtx_class rtx_class[NUM_RTX_CODE];
  88. #define GET_RTX_CLASS(CODE) (rtx_class[(int) (CODE)])
  89. /* True if CODE is part of the insn chain (i.e. has INSN_UID, PREV_INSN
  90. and NEXT_INSN fields). */
  91. #define INSN_CHAIN_CODE_P(CODE) IN_RANGE (CODE, DEBUG_INSN, NOTE)
  92. extern const unsigned char rtx_code_size[NUM_RTX_CODE];
  93. extern const unsigned char rtx_next[NUM_RTX_CODE];
  94. /* The flags and bitfields of an ADDR_DIFF_VEC. BASE is the base label
  95. relative to which the offsets are calculated, as explained in rtl.def. */
  96. struct addr_diff_vec_flags
  97. {
  98. /* Set at the start of shorten_branches - ONLY WHEN OPTIMIZING - : */
  99. unsigned min_align: 8;
  100. /* Flags: */
  101. unsigned base_after_vec: 1; /* BASE is after the ADDR_DIFF_VEC. */
  102. unsigned min_after_vec: 1; /* minimum address target label is
  103. after the ADDR_DIFF_VEC. */
  104. unsigned max_after_vec: 1; /* maximum address target label is
  105. after the ADDR_DIFF_VEC. */
  106. unsigned min_after_base: 1; /* minimum address target label is
  107. after BASE. */
  108. unsigned max_after_base: 1; /* maximum address target label is
  109. after BASE. */
  110. /* Set by the actual branch shortening process - ONLY WHEN OPTIMIZING - : */
  111. unsigned offset_unsigned: 1; /* offsets have to be treated as unsigned. */
  112. unsigned : 2;
  113. unsigned scale : 8;
  114. };
  115. /* Structure used to describe the attributes of a MEM. These are hashed
  116. so MEMs that the same attributes share a data structure. This means
  117. they cannot be modified in place. */
  118. struct GTY(()) mem_attrs
  119. {
  120. mem_attrs ();
  121. /* The expression that the MEM accesses, or null if not known.
  122. This expression might be larger than the memory reference itself.
  123. (In other words, the MEM might access only part of the object.) */
  124. tree expr;
  125. /* The offset of the memory reference from the start of EXPR.
  126. Only valid if OFFSET_KNOWN_P. */
  127. poly_int64 offset;
  128. /* The size of the memory reference in bytes. Only valid if
  129. SIZE_KNOWN_P. */
  130. poly_int64 size;
  131. /* The alias set of the memory reference. */
  132. alias_set_type alias;
  133. /* The alignment of the reference in bits. Always a multiple of
  134. BITS_PER_UNIT. Note that EXPR may have a stricter alignment
  135. than the memory reference itself. */
  136. unsigned int align;
  137. /* The address space that the memory reference uses. */
  138. unsigned char addrspace;
  139. /* True if OFFSET is known. */
  140. bool offset_known_p;
  141. /* True if SIZE is known. */
  142. bool size_known_p;
  143. };
  144. /* Structure used to describe the attributes of a REG in similar way as
  145. mem_attrs does for MEM above. Note that the OFFSET field is calculated
  146. in the same way as for mem_attrs, rather than in the same way as a
  147. SUBREG_BYTE. For example, if a big-endian target stores a byte
  148. object in the low part of a 4-byte register, the OFFSET field
  149. will be -3 rather than 0. */
  150. struct GTY((for_user)) reg_attrs {
  151. tree decl; /* decl corresponding to REG. */
  152. poly_int64 offset; /* Offset from start of DECL. */
  153. };
  154. /* Common union for an element of an rtx. */
  155. union rtunion
  156. {
  157. int rt_int;
  158. unsigned int rt_uint;
  159. poly_uint16_pod rt_subreg;
  160. const char *rt_str;
  161. rtx rt_rtx;
  162. rtvec rt_rtvec;
  163. machine_mode rt_type;
  164. addr_diff_vec_flags rt_addr_diff_vec_flags;
  165. struct cselib_val *rt_cselib;
  166. tree rt_tree;
  167. basic_block rt_bb;
  168. mem_attrs *rt_mem;
  169. struct constant_descriptor_rtx *rt_constant;
  170. struct dw_cfi_node *rt_cfi;
  171. };
  172. /* Describes the properties of a REG. */
  173. struct GTY(()) reg_info {
  174. /* The value of REGNO. */
  175. unsigned int regno;
  176. /* The value of REG_NREGS. */
  177. unsigned int nregs : 8;
  178. unsigned int unused : 24;
  179. /* The value of REG_ATTRS. */
  180. reg_attrs *attrs;
  181. };
  182. /* This structure remembers the position of a SYMBOL_REF within an
  183. object_block structure. A SYMBOL_REF only provides this information
  184. if SYMBOL_REF_HAS_BLOCK_INFO_P is true. */
  185. struct GTY(()) block_symbol {
  186. /* The usual SYMBOL_REF fields. */
  187. rtunion GTY ((skip)) fld[2];
  188. /* The block that contains this object. */
  189. struct object_block *block;
  190. /* The offset of this object from the start of its block. It is negative
  191. if the symbol has not yet been assigned an offset. */
  192. HOST_WIDE_INT offset;
  193. };
  194. /* Describes a group of objects that are to be placed together in such
  195. a way that their relative positions are known. */
  196. struct GTY((for_user)) object_block {
  197. /* The section in which these objects should be placed. */
  198. section *sect;
  199. /* The alignment of the first object, measured in bits. */
  200. unsigned int alignment;
  201. /* The total size of the objects, measured in bytes. */
  202. HOST_WIDE_INT size;
  203. /* The SYMBOL_REFs for each object. The vector is sorted in
  204. order of increasing offset and the following conditions will
  205. hold for each element X:
  206. SYMBOL_REF_HAS_BLOCK_INFO_P (X)
  207. !SYMBOL_REF_ANCHOR_P (X)
  208. SYMBOL_REF_BLOCK (X) == [address of this structure]
  209. SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */
  210. vec<rtx, va_gc> *objects;
  211. /* All the anchor SYMBOL_REFs used to address these objects, sorted
  212. in order of increasing offset, and then increasing TLS model.
  213. The following conditions will hold for each element X in this vector:
  214. SYMBOL_REF_HAS_BLOCK_INFO_P (X)
  215. SYMBOL_REF_ANCHOR_P (X)
  216. SYMBOL_REF_BLOCK (X) == [address of this structure]
  217. SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */
  218. vec<rtx, va_gc> *anchors;
  219. };
  220. struct GTY((variable_size)) hwivec_def {
  221. HOST_WIDE_INT elem[1];
  222. };
  223. /* Number of elements of the HWIVEC if RTX is a CONST_WIDE_INT. */
  224. #define CWI_GET_NUM_ELEM(RTX) \
  225. ((int)RTL_FLAG_CHECK1("CWI_GET_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem)
  226. #define CWI_PUT_NUM_ELEM(RTX, NUM) \
  227. (RTL_FLAG_CHECK1("CWI_PUT_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem = (NUM))
  228. struct GTY((variable_size)) const_poly_int_def {
  229. trailing_wide_ints<NUM_POLY_INT_COEFFS> coeffs;
  230. };
  231. /* RTL expression ("rtx"). */
  232. /* The GTY "desc" and "tag" options below are a kludge: we need a desc
  233. field for gengtype to recognize that inheritance is occurring,
  234. so that all subclasses are redirected to the traversal hook for the
  235. base class.
  236. However, all of the fields are in the base class, and special-casing
  237. is at work. Hence we use desc and tag of 0, generating a switch
  238. statement of the form:
  239. switch (0)
  240. {
  241. case 0: // all the work happens here
  242. }
  243. in order to work with the existing special-casing in gengtype. */
  244. struct GTY((desc("0"), tag("0"),
  245. chain_next ("RTX_NEXT (&%h)"),
  246. chain_prev ("RTX_PREV (&%h)"))) rtx_def {
  247. /* The kind of expression this is. */
  248. ENUM_BITFIELD(rtx_code) code: 16;
  249. /* The kind of value the expression has. */
  250. ENUM_BITFIELD(machine_mode) mode : 8;
  251. /* 1 in a MEM if we should keep the alias set for this mem unchanged
  252. when we access a component.
  253. 1 in a JUMP_INSN if it is a crossing jump.
  254. 1 in a CALL_INSN if it is a sibling call.
  255. 1 in a SET that is for a return.
  256. In a CODE_LABEL, part of the two-bit alternate entry field.
  257. 1 in a CONCAT is VAL_EXPR_IS_COPIED in var-tracking.c.
  258. 1 in a VALUE is SP_BASED_VALUE_P in cselib.c.
  259. 1 in a SUBREG generated by LRA for reload insns.
  260. 1 in a REG if this is a static chain register.
  261. 1 in a CALL for calls instrumented by Pointer Bounds Checker.
  262. Dumped as "/j" in RTL dumps. */
  263. unsigned int jump : 1;
  264. /* In a CODE_LABEL, part of the two-bit alternate entry field.
  265. 1 in a MEM if it cannot trap.
  266. 1 in a CALL_INSN logically equivalent to
  267. ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P.
  268. Dumped as "/c" in RTL dumps. */
  269. unsigned int call : 1;
  270. /* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
  271. 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
  272. 1 in a SYMBOL_REF if it addresses something in the per-function
  273. constants pool.
  274. 1 in a CALL_INSN logically equivalent to ECF_CONST and TREE_READONLY.
  275. 1 in a NOTE, or EXPR_LIST for a const call.
  276. 1 in a JUMP_INSN of an annulling branch.
  277. 1 in a CONCAT is VAL_EXPR_IS_CLOBBERED in var-tracking.c.
  278. 1 in a preserved VALUE is PRESERVED_VALUE_P in cselib.c.
  279. 1 in a clobber temporarily created for LRA.
  280. Dumped as "/u" in RTL dumps. */
  281. unsigned int unchanging : 1;
  282. /* 1 in a MEM or ASM_OPERANDS expression if the memory reference is volatile.
  283. 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL, BARRIER, or NOTE
  284. if it has been deleted.
  285. 1 in a REG expression if corresponds to a variable declared by the user,
  286. 0 for an internally generated temporary.
  287. 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P.
  288. 1 in a LABEL_REF, REG_LABEL_TARGET or REG_LABEL_OPERAND note for a
  289. non-local label.
  290. In a SYMBOL_REF, this flag is used for machine-specific purposes.
  291. In a PREFETCH, this flag indicates that it should be considered a
  292. scheduling barrier.
  293. 1 in a CONCAT is VAL_NEEDS_RESOLUTION in var-tracking.c.
  294. Dumped as "/v" in RTL dumps. */
  295. unsigned int volatil : 1;
  296. /* 1 in a REG if the register is used only in exit code a loop.
  297. 1 in a SUBREG expression if was generated from a variable with a
  298. promoted mode.
  299. 1 in a CODE_LABEL if the label is used for nonlocal gotos
  300. and must not be deleted even if its count is zero.
  301. 1 in an INSN, JUMP_INSN or CALL_INSN if this insn must be scheduled
  302. together with the preceding insn. Valid only within sched.
  303. 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
  304. from the target of a branch. Valid from reorg until end of compilation;
  305. cleared before used.
  306. The name of the field is historical. It used to be used in MEMs
  307. to record whether the MEM accessed part of a structure.
  308. Dumped as "/s" in RTL dumps. */
  309. unsigned int in_struct : 1;
  310. /* At the end of RTL generation, 1 if this rtx is used. This is used for
  311. copying shared structure. See `unshare_all_rtl'.
  312. In a REG, this is not needed for that purpose, and used instead
  313. in `leaf_renumber_regs_insn'.
  314. 1 in a SYMBOL_REF, means that emit_library_call
  315. has used it as the function.
  316. 1 in a CONCAT is VAL_HOLDS_TRACK_EXPR in var-tracking.c.
  317. 1 in a VALUE or DEBUG_EXPR is VALUE_RECURSED_INTO in var-tracking.c. */
  318. unsigned int used : 1;
  319. /* 1 in an INSN or a SET if this rtx is related to the call frame,
  320. either changing how we compute the frame address or saving and
  321. restoring registers in the prologue and epilogue.
  322. 1 in a REG or MEM if it is a pointer.
  323. 1 in a SYMBOL_REF if it addresses something in the per-function
  324. constant string pool.
  325. 1 in a VALUE is VALUE_CHANGED in var-tracking.c.
  326. Dumped as "/f" in RTL dumps. */
  327. unsigned frame_related : 1;
  328. /* 1 in a REG or PARALLEL that is the current function's return value.
  329. 1 in a SYMBOL_REF for a weak symbol.
  330. 1 in a CALL_INSN logically equivalent to ECF_PURE and DECL_PURE_P.
  331. 1 in a CONCAT is VAL_EXPR_HAS_REVERSE in var-tracking.c.
  332. 1 in a VALUE or DEBUG_EXPR is NO_LOC_P in var-tracking.c.
  333. Dumped as "/i" in RTL dumps. */
  334. unsigned return_val : 1;
  335. union {
  336. /* The final union field is aligned to 64 bits on LP64 hosts,
  337. giving a 32-bit gap after the fields above. We optimize the
  338. layout for that case and use the gap for extra code-specific
  339. information. */
  340. /* The ORIGINAL_REGNO of a REG. */
  341. unsigned int original_regno;
  342. /* The INSN_UID of an RTX_INSN-class code. */
  343. int insn_uid;
  344. /* The SYMBOL_REF_FLAGS of a SYMBOL_REF. */
  345. unsigned int symbol_ref_flags;
  346. /* The PAT_VAR_LOCATION_STATUS of a VAR_LOCATION. */
  347. enum var_init_status var_location_status;
  348. /* In a CONST_WIDE_INT (aka hwivec_def), this is the number of
  349. HOST_WIDE_INTs in the hwivec_def. */
  350. unsigned int num_elem;
  351. /* Information about a CONST_VECTOR. */
  352. struct
  353. {
  354. /* The value of CONST_VECTOR_NPATTERNS. */
  355. unsigned int npatterns : 16;
  356. /* The value of CONST_VECTOR_NELTS_PER_PATTERN. */
  357. unsigned int nelts_per_pattern : 8;
  358. /* For future expansion. */
  359. unsigned int unused : 8;
  360. } const_vector;
  361. } GTY ((skip)) u2;
  362. /* The first element of the operands of this rtx.
  363. The number of operands and their types are controlled
  364. by the `code' field, according to rtl.def. */
  365. union u {
  366. rtunion fld[1];
  367. HOST_WIDE_INT hwint[1];
  368. struct reg_info reg;
  369. struct block_symbol block_sym;
  370. struct real_value rv;
  371. struct fixed_value fv;
  372. struct hwivec_def hwiv;
  373. struct const_poly_int_def cpi;
  374. } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
  375. };
  376. /* A node for constructing singly-linked lists of rtx. */
  377. class GTY(()) rtx_expr_list : public rtx_def
  378. {
  379. /* No extra fields, but adds invariant: (GET_CODE (X) == EXPR_LIST). */
  380. public:
  381. /* Get next in list. */
  382. rtx_expr_list *next () const;
  383. /* Get at the underlying rtx. */
  384. rtx element () const;
  385. };
  386. template <>
  387. template <>
  388. inline bool
  389. is_a_helper <rtx_expr_list *>::test (rtx rt)
  390. {
  391. return rt->code == EXPR_LIST;
  392. }
  393. class GTY(()) rtx_insn_list : public rtx_def
  394. {
  395. /* No extra fields, but adds invariant: (GET_CODE (X) == INSN_LIST).
  396. This is an instance of:
  397. DEF_RTL_EXPR(INSN_LIST, "insn_list", "ue", RTX_EXTRA)
  398. i.e. a node for constructing singly-linked lists of rtx_insn *, where
  399. the list is "external" to the insn (as opposed to the doubly-linked
  400. list embedded within rtx_insn itself). */
  401. public:
  402. /* Get next in list. */
  403. rtx_insn_list *next () const;
  404. /* Get at the underlying instruction. */
  405. rtx_insn *insn () const;
  406. };
  407. template <>
  408. template <>
  409. inline bool
  410. is_a_helper <rtx_insn_list *>::test (rtx rt)
  411. {
  412. return rt->code == INSN_LIST;
  413. }
  414. /* A node with invariant GET_CODE (X) == SEQUENCE i.e. a vector of rtx,
  415. typically (but not always) of rtx_insn *, used in the late passes. */
  416. class GTY(()) rtx_sequence : public rtx_def
  417. {
  418. /* No extra fields, but adds invariant: (GET_CODE (X) == SEQUENCE). */
  419. public:
  420. /* Get number of elements in sequence. */
  421. int len () const;
  422. /* Get i-th element of the sequence. */
  423. rtx element (int index) const;
  424. /* Get i-th element of the sequence, with a checked cast to
  425. rtx_insn *. */
  426. rtx_insn *insn (int index) const;
  427. };
  428. template <>
  429. template <>
  430. inline bool
  431. is_a_helper <rtx_sequence *>::test (rtx rt)
  432. {
  433. return rt->code == SEQUENCE;
  434. }
  435. template <>
  436. template <>
  437. inline bool
  438. is_a_helper <const rtx_sequence *>::test (const_rtx rt)
  439. {
  440. return rt->code == SEQUENCE;
  441. }
  442. class GTY(()) rtx_insn : public rtx_def
  443. {
  444. public:
  445. /* No extra fields, but adds the invariant:
  446. (INSN_P (X)
  447. || NOTE_P (X)
  448. || JUMP_TABLE_DATA_P (X)
  449. || BARRIER_P (X)
  450. || LABEL_P (X))
  451. i.e. that we must be able to use the following:
  452. INSN_UID ()
  453. NEXT_INSN ()
  454. PREV_INSN ()
  455. i.e. we have an rtx that has an INSN_UID field and can be part of
  456. a linked list of insns.
  457. */
  458. /* Returns true if this insn has been deleted. */
  459. bool deleted () const { return volatil; }
  460. /* Mark this insn as deleted. */
  461. void set_deleted () { volatil = true; }
  462. /* Mark this insn as not deleted. */
  463. void set_undeleted () { volatil = false; }
  464. };
  465. /* Subclasses of rtx_insn. */
  466. class GTY(()) rtx_debug_insn : public rtx_insn
  467. {
  468. /* No extra fields, but adds the invariant:
  469. DEBUG_INSN_P (X) aka (GET_CODE (X) == DEBUG_INSN)
  470. i.e. an annotation for tracking variable assignments.
  471. This is an instance of:
  472. DEF_RTL_EXPR(DEBUG_INSN, "debug_insn", "uuBeiie", RTX_INSN)
  473. from rtl.def. */
  474. };
  475. class GTY(()) rtx_nonjump_insn : public rtx_insn
  476. {
  477. /* No extra fields, but adds the invariant:
  478. NONJUMP_INSN_P (X) aka (GET_CODE (X) == INSN)
  479. i.e an instruction that cannot jump.
  480. This is an instance of:
  481. DEF_RTL_EXPR(INSN, "insn", "uuBeiie", RTX_INSN)
  482. from rtl.def. */
  483. };
  484. class GTY(()) rtx_jump_insn : public rtx_insn
  485. {
  486. public:
  487. /* No extra fields, but adds the invariant:
  488. JUMP_P (X) aka (GET_CODE (X) == JUMP_INSN)
  489. i.e. an instruction that can possibly jump.
  490. This is an instance of:
  491. DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "uuBeiie0", RTX_INSN)
  492. from rtl.def. */
  493. /* Returns jump target of this instruction. The returned value is not
  494. necessarily a code label: it may also be a RETURN or SIMPLE_RETURN
  495. expression. Also, when the code label is marked "deleted", it is
  496. replaced by a NOTE. In some cases the value is NULL_RTX. */
  497. inline rtx jump_label () const;
  498. /* Returns jump target cast to rtx_code_label *. */
  499. inline rtx_code_label *jump_target () const;
  500. /* Set jump target. */
  501. inline void set_jump_target (rtx_code_label *);
  502. };
  503. class GTY(()) rtx_call_insn : public rtx_insn
  504. {
  505. /* No extra fields, but adds the invariant:
  506. CALL_P (X) aka (GET_CODE (X) == CALL_INSN)
  507. i.e. an instruction that can possibly call a subroutine
  508. but which will not change which instruction comes next
  509. in the current function.
  510. This is an instance of:
  511. DEF_RTL_EXPR(CALL_INSN, "call_insn", "uuBeiiee", RTX_INSN)
  512. from rtl.def. */
  513. };
  514. class GTY(()) rtx_jump_table_data : public rtx_insn
  515. {
  516. /* No extra fields, but adds the invariant:
  517. JUMP_TABLE_DATA_P (X) aka (GET_CODE (INSN) == JUMP_TABLE_DATA)
  518. i.e. a data for a jump table, considered an instruction for
  519. historical reasons.
  520. This is an instance of:
  521. DEF_RTL_EXPR(JUMP_TABLE_DATA, "jump_table_data", "uuBe0000", RTX_INSN)
  522. from rtl.def. */
  523. public:
  524. /* This can be either:
  525. (a) a table of absolute jumps, in which case PATTERN (this) is an
  526. ADDR_VEC with arg 0 a vector of labels, or
  527. (b) a table of relative jumps (e.g. for -fPIC), in which case
  528. PATTERN (this) is an ADDR_DIFF_VEC, with arg 0 a LABEL_REF and
  529. arg 1 the vector of labels.
  530. This method gets the underlying vec. */
  531. inline rtvec get_labels () const;
  532. inline scalar_int_mode get_data_mode () const;
  533. };
  534. class GTY(()) rtx_barrier : public rtx_insn
  535. {
  536. /* No extra fields, but adds the invariant:
  537. BARRIER_P (X) aka (GET_CODE (X) == BARRIER)
  538. i.e. a marker that indicates that control will not flow through.
  539. This is an instance of:
  540. DEF_RTL_EXPR(BARRIER, "barrier", "uu00000", RTX_EXTRA)
  541. from rtl.def. */
  542. };
  543. class GTY(()) rtx_code_label : public rtx_insn
  544. {
  545. /* No extra fields, but adds the invariant:
  546. LABEL_P (X) aka (GET_CODE (X) == CODE_LABEL)
  547. i.e. a label in the assembler.
  548. This is an instance of:
  549. DEF_RTL_EXPR(CODE_LABEL, "code_label", "uuB00is", RTX_EXTRA)
  550. from rtl.def. */
  551. };
  552. class GTY(()) rtx_note : public rtx_insn
  553. {
  554. /* No extra fields, but adds the invariant:
  555. NOTE_P(X) aka (GET_CODE (X) == NOTE)
  556. i.e. a note about the corresponding source code.
  557. This is an instance of:
  558. DEF_RTL_EXPR(NOTE, "note", "uuB0ni", RTX_EXTRA)
  559. from rtl.def. */
  560. };
  561. /* The size in bytes of an rtx header (code, mode and flags). */
  562. #define RTX_HDR_SIZE offsetof (struct rtx_def, u)
  563. /* The size in bytes of an rtx with code CODE. */
  564. #define RTX_CODE_SIZE(CODE) rtx_code_size[CODE]
  565. #define NULL_RTX (rtx) 0
  566. /* The "next" and "previous" RTX, relative to this one. */
  567. #define RTX_NEXT(X) (rtx_next[GET_CODE (X)] == 0 ? NULL \
  568. : *(rtx *)(((char *)X) + rtx_next[GET_CODE (X)]))
  569. /* FIXME: the "NEXT_INSN (PREV_INSN (X)) == X" condition shouldn't be needed.
  570. */
  571. #define RTX_PREV(X) ((INSN_P (X) \
  572. || NOTE_P (X) \
  573. || JUMP_TABLE_DATA_P (X) \
  574. || BARRIER_P (X) \
  575. || LABEL_P (X)) \
  576. && PREV_INSN (as_a <rtx_insn *> (X)) != NULL \
  577. && NEXT_INSN (PREV_INSN (as_a <rtx_insn *> (X))) == X \
  578. ? PREV_INSN (as_a <rtx_insn *> (X)) : NULL)
  579. /* Define macros to access the `code' field of the rtx. */
  580. #define GET_CODE(RTX) ((enum rtx_code) (RTX)->code)
  581. #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
  582. #define GET_MODE(RTX) ((machine_mode) (RTX)->mode)
  583. #define PUT_MODE_RAW(RTX, MODE) ((RTX)->mode = (MODE))
  584. /* RTL vector. These appear inside RTX's when there is a need
  585. for a variable number of things. The principle use is inside
  586. PARALLEL expressions. */
  587. struct GTY(()) rtvec_def {
  588. int num_elem; /* number of elements */
  589. rtx GTY ((length ("%h.num_elem"))) elem[1];
  590. };
  591. #define NULL_RTVEC (rtvec) 0
  592. #define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
  593. #define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (NUM))
  594. /* Predicate yielding nonzero iff X is an rtx for a register. */
  595. #define REG_P(X) (GET_CODE (X) == REG)
  596. /* Predicate yielding nonzero iff X is an rtx for a memory location. */
  597. #define MEM_P(X) (GET_CODE (X) == MEM)
  598. #if TARGET_SUPPORTS_WIDE_INT
  599. /* Match CONST_*s that can represent compile-time constant integers. */
  600. #define CASE_CONST_SCALAR_INT \
  601. case CONST_INT: \
  602. case CONST_WIDE_INT
  603. /* Match CONST_*s for which pointer equality corresponds to value
  604. equality. */
  605. #define CASE_CONST_UNIQUE \
  606. case CONST_INT: \
  607. case CONST_WIDE_INT: \
  608. case CONST_POLY_INT: \
  609. case CONST_DOUBLE: \
  610. case CONST_FIXED
  611. /* Match all CONST_* rtxes. */
  612. #define CASE_CONST_ANY \
  613. case CONST_INT: \
  614. case CONST_WIDE_INT: \
  615. case CONST_POLY_INT: \
  616. case CONST_DOUBLE: \
  617. case CONST_FIXED: \
  618. case CONST_VECTOR
  619. #else
  620. /* Match CONST_*s that can represent compile-time constant integers. */
  621. #define CASE_CONST_SCALAR_INT \
  622. case CONST_INT: \
  623. case CONST_DOUBLE
  624. /* Match CONST_*s for which pointer equality corresponds to value
  625. equality. */
  626. #define CASE_CONST_UNIQUE \
  627. case CONST_INT: \
  628. case CONST_DOUBLE: \
  629. case CONST_FIXED
  630. /* Match all CONST_* rtxes. */
  631. #define CASE_CONST_ANY \
  632. case CONST_INT: \
  633. case CONST_DOUBLE: \
  634. case CONST_FIXED: \
  635. case CONST_VECTOR
  636. #endif
  637. /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
  638. #define CONST_INT_P(X) (GET_CODE (X) == CONST_INT)
  639. /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
  640. #define CONST_WIDE_INT_P(X) (GET_CODE (X) == CONST_WIDE_INT)
  641. /* Predicate yielding nonzero iff X is an rtx for a polynomial constant
  642. integer. */
  643. #define CONST_POLY_INT_P(X) \
  644. (NUM_POLY_INT_COEFFS > 1 && GET_CODE (X) == CONST_POLY_INT)
  645. /* Predicate yielding nonzero iff X is an rtx for a constant fixed-point. */
  646. #define CONST_FIXED_P(X) (GET_CODE (X) == CONST_FIXED)
  647. /* Predicate yielding true iff X is an rtx for a double-int
  648. or floating point constant. */
  649. #define CONST_DOUBLE_P(X) (GET_CODE (X) == CONST_DOUBLE)
  650. /* Predicate yielding true iff X is an rtx for a double-int. */
  651. #define CONST_DOUBLE_AS_INT_P(X) \
  652. (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == VOIDmode)
  653. /* Predicate yielding true iff X is an rtx for a integer const. */
  654. #if TARGET_SUPPORTS_WIDE_INT
  655. #define CONST_SCALAR_INT_P(X) \
  656. (CONST_INT_P (X) || CONST_WIDE_INT_P (X))
  657. #else
  658. #define CONST_SCALAR_INT_P(X) \
  659. (CONST_INT_P (X) || CONST_DOUBLE_AS_INT_P (X))
  660. #endif
  661. /* Predicate yielding true iff X is an rtx for a double-int. */
  662. #define CONST_DOUBLE_AS_FLOAT_P(X) \
  663. (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode)
  664. /* Predicate yielding nonzero iff X is a label insn. */
  665. #define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)
  666. /* Predicate yielding nonzero iff X is a jump insn. */
  667. #define JUMP_P(X) (GET_CODE (X) == JUMP_INSN)
  668. /* Predicate yielding nonzero iff X is a call insn. */
  669. #define CALL_P(X) (GET_CODE (X) == CALL_INSN)
  670. /* Predicate yielding nonzero iff X is an insn that cannot jump. */
  671. #define NONJUMP_INSN_P(X) (GET_CODE (X) == INSN)
  672. /* Predicate yielding nonzero iff X is a debug note/insn. */
  673. #define DEBUG_INSN_P(X) (GET_CODE (X) == DEBUG_INSN)
  674. /* Predicate yielding nonzero iff X is an insn that is not a debug insn. */
  675. #define NONDEBUG_INSN_P(X) (INSN_P (X) && !DEBUG_INSN_P (X))
  676. /* Nonzero if DEBUG_MARKER_INSN_P may possibly hold. */
  677. #define MAY_HAVE_DEBUG_MARKER_INSNS debug_nonbind_markers_p
  678. /* Nonzero if DEBUG_BIND_INSN_P may possibly hold. */
  679. #define MAY_HAVE_DEBUG_BIND_INSNS flag_var_tracking_assignments
  680. /* Nonzero if DEBUG_INSN_P may possibly hold. */
  681. #define MAY_HAVE_DEBUG_INSNS \
  682. (MAY_HAVE_DEBUG_MARKER_INSNS || MAY_HAVE_DEBUG_BIND_INSNS)
  683. /* Predicate yielding nonzero iff X is a real insn. */
  684. #define INSN_P(X) \
  685. (NONJUMP_INSN_P (X) || DEBUG_INSN_P (X) || JUMP_P (X) || CALL_P (X))
  686. /* Predicate yielding nonzero iff X is a note insn. */
  687. #define NOTE_P(X) (GET_CODE (X) == NOTE)
  688. /* Predicate yielding nonzero iff X is a barrier insn. */
  689. #define BARRIER_P(X) (GET_CODE (X) == BARRIER)
  690. /* Predicate yielding nonzero iff X is a data for a jump table. */
  691. #define JUMP_TABLE_DATA_P(INSN) (GET_CODE (INSN) == JUMP_TABLE_DATA)
  692. /* Predicate yielding nonzero iff RTX is a subreg. */
  693. #define SUBREG_P(RTX) (GET_CODE (RTX) == SUBREG)
  694. /* Predicate yielding true iff RTX is a symbol ref. */
  695. #define SYMBOL_REF_P(RTX) (GET_CODE (RTX) == SYMBOL_REF)
  696. template <>
  697. template <>
  698. inline bool
  699. is_a_helper <rtx_insn *>::test (rtx rt)
  700. {
  701. return (INSN_P (rt)
  702. || NOTE_P (rt)
  703. || JUMP_TABLE_DATA_P (rt)
  704. || BARRIER_P (rt)
  705. || LABEL_P (rt));
  706. }
  707. template <>
  708. template <>
  709. inline bool
  710. is_a_helper <const rtx_insn *>::test (const_rtx rt)
  711. {
  712. return (INSN_P (rt)
  713. || NOTE_P (rt)
  714. || JUMP_TABLE_DATA_P (rt)
  715. || BARRIER_P (rt)
  716. || LABEL_P (rt));
  717. }
  718. template <>
  719. template <>
  720. inline bool
  721. is_a_helper <rtx_debug_insn *>::test (rtx rt)
  722. {
  723. return DEBUG_INSN_P (rt);
  724. }
  725. template <>
  726. template <>
  727. inline bool
  728. is_a_helper <rtx_nonjump_insn *>::test (rtx rt)
  729. {
  730. return NONJUMP_INSN_P (rt);
  731. }
  732. template <>
  733. template <>
  734. inline bool
  735. is_a_helper <rtx_jump_insn *>::test (rtx rt)
  736. {
  737. return JUMP_P (rt);
  738. }
  739. template <>
  740. template <>
  741. inline bool
  742. is_a_helper <rtx_jump_insn *>::test (rtx_insn *insn)
  743. {
  744. return JUMP_P (insn);
  745. }
  746. template <>
  747. template <>
  748. inline bool
  749. is_a_helper <rtx_call_insn *>::test (rtx rt)
  750. {
  751. return CALL_P (rt);
  752. }
  753. template <>
  754. template <>
  755. inline bool
  756. is_a_helper <rtx_call_insn *>::test (rtx_insn *insn)
  757. {
  758. return CALL_P (insn);
  759. }
  760. template <>
  761. template <>
  762. inline bool
  763. is_a_helper <rtx_jump_table_data *>::test (rtx rt)
  764. {
  765. return JUMP_TABLE_DATA_P (rt);
  766. }
  767. template <>
  768. template <>
  769. inline bool
  770. is_a_helper <rtx_jump_table_data *>::test (rtx_insn *insn)
  771. {
  772. return JUMP_TABLE_DATA_P (insn);
  773. }
  774. template <>
  775. template <>
  776. inline bool
  777. is_a_helper <rtx_barrier *>::test (rtx rt)
  778. {
  779. return BARRIER_P (rt);
  780. }
  781. template <>
  782. template <>
  783. inline bool
  784. is_a_helper <rtx_code_label *>::test (rtx rt)
  785. {
  786. return LABEL_P (rt);
  787. }
  788. template <>
  789. template <>
  790. inline bool
  791. is_a_helper <rtx_code_label *>::test (rtx_insn *insn)
  792. {
  793. return LABEL_P (insn);
  794. }
  795. template <>
  796. template <>
  797. inline bool
  798. is_a_helper <rtx_note *>::test (rtx rt)
  799. {
  800. return NOTE_P (rt);
  801. }
  802. template <>
  803. template <>
  804. inline bool
  805. is_a_helper <rtx_note *>::test (rtx_insn *insn)
  806. {
  807. return NOTE_P (insn);
  808. }
  809. /* Predicate yielding nonzero iff X is a return or simple_return. */
  810. #define ANY_RETURN_P(X) \
  811. (GET_CODE (X) == RETURN || GET_CODE (X) == SIMPLE_RETURN)
  812. /* 1 if X is a unary operator. */
  813. #define UNARY_P(X) \
  814. (GET_RTX_CLASS (GET_CODE (X)) == RTX_UNARY)
  815. /* 1 if X is a binary operator. */
  816. #define BINARY_P(X) \
  817. ((GET_RTX_CLASS (GET_CODE (X)) & RTX_BINARY_MASK) == RTX_BINARY_RESULT)
  818. /* 1 if X is an arithmetic operator. */
  819. #define ARITHMETIC_P(X) \
  820. ((GET_RTX_CLASS (GET_CODE (X)) & RTX_ARITHMETIC_MASK) \
  821. == RTX_ARITHMETIC_RESULT)
  822. /* 1 if X is an arithmetic operator. */
  823. #define COMMUTATIVE_ARITH_P(X) \
  824. (GET_RTX_CLASS (GET_CODE (X)) == RTX_COMM_ARITH)
  825. /* 1 if X is a commutative arithmetic operator or a comparison operator.
  826. These two are sometimes selected together because it is possible to
  827. swap the two operands. */
  828. #define SWAPPABLE_OPERANDS_P(X) \
  829. ((1 << GET_RTX_CLASS (GET_CODE (X))) \
  830. & ((1 << RTX_COMM_ARITH) | (1 << RTX_COMM_COMPARE) \
  831. | (1 << RTX_COMPARE)))
  832. /* 1 if X is a non-commutative operator. */
  833. #define NON_COMMUTATIVE_P(X) \
  834. ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
  835. == RTX_NON_COMMUTATIVE_RESULT)
  836. /* 1 if X is a commutative operator on integers. */
  837. #define COMMUTATIVE_P(X) \
  838. ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \
  839. == RTX_COMMUTATIVE_RESULT)
  840. /* 1 if X is a relational operator. */
  841. #define COMPARISON_P(X) \
  842. ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMPARE_MASK) == RTX_COMPARE_RESULT)
  843. /* 1 if X is a constant value that is an integer. */
  844. #define CONSTANT_P(X) \
  845. (GET_RTX_CLASS (GET_CODE (X)) == RTX_CONST_OBJ)
  846. /* 1 if X can be used to represent an object. */
  847. #define OBJECT_P(X) \
  848. ((GET_RTX_CLASS (GET_CODE (X)) & RTX_OBJ_MASK) == RTX_OBJ_RESULT)
  849. /* General accessor macros for accessing the fields of an rtx. */
  850. #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
  851. /* The bit with a star outside the statement expr and an & inside is
  852. so that N can be evaluated only once. */
  853. #define RTL_CHECK1(RTX, N, C1) __extension__ \
  854. (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
  855. const enum rtx_code _code = GET_CODE (_rtx); \
  856. if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
  857. rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
  858. __FUNCTION__); \
  859. if (GET_RTX_FORMAT (_code)[_n] != C1) \
  860. rtl_check_failed_type1 (_rtx, _n, C1, __FILE__, __LINE__, \
  861. __FUNCTION__); \
  862. &_rtx->u.fld[_n]; }))
  863. #define RTL_CHECK2(RTX, N, C1, C2) __extension__ \
  864. (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
  865. const enum rtx_code _code = GET_CODE (_rtx); \
  866. if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
  867. rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
  868. __FUNCTION__); \
  869. if (GET_RTX_FORMAT (_code)[_n] != C1 \
  870. && GET_RTX_FORMAT (_code)[_n] != C2) \
  871. rtl_check_failed_type2 (_rtx, _n, C1, C2, __FILE__, __LINE__, \
  872. __FUNCTION__); \
  873. &_rtx->u.fld[_n]; }))
  874. #define RTL_CHECKC1(RTX, N, C) __extension__ \
  875. (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
  876. if (GET_CODE (_rtx) != (C)) \
  877. rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
  878. __FUNCTION__); \
  879. &_rtx->u.fld[_n]; }))
  880. #define RTL_CHECKC2(RTX, N, C1, C2) __extension__ \
  881. (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
  882. const enum rtx_code _code = GET_CODE (_rtx); \
  883. if (_code != (C1) && _code != (C2)) \
  884. rtl_check_failed_code2 (_rtx, (C1), (C2), __FILE__, __LINE__, \
  885. __FUNCTION__); \
  886. &_rtx->u.fld[_n]; }))
  887. #define RTVEC_ELT(RTVEC, I) __extension__ \
  888. (*({ __typeof (RTVEC) const _rtvec = (RTVEC); const int _i = (I); \
  889. if (_i < 0 || _i >= GET_NUM_ELEM (_rtvec)) \
  890. rtvec_check_failed_bounds (_rtvec, _i, __FILE__, __LINE__, \
  891. __FUNCTION__); \
  892. &_rtvec->elem[_i]; }))
  893. #define XWINT(RTX, N) __extension__ \
  894. (*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \
  895. const enum rtx_code _code = GET_CODE (_rtx); \
  896. if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
  897. rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
  898. __FUNCTION__); \
  899. if (GET_RTX_FORMAT (_code)[_n] != 'w') \
  900. rtl_check_failed_type1 (_rtx, _n, 'w', __FILE__, __LINE__, \
  901. __FUNCTION__); \
  902. &_rtx->u.hwint[_n]; }))
  903. #define CWI_ELT(RTX, I) __extension__ \
  904. (*({ __typeof (RTX) const _cwi = (RTX); \
  905. int _max = CWI_GET_NUM_ELEM (_cwi); \
  906. const int _i = (I); \
  907. if (_i < 0 || _i >= _max) \
  908. cwi_check_failed_bounds (_cwi, _i, __FILE__, __LINE__, \
  909. __FUNCTION__); \
  910. &_cwi->u.hwiv.elem[_i]; }))
  911. #define XCWINT(RTX, N, C) __extension__ \
  912. (*({ __typeof (RTX) const _rtx = (RTX); \
  913. if (GET_CODE (_rtx) != (C)) \
  914. rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \
  915. __FUNCTION__); \
  916. &_rtx->u.hwint[N]; }))
  917. #define XCMWINT(RTX, N, C, M) __extension__ \
  918. (*({ __typeof (RTX) const _rtx = (RTX); \
  919. if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) != (M)) \
  920. rtl_check_failed_code_mode (_rtx, (C), (M), false, __FILE__, \
  921. __LINE__, __FUNCTION__); \
  922. &_rtx->u.hwint[N]; }))
  923. #define XCNMPRV(RTX, C, M) __extension__ \
  924. ({ __typeof (RTX) const _rtx = (RTX); \
  925. if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
  926. rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
  927. __LINE__, __FUNCTION__); \
  928. &_rtx->u.rv; })
  929. #define XCNMPFV(RTX, C, M) __extension__ \
  930. ({ __typeof (RTX) const _rtx = (RTX); \
  931. if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
  932. rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
  933. __LINE__, __FUNCTION__); \
  934. &_rtx->u.fv; })
  935. #define REG_CHECK(RTX) __extension__ \
  936. ({ __typeof (RTX) const _rtx = (RTX); \
  937. if (GET_CODE (_rtx) != REG) \
  938. rtl_check_failed_code1 (_rtx, REG, __FILE__, __LINE__, \
  939. __FUNCTION__); \
  940. &_rtx->u.reg; })
  941. #define BLOCK_SYMBOL_CHECK(RTX) __extension__ \
  942. ({ __typeof (RTX) const _symbol = (RTX); \
  943. const unsigned int flags = SYMBOL_REF_FLAGS (_symbol); \
  944. if ((flags & SYMBOL_FLAG_HAS_BLOCK_INFO) == 0) \
  945. rtl_check_failed_block_symbol (__FILE__, __LINE__, \
  946. __FUNCTION__); \
  947. &_symbol->u.block_sym; })
  948. #define HWIVEC_CHECK(RTX,C) __extension__ \
  949. ({ __typeof (RTX) const _symbol = (RTX); \
  950. RTL_CHECKC1 (_symbol, 0, C); \
  951. &_symbol->u.hwiv; })
  952. extern void rtl_check_failed_bounds (const_rtx, int, const char *, int,
  953. const char *)
  954. ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
  955. extern void rtl_check_failed_type1 (const_rtx, int, int, const char *, int,
  956. const char *)
  957. ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
  958. extern void rtl_check_failed_type2 (const_rtx, int, int, int, const char *,
  959. int, const char *)
  960. ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
  961. extern void rtl_check_failed_code1 (const_rtx, enum rtx_code, const char *,
  962. int, const char *)
  963. ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
  964. extern void rtl_check_failed_code2 (const_rtx, enum rtx_code, enum rtx_code,
  965. const char *, int, const char *)
  966. ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
  967. extern void rtl_check_failed_code_mode (const_rtx, enum rtx_code, machine_mode,
  968. bool, const char *, int, const char *)
  969. ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
  970. extern void rtl_check_failed_block_symbol (const char *, int, const char *)
  971. ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
  972. extern void cwi_check_failed_bounds (const_rtx, int, const char *, int,
  973. const char *)
  974. ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
  975. extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
  976. const char *)
  977. ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
  978. #else /* not ENABLE_RTL_CHECKING */
  979. #define RTL_CHECK1(RTX, N, C1) ((RTX)->u.fld[N])
  980. #define RTL_CHECK2(RTX, N, C1, C2) ((RTX)->u.fld[N])
  981. #define RTL_CHECKC1(RTX, N, C) ((RTX)->u.fld[N])
  982. #define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->u.fld[N])
  983. #define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[I])
  984. #define XWINT(RTX, N) ((RTX)->u.hwint[N])
  985. #define CWI_ELT(RTX, I) ((RTX)->u.hwiv.elem[I])
  986. #define XCWINT(RTX, N, C) ((RTX)->u.hwint[N])
  987. #define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
  988. #define XCNMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
  989. #define XCNMPRV(RTX, C, M) (&(RTX)->u.rv)
  990. #define XCNMPFV(RTX, C, M) (&(RTX)->u.fv)
  991. #define REG_CHECK(RTX) (&(RTX)->u.reg)
  992. #define BLOCK_SYMBOL_CHECK(RTX) (&(RTX)->u.block_sym)
  993. #define HWIVEC_CHECK(RTX,C) (&(RTX)->u.hwiv)
  994. #endif
  995. /* General accessor macros for accessing the flags of an rtx. */
  996. /* Access an individual rtx flag, with no checking of any kind. */
  997. #define RTX_FLAG(RTX, FLAG) ((RTX)->FLAG)
  998. #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
  999. #define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__ \
  1000. ({ __typeof (RTX) const _rtx = (RTX); \
  1001. if (GET_CODE (_rtx) != C1) \
  1002. rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
  1003. __FUNCTION__); \
  1004. _rtx; })
  1005. #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) __extension__ \
  1006. ({ __typeof (RTX) const _rtx = (RTX); \
  1007. if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2) \
  1008. rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
  1009. __FUNCTION__); \
  1010. _rtx; })
  1011. #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) __extension__ \
  1012. ({ __typeof (RTX) const _rtx = (RTX); \
  1013. if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
  1014. && GET_CODE (_rtx) != C3) \
  1015. rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
  1016. __FUNCTION__); \
  1017. _rtx; })
  1018. #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) __extension__ \
  1019. ({ __typeof (RTX) const _rtx = (RTX); \
  1020. if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
  1021. && GET_CODE (_rtx) != C3 && GET_CODE(_rtx) != C4) \
  1022. rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
  1023. __FUNCTION__); \
  1024. _rtx; })
  1025. #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) __extension__ \
  1026. ({ __typeof (RTX) const _rtx = (RTX); \
  1027. if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
  1028. && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
  1029. && GET_CODE (_rtx) != C5) \
  1030. rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
  1031. __FUNCTION__); \
  1032. _rtx; })
  1033. #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) \
  1034. __extension__ \
  1035. ({ __typeof (RTX) const _rtx = (RTX); \
  1036. if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
  1037. && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
  1038. && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6) \
  1039. rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
  1040. __FUNCTION__); \
  1041. _rtx; })
  1042. #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) \
  1043. __extension__ \
  1044. ({ __typeof (RTX) const _rtx = (RTX); \
  1045. if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
  1046. && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
  1047. && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6 \
  1048. && GET_CODE (_rtx) != C7) \
  1049. rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
  1050. __FUNCTION__); \
  1051. _rtx; })
  1052. #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) \
  1053. __extension__ \
  1054. ({ __typeof (RTX) const _rtx = (RTX); \
  1055. if (!INSN_CHAIN_CODE_P (GET_CODE (_rtx))) \
  1056. rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
  1057. __FUNCTION__); \
  1058. _rtx; })
  1059. extern void rtl_check_failed_flag (const char *, const_rtx, const char *,
  1060. int, const char *)
  1061. ATTRIBUTE_NORETURN ATTRIBUTE_COLD
  1062. ;
  1063. #else /* not ENABLE_RTL_FLAG_CHECKING */
  1064. #define RTL_FLAG_CHECK1(NAME, RTX, C1) (RTX)
  1065. #define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) (RTX)
  1066. #define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) (RTX)
  1067. #define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) (RTX)
  1068. #define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) (RTX)
  1069. #define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) (RTX)
  1070. #define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) (RTX)
  1071. #define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) (RTX)
  1072. #endif
  1073. #define XINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_int)
  1074. #define XUINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_uint)
  1075. #define XSTR(RTX, N) (RTL_CHECK2 (RTX, N, 's', 'S').rt_str)
  1076. #define XEXP(RTX, N) (RTL_CHECK2 (RTX, N, 'e', 'u').rt_rtx)
  1077. #define XVEC(RTX, N) (RTL_CHECK2 (RTX, N, 'E', 'V').rt_rtvec)
  1078. #define XMODE(RTX, N) (RTL_CHECK1 (RTX, N, 'M').rt_type)
  1079. #define XTREE(RTX, N) (RTL_CHECK1 (RTX, N, 't').rt_tree)
  1080. #define XBBDEF(RTX, N) (RTL_CHECK1 (RTX, N, 'B').rt_bb)
  1081. #define XTMPL(RTX, N) (RTL_CHECK1 (RTX, N, 'T').rt_str)
  1082. #define XCFI(RTX, N) (RTL_CHECK1 (RTX, N, 'C').rt_cfi)
  1083. #define XVECEXP(RTX, N, M) RTVEC_ELT (XVEC (RTX, N), M)
  1084. #define XVECLEN(RTX, N) GET_NUM_ELEM (XVEC (RTX, N))
  1085. /* These are like XINT, etc. except that they expect a '0' field instead
  1086. of the normal type code. */
  1087. #define X0INT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_int)
  1088. #define X0UINT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_uint)
  1089. #define X0STR(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_str)
  1090. #define X0EXP(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtx)
  1091. #define X0VEC(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtvec)
  1092. #define X0MODE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_type)
  1093. #define X0TREE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_tree)
  1094. #define X0BBDEF(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_bb)
  1095. #define X0ADVFLAGS(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_addr_diff_vec_flags)
  1096. #define X0CSELIB(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_cselib)
  1097. #define X0MEMATTR(RTX, N) (RTL_CHECKC1 (RTX, N, MEM).rt_mem)
  1098. #define X0CONSTANT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_constant)
  1099. /* Access a '0' field with any type. */
  1100. #define X0ANY(RTX, N) RTL_CHECK1 (RTX, N, '0')
  1101. #define XCINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_int)
  1102. #define XCUINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_uint)
  1103. #define XCSUBREG(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_subreg)
  1104. #define XCSTR(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_str)
  1105. #define XCEXP(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtx)
  1106. #define XCVEC(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtvec)
  1107. #define XCMODE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_type)
  1108. #define XCTREE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_tree)
  1109. #define XCBBDEF(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_bb)
  1110. #define XCCFI(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cfi)
  1111. #define XCCSELIB(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cselib)
  1112. #define XCVECEXP(RTX, N, M, C) RTVEC_ELT (XCVEC (RTX, N, C), M)
  1113. #define XCVECLEN(RTX, N, C) GET_NUM_ELEM (XCVEC (RTX, N, C))
  1114. #define XC2EXP(RTX, N, C1, C2) (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx)
  1115. /* Methods of rtx_expr_list. */
  1116. inline rtx_expr_list *rtx_expr_list::next () const
  1117. {
  1118. rtx tmp = XEXP (this, 1);
  1119. return safe_as_a <rtx_expr_list *> (tmp);
  1120. }
  1121. inline rtx rtx_expr_list::element () const
  1122. {
  1123. return XEXP (this, 0);
  1124. }
  1125. /* Methods of rtx_insn_list. */
  1126. inline rtx_insn_list *rtx_insn_list::next () const
  1127. {
  1128. rtx tmp = XEXP (this, 1);
  1129. return safe_as_a <rtx_insn_list *> (tmp);
  1130. }
  1131. inline rtx_insn *rtx_insn_list::insn () const
  1132. {
  1133. rtx tmp = XEXP (this, 0);
  1134. return safe_as_a <rtx_insn *> (tmp);
  1135. }
  1136. /* Methods of rtx_sequence. */
  1137. inline int rtx_sequence::len () const
  1138. {
  1139. return XVECLEN (this, 0);
  1140. }
  1141. inline rtx rtx_sequence::element (int index) const
  1142. {
  1143. return XVECEXP (this, 0, index);
  1144. }
  1145. inline rtx_insn *rtx_sequence::insn (int index) const
  1146. {
  1147. return as_a <rtx_insn *> (XVECEXP (this, 0, index));
  1148. }
  1149. /* ACCESS MACROS for particular fields of insns. */
  1150. /* Holds a unique number for each insn.
  1151. These are not necessarily sequentially increasing. */
  1152. inline int INSN_UID (const_rtx insn)
  1153. {
  1154. return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID",
  1155. (insn))->u2.insn_uid;
  1156. }
  1157. inline int& INSN_UID (rtx insn)
  1158. {
  1159. return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID",
  1160. (insn))->u2.insn_uid;
  1161. }
  1162. /* Chain insns together in sequence. */
  1163. /* For now these are split in two: an rvalue form:
  1164. PREV_INSN/NEXT_INSN
  1165. and an lvalue form:
  1166. SET_NEXT_INSN/SET_PREV_INSN. */
  1167. inline rtx_insn *PREV_INSN (const rtx_insn *insn)
  1168. {
  1169. rtx prev = XEXP (insn, 0);
  1170. return safe_as_a <rtx_insn *> (prev);
  1171. }
  1172. inline rtx& SET_PREV_INSN (rtx_insn *insn)
  1173. {
  1174. return XEXP (insn, 0);
  1175. }
  1176. inline rtx_insn *NEXT_INSN (const rtx_insn *insn)
  1177. {
  1178. rtx next = XEXP (insn, 1);
  1179. return safe_as_a <rtx_insn *> (next);
  1180. }
  1181. inline rtx& SET_NEXT_INSN (rtx_insn *insn)
  1182. {
  1183. return XEXP (insn, 1);
  1184. }
  1185. inline basic_block BLOCK_FOR_INSN (const_rtx insn)
  1186. {
  1187. return XBBDEF (insn, 2);
  1188. }
  1189. inline basic_block& BLOCK_FOR_INSN (rtx insn)
  1190. {
  1191. return XBBDEF (insn, 2);
  1192. }
  1193. inline void set_block_for_insn (rtx_insn *insn, basic_block bb)
  1194. {
  1195. BLOCK_FOR_INSN (insn) = bb;
  1196. }
  1197. /* The body of an insn. */
  1198. inline rtx PATTERN (const_rtx insn)
  1199. {
  1200. return XEXP (insn, 3);
  1201. }
  1202. inline rtx& PATTERN (rtx insn)
  1203. {
  1204. return XEXP (insn, 3);
  1205. }
  1206. inline unsigned int INSN_LOCATION (const rtx_insn *insn)
  1207. {
  1208. return XUINT (insn, 4);
  1209. }
  1210. inline unsigned int& INSN_LOCATION (rtx_insn *insn)
  1211. {
  1212. return XUINT (insn, 4);
  1213. }
  1214. inline bool INSN_HAS_LOCATION (const rtx_insn *insn)
  1215. {
  1216. return LOCATION_LOCUS (INSN_LOCATION (insn)) != UNKNOWN_LOCATION;
  1217. }
  1218. /* LOCATION of an RTX if relevant. */
  1219. #define RTL_LOCATION(X) (INSN_P (X) ? \
  1220. INSN_LOCATION (as_a <rtx_insn *> (X)) \
  1221. : UNKNOWN_LOCATION)
  1222. /* Code number of instruction, from when it was recognized.
  1223. -1 means this instruction has not been recognized yet. */
  1224. #define INSN_CODE(INSN) XINT (INSN, 5)
  1225. inline rtvec rtx_jump_table_data::get_labels () const
  1226. {
  1227. rtx pat = PATTERN (this);
  1228. if (GET_CODE (pat) == ADDR_VEC)
  1229. return XVEC (pat, 0);
  1230. else
  1231. return XVEC (pat, 1); /* presumably an ADDR_DIFF_VEC */
  1232. }
  1233. /* Return the mode of the data in the table, which is always a scalar
  1234. integer. */
  1235. inline scalar_int_mode
  1236. rtx_jump_table_data::get_data_mode () const
  1237. {
  1238. return as_a <scalar_int_mode> (GET_MODE (PATTERN (this)));
  1239. }
  1240. /* If LABEL is followed by a jump table, return the table, otherwise
  1241. return null. */
  1242. inline rtx_jump_table_data *
  1243. jump_table_for_label (const rtx_code_label *label)
  1244. {
  1245. return safe_dyn_cast <rtx_jump_table_data *> (NEXT_INSN (label));
  1246. }
  1247. #define RTX_FRAME_RELATED_P(RTX) \
  1248. (RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \
  1249. CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related)
  1250. /* 1 if JUMP RTX is a crossing jump. */
  1251. #define CROSSING_JUMP_P(RTX) \
  1252. (RTL_FLAG_CHECK1 ("CROSSING_JUMP_P", (RTX), JUMP_INSN)->jump)
  1253. /* 1 if RTX is a call to a const function. Built from ECF_CONST and
  1254. TREE_READONLY. */
  1255. #define RTL_CONST_CALL_P(RTX) \
  1256. (RTL_FLAG_CHECK1 ("RTL_CONST_CALL_P", (RTX), CALL_INSN)->unchanging)
  1257. /* 1 if RTX is a call to a pure function. Built from ECF_PURE and
  1258. DECL_PURE_P. */
  1259. #define RTL_PURE_CALL_P(RTX) \
  1260. (RTL_FLAG_CHECK1 ("RTL_PURE_CALL_P", (RTX), CALL_INSN)->return_val)
  1261. /* 1 if RTX is a call to a const or pure function. */
  1262. #define RTL_CONST_OR_PURE_CALL_P(RTX) \
  1263. (RTL_CONST_CALL_P (RTX) || RTL_PURE_CALL_P (RTX))
  1264. /* 1 if RTX is a call to a looping const or pure function. Built from
  1265. ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */
  1266. #define RTL_LOOPING_CONST_OR_PURE_CALL_P(RTX) \
  1267. (RTL_FLAG_CHECK1 ("CONST_OR_PURE_CALL_P", (RTX), CALL_INSN)->call)
  1268. /* 1 if RTX is a call_insn for a sibling call. */
  1269. #define SIBLING_CALL_P(RTX) \
  1270. (RTL_FLAG_CHECK1 ("SIBLING_CALL_P", (RTX), CALL_INSN)->jump)
  1271. /* 1 if RTX is a jump_insn, call_insn, or insn that is an annulling branch. */
  1272. #define INSN_ANNULLED_BRANCH_P(RTX) \
  1273. (RTL_FLAG_CHECK1 ("INSN_ANNULLED_BRANCH_P", (RTX), JUMP_INSN)->unchanging)
  1274. /* 1 if RTX is an insn in a delay slot and is from the target of the branch.
  1275. If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
  1276. executed if the branch is taken. For annulled branches with this bit
  1277. clear, the insn should be executed only if the branch is not taken. */
  1278. #define INSN_FROM_TARGET_P(RTX) \
  1279. (RTL_FLAG_CHECK3 ("INSN_FROM_TARGET_P", (RTX), INSN, JUMP_INSN, \
  1280. CALL_INSN)->in_struct)
  1281. /* In an ADDR_DIFF_VEC, the flags for RTX for use by branch shortening.
  1282. See the comments for ADDR_DIFF_VEC in rtl.def. */
  1283. #define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS (RTX, 4)
  1284. /* In a VALUE, the value cselib has assigned to RTX.
  1285. This is a "struct cselib_val", see cselib.h. */
  1286. #define CSELIB_VAL_PTR(RTX) X0CSELIB (RTX, 0)
  1287. /* Holds a list of notes on what this insn does to various REGs.
  1288. It is a chain of EXPR_LIST rtx's, where the second operand is the
  1289. chain pointer and the first operand is the REG being described.
  1290. The mode field of the EXPR_LIST contains not a real machine mode
  1291. but a value from enum reg_note. */
  1292. #define REG_NOTES(INSN) XEXP(INSN, 6)
  1293. /* In an ENTRY_VALUE this is the DECL_INCOMING_RTL of the argument in
  1294. question. */
  1295. #define ENTRY_VALUE_EXP(RTX) (RTL_CHECKC1 (RTX, 0, ENTRY_VALUE).rt_rtx)
  1296. enum reg_note
  1297. {
  1298. #define DEF_REG_NOTE(NAME) NAME,
  1299. #include "reg-notes.def"
  1300. #undef DEF_REG_NOTE
  1301. REG_NOTE_MAX
  1302. };
  1303. /* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
  1304. #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
  1305. #define PUT_REG_NOTE_KIND(LINK, KIND) \
  1306. PUT_MODE_RAW (LINK, (machine_mode) (KIND))
  1307. /* Names for REG_NOTE's in EXPR_LIST insn's. */
  1308. extern const char * const reg_note_name[];
  1309. #define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int) (MODE)])
  1310. /* This field is only present on CALL_INSNs. It holds a chain of EXPR_LIST of
  1311. USE and CLOBBER expressions.
  1312. USE expressions list the registers filled with arguments that
  1313. are passed to the function.
  1314. CLOBBER expressions document the registers explicitly clobbered
  1315. by this CALL_INSN.
  1316. Pseudo registers can not be mentioned in this list. */
  1317. #define CALL_INSN_FUNCTION_USAGE(INSN) XEXP(INSN, 7)
  1318. /* The label-number of a code-label. The assembler label
  1319. is made from `L' and the label-number printed in decimal.
  1320. Label numbers are unique in a compilation. */
  1321. #define CODE_LABEL_NUMBER(INSN) XINT (INSN, 5)
  1322. /* In a NOTE that is a line number, this is a string for the file name that the
  1323. line is in. We use the same field to record block numbers temporarily in
  1324. NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes. (We avoid lots of casts
  1325. between ints and pointers if we use a different macro for the block number.)
  1326. */
  1327. /* Opaque data. */
  1328. #define NOTE_DATA(INSN) RTL_CHECKC1 (INSN, 3, NOTE)
  1329. #define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 3, NOTE)
  1330. #define SET_INSN_DELETED(INSN) set_insn_deleted (INSN);
  1331. #define NOTE_BLOCK(INSN) XCTREE (INSN, 3, NOTE)
  1332. #define NOTE_EH_HANDLER(INSN) XCINT (INSN, 3, NOTE)
  1333. #define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 3, NOTE)
  1334. #define NOTE_VAR_LOCATION(INSN) XCEXP (INSN, 3, NOTE)
  1335. #define NOTE_MARKER_LOCATION(INSN) XCUINT (INSN, 3, NOTE)
  1336. #define NOTE_CFI(INSN) XCCFI (INSN, 3, NOTE)
  1337. #define NOTE_LABEL_NUMBER(INSN) XCINT (INSN, 3, NOTE)
  1338. /* In a NOTE that is a line number, this is the line number.
  1339. Other kinds of NOTEs are identified by negative numbers here. */
  1340. #define NOTE_KIND(INSN) XCINT (INSN, 4, NOTE)
  1341. /* Nonzero if INSN is a note marking the beginning of a basic block. */
  1342. #define NOTE_INSN_BASIC_BLOCK_P(INSN) \
  1343. (NOTE_P (INSN) && NOTE_KIND (INSN) == NOTE_INSN_BASIC_BLOCK)
  1344. /* Nonzero if INSN is a debug nonbind marker note,
  1345. for which NOTE_MARKER_LOCATION can be used. */
  1346. #define NOTE_MARKER_P(INSN) \
  1347. (NOTE_P (INSN) && \
  1348. (NOTE_KIND (INSN) == NOTE_INSN_BEGIN_STMT \
  1349. || NOTE_KIND (INSN) == NOTE_INSN_INLINE_ENTRY))
  1350. /* Variable declaration and the location of a variable. */
  1351. #define PAT_VAR_LOCATION_DECL(PAT) (XCTREE ((PAT), 0, VAR_LOCATION))
  1352. #define PAT_VAR_LOCATION_LOC(PAT) (XCEXP ((PAT), 1, VAR_LOCATION))
  1353. /* Initialization status of the variable in the location. Status
  1354. can be unknown, uninitialized or initialized. See enumeration
  1355. type below. */
  1356. #define PAT_VAR_LOCATION_STATUS(PAT) \
  1357. (RTL_FLAG_CHECK1 ("PAT_VAR_LOCATION_STATUS", PAT, VAR_LOCATION) \
  1358. ->u2.var_location_status)
  1359. /* Accessors for a NOTE_INSN_VAR_LOCATION. */
  1360. #define NOTE_VAR_LOCATION_DECL(NOTE) \
  1361. PAT_VAR_LOCATION_DECL (NOTE_VAR_LOCATION (NOTE))
  1362. #define NOTE_VAR_LOCATION_LOC(NOTE) \
  1363. PAT_VAR_LOCATION_LOC (NOTE_VAR_LOCATION (NOTE))
  1364. #define NOTE_VAR_LOCATION_STATUS(NOTE) \
  1365. PAT_VAR_LOCATION_STATUS (NOTE_VAR_LOCATION (NOTE))
  1366. /* Evaluate to TRUE if INSN is a debug insn that denotes a variable
  1367. location/value tracking annotation. */
  1368. #define DEBUG_BIND_INSN_P(INSN) \
  1369. (DEBUG_INSN_P (INSN) \
  1370. && (GET_CODE (PATTERN (INSN)) \
  1371. == VAR_LOCATION))
  1372. /* Evaluate to TRUE if INSN is a debug insn that denotes a program
  1373. source location marker. */
  1374. #define DEBUG_MARKER_INSN_P(INSN) \
  1375. (DEBUG_INSN_P (INSN) \
  1376. && (GET_CODE (PATTERN (INSN)) \
  1377. != VAR_LOCATION))
  1378. /* Evaluate to the marker kind. */
  1379. #define INSN_DEBUG_MARKER_KIND(INSN) \
  1380. (GET_CODE (PATTERN (INSN)) == DEBUG_MARKER \
  1381. ? (GET_MODE (PATTERN (INSN)) == VOIDmode \
  1382. ? NOTE_INSN_BEGIN_STMT \
  1383. : GET_MODE (PATTERN (INSN)) == BLKmode \
  1384. ? NOTE_INSN_INLINE_ENTRY \
  1385. : (enum insn_note)-1) \
  1386. : (enum insn_note)-1)
  1387. /* Create patterns for debug markers. These and the above abstract
  1388. the representation, so that it's easier to get rid of the abuse of
  1389. the mode to hold the marker kind. Other marker types are
  1390. envisioned, so a single bit flag won't do; maybe separate RTL codes
  1391. wouldn't be a problem. */
  1392. #define GEN_RTX_DEBUG_MARKER_BEGIN_STMT_PAT() \
  1393. gen_rtx_DEBUG_MARKER (VOIDmode)
  1394. #define GEN_RTX_DEBUG_MARKER_INLINE_ENTRY_PAT() \
  1395. gen_rtx_DEBUG_MARKER (BLKmode)
  1396. /* The VAR_LOCATION rtx in a DEBUG_INSN. */
  1397. #define INSN_VAR_LOCATION(INSN) \
  1398. (RTL_FLAG_CHECK1 ("INSN_VAR_LOCATION", PATTERN (INSN), VAR_LOCATION))
  1399. /* A pointer to the VAR_LOCATION rtx in a DEBUG_INSN. */
  1400. #define INSN_VAR_LOCATION_PTR(INSN) \
  1401. (&PATTERN (INSN))
  1402. /* Accessors for a tree-expanded var location debug insn. */
  1403. #define INSN_VAR_LOCATION_DECL(INSN) \
  1404. PAT_VAR_LOCATION_DECL (INSN_VAR_LOCATION (INSN))
  1405. #define INSN_VAR_LOCATION_LOC(INSN) \
  1406. PAT_VAR_LOCATION_LOC (INSN_VAR_LOCATION (INSN))
  1407. #define INSN_VAR_LOCATION_STATUS(INSN) \
  1408. PAT_VAR_LOCATION_STATUS (INSN_VAR_LOCATION (INSN))
  1409. /* Expand to the RTL that denotes an unknown variable location in a
  1410. DEBUG_INSN. */
  1411. #define gen_rtx_UNKNOWN_VAR_LOC() (gen_rtx_CLOBBER (VOIDmode, const0_rtx))
  1412. /* Determine whether X is such an unknown location. */
  1413. #define VAR_LOC_UNKNOWN_P(X) \
  1414. (GET_CODE (X) == CLOBBER && XEXP ((X), 0) == const0_rtx)
  1415. /* 1 if RTX is emitted after a call, but it should take effect before
  1416. the call returns. */
  1417. #define NOTE_DURING_CALL_P(RTX) \
  1418. (RTL_FLAG_CHECK1 ("NOTE_VAR_LOCATION_DURING_CALL_P", (RTX), NOTE)->call)
  1419. /* DEBUG_EXPR_DECL corresponding to a DEBUG_EXPR RTX. */
  1420. #define DEBUG_EXPR_TREE_DECL(RTX) XCTREE (RTX, 0, DEBUG_EXPR)
  1421. /* VAR_DECL/PARM_DECL DEBUG_IMPLICIT_PTR takes address of. */
  1422. #define DEBUG_IMPLICIT_PTR_DECL(RTX) XCTREE (RTX, 0, DEBUG_IMPLICIT_PTR)
  1423. /* PARM_DECL DEBUG_PARAMETER_REF references. */
  1424. #define DEBUG_PARAMETER_REF_DECL(RTX) XCTREE (RTX, 0, DEBUG_PARAMETER_REF)
  1425. /* Codes that appear in the NOTE_KIND field for kinds of notes
  1426. that are not line numbers. These codes are all negative.
  1427. Notice that we do not try to use zero here for any of
  1428. the special note codes because sometimes the source line
  1429. actually can be zero! This happens (for example) when we
  1430. are generating code for the per-translation-unit constructor
  1431. and destructor routines for some C++ translation unit. */
  1432. enum insn_note
  1433. {
  1434. #define DEF_INSN_NOTE(NAME) NAME,
  1435. #include "insn-notes.def"
  1436. #undef DEF_INSN_NOTE
  1437. NOTE_INSN_MAX
  1438. };
  1439. /* Names for NOTE insn's other than line numbers. */
  1440. extern const char * const note_insn_name[NOTE_INSN_MAX];
  1441. #define GET_NOTE_INSN_NAME(NOTE_CODE) \
  1442. (note_insn_name[(NOTE_CODE)])
  1443. /* The name of a label, in case it corresponds to an explicit label
  1444. in the input source code. */
  1445. #define LABEL_NAME(RTX) XCSTR (RTX, 6, CODE_LABEL)
  1446. /* In jump.c, each label contains a count of the number
  1447. of LABEL_REFs that point at it, so unused labels can be deleted. */
  1448. #define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
  1449. /* Labels carry a two-bit field composed of the ->jump and ->call
  1450. bits. This field indicates whether the label is an alternate
  1451. entry point, and if so, what kind. */
  1452. enum label_kind
  1453. {
  1454. LABEL_NORMAL = 0, /* ordinary label */
  1455. LABEL_STATIC_ENTRY, /* alternate entry point, not exported */
  1456. LABEL_GLOBAL_ENTRY, /* alternate entry point, exported */
  1457. LABEL_WEAK_ENTRY /* alternate entry point, exported as weak symbol */
  1458. };
  1459. #if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007)
  1460. /* Retrieve the kind of LABEL. */
  1461. #define LABEL_KIND(LABEL) __extension__ \
  1462. ({ __typeof (LABEL) const _label = (LABEL); \
  1463. if (! LABEL_P (_label)) \
  1464. rtl_check_failed_flag ("LABEL_KIND", _label, __FILE__, __LINE__, \
  1465. __FUNCTION__); \
  1466. (enum label_kind) ((_label->jump << 1) | _label->call); })
  1467. /* Set the kind of LABEL. */
  1468. #define SET_LABEL_KIND(LABEL, KIND) do { \
  1469. __typeof (LABEL) const _label = (LABEL); \
  1470. const unsigned int _kind = (KIND); \
  1471. if (! LABEL_P (_label)) \
  1472. rtl_check_failed_flag ("SET_LABEL_KIND", _label, __FILE__, __LINE__, \
  1473. __FUNCTION__); \
  1474. _label->jump = ((_kind >> 1) & 1); \
  1475. _label->call = (_kind & 1); \
  1476. } while (0)
  1477. #else
  1478. /* Retrieve the kind of LABEL. */
  1479. #define LABEL_KIND(LABEL) \
  1480. ((enum label_kind) (((LABEL)->jump << 1) | (LABEL)->call))
  1481. /* Set the kind of LABEL. */
  1482. #define SET_LABEL_KIND(LABEL, KIND) do { \
  1483. rtx const _label = (LABEL); \
  1484. const unsigned int _kind = (KIND); \
  1485. _label->jump = ((_kind >> 1) & 1); \
  1486. _label->call = (_kind & 1); \
  1487. } while (0)
  1488. #endif /* rtl flag checking */
  1489. #define LABEL_ALT_ENTRY_P(LABEL) (LABEL_KIND (LABEL) != LABEL_NORMAL)
  1490. /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
  1491. so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
  1492. be decremented and possibly the label can be deleted. */
  1493. #define JUMP_LABEL(INSN) XCEXP (INSN, 7, JUMP_INSN)
  1494. inline rtx_insn *JUMP_LABEL_AS_INSN (const rtx_insn *insn)
  1495. {
  1496. return safe_as_a <rtx_insn *> (JUMP_LABEL (insn));
  1497. }
  1498. /* Methods of rtx_jump_insn. */
  1499. inline rtx rtx_jump_insn::jump_label () const
  1500. {
  1501. return JUMP_LABEL (this);
  1502. }
  1503. inline rtx_code_label *rtx_jump_insn::jump_target () const
  1504. {
  1505. return safe_as_a <rtx_code_label *> (JUMP_LABEL (this));
  1506. }
  1507. inline void rtx_jump_insn::set_jump_target (rtx_code_label *target)
  1508. {
  1509. JUMP_LABEL (this) = target;
  1510. }
  1511. /* Once basic blocks are found, each CODE_LABEL starts a chain that
  1512. goes through all the LABEL_REFs that jump to that label. The chain
  1513. eventually winds up at the CODE_LABEL: it is circular. */
  1514. #define LABEL_REFS(LABEL) XCEXP (LABEL, 3, CODE_LABEL)
  1515. /* Get the label that a LABEL_REF references. */
  1516. static inline rtx_insn *
  1517. label_ref_label (const_rtx ref)
  1518. {
  1519. return as_a<rtx_insn *> (XCEXP (ref, 0, LABEL_REF));
  1520. }
  1521. /* Set the label that LABEL_REF ref refers to. */
  1522. static inline void
  1523. set_label_ref_label (rtx ref, rtx_insn *label)
  1524. {
  1525. XCEXP (ref, 0, LABEL_REF) = label;
  1526. }
  1527. /* For a REG rtx, REGNO extracts the register number. REGNO can only
  1528. be used on RHS. Use SET_REGNO to change the value. */
  1529. #define REGNO(RTX) (rhs_regno(RTX))
  1530. #define SET_REGNO(RTX, N) (df_ref_change_reg_with_loc (RTX, N))
  1531. /* Return the number of consecutive registers in a REG. This is always
  1532. 1 for pseudo registers and is determined by TARGET_HARD_REGNO_NREGS for
  1533. hard registers. */
  1534. #define REG_NREGS(RTX) (REG_CHECK (RTX)->nregs)
  1535. /* ORIGINAL_REGNO holds the number the register originally had; for a
  1536. pseudo register turned into a hard reg this will hold the old pseudo
  1537. register number. */
  1538. #define ORIGINAL_REGNO(RTX) \
  1539. (RTL_FLAG_CHECK1 ("ORIGINAL_REGNO", (RTX), REG)->u2.original_regno)
  1540. /* Force the REGNO macro to only be used on the lhs. */
  1541. static inline unsigned int
  1542. rhs_regno (const_rtx x)
  1543. {
  1544. return REG_CHECK (x)->regno;
  1545. }
  1546. /* Return the final register in REG X plus one. */
  1547. static inline unsigned int
  1548. END_REGNO (const_rtx x)
  1549. {
  1550. return REGNO (x) + REG_NREGS (x);
  1551. }
  1552. /* Change the REGNO and REG_NREGS of REG X to the specified values,
  1553. bypassing the df machinery. */
  1554. static inline void
  1555. set_regno_raw (rtx x, unsigned int regno, unsigned int nregs)
  1556. {
  1557. reg_info *reg = REG_CHECK (x);
  1558. reg->regno = regno;
  1559. reg->nregs = nregs;
  1560. }
  1561. /* 1 if RTX is a reg or parallel that is the current function's return
  1562. value. */
  1563. #define REG_FUNCTION_VALUE_P(RTX) \
  1564. (RTL_FLAG_CHECK2 ("REG_FUNCTION_VALUE_P", (RTX), REG, PARALLEL)->return_val)
  1565. /* 1 if RTX is a reg that corresponds to a variable declared by the user. */
  1566. #define REG_USERVAR_P(RTX) \
  1567. (RTL_FLAG_CHECK1 ("REG_USERVAR_P", (RTX), REG)->volatil)
  1568. /* 1 if RTX is a reg that holds a pointer value. */
  1569. #define REG_POINTER(RTX) \
  1570. (RTL_FLAG_CHECK1 ("REG_POINTER", (RTX), REG)->frame_related)
  1571. /* 1 if RTX is a mem that holds a pointer value. */
  1572. #define MEM_POINTER(RTX) \
  1573. (RTL_FLAG_CHECK1 ("MEM_POINTER", (RTX), MEM)->frame_related)
  1574. /* 1 if the given register REG corresponds to a hard register. */
  1575. #define HARD_REGISTER_P(REG) (HARD_REGISTER_NUM_P (REGNO (REG)))
  1576. /* 1 if the given register number REG_NO corresponds to a hard register. */
  1577. #define HARD_REGISTER_NUM_P(REG_NO) ((REG_NO) < FIRST_PSEUDO_REGISTER)
  1578. /* For a CONST_INT rtx, INTVAL extracts the integer. */
  1579. #define INTVAL(RTX) XCWINT (RTX, 0, CONST_INT)
  1580. #define UINTVAL(RTX) ((unsigned HOST_WIDE_INT) INTVAL (RTX))
  1581. /* For a CONST_WIDE_INT, CONST_WIDE_INT_NUNITS is the number of
  1582. elements actually needed to represent the constant.
  1583. CONST_WIDE_INT_ELT gets one of the elements. 0 is the least
  1584. significant HOST_WIDE_INT. */
  1585. #define CONST_WIDE_INT_VEC(RTX) HWIVEC_CHECK (RTX, CONST_WIDE_INT)
  1586. #define CONST_WIDE_INT_NUNITS(RTX) CWI_GET_NUM_ELEM (RTX)
  1587. #define CONST_WIDE_INT_ELT(RTX, N) CWI_ELT (RTX, N)
  1588. /* For a CONST_POLY_INT, CONST_POLY_INT_COEFFS gives access to the
  1589. individual coefficients, in the form of a trailing_wide_ints structure. */
  1590. #define CONST_POLY_INT_COEFFS(RTX) \
  1591. (RTL_FLAG_CHECK1("CONST_POLY_INT_COEFFS", (RTX), \
  1592. CONST_POLY_INT)->u.cpi.coeffs)
  1593. /* For a CONST_DOUBLE:
  1594. #if TARGET_SUPPORTS_WIDE_INT == 0
  1595. For a VOIDmode, there are two integers CONST_DOUBLE_LOW is the
  1596. low-order word and ..._HIGH the high-order.
  1597. #endif
  1598. For a float, there is a REAL_VALUE_TYPE structure, and
  1599. CONST_DOUBLE_REAL_VALUE(r) is a pointer to it. */
  1600. #define CONST_DOUBLE_LOW(r) XCMWINT (r, 0, CONST_DOUBLE, VOIDmode)
  1601. #define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
  1602. #define CONST_DOUBLE_REAL_VALUE(r) \
  1603. ((const struct real_value *) XCNMPRV (r, CONST_DOUBLE, VOIDmode))
  1604. #define CONST_FIXED_VALUE(r) \
  1605. ((const struct fixed_value *) XCNMPFV (r, CONST_FIXED, VOIDmode))
  1606. #define CONST_FIXED_VALUE_HIGH(r) \
  1607. ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.high))
  1608. #define CONST_FIXED_VALUE_LOW(r) \
  1609. ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.low))
  1610. /* For a CONST_VECTOR, return element #n. */
  1611. #define CONST_VECTOR_ELT(RTX, N) const_vector_elt (RTX, N)
  1612. /* See rtl.texi for a description of these macros. */
  1613. #define CONST_VECTOR_NPATTERNS(RTX) \
  1614. (RTL_FLAG_CHECK1 ("CONST_VECTOR_NPATTERNS", (RTX), CONST_VECTOR) \
  1615. ->u2.const_vector.npatterns)
  1616. #define CONST_VECTOR_NELTS_PER_PATTERN(RTX) \
  1617. (RTL_FLAG_CHECK1 ("CONST_VECTOR_NELTS_PER_PATTERN", (RTX), CONST_VECTOR) \
  1618. ->u2.const_vector.nelts_per_pattern)
  1619. #define CONST_VECTOR_DUPLICATE_P(RTX) \
  1620. (CONST_VECTOR_NELTS_PER_PATTERN (RTX) == 1)
  1621. #define CONST_VECTOR_STEPPED_P(RTX) \
  1622. (CONST_VECTOR_NELTS_PER_PATTERN (RTX) == 3)
  1623. #define CONST_VECTOR_ENCODED_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
  1624. /* Return the number of elements encoded directly in a CONST_VECTOR. */
  1625. inline unsigned int
  1626. const_vector_encoded_nelts (const_rtx x)
  1627. {
  1628. return CONST_VECTOR_NPATTERNS (x) * CONST_VECTOR_NELTS_PER_PATTERN (x);
  1629. }
  1630. /* For a CONST_VECTOR, return the number of elements in a vector. */
  1631. #define CONST_VECTOR_NUNITS(RTX) GET_MODE_NUNITS (GET_MODE (RTX))
  1632. /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
  1633. SUBREG_BYTE extracts the byte-number. */
  1634. #define SUBREG_REG(RTX) XCEXP (RTX, 0, SUBREG)
  1635. #define SUBREG_BYTE(RTX) XCSUBREG (RTX, 1, SUBREG)
  1636. /* in rtlanal.c */
  1637. /* Return the right cost to give to an operation
  1638. to make the cost of the corresponding register-to-register instruction
  1639. N times that of a fast register-to-register instruction. */
  1640. #define COSTS_N_INSNS(N) ((N) * 4)
  1641. /* Maximum cost of an rtl expression. This value has the special meaning
  1642. not to use an rtx with this cost under any circumstances. */
  1643. #define MAX_COST INT_MAX
  1644. /* Return true if CODE always has VOIDmode. */
  1645. static inline bool
  1646. always_void_p (enum rtx_code code)
  1647. {
  1648. return code == SET;
  1649. }
  1650. /* A structure to hold all available cost information about an rtl
  1651. expression. */
  1652. struct full_rtx_costs
  1653. {
  1654. int speed;
  1655. int size;
  1656. };
  1657. /* Initialize a full_rtx_costs structure C to the maximum cost. */
  1658. static inline void
  1659. init_costs_to_max (struct full_rtx_costs *c)
  1660. {
  1661. c->speed = MAX_COST;
  1662. c->size = MAX_COST;
  1663. }
  1664. /* Initialize a full_rtx_costs structure C to zero cost. */
  1665. static inline void
  1666. init_costs_to_zero (struct full_rtx_costs *c)
  1667. {
  1668. c->speed = 0;
  1669. c->size = 0;
  1670. }
  1671. /* Compare two full_rtx_costs structures A and B, returning true
  1672. if A < B when optimizing for speed. */
  1673. static inline bool
  1674. costs_lt_p (struct full_rtx_costs *a, struct full_rtx_costs *b,
  1675. bool speed)
  1676. {
  1677. if (speed)
  1678. return (a->speed < b->speed
  1679. || (a->speed == b->speed && a->size < b->size));
  1680. else
  1681. return (a->size < b->size
  1682. || (a->size == b->size && a->speed < b->speed));
  1683. }
  1684. /* Increase both members of the full_rtx_costs structure C by the
  1685. cost of N insns. */
  1686. static inline void
  1687. costs_add_n_insns (struct full_rtx_costs *c, int n)
  1688. {
  1689. c->speed += COSTS_N_INSNS (n);
  1690. c->size += COSTS_N_INSNS (n);
  1691. }
  1692. /* Describes the shape of a subreg:
  1693. inner_mode == the mode of the SUBREG_REG
  1694. offset == the SUBREG_BYTE
  1695. outer_mode == the mode of the SUBREG itself. */
  1696. struct subreg_shape {
  1697. subreg_shape (machine_mode, poly_uint16, machine_mode);
  1698. bool operator == (const subreg_shape &) const;
  1699. bool operator != (const subreg_shape &) const;
  1700. unsigned HOST_WIDE_INT unique_id () const;
  1701. machine_mode inner_mode;
  1702. poly_uint16 offset;
  1703. machine_mode outer_mode;
  1704. };
  1705. inline
  1706. subreg_shape::subreg_shape (machine_mode inner_mode_in,
  1707. poly_uint16 offset_in,
  1708. machine_mode outer_mode_in)
  1709. : inner_mode (inner_mode_in), offset (offset_in), outer_mode (outer_mode_in)
  1710. {}
  1711. inline bool
  1712. subreg_shape::operator == (const subreg_shape &other) const
  1713. {
  1714. return (inner_mode == other.inner_mode
  1715. && known_eq (offset, other.offset)
  1716. && outer_mode == other.outer_mode);
  1717. }
  1718. inline bool
  1719. subreg_shape::operator != (const subreg_shape &other) const
  1720. {
  1721. return !operator == (other);
  1722. }
  1723. /* Return an integer that uniquely identifies this shape. Structures
  1724. like rtx_def assume that a mode can fit in an 8-bit bitfield and no
  1725. current mode is anywhere near being 65536 bytes in size, so the
  1726. id comfortably fits in an int. */
  1727. inline unsigned HOST_WIDE_INT
  1728. subreg_shape::unique_id () const
  1729. {
  1730. { STATIC_ASSERT (MAX_MACHINE_MODE <= 256); }
  1731. { STATIC_ASSERT (NUM_POLY_INT_COEFFS <= 3); }
  1732. { STATIC_ASSERT (sizeof (offset.coeffs[0]) <= 2); }
  1733. int res = (int) inner_mode + ((int) outer_mode << 8);
  1734. for (int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
  1735. res += (HOST_WIDE_INT) offset.coeffs[i] << ((1 + i) * 16);
  1736. return res;
  1737. }
  1738. /* Return the shape of a SUBREG rtx. */
  1739. static inline subreg_shape
  1740. shape_of_subreg (const_rtx x)
  1741. {
  1742. return subreg_shape (GET_MODE (SUBREG_REG (x)),
  1743. SUBREG_BYTE (x), GET_MODE (x));
  1744. }
  1745. /* Information about an address. This structure is supposed to be able
  1746. to represent all supported target addresses. Please extend it if it
  1747. is not yet general enough. */
  1748. struct address_info {
  1749. /* The mode of the value being addressed, or VOIDmode if this is
  1750. a load-address operation with no known address mode. */
  1751. machine_mode mode;
  1752. /* The address space. */
  1753. addr_space_t as;
  1754. /* True if this is an RTX_AUTOINC address. */
  1755. bool autoinc_p;
  1756. /* A pointer to the top-level address. */
  1757. rtx *outer;
  1758. /* A pointer to the inner address, after all address mutations
  1759. have been stripped from the top-level address. It can be one
  1760. of the following:
  1761. - A {PRE,POST}_{INC,DEC} of *BASE. SEGMENT, INDEX and DISP are null.
  1762. - A {PRE,POST}_MODIFY of *BASE. In this case either INDEX or DISP
  1763. points to the step value, depending on whether the step is variable
  1764. or constant respectively. SEGMENT is null.
  1765. - A plain sum of the form SEGMENT + BASE + INDEX + DISP,
  1766. with null fields evaluating to 0. */
  1767. rtx *inner;
  1768. /* Components that make up *INNER. Each one may be null or nonnull.
  1769. When nonnull, their meanings are as follows:
  1770. - *SEGMENT is the "segment" of memory to which the address refers.
  1771. This value is entirely target-specific and is only called a "segment"
  1772. because that's its most typical use. It contains exactly one UNSPEC,
  1773. pointed to by SEGMENT_TERM. The contents of *SEGMENT do not need
  1774. reloading.
  1775. - *BASE is a variable expression representing a base address.
  1776. It contains exactly one REG, SUBREG or MEM, pointed to by BASE_TERM.
  1777. - *INDEX is a variable expression representing an index value.
  1778. It may be a scaled expression, such as a MULT. It has exactly
  1779. one REG, SUBREG or MEM, pointed to by INDEX_TERM.
  1780. - *DISP is a constant, possibly mutated. DISP_TERM points to the
  1781. unmutated RTX_CONST_OBJ. */
  1782. rtx *segment;
  1783. rtx *base;
  1784. rtx *index;
  1785. rtx *disp;
  1786. rtx *segment_term;
  1787. rtx *base_term;
  1788. rtx *index_term;
  1789. rtx *disp_term;
  1790. /* In a {PRE,POST}_MODIFY address, this points to a second copy
  1791. of BASE_TERM, otherwise it is null. */
  1792. rtx *base_term2;
  1793. /* ADDRESS if this structure describes an address operand, MEM if
  1794. it describes a MEM address. */
  1795. enum rtx_code addr_outer_code;
  1796. /* If BASE is nonnull, this is the code of the rtx that contains it. */
  1797. enum rtx_code base_outer_code;
  1798. };
  1799. /* This is used to bundle an rtx and a mode together so that the pair
  1800. can be used with the wi:: routines. If we ever put modes into rtx
  1801. integer constants, this should go away and then just pass an rtx in. */
  1802. typedef std::pair <rtx, machine_mode> rtx_mode_t;
  1803. namespace wi
  1804. {
  1805. template <>
  1806. struct int_traits <rtx_mode_t>
  1807. {
  1808. static const enum precision_type precision_type = VAR_PRECISION;
  1809. static const bool host_dependent_precision = false;
  1810. /* This ought to be true, except for the special case that BImode
  1811. is canonicalized to STORE_FLAG_VALUE, which might be 1. */
  1812. static const bool is_sign_extended = false;
  1813. static unsigned int get_precision (const rtx_mode_t &);
  1814. static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int,
  1815. const rtx_mode_t &);
  1816. };
  1817. }
  1818. inline unsigned int
  1819. wi::int_traits <rtx_mode_t>::get_precision (const rtx_mode_t &x)
  1820. {
  1821. return GET_MODE_PRECISION (as_a <scalar_mode> (x.second));
  1822. }
  1823. inline wi::storage_ref
  1824. wi::int_traits <rtx_mode_t>::decompose (HOST_WIDE_INT *,
  1825. unsigned int precision,
  1826. const rtx_mode_t &x)
  1827. {
  1828. gcc_checking_assert (precision == get_precision (x));
  1829. switch (GET_CODE (x.first))
  1830. {
  1831. case CONST_INT:
  1832. if (precision < HOST_BITS_PER_WIDE_INT)
  1833. /* Nonzero BImodes are stored as STORE_FLAG_VALUE, which on many
  1834. targets is 1 rather than -1. */
  1835. gcc_checking_assert (INTVAL (x.first)
  1836. == sext_hwi (INTVAL (x.first), precision)
  1837. || (x.second == BImode && INTVAL (x.first) == 1));
  1838. return wi::storage_ref (&INTVAL (x.first), 1, precision);
  1839. case CONST_WIDE_INT:
  1840. return wi::storage_ref (&CONST_WIDE_INT_ELT (x.first, 0),
  1841. CONST_WIDE_INT_NUNITS (x.first), precision);
  1842. #if TARGET_SUPPORTS_WIDE_INT == 0
  1843. case CONST_DOUBLE:
  1844. return wi::storage_ref (&CONST_DOUBLE_LOW (x.first), 2, precision);
  1845. #endif
  1846. default:
  1847. gcc_unreachable ();
  1848. }
  1849. }
  1850. namespace wi
  1851. {
  1852. hwi_with_prec shwi (HOST_WIDE_INT, machine_mode mode);
  1853. wide_int min_value (machine_mode, signop);
  1854. wide_int max_value (machine_mode, signop);
  1855. }
  1856. inline wi::hwi_with_prec
  1857. wi::shwi (HOST_WIDE_INT val, machine_mode mode)
  1858. {
  1859. return shwi (val, GET_MODE_PRECISION (as_a <scalar_mode> (mode)));
  1860. }
  1861. /* Produce the smallest number that is represented in MODE. The precision
  1862. is taken from MODE and the sign from SGN. */
  1863. inline wide_int
  1864. wi::min_value (machine_mode mode, signop sgn)
  1865. {
  1866. return min_value (GET_MODE_PRECISION (as_a <scalar_mode> (mode)), sgn);
  1867. }
  1868. /* Produce the largest number that is represented in MODE. The precision
  1869. is taken from MODE and the sign from SGN. */
  1870. inline wide_int
  1871. wi::max_value (machine_mode mode, signop sgn)
  1872. {
  1873. return max_value (GET_MODE_PRECISION (as_a <scalar_mode> (mode)), sgn);
  1874. }
  1875. namespace wi
  1876. {
  1877. typedef poly_int<NUM_POLY_INT_COEFFS,
  1878. generic_wide_int <wide_int_ref_storage <false, false> > >
  1879. rtx_to_poly_wide_ref;
  1880. rtx_to_poly_wide_ref to_poly_wide (const_rtx, machine_mode);
  1881. }
  1882. /* Return the value of a CONST_POLY_INT in its native precision. */
  1883. inline wi::rtx_to_poly_wide_ref
  1884. const_poly_int_value (const_rtx x)
  1885. {
  1886. poly_int<NUM_POLY_INT_COEFFS, WIDE_INT_REF_FOR (wide_int)> res;
  1887. for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
  1888. res.coeffs[i] = CONST_POLY_INT_COEFFS (x)[i];
  1889. return res;
  1890. }
  1891. /* Return true if X is a scalar integer or a CONST_POLY_INT. The value
  1892. can then be extracted using wi::to_poly_wide. */
  1893. inline bool
  1894. poly_int_rtx_p (const_rtx x)
  1895. {
  1896. return CONST_SCALAR_INT_P (x) || CONST_POLY_INT_P (x);
  1897. }
  1898. /* Access X (which satisfies poly_int_rtx_p) as a poly_wide_int.
  1899. MODE is the mode of X. */
  1900. inline wi::rtx_to_poly_wide_ref
  1901. wi::to_poly_wide (const_rtx x, machine_mode mode)
  1902. {
  1903. if (CONST_POLY_INT_P (x))
  1904. return const_poly_int_value (x);
  1905. return rtx_mode_t (const_cast<rtx> (x), mode);
  1906. }
  1907. /* Return the value of X as a poly_int64. */
  1908. inline poly_int64
  1909. rtx_to_poly_int64 (const_rtx x)
  1910. {
  1911. if (CONST_POLY_INT_P (x))
  1912. {
  1913. poly_int64 res;
  1914. for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
  1915. res.coeffs[i] = CONST_POLY_INT_COEFFS (x)[i].to_shwi ();
  1916. return res;
  1917. }
  1918. return INTVAL (x);
  1919. }
  1920. /* Return true if arbitrary value X is an integer constant that can
  1921. be represented as a poly_int64. Store the value in *RES if so,
  1922. otherwise leave it unmodified. */
  1923. inline bool
  1924. poly_int_rtx_p (const_rtx x, poly_int64_pod *res)
  1925. {
  1926. if (CONST_INT_P (x))
  1927. {
  1928. *res = INTVAL (x);
  1929. return true;
  1930. }
  1931. if (CONST_POLY_INT_P (x))
  1932. {
  1933. for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
  1934. if (!wi::fits_shwi_p (CONST_POLY_INT_COEFFS (x)[i]))
  1935. return false;
  1936. for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
  1937. res->coeffs[i] = CONST_POLY_INT_COEFFS (x)[i].to_shwi ();
  1938. return true;
  1939. }
  1940. return false;
  1941. }
  1942. extern void init_rtlanal (void);
  1943. extern int rtx_cost (rtx, machine_mode, enum rtx_code, int, bool);
  1944. extern int address_cost (rtx, machine_mode, addr_space_t, bool);
  1945. extern void get_full_rtx_cost (rtx, machine_mode, enum rtx_code, int,
  1946. struct full_rtx_costs *);
  1947. extern poly_uint64 subreg_lsb (const_rtx);
  1948. extern poly_uint64 subreg_lsb_1 (machine_mode, machine_mode, poly_uint64);
  1949. extern poly_uint64 subreg_size_offset_from_lsb (poly_uint64, poly_uint64,
  1950. poly_uint64);
  1951. extern bool read_modify_subreg_p (const_rtx);
  1952. /* Return the subreg byte offset for a subreg whose outer mode is
  1953. OUTER_MODE, whose inner mode is INNER_MODE, and where there are
  1954. LSB_SHIFT *bits* between the lsb of the outer value and the lsb of
  1955. the inner value. This is the inverse of subreg_lsb_1 (which converts
  1956. byte offsets to bit shifts). */
  1957. inline poly_uint64
  1958. subreg_offset_from_lsb (machine_mode outer_mode,
  1959. machine_mode inner_mode,
  1960. poly_uint64 lsb_shift)
  1961. {
  1962. return subreg_size_offset_from_lsb (GET_MODE_SIZE (outer_mode),
  1963. GET_MODE_SIZE (inner_mode), lsb_shift);
  1964. }
  1965. extern unsigned int subreg_regno_offset (unsigned int, machine_mode,
  1966. poly_uint64, machine_mode);
  1967. extern bool subreg_offset_representable_p (unsigned int, machine_mode,
  1968. poly_uint64, machine_mode);
  1969. extern unsigned int subreg_regno (const_rtx);
  1970. extern int simplify_subreg_regno (unsigned int, machine_mode,
  1971. poly_uint64, machine_mode);
  1972. extern unsigned int subreg_nregs (const_rtx);
  1973. extern unsigned int subreg_nregs_with_regno (unsigned int, const_rtx);
  1974. extern unsigned HOST_WIDE_INT nonzero_bits (const_rtx, machine_mode);
  1975. extern unsigned int num_sign_bit_copies (const_rtx, machine_mode);
  1976. extern bool constant_pool_constant_p (rtx);
  1977. extern bool truncated_to_mode (machine_mode, const_rtx);
  1978. extern int low_bitmask_len (machine_mode, unsigned HOST_WIDE_INT);
  1979. extern void split_double (rtx, rtx *, rtx *);
  1980. extern rtx *strip_address_mutations (rtx *, enum rtx_code * = 0);
  1981. extern void decompose_address (struct address_info *, rtx *,
  1982. machine_mode, addr_space_t, enum rtx_code);
  1983. extern void decompose_lea_address (struct address_info *, rtx *);
  1984. extern void decompose_mem_address (struct address_info *, rtx);
  1985. extern void update_address (struct address_info *);
  1986. extern HOST_WIDE_INT get_index_scale (const struct address_info *);
  1987. extern enum rtx_code get_index_code (const struct address_info *);
  1988. /* 1 if RTX is a subreg containing a reg that is already known to be
  1989. sign- or zero-extended from the mode of the subreg to the mode of
  1990. the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
  1991. extension.
  1992. When used as a LHS, is means that this extension must be done
  1993. when assigning to SUBREG_REG. */
  1994. #define SUBREG_PROMOTED_VAR_P(RTX) \
  1995. (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED", (RTX), SUBREG)->in_struct)
  1996. /* Valid for subregs which are SUBREG_PROMOTED_VAR_P(). In that case
  1997. this gives the necessary extensions:
  1998. 0 - signed (SPR_SIGNED)
  1999. 1 - normal unsigned (SPR_UNSIGNED)
  2000. 2 - value is both sign and unsign extended for mode
  2001. (SPR_SIGNED_AND_UNSIGNED).
  2002. -1 - pointer unsigned, which most often can be handled like unsigned
  2003. extension, except for generating instructions where we need to
  2004. emit special code (ptr_extend insns) on some architectures
  2005. (SPR_POINTER). */
  2006. const int SRP_POINTER = -1;
  2007. const int SRP_SIGNED = 0;
  2008. const int SRP_UNSIGNED = 1;
  2009. const int SRP_SIGNED_AND_UNSIGNED = 2;
  2010. /* Sets promoted mode for SUBREG_PROMOTED_VAR_P(). */
  2011. #define SUBREG_PROMOTED_SET(RTX, VAL) \
  2012. do { \
  2013. rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SET", \
  2014. (RTX), SUBREG); \
  2015. switch (VAL) \
  2016. { \
  2017. case SRP_POINTER: \
  2018. _rtx->volatil = 0; \
  2019. _rtx->unchanging = 0; \
  2020. break; \
  2021. case SRP_SIGNED: \
  2022. _rtx->volatil = 0; \
  2023. _rtx->unchanging = 1; \
  2024. break; \
  2025. case SRP_UNSIGNED: \
  2026. _rtx->volatil = 1; \
  2027. _rtx->unchanging = 0; \
  2028. break; \
  2029. case SRP_SIGNED_AND_UNSIGNED: \
  2030. _rtx->volatil = 1; \
  2031. _rtx->unchanging = 1; \
  2032. break; \
  2033. } \
  2034. } while (0)
  2035. /* Gets the value stored in promoted mode for SUBREG_PROMOTED_VAR_P(),
  2036. including SRP_SIGNED_AND_UNSIGNED if promoted for
  2037. both signed and unsigned. */
  2038. #define SUBREG_PROMOTED_GET(RTX) \
  2039. (2 * (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_GET", (RTX), SUBREG)->volatil)\
  2040. + (RTX)->unchanging - 1)
  2041. /* Returns sign of promoted mode for SUBREG_PROMOTED_VAR_P(). */
  2042. #define SUBREG_PROMOTED_SIGN(RTX) \
  2043. ((RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGN", (RTX), SUBREG)->volatil) ? 1\
  2044. : (RTX)->unchanging - 1)
  2045. /* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted
  2046. for SIGNED type. */
  2047. #define SUBREG_PROMOTED_SIGNED_P(RTX) \
  2048. (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGNED_P", (RTX), SUBREG)->unchanging)
  2049. /* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted
  2050. for UNSIGNED type. */
  2051. #define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
  2052. (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil)
  2053. /* Checks if RTX of SUBREG_PROMOTED_VAR_P() is promoted for given SIGN. */
  2054. #define SUBREG_CHECK_PROMOTED_SIGN(RTX, SIGN) \
  2055. ((SIGN) == SRP_POINTER ? SUBREG_PROMOTED_GET (RTX) == SRP_POINTER \
  2056. : (SIGN) == SRP_SIGNED ? SUBREG_PROMOTED_SIGNED_P (RTX) \
  2057. : SUBREG_PROMOTED_UNSIGNED_P (RTX))
  2058. /* True if the REG is the static chain register for some CALL_INSN. */
  2059. #define STATIC_CHAIN_REG_P(RTX) \
  2060. (RTL_FLAG_CHECK1 ("STATIC_CHAIN_REG_P", (RTX), REG)->jump)
  2061. /* True if the subreg was generated by LRA for reload insns. Such
  2062. subregs are valid only during LRA. */
  2063. #define LRA_SUBREG_P(RTX) \
  2064. (RTL_FLAG_CHECK1 ("LRA_SUBREG_P", (RTX), SUBREG)->jump)
  2065. /* True if call is instrumented by Pointer Bounds Checker. */
  2066. #define CALL_EXPR_WITH_BOUNDS_P(RTX) \
  2067. (RTL_FLAG_CHECK1 ("CALL_EXPR_WITH_BOUNDS_P", (RTX), CALL)->jump)
  2068. /* Access various components of an ASM_OPERANDS rtx. */
  2069. #define ASM_OPERANDS_TEMPLATE(RTX) XCSTR (RTX, 0, ASM_OPERANDS)
  2070. #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XCSTR (RTX, 1, ASM_OPERANDS)
  2071. #define ASM_OPERANDS_OUTPUT_IDX(RTX) XCINT (RTX, 2, ASM_OPERANDS)
  2072. #define ASM_OPERANDS_INPUT_VEC(RTX) XCVEC (RTX, 3, ASM_OPERANDS)
  2073. #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XCVEC (RTX, 4, ASM_OPERANDS)
  2074. #define ASM_OPERANDS_INPUT(RTX, N) XCVECEXP (RTX, 3, N, ASM_OPERANDS)
  2075. #define ASM_OPERANDS_INPUT_LENGTH(RTX) XCVECLEN (RTX, 3, ASM_OPERANDS)
  2076. #define ASM_OPERANDS_INPUT_CONSTRAINT_EXP(RTX, N) \
  2077. XCVECEXP (RTX, 4, N, ASM_OPERANDS)
  2078. #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) \
  2079. XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0)
  2080. #define ASM_OPERANDS_INPUT_MODE(RTX, N) \
  2081. GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
  2082. #define ASM_OPERANDS_LABEL_VEC(RTX) XCVEC (RTX, 5, ASM_OPERANDS)
  2083. #define ASM_OPERANDS_LABEL_LENGTH(RTX) XCVECLEN (RTX, 5, ASM_OPERANDS)
  2084. #define ASM_OPERANDS_LABEL(RTX, N) XCVECEXP (RTX, 5, N, ASM_OPERANDS)
  2085. #define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCUINT (RTX, 6, ASM_OPERANDS)
  2086. #define ASM_INPUT_SOURCE_LOCATION(RTX) XCUINT (RTX, 1, ASM_INPUT)
  2087. /* 1 if RTX is a mem that is statically allocated in read-only memory. */
  2088. #define MEM_READONLY_P(RTX) \
  2089. (RTL_FLAG_CHECK1 ("MEM_READONLY_P", (RTX), MEM)->unchanging)
  2090. /* 1 if RTX is a mem and we should keep the alias set for this mem
  2091. unchanged when we access a component. Set to 1, or example, when we
  2092. are already in a non-addressable component of an aggregate. */
  2093. #define MEM_KEEP_ALIAS_SET_P(RTX) \
  2094. (RTL_FLAG_CHECK1 ("MEM_KEEP_ALIAS_SET_P", (RTX), MEM)->jump)
  2095. /* 1 if RTX is a mem or asm_operand for a volatile reference. */
  2096. #define MEM_VOLATILE_P(RTX) \
  2097. (RTL_FLAG_CHECK3 ("MEM_VOLATILE_P", (RTX), MEM, ASM_OPERANDS, \
  2098. ASM_INPUT)->volatil)
  2099. /* 1 if RTX is a mem that cannot trap. */
  2100. #define MEM_NOTRAP_P(RTX) \
  2101. (RTL_FLAG_CHECK1 ("MEM_NOTRAP_P", (RTX), MEM)->call)
  2102. /* The memory attribute block. We provide access macros for each value
  2103. in the block and provide defaults if none specified. */
  2104. #define MEM_ATTRS(RTX) X0MEMATTR (RTX, 1)
  2105. /* The register attribute block. We provide access macros for each value
  2106. in the block and provide defaults if none specified. */
  2107. #define REG_ATTRS(RTX) (REG_CHECK (RTX)->attrs)
  2108. #ifndef GENERATOR_FILE
  2109. /* For a MEM rtx, the alias set. If 0, this MEM is not in any alias
  2110. set, and may alias anything. Otherwise, the MEM can only alias
  2111. MEMs in a conflicting alias set. This value is set in a
  2112. language-dependent manner in the front-end, and should not be
  2113. altered in the back-end. These set numbers are tested with
  2114. alias_sets_conflict_p. */
  2115. #define MEM_ALIAS_SET(RTX) (get_mem_attrs (RTX)->alias)
  2116. /* For a MEM rtx, the decl it is known to refer to, if it is known to
  2117. refer to part of a DECL. It may also be a COMPONENT_REF. */
  2118. #define MEM_EXPR(RTX) (get_mem_attrs (RTX)->expr)
  2119. /* For a MEM rtx, true if its MEM_OFFSET is known. */
  2120. #define MEM_OFFSET_KNOWN_P(RTX) (get_mem_attrs (RTX)->offset_known_p)
  2121. /* For a MEM rtx, the offset from the start of MEM_EXPR. */
  2122. #define MEM_OFFSET(RTX) (get_mem_attrs (RTX)->offset)
  2123. /* For a MEM rtx, the address space. */
  2124. #define MEM_ADDR_SPACE(RTX) (get_mem_attrs (RTX)->addrspace)
  2125. /* For a MEM rtx, true if its MEM_SIZE is known. */
  2126. #define MEM_SIZE_KNOWN_P(RTX) (get_mem_attrs (RTX)->size_known_p)
  2127. /* For a MEM rtx, the size in bytes of the MEM. */
  2128. #define MEM_SIZE(RTX) (get_mem_attrs (RTX)->size)
  2129. /* For a MEM rtx, the alignment in bits. We can use the alignment of the
  2130. mode as a default when STRICT_ALIGNMENT, but not if not. */
  2131. #define MEM_ALIGN(RTX) (get_mem_attrs (RTX)->align)
  2132. #else
  2133. #define MEM_ADDR_SPACE(RTX) ADDR_SPACE_GENERIC
  2134. #endif
  2135. /* For a REG rtx, the decl it is known to refer to, if it is known to
  2136. refer to part of a DECL. */
  2137. #define REG_EXPR(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->decl)
  2138. /* For a REG rtx, the offset from the start of REG_EXPR, if known, as an
  2139. HOST_WIDE_INT. */
  2140. #define REG_OFFSET(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->offset)
  2141. /* Copy the attributes that apply to memory locations from RHS to LHS. */
  2142. #define MEM_COPY_ATTRIBUTES(LHS, RHS) \
  2143. (MEM_VOLATILE_P (LHS) = MEM_VOLATILE_P (RHS), \
  2144. MEM_NOTRAP_P (LHS) = MEM_NOTRAP_P (RHS), \
  2145. MEM_READONLY_P (LHS) = MEM_READONLY_P (RHS), \
  2146. MEM_KEEP_ALIAS_SET_P (LHS) = MEM_KEEP_ALIAS_SET_P (RHS), \
  2147. MEM_POINTER (LHS) = MEM_POINTER (RHS), \
  2148. MEM_ATTRS (LHS) = MEM_ATTRS (RHS))
  2149. /* 1 if RTX is a label_ref for a nonlocal label. */
  2150. /* Likewise in an expr_list for a REG_LABEL_OPERAND or
  2151. REG_LABEL_TARGET note. */
  2152. #define LABEL_REF_NONLOCAL_P(RTX) \
  2153. (RTL_FLAG_CHECK1 ("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF)->volatil)
  2154. /* 1 if RTX is a code_label that should always be considered to be needed. */
  2155. #define LABEL_PRESERVE_P(RTX) \
  2156. (RTL_FLAG_CHECK2 ("LABEL_PRESERVE_P", (RTX), CODE_LABEL, NOTE)->in_struct)
  2157. /* During sched, 1 if RTX is an insn that must be scheduled together
  2158. with the preceding insn. */
  2159. #define SCHED_GROUP_P(RTX) \
  2160. (RTL_FLAG_CHECK4 ("SCHED_GROUP_P", (RTX), DEBUG_INSN, INSN, \
  2161. JUMP_INSN, CALL_INSN)->in_struct)
  2162. /* For a SET rtx, SET_DEST is the place that is set
  2163. and SET_SRC is the value it is set to. */
  2164. #define SET_DEST(RTX) XC2EXP (RTX, 0, SET, CLOBBER)
  2165. #define SET_SRC(RTX) XCEXP (RTX, 1, SET)
  2166. #define SET_IS_RETURN_P(RTX) \
  2167. (RTL_FLAG_CHECK1 ("SET_IS_RETURN_P", (RTX), SET)->jump)
  2168. /* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
  2169. #define TRAP_CONDITION(RTX) XCEXP (RTX, 0, TRAP_IF)
  2170. #define TRAP_CODE(RTX) XCEXP (RTX, 1, TRAP_IF)
  2171. /* For a COND_EXEC rtx, COND_EXEC_TEST is the condition to base
  2172. conditionally executing the code on, COND_EXEC_CODE is the code
  2173. to execute if the condition is true. */
  2174. #define COND_EXEC_TEST(RTX) XCEXP (RTX, 0, COND_EXEC)
  2175. #define COND_EXEC_CODE(RTX) XCEXP (RTX, 1, COND_EXEC)
  2176. /* 1 if RTX is a symbol_ref that addresses this function's rtl
  2177. constants pool. */
  2178. #define CONSTANT_POOL_ADDRESS_P(RTX) \
  2179. (RTL_FLAG_CHECK1 ("CONSTANT_POOL_ADDRESS_P", (RTX), SYMBOL_REF)->unchanging)
  2180. /* 1 if RTX is a symbol_ref that addresses a value in the file's
  2181. tree constant pool. This information is private to varasm.c. */
  2182. #define TREE_CONSTANT_POOL_ADDRESS_P(RTX) \
  2183. (RTL_FLAG_CHECK1 ("TREE_CONSTANT_POOL_ADDRESS_P", \
  2184. (RTX), SYMBOL_REF)->frame_related)
  2185. /* Used if RTX is a symbol_ref, for machine-specific purposes. */
  2186. #define SYMBOL_REF_FLAG(RTX) \
  2187. (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAG", (RTX), SYMBOL_REF)->volatil)
  2188. /* 1 if RTX is a symbol_ref that has been the library function in
  2189. emit_library_call. */
  2190. #define SYMBOL_REF_USED(RTX) \
  2191. (RTL_FLAG_CHECK1 ("SYMBOL_REF_USED", (RTX), SYMBOL_REF)->used)
  2192. /* 1 if RTX is a symbol_ref for a weak symbol. */
  2193. #define SYMBOL_REF_WEAK(RTX) \
  2194. (RTL_FLAG_CHECK1 ("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->return_val)
  2195. /* A pointer attached to the SYMBOL_REF; either SYMBOL_REF_DECL or
  2196. SYMBOL_REF_CONSTANT. */
  2197. #define SYMBOL_REF_DATA(RTX) X0ANY ((RTX), 1)
  2198. /* Set RTX's SYMBOL_REF_DECL to DECL. RTX must not be a constant
  2199. pool symbol. */
  2200. #define SET_SYMBOL_REF_DECL(RTX, DECL) \
  2201. (gcc_assert (!CONSTANT_POOL_ADDRESS_P (RTX)), X0TREE ((RTX), 1) = (DECL))
  2202. /* The tree (decl or constant) associated with the symbol, or null. */
  2203. #define SYMBOL_REF_DECL(RTX) \
  2204. (CONSTANT_POOL_ADDRESS_P (RTX) ? NULL : X0TREE ((RTX), 1))
  2205. /* Set RTX's SYMBOL_REF_CONSTANT to C. RTX must be a constant pool symbol. */
  2206. #define SET_SYMBOL_REF_CONSTANT(RTX, C) \
  2207. (gcc_assert (CONSTANT_POOL_ADDRESS_P (RTX)), X0CONSTANT ((RTX), 1) = (C))
  2208. /* The rtx constant pool entry for a symbol, or null. */
  2209. #define SYMBOL_REF_CONSTANT(RTX) \
  2210. (CONSTANT_POOL_ADDRESS_P (RTX) ? X0CONSTANT ((RTX), 1) : NULL)
  2211. /* A set of flags on a symbol_ref that are, in some respects, redundant with
  2212. information derivable from the tree decl associated with this symbol.
  2213. Except that we build a *lot* of SYMBOL_REFs that aren't associated with a
  2214. decl. In some cases this is a bug. But beyond that, it's nice to cache
  2215. this information to avoid recomputing it. Finally, this allows space for
  2216. the target to store more than one bit of information, as with
  2217. SYMBOL_REF_FLAG. */
  2218. #define SYMBOL_REF_FLAGS(RTX) \
  2219. (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAGS", (RTX), SYMBOL_REF) \
  2220. ->u2.symbol_ref_flags)
  2221. /* These flags are common enough to be defined for all targets. They
  2222. are computed by the default version of targetm.encode_section_info. */
  2223. /* Set if this symbol is a function. */
  2224. #define SYMBOL_FLAG_FUNCTION (1 << 0)
  2225. #define SYMBOL_REF_FUNCTION_P(RTX) \
  2226. ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_FUNCTION) != 0)
  2227. /* Set if targetm.binds_local_p is true. */
  2228. #define SYMBOL_FLAG_LOCAL (1 << 1)
  2229. #define SYMBOL_REF_LOCAL_P(RTX) \
  2230. ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_LOCAL) != 0)
  2231. /* Set if targetm.in_small_data_p is true. */
  2232. #define SYMBOL_FLAG_SMALL (1 << 2)
  2233. #define SYMBOL_REF_SMALL_P(RTX) \
  2234. ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_SMALL) != 0)
  2235. /* The three-bit field at [5:3] is true for TLS variables; use
  2236. SYMBOL_REF_TLS_MODEL to extract the field as an enum tls_model. */
  2237. #define SYMBOL_FLAG_TLS_SHIFT 3
  2238. #define SYMBOL_REF_TLS_MODEL(RTX) \
  2239. ((enum tls_model) ((SYMBOL_REF_FLAGS (RTX) >> SYMBOL_FLAG_TLS_SHIFT) & 7))
  2240. /* Set if this symbol is not defined in this translation unit. */
  2241. #define SYMBOL_FLAG_EXTERNAL (1 << 6)
  2242. #define SYMBOL_REF_EXTERNAL_P(RTX) \
  2243. ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_EXTERNAL) != 0)
  2244. /* Set if this symbol has a block_symbol structure associated with it. */
  2245. #define SYMBOL_FLAG_HAS_BLOCK_INFO (1 << 7)
  2246. #define SYMBOL_REF_HAS_BLOCK_INFO_P(RTX) \
  2247. ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_HAS_BLOCK_INFO) != 0)
  2248. /* Set if this symbol is a section anchor. SYMBOL_REF_ANCHOR_P implies
  2249. SYMBOL_REF_HAS_BLOCK_INFO_P. */
  2250. #define SYMBOL_FLAG_ANCHOR (1 << 8)
  2251. #define SYMBOL_REF_ANCHOR_P(RTX) \
  2252. ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_ANCHOR) != 0)
  2253. /* Subsequent bits are available for the target to use. */
  2254. #define SYMBOL_FLAG_MACH_DEP_SHIFT 9
  2255. #define SYMBOL_FLAG_MACH_DEP (1 << SYMBOL_FLAG_MACH_DEP_SHIFT)
  2256. /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the object_block
  2257. structure to which the symbol belongs, or NULL if it has not been
  2258. assigned a block. */
  2259. #define SYMBOL_REF_BLOCK(RTX) (BLOCK_SYMBOL_CHECK (RTX)->block)
  2260. /* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the offset of RTX from
  2261. the first object in SYMBOL_REF_BLOCK (RTX). The value is negative if
  2262. RTX has not yet been assigned to a block, or it has not been given an
  2263. offset within that block. */
  2264. #define SYMBOL_REF_BLOCK_OFFSET(RTX) (BLOCK_SYMBOL_CHECK (RTX)->offset)
  2265. /* True if RTX is flagged to be a scheduling barrier. */
  2266. #define PREFETCH_SCHEDULE_BARRIER_P(RTX) \
  2267. (RTL_FLAG_CHECK1 ("PREFETCH_SCHEDULE_BARRIER_P", (RTX), PREFETCH)->volatil)
  2268. /* Indicate whether the machine has any sort of auto increment addressing.
  2269. If not, we can avoid checking for REG_INC notes. */
  2270. #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) \
  2271. || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT) \
  2272. || defined (HAVE_PRE_MODIFY_DISP) || defined (HAVE_POST_MODIFY_DISP) \
  2273. || defined (HAVE_PRE_MODIFY_REG) || defined (HAVE_POST_MODIFY_REG))
  2274. #define AUTO_INC_DEC 1
  2275. #else
  2276. #define AUTO_INC_DEC 0
  2277. #endif
  2278. /* Define a macro to look for REG_INC notes,
  2279. but save time on machines where they never exist. */
  2280. #if AUTO_INC_DEC
  2281. #define FIND_REG_INC_NOTE(INSN, REG) \
  2282. ((REG) != NULL_RTX && REG_P ((REG)) \
  2283. ? find_regno_note ((INSN), REG_INC, REGNO (REG)) \
  2284. : find_reg_note ((INSN), REG_INC, (REG)))
  2285. #else
  2286. #define FIND_REG_INC_NOTE(INSN, REG) 0
  2287. #endif
  2288. #ifndef HAVE_PRE_INCREMENT
  2289. #define HAVE_PRE_INCREMENT 0
  2290. #endif
  2291. #ifndef HAVE_PRE_DECREMENT
  2292. #define HAVE_PRE_DECREMENT 0
  2293. #endif
  2294. #ifndef HAVE_POST_INCREMENT
  2295. #define HAVE_POST_INCREMENT 0
  2296. #endif
  2297. #ifndef HAVE_POST_DECREMENT
  2298. #define HAVE_POST_DECREMENT 0
  2299. #endif
  2300. #ifndef HAVE_POST_MODIFY_DISP
  2301. #define HAVE_POST_MODIFY_DISP 0
  2302. #endif
  2303. #ifndef HAVE_POST_MODIFY_REG
  2304. #define HAVE_POST_MODIFY_REG 0
  2305. #endif
  2306. #ifndef HAVE_PRE_MODIFY_DISP
  2307. #define HAVE_PRE_MODIFY_DISP 0
  2308. #endif
  2309. #ifndef HAVE_PRE_MODIFY_REG
  2310. #define HAVE_PRE_MODIFY_REG 0
  2311. #endif
  2312. /* Some architectures do not have complete pre/post increment/decrement
  2313. instruction sets, or only move some modes efficiently. These macros
  2314. allow us to tune autoincrement generation. */
  2315. #ifndef USE_LOAD_POST_INCREMENT
  2316. #define USE_LOAD_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
  2317. #endif
  2318. #ifndef USE_LOAD_POST_DECREMENT
  2319. #define USE_LOAD_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
  2320. #endif
  2321. #ifndef USE_LOAD_PRE_INCREMENT
  2322. #define USE_LOAD_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
  2323. #endif
  2324. #ifndef USE_LOAD_PRE_DECREMENT
  2325. #define USE_LOAD_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
  2326. #endif
  2327. #ifndef USE_STORE_POST_INCREMENT
  2328. #define USE_STORE_POST_INCREMENT(MODE) HAVE_POST_INCREMENT
  2329. #endif
  2330. #ifndef USE_STORE_POST_DECREMENT
  2331. #define USE_STORE_POST_DECREMENT(MODE) HAVE_POST_DECREMENT
  2332. #endif
  2333. #ifndef USE_STORE_PRE_INCREMENT
  2334. #define USE_STORE_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT
  2335. #endif
  2336. #ifndef USE_STORE_PRE_DECREMENT
  2337. #define USE_STORE_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT
  2338. #endif
  2339. /* Nonzero when we are generating CONCATs. */
  2340. extern int generating_concat_p;
  2341. /* Nonzero when we are expanding trees to RTL. */
  2342. extern int currently_expanding_to_rtl;
  2343. /* Generally useful functions. */
  2344. #ifndef GENERATOR_FILE
  2345. /* Return the cost of SET X. SPEED_P is true if optimizing for speed
  2346. rather than size. */
  2347. static inline int
  2348. set_rtx_cost (rtx x, bool speed_p)
  2349. {
  2350. return rtx_cost (x, VOIDmode, INSN, 4, speed_p);
  2351. }
  2352. /* Like set_rtx_cost, but return both the speed and size costs in C. */
  2353. static inline void
  2354. get_full_set_rtx_cost (rtx x, struct full_rtx_costs *c)
  2355. {
  2356. get_full_rtx_cost (x, VOIDmode, INSN, 4, c);
  2357. }
  2358. /* Return the cost of moving X into a register, relative to the cost
  2359. of a register move. SPEED_P is true if optimizing for speed rather
  2360. than size. */
  2361. static inline int
  2362. set_src_cost (rtx x, machine_mode mode, bool speed_p)
  2363. {
  2364. return rtx_cost (x, mode, SET, 1, speed_p);
  2365. }
  2366. /* Like set_src_cost, but return both the speed and size costs in C. */
  2367. static inline void
  2368. get_full_set_src_cost (rtx x, machine_mode mode, struct full_rtx_costs *c)
  2369. {
  2370. get_full_rtx_cost (x, mode, SET, 1, c);
  2371. }
  2372. #endif
  2373. /* A convenience macro to validate the arguments of a zero_extract
  2374. expression. It determines whether SIZE lies inclusively within
  2375. [1, RANGE], POS lies inclusively within between [0, RANGE - 1]
  2376. and the sum lies inclusively within [1, RANGE]. RANGE must be
  2377. >= 1, but SIZE and POS may be negative. */
  2378. #define EXTRACT_ARGS_IN_RANGE(SIZE, POS, RANGE) \
  2379. (IN_RANGE ((POS), 0, (unsigned HOST_WIDE_INT) (RANGE) - 1) \
  2380. && IN_RANGE ((SIZE), 1, (unsigned HOST_WIDE_INT) (RANGE) \
  2381. - (unsigned HOST_WIDE_INT)(POS)))
  2382. /* In explow.c */
  2383. extern HOST_WIDE_INT trunc_int_for_mode (HOST_WIDE_INT, machine_mode);
  2384. extern poly_int64 trunc_int_for_mode (poly_int64, machine_mode);
  2385. extern rtx plus_constant (machine_mode, rtx, poly_int64, bool = false);
  2386. extern HOST_WIDE_INT get_stack_check_protect (void);
  2387. /* In rtl.c */
  2388. extern rtx rtx_alloc (RTX_CODE CXX_MEM_STAT_INFO);
  2389. extern rtx rtx_alloc_stat_v (RTX_CODE MEM_STAT_DECL, int);
  2390. #define rtx_alloc_v(c, SZ) rtx_alloc_stat_v (c MEM_STAT_INFO, SZ)
  2391. #define const_wide_int_alloc(NWORDS) \
  2392. rtx_alloc_v (CONST_WIDE_INT, \
  2393. (sizeof (struct hwivec_def) \
  2394. + ((NWORDS)-1) * sizeof (HOST_WIDE_INT))) \
  2395. extern rtvec rtvec_alloc (int);
  2396. extern rtvec shallow_copy_rtvec (rtvec);
  2397. extern bool shared_const_p (const_rtx);
  2398. extern rtx copy_rtx (rtx);
  2399. extern enum rtx_code classify_insn (rtx);
  2400. extern void dump_rtx_statistics (void);
  2401. /* In emit-rtl.c */
  2402. extern rtx copy_rtx_if_shared (rtx);
  2403. /* In rtl.c */
  2404. extern unsigned int rtx_size (const_rtx);
  2405. extern rtx shallow_copy_rtx (const_rtx CXX_MEM_STAT_INFO);
  2406. extern int rtx_equal_p (const_rtx, const_rtx);
  2407. extern bool rtvec_all_equal_p (const_rtvec);
  2408. /* Return true if X is a vector constant with a duplicated element value. */
  2409. inline bool
  2410. const_vec_duplicate_p (const_rtx x)
  2411. {
  2412. return (GET_CODE (x) == CONST_VECTOR
  2413. && CONST_VECTOR_NPATTERNS (x) == 1
  2414. && CONST_VECTOR_DUPLICATE_P (x));
  2415. }
  2416. /* Return true if X is a vector constant with a duplicated element value.
  2417. Store the duplicated element in *ELT if so. */
  2418. template <typename T>
  2419. inline bool
  2420. const_vec_duplicate_p (T x, T *elt)
  2421. {
  2422. if (const_vec_duplicate_p (x))
  2423. {
  2424. *elt = CONST_VECTOR_ENCODED_ELT (x, 0);
  2425. return true;
  2426. }
  2427. return false;
  2428. }
  2429. /* Return true if X is a vector with a duplicated element value, either
  2430. constant or nonconstant. Store the duplicated element in *ELT if so. */
  2431. template <typename T>
  2432. inline bool
  2433. vec_duplicate_p (T x, T *elt)
  2434. {
  2435. if (GET_CODE (x) == VEC_DUPLICATE
  2436. && !VECTOR_MODE_P (GET_MODE (XEXP (x, 0))))
  2437. {
  2438. *elt = XEXP (x, 0);
  2439. return true;
  2440. }
  2441. return const_vec_duplicate_p (x, elt);
  2442. }
  2443. /* If X is a vector constant with a duplicated element value, return that
  2444. element value, otherwise return X. */
  2445. template <typename T>
  2446. inline T
  2447. unwrap_const_vec_duplicate (T x)
  2448. {
  2449. if (const_vec_duplicate_p (x))
  2450. x = CONST_VECTOR_ELT (x, 0);
  2451. return x;
  2452. }
  2453. /* In emit-rtl.c. */
  2454. extern wide_int const_vector_int_elt (const_rtx, unsigned int);
  2455. extern rtx const_vector_elt (const_rtx, unsigned int);
  2456. extern bool const_vec_series_p_1 (const_rtx, rtx *, rtx *);
  2457. /* Return true if X is an integer constant vector that contains a linear
  2458. series of the form:
  2459. { B, B + S, B + 2 * S, B + 3 * S, ... }
  2460. for a nonzero S. Store B and S in *BASE_OUT and *STEP_OUT on sucess. */
  2461. inline bool
  2462. const_vec_series_p (const_rtx x, rtx *base_out, rtx *step_out)
  2463. {
  2464. if (GET_CODE (x) == CONST_VECTOR
  2465. && CONST_VECTOR_NPATTERNS (x) == 1
  2466. && !CONST_VECTOR_DUPLICATE_P (x))
  2467. return const_vec_series_p_1 (x, base_out, step_out);
  2468. return false;
  2469. }
  2470. /* Return true if X is a vector that contains a linear series of the
  2471. form:
  2472. { B, B + S, B + 2 * S, B + 3 * S, ... }
  2473. where B and S are constant or nonconstant. Store B and S in
  2474. *BASE_OUT and *STEP_OUT on sucess. */
  2475. inline bool
  2476. vec_series_p (const_rtx x, rtx *base_out, rtx *step_out)
  2477. {
  2478. if (GET_CODE (x) == VEC_SERIES)
  2479. {
  2480. *base_out = XEXP (x, 0);
  2481. *step_out = XEXP (x, 1);
  2482. return true;
  2483. }
  2484. return const_vec_series_p (x, base_out, step_out);
  2485. }
  2486. /* Return the unpromoted (outer) mode of SUBREG_PROMOTED_VAR_P subreg X. */
  2487. inline scalar_int_mode
  2488. subreg_unpromoted_mode (rtx x)
  2489. {
  2490. gcc_checking_assert (SUBREG_PROMOTED_VAR_P (x));
  2491. return as_a <scalar_int_mode> (GET_MODE (x));
  2492. }
  2493. /* Return the promoted (inner) mode of SUBREG_PROMOTED_VAR_P subreg X. */
  2494. inline scalar_int_mode
  2495. subreg_promoted_mode (rtx x)
  2496. {
  2497. gcc_checking_assert (SUBREG_PROMOTED_VAR_P (x));
  2498. return as_a <scalar_int_mode> (GET_MODE (SUBREG_REG (x)));
  2499. }
  2500. /* In emit-rtl.c */
  2501. extern rtvec gen_rtvec_v (int, rtx *);
  2502. extern rtvec gen_rtvec_v (int, rtx_insn **);
  2503. extern rtx gen_reg_rtx (machine_mode);
  2504. extern rtx gen_rtx_REG_offset (rtx, machine_mode, unsigned int, poly_int64);
  2505. extern rtx gen_reg_rtx_offset (rtx, machine_mode, int);
  2506. extern rtx gen_reg_rtx_and_attrs (rtx);
  2507. extern rtx_code_label *gen_label_rtx (void);
  2508. extern rtx gen_lowpart_common (machine_mode, rtx);
  2509. /* In cse.c */
  2510. extern rtx gen_lowpart_if_possible (machine_mode, rtx);
  2511. /* In emit-rtl.c */
  2512. extern rtx gen_highpart (machine_mode, rtx);
  2513. extern rtx gen_highpart_mode (machine_mode, machine_mode, rtx);
  2514. extern rtx operand_subword (rtx, poly_uint64, int, machine_mode);
  2515. /* In emit-rtl.c */
  2516. extern rtx operand_subword_force (rtx, poly_uint64, machine_mode);
  2517. extern int subreg_lowpart_p (const_rtx);
  2518. extern poly_uint64 subreg_size_lowpart_offset (poly_uint64, poly_uint64);
  2519. /* Return true if a subreg of mode OUTERMODE would only access part of
  2520. an inner register with mode INNERMODE. The other bits of the inner
  2521. register would then be "don't care" on read. The behavior for writes
  2522. depends on REGMODE_NATURAL_SIZE; bits in the same REGMODE_NATURAL_SIZE-d
  2523. chunk would be clobbered but other bits would be preserved. */
  2524. inline bool
  2525. partial_subreg_p (machine_mode outermode, machine_mode innermode)
  2526. {
  2527. /* Modes involved in a subreg must be ordered. In particular, we must
  2528. always know at compile time whether the subreg is paradoxical. */
  2529. poly_int64 outer_prec = GET_MODE_PRECISION (outermode);
  2530. poly_int64 inner_prec = GET_MODE_PRECISION (innermode);
  2531. gcc_checking_assert (ordered_p (outer_prec, inner_prec));
  2532. return maybe_lt (outer_prec, inner_prec);
  2533. }
  2534. /* Likewise return true if X is a subreg that is smaller than the inner
  2535. register. Use read_modify_subreg_p to test whether writing to such
  2536. a subreg preserves any part of the inner register. */
  2537. inline bool
  2538. partial_subreg_p (const_rtx x)
  2539. {
  2540. if (GET_CODE (x) != SUBREG)
  2541. return false;
  2542. return partial_subreg_p (GET_MODE (x), GET_MODE (SUBREG_REG (x)));
  2543. }
  2544. /* Return true if a subreg with the given outer and inner modes is
  2545. paradoxical. */
  2546. inline bool
  2547. paradoxical_subreg_p (machine_mode outermode, machine_mode innermode)
  2548. {
  2549. /* Modes involved in a subreg must be ordered. In particular, we must
  2550. always know at compile time whether the subreg is paradoxical. */
  2551. poly_int64 outer_prec = GET_MODE_PRECISION (outermode);
  2552. poly_int64 inner_prec = GET_MODE_PRECISION (innermode);
  2553. gcc_checking_assert (ordered_p (outer_prec, inner_prec));
  2554. return maybe_gt (outer_prec, inner_prec);
  2555. }
  2556. /* Return true if X is a paradoxical subreg, false otherwise. */
  2557. inline bool
  2558. paradoxical_subreg_p (const_rtx x)
  2559. {
  2560. if (GET_CODE (x) != SUBREG)
  2561. return false;
  2562. return paradoxical_subreg_p (GET_MODE (x), GET_MODE (SUBREG_REG (x)));
  2563. }
  2564. /* Return the SUBREG_BYTE for an OUTERMODE lowpart of an INNERMODE value. */
  2565. inline poly_uint64
  2566. subreg_lowpart_offset (machine_mode outermode, machine_mode innermode)
  2567. {
  2568. return subreg_size_lowpart_offset (GET_MODE_SIZE (outermode),
  2569. GET_MODE_SIZE (innermode));
  2570. }
  2571. /* Given that a subreg has outer mode OUTERMODE and inner mode INNERMODE,
  2572. return the smaller of the two modes if they are different sizes,
  2573. otherwise return the outer mode. */
  2574. inline machine_mode
  2575. narrower_subreg_mode (machine_mode outermode, machine_mode innermode)
  2576. {
  2577. return paradoxical_subreg_p (outermode, innermode) ? innermode : outermode;
  2578. }
  2579. /* Given that a subreg has outer mode OUTERMODE and inner mode INNERMODE,
  2580. return the mode that is big enough to hold both the outer and inner
  2581. values. Prefer the outer mode in the event of a tie. */
  2582. inline machine_mode
  2583. wider_subreg_mode (machine_mode outermode, machine_mode innermode)
  2584. {
  2585. return partial_subreg_p (outermode, innermode) ? innermode : outermode;
  2586. }
  2587. /* Likewise for subreg X. */
  2588. inline machine_mode
  2589. wider_subreg_mode (const_rtx x)
  2590. {
  2591. return wider_subreg_mode (GET_MODE (x), GET_MODE (SUBREG_REG (x)));
  2592. }
  2593. extern poly_uint64 subreg_size_highpart_offset (poly_uint64, poly_uint64);
  2594. /* Return the SUBREG_BYTE for an OUTERMODE highpart of an INNERMODE value. */
  2595. inline poly_uint64
  2596. subreg_highpart_offset (machine_mode outermode, machine_mode innermode)
  2597. {
  2598. return subreg_size_highpart_offset (GET_MODE_SIZE (outermode),
  2599. GET_MODE_SIZE (innermode));
  2600. }
  2601. extern poly_int64 byte_lowpart_offset (machine_mode, machine_mode);
  2602. extern poly_int64 subreg_memory_offset (machine_mode, machine_mode,
  2603. poly_uint64);
  2604. extern poly_int64 subreg_memory_offset (const_rtx);
  2605. extern rtx make_safe_from (rtx, rtx);
  2606. extern rtx convert_memory_address_addr_space_1 (scalar_int_mode, rtx,
  2607. addr_space_t, bool, bool);
  2608. extern rtx convert_memory_address_addr_space (scalar_int_mode, rtx,
  2609. addr_space_t);
  2610. #define convert_memory_address(to_mode,x) \
  2611. convert_memory_address_addr_space ((to_mode), (x), ADDR_SPACE_GENERIC)
  2612. extern const char *get_insn_name (int);
  2613. extern rtx_insn *get_last_insn_anywhere (void);
  2614. extern rtx_insn *get_first_nonnote_insn (void);
  2615. extern rtx_insn *get_last_nonnote_insn (void);
  2616. extern void start_sequence (void);
  2617. extern void push_to_sequence (rtx_insn *);
  2618. extern void push_to_sequence2 (rtx_insn *, rtx_insn *);
  2619. extern void end_sequence (void);
  2620. #if TARGET_SUPPORTS_WIDE_INT == 0
  2621. extern double_int rtx_to_double_int (const_rtx);
  2622. #endif
  2623. extern void cwi_output_hex (FILE *, const_rtx);
  2624. #if TARGET_SUPPORTS_WIDE_INT == 0
  2625. extern rtx immed_double_const (HOST_WIDE_INT, HOST_WIDE_INT,
  2626. machine_mode);
  2627. #endif
  2628. extern rtx immed_wide_int_const (const poly_wide_int_ref &, machine_mode);
  2629. /* In varasm.c */
  2630. extern rtx force_const_mem (machine_mode, rtx);
  2631. /* In varasm.c */
  2632. struct function;
  2633. extern rtx get_pool_constant (const_rtx);
  2634. extern rtx get_pool_constant_mark (rtx, bool *);
  2635. extern fixed_size_mode get_pool_mode (const_rtx);
  2636. extern rtx simplify_subtraction (rtx);
  2637. extern void decide_function_section (tree);
  2638. /* In emit-rtl.c */
  2639. extern rtx_insn *emit_insn_before (rtx, rtx);
  2640. extern rtx_insn *emit_insn_before_noloc (rtx, rtx_insn *, basic_block);
  2641. extern rtx_insn *emit_insn_before_setloc (rtx, rtx_insn *, int);
  2642. extern rtx_jump_insn *emit_jump_insn_before (rtx, rtx);
  2643. extern rtx_jump_insn *emit_jump_insn_before_noloc (rtx, rtx_insn *);
  2644. extern rtx_jump_insn *emit_jump_insn_before_setloc (rtx, rtx_insn *, int);
  2645. extern rtx_insn *emit_call_insn_before (rtx, rtx_insn *);
  2646. extern rtx_insn *emit_call_insn_before_noloc (rtx, rtx_insn *);
  2647. extern rtx_insn *emit_call_insn_before_setloc (rtx, rtx_insn *, int);
  2648. extern rtx_insn *emit_debug_insn_before (rtx, rtx_insn *);
  2649. extern rtx_insn *emit_debug_insn_before_noloc (rtx, rtx);
  2650. extern rtx_insn *emit_debug_insn_before_setloc (rtx, rtx, int);
  2651. extern rtx_barrier *emit_barrier_before (rtx);
  2652. extern rtx_code_label *emit_label_before (rtx, rtx_insn *);
  2653. extern rtx_note *emit_note_before (enum insn_note, rtx_insn *);
  2654. extern rtx_insn *emit_insn_after (rtx, rtx);
  2655. extern rtx_insn *emit_insn_after_noloc (rtx, rtx, basic_block);
  2656. extern rtx_insn *emit_insn_after_setloc (rtx, rtx, int);
  2657. extern rtx_jump_insn *emit_jump_insn_after (rtx, rtx);
  2658. extern rtx_jump_insn *emit_jump_insn_after_noloc (rtx, rtx);
  2659. extern rtx_jump_insn *emit_jump_insn_after_setloc (rtx, rtx, int);
  2660. extern rtx_insn *emit_call_insn_after (rtx, rtx);
  2661. extern rtx_insn *emit_call_insn_after_noloc (rtx, rtx);
  2662. extern rtx_insn *emit_call_insn_after_setloc (rtx, rtx, int);
  2663. extern rtx_insn *emit_debug_insn_after (rtx, rtx);
  2664. extern rtx_insn *emit_debug_insn_after_noloc (rtx, rtx);
  2665. extern rtx_insn *emit_debug_insn_after_setloc (rtx, rtx, int);
  2666. extern rtx_barrier *emit_barrier_after (rtx);
  2667. extern rtx_insn *emit_label_after (rtx, rtx_insn *);
  2668. extern rtx_note *emit_note_after (enum insn_note, rtx_insn *);
  2669. extern rtx_insn *emit_insn (rtx);
  2670. extern rtx_insn *emit_debug_insn (rtx);
  2671. extern rtx_insn *emit_jump_insn (rtx);
  2672. extern rtx_insn *emit_call_insn (rtx);
  2673. extern rtx_code_label *emit_label (rtx);
  2674. extern rtx_jump_table_data *emit_jump_table_data (rtx);
  2675. extern rtx_barrier *emit_barrier (void);
  2676. extern rtx_note *emit_note (enum insn_note);
  2677. extern rtx_note *emit_note_copy (rtx_note *);
  2678. extern rtx_insn *gen_clobber (rtx);
  2679. extern rtx_insn *emit_clobber (rtx);
  2680. extern rtx_insn *gen_use (rtx);
  2681. extern rtx_insn *emit_use (rtx);
  2682. extern rtx_insn *make_insn_raw (rtx);
  2683. extern void add_function_usage_to (rtx, rtx);
  2684. extern rtx_call_insn *last_call_insn (void);
  2685. extern rtx_insn *previous_insn (rtx_insn *);
  2686. extern rtx_insn *next_insn (rtx_insn *);
  2687. extern rtx_insn *prev_nonnote_insn (rtx_insn *);
  2688. extern rtx_insn *next_nonnote_insn (rtx_insn *);
  2689. extern rtx_insn *prev_nondebug_insn (rtx_insn *);
  2690. extern rtx_insn *next_nondebug_insn (rtx_insn *);
  2691. extern rtx_insn *prev_nonnote_nondebug_insn (rtx_insn *);
  2692. extern rtx_insn *prev_nonnote_nondebug_insn_bb (rtx_insn *);
  2693. extern rtx_insn *next_nonnote_nondebug_insn (rtx_insn *);
  2694. extern rtx_insn *next_nonnote_nondebug_insn_bb (rtx_insn *);
  2695. extern rtx_insn *prev_real_insn (rtx_insn *);
  2696. extern rtx_insn *next_real_insn (rtx);
  2697. extern rtx_insn *prev_real_nondebug_insn (rtx_insn *);
  2698. extern rtx_insn *next_real_nondebug_insn (rtx);
  2699. extern rtx_insn *prev_active_insn (rtx_insn *);
  2700. extern rtx_insn *next_active_insn (rtx_insn *);
  2701. extern int active_insn_p (const rtx_insn *);
  2702. extern rtx_insn *next_cc0_user (rtx_insn *);
  2703. extern rtx_insn *prev_cc0_setter (rtx_insn *);
  2704. /* In emit-rtl.c */
  2705. extern int insn_line (const rtx_insn *);
  2706. extern const char * insn_file (const rtx_insn *);
  2707. extern tree insn_scope (const rtx_insn *);
  2708. extern expanded_location insn_location (const rtx_insn *);
  2709. extern location_t prologue_location, epilogue_location;
  2710. /* In jump.c */
  2711. extern enum rtx_code reverse_condition (enum rtx_code);
  2712. extern enum rtx_code reverse_condition_maybe_unordered (enum rtx_code);
  2713. extern enum rtx_code swap_condition (enum rtx_code);
  2714. extern enum rtx_code unsigned_condition (enum rtx_code);
  2715. extern enum rtx_code signed_condition (enum rtx_code);
  2716. extern void mark_jump_label (rtx, rtx_insn *, int);
  2717. /* In jump.c */
  2718. extern rtx_insn *delete_related_insns (rtx);
  2719. /* In recog.c */
  2720. extern rtx *find_constant_term_loc (rtx *);
  2721. /* In emit-rtl.c */
  2722. extern rtx_insn *try_split (rtx, rtx_insn *, int);
  2723. /* In insn-recog.c (generated by genrecog). */
  2724. extern rtx_insn *split_insns (rtx, rtx_insn *);
  2725. /* In simplify-rtx.c */
  2726. extern rtx simplify_const_unary_operation (enum rtx_code, machine_mode,
  2727. rtx, machine_mode);
  2728. extern rtx simplify_unary_operation (enum rtx_code, machine_mode, rtx,
  2729. machine_mode);
  2730. extern rtx simplify_const_binary_operation (enum rtx_code, machine_mode,
  2731. rtx, rtx);
  2732. extern rtx simplify_binary_operation (enum rtx_code, machine_mode, rtx,
  2733. rtx);
  2734. extern rtx simplify_ternary_operation (enum rtx_code, machine_mode,
  2735. machine_mode, rtx, rtx, rtx);
  2736. extern rtx simplify_const_relational_operation (enum rtx_code,
  2737. machine_mode, rtx, rtx);
  2738. extern rtx simplify_relational_operation (enum rtx_code, machine_mode,
  2739. machine_mode, rtx, rtx);
  2740. extern rtx simplify_gen_binary (enum rtx_code, machine_mode, rtx, rtx);
  2741. extern rtx simplify_gen_unary (enum rtx_code, machine_mode, rtx,
  2742. machine_mode);
  2743. extern rtx simplify_gen_ternary (enum rtx_code, machine_mode,
  2744. machine_mode, rtx, rtx, rtx);
  2745. extern rtx simplify_gen_relational (enum rtx_code, machine_mode,
  2746. machine_mode, rtx, rtx);
  2747. extern rtx simplify_subreg (machine_mode, rtx, machine_mode, poly_uint64);
  2748. extern rtx simplify_gen_subreg (machine_mode, rtx, machine_mode, poly_uint64);
  2749. extern rtx lowpart_subreg (machine_mode, rtx, machine_mode);
  2750. extern rtx simplify_replace_fn_rtx (rtx, const_rtx,
  2751. rtx (*fn) (rtx, const_rtx, void *), void *);
  2752. extern rtx simplify_replace_rtx (rtx, const_rtx, rtx);
  2753. extern rtx simplify_rtx (const_rtx);
  2754. extern rtx avoid_constant_pool_reference (rtx);
  2755. extern rtx delegitimize_mem_from_attrs (rtx);
  2756. extern bool mode_signbit_p (machine_mode, const_rtx);
  2757. extern bool val_signbit_p (machine_mode, unsigned HOST_WIDE_INT);
  2758. extern bool val_signbit_known_set_p (machine_mode,
  2759. unsigned HOST_WIDE_INT);
  2760. extern bool val_signbit_known_clear_p (machine_mode,
  2761. unsigned HOST_WIDE_INT);
  2762. /* In reginfo.c */
  2763. extern machine_mode choose_hard_reg_mode (unsigned int, unsigned int,
  2764. bool);
  2765. extern const HARD_REG_SET &simplifiable_subregs (const subreg_shape &);
  2766. /* In emit-rtl.c */
  2767. extern rtx set_for_reg_notes (rtx);
  2768. extern rtx set_unique_reg_note (rtx, enum reg_note, rtx);
  2769. extern rtx set_dst_reg_note (rtx, enum reg_note, rtx, rtx);
  2770. extern void set_insn_deleted (rtx);
  2771. /* Functions in rtlanal.c */
  2772. extern rtx single_set_2 (const rtx_insn *, const_rtx);
  2773. extern bool contains_symbol_ref_p (const_rtx);
  2774. extern bool contains_symbolic_reference_p (const_rtx);
  2775. /* Handle the cheap and common cases inline for performance. */
  2776. inline rtx single_set (const rtx_insn *insn)
  2777. {
  2778. if (!INSN_P (insn))
  2779. return NULL_RTX;
  2780. if (GET_CODE (PATTERN (insn)) == SET)
  2781. return PATTERN (insn);
  2782. /* Defer to the more expensive case. */
  2783. return single_set_2 (insn, PATTERN (insn));
  2784. }
  2785. extern scalar_int_mode get_address_mode (rtx mem);
  2786. extern int rtx_addr_can_trap_p (const_rtx);
  2787. extern bool nonzero_address_p (const_rtx);
  2788. extern int rtx_unstable_p (const_rtx);
  2789. extern bool rtx_varies_p (const_rtx, bool);
  2790. extern bool rtx_addr_varies_p (const_rtx, bool);
  2791. extern rtx get_call_rtx_from (rtx);
  2792. extern HOST_WIDE_INT get_integer_term (const_rtx);
  2793. extern rtx get_related_value (const_rtx);
  2794. extern bool offset_within_block_p (const_rtx, HOST_WIDE_INT);
  2795. extern void split_const (rtx, rtx *, rtx *);
  2796. extern rtx strip_offset (rtx, poly_int64_pod *);
  2797. extern poly_int64 get_args_size (const_rtx);
  2798. extern bool unsigned_reg_p (rtx);
  2799. extern int reg_mentioned_p (const_rtx, const_rtx);
  2800. extern int count_occurrences (const_rtx, const_rtx, int);
  2801. extern int reg_referenced_p (const_rtx, const_rtx);
  2802. extern int reg_used_between_p (const_rtx, const rtx_insn *, const rtx_insn *);
  2803. extern int reg_set_between_p (const_rtx, const rtx_insn *, const rtx_insn *);
  2804. extern int commutative_operand_precedence (rtx);
  2805. extern bool swap_commutative_operands_p (rtx, rtx);
  2806. extern int modified_between_p (const_rtx, const rtx_insn *, const rtx_insn *);
  2807. extern int no_labels_between_p (const rtx_insn *, const rtx_insn *);
  2808. extern int modified_in_p (const_rtx, const_rtx);
  2809. extern int reg_set_p (const_rtx, const_rtx);
  2810. extern int multiple_sets (const_rtx);
  2811. extern int set_noop_p (const_rtx);
  2812. extern int noop_move_p (const rtx_insn *);
  2813. extern bool refers_to_regno_p (unsigned int, unsigned int, const_rtx, rtx *);
  2814. extern int reg_overlap_mentioned_p (const_rtx, const_rtx);
  2815. extern const_rtx set_of (const_rtx, const_rtx);
  2816. extern void record_hard_reg_sets (rtx, const_rtx, void *);
  2817. extern void record_hard_reg_uses (rtx *, void *);
  2818. extern void find_all_hard_regs (const_rtx, HARD_REG_SET *);
  2819. extern void find_all_hard_reg_sets (const rtx_insn *, HARD_REG_SET *, bool);
  2820. extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *);
  2821. extern void note_uses (rtx *, void (*) (rtx *, void *), void *);
  2822. extern int dead_or_set_p (const rtx_insn *, const_rtx);
  2823. extern int dead_or_set_regno_p (const rtx_insn *, unsigned int);
  2824. extern rtx find_reg_note (const_rtx, enum reg_note, const_rtx);
  2825. extern rtx find_regno_note (const_rtx, enum reg_note, unsigned int);
  2826. extern rtx find_reg_equal_equiv_note (const_rtx);
  2827. extern rtx find_constant_src (const rtx_insn *);
  2828. extern int find_reg_fusage (const_rtx, enum rtx_code, const_rtx);
  2829. extern int find_regno_fusage (const_rtx, enum rtx_code, unsigned int);
  2830. extern rtx alloc_reg_note (enum reg_note, rtx, rtx);
  2831. extern void add_reg_note (rtx, enum reg_note, rtx);
  2832. extern void add_int_reg_note (rtx_insn *, enum reg_note, int);
  2833. extern void add_args_size_note (rtx_insn *, poly_int64);
  2834. extern void add_shallow_copy_of_reg_note (rtx_insn *, rtx);
  2835. extern rtx duplicate_reg_note (rtx);
  2836. extern void remove_note (rtx_insn *, const_rtx);
  2837. extern bool remove_reg_equal_equiv_notes (rtx_insn *);
  2838. extern void remove_reg_equal_equiv_notes_for_regno (unsigned int);
  2839. extern int side_effects_p (const_rtx);
  2840. extern int volatile_refs_p (const_rtx);
  2841. extern int volatile_insn_p (const_rtx);
  2842. extern int may_trap_p_1 (const_rtx, unsigned);
  2843. extern int may_trap_p (const_rtx);
  2844. extern int may_trap_or_fault_p (const_rtx);
  2845. extern bool can_throw_internal (const_rtx);
  2846. extern bool can_throw_external (const_rtx);
  2847. extern bool insn_could_throw_p (const_rtx);
  2848. extern bool insn_nothrow_p (const_rtx);
  2849. extern bool can_nonlocal_goto (const rtx_insn *);
  2850. extern void copy_reg_eh_region_note_forward (rtx, rtx_insn *, rtx);
  2851. extern void copy_reg_eh_region_note_backward (rtx, rtx_insn *, rtx);
  2852. extern int inequality_comparisons_p (const_rtx);
  2853. extern rtx replace_rtx (rtx, rtx, rtx, bool = false);
  2854. extern void replace_label (rtx *, rtx, rtx, bool);
  2855. extern void replace_label_in_insn (rtx_insn *, rtx_insn *, rtx_insn *, bool);
  2856. extern bool rtx_referenced_p (const_rtx, const_rtx);
  2857. extern bool tablejump_p (const rtx_insn *, rtx_insn **, rtx_jump_table_data **);
  2858. extern int computed_jump_p (const rtx_insn *);
  2859. extern bool tls_referenced_p (const_rtx);
  2860. extern bool contains_mem_rtx_p (rtx x);
  2861. /* Overload for refers_to_regno_p for checking a single register. */
  2862. inline bool
  2863. refers_to_regno_p (unsigned int regnum, const_rtx x, rtx* loc = NULL)
  2864. {
  2865. return refers_to_regno_p (regnum, regnum + 1, x, loc);
  2866. }
  2867. /* Callback for for_each_inc_dec, to process the autoinc operation OP
  2868. within MEM that sets DEST to SRC + SRCOFF, or SRC if SRCOFF is
  2869. NULL. The callback is passed the same opaque ARG passed to
  2870. for_each_inc_dec. Return zero to continue looking for other
  2871. autoinc operations or any other value to interrupt the traversal and
  2872. return that value to the caller of for_each_inc_dec. */
  2873. typedef int (*for_each_inc_dec_fn) (rtx mem, rtx op, rtx dest, rtx src,
  2874. rtx srcoff, void *arg);
  2875. extern int for_each_inc_dec (rtx, for_each_inc_dec_fn, void *arg);
  2876. typedef int (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *,
  2877. rtx *, rtx *);
  2878. extern int rtx_equal_p_cb (const_rtx, const_rtx,
  2879. rtx_equal_p_callback_function);
  2880. typedef int (*hash_rtx_callback_function) (const_rtx, machine_mode, rtx *,
  2881. machine_mode *);
  2882. extern unsigned hash_rtx_cb (const_rtx, machine_mode, int *, int *,
  2883. bool, hash_rtx_callback_function);
  2884. extern rtx regno_use_in (unsigned int, rtx);
  2885. extern int auto_inc_p (const_rtx);
  2886. extern bool in_insn_list_p (const rtx_insn_list *, const rtx_insn *);
  2887. extern void remove_node_from_expr_list (const_rtx, rtx_expr_list **);
  2888. extern void remove_node_from_insn_list (const rtx_insn *, rtx_insn_list **);
  2889. extern int loc_mentioned_in_p (rtx *, const_rtx);
  2890. extern rtx_insn *find_first_parameter_load (rtx_insn *, rtx_insn *);
  2891. extern bool keep_with_call_p (const rtx_insn *);
  2892. extern bool label_is_jump_target_p (const_rtx, const rtx_insn *);
  2893. extern int pattern_cost (rtx, bool);
  2894. extern int insn_cost (rtx_insn *, bool);
  2895. extern unsigned seq_cost (const rtx_insn *, bool);
  2896. /* Given an insn and condition, return a canonical description of
  2897. the test being made. */
  2898. extern rtx canonicalize_condition (rtx_insn *, rtx, int, rtx_insn **, rtx,
  2899. int, int);
  2900. /* Given a JUMP_INSN, return a canonical description of the test
  2901. being made. */
  2902. extern rtx get_condition (rtx_insn *, rtx_insn **, int, int);
  2903. /* Information about a subreg of a hard register. */
  2904. struct subreg_info
  2905. {
  2906. /* Offset of first hard register involved in the subreg. */
  2907. int offset;
  2908. /* Number of hard registers involved in the subreg. In the case of
  2909. a paradoxical subreg, this is the number of registers that would
  2910. be modified by writing to the subreg; some of them may be don't-care
  2911. when reading from the subreg. */
  2912. int nregs;
  2913. /* Whether this subreg can be represented as a hard reg with the new
  2914. mode (by adding OFFSET to the original hard register). */
  2915. bool representable_p;
  2916. };
  2917. extern void subreg_get_info (unsigned int, machine_mode,
  2918. poly_uint64, machine_mode,
  2919. struct subreg_info *);
  2920. /* lists.c */
  2921. extern void free_EXPR_LIST_list (rtx_expr_list **);
  2922. extern void free_INSN_LIST_list (rtx_insn_list **);
  2923. extern void free_EXPR_LIST_node (rtx);
  2924. extern void free_INSN_LIST_node (rtx);
  2925. extern rtx_insn_list *alloc_INSN_LIST (rtx, rtx);
  2926. extern rtx_insn_list *copy_INSN_LIST (rtx_insn_list *);
  2927. extern rtx_insn_list *concat_INSN_LIST (rtx_insn_list *, rtx_insn_list *);
  2928. extern rtx_expr_list *alloc_EXPR_LIST (int, rtx, rtx);
  2929. extern void remove_free_INSN_LIST_elem (rtx_insn *, rtx_insn_list **);
  2930. extern rtx remove_list_elem (rtx, rtx *);
  2931. extern rtx_insn *remove_free_INSN_LIST_node (rtx_insn_list **);
  2932. extern rtx remove_free_EXPR_LIST_node (rtx_expr_list **);
  2933. /* reginfo.c */
  2934. /* Resize reg info. */
  2935. extern bool resize_reg_info (void);
  2936. /* Free up register info memory. */
  2937. extern void free_reg_info (void);
  2938. extern void init_subregs_of_mode (void);
  2939. extern void finish_subregs_of_mode (void);
  2940. /* recog.c */
  2941. extern rtx extract_asm_operands (rtx);
  2942. extern int asm_noperands (const_rtx);
  2943. extern const char *decode_asm_operands (rtx, rtx *, rtx **, const char **,
  2944. machine_mode *, location_t *);
  2945. extern void get_referenced_operands (const char *, bool *, unsigned int);
  2946. extern enum reg_class reg_preferred_class (int);
  2947. extern enum reg_class reg_alternate_class (int);
  2948. extern enum reg_class reg_allocno_class (int);
  2949. extern void setup_reg_classes (int, enum reg_class, enum reg_class,
  2950. enum reg_class);
  2951. extern void split_all_insns (void);
  2952. extern unsigned int split_all_insns_noflow (void);
  2953. #define MAX_SAVED_CONST_INT 64
  2954. extern GTY(()) rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
  2955. #define const0_rtx (const_int_rtx[MAX_SAVED_CONST_INT])
  2956. #define const1_rtx (const_int_rtx[MAX_SAVED_CONST_INT+1])
  2957. #define const2_rtx (const_int_rtx[MAX_SAVED_CONST_INT+2])
  2958. #define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1])
  2959. extern GTY(()) rtx const_true_rtx;
  2960. extern GTY(()) rtx const_tiny_rtx[4][(int) MAX_MACHINE_MODE];
  2961. /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
  2962. same as VOIDmode. */
  2963. #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
  2964. /* Likewise, for the constants 1 and 2 and -1. */
  2965. #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
  2966. #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
  2967. #define CONSTM1_RTX(MODE) (const_tiny_rtx[3][(int) (MODE)])
  2968. extern GTY(()) rtx pc_rtx;
  2969. extern GTY(()) rtx cc0_rtx;
  2970. extern GTY(()) rtx ret_rtx;
  2971. extern GTY(()) rtx simple_return_rtx;
  2972. extern GTY(()) rtx_insn *invalid_insn_rtx;
  2973. /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
  2974. is used to represent the frame pointer. This is because the
  2975. hard frame pointer and the automatic variables are separated by an amount
  2976. that cannot be determined until after register allocation. We can assume
  2977. that in this case ELIMINABLE_REGS will be defined, one action of which
  2978. will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
  2979. #ifndef HARD_FRAME_POINTER_REGNUM
  2980. #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
  2981. #endif
  2982. #ifndef HARD_FRAME_POINTER_IS_FRAME_POINTER
  2983. #define HARD_FRAME_POINTER_IS_FRAME_POINTER \
  2984. (HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM)
  2985. #endif
  2986. #ifndef HARD_FRAME_POINTER_IS_ARG_POINTER
  2987. #define HARD_FRAME_POINTER_IS_ARG_POINTER \
  2988. (HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM)
  2989. #endif
  2990. /* Index labels for global_rtl. */
  2991. enum global_rtl_index
  2992. {
  2993. GR_STACK_POINTER,
  2994. GR_FRAME_POINTER,
  2995. /* For register elimination to work properly these hard_frame_pointer_rtx,
  2996. frame_pointer_rtx, and arg_pointer_rtx must be the same if they refer to
  2997. the same register. */
  2998. #if FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
  2999. GR_ARG_POINTER = GR_FRAME_POINTER,
  3000. #endif
  3001. #if HARD_FRAME_POINTER_IS_FRAME_POINTER
  3002. GR_HARD_FRAME_POINTER = GR_FRAME_POINTER,
  3003. #else
  3004. GR_HARD_FRAME_POINTER,
  3005. #endif
  3006. #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
  3007. #if HARD_FRAME_POINTER_IS_ARG_POINTER
  3008. GR_ARG_POINTER = GR_HARD_FRAME_POINTER,
  3009. #else
  3010. GR_ARG_POINTER,
  3011. #endif
  3012. #endif
  3013. GR_VIRTUAL_INCOMING_ARGS,
  3014. GR_VIRTUAL_STACK_ARGS,
  3015. GR_VIRTUAL_STACK_DYNAMIC,
  3016. GR_VIRTUAL_OUTGOING_ARGS,
  3017. GR_VIRTUAL_CFA,
  3018. GR_VIRTUAL_PREFERRED_STACK_BOUNDARY,
  3019. GR_MAX
  3020. };
  3021. /* Target-dependent globals. */
  3022. struct GTY(()) target_rtl {
  3023. /* All references to the hard registers in global_rtl_index go through
  3024. these unique rtl objects. On machines where the frame-pointer and
  3025. arg-pointer are the same register, they use the same unique object.
  3026. After register allocation, other rtl objects which used to be pseudo-regs
  3027. may be clobbered to refer to the frame-pointer register.
  3028. But references that were originally to the frame-pointer can be
  3029. distinguished from the others because they contain frame_pointer_rtx.
  3030. When to use frame_pointer_rtx and hard_frame_pointer_rtx is a little
  3031. tricky: until register elimination has taken place hard_frame_pointer_rtx
  3032. should be used if it is being set, and frame_pointer_rtx otherwise. After
  3033. register elimination hard_frame_pointer_rtx should always be used.
  3034. On machines where the two registers are same (most) then these are the
  3035. same. */
  3036. rtx x_global_rtl[GR_MAX];
  3037. /* A unique representation of (REG:Pmode PIC_OFFSET_TABLE_REGNUM). */
  3038. rtx x_pic_offset_table_rtx;
  3039. /* A unique representation of (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM).
  3040. This is used to implement __builtin_return_address for some machines;
  3041. see for instance the MIPS port. */
  3042. rtx x_return_address_pointer_rtx;
  3043. /* Commonly used RTL for hard registers. These objects are not
  3044. necessarily unique, so we allocate them separately from global_rtl.
  3045. They are initialized once per compilation unit, then copied into
  3046. regno_reg_rtx at the beginning of each function. */
  3047. rtx x_initial_regno_reg_rtx[FIRST_PSEUDO_REGISTER];
  3048. /* A sample (mem:M stack_pointer_rtx) rtx for each mode M. */
  3049. rtx x_top_of_stack[MAX_MACHINE_MODE];
  3050. /* Static hunks of RTL used by the aliasing code; these are treated
  3051. as persistent to avoid unnecessary RTL allocations. */
  3052. rtx x_static_reg_base_value[FIRST_PSEUDO_REGISTER];
  3053. /* The default memory attributes for each mode. */
  3054. struct mem_attrs *x_mode_mem_attrs[(int) MAX_MACHINE_MODE];
  3055. /* Track if RTL has been initialized. */
  3056. bool target_specific_initialized;
  3057. };
  3058. extern GTY(()) struct target_rtl default_target_rtl;
  3059. #if SWITCHABLE_TARGET
  3060. extern struct target_rtl *this_target_rtl;
  3061. #else
  3062. #define this_target_rtl (&default_target_rtl)
  3063. #endif
  3064. #define global_rtl \
  3065. (this_target_rtl->x_global_rtl)
  3066. #define pic_offset_table_rtx \
  3067. (this_target_rtl->x_pic_offset_table_rtx)
  3068. #define return_address_pointer_rtx \
  3069. (this_target_rtl->x_return_address_pointer_rtx)
  3070. #define top_of_stack \
  3071. (this_target_rtl->x_top_of_stack)
  3072. #define mode_mem_attrs \
  3073. (this_target_rtl->x_mode_mem_attrs)
  3074. /* All references to certain hard regs, except those created
  3075. by allocating pseudo regs into them (when that's possible),
  3076. go through these unique rtx objects. */
  3077. #define stack_pointer_rtx (global_rtl[GR_STACK_POINTER])
  3078. #define frame_pointer_rtx (global_rtl[GR_FRAME_POINTER])
  3079. #define hard_frame_pointer_rtx (global_rtl[GR_HARD_FRAME_POINTER])
  3080. #define arg_pointer_rtx (global_rtl[GR_ARG_POINTER])
  3081. #ifndef GENERATOR_FILE
  3082. /* Return the attributes of a MEM rtx. */
  3083. static inline const struct mem_attrs *
  3084. get_mem_attrs (const_rtx x)
  3085. {
  3086. struct mem_attrs *attrs;
  3087. attrs = MEM_ATTRS (x);
  3088. if (!attrs)
  3089. attrs = mode_mem_attrs[(int) GET_MODE (x)];
  3090. return attrs;
  3091. }
  3092. #endif
  3093. /* Include the RTL generation functions. */
  3094. #ifndef GENERATOR_FILE
  3095. #include "genrtl.h"
  3096. #undef gen_rtx_ASM_INPUT
  3097. #define gen_rtx_ASM_INPUT(MODE, ARG0) \
  3098. gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), 0)
  3099. #define gen_rtx_ASM_INPUT_loc(MODE, ARG0, LOC) \
  3100. gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), (LOC))
  3101. #endif
  3102. /* There are some RTL codes that require special attention; the
  3103. generation functions included above do the raw handling. If you
  3104. add to this list, modify special_rtx in gengenrtl.c as well. */
  3105. extern rtx_expr_list *gen_rtx_EXPR_LIST (machine_mode, rtx, rtx);
  3106. extern rtx_insn_list *gen_rtx_INSN_LIST (machine_mode, rtx, rtx);
  3107. extern rtx_insn *
  3108. gen_rtx_INSN (machine_mode mode, rtx_insn *prev_insn, rtx_insn *next_insn,
  3109. basic_block bb, rtx pattern, int location, int code,
  3110. rtx reg_notes);
  3111. extern rtx gen_rtx_CONST_INT (machine_mode, HOST_WIDE_INT);
  3112. extern rtx gen_rtx_CONST_VECTOR (machine_mode, rtvec);
  3113. extern void set_mode_and_regno (rtx, machine_mode, unsigned int);
  3114. extern rtx gen_raw_REG (machine_mode, unsigned int);
  3115. extern rtx gen_rtx_REG (machine_mode, unsigned int);
  3116. extern rtx gen_rtx_SUBREG (machine_mode, rtx, poly_uint64);
  3117. extern rtx gen_rtx_MEM (machine_mode, rtx);
  3118. extern rtx gen_rtx_VAR_LOCATION (machine_mode, tree, rtx,
  3119. enum var_init_status);
  3120. #ifdef GENERATOR_FILE
  3121. #define PUT_MODE(RTX, MODE) PUT_MODE_RAW (RTX, MODE)
  3122. #else
  3123. static inline void
  3124. PUT_MODE (rtx x, machine_mode mode)
  3125. {
  3126. if (REG_P (x))
  3127. set_mode_and_regno (x, mode, REGNO (x));
  3128. else
  3129. PUT_MODE_RAW (x, mode);
  3130. }
  3131. #endif
  3132. #define GEN_INT(N) gen_rtx_CONST_INT (VOIDmode, (N))
  3133. /* Virtual registers are used during RTL generation to refer to locations into
  3134. the stack frame when the actual location isn't known until RTL generation
  3135. is complete. The routine instantiate_virtual_regs replaces these with
  3136. the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
  3137. a constant. */
  3138. #define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
  3139. /* This points to the first word of the incoming arguments passed on the stack,
  3140. either by the caller or by the callee when pretending it was passed by the
  3141. caller. */
  3142. #define virtual_incoming_args_rtx (global_rtl[GR_VIRTUAL_INCOMING_ARGS])
  3143. #define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
  3144. /* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
  3145. variable on the stack. Otherwise, it points to the first variable on
  3146. the stack. */
  3147. #define virtual_stack_vars_rtx (global_rtl[GR_VIRTUAL_STACK_ARGS])
  3148. #define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
  3149. /* This points to the location of dynamically-allocated memory on the stack
  3150. immediately after the stack pointer has been adjusted by the amount
  3151. desired. */
  3152. #define virtual_stack_dynamic_rtx (global_rtl[GR_VIRTUAL_STACK_DYNAMIC])
  3153. #define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
  3154. /* This points to the location in the stack at which outgoing arguments should
  3155. be written when the stack is pre-pushed (arguments pushed using push
  3156. insns always use sp). */
  3157. #define virtual_outgoing_args_rtx (global_rtl[GR_VIRTUAL_OUTGOING_ARGS])
  3158. #define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
  3159. /* This points to the Canonical Frame Address of the function. This
  3160. should correspond to the CFA produced by INCOMING_FRAME_SP_OFFSET,
  3161. but is calculated relative to the arg pointer for simplicity; the
  3162. frame pointer nor stack pointer are necessarily fixed relative to
  3163. the CFA until after reload. */
  3164. #define virtual_cfa_rtx (global_rtl[GR_VIRTUAL_CFA])
  3165. #define VIRTUAL_CFA_REGNUM ((FIRST_VIRTUAL_REGISTER) + 4)
  3166. #define LAST_VIRTUAL_POINTER_REGISTER ((FIRST_VIRTUAL_REGISTER) + 4)
  3167. /* This is replaced by crtl->preferred_stack_boundary / BITS_PER_UNIT
  3168. when finalized. */
  3169. #define virtual_preferred_stack_boundary_rtx \
  3170. (global_rtl[GR_VIRTUAL_PREFERRED_STACK_BOUNDARY])
  3171. #define VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM \
  3172. ((FIRST_VIRTUAL_REGISTER) + 5)
  3173. #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 5)
  3174. /* Nonzero if REGNUM is a pointer into the stack frame. */
  3175. #define REGNO_PTR_FRAME_P(REGNUM) \
  3176. ((REGNUM) == STACK_POINTER_REGNUM \
  3177. || (REGNUM) == FRAME_POINTER_REGNUM \
  3178. || (REGNUM) == HARD_FRAME_POINTER_REGNUM \
  3179. || (REGNUM) == ARG_POINTER_REGNUM \
  3180. || ((REGNUM) >= FIRST_VIRTUAL_REGISTER \
  3181. && (REGNUM) <= LAST_VIRTUAL_POINTER_REGISTER))
  3182. /* REGNUM never really appearing in the INSN stream. */
  3183. #define INVALID_REGNUM (~(unsigned int) 0)
  3184. /* REGNUM for which no debug information can be generated. */
  3185. #define IGNORED_DWARF_REGNUM (INVALID_REGNUM - 1)
  3186. extern rtx output_constant_def (tree, int);
  3187. extern rtx lookup_constant_def (tree);
  3188. /* Nonzero after end of reload pass.
  3189. Set to 1 or 0 by reload1.c. */
  3190. extern int reload_completed;
  3191. /* Nonzero after thread_prologue_and_epilogue_insns has run. */
  3192. extern int epilogue_completed;
  3193. /* Set to 1 while reload_as_needed is operating.
  3194. Required by some machines to handle any generated moves differently. */
  3195. extern int reload_in_progress;
  3196. /* Set to 1 while in lra. */
  3197. extern int lra_in_progress;
  3198. /* This macro indicates whether you may create a new
  3199. pseudo-register. */
  3200. #define can_create_pseudo_p() (!reload_in_progress && !reload_completed)
  3201. #ifdef STACK_REGS
  3202. /* Nonzero after end of regstack pass.
  3203. Set to 1 or 0 by reg-stack.c. */
  3204. extern int regstack_completed;
  3205. #endif
  3206. /* If this is nonzero, we do not bother generating VOLATILE
  3207. around volatile memory references, and we are willing to
  3208. output indirect addresses. If cse is to follow, we reject
  3209. indirect addresses so a useful potential cse is generated;
  3210. if it is used only once, instruction combination will produce
  3211. the same indirect address eventually. */
  3212. extern int cse_not_expected;
  3213. /* Translates rtx code to tree code, for those codes needed by
  3214. real_arithmetic. The function returns an int because the caller may not
  3215. know what `enum tree_code' means. */
  3216. extern int rtx_to_tree_code (enum rtx_code);
  3217. /* In cse.c */
  3218. extern int delete_trivially_dead_insns (rtx_insn *, int);
  3219. extern int exp_equiv_p (const_rtx, const_rtx, int, bool);
  3220. extern unsigned hash_rtx (const_rtx x, machine_mode, int *, int *, bool);
  3221. /* In dse.c */
  3222. extern bool check_for_inc_dec (rtx_insn *insn);
  3223. /* In jump.c */
  3224. extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
  3225. extern bool jump_to_label_p (const rtx_insn *);
  3226. extern int condjump_p (const rtx_insn *);
  3227. extern int any_condjump_p (const rtx_insn *);
  3228. extern int any_uncondjump_p (const rtx_insn *);
  3229. extern rtx pc_set (const rtx_insn *);
  3230. extern rtx condjump_label (const rtx_insn *);
  3231. extern int simplejump_p (const rtx_insn *);
  3232. extern int returnjump_p (const rtx_insn *);
  3233. extern int eh_returnjump_p (rtx_insn *);
  3234. extern int onlyjump_p (const rtx_insn *);
  3235. extern int only_sets_cc0_p (const_rtx);
  3236. extern int sets_cc0_p (const_rtx);
  3237. extern int invert_jump_1 (rtx_jump_insn *, rtx);
  3238. extern int invert_jump (rtx_jump_insn *, rtx, int);
  3239. extern int rtx_renumbered_equal_p (const_rtx, const_rtx);
  3240. extern int true_regnum (const_rtx);
  3241. extern unsigned int reg_or_subregno (const_rtx);
  3242. extern int redirect_jump_1 (rtx_insn *, rtx);
  3243. extern void redirect_jump_2 (rtx_jump_insn *, rtx, rtx, int, int);
  3244. extern int redirect_jump (rtx_jump_insn *, rtx, int);
  3245. extern void rebuild_jump_labels (rtx_insn *);
  3246. extern void rebuild_jump_labels_chain (rtx_insn *);
  3247. extern rtx reversed_comparison (const_rtx, machine_mode);
  3248. extern enum rtx_code reversed_comparison_code (const_rtx, const rtx_insn *);
  3249. extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, const_rtx,
  3250. const_rtx, const rtx_insn *);
  3251. extern void delete_for_peephole (rtx_insn *, rtx_insn *);
  3252. extern int condjump_in_parallel_p (const rtx_insn *);
  3253. /* In emit-rtl.c. */
  3254. extern int max_reg_num (void);
  3255. extern int max_label_num (void);
  3256. extern int get_first_label_num (void);
  3257. extern void maybe_set_first_label_num (rtx_code_label *);
  3258. extern void delete_insns_since (rtx_insn *);
  3259. extern void mark_reg_pointer (rtx, int);
  3260. extern void mark_user_reg (rtx);
  3261. extern void reset_used_flags (rtx);
  3262. extern void set_used_flags (rtx);
  3263. extern void reorder_insns (rtx_insn *, rtx_insn *, rtx_insn *);
  3264. extern void reorder_insns_nobb (rtx_insn *, rtx_insn *, rtx_insn *);
  3265. extern int get_max_insn_count (void);
  3266. extern int in_sequence_p (void);
  3267. extern void init_emit (void);
  3268. extern void init_emit_regs (void);
  3269. extern void init_derived_machine_modes (void);
  3270. extern void init_emit_once (void);
  3271. extern void push_topmost_sequence (void);
  3272. extern void pop_topmost_sequence (void);
  3273. extern void set_new_first_and_last_insn (rtx_insn *, rtx_insn *);
  3274. extern unsigned int unshare_all_rtl (void);
  3275. extern void unshare_all_rtl_again (rtx_insn *);
  3276. extern void unshare_all_rtl_in_chain (rtx_insn *);
  3277. extern void verify_rtl_sharing (void);
  3278. extern void add_insn (rtx_insn *);
  3279. extern void add_insn_before (rtx, rtx, basic_block);
  3280. extern void add_insn_after (rtx, rtx, basic_block);
  3281. extern void remove_insn (rtx);
  3282. extern rtx_insn *emit (rtx, bool = true);
  3283. extern void emit_insn_at_entry (rtx);
  3284. extern rtx gen_lowpart_SUBREG (machine_mode, rtx);
  3285. extern rtx gen_const_mem (machine_mode, rtx);
  3286. extern rtx gen_frame_mem (machine_mode, rtx);
  3287. extern rtx gen_tmp_stack_mem (machine_mode, rtx);
  3288. extern bool validate_subreg (machine_mode, machine_mode,
  3289. const_rtx, poly_uint64);
  3290. /* In combine.c */
  3291. extern unsigned int extended_count (const_rtx, machine_mode, int);
  3292. extern rtx remove_death (unsigned int, rtx_insn *);
  3293. extern void dump_combine_stats (FILE *);
  3294. extern void dump_combine_total_stats (FILE *);
  3295. extern rtx make_compound_operation (rtx, enum rtx_code);
  3296. /* In sched-rgn.c. */
  3297. extern void schedule_insns (void);
  3298. /* In sched-ebb.c. */
  3299. extern void schedule_ebbs (void);
  3300. /* In sel-sched-dump.c. */
  3301. extern void sel_sched_fix_param (const char *param, const char *val);
  3302. /* In print-rtl.c */
  3303. extern const char *print_rtx_head;
  3304. extern void debug (const rtx_def &ref);
  3305. extern void debug (const rtx_def *ptr);
  3306. extern void debug_rtx (const_rtx);
  3307. extern void debug_rtx_list (const rtx_insn *, int);
  3308. extern void debug_rtx_range (const rtx_insn *, const rtx_insn *);
  3309. extern const rtx_insn *debug_rtx_find (const rtx_insn *, int);
  3310. extern void print_mem_expr (FILE *, const_tree);
  3311. extern void print_rtl (FILE *, const_rtx);
  3312. extern void print_simple_rtl (FILE *, const_rtx);
  3313. extern int print_rtl_single (FILE *, const_rtx);
  3314. extern int print_rtl_single_with_indent (FILE *, const_rtx, int);
  3315. extern void print_inline_rtx (FILE *, const_rtx, int);
  3316. /* In stmt.c */
  3317. extern void expand_null_return (void);
  3318. extern void expand_naked_return (void);
  3319. extern void emit_jump (rtx);
  3320. /* In expr.c */
  3321. extern rtx move_by_pieces (rtx, rtx, unsigned HOST_WIDE_INT,
  3322. unsigned int, int);
  3323. extern poly_int64 find_args_size_adjust (rtx_insn *);
  3324. extern poly_int64 fixup_args_size_notes (rtx_insn *, rtx_insn *, poly_int64);
  3325. /* In expmed.c */
  3326. extern void init_expmed (void);
  3327. extern void expand_inc (rtx, rtx);
  3328. extern void expand_dec (rtx, rtx);
  3329. /* In lower-subreg.c */
  3330. extern void init_lower_subreg (void);
  3331. /* In gcse.c */
  3332. extern bool can_copy_p (machine_mode);
  3333. extern bool can_assign_to_reg_without_clobbers_p (rtx, machine_mode);
  3334. extern rtx_insn *prepare_copy_insn (rtx, rtx);
  3335. /* In cprop.c */
  3336. extern rtx fis_get_condition (rtx_insn *);
  3337. /* In ira.c */
  3338. extern HARD_REG_SET eliminable_regset;
  3339. extern void mark_elimination (int, int);
  3340. /* In reginfo.c */
  3341. extern int reg_classes_intersect_p (reg_class_t, reg_class_t);
  3342. extern int reg_class_subset_p (reg_class_t, reg_class_t);
  3343. extern void globalize_reg (tree, int);
  3344. extern void init_reg_modes_target (void);
  3345. extern void init_regs (void);
  3346. extern void reinit_regs (void);
  3347. extern void init_fake_stack_mems (void);
  3348. extern void save_register_info (void);
  3349. extern void init_reg_sets (void);
  3350. extern void regclass (rtx, int);
  3351. extern void reg_scan (rtx_insn *, unsigned int);
  3352. extern void fix_register (const char *, int, int);
  3353. extern const HARD_REG_SET *valid_mode_changes_for_regno (unsigned int);
  3354. /* In reload1.c */
  3355. extern int function_invariant_p (const_rtx);
  3356. /* In calls.c */
  3357. enum libcall_type
  3358. {
  3359. LCT_NORMAL = 0,
  3360. LCT_CONST = 1,
  3361. LCT_PURE = 2,
  3362. LCT_NORETURN = 3,
  3363. LCT_THROW = 4,
  3364. LCT_RETURNS_TWICE = 5
  3365. };
  3366. extern rtx emit_library_call_value_1 (int, rtx, rtx, enum libcall_type,
  3367. machine_mode, int, rtx_mode_t *);
  3368. /* Output a library call and discard the returned value. FUN is the
  3369. address of the function, as a SYMBOL_REF rtx, and OUTMODE is the mode
  3370. of the (discarded) return value. FN_TYPE is LCT_NORMAL for `normal'
  3371. calls, LCT_CONST for `const' calls, LCT_PURE for `pure' calls, or
  3372. another LCT_ value for other types of library calls.
  3373. There are different overloads of this function for different numbers
  3374. of arguments. In each case the argument value is followed by its mode. */
  3375. inline void
  3376. emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode)
  3377. {
  3378. emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 0, NULL);
  3379. }
  3380. inline void
  3381. emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
  3382. rtx arg1, machine_mode arg1_mode)
  3383. {
  3384. rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode) };
  3385. emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 1, args);
  3386. }
  3387. inline void
  3388. emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
  3389. rtx arg1, machine_mode arg1_mode,
  3390. rtx arg2, machine_mode arg2_mode)
  3391. {
  3392. rtx_mode_t args[] = {
  3393. rtx_mode_t (arg1, arg1_mode),
  3394. rtx_mode_t (arg2, arg2_mode)
  3395. };
  3396. emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 2, args);
  3397. }
  3398. inline void
  3399. emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
  3400. rtx arg1, machine_mode arg1_mode,
  3401. rtx arg2, machine_mode arg2_mode,
  3402. rtx arg3, machine_mode arg3_mode)
  3403. {
  3404. rtx_mode_t args[] = {
  3405. rtx_mode_t (arg1, arg1_mode),
  3406. rtx_mode_t (arg2, arg2_mode),
  3407. rtx_mode_t (arg3, arg3_mode)
  3408. };
  3409. emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 3, args);
  3410. }
  3411. inline void
  3412. emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
  3413. rtx arg1, machine_mode arg1_mode,
  3414. rtx arg2, machine_mode arg2_mode,
  3415. rtx arg3, machine_mode arg3_mode,
  3416. rtx arg4, machine_mode arg4_mode)
  3417. {
  3418. rtx_mode_t args[] = {
  3419. rtx_mode_t (arg1, arg1_mode),
  3420. rtx_mode_t (arg2, arg2_mode),
  3421. rtx_mode_t (arg3, arg3_mode),
  3422. rtx_mode_t (arg4, arg4_mode)
  3423. };
  3424. emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 4, args);
  3425. }
  3426. /* Like emit_library_call, but return the value produced by the call.
  3427. Use VALUE to store the result if it is nonnull, otherwise pick a
  3428. convenient location. */
  3429. inline rtx
  3430. emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
  3431. machine_mode outmode)
  3432. {
  3433. return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 0, NULL);
  3434. }
  3435. inline rtx
  3436. emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
  3437. machine_mode outmode,
  3438. rtx arg1, machine_mode arg1_mode)
  3439. {
  3440. rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode) };
  3441. return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 1, args);
  3442. }
  3443. inline rtx
  3444. emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
  3445. machine_mode outmode,
  3446. rtx arg1, machine_mode arg1_mode,
  3447. rtx arg2, machine_mode arg2_mode)
  3448. {
  3449. rtx_mode_t args[] = {
  3450. rtx_mode_t (arg1, arg1_mode),
  3451. rtx_mode_t (arg2, arg2_mode)
  3452. };
  3453. return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 2, args);
  3454. }
  3455. inline rtx
  3456. emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
  3457. machine_mode outmode,
  3458. rtx arg1, machine_mode arg1_mode,
  3459. rtx arg2, machine_mode arg2_mode,
  3460. rtx arg3, machine_mode arg3_mode)
  3461. {
  3462. rtx_mode_t args[] = {
  3463. rtx_mode_t (arg1, arg1_mode),
  3464. rtx_mode_t (arg2, arg2_mode),
  3465. rtx_mode_t (arg3, arg3_mode)
  3466. };
  3467. return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 3, args);
  3468. }
  3469. inline rtx
  3470. emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
  3471. machine_mode outmode,
  3472. rtx arg1, machine_mode arg1_mode,
  3473. rtx arg2, machine_mode arg2_mode,
  3474. rtx arg3, machine_mode arg3_mode,
  3475. rtx arg4, machine_mode arg4_mode)
  3476. {
  3477. rtx_mode_t args[] = {
  3478. rtx_mode_t (arg1, arg1_mode),
  3479. rtx_mode_t (arg2, arg2_mode),
  3480. rtx_mode_t (arg3, arg3_mode),
  3481. rtx_mode_t (arg4, arg4_mode)
  3482. };
  3483. return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 4, args);
  3484. }
  3485. /* In varasm.c */
  3486. extern void init_varasm_once (void);
  3487. extern rtx make_debug_expr_from_rtl (const_rtx);
  3488. /* In read-rtl.c */
  3489. #ifdef GENERATOR_FILE
  3490. extern bool read_rtx (const char *, vec<rtx> *);
  3491. #endif
  3492. /* In alias.c */
  3493. extern rtx canon_rtx (rtx);
  3494. extern int true_dependence (const_rtx, machine_mode, const_rtx);
  3495. extern rtx get_addr (rtx);
  3496. extern int canon_true_dependence (const_rtx, machine_mode, rtx,
  3497. const_rtx, rtx);
  3498. extern int read_dependence (const_rtx, const_rtx);
  3499. extern int anti_dependence (const_rtx, const_rtx);
  3500. extern int canon_anti_dependence (const_rtx, bool,
  3501. const_rtx, machine_mode, rtx);
  3502. extern int output_dependence (const_rtx, const_rtx);
  3503. extern int canon_output_dependence (const_rtx, bool,
  3504. const_rtx, machine_mode, rtx);
  3505. extern int may_alias_p (const_rtx, const_rtx);
  3506. extern void init_alias_target (void);
  3507. extern void init_alias_analysis (void);
  3508. extern void end_alias_analysis (void);
  3509. extern void vt_equate_reg_base_value (const_rtx, const_rtx);
  3510. extern bool memory_modified_in_insn_p (const_rtx, const_rtx);
  3511. extern bool may_be_sp_based_p (rtx);
  3512. extern rtx gen_hard_reg_clobber (machine_mode, unsigned int);
  3513. extern rtx get_reg_known_value (unsigned int);
  3514. extern bool get_reg_known_equiv_p (unsigned int);
  3515. extern rtx get_reg_base_value (unsigned int);
  3516. #ifdef STACK_REGS
  3517. extern int stack_regs_mentioned (const_rtx insn);
  3518. #endif
  3519. /* In toplev.c */
  3520. extern GTY(()) rtx stack_limit_rtx;
  3521. /* In var-tracking.c */
  3522. extern unsigned int variable_tracking_main (void);
  3523. extern void delete_vta_debug_insns (bool);
  3524. /* In stor-layout.c. */
  3525. extern void get_mode_bounds (scalar_int_mode, int,
  3526. scalar_int_mode, rtx *, rtx *);
  3527. /* In loop-iv.c */
  3528. extern rtx canon_condition (rtx);
  3529. extern void simplify_using_condition (rtx, rtx *, bitmap);
  3530. /* In final.c */
  3531. extern unsigned int compute_alignments (void);
  3532. extern void update_alignments (vec<rtx> &);
  3533. extern int asm_str_count (const char *templ);
  3534. struct rtl_hooks
  3535. {
  3536. rtx (*gen_lowpart) (machine_mode, rtx);
  3537. rtx (*gen_lowpart_no_emit) (machine_mode, rtx);
  3538. rtx (*reg_nonzero_bits) (const_rtx, scalar_int_mode, scalar_int_mode,
  3539. unsigned HOST_WIDE_INT *);
  3540. rtx (*reg_num_sign_bit_copies) (const_rtx, scalar_int_mode, scalar_int_mode,
  3541. unsigned int *);
  3542. bool (*reg_truncated_to_mode) (machine_mode, const_rtx);
  3543. /* Whenever you add entries here, make sure you adjust rtlhooks-def.h. */
  3544. };
  3545. /* Each pass can provide its own. */
  3546. extern struct rtl_hooks rtl_hooks;
  3547. /* ... but then it has to restore these. */
  3548. extern const struct rtl_hooks general_rtl_hooks;
  3549. /* Keep this for the nonce. */
  3550. #define gen_lowpart rtl_hooks.gen_lowpart
  3551. extern void insn_locations_init (void);
  3552. extern void insn_locations_finalize (void);
  3553. extern void set_curr_insn_location (location_t);
  3554. extern location_t curr_insn_location (void);
  3555. /* rtl-error.c */
  3556. extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)
  3557. ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
  3558. extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *)
  3559. ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
  3560. #define fatal_insn(msgid, insn) \
  3561. _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
  3562. #define fatal_insn_not_found(insn) \
  3563. _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
  3564. /* reginfo.c */
  3565. extern tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER];
  3566. /* Information about the function that is propagated by the RTL backend.
  3567. Available only for functions that has been already assembled. */
  3568. struct GTY(()) cgraph_rtl_info {
  3569. unsigned int preferred_incoming_stack_boundary;
  3570. /* Call unsaved hard registers really used by the corresponding
  3571. function (including ones used by functions called by the
  3572. function). */
  3573. HARD_REG_SET function_used_regs;
  3574. /* Set if function_used_regs is valid. */
  3575. unsigned function_used_regs_valid: 1;
  3576. };
  3577. /* If loads from memories of mode MODE always sign or zero extend,
  3578. return SIGN_EXTEND or ZERO_EXTEND as appropriate. Return UNKNOWN
  3579. otherwise. */
  3580. inline rtx_code
  3581. load_extend_op (machine_mode mode)
  3582. {
  3583. scalar_int_mode int_mode;
  3584. if (is_a <scalar_int_mode> (mode, &int_mode)
  3585. && GET_MODE_PRECISION (int_mode) < BITS_PER_WORD)
  3586. return LOAD_EXTEND_OP (int_mode);
  3587. return UNKNOWN;
  3588. }
  3589. /* If X is a PLUS of a base and a constant offset, add the constant to *OFFSET
  3590. and return the base. Return X otherwise. */
  3591. inline rtx
  3592. strip_offset_and_add (rtx x, poly_int64_pod *offset)
  3593. {
  3594. if (GET_CODE (x) == PLUS)
  3595. {
  3596. poly_int64 suboffset;
  3597. x = strip_offset (x, &suboffset);
  3598. *offset = poly_uint64 (*offset) + suboffset;
  3599. }
  3600. return x;
  3601. }
  3602. /* Return true if X is an operation that always operates on the full
  3603. registers for WORD_REGISTER_OPERATIONS architectures. */
  3604. inline bool
  3605. word_register_operation_p (const_rtx x)
  3606. {
  3607. switch (GET_CODE (x))
  3608. {
  3609. case ROTATE:
  3610. case ROTATERT:
  3611. case SIGN_EXTRACT:
  3612. case ZERO_EXTRACT:
  3613. return false;
  3614. default:
  3615. return true;
  3616. }
  3617. }
  3618. /* gtype-desc.c. */
  3619. extern void gt_ggc_mx (rtx &);
  3620. extern void gt_pch_nx (rtx &);
  3621. extern void gt_pch_nx (rtx &, gt_pointer_operator, void *);
  3622. #endif /* ! GCC_RTL_H */