1 /* Register Transfer Language (RTL) definitions for GNU C-Compiler
2 Copyright (C) 1987, 91, 92, 93, 94, 1995 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)
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, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
24 #undef FFS /* Some systems predefine this symbol; don't let it interfere. */
25 #undef FLOAT /* Likewise. */
26 #undef ABS /* Likewise. */
27 #undef PC /* Likewise. */
33 /* Register Transfer Language EXPRESSIONS CODES */
35 #define RTX_CODE enum rtx_code
38 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
39 #include "rtl.def" /* rtl expressions are documented here */
42 LAST_AND_UNUSED_RTX_CODE
}; /* A convenient way to get a value for
44 Assumes default enum value assignment. */
46 #define NUM_RTX_CODE ((int)LAST_AND_UNUSED_RTX_CODE)
47 /* The cast here, saves many elsewhere. */
49 extern int rtx_length
[];
50 #define GET_RTX_LENGTH(CODE) (rtx_length[(int)(CODE)])
52 extern char *rtx_name
[];
53 #define GET_RTX_NAME(CODE) (rtx_name[(int)(CODE)])
55 extern char *rtx_format
[];
56 #define GET_RTX_FORMAT(CODE) (rtx_format[(int)(CODE)])
58 extern char rtx_class
[];
59 #define GET_RTX_CLASS(CODE) (rtx_class[(int)(CODE)])
61 /* Common union for an element of an rtx. */
63 typedef union rtunion_def
69 struct rtvec_def
*rtvec
;
70 enum machine_mode rttype
;
73 /* RTL expression ("rtx"). */
75 typedef struct rtx_def
77 #ifdef ONLY_INT_FIELDS
79 unsigned int code
: 16;
84 /* The kind of expression this is. */
85 enum rtx_code code
: 16;
87 /* The kind of value the expression has. */
88 #ifdef ONLY_INT_FIELDS
91 enum machine_mode mode
: 8;
93 /* 1 in an INSN if it can alter flow of control
94 within this function. Not yet used! */
95 unsigned int jump
: 1;
96 /* 1 in an INSN if it can call another function. Not yet used! */
97 unsigned int call
: 1;
98 /* 1 in a MEM or REG if value of this expression will never change
99 during the current function, even though it is not
101 1 in a SUBREG if it is from a promoted variable that is unsigned.
102 1 in a SYMBOL_REF if it addresses something in the per-function
104 1 in a CALL_INSN if it is a const call.
105 1 in a JUMP_INSN if it is a branch that should be annulled. Valid from
106 reorg until end of compilation; cleared before used. */
107 unsigned int unchanging
: 1;
108 /* 1 in a MEM expression if contents of memory are volatile.
109 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL or BARRIER
111 1 in a REG expression if corresponds to a variable declared by the user.
112 0 for an internally generated temporary.
113 In a SYMBOL_REF, this flag is used for machine-specific purposes.
114 In a LABEL_REF or in a REG_LABEL note, this is LABEL_REF_NONLOCAL_P. */
115 unsigned int volatil
: 1;
116 /* 1 in a MEM referring to a field of a structure (not a union!).
117 0 if the MEM was a variable or the result of a * operator in C;
118 1 if it was the result of a . or -> operator (on a struct) in C.
119 1 in a REG if the register is used only in exit code a loop.
120 1 in a SUBREG expression if was generated from a variable with a
122 1 in a CODE_LABEL if the label is used for nonlocal gotos
123 and must not be deleted even if its count is zero.
124 1 in a LABEL_REF if this is a reference to a label outside the
126 1 in an INSN, JUMP_INSN, or CALL_INSN if this insn must be scheduled
127 together with the preceding insn. Valid only within sched.
128 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
129 from the target of a branch. Valid from reorg until end of compilation;
130 cleared before used. */
131 unsigned int in_struct
: 1;
132 /* 1 if this rtx is used. This is used for copying shared structure.
133 See `unshare_all_rtl'.
134 In a REG, this is not needed for that purpose, and used instead
135 in `leaf_renumber_regs_insn'.
136 In a SYMBOL_REF, means that emit_library_call
137 has used it as the function. */
138 unsigned int used
: 1;
139 /* Nonzero if this rtx came from procedure integration.
140 In a REG, nonzero means this reg refers to the return value
141 of the current function. */
142 unsigned integrated
: 1;
143 /* The first element of the operands of this rtx.
144 The number of operands and their types are controlled
145 by the `code' field, according to rtl.def. */
150 /* Add prototype support. */
152 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
153 #define PROTO(ARGS) ARGS
155 #define PROTO(ARGS) ()
161 #define PVPROTO(ARGS) ARGS
162 #define VPROTO(ARGS) ARGS
163 #define VA_START(va_list,var) va_start(va_list,var)
165 #define PVPROTO(ARGS) ()
166 #define VPROTO(ARGS) (va_alist) va_dcl
167 #define VA_START(va_list,var) va_start(va_list)
173 #define STDIO_PROTO(ARGS) PROTO(ARGS)
175 #define STDIO_PROTO(ARGS) ()
179 #define NULL_RTX (rtx) 0
181 /* Define a generic NULL if one hasn't already been defined. */
188 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
189 #define GENERIC_PTR void *
191 #define GENERIC_PTR char *
196 #define NULL_PTR ((GENERIC_PTR)0)
199 /* Define macros to access the `code' field of the rtx. */
201 #ifdef SHORT_ENUM_BUG
202 #define GET_CODE(RTX) ((enum rtx_code) ((RTX)->code))
203 #define PUT_CODE(RTX, CODE) ((RTX)->code = ((short) (CODE)))
205 #define GET_CODE(RTX) ((RTX)->code)
206 #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
209 #define GET_MODE(RTX) ((RTX)->mode)
210 #define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))
212 #define RTX_INTEGRATED_P(RTX) ((RTX)->integrated)
213 #define RTX_UNCHANGING_P(RTX) ((RTX)->unchanging)
215 /* RTL vector. These appear inside RTX's when there is a need
216 for a variable number of things. The principle use is inside
217 PARALLEL expressions. */
219 typedef struct rtvec_def
{
220 unsigned num_elem
; /* number of elements */
224 #define NULL_RTVEC (rtvec) 0
226 #define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
227 #define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (unsigned) NUM)
229 #define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[(I)].rtx)
231 /* 1 if X is a REG. */
233 #define REG_P(X) (GET_CODE (X) == REG)
235 /* 1 if X is a constant value that is an integer. */
237 #define CONSTANT_P(X) \
238 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
239 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST_DOUBLE \
240 || GET_CODE (X) == CONST || GET_CODE (X) == HIGH)
242 /* General accessor macros for accessing the fields of an rtx. */
244 #define XEXP(RTX, N) ((RTX)->fld[N].rtx)
245 #define XINT(RTX, N) ((RTX)->fld[N].rtint)
246 #define XWINT(RTX, N) ((RTX)->fld[N].rtwint)
247 #define XSTR(RTX, N) ((RTX)->fld[N].rtstr)
248 #define XVEC(RTX, N) ((RTX)->fld[N].rtvec)
249 #define XVECLEN(RTX, N) ((RTX)->fld[N].rtvec->num_elem)
250 #define XVECEXP(RTX,N,M)((RTX)->fld[N].rtvec->elem[M].rtx)
252 /* ACCESS MACROS for particular fields of insns. */
254 /* Holds a unique number for each insn.
255 These are not necessarily sequentially increasing. */
256 #define INSN_UID(INSN) ((INSN)->fld[0].rtint)
258 /* Chain insns together in sequence. */
259 #define PREV_INSN(INSN) ((INSN)->fld[1].rtx)
260 #define NEXT_INSN(INSN) ((INSN)->fld[2].rtx)
262 /* The body of an insn. */
263 #define PATTERN(INSN) ((INSN)->fld[3].rtx)
265 /* Code number of instruction, from when it was recognized.
266 -1 means this instruction has not been recognized yet. */
267 #define INSN_CODE(INSN) ((INSN)->fld[4].rtint)
269 /* Set up in flow.c; empty before then.
270 Holds a chain of INSN_LIST rtx's whose first operands point at
271 previous insns with direct data-flow connections to this one.
272 That means that those insns set variables whose next use is in this insn.
273 They are always in the same basic block as this insn. */
274 #define LOG_LINKS(INSN) ((INSN)->fld[5].rtx)
276 /* 1 if insn has been deleted. */
277 #define INSN_DELETED_P(INSN) ((INSN)->volatil)
279 /* 1 if insn is a call to a const function. */
280 #define CONST_CALL_P(INSN) ((INSN)->unchanging)
282 /* 1 if insn is a branch that should not unconditionally execute its
283 delay slots, i.e., it is an annulled branch. */
284 #define INSN_ANNULLED_BRANCH_P(INSN) ((INSN)->unchanging)
286 /* 1 if insn is in a delay slot and is from the target of the branch. If
287 the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
288 executed if the branch is taken. For annulled branches with this bit
289 clear, the insn should be executed only if the branch is not taken. */
290 #define INSN_FROM_TARGET_P(INSN) ((INSN)->in_struct)
292 /* Holds a list of notes on what this insn does to various REGs.
293 It is a chain of EXPR_LIST rtx's, where the second operand
294 is the chain pointer and the first operand is the REG being described.
295 The mode field of the EXPR_LIST contains not a real machine mode
296 but a value that says what this note says about the REG:
297 REG_DEAD means that the value in REG dies in this insn (i.e., it is
298 not needed past this insn). If REG is set in this insn, the REG_DEAD
299 note may, but need not, be omitted.
300 REG_INC means that the REG is autoincremented or autodecremented.
301 REG_EQUIV describes the insn as a whole; it says that the
302 insn sets a register to a constant value or to be equivalent to
303 a memory address. If the
304 register is spilled to the stack then the constant value
305 should be substituted for it. The contents of the REG_EQUIV
306 is the constant value or memory address, which may be different
307 from the source of the SET although it has the same value.
308 REG_EQUAL is like REG_EQUIV except that the destination
309 is only momentarily equal to the specified rtx. Therefore, it
310 cannot be used for substitution; but it can be used for cse.
311 REG_RETVAL means that this insn copies the return-value of
312 a library call out of the hard reg for return values. This note
313 is actually an INSN_LIST and it points to the first insn involved
314 in setting up arguments for the call. flow.c uses this to delete
315 the entire library call when its result is dead.
316 REG_LIBCALL is the inverse of REG_RETVAL: it goes on the first insn
317 of the library call and points at the one that has the REG_RETVAL.
318 REG_WAS_0 says that the register set in this insn held 0 before the insn.
319 The contents of the note is the insn that stored the 0.
320 If that insn is deleted or patched to a NOTE, the REG_WAS_0 is inoperative.
321 The REG_WAS_0 note is actually an INSN_LIST, not an EXPR_LIST.
322 REG_NONNEG means that the register is always nonnegative during
323 the containing loop. This is used in branches so that decrement and
324 branch instructions terminating on zero can be matched. There must be
325 an insn pattern in the md file named `decrement_and_branch_until_zero'
326 or else this will never be added to any instructions.
327 REG_NO_CONFLICT means there is no conflict *after this insn*
328 between the register in the note and the destination of this insn.
329 REG_UNUSED identifies a register set in this insn and never used.
330 REG_CC_SETTER and REG_CC_USER link a pair of insns that set and use
331 CC0, respectively. Normally, these are required to be consecutive insns,
332 but we permit putting a cc0-setting insn in the delay slot of a branch
333 as long as only one copy of the insn exists. In that case, these notes
334 point from one to the other to allow code generation to determine what
335 any require information and to properly update CC_STATUS.
336 REG_LABEL points to a CODE_LABEL. Used by non-JUMP_INSNs to
337 say that the CODE_LABEL contained in the REG_LABEL note is used
339 REG_DEP_ANTI is used in LOG_LINKS which represent anti (write after read)
340 dependencies. REG_DEP_OUTPUT is used in LOG_LINKS which represent output
341 (write after write) dependencies. Data dependencies, which are the only
342 type of LOG_LINK created by flow, are represented by a 0 reg note kind. */
344 #define REG_NOTES(INSN) ((INSN)->fld[6].rtx)
346 /* Don't forget to change reg_note_name in rtl.c. */
347 enum reg_note
{ REG_DEAD
= 1, REG_INC
= 2, REG_EQUIV
= 3, REG_WAS_0
= 4,
348 REG_EQUAL
= 5, REG_RETVAL
= 6, REG_LIBCALL
= 7,
349 REG_NONNEG
= 8, REG_NO_CONFLICT
= 9, REG_UNUSED
= 10,
350 REG_CC_SETTER
= 11, REG_CC_USER
= 12, REG_LABEL
= 13,
351 REG_DEP_ANTI
= 14, REG_DEP_OUTPUT
= 15 };
353 /* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
354 #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
355 #define PUT_REG_NOTE_KIND(LINK,KIND) PUT_MODE(LINK, (enum machine_mode) (KIND))
357 /* Names for REG_NOTE's in EXPR_LIST insn's. */
359 extern char *reg_note_name
[];
360 #define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int)(MODE)])
362 /* This field is only present on CALL_INSNs. It holds a chain of EXPR_LIST of
363 USE and CLOBBER expressions.
364 USE expressions list the registers filled with arguments that
365 are passed to the function.
366 CLOBBER expressions document the registers explicitly clobbered
368 Pseudo registers can not be mentioned in this list. */
369 #define CALL_INSN_FUNCTION_USAGE(INSN) ((INSN)->fld[7].rtx)
371 /* The label-number of a code-label. The assembler label
372 is made from `L' and the label-number printed in decimal.
373 Label numbers are unique in a compilation. */
374 #define CODE_LABEL_NUMBER(INSN) ((INSN)->fld[3].rtint)
376 #define LINE_NUMBER NOTE
378 /* In a NOTE that is a line number, this is a string for the file name
379 that the line is in. We use the same field to record block numbers
380 temporarily in NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes.
381 (We avoid lots of casts between ints and pointers if we use a
382 different macro for the bock number.) */
384 #define NOTE_SOURCE_FILE(INSN) ((INSN)->fld[3].rtstr)
385 #define NOTE_BLOCK_NUMBER(INSN) ((INSN)->fld[3].rtint)
387 /* In a NOTE that is a line number, this is the line number.
388 Other kinds of NOTEs are identified by negative numbers here. */
389 #define NOTE_LINE_NUMBER(INSN) ((INSN)->fld[4].rtint)
391 /* Codes that appear in the NOTE_LINE_NUMBER field
392 for kinds of notes that are not line numbers.
394 Notice that we do not try to use zero here for any of
395 the special note codes because sometimes the source line
396 actually can be zero! This happens (for example) when we
397 are generating code for the per-translation-unit constructor
398 and destructor routines for some C++ translation unit.
400 If you should change any of the following values, or if you
401 should add a new value here, don't forget to change the
402 note_insn_name array in rtl.c. */
404 /* This note is used to get rid of an insn
405 when it isn't safe to patch the insn out of the chain. */
406 #define NOTE_INSN_DELETED -1
407 #define NOTE_INSN_BLOCK_BEG -2
408 #define NOTE_INSN_BLOCK_END -3
409 #define NOTE_INSN_LOOP_BEG -4
410 #define NOTE_INSN_LOOP_END -5
411 /* This kind of note is generated at the end of the function body,
412 just before the return insn or return label.
413 In an optimizing compilation it is deleted by the first jump optimization,
414 after enabling that optimizer to determine whether control can fall
415 off the end of the function body without a return statement. */
416 #define NOTE_INSN_FUNCTION_END -6
417 /* This kind of note is generated just after each call to `setjmp', et al. */
418 #define NOTE_INSN_SETJMP -7
419 /* Generated at the place in a loop that `continue' jumps to. */
420 #define NOTE_INSN_LOOP_CONT -8
421 /* Generated at the start of a duplicated exit test. */
422 #define NOTE_INSN_LOOP_VTOP -9
423 /* This marks the point immediately after the last prologue insn. */
424 #define NOTE_INSN_PROLOGUE_END -10
425 /* This marks the point immediately prior to the first epilogue insn. */
426 #define NOTE_INSN_EPILOGUE_BEG -11
427 /* Generated in place of user-declared labels when they are deleted. */
428 #define NOTE_INSN_DELETED_LABEL -12
429 /* This note indicates the start of the real body of the function,
430 i.e. the point just after all of the parms have been moved into
432 #define NOTE_INSN_FUNCTION_BEG -13
435 #if 0 /* These are not used, and I don't know what they were for. --rms. */
436 #define NOTE_DECL_NAME(INSN) ((INSN)->fld[3].rtstr)
437 #define NOTE_DECL_CODE(INSN) ((INSN)->fld[4].rtint)
438 #define NOTE_DECL_RTL(INSN) ((INSN)->fld[5].rtx)
439 #define NOTE_DECL_IDENTIFIER(INSN) ((INSN)->fld[6].rtint)
440 #define NOTE_DECL_TYPE(INSN) ((INSN)->fld[7].rtint)
443 /* Names for NOTE insn's other than line numbers. */
445 extern char *note_insn_name
[];
446 #define GET_NOTE_INSN_NAME(NOTE_CODE) (note_insn_name[-(NOTE_CODE)])
448 /* The name of a label, in case it corresponds to an explicit label
449 in the input source code. */
450 #define LABEL_NAME(LABEL) ((LABEL)->fld[4].rtstr)
452 /* In jump.c, each label contains a count of the number
453 of LABEL_REFs that point at it, so unused labels can be deleted. */
454 #define LABEL_NUSES(LABEL) ((LABEL)->fld[5].rtint)
456 /* The rest is used instead of the above, in a CODE_LABEL,
457 if bytecode is being output.
458 We make the slightly kludgy assumption that a LABEL has enough slots
459 to hold these things. That happens to be true. */
461 /* For static or external objects. */
462 #define BYTECODE_LABEL(X) (XEXP ((X), 0))
464 /* For goto labels inside bytecode functions. */
465 #define BYTECODE_BC_LABEL(X) (*(struct bc_label **) &XEXP ((X), 1))
467 /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
468 so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
469 be decremented and possibly the label can be deleted. */
470 #define JUMP_LABEL(INSN) ((INSN)->fld[7].rtx)
472 /* Once basic blocks are found in flow.c,
473 each CODE_LABEL starts a chain that goes through
474 all the LABEL_REFs that jump to that label.
475 The chain eventually winds up at the CODE_LABEL; it is circular. */
476 #define LABEL_REFS(LABEL) ((LABEL)->fld[5].rtx)
478 /* This is the field in the LABEL_REF through which the circular chain
479 of references to a particular label is linked.
480 This chain is set up in flow.c. */
482 #define LABEL_NEXTREF(REF) ((REF)->fld[1].rtx)
484 /* Once basic blocks are found in flow.c,
485 Each LABEL_REF points to its containing instruction with this field. */
487 #define CONTAINING_INSN(RTX) ((RTX)->fld[2].rtx)
489 /* For a REG rtx, REGNO extracts the register number. */
491 #define REGNO(RTX) ((RTX)->fld[0].rtint)
493 /* For a REG rtx, REG_FUNCTION_VALUE_P is nonzero if the reg
494 is the current function's return value. */
496 #define REG_FUNCTION_VALUE_P(RTX) ((RTX)->integrated)
498 /* 1 in a REG rtx if it corresponds to a variable declared by the user. */
499 #define REG_USERVAR_P(RTX) ((RTX)->volatil)
501 /* For a CONST_INT rtx, INTVAL extracts the integer. */
503 #define INTVAL(RTX) ((RTX)->fld[0].rtwint)
505 /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
506 SUBREG_WORD extracts the word-number. */
508 #define SUBREG_REG(RTX) ((RTX)->fld[0].rtx)
509 #define SUBREG_WORD(RTX) ((RTX)->fld[1].rtint)
511 /* 1 if the REG contained in SUBREG_REG is already known to be
512 sign- or zero-extended from the mode of the SUBREG to the mode of
513 the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
516 When used as a LHS, is means that this extension must be done
517 when assigning to SUBREG_REG. */
519 #define SUBREG_PROMOTED_VAR_P(RTX) ((RTX)->in_struct)
520 #define SUBREG_PROMOTED_UNSIGNED_P(RTX) ((RTX)->unchanging)
522 /* Access various components of an ASM_OPERANDS rtx. */
524 #define ASM_OPERANDS_TEMPLATE(RTX) XSTR ((RTX), 0)
525 #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XSTR ((RTX), 1)
526 #define ASM_OPERANDS_OUTPUT_IDX(RTX) XINT ((RTX), 2)
527 #define ASM_OPERANDS_INPUT_VEC(RTX) XVEC ((RTX), 3)
528 #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XVEC ((RTX), 4)
529 #define ASM_OPERANDS_INPUT(RTX, N) XVECEXP ((RTX), 3, (N))
530 #define ASM_OPERANDS_INPUT_LENGTH(RTX) XVECLEN ((RTX), 3)
531 #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) XSTR (XVECEXP ((RTX), 4, (N)), 0)
532 #define ASM_OPERANDS_INPUT_MODE(RTX, N) GET_MODE (XVECEXP ((RTX), 4, (N)))
533 #define ASM_OPERANDS_SOURCE_FILE(RTX) XSTR ((RTX), 5)
534 #define ASM_OPERANDS_SOURCE_LINE(RTX) XINT ((RTX), 6)
536 /* For a MEM rtx, 1 if it's a volatile reference.
537 Also in an ASM_OPERANDS rtx. */
538 #define MEM_VOLATILE_P(RTX) ((RTX)->volatil)
540 /* For a MEM rtx, 1 if it refers to a structure or union component. */
541 #define MEM_IN_STRUCT_P(RTX) ((RTX)->in_struct)
543 /* For a LABEL_REF, 1 means that this reference is to a label outside the
544 loop containing the reference. */
545 #define LABEL_OUTSIDE_LOOP_P(RTX) ((RTX)->in_struct)
547 /* For a LABEL_REF, 1 means it is for a nonlocal label. */
548 /* Likewise in an EXPR_LIST for a REG_LABEL note. */
549 #define LABEL_REF_NONLOCAL_P(RTX) ((RTX)->volatil)
551 /* For a CODE_LABEL, 1 means always consider this label to be needed. */
552 #define LABEL_PRESERVE_P(RTX) ((RTX)->in_struct)
554 /* For a REG, 1 means the register is used only in an exit test of a loop. */
555 #define REG_LOOP_TEST_P(RTX) ((RTX)->in_struct)
557 /* During sched, for an insn, 1 means that the insn must be scheduled together
558 with the preceding insn. */
559 #define SCHED_GROUP_P(INSN) ((INSN)->in_struct)
561 /* During sched, for the LOG_LINKS of an insn, these cache the adjusted
562 cost of the dependence link. The cost of executing an instruction
563 may vary based on how the results are used. LINK_COST_ZERO is 1 when
564 the cost through the link varies and is unchanged (i.e., the link has
565 zero additional cost). LINK_COST_FREE is 1 when the cost through the
566 link is zero (i.e., the link makes the cost free). In other cases,
567 the adjustment to the cost is recomputed each time it is needed. */
568 #define LINK_COST_ZERO(X) ((X)->jump)
569 #define LINK_COST_FREE(X) ((X)->call)
571 /* For a SET rtx, SET_DEST is the place that is set
572 and SET_SRC is the value it is set to. */
573 #define SET_DEST(RTX) ((RTX)->fld[0].rtx)
574 #define SET_SRC(RTX) ((RTX)->fld[1].rtx)
576 /* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
577 #define TRAP_CONDITION(RTX) ((RTX)->fld[0].rtx)
579 /* 1 in a SYMBOL_REF if it addresses this function's constants pool. */
580 #define CONSTANT_POOL_ADDRESS_P(RTX) ((RTX)->unchanging)
582 /* Flag in a SYMBOL_REF for machine-specific purposes. */
583 #define SYMBOL_REF_FLAG(RTX) ((RTX)->volatil)
585 /* 1 means a SYMBOL_REF has been the library function in emit_library_call. */
586 #define SYMBOL_REF_USED(RTX) ((RTX)->used)
588 /* For an INLINE_HEADER rtx, FIRST_FUNCTION_INSN is the first insn
589 of the function that is not involved in copying parameters to
590 pseudo-registers. FIRST_PARM_INSN is the very first insn of
591 the function, including the parameter copying.
592 We keep this around in case we must splice
593 this function into the assembly code at the end of the file.
594 FIRST_LABELNO is the first label number used by the function (inclusive).
595 LAST_LABELNO is the last label used by the function (exclusive).
596 MAX_REGNUM is the largest pseudo-register used by that function.
597 FUNCTION_ARGS_SIZE is the size of the argument block in the stack.
598 POPS_ARGS is the number of bytes of input arguments popped by the function
599 STACK_SLOT_LIST is the list of stack slots.
600 FORCED_LABELS is the list of labels whose address was taken.
601 FUNCTION_FLAGS are where single-bit flags are saved.
602 OUTGOING_ARGS_SIZE is the size of the largest outgoing stack parameter list.
603 ORIGINAL_ARG_VECTOR is a vector of the original DECL_RTX values
604 for the function arguments.
605 ORIGINAL_DECL_INITIAL is a pointer to the original DECL_INITIAL for the
608 We want this to lay down like an INSN. The PREV_INSN field
609 is always NULL. The NEXT_INSN field always points to the
610 first function insn of the function being squirreled away. */
612 #define FIRST_FUNCTION_INSN(RTX) ((RTX)->fld[2].rtx)
613 #define FIRST_PARM_INSN(RTX) ((RTX)->fld[3].rtx)
614 #define FIRST_LABELNO(RTX) ((RTX)->fld[4].rtint)
615 #define LAST_LABELNO(RTX) ((RTX)->fld[5].rtint)
616 #define MAX_PARMREG(RTX) ((RTX)->fld[6].rtint)
617 #define MAX_REGNUM(RTX) ((RTX)->fld[7].rtint)
618 #define FUNCTION_ARGS_SIZE(RTX) ((RTX)->fld[8].rtint)
619 #define POPS_ARGS(RTX) ((RTX)->fld[9].rtint)
620 #define STACK_SLOT_LIST(RTX) ((RTX)->fld[10].rtx)
621 #define FORCED_LABELS(RTX) ((RTX)->fld[11].rtx)
622 #define FUNCTION_FLAGS(RTX) ((RTX)->fld[12].rtint)
623 #define OUTGOING_ARGS_SIZE(RTX) ((RTX)->fld[13].rtint)
624 #define ORIGINAL_ARG_VECTOR(RTX) ((RTX)->fld[14].rtvec)
625 #define ORIGINAL_DECL_INITIAL(RTX) ((RTX)->fld[15].rtx)
627 /* In FUNCTION_FLAGS we save some variables computed when emitting the code
628 for the function and which must be `or'ed into the current flag values when
629 insns from that function are being inlined. */
631 /* These ought to be an enum, but non-ANSI compilers don't like that. */
632 #define FUNCTION_FLAGS_CALLS_ALLOCA 01
633 #define FUNCTION_FLAGS_CALLS_SETJMP 02
634 #define FUNCTION_FLAGS_RETURNS_STRUCT 04
635 #define FUNCTION_FLAGS_RETURNS_PCC_STRUCT 010
636 #define FUNCTION_FLAGS_NEEDS_CONTEXT 020
637 #define FUNCTION_FLAGS_HAS_NONLOCAL_LABEL 040
638 #define FUNCTION_FLAGS_RETURNS_POINTER 0100
639 #define FUNCTION_FLAGS_USES_CONST_POOL 0200
640 #define FUNCTION_FLAGS_CALLS_LONGJMP 0400
641 #define FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE 01000
643 /* Define a macro to look for REG_INC notes,
644 but save time on machines where they never exist. */
646 /* Don't continue this line--convex cc version 4.1 would lose. */
647 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
648 #define FIND_REG_INC_NOTE(insn, reg) (find_reg_note ((insn), REG_INC, (reg)))
650 #define FIND_REG_INC_NOTE(insn, reg) 0
653 /* Indicate whether the machine has any sort of auto increment addressing.
654 If not, we can avoid checking for REG_INC notes. */
656 /* Don't continue this line--convex cc version 4.1 would lose. */
657 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
661 /* Generally useful functions. */
663 /* The following functions accept a wide integer argument. Rather than
664 having to cast on every function call, we use a macro instead, that is
665 defined here and in tree.h. */
668 #define exact_log2(N) exact_log2_wide ((HOST_WIDE_INT) (N))
669 #define floor_log2(N) floor_log2_wide ((HOST_WIDE_INT) (N))
672 #define plus_constant(X,C) plus_constant_wide (X, (HOST_WIDE_INT) (C))
674 #define plus_constant_for_output(X,C) \
675 plus_constant_for_output_wide (X, (HOST_WIDE_INT) (C))
677 extern rtx plus_constant_wide
PROTO((rtx
, HOST_WIDE_INT
));
678 extern rtx plus_constant_for_output_wide
PROTO((rtx
, HOST_WIDE_INT
));
680 #define GEN_INT(N) gen_rtx (CONST_INT, VOIDmode, (HOST_WIDE_INT) (N))
682 extern rtx
bc_gen_rtx ();
684 extern rtx gen_rtx
PVPROTO((enum rtx_code
,
685 enum machine_mode
, ...));
686 extern rtvec gen_rtvec
PVPROTO((int, ...));
688 extern rtx read_rtx
STDIO_PROTO((FILE *));
691 /* At present, don't prototype xrealloc, since all of the callers don't
692 cast their pointers to char *, and all of the xrealloc's don't use
694 extern char *xmalloc
PROTO((size_t));
695 extern char *xrealloc
PROTO((void *, size_t));
697 extern char *xmalloc ();
698 extern char *xrealloc ();
701 extern char *oballoc
PROTO((int));
702 extern char *permalloc
PROTO((int));
703 extern void free
PROTO((void *));
704 extern rtx rtx_alloc
PROTO((RTX_CODE
));
705 extern rtvec rtvec_alloc
PROTO((int));
706 extern rtx find_reg_note
PROTO((rtx
, enum reg_note
, rtx
));
707 extern rtx find_regno_note
PROTO((rtx
, enum reg_note
, int));
708 extern int find_reg_fusage
PROTO((rtx
, enum rtx_code
, rtx
));
709 extern int find_regno_fusage
PROTO((rtx
, enum rtx_code
, int));
710 extern HOST_WIDE_INT get_integer_term
PROTO((rtx
));
711 extern rtx get_related_value
PROTO((rtx
));
712 extern rtx single_set
PROTO((rtx
));
713 extern rtx find_last_value
PROTO((rtx
, rtx
*, rtx
));
714 extern rtx copy_rtx
PROTO((rtx
));
715 extern rtx copy_rtx_if_shared
PROTO((rtx
));
716 extern rtx copy_most_rtx
PROTO((rtx
, rtx
));
717 extern rtx replace_rtx
PROTO((rtx
, rtx
, rtx
));
718 extern rtvec gen_rtvec_v
PROTO((int, rtx
*));
719 extern rtx gen_reg_rtx
PROTO((enum machine_mode
));
720 extern rtx gen_label_rtx
PROTO((void));
721 extern rtx gen_inline_header_rtx
PROTO((rtx
, rtx
, int, int, int, int,
722 int, int, rtx
, rtx
, int, int,
724 extern rtx gen_lowpart_common
PROTO((enum machine_mode
, rtx
));
725 extern rtx gen_lowpart
PROTO((enum machine_mode
, rtx
));
726 extern rtx gen_lowpart_if_possible
PROTO((enum machine_mode
, rtx
));
727 extern rtx gen_highpart
PROTO((enum machine_mode
, rtx
));
728 extern rtx gen_realpart
PROTO((enum machine_mode
, rtx
));
729 extern rtx gen_imagpart
PROTO((enum machine_mode
, rtx
));
730 extern rtx operand_subword
PROTO((rtx
, int, int, enum machine_mode
));
731 extern rtx operand_subword_force
PROTO((rtx
, int, enum machine_mode
));
732 extern int subreg_lowpart_p
PROTO((rtx
));
733 extern rtx make_safe_from
PROTO((rtx
, rtx
));
734 extern rtx convert_memory_address
PROTO((enum machine_mode
, rtx
));
735 extern rtx memory_address
PROTO((enum machine_mode
, rtx
));
736 extern rtx get_insns
PROTO((void));
737 extern rtx get_last_insn
PROTO((void));
738 extern rtx get_last_insn_anywhere
PROTO((void));
739 extern void start_sequence
PROTO((void));
740 extern void push_to_sequence
PROTO((rtx
));
741 extern void end_sequence
PROTO((void));
742 extern rtx gen_sequence
PROTO((void));
743 extern rtx immed_double_const
PROTO((HOST_WIDE_INT
, HOST_WIDE_INT
, enum machine_mode
));
744 extern rtx force_const_mem
PROTO((enum machine_mode
, rtx
));
745 extern rtx force_reg
PROTO((enum machine_mode
, rtx
));
746 extern rtx get_pool_constant
PROTO((rtx
));
747 extern enum machine_mode get_pool_mode
PROTO((rtx
));
748 extern int get_pool_offset
PROTO((rtx
));
749 extern rtx simplify_subtraction
PROTO((rtx
));
750 extern rtx assign_stack_local
PROTO((enum machine_mode
, int, int));
751 extern rtx assign_stack_temp
PROTO((enum machine_mode
, int, int));
752 extern rtx protect_from_queue
PROTO((rtx
, int));
753 extern void emit_queue
PROTO((void));
754 extern rtx emit_move_insn
PROTO((rtx
, rtx
));
755 extern rtx emit_insn_before
PROTO((rtx
, rtx
));
756 extern rtx emit_jump_insn_before
PROTO((rtx
, rtx
));
757 extern rtx emit_call_insn_before
PROTO((rtx
, rtx
));
758 extern rtx emit_barrier_before
PROTO((rtx
));
759 extern rtx emit_note_before
PROTO((int, rtx
));
760 extern rtx emit_insn_after
PROTO((rtx
, rtx
));
761 extern rtx emit_jump_insn_after
PROTO((rtx
, rtx
));
762 extern rtx emit_barrier_after
PROTO((rtx
));
763 extern rtx emit_label_after
PROTO((rtx
, rtx
));
764 extern rtx emit_note_after
PROTO((int, rtx
));
765 extern rtx emit_line_note_after
PROTO((char *, int, rtx
));
766 extern rtx emit_insn
PROTO((rtx
));
767 extern rtx emit_insns
PROTO((rtx
));
768 extern rtx emit_insns_before
PROTO((rtx
, rtx
));
769 extern rtx emit_insns_after
PROTO((rtx
, rtx
));
770 extern rtx emit_jump_insn
PROTO((rtx
));
771 extern rtx emit_call_insn
PROTO((rtx
));
772 extern rtx emit_label
PROTO((rtx
));
773 extern rtx emit_barrier
PROTO((void));
774 extern rtx emit_line_note
PROTO((char *, int));
775 extern rtx emit_note
PROTO((char *, int));
776 extern rtx emit_line_note_force
PROTO((char *, int));
777 extern rtx make_insn_raw
PROTO((rtx
));
778 extern rtx previous_insn
PROTO((rtx
));
779 extern rtx next_insn
PROTO((rtx
));
780 extern rtx prev_nonnote_insn
PROTO((rtx
));
781 extern rtx next_nonnote_insn
PROTO((rtx
));
782 extern rtx prev_real_insn
PROTO((rtx
));
783 extern rtx next_real_insn
PROTO((rtx
));
784 extern rtx prev_active_insn
PROTO((rtx
));
785 extern rtx next_active_insn
PROTO((rtx
));
786 extern rtx prev_label
PROTO((rtx
));
787 extern rtx next_label
PROTO((rtx
));
788 extern rtx next_cc0_user
PROTO((rtx
));
789 extern rtx prev_cc0_setter
PROTO((rtx
));
790 extern rtx reg_set_last
PROTO((rtx
, rtx
));
791 extern rtx next_nondeleted_insn
PROTO((rtx
));
792 extern enum rtx_code reverse_condition
PROTO((enum rtx_code
));
793 extern enum rtx_code swap_condition
PROTO((enum rtx_code
));
794 extern enum rtx_code unsigned_condition
PROTO((enum rtx_code
));
795 extern enum rtx_code signed_condition
PROTO((enum rtx_code
));
796 extern rtx find_equiv_reg
PROTO((rtx
, rtx
, enum reg_class
, int, short *, int, enum machine_mode
));
797 extern rtx squeeze_notes
PROTO((rtx
, rtx
));
798 extern rtx delete_insn
PROTO((rtx
));
799 extern void delete_jump
PROTO((rtx
));
800 extern rtx get_label_before
PROTO((rtx
));
801 extern rtx get_label_after
PROTO((rtx
));
802 extern rtx follow_jumps
PROTO((rtx
));
803 extern rtx adj_offsettable_operand
PROTO((rtx
, int));
804 extern rtx try_split
PROTO((rtx
, rtx
, int));
805 extern rtx split_insns
PROTO((rtx
, rtx
));
806 extern rtx simplify_unary_operation
PROTO((enum rtx_code
, enum machine_mode
, rtx
, enum machine_mode
));
807 extern rtx simplify_binary_operation
PROTO((enum rtx_code
, enum machine_mode
, rtx
, rtx
));
808 extern rtx simplify_ternary_operation
PROTO((enum rtx_code
, enum machine_mode
, enum machine_mode
, rtx
, rtx
, rtx
));
809 extern rtx simplify_relational_operation
PROTO((enum rtx_code
, enum machine_mode
, rtx
, rtx
));
810 extern rtx nonlocal_label_rtx_list
PROTO((void));
811 extern rtx gen_move_insn
PROTO((rtx
, rtx
));
812 extern rtx gen_jump
PROTO((rtx
));
813 extern rtx gen_beq
PROTO((rtx
));
814 extern rtx gen_bge
PROTO((rtx
));
815 extern rtx gen_ble
PROTO((rtx
));
816 extern rtx eliminate_constant_term
PROTO((rtx
, rtx
*));
817 extern rtx expand_complex_abs
PROTO((enum machine_mode
, rtx
, rtx
, int));
818 extern enum machine_mode choose_hard_reg_mode
PROTO((int, int));
820 /* Maximum number of parallel sets and clobbers in any insn in this fn.
821 Always at least 3, since the combiner could put that many togetherm
822 and we want this to remain correct for all the remaining passes. */
824 extern int max_parallel
;
826 extern int asm_noperands
PROTO((rtx
));
827 extern char *decode_asm_operands
PROTO((rtx
, rtx
*, rtx
**, char **, enum machine_mode
*));
829 extern enum reg_class reg_preferred_class
PROTO((int));
830 extern enum reg_class reg_alternate_class
PROTO((int));
832 extern rtx get_first_nonparm_insn
PROTO((void));
834 /* Standard pieces of rtx, to be substituted directly into things. */
837 extern rtx const0_rtx
;
838 extern rtx const1_rtx
;
839 extern rtx const2_rtx
;
840 extern rtx constm1_rtx
;
841 extern rtx const_true_rtx
;
843 extern rtx const_tiny_rtx
[3][(int) MAX_MACHINE_MODE
];
845 /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
848 #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
850 /* Likewise, for the constants 1 and 2. */
852 #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
853 #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
855 /* All references to certain hard regs, except those created
856 by allocating pseudo regs into them (when that's possible),
857 go through these unique rtx objects. */
858 extern rtx stack_pointer_rtx
;
859 extern rtx frame_pointer_rtx
;
860 extern rtx hard_frame_pointer_rtx
;
861 extern rtx arg_pointer_rtx
;
862 extern rtx pic_offset_table_rtx
;
863 extern rtx struct_value_rtx
;
864 extern rtx struct_value_incoming_rtx
;
865 extern rtx static_chain_rtx
;
866 extern rtx static_chain_incoming_rtx
;
868 /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
869 is used to represent the frame pointer. This is because the
870 hard frame pointer and the automatic variables are separated by an amount
871 that cannot be determined until after register allocation. We can assume
872 that in this case ELIMINABLE_REGS will be defined, one action of which
873 will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
874 #ifndef HARD_FRAME_POINTER_REGNUM
875 #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
878 /* Virtual registers are used during RTL generation to refer to locations into
879 the stack frame when the actual location isn't known until RTL generation
880 is complete. The routine instantiate_virtual_regs replaces these with
881 the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
884 #define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
886 /* This points to the first word of the incoming arguments passed on the stack,
887 either by the caller or by the callee when pretending it was passed by the
890 extern rtx virtual_incoming_args_rtx
;
892 #define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
894 /* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
895 variable on the stack. Otherwise, it points to the first variable on
898 extern rtx virtual_stack_vars_rtx
;
900 #define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
902 /* This points to the location of dynamically-allocated memory on the stack
903 immediately after the stack pointer has been adjusted by the amount
906 extern rtx virtual_stack_dynamic_rtx
;
908 #define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
910 /* This points to the location in the stack at which outgoing arguments should
911 be written when the stack is pre-pushed (arguments pushed using push
912 insns always use sp). */
914 extern rtx virtual_outgoing_args_rtx
;
916 #define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
918 #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 3)
920 extern rtx find_next_ref
PROTO((rtx
, rtx
));
921 extern rtx
*find_single_use
PROTO((rtx
, rtx
, rtx
*));
923 /* It is hard to write the prototype for expand_expr, since it needs
924 expr.h to be included for the enumeration. */
926 extern rtx
expand_expr ();
928 extern rtx output_constant_def
PROTO((union tree_node
*));
929 extern rtx immed_real_const
PROTO((union tree_node
*));
930 extern union tree_node
*make_tree
PROTO((union tree_node
*, rtx
));
933 extern void fatal_insn_not_found
PROTO((rtx
));
934 extern void fatal_insn
PROTO((char *, rtx
));
936 /* Define a default value for STORE_FLAG_VALUE. */
938 #ifndef STORE_FLAG_VALUE
939 #define STORE_FLAG_VALUE 1
942 /* Nonzero after end of reload pass.
943 Set to 1 or 0 by toplev.c. */
945 extern int reload_completed
;
947 /* Set to 1 while reload_as_needed is operating.
948 Required by some machines to handle any generated moves differently. */
950 extern int reload_in_progress
;
952 /* If this is nonzero, we do not bother generating VOLATILE
953 around volatile memory references, and we are willing to
954 output indirect addresses. If cse is to follow, we reject
955 indirect addresses so a useful potential cse is generated;
956 if it is used only once, instruction combination will produce
957 the same indirect address eventually. */
958 extern int cse_not_expected
;
960 /* Indexed by pseudo register number, gives the rtx for that pseudo.
961 Allocated in parallel with regno_pointer_flag. */
962 extern rtx
*regno_reg_rtx
;
964 /* Translates rtx code to tree code, for those codes needed by
965 REAL_ARITHMETIC. The function returns an int because the caller may not
966 know what `enum tree_code' means. */
968 extern int rtx_to_tree_code
PROTO((enum rtx_code
));