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