rtl.h 124 KB

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