]>
Commit | Line | Data |
---|---|---|
0c2768fc RS |
1 | /* Declarations for insn-output.c. These functions are defined in recog.c, |
2 | final.c, and varasm.c. | |
a1493f9f | 3 | Copyright (C) 1987, 1991, 1994, 1997 Free Software Foundation, Inc. |
0c2768fc RS |
4 | |
5 | This file is part of GNU CC. | |
6 | ||
7 | GNU CC is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2, or (at your option) | |
10 | any later version. | |
11 | ||
12 | GNU CC is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GNU CC; see the file COPYING. If not, write to | |
e99215a3 RK |
19 | the Free Software Foundation, 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. */ | |
0c2768fc | 21 | |
9b1d8cd6 RK |
22 | /* Initialize data in final at the beginning of a compilation. */ |
23 | extern void init_final PROTO((char *)); | |
24 | ||
25 | /* Called at end of source file, | |
26 | to output the block-profiling table for this entire compilation. */ | |
27 | extern void end_final PROTO((char *)); | |
28 | ||
29 | /* Enable APP processing of subsequent output. | |
30 | Used before the output from an `asm' statement. */ | |
31 | extern void app_enable PROTO((void)); | |
32 | ||
33 | /* Disable APP processing of subsequent output. | |
34 | Called from varasm.c before most kinds of output. */ | |
35 | extern void app_disable PROTO((void)); | |
36 | ||
37 | /* Return the number of slots filled in the current | |
38 | delayed branch sequence (we don't count the insn needing the | |
39 | delay slot). Zero if not in a delayed branch sequence. */ | |
40 | extern int dbr_sequence_length PROTO((void)); | |
41 | ||
42 | /* Indicate that branch shortening hasn't yet been done. */ | |
43 | extern void init_insn_lengths PROTO((void)); | |
44 | ||
ed068cf5 | 45 | #ifdef RTX_CODE |
9b1d8cd6 RK |
46 | /* Obtain the current length of an insn. If branch shortening has been done, |
47 | get its actual length. Otherwise, get its maximum length. */ | |
48 | extern int get_attr_length PROTO((rtx)); | |
49 | ||
50 | /* Make a pass over all insns and compute their actual lengths by shortening | |
51 | any branches of variable length if possible. */ | |
52 | extern void shorten_branches PROTO((rtx)); | |
53 | ||
54 | /* Output assembler code for the start of a function, | |
55 | and initialize some of the variables in this file | |
56 | for the new function. The label for the function and associated | |
57 | assembler pseudo-ops have already been output in | |
58 | `assemble_start_function'. */ | |
59 | extern void final_start_function STDIO_PROTO((rtx, FILE *, int)); | |
60 | ||
61 | /* Output assembler code for the end of a function. | |
62 | For clarity, args are same as those of `final_start_function' | |
63 | even though not all of them are needed. */ | |
64 | extern void final_end_function STDIO_PROTO((rtx, FILE *, int)); | |
65 | ||
66 | /* Output assembler code for some insns: all or part of a function. */ | |
67 | extern void final STDIO_PROTO((rtx, FILE *, int, int)); | |
68 | ||
69 | /* The final scan for one insn, INSN. Args are same as in `final', except | |
70 | that INSN is the insn being scanned. Value returned is the next insn to | |
71 | be scanned. */ | |
72 | extern rtx final_scan_insn STDIO_PROTO((rtx, FILE *, int, int, int)); | |
73 | ||
74 | /* Replace a SUBREG with a REG or a MEM, based on the thing it is a | |
75 | subreg of. */ | |
76 | extern rtx alter_subreg PROTO((rtx)); | |
77 | ||
78 | /* Report inconsistency between the assembler template and the operands. | |
79 | In an `asm', it's the user's fault; otherwise, the compiler's fault. */ | |
80 | extern void output_operand_lossage PROTO((char *)); | |
cf1c49cb | 81 | |
0c2768fc RS |
82 | /* Output a string of assembler code, substituting insn operands. |
83 | Defined in final.c. */ | |
9b1d8cd6 | 84 | extern void output_asm_insn PROTO((char *, rtx *)); |
0c2768fc | 85 | |
9b1d8cd6 RK |
86 | /* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol. */ |
87 | extern void output_asm_label PROTO((rtx)); | |
88 | ||
89 | /* Print a memory reference operand for address X | |
90 | using machine-dependent assembler syntax. */ | |
91 | extern void output_address PROTO((rtx)); | |
1428a6b3 | 92 | |
aaff8ce0 CH |
93 | /* Print an integer constant expression in assembler syntax. |
94 | Addition and subtraction are the only arithmetic | |
95 | that may appear in these expressions. */ | |
cf1c49cb | 96 | extern void output_addr_const STDIO_PROTO((FILE *, rtx)); |
aaff8ce0 | 97 | |
9b1d8cd6 RK |
98 | /* Output a string of assembler code, substituting numbers, strings |
99 | and fixed syntactic prefixes. */ | |
100 | extern void asm_fprintf STDIO_PROTO(PVPROTO((FILE *file, | |
101 | char *p, ...))); | |
102 | ||
103 | /* Split up a CONST_DOUBLE or integer constant rtx into two rtx's for single | |
104 | words. */ | |
105 | extern void split_double PROTO((rtx, rtx *, rtx *)); | |
106 | ||
107 | /* Return nonzero if this function has no function calls. */ | |
108 | extern int leaf_function_p PROTO((void)); | |
109 | ||
110 | /* Return 1 if this function uses only the registers that can be | |
111 | safely renumbered. */ | |
112 | extern int only_leaf_regs_used PROTO((void)); | |
113 | ||
114 | /* Scan IN_RTX and its subexpressions, and renumber all regs into those | |
115 | available in leaf functions. */ | |
116 | extern void leaf_renumber_regs_insn PROTO((rtx)); | |
a1493f9f RK |
117 | |
118 | /* Functions in flow.c */ | |
119 | extern void allocate_for_life_analysis PROTO((void)); | |
120 | extern int regno_uninitialized PROTO((int)); | |
121 | extern int regno_clobbered_at_setjmp PROTO((int)); | |
122 | extern void dump_flow_info STDIO_PROTO((FILE *)); | |
123 | extern void flow_analysis STDIO_PROTO((rtx, int, FILE *)); | |
ed068cf5 RK |
124 | #endif |
125 | ||
126 | /* Functions in varasm.c. */ | |
127 | ||
128 | /* Tell assembler to switch to text section. */ | |
129 | extern void text_section PROTO((void)); | |
130 | ||
131 | /* Tell assembler to switch to data section. */ | |
132 | extern void data_section PROTO((void)); | |
133 | ||
134 | /* Tell assembler to switch to read-only data section. This is normally | |
135 | the text section. */ | |
136 | extern void readonly_data_section PROTO((void)); | |
137 | ||
138 | /* Determine if we're in the text section. */ | |
139 | extern int in_text_section PROTO((void)); | |
140 | ||
141 | #ifdef TREE_CODE | |
142 | /* Tell assembler to change to section NAME for DECL. | |
143 | If DECL is NULL, just switch to section NAME. | |
ad4ff310 JM |
144 | If NAME is NULL, get the name from DECL. |
145 | If RELOC is 1, the initializer for DECL contains relocs. */ | |
146 | extern void named_section PROTO((tree, char *, int)); | |
ed068cf5 | 147 | |
4d1065ed DE |
148 | /* Tell assembler to switch to the section for function DECL. */ |
149 | extern void function_section PROTO((tree)); | |
150 | ||
6adb4e3a MS |
151 | /* Tell assembler to switch to the section for the exception table. */ |
152 | extern void exception_section PROTO((void)); | |
153 | ||
ed068cf5 RK |
154 | /* Create the rtl to represent a function, for a function definition. |
155 | DECL is a FUNCTION_DECL node which describes which function. | |
156 | The rtl is stored into DECL. */ | |
157 | extern void make_function_rtl PROTO((tree)); | |
158 | ||
159 | /* Decode an `asm' spec for a declaration as a register name. | |
160 | Return the register number, or -1 if nothing specified, | |
161 | or -2 if the ASMSPEC is not `cc' or `memory' and is not recognized, | |
162 | or -3 if ASMSPEC is `cc' and is not recognized, | |
163 | or -4 if ASMSPEC is `memory' and is not recognized. | |
164 | Accept an exact spelling or a decimal number. | |
165 | Prefixes such as % are optional. */ | |
166 | extern int decode_reg_name PROTO((char *)); | |
167 | ||
168 | /* Create the DECL_RTL for a declaration for a static or external variable | |
169 | or static or external function. | |
170 | ASMSPEC, if not 0, is the string which the user specified | |
171 | as the assembler symbol name. | |
172 | TOP_LEVEL is nonzero if this is a file-scope variable. | |
173 | ||
174 | This is never called for PARM_DECL nodes. */ | |
175 | extern void make_decl_rtl PROTO((tree, char *, int)); | |
176 | ||
177 | /* Make the rtl for variable VAR be volatile. | |
178 | Use this only for static variables. */ | |
179 | extern void make_var_volatile PROTO((tree)); | |
180 | ||
181 | /* Output alignment directive to align for constant expression EXP. */ | |
182 | extern void assemble_constant_align PROTO((tree)); | |
183 | ||
184 | /* Output a string of literal assembler code | |
185 | for an `asm' keyword used between functions. */ | |
186 | extern void assemble_asm PROTO((tree)); | |
187 | ||
188 | /* Record an element in the table of global destructors. | |
189 | How this is done depends on what sort of assembler and linker | |
190 | are in use. | |
191 | ||
192 | NAME should be the name of a global function to be called | |
193 | at exit time. This name is output using assemble_name. */ | |
194 | extern void assemble_destructor PROTO((char *)); | |
195 | ||
196 | /* Likewise for global constructors. */ | |
197 | extern void assemble_constructor PROTO((char *)); | |
198 | ||
199 | /* Likewise for entries we want to record for garbage collection. | |
200 | Garbage collection is still under development. */ | |
201 | extern void assemble_gc_entry PROTO((char *)); | |
202 | ||
203 | /* Output assembler code for the constant pool of a function and associated | |
204 | with defining the name of the function. DECL describes the function. | |
205 | NAME is the function's name. For the constant pool, we use the current | |
206 | constant pool data. */ | |
207 | extern void assemble_start_function PROTO((tree, char *)); | |
208 | ||
209 | /* Output assembler code associated with defining the size of the | |
210 | function. DECL describes the function. NAME is the function's name. */ | |
211 | extern void assemble_end_function PROTO((tree, char *)); | |
212 | ||
213 | /* Assemble code to leave SIZE bytes of zeros. */ | |
214 | extern void assemble_zeros PROTO((int)); | |
215 | ||
216 | /* Assemble an alignment pseudo op for an ALIGN-bit boundary. */ | |
217 | extern void assemble_align PROTO((int)); | |
218 | ||
219 | /* Assemble a string constant with the specified C string as contents. */ | |
220 | extern void assemble_string PROTO((char *, int)); | |
221 | /* Assemble everything that is needed for a variable or function declaration. | |
222 | Not used for automatic variables, and not used for function definitions. | |
223 | Should not be called for variables of incomplete structure type. | |
224 | ||
225 | TOP_LEVEL is nonzero if this variable has file scope. | |
226 | AT_END is nonzero if this is the special handling, at end of compilation, | |
227 | to define things that have had only tentative definitions. | |
228 | DONT_OUTPUT_DATA if nonzero means don't actually output the | |
229 | initial value (that will be done by the caller). */ | |
230 | extern void assemble_variable PROTO((tree, int, int, int)); | |
231 | ||
232 | /* Output text storage for constructor CONSTR. */ | |
233 | extern void bc_output_constructor PROTO((tree, int)); | |
234 | ||
235 | /* Create storage for constructor CONSTR. */ | |
236 | extern void bc_output_data_constructor PROTO((tree)); | |
237 | ||
238 | /* Output something to declare an external symbol to the assembler. | |
239 | (Most assemblers don't need this, so we normally output nothing.) | |
240 | Do nothing if DECL is not external. */ | |
241 | extern void assemble_external PROTO((tree)); | |
242 | #endif | |
243 | ||
244 | #ifdef RTX_CODE | |
245 | /* Similar, for calling a library function FUN. */ | |
246 | extern void assemble_external_libcall PROTO((rtx)); | |
247 | #endif | |
9b1d8cd6 | 248 | |
ed068cf5 RK |
249 | /* Declare the label NAME global. */ |
250 | extern void assemble_global PROTO((char *)); | |
251 | ||
252 | /* Assemble a label named NAME. */ | |
253 | extern void assemble_label PROTO((char *)); | |
254 | ||
255 | /* Output to FILE a reference to the assembler name of a C-level name NAME. | |
256 | If NAME starts with a *, the rest of NAME is output verbatim. | |
257 | Otherwise NAME is transformed in an implementation-defined way | |
258 | (usually by the addition of an underscore). | |
259 | Many macros in the tm file are defined to call this function. */ | |
260 | extern void assemble_name STDIO_PROTO((FILE *, char *)); | |
261 | ||
262 | #ifdef RTX_CODE | |
263 | /* Assemble the integer constant X into an object of SIZE bytes. | |
264 | X must be either a CONST_INT or CONST_DOUBLE. | |
265 | ||
266 | Return 1 if we were able to output the constant, otherwise 0. If FORCE is | |
267 | non-zero, abort if we can't output the constant. */ | |
268 | extern int assemble_integer PROTO((rtx, int, int)); | |
269 | ||
270 | #ifdef EMUSHORT | |
271 | /* Assemble the floating-point constant D into an object of size MODE. */ | |
272 | extern void assemble_real PROTO((REAL_VALUE_TYPE, | |
273 | enum machine_mode)); | |
274 | #endif | |
275 | #endif | |
276 | ||
277 | /* At the end of a function, forget the memory-constants | |
278 | previously made for CONST_DOUBLEs. Mark them as not on real_constant_chain. | |
279 | Also clear out real_constant_chain and clear out all the chain-pointers. */ | |
280 | extern void clear_const_double_mem PROTO((void)); | |
281 | ||
282 | /* Start deferring output of subconstants. */ | |
283 | extern void defer_addressed_constants PROTO((void)); | |
284 | ||
285 | /* Stop deferring output of subconstants, | |
286 | and output now all those that have been deferred. */ | |
287 | extern void output_deferred_addressed_constants PROTO((void)); | |
288 | ||
289 | /* Initialize constant pool hashing for next function. */ | |
290 | extern void init_const_rtx_hash_table PROTO((void)); | |
291 | ||
292 | /* Return the size of the constant pool. */ | |
293 | extern int get_pool_size PROTO((void)); | |
294 | ||
295 | #ifdef TREE_CODE | |
296 | /* Write all the constants in the constant pool. */ | |
297 | extern void output_constant_pool PROTO((char *, tree)); | |
298 | ||
299 | /* Output assembler code for constant EXP to FILE, with no label. | |
300 | This includes the pseudo-op such as ".int" or ".byte", and a newline. | |
301 | Assumes output_addressed_constants has been done on EXP already. | |
302 | ||
303 | Generate exactly SIZE bytes of assembler data, padding at the end | |
304 | with zeros if necessary. SIZE must always be specified. */ | |
305 | extern void output_constant PROTO((tree, int)); | |
306 | #endif | |
aaff8ce0 | 307 | |
0c2768fc RS |
308 | /* When outputting assembler code, indicates which alternative |
309 | of the constraints was actually satisfied. */ | |
310 | extern int which_alternative; | |
311 | ||
ed068cf5 | 312 | #ifdef RTX_CODE |
0c2768fc RS |
313 | /* When outputting delayed branch sequences, this rtx holds the |
314 | sequence being output. It is null when no delayed branch | |
315 | sequence is being output, so it can be used as a test in the | |
316 | insn output code. | |
317 | ||
318 | This variable is defined in final.c. */ | |
319 | extern rtx final_sequence; | |
ed068cf5 | 320 | #endif |
0c2768fc RS |
321 | |
322 | /* Number of bytes of args popped by function being compiled on its return. | |
323 | Zero if no bytes are to be popped. | |
324 | May affect compilation of return insn or of function epilogue. */ | |
325 | ||
326 | extern int current_function_pops_args; | |
327 | ||
328 | /* Nonzero if function being compiled needs to be given an address | |
329 | where the value should be stored. */ | |
330 | ||
331 | extern int current_function_returns_struct; | |
332 | ||
333 | /* Nonzero if function being compiled needs to | |
334 | return the address of where it has put a structure value. */ | |
335 | ||
336 | extern int current_function_returns_pcc_struct; | |
337 | ||
338 | /* Nonzero if function being compiled needs to be passed a static chain. */ | |
339 | ||
340 | extern int current_function_needs_context; | |
341 | ||
342 | /* Nonzero if function being compiled can call setjmp. */ | |
343 | ||
344 | extern int current_function_calls_setjmp; | |
345 | ||
346 | /* Nonzero if function being compiled can call longjmp. */ | |
347 | ||
348 | extern int current_function_calls_longjmp; | |
349 | ||
350 | /* Nonzero if function being compiled can call alloca, | |
351 | either as a subroutine or builtin. */ | |
352 | ||
353 | extern int current_function_calls_alloca; | |
354 | ||
355 | /* Nonzero if function being compiled receives nonlocal gotos | |
356 | from nested functions. */ | |
357 | ||
358 | extern int current_function_has_nonlocal_label; | |
359 | ||
360 | /* Nonzero if function being compiled contains nested functions. */ | |
361 | ||
362 | extern int current_function_contains_functions; | |
363 | ||
364 | /* Nonzero if the current function returns a pointer type */ | |
365 | ||
366 | extern int current_function_returns_pointer; | |
367 | ||
368 | /* If function's args have a fixed size, this is that size, in bytes. | |
369 | Otherwise, it is -1. | |
370 | May affect compilation of return insn or of function epilogue. */ | |
371 | ||
372 | extern int current_function_args_size; | |
373 | ||
374 | /* # bytes the prologue should push and pretend that the caller pushed them. | |
375 | The prologue must do this, but only if parms can be passed in registers. */ | |
376 | ||
377 | extern int current_function_pretend_args_size; | |
378 | ||
379 | /* # of bytes of outgoing arguments required to be pushed by the prologue. | |
380 | If this is non-zero, it means that ACCUMULATE_OUTGOING_ARGS was defined | |
381 | and no stack adjusts will be done on function calls. */ | |
382 | ||
383 | extern int current_function_outgoing_args_size; | |
384 | ||
385 | /* Nonzero if current function uses varargs.h or equivalent. | |
386 | Zero for functions that use stdarg.h. */ | |
387 | ||
388 | extern int current_function_varargs; | |
389 | ||
ca00d1e0 RK |
390 | /* Nonzero if current function uses stdarg.h or equivalent. |
391 | Zero for functions that use varargs.h. */ | |
392 | ||
393 | extern int current_function_stdarg; | |
394 | ||
0c2768fc RS |
395 | /* Quantities of various kinds of registers |
396 | used for the current function's args. */ | |
397 | ||
398 | extern CUMULATIVE_ARGS current_function_args_info; | |
399 | ||
400 | /* Name of function now being compiled. */ | |
401 | ||
402 | extern char *current_function_name; | |
403 | ||
ed068cf5 | 404 | #ifdef RTX_CODE |
0c2768fc RS |
405 | /* If non-zero, an RTL expression for that location at which the current |
406 | function returns its result. Usually equal to | |
407 | DECL_RTL (DECL_RESULT (current_function_decl)). */ | |
408 | ||
409 | extern rtx current_function_return_rtx; | |
410 | ||
411 | /* If some insns can be deferred to the delay slots of the epilogue, the | |
412 | delay list for them is recorded here. */ | |
413 | ||
414 | extern rtx current_function_epilogue_delay_list; | |
ed068cf5 | 415 | #endif |
0c2768fc | 416 | |
7fe78aa6 JL |
417 | /* Nonzero means generate position-independent code. |
418 | This is not fully implemented yet. */ | |
419 | ||
420 | extern int flag_pic; | |
421 | ||
0c2768fc RS |
422 | /* This is nonzero if the current function uses pic_offset_table_rtx. */ |
423 | extern int current_function_uses_pic_offset_table; | |
424 | ||
aae75261 JVA |
425 | /* This is nonzero if the current function uses the constant pool. */ |
426 | extern int current_function_uses_const_pool; | |
427 | ||
0c2768fc RS |
428 | /* The line number of the beginning of the current function. |
429 | sdbout.c needs this so that it can output relative linenumbers. */ | |
430 | ||
431 | #ifdef SDB_DEBUGGING_INFO /* Avoid undef sym in certain broken linkers. */ | |
432 | extern int sdb_begin_function_line; | |
433 | #endif | |
434 | ||
435 | /* File in which assembler code is being written. */ | |
436 | ||
cf1c49cb | 437 | #ifdef BUFSIZ |
0c2768fc RS |
438 | extern FILE *asm_out_file; |
439 | #endif | |
ad4ff310 JM |
440 | |
441 | /* Decide whether DECL needs to be in a writable section. RELOC is the same | |
442 | as for SELECT_SECTION. */ | |
443 | ||
444 | #define DECL_READONLY_SECTION(DECL,RELOC) \ | |
445 | (TREE_READONLY (DECL) \ | |
446 | && ! TREE_THIS_VOLATILE (DECL) \ | |
447 | && DECL_INITIAL (DECL) \ | |
448 | && (DECL_INITIAL (DECL) == error_mark_node \ | |
449 | || TREE_CONSTANT (DECL_INITIAL (DECL))) \ | |
450 | && ! (RELOC && (flag_pic || DECL_ONE_ONLY (DECL)))) |