1 /* Register Transfer Language (RTL) definitions for GNU C-Compiler
2 Copyright (C) 1987, 1991, 1992 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
23 #undef FFS /* Some systems predefine this symbol; don't let it interfere. */
24 #undef FLOAT /* Likewise. */
26 /* Register Transfer Language EXPRESSIONS CODES */
28 #define RTX_CODE enum rtx_code
31 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
32 #include "rtl.def" /* rtl expressions are documented here */
35 LAST_AND_UNUSED_RTX_CODE}; /* A convenient way to get a value for
37 Assumes default enum value assignment. */
39 #define NUM_RTX_CODE ((int)LAST_AND_UNUSED_RTX_CODE)
40 /* The cast here, saves many elsewhere. */
42 extern int rtx_length[];
43 #define GET_RTX_LENGTH(CODE) (rtx_length[(int)(CODE)])
45 extern char *rtx_name[];
46 #define GET_RTX_NAME(CODE) (rtx_name[(int)(CODE)])
48 extern char *rtx_format[];
49 #define GET_RTX_FORMAT(CODE) (rtx_format[(int)(CODE)])
51 extern char rtx_class[];
52 #define GET_RTX_CLASS(CODE) (rtx_class[(int)(CODE)])
54 /* Common union for an element of an rtx. */
56 typedef union rtunion_def
62 struct rtvec_def *rtvec;
63 enum machine_mode rttype;
66 /* RTL expression ("rtx"). */
68 typedef struct rtx_def
70 #ifdef ONLY_INT_FIELDS
73 /* The kind of expression this is. */
74 enum rtx_code code : 16;
76 /* The kind of value the expression has. */
77 #ifdef ONLY_INT_FIELDS
80 enum machine_mode mode : 8;
82 /* 1 in an INSN if it can alter flow of control
83 within this function. Not yet used! */
84 unsigned int jump : 1;
85 /* 1 in an INSN if it can call another function. Not yet used! */
86 unsigned int call : 1;
87 /* 1 in a MEM or REG if value of this expression will never change
88 during the current function, even though it is not
90 1 in a SUBREG if it is from a promoted variable that is unsigned.
91 1 in a SYMBOL_REF if it addresses something in the per-function
93 1 in a CALL_INSN if it is a const call.
94 1 in a JUMP_INSN if it is a branch that should be annulled. Valid from
95 reorg until end of compilation; cleared before used. */
96 unsigned int unchanging : 1;
97 /* 1 in a MEM expression if contents of memory are volatile.
98 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL or BARRIER
100 1 in a REG expression if corresponds to a variable declared by the user.
101 0 for an internally generated temporary.
102 In a SYMBOL_REF, this flag is used for machine-specific purposes. */
103 unsigned int volatil : 1;
104 /* 1 in a MEM referring to a field of a structure (not a union!).
105 0 if the MEM was a variable or the result of a * operator in C;
106 1 if it was the result of a . or -> operator (on a struct) in C.
107 1 in a REG if the register is used only in exit code a loop.
108 1 in a SUBREG expression if was generated from a variable with a
110 1 in a CODE_LABEL if the label is used for nonlocal gotos
111 and must not be deleted even if its count is zero.
112 1 in a LABEL_REF if this is a reference to a label outside the
114 1 in an INSN, JUMP_INSN, or CALL_INSN if this insn must be scheduled
115 together with the preceding insn. Valid only within sched.
116 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
117 from the target of a branch. Valid from reorg until end of compilation;
118 cleared before used. */
119 unsigned int in_struct : 1;
120 /* 1 if this rtx is used. This is used for copying shared structure.
121 See `unshare_all_rtl'.
122 In a REG, this is not needed for that purpose, and used instead
123 in `leaf_renumber_regs_insn'.
124 In a SYMBOL_REF, means that emit_library_call
125 has used it as the function. */
126 unsigned int used : 1;
127 /* Nonzero if this rtx came from procedure integration.
128 In a REG, nonzero means this reg refers to the return value
129 of the current function. */
130 unsigned integrated : 1;
131 /* The first element of the operands of this rtx.
132 The number of operands and their types are controlled
133 by the `code' field, according to rtl.def. */
137 /* Add prototype support. */
139 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
140 #define PROTO(ARGS) ARGS
142 #define PROTO(ARGS) ()
146 #define NULL_RTX (rtx) 0
148 /* Define a generic NULL if one hasn't already been defined. */
155 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
156 #define GENERIC_PTR void *
158 #define GENERIC_PTR char *
163 #define NULL_PTR ((GENERIC_PTR)0)
166 /* Define macros to access the `code' field of the rtx. */
168 #ifdef SHORT_ENUM_BUG
169 #define GET_CODE(RTX) ((enum rtx_code) ((RTX)->code))
170 #define PUT_CODE(RTX, CODE) ((RTX)->code = ((short) (CODE)))
172 #define GET_CODE(RTX) ((RTX)->code)
173 #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
176 #define GET_MODE(RTX) ((RTX)->mode)
177 #define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))
179 #define RTX_INTEGRATED_P(RTX) ((RTX)->integrated)
180 #define RTX_UNCHANGING_P(RTX) ((RTX)->unchanging)
182 /* RTL vector. These appear inside RTX's when there is a need
183 for a variable number of things. The principle use is inside
184 PARALLEL expressions. */
186 typedef struct rtvec_def{
187 unsigned num_elem; /* number of elements */
191 #define NULL_RTVEC (rtvec) 0
193 #define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
194 #define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (unsigned) NUM)
196 #define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[(I)].rtx)
198 /* 1 if X is a REG. */
200 #define REG_P(X) (GET_CODE (X) == REG)
202 /* 1 if X is a constant value that is an integer. */
204 #define CONSTANT_P(X) \
205 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
206 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST_DOUBLE \
207 || GET_CODE (X) == CONST || GET_CODE (X) == HIGH)
209 /* General accessor macros for accessing the fields of an rtx. */
211 #define XEXP(RTX, N) ((RTX)->fld[N].rtx)
212 #define XINT(RTX, N) ((RTX)->fld[N].rtint)
213 #define XWINT(RTX, N) ((RTX)->fld[N].rtwint)
214 #define XSTR(RTX, N) ((RTX)->fld[N].rtstr)
215 #define XVEC(RTX, N) ((RTX)->fld[N].rtvec)
216 #define XVECLEN(RTX, N) ((RTX)->fld[N].rtvec->num_elem)
217 #define XVECEXP(RTX,N,M)((RTX)->fld[N].rtvec->elem[M].rtx)
219 /* ACCESS MACROS for particular fields of insns. */
221 /* Holds a unique number for each insn.
222 These are not necessarily sequentially increasing. */
223 #define INSN_UID(INSN) ((INSN)->fld[0].rtint)
225 /* Chain insns together in sequence. */
226 #define PREV_INSN(INSN) ((INSN)->fld[1].rtx)
227 #define NEXT_INSN(INSN) ((INSN)->fld[2].rtx)
229 /* The body of an insn. */
230 #define PATTERN(INSN) ((INSN)->fld[3].rtx)
232 /* Code number of instruction, from when it was recognized.
233 -1 means this instruction has not been recognized yet. */
234 #define INSN_CODE(INSN) ((INSN)->fld[4].rtint)
236 /* Set up in flow.c; empty before then.
237 Holds a chain of INSN_LIST rtx's whose first operands point at
238 previous insns with direct data-flow connections to this one.
239 That means that those insns set variables whose next use is in this insn.
240 They are always in the same basic block as this insn. */
241 #define LOG_LINKS(INSN) ((INSN)->fld[5].rtx)
243 /* 1 if insn has been deleted. */
244 #define INSN_DELETED_P(INSN) ((INSN)->volatil)
246 /* 1 if insn is a call to a const function. */
247 #define CONST_CALL_P(INSN) ((INSN)->unchanging)
249 /* 1 if insn is a branch that should not unconditionally execute its
250 delay slots, i.e., it is an annulled branch. */
251 #define INSN_ANNULLED_BRANCH_P(INSN) ((INSN)->unchanging)
253 /* 1 if insn is in a delay slot and is from the target of the branch. If
254 the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
255 executed if the branch is taken. For annulled branches with this bit
256 clear, the insn should be executed only if the branch is not taken. */
257 #define INSN_FROM_TARGET_P(INSN) ((INSN)->in_struct)
259 /* Holds a list of notes on what this insn does to various REGs.
260 It is a chain of EXPR_LIST rtx's, where the second operand
261 is the chain pointer and the first operand is the REG being described.
262 The mode field of the EXPR_LIST contains not a real machine mode
263 but a value that says what this note says about the REG:
264 REG_DEAD means that the value in REG dies in this insn (i.e., it is
265 not needed past this insn). If REG is set in this insn, the REG_DEAD
266 note may, but need not, be omitted.
267 REG_INC means that the REG is autoincremented or autodecremented.
268 REG_EQUIV describes the insn as a whole; it says that the
269 insn sets a register to a constant value or to be equivalent to
270 a memory address. If the
271 register is spilled to the stack then the constant value
272 should be substituted for it. The contents of the REG_EQUIV
273 is the constant value or memory address, which may be different
274 from the source of the SET although it has the same value.
275 REG_EQUAL is like REG_EQUIV except that the destination
276 is only momentarily equal to the specified rtx. Therefore, it
277 cannot be used for substitution; but it can be used for cse.
278 REG_RETVAL means that this insn copies the return-value of
279 a library call out of the hard reg for return values. This note
280 is actually an INSN_LIST and it points to the first insn involved
281 in setting up arguments for the call. flow.c uses this to delete
282 the entire library call when its result is dead.
283 REG_LIBCALL is the inverse of REG_RETVAL: it goes on the first insn
284 of the library call and points at the one that has the REG_RETVAL.
285 REG_WAS_0 says that the register set in this insn held 0 before the insn.
286 The contents of the note is the insn that stored the 0.
287 If that insn is deleted or patched to a NOTE, the REG_WAS_0 is inoperative.
288 The REG_WAS_0 note is actually an INSN_LIST, not an EXPR_LIST.
289 REG_NONNEG means that the register is always nonnegative during
290 the containing loop. This is used in branches so that decrement and
291 branch instructions terminating on zero can be matched. There must be
292 an insn pattern in the md file named `decrement_and_branch_until_zero'
293 or else this will never be added to any instructions.
294 REG_NO_CONFLICT means there is no conflict *after this insn*
295 between the register in the note and the destination of this insn.
296 REG_UNUSED identifies a register set in this insn and never used.
297 REG_CC_SETTER and REG_CC_USER link a pair of insns that set and use
298 CC0, respectively. Normally, these are required to be consecutive insns,
299 but we permit putting a cc0-setting insn in the delay slot of a branch
300 as long as only one copy of the insn exists. In that case, these notes
301 point from one to the other to allow code generation to determine what
302 any require information and to properly update CC_STATUS.
303 REG_LABEL points to a CODE_LABEL. Used by non-JUMP_INSNs to
304 say that the CODE_LABEL contained in the REG_LABEL note is used
306 REG_DEP_ANTI is used in LOG_LINKS which represent anti (write after read)
307 dependencies. REG_DEP_OUTPUT is used in LOG_LINKS which represent output
308 (write after write) dependencies. Data dependencies, which are the only
309 type of LOG_LINK created by flow, are represented by a 0 reg note kind. */
311 #define REG_NOTES(INSN) ((INSN)->fld[6].rtx)
313 /* Don't forget to change reg_note_name in rtl.c. */
314 enum reg_note { REG_DEAD = 1, REG_INC = 2, REG_EQUIV = 3, REG_WAS_0 = 4,
315 REG_EQUAL = 5, REG_RETVAL = 6, REG_LIBCALL = 7,
316 REG_NONNEG = 8, REG_NO_CONFLICT = 9, REG_UNUSED = 10,
317 REG_CC_SETTER = 11, REG_CC_USER = 12, REG_LABEL = 13,
318 REG_DEP_ANTI = 14, REG_DEP_OUTPUT = 15 };
320 /* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
321 #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
322 #define PUT_REG_NOTE_KIND(LINK,KIND) PUT_MODE(LINK, (enum machine_mode) (KIND))
324 /* Names for REG_NOTE's in EXPR_LIST insn's. */
326 extern char *reg_note_name[];
327 #define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int)(MODE)])
329 /* The label-number of a code-label. The assembler label
330 is made from `L' and the label-number printed in decimal.
331 Label numbers are unique in a compilation. */
332 #define CODE_LABEL_NUMBER(INSN) ((INSN)->fld[3].rtint)
334 #define LINE_NUMBER NOTE
336 /* In a NOTE that is a line number, this is a string for the file name
337 that the line is in. We use the same field to record block numbers
338 temporarily in NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes.
339 (We avoid lots of casts between ints and pointers if we use a
340 different macro for the bock number.) */
342 #define NOTE_SOURCE_FILE(INSN) ((INSN)->fld[3].rtstr)
343 #define NOTE_BLOCK_NUMBER(INSN) ((INSN)->fld[3].rtint)
345 /* In a NOTE that is a line number, this is the line number.
346 Other kinds of NOTEs are identified by negative numbers here. */
347 #define NOTE_LINE_NUMBER(INSN) ((INSN)->fld[4].rtint)
349 /* Codes that appear in the NOTE_LINE_NUMBER field
350 for kinds of notes that are not line numbers. */
352 /* This note indicates the end of the real body of the function,
353 after moving the parms into their homes, etc. */
354 #define NOTE_INSN_FUNCTION_BEG 0
356 /* This note is used to get rid of an insn
357 when it isn't safe to patch the insn out of the chain. */
358 #define NOTE_INSN_DELETED -1
359 #define NOTE_INSN_BLOCK_BEG -2
360 #define NOTE_INSN_BLOCK_END -3
361 #define NOTE_INSN_LOOP_BEG -4
362 #define NOTE_INSN_LOOP_END -5
363 /* This kind of note is generated at the end of the function body,
364 just before the return insn or return label.
365 In an optimizing compilation it is deleted by the first jump optimization,
366 after enabling that optimizer to determine whether control can fall
367 off the end of the function body without a return statement. */
368 #define NOTE_INSN_FUNCTION_END -6
369 /* This kind of note is generated just after each call to `setjmp', et al. */
370 #define NOTE_INSN_SETJMP -7
371 /* Generated at the place in a loop that `continue' jumps to. */
372 #define NOTE_INSN_LOOP_CONT -8
373 /* Generated at the start of a duplicated exit test. */
374 #define NOTE_INSN_LOOP_VTOP -9
375 /* This marks the point immediately after the last prologue insn. */
376 #define NOTE_INSN_PROLOGUE_END -10
377 /* This marks the point immediately prior to the first epilogue insn. */
378 #define NOTE_INSN_EPILOGUE_BEG -11
379 /* Generated in place of user-declared labels when they are deleted. */
380 #define NOTE_INSN_DELETED_LABEL -12
381 /* Don't forget to change note_insn_name in rtl.c. */
384 #if 0 /* These are not used, and I don't know what they were for. --rms. */
385 #define NOTE_DECL_NAME(INSN) ((INSN)->fld[3].rtstr)
386 #define NOTE_DECL_CODE(INSN) ((INSN)->fld[4].rtint)
387 #define NOTE_DECL_RTL(INSN) ((INSN)->fld[5].rtx)
388 #define NOTE_DECL_IDENTIFIER(INSN) ((INSN)->fld[6].rtint)
389 #define NOTE_DECL_TYPE(INSN) ((INSN)->fld[7].rtint)
392 /* Names for NOTE insn's other than line numbers. */
394 extern char *note_insn_name[];
395 #define GET_NOTE_INSN_NAME(NOTE_CODE) (note_insn_name[-(NOTE_CODE)])
397 /* The name of a label, in case it corresponds to an explicit label
398 in the input source code. */
399 #define LABEL_NAME(LABEL) ((LABEL)->fld[4].rtstr)
401 /* In jump.c, each label contains a count of the number
402 of LABEL_REFs that point at it, so unused labels can be deleted. */
403 #define LABEL_NUSES(LABEL) ((LABEL)->fld[5].rtint)
405 /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
406 so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
407 be decremented and possibly the label can be deleted. */
408 #define JUMP_LABEL(INSN) ((INSN)->fld[7].rtx)
410 /* Once basic blocks are found in flow.c,
411 each CODE_LABEL starts a chain that goes through
412 all the LABEL_REFs that jump to that label.
413 The chain eventually winds up at the CODE_LABEL; it is circular. */
414 #define LABEL_REFS(LABEL) ((LABEL)->fld[5].rtx)
416 /* This is the field in the LABEL_REF through which the circular chain
417 of references to a particular label is linked.
418 This chain is set up in flow.c. */
420 #define LABEL_NEXTREF(REF) ((REF)->fld[1].rtx)
422 /* Once basic blocks are found in flow.c,
423 Each LABEL_REF points to its containing instruction with this field. */
425 #define CONTAINING_INSN(RTX) ((RTX)->fld[2].rtx)
427 /* For a REG rtx, REGNO extracts the register number. */
429 #define REGNO(RTX) ((RTX)->fld[0].rtint)
431 /* For a REG rtx, REG_FUNCTION_VALUE_P is nonzero if the reg
432 is the current function's return value. */
434 #define REG_FUNCTION_VALUE_P(RTX) ((RTX)->integrated)
436 /* 1 in a REG rtx if it corresponds to a variable declared by the user. */
437 #define REG_USERVAR_P(RTX) ((RTX)->volatil)
439 /* For a CONST_INT rtx, INTVAL extracts the integer. */
441 #define INTVAL(RTX) ((RTX)->fld[0].rtwint)
443 /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
444 SUBREG_WORD extracts the word-number. */
446 #define SUBREG_REG(RTX) ((RTX)->fld[0].rtx)
447 #define SUBREG_WORD(RTX) ((RTX)->fld[1].rtint)
449 /* 1 if the REG contained in SUBREG_REG is already known to be
450 sign- or zero-extended from the mode of the SUBREG to the mode of
451 the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
454 When used as a LHS, is means that this extension must be done
455 when assigning to SUBREG_REG. */
457 #define SUBREG_PROMOTED_VAR_P(RTX) ((RTX)->in_struct)
458 #define SUBREG_PROMOTED_UNSIGNED_P(RTX) ((RTX)->unchanging)
460 /* Access various components of an ASM_OPERANDS rtx. */
462 #define ASM_OPERANDS_TEMPLATE(RTX) XSTR ((RTX), 0)
463 #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XSTR ((RTX), 1)
464 #define ASM_OPERANDS_OUTPUT_IDX(RTX) XINT ((RTX), 2)
465 #define ASM_OPERANDS_INPUT_VEC(RTX) XVEC ((RTX), 3)
466 #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XVEC ((RTX), 4)
467 #define ASM_OPERANDS_INPUT(RTX, N) XVECEXP ((RTX), 3, (N))
468 #define ASM_OPERANDS_INPUT_LENGTH(RTX) XVECLEN ((RTX), 3)
469 #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) XSTR (XVECEXP ((RTX), 4, (N)), 0)
470 #define ASM_OPERANDS_INPUT_MODE(RTX, N) GET_MODE (XVECEXP ((RTX), 4, (N)))
471 #define ASM_OPERANDS_SOURCE_FILE(RTX) XSTR ((RTX), 5)
472 #define ASM_OPERANDS_SOURCE_LINE(RTX) XINT ((RTX), 6)
474 /* For a MEM rtx, 1 if it's a volatile reference.
475 Also in an ASM_OPERANDS rtx. */
476 #define MEM_VOLATILE_P(RTX) ((RTX)->volatil)
478 /* For a MEM rtx, 1 if it refers to a structure or union component. */
479 #define MEM_IN_STRUCT_P(RTX) ((RTX)->in_struct)
481 /* For a LABEL_REF, 1 means that this reference is to a label outside the
482 loop containing the reference. */
483 #define LABEL_OUTSIDE_LOOP_P(RTX) ((RTX)->in_struct)
485 /* For a LABEL_REF, 1 means it is for a nonlocal label. */
486 #define LABEL_REF_NONLOCAL_P(RTX) ((RTX)->volatil)
488 /* For a CODE_LABEL, 1 means always consider this label to be needed. */
489 #define LABEL_PRESERVE_P(RTX) ((RTX)->in_struct)
491 /* For a REG, 1 means the register is used only in an exit test of a loop. */
492 #define REG_LOOP_TEST_P(RTX) ((RTX)->in_struct)
494 /* During sched, for an insn, 1 means that the insn must be scheduled together
495 with the preceding insn. */
496 #define SCHED_GROUP_P(INSN) ((INSN)->in_struct)
498 /* During sched, for the LOG_LINKS of an insn, these cache the adjusted
499 cost of the dependence link. The cost of executing an instruction
500 may vary based on how the results are used. LINK_COST_ZERO is 1 when
501 the cost through the link varies and is unchanged (i.e., the link has
502 zero additional cost). LINK_COST_FREE is 1 when the cost through the
503 link is zero (i.e., the link makes the cost free). In other cases,
504 the adjustment to the cost is recomputed each time it is needed. */
505 #define LINK_COST_ZERO(X) ((X)->jump)
506 #define LINK_COST_FREE(X) ((X)->call)
508 /* For a SET rtx, SET_DEST is the place that is set
509 and SET_SRC is the value it is set to. */
510 #define SET_DEST(RTX) ((RTX)->fld[0].rtx)
511 #define SET_SRC(RTX) ((RTX)->fld[1].rtx)
513 /* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
514 #define TRAP_CONDITION(RTX) ((RTX)->fld[0].rtx)
516 /* 1 in a SYMBOL_REF if it addresses this function's constants pool. */
517 #define CONSTANT_POOL_ADDRESS_P(RTX) ((RTX)->unchanging)
519 /* Flag in a SYMBOL_REF for machine-specific purposes. */
520 #define SYMBOL_REF_FLAG(RTX) ((RTX)->volatil)
522 /* 1 means a SYMBOL_REF has been the library function in emit_library_call. */
523 #define SYMBOL_REF_USED(RTX) ((RTX)->used)
525 /* For an INLINE_HEADER rtx, FIRST_FUNCTION_INSN is the first insn
526 of the function that is not involved in copying parameters to
527 pseudo-registers. FIRST_PARM_INSN is the very first insn of
528 the function, including the parameter copying.
529 We keep this around in case we must splice
530 this function into the assembly code at the end of the file.
531 FIRST_LABELNO is the first label number used by the function (inclusive).
532 LAST_LABELNO is the last label used by the function (exclusive).
533 MAX_REGNUM is the largest pseudo-register used by that function.
534 FUNCTION_ARGS_SIZE is the size of the argument block in the stack.
535 POPS_ARGS is the number of bytes of input arguments popped by the function
536 STACK_SLOT_LIST is the list of stack slots.
537 FUNCTION_FLAGS are where single-bit flags are saved.
538 OUTGOING_ARGS_SIZE is the size of the largest outgoing stack parameter list.
539 ORIGINAL_ARG_VECTOR is a vector of the original DECL_RTX values
540 for the function arguments.
541 ORIGINAL_DECL_INITIAL is a pointer to the original DECL_INITIAL for the
544 We want this to lay down like an INSN. The PREV_INSN field
545 is always NULL. The NEXT_INSN field always points to the
546 first function insn of the function being squirreled away. */
548 #define FIRST_FUNCTION_INSN(RTX) ((RTX)->fld[2].rtx)
549 #define FIRST_PARM_INSN(RTX) ((RTX)->fld[3].rtx)
550 #define FIRST_LABELNO(RTX) ((RTX)->fld[4].rtint)
551 #define LAST_LABELNO(RTX) ((RTX)->fld[5].rtint)
552 #define MAX_PARMREG(RTX) ((RTX)->fld[6].rtint)
553 #define MAX_REGNUM(RTX) ((RTX)->fld[7].rtint)
554 #define FUNCTION_ARGS_SIZE(RTX) ((RTX)->fld[8].rtint)
555 #define POPS_ARGS(RTX) ((RTX)->fld[9].rtint)
556 #define STACK_SLOT_LIST(RTX) ((RTX)->fld[10].rtx)
557 #define FUNCTION_FLAGS(RTX) ((RTX)->fld[11].rtint)
558 #define OUTGOING_ARGS_SIZE(RTX) ((RTX)->fld[12].rtint)
559 #define ORIGINAL_ARG_VECTOR(RTX) ((RTX)->fld[13].rtvec)
560 #define ORIGINAL_DECL_INITIAL(RTX) ((RTX)->fld[14].rtx)
562 /* In FUNCTION_FLAGS we save some variables computed when emitting the code
563 for the function and which must be `or'ed into the current flag values when
564 insns from that function are being inlined. */
566 /* These ought to be an enum, but non-ANSI compilers don't like that. */
567 #define FUNCTION_FLAGS_CALLS_ALLOCA 01
568 #define FUNCTION_FLAGS_CALLS_SETJMP 02
569 #define FUNCTION_FLAGS_RETURNS_STRUCT 04
570 #define FUNCTION_FLAGS_RETURNS_PCC_STRUCT 010
571 #define FUNCTION_FLAGS_NEEDS_CONTEXT 020
572 #define FUNCTION_FLAGS_HAS_NONLOCAL_LABEL 040
573 #define FUNCTION_FLAGS_RETURNS_POINTER 0100
574 #define FUNCTION_FLAGS_USES_CONST_POOL 0200
575 #define FUNCTION_FLAGS_CALLS_LONGJMP 0400
576 #define FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE 01000
578 /* Define a macro to look for REG_INC notes,
579 but save time on machines where they never exist. */
581 /* Don't continue this line--convex cc version 4.1 would lose. */
582 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
583 #define FIND_REG_INC_NOTE(insn, reg) (find_reg_note ((insn), REG_INC, (reg)))
585 #define FIND_REG_INC_NOTE(insn, reg) 0
588 /* Indicate whether the machine has any sort of auto increment addressing.
589 If not, we can avoid checking for REG_INC notes. */
591 /* Don't continue this line--convex cc version 4.1 would lose. */
592 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
596 /* Generally useful functions. */
598 /* The following functions accept a wide integer argument. Rather than
599 having to cast on every function call, we use a macro instead, that is
600 defined here and in tree.h. */
603 #define exact_log2(N) exact_log2_wide ((HOST_WIDE_INT) (N))
604 #define floor_log2(N) floor_log2_wide ((HOST_WIDE_INT) (N))
607 #define plus_constant(X,C) plus_constant_wide (X, (HOST_WIDE_INT) (C))
609 #define plus_constant_for_output(X,C) \
610 plus_constant_for_output_wide (X, (HOST_WIDE_INT) (C))
612 extern rtx plus_constant_wide PROTO((rtx, HOST_WIDE_INT));
613 extern rtx plus_constant_for_output_wide PROTO((rtx, HOST_WIDE_INT));
615 #define GEN_INT(N) gen_rtx (CONST_INT, VOIDmode, (N))
618 /* We cannot define prototypes for the variable argument functions,
619 since they have not been ANSI-fied, and an ANSI compiler would
620 complain when compiling the definition of these functions. */
622 extern rtx gen_rtx PROTO((enum rtx_code, enum machine_mode, ...));
623 extern rtvec gen_rtvec PROTO((int, ...));
626 extern rtx gen_rtx ();
627 extern rtvec gen_rtvec ();
630 #ifdef BUFSIZ /* stdio.h has been included */
631 extern rtx read_rtx PROTO((FILE *));
633 extern rtx read_rtx ();
637 /* At present, don't prototype xrealloc, since all of the callers don't
638 cast their pointers to char *, and all of the xrealloc's don't use
640 extern char *xrealloc PROTO((void *, unsigned));
642 extern char *xrealloc ();
645 extern char *xmalloc PROTO((unsigned));
646 extern char *oballoc PROTO((int));
647 extern char *permalloc PROTO((int));
648 extern void free PROTO((void *));
649 extern rtx rtx_alloc PROTO((RTX_CODE));
650 extern rtvec rtvec_alloc PROTO((int));
651 extern rtx find_reg_note PROTO((rtx, enum reg_note, rtx));
652 extern rtx find_regno_note PROTO((rtx, enum reg_note, int));
653 extern HOST_WIDE_INT get_integer_term PROTO((rtx));
654 extern rtx get_related_value PROTO((rtx));
655 extern rtx single_set PROTO((rtx));
656 extern rtx find_last_value PROTO((rtx, rtx *, rtx));
657 extern rtx copy_rtx PROTO((rtx));
658 extern rtx copy_rtx_if_shared PROTO((rtx));
659 extern rtx copy_most_rtx PROTO((rtx, rtx));
660 extern rtx replace_rtx PROTO((rtx, rtx, rtx));
661 extern rtvec gen_rtvec_v PROTO((int, rtx *));
662 extern rtx gen_reg_rtx PROTO((enum machine_mode));
663 extern rtx gen_label_rtx PROTO((void));
664 extern rtx gen_inline_header_rtx PROTO((rtx, rtx, int, int, int, int, int, int, rtx, int, int, rtvec, rtx));
665 extern rtx gen_lowpart_common PROTO((enum machine_mode, rtx));
666 extern rtx gen_lowpart PROTO((enum machine_mode, rtx));
667 extern rtx gen_lowpart_if_possible PROTO((enum machine_mode, rtx));
668 extern rtx gen_highpart PROTO((enum machine_mode, rtx));
669 extern rtx gen_realpart PROTO((enum machine_mode, rtx));
670 extern rtx gen_imagpart PROTO((enum machine_mode, rtx));
671 extern rtx operand_subword PROTO((rtx, int, int, enum machine_mode));
672 extern rtx operand_subword_force PROTO((rtx, int, enum machine_mode));
673 extern int subreg_lowpart_p PROTO((rtx));
674 extern rtx make_safe_from PROTO((rtx, rtx));
675 extern rtx memory_address PROTO((enum machine_mode, rtx));
676 extern rtx get_insns PROTO((void));
677 extern rtx get_last_insn PROTO((void));
678 extern rtx get_last_insn_anywhere PROTO((void));
679 extern void start_sequence PROTO((void));
680 extern void push_to_sequence PROTO((rtx));
681 extern void end_sequence PROTO((void));
682 extern rtx gen_sequence PROTO((void));
683 extern rtx immed_double_const PROTO((HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode));
684 extern rtx force_const_mem PROTO((enum machine_mode, rtx));
685 extern rtx force_reg PROTO((enum machine_mode, rtx));
686 extern rtx get_pool_constant PROTO((rtx));
687 extern enum machine_mode get_pool_mode PROTO((rtx));
688 extern int get_pool_offset PROTO((rtx));
689 extern rtx assign_stack_local PROTO((enum machine_mode, int, int));
690 extern rtx assign_stack_temp PROTO((enum machine_mode, int, int));
691 extern rtx protect_from_queue PROTO((rtx, int));
692 extern void emit_queue PROTO((void));
693 extern rtx emit_move_insn PROTO((rtx, rtx));
694 extern rtx emit_insn_before PROTO((rtx, rtx));
695 extern rtx emit_jump_insn_before PROTO((rtx, rtx));
696 extern rtx emit_call_insn_before PROTO((rtx, rtx));
697 extern rtx emit_barrier_before PROTO((rtx));
698 extern rtx emit_note_before PROTO((int, rtx));
699 extern rtx emit_insn_after PROTO((rtx, rtx));
700 extern rtx emit_jump_insn_after PROTO((rtx, rtx));
701 extern rtx emit_barrier_after PROTO((rtx));
702 extern rtx emit_label_after PROTO((rtx, rtx));
703 extern rtx emit_note_after PROTO((int, rtx));
704 extern rtx emit_line_note_after PROTO((char *, int, rtx));
705 extern rtx emit_insn PROTO((rtx));
706 extern rtx emit_insns PROTO((rtx));
707 extern rtx emit_insns_before PROTO((rtx, rtx));
708 extern rtx emit_jump_insn PROTO((rtx));
709 extern rtx emit_call_insn PROTO((rtx));
710 extern rtx emit_label PROTO((rtx));
711 extern rtx emit_barrier PROTO((void));
712 extern rtx emit_line_note PROTO((char *, int));
713 extern rtx emit_note PROTO((char *, int));
714 extern rtx emit_line_note_force PROTO((char *, int));
715 extern rtx make_insn_raw PROTO((rtx));
716 extern rtx previous_insn PROTO((rtx));
717 extern rtx next_insn PROTO((rtx));
718 extern rtx prev_nonnote_insn PROTO((rtx));
719 extern rtx next_nonnote_insn PROTO((rtx));
720 extern rtx prev_real_insn PROTO((rtx));
721 extern rtx next_real_insn PROTO((rtx));
722 extern rtx prev_active_insn PROTO((rtx));
723 extern rtx next_active_insn PROTO((rtx));
724 extern rtx prev_label PROTO((rtx));
725 extern rtx next_label PROTO((rtx));
726 extern rtx next_cc0_user PROTO((rtx));
727 extern rtx prev_cc0_setter PROTO((rtx));
728 extern rtx reg_set_last PROTO((rtx, rtx));
729 extern rtx next_nondeleted_insn PROTO((rtx));
730 extern enum rtx_code reverse_condition PROTO((enum rtx_code));
731 extern enum rtx_code swap_condition PROTO((enum rtx_code));
732 extern enum rtx_code unsigned_condition PROTO((enum rtx_code));
733 extern enum rtx_code signed_condition PROTO((enum rtx_code));
734 extern rtx find_equiv_reg PROTO((rtx, rtx, enum reg_class, int, short *, int, enum machine_mode));
735 extern rtx squeeze_notes PROTO((rtx, rtx));
736 extern rtx delete_insn PROTO((rtx));
737 extern void delete_jump PROTO((rtx));
738 extern rtx get_label_before PROTO((rtx));
739 extern rtx get_label_after PROTO((rtx));
740 extern rtx follow_jumps PROTO((rtx));
741 extern rtx adj_offsettable_operand PROTO((rtx, int));
742 extern rtx try_split PROTO((rtx, rtx, int));
743 extern rtx split_insns PROTO((rtx, rtx));
744 extern rtx simplify_unary_operation PROTO((enum rtx_code, enum machine_mode, rtx, enum machine_mode));
745 extern rtx simplify_binary_operation PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
746 extern rtx simplify_ternary_operation PROTO((enum rtx_code, enum machine_mode, enum machine_mode, rtx, rtx, rtx));
747 extern rtx simplify_relational_operation PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
748 extern rtx nonlocal_label_rtx_list PROTO((void));
749 extern rtx gen_move_insn PROTO((rtx, rtx));
750 extern rtx gen_jump PROTO((rtx));
751 extern rtx gen_beq PROTO((rtx));
752 extern rtx gen_bge PROTO((rtx));
753 extern rtx gen_ble PROTO((rtx));
754 extern rtx eliminate_constant_term PROTO((rtx, rtx *));
755 extern rtx expand_complex_abs PROTO((enum machine_mode, rtx, rtx, int));
757 /* Maximum number of parallel sets and clobbers in any insn in this fn.
758 Always at least 3, since the combiner could put that many togetherm
759 and we want this to remain correct for all the remaining passes. */
761 extern int max_parallel;
763 extern int asm_noperands PROTO((rtx));
764 extern char *decode_asm_operands PROTO((rtx, rtx *, rtx **, char **, enum machine_mode *));
766 extern enum reg_class reg_preferred_class PROTO((int));
767 extern enum reg_class reg_alternate_class PROTO((int));
769 extern rtx get_first_nonparm_insn PROTO((void));
771 /* Standard pieces of rtx, to be substituted directly into things. */
774 extern rtx const0_rtx;
775 extern rtx const1_rtx;
776 extern rtx const2_rtx;
777 extern rtx constm1_rtx;
778 extern rtx const_true_rtx;
780 extern rtx const_tiny_rtx[3][(int) MAX_MACHINE_MODE];
782 /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
785 #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
787 /* Likewise, for the constants 1 and 2. */
789 #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
790 #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
792 /* All references to certain hard regs, except those created
793 by allocating pseudo regs into them (when that's possible),
794 go through these unique rtx objects. */
795 extern rtx stack_pointer_rtx;
796 extern rtx frame_pointer_rtx;
797 extern rtx arg_pointer_rtx;
798 extern rtx pic_offset_table_rtx;
799 extern rtx struct_value_rtx;
800 extern rtx struct_value_incoming_rtx;
801 extern rtx static_chain_rtx;
802 extern rtx static_chain_incoming_rtx;
804 /* Virtual registers are used during RTL generation to refer to locations into
805 the stack frame when the actual location isn't known until RTL generation
806 is complete. The routine instantiate_virtual_regs replaces these with
807 the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
810 #define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
812 /* This points to the first word of the incoming arguments passed on the stack,
813 either by the caller or by the callee when pretending it was passed by the
816 extern rtx virtual_incoming_args_rtx;
818 #define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
820 /* If FRAME_GROWS_DOWNWARDS, this points to immediately above the first
821 variable on the stack. Otherwise, it points to the first variable on
824 extern rtx virtual_stack_vars_rtx;
826 #define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
828 /* This points to the location of dynamically-allocated memory on the stack
829 immediately after the stack pointer has been adjusted by the amount
832 extern rtx virtual_stack_dynamic_rtx;
834 #define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
836 /* This points to the location in the stack at which outgoing arguments should
837 be written when the stack is pre-pushed (arguments pushed using push
838 insns always use sp). */
840 extern rtx virtual_outgoing_args_rtx;
842 #define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
844 #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 3)
846 extern rtx find_next_ref PROTO((rtx, rtx));
847 extern rtx *find_single_use PROTO((rtx, rtx, rtx *));
849 /* It is hard to write the prototype for expand_expr, since it needs
850 expr.h to be included for the enumeration. */
852 extern rtx expand_expr ();
853 extern rtx immed_real_const_1();
856 /* rtl.h and tree.h were included. */
857 extern rtx output_constant_def PROTO((tree));
858 extern rtx immed_real_const PROTO((tree));
859 extern rtx immed_real_const_1 PROTO((REAL_VALUE_TYPE, enum machine_mode));
860 extern tree make_tree PROTO((tree, rtx));
863 extern rtx output_constant_def ();
864 extern rtx immed_real_const ();
865 extern rtx immed_real_const_1 ();
868 /* Define a default value for STORE_FLAG_VALUE. */
870 #ifndef STORE_FLAG_VALUE
871 #define STORE_FLAG_VALUE 1
874 /* Nonzero after end of reload pass.
875 Set to 1 or 0 by toplev.c. */
877 extern int reload_completed;
879 /* Set to 1 while reload_as_needed is operating.
880 Required by some machines to handle any generated moves differently. */
882 extern int reload_in_progress;
884 /* If this is nonzero, we do not bother generating VOLATILE
885 around volatile memory references, and we are willing to
886 output indirect addresses. If cse is to follow, we reject
887 indirect addresses so a useful potential cse is generated;
888 if it is used only once, instruction combination will produce
889 the same indirect address eventually. */
890 extern int cse_not_expected;
892 /* Indexed by pseudo register number, gives the rtx for that pseudo.
893 Allocated in parallel with regno_pointer_flag. */
894 extern rtx *regno_reg_rtx;