(all output patterns): Use new capabilities of arm_print_operand to
[official-gcc.git] / gcc / rtl.h
blobb0eb1c521fcab1c07fd2f7372e0aad70b8ae72be
1 /* Register Transfer Language (RTL) definitions for GNU C-Compiler
2 Copyright (C) 1987, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21 #include "machmode.h"
23 #undef FFS /* Some systems predefine this symbol; don't let it interfere. */
24 #undef FLOAT /* Likewise. */
25 #undef ABS /* Likewise. */
26 #undef PC /* Likewise. */
28 #ifndef TREE_CODE
29 union tree_node;
30 #endif
32 /* Register Transfer Language EXPRESSIONS CODES */
34 #define RTX_CODE enum rtx_code
35 enum rtx_code {
37 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
38 #include "rtl.def" /* rtl expressions are documented here */
39 #undef DEF_RTL_EXPR
41 LAST_AND_UNUSED_RTX_CODE}; /* A convenient way to get a value for
42 NUM_RTX_CODE.
43 Assumes default enum value assignment. */
45 #define NUM_RTX_CODE ((int)LAST_AND_UNUSED_RTX_CODE)
46 /* The cast here, saves many elsewhere. */
48 extern int rtx_length[];
49 #define GET_RTX_LENGTH(CODE) (rtx_length[(int)(CODE)])
51 extern char *rtx_name[];
52 #define GET_RTX_NAME(CODE) (rtx_name[(int)(CODE)])
54 extern char *rtx_format[];
55 #define GET_RTX_FORMAT(CODE) (rtx_format[(int)(CODE)])
57 extern char rtx_class[];
58 #define GET_RTX_CLASS(CODE) (rtx_class[(int)(CODE)])
60 /* Common union for an element of an rtx. */
62 typedef union rtunion_def
64 HOST_WIDE_INT rtwint;
65 int rtint;
66 char *rtstr;
67 struct rtx_def *rtx;
68 struct rtvec_def *rtvec;
69 enum machine_mode rttype;
70 } rtunion;
72 /* RTL expression ("rtx"). */
74 typedef struct rtx_def
76 #ifdef ONLY_INT_FIELDS
77 #ifdef CODE_FIELD_BUG
78 unsigned int code : 16;
79 #else
80 unsigned short code;
81 #endif
82 #else
83 /* The kind of expression this is. */
84 enum rtx_code code : 16;
85 #endif
86 /* The kind of value the expression has. */
87 #ifdef ONLY_INT_FIELDS
88 int mode : 8;
89 #else
90 enum machine_mode mode : 8;
91 #endif
92 /* 1 in an INSN if it can alter flow of control
93 within this function. Not yet used! */
94 unsigned int jump : 1;
95 /* 1 in an INSN if it can call another function. Not yet used! */
96 unsigned int call : 1;
97 /* 1 in a MEM or REG if value of this expression will never change
98 during the current function, even though it is not
99 manifestly constant.
100 1 in a SUBREG if it is from a promoted variable that is unsigned.
101 1 in a SYMBOL_REF if it addresses something in the per-function
102 constants pool.
103 1 in a CALL_INSN if it is a const call.
104 1 in a JUMP_INSN if it is a branch that should be annulled. Valid from
105 reorg until end of compilation; cleared before used. */
106 unsigned int unchanging : 1;
107 /* 1 in a MEM expression if contents of memory are volatile.
108 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL or BARRIER
109 if it is deleted.
110 1 in a REG expression if corresponds to a variable declared by the user.
111 0 for an internally generated temporary.
112 In a SYMBOL_REF, this flag is used for machine-specific purposes.
113 In a LABEL_REF or in a REG_LABEL note, this is LABEL_REF_NONLOCAL_P. */
114 unsigned int volatil : 1;
115 /* 1 in a MEM referring to a field of a structure (not a union!).
116 0 if the MEM was a variable or the result of a * operator in C;
117 1 if it was the result of a . or -> operator (on a struct) in C.
118 1 in a REG if the register is used only in exit code a loop.
119 1 in a SUBREG expression if was generated from a variable with a
120 promoted mode.
121 1 in a CODE_LABEL if the label is used for nonlocal gotos
122 and must not be deleted even if its count is zero.
123 1 in a LABEL_REF if this is a reference to a label outside the
124 current loop.
125 1 in an INSN, JUMP_INSN, or CALL_INSN if this insn must be scheduled
126 together with the preceding insn. Valid only within sched.
127 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
128 from the target of a branch. Valid from reorg until end of compilation;
129 cleared before used. */
130 unsigned int in_struct : 1;
131 /* 1 if this rtx is used. This is used for copying shared structure.
132 See `unshare_all_rtl'.
133 In a REG, this is not needed for that purpose, and used instead
134 in `leaf_renumber_regs_insn'.
135 In a SYMBOL_REF, means that emit_library_call
136 has used it as the function. */
137 unsigned int used : 1;
138 /* Nonzero if this rtx came from procedure integration.
139 In a REG, nonzero means this reg refers to the return value
140 of the current function. */
141 unsigned integrated : 1;
142 /* The first element of the operands of this rtx.
143 The number of operands and their types are controlled
144 by the `code' field, according to rtl.def. */
145 rtunion fld[1];
146 } *rtx;
149 /* Add prototype support. */
150 #ifndef PROTO
151 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
152 #define PROTO(ARGS) ARGS
153 #else
154 #define PROTO(ARGS) ()
155 #endif
156 #endif
158 #ifndef VPROTO
159 #ifdef __STDC__
160 #define PVPROTO(ARGS) ARGS
161 #define VPROTO(ARGS) ARGS
162 #define VA_START(va_list,var) va_start(va_list,var)
163 #else
164 #define PVPROTO(ARGS) ()
165 #define VPROTO(ARGS) (va_alist) va_dcl
166 #define VA_START(va_list,var) va_start(va_list)
167 #endif
168 #endif
170 #ifndef STDIO_PROTO
171 #ifdef BUFSIZ
172 #define STDIO_PROTO(ARGS) PROTO(ARGS)
173 #else
174 #define STDIO_PROTO(ARGS) ()
175 #endif
176 #endif
178 #define NULL_RTX (rtx) 0
180 /* Define a generic NULL if one hasn't already been defined. */
182 #ifndef NULL
183 #define NULL 0
184 #endif
186 #ifndef GENERIC_PTR
187 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
188 #define GENERIC_PTR void *
189 #else
190 #define GENERIC_PTR char *
191 #endif
192 #endif
194 #ifndef NULL_PTR
195 #define NULL_PTR ((GENERIC_PTR)0)
196 #endif
198 /* Define macros to access the `code' field of the rtx. */
200 #ifdef SHORT_ENUM_BUG
201 #define GET_CODE(RTX) ((enum rtx_code) ((RTX)->code))
202 #define PUT_CODE(RTX, CODE) ((RTX)->code = ((short) (CODE)))
203 #else
204 #define GET_CODE(RTX) ((RTX)->code)
205 #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
206 #endif
208 #define GET_MODE(RTX) ((RTX)->mode)
209 #define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))
211 #define RTX_INTEGRATED_P(RTX) ((RTX)->integrated)
212 #define RTX_UNCHANGING_P(RTX) ((RTX)->unchanging)
214 /* RTL vector. These appear inside RTX's when there is a need
215 for a variable number of things. The principle use is inside
216 PARALLEL expressions. */
218 typedef struct rtvec_def{
219 unsigned num_elem; /* number of elements */
220 rtunion elem[1];
221 } *rtvec;
223 #define NULL_RTVEC (rtvec) 0
225 #define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
226 #define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (unsigned) NUM)
228 #define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[(I)].rtx)
230 /* 1 if X is a REG. */
232 #define REG_P(X) (GET_CODE (X) == REG)
234 /* 1 if X is a constant value that is an integer. */
236 #define CONSTANT_P(X) \
237 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
238 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST_DOUBLE \
239 || GET_CODE (X) == CONST || GET_CODE (X) == HIGH)
241 /* General accessor macros for accessing the fields of an rtx. */
243 #define XEXP(RTX, N) ((RTX)->fld[N].rtx)
244 #define XINT(RTX, N) ((RTX)->fld[N].rtint)
245 #define XWINT(RTX, N) ((RTX)->fld[N].rtwint)
246 #define XSTR(RTX, N) ((RTX)->fld[N].rtstr)
247 #define XVEC(RTX, N) ((RTX)->fld[N].rtvec)
248 #define XVECLEN(RTX, N) ((RTX)->fld[N].rtvec->num_elem)
249 #define XVECEXP(RTX,N,M)((RTX)->fld[N].rtvec->elem[M].rtx)
251 /* ACCESS MACROS for particular fields of insns. */
253 /* Holds a unique number for each insn.
254 These are not necessarily sequentially increasing. */
255 #define INSN_UID(INSN) ((INSN)->fld[0].rtint)
257 /* Chain insns together in sequence. */
258 #define PREV_INSN(INSN) ((INSN)->fld[1].rtx)
259 #define NEXT_INSN(INSN) ((INSN)->fld[2].rtx)
261 /* The body of an insn. */
262 #define PATTERN(INSN) ((INSN)->fld[3].rtx)
264 /* Code number of instruction, from when it was recognized.
265 -1 means this instruction has not been recognized yet. */
266 #define INSN_CODE(INSN) ((INSN)->fld[4].rtint)
268 /* Set up in flow.c; empty before then.
269 Holds a chain of INSN_LIST rtx's whose first operands point at
270 previous insns with direct data-flow connections to this one.
271 That means that those insns set variables whose next use is in this insn.
272 They are always in the same basic block as this insn. */
273 #define LOG_LINKS(INSN) ((INSN)->fld[5].rtx)
275 /* 1 if insn has been deleted. */
276 #define INSN_DELETED_P(INSN) ((INSN)->volatil)
278 /* 1 if insn is a call to a const function. */
279 #define CONST_CALL_P(INSN) ((INSN)->unchanging)
281 /* 1 if insn is a branch that should not unconditionally execute its
282 delay slots, i.e., it is an annulled branch. */
283 #define INSN_ANNULLED_BRANCH_P(INSN) ((INSN)->unchanging)
285 /* 1 if insn is in a delay slot and is from the target of the branch. If
286 the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
287 executed if the branch is taken. For annulled branches with this bit
288 clear, the insn should be executed only if the branch is not taken. */
289 #define INSN_FROM_TARGET_P(INSN) ((INSN)->in_struct)
291 /* Holds a list of notes on what this insn does to various REGs.
292 It is a chain of EXPR_LIST rtx's, where the second operand
293 is the chain pointer and the first operand is the REG being described.
294 The mode field of the EXPR_LIST contains not a real machine mode
295 but a value that says what this note says about the REG:
296 REG_DEAD means that the value in REG dies in this insn (i.e., it is
297 not needed past this insn). If REG is set in this insn, the REG_DEAD
298 note may, but need not, be omitted.
299 REG_INC means that the REG is autoincremented or autodecremented.
300 REG_EQUIV describes the insn as a whole; it says that the
301 insn sets a register to a constant value or to be equivalent to
302 a memory address. If the
303 register is spilled to the stack then the constant value
304 should be substituted for it. The contents of the REG_EQUIV
305 is the constant value or memory address, which may be different
306 from the source of the SET although it has the same value.
307 REG_EQUAL is like REG_EQUIV except that the destination
308 is only momentarily equal to the specified rtx. Therefore, it
309 cannot be used for substitution; but it can be used for cse.
310 REG_RETVAL means that this insn copies the return-value of
311 a library call out of the hard reg for return values. This note
312 is actually an INSN_LIST and it points to the first insn involved
313 in setting up arguments for the call. flow.c uses this to delete
314 the entire library call when its result is dead.
315 REG_LIBCALL is the inverse of REG_RETVAL: it goes on the first insn
316 of the library call and points at the one that has the REG_RETVAL.
317 REG_WAS_0 says that the register set in this insn held 0 before the insn.
318 The contents of the note is the insn that stored the 0.
319 If that insn is deleted or patched to a NOTE, the REG_WAS_0 is inoperative.
320 The REG_WAS_0 note is actually an INSN_LIST, not an EXPR_LIST.
321 REG_NONNEG means that the register is always nonnegative during
322 the containing loop. This is used in branches so that decrement and
323 branch instructions terminating on zero can be matched. There must be
324 an insn pattern in the md file named `decrement_and_branch_until_zero'
325 or else this will never be added to any instructions.
326 REG_NO_CONFLICT means there is no conflict *after this insn*
327 between the register in the note and the destination of this insn.
328 REG_UNUSED identifies a register set in this insn and never used.
329 REG_CC_SETTER and REG_CC_USER link a pair of insns that set and use
330 CC0, respectively. Normally, these are required to be consecutive insns,
331 but we permit putting a cc0-setting insn in the delay slot of a branch
332 as long as only one copy of the insn exists. In that case, these notes
333 point from one to the other to allow code generation to determine what
334 any require information and to properly update CC_STATUS.
335 REG_LABEL points to a CODE_LABEL. Used by non-JUMP_INSNs to
336 say that the CODE_LABEL contained in the REG_LABEL note is used
337 by the insn.
338 REG_DEP_ANTI is used in LOG_LINKS which represent anti (write after read)
339 dependencies. REG_DEP_OUTPUT is used in LOG_LINKS which represent output
340 (write after write) dependencies. Data dependencies, which are the only
341 type of LOG_LINK created by flow, are represented by a 0 reg note kind. */
343 #define REG_NOTES(INSN) ((INSN)->fld[6].rtx)
345 /* Don't forget to change reg_note_name in rtl.c. */
346 enum reg_note { REG_DEAD = 1, REG_INC = 2, REG_EQUIV = 3, REG_WAS_0 = 4,
347 REG_EQUAL = 5, REG_RETVAL = 6, REG_LIBCALL = 7,
348 REG_NONNEG = 8, REG_NO_CONFLICT = 9, REG_UNUSED = 10,
349 REG_CC_SETTER = 11, REG_CC_USER = 12, REG_LABEL = 13,
350 REG_DEP_ANTI = 14, REG_DEP_OUTPUT = 15 };
352 /* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
353 #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
354 #define PUT_REG_NOTE_KIND(LINK,KIND) PUT_MODE(LINK, (enum machine_mode) (KIND))
356 /* Names for REG_NOTE's in EXPR_LIST insn's. */
358 extern char *reg_note_name[];
359 #define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int)(MODE)])
361 /* This field is only present on CALL_INSNs. It holds a chain of EXPR_LIST of
362 USE and CLOBBER expressions.
363 USE expressions list the registers filled with arguments that
364 are passed to the function.
365 CLOBBER expressions document the registers explicitly clobbered
366 by this CALL_INSN.
367 Pseudo registers can not be mentioned in this list. */
368 #define CALL_INSN_FUNCTION_USAGE(INSN) ((INSN)->fld[7].rtx)
370 /* The label-number of a code-label. The assembler label
371 is made from `L' and the label-number printed in decimal.
372 Label numbers are unique in a compilation. */
373 #define CODE_LABEL_NUMBER(INSN) ((INSN)->fld[3].rtint)
375 #define LINE_NUMBER NOTE
377 /* In a NOTE that is a line number, this is a string for the file name
378 that the line is in. We use the same field to record block numbers
379 temporarily in NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes.
380 (We avoid lots of casts between ints and pointers if we use a
381 different macro for the bock number.) */
383 #define NOTE_SOURCE_FILE(INSN) ((INSN)->fld[3].rtstr)
384 #define NOTE_BLOCK_NUMBER(INSN) ((INSN)->fld[3].rtint)
386 /* In a NOTE that is a line number, this is the line number.
387 Other kinds of NOTEs are identified by negative numbers here. */
388 #define NOTE_LINE_NUMBER(INSN) ((INSN)->fld[4].rtint)
390 /* Codes that appear in the NOTE_LINE_NUMBER field
391 for kinds of notes that are not line numbers.
393 Notice that we do not try to use zero here for any of
394 the special note codes because sometimes the source line
395 actually can be zero! This happens (for example) when we
396 are generating code for the per-translation-unit constructor
397 and destructor routines for some C++ translation unit.
399 If you should change any of the following values, or if you
400 should add a new value here, don't forget to change the
401 note_insn_name array in rtl.c. */
403 /* This note is used to get rid of an insn
404 when it isn't safe to patch the insn out of the chain. */
405 #define NOTE_INSN_DELETED -1
406 #define NOTE_INSN_BLOCK_BEG -2
407 #define NOTE_INSN_BLOCK_END -3
408 #define NOTE_INSN_LOOP_BEG -4
409 #define NOTE_INSN_LOOP_END -5
410 /* This kind of note is generated at the end of the function body,
411 just before the return insn or return label.
412 In an optimizing compilation it is deleted by the first jump optimization,
413 after enabling that optimizer to determine whether control can fall
414 off the end of the function body without a return statement. */
415 #define NOTE_INSN_FUNCTION_END -6
416 /* This kind of note is generated just after each call to `setjmp', et al. */
417 #define NOTE_INSN_SETJMP -7
418 /* Generated at the place in a loop that `continue' jumps to. */
419 #define NOTE_INSN_LOOP_CONT -8
420 /* Generated at the start of a duplicated exit test. */
421 #define NOTE_INSN_LOOP_VTOP -9
422 /* This marks the point immediately after the last prologue insn. */
423 #define NOTE_INSN_PROLOGUE_END -10
424 /* This marks the point immediately prior to the first epilogue insn. */
425 #define NOTE_INSN_EPILOGUE_BEG -11
426 /* Generated in place of user-declared labels when they are deleted. */
427 #define NOTE_INSN_DELETED_LABEL -12
428 /* This note indicates the start of the real body of the function,
429 i.e. the point just after all of the parms have been moved into
430 their homes, etc. */
431 #define NOTE_INSN_FUNCTION_BEG -13
434 #if 0 /* These are not used, and I don't know what they were for. --rms. */
435 #define NOTE_DECL_NAME(INSN) ((INSN)->fld[3].rtstr)
436 #define NOTE_DECL_CODE(INSN) ((INSN)->fld[4].rtint)
437 #define NOTE_DECL_RTL(INSN) ((INSN)->fld[5].rtx)
438 #define NOTE_DECL_IDENTIFIER(INSN) ((INSN)->fld[6].rtint)
439 #define NOTE_DECL_TYPE(INSN) ((INSN)->fld[7].rtint)
440 #endif /* 0 */
442 /* Names for NOTE insn's other than line numbers. */
444 extern char *note_insn_name[];
445 #define GET_NOTE_INSN_NAME(NOTE_CODE) (note_insn_name[-(NOTE_CODE)])
447 /* The name of a label, in case it corresponds to an explicit label
448 in the input source code. */
449 #define LABEL_NAME(LABEL) ((LABEL)->fld[4].rtstr)
451 /* In jump.c, each label contains a count of the number
452 of LABEL_REFs that point at it, so unused labels can be deleted. */
453 #define LABEL_NUSES(LABEL) ((LABEL)->fld[5].rtint)
455 /* The rest is used instead of the above, in a CODE_LABEL,
456 if bytecode is being output.
457 We make the slightly klugy assumption that a LABEL has enough slots
458 to hold these things. That happens to be true. */
460 /* For static or external objects. */
461 #define BYTECODE_LABEL(X) (XEXP ((X), 0))
463 /* For goto labels inside bytecode functions. */
464 #define BYTECODE_BC_LABEL(X) (*(struct bc_label **) &XEXP ((X), 1))
466 /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
467 so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
468 be decremented and possibly the label can be deleted. */
469 #define JUMP_LABEL(INSN) ((INSN)->fld[7].rtx)
471 /* Once basic blocks are found in flow.c,
472 each CODE_LABEL starts a chain that goes through
473 all the LABEL_REFs that jump to that label.
474 The chain eventually winds up at the CODE_LABEL; it is circular. */
475 #define LABEL_REFS(LABEL) ((LABEL)->fld[5].rtx)
477 /* This is the field in the LABEL_REF through which the circular chain
478 of references to a particular label is linked.
479 This chain is set up in flow.c. */
481 #define LABEL_NEXTREF(REF) ((REF)->fld[1].rtx)
483 /* Once basic blocks are found in flow.c,
484 Each LABEL_REF points to its containing instruction with this field. */
486 #define CONTAINING_INSN(RTX) ((RTX)->fld[2].rtx)
488 /* For a REG rtx, REGNO extracts the register number. */
490 #define REGNO(RTX) ((RTX)->fld[0].rtint)
492 /* For a REG rtx, REG_FUNCTION_VALUE_P is nonzero if the reg
493 is the current function's return value. */
495 #define REG_FUNCTION_VALUE_P(RTX) ((RTX)->integrated)
497 /* 1 in a REG rtx if it corresponds to a variable declared by the user. */
498 #define REG_USERVAR_P(RTX) ((RTX)->volatil)
500 /* For a CONST_INT rtx, INTVAL extracts the integer. */
502 #define INTVAL(RTX) ((RTX)->fld[0].rtwint)
504 /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
505 SUBREG_WORD extracts the word-number. */
507 #define SUBREG_REG(RTX) ((RTX)->fld[0].rtx)
508 #define SUBREG_WORD(RTX) ((RTX)->fld[1].rtint)
510 /* 1 if the REG contained in SUBREG_REG is already known to be
511 sign- or zero-extended from the mode of the SUBREG to the mode of
512 the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
513 extension.
515 When used as a LHS, is means that this extension must be done
516 when assigning to SUBREG_REG. */
518 #define SUBREG_PROMOTED_VAR_P(RTX) ((RTX)->in_struct)
519 #define SUBREG_PROMOTED_UNSIGNED_P(RTX) ((RTX)->unchanging)
521 /* Access various components of an ASM_OPERANDS rtx. */
523 #define ASM_OPERANDS_TEMPLATE(RTX) XSTR ((RTX), 0)
524 #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XSTR ((RTX), 1)
525 #define ASM_OPERANDS_OUTPUT_IDX(RTX) XINT ((RTX), 2)
526 #define ASM_OPERANDS_INPUT_VEC(RTX) XVEC ((RTX), 3)
527 #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XVEC ((RTX), 4)
528 #define ASM_OPERANDS_INPUT(RTX, N) XVECEXP ((RTX), 3, (N))
529 #define ASM_OPERANDS_INPUT_LENGTH(RTX) XVECLEN ((RTX), 3)
530 #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) XSTR (XVECEXP ((RTX), 4, (N)), 0)
531 #define ASM_OPERANDS_INPUT_MODE(RTX, N) GET_MODE (XVECEXP ((RTX), 4, (N)))
532 #define ASM_OPERANDS_SOURCE_FILE(RTX) XSTR ((RTX), 5)
533 #define ASM_OPERANDS_SOURCE_LINE(RTX) XINT ((RTX), 6)
535 /* For a MEM rtx, 1 if it's a volatile reference.
536 Also in an ASM_OPERANDS rtx. */
537 #define MEM_VOLATILE_P(RTX) ((RTX)->volatil)
539 /* For a MEM rtx, 1 if it refers to a structure or union component. */
540 #define MEM_IN_STRUCT_P(RTX) ((RTX)->in_struct)
542 /* For a LABEL_REF, 1 means that this reference is to a label outside the
543 loop containing the reference. */
544 #define LABEL_OUTSIDE_LOOP_P(RTX) ((RTX)->in_struct)
546 /* For a LABEL_REF, 1 means it is for a nonlocal label. */
547 /* Likewise in an EXPR_LIST for a REG_LABEL note. */
548 #define LABEL_REF_NONLOCAL_P(RTX) ((RTX)->volatil)
550 /* For a CODE_LABEL, 1 means always consider this label to be needed. */
551 #define LABEL_PRESERVE_P(RTX) ((RTX)->in_struct)
553 /* For a REG, 1 means the register is used only in an exit test of a loop. */
554 #define REG_LOOP_TEST_P(RTX) ((RTX)->in_struct)
556 /* During sched, for an insn, 1 means that the insn must be scheduled together
557 with the preceding insn. */
558 #define SCHED_GROUP_P(INSN) ((INSN)->in_struct)
560 /* During sched, for the LOG_LINKS of an insn, these cache the adjusted
561 cost of the dependence link. The cost of executing an instruction
562 may vary based on how the results are used. LINK_COST_ZERO is 1 when
563 the cost through the link varies and is unchanged (i.e., the link has
564 zero additional cost). LINK_COST_FREE is 1 when the cost through the
565 link is zero (i.e., the link makes the cost free). In other cases,
566 the adjustment to the cost is recomputed each time it is needed. */
567 #define LINK_COST_ZERO(X) ((X)->jump)
568 #define LINK_COST_FREE(X) ((X)->call)
570 /* For a SET rtx, SET_DEST is the place that is set
571 and SET_SRC is the value it is set to. */
572 #define SET_DEST(RTX) ((RTX)->fld[0].rtx)
573 #define SET_SRC(RTX) ((RTX)->fld[1].rtx)
575 /* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
576 #define TRAP_CONDITION(RTX) ((RTX)->fld[0].rtx)
578 /* 1 in a SYMBOL_REF if it addresses this function's constants pool. */
579 #define CONSTANT_POOL_ADDRESS_P(RTX) ((RTX)->unchanging)
581 /* Flag in a SYMBOL_REF for machine-specific purposes. */
582 #define SYMBOL_REF_FLAG(RTX) ((RTX)->volatil)
584 /* 1 means a SYMBOL_REF has been the library function in emit_library_call. */
585 #define SYMBOL_REF_USED(RTX) ((RTX)->used)
587 /* For an INLINE_HEADER rtx, FIRST_FUNCTION_INSN is the first insn
588 of the function that is not involved in copying parameters to
589 pseudo-registers. FIRST_PARM_INSN is the very first insn of
590 the function, including the parameter copying.
591 We keep this around in case we must splice
592 this function into the assembly code at the end of the file.
593 FIRST_LABELNO is the first label number used by the function (inclusive).
594 LAST_LABELNO is the last label used by the function (exclusive).
595 MAX_REGNUM is the largest pseudo-register used by that function.
596 FUNCTION_ARGS_SIZE is the size of the argument block in the stack.
597 POPS_ARGS is the number of bytes of input arguments popped by the function
598 STACK_SLOT_LIST is the list of stack slots.
599 FUNCTION_FLAGS are where single-bit flags are saved.
600 OUTGOING_ARGS_SIZE is the size of the largest outgoing stack parameter list.
601 ORIGINAL_ARG_VECTOR is a vector of the original DECL_RTX values
602 for the function arguments.
603 ORIGINAL_DECL_INITIAL is a pointer to the original DECL_INITIAL for the
604 function.
606 We want this to lay down like an INSN. The PREV_INSN field
607 is always NULL. The NEXT_INSN field always points to the
608 first function insn of the function being squirreled away. */
610 #define FIRST_FUNCTION_INSN(RTX) ((RTX)->fld[2].rtx)
611 #define FIRST_PARM_INSN(RTX) ((RTX)->fld[3].rtx)
612 #define FIRST_LABELNO(RTX) ((RTX)->fld[4].rtint)
613 #define LAST_LABELNO(RTX) ((RTX)->fld[5].rtint)
614 #define MAX_PARMREG(RTX) ((RTX)->fld[6].rtint)
615 #define MAX_REGNUM(RTX) ((RTX)->fld[7].rtint)
616 #define FUNCTION_ARGS_SIZE(RTX) ((RTX)->fld[8].rtint)
617 #define POPS_ARGS(RTX) ((RTX)->fld[9].rtint)
618 #define STACK_SLOT_LIST(RTX) ((RTX)->fld[10].rtx)
619 #define FUNCTION_FLAGS(RTX) ((RTX)->fld[11].rtint)
620 #define OUTGOING_ARGS_SIZE(RTX) ((RTX)->fld[12].rtint)
621 #define ORIGINAL_ARG_VECTOR(RTX) ((RTX)->fld[13].rtvec)
622 #define ORIGINAL_DECL_INITIAL(RTX) ((RTX)->fld[14].rtx)
624 /* In FUNCTION_FLAGS we save some variables computed when emitting the code
625 for the function and which must be `or'ed into the current flag values when
626 insns from that function are being inlined. */
628 /* These ought to be an enum, but non-ANSI compilers don't like that. */
629 #define FUNCTION_FLAGS_CALLS_ALLOCA 01
630 #define FUNCTION_FLAGS_CALLS_SETJMP 02
631 #define FUNCTION_FLAGS_RETURNS_STRUCT 04
632 #define FUNCTION_FLAGS_RETURNS_PCC_STRUCT 010
633 #define FUNCTION_FLAGS_NEEDS_CONTEXT 020
634 #define FUNCTION_FLAGS_HAS_NONLOCAL_LABEL 040
635 #define FUNCTION_FLAGS_RETURNS_POINTER 0100
636 #define FUNCTION_FLAGS_USES_CONST_POOL 0200
637 #define FUNCTION_FLAGS_CALLS_LONGJMP 0400
638 #define FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE 01000
640 /* Define a macro to look for REG_INC notes,
641 but save time on machines where they never exist. */
643 /* Don't continue this line--convex cc version 4.1 would lose. */
644 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
645 #define FIND_REG_INC_NOTE(insn, reg) (find_reg_note ((insn), REG_INC, (reg)))
646 #else
647 #define FIND_REG_INC_NOTE(insn, reg) 0
648 #endif
650 /* Indicate whether the machine has any sort of auto increment addressing.
651 If not, we can avoid checking for REG_INC notes. */
653 /* Don't continue this line--convex cc version 4.1 would lose. */
654 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
655 #define AUTO_INC_DEC
656 #endif
658 /* Generally useful functions. */
660 /* The following functions accept a wide integer argument. Rather than
661 having to cast on every function call, we use a macro instead, that is
662 defined here and in tree.h. */
664 #ifndef exact_log2
665 #define exact_log2(N) exact_log2_wide ((HOST_WIDE_INT) (N))
666 #define floor_log2(N) floor_log2_wide ((HOST_WIDE_INT) (N))
667 #endif
669 #define plus_constant(X,C) plus_constant_wide (X, (HOST_WIDE_INT) (C))
671 #define plus_constant_for_output(X,C) \
672 plus_constant_for_output_wide (X, (HOST_WIDE_INT) (C))
674 extern rtx plus_constant_wide PROTO((rtx, HOST_WIDE_INT));
675 extern rtx plus_constant_for_output_wide PROTO((rtx, HOST_WIDE_INT));
677 #define GEN_INT(N) gen_rtx (CONST_INT, VOIDmode, (HOST_WIDE_INT) (N))
679 extern rtx bc_gen_rtx ();
681 extern rtx gen_rtx PVPROTO((enum rtx_code,
682 enum machine_mode, ...));
683 extern rtvec gen_rtvec PVPROTO((int, ...));
685 extern rtx read_rtx STDIO_PROTO((FILE *));
687 #if 0
688 /* At present, don't prototype xrealloc, since all of the callers don't
689 cast their pointers to char *, and all of the xrealloc's don't use
690 void * yet. */
691 extern char *xmalloc PROTO((size_t));
692 extern char *xrealloc PROTO((void *, size_t));
693 #else
694 extern char *xmalloc ();
695 extern char *xrealloc ();
696 #endif
698 extern char *oballoc PROTO((int));
699 extern char *permalloc PROTO((int));
700 extern void free PROTO((void *));
701 extern rtx rtx_alloc PROTO((RTX_CODE));
702 extern rtvec rtvec_alloc PROTO((int));
703 extern rtx find_reg_note PROTO((rtx, enum reg_note, rtx));
704 extern rtx find_regno_note PROTO((rtx, enum reg_note, int));
705 extern int find_reg_fusage PROTO((rtx, enum rtx_code, rtx));
706 extern int find_regno_fusage PROTO((rtx, enum rtx_code, int));
707 extern HOST_WIDE_INT get_integer_term PROTO((rtx));
708 extern rtx get_related_value PROTO((rtx));
709 extern rtx single_set PROTO((rtx));
710 extern rtx find_last_value PROTO((rtx, rtx *, rtx));
711 extern rtx copy_rtx PROTO((rtx));
712 extern rtx copy_rtx_if_shared PROTO((rtx));
713 extern rtx copy_most_rtx PROTO((rtx, rtx));
714 extern rtx replace_rtx PROTO((rtx, rtx, rtx));
715 extern rtvec gen_rtvec_v PROTO((int, rtx *));
716 extern rtx gen_reg_rtx PROTO((enum machine_mode));
717 extern rtx gen_label_rtx PROTO((void));
718 extern rtx gen_inline_header_rtx PROTO((rtx, rtx, int, int, int, int, int, int, rtx, int, int, rtvec, rtx));
719 extern rtx gen_lowpart_common PROTO((enum machine_mode, rtx));
720 extern rtx gen_lowpart PROTO((enum machine_mode, rtx));
721 extern rtx gen_lowpart_if_possible PROTO((enum machine_mode, rtx));
722 extern rtx gen_highpart PROTO((enum machine_mode, rtx));
723 extern rtx gen_realpart PROTO((enum machine_mode, rtx));
724 extern rtx gen_imagpart PROTO((enum machine_mode, rtx));
725 extern rtx operand_subword PROTO((rtx, int, int, enum machine_mode));
726 extern rtx operand_subword_force PROTO((rtx, int, enum machine_mode));
727 extern int subreg_lowpart_p PROTO((rtx));
728 extern rtx make_safe_from PROTO((rtx, rtx));
729 extern rtx memory_address PROTO((enum machine_mode, rtx));
730 extern rtx get_insns PROTO((void));
731 extern rtx get_last_insn PROTO((void));
732 extern rtx get_last_insn_anywhere PROTO((void));
733 extern void start_sequence PROTO((void));
734 extern void push_to_sequence PROTO((rtx));
735 extern void end_sequence PROTO((void));
736 extern rtx gen_sequence PROTO((void));
737 extern rtx immed_double_const PROTO((HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode));
738 extern rtx force_const_mem PROTO((enum machine_mode, rtx));
739 extern rtx force_reg PROTO((enum machine_mode, rtx));
740 extern rtx get_pool_constant PROTO((rtx));
741 extern enum machine_mode get_pool_mode PROTO((rtx));
742 extern int get_pool_offset PROTO((rtx));
743 extern rtx simplify_subtraction PROTO((rtx));
744 extern rtx assign_stack_local PROTO((enum machine_mode, int, int));
745 extern rtx assign_stack_temp PROTO((enum machine_mode, int, int));
746 extern rtx protect_from_queue PROTO((rtx, int));
747 extern void emit_queue PROTO((void));
748 extern rtx emit_move_insn PROTO((rtx, rtx));
749 extern rtx emit_insn_before PROTO((rtx, rtx));
750 extern rtx emit_jump_insn_before PROTO((rtx, rtx));
751 extern rtx emit_call_insn_before PROTO((rtx, rtx));
752 extern rtx emit_barrier_before PROTO((rtx));
753 extern rtx emit_note_before PROTO((int, rtx));
754 extern rtx emit_insn_after PROTO((rtx, rtx));
755 extern rtx emit_jump_insn_after PROTO((rtx, rtx));
756 extern rtx emit_barrier_after PROTO((rtx));
757 extern rtx emit_label_after PROTO((rtx, rtx));
758 extern rtx emit_note_after PROTO((int, rtx));
759 extern rtx emit_line_note_after PROTO((char *, int, rtx));
760 extern rtx emit_insn PROTO((rtx));
761 extern rtx emit_insns PROTO((rtx));
762 extern rtx emit_insns_before PROTO((rtx, rtx));
763 extern rtx emit_jump_insn PROTO((rtx));
764 extern rtx emit_call_insn PROTO((rtx));
765 extern rtx emit_label PROTO((rtx));
766 extern rtx emit_barrier PROTO((void));
767 extern rtx emit_line_note PROTO((char *, int));
768 extern rtx emit_note PROTO((char *, int));
769 extern rtx emit_line_note_force PROTO((char *, int));
770 extern rtx make_insn_raw PROTO((rtx));
771 extern rtx previous_insn PROTO((rtx));
772 extern rtx next_insn PROTO((rtx));
773 extern rtx prev_nonnote_insn PROTO((rtx));
774 extern rtx next_nonnote_insn PROTO((rtx));
775 extern rtx prev_real_insn PROTO((rtx));
776 extern rtx next_real_insn PROTO((rtx));
777 extern rtx prev_active_insn PROTO((rtx));
778 extern rtx next_active_insn PROTO((rtx));
779 extern rtx prev_label PROTO((rtx));
780 extern rtx next_label PROTO((rtx));
781 extern rtx next_cc0_user PROTO((rtx));
782 extern rtx prev_cc0_setter PROTO((rtx));
783 extern rtx reg_set_last PROTO((rtx, rtx));
784 extern rtx next_nondeleted_insn PROTO((rtx));
785 extern enum rtx_code reverse_condition PROTO((enum rtx_code));
786 extern enum rtx_code swap_condition PROTO((enum rtx_code));
787 extern enum rtx_code unsigned_condition PROTO((enum rtx_code));
788 extern enum rtx_code signed_condition PROTO((enum rtx_code));
789 extern rtx find_equiv_reg PROTO((rtx, rtx, enum reg_class, int, short *, int, enum machine_mode));
790 extern rtx squeeze_notes PROTO((rtx, rtx));
791 extern rtx delete_insn PROTO((rtx));
792 extern void delete_jump PROTO((rtx));
793 extern rtx get_label_before PROTO((rtx));
794 extern rtx get_label_after PROTO((rtx));
795 extern rtx follow_jumps PROTO((rtx));
796 extern rtx adj_offsettable_operand PROTO((rtx, int));
797 extern rtx try_split PROTO((rtx, rtx, int));
798 extern rtx split_insns PROTO((rtx, rtx));
799 extern rtx simplify_unary_operation PROTO((enum rtx_code, enum machine_mode, rtx, enum machine_mode));
800 extern rtx simplify_binary_operation PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
801 extern rtx simplify_ternary_operation PROTO((enum rtx_code, enum machine_mode, enum machine_mode, rtx, rtx, rtx));
802 extern rtx simplify_relational_operation PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
803 extern rtx nonlocal_label_rtx_list PROTO((void));
804 extern rtx gen_move_insn PROTO((rtx, rtx));
805 extern rtx gen_jump PROTO((rtx));
806 extern rtx gen_beq PROTO((rtx));
807 extern rtx gen_bge PROTO((rtx));
808 extern rtx gen_ble PROTO((rtx));
809 extern rtx eliminate_constant_term PROTO((rtx, rtx *));
810 extern rtx expand_complex_abs PROTO((enum machine_mode, rtx, rtx, int));
811 extern enum machine_mode choose_hard_reg_mode PROTO((int, int));
813 /* Maximum number of parallel sets and clobbers in any insn in this fn.
814 Always at least 3, since the combiner could put that many togetherm
815 and we want this to remain correct for all the remaining passes. */
817 extern int max_parallel;
819 extern int asm_noperands PROTO((rtx));
820 extern char *decode_asm_operands PROTO((rtx, rtx *, rtx **, char **, enum machine_mode *));
822 extern enum reg_class reg_preferred_class PROTO((int));
823 extern enum reg_class reg_alternate_class PROTO((int));
825 extern rtx get_first_nonparm_insn PROTO((void));
827 /* Standard pieces of rtx, to be substituted directly into things. */
828 extern rtx pc_rtx;
829 extern rtx cc0_rtx;
830 extern rtx const0_rtx;
831 extern rtx const1_rtx;
832 extern rtx const2_rtx;
833 extern rtx constm1_rtx;
834 extern rtx const_true_rtx;
836 extern rtx const_tiny_rtx[3][(int) MAX_MACHINE_MODE];
838 /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
839 same as VOIDmode. */
841 #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
843 /* Likewise, for the constants 1 and 2. */
845 #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
846 #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
848 /* All references to certain hard regs, except those created
849 by allocating pseudo regs into them (when that's possible),
850 go through these unique rtx objects. */
851 extern rtx stack_pointer_rtx;
852 extern rtx frame_pointer_rtx;
853 extern rtx hard_frame_pointer_rtx;
854 extern rtx arg_pointer_rtx;
855 extern rtx pic_offset_table_rtx;
856 extern rtx struct_value_rtx;
857 extern rtx struct_value_incoming_rtx;
858 extern rtx static_chain_rtx;
859 extern rtx static_chain_incoming_rtx;
861 /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
862 is used to represent the frame pointer. This is because the
863 hard frame pointer and the automatic variables are separated by an amount
864 that cannot be determined until after register allocation. We can assume
865 that in this case ELIMINABLE_REGS will be defined, one action of which
866 will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
867 #ifndef HARD_FRAME_POINTER_REGNUM
868 #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
869 #endif
871 /* Virtual registers are used during RTL generation to refer to locations into
872 the stack frame when the actual location isn't known until RTL generation
873 is complete. The routine instantiate_virtual_regs replaces these with
874 the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
875 a constant. */
877 #define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
879 /* This points to the first word of the incoming arguments passed on the stack,
880 either by the caller or by the callee when pretending it was passed by the
881 caller. */
883 extern rtx virtual_incoming_args_rtx;
885 #define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
887 /* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
888 variable on the stack. Otherwise, it points to the first variable on
889 the stack. */
891 extern rtx virtual_stack_vars_rtx;
893 #define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
895 /* This points to the location of dynamically-allocated memory on the stack
896 immediately after the stack pointer has been adjusted by the amount
897 desired. */
899 extern rtx virtual_stack_dynamic_rtx;
901 #define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
903 /* This points to the location in the stack at which outgoing arguments should
904 be written when the stack is pre-pushed (arguments pushed using push
905 insns always use sp). */
907 extern rtx virtual_outgoing_args_rtx;
909 #define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
911 #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 3)
913 extern rtx find_next_ref PROTO((rtx, rtx));
914 extern rtx *find_single_use PROTO((rtx, rtx, rtx *));
916 /* It is hard to write the prototype for expand_expr, since it needs
917 expr.h to be included for the enumeration. */
919 extern rtx expand_expr ();
921 extern rtx output_constant_def PROTO((union tree_node *));
922 extern rtx immed_real_const PROTO((union tree_node *));
923 extern union tree_node *make_tree PROTO((union tree_node *, rtx));
925 /* Define a default value for STORE_FLAG_VALUE. */
927 #ifndef STORE_FLAG_VALUE
928 #define STORE_FLAG_VALUE 1
929 #endif
931 /* Nonzero after end of reload pass.
932 Set to 1 or 0 by toplev.c. */
934 extern int reload_completed;
936 /* Set to 1 while reload_as_needed is operating.
937 Required by some machines to handle any generated moves differently. */
939 extern int reload_in_progress;
941 /* If this is nonzero, we do not bother generating VOLATILE
942 around volatile memory references, and we are willing to
943 output indirect addresses. If cse is to follow, we reject
944 indirect addresses so a useful potential cse is generated;
945 if it is used only once, instruction combination will produce
946 the same indirect address eventually. */
947 extern int cse_not_expected;
949 /* Indexed by pseudo register number, gives the rtx for that pseudo.
950 Allocated in parallel with regno_pointer_flag. */
951 extern rtx *regno_reg_rtx;
953 /* Translates rtx code to tree code, for those codes needed by
954 REAL_ARITHMETIC. The function returns an int because the caller may not
955 know what `enum tree_code' means. */
957 extern int rtx_to_tree_code PROTO((enum rtx_code));