OSDN Git Service

* rtl.h (global_rtl): New variable, replacing separate variables for
[pf3gnuchains/gcc-fork.git] / gcc / rtl.h
1 /* Register Transfer Language (RTL) definitions for GNU C-Compiler
2    Copyright (C) 1987, 91-96, 1997 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 };
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 rest is used instead of the above, in a CODE_LABEL,
443    if bytecode is being output.
444    We make the slightly kludgy assumption that a LABEL has enough slots
445    to hold these things.  That happens to be true.  */
446
447 /* For static or external objects.  */
448 #define BYTECODE_LABEL(X) (XSTR ((X), 0))
449
450 /* For goto labels inside bytecode functions.  */
451 #define BYTECODE_BC_LABEL(X) (*(struct bc_label **) &XEXP ((X), 1))
452
453 /* The original regno this ADDRESSOF was built for.  */
454 #define ADDRESSOF_REGNO(RTX) ((RTX)->fld[1].rtint)
455
456 /* The variable in the register we took the address of.  */
457 #define ADDRESSOF_DECL(X) ((tree) XEXP ((X), 2))
458 #define SET_ADDRESSOF_DECL(X, T) (XEXP ((X), 2) = (rtx) (T))
459
460 /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
461    so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
462    be decremented and possibly the label can be deleted.  */
463 #define JUMP_LABEL(INSN)   ((INSN)->fld[7].rtx)
464
465 /* Once basic blocks are found in flow.c,
466    each CODE_LABEL starts a chain that goes through
467    all the LABEL_REFs that jump to that label.
468    The chain eventually winds up at the CODE_LABEL; it is circular.  */
469 #define LABEL_REFS(LABEL) ((LABEL)->fld[6].rtx)
470 \f
471 /* This is the field in the LABEL_REF through which the circular chain
472    of references to a particular label is linked.
473    This chain is set up in flow.c.  */
474
475 #define LABEL_NEXTREF(REF) ((REF)->fld[1].rtx)
476
477 /* Once basic blocks are found in flow.c,
478    Each LABEL_REF points to its containing instruction with this field.  */
479
480 #define CONTAINING_INSN(RTX) ((RTX)->fld[2].rtx)
481
482 /* For a REG rtx, REGNO extracts the register number.  */
483
484 #define REGNO(RTX) ((RTX)->fld[0].rtint)
485
486 /* For a REG rtx, REG_FUNCTION_VALUE_P is nonzero if the reg
487    is the current function's return value.  */
488
489 #define REG_FUNCTION_VALUE_P(RTX) ((RTX)->integrated)
490
491 /* 1 in a REG rtx if it corresponds to a variable declared by the user.  */
492 #define REG_USERVAR_P(RTX) ((RTX)->volatil)
493
494 /* For a CONST_INT rtx, INTVAL extracts the integer.  */
495
496 #define INTVAL(RTX) ((RTX)->fld[0].rtwint)
497
498 /* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
499    SUBREG_WORD extracts the word-number.  */
500
501 #define SUBREG_REG(RTX) ((RTX)->fld[0].rtx)
502 #define SUBREG_WORD(RTX) ((RTX)->fld[1].rtint)
503
504 /* 1 if the REG contained in SUBREG_REG is already known to be
505    sign- or zero-extended from the mode of the SUBREG to the mode of
506    the reg.  SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
507    extension.  
508
509    When used as a LHS, is means that this extension must be done
510    when assigning to SUBREG_REG.  */
511
512 #define SUBREG_PROMOTED_VAR_P(RTX) ((RTX)->in_struct)
513 #define SUBREG_PROMOTED_UNSIGNED_P(RTX) ((RTX)->unchanging)
514
515 /* Access various components of an ASM_OPERANDS rtx.  */
516
517 #define ASM_OPERANDS_TEMPLATE(RTX) XSTR ((RTX), 0)
518 #define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XSTR ((RTX), 1)
519 #define ASM_OPERANDS_OUTPUT_IDX(RTX) XINT ((RTX), 2)
520 #define ASM_OPERANDS_INPUT_VEC(RTX) XVEC ((RTX), 3)
521 #define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XVEC ((RTX), 4)
522 #define ASM_OPERANDS_INPUT(RTX, N) XVECEXP ((RTX), 3, (N))
523 #define ASM_OPERANDS_INPUT_LENGTH(RTX) XVECLEN ((RTX), 3)
524 #define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) XSTR (XVECEXP ((RTX), 4, (N)), 0)
525 #define ASM_OPERANDS_INPUT_MODE(RTX, N) GET_MODE (XVECEXP ((RTX), 4, (N)))
526 #define ASM_OPERANDS_SOURCE_FILE(RTX) XSTR ((RTX), 5)
527 #define ASM_OPERANDS_SOURCE_LINE(RTX) XINT ((RTX), 6)
528
529 /* For a MEM rtx, 1 if it's a volatile reference.
530    Also in an ASM_OPERANDS rtx.  */
531 #define MEM_VOLATILE_P(RTX) ((RTX)->volatil)
532
533 /* For a MEM rtx, 1 if it refers to a structure or union component.  */
534 #define MEM_IN_STRUCT_P(RTX) ((RTX)->in_struct)
535
536 /* For a LABEL_REF, 1 means that this reference is to a label outside the
537    loop containing the reference.  */
538 #define LABEL_OUTSIDE_LOOP_P(RTX) ((RTX)->in_struct)
539
540 /* For a LABEL_REF, 1 means it is for a nonlocal label.  */
541 /* Likewise in an EXPR_LIST for a REG_LABEL note.  */
542 #define LABEL_REF_NONLOCAL_P(RTX) ((RTX)->volatil)
543
544 /* For a CODE_LABEL, 1 means always consider this label to be needed.  */
545 #define LABEL_PRESERVE_P(RTX) ((RTX)->in_struct)
546
547 /* For a REG, 1 means the register is used only in an exit test of a loop.  */
548 #define REG_LOOP_TEST_P(RTX) ((RTX)->in_struct)
549
550 /* During sched, for an insn, 1 means that the insn must be scheduled together
551    with the preceding insn.  */
552 #define SCHED_GROUP_P(INSN) ((INSN)->in_struct)
553
554 /* During sched, for the LOG_LINKS of an insn, these cache the adjusted
555    cost of the dependence link.  The cost of executing an instruction
556    may vary based on how the results are used.  LINK_COST_ZERO is 1 when
557    the cost through the link varies and is unchanged (i.e., the link has
558    zero additional cost).  LINK_COST_FREE is 1 when the cost through the
559    link is zero (i.e., the link makes the cost free).  In other cases,
560    the adjustment to the cost is recomputed each time it is needed.  */
561 #define LINK_COST_ZERO(X) ((X)->jump)
562 #define LINK_COST_FREE(X) ((X)->call)
563
564 /* For a SET rtx, SET_DEST is the place that is set
565    and SET_SRC is the value it is set to.  */
566 #define SET_DEST(RTX) ((RTX)->fld[0].rtx)
567 #define SET_SRC(RTX) ((RTX)->fld[1].rtx)
568
569 /* For a TRAP_IF rtx, TRAP_CONDITION is an expression.  */
570 #define TRAP_CONDITION(RTX) ((RTX)->fld[0].rtx)
571
572 /* 1 in a SYMBOL_REF if it addresses this function's constants pool.  */
573 #define CONSTANT_POOL_ADDRESS_P(RTX) ((RTX)->unchanging)
574
575 /* Flag in a SYMBOL_REF for machine-specific purposes.  */
576 #define SYMBOL_REF_FLAG(RTX) ((RTX)->volatil)
577
578 /* 1 means a SYMBOL_REF has been the library function in emit_library_call.  */
579 #define SYMBOL_REF_USED(RTX) ((RTX)->used)
580
581 /* For an INLINE_HEADER rtx, FIRST_FUNCTION_INSN is the first insn
582    of the function that is not involved in copying parameters to
583    pseudo-registers.  FIRST_PARM_INSN is the very first insn of
584    the function, including the parameter copying.
585    We keep this around in case we must splice
586    this function into the assembly code at the end of the file.
587    FIRST_LABELNO is the first label number used by the function (inclusive).
588    LAST_LABELNO is the last label used by the function (exclusive).
589    MAX_REGNUM is the largest pseudo-register used by that function.
590    FUNCTION_ARGS_SIZE is the size of the argument block in the stack.
591    POPS_ARGS is the number of bytes of input arguments popped by the function
592    STACK_SLOT_LIST is the list of stack slots.
593    FORCED_LABELS is the list of labels whose address was taken.
594    FUNCTION_FLAGS are where single-bit flags are saved.
595    OUTGOING_ARGS_SIZE is the size of the largest outgoing stack parameter list.
596    ORIGINAL_ARG_VECTOR is a vector of the original DECL_RTX values
597     for the function arguments.
598    ORIGINAL_DECL_INITIAL is a pointer to the original DECL_INITIAL for the
599     function.
600    INLINE_REGNO_REG_RTX, INLINE_REGNO_POINTER_FLAG, and
601     INLINE_REGNO_POINTER_ALIGN are pointers to the corresponding arrays.
602
603    We want this to lay down like an INSN.  The PREV_INSN field
604    is always NULL.  The NEXT_INSN field always points to the
605    first function insn of the function being squirreled away.  */
606
607 #define FIRST_FUNCTION_INSN(RTX) ((RTX)->fld[2].rtx)
608 #define FIRST_PARM_INSN(RTX) ((RTX)->fld[3].rtx)
609 #define FIRST_LABELNO(RTX) ((RTX)->fld[4].rtint)
610 #define LAST_LABELNO(RTX) ((RTX)->fld[5].rtint)
611 #define MAX_PARMREG(RTX) ((RTX)->fld[6].rtint)
612 #define MAX_REGNUM(RTX) ((RTX)->fld[7].rtint)
613 #define FUNCTION_ARGS_SIZE(RTX) ((RTX)->fld[8].rtint)
614 #define POPS_ARGS(RTX) ((RTX)->fld[9].rtint)
615 #define STACK_SLOT_LIST(RTX) ((RTX)->fld[10].rtx)
616 #define FORCED_LABELS(RTX) ((RTX)->fld[11].rtx)
617 #define FUNCTION_FLAGS(RTX) ((RTX)->fld[12].rtint)
618 #define OUTGOING_ARGS_SIZE(RTX) ((RTX)->fld[13].rtint)
619 #define ORIGINAL_ARG_VECTOR(RTX) ((RTX)->fld[14].rtvec)
620 #define ORIGINAL_DECL_INITIAL(RTX) ((RTX)->fld[15].rtx)
621 #define INLINE_REGNO_REG_RTX(RTX) ((RTX)->fld[16].rtvec)
622 #define INLINE_REGNO_POINTER_FLAG(RTX) ((RTX)->fld[17].rtstr)
623 #define INLINE_REGNO_POINTER_ALIGN(RTX) ((RTX)->fld[18].rtstr)
624 #define PARMREG_STACK_LOC(RTX) ((RTX)->fld[19].rtvec)
625
626 /* In FUNCTION_FLAGS we save some variables computed when emitting the code
627    for the function and which must be `or'ed into the current flag values when
628    insns from that function are being inlined.  */
629
630 /* These ought to be an enum, but non-ANSI compilers don't like that.  */
631 #define FUNCTION_FLAGS_CALLS_ALLOCA 01
632 #define FUNCTION_FLAGS_CALLS_SETJMP 02
633 #define FUNCTION_FLAGS_RETURNS_STRUCT 04
634 #define FUNCTION_FLAGS_RETURNS_PCC_STRUCT 010
635 #define FUNCTION_FLAGS_NEEDS_CONTEXT 020
636 #define FUNCTION_FLAGS_HAS_NONLOCAL_LABEL 040
637 #define FUNCTION_FLAGS_RETURNS_POINTER 0100
638 #define FUNCTION_FLAGS_USES_CONST_POOL 0200
639 #define FUNCTION_FLAGS_CALLS_LONGJMP 0400
640 #define FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE 01000
641
642 /* Define a macro to look for REG_INC notes,
643    but save time on machines where they never exist.  */
644
645 /* Don't continue this line--convex cc version 4.1 would lose.  */
646 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
647 #define FIND_REG_INC_NOTE(insn, reg) (find_reg_note ((insn), REG_INC, (reg)))
648 #else
649 #define FIND_REG_INC_NOTE(insn, reg) 0
650 #endif
651
652 /* Indicate whether the machine has any sort of auto increment addressing.
653    If not, we can avoid checking for REG_INC notes.  */
654
655 /* Don't continue this line--convex cc version 4.1 would lose.  */
656 #if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
657 #define AUTO_INC_DEC
658 #endif
659 \f
660 /* Generally useful functions.  */
661
662 /* The following functions accept a wide integer argument.  Rather than
663    having to cast on every function call, we use a macro instead, that is
664    defined here and in tree.h.  */
665
666 #ifndef exact_log2
667 #define exact_log2(N) exact_log2_wide ((unsigned HOST_WIDE_INT) (N))
668 #define floor_log2(N) floor_log2_wide ((unsigned HOST_WIDE_INT) (N))
669 #endif
670 extern int exact_log2_wide              PROTO((unsigned HOST_WIDE_INT));
671 extern int floor_log2_wide              PROTO((unsigned HOST_WIDE_INT));
672
673 /* In expmed.c */
674 extern int ceil_log2                    PROTO((unsigned HOST_WIDE_INT));
675
676 #define plus_constant(X,C) plus_constant_wide (X, (HOST_WIDE_INT) (C))
677
678 #define plus_constant_for_output(X,C)  \
679   plus_constant_for_output_wide (X, (HOST_WIDE_INT) (C))
680
681 extern rtx plus_constant_wide            PROTO((rtx, HOST_WIDE_INT));
682 extern rtx plus_constant_for_output_wide PROTO((rtx, HOST_WIDE_INT));
683
684 #define GEN_INT(N) gen_rtx (CONST_INT, VOIDmode, (HOST_WIDE_INT) (N))
685
686 struct bc_label;
687 extern rtx bc_gen_rtx                   PROTO ((char *, int,
688                                                 struct bc_label *));
689
690 extern rtx gen_rtx                      PVPROTO((enum rtx_code,
691                                                  enum machine_mode, ...));
692 extern rtvec gen_rtvec                  PVPROTO((int, ...));
693
694 #ifdef BUFSIZ
695 extern rtx read_rtx                     PROTO((FILE *));
696 #endif
697
698 #if 0
699 /* At present, don't prototype xrealloc, since all of the callers don't
700    cast their pointers to char *, and all of the xrealloc's don't use
701    void * yet.  */
702 extern char *xmalloc                    PROTO((size_t));
703 extern char *xrealloc                   PROTO((void *, size_t));
704 #else
705 extern char *xmalloc ();
706 extern char *xrealloc ();
707 #endif
708
709 extern char *oballoc                    PROTO((int));
710 extern char *permalloc                  PROTO((int));
711 #ifdef NEED_DECLARATION_FREE
712 extern void free                        PROTO((void *));
713 #endif
714 extern rtx rtx_alloc                    PROTO((RTX_CODE));
715 extern rtvec rtvec_alloc                PROTO((int));
716 extern rtx copy_rtx                     PROTO((rtx));
717 extern rtx copy_rtx_if_shared           PROTO((rtx));
718 extern rtx copy_most_rtx                PROTO((rtx, rtx));
719 extern rtvec gen_rtvec_v                PROTO((int, rtx *));
720 extern rtvec gen_rtvec_vv               PROTO((int, rtunion *));
721 extern rtx gen_reg_rtx                  PROTO((enum machine_mode));
722 extern rtx gen_label_rtx                PROTO((void));
723 extern rtx gen_inline_header_rtx        PROTO((rtx, rtx, int, int, int, int,
724                                                int, int, rtx, rtx, int, int,
725                                                rtvec, rtx,
726                                                rtvec, char *, char *, rtvec));
727 extern rtx gen_lowpart_common           PROTO((enum machine_mode, rtx));
728 extern rtx gen_lowpart                  PROTO((enum machine_mode, rtx));
729 extern rtx gen_lowpart_if_possible      PROTO((enum machine_mode, rtx));
730 extern rtx gen_highpart                 PROTO((enum machine_mode, rtx));
731 extern rtx gen_realpart                 PROTO((enum machine_mode, rtx));
732 extern rtx gen_imagpart                 PROTO((enum machine_mode, rtx));
733 extern rtx operand_subword              PROTO((rtx, int, int, enum machine_mode));
734 extern rtx operand_subword_force        PROTO((rtx, int, enum machine_mode));
735 extern int subreg_lowpart_p             PROTO((rtx));
736 extern rtx make_safe_from               PROTO((rtx, rtx));
737 extern rtx convert_memory_address       PROTO((enum machine_mode, rtx));
738 extern rtx memory_address               PROTO((enum machine_mode, rtx));
739 extern rtx get_insns                    PROTO((void));
740 extern rtx get_last_insn                PROTO((void));
741 extern rtx get_last_insn_anywhere       PROTO((void));
742 extern void start_sequence              PROTO((void));
743 extern void push_to_sequence            PROTO((rtx));
744 extern void end_sequence                PROTO((void));
745 extern rtx gen_sequence                 PROTO((void));
746 extern rtx immed_double_const           PROTO((HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode));
747 extern rtx force_const_mem              PROTO((enum machine_mode, rtx));
748 extern rtx force_reg                    PROTO((enum machine_mode, rtx));
749 extern rtx get_pool_constant            PROTO((rtx));
750 extern enum machine_mode get_pool_mode  PROTO((rtx));
751 extern int get_pool_offset              PROTO((rtx));
752 extern rtx simplify_subtraction         PROTO((rtx));
753 extern rtx assign_stack_local           PROTO((enum machine_mode, int, int));
754 extern rtx assign_stack_temp            PROTO((enum machine_mode, int, int));
755 extern rtx assign_temp                  PROTO((union tree_node *, int,
756                                                int, int));
757 extern rtx protect_from_queue           PROTO((rtx, int));
758 extern void emit_queue                  PROTO((void));
759 extern rtx emit_move_insn               PROTO((rtx, rtx));
760 extern rtx emit_insn_before             PROTO((rtx, rtx));
761 extern rtx emit_jump_insn_before        PROTO((rtx, rtx));
762 extern rtx emit_call_insn_before        PROTO((rtx, rtx));
763 extern rtx emit_barrier_before          PROTO((rtx));
764 extern rtx emit_note_before             PROTO((int, rtx));
765 extern rtx emit_insn_after              PROTO((rtx, rtx));
766 extern rtx emit_jump_insn_after         PROTO((rtx, rtx));
767 extern rtx emit_barrier_after           PROTO((rtx));
768 extern rtx emit_label_after             PROTO((rtx, rtx));
769 extern rtx emit_note_after              PROTO((int, rtx));
770 extern rtx emit_line_note_after         PROTO((char *, int, rtx));
771 extern rtx emit_insn                    PROTO((rtx));
772 extern rtx emit_insns                   PROTO((rtx));
773 extern rtx emit_insns_before            PROTO((rtx, rtx));
774 extern rtx emit_insns_after             PROTO((rtx, rtx));
775 extern rtx emit_jump_insn               PROTO((rtx));
776 extern rtx emit_call_insn               PROTO((rtx));
777 extern rtx emit_label                   PROTO((rtx));
778 extern rtx emit_barrier                 PROTO((void));
779 extern rtx emit_line_note               PROTO((char *, int));
780 extern rtx emit_note                    PROTO((char *, int));
781 extern rtx emit_line_note_force         PROTO((char *, int));
782 extern rtx make_insn_raw                PROTO((rtx));
783 extern rtx previous_insn                PROTO((rtx));
784 extern rtx next_insn                    PROTO((rtx));
785 extern rtx prev_nonnote_insn            PROTO((rtx));
786 extern rtx next_nonnote_insn            PROTO((rtx));
787 extern rtx prev_real_insn               PROTO((rtx));
788 extern rtx next_real_insn               PROTO((rtx));
789 extern rtx prev_active_insn             PROTO((rtx));
790 extern rtx next_active_insn             PROTO((rtx));
791 extern rtx prev_label                   PROTO((rtx));
792 extern rtx next_label                   PROTO((rtx));
793 extern rtx next_cc0_user                PROTO((rtx));
794 extern rtx prev_cc0_setter              PROTO((rtx));
795 extern rtx next_nondeleted_insn         PROTO((rtx));
796 extern enum rtx_code reverse_condition  PROTO((enum rtx_code));
797 extern enum rtx_code swap_condition     PROTO((enum rtx_code));
798 extern enum rtx_code unsigned_condition PROTO((enum rtx_code));
799 extern enum rtx_code signed_condition   PROTO((enum rtx_code));
800 extern rtx find_equiv_reg               PROTO((rtx, rtx, enum reg_class, int, short *, int, enum machine_mode));
801 extern rtx squeeze_notes                PROTO((rtx, rtx));
802 extern rtx delete_insn                  PROTO((rtx));
803 extern void delete_jump                 PROTO((rtx));
804 extern rtx get_label_before             PROTO((rtx));
805 extern rtx get_label_after              PROTO((rtx));
806 extern rtx follow_jumps                 PROTO((rtx));
807 extern rtx adj_offsettable_operand      PROTO((rtx, int));
808 extern rtx try_split                    PROTO((rtx, rtx, int));
809 extern rtx split_insns                  PROTO((rtx, rtx));
810 extern rtx simplify_unary_operation     PROTO((enum rtx_code, enum machine_mode, rtx, enum machine_mode));
811 extern rtx simplify_binary_operation    PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
812 extern rtx simplify_ternary_operation   PROTO((enum rtx_code, enum machine_mode, enum machine_mode, rtx, rtx, rtx));
813 extern rtx simplify_relational_operation PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
814 extern rtx nonlocal_label_rtx_list      PROTO((void));
815 extern rtx gen_move_insn                PROTO((rtx, rtx));
816 extern rtx gen_jump                     PROTO((rtx));
817 extern rtx gen_beq                      PROTO((rtx));
818 extern rtx gen_bge                      PROTO((rtx));
819 extern rtx gen_ble                      PROTO((rtx));
820 extern rtx gen_mem_addressof            PROTO((rtx, union tree_node *));
821 extern rtx eliminate_constant_term      PROTO((rtx, rtx *));
822 extern rtx expand_complex_abs           PROTO((enum machine_mode, rtx, rtx, int));
823 extern enum machine_mode choose_hard_reg_mode PROTO((int, int));
824 extern int rtx_varies_p         PROTO((rtx));
825 extern int may_trap_p           PROTO((rtx));
826 extern int side_effects_p       PROTO((rtx));
827 extern int volatile_refs_p      PROTO((rtx));
828 extern int volatile_insn_p      PROTO((rtx));
829 extern void remove_note         PROTO((rtx, rtx));
830 extern void note_stores         PROTO((rtx, void (*) (rtx, rtx)));
831 extern int refers_to_regno_p    PROTO((int, int, rtx, rtx *));
832 extern int reg_overlap_mentioned_p PROTO((rtx, rtx));
833 extern rtx find_use_as_address  PROTO((rtx, rtx, HOST_WIDE_INT));
834
835 /* Functions in rtlanal.c */
836
837 extern int rtx_unstable_p               PROTO((rtx));
838 extern int rtx_varies_p                 PROTO((rtx));
839 extern int rtx_addr_varies_p            PROTO((rtx));
840 extern HOST_WIDE_INT get_integer_term   PROTO((rtx));
841 extern rtx get_related_value            PROTO((rtx));
842 extern int reg_mentioned_p              PROTO((rtx, rtx));
843 extern int reg_referenced_p             PROTO((rtx, rtx));
844 extern int reg_used_between_p           PROTO((rtx, rtx, rtx));
845 extern int reg_referenced_between_p     PROTO((rtx, rtx, rtx));
846 extern int reg_set_between_p            PROTO((rtx, rtx, rtx));
847 extern int modified_between_p           PROTO((rtx, rtx, rtx));
848 extern int no_labels_between_p          PROTO((rtx, rtx));
849 extern int modified_in_p                PROTO((rtx, rtx));
850 extern int reg_set_p                    PROTO((rtx, rtx));
851 extern rtx single_set                   PROTO((rtx));
852 extern rtx find_last_value              PROTO((rtx, rtx *, rtx));
853 extern int refers_to_regno_p            PROTO((int, int, rtx, rtx *));
854 extern int reg_overlap_mentioned_p      PROTO((rtx, rtx));
855 extern void note_stores                 PROTO((rtx, void (*)()));
856 extern rtx reg_set_last                 PROTO((rtx, rtx));
857 extern int rtx_equal_p                  PROTO((rtx, rtx));
858 extern int dead_or_set_p                PROTO((rtx, rtx));
859 extern int dead_or_set_regno_p          PROTO((rtx, int));
860 extern rtx find_reg_note                PROTO((rtx, enum reg_note, rtx));
861 extern rtx find_regno_note              PROTO((rtx, enum reg_note, int));
862 extern int find_reg_fusage              PROTO((rtx, enum rtx_code, rtx));
863 extern int find_regno_fusage            PROTO((rtx, enum rtx_code, int));
864 extern void remove_note                 PROTO((rtx, rtx));
865 extern int side_effects_p               PROTO((rtx));
866 extern int volatile_refs_p              PROTO((rtx));
867 extern int volatile_insn_p              PROTO((rtx));
868 extern int may_trap_p                   PROTO((rtx));
869 extern int inequality_comparison_p      PROTO((rtx));
870 extern rtx replace_rtx                  PROTO((rtx, rtx, rtx));
871 extern rtx replace_regs                 PROTO((rtx, rtx *, int, int));
872 extern int computed_jump_p              PROTO((rtx));
873
874 /* Maximum number of parallel sets and clobbers in any insn in this fn.
875    Always at least 3, since the combiner could put that many togetherm
876    and we want this to remain correct for all the remaining passes.  */
877
878 extern int max_parallel;
879
880 extern int asm_noperands                PROTO((rtx));
881 extern char *decode_asm_operands        PROTO((rtx, rtx *, rtx **, char **, enum machine_mode *));
882
883 extern enum reg_class reg_preferred_class PROTO((int));
884 extern enum reg_class reg_alternate_class PROTO((int));
885
886 extern rtx get_first_nonparm_insn       PROTO((void));
887
888 /* Standard pieces of rtx, to be substituted directly into things.  */
889 #define pc_rtx          (&global_rtl.pc_val)
890 #define cc0_rtx         (&global_rtl.cc0_val)
891
892 #define MAX_SAVED_CONST_INT 64
893 extern struct rtx_def const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
894
895 #define const0_rtx      (&const_int_rtx[MAX_SAVED_CONST_INT])
896 #define const1_rtx      (&const_int_rtx[MAX_SAVED_CONST_INT+1])
897 #define const2_rtx      (&const_int_rtx[MAX_SAVED_CONST_INT+2])
898 #define constm1_rtx     (&const_int_rtx[MAX_SAVED_CONST_INT-1])
899 extern rtx const_true_rtx;
900
901 extern rtx const_tiny_rtx[3][(int) MAX_MACHINE_MODE];
902
903 /* Returns a constant 0 rtx in mode MODE.  Integer modes are treated the 
904    same as VOIDmode.  */
905
906 #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
907
908 /* Likewise, for the constants 1 and 2.  */
909
910 #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
911 #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
912
913 extern struct _global_rtl
914 {
915   struct rtx_def pc_val, cc0_val;
916   struct rtx_def stack_pointer_val, frame_pointer_val;
917   struct rtx_def hard_frame_pointer_val;
918   struct rtx_def arg_pointer_val;
919   struct rtx_def virtual_incoming_args_val;
920   struct rtx_def virtual_stack_vars_val;
921   struct rtx_def virtual_stack_dynamic_val;
922   struct rtx_def virtual_outgoing_args_val;
923 } global_rtl;
924
925 /* All references to certain hard regs, except those created
926    by allocating pseudo regs into them (when that's possible),
927    go through these unique rtx objects.  */
928 #define stack_pointer_rtx       (&global_rtl.stack_pointer_val)
929 #define frame_pointer_rtx       (&global_rtl.frame_pointer_val)
930
931 extern rtx pic_offset_table_rtx;
932 extern rtx struct_value_rtx;
933 extern rtx struct_value_incoming_rtx;
934 extern rtx static_chain_rtx;
935 extern rtx static_chain_incoming_rtx;
936
937 /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
938    is used to represent the frame pointer.  This is because the
939    hard frame pointer and the automatic variables are separated by an amount
940    that cannot be determined until after register allocation.  We can assume
941    that in this case ELIMINABLE_REGS will be defined, one action of which
942    will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
943 #ifndef HARD_FRAME_POINTER_REGNUM
944 #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
945 #endif
946
947 /* For register elimination to work properly these hard_frame_pointer_rtx,
948    frame_pointer_rtx, and arg_pointer_rtx must be the same if they refer to
949    the same register.  */
950 #if HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM
951 #define hard_frame_pointer_rtx  (&global_rtl.frame_pointer_val)
952 #else
953 #define hard_frame_pointer_rtx  (&global_rtl.hard_frame_pointer_val)
954 #endif
955
956 #if FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
957 #define arg_pointer_rtx         (&global_rtl.frame_pointer_val)
958 #else
959 #if HARD_POINTER_REGNUM == ARG_POINTER_REGNUM
960 #define arg_pointer_rtx         (&global_rtl.hard_frame_pointer_val)
961 #else
962 #define arg_pointer_rtx         (&global_rtl.arg_pointer_val)
963 #endif
964 #endif
965
966 /* Virtual registers are used during RTL generation to refer to locations into
967    the stack frame when the actual location isn't known until RTL generation
968    is complete.  The routine instantiate_virtual_regs replaces these with
969    the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
970    a constant.  */
971
972 #define FIRST_VIRTUAL_REGISTER  (FIRST_PSEUDO_REGISTER)
973
974 /* This points to the first word of the incoming arguments passed on the stack,
975    either by the caller or by the callee when pretending it was passed by the
976    caller.  */
977
978 #define virtual_incoming_args_rtx (&global_rtl.virtual_incoming_args_val)
979
980 #define VIRTUAL_INCOMING_ARGS_REGNUM    (FIRST_VIRTUAL_REGISTER)
981
982 /* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
983    variable on the stack.  Otherwise, it points to the first variable on
984    the stack.  */
985
986 #define virtual_stack_vars_rtx  (&global_rtl.virtual_stack_vars_val)
987
988 #define VIRTUAL_STACK_VARS_REGNUM       ((FIRST_VIRTUAL_REGISTER) + 1)
989
990 /* This points to the location of dynamically-allocated memory on the stack
991    immediately after the stack pointer has been adjusted by the amount
992    desired.  */
993
994 #define virtual_stack_dynamic_rtx       (&global_rtl.virtual_stack_dynamic_val)
995
996 #define VIRTUAL_STACK_DYNAMIC_REGNUM    ((FIRST_VIRTUAL_REGISTER) + 2)
997
998 /* This points to the location in the stack at which outgoing arguments should
999    be written when the stack is pre-pushed (arguments pushed using push
1000    insns always use sp).  */
1001
1002 #define virtual_outgoing_args_rtx       (&global_rtl.virtual_outgoing_args_val)
1003
1004 #define VIRTUAL_OUTGOING_ARGS_REGNUM    ((FIRST_VIRTUAL_REGISTER) + 3)
1005
1006 #define LAST_VIRTUAL_REGISTER   ((FIRST_VIRTUAL_REGISTER) + 3)
1007
1008 extern rtx find_next_ref                PROTO((rtx, rtx));
1009 extern rtx *find_single_use             PROTO((rtx, rtx, rtx *));
1010
1011 /* It is hard to write the prototype for expand_expr, since it needs
1012    expr.h to be included for the enumeration.  */
1013
1014 extern rtx expand_expr ();
1015
1016 extern rtx output_constant_def          PROTO((union tree_node *));
1017 extern rtx immed_real_const             PROTO((union tree_node *));
1018 extern union tree_node *make_tree       PROTO((union tree_node *, rtx));
1019
1020 /* Abort routines */
1021 extern void fatal_insn_not_found        PROTO((rtx));
1022 extern void fatal_insn                  PROTO((char *, rtx));
1023
1024 /* Define a default value for STORE_FLAG_VALUE.  */
1025
1026 #ifndef STORE_FLAG_VALUE
1027 #define STORE_FLAG_VALUE 1
1028 #endif
1029
1030 /* Nonzero after end of reload pass.
1031    Set to 1 or 0 by toplev.c.  */
1032
1033 extern int reload_completed;
1034
1035 /* Set to 1 while reload_as_needed is operating.
1036    Required by some machines to handle any generated moves differently.  */
1037
1038 extern int reload_in_progress;
1039
1040 /* If this is nonzero, we do not bother generating VOLATILE
1041    around volatile memory references, and we are willing to
1042    output indirect addresses.  If cse is to follow, we reject
1043    indirect addresses so a useful potential cse is generated;
1044    if it is used only once, instruction combination will produce
1045    the same indirect address eventually.  */
1046 extern int cse_not_expected;
1047
1048 /* Indexed by pseudo register number, gives the rtx for that pseudo.
1049    Allocated in parallel with regno_pointer_flag.  */
1050 extern rtx *regno_reg_rtx;
1051
1052 /* Vector indexed by regno; contain the alignment in bytes and type
1053    pointed to for a register that contains a pointer, if known.  */
1054 extern char *regno_pointer_align;
1055 #define REGNO_POINTER_ALIGN(REGNO) regno_pointer_align[REGNO]
1056
1057 /* Translates rtx code to tree code, for those codes needed by
1058    REAL_ARITHMETIC.  The function returns an int because the caller may not
1059    know what `enum tree_code' means.  */
1060
1061 extern int rtx_to_tree_code     PROTO((enum rtx_code));
1062
1063 /* In rtlanal.c */
1064 extern int reg_set_p                    PROTO ((rtx, rtx));
1065 extern int reg_mentioned_p              PROTO ((rtx, rtx));
1066 extern int reg_referenced_p             PROTO ((rtx, rtx));
1067 extern int reg_used_between_p           PROTO ((rtx, rtx, rtx));
1068 extern int reg_set_p                    PROTO ((rtx, rtx));
1069 extern int reg_referenced_between_p     PROTO ((rtx, rtx, rtx));
1070 extern int reg_set_between_p            PROTO ((rtx, rtx, rtx));
1071 extern int rtx_unstable_p               PROTO ((rtx));
1072 extern int rtx_addr_varies_p            PROTO ((rtx));
1073 extern int rtx_equal_p                  PROTO ((rtx, rtx));
1074 extern int inequality_comparisons_p     PROTO ((rtx));
1075 extern int dead_or_set_p                PROTO ((rtx, rtx));
1076 extern int dead_or_set_regno_p          PROTO ((rtx, int));
1077 extern int no_labels_between_p          PROTO ((rtx, rtx));
1078 extern int modified_between_p           PROTO ((rtx, rtx, rtx));
1079 extern int modified_in_p                PROTO ((rtx, rtx));
1080
1081 /* In tree.c */
1082 extern void obfree                      PROTO ((char *));
1083 struct obstack;
1084 extern void gcc_obstack_init            PROTO ((struct obstack *));
1085 extern void pop_obstacks                PROTO ((void));
1086 extern void push_obstacks               PROTO ((struct obstack *,
1087                                                 struct obstack *));
1088 #ifdef BUFSIZ
1089 extern int read_skip_spaces             PROTO ((FILE *));
1090 #endif
1091
1092 /* In cse.c */
1093 struct cse_basic_block_data;
1094 extern int rtx_cost                     PROTO ((rtx, enum rtx_code));
1095 extern void delete_dead_from_cse        PROTO ((rtx, int));
1096 #ifdef BUFSIZ
1097 extern int cse_main                     PROTO ((rtx, int, int, FILE *));
1098 #endif
1099 extern void cse_end_of_basic_block      PROTO ((rtx,
1100                                                 struct cse_basic_block_data *,
1101                                                 int, int, int));
1102
1103 /* In jump.c */
1104 extern int comparison_dominates_p       PROTO ((enum rtx_code, enum rtx_code));
1105 extern int condjump_p                   PROTO ((rtx));
1106 extern int simplejump_p                 PROTO ((rtx));
1107 extern int sets_cc0_p                   PROTO ((rtx));
1108 extern int invert_jump                  PROTO ((rtx, rtx));
1109 extern int rtx_renumbered_equal_p       PROTO ((rtx, rtx));
1110 extern int true_regnum                  PROTO ((rtx));
1111 extern int redirect_jump                PROTO ((rtx, rtx));
1112 extern void jump_optimize               PROTO ((rtx, int, int, int));
1113 extern void thread_jumps                PROTO ((rtx, int, int));
1114 extern int redirect_exp                 PROTO ((rtx *, rtx, rtx, rtx));
1115 extern int rtx_equal_for_thread_p       PROTO ((rtx, rtx, rtx));
1116 extern int invert_exp                   PROTO ((rtx, rtx));
1117 extern int can_reverse_comparison_p     PROTO ((rtx, rtx));
1118 extern void delete_for_peephole         PROTO ((rtx, rtx));
1119 extern int condjump_in_parallel_p       PROTO ((rtx));
1120
1121 /* In emit-rtl.c. */
1122 extern int max_reg_num                          PROTO ((void));
1123 extern int max_label_num                        PROTO ((void));
1124 extern int get_first_label_num                  PROTO ((void));
1125 extern void delete_insns_since                  PROTO ((rtx));
1126 extern void mark_reg_pointer                    PROTO ((rtx, int));
1127 extern void mark_user_reg                       PROTO ((rtx));
1128 extern void reset_used_flags                    PROTO ((rtx));
1129 extern void reorder_insns                       PROTO ((rtx, rtx, rtx));
1130 extern int get_max_uid                          PROTO ((void));
1131 extern int in_sequence_p                        PROTO ((void));
1132 extern void force_next_line_note                PROTO ((void));
1133 extern void init_emit                           PROTO ((void));
1134 extern void init_emit_once                      PROTO ((int));
1135 extern void push_topmost_sequence               PROTO ((void));
1136 extern void pop_topmost_sequence                PROTO ((void));
1137 extern int subreg_realpart_p                    PROTO ((rtx));
1138 extern void reverse_comparison                  PROTO ((rtx));
1139 extern void set_new_first_and_last_insn         PROTO ((rtx, rtx));
1140 extern void set_new_first_and_last_label_num    PROTO ((int, int));
1141 extern void unshare_all_rtl                     PROTO ((rtx));
1142 extern void set_last_insn                       PROTO ((rtx));
1143 extern void link_cc0_insns                      PROTO ((rtx));
1144 extern void add_insn                            PROTO ((rtx));
1145 extern void add_insn_before                     PROTO ((rtx, rtx));
1146 extern void add_insn_after                      PROTO ((rtx, rtx));
1147 extern void reorder_insns_with_line_notes       PROTO ((rtx, rtx, rtx));
1148 extern void emit_insn_after_with_line_notes     PROTO ((rtx, rtx, rtx));
1149 extern enum rtx_code classify_insn              PROTO ((rtx));
1150 extern rtx emit                                 PROTO ((rtx));
1151
1152 /* In insn-emit.c */
1153 extern void add_clobbers                PROTO ((rtx, int));
1154
1155 /* In combine.c */
1156 extern void combine_instructions        PROTO ((rtx, int));
1157 extern int extended_count               PROTO ((rtx, enum machine_mode, int));
1158 extern rtx remove_death                 PROTO ((int, rtx));
1159 #ifdef BUFSIZ
1160 extern void dump_combine_stats          PROTO ((FILE *));
1161 extern void dump_combine_total_stats    PROTO ((FILE *));
1162 #endif
1163
1164 /* In sched.c. */
1165 #ifdef BUFSIZ
1166 extern void schedule_insns              PROTO ((FILE *));
1167 #endif
1168
1169 /* In print-rtl.c */
1170 extern void debug_rtx                   PROTO ((rtx));
1171 extern void debug_rtx_list              PROTO ((rtx, int));
1172 extern rtx debug_rtx_find               PROTO ((rtx, int));
1173 #ifdef BUFSIZ
1174 extern void print_rtl                   PROTO ((FILE *, rtx));
1175 extern void print_inline_rtx            PROTO ((FILE *, rtx, int));
1176 #endif
1177
1178 /* In loop.c */
1179 extern void init_loop                   PROTO ((void));
1180 #ifdef BUFSIZ
1181 extern void loop_optimize               PROTO ((rtx, FILE *, int));
1182 #endif
1183 extern void record_excess_regs          PROTO ((rtx, rtx, rtx *));
1184
1185 /* In function.c */
1186 extern void reposition_prologue_and_epilogue_notes      PROTO ((rtx));
1187 extern void thread_prologue_and_epilogue_insns          PROTO ((rtx));
1188 extern void use_variable                                PROTO ((rtx));
1189 extern HOST_WIDE_INT get_frame_size                     PROTO ((void));
1190 extern void preserve_rtl_expr_result                    PROTO ((rtx));
1191 extern void mark_temp_addr_taken                        PROTO ((rtx));
1192 extern void update_temp_slot_address                    PROTO ((rtx, rtx));
1193 extern void use_variable_after                          PROTO ((rtx, rtx));
1194
1195 /* In reload.c */
1196 extern int operands_match_p             PROTO ((rtx, rtx));
1197 extern int safe_from_earlyclobber       PROTO ((rtx, rtx));
1198 extern int strict_memory_address_p      PROTO ((enum machine_mode, rtx));
1199
1200 /* In recog.c */
1201 extern int memory_address_p             PROTO ((enum machine_mode, rtx));
1202 extern int constrain_operands           PROTO ((int, int));
1203 extern int mode_dependent_address_p     PROTO ((rtx));
1204 extern void init_recog_no_volatile      PROTO ((void));
1205 extern int offsettable_memref_pq        PROTO ((rtx));
1206 extern int offsettable_nonstrict_memref_p PROTO ((rtx));
1207 extern int reg_fits_class_p             PROTO ((rtx, register enum reg_class,
1208                                                 int, enum machine_mode));
1209 extern int check_asm_operands           PROTO ((rtx));
1210 extern int address_operand              PROTO ((rtx, enum machine_mode));
1211 extern int const_int_operand            PROTO ((rtx, enum machine_mode));
1212 extern int const_double_operand         PROTO ((rtx, enum machine_mode));
1213 extern int general_operand              PROTO ((rtx, enum machine_mode));
1214 extern int immediate_operand            PROTO ((rtx, enum machine_mode));
1215 extern int nonimmediate_operand         PROTO ((rtx, enum machine_mode));
1216 extern int memory_operand               PROTO ((rtx, enum machine_mode));
1217 extern int nonmemory_operand            PROTO ((rtx, enum machine_mode));
1218 extern int push_operand                 PROTO ((rtx, enum machine_mode));
1219 extern int register_operand             PROTO ((rtx, enum machine_mode));
1220 extern int scratch_operand              PROTO ((rtx, enum machine_mode));
1221 extern int indirect_operand             PROTO ((rtx, enum machine_mode));
1222 extern int mode_independent_operand     PROTO ((rtx, enum machine_mode));
1223 extern int comparison_operator          PROTO ((rtx, enum machine_mode));
1224 extern void init_recog_no_volatile      PROTO ((void));
1225 extern void init_recog                  PROTO ((void));
1226 extern int validate_replace_rtx         PROTO ((rtx, rtx, rtx));
1227 extern int offsettable_address_p        PROTO ((int, enum machine_mode, rtx));
1228 extern int next_insn_tests_no_inequality PROTO ((rtx));
1229 extern int recog_memoized               PROTO ((rtx));
1230 extern int validate_change              PROTO ((rtx, rtx *, rtx, int));
1231 extern int apply_change_group           PROTO ((void));
1232 extern void cancel_changes              PROTO ((int));
1233 extern int num_validated_changes        PROTO ((void));
1234
1235 /* In insn-recog.c */
1236 extern int recog                        PROTO ((rtx, rtx, int *));
1237
1238 /* In stmt.c */
1239 extern void emit_jump                   PROTO ((rtx));
1240 extern int preserve_subexpressions_p    PROTO ((void));
1241
1242 /* In expr.c */
1243 extern rtx bc_allocate_local            PROTO ((int, int));
1244 extern void init_expr_once              PROTO ((void));
1245
1246 /* In stupid.c */
1247 #ifdef BUFSIZ
1248 extern void stupid_life_analysis        PROTO ((rtx, int, FILE *));
1249 #endif
1250
1251 /* In flow.c */
1252 extern void allocate_for_life_analysis  PROTO ((void));
1253 #ifdef BUFSIZ
1254 extern void dump_flow_info              PROTO ((FILE *));
1255 #endif
1256
1257 /* In expmed.c */
1258 extern void init_expmed                 PROTO ((void));
1259 extern void expand_inc                  PROTO ((rtx, rtx));
1260 extern void expand_dec                  PROTO ((rtx, rtx));
1261 extern rtx expand_mult_highpart         PROTO ((enum machine_mode, rtx,
1262                                                 unsigned HOST_WIDE_INT, rtx,
1263                                                 int, int));
1264
1265 /* In toplev.c */
1266 extern void strip_off_ending            PROTO ((char *, int));
1267 extern void print_time                  PROTO ((char *, int));
1268 extern int get_run_time                 PROTO ((void));
1269 #if 0
1270 extern void fatal                       PVPROTO ((char *, ...));
1271 extern void warning                     PVPROTO ((char *, ...));
1272 extern void error                       PVPROTO ((char *, ...));
1273 #endif
1274 extern void pfatal_with_name            PROTO ((char *));
1275 extern void fancy_abort                 PROTO ((void));
1276 extern int count_error                  PROTO ((int));
1277 extern void pedwarn                     PVPROTO ((char *, ...));
1278 extern void warning_for_asm             PVPROTO ((rtx, char *, ...));
1279 extern void error_for_asm               PVPROTO ((rtx, char *, ...));
1280
1281 /* In global.c */
1282 #ifdef BUFSIZ
1283 extern int global_alloc                 PROTO ((FILE *));
1284 extern void dump_global_regs            PROTO ((FILE *));
1285 #endif
1286
1287 /* In regclass.c */
1288 extern void globalize_reg               PROTO ((int));
1289 extern void init_regs                   PROTO ((void));
1290 extern void init_reg_sets               PROTO ((void));
1291 extern void regset_release_memory       PROTO ((void));
1292 extern void regclass_init               PROTO ((void));
1293 extern void regclass                    PROTO ((rtx, int));
1294 extern void reg_scan                    PROTO ((rtx, int, int));
1295 extern void fix_register                PROTO ((char *, int, int));
1296
1297 /* In optabs.c */
1298 extern void init_optabs                 PROTO ((void));
1299
1300 /* In local-alloc.c */
1301 #ifdef BUFSIZ
1302 extern void dump_local_alloc            PROTO ((FILE *));
1303 #endif
1304 extern void local_alloc                 PROTO ((void));
1305
1306 /* In reload1.c */
1307 extern void reload_cse_regs             PROTO ((rtx));
1308 extern void init_reload                 PROTO ((void));
1309 extern void mark_home_live              PROTO ((int));
1310 #ifdef BUFSIZ
1311 extern int reload                       PROTO ((rtx, int, FILE *));
1312 #endif
1313
1314 /* In caller-save.c */
1315 extern void init_caller_save            PROTO ((void));
1316
1317 /* In profile.c */
1318 extern void init_branch_prob            PROTO ((char *));
1319
1320 /* In reg-stack.c */
1321 #ifdef BUFSIZ
1322 extern void reg_to_stack                PROTO ((rtx, FILE *));
1323 #endif
1324 extern int stack_regs_mentioned_p       PROTO ((rtx));
1325
1326 /* In fold-const.c */
1327 extern int add_double           PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1328                                         HOST_WIDE_INT, HOST_WIDE_INT,
1329                                         HOST_WIDE_INT *, HOST_WIDE_INT *));
1330 extern int neg_double           PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1331                                         HOST_WIDE_INT *, HOST_WIDE_INT *));
1332 extern int mul_double           PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1333                                         HOST_WIDE_INT, HOST_WIDE_INT,
1334                                         HOST_WIDE_INT *, HOST_WIDE_INT *));
1335 extern void lshift_double       PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1336                                         HOST_WIDE_INT, int, HOST_WIDE_INT *,
1337                                         HOST_WIDE_INT *, int));
1338 extern void rshift_double       PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1339                                         HOST_WIDE_INT, int,
1340                                         HOST_WIDE_INT *, HOST_WIDE_INT *, int));
1341 extern void lrotate_double      PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1342                                         HOST_WIDE_INT, int, HOST_WIDE_INT *,
1343                                         HOST_WIDE_INT *));
1344 extern void rrotate_double      PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1345                                         HOST_WIDE_INT, int, HOST_WIDE_INT *,
1346                                         HOST_WIDE_INT *));
1347
1348 /* In calls.c */
1349 /* Emit library call.  */                                           
1350 extern void emit_library_call           PVPROTO ((rtx, int, enum machine_mode,
1351                                                   int, ...));
1352 extern rtx emit_library_call_value      PVPROTO((rtx, rtx, int,
1353                                                  enum machine_mode,
1354                                                  int, ...));
1355
1356 /* In unroll.c */
1357 extern int set_dominates_use            PROTO ((int, int, int, rtx, rtx));
1358
1359 /* In varasm.c */
1360 extern void bss_section                 PROTO ((void));
1361 extern int in_data_section              PROTO ((void));
1362 extern int supports_one_only            PROTO ((void));
1363
1364 /* In rtl.c */
1365 extern void init_rtl                    PROTO ((void));
1366 extern void rtx_free                    PROTO ((rtx));
1367
1368 /* In alias.c */
1369 extern int true_dependence              PROTO ((rtx, enum machine_mode, rtx,
1370                                                 int (*)(rtx)));
1371 extern int read_dependence              PROTO ((rtx, rtx));
1372 extern int anti_dependence              PROTO ((rtx, rtx));
1373 extern int output_dependence            PROTO ((rtx, rtx));
1374 extern void init_alias_analysis         PROTO ((void));
1375 extern void end_alias_analysis          PROTO ((void));
1376
1377 #endif /* _RTL_H */
1378