toplev.h: New file.
[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,
758 HOST_WIDE_INT, int));
759 extern rtx assign_stack_temp PROTO((enum machine_mode,
760 HOST_WIDE_INT, int));
761 extern rtx assign_temp PROTO((union tree_node *,
762 int, int, int));
763 extern rtx protect_from_queue PROTO((rtx, int));
764 extern void emit_queue PROTO((void));
765 extern rtx emit_move_insn PROTO((rtx, rtx));
766 extern rtx emit_insn_before PROTO((rtx, rtx));
767 extern rtx emit_jump_insn_before PROTO((rtx, rtx));
768 extern rtx emit_call_insn_before PROTO((rtx, rtx));
769 extern rtx emit_barrier_before PROTO((rtx));
770 extern rtx emit_note_before PROTO((int, rtx));
771 extern rtx emit_insn_after PROTO((rtx, rtx));
772 extern rtx emit_jump_insn_after PROTO((rtx, rtx));
773 extern rtx emit_barrier_after PROTO((rtx));
774 extern rtx emit_label_after PROTO((rtx, rtx));
775 extern rtx emit_note_after PROTO((int, rtx));
776 extern rtx emit_line_note_after PROTO((char *, int, rtx));
777 extern rtx emit_insn PROTO((rtx));
778 extern rtx emit_insns PROTO((rtx));
779 extern rtx emit_insns_before PROTO((rtx, rtx));
780 extern rtx emit_insns_after PROTO((rtx, rtx));
781 extern rtx emit_jump_insn PROTO((rtx));
782 extern rtx emit_call_insn PROTO((rtx));
783 extern rtx emit_label PROTO((rtx));
784 extern rtx emit_barrier PROTO((void));
785 extern rtx emit_line_note PROTO((char *, int));
786 extern rtx emit_note PROTO((char *, int));
787 extern rtx emit_line_note_force PROTO((char *, int));
788 extern rtx make_insn_raw PROTO((rtx));
789 extern rtx previous_insn PROTO((rtx));
790 extern rtx next_insn PROTO((rtx));
791 extern rtx prev_nonnote_insn PROTO((rtx));
792 extern rtx next_nonnote_insn PROTO((rtx));
793 extern rtx prev_real_insn PROTO((rtx));
794 extern rtx next_real_insn PROTO((rtx));
795 extern rtx prev_active_insn PROTO((rtx));
796 extern rtx next_active_insn PROTO((rtx));
797 extern rtx prev_label PROTO((rtx));
798 extern rtx next_label PROTO((rtx));
799 extern rtx next_cc0_user PROTO((rtx));
800 extern rtx prev_cc0_setter PROTO((rtx));
801 extern rtx next_nondeleted_insn PROTO((rtx));
802 extern enum rtx_code reverse_condition PROTO((enum rtx_code));
803 extern enum rtx_code swap_condition PROTO((enum rtx_code));
804 extern enum rtx_code unsigned_condition PROTO((enum rtx_code));
805 extern enum rtx_code signed_condition PROTO((enum rtx_code));
806 extern rtx find_equiv_reg PROTO((rtx, rtx, enum reg_class, int, short *, int, enum machine_mode));
807 extern rtx squeeze_notes PROTO((rtx, rtx));
808 extern rtx delete_insn PROTO((rtx));
809 extern void delete_jump PROTO((rtx));
810 extern rtx get_label_before PROTO((rtx));
811 extern rtx get_label_after PROTO((rtx));
812 extern rtx follow_jumps PROTO((rtx));
813 extern rtx adj_offsettable_operand PROTO((rtx, int));
814 extern rtx try_split PROTO((rtx, rtx, int));
815 extern rtx split_insns PROTO((rtx, rtx));
816 extern rtx simplify_unary_operation PROTO((enum rtx_code, enum machine_mode, rtx, enum machine_mode));
817 extern rtx simplify_binary_operation PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
818 extern rtx simplify_ternary_operation PROTO((enum rtx_code, enum machine_mode, enum machine_mode, rtx, rtx, rtx));
819 extern rtx simplify_relational_operation PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
820 extern rtx nonlocal_label_rtx_list PROTO((void));
821 extern rtx gen_move_insn PROTO((rtx, rtx));
822 extern rtx gen_jump PROTO((rtx));
823 extern rtx gen_beq PROTO((rtx));
824 extern rtx gen_bge PROTO((rtx));
825 extern rtx gen_ble PROTO((rtx));
826 extern rtx gen_mem_addressof PROTO((rtx, union tree_node *));
827 extern rtx eliminate_constant_term PROTO((rtx, rtx *));
828 extern rtx expand_complex_abs PROTO((enum machine_mode, rtx, rtx, int));
829 extern enum machine_mode choose_hard_reg_mode PROTO((int, int));
830 extern int rtx_varies_p PROTO((rtx));
831 extern int may_trap_p PROTO((rtx));
832 extern int side_effects_p PROTO((rtx));
833 extern int volatile_refs_p PROTO((rtx));
834 extern int volatile_insn_p PROTO((rtx));
835 extern void remove_note PROTO((rtx, rtx));
836 extern void note_stores PROTO((rtx, void (*) (rtx, rtx)));
837 extern int refers_to_regno_p PROTO((int, int, rtx, rtx *));
838 extern int reg_overlap_mentioned_p PROTO((rtx, rtx));
839 extern rtx find_use_as_address PROTO((rtx, rtx, HOST_WIDE_INT));
840
841 /* Functions in rtlanal.c */
842
843 extern int rtx_unstable_p PROTO((rtx));
844 extern int rtx_varies_p PROTO((rtx));
845 extern int rtx_addr_varies_p PROTO((rtx));
846 extern HOST_WIDE_INT get_integer_term PROTO((rtx));
847 extern rtx get_related_value PROTO((rtx));
848 extern int reg_mentioned_p PROTO((rtx, rtx));
849 extern int reg_referenced_p PROTO((rtx, rtx));
850 extern int reg_used_between_p PROTO((rtx, rtx, rtx));
851 extern int reg_referenced_between_p PROTO((rtx, rtx, rtx));
852 extern int reg_set_between_p PROTO((rtx, rtx, rtx));
853 extern int modified_between_p PROTO((rtx, rtx, rtx));
854 extern int no_labels_between_p PROTO((rtx, rtx));
855 extern int modified_in_p PROTO((rtx, rtx));
856 extern int reg_set_p PROTO((rtx, rtx));
857 extern rtx single_set PROTO((rtx));
858 extern rtx find_last_value PROTO((rtx, rtx *, rtx));
859 extern int refers_to_regno_p PROTO((int, int, rtx, rtx *));
860 extern int reg_overlap_mentioned_p PROTO((rtx, rtx));
861 extern rtx reg_set_last PROTO((rtx, rtx));
862 extern int rtx_equal_p PROTO((rtx, rtx));
863 extern int dead_or_set_p PROTO((rtx, rtx));
864 extern int dead_or_set_regno_p PROTO((rtx, int));
865 extern rtx find_reg_note PROTO((rtx, enum reg_note, rtx));
866 extern rtx find_regno_note PROTO((rtx, enum reg_note, int));
867 extern int find_reg_fusage PROTO((rtx, enum rtx_code, rtx));
868 extern int find_regno_fusage PROTO((rtx, enum rtx_code, int));
869 extern void remove_note PROTO((rtx, rtx));
870 extern int side_effects_p PROTO((rtx));
871 extern int volatile_refs_p PROTO((rtx));
872 extern int volatile_insn_p PROTO((rtx));
873 extern int may_trap_p PROTO((rtx));
874 extern int inequality_comparison_p PROTO((rtx));
875 extern rtx replace_rtx PROTO((rtx, rtx, rtx));
876 extern rtx replace_regs PROTO((rtx, rtx *, int, int));
877 extern int computed_jump_p PROTO((rtx));
878
879 /* Maximum number of parallel sets and clobbers in any insn in this fn.
880 Always at least 3, since the combiner could put that many togetherm
881 and we want this to remain correct for all the remaining passes. */
882
883 extern int max_parallel;
884
885 extern int asm_noperands PROTO((rtx));
886 extern char *decode_asm_operands PROTO((rtx, rtx *, rtx **, char **, enum machine_mode *));
887
888 extern enum reg_class reg_preferred_class PROTO((int));
889 extern enum reg_class reg_alternate_class PROTO((int));
890
891 extern rtx get_first_nonparm_insn PROTO((void));
892
893 /* Standard pieces of rtx, to be substituted directly into things. */
894 #define pc_rtx (&global_rtl.pc_val)
895 #define cc0_rtx (&global_rtl.cc0_val)
896
897 #define MAX_SAVED_CONST_INT 64
898 extern struct rtx_def const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
899
900 #define const0_rtx (&const_int_rtx[MAX_SAVED_CONST_INT])
901 #define const1_rtx (&const_int_rtx[MAX_SAVED_CONST_INT+1])
902 #define const2_rtx (&const_int_rtx[MAX_SAVED_CONST_INT+2])
903 #define constm1_rtx (&const_int_rtx[MAX_SAVED_CONST_INT-1])
904 extern rtx const_true_rtx;
905
906 extern rtx const_tiny_rtx[3][(int) MAX_MACHINE_MODE];
907
908 /* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
909 same as VOIDmode. */
910
911 #define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
912
913 /* Likewise, for the constants 1 and 2. */
914
915 #define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
916 #define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
917
918 extern struct _global_rtl
919 {
920 struct rtx_def pc_val, cc0_val;
921 struct rtx_def stack_pointer_val, frame_pointer_val;
922 struct rtx_def hard_frame_pointer_val;
923 struct rtx_def arg_pointer_val;
924 struct rtx_def virtual_incoming_args_val;
925 struct rtx_def virtual_stack_vars_val;
926 struct rtx_def virtual_stack_dynamic_val;
927 struct rtx_def virtual_outgoing_args_val;
928 } global_rtl;
929
930 /* All references to certain hard regs, except those created
931 by allocating pseudo regs into them (when that's possible),
932 go through these unique rtx objects. */
933 #define stack_pointer_rtx (&global_rtl.stack_pointer_val)
934 #define frame_pointer_rtx (&global_rtl.frame_pointer_val)
935
936 extern rtx pic_offset_table_rtx;
937 extern rtx struct_value_rtx;
938 extern rtx struct_value_incoming_rtx;
939 extern rtx static_chain_rtx;
940 extern rtx static_chain_incoming_rtx;
941
942
943 /* Include the RTL generation functions. */
944
945 #ifndef NO_GENRTL_H
946 #include "genrtl.h"
947 #endif
948
949 /* There are two RTL codes that require special attention; the generation
950 functions included above do the raw handling. */
951
952 extern rtx gen_rtx_CONST_INT PROTO((enum machine_mode, HOST_WIDE_INT));
953 extern rtx gen_rtx_REG PROTO((enum machine_mode, int));
954
955 /* We need the cast here to ensure that we get the same result both with
956 and without prototypes. */
957 #define GEN_INT(N) gen_rtx_CONST_INT (VOIDmode, (HOST_WIDE_INT) (N))
958
959
960 /* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
961 is used to represent the frame pointer. This is because the
962 hard frame pointer and the automatic variables are separated by an amount
963 that cannot be determined until after register allocation. We can assume
964 that in this case ELIMINABLE_REGS will be defined, one action of which
965 will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
966 #ifndef HARD_FRAME_POINTER_REGNUM
967 #define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
968 #endif
969
970 /* For register elimination to work properly these hard_frame_pointer_rtx,
971 frame_pointer_rtx, and arg_pointer_rtx must be the same if they refer to
972 the same register. */
973 #if HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM
974 #define hard_frame_pointer_rtx (&global_rtl.frame_pointer_val)
975 #else
976 #define hard_frame_pointer_rtx (&global_rtl.hard_frame_pointer_val)
977 #endif
978
979 #if FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
980 #define arg_pointer_rtx (&global_rtl.frame_pointer_val)
981 #else
982 #if HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
983 #define arg_pointer_rtx (&global_rtl.hard_frame_pointer_val)
984 #else
985 #define arg_pointer_rtx (&global_rtl.arg_pointer_val)
986 #endif
987 #endif
988
989 /* Virtual registers are used during RTL generation to refer to locations into
990 the stack frame when the actual location isn't known until RTL generation
991 is complete. The routine instantiate_virtual_regs replaces these with
992 the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
993 a constant. */
994
995 #define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
996
997 /* This points to the first word of the incoming arguments passed on the stack,
998 either by the caller or by the callee when pretending it was passed by the
999 caller. */
1000
1001 #define virtual_incoming_args_rtx (&global_rtl.virtual_incoming_args_val)
1002
1003 #define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
1004
1005 /* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
1006 variable on the stack. Otherwise, it points to the first variable on
1007 the stack. */
1008
1009 #define virtual_stack_vars_rtx (&global_rtl.virtual_stack_vars_val)
1010
1011 #define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
1012
1013 /* This points to the location of dynamically-allocated memory on the stack
1014 immediately after the stack pointer has been adjusted by the amount
1015 desired. */
1016
1017 #define virtual_stack_dynamic_rtx (&global_rtl.virtual_stack_dynamic_val)
1018
1019 #define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
1020
1021 /* This points to the location in the stack at which outgoing arguments should
1022 be written when the stack is pre-pushed (arguments pushed using push
1023 insns always use sp). */
1024
1025 #define virtual_outgoing_args_rtx (&global_rtl.virtual_outgoing_args_val)
1026
1027 #define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
1028
1029 #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 3)
1030
1031 extern rtx find_next_ref PROTO((rtx, rtx));
1032 extern rtx *find_single_use PROTO((rtx, rtx, rtx *));
1033
1034 /* It is hard to write the prototype for expand_expr, since it needs
1035 expr.h to be included for the enumeration. */
1036
1037 extern rtx expand_expr ();
1038
1039 extern rtx output_constant_def PROTO((union tree_node *));
1040 extern rtx immed_real_const PROTO((union tree_node *));
1041 extern union tree_node *make_tree PROTO((union tree_node *, rtx));
1042
1043 /* Abort routines */
1044 extern void fatal_insn_not_found PROTO((rtx));
1045 extern void fatal_insn PROTO((char *, rtx));
1046
1047 /* Define a default value for STORE_FLAG_VALUE. */
1048
1049 #ifndef STORE_FLAG_VALUE
1050 #define STORE_FLAG_VALUE 1
1051 #endif
1052
1053 /* Nonzero after end of reload pass.
1054 Set to 1 or 0 by toplev.c. */
1055
1056 extern int reload_completed;
1057
1058 /* Set to 1 while reload_as_needed is operating.
1059 Required by some machines to handle any generated moves differently. */
1060
1061 extern int reload_in_progress;
1062
1063 /* If this is nonzero, we do not bother generating VOLATILE
1064 around volatile memory references, and we are willing to
1065 output indirect addresses. If cse is to follow, we reject
1066 indirect addresses so a useful potential cse is generated;
1067 if it is used only once, instruction combination will produce
1068 the same indirect address eventually. */
1069 extern int cse_not_expected;
1070
1071 /* Indexed by pseudo register number, gives the rtx for that pseudo.
1072 Allocated in parallel with regno_pointer_flag. */
1073 extern rtx *regno_reg_rtx;
1074
1075 /* Vector indexed by regno; contain the alignment in bytes and type
1076 pointed to for a register that contains a pointer, if known. */
1077 extern char *regno_pointer_align;
1078 #define REGNO_POINTER_ALIGN(REGNO) regno_pointer_align[REGNO]
1079
1080 /* Translates rtx code to tree code, for those codes needed by
1081 REAL_ARITHMETIC. The function returns an int because the caller may not
1082 know what `enum tree_code' means. */
1083
1084 extern int rtx_to_tree_code PROTO((enum rtx_code));
1085
1086 /* In rtlanal.c */
1087 extern int reg_set_p PROTO ((rtx, rtx));
1088 extern int reg_mentioned_p PROTO ((rtx, rtx));
1089 extern int reg_referenced_p PROTO ((rtx, rtx));
1090 extern int reg_used_between_p PROTO ((rtx, rtx, rtx));
1091 extern int reg_set_p PROTO ((rtx, rtx));
1092 extern int reg_referenced_between_p PROTO ((rtx, rtx, rtx));
1093 extern int reg_set_between_p PROTO ((rtx, rtx, rtx));
1094 extern int rtx_unstable_p PROTO ((rtx));
1095 extern int rtx_addr_varies_p PROTO ((rtx));
1096 extern int rtx_equal_p PROTO ((rtx, rtx));
1097 extern int inequality_comparisons_p PROTO ((rtx));
1098 extern int dead_or_set_p PROTO ((rtx, rtx));
1099 extern int dead_or_set_regno_p PROTO ((rtx, int));
1100 extern int no_labels_between_p PROTO ((rtx, rtx));
1101 extern int modified_between_p PROTO ((rtx, rtx, rtx));
1102 extern int modified_in_p PROTO ((rtx, rtx));
1103
1104 /* In tree.c */
1105 extern void obfree PROTO ((char *));
1106 struct obstack;
1107 extern void gcc_obstack_init PROTO ((struct obstack *));
1108 extern void pop_obstacks PROTO ((void));
1109 extern void push_obstacks PROTO ((struct obstack *,
1110 struct obstack *));
1111 #ifdef BUFSIZ
1112 extern int read_skip_spaces PROTO ((FILE *));
1113 #endif
1114
1115 /* In cse.c */
1116 struct cse_basic_block_data;
1117 extern int rtx_cost PROTO ((rtx, enum rtx_code));
1118 extern void delete_trivially_dead_insns PROTO ((rtx, int));
1119 #ifdef BUFSIZ
1120 extern int cse_main PROTO ((rtx, int, int, FILE *));
1121 #endif
1122 extern void cse_end_of_basic_block PROTO ((rtx,
1123 struct cse_basic_block_data *,
1124 int, int, int));
1125
1126 /* In jump.c */
1127 extern int comparison_dominates_p PROTO ((enum rtx_code, enum rtx_code));
1128 extern int condjump_p PROTO ((rtx));
1129 extern int simplejump_p PROTO ((rtx));
1130 extern int sets_cc0_p PROTO ((rtx));
1131 extern int invert_jump PROTO ((rtx, rtx));
1132 extern int rtx_renumbered_equal_p PROTO ((rtx, rtx));
1133 extern int true_regnum PROTO ((rtx));
1134 extern int redirect_jump PROTO ((rtx, rtx));
1135 extern void jump_optimize PROTO ((rtx, int, int, int));
1136 extern void thread_jumps PROTO ((rtx, int, int));
1137 extern int redirect_exp PROTO ((rtx *, rtx, rtx, rtx));
1138 extern int rtx_equal_for_thread_p PROTO ((rtx, rtx, rtx));
1139 extern int invert_exp PROTO ((rtx, rtx));
1140 extern int can_reverse_comparison_p PROTO ((rtx, rtx));
1141 extern void delete_for_peephole PROTO ((rtx, rtx));
1142 extern int condjump_in_parallel_p PROTO ((rtx));
1143
1144 /* Flags for jump_optimize() */
1145 #define JUMP_CROSS_JUMP 1
1146 #define JUMP_NOOP_MOVES 1
1147 #define JUMP_AFTER_REGSCAN 1
1148
1149 /* In emit-rtl.c. */
1150 extern int max_reg_num PROTO ((void));
1151 extern int max_label_num PROTO ((void));
1152 extern int get_first_label_num PROTO ((void));
1153 extern void delete_insns_since PROTO ((rtx));
1154 extern void mark_reg_pointer PROTO ((rtx, int));
1155 extern void mark_user_reg PROTO ((rtx));
1156 extern void reset_used_flags PROTO ((rtx));
1157 extern void reorder_insns PROTO ((rtx, rtx, rtx));
1158 extern int get_max_uid PROTO ((void));
1159 extern int in_sequence_p PROTO ((void));
1160 extern void force_next_line_note PROTO ((void));
1161 extern void init_emit PROTO ((void));
1162 extern void init_emit_once PROTO ((int));
1163 extern void push_topmost_sequence PROTO ((void));
1164 extern void pop_topmost_sequence PROTO ((void));
1165 extern int subreg_realpart_p PROTO ((rtx));
1166 extern void reverse_comparison PROTO ((rtx));
1167 extern void set_new_first_and_last_insn PROTO ((rtx, rtx));
1168 extern void set_new_first_and_last_label_num PROTO ((int, int));
1169 extern void unshare_all_rtl PROTO ((rtx));
1170 extern void set_last_insn PROTO ((rtx));
1171 extern void link_cc0_insns PROTO ((rtx));
1172 extern void add_insn PROTO ((rtx));
1173 extern void add_insn_before PROTO ((rtx, rtx));
1174 extern void add_insn_after PROTO ((rtx, rtx));
1175 extern void reorder_insns_with_line_notes PROTO ((rtx, rtx, rtx));
1176 extern void emit_insn_after_with_line_notes PROTO ((rtx, rtx, rtx));
1177 extern enum rtx_code classify_insn PROTO ((rtx));
1178 extern rtx emit PROTO ((rtx));
1179 /* Query and clear/ restore no_line_numbers. This is used by the
1180 switch / case handling in stmt.c to give proper line numbers in
1181 warnings about unreachable code. */
1182 int force_line_numbers PROTO((void));
1183 void restore_line_number_status PROTO((int old_value));
1184
1185 /* In insn-emit.c */
1186 extern void add_clobbers PROTO ((rtx, int));
1187
1188 /* In combine.c */
1189 extern void combine_instructions PROTO ((rtx, int));
1190 extern int extended_count PROTO ((rtx, enum machine_mode, int));
1191 extern rtx remove_death PROTO ((int, rtx));
1192 #ifdef BUFSIZ
1193 extern void dump_combine_stats PROTO ((FILE *));
1194 extern void dump_combine_total_stats PROTO ((FILE *));
1195 #endif
1196
1197 /* In sched.c. */
1198 #ifdef BUFSIZ
1199 extern void schedule_insns PROTO ((FILE *));
1200 #endif
1201
1202 /* In print-rtl.c */
1203 extern void debug_rtx PROTO ((rtx));
1204 extern void debug_rtx_list PROTO ((rtx, int));
1205 extern rtx debug_rtx_find PROTO ((rtx, int));
1206 #ifdef BUFSIZ
1207 extern void print_rtl PROTO ((FILE *, rtx));
1208 extern void print_inline_rtx PROTO ((FILE *, rtx, int));
1209 #endif
1210
1211 /* In loop.c */
1212 extern void init_loop PROTO ((void));
1213 #ifdef BUFSIZ
1214 extern void loop_optimize PROTO ((rtx, FILE *, int));
1215 #endif
1216 extern void record_excess_regs PROTO ((rtx, rtx, rtx *));
1217
1218 /* In function.c */
1219 extern void reposition_prologue_and_epilogue_notes PROTO ((rtx));
1220 extern void thread_prologue_and_epilogue_insns PROTO ((rtx));
1221 extern void use_variable PROTO ((rtx));
1222 extern HOST_WIDE_INT get_frame_size PROTO ((void));
1223 extern void preserve_rtl_expr_result PROTO ((rtx));
1224 extern void mark_temp_addr_taken PROTO ((rtx));
1225 extern void update_temp_slot_address PROTO ((rtx, rtx));
1226 extern void use_variable_after PROTO ((rtx, rtx));
1227
1228 /* In reload.c */
1229 extern int operands_match_p PROTO ((rtx, rtx));
1230 extern int safe_from_earlyclobber PROTO ((rtx, rtx));
1231 extern int strict_memory_address_p PROTO ((enum machine_mode, rtx));
1232
1233 /* In recog.c */
1234 extern int memory_address_p PROTO ((enum machine_mode, rtx));
1235 extern int constrain_operands PROTO ((int, int));
1236 extern int mode_dependent_address_p PROTO ((rtx));
1237 extern void init_recog_no_volatile PROTO ((void));
1238 extern int offsettable_memref_p PROTO ((rtx));
1239 extern int offsettable_nonstrict_memref_p PROTO ((rtx));
1240 extern int reg_fits_class_p PROTO ((rtx, register enum reg_class,
1241 int, enum machine_mode));
1242 extern int check_asm_operands PROTO ((rtx));
1243 extern int address_operand PROTO ((rtx, enum machine_mode));
1244 extern int const_int_operand PROTO ((rtx, enum machine_mode));
1245 extern int const_double_operand PROTO ((rtx, enum machine_mode));
1246 extern int general_operand PROTO ((rtx, enum machine_mode));
1247 extern int immediate_operand PROTO ((rtx, enum machine_mode));
1248 extern int nonimmediate_operand PROTO ((rtx, enum machine_mode));
1249 extern int memory_operand PROTO ((rtx, enum machine_mode));
1250 extern int nonmemory_operand PROTO ((rtx, enum machine_mode));
1251 extern int push_operand PROTO ((rtx, enum machine_mode));
1252 extern int register_operand PROTO ((rtx, enum machine_mode));
1253 extern int scratch_operand PROTO ((rtx, enum machine_mode));
1254 extern int indirect_operand PROTO ((rtx, enum machine_mode));
1255 extern int mode_independent_operand PROTO ((rtx, enum machine_mode));
1256 extern int comparison_operator PROTO ((rtx, enum machine_mode));
1257 extern void init_recog_no_volatile PROTO ((void));
1258 extern void init_recog PROTO ((void));
1259 extern int validate_replace_rtx PROTO ((rtx, rtx, rtx));
1260 extern int offsettable_address_p PROTO ((int, enum machine_mode, rtx));
1261 extern int next_insn_tests_no_inequality PROTO ((rtx));
1262 extern int recog_memoized PROTO ((rtx));
1263 extern int validate_change PROTO ((rtx, rtx *, rtx, int));
1264 extern int apply_change_group PROTO ((void));
1265 extern void cancel_changes PROTO ((int));
1266 extern int num_validated_changes PROTO ((void));
1267
1268 /* In insn-recog.c */
1269 extern int recog PROTO ((rtx, rtx, int *));
1270
1271 /* In stmt.c */
1272 extern void emit_jump PROTO ((rtx));
1273 extern int preserve_subexpressions_p PROTO ((void));
1274
1275 /* In expr.c */
1276 extern void init_expr_once PROTO ((void));
1277
1278 /* In stupid.c */
1279 #ifdef BUFSIZ
1280 extern void stupid_life_analysis PROTO ((rtx, int, FILE *));
1281 #endif
1282
1283 /* In flow.c */
1284 extern void allocate_for_life_analysis PROTO ((void));
1285 #ifdef BUFSIZ
1286 extern void dump_flow_info PROTO ((FILE *));
1287 #endif
1288
1289 /* In expmed.c */
1290 extern void init_expmed PROTO ((void));
1291 extern void expand_inc PROTO ((rtx, rtx));
1292 extern void expand_dec PROTO ((rtx, rtx));
1293 extern rtx expand_mult_highpart PROTO ((enum machine_mode, rtx,
1294 unsigned HOST_WIDE_INT, rtx,
1295 int, int));
1296
1297 /* In global.c */
1298 #ifdef BUFSIZ
1299 extern int global_alloc PROTO ((FILE *));
1300 extern void dump_global_regs PROTO ((FILE *));
1301 #endif
1302
1303 /* In regclass.c */
1304 extern void globalize_reg PROTO ((int));
1305 extern void init_regs PROTO ((void));
1306 extern void init_reg_sets PROTO ((void));
1307 extern void regset_release_memory PROTO ((void));
1308 extern void regclass_init PROTO ((void));
1309 extern void regclass PROTO ((rtx, int));
1310 extern void reg_scan PROTO ((rtx, int, int));
1311 extern void fix_register PROTO ((char *, int, int));
1312
1313 /* In optabs.c */
1314 extern void init_optabs PROTO ((void));
1315
1316 /* In local-alloc.c */
1317 #ifdef BUFSIZ
1318 extern void dump_local_alloc PROTO ((FILE *));
1319 #endif
1320 extern void local_alloc PROTO ((void));
1321
1322 /* In reload1.c */
1323 extern void reload_cse_regs PROTO ((rtx));
1324 extern void init_reload PROTO ((void));
1325 extern void mark_home_live PROTO ((int));
1326 #ifdef BUFSIZ
1327 extern int reload PROTO ((rtx, int, FILE *));
1328 #endif
1329
1330 /* In caller-save.c */
1331 extern void init_caller_save PROTO ((void));
1332
1333 /* In profile.c */
1334 extern void init_branch_prob PROTO ((char *));
1335
1336 /* In reg-stack.c */
1337 #ifdef BUFSIZ
1338 extern void reg_to_stack PROTO ((rtx, FILE *));
1339 #endif
1340 extern int stack_regs_mentioned_p PROTO ((rtx));
1341
1342 /* In fold-const.c */
1343 extern int add_double PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1344 HOST_WIDE_INT, HOST_WIDE_INT,
1345 HOST_WIDE_INT *, HOST_WIDE_INT *));
1346 extern int neg_double PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1347 HOST_WIDE_INT *, HOST_WIDE_INT *));
1348 extern int mul_double PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1349 HOST_WIDE_INT, HOST_WIDE_INT,
1350 HOST_WIDE_INT *, HOST_WIDE_INT *));
1351 extern void lshift_double PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1352 HOST_WIDE_INT, int, HOST_WIDE_INT *,
1353 HOST_WIDE_INT *, int));
1354 extern void rshift_double PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1355 HOST_WIDE_INT, int,
1356 HOST_WIDE_INT *, HOST_WIDE_INT *, int));
1357 extern void lrotate_double PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1358 HOST_WIDE_INT, int, HOST_WIDE_INT *,
1359 HOST_WIDE_INT *));
1360 extern void rrotate_double PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
1361 HOST_WIDE_INT, int, HOST_WIDE_INT *,
1362 HOST_WIDE_INT *));
1363
1364 /* In calls.c */
1365 /* Emit library call. */
1366 extern void emit_library_call PVPROTO ((rtx, int, enum machine_mode,
1367 int, ...));
1368 extern rtx emit_library_call_value PVPROTO((rtx, rtx, int,
1369 enum machine_mode,
1370 int, ...));
1371
1372 /* In unroll.c */
1373 extern int set_dominates_use PROTO ((int, int, int, rtx, rtx));
1374
1375 /* In varasm.c */
1376 extern void bss_section PROTO ((void));
1377 extern int in_data_section PROTO ((void));
1378 extern int supports_one_only PROTO ((void));
1379
1380 /* In rtl.c */
1381 extern void init_rtl PROTO ((void));
1382 extern void rtx_free PROTO ((rtx));
1383
1384 /* In alias.c */
1385 extern int true_dependence PROTO ((rtx, enum machine_mode, rtx,
1386 int (*)(rtx)));
1387 extern int read_dependence PROTO ((rtx, rtx));
1388 extern int anti_dependence PROTO ((rtx, rtx));
1389 extern int output_dependence PROTO ((rtx, rtx));
1390 extern void init_alias_once PROTO ((void));
1391 extern void init_alias_analysis PROTO ((void));
1392 extern void end_alias_analysis PROTO ((void));
1393
1394 extern void record_base_value PROTO ((int, rtx, int));
1395
1396 #endif /* _RTL_H */