mips-protos.h revision 169690
1123992Ssobomax/* Prototypes of target machine for GNU compiler.  MIPS version.
2103026Ssobomax   Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3103026Ssobomax   1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4139823Simp   Contributed by A. Lichnewsky (lich@inria.inria.fr).
5103026Ssobomax   Changed by Michael Meissner	(meissner@osf.org).
6103026Ssobomax   64 bit r4000 support by Ian Lance Taylor (ian@cygnus.com) and
7103026Ssobomax   Brendan Eich (brendan@microunity.com).
8103026Ssobomax
9103026SsobomaxThis file is part of GCC.
10103026Ssobomax
11148613SbzGCC is free software; you can redistribute it and/or modify
12148613Sbzit under the terms of the GNU General Public License as published by
13103026Ssobomaxthe Free Software Foundation; either version 2, or (at your option)
14103026Ssobomaxany later version.
15103026Ssobomax
16103026SsobomaxGCC is distributed in the hope that it will be useful,
17103026Ssobomaxbut WITHOUT ANY WARRANTY; without even the implied warranty of
18103026SsobomaxMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19103026SsobomaxGNU General Public License for more details.
20103026Ssobomax
21103026SsobomaxYou should have received a copy of the GNU General Public License
22103026Ssobomaxalong with GCC; see the file COPYING.  If not, write to
23103026Ssobomaxthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
24103026SsobomaxBoston, MA 02110-1301, USA.  */
25103026Ssobomax
26103026Ssobomax#ifndef GCC_MIPS_PROTOS_H
27103026Ssobomax#define GCC_MIPS_PROTOS_H
28103026Ssobomax
29103026Ssobomax/* Classifies a SYMBOL_REF, LABEL_REF or UNSPEC address.
30103026Ssobomax
31103026Ssobomax   SYMBOL_GENERAL
32103026Ssobomax       Used when none of the below apply.
33103026Ssobomax
34103026Ssobomax   SYMBOL_SMALL_DATA
35103026Ssobomax       The symbol refers to something in a small data section.
36103026Ssobomax
37103026Ssobomax   SYMBOL_CONSTANT_POOL
38103026Ssobomax       The symbol refers to something in the mips16 constant pool.
39103026Ssobomax
40103026Ssobomax   SYMBOL_GOT_LOCAL
41103026Ssobomax       The symbol refers to local data that will be found using
42103026Ssobomax       the global offset table.
43103026Ssobomax
44148613Sbz   SYMBOL_GOT_GLOBAL
45103026Ssobomax       Likewise non-local data.
46103026Ssobomax
47103026Ssobomax   SYMBOL_GOTOFF_PAGE
48103026Ssobomax       An UNSPEC wrapper around a SYMBOL_GOT_LOCAL.  It represents the
49103026Ssobomax       offset from _gp of a GOT page entry.
50103026Ssobomax
51103394Sbde   SYMBOL_GOTOFF_GLOBAL
52103026Ssobomax       An UNSPEC wrapper around a SYMBOL_GOT_GLOBAL.  It represents the
53122699Sbms       the offset from _gp of the symbol's GOT entry.
54103026Ssobomax
55103026Ssobomax   SYMBOL_GOTOFF_CALL
56103026Ssobomax       Like SYMBOL_GOTOFF_GLOBAL, but used when calling a global function.
57103026Ssobomax       The GOT entry is allowed to point to a stub rather than to the
58129880Sphk       function itself.
59103026Ssobomax
60103026Ssobomax   SYMBOL_GOTOFF_LOADGP
61103026Ssobomax       An UNSPEC wrapper around a function's address.  It represents the
62103026Ssobomax       offset of _gp from the start of the function.
63103026Ssobomax
64103344Sbde   SYMBOL_TLS
65103026Ssobomax       A thread-local symbol.
66103026Ssobomax
67103026Ssobomax   SYMBOL_TLSGD
68130933Sbrooks   SYMBOL_TLSLDM
69103026Ssobomax   SYMBOL_DTPREL
70103026Ssobomax   SYMBOL_GOTTPREL
71103026Ssobomax   SYMBOL_TPREL
72103026Ssobomax       UNSPEC wrappers around SYMBOL_TLS, corresponding to the
73103026Ssobomax       thread-local storage relocation operators.
74103026Ssobomax
75103026Ssobomax   SYMBOL_64_HIGH
76103026Ssobomax       For a 64-bit symbolic address X, this is the value of
77103026Ssobomax       (%highest(X) << 16) + %higher(X).
78103026Ssobomax
79103026Ssobomax   SYMBOL_64_MID
80103026Ssobomax       For a 64-bit symbolic address X, this is the value of
81103026Ssobomax       (%higher(X) << 16) + %hi(X).
82103026Ssobomax
83103026Ssobomax   SYMBOL_64_LOW
84103026Ssobomax       For a 64-bit symbolic address X, this is the value of
85103026Ssobomax       (%hi(X) << 16) + %lo(X).  */
86103026Ssobomaxenum mips_symbol_type {
87103026Ssobomax  SYMBOL_GENERAL,
88103026Ssobomax  SYMBOL_SMALL_DATA,
89103026Ssobomax  SYMBOL_CONSTANT_POOL,
90103026Ssobomax  SYMBOL_GOT_LOCAL,
91103026Ssobomax  SYMBOL_GOT_GLOBAL,
92103026Ssobomax  SYMBOL_GOTOFF_PAGE,
93103026Ssobomax  SYMBOL_GOTOFF_GLOBAL,
94103026Ssobomax  SYMBOL_GOTOFF_CALL,
95103026Ssobomax  SYMBOL_GOTOFF_LOADGP,
96103026Ssobomax  SYMBOL_TLS,
97103026Ssobomax  SYMBOL_TLSGD,
98127307Srwatson  SYMBOL_TLSLDM,
99127307Srwatson  SYMBOL_DTPREL,
100127307Srwatson  SYMBOL_GOTTPREL,
101127307Srwatson  SYMBOL_TPREL,
102127307Srwatson  SYMBOL_64_HIGH,
103103026Ssobomax  SYMBOL_64_MID,
104103026Ssobomax  SYMBOL_64_LOW
105103026Ssobomax};
106103026Ssobomax#define NUM_SYMBOL_TYPES (SYMBOL_64_LOW + 1)
107105300Salfred
108105300Salfred/* Identifiers a style of $gp initialization sequence.
109103032Ssobomax
110103032Ssobomax   LOADGP_NONE
111103032Ssobomax	No initialization sequence is needed.
112103026Ssobomax
113130933Sbrooks   LOADGP_OLDABI
114103026Ssobomax	The o32 and o64 PIC sequence (the kind traditionally generated
115103032Ssobomax	by .cpload).
116103026Ssobomax
117105300Salfred   LOADGP_NEWABI
118103026Ssobomax	The n32 and n64 PIC sequence (the kind traditionally generated
119103026Ssobomax	by .cpsetup).
120103026Ssobomax
121152242Sru   LOADGP_ABSOLUTE
122152242Sru	The GNU absolute sequence, as generated by loadgp_noshared.  */
123152242Sruenum mips_loadgp_style {
124152242Sru  LOADGP_NONE,
125152242Sru  LOADGP_OLDABI,
126154625Sbz  LOADGP_NEWABI,
127152242Sru  LOADGP_ABSOLUTE
128152242Sru};
129152242Sru
130152242Sruextern bool mips_symbolic_constant_p (rtx, enum mips_symbol_type *);
131103026Ssobomaxextern int mips_regno_mode_ok_for_base_p (int, enum machine_mode, int);
132152242Sruextern bool mips_stack_address_p (rtx, enum machine_mode);
133152242Sruextern int mips_address_insns (rtx, enum machine_mode);
134152242Sruextern int mips_const_insns (rtx);
135152242Sruextern int mips_fetch_insns (rtx);
136152242Sruextern int mips_idiv_insns (void);
137154625Sbzextern int fp_register_operand (rtx, enum machine_mode);
138152242Sruextern int lo_operand (rtx, enum machine_mode);
139152242Sruextern bool mips_legitimate_address_p (enum machine_mode, rtx, int);
140152242Sruextern rtx mips_split_symbol (rtx, rtx);
141152242Sruextern rtx mips_unspec_address (rtx, enum mips_symbol_type);
142103026Ssobomaxextern bool mips_legitimize_address (rtx *, enum machine_mode);
143103026Ssobomaxextern void mips_move_integer (rtx, rtx, unsigned HOST_WIDE_INT);
144103026Ssobomaxextern bool mips_legitimize_move (enum machine_mode, rtx, rtx);
145103026Ssobomax
146123338Sbmsextern int m16_uimm3_b (rtx, enum machine_mode);
147103026Ssobomaxextern int m16_simm4_1 (rtx, enum machine_mode);
148103026Ssobomaxextern int m16_nsimm4_1 (rtx, enum machine_mode);
149103026Ssobomaxextern int m16_simm5_1 (rtx, enum machine_mode);
150103026Ssobomaxextern int m16_nsimm5_1 (rtx, enum machine_mode);
151103026Ssobomaxextern int m16_uimm5_4 (rtx, enum machine_mode);
152103026Ssobomaxextern int m16_nuimm5_4 (rtx, enum machine_mode);
153103026Ssobomaxextern int m16_simm8_1 (rtx, enum machine_mode);
154103026Ssobomaxextern int m16_nsimm8_1 (rtx, enum machine_mode);
155103026Ssobomaxextern int m16_uimm8_1 (rtx, enum machine_mode);
156103026Ssobomaxextern int m16_nuimm8_1 (rtx, enum machine_mode);
157103026Ssobomaxextern int m16_uimm8_m1_1 (rtx, enum machine_mode);
158103026Ssobomaxextern int m16_uimm8_4 (rtx, enum machine_mode);
159103026Ssobomaxextern int m16_nuimm8_4 (rtx, enum machine_mode);
160103026Ssobomaxextern int m16_simm8_8 (rtx, enum machine_mode);
161103026Ssobomaxextern int m16_nsimm8_8 (rtx, enum machine_mode);
162103026Ssobomax
163103026Ssobomaxextern rtx mips_subword (rtx, int);
164103032Ssobomaxextern bool mips_split_64bit_move_p (rtx, rtx);
165103026Ssobomaxextern void mips_split_64bit_move (rtx, rtx);
166103026Ssobomaxextern const char *mips_output_move (rtx, rtx);
167103026Ssobomaxextern void mips_restore_gp (void);
168127307Srwatson#ifdef RTX_CODE
169103026Ssobomaxextern bool mips_emit_scc (enum rtx_code, rtx);
170103026Ssobomaxextern void gen_conditional_branch (rtx *, enum rtx_code);
171103026Ssobomaxextern void mips_expand_vcondv2sf (rtx, rtx, rtx, enum rtx_code, rtx, rtx);
172103026Ssobomax#endif
173103032Ssobomaxextern void gen_conditional_move (rtx *);
174103026Ssobomaxextern void mips_gen_conditional_trap (rtx *);
175103026Ssobomaxextern void mips_expand_call (rtx, rtx, rtx, rtx, int);
176103026Ssobomaxextern void mips_emit_fcc_reload (rtx, rtx, rtx);
177103026Ssobomaxextern void mips_set_return_address (rtx, rtx);
178103026Ssobomaxextern bool mips_expand_block_move (rtx, rtx, rtx);
179103026Ssobomax
180131673Sbmsextern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx);
181103026Ssobomaxextern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
182147643Sbz				  tree, int);
183147643Sbzextern struct rtx_def *function_arg (const CUMULATIVE_ARGS *,
184147643Sbz				     enum machine_mode, tree, int);
185147643Sbzextern int function_arg_boundary (enum machine_mode, tree);
186147643Sbzextern bool mips_pad_arg_upward (enum machine_mode, tree);
187147643Sbzextern bool mips_pad_reg_upward (enum machine_mode, tree);
188147643Sbzextern void mips_va_start (tree, rtx);
189147256Sbrooks
190147643Sbzextern bool mips_expand_unaligned_load (rtx, rtx, unsigned int, int);
191147256Sbrooksextern bool mips_expand_unaligned_store (rtx, rtx, unsigned int, int);
192147256Sbrooksextern bool mips_mem_fits_mode_p (enum machine_mode mode, rtx x);
193147256Sbrooksextern void override_options (void);
194147256Sbrooksextern void mips_conditional_register_usage (void);
195147256Sbrooksextern void mips_order_regs_for_local_alloc (void);
196147256Sbrooksextern HOST_WIDE_INT mips_debugger_offset (rtx, HOST_WIDE_INT);
197147256Sbrooks
198103026Ssobomaxextern void print_operand (FILE *, rtx, int);
199103026Ssobomaxextern void print_operand_address (FILE *, rtx);
200147256Sbrooksextern int mips_output_external (FILE *, tree, const char *);
201103026Ssobomaxextern void mips_output_filename (FILE *, const char *);
202103026Ssobomaxextern void mips_output_ascii (FILE *, const char *, size_t, const char *);
203125024Ssobomaxextern void mips_output_aligned_bss (FILE *, tree, const char *,
204147256Sbrooks				     unsigned HOST_WIDE_INT, int);
205147256Sbrooksextern void mips_output_aligned_decl_common (FILE *, tree, const char *,
206127307Srwatson					     unsigned HOST_WIDE_INT,
207103026Ssobomax					     unsigned int);
208127307Srwatsonextern void mips_declare_common_object (FILE *, const char *,
209103026Ssobomax					const char *, unsigned HOST_WIDE_INT,
210103026Ssobomax					unsigned int, bool);
211103026Ssobomaxextern void mips_declare_object (FILE *, const char *, const char *,
212103032Ssobomax				 const char *, ...) ATTRIBUTE_PRINTF_4;
213127307Srwatsonextern void mips_declare_object_name (FILE *, const char *, tree);
214127307Srwatsonextern void mips_finish_declare_object (FILE *, tree, int, int);
215127307Srwatson
216127307Srwatsonextern bool mips_small_data_pattern_p (rtx);
217127307Srwatsonextern rtx mips_rewrite_small_data (rtx);
218127307Srwatsonextern HOST_WIDE_INT compute_frame_size (HOST_WIDE_INT);
219127307Srwatsonextern HOST_WIDE_INT mips_initial_elimination_offset (int, int);
220127307Srwatsonextern rtx mips_return_addr (int, rtx);
221151266Sthompsaextern enum mips_loadgp_style mips_current_loadgp_style (void);
222151266Sthompsaextern void mips_expand_prologue (void);
223151266Sthompsaextern void mips_expand_epilogue (int);
224151266Sthompsaextern int mips_can_use_return_insn (void);
225151266Sthompsaextern struct rtx_def *mips_function_value (tree, tree, enum machine_mode);
226151266Sthompsa
227151266Sthompsaextern bool mips_cannot_change_mode_class (enum machine_mode,
228151266Sthompsa					   enum machine_mode, enum reg_class);
229151266Sthompsaextern bool mips_dangerous_for_la25_p (rtx);
230127307Srwatsonextern enum reg_class mips_preferred_reload_class (rtx, enum reg_class);
231127307Srwatsonextern enum reg_class mips_secondary_reload_class (enum reg_class,
232103026Ssobomax						   enum machine_mode,
233103026Ssobomax						   rtx, int);
234103026Ssobomaxextern int mips_class_max_nregs (enum reg_class, enum machine_mode);
235103026Ssobomaxextern int build_mips16_call_stub (rtx, rtx, rtx, int);
236103032Ssobomaxextern int mips_register_move_cost (enum machine_mode, enum reg_class,
237103026Ssobomax				    enum reg_class);
238103026Ssobomax
239103026Ssobomaxextern int mips_adjust_insn_length (rtx, int);
240103026Ssobomaxextern const char *mips_output_load_label (void);
241103026Ssobomaxextern const char *mips_output_conditional_branch (rtx, rtx *, const char *,
242103026Ssobomax						   const char *);
243103026Ssobomaxextern const char *mips_output_order_conditional_branch (rtx, rtx *, bool);
244148613Sbzextern const char *mips_output_division (const char *, rtx *);
245148613Sbzextern unsigned int mips_hard_regno_nregs (int, enum machine_mode);
246123992Ssobomaxextern bool mips_linked_madd_p (rtx, rtx);
247103026Ssobomaxextern int mips_store_data_bypass_p (rtx, rtx);
248147611Sdwmaloneextern rtx mips_prefetch_cookie (rtx, rtx);
249103026Ssobomax
250103026Ssobomaxextern void irix_asm_output_align (FILE *, unsigned);
251103026Ssobomaxextern const char *current_section_name (void);
252103026Ssobomaxextern unsigned int current_section_flags (void);
253103026Ssobomaxextern bool mips_use_ins_ext_p (rtx, rtx, rtx);
254103026Ssobomax
255103026Ssobomax#endif /* ! GCC_MIPS_PROTOS_H */
256147256Sbrooks