OSDN Git Service

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