OSDN Git Service

* output.h (const_section, init_section, fini_section): Add
[pf3gnuchains/gcc-fork.git] / gcc / output.h
1 /* Declarations for insn-output.c.  These functions are defined in recog.c,
2    final.c, and varasm.c.
3    Copyright (C) 1987, 1991, 1994, 97-98, 1999 Free Software Foundation, Inc.
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
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 /* Initialize data in final at the beginning of a compilation.  */
23 extern void init_final          PROTO((const 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((const 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
45 #ifdef RTX_CODE
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  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  PROTO((rtx, FILE *, int));
65
66 /* Output assembler code for some insns: all or part of a function.  */
67 extern void final               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      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((const char *));
81
82 /* Output a string of assembler code, substituting insn operands.
83    Defined in final.c.  */
84 extern void output_asm_insn     PROTO((const char *, rtx *));
85
86 /* Compute a worst-case reference address of a branch so that it
87    can be safely used in the presence of aligned labels.
88    Defined in final.c.  */
89 extern int insn_current_reference_address       PROTO((rtx));
90
91 /* Find the alignment associated with a CODE_LABEL.
92    Defined in final.c.  */
93 extern int label_to_alignment   PROTO((rtx));
94
95 /* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol.  */
96 extern void output_asm_label    PROTO((rtx));
97
98 /* Print a memory reference operand for address X
99    using machine-dependent assembler syntax.  */
100 extern void output_address      PROTO((rtx));
101
102 /* Print an integer constant expression in assembler syntax.
103    Addition and subtraction are the only arithmetic
104    that may appear in these expressions.  */
105 extern void output_addr_const PROTO((FILE *, rtx));
106
107 /* Output a string of assembler code, substituting numbers, strings
108    and fixed syntactic prefixes.  */
109 extern void asm_fprintf         PVPROTO((FILE *file, const char *p, ...));
110
111 /* Split up a CONST_DOUBLE or integer constant rtx into two rtx's for single
112    words.  */
113 extern void split_double        PROTO((rtx, rtx *, rtx *));
114
115 /* Return nonzero if this function has no function calls.  */
116 extern int leaf_function_p      PROTO((void));
117
118 /* Return 1 if this function uses only the registers that can be
119    safely renumbered.  */
120 extern int only_leaf_regs_used  PROTO((void));
121
122 /* Scan IN_RTX and its subexpressions, and renumber all regs into those
123    available in leaf functions.  */
124 extern void leaf_renumber_regs_insn PROTO((rtx));
125
126 /* Locate the proper template for the given insn-code.  */
127 extern const char *get_insn_template PROTO((int, rtx));
128
129 /* Functions in flow.c */
130 extern void allocate_for_life_analysis  PROTO((void));
131 extern int regno_uninitialized          PROTO((int));
132 extern int regno_clobbered_at_setjmp    PROTO((int));
133 extern void dump_flow_info              PROTO((FILE *));
134 extern void find_basic_blocks         PROTO((rtx, int, FILE *, int));
135 extern void free_basic_block_vars     PROTO((int));
136 extern void set_block_num             PROTO((rtx, int));
137 extern void life_analysis             PROTO((rtx, int, FILE *, int));
138 #endif
139
140 /* Functions in varasm.c.  */
141
142 /* Tell assembler to switch to text section.  */
143 extern void text_section                PROTO((void));
144
145 /* Tell assembler to switch to data section.  */
146 extern void data_section                PROTO((void));
147
148 /* Tell assembler to make sure its in the data section.  */
149 extern void force_data_section          PROTO((void));
150
151 /* Tell assembler to switch to read-only data section.  This is normally
152    the text section.  */
153 extern void readonly_data_section       PROTO((void));
154
155 /* Determine if we're in the text section. */
156 extern int in_text_section              PROTO((void));
157
158 #ifdef EH_FRAME_SECTION_ASM_OP
159 extern void eh_frame_section            PROTO ((void));
160 #endif
161
162 #ifdef CTORS_SECTION_ASM_OP
163 extern void ctors_section PARAMS ((void));
164 #endif
165
166 #ifdef DTORS_SECTION_ASM_OP
167 extern void dtors_section PARAMS ((void));
168 #endif
169
170 #ifdef BSS_SECTION_ASM_OP
171 extern void bss_section PARAMS ((void));
172 #endif
173
174 #ifdef CONST_SECTION_ASM_OP
175 extern void const_section PARAMS ((void));
176 #endif
177
178 #ifdef INIT_SECTION_ASM_OP
179 extern void init_section PARAMS ((void));
180 #endif
181
182 #ifdef FINI_SECTION_ASM_OP
183 extern void fini_section PARAMS ((void));
184 #endif
185
186 #ifdef TREE_CODE
187 /* Tell assembler to change to section NAME for DECL.
188    If DECL is NULL, just switch to section NAME.
189    If NAME is NULL, get the name from DECL.
190    If RELOC is 1, the initializer for DECL contains relocs.  */
191 extern void named_section               PROTO((tree, const char *, int));
192
193 /* Tell assembler to switch to the section for function DECL.  */
194 extern void function_section            PROTO((tree));
195
196 /* Tell assembler to switch to the section for the exception table.  */
197 extern void exception_section           PROTO((void));
198
199 /* Create the rtl to represent a function, for a function definition.
200    DECL is a FUNCTION_DECL node which describes which function.
201    The rtl is stored into DECL.  */
202 extern void make_function_rtl           PROTO((tree));
203
204 /* Declare DECL to be a weak symbol.  */
205 extern void declare_weak                PROTO ((tree));
206 #endif /* TREE_CODE */
207
208 /* Emit any pending weak declarations.  */
209 extern void weak_finish                 PROTO ((void));
210
211 /* Decode an `asm' spec for a declaration as a register name.
212    Return the register number, or -1 if nothing specified,
213    or -2 if the ASMSPEC is not `cc' or `memory' and is not recognized,
214    or -3 if ASMSPEC is `cc' and is not recognized,
215    or -4 if ASMSPEC is `memory' and is not recognized.
216    Accept an exact spelling or a decimal number.
217    Prefixes such as % are optional.  */
218 extern int decode_reg_name              PROTO((const char *));
219
220 #ifdef TREE_CODE
221 /* Create the DECL_RTL for a declaration for a static or external variable
222    or static or external function.
223    ASMSPEC, if not 0, is the string which the user specified
224    as the assembler symbol name.
225    TOP_LEVEL is nonzero if this is a file-scope variable.
226
227    This is never called for PARM_DECL nodes.  */
228 extern void make_decl_rtl               PROTO((tree, const char *, int));
229
230 /* Make the rtl for variable VAR be volatile.
231    Use this only for static variables.  */
232 extern void make_var_volatile           PROTO((tree));
233
234 /* Output alignment directive to align for constant expression EXP.  */
235 extern void assemble_constant_align     PROTO((tree));
236
237 extern void assemble_alias              PROTO((tree, tree));
238
239 /* Output a string of literal assembler code
240    for an `asm' keyword used between functions.  */
241 extern void assemble_asm                PROTO((tree));
242
243 /* Output assembler code for the constant pool of a function and associated
244    with defining the name of the function.  DECL describes the function.
245    NAME is the function's name.  For the constant pool, we use the current
246    constant pool data.  */
247 extern void assemble_start_function     PROTO((tree, char *));
248
249 /* Output assembler code associated with defining the size of the
250    function.  DECL describes the function.  NAME is the function's name.  */
251 extern void assemble_end_function       PROTO((tree, const char *));
252
253 /* Assemble everything that is needed for a variable or function declaration.
254    Not used for automatic variables, and not used for function definitions.
255    Should not be called for variables of incomplete structure type.
256
257    TOP_LEVEL is nonzero if this variable has file scope.
258    AT_END is nonzero if this is the special handling, at end of compilation,
259    to define things that have had only tentative definitions.
260    DONT_OUTPUT_DATA if nonzero means don't actually output the
261    initial value (that will be done by the caller).  */
262 extern void assemble_variable           PROTO((tree, int, int, int));
263
264 /* Output something to declare an external symbol to the assembler.
265    (Most assemblers don't need this, so we normally output nothing.)
266    Do nothing if DECL is not external.  */
267 extern void assemble_external           PROTO((tree));
268 #endif /* TREE_CODE */
269
270 /* Record an element in the table of global destructors.
271    How this is done depends on what sort of assembler and linker
272    are in use.
273
274    NAME should be the name of a global function to be called
275    at exit time.  This name is output using assemble_name.  */
276 extern void assemble_destructor         PROTO((const char *));
277
278 /* Likewise for global constructors.  */
279 extern void assemble_constructor        PROTO((const char *));
280
281 /* Likewise for entries we want to record for garbage collection.
282    Garbage collection is still under development.  */
283 extern void assemble_gc_entry           PROTO((const char *));
284
285 /* Assemble code to leave SIZE bytes of zeros.  */
286 extern void assemble_zeros              PROTO((int));
287
288 /* Assemble an alignment pseudo op for an ALIGN-bit boundary.  */
289 extern void assemble_align              PROTO((int));
290
291 /* Assemble a string constant with the specified C string as contents.  */
292 extern void assemble_string             PROTO((const char *, int));
293
294 #ifdef RTX_CODE
295 /* Similar, for calling a library function FUN.  */
296 extern void assemble_external_libcall   PROTO((rtx));
297 #endif
298
299 /* Declare the label NAME global.  */
300 extern void assemble_global             PROTO((const char *));
301
302 /* Assemble a label named NAME.  */
303 extern void assemble_label              PROTO((const char *));
304
305 /* Output to FILE a reference to the assembler name of a C-level name NAME.
306    If NAME starts with a *, the rest of NAME is output verbatim.
307    Otherwise NAME is transformed in an implementation-defined way
308    (usually by the addition of an underscore).
309    Many macros in the tm file are defined to call this function.  */
310 extern void assemble_name               PROTO((FILE *, const char *));
311
312 #ifdef RTX_CODE
313 /* Assemble the integer constant X into an object of SIZE bytes.
314    X must be either a CONST_INT or CONST_DOUBLE.
315
316    Return 1 if we were able to output the constant, otherwise 0.  If FORCE is
317    non-zero, abort if we can't output the constant.  */
318 extern int assemble_integer             PROTO((rtx, int, int));
319
320 #ifdef EMUSHORT
321 /* Assemble the floating-point constant D into an object of size MODE.  */
322 extern void assemble_real               PROTO((REAL_VALUE_TYPE,
323                                                enum machine_mode));
324 #endif
325 #endif
326
327 /* At the end of a function, forget the memory-constants
328    previously made for CONST_DOUBLEs.  Mark them as not on real_constant_chain.
329    Also clear out real_constant_chain and clear out all the chain-pointers.  */
330 extern void clear_const_double_mem      PROTO((void));
331
332 /* Start deferring output of subconstants.  */
333 extern void defer_addressed_constants   PROTO((void));
334
335 /* Stop deferring output of subconstants,
336    and output now all those that have been deferred.  */
337 extern void output_deferred_addressed_constants PROTO((void));
338
339 /* Return the size of the constant pool.  */
340 extern int get_pool_size                PROTO((void));
341
342 #ifdef HAVE_peephole
343 extern rtx peephole                     PROTO((rtx));
344 #endif
345
346 #ifdef TREE_CODE
347 /* Write all the constants in the constant pool.  */
348 extern void output_constant_pool        PROTO((const char *, tree));
349
350 /* Return nonzero if VALUE is a valid constant-valued expression
351    for use in initializing a static variable; one that can be an
352    element of a "constant" initializer.
353
354    Return null_pointer_node if the value is absolute;
355    if it is relocatable, return the variable that determines the relocation.
356    We assume that VALUE has been folded as much as possible;
357    therefore, we do not need to check for such things as
358    arithmetic-combinations of integers.  */
359 extern tree initializer_constant_valid_p        PROTO((tree, tree));
360
361 /* Output assembler code for constant EXP to FILE, with no label.
362    This includes the pseudo-op such as ".int" or ".byte", and a newline.
363    Assumes output_addressed_constants has been done on EXP already.
364
365    Generate exactly SIZE bytes of assembler data, padding at the end
366    with zeros if necessary.  SIZE must always be specified.  */
367 extern void output_constant             PROTO((tree, int));
368 #endif
369
370 /* When outputting assembler code, indicates which alternative
371    of the constraints was actually satisfied.  */
372 extern int which_alternative;
373
374 #ifdef RTX_CODE
375 /* When outputting delayed branch sequences, this rtx holds the
376    sequence being output.  It is null when no delayed branch
377    sequence is being output, so it can be used as a test in the
378    insn output code.
379
380    This variable is defined  in final.c.  */
381 extern rtx final_sequence;
382 #endif
383
384 /* Nonzero means generate position-independent code.
385    This is not fully implemented yet.  */
386
387 extern int flag_pic;
388
389 /* The line number of the beginning of the current function.
390    sdbout.c needs this so that it can output relative linenumbers.  */
391
392 #ifdef SDB_DEBUGGING_INFO /* Avoid undef sym in certain broken linkers.  */
393 extern int sdb_begin_function_line;
394 #endif
395
396 /* File in which assembler code is being written.  */
397
398 #ifdef BUFSIZ
399 extern FILE *asm_out_file;
400 #endif
401 /* Nonzero if function being compiled doesn't contain any calls
402    (ignoring the prologue and epilogue).  This is set prior to
403    local register allocation and is valid for the remaining
404    compiler passes. */
405
406 extern int current_function_is_leaf;
407
408 /* Nonzero if function being compiled doesn't modify the stack pointer
409    (ignoring the prologue and epilogue).  This is only valid after
410    life_analysis has run. */
411
412 extern int current_function_sp_is_unchanging;
413
414 /* Nonzero if the function being compiled is a leaf function which only
415    uses leaf registers.  This is valid after reload (specifically after
416    sched2) and is useful only if the port defines LEAF_REGISTERS.  */
417
418 extern int current_function_uses_only_leaf_regs;
419
420 /* Default file in which to dump debug output.  */
421
422 #ifdef BUFSIZ
423 extern FILE *rtl_dump_file;
424 #endif
425
426 /* Decide whether DECL needs to be in a writable section.  RELOC is the same
427    as for SELECT_SECTION.  */
428
429 #define DECL_READONLY_SECTION(DECL,RELOC)               \
430   (TREE_READONLY (DECL)                                 \
431    && ! TREE_THIS_VOLATILE (DECL)                       \
432    && DECL_INITIAL (DECL)                               \
433    && (DECL_INITIAL (DECL) == error_mark_node           \
434        || TREE_CONSTANT (DECL_INITIAL (DECL)))          \
435    && ! (RELOC && (flag_pic || DECL_ONE_ONLY (DECL))))
436
437 /* User label prefix in effect for this compilation.  */
438 extern const char *user_label_prefix;
439
440 /* This macro gets just the user-specified name
441    out of the string in a SYMBOL_REF.  On most machines,
442    we discard the * if any and that's all.  */
443 #ifndef STRIP_NAME_ENCODING
444 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
445   (VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'))
446 #endif