1/* Definitions of target machine for GCC for IA-32.
2 Copyright (C) 1988-2017 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 3, or (at your option)
9any later version.
10
11GCC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20/* In i386-common.c. */
21extern bool ix86_handle_option (struct gcc_options *opts,
22 struct gcc_options *opts_set ATTRIBUTE_UNUSED,
23 const struct cl_decoded_option *decoded,
24 location_t loc);
25
26/* Functions in i386.c */
27extern bool ix86_target_stack_probe (void);
28extern bool ix86_can_use_return_insn_p (void);
29extern void ix86_setup_frame_addresses (void);
30extern bool ix86_rip_relative_addr_p (struct ix86_address *parts);
31
32extern HOST_WIDE_INT ix86_initial_elimination_offset (int, int);
33extern void ix86_expand_prologue (void);
34extern void ix86_maybe_emit_epilogue_vzeroupper (void);
35extern void ix86_expand_epilogue (int);
36extern void ix86_expand_split_stack_prologue (void);
37
38extern void ix86_output_addr_vec_elt (FILE *, int);
39extern void ix86_output_addr_diff_elt (FILE *, int, int);
40
41extern enum calling_abi ix86_cfun_abi (void);
42extern enum calling_abi ix86_function_type_abi (const_tree);
43
44extern bool ix86_use_pseudo_pic_reg (void);
45
46extern void ix86_reset_previous_fndecl (void);
47
48extern bool ix86_using_red_zone (void);
49
50#ifdef RTX_CODE
51extern int standard_80387_constant_p (rtx);
52extern const char *standard_80387_constant_opcode (rtx);
53extern rtx standard_80387_constant_rtx (int);
54extern int standard_sse_constant_p (rtx, machine_mode);
55extern const char *standard_sse_constant_opcode (rtx_insn *, rtx *);
56extern bool ix86_standard_x87sse_constant_load_p (const rtx_insn *, rtx);
57extern bool symbolic_reference_mentioned_p (rtx);
58extern bool extended_reg_mentioned_p (rtx);
59extern bool x86_extended_QIreg_mentioned_p (rtx_insn *);
60extern bool x86_extended_reg_mentioned_p (rtx);
61extern bool x86_maybe_negate_const_int (rtx *, machine_mode);
62extern machine_mode ix86_cc_mode (enum rtx_code, rtx, rtx);
63
64extern int avx_vpermilp_parallel (rtx par, machine_mode mode);
65extern int avx_vperm2f128_parallel (rtx par, machine_mode mode);
66
67extern bool ix86_expand_strlen (rtx, rtx, rtx, rtx);
68extern bool ix86_expand_set_or_movmem (rtx, rtx, rtx, rtx, rtx, rtx,
69 rtx, rtx, rtx, rtx, bool);
70
71extern bool constant_address_p (rtx);
72extern bool legitimate_pic_operand_p (rtx);
73extern bool legitimate_pic_address_disp_p (rtx);
74extern bool ix86_force_load_from_GOT_p (rtx);
75extern void print_reg (rtx, int, FILE*);
76extern void ix86_print_operand (FILE *, rtx, int);
77
78extern void split_double_mode (machine_mode, rtx[], int, rtx[], rtx[]);
79
80extern const char *output_set_got (rtx, rtx);
81extern const char *output_387_binary_op (rtx_insn *, rtx*);
82extern const char *output_387_reg_move (rtx_insn *, rtx*);
83extern const char *output_fix_trunc (rtx_insn *, rtx*, bool);
84extern const char *output_fp_compare (rtx_insn *, rtx*, bool, bool);
85extern const char *output_adjust_stack_and_probe (rtx);
86extern const char *output_probe_stack_range (rtx, rtx);
87
88extern void ix86_expand_clear (rtx);
89extern void ix86_expand_move (machine_mode, rtx[]);
90extern void ix86_expand_vector_move (machine_mode, rtx[]);
91extern void ix86_expand_vector_move_misalign (machine_mode, rtx[]);
92extern rtx ix86_fixup_binary_operands (enum rtx_code,
93 machine_mode, rtx[]);
94extern void ix86_fixup_binary_operands_no_copy (enum rtx_code,
95 machine_mode, rtx[]);
96extern void ix86_expand_binary_operator (enum rtx_code,
97 machine_mode, rtx[]);
98extern void ix86_expand_vector_logical_operator (enum rtx_code,
99 machine_mode, rtx[]);
100extern bool ix86_binary_operator_ok (enum rtx_code, machine_mode, rtx[]);
101extern bool ix86_avoid_lea_for_add (rtx_insn *, rtx[]);
102extern bool ix86_use_lea_for_mov (rtx_insn *, rtx[]);
103extern bool ix86_avoid_lea_for_addr (rtx_insn *, rtx[]);
104extern void ix86_split_lea_for_addr (rtx_insn *, rtx[], machine_mode);
105extern bool ix86_lea_for_add_ok (rtx_insn *, rtx[]);
106extern bool ix86_vec_interleave_v2df_operator_ok (rtx operands[3], bool high);
107extern bool ix86_dep_by_shift_count (const_rtx set_insn, const_rtx use_insn);
108extern bool ix86_agi_dependent (rtx_insn *set_insn, rtx_insn *use_insn);
109extern void ix86_expand_unary_operator (enum rtx_code, machine_mode,
110 rtx[]);
111extern rtx ix86_build_const_vector (machine_mode, bool, rtx);
112extern rtx ix86_build_signbit_mask (machine_mode, bool, bool);
113extern void ix86_split_convert_uns_si_sse (rtx[]);
114extern void ix86_expand_convert_uns_didf_sse (rtx, rtx);
115extern void ix86_expand_convert_uns_sixf_sse (rtx, rtx);
116extern void ix86_expand_convert_uns_sidf_sse (rtx, rtx);
117extern void ix86_expand_convert_uns_sisf_sse (rtx, rtx);
118extern void ix86_expand_convert_sign_didf_sse (rtx, rtx);
119extern void ix86_expand_vector_convert_uns_vsivsf (rtx, rtx);
120extern rtx ix86_expand_adjust_ufix_to_sfix_si (rtx, rtx *);
121extern enum ix86_fpcmp_strategy ix86_fp_comparison_strategy (enum rtx_code);
122extern void ix86_expand_fp_absneg_operator (enum rtx_code, machine_mode,
123 rtx[]);
124extern void ix86_expand_copysign (rtx []);
125extern void ix86_split_copysign_const (rtx []);
126extern void ix86_split_copysign_var (rtx []);
127extern bool ix86_unary_operator_ok (enum rtx_code, machine_mode, rtx[]);
128extern bool ix86_match_ccmode (rtx, machine_mode);
129extern void ix86_expand_branch (enum rtx_code, rtx, rtx, rtx);
130extern void ix86_expand_setcc (rtx, enum rtx_code, rtx, rtx);
131extern bool ix86_expand_int_movcc (rtx[]);
132extern bool ix86_expand_fp_movcc (rtx[]);
133extern bool ix86_expand_fp_vcond (rtx[]);
134extern bool ix86_expand_int_vcond (rtx[]);
135extern void ix86_expand_vec_perm (rtx[]);
136extern bool ix86_expand_vec_perm_const (rtx[]);
137extern bool ix86_expand_mask_vec_cmp (rtx[]);
138extern bool ix86_expand_int_vec_cmp (rtx[]);
139extern bool ix86_expand_fp_vec_cmp (rtx[]);
140extern void ix86_expand_sse_movcc (rtx, rtx, rtx, rtx);
141extern void ix86_expand_sse_unpack (rtx, rtx, bool, bool);
142extern bool ix86_expand_int_addcc (rtx[]);
143extern rtx ix86_expand_call (rtx, rtx, rtx, rtx, rtx, bool);
144extern void ix86_split_call_vzeroupper (rtx, rtx);
145extern void x86_initialize_trampoline (rtx, rtx, rtx);
146extern rtx ix86_zero_extend_to_Pmode (rtx);
147extern void ix86_split_long_move (rtx[]);
148extern void ix86_split_ashl (rtx *, rtx, machine_mode);
149extern void ix86_split_ashr (rtx *, rtx, machine_mode);
150extern void ix86_split_lshr (rtx *, rtx, machine_mode);
151extern rtx ix86_find_base_term (rtx);
152extern bool ix86_check_movabs (rtx, int);
153extern bool ix86_check_no_addr_space (rtx);
154extern void ix86_split_idivmod (machine_mode, rtx[], bool);
155
156extern rtx assign_386_stack_local (machine_mode, enum ix86_stack_slot);
157extern int ix86_attr_length_immediate_default (rtx_insn *, bool);
158extern int ix86_attr_length_address_default (rtx_insn *);
159extern int ix86_attr_length_vex_default (rtx_insn *, bool, bool);
160
161extern rtx ix86_libcall_value (machine_mode);
162extern bool ix86_function_arg_regno_p (int);
163extern void ix86_asm_output_function_label (FILE *, const char *, tree);
164extern void ix86_call_abi_override (const_tree);
165extern int ix86_reg_parm_stack_space (const_tree);
166
167extern bool ix86_libc_has_function (enum function_class fn_class);
168
169extern void x86_order_regs_for_local_alloc (void);
170extern void x86_function_profiler (FILE *, int);
171extern void x86_emit_floatuns (rtx [2]);
172extern void ix86_emit_fp_unordered_jump (rtx);
173
174extern void ix86_emit_i387_log1p (rtx, rtx);
175extern void ix86_emit_i387_round (rtx, rtx);
176extern void ix86_emit_swdivsf (rtx, rtx, rtx, machine_mode);
177extern void ix86_emit_swsqrtsf (rtx, rtx, machine_mode, bool);
178
179extern enum rtx_code ix86_reverse_condition (enum rtx_code, machine_mode);
180
181extern void ix86_expand_lround (rtx, rtx);
182extern void ix86_expand_lfloorceil (rtx, rtx, bool);
183extern void ix86_expand_rint (rtx, rtx);
184extern void ix86_expand_floorceil (rtx, rtx, bool);
185extern void ix86_expand_floorceildf_32 (rtx, rtx, bool);
186extern void ix86_expand_round_sse4 (rtx, rtx);
187extern void ix86_expand_round (rtx, rtx);
188extern void ix86_expand_rounddf_32 (rtx, rtx);
189extern void ix86_expand_trunc (rtx, rtx);
190extern void ix86_expand_truncdf_32 (rtx, rtx);
191
192extern void ix86_expand_vecop_qihi (enum rtx_code, rtx, rtx, rtx);
193
194extern rtx ix86_split_stack_guard (void);
195
196#ifdef TREE_CODE
197extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int);
198#endif /* TREE_CODE */
199
200#endif /* RTX_CODE */
201
202#ifdef TREE_CODE
203extern int ix86_data_alignment (tree, int, bool);
204extern unsigned int ix86_local_alignment (tree, machine_mode,
205 unsigned int);
206extern unsigned int ix86_minimum_alignment (tree, machine_mode,
207 unsigned int);
208extern tree ix86_handle_shared_attribute (tree *, tree, tree, int, bool *);
209extern tree ix86_handle_selectany_attribute (tree *, tree, tree, int, bool *);
210extern int x86_field_alignment (tree, int);
211extern tree ix86_valid_target_attribute_tree (tree,
212 struct gcc_options *,
213 struct gcc_options *);
214extern unsigned int ix86_get_callcvt (const_tree);
215
216#endif
217
218extern rtx ix86_tls_module_base (void);
219extern bool ix86_tls_address_pattern_p (rtx);
220extern rtx ix86_rewrite_tls_address (rtx);
221
222extern void ix86_expand_vector_init (bool, rtx, rtx);
223extern void ix86_expand_vector_set (bool, rtx, rtx, int);
224extern void ix86_expand_vector_extract (bool, rtx, rtx, int);
225extern void ix86_expand_reduc (rtx (*)(rtx, rtx, rtx), rtx, rtx);
226
227extern void ix86_expand_vec_extract_even_odd (rtx, rtx, rtx, unsigned);
228extern bool ix86_expand_pextr (rtx *);
229extern bool ix86_expand_pinsr (rtx *);
230extern void ix86_expand_mul_widen_evenodd (rtx, rtx, rtx, bool, bool);
231extern void ix86_expand_mul_widen_hilo (rtx, rtx, rtx, bool, bool);
232extern void ix86_expand_sse2_mulv4si3 (rtx, rtx, rtx);
233extern void ix86_expand_sse2_mulvxdi3 (rtx, rtx, rtx);
234extern void ix86_expand_sse2_abs (rtx, rtx);
235
236extern bool ix86_bnd_prefixed_insn_p (rtx);
237
238/* In i386-c.c */
239extern void ix86_target_macros (void);
240extern void ix86_register_pragmas (void);
241
242/* In winnt.c */
243extern void i386_pe_unique_section (tree, int);
244extern void i386_pe_declare_function_type (FILE *, const char *, int);
245extern void i386_pe_record_external_function (tree, const char *);
246extern void i386_pe_maybe_record_exported_symbol (tree, const char *, int);
247extern void i386_pe_encode_section_info (tree, rtx, int);
248extern bool i386_pe_binds_local_p (const_tree);
249extern const char *i386_pe_strip_name_encoding_full (const char *);
250extern bool i386_pe_valid_dllimport_attribute_p (const_tree);
251extern unsigned int i386_pe_section_type_flags (tree, const char *, int);
252extern void i386_pe_asm_named_section (const char *, unsigned int, tree);
253extern void i386_pe_asm_output_aligned_decl_common (FILE *, tree,
254 const char *,
255 HOST_WIDE_INT,
256 HOST_WIDE_INT);
257extern void i386_pe_file_end (void);
258extern void i386_pe_start_function (FILE *, const char *, tree);
259extern void i386_pe_end_function (FILE *, const char *, tree);
260extern void i386_pe_assemble_visibility (tree, int);
261extern tree i386_pe_mangle_decl_assembler_name (tree, tree);
262extern tree i386_pe_mangle_assembler_name (const char *);
263extern void i386_pe_record_stub (const char *);
264
265extern void i386_pe_seh_init (FILE *);
266extern void i386_pe_seh_end_prologue (FILE *);
267extern void i386_pe_seh_unwind_emit (FILE *, rtx_insn *);
268extern void i386_pe_seh_emit_except_personality (rtx);
269extern void i386_pe_seh_init_sections (void);
270
271/* In winnt-cxx.c and winnt-stubs.c */
272extern void i386_pe_adjust_class_at_definition (tree);
273extern bool i386_pe_type_dllimport_p (tree);
274extern bool i386_pe_type_dllexport_p (tree);
275
276extern int i386_pe_reloc_rw_mask (void);
277
278extern char internal_label_prefix[16];
279extern int internal_label_prefix_len;
280
281extern bool ix86_epilogue_uses (int);
282
283struct ix86_address
284{
285 rtx base, index, disp;
286 HOST_WIDE_INT scale;
287 addr_space_t seg;
288};
289
290extern int ix86_decompose_address (rtx, struct ix86_address *);
291extern int memory_address_length (rtx, bool);
292extern void x86_output_aligned_bss (FILE *, tree, const char *,
293 unsigned HOST_WIDE_INT, int);
294extern void x86_elf_aligned_decl_common (FILE *, tree, const char *,
295 unsigned HOST_WIDE_INT, int);
296
297#ifdef RTX_CODE
298extern void ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *,
299 enum rtx_code *, enum rtx_code *);
300extern enum rtx_code ix86_fp_compare_code_to_integer (enum rtx_code);
301#endif
302extern int asm_preferred_eh_data_format (int, int);
303
304#ifdef HAVE_ATTR_cpu
305extern enum attr_cpu ix86_schedule;
306#endif
307
308extern const char * ix86_output_call_insn (rtx_insn *insn, rtx call_op);
309extern bool ix86_operands_ok_for_move_multiple (rtx *operands, bool load,
310 machine_mode mode);
311extern int ix86_min_insn_size (rtx_insn *);
312
313extern int ix86_issue_rate (void);
314extern int ix86_adjust_cost (rtx_insn *insn, int dep_type, rtx_insn *dep_insn,
315 int cost, unsigned int);
316extern int ia32_multipass_dfa_lookahead (void);
317extern bool ix86_macro_fusion_p (void);
318extern bool ix86_macro_fusion_pair_p (rtx_insn *condgen, rtx_insn *condjmp);
319
320extern bool ix86_bd_has_dispatch (rtx_insn *insn, int action);
321extern void ix86_bd_do_dispatch (rtx_insn *insn, int mode);
322
323extern void ix86_core2i7_init_hooks (void);
324
325extern int ix86_atom_sched_reorder (FILE *, int, rtx_insn **, int *, int);
326
327#ifdef RTX_CODE
328/* Target data for multipass lookahead scheduling.
329 Currently used for Core 2/i7 tuning. */
330struct ix86_first_cycle_multipass_data_
331{
332 /* The length (in bytes) of ifetch block in this solution. */
333 int ifetch_block_len;
334 /* Number of instructions in ifetch block in this solution. */
335 int ifetch_block_n_insns;
336 /* Bitmap to remember changes to ready_try for backtracking. */
337 sbitmap ready_try_change;
338 /* Size of the bitmap. */
339 int ready_try_change_size;
340};
341# define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DATA_T \
342 struct ix86_first_cycle_multipass_data_
343#endif /* RTX_CODE */
344
345const addr_space_t ADDR_SPACE_SEG_FS = 1;
346const addr_space_t ADDR_SPACE_SEG_GS = 2;
347
348namespace gcc { class context; }
349class rtl_opt_pass;
350
351extern rtl_opt_pass *make_pass_insert_vzeroupper (gcc::context *);
352extern rtl_opt_pass *make_pass_stv (gcc::context *);
353extern rtl_opt_pass *make_pass_insert_endbranch (gcc::context *);
354