rtl.def 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. /* This file contains the definitions and documentation for the
  2. Register Transfer Expressions (rtx's) that make up the
  3. Register Transfer Language (rtl) used in the Back End of the GNU compiler.
  4. Copyright (C) 1987 Free Software Foundation, Inc.
  5. This file is part of GNU CC.
  6. GNU CC is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY. No author or distributor
  8. accepts responsibility to anyone for the consequences of using it
  9. or for whether it serves any particular purpose or works at all,
  10. unless he says so in writing. Refer to the GNU CC General Public
  11. License for full details.
  12. Everyone is granted permission to copy, modify and redistribute
  13. GNU CC, but only under the conditions described in the
  14. GNU CC General Public License. A copy of this license is
  15. supposed to have been given to you along with GNU CC so you
  16. can know your rights and responsibilities. It should be in a
  17. file named COPYING. Among other things, the copyright notice
  18. and this notice must be preserved on all copies. */
  19. /* Expression definitions and descriptions for all targets are in this file.
  20. Some will not be used for some targets.
  21. The fields in the cpp macro call "DEF_RTL_EXPR()"
  22. are used to create declarations in the C source of the compiler.
  23. The fields are:
  24. 1. The internal name of the rtx used in the C source.
  25. It is a tag in the enumeration "enum rtx_code" defined in "rtl.h".
  26. By convention these are in UPPER_CASE.
  27. 2. The name of the rtx in the external ASCII format read by
  28. rtl.read_rtl(), and printed by rtl.print_rtl().
  29. These names are stored in rtl.rtx_name[].
  30. By convention these are the internal (field 1) names in lower_case.
  31. 3. The print format, and type of each rtx->fld[] (field) in this rtx.
  32. These formats are stored in rtl.rtx_format[].
  33. The meaning of the formats is documented in front of this array in rtl.c
  34. */
  35. /* ---------------------------------------------------------------------
  36. Expressions (and "meta" expressions) used for structuring the
  37. rtl representation of a program.
  38. --------------------------------------------------------------------- */
  39. /* an expression code name unknown to the reader */
  40. DEF_RTL_EXPR(UNKNOWN, "UnKnown", "*")
  41. /* (NIL) is used by rtl reader and printer to represent a null pointer. */
  42. DEF_RTL_EXPR(NIL, "nil", "*")
  43. /* ----------------------------------------------------------------------
  44. Expressions types used for things in the instruction chain.
  45. All formats must start with "iuu" to handle the chain.
  46. Each insn expression holds an rtl instruction and its semantics
  47. during back-end processing.
  48. See macros's in "rtl.h" for the meaning of each rtx->fld[].
  49. ---------------------------------------------------------------------- */
  50. /* An instruction that cannot jump. */
  51. DEF_RTL_EXPR(INSN, "insn", "iuueiee")
  52. /* An instruction that can possibly jump.
  53. Fields ( rtx->fld[] ) have exact same meaning as INSN's
  54. except field 3 is also used in jump.c to point to the label jumped to.
  55. Field 7 is used in jump.c as the JUMP_LABEL. */
  56. DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "iuueiee0")
  57. /* An instruction that can possibly call a subroutine
  58. but which will not change which instruction comes next
  59. in the current function.
  60. Fields ( rtx->fld[] ) have exact same meaning as INSN's. */
  61. DEF_RTL_EXPR(CALL_INSN, "call_insn", "iuueiee")
  62. /* A marker that indicates that control will not flow through. */
  63. DEF_RTL_EXPR(BARRIER, "barrier", "iuu")
  64. /* Holds a label that is followed by instructions.
  65. Operand:
  66. 3: is a number that is unique in the entire compilation.
  67. 4: is used in jump.c for the use-count of the label.
  68. and in flow.c to point to the chain of label_ref's to this label. */
  69. DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuui0")
  70. /* Say where in the code a source line starts, for symbol table's sake.
  71. Contains a filename and a line number. Line numbers <= 0 are special:
  72. 0 is used in a dummy placed at the front of every function
  73. just so there will never be a need to delete the first insn;
  74. -1 indicates a dummy; insns to be deleted by flow analysis and combining
  75. are really changed to NOTEs with a number of -1.
  76. -2 means beginning of a name binding contour; output N_LBRAC.
  77. -3 means end of a contour; output N_RBRAC. */
  78. DEF_RTL_EXPR(NOTE, "note", "iuusi")
  79. /* ----------------------------------------------------------------------
  80. Top level constituents of INSN, JUMP_INSN and CALL_INSN.
  81. ---------------------------------------------------------------------- */
  82. /* Several operations to be done in parallel. */
  83. DEF_RTL_EXPR(PARALLEL, "parallel", "E")
  84. /* A string that is passed through to the assembler as input.
  85. One can obviously pass comments through by using the
  86. assembler comment syntax.
  87. These occur in an insn all by themselves as the PATTERN.
  88. */
  89. DEF_RTL_EXPR(ASM_INPUT, "asm_input", "s")
  90. /* Vector of addresses, stored as full words. */
  91. /* Each element is a LABEL_REF to a CODE_LABEL whose address we want. */
  92. DEF_RTL_EXPR(ADDR_VEC, "addr_vec", "E")
  93. /* Vector of address differences X0 - BASE, X1 - BASE, ...
  94. First operand is BASE; the vector contains the X's.
  95. The machine mode of this rtx says how much space to leave
  96. for each difference. */
  97. /* Appears inside a DEFINE_DATA. */
  98. DEF_RTL_EXPR(ADDR_DIFF_VEC, "addr_diff_vec", "eE")
  99. /* ----------------------------------------------------------------------
  100. Misc. special purpose expression types.
  101. ---------------------------------------------------------------------- */
  102. /* Appears only in machine descriptions.
  103. Means use the function named by the second arg (the string)
  104. as a predicate; if matched, store the structure that was matched
  105. in the operand table at index specified by the first arg (the integer).
  106. If the second arg is the null string, the structure is just stored.
  107. A third string argument indicates to the register allocator restrictions
  108. on where the operand can be allocated.
  109. If the target needs no restriction on any instruction this field should
  110. be the null string.
  111. The string is prepended by:
  112. '=' to indicate the operand is only written to.
  113. '+' to indicate the operand is both read and written to.
  114. Each character in the string represents an allocatable class for an operand.
  115. 'g' indicates the operand can be any valid class.
  116. 'i' indicates the operand can be immeadiate (in the instruction) data.
  117. 'r' indicates the operand can be in a register.
  118. 'm' indicates the operand can be in memory.
  119. 'o' a subset of the 'm' class. Those memory addressing modes that
  120. can be offset at compile time (have a constant added to them).
  121. Other characters indicate target dependent operand classes and
  122. are described in each target's machine description.
  123. For instructions with more than one operand, sets of classes can be
  124. separated by a comma to indicate the appropriate multi-operand constraints.
  125. There must be a 1 to 1 correspondence between these sets of classes in
  126. all operands for an instruction.
  127. */
  128. DEF_RTL_EXPR(MATCH_OPERAND, "match_operand", "iss")
  129. /* Appears only in machine descriptions.
  130. Means match only something equal to what is stored in the operand table
  131. at the index specified by the argument. */
  132. DEF_RTL_EXPR(MATCH_DUP, "match_dup", "i")
  133. /* Appears only in machine descriptions.
  134. Defines the pattern for one kind of instruction.
  135. Operand:
  136. 0: names this instruction.
  137. If the name is the null string, the instruction is in the
  138. machine description just to be recognized, and will never be emitted by
  139. the tree to rtl expander.
  140. 1: is the pattern.
  141. 2: is currently not used.
  142. 3: is the action to execute if this pattern is matched.
  143. If this assembler code template starts with a * if is a fragment of
  144. C code to run to decide on a template to use. Otherwise, it is the
  145. template to use.
  146. */
  147. DEF_RTL_EXPR(DEFINE_INSN, "define_insn", "sEss")
  148. /* Refers to the address of its argument.
  149. This appears only in machine descriptions, indicating that
  150. any expression that would be acceptable as the operand of MEM
  151. should be matched. */
  152. DEF_RTL_EXPR(ADDRESS, "address", "e")
  153. /* a linked list of expressions */
  154. DEF_RTL_EXPR(EXPR_LIST, "expr_list", "ee")
  155. /* a linked list of instructions.
  156. The insns are represented in print by their uids. */
  157. DEF_RTL_EXPR(INSN_LIST, "insn_list", "ue")
  158. /* ----------------------------------------------------------------------
  159. Expressions used for attributing execution effects.
  160. ---------------------------------------------------------------------- */
  161. /* for memory mapped i/o ports.
  162. 2 or more succesive writes or reads should NOT be optimized out.
  163. This rtx is nested around each use of an volatile address.
  164. e.g. (volatile (mem 97)) */
  165. DEF_RTL_EXPR(VOLATILE, "volatile", "e")
  166. /* The opposite of volatile.
  167. This says that the argument is something whose value will
  168. never change within one function.
  169. This can tell various things that they can save the trouble
  170. of preserving the current value of that thing, and just use
  171. its current value whenever is convenient.
  172. The idea is to use this around REG rtx's that are links in
  173. the static chain. */
  174. DEF_RTL_EXPR(UNCHANGING, "unchanging", "e")
  175. /* ----------------------------------------------------------------------
  176. At the top level of an instruction (perhaps under PARALLEL).
  177. ---------------------------------------------------------------------- */
  178. /* Assignment.
  179. Operand 1 is the location (REG, MEM, PC, CC0 or whatever) assigned to.
  180. Operand 2 is the value stored there.
  181. ALL assignment must use SET.
  182. Instructions that do multiple assignments must use multiple SET,
  183. under PARALLEL. */
  184. DEF_RTL_EXPR(SET, "set", "ee")
  185. /* Indicate something is used in a way that we don't want to explain.
  186. For example, subroutine calls will use the register
  187. in which the static chain is passed. */
  188. DEF_RTL_EXPR(USE, "use", "e")
  189. /* Indicate something is clobbered in a way that we don't want to explain.
  190. For example, subroutine calls will clobber some physical registers
  191. (the ones that are by convention not saved). */
  192. DEF_RTL_EXPR(CLOBBER, "clobber", "e")
  193. /* Call a subroutine.
  194. Operand 1 is the address to call.
  195. Operand 2 is the number of arguments. */
  196. DEF_RTL_EXPR(CALL, "call", "ee")
  197. /* Return from a subroutine. */
  198. DEF_RTL_EXPR(RETURN, "return", "")
  199. /* ----------------------------------------------------------------------
  200. Primitive values for use in expressions.
  201. ---------------------------------------------------------------------- */
  202. /* numeric integer constant */
  203. DEF_RTL_EXPR(CONST_INT, "const_int", "i")
  204. /* numeric double constant.
  205. The double is stored in two "integer" operands.
  206. The third operand is the MEM that stores this constant in memory.
  207. The fourth is used to chain together these rtx's for uniquization. */
  208. DEF_RTL_EXPR(CONST_DOUBLE, "const_double", "iie00")
  209. /* This is used to encapsulate an expression whose value is constant
  210. (such as the sum of a SYMBOL_REF and a CONST_INT) so that it will be
  211. recognized as a constant operand rather than by arithmetic instructions. */
  212. DEF_RTL_EXPR(CONST, "const", "e")
  213. /* program counter. Ordinary jumps are represented
  214. by a SET whose first operand is (PC). */
  215. DEF_RTL_EXPR(PC, "pc", "")
  216. /* A register. The "operand" is the register number, accessed
  217. with the REGNO macro. If this number is less than FIRST_PSEUDO_REGISTER
  218. than a hardware register is being referred to. */
  219. DEF_RTL_EXPR(REG, "reg", "i")
  220. /* One word of a multi-word value.
  221. The first operand is the complete value; the second says which word.
  222. The WORDS_BIG_ENDIAN flag controls whether word number 0
  223. (as numbered in a SUBREG) is the most or least significant word.
  224. This is also used to refer to a value in a different machine mode.
  225. For example, it can be used to refer to a SImode value as if it were
  226. Qimode, or vice versa. Then the word number is always 0. */
  227. DEF_RTL_EXPR(SUBREG, "subreg", "ei")
  228. /* This one-argument rtx is used for move instructions
  229. that are guaranteed to alter only the low part of a destination.
  230. Thus, (SET (SUBREG:HI (REG...)) (MEM:HI ...))
  231. has an unspecified effect on the high part of REG,
  232. but (SET (STRICT_LOW_PART (SUBREG:HI (REG...))) (MEM:HI ...))
  233. is guaranteed to alter only the bits of REG that are in HImode.
  234. The actual instruction used is probably the same in both cases,
  235. but the register constraints may be tighter when STRICT_LOW_PART
  236. is in use. */
  237. DEF_RTL_EXPR(STRICT_LOW_PART, "strict_low_part", "e")
  238. /* A memory location; operand is the address.
  239. Can be nested inside a VOLATILE. */
  240. DEF_RTL_EXPR(MEM, "mem", "e")
  241. /* Reference to an assembler label in the code for this function.
  242. The operand is a CODE_LABEL found in the insn chain.
  243. The unprinted fields 1 and 2 are used in flow.c for the
  244. LABEL_NEXTREF and CONTAINING_INSN. */
  245. DEF_RTL_EXPR(LABEL_REF, "label_ref", "u00")
  246. /* Reference to a named label: the string that is the first operand,
  247. with `_' added implicitly in front.
  248. Exception: if the first character explicitly given is `*',
  249. to give it to the assembler, remove the `*' and do not add `_'. */
  250. DEF_RTL_EXPR(SYMBOL_REF, "symbol_ref", "s")
  251. /* The condition code register is represented, in our imagination,
  252. as a register holding a value that can be compared to zero.
  253. In fact, the machine has already compared them and recorded the
  254. results; but instructions that look at the condition code
  255. pretend to be looking at the entire value and comparing it. */
  256. DEF_RTL_EXPR(CC0, "cc0", "")
  257. /* =====================================================================
  258. A QUEUED expression really points to a member of the queue of instructions
  259. to be output later for postincrement/postdecrement.
  260. QUEUED expressions never become part of instructions.
  261. When a QUEUED expression would be put into an instruction,
  262. instead either the incremented variable or a copy of its previous
  263. value is used.
  264. Operands are:
  265. 0. the variable to be incremented (a REG rtx).
  266. 1. the incrementing instruction, or 0 if it hasn't been output yet.
  267. 2. A REG rtx for a copy of the old value of the variable, or 0 if none yet.
  268. 3. the body to use for the incrementing instruction
  269. 4. the next QUEUED expression in the queue.
  270. ====================================================================== */
  271. DEF_RTL_EXPR(QUEUED, "queued", "eeeee")
  272. /* ----------------------------------------------------------------------
  273. Expressions for operators in an rtl pattern
  274. ---------------------------------------------------------------------- */
  275. /* if_then_else. This is used in representing ordinary
  276. conditional jump instructions.
  277. Operand:
  278. 0: condition
  279. 1: then expr
  280. 2: else expr */
  281. DEF_RTL_EXPR(IF_THEN_ELSE, "if_then_else", "eee")
  282. /* plus */
  283. DEF_RTL_EXPR(PLUS, "plus", "ee")
  284. /* Operand 0 minus operand 1. */
  285. DEF_RTL_EXPR(MINUS, "minus", "ee")
  286. /* Minus operand 0. */
  287. DEF_RTL_EXPR(NEG, "neg", "e")
  288. DEF_RTL_EXPR(MULT, "mult", "ee")
  289. /* Operand 0 divided by operand 1. */
  290. DEF_RTL_EXPR(DIV, "div", "ee")
  291. /* Remainder of operand 0 divided by operand 1. */
  292. DEF_RTL_EXPR(MOD, "mod", "ee")
  293. /* Unsigned multiply and divide. */
  294. DEF_RTL_EXPR(UMULT, "umult", "ee")
  295. DEF_RTL_EXPR(UDIV, "udiv", "ee")
  296. DEF_RTL_EXPR(UMOD, "umod", "ee")
  297. /* Bitwise operations. */
  298. DEF_RTL_EXPR(AND, "and", "ee")
  299. DEF_RTL_EXPR(IOR, "ior", "ee")
  300. DEF_RTL_EXPR(XOR, "xor", "ee")
  301. DEF_RTL_EXPR(NOT, "not", "e")
  302. /* Operand:
  303. 0: value to be shifted.
  304. 1: number of bits.
  305. ASHIFT and LSHIFT are distinguished because on some machines
  306. these allow a negative operand and shift right in that case. */
  307. DEF_RTL_EXPR(LSHIFT, "lshift", "ee")
  308. DEF_RTL_EXPR(ASHIFT, "ashift", "ee")
  309. DEF_RTL_EXPR(ROTATE, "rotate", "ee")
  310. /* Right shift operations, for machines where these are not the same
  311. as left shifting with a negative argument. */
  312. DEF_RTL_EXPR(ASHIFTRT, "ashiftrt", "ee")
  313. DEF_RTL_EXPR(LSHIFTRT, "lshiftrt", "ee")
  314. DEF_RTL_EXPR(ROTATERT, "rotatert", "ee")
  315. /* These unary operations are used to represent incrementation
  316. and decrementation as they occur in memory addresses.
  317. The amount of increment or decrement are not represented
  318. because they can be understood from the machine-mode of the
  319. containing MEM. These operations exist in only two cases:
  320. 1. pushes onto the stack.
  321. 2. created automatically by the life_analysis pass in flow.c. */
  322. DEF_RTL_EXPR(PRE_DEC, "pre_dec", "e")
  323. DEF_RTL_EXPR(PRE_INC, "pre_inc", "e")
  324. DEF_RTL_EXPR(POST_DEC, "post_dec", "e")
  325. DEF_RTL_EXPR(POST_INC, "post_inc", "e")
  326. /* Comparison operations. The ordered comparisons exist in two
  327. flavors, signed and unsigned. */
  328. DEF_RTL_EXPR(NE, "ne", "ee")
  329. DEF_RTL_EXPR(EQ, "eq", "ee")
  330. DEF_RTL_EXPR(GE, "ge", "ee")
  331. DEF_RTL_EXPR(GT, "gt", "ee")
  332. DEF_RTL_EXPR(LE, "le", "ee")
  333. DEF_RTL_EXPR(LT, "lt", "ee")
  334. DEF_RTL_EXPR(GEU, "geu", "ee")
  335. DEF_RTL_EXPR(GTU, "gtu", "ee")
  336. DEF_RTL_EXPR(LEU, "leu", "ee")
  337. DEF_RTL_EXPR(LTU, "ltu", "ee")
  338. /* Represents the result of sign-extending the sole operand.
  339. The machine modes of the operand and of the SIGN_EXTEND expression
  340. determine how much sign-extension is going on. */
  341. DEF_RTL_EXPR(SIGN_EXTEND, "sign_extend", "e")
  342. /* Similar for zero-extension (such as unsigned short to int). */
  343. DEF_RTL_EXPR(ZERO_EXTEND, "zero_extend", "e")
  344. /* Similar but here the operand has a wider mode. */
  345. DEF_RTL_EXPR(TRUNCATE, "truncate", "e")
  346. /* Similar for extending floating-point values (such as SFmode to DFmode). */
  347. DEF_RTL_EXPR(FLOAT_EXTEND, "float_extend", "e")
  348. DEF_RTL_EXPR(FLOAT_TRUNCATE, "float_truncate", "e")
  349. /* Conversion of fixed point operand to floating point value. */
  350. DEF_RTL_EXPR(FLOAT, "float", "e")
  351. /* Conversion of floating point operand to fixed point value. */
  352. DEF_RTL_EXPR(FIX, "fix", "e")
  353. /* Absolute value */
  354. DEF_RTL_EXPR(ABS, "abs", "e")
  355. /* Square root */
  356. DEF_RTL_EXPR(SQRT, "sqrt", "e")
  357. /* Reference to a signed bit-field of specified size and position.
  358. Operand 0 is the memory unit (usually SImode or QImode) which
  359. contains the field's first bit. Operand 1 is the width, in bits.
  360. Operand 2 is the number of bits in the memory unit before the
  361. first bit of this field.
  362. If BITS_BIG_ENDIAN is defined, the first bit is the msb and
  363. operand 2 counts from the msb of the memory unit.
  364. Otherwise, the first bit is the lsb and operand 2 counts from
  365. the lsb of the memory unit. */
  366. DEF_RTL_EXPR(SIGN_EXTRACT, "sign_extract", "eee")
  367. /* Similar for unsigned bit-field. */
  368. DEF_RTL_EXPR(ZERO_EXTRACT, "zero_extract", "eee")
  369. /*
  370. Local variables:
  371. mode:c
  372. version-control: t
  373. End:
  374. */