1 /* Declarations for insn-output.c. These functions are defined in recog.c,
3 Copyright (C) 1987, 1991, 1994, 1997 Free Software Foundation, Inc.
5 This file is part of GNU CC.
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)
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.
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
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* Initialize data in final at the beginning of a compilation. */
23 extern void init_final PROTO((char *));
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 *));
29 /* Enable APP processing of subsequent output.
30 Used before the output from an `asm' statement. */
31 extern void app_enable PROTO((void));
33 /* Disable APP processing of subsequent output.
34 Called from varasm.c before most kinds of output. */
35 extern void app_disable PROTO((void));
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));
42 /* Indicate that branch shortening hasn't yet been done. */
43 extern void init_insn_lengths PROTO((void));
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));
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));
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 PROTO((rtx, FILE *, int));
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 PROTO((rtx, FILE *, int));
66 /* Output assembler code for some insns: all or part of a function. */
67 extern void final PROTO((rtx, FILE *, int, int));
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
72 extern rtx final_scan_insn PROTO((rtx, FILE *, int, int, int));
74 /* Replace a SUBREG with a REG or a MEM, based on the thing it is a
76 extern rtx alter_subreg PROTO((rtx));
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 *));
82 /* Output a string of assembler code, substituting insn operands.
83 Defined in final.c. */
84 extern void output_asm_insn PROTO((char *, rtx *));
86 /* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol. */
87 extern void output_asm_label PROTO((rtx));
89 /* Print a memory reference operand for address X
90 using machine-dependent assembler syntax. */
91 extern void output_address PROTO((rtx));
93 /* Print an integer constant expression in assembler syntax.
94 Addition and subtraction are the only arithmetic
95 that may appear in these expressions. */
96 extern void output_addr_const PROTO((FILE *, rtx));
98 /* Output a string of assembler code, substituting numbers, strings
99 and fixed syntactic prefixes. */
100 extern void asm_fprintf PROTO(PVPROTO((FILE *file, char *p, ...)));
102 /* Split up a CONST_DOUBLE or integer constant rtx into two rtx's for single
104 extern void split_double PROTO((rtx, rtx *, rtx *));
106 /* Return nonzero if this function has no function calls. */
107 extern int leaf_function_p PROTO((void));
109 /* Return 1 if this function uses only the registers that can be
110 safely renumbered. */
111 extern int only_leaf_regs_used PROTO((void));
113 /* Scan IN_RTX and its subexpressions, and renumber all regs into those
114 available in leaf functions. */
115 extern void leaf_renumber_regs_insn PROTO((rtx));
117 /* Functions in flow.c */
118 extern void allocate_for_life_analysis PROTO((void));
119 extern int regno_uninitialized PROTO((int));
120 extern int regno_clobbered_at_setjmp PROTO((int));
121 extern void dump_flow_info PROTO((FILE *));
122 extern void find_basic_blocks PROTO((rtx, int, FILE *, int));
123 extern void free_basic_block_vars PROTO((int));
124 extern void set_block_num PROTO((rtx, int));
125 extern void life_analysis PROTO((rtx, int, FILE *));
128 /* Functions in varasm.c. */
130 /* Tell assembler to switch to text section. */
131 extern void text_section PROTO((void));
133 /* Tell assembler to switch to data section. */
134 extern void data_section PROTO((void));
136 /* Tell assembler to switch to read-only data section. This is normally
138 extern void readonly_data_section PROTO((void));
140 /* Determine if we're in the text section. */
141 extern int in_text_section PROTO((void));
144 /* Tell assembler to change to section NAME for DECL.
145 If DECL is NULL, just switch to section NAME.
146 If NAME is NULL, get the name from DECL.
147 If RELOC is 1, the initializer for DECL contains relocs. */
148 extern void named_section PROTO((tree, char *, int));
150 /* Tell assembler to switch to the section for function DECL. */
151 extern void function_section PROTO((tree));
153 /* Tell assembler to switch to the section for the exception table. */
154 extern void exception_section PROTO((void));
156 /* Create the rtl to represent a function, for a function definition.
157 DECL is a FUNCTION_DECL node which describes which function.
158 The rtl is stored into DECL. */
159 extern void make_function_rtl PROTO((tree));
161 /* Declare DECL to be a weak symbol. */
162 extern void declare_weak PROTO ((tree));
163 #endif /* TREE_CODE */
165 /* Decode an `asm' spec for a declaration as a register name.
166 Return the register number, or -1 if nothing specified,
167 or -2 if the ASMSPEC is not `cc' or `memory' and is not recognized,
168 or -3 if ASMSPEC is `cc' and is not recognized,
169 or -4 if ASMSPEC is `memory' and is not recognized.
170 Accept an exact spelling or a decimal number.
171 Prefixes such as % are optional. */
172 extern int decode_reg_name PROTO((char *));
175 /* Create the DECL_RTL for a declaration for a static or external variable
176 or static or external function.
177 ASMSPEC, if not 0, is the string which the user specified
178 as the assembler symbol name.
179 TOP_LEVEL is nonzero if this is a file-scope variable.
181 This is never called for PARM_DECL nodes. */
182 extern void make_decl_rtl PROTO((tree, char *, int));
184 /* Make the rtl for variable VAR be volatile.
185 Use this only for static variables. */
186 extern void make_var_volatile PROTO((tree));
188 /* Output alignment directive to align for constant expression EXP. */
189 extern void assemble_constant_align PROTO((tree));
191 extern void assemble_alias PROTO((tree, tree));
193 /* Output a string of literal assembler code
194 for an `asm' keyword used between functions. */
195 extern void assemble_asm PROTO((tree));
197 /* Record an element in the table of global destructors.
198 How this is done depends on what sort of assembler and linker
201 NAME should be the name of a global function to be called
202 at exit time. This name is output using assemble_name. */
203 extern void assemble_destructor PROTO((char *));
205 /* Likewise for global constructors. */
206 extern void assemble_constructor PROTO((char *));
208 /* Likewise for entries we want to record for garbage collection.
209 Garbage collection is still under development. */
210 extern void assemble_gc_entry PROTO((char *));
212 /* Output assembler code for the constant pool of a function and associated
213 with defining the name of the function. DECL describes the function.
214 NAME is the function's name. For the constant pool, we use the current
215 constant pool data. */
216 extern void assemble_start_function PROTO((tree, char *));
218 /* Output assembler code associated with defining the size of the
219 function. DECL describes the function. NAME is the function's name. */
220 extern void assemble_end_function PROTO((tree, char *));
222 /* Assemble code to leave SIZE bytes of zeros. */
223 extern void assemble_zeros PROTO((int));
225 /* Assemble an alignment pseudo op for an ALIGN-bit boundary. */
226 extern void assemble_align PROTO((int));
228 /* Assemble a string constant with the specified C string as contents. */
229 extern void assemble_string PROTO((char *, int));
230 /* Assemble everything that is needed for a variable or function declaration.
231 Not used for automatic variables, and not used for function definitions.
232 Should not be called for variables of incomplete structure type.
234 TOP_LEVEL is nonzero if this variable has file scope.
235 AT_END is nonzero if this is the special handling, at end of compilation,
236 to define things that have had only tentative definitions.
237 DONT_OUTPUT_DATA if nonzero means don't actually output the
238 initial value (that will be done by the caller). */
239 extern void assemble_variable PROTO((tree, int, int, int));
241 /* Output something to declare an external symbol to the assembler.
242 (Most assemblers don't need this, so we normally output nothing.)
243 Do nothing if DECL is not external. */
244 extern void assemble_external PROTO((tree));
245 #endif /* TREE_CODE */
248 /* Similar, for calling a library function FUN. */
249 extern void assemble_external_libcall PROTO((rtx));
252 /* Declare the label NAME global. */
253 extern void assemble_global PROTO((char *));
255 /* Assemble a label named NAME. */
256 extern void assemble_label PROTO((char *));
258 /* Output to FILE a reference to the assembler name of a C-level name NAME.
259 If NAME starts with a *, the rest of NAME is output verbatim.
260 Otherwise NAME is transformed in an implementation-defined way
261 (usually by the addition of an underscore).
262 Many macros in the tm file are defined to call this function. */
263 extern void assemble_name PROTO((FILE *, char *));
266 /* Assemble the integer constant X into an object of SIZE bytes.
267 X must be either a CONST_INT or CONST_DOUBLE.
269 Return 1 if we were able to output the constant, otherwise 0. If FORCE is
270 non-zero, abort if we can't output the constant. */
271 extern int assemble_integer PROTO((rtx, int, int));
274 /* Assemble the floating-point constant D into an object of size MODE. */
275 extern void assemble_real PROTO((REAL_VALUE_TYPE,
280 /* At the end of a function, forget the memory-constants
281 previously made for CONST_DOUBLEs. Mark them as not on real_constant_chain.
282 Also clear out real_constant_chain and clear out all the chain-pointers. */
283 extern void clear_const_double_mem PROTO((void));
285 /* Start deferring output of subconstants. */
286 extern void defer_addressed_constants PROTO((void));
288 /* Stop deferring output of subconstants,
289 and output now all those that have been deferred. */
290 extern void output_deferred_addressed_constants PROTO((void));
292 /* Initialize constant pool hashing for next function. */
293 extern void init_const_rtx_hash_table PROTO((void));
295 /* Return the size of the constant pool. */
296 extern int get_pool_size PROTO((void));
299 /* Write all the constants in the constant pool. */
300 extern void output_constant_pool PROTO((char *, tree));
302 /* Output assembler code for constant EXP to FILE, with no label.
303 This includes the pseudo-op such as ".int" or ".byte", and a newline.
304 Assumes output_addressed_constants has been done on EXP already.
306 Generate exactly SIZE bytes of assembler data, padding at the end
307 with zeros if necessary. SIZE must always be specified. */
308 extern void output_constant PROTO((tree, int));
311 /* When outputting assembler code, indicates which alternative
312 of the constraints was actually satisfied. */
313 extern int which_alternative;
316 /* When outputting delayed branch sequences, this rtx holds the
317 sequence being output. It is null when no delayed branch
318 sequence is being output, so it can be used as a test in the
321 This variable is defined in final.c. */
322 extern rtx final_sequence;
325 /* Number of bytes of args popped by function being compiled on its return.
326 Zero if no bytes are to be popped.
327 May affect compilation of return insn or of function epilogue. */
329 extern int current_function_pops_args;
331 /* Nonzero if function being compiled needs to be given an address
332 where the value should be stored. */
334 extern int current_function_returns_struct;
336 /* Nonzero if function being compiled needs to
337 return the address of where it has put a structure value. */
339 extern int current_function_returns_pcc_struct;
341 /* Nonzero if function being compiled needs to be passed a static chain. */
343 extern int current_function_needs_context;
345 /* Nonzero if function being compiled can call setjmp. */
347 extern int current_function_calls_setjmp;
349 /* Nonzero if function being compiled can call longjmp. */
351 extern int current_function_calls_longjmp;
353 /* Nonzero if function being compiled can call alloca,
354 either as a subroutine or builtin. */
356 extern int current_function_calls_alloca;
358 /* Nonzero if function being compiled receives nonlocal gotos
359 from nested functions. */
361 extern int current_function_has_nonlocal_label;
363 /* Nonzero if function being compiled contains nested functions. */
365 extern int current_function_contains_functions;
367 /* Nonzero if the current function returns a pointer type */
369 extern int current_function_returns_pointer;
371 /* If function's args have a fixed size, this is that size, in bytes.
373 May affect compilation of return insn or of function epilogue. */
375 extern int current_function_args_size;
377 /* # bytes the prologue should push and pretend that the caller pushed them.
378 The prologue must do this, but only if parms can be passed in registers. */
380 extern int current_function_pretend_args_size;
382 /* # of bytes of outgoing arguments required to be pushed by the prologue.
383 If this is non-zero, it means that ACCUMULATE_OUTGOING_ARGS was defined
384 and no stack adjusts will be done on function calls. */
386 extern int current_function_outgoing_args_size;
388 /* Nonzero if current function uses varargs.h or equivalent.
389 Zero for functions that use stdarg.h. */
391 extern int current_function_varargs;
393 /* Nonzero if current function uses stdarg.h or equivalent.
394 Zero for functions that use varargs.h. */
396 extern int current_function_stdarg;
398 /* Quantities of various kinds of registers
399 used for the current function's args. */
401 extern CUMULATIVE_ARGS current_function_args_info;
403 /* Name of function now being compiled. */
405 extern char *current_function_name;
408 /* If non-zero, an RTL expression for that location at which the current
409 function returns its result. Usually equal to
410 DECL_RTL (DECL_RESULT (current_function_decl)). */
412 extern rtx current_function_return_rtx;
414 /* If some insns can be deferred to the delay slots of the epilogue, the
415 delay list for them is recorded here. */
417 extern rtx current_function_epilogue_delay_list;
420 /* Nonzero means generate position-independent code.
421 This is not fully implemented yet. */
425 /* This is nonzero if the current function uses pic_offset_table_rtx. */
426 extern int current_function_uses_pic_offset_table;
428 /* This is nonzero if the current function uses the constant pool. */
429 extern int current_function_uses_const_pool;
431 /* The line number of the beginning of the current function.
432 sdbout.c needs this so that it can output relative linenumbers. */
434 #ifdef SDB_DEBUGGING_INFO /* Avoid undef sym in certain broken linkers. */
435 extern int sdb_begin_function_line;
438 /* File in which assembler code is being written. */
441 extern FILE *asm_out_file;
444 /* Decide whether DECL needs to be in a writable section. RELOC is the same
445 as for SELECT_SECTION. */
447 #define DECL_READONLY_SECTION(DECL,RELOC) \
448 (TREE_READONLY (DECL) \
449 && ! TREE_THIS_VOLATILE (DECL) \
450 && DECL_INITIAL (DECL) \
451 && (DECL_INITIAL (DECL) == error_mark_node \
452 || TREE_CONSTANT (DECL_INITIAL (DECL))) \
453 && ! (RELOC && (flag_pic || DECL_ONE_ONLY (DECL))))