1 /* Declarations for insn-output.c. These functions are defined in recog.c,
3 Copyright (C) 1987, 1991, 1994, 1997, 1998,
4 1999, 2000 Free Software Foundation, Inc.
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 /* Initialize data in final at the beginning of a compilation. */
24 extern void init_final
PARAMS ((const char *));
26 /* Called at end of source file,
27 to output the block-profiling table for this entire compilation. */
28 extern void end_final
PARAMS ((const char *));
30 /* Enable APP processing of subsequent output.
31 Used before the output from an `asm' statement. */
32 extern void app_enable
PARAMS ((void));
34 /* Disable APP processing of subsequent output.
35 Called from varasm.c before most kinds of output. */
36 extern void app_disable
PARAMS ((void));
38 /* Return the number of slots filled in the current
39 delayed branch sequence (we don't count the insn needing the
40 delay slot). Zero if not in a delayed branch sequence. */
41 extern int dbr_sequence_length
PARAMS ((void));
43 /* Indicate that branch shortening hasn't yet been done. */
44 extern void init_insn_lengths
PARAMS ((void));
47 /* Obtain the current length of an insn. If branch shortening has been done,
48 get its actual length. Otherwise, get its maximum length. */
49 extern int get_attr_length
PARAMS ((rtx
));
51 /* Make a pass over all insns and compute their actual lengths by shortening
52 any branches of variable length if possible. */
53 extern void shorten_branches
PARAMS ((rtx
));
55 /* Output assembler code for the start of a function,
56 and initialize some of the variables in this file
57 for the new function. The label for the function and associated
58 assembler pseudo-ops have already been output in
59 `assemble_start_function'. */
60 extern void final_start_function
PARAMS ((rtx
, FILE *, int));
62 /* Output assembler code for the end of a function.
63 For clarity, args are same as those of `final_start_function'
64 even though not all of them are needed. */
65 extern void final_end_function
PARAMS ((rtx
, FILE *, int));
67 /* Output assembler code for some insns: all or part of a function. */
68 extern void final
PARAMS ((rtx
, FILE *, int, int));
70 /* The final scan for one insn, INSN. Args are same as in `final', except
71 that INSN is the insn being scanned. Value returned is the next insn to
73 extern rtx final_scan_insn
PARAMS ((rtx
, FILE *, int, int, int));
75 /* Replace a SUBREG with a REG or a MEM, based on the thing it is a
77 extern rtx alter_subreg
PARAMS ((rtx
));
79 /* Report inconsistency between the assembler template and the operands.
80 In an `asm', it's the user's fault; otherwise, the compiler's fault. */
81 extern void output_operand_lossage
PARAMS ((const char *));
83 /* Output a string of assembler code, substituting insn operands.
84 Defined in final.c. */
85 extern void output_asm_insn
PARAMS ((const char *, rtx
*));
87 /* Compute a worst-case reference address of a branch so that it
88 can be safely used in the presence of aligned labels.
89 Defined in final.c. */
90 extern int insn_current_reference_address
PARAMS ((rtx
));
92 /* Find the alignment associated with a CODE_LABEL.
93 Defined in final.c. */
94 extern int label_to_alignment
PARAMS ((rtx
));
96 /* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol. */
97 extern void output_asm_label
PARAMS ((rtx
));
99 /* Print a memory reference operand for address X
100 using machine-dependent assembler syntax. */
101 extern void output_address
PARAMS ((rtx
));
103 /* Print an integer constant expression in assembler syntax.
104 Addition and subtraction are the only arithmetic
105 that may appear in these expressions. */
106 extern void output_addr_const
PARAMS ((FILE *, rtx
));
108 /* Output a string of assembler code, substituting numbers, strings
109 and fixed syntactic prefixes. */
110 extern void asm_fprintf
PARAMS ((FILE *file
, const char *p
, ...));
112 /* Split up a CONST_DOUBLE or integer constant rtx into two rtx's for single
114 extern void split_double
PARAMS ((rtx
, rtx
*, rtx
*));
116 /* Return nonzero if this function has no function calls. */
117 extern int leaf_function_p
PARAMS ((void));
119 /* Return 1 if this function uses only the registers that can be
120 safely renumbered. */
121 extern int only_leaf_regs_used
PARAMS ((void));
123 /* Scan IN_RTX and its subexpressions, and renumber all regs into those
124 available in leaf functions. */
125 extern void leaf_renumber_regs_insn
PARAMS ((rtx
));
127 /* Locate the proper template for the given insn-code. */
128 extern const char *get_insn_template
PARAMS ((int, rtx
));
130 /* Functions in flow.c */
131 extern void allocate_for_life_analysis
PARAMS ((void));
132 extern int regno_uninitialized
PARAMS ((int));
133 extern int regno_clobbered_at_setjmp
PARAMS ((int));
134 extern void dump_flow_info
PARAMS ((FILE *));
135 extern void find_basic_blocks
PARAMS ((rtx
, int, FILE *));
136 extern void cleanup_cfg
PARAMS ((rtx
));
137 extern void free_basic_block_vars
PARAMS ((int));
138 extern void set_block_num
PARAMS ((rtx
, int));
141 /* Functions in varasm.c. */
143 /* Tell assembler to switch to text section. */
144 extern void text_section
PARAMS ((void));
146 /* Tell assembler to switch to data section. */
147 extern void data_section
PARAMS ((void));
149 /* Tell assembler to make sure its in the data section. */
150 extern void force_data_section
PARAMS ((void));
152 /* Tell assembler to switch to read-only data section. This is normally
154 extern void readonly_data_section
PARAMS ((void));
156 /* Determine if we're in the text section. */
157 extern int in_text_section
PARAMS ((void));
159 #ifdef EH_FRAME_SECTION_ASM_OP
160 extern void eh_frame_section
PARAMS ((void));
163 #ifdef CTORS_SECTION_ASM_OP
164 extern void ctors_section
PARAMS ((void));
167 #ifdef DTORS_SECTION_ASM_OP
168 extern void dtors_section
PARAMS ((void));
171 #ifdef BSS_SECTION_ASM_OP
172 extern void bss_section
PARAMS ((void));
175 #ifdef CONST_SECTION_ASM_OP
176 extern void const_section
PARAMS ((void));
179 #ifdef INIT_SECTION_ASM_OP
180 extern void init_section
PARAMS ((void));
183 #ifdef FINI_SECTION_ASM_OP
184 extern void fini_section
PARAMS ((void));
187 #ifdef TDESC_SECTION_ASM_OP
188 extern void tdesc_section
PARAMS ((void));
192 /* Tell assembler to change to section NAME for DECL.
193 If DECL is NULL, just switch to section NAME.
194 If NAME is NULL, get the name from DECL.
195 If RELOC is 1, the initializer for DECL contains relocs. */
196 extern void named_section
PARAMS ((tree
, const char *, int));
198 /* Tell assembler to switch to the section for function DECL. */
199 extern void function_section
PARAMS ((tree
));
201 /* Tell assembler to switch to the section for the exception table. */
202 extern void exception_section
PARAMS ((void));
204 /* Create the rtl to represent a function, for a function definition.
205 DECL is a FUNCTION_DECL node which describes which function.
206 The rtl is stored into DECL. */
207 extern void make_function_rtl
PARAMS ((tree
));
209 /* Declare DECL to be a weak symbol. */
210 extern void declare_weak
PARAMS ((tree
));
211 #endif /* TREE_CODE */
213 /* Emit any pending weak declarations. */
214 extern void weak_finish
PARAMS ((void));
216 /* Decode an `asm' spec for a declaration as a register name.
217 Return the register number, or -1 if nothing specified,
218 or -2 if the ASMSPEC is not `cc' or `memory' and is not recognized,
219 or -3 if ASMSPEC is `cc' and is not recognized,
220 or -4 if ASMSPEC is `memory' and is not recognized.
221 Accept an exact spelling or a decimal number.
222 Prefixes such as % are optional. */
223 extern int decode_reg_name
PARAMS ((const char *));
226 /* Create the DECL_RTL for a declaration for a static or external variable
227 or static or external function.
228 ASMSPEC, if not 0, is the string which the user specified
229 as the assembler symbol name.
230 TOP_LEVEL is nonzero if this is a file-scope variable.
232 This is never called for PARM_DECL nodes. */
233 extern void make_decl_rtl
PARAMS ((tree
, const char *, int));
235 /* Make the rtl for variable VAR be volatile.
236 Use this only for static variables. */
237 extern void make_var_volatile
PARAMS ((tree
));
239 /* Output alignment directive to align for constant expression EXP. */
240 extern void assemble_constant_align
PARAMS ((tree
));
242 extern void assemble_alias
PARAMS ((tree
, tree
));
244 /* Output a string of literal assembler code
245 for an `asm' keyword used between functions. */
246 extern void assemble_asm
PARAMS ((tree
));
248 /* Output assembler code for the constant pool of a function and associated
249 with defining the name of the function. DECL describes the function.
250 NAME is the function's name. For the constant pool, we use the current
251 constant pool data. */
252 extern void assemble_start_function
PARAMS ((tree
, const char *));
254 /* Output assembler code associated with defining the size of the
255 function. DECL describes the function. NAME is the function's name. */
256 extern void assemble_end_function
PARAMS ((tree
, const char *));
258 /* Assemble everything that is needed for a variable or function declaration.
259 Not used for automatic variables, and not used for function definitions.
260 Should not be called for variables of incomplete structure type.
262 TOP_LEVEL is nonzero if this variable has file scope.
263 AT_END is nonzero if this is the special handling, at end of compilation,
264 to define things that have had only tentative definitions.
265 DONT_OUTPUT_DATA if nonzero means don't actually output the
266 initial value (that will be done by the caller). */
267 extern void assemble_variable
PARAMS ((tree
, int, int, int));
269 /* Output something to declare an external symbol to the assembler.
270 (Most assemblers don't need this, so we normally output nothing.)
271 Do nothing if DECL is not external. */
272 extern void assemble_external
PARAMS ((tree
));
273 #endif /* TREE_CODE */
275 /* Record an element in the table of global destructors.
276 How this is done depends on what sort of assembler and linker
279 NAME should be the name of a global function to be called
280 at exit time. This name is output using assemble_name. */
281 extern void assemble_destructor
PARAMS ((const char *));
283 /* Likewise for global constructors. */
284 extern void assemble_constructor
PARAMS ((const char *));
286 /* Likewise for entries we want to record for garbage collection.
287 Garbage collection is still under development. */
288 extern void assemble_gc_entry
PARAMS ((const char *));
290 /* Assemble code to leave SIZE bytes of zeros. */
291 extern void assemble_zeros
PARAMS ((int));
293 /* Assemble an alignment pseudo op for an ALIGN-bit boundary. */
294 extern void assemble_align
PARAMS ((int));
295 extern void assemble_eh_align
PARAMS ((int));
297 /* Assemble a string constant with the specified C string as contents. */
298 extern void assemble_string
PARAMS ((const char *, int));
301 /* Similar, for calling a library function FUN. */
302 extern void assemble_external_libcall
PARAMS ((rtx
));
305 /* Declare the label NAME global. */
306 extern void assemble_global
PARAMS ((const char *));
308 /* Assemble a label named NAME. */
309 extern void assemble_label
PARAMS ((const char *));
310 extern void assemble_eh_label
PARAMS ((const char *));
312 /* Output to FILE a reference to the assembler name of a C-level name NAME.
313 If NAME starts with a *, the rest of NAME is output verbatim.
314 Otherwise NAME is transformed in an implementation-defined way
315 (usually by the addition of an underscore).
316 Many macros in the tm file are defined to call this function. */
317 extern void assemble_name
PARAMS ((FILE *, const char *));
320 /* Assemble the integer constant X into an object of SIZE bytes.
321 X must be either a CONST_INT or CONST_DOUBLE.
323 Return 1 if we were able to output the constant, otherwise 0. If FORCE is
324 non-zero, abort if we can't output the constant. */
325 extern int assemble_integer
PARAMS ((rtx
, int, int));
326 extern int assemble_eh_integer
PARAMS ((rtx
, int, int));
329 /* Assemble the floating-point constant D into an object of size MODE. */
330 extern void assemble_real
PARAMS ((REAL_VALUE_TYPE
,
335 /* At the end of a function, forget the memory-constants
336 previously made for CONST_DOUBLEs. Mark them as not on real_constant_chain.
337 Also clear out real_constant_chain and clear out all the chain-pointers. */
338 extern void clear_const_double_mem
PARAMS ((void));
340 /* Start deferring output of subconstants. */
341 extern void defer_addressed_constants
PARAMS ((void));
343 /* Stop deferring output of subconstants,
344 and output now all those that have been deferred. */
345 extern void output_deferred_addressed_constants
PARAMS ((void));
347 /* Return the size of the constant pool. */
348 extern int get_pool_size
PARAMS ((void));
351 extern rtx peephole
PARAMS ((rtx
));
355 /* Write all the constants in the constant pool. */
356 extern void output_constant_pool
PARAMS ((const char *, tree
));
358 /* Return nonzero if VALUE is a valid constant-valued expression
359 for use in initializing a static variable; one that can be an
360 element of a "constant" initializer.
362 Return null_pointer_node if the value is absolute;
363 if it is relocatable, return the variable that determines the relocation.
364 We assume that VALUE has been folded as much as possible;
365 therefore, we do not need to check for such things as
366 arithmetic-combinations of integers. */
367 extern tree initializer_constant_valid_p
PARAMS ((tree
, tree
));
369 /* Output assembler code for constant EXP to FILE, with no label.
370 This includes the pseudo-op such as ".int" or ".byte", and a newline.
371 Assumes output_addressed_constants has been done on EXP already.
373 Generate exactly SIZE bytes of assembler data, padding at the end
374 with zeros if necessary. SIZE must always be specified. */
375 extern void output_constant
PARAMS ((tree
, int));
378 /* When outputting assembler code, indicates which alternative
379 of the constraints was actually satisfied. */
380 extern int which_alternative
;
383 /* When outputting delayed branch sequences, this rtx holds the
384 sequence being output. It is null when no delayed branch
385 sequence is being output, so it can be used as a test in the
388 This variable is defined in final.c. */
389 extern rtx final_sequence
;
392 /* Nonzero means generate position-independent code.
393 This is not fully implemented yet. */
397 /* The line number of the beginning of the current function.
398 sdbout.c needs this so that it can output relative linenumbers. */
400 #ifdef SDB_DEBUGGING_INFO /* Avoid undef sym in certain broken linkers. */
401 extern int sdb_begin_function_line
;
404 /* File in which assembler code is being written. */
407 extern FILE *asm_out_file
;
410 /* The first global object in the file. */
411 extern const char *first_global_object_name
;
413 /* The first weak object in the file. */
414 extern const char *weak_global_object_name
;
416 /* Nonzero if function being compiled doesn't contain any calls
417 (ignoring the prologue and epilogue). This is set prior to
418 local register allocation and is valid for the remaining
421 extern int current_function_is_leaf
;
423 /* Nonzero if function being compiled doesn't contain any instructions
424 that can throw an exception. This is set prior to final. */
426 extern int current_function_nothrow
;
428 /* Nonzero if function being compiled doesn't modify the stack pointer
429 (ignoring the prologue and epilogue). This is only valid after
430 life_analysis has run. */
432 extern int current_function_sp_is_unchanging
;
434 /* Nonzero if the function being compiled is a leaf function which only
435 uses leaf registers. This is valid after reload (specifically after
436 sched2) and is useful only if the port defines LEAF_REGISTERS. */
438 extern int current_function_uses_only_leaf_regs
;
440 /* Default file in which to dump debug output. */
443 extern FILE *rtl_dump_file
;
446 /* Nonnull if the insn currently being emitted was a COND_EXEC pattern. */
447 extern struct rtx_def
*current_insn_predicate
;
449 /* Last insn processed by final_scan_insn. */
450 extern struct rtx_def
*current_output_insn
;
452 /* Decide whether DECL needs to be in a writable section. RELOC is the same
453 as for SELECT_SECTION. */
455 #define DECL_READONLY_SECTION(DECL,RELOC) \
456 (TREE_READONLY (DECL) \
457 && ! TREE_THIS_VOLATILE (DECL) \
458 && DECL_INITIAL (DECL) \
459 && (DECL_INITIAL (DECL) == error_mark_node \
460 || TREE_CONSTANT (DECL_INITIAL (DECL))) \
461 && ! (RELOC && (flag_pic || DECL_ONE_ONLY (DECL))))
463 /* User label prefix in effect for this compilation. */
464 extern const char *user_label_prefix
;
466 /* This macro gets just the user-specified name
467 out of the string in a SYMBOL_REF. On most machines,
468 we discard the * if any and that's all. */
469 #ifndef STRIP_NAME_ENCODING
470 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
471 (VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'))