rtl.h 150 KB

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