]> gcc.gnu.org Git - gcc.git/blob - gcc/reload.h
(PROTO, STDIO_PROTO): Likewise.
[gcc.git] / gcc / reload.h
1 /* Communication between reload.c and reload1.c.
2 Copyright (C) 1987, 1991, 1992, 1993, 1994 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20
21 /* If secondary reloads are the same for inputs and outputs, define those
22 macros here. */
23
24 #ifdef SECONDARY_RELOAD_CLASS
25 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
26 SECONDARY_RELOAD_CLASS (CLASS, MODE, X)
27 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
28 SECONDARY_RELOAD_CLASS (CLASS, MODE, X)
29 #endif
30
31 /* If either macro is defined, show that we need secondary reloads. */
32 #if defined(SECONDARY_INPUT_RELOAD_CLASS) || defined(SECONDARY_OUTPUT_RELOAD_CLASS)
33 #define HAVE_SECONDARY_RELOADS
34 #endif
35
36 /* See reload.c and reload1.c for comments on these variables. */
37
38 /* Maximum number of reloads we can need. */
39 #define MAX_RELOADS (2 * MAX_RECOG_OPERANDS * (MAX_REGS_PER_ADDRESS + 1))
40
41 extern rtx reload_in[MAX_RELOADS];
42 extern rtx reload_out[MAX_RELOADS];
43 extern rtx reload_in_reg[MAX_RELOADS];
44 extern enum reg_class reload_reg_class[MAX_RELOADS];
45 extern enum machine_mode reload_inmode[MAX_RELOADS];
46 extern enum machine_mode reload_outmode[MAX_RELOADS];
47 extern char reload_optional[MAX_RELOADS];
48 extern int reload_inc[MAX_RELOADS];
49 extern int reload_opnum[MAX_RELOADS];
50 extern int reload_secondary_p[MAX_RELOADS];
51 extern int reload_secondary_in_reload[MAX_RELOADS];
52 extern int reload_secondary_out_reload[MAX_RELOADS];
53 #ifdef MAX_INSN_CODE
54 extern enum insn_code reload_secondary_in_icode[MAX_RELOADS];
55 extern enum insn_code reload_secondary_out_icode[MAX_RELOADS];
56 #endif
57 extern int n_reloads;
58
59 extern rtx reload_reg_rtx[MAX_RELOADS];
60
61 /* Encode the usage of a reload. The following codes are supported:
62
63 RELOAD_FOR_INPUT reload of an input operand
64 RELOAD_FOR_OUTPUT likewise, for output
65 RELOAD_FOR_INSN a reload that must not conflict with anything
66 used in the insn, but may conflict with
67 something used before or after the insn
68 RELOAD_FOR_INPUT_ADDRESS reload for parts of the address of an object
69 that is an input reload
70 RELOAD_FOR_OUTPUT_ADDRESS likewise, for output reload
71 RELOAD_FOR_OPERAND_ADDRESS reload for the address of a non-reloaded
72 operand; these don't conflict with
73 any other addresses.
74 RELOAD_OTHER none of the above, usually multiple uses
75 RELOAD_FOR_OTHER_ADDRESS reload for part of the address of an input
76 that is marked RELOAD_OTHER.
77
78 This used to be "enum reload_when_needed" but some debuggers have trouble
79 with an enum tag and variable of the same name. */
80
81 enum reload_type
82 {
83 RELOAD_FOR_INPUT, RELOAD_FOR_OUTPUT, RELOAD_FOR_INSN,
84 RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_OUTPUT_ADDRESS,
85 RELOAD_FOR_OPERAND_ADDRESS, RELOAD_OTHER, RELOAD_FOR_OTHER_ADDRESS
86 };
87
88 extern enum reload_type reload_when_needed[MAX_RELOADS];
89
90 extern rtx *reg_equiv_constant;
91 extern rtx *reg_equiv_memory_loc;
92 extern rtx *reg_equiv_address;
93 extern rtx *reg_equiv_mem;
94
95 /* All the "earlyclobber" operands of the current insn
96 are recorded here. */
97 extern int n_earlyclobbers;
98 extern rtx reload_earlyclobbers[MAX_RECOG_OPERANDS];
99
100 /* Save the number of operands. */
101 extern int reload_n_operands;
102
103 /* First uid used by insns created by reload in this function.
104 Used in find_equiv_reg. */
105 extern int reload_first_uid;
106
107 /* Nonzero if indirect addressing is supported when the innermost MEM is
108 of the form (MEM (SYMBOL_REF sym)). It is assumed that the level to
109 which these are valid is the same as spill_indirect_levels, above. */
110
111 extern char indirect_symref_ok;
112
113 /* Nonzero if an address (plus (reg frame_pointer) (reg ...)) is valid. */
114 extern char double_reg_address_ok;
115
116 #ifdef MAX_INSN_CODE
117 /* These arrays record the insn_code of insns that may be needed to
118 perform input and output reloads of special objects. They provide a
119 place to pass a scratch register. */
120 extern enum insn_code reload_in_optab[];
121 extern enum insn_code reload_out_optab[];
122 #endif
123
124 /* Functions from reload.c: */
125
126 /* Return a memory location that will be used to copy X in mode MODE.
127 If we haven't already made a location for this mode in this insn,
128 call find_reloads_address on the location being returned. */
129 extern rtx get_secondary_mem PROTO((rtx, enum machine_mode,
130 int, enum reload_type));
131
132 /* Clear any secondary memory locations we've made. */
133 extern void clear_secondary_mem PROTO((void));
134
135 /* Transfer all replacements that used to be in reload FROM to be in
136 reload TO. */
137 extern void transfer_replacements PROTO((int, int));
138
139 /* Return 1 if ADDR is a valid memory address for mode MODE,
140 and check that each pseudo reg has the proper kind of
141 hard reg. */
142 extern int strict_memory_address_p PROTO((enum machine_mode, rtx));
143
144 /* Like rtx_equal_p except that it allows a REG and a SUBREG to match
145 if they are the same hard reg, and has special hacks for
146 autoincrement and autodecrement. */
147 extern int operands_match_p PROTO((rtx, rtx));
148
149 /* Return the number of times character C occurs in string S. */
150 extern int n_occurrences PROTO((int, char *));
151
152 /* Return 1 if altering OP will not modify the value of CLOBBER. */
153 extern int safe_from_earlyclobber PROTO((rtx, rtx));
154
155 /* Search the body of INSN for values that need reloading and record them
156 with push_reload. REPLACE nonzero means record also where the values occur
157 so that subst_reloads can be used. */
158 extern void find_reloads PROTO((rtx, int, int, int, short *));
159
160 /* Compute the sum of X and Y, making canonicalizations assumed in an
161 address, namely: sum constant integers, surround the sum of two
162 constants with a CONST, put the constant as the second operand, and
163 group the constant on the outermost sum. */
164 extern rtx form_sum PROTO((rtx, rtx));
165
166 /* Substitute into the current INSN the registers into which we have reloaded
167 the things that need reloading. */
168 extern void subst_reloads PROTO((void));
169
170 /* Make a copy of any replacements being done into X and move those copies
171 to locations in Y, a copy of X. We only look at the highest level of
172 the RTL. */
173 extern void copy_replacements PROTO((rtx, rtx));
174
175 /* If LOC was scheduled to be replaced by something, return the replacement.
176 Otherwise, return *LOC. */
177 extern rtx find_replacement PROTO((rtx *));
178
179 /* Return nonzero if register in range [REGNO, ENDREGNO)
180 appears either explicitly or implicitly in X
181 other than being stored into. */
182 extern int refers_to_regno_for_reload_p PROTO((int, int, rtx, rtx *));
183
184 /* Nonzero if modifying X will affect IN. */
185 extern int reg_overlap_mentioned_for_reload_p PROTO((rtx, rtx));
186
187 /* Return nonzero if anything in X contains a MEM. Look also for pseudo
188 registers. */
189 extern int refers_to_mem_for_reload_p PROTO((rtx));
190
191 /* Check the insns before INSN to see if there is a suitable register
192 containing the same value as GOAL. */
193 extern rtx find_equiv_reg PROTO((rtx, rtx, enum reg_class, int, short *,
194 int, enum machine_mode));
195
196 /* Return 1 if register REGNO is the subject of a clobber in insn INSN. */
197 extern int regno_clobbered_p PROTO((int, rtx));
198
199
200 /* Functions in reload1.c: */
201
202 /* Initialize the reload pass once per compilation. */
203 extern void init_reload PROTO((void));
204
205 /* The reload pass itself. */
206 extern int reload STDIO_PROTO((rtx, int, FILE *));
207
208 /* Mark the slots in regs_ever_live for the hard regs
209 used by pseudo-reg number REGNO. */
210 extern void mark_home_live PROTO((int));
211
212 /* Scan X and replace any eliminable registers (such as fp) with a
213 replacement (such as sp), plus an offset. */
214 extern rtx eliminate_regs PROTO((rtx, enum machine_mode, rtx));
215
216 /* Emit code to perform an input reload of IN to RELOADREG. IN is from
217 operand OPNUM with reload type TYPE. */
218 extern rtx gen_input_reload PROTO((rtx, rtx, int, enum reload_type));
219
220 /* Functions in caller-save.c: */
221
222 /* Initialize for caller-save. */
223 extern void init_caller_save PROTO((void));
224
225 /* Initialize save areas by showing that we haven't allocated any yet. */
226 extern void init_save_areas PROTO((void));
227
228 /* Allocate save areas for any hard registers that might need saving. */
229 extern int setup_save_areas PROTO((int *));
230
231 /* Find the places where hard regs are live across calls and save them. */
232 extern void save_call_clobbered_regs PROTO((enum machine_mode));
This page took 0.053009 seconds and 6 git commands to generate.