OSDN Git Service

Emit eabi's main call to __eabi before setting up the minimal TOC, rather than after.
[pf3gnuchains/gcc-fork.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_FOR_OPADDR_ADDR       reload needed for RELOAD_FOR_OPERAND_ADDRESS
75                                 reloads; usually secondary reloads
76    RELOAD_OTHER                 none of the above, usually multiple uses
77    RELOAD_FOR_OTHER_ADDRESS     reload for part of the address of an input
78                                 that is marked RELOAD_OTHER.
79
80    This used to be "enum reload_when_needed" but some debuggers have trouble
81    with an enum tag and variable of the same name.  */
82
83 enum reload_type
84 {
85   RELOAD_FOR_INPUT, RELOAD_FOR_OUTPUT, RELOAD_FOR_INSN, 
86   RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_OUTPUT_ADDRESS,
87   RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OPADDR_ADDR,
88   RELOAD_OTHER, RELOAD_FOR_OTHER_ADDRESS
89 };
90
91 extern enum reload_type reload_when_needed[MAX_RELOADS];
92
93 extern rtx *reg_equiv_constant;
94 extern rtx *reg_equiv_memory_loc;
95 extern rtx *reg_equiv_address;
96 extern rtx *reg_equiv_mem;
97
98 /* All the "earlyclobber" operands of the current insn
99    are recorded here.  */
100 extern int n_earlyclobbers;
101 extern rtx reload_earlyclobbers[MAX_RECOG_OPERANDS];
102
103 /* Save the number of operands.  */
104 extern int reload_n_operands;
105
106 /* First uid used by insns created by reload in this function.
107    Used in find_equiv_reg.  */
108 extern int reload_first_uid;
109
110 /* Nonzero if indirect addressing is supported when the innermost MEM is
111    of the form (MEM (SYMBOL_REF sym)).  It is assumed that the level to
112    which these are valid is the same as spill_indirect_levels, above.   */
113
114 extern char indirect_symref_ok;
115
116 /* Nonzero if an address (plus (reg frame_pointer) (reg ...)) is valid.  */
117 extern char double_reg_address_ok;
118
119 #ifdef MAX_INSN_CODE
120 /* These arrays record the insn_code of insns that may be needed to
121    perform input and output reloads of special objects.  They provide a
122    place to pass a scratch register.  */
123 extern enum insn_code reload_in_optab[];
124 extern enum insn_code reload_out_optab[];
125 #endif
126
127 /* Functions from reload.c:  */
128
129 /* Return a memory location that will be used to copy X in mode MODE.  
130    If we haven't already made a location for this mode in this insn,
131    call find_reloads_address on the location being returned.  */
132 extern rtx get_secondary_mem PROTO((rtx, enum machine_mode,
133                                     int, enum reload_type));
134
135 /* Clear any secondary memory locations we've made.  */
136 extern void clear_secondary_mem PROTO((void));
137
138 /* Transfer all replacements that used to be in reload FROM to be in
139    reload TO.  */
140 extern void transfer_replacements PROTO((int, int));
141
142 /* Return 1 if ADDR is a valid memory address for mode MODE,
143    and check that each pseudo reg has the proper kind of
144    hard reg.  */
145 extern int strict_memory_address_p PROTO((enum machine_mode, rtx));
146
147 /* Like rtx_equal_p except that it allows a REG and a SUBREG to match
148    if they are the same hard reg, and has special hacks for
149    autoincrement and autodecrement.  */
150 extern int operands_match_p PROTO((rtx, rtx));
151
152 /* Return the number of times character C occurs in string S.  */
153 extern int n_occurrences PROTO((int, char *));
154
155 /* Return 1 if altering OP will not modify the value of CLOBBER. */
156 extern int safe_from_earlyclobber PROTO((rtx, rtx));
157
158 /* Search the body of INSN for values that need reloading and record them
159    with push_reload.  REPLACE nonzero means record also where the values occur
160    so that subst_reloads can be used.  */
161 extern void find_reloads PROTO((rtx, int, int, int, short *));
162
163 /* Compute the sum of X and Y, making canonicalizations assumed in an
164    address, namely: sum constant integers, surround the sum of two
165    constants with a CONST, put the constant as the second operand, and
166    group the constant on the outermost sum.  */
167 extern rtx form_sum PROTO((rtx, rtx));
168
169 /* Substitute into the current INSN the registers into which we have reloaded
170    the things that need reloading.  */
171 extern void subst_reloads PROTO((void));
172
173 /* Make a copy of any replacements being done into X and move those copies
174    to locations in Y, a copy of X.  We only look at the highest level of
175    the RTL.  */
176 extern void copy_replacements PROTO((rtx, rtx));
177
178 /* If LOC was scheduled to be replaced by something, return the replacement.
179    Otherwise, return *LOC.  */
180 extern rtx find_replacement PROTO((rtx *));
181
182 /* Return nonzero if register in range [REGNO, ENDREGNO)
183    appears either explicitly or implicitly in X
184    other than being stored into.  */
185 extern int refers_to_regno_for_reload_p PROTO((int, int, rtx, rtx *));
186
187 /* Nonzero if modifying X will affect IN.  */
188 extern int reg_overlap_mentioned_for_reload_p PROTO((rtx, rtx));
189
190 /* Return nonzero if anything in X contains a MEM.  Look also for pseudo
191    registers.  */
192 extern int refers_to_mem_for_reload_p PROTO((rtx));
193
194 /* Check the insns before INSN to see if there is a suitable register
195    containing the same value as GOAL.  */
196 extern rtx find_equiv_reg PROTO((rtx, rtx, enum reg_class, int, short *,
197                                  int, enum machine_mode));
198
199 /* Return 1 if register REGNO is the subject of a clobber in insn INSN.  */
200 extern int regno_clobbered_p PROTO((int, rtx));
201
202
203 /* Functions in reload1.c:  */
204
205 /* Initialize the reload pass once per compilation.  */
206 extern void init_reload PROTO((void));
207
208 /* The reload pass itself.  */
209 extern int reload STDIO_PROTO((rtx, int, FILE *));
210
211 /* Mark the slots in regs_ever_live for the hard regs
212    used by pseudo-reg number REGNO.  */
213 extern void mark_home_live PROTO((int));
214
215 /* Scan X and replace any eliminable registers (such as fp) with a
216    replacement (such as sp), plus an offset.  */
217 extern rtx eliminate_regs PROTO((rtx, enum machine_mode, rtx));
218
219 /* Emit code to perform a reload from IN (which may be a reload register) to
220    OUT (which may also be a reload register).  IN or OUT is from operand
221    OPNUM with reload type TYPE.  */
222 extern rtx gen_reload PROTO((rtx, rtx, int, enum reload_type));
223
224 /* Functions in caller-save.c:  */
225
226 /* Initialize for caller-save.  */
227 extern void init_caller_save PROTO((void));
228
229 /* Initialize save areas by showing that we haven't allocated any yet.  */
230 extern void init_save_areas PROTO((void));
231
232 /* Allocate save areas for any hard registers that might need saving.  */
233 extern int setup_save_areas PROTO((int *));
234
235 /* Find the places where hard regs are live across calls and save them.  */
236 extern void save_call_clobbered_regs PROTO((enum machine_mode));