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