defaults.h (UNALIGNED_SHORT_ASM_OP, [...]): Move from ...
[platform/upstream/gcc.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, 1997, 1998,
4    1999, 2000, 2001 Free Software Foundation, Inc.
5
6 This file is part of GNU CC.
7
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)
11 any later version.
12
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.
17
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.  */
22
23 /* Initialize data in final at the beginning of a compilation.  */
24 extern void init_final          PARAMS ((const char *));
25
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 *));
29
30 /* Enable APP processing of subsequent output.
31    Used before the output from an `asm' statement.  */
32 extern void app_enable          PARAMS ((void));
33
34 /* Disable APP processing of subsequent output.
35    Called from varasm.c before most kinds of output.  */
36 extern void app_disable         PARAMS ((void));
37
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));
42
43 /* Indicate that branch shortening hasn't yet been done.  */
44 extern void init_insn_lengths   PARAMS ((void));
45
46 #ifdef RTX_CODE
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));
50
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));
54
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));
61
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 ((void));
66
67 /* Output assembler code for some insns: all or part of a function.  */
68 extern void final               PARAMS ((rtx, FILE *, int, int));
69
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
72    be scanned.  */
73 extern rtx final_scan_insn      PARAMS ((rtx, FILE *, int, int, int));
74
75 /* Replace a SUBREG with a REG or a MEM, based on the thing it is a
76    subreg of.  */
77 extern rtx alter_subreg PARAMS ((rtx));
78
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 *));
82
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 *));
86
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));
91
92 /* Find the alignment associated with a CODE_LABEL.
93    Defined in final.c.  */
94 extern int label_to_alignment   PARAMS ((rtx));
95
96 /* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol.  */
97 extern void output_asm_label    PARAMS ((rtx));
98
99 /* Print a memory reference operand for address X
100    using machine-dependent assembler syntax.  */
101 extern void output_address      PARAMS ((rtx));
102
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));
107
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, ...));
111
112 /* Split up a CONST_DOUBLE or integer constant rtx into two rtx's for single
113    words.  */
114 extern void split_double        PARAMS ((rtx, rtx *, rtx *));
115
116 /* Return nonzero if this function has no function calls.  */
117 extern int leaf_function_p      PARAMS ((void));
118
119 /* Return 1 if branch is an forward branch.
120    Uses insn_shuid array, so it works only in the final pass.  May be used by
121    output templates to add branch prediction hints, for example.  */
122 extern int final_forward_branch_p PARAMS ((rtx));
123
124 /* Return 1 if this function uses only the registers that can be
125    safely renumbered.  */
126 extern int only_leaf_regs_used  PARAMS ((void));
127
128 /* Scan IN_RTX and its subexpressions, and renumber all regs into those
129    available in leaf functions.  */
130 extern void leaf_renumber_regs_insn PARAMS ((rtx));
131
132 /* Locate the proper template for the given insn-code.  */
133 extern const char *get_insn_template PARAMS ((int, rtx));
134
135 /* Functions in flow.c */
136 extern void allocate_for_life_analysis  PARAMS ((void));
137 extern int regno_uninitialized          PARAMS ((int));
138 extern int regno_clobbered_at_setjmp    PARAMS ((int));
139 extern void find_basic_blocks           PARAMS ((rtx, int, FILE *));
140 extern void cleanup_cfg                 PARAMS ((int));
141 extern void check_function_return_warnings PARAMS ((void));
142 #endif
143
144 /* Functions in varasm.c.  */
145
146 /* Tell assembler to switch to text section.  */
147 extern void text_section                PARAMS ((void));
148
149 /* Tell assembler to switch to data section.  */
150 extern void data_section                PARAMS ((void));
151
152 /* Tell assembler to make sure its in the data section.  */
153 extern void force_data_section          PARAMS ((void));
154
155 /* Tell assembler to switch to read-only data section.  This is normally
156    the text section.  */
157 extern void readonly_data_section       PARAMS ((void));
158
159 /* Determine if we're in the text section. */
160 extern int in_text_section              PARAMS ((void));
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 TDESC_SECTION_ASM_OP
187 extern void tdesc_section PARAMS ((void));
188 #endif
189
190 #ifdef TREE_CODE
191 /* Tell assembler to change to section NAME for DECL.
192    If DECL is NULL, just switch to section NAME.
193    If NAME is NULL, get the name from DECL.
194    If RELOC is 1, the initializer for DECL contains relocs.  */
195 extern void named_section               PARAMS ((tree, const char *, int));
196
197 /* Tell assembler to switch to the section for function DECL.  */
198 extern void function_section            PARAMS ((tree));
199
200 /* Tell assembler to switch to the section for the exception table.  */
201 extern void exception_section           PARAMS ((void));
202
203 /* Declare DECL to be a weak symbol.  */
204 extern void declare_weak                PARAMS ((tree));
205 #endif /* TREE_CODE */
206
207 /* Emit any pending weak declarations.  */
208 extern void weak_finish                 PARAMS ((void));
209
210 /* Decode an `asm' spec for a declaration as a register name.
211    Return the register number, or -1 if nothing specified,
212    or -2 if the ASMSPEC is not `cc' or `memory' and is not recognized,
213    or -3 if ASMSPEC is `cc' and is not recognized,
214    or -4 if ASMSPEC is `memory' and is not recognized.
215    Accept an exact spelling or a decimal number.
216    Prefixes such as % are optional.  */
217 extern int decode_reg_name              PARAMS ((const char *));
218
219 #ifdef TREE_CODE
220 /* Make the rtl for variable VAR be volatile.
221    Use this only for static variables.  */
222 extern void make_var_volatile           PARAMS ((tree));
223
224 /* Output alignment directive to align for constant expression EXP.  */
225 extern void assemble_constant_align     PARAMS ((tree));
226
227 extern void assemble_alias              PARAMS ((tree, tree));
228
229 /* Output a string of literal assembler code
230    for an `asm' keyword used between functions.  */
231 extern void assemble_asm                PARAMS ((tree));
232
233 /* Output assembler code for the constant pool of a function and associated
234    with defining the name of the function.  DECL describes the function.
235    NAME is the function's name.  For the constant pool, we use the current
236    constant pool data.  */
237 extern void assemble_start_function     PARAMS ((tree, const char *));
238
239 /* Output assembler code associated with defining the size of the
240    function.  DECL describes the function.  NAME is the function's name.  */
241 extern void assemble_end_function       PARAMS ((tree, const char *));
242
243 /* Assemble everything that is needed for a variable or function declaration.
244    Not used for automatic variables, and not used for function definitions.
245    Should not be called for variables of incomplete structure type.
246
247    TOP_LEVEL is nonzero if this variable has file scope.
248    AT_END is nonzero if this is the special handling, at end of compilation,
249    to define things that have had only tentative definitions.
250    DONT_OUTPUT_DATA if nonzero means don't actually output the
251    initial value (that will be done by the caller).  */
252 extern void assemble_variable           PARAMS ((tree, int, int, int));
253
254 /* Output something to declare an external symbol to the assembler.
255    (Most assemblers don't need this, so we normally output nothing.)
256    Do nothing if DECL is not external.  */
257 extern void assemble_external           PARAMS ((tree));
258 #endif /* TREE_CODE */
259
260 /* Assemble code to leave SIZE bytes of zeros.  */
261 extern void assemble_zeros              PARAMS ((int));
262
263 /* Assemble an alignment pseudo op for an ALIGN-bit boundary.  */
264 extern void assemble_align              PARAMS ((int));
265 extern void assemble_eh_align           PARAMS ((int));
266
267 /* Assemble a string constant with the specified C string as contents.  */
268 extern void assemble_string             PARAMS ((const char *, int));
269
270 #ifdef RTX_CODE
271 /* Similar, for calling a library function FUN.  */
272 extern void assemble_external_libcall   PARAMS ((rtx));
273 #endif
274
275 /* Declare the label NAME global.  */
276 extern void assemble_global             PARAMS ((const char *));
277
278 /* Assemble a label named NAME.  */
279 extern void assemble_label              PARAMS ((const char *));
280 extern void assemble_eh_label           PARAMS ((const char *));
281
282 /* Output to FILE a reference to the assembler name of a C-level name NAME.
283    If NAME starts with a *, the rest of NAME is output verbatim.
284    Otherwise NAME is transformed in an implementation-defined way
285    (usually by the addition of an underscore).
286    Many macros in the tm file are defined to call this function.  */
287 extern void assemble_name               PARAMS ((FILE *, const char *));
288
289 #ifdef RTX_CODE
290 /* Assemble the integer constant X into an object of SIZE bytes.  ALIGN is
291    the alignment of the integer in bits.  Return 1 if we were able to output
292    the constant, otherwise 0.  If FORCE is non-zero, abort if we can't output
293    the constant.  */
294 extern int assemble_integer             PARAMS ((rtx, unsigned, unsigned, int));
295
296 #ifdef REAL_VALUE_TYPE
297 /* Assemble the floating-point constant D into an object of size MODE.  */
298 extern void assemble_real               PARAMS ((REAL_VALUE_TYPE,
299                                                  enum machine_mode,
300                                                  unsigned));
301 #endif
302 #endif
303
304 /* At the end of a function, forget the memory-constants
305    previously made for CONST_DOUBLEs.  Mark them as not on real_constant_chain.
306    Also clear out real_constant_chain and clear out all the chain-pointers.  */
307 extern void clear_const_double_mem      PARAMS ((void));
308
309 /* Start deferring output of subconstants.  */
310 extern void defer_addressed_constants   PARAMS ((void));
311
312 /* Stop deferring output of subconstants,
313    and output now all those that have been deferred.  */
314 extern void output_deferred_addressed_constants PARAMS ((void));
315
316 /* Return the size of the constant pool.  */
317 extern int get_pool_size                PARAMS ((void));
318
319 #ifdef HAVE_peephole
320 extern rtx peephole                     PARAMS ((rtx));
321 #endif
322
323 #ifdef TREE_CODE
324 /* Write all the constants in the constant pool.  */
325 extern void output_constant_pool        PARAMS ((const char *, tree));
326
327 /* Return nonzero if VALUE is a valid constant-valued expression
328    for use in initializing a static variable; one that can be an
329    element of a "constant" initializer.
330
331    Return null_pointer_node if the value is absolute;
332    if it is relocatable, return the variable that determines the relocation.
333    We assume that VALUE has been folded as much as possible;
334    therefore, we do not need to check for such things as
335    arithmetic-combinations of integers.  */
336 extern tree initializer_constant_valid_p        PARAMS ((tree, tree));
337
338 /* Output assembler code for constant EXP to FILE, with no label.
339    This includes the pseudo-op such as ".int" or ".byte", and a newline.
340    Assumes output_addressed_constants has been done on EXP already.
341
342    Generate exactly SIZE bytes of assembler data, padding at the end
343    with zeros if necessary.  SIZE must always be specified.
344
345    ALIGN is the alignment in bits that may be assumed for the data.  */
346 extern void output_constant             PARAMS ((tree, int, unsigned));
347 #endif
348
349 #ifdef RTX_CODE
350 /* When outputting delayed branch sequences, this rtx holds the
351    sequence being output.  It is null when no delayed branch
352    sequence is being output, so it can be used as a test in the
353    insn output code.
354
355    This variable is defined  in final.c.  */
356 extern rtx final_sequence;
357 #endif
358
359 /* The line number of the beginning of the current function.  Various
360    md code needs this so that it can output relative linenumbers.  */
361
362 #ifdef SDB_DEBUGGING_INFO /* Avoid undef sym in certain broken linkers.  */
363 extern int sdb_begin_function_line;
364 #endif
365
366 /* File in which assembler code is being written.  */
367
368 #ifdef BUFSIZ
369 extern FILE *asm_out_file;
370 #endif
371
372 /* The first global object in the file.  */
373 extern const char *first_global_object_name;
374
375 /* The first weak object in the file.  */
376 extern const char *weak_global_object_name;
377
378 /* Nonzero if function being compiled doesn't contain any calls
379    (ignoring the prologue and epilogue).  This is set prior to
380    local register allocation and is valid for the remaining
381    compiler passes. */
382
383 extern int current_function_is_leaf;
384
385 /* Nonzero if function being compiled doesn't contain any instructions
386    that can throw an exception.  This is set prior to final.  */
387
388 extern int current_function_nothrow;
389
390 /* Nonzero if function being compiled doesn't modify the stack pointer
391    (ignoring the prologue and epilogue).  This is only valid after
392    life_analysis has run. */
393
394 extern int current_function_sp_is_unchanging;
395
396 /* Nonzero if the function being compiled is a leaf function which only
397    uses leaf registers.  This is valid after reload (specifically after
398    sched2) and is useful only if the port defines LEAF_REGISTERS.  */
399
400 extern int current_function_uses_only_leaf_regs;
401
402 /* Default file in which to dump debug output.  */
403
404 #ifdef BUFSIZ
405 extern FILE *rtl_dump_file;
406 #endif
407
408 /* Nonnull if the insn currently being emitted was a COND_EXEC pattern.  */
409 extern struct rtx_def *current_insn_predicate;
410
411 /* Last insn processed by final_scan_insn.  */
412 extern struct rtx_def *current_output_insn;
413
414 /* Decide whether DECL needs to be in a writable section.  RELOC is the same
415    as for SELECT_SECTION.  */
416
417 #define DECL_READONLY_SECTION(DECL,RELOC)               \
418   (TREE_READONLY (DECL)                                 \
419    && ! TREE_THIS_VOLATILE (DECL)                       \
420    && DECL_INITIAL (DECL)                               \
421    && (DECL_INITIAL (DECL) == error_mark_node           \
422        || TREE_CONSTANT (DECL_INITIAL (DECL)))          \
423    && ! (RELOC && (flag_pic || DECL_ONE_ONLY (DECL))))
424
425 /* User label prefix in effect for this compilation.  */
426 extern const char *user_label_prefix;
427
428 /* This macro gets just the user-specified name
429    out of the string in a SYMBOL_REF.  On most machines,
430    we discard the * if any and that's all.  */
431 #ifndef STRIP_NAME_ENCODING
432 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
433   (VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'))
434 #endif
435 /* Assign unique numbers to labels generated for profiling.  */
436
437 extern int profile_label_no;
438
439 /* Default target function prologue and epilogue assembler output.  */
440 extern void default_function_pro_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
441
442 /* Default target hook that outputs nothing to a stream.  */
443 extern void no_asm_to_stream PARAMS ((FILE *));
444
445 /* Flags controling properties of a section.  */
446 #define SECTION_CODE        1   /* contains code */
447 #define SECTION_WRITE       2   /* data is writable */
448 #define SECTION_DEBUG       4   /* contains debug data */
449 #define SECTION_LINKONCE    8   /* is linkonce */
450 #define SECTION_SMALL      16   /* contains "small data" */
451 #define SECTION_BSS        32   /* contains zeros only */
452 #define SECTION_FORGET     64   /* forget that we've entered the section */
453 #define SECTION_MACH_DEP  128   /* subsequent bits reserved for target */
454
455 extern unsigned int get_named_section_flags PARAMS ((const char *));
456 extern bool set_named_section_flags     PARAMS ((const char *, unsigned int));
457 extern void named_section_flags         PARAMS ((const char *, unsigned int));
458
459 union tree_node;
460 extern unsigned int default_section_type_flags PARAMS ((union tree_node *,
461                                                         const char *, int));
462
463 extern void default_no_named_section PARAMS ((const char *, unsigned int));
464 extern void default_elf_asm_named_section PARAMS ((const char *, unsigned int));
465 extern void default_coff_asm_named_section PARAMS ((const char *,
466                                                     unsigned int));
467 extern void default_pe_asm_named_section PARAMS ((const char *, unsigned int));
468
469 extern void default_stabs_asm_out_destructor PARAMS ((struct rtx_def *, int));
470 extern void default_named_section_asm_out_destructor PARAMS ((struct rtx_def *,
471                                                               int));
472 extern void default_dtor_section_asm_out_destructor PARAMS ((struct rtx_def *,
473                                                              int));
474 extern void default_stabs_asm_out_constructor PARAMS ((struct rtx_def *, int));
475 extern void default_named_section_asm_out_constructor PARAMS ((struct rtx_def *,
476                                                                int));
477 extern void default_ctor_section_asm_out_constructor PARAMS ((struct rtx_def *,
478                                                               int));