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