OSDN Git Service

f75ca1b3984cae1e4aa7a702a5fc1fdfd75aa955
[pf3gnuchains/gcc-fork.git] / gcc / rtl.h
1 /* Register Transfer Language (RTL) definitions for GNU C-Compiler
2    Copyright (C) 1987, 91-97, 1998 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, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 #ifndef _RTL_H
22 #define _RTL_H
23
24 #include "machmode.h"
25
26 #undef FFS  /* Some systems predefine this symbol; don't let it interfere.  */
27 #undef FLOAT /* Likewise.  */
28 #undef ABS /* Likewise.  */
29 #undef PC /* Likewise.  */
30
31 #ifndef TREE_CODE
32 union tree_node;
33 #endif
34
35 /* Register Transfer Language EXPRESSIONS CODES */
36
37 #define RTX_CODE        enum rtx_code
38 enum rtx_code  {
39
40 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   ENUM ,
41 #include "rtl.def"              /* rtl expressions are documented here */
42 #undef DEF_RTL_EXPR
43
44   LAST_AND_UNUSED_RTX_CODE};    /* A convenient way to get a value for
45                                    NUM_RTX_CODE.
46                                    Assumes default enum value assignment.  */
47
48 #define NUM_RTX_CODE ((int)LAST_AND_UNUSED_RTX_CODE)
49                                 /* The cast here, saves many elsewhere.  */
50
51 extern int rtx_length[];
52 #define GET_RTX_LENGTH(CODE)            (rtx_length[(int) (CODE)])
53
54 extern char *rtx_name[];
55 #define GET_RTX_NAME(CODE)              (rtx_name[(int) (CODE)])
56
57 extern char *rtx_format[];
58 #define GET_RTX_FORMAT(CODE)            (rtx_format[(int) (CODE)])
59
60 extern char rtx_class[];
61 #define GET_RTX_CLASS(CODE)             (rtx_class[(int) (CODE)])
62 \f
63 /* Common union for an element of an rtx.  */
64
65 typedef union rtunion_def
66 {
67   HOST_WIDE_INT rtwint;
68   int rtint;
69   char *rtstr;
70   struct rtx_def *rtx;
71   struct rtvec_def *rtvec;
72   enum machine_mode rttype;
73 } rtunion;
74
75 /* RTL expression ("rtx").  */
76
77 typedef struct rtx_def
78 {
79 #ifdef ONLY_INT_FIELDS
80 #ifdef CODE_FIELD_BUG
81   unsigned int code : 16;
82 #else
83   unsigned short code;
84 #endif
85 #else
86   /* The kind of expression this is.  */
87   enum rtx_code code : 16;
88 #endif
89   /* The kind of value the expression has.  */
90 #ifdef ONLY_INT_FIELDS
91   int mode : 8;
92 #else
93   enum machine_mode mode : 8;
94 #endif
95   /* 1 in an INSN if it can alter flow of control
96      within this function.  Not yet used!  */
97   unsigned int jump : 1;
98   /* 1 in an INSN if it can call another function.  Not yet used!  */
99   unsigned int call : 1;
100   /* 1 in a MEM or REG if value of this expression will never change
101      during the current function, even though it is not
102      manifestly constant.
103      1 in a SUBREG if it is from a promoted variable that is unsigned.
104      1 in a SYMBOL_REF if it addresses something in the per-function
105      constants pool.
106      1 in a CALL_INSN if it is a const call.
107      1 in a JUMP_INSN if it is a branch that should be annulled.  Valid from
108      reorg until end of compilation; cleared before used.  */
109   unsigned int unchanging : 1;
110   /* 1 in a MEM expression if contents of memory are volatile.
111      1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL or BARRIER
112      if it is deleted.
113      1 in a REG expression if corresponds to a variable declared by the user.
114      0 for an internally generated temporary.
115      In a SYMBOL_REF, this flag is used for machine-specific purposes.
116      In a LABEL_REF or in a REG_LABEL note, this is LABEL_REF_NONLOCAL_P.  */
117   unsigned int volatil : 1;
118   /* 1 in a MEM referring to a field of a structure (not a union!).
119      0 if the MEM was a variable or the result of a * operator in C;
120      1 if it was the result of a . or -> operator (on a struct) in C.
121      1 in a REG if the register is used only in exit code a loop.
122      1 in a SUBREG expression if was generated from a variable with a 
123      promoted mode.
124      1 in a CODE_LABEL if the label is used for nonlocal gotos
125      and must not be deleted even if its count is zero.
126      1 in a LABEL_REF if this is a reference to a label outside the
127      current loop.
128      1 in an INSN, JUMP_INSN, or CALL_INSN if this insn must be scheduled
129      together with the preceding insn.  Valid only within sched.
130      1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
131      from the target of a branch.  Valid from reorg until end of compilation;
132      cleared before used.  */
133   unsigned int in_struct : 1;
134   /* 1 if this rtx is used.  This is used for copying shared structure.
135      See `unshare_all_rtl'.
136      In a REG, this is not needed for that purpose, and used instead 
137      in `leaf_renumber_regs_insn'.
138      In a SYMBOL_REF, means that emit_library_call
139      has used it as the function.  */
140   unsigned int used : 1;
141   /* Nonzero if this rtx came from procedure integration.
142      In a REG, nonzero means this reg refers to the return value
143      of the current function.  */
144   unsigned integrated : 1;
145   /* Nonzero if this rtx is related to the call frame, either changing how
146      we compute the frame address or saving and restoring registers in
147      the prologue and epilogue.  */
148   unsigned frame_related : 1;
149   /* The first element of the operands of this rtx.
150      The number of operands and their types are controlled
151      by the `code' field, according to rtl.def.  */
152   rtunion fld[1];
153 } *rtx;
154
155 #include "gansidecl.h"
156
157 #define NULL_RTX (rtx) 0
158
159 /* Define macros to access the `code' field of the rtx.  */
160
161 #ifdef SHORT_ENUM_BUG
162 #define GET_CODE(RTX)           ((enum rtx_code) ((RTX)->code))
163 #define PUT_CODE(RTX, CODE)     ((RTX)->code = ((short) (CODE)))
164 #else
165 #define GET_CODE(RTX)           ((RTX)->code)
166 #define PUT_CODE(RTX, CODE)     ((RTX)->code = (CODE))
167 #endif
168
169 #define GET_MODE(RTX)           ((RTX)->mode)
170 #define PUT_MODE(RTX, MODE)     ((RTX)->mode = (MODE))
171
172 #define RTX_INTEGRATED_P(RTX) ((RTX)->integrated)
173 #define RTX_UNCHANGING_P(RTX) ((RTX)->unchanging)
174 #define RTX_FRAME_RELATED_P(RTX) ((RTX)->frame_related)
175
176 /* RTL vector.  These appear inside RTX's when there is a need
177    for a variable number of things.  The principle use is inside
178    PARALLEL expressions.  */
179
180 typedef struct rtvec_def{
181   int num_elem;         /* number of elements */
182   rtunion elem[1];
183 } *rtvec;
184
185 #define NULL_RTVEC (rtvec) 0
186
187 #define GET_NUM_ELEM(RTVEC)             ((RTVEC)->num_elem)
188 #define PUT_NUM_ELEM(RTVEC, NUM)        ((RTVEC)->num_elem = (NUM))
189
190 #define RTVEC_ELT(RTVEC, I)  ((RTVEC)->elem[(I)].rtx)
191
192 /* 1 if X is a REG.  */
193
194 #define REG_P(X) (GET_CODE (X) == REG)
195
196 /* 1 if X is a constant value that is an integer.  */
197
198 #define CONSTANT_P(X)   \
199   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF              \
200    || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST_DOUBLE         \
201    || GET_CODE (X) == CONST || GET_CODE (X) == HIGH)
202
203 /* General accessor macros for accessing the fields of an rtx.  */
204
205 #define XEXP(RTX, N)    ((RTX)->fld[N].rtx)
206 #define XINT(RTX, N)    ((RTX)->fld[N].rtint)
207 #define XWINT(RTX, N)   ((RTX)->fld[N].rtwint)
208 #define XSTR(RTX, N)    ((RTX)->fld[N].rtstr)
209 #define XVEC(RTX, N)    ((RTX)->fld[N].rtvec)
210 #define XVECLEN(RTX, N) ((RTX)->fld[N].rtvec->num_elem)
211 #define XVECEXP(RTX,N,M)((RTX)->fld[N].rtvec->elem[M].rtx)
212 \f
213 /* ACCESS MACROS for particular fields of insns.  */
214
215 /* Holds a unique number for each insn.
216    These are not necessarily sequentially increasing.  */
217 #define INSN_UID(INSN)  ((INSN)->fld[0].rtint)
218
219 /* Chain insns together in sequence.  */
220 #define PREV_INSN(INSN) ((INSN)->fld[1].rtx)
221 #define NEXT_INSN(INSN) ((INSN)->fld[2].rtx)
222
223 /* The body of an insn.  */
224 #define PATTERN(INSN)   ((INSN)->fld[3].rtx)
225
226 /* Code number of instruction, from when it was recognized.
227    -1 means this instruction has not been recognized yet.  */
228 #define INSN_CODE(INSN) ((INSN)->fld[4].rtint)
229
230 /* Set up in flow.c; empty before then.
231    Holds a chain of INSN_LIST rtx's whose first operands point at
232    previous insns with direct data-flow connections to this one.
233    That means that those insns set variables whose next use is in this insn.
234    They are always in the same basic block as this insn.  */
235 #define LOG_LINKS(INSN)         ((INSN)->fld[5].rtx)
236
237 /* 1 if insn has been deleted.  */
238 #define INSN_DELETED_P(INSN) ((INSN)->volatil)
239
240 /* 1 if insn is a call to a const function.  */
241 #define CONST_CALL_P(INSN) ((INSN)->unchanging)
242
243 /* 1 if insn is a branch that should not unconditionally execute its
244    delay slots, i.e., it is an annulled branch.   */
245 #define INSN_ANNULLED_BRANCH_P(INSN) ((INSN)->unchanging)
246
247 /* 1 if insn is in a delay slot and is from the target of the branch.  If
248    the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
249    executed if the branch is taken.  For annulled branches with this bit
250    clear, the insn should be executed only if the branch is not taken.  */
251 #define INSN_FROM_TARGET_P(INSN) ((INSN)->in_struct)
252
253 /* Holds a list of notes on what this insn does to various REGs.
254    It is a chain of EXPR_LIST rtx's, where the second operand
255    is the chain pointer and the first operand is the REG being described.
256    The mode field of the EXPR_LIST contains not a real machine mode
257    but a value that says what this note says about the REG:
258      REG_DEAD means that the value in REG dies in this insn (i.e., it is
259    not needed past this insn).  If REG is set in this insn, the REG_DEAD
260    note may, but need not, be omitted.
261      REG_INC means that the REG is autoincremented or autodecremented.
262      REG_EQUIV describes the insn as a whole; it says that the insn
263    sets a register to a constant value or to be equivalent to a memory
264    address.  If the register is spilled to the stack then the constant
265    value should be substituted for it.  The contents of the REG_EQUIV
266    is the constant value or memory address, which may be different
267    from the source of the SET although it has the same value.  A
268    REG_EQUIV note may also appear on an insn which copies a register
269    parameter to a pseudo-register, if there is a memory address which
270    could be used to hold that pseudo-register throughout the function.
271      REG_EQUAL is like REG_EQUIV except that the destination
272    is only momentarily equal to the specified rtx.  Therefore, it
273    cannot be used for substitution; but it can be used for cse.
274      REG_RETVAL means that this insn copies the return-value of
275    a library call out of the hard reg for return values.  This note
276    is actually an INSN_LIST and it points to the first insn involved
277    in setting up arguments for the call.  flow.c uses this to delete
278    the entire library call when its result is dead.
279      REG_LIBCALL is the inverse of REG_RETVAL: it goes on the first insn
280    of the library call and points at the one that has the REG_RETVAL.
281      REG_WAS_0 says that the register set in this insn held 0 before the insn.
282    The contents of the note is the insn that stored the 0.
283    If that insn is deleted or patched to a NOTE, the REG_WAS_0 is inoperative.
284    The REG_WAS_0 note is actually an INSN_LIST, not an EXPR_LIST.
285      REG_NONNEG means that the register is always nonnegative during
286    the containing loop.  This is used in branches so that decrement and
287    branch instructions terminating on zero can be matched.  There must be
288    an insn pattern in the md file named `decrement_and_branch_until_zero'
289    or else this will never be added to any instructions.
290      REG_NO_CONFLICT means there is no conflict *after this insn*
291    between the register in the note and the destination of this insn.
292      REG_UNUSED identifies a register set in this insn and never used.
293      REG_CC_SETTER and REG_CC_USER link a pair of insns that set and use
294    CC0, respectively.  Normally, these are required to be consecutive insns,
295    but we permit putting a cc0-setting insn in the delay slot of a branch
296    as long as only one copy of the insn exists.  In that case, these notes
297    point from one to the other to allow code generation to determine what
298    any require information and to properly update CC_STATUS.
299      REG_LABEL points to a CODE_LABEL.  Used by non-JUMP_INSNs to
300    say that the CODE_LABEL contained in the REG_LABEL note is used
301    by the insn.
302      REG_DEP_ANTI is used in LOG_LINKS which represent anti (write after read)
303    dependencies.  REG_DEP_OUTPUT is used in LOG_LINKS which represent output
304    (write after write) dependencies.  Data dependencies, which are the only
305    type of LOG_LINK created by flow, are represented by a 0 reg note kind.  */
306 /*   REG_BR_PROB is attached to JUMP_INSNs and CALL_INSNs when the flag
307    -fbranch-probabilities is given.  It has an integer value.  For jumps,
308    it is the probability that this is a taken branch.  For calls, it is the
309    probability that this call won't return.
310      REG_EXEC_COUNT is attached to the first insn of each basic block, and
311    the first insn after each CALL_INSN.  It indicates how many times this
312    block was executed.
313      REG_SAVE_AREA is used to optimize rtl generated by dynamic stack
314    allocations for targets where SETJMP_VIA_SAVE_AREA is true.
315      REG_BR_PRED is attached to JUMP_INSNs only, it holds the branch prediction
316    flags computed by get_jump_flags() after dbr scheduling is complete.  */
317
318
319 #define REG_NOTES(INSN) ((INSN)->fld[6].rtx)
320
321 /* Don't forget to change reg_note_name in rtl.c.  */
322 enum reg_note { REG_DEAD = 1, REG_INC = 2, REG_EQUIV = 3, REG_WAS_0 = 4,
323                 REG_EQUAL = 5, REG_RETVAL = 6, REG_LIBCALL = 7,
324                 REG_NONNEG = 8, REG_NO_CONFLICT = 9, REG_UNUSED = 10,
325                 REG_CC_SETTER = 11, REG_CC_USER = 12, REG_LABEL = 13,
326                 REG_DEP_ANTI = 14, REG_DEP_OUTPUT = 15, REG_BR_PROB = 16,
327                 REG_EXEC_COUNT = 17, REG_NOALIAS = 18, REG_SAVE_AREA = 19,
328                 REG_BR_PRED = 20, REG_EH_CONTEXT = 21 };
329 /* The base value for branch probability notes.  */
330 #define REG_BR_PROB_BASE  10000
331
332 /* Define macros to extract and insert the reg-note kind in an EXPR_LIST.  */
333 #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
334 #define PUT_REG_NOTE_KIND(LINK,KIND) PUT_MODE(LINK, (enum machine_mode) (KIND))
335
336 /* Names for REG_NOTE's in EXPR_LIST insn's.  */
337
338 extern char *reg_note_name[];
339 #define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int) (MODE)])
340
341 /* This field is only present on CALL_INSNs.  It holds a chain of EXPR_LIST of
342    USE and CLOBBER expressions.
343      USE expressions list the registers filled with arguments that
344    are passed to the function.
345      CLOBBER expressions document the registers explicitly clobbered
346    by this CALL_INSN.
347      Pseudo registers can not be mentioned in this list.  */
348 #define CALL_INSN_FUNCTION_USAGE(INSN)  ((INSN)->fld[7].rtx)
349
350 /* The label-number of a code-label.  The assembler label
351    is made from `L' and the label-number printed in decimal.
352    Label numbers are unique in a compilation.  */
353 #define CODE_LABEL_NUMBER(INSN) ((INSN)->fld[3].rtint)
354
355 #define LINE_NUMBER NOTE
356
357 /* In a NOTE that is a line number, this is a string for the file name
358    that the line is in.  We use the same field to record block numbers
359    temporarily in NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes.
360    (We avoid lots of casts between ints and pointers if we use a
361    different macro for the bock number.)  */
362
363 #define NOTE_SOURCE_FILE(INSN)  ((INSN)->fld[3].rtstr)
364 #define NOTE_BLOCK_NUMBER(INSN) ((INSN)->fld[3].rtint)
365
366 /* In a NOTE that is a line number, this is the line number.
367    Other kinds of NOTEs are identified by negative numbers here.  */
368 #define NOTE_LINE_NUMBER(INSN) ((INSN)->fld[4].rtint)
369
370 /* Codes that appear in the NOTE_LINE_NUMBER field
371    for kinds of notes that are not line numbers.
372
373    Notice that we do not try to use zero here for any of
374    the special note codes because sometimes the source line
375    actually can be zero!  This happens (for example) when we
376    are generating code for the per-translation-unit constructor
377    and destructor routines for some C++ translation unit.
378
379    If you should change any of the following values, or if you
380    should add a new value here, don't forget to change the
381    note_insn_name array in rtl.c.  */
382
383 /* This note is used to get rid of an insn
384    when it isn't safe to patch the insn out of the chain.  */
385 #define NOTE_INSN_DELETED -1
386 #define NOTE_INSN_BLOCK_BEG -2
387 #define NOTE_INSN_BLOCK_END -3
388 #define NOTE_INSN_LOOP_BEG -4
389 #define NOTE_INSN_LOOP_END -5
390 /* This kind of note is generated at the end of the function body,
391    just before the return insn or return label.
392    In an optimizing compilation it is deleted by the first jump optimization,
393    after enabling that optimizer to determine whether control can fall
394    off the end of the function body without a return statement.  */
395 #define NOTE_INSN_FUNCTION_END -6
396 /* This kind of note is generated just after each call to `setjmp', et al.  */
397 #define NOTE_INSN_SETJMP -7
398 /* Generated at the place in a loop that `continue' jumps to.  */
399 #define NOTE_INSN_LOOP_CONT -8
400 /* Generated at the start of a duplicated exit test.  */
401 #define NOTE_INSN_LOOP_VTOP -9
402 /* This marks the point immediately after the last prologue insn.  */
403 #define NOTE_INSN_PROLOGUE_END -10
404 /* This marks the point immediately prior to the first epilogue insn.  */
405 #define NOTE_INSN_EPILOGUE_BEG -11
406 /* Generated in place of user-declared labels when they are deleted.  */
407 #define NOTE_INSN_DELETED_LABEL -12
408 /* This note indicates the start of the real body of the function,
409    i.e. the point just after all of the parms have been moved into
410    their homes, etc.  */
411 #define NOTE_INSN_FUNCTION_BEG -13
412 /* These note where exception handling regions begin and end.  */
413 #define NOTE_INSN_EH_REGION_BEG -14
414 #define NOTE_INSN_EH_REGION_END -15
415 /* Generated whenever a duplicate line number note is output.  For example,
416    one is output after the end of an inline function, in order to prevent
417    the line containing the inline call from being counted twice in gcov. */
418 #define NOTE_REPEATED_LINE_NUMBER -16
419
420
421 #if 0 /* These are not used, and I don't know what they were for. --rms.  */
422 #define NOTE_DECL_NAME(INSN) ((INSN)->fld[3].rtstr)
423 #define NOTE_DECL_CODE(INSN) ((INSN)->fld[4].rtint)
424 #define NOTE_DECL_RTL(INSN) ((INSN)->fld[5].rtx)
425 #define NOTE_DECL_IDENTIFIER(INSN) ((INSN)->fld[6].rtint)
426 #define NOTE_DECL_TYPE(INSN) ((INSN)->fld[7].rtint)
427 #endif /* 0 */
428
429 /* Names for NOTE insn's other than line numbers.  */
430
431 extern char *note_insn_name[];
432 #define GET_NOTE_INSN_NAME(NOTE_CODE) (note_insn_name[-(NOTE_CODE)])
433
434 /* The name of a label, in case it corresponds to an explicit label
435    in the input source code.  */
436 #define LABEL_NAME(LABEL) ((LABEL)->fld[4].rtstr)
437
438 /* In jump.c, each label contains a count of the number
439    of LABEL_REFs that point at it, so unused labels can be deleted.  */
440 #define LABEL_NUSES(LABEL) ((LABEL)->fld[5].rtint)
441
442 /* The original regno this ADDRESSOF was built for.  */
443 #define ADDRESSOF_REGNO(RTX) ((RTX)->fld[1].rtint)
444
445 /* The variable in the register we took the address of.  */
446 #define ADDRESSOF_DECL(X) ((tree) XEXP ((X), 2))
447 #define SET_ADDRESSOF_DECL(X, T) (XEXP ((X), 2) = (rtx) (T))
448
449 /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
450    so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
451    be decremented and possibly the label can be deleted.  */
452 #define JUMP_LABEL(INSN)   ((INSN)->fld[7].rtx)
453
454 /* Once basic blocks are found in flow.c,
455    each CODE_LABEL starts a chain that goes through
456    all the LABEL_REFs that jump to that label.
457    The chain eventually winds up at the CODE_LABEL; it is circular.  */
458 #define LABEL_REFS(LABEL) ((LABEL)->fld[6].rtx)
459 \f
460 /* This is the field in the LABEL_REF through which the circular chain
461    of references to a particular label is linked.
462    This chain is set up in flow.c.  */
463
464 #define LABEL_NEXTREF(REF) ((REF)->fld[1].rtx)
465
466 /* Once basic blocks are found in flow.c,
467    Each LABEL_REF points to its containing instruction with this field.  */
468
469 #define CONTAINING_INSN(RTX) ((RTX)->fld[2].rtx)
470
471 /* For a REG rtx, REGNO extracts the register number.  */
472
473 #define REGNO(RTX) ((RTX)->fld[0].rtint)
474
475 /* For a REG rtx, REG_FUNCTION_VALUE_P is nonzero if the reg
476    is the current function's return value.  */
477
478 #define REG_FUNCTION_VALUE_P(RTX) ((RTX)->integrated)
479
480 /* 1 in a REG rtx if it corresponds to a variable declared by the user.  */
481 #define REG_USERVAR_P(RTX) ((RTX)->volatil)
482
483 /* For a CONST_INT rtx, INTVAL extracts the integer.  */
484
485 #define INTVAL(RTX) ((RTX)->fld[0].rtwint)
486
487 /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
488    SUBREG_WORD extracts the word-number.  */
489
490 #define SUBREG_REG(RTX) ((RTX)->fld[0].rtx)
491 #define SUBREG_WORD(RTX) ((RTX)->fld[1].rtint)
492
493 /* 1 if the REG contained in SUBREG_REG is already known to be
494    sign- or zero-extended from the mode of the SUBREG to the mode of
495    the reg.  SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
496    extension.  
497
498    When used as a LHS, is means that this extension must be done
499    when assigning to SUBREG_REG.  */
500
501 #define SUBREG_PROMOTED_VAR_P(RTX) ((RTX)->in_struct)
502 #define SUBREG_PROMOTED_UNSIGNED_P(RTX) ((RTX)->unchanging)
503
504 /* Access various components of an ASM_OPERANDS rtx.  */
505
506 #define ASM_OPERANDS_TEMPLATE(RTX) XSTR ((RTX), 0)
507 #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XSTR ((RTX), 1)
508 #define ASM_OPERANDS_OUTPUT_IDX(RTX) XINT ((RTX), 2)
509 #define ASM_OPERANDS_INPUT_VEC(RTX) XVEC ((RTX), 3)
510 #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XVEC ((RTX), 4)
511 #define ASM_OPERANDS_INPUT(RTX, N) XVECEXP ((RTX), 3, (N))
512 #define ASM_OPERANDS_INPUT_LENGTH(RTX) XVECLEN ((RTX), 3)
513 #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) XSTR (XVECEXP ((RTX), 4, (N)), 0)
514 #define ASM_OPERANDS_INPUT_MODE(RTX, N) GET_MODE (XVECEXP ((RTX), 4, (N)))
515 #define ASM_OPERANDS_SOURCE_FILE(RTX) XSTR ((RTX), 5)
516 #define ASM_OPERANDS_SOURCE_LINE(RTX) XINT ((RTX), 6)
517
518 /* For a MEM rtx, 1 if it's a volatile reference.
519    Also in an ASM_OPERANDS rtx.  */
520 #define MEM_VOLATILE_P(RTX) ((RTX)->volatil)
521
522 /* For a MEM rtx, 1 if it refers to a structure or union component.  */
523 #define MEM_IN_STRUCT_P(RTX) ((RTX)->in_struct)
524
525 /* For a LABEL_REF, 1 means that this reference is to a label outside the
526    loop containing the reference.  */
527 #define LABEL_OUTSIDE_LOOP_P(RTX) ((RTX)->in_struct)
528
529 /* For a LABEL_REF, 1 means it is for a nonlocal label.  */
530 /* Likewise in an EXPR_LIST for a REG_LABEL note.  */
531 #define LABEL_REF_NONLOCAL_P(RTX) ((RTX)->volatil)
532
533 /* For a CODE_LABEL, 1 means always consider this label to be needed.  */
534 #define LABEL_PRESERVE_P(RTX) ((RTX)->in_struct)
535
536 /* For a REG, 1 means the register is used only in an exit test of a loop.  */
537 #define REG_LOOP_TEST_P(RTX) ((RTX)->in_struct)
538
539 /* During sched, for an insn, 1 means that the insn must be scheduled together
540    with the preceding insn.  */
541 #define SCHED_GROUP_P(INSN) ((INSN)->in_struct)
542
543 /* During sched, for the LOG_LINKS of an insn, these cache the adjusted
544    cost of the dependence link.  The cost of executing an instruction
545    may vary based on how the results are used.  LINK_COST_ZERO is 1 when
546    the cost through the link varies and is unchanged (i.e., the link has
547    zero additional cost).  LINK_COST_FREE is 1 when the cost through the
548    link is zero (i.e., the link makes the cost free).  In other cases,
549    the adjustment to the cost is recomputed each time it is needed.  */
550 #define LINK_COST_ZERO(X) ((X)->jump)
551 #define LINK_COST_FREE(X) ((X)->call)
552
553 /* For a SET rtx, SET_DEST is the place that is set
554    and SET_SRC is the value it is set to.  */
555 #define SET_DEST(RTX) ((RTX)->fld[0].rtx)
556 #define SET_SRC(RTX) ((RTX)->fld[1].rtx)
557
558 /* For a TRAP_IF rtx, TRAP_CONDITION is an expression.  */
559 #define TRAP_CONDITION(RTX) ((RTX)->fld[0].rtx)
560
561 /* 1 in a SYMBOL_REF if it addresses this function's constants pool.  */
562 #define CONSTANT_POOL_ADDRESS_P(RTX) ((RTX)->unchanging)
563
564 /* Flag in a SYMBOL_REF for machine-specific purposes.  */
565 #define SYMBOL_REF_FLAG(RTX) ((RTX)->volatil)
566
567 /* 1 means a SYMBOL_REF has been the library function in emit_library_call.  */
568 #define SYMBOL_REF_USED(RTX) ((RTX)->used)
569
570 /* For an INLINE_HEADER rtx, FIRST_FUNCTION_INSN is the first insn
571    of the function that is not involved in copying parameters to
572    pseudo-registers.  FIRST_PARM_INSN is the very first insn of
573    the function, including the parameter copying.
574    We keep this around in case we must splice
575    this function into the assembly code at the end of the file.
576    FIRST_LABELNO is the first label number used by the function (inclusive).
577    LAST_LABELNO is the last label used by the function (exclusive).
578    MAX_REGNUM is the largest pseudo-register used by that function.
579    FUNCTION_ARGS_SIZE is the size of the argument block in the stack.
580    POPS_ARGS is the number of bytes of input arguments popped by the function
581    STACK_SLOT_LIST is the list of stack slots.
582    FORCED_LABELS is the list of labels whose address was taken.
583    FUNCTION_FLAGS are where single-bit flags are saved.
584    OUTGOING_ARGS_SIZE is the size of the largest outgoing stack parameter list.
585    ORIGINAL_ARG_VECTOR is a vector of the original DECL_RTX values
586     for the function arguments.
587    ORIGINAL_DECL_INITIAL is a pointer to the original DECL_INITIAL for the
588     function.
589    INLINE_REGNO_REG_RTX, INLINE_REGNO_POINTER_FLAG, and
590     INLINE_REGNO_POINTER_ALIGN are pointers to the corresponding arrays.
591
592    We want this to lay down like an INSN.  The PREV_INSN field
593    is always NULL.  The NEXT_INSN field always points to the
594    first function insn of the function being squirreled away.  */
595
596 #define FIRST_FUNCTION_INSN(RTX) ((RTX)->fld[2].rtx)
597 #define FIRST_PARM_INSN(RTX) ((RTX)->fld[3].rtx)
598 #define FIRST_LABELNO(RTX) ((RTX)->fld[4].rtint)
599 #define LAST_LABELNO(RTX) ((RTX)->fld[5].rtint)
600 #define MAX_PARMREG(RTX) ((RTX)->fld[6].rtint)
601 #define MAX_REGNUM(RTX) ((RTX)->fld[7].rtint)
602 #define FUNCTION_ARGS_SIZE(RTX) ((RTX)->fld[8].rtint)
603 #define POPS_ARGS(RTX) ((RTX)->fld[9].rtint)
604 #define STACK_SLOT_LIST(RTX) ((RTX)->fld[10].rtx)
605 #define FORCED_LABELS(RTX) ((RTX)->fld[11].rtx)
606 #define FUNCTION_FLAGS(RTX) ((RTX)->fld[12].rtint)
607 #define OUTGOING_ARGS_SIZE(RTX) ((RTX)->fld[13].rtint)
608 #define ORIGINAL_ARG_VECTOR(RTX) ((RTX)->fld[14].rtvec)
609 #define ORIGINAL_DECL_INITIAL(RTX) ((RTX)->fld[15].rtx)
610 #define INLINE_REGNO_REG_RTX(RTX) ((RTX)->fld[16].rtvec)
611 #define INLINE_REGNO_POINTER_FLAG(RTX) ((RTX)->fld[17].rtstr)
612 #define INLINE_REGNO_POINTER_ALIGN(RTX) ((RTX)->fld[18].rtstr)
613 #define PARMREG_STACK_LOC(RTX) ((RTX)->fld[19].rtvec)
614
615 /* In FUNCTION_FLAGS we save some variables computed when emitting the code
616    for the function and which must be `or'ed into the current flag values when
617    insns from that function are being inlined.  */
618
619 /* These ought to be an enum, but non-ANSI compilers don't like that.  */
620 #define FUNCTION_FLAGS_CALLS_ALLOCA 01
621 #define FUNCTION_FLAGS_CALLS_SETJMP 02
622 #define FUNCTION_FLAGS_RETURNS_STRUCT 04
623 #define FUNCTION_FLAGS_RETURNS_PCC_STRUCT 010
624 #define FUNCTION_FLAGS_NEEDS_CONTEXT 020
625 #define FUNCTION_FLAGS_HAS_NONLOCAL_LABEL 040
626 #define FUNCTION_FLAGS_RETURNS_POINTER 0100
627 #define FUNCTION_FLAGS_USES_CONST_POOL 0200
628 #define FUNCTION_FLAGS_CALLS_LONGJMP 0400
629 #define FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE 01000
630
631 /* Define a macro to look for REG_INC notes,
632    but save time on machines where they never exist.  */
633
634 /* Don't continue this line--convex cc version 4.1 would lose.  */
635 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
636 #define FIND_REG_INC_NOTE(insn, reg) (find_reg_note ((insn), REG_INC, (reg)))
637 #else
638 #define FIND_REG_INC_NOTE(insn, reg) 0
639 #endif
640
641 /* Indicate whether the machine has any sort of auto increment addressing.
642    If not, we can avoid checking for REG_INC notes.  */
643
644 /* Don't continue this line--convex cc version 4.1 would lose.  */
645 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
646 #define AUTO_INC_DEC
647 #endif
648 \f
649 /* Generally useful functions.  */
650
651 /* The following functions accept a wide integer argument.  Rather than
652    having to cast on every function call, we use a macro instead, that is
653    defined here and in tree.h.  */
654
655 #ifndef exact_log2
656 #define exact_log2(N) exact_log2_wide ((unsigned HOST_WIDE_INT) (N))
657 #define floor_log2(N) floor_log2_wide ((unsigned HOST_WIDE_INT) (N))
658 #endif
659 extern int exact_log2_wide              PROTO((unsigned HOST_WIDE_INT));
660 extern int floor_log2_wide              PROTO((unsigned HOST_WIDE_INT));
661
662 /* In expmed.c */
663 extern int ceil_log2                    PROTO((unsigned HOST_WIDE_INT));
664
665 #define plus_constant(X,C) plus_constant_wide (X, (HOST_WIDE_INT) (C))
666
667 #define plus_constant_for_output(X,C)  \
668   plus_constant_for_output_wide (X, (HOST_WIDE_INT) (C))
669
670 extern rtx plus_constant_wide            PROTO((rtx, HOST_WIDE_INT));
671 extern rtx plus_constant_for_output_wide PROTO((rtx, HOST_WIDE_INT));
672
673 extern rtx gen_rtx                      PVPROTO((enum rtx_code,
674                                                  enum machine_mode, ...));
675 extern rtvec gen_rtvec                  PVPROTO((int, ...));
676
677 #ifdef BUFSIZ
678 extern rtx read_rtx                     PROTO((FILE *));
679 #endif
680
681 #if 0
682 /* At present, don't prototype xrealloc, since all of the callers don't
683    cast their pointers to char *, and all of the xrealloc's don't use
684    void * yet.  */
685 extern char *xmalloc                    PROTO((size_t));
686 extern char *xrealloc                   PROTO((void *, size_t));
687 #else
688 extern char *xmalloc ();
689 extern char *xrealloc ();
690 #endif
691
692 extern char *oballoc                    PROTO((int));
693 extern char *permalloc                  PROTO((int));
694 #ifdef NEED_DECLARATION_FREE
695 extern void free                        PROTO((void *));
696 #endif
697 extern rtx rtx_alloc                    PROTO((RTX_CODE));
698 extern rtvec rtvec_alloc                PROTO((int));
699 extern rtx copy_rtx                     PROTO((rtx));
700 extern rtx copy_rtx_if_shared           PROTO((rtx));
701 extern rtx copy_most_rtx                PROTO((rtx, rtx));
702 extern rtvec gen_rtvec_v                PROTO((int, rtx *));
703 extern rtvec gen_rtvec_vv               PROTO((int, rtunion *));
704 extern rtx gen_reg_rtx                  PROTO((enum machine_mode));
705 extern rtx gen_label_rtx                PROTO((void));
706 extern rtx gen_inline_header_rtx        PROTO((rtx, rtx, int, int, int, int,
707                                                int, int, rtx, rtx, int, int,
708                                                rtvec, rtx,
709                                                rtvec, char *, char *, rtvec));
710 extern rtx gen_lowpart_common           PROTO((enum machine_mode, rtx));
711 extern rtx gen_lowpart                  PROTO((enum machine_mode, rtx));
712 extern rtx gen_lowpart_if_possible      PROTO((enum machine_mode, rtx));
713 extern rtx gen_highpart                 PROTO((enum machine_mode, rtx));
714 extern rtx gen_realpart                 PROTO((enum machine_mode, rtx));
715 extern rtx gen_imagpart                 PROTO((enum machine_mode, rtx));
716 extern rtx operand_subword              PROTO((rtx, int, int, enum machine_mode));
717 extern rtx operand_subword_force        PROTO((rtx, int, enum machine_mode));
718 extern int subreg_lowpart_p             PROTO((rtx));
719 extern rtx make_safe_from               PROTO((rtx, rtx));
720 extern rtx convert_memory_address       PROTO((enum machine_mode, rtx));
721 extern rtx memory_address               PROTO((enum machine_mode, rtx));
722 extern rtx get_insns                    PROTO((void));
723 extern rtx get_last_insn                PROTO((void));
724 extern rtx get_last_insn_anywhere       PROTO((void));
725 extern void start_sequence              PROTO((void));
726 extern void push_to_sequence            PROTO((rtx));
727 extern void end_sequence                PROTO((void));
728 extern rtx gen_sequence                 PROTO((void));
729 extern rtx immed_double_const           PROTO((HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode));
730 extern rtx force_const_mem              PROTO((enum machine_mode, rtx));
731 extern rtx force_reg                    PROTO((enum machine_mode, rtx));
732 extern rtx get_pool_constant            PROTO((rtx));
733 extern enum machine_mode get_pool_mode  PROTO((rtx));
734 extern int get_pool_offset              PROTO((rtx));
735 extern rtx simplify_subtraction         PROTO((rtx));
736 extern rtx assign_stack_local           PROTO((enum machine_mode, int, int));
737 extern rtx assign_stack_temp            PROTO((enum machine_mode, int, int));
738 extern rtx assign_temp                  PROTO((union tree_node *, int,
739                                                int, int));
740 extern rtx protect_from_queue           PROTO((rtx, int));
741 extern void emit_queue                  PROTO((void));
742 extern rtx emit_move_insn               PROTO((rtx, rtx));
743 extern rtx emit_insn_before             PROTO((rtx, rtx));
744 extern rtx emit_jump_insn_before        PROTO((rtx, rtx));
745 extern rtx emit_call_insn_before        PROTO((rtx, rtx));
746 extern rtx emit_barrier_before          PROTO((rtx));
747 extern rtx emit_note_before             PROTO((int, rtx));
748 extern rtx emit_insn_after              PROTO((rtx, rtx));
749 extern rtx emit_jump_insn_after         PROTO((rtx, rtx));
750 extern rtx emit_barrier_after           PROTO((rtx));
751 extern rtx emit_label_after             PROTO((rtx, rtx));
752 extern rtx emit_note_after              PROTO((int, rtx));
753 extern rtx emit_line_note_after         PROTO((char *, int, rtx));
754 extern rtx emit_insn                    PROTO((rtx));
755 extern rtx emit_insns                   PROTO((rtx));
756 extern rtx emit_insns_before            PROTO((rtx, rtx));
757 extern rtx emit_insns_after             PROTO((rtx, rtx));
758 extern rtx emit_jump_insn               PROTO((rtx));
759 extern rtx emit_call_insn               PROTO((rtx));
760 extern rtx emit_label                   PROTO((rtx));
761 extern rtx emit_barrier                 PROTO((void));
762 extern rtx emit_line_note               PROTO((char *, int));
763 extern rtx emit_note                    PROTO((char *, int));
764 extern rtx emit_line_note_force         PROTO((char *, int));
765 extern rtx make_insn_raw                PROTO((rtx));
766 extern rtx previous_insn                PROTO((rtx));
767 extern rtx next_insn                    PROTO((rtx));
768 extern rtx prev_nonnote_insn            PROTO((rtx));
769 extern rtx next_nonnote_insn            PROTO((rtx));
770 extern rtx prev_real_insn               PROTO((rtx));
771 extern rtx next_real_insn               PROTO((rtx));
772 extern rtx prev_active_insn             PROTO((rtx));
773 extern rtx next_active_insn             PROTO((rtx));
774 extern rtx prev_label                   PROTO((rtx));
775 extern rtx next_label                   PROTO((rtx));
776 extern rtx next_cc0_user                PROTO((rtx));
777 extern rtx prev_cc0_setter              PROTO((rtx));
778 extern rtx next_nondeleted_insn         PROTO((rtx));
779 extern enum rtx_code reverse_condition  PROTO((enum rtx_code));
780 extern enum rtx_code swap_condition     PROTO((enum rtx_code));
781 extern enum rtx_code unsigned_condition PROTO((enum rtx_code));
782 extern enum rtx_code signed_condition   PROTO((enum rtx_code));
783 extern rtx find_equiv_reg               PROTO((rtx, rtx, enum reg_class, int, short *, int, enum machine_mode));
784 extern rtx squeeze_notes                PROTO((rtx, rtx));
785 extern rtx delete_insn                  PROTO((rtx));
786 extern void delete_jump                 PROTO((rtx));
787 extern rtx get_label_before             PROTO((rtx));
788 extern rtx get_label_after              PROTO((rtx));
789 extern rtx follow_jumps                 PROTO((rtx));
790 extern rtx adj_offsettable_operand      PROTO((rtx, int));
791 extern rtx try_split                    PROTO((rtx, rtx, int));
792 extern rtx split_insns                  PROTO((rtx, rtx));
793 extern rtx simplify_unary_operation     PROTO((enum rtx_code, enum machine_mode, rtx, enum machine_mode));
794 extern rtx simplify_binary_operation    PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
795 extern rtx simplify_ternary_operation   PROTO((enum rtx_code, enum machine_mode, enum machine_mode, rtx, rtx, rtx));
796 extern rtx simplify_relational_operation PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
797 extern rtx nonlocal_label_rtx_list      PROTO((void));
798 extern rtx gen_move_insn                PROTO((rtx, rtx));
799 extern rtx gen_jump                     PROTO((rtx));
800 extern rtx gen_beq                      PROTO((rtx));
801 extern rtx gen_bge                      PROTO((rtx));
802 extern rtx gen_ble                      PROTO((rtx));
803 extern rtx gen_mem_addressof            PROTO((rtx, union tree_node *));
804 extern rtx eliminate_constant_term      PROTO((rtx, rtx *));
805 extern rtx expand_complex_abs           PROTO((enum machine_mode, rtx, rtx, int));
806 extern enum machine_mode choose_hard_reg_mode PROTO((int, int));
807 extern int rtx_varies_p         PROTO((rtx));
808 extern int may_trap_p           PROTO((rtx));
809 extern int side_effects_p       PROTO((rtx));
810 extern int volatile_refs_p      PROTO((rtx));
811 extern int volatile_insn_p      PROTO((rtx));
812 extern void remove_note         PROTO((rtx, rtx));
813 extern void note_stores         PROTO((rtx, void (*) (rtx, rtx)));
814 extern int refers_to_regno_p    PROTO((int, int, rtx, rtx *));
815 extern int reg_overlap_mentioned_p PROTO((rtx, rtx));
816 extern rtx find_use_as_address  PROTO((rtx, rtx, HOST_WIDE_INT));
817
818 /* Functions in rtlanal.c */
819
820 extern int rtx_unstable_p               PROTO((rtx));
821 extern int rtx_varies_p                 PROTO((rtx));
822 extern int rtx_addr_varies_p            PROTO((rtx));
823 extern HOST_WIDE_INT get_integer_term   PROTO((rtx));
824 extern rtx get_related_value            PROTO((rtx));
825 extern int reg_mentioned_p              PROTO((rtx, rtx));
826 extern int reg_referenced_p             PROTO((rtx, rtx));
827 extern int reg_used_between_p           PROTO((rtx, rtx, rtx));
828 extern int reg_referenced_between_p     PROTO((rtx, rtx, rtx));
829 extern int reg_set_between_p            PROTO((rtx, rtx, rtx));
830 extern int modified_between_p           PROTO((rtx, rtx, rtx));
831 extern int no_labels_between_p          PROTO((rtx, rtx));
832 extern int modified_in_p                PROTO((rtx, rtx));
833 extern int reg_set_p                    PROTO((rtx, rtx));
834 extern rtx single_set                   PROTO((rtx));
835 extern rtx find_last_value              PROTO((rtx, rtx *, rtx));
836 extern int refers_to_regno_p            PROTO((int, int, rtx, rtx *));
837 extern int reg_overlap_mentioned_p      PROTO((rtx, rtx));
838 extern void note_stores                 PROTO((rtx, void (*)()));
839 extern rtx reg_set_last                 PROTO((rtx, rtx));
840 extern int rtx_equal_p                  PROTO((rtx, rtx));
841 extern int dead_or_set_p                PROTO((rtx, rtx));
842 extern int dead_or_set_regno_p          PROTO((rtx, int));
843 extern rtx find_reg_note                PROTO((rtx, enum reg_note, rtx));
844 extern rtx find_regno_note              PROTO((rtx, enum reg_note, int));
845 extern int find_reg_fusage              PROTO((rtx, enum rtx_code, rtx));
846 extern int find_regno_fusage            PROTO((rtx, enum rtx_code, int));
847 extern void remove_note                 PROTO((rtx, rtx));
848 extern int side_effects_p               PROTO((rtx));
849 extern int volatile_refs_p              PROTO((rtx));
850 extern int volatile_insn_p              PROTO((rtx));
851 extern int may_trap_p                   PROTO((rtx));
852 extern int inequality_comparison_p      PROTO((rtx));
853 extern rtx replace_rtx                  PROTO((rtx, rtx, rtx));
854 extern rtx replace_regs                 PROTO((rtx, rtx *, int, int));
855 extern int computed_jump_p              PROTO((rtx));
856
857 /* Maximum number of parallel sets and clobbers in any insn in this fn.
858    Always at least 3, since the combiner could put that many togetherm
859    and we want this to remain correct for all the remaining passes.  */
860
861 extern int max_parallel;
862
863 extern int asm_noperands                PROTO((rtx));
864 extern char *decode_asm_operands        PROTO((rtx, rtx *, rtx **, char **, enum machine_mode *));
865
866 extern enum reg_class reg_preferred_class PROTO((int));
867 extern enum reg_class reg_alternate_class PROTO((int));
868
869 extern rtx get_first_nonparm_insn       PROTO((void));
870
871 /* Standard pieces of rtx, to be substituted directly into things.  */
872 #define pc_rtx          (&global_rtl.pc_val)
873 #define cc0_rtx         (&global_rtl.cc0_val)
874
875 #define MAX_SAVED_CONST_INT 64
876 extern struct rtx_def const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
877
878 #define const0_rtx      (&const_int_rtx[MAX_SAVED_CONST_INT])
879 #define const1_rtx      (&const_int_rtx[MAX_SAVED_CONST_INT+1])
880 #define const2_rtx      (&const_int_rtx[MAX_SAVED_CONST_INT+2])
881 #define constm1_rtx     (&const_int_rtx[MAX_SAVED_CONST_INT-1])
882 extern rtx const_true_rtx;
883
884 extern rtx const_tiny_rtx[3][(int) MAX_MACHINE_MODE];
885
886 /* Returns a constant 0 rtx in mode MODE.  Integer modes are treated the 
887    same as VOIDmode.  */
888
889 #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
890
891 /* Likewise, for the constants 1 and 2.  */
892
893 #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
894 #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
895
896 extern struct _global_rtl
897 {
898   struct rtx_def pc_val, cc0_val;
899   struct rtx_def stack_pointer_val, frame_pointer_val;
900   struct rtx_def hard_frame_pointer_val;
901   struct rtx_def arg_pointer_val;
902   struct rtx_def virtual_incoming_args_val;
903   struct rtx_def virtual_stack_vars_val;
904   struct rtx_def virtual_stack_dynamic_val;
905   struct rtx_def virtual_outgoing_args_val;
906 } global_rtl;
907
908 /* All references to certain hard regs, except those created
909    by allocating pseudo regs into them (when that's possible),
910    go through these unique rtx objects.  */
911 #define stack_pointer_rtx       (&global_rtl.stack_pointer_val)
912 #define frame_pointer_rtx       (&global_rtl.frame_pointer_val)
913
914 extern rtx pic_offset_table_rtx;
915 extern rtx struct_value_rtx;
916 extern rtx struct_value_incoming_rtx;
917 extern rtx static_chain_rtx;
918 extern rtx static_chain_incoming_rtx;
919
920
921 /* Include the RTL generation functions.  */
922
923 #ifndef NO_GENRTL_H
924 #include "genrtl.h"
925 #endif
926
927 /* There are two RTL codes that require special attention; the generation
928    functions included above do the raw handling.  */
929
930 extern rtx gen_rtx_CONST_INT PROTO((enum machine_mode, HOST_WIDE_INT));
931 extern rtx gen_rtx_REG PROTO((enum machine_mode, int));
932
933 #define GEN_INT(N)  gen_rtx_CONST_INT (VOIDmode, (N))
934
935
936 /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
937    is used to represent the frame pointer.  This is because the
938    hard frame pointer and the automatic variables are separated by an amount
939    that cannot be determined until after register allocation.  We can assume
940    that in this case ELIMINABLE_REGS will be defined, one action of which
941    will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
942 #ifndef HARD_FRAME_POINTER_REGNUM
943 #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
944 #endif
945
946 /* For register elimination to work properly these hard_frame_pointer_rtx,
947    frame_pointer_rtx, and arg_pointer_rtx must be the same if they refer to
948    the same register.  */
949 #if HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM
950 #define hard_frame_pointer_rtx  (&global_rtl.frame_pointer_val)
951 #else
952 #define hard_frame_pointer_rtx  (&global_rtl.hard_frame_pointer_val)
953 #endif
954
955 #if FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
956 #define arg_pointer_rtx         (&global_rtl.frame_pointer_val)
957 #else
958 #if HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
959 #define arg_pointer_rtx         (&global_rtl.hard_frame_pointer_val)
960 #else
961 #define arg_pointer_rtx         (&global_rtl.arg_pointer_val)
962 #endif
963 #endif
964
965 /* Virtual registers are used during RTL generation to refer to locations into
966    the stack frame when the actual location isn't known until RTL generation
967    is complete.  The routine instantiate_virtual_regs replaces these with
968    the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
969    a constant.  */
970
971 #define FIRST_VIRTUAL_REGISTER  (FIRST_PSEUDO_REGISTER)
972
973 /* This points to the first word of the incoming arguments passed on the stack,
974    either by the caller or by the callee when pretending it was passed by the
975    caller.  */
976
977 #define virtual_incoming_args_rtx (&global_rtl.virtual_incoming_args_val)
978
979 #define VIRTUAL_INCOMING_ARGS_REGNUM    (FIRST_VIRTUAL_REGISTER)
980
981 /* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
982    variable on the stack.  Otherwise, it points to the first variable on
983    the stack.  */
984
985 #define virtual_stack_vars_rtx  (&global_rtl.virtual_stack_vars_val)
986
987 #define VIRTUAL_STACK_VARS_REGNUM       ((FIRST_VIRTUAL_REGISTER) + 1)
988
989 /* This points to the location of dynamically-allocated memory on the stack
990    immediately after the stack pointer has been adjusted by the amount
991    desired.  */
992
993 #define virtual_stack_dynamic_rtx       (&global_rtl.virtual_stack_dynamic_val)
994
995 #define VIRTUAL_STACK_DYNAMIC_REGNUM    ((FIRST_VIRTUAL_REGISTER) + 2)
996
997 /* This points to the location in the stack at which outgoing arguments should
998    be written when the stack is pre-pushed (arguments pushed using push
999    insns always use sp).  */
1000
1001 #define virtual_outgoing_args_rtx       (&global_rtl.virtual_outgoing_args_val)
1002
1003 #define VIRTUAL_OUTGOING_ARGS_REGNUM    ((FIRST_VIRTUAL_REGISTER) + 3)
1004
1005 #define LAST_VIRTUAL_REGISTER   ((FIRST_VIRTUAL_REGISTER) + 3)
1006
1007 extern rtx find_next_ref                PROTO((rtx, rtx));
1008 extern rtx *find_single_use             PROTO((rtx, rtx, rtx *));
1009
1010 /* It is hard to write the prototype for expand_expr, since it needs
1011    expr.h to be included for the enumeration.  */
1012
1013 extern rtx expand_expr ();
1014
1015 extern rtx output_constant_def          PROTO((union tree_node *));
1016 extern rtx immed_real_const             PROTO((union tree_node *));
1017 extern union tree_node *make_tree       PROTO((union tree_node *, rtx));
1018
1019 /* Abort routines */
1020 extern void fatal_insn_not_found        PROTO((rtx));
1021 extern void fatal_insn                  PROTO((char *, rtx));
1022
1023 /* Define a default value for STORE_FLAG_VALUE.  */
1024
1025 #ifndef STORE_FLAG_VALUE
1026 #define STORE_FLAG_VALUE 1
1027 #endif
1028
1029 /* Nonzero after end of reload pass.
1030    Set to 1 or 0 by toplev.c.  */
1031
1032 extern int reload_completed;
1033
1034 /* Set to 1 while reload_as_needed is operating.
1035    Required by some machines to handle any generated moves differently.  */
1036
1037 extern int reload_in_progress;
1038
1039 /* If this is nonzero, we do not bother generating VOLATILE
1040    around volatile memory references, and we are willing to
1041    output indirect addresses.  If cse is to follow, we reject
1042    indirect addresses so a useful potential cse is generated;
1043    if it is used only once, instruction combination will produce
1044    the same indirect address eventually.  */
1045 extern int cse_not_expected;
1046
1047 /* Indexed by pseudo register number, gives the rtx for that pseudo.
1048    Allocated in parallel with regno_pointer_flag.  */
1049 extern rtx *regno_reg_rtx;
1050
1051 /* Vector indexed by regno; contain the alignment in bytes and type
1052    pointed to for a register that contains a pointer, if known.  */
1053 extern char *regno_pointer_align;
1054 #define REGNO_POINTER_ALIGN(REGNO) regno_pointer_align[REGNO]
1055
1056 /* Translates rtx code to tree code, for those codes needed by
1057    REAL_ARITHMETIC.  The function returns an int because the caller may not
1058    know what `enum tree_code' means.  */
1059
1060 extern int rtx_to_tree_code     PROTO((enum rtx_code));
1061
1062 /* In rtlanal.c */
1063 extern int reg_set_p                    PROTO ((rtx, rtx));
1064 extern int reg_mentioned_p              PROTO ((rtx, rtx));
1065 extern int reg_referenced_p             PROTO ((rtx, rtx));
1066 extern int reg_used_between_p           PROTO ((rtx, rtx, rtx));
1067 extern int reg_set_p                    PROTO ((rtx, rtx));
1068 extern int reg_referenced_between_p     PROTO ((rtx, rtx, rtx));
1069 extern int reg_set_between_p            PROTO ((rtx, rtx, rtx));
1070 extern int rtx_unstable_p               PROTO ((rtx));
1071 extern int rtx_addr_varies_p            PROTO ((rtx));
1072 extern int rtx_equal_p                  PROTO ((rtx, rtx));
1073 extern int inequality_comparisons_p     PROTO ((rtx));
1074 extern int dead_or_set_p                PROTO ((rtx, rtx));
1075 extern int dead_or_set_regno_p          PROTO ((rtx, int));
1076 extern int no_labels_between_p          PROTO ((rtx, rtx));
1077 extern int modified_between_p           PROTO ((rtx, rtx, rtx));
1078 extern int modified_in_p                PROTO ((rtx, rtx));
1079
1080 /* In tree.c */
1081 extern void obfree                      PROTO ((char *));
1082 struct obstack;
1083 extern void gcc_obstack_init            PROTO ((struct obstack *));
1084 extern void pop_obstacks                PROTO ((void));
1085 extern void push_obstacks               PROTO ((struct obstack *,
1086                                                 struct obstack *));
1087 #ifdef BUFSIZ
1088 extern int read_skip_spaces             PROTO ((FILE *));
1089 #endif
1090
1091 /* In cse.c */
1092 struct cse_basic_block_data;
1093 extern int rtx_cost                     PROTO ((rtx, enum rtx_code));
1094 extern void delete_dead_from_cse        PROTO ((rtx, int));
1095 #ifdef BUFSIZ
1096 extern int cse_main                     PROTO ((rtx, int, int, FILE *));
1097 #endif
1098 extern void cse_end_of_basic_block      PROTO ((rtx,
1099                                                 struct cse_basic_block_data *,
1100                                                 int, int, int));
1101
1102 /* In jump.c */
1103 extern int comparison_dominates_p       PROTO ((enum rtx_code, enum rtx_code));
1104 extern int condjump_p                   PROTO ((rtx));
1105 extern int simplejump_p                 PROTO ((rtx));
1106 extern int sets_cc0_p                   PROTO ((rtx));
1107 extern int invert_jump                  PROTO ((rtx, rtx));
1108 extern int rtx_renumbered_equal_p       PROTO ((rtx, rtx));
1109 extern int true_regnum                  PROTO ((rtx));
1110 extern int redirect_jump                PROTO ((rtx, rtx));
1111 extern void jump_optimize               PROTO ((rtx, int, int, int));
1112 extern void thread_jumps                PROTO ((rtx, int, int));
1113 extern int redirect_exp                 PROTO ((rtx *, rtx, rtx, rtx));
1114 extern int rtx_equal_for_thread_p       PROTO ((rtx, rtx, rtx));
1115 extern int invert_exp                   PROTO ((rtx, rtx));
1116 extern int can_reverse_comparison_p     PROTO ((rtx, rtx));
1117 extern void delete_for_peephole         PROTO ((rtx, rtx));
1118 extern int condjump_in_parallel_p       PROTO ((rtx));
1119
1120 /* In emit-rtl.c. */
1121 extern int max_reg_num                          PROTO ((void));
1122 extern int max_label_num                        PROTO ((void));
1123 extern int get_first_label_num                  PROTO ((void));
1124 extern void delete_insns_since                  PROTO ((rtx));
1125 extern void mark_reg_pointer                    PROTO ((rtx, int));
1126 extern void mark_user_reg                       PROTO ((rtx));
1127 extern void reset_used_flags                    PROTO ((rtx));
1128 extern void reorder_insns                       PROTO ((rtx, rtx, rtx));
1129 extern int get_max_uid                          PROTO ((void));
1130 extern int in_sequence_p                        PROTO ((void));
1131 extern void force_next_line_note                PROTO ((void));
1132 extern void init_emit                           PROTO ((void));
1133 extern void init_emit_once                      PROTO ((int));
1134 extern void push_topmost_sequence               PROTO ((void));
1135 extern void pop_topmost_sequence                PROTO ((void));
1136 extern int subreg_realpart_p                    PROTO ((rtx));
1137 extern void reverse_comparison                  PROTO ((rtx));
1138 extern void set_new_first_and_last_insn         PROTO ((rtx, rtx));
1139 extern void set_new_first_and_last_label_num    PROTO ((int, int));
1140 extern void unshare_all_rtl                     PROTO ((rtx));
1141 extern void set_last_insn                       PROTO ((rtx));
1142 extern void link_cc0_insns                      PROTO ((rtx));
1143 extern void add_insn                            PROTO ((rtx));
1144 extern void add_insn_before                     PROTO ((rtx, rtx));
1145 extern void add_insn_after                      PROTO ((rtx, rtx));
1146 extern void reorder_insns_with_line_notes       PROTO ((rtx, rtx, rtx));
1147 extern void emit_insn_after_with_line_notes     PROTO ((rtx, rtx, rtx));
1148 extern enum rtx_code classify_insn              PROTO ((rtx));
1149 extern rtx emit                                 PROTO ((rtx));
1150
1151 /* In insn-emit.c */
1152 extern void add_clobbers                PROTO ((rtx, int));
1153
1154 /* In combine.c */
1155 extern void combine_instructions        PROTO ((rtx, int));
1156 extern int extended_count               PROTO ((rtx, enum machine_mode, int));
1157 extern rtx remove_death                 PROTO ((int, rtx));
1158 #ifdef BUFSIZ
1159 extern void dump_combine_stats          PROTO ((FILE *));
1160 extern void dump_combine_total_stats    PROTO ((FILE *));
1161 #endif
1162
1163 /* In sched.c. */
1164 #ifdef BUFSIZ
1165 extern void schedule_insns              PROTO ((FILE *));
1166 #endif
1167
1168 /* In print-rtl.c */
1169 extern void debug_rtx                   PROTO ((rtx));
1170 extern void debug_rtx_list              PROTO ((rtx, int));
1171 extern rtx debug_rtx_find               PROTO ((rtx, int));
1172 #ifdef BUFSIZ
1173 extern void print_rtl                   PROTO ((FILE *, rtx));
1174 extern void print_inline_rtx            PROTO ((FILE *, rtx, int));
1175 #endif
1176
1177 /* In loop.c */
1178 extern void init_loop                   PROTO ((void));
1179 #ifdef BUFSIZ
1180 extern void loop_optimize               PROTO ((rtx, FILE *, int));
1181 #endif
1182 extern void record_excess_regs          PROTO ((rtx, rtx, rtx *));
1183
1184 /* In function.c */
1185 extern void reposition_prologue_and_epilogue_notes      PROTO ((rtx));
1186 extern void thread_prologue_and_epilogue_insns          PROTO ((rtx));
1187 extern void use_variable                                PROTO ((rtx));
1188 extern HOST_WIDE_INT get_frame_size                     PROTO ((void));
1189 extern void preserve_rtl_expr_result                    PROTO ((rtx));
1190 extern void mark_temp_addr_taken                        PROTO ((rtx));
1191 extern void update_temp_slot_address                    PROTO ((rtx, rtx));
1192 extern void use_variable_after                          PROTO ((rtx, rtx));
1193
1194 /* In reload.c */
1195 extern int operands_match_p             PROTO ((rtx, rtx));
1196 extern int safe_from_earlyclobber       PROTO ((rtx, rtx));
1197 extern int strict_memory_address_p      PROTO ((enum machine_mode, rtx));
1198
1199 /* In recog.c */
1200 extern int memory_address_p             PROTO ((enum machine_mode, rtx));
1201 extern int constrain_operands           PROTO ((int, int));
1202 extern int mode_dependent_address_p     PROTO ((rtx));
1203 extern void init_recog_no_volatile      PROTO ((void));
1204 extern int offsettable_memref_pq        PROTO ((rtx));
1205 extern int offsettable_nonstrict_memref_p PROTO ((rtx));
1206 extern int reg_fits_class_p             PROTO ((rtx, register enum reg_class,
1207                                                 int, enum machine_mode));
1208 extern int check_asm_operands           PROTO ((rtx));
1209 extern int address_operand              PROTO ((rtx, enum machine_mode));
1210 extern int const_int_operand            PROTO ((rtx, enum machine_mode));
1211 extern int const_double_operand         PROTO ((rtx, enum machine_mode));
1212 extern int general_operand              PROTO ((rtx, enum machine_mode));
1213 extern int immediate_operand            PROTO ((rtx, enum machine_mode));
1214 extern int nonimmediate_operand         PROTO ((rtx, enum machine_mode));
1215 extern int memory_operand               PROTO ((rtx, enum machine_mode));
1216 extern int nonmemory_operand            PROTO ((rtx, enum machine_mode));
1217 extern int push_operand                 PROTO ((rtx, enum machine_mode));
1218 extern int register_operand             PROTO ((rtx, enum machine_mode));
1219 extern int scratch_operand              PROTO ((rtx, enum machine_mode));
1220 extern int indirect_operand             PROTO ((rtx, enum machine_mode));
1221 extern int mode_independent_operand     PROTO ((rtx, enum machine_mode));
1222 extern int comparison_operator          PROTO ((rtx, enum machine_mode));
1223 extern void init_recog_no_volatile      PROTO ((void));
1224 extern void init_recog                  PROTO ((void));
1225 extern int validate_replace_rtx         PROTO ((rtx, rtx, rtx));
1226 extern int offsettable_address_p        PROTO ((int, enum machine_mode, rtx));
1227 extern int next_insn_tests_no_inequality PROTO ((rtx));
1228 extern int recog_memoized               PROTO ((rtx));
1229 extern int validate_change              PROTO ((rtx, rtx *, rtx, int));
1230 extern int apply_change_group           PROTO ((void));
1231 extern void cancel_changes              PROTO ((int));
1232 extern int num_validated_changes        PROTO ((void));
1233
1234 /* In insn-recog.c */
1235 extern int recog                        PROTO ((rtx, rtx, int *));
1236
1237 /* In stmt.c */
1238 extern void emit_jump                   PROTO ((rtx));
1239 extern int preserve_subexpressions_p    PROTO ((void));
1240
1241 /* In expr.c */
1242 extern void init_expr_once              PROTO ((void));
1243
1244 /* In stupid.c */
1245 #ifdef BUFSIZ
1246 extern void stupid_life_analysis        PROTO ((rtx, int, FILE *));
1247 #endif
1248
1249 /* In flow.c */
1250 extern void allocate_for_life_analysis  PROTO ((void));
1251 #ifdef BUFSIZ
1252 extern void dump_flow_info              PROTO ((FILE *));
1253 #endif
1254
1255 /* In expmed.c */
1256 extern void init_expmed                 PROTO ((void));
1257 extern void expand_inc                  PROTO ((rtx, rtx));
1258 extern void expand_dec                  PROTO ((rtx, rtx));
1259 extern rtx expand_mult_highpart         PROTO ((enum machine_mode, rtx,
1260                                                 unsigned HOST_WIDE_INT, rtx,
1261                                                 int, int));
1262
1263 /* In toplev.c */
1264 extern void strip_off_ending            PROTO ((char *, int));
1265 extern void print_time                  PROTO ((char *, int));
1266 extern int get_run_time                 PROTO ((void));
1267 #if 0
1268 extern void fatal                       PVPROTO ((char *, ...));
1269 extern void warning                     PVPROTO ((char *, ...));
1270 extern void error                       PVPROTO ((char *, ...));
1271 #endif
1272 extern void pfatal_with_name            PROTO ((char *));
1273 extern void fancy_abort                 PROTO ((void));
1274 extern int count_error                  PROTO ((int));
1275 extern void pedwarn                     PVPROTO ((char *, ...));
1276 extern void warning_for_asm             PVPROTO ((rtx, char *, ...));
1277 extern void error_for_asm               PVPROTO ((rtx, char *, ...));
1278
1279 /* In global.c */
1280 #ifdef BUFSIZ
1281 extern int global_alloc                 PROTO ((FILE *));
1282 extern void dump_global_regs            PROTO ((FILE *));
1283 #endif
1284
1285 /* In regclass.c */
1286 extern void globalize_reg               PROTO ((int));
1287 extern void init_regs                   PROTO ((void));
1288 extern void init_reg_sets               PROTO ((void));
1289 extern void regset_release_memory       PROTO ((void));
1290 extern void regclass_init               PROTO ((void));
1291 extern void regclass                    PROTO ((rtx, int));
1292 extern void reg_scan                    PROTO ((rtx, int, int));
1293 extern void fix_register                PROTO ((char *, int, int));
1294
1295 /* In optabs.c */
1296 extern void init_optabs                 PROTO ((void));
1297
1298 /* In local-alloc.c */
1299 #ifdef BUFSIZ
1300 extern void dump_local_alloc            PROTO ((FILE *));
1301 #endif
1302 extern void local_alloc                 PROTO ((void));
1303
1304 /* In reload1.c */
1305 extern void reload_cse_regs             PROTO ((rtx));
1306 extern void init_reload                 PROTO ((void));
1307 extern void mark_home_live              PROTO ((int));
1308 #ifdef BUFSIZ
1309 extern int reload                       PROTO ((rtx, int, FILE *));
1310 #endif
1311
1312 /* In caller-save.c */
1313 extern void init_caller_save            PROTO ((void));
1314
1315 /* In profile.c */
1316 extern void init_branch_prob            PROTO ((char *));
1317
1318 /* In reg-stack.c */
1319 #ifdef BUFSIZ
1320 extern void reg_to_stack                PROTO ((rtx, FILE *));
1321 #endif
1322 extern int stack_regs_mentioned_p       PROTO ((rtx));
1323
1324 /* In fold-const.c */
1325 extern int add_double           PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1326                                         HOST_WIDE_INT, HOST_WIDE_INT,
1327                                         HOST_WIDE_INT *, HOST_WIDE_INT *));
1328 extern int neg_double           PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1329                                         HOST_WIDE_INT *, HOST_WIDE_INT *));
1330 extern int mul_double           PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1331                                         HOST_WIDE_INT, HOST_WIDE_INT,
1332                                         HOST_WIDE_INT *, HOST_WIDE_INT *));
1333 extern void lshift_double       PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1334                                         HOST_WIDE_INT, int, HOST_WIDE_INT *,
1335                                         HOST_WIDE_INT *, int));
1336 extern void rshift_double       PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1337                                         HOST_WIDE_INT, int,
1338                                         HOST_WIDE_INT *, HOST_WIDE_INT *, int));
1339 extern void lrotate_double      PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1340                                         HOST_WIDE_INT, int, HOST_WIDE_INT *,
1341                                         HOST_WIDE_INT *));
1342 extern void rrotate_double      PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1343                                         HOST_WIDE_INT, int, HOST_WIDE_INT *,
1344                                         HOST_WIDE_INT *));
1345
1346 /* In calls.c */
1347 /* Emit library call.  */                                           
1348 extern void emit_library_call           PVPROTO ((rtx, int, enum machine_mode,
1349                                                   int, ...));
1350 extern rtx emit_library_call_value      PVPROTO((rtx, rtx, int,
1351                                                  enum machine_mode,
1352                                                  int, ...));
1353
1354 /* In unroll.c */
1355 extern int set_dominates_use            PROTO ((int, int, int, rtx, rtx));
1356
1357 /* In varasm.c */
1358 extern void bss_section                 PROTO ((void));
1359 extern int in_data_section              PROTO ((void));
1360 extern int supports_one_only            PROTO ((void));
1361
1362 /* In rtl.c */
1363 extern void init_rtl                    PROTO ((void));
1364 extern void rtx_free                    PROTO ((rtx));
1365
1366 /* In alias.c */
1367 extern int true_dependence              PROTO ((rtx, enum machine_mode, rtx,
1368                                                 int (*)(rtx)));
1369 extern int read_dependence              PROTO ((rtx, rtx));
1370 extern int anti_dependence              PROTO ((rtx, rtx));
1371 extern int output_dependence            PROTO ((rtx, rtx));
1372 extern void init_alias_once             PROTO ((void));
1373 extern void init_alias_analysis         PROTO ((void));
1374 extern void end_alias_analysis          PROTO ((void));
1375
1376 #endif /* _RTL_H */