1 /* Definitions of target machine for GCC for IA-32.
2 Copyright (C) 1988-2022 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 /* In i386-common.cc. */
21 extern bool ix86_handle_option (struct gcc_options
*opts
,
22 struct gcc_options
*opts_set ATTRIBUTE_UNUSED
,
23 const struct cl_decoded_option
*decoded
,
26 /* Functions in i386.cc */
27 extern bool ix86_target_stack_probe (void);
28 extern bool ix86_can_use_return_insn_p (void);
29 extern bool ix86_function_ms_hook_prologue (const_tree fn
);
30 extern void ix86_setup_frame_addresses (void);
31 extern bool ix86_rip_relative_addr_p (struct ix86_address
*parts
);
33 extern HOST_WIDE_INT
ix86_initial_elimination_offset (int, int);
34 extern void ix86_expand_prologue (void);
35 extern void ix86_maybe_emit_epilogue_vzeroupper (void);
36 extern void ix86_expand_epilogue (int);
37 extern void ix86_expand_split_stack_prologue (void);
39 extern void ix86_output_addr_vec_elt (FILE *, int);
40 extern void ix86_output_addr_diff_elt (FILE *, int, int);
42 extern const char *ix86_output_ssemov (rtx_insn
*, rtx
*);
44 extern enum calling_abi
ix86_cfun_abi (void);
45 extern enum calling_abi
ix86_function_type_abi (const_tree
);
47 extern bool ix86_use_pseudo_pic_reg (void);
49 extern void ix86_reset_previous_fndecl (void);
51 extern bool ix86_using_red_zone (void);
53 extern rtx
ix86_gen_scratch_sse_rtx (machine_mode
);
55 extern unsigned int ix86_regmode_natural_size (machine_mode
);
56 extern bool ix86_check_builtin_isa_match (unsigned int fcode
);
58 extern int standard_80387_constant_p (rtx
);
59 extern const char *standard_80387_constant_opcode (rtx
);
60 extern rtx
standard_80387_constant_rtx (int);
61 extern int standard_sse_constant_p (rtx
, machine_mode
);
62 extern const char *standard_sse_constant_opcode (rtx_insn
*, rtx
*);
63 extern bool ix86_standard_x87sse_constant_load_p (const rtx_insn
*, rtx
);
64 extern bool ix86_pre_reload_split (void);
65 extern bool symbolic_reference_mentioned_p (rtx
);
66 extern bool extended_reg_mentioned_p (rtx
);
67 extern bool x86_extended_QIreg_mentioned_p (rtx_insn
*);
68 extern bool x86_extended_reg_mentioned_p (rtx
);
69 extern bool x86_maybe_negate_const_int (rtx
*, machine_mode
);
70 extern machine_mode
ix86_cc_mode (enum rtx_code
, rtx
, rtx
);
72 extern int avx_vpermilp_parallel (rtx par
, machine_mode mode
);
73 extern int avx_vperm2f128_parallel (rtx par
, machine_mode mode
);
75 extern bool ix86_expand_strlen (rtx
, rtx
, rtx
, rtx
);
76 extern bool ix86_expand_set_or_cpymem (rtx
, rtx
, rtx
, rtx
, rtx
, rtx
,
77 rtx
, rtx
, rtx
, rtx
, bool);
78 extern bool ix86_expand_cmpstrn_or_cmpmem (rtx
, rtx
, rtx
, rtx
, rtx
, bool);
80 extern bool constant_address_p (rtx
);
81 extern bool legitimate_pic_operand_p (rtx
);
82 extern bool legitimate_pic_address_disp_p (rtx
);
83 extern bool ix86_force_load_from_GOT_p (rtx
, bool = false);
84 extern void print_reg (rtx
, int, FILE*);
85 extern void ix86_print_operand (FILE *, rtx
, int);
87 extern void split_double_mode (machine_mode
, rtx
[], int, rtx
[], rtx
[]);
89 extern const char *output_set_got (rtx
, rtx
);
90 extern const char *output_387_binary_op (rtx_insn
*, rtx
*);
91 extern const char *output_387_reg_move (rtx_insn
*, rtx
*);
92 extern const char *output_fix_trunc (rtx_insn
*, rtx
*, bool);
93 extern const char *output_fp_compare (rtx_insn
*, rtx
*, bool, bool);
94 extern const char *output_adjust_stack_and_probe (rtx
);
95 extern const char *output_probe_stack_range (rtx
, rtx
);
97 extern void ix86_output_patchable_area (unsigned int, bool);
99 extern void ix86_expand_clear (rtx
);
100 extern void ix86_expand_move (machine_mode
, rtx
[]);
101 extern void ix86_expand_vector_move (machine_mode
, rtx
[]);
102 extern void ix86_expand_vector_move_misalign (machine_mode
, rtx
[]);
103 extern rtx
ix86_fixup_binary_operands (enum rtx_code
,
104 machine_mode
, rtx
[]);
105 extern void ix86_fixup_binary_operands_no_copy (enum rtx_code
,
106 machine_mode
, rtx
[]);
107 extern void ix86_expand_binary_operator (enum rtx_code
,
108 machine_mode
, rtx
[]);
109 extern void ix86_expand_vector_logical_operator (enum rtx_code
,
110 machine_mode
, rtx
[]);
111 extern bool ix86_binary_operator_ok (enum rtx_code
, machine_mode
, rtx
[]);
112 extern bool ix86_avoid_lea_for_add (rtx_insn
*, rtx
[]);
113 extern bool ix86_use_lea_for_mov (rtx_insn
*, rtx
[]);
114 extern bool ix86_avoid_lea_for_addr (rtx_insn
*, rtx
[]);
115 extern void ix86_split_lea_for_addr (rtx_insn
*, rtx
[], machine_mode
);
116 extern bool ix86_lea_for_add_ok (rtx_insn
*, rtx
[]);
117 extern int ix86_last_zero_store_uid
;
118 extern bool ix86_vec_interleave_v2df_operator_ok (rtx operands
[3], bool high
);
119 extern bool ix86_dep_by_shift_count (const_rtx set_insn
, const_rtx use_insn
);
120 extern bool ix86_agi_dependent (rtx_insn
*set_insn
, rtx_insn
*use_insn
);
121 extern void ix86_expand_unary_operator (enum rtx_code
, machine_mode
,
123 extern rtx
ix86_build_const_vector (machine_mode
, bool, rtx
);
124 extern rtx
ix86_build_signbit_mask (machine_mode
, bool, bool);
125 extern void ix86_split_convert_uns_si_sse (rtx
[]);
126 extern void ix86_expand_convert_uns_didf_sse (rtx
, rtx
);
127 extern void ix86_expand_convert_uns_sixf_sse (rtx
, rtx
);
128 extern void ix86_expand_convert_uns_sidf_sse (rtx
, rtx
);
129 extern void ix86_expand_convert_uns_sisf_sse (rtx
, rtx
);
130 extern void ix86_expand_convert_sign_didf_sse (rtx
, rtx
);
131 extern void ix86_expand_vector_convert_uns_vsivsf (rtx
, rtx
);
132 extern rtx
ix86_expand_adjust_ufix_to_sfix_si (rtx
, rtx
*);
133 extern enum ix86_fpcmp_strategy
ix86_fp_comparison_strategy (enum rtx_code
);
134 extern void ix86_expand_fp_absneg_operator (enum rtx_code
, machine_mode
,
136 extern void ix86_split_fp_absneg_operator (enum rtx_code
, machine_mode
,
138 extern void ix86_expand_copysign (rtx
[]);
139 extern void ix86_expand_xorsign (rtx
[]);
140 extern bool ix86_unary_operator_ok (enum rtx_code
, machine_mode
, rtx
[]);
141 extern bool ix86_match_ccmode (rtx
, machine_mode
);
142 extern void ix86_expand_branch (enum rtx_code
, rtx
, rtx
, rtx
);
143 extern void ix86_expand_setcc (rtx
, enum rtx_code
, rtx
, rtx
);
144 extern bool ix86_expand_int_movcc (rtx
[]);
145 extern bool ix86_expand_fp_movcc (rtx
[]);
146 extern bool ix86_expand_fp_vcond (rtx
[]);
147 extern bool ix86_expand_int_vcond (rtx
[]);
148 extern void ix86_expand_vec_perm (rtx
[]);
149 extern bool ix86_expand_mask_vec_cmp (rtx
, enum rtx_code
, rtx
, rtx
);
150 extern bool ix86_expand_int_vec_cmp (rtx
[]);
151 extern bool ix86_expand_fp_vec_cmp (rtx
[]);
152 extern void ix86_expand_sse_movcc (rtx
, rtx
, rtx
, rtx
);
153 extern void ix86_expand_sse_unpack (rtx
, rtx
, bool, bool);
154 extern void ix86_expand_fp_spaceship (rtx
, rtx
, rtx
);
155 extern bool ix86_expand_int_addcc (rtx
[]);
156 extern rtx_insn
*ix86_expand_call (rtx
, rtx
, rtx
, rtx
, rtx
, bool);
157 extern bool ix86_call_use_plt_p (rtx
);
158 extern void ix86_split_call_vzeroupper (rtx
, rtx
);
159 extern void x86_initialize_trampoline (rtx
, rtx
, rtx
);
160 extern rtx
ix86_zero_extend_to_Pmode (rtx
);
161 extern void ix86_split_long_move (rtx
[]);
162 extern void ix86_split_ashl (rtx
*, rtx
, machine_mode
);
163 extern void ix86_split_ashr (rtx
*, rtx
, machine_mode
);
164 extern void ix86_split_lshr (rtx
*, rtx
, machine_mode
);
165 extern void ix86_expand_v1ti_shift (enum rtx_code
, rtx
[]);
166 extern void ix86_expand_v1ti_rotate (enum rtx_code
, rtx
[]);
167 extern void ix86_expand_v1ti_ashiftrt (rtx
[]);
168 extern rtx
ix86_find_base_term (rtx
);
169 extern bool ix86_check_movabs (rtx
, int);
170 extern bool ix86_check_no_addr_space (rtx
);
171 extern void ix86_split_idivmod (machine_mode
, rtx
[], bool);
172 extern bool ix86_hardreg_mov_ok (rtx
, rtx
);
174 extern rtx
assign_386_stack_local (machine_mode
, enum ix86_stack_slot
);
175 extern int ix86_attr_length_immediate_default (rtx_insn
*, bool);
176 extern int ix86_attr_length_address_default (rtx_insn
*);
177 extern int ix86_attr_length_vex_default (rtx_insn
*, bool, bool);
179 extern rtx
ix86_libcall_value (machine_mode
);
180 extern bool ix86_function_arg_regno_p (int);
181 extern void ix86_asm_output_function_label (FILE *, const char *, tree
);
182 extern void ix86_call_abi_override (const_tree
);
183 extern int ix86_reg_parm_stack_space (const_tree
);
185 extern bool ix86_libc_has_function (enum function_class fn_class
);
187 extern void x86_order_regs_for_local_alloc (void);
188 extern void x86_function_profiler (FILE *, int);
189 extern void x86_emit_floatuns (rtx
[2]);
190 extern void ix86_emit_fp_unordered_jump (rtx
);
192 extern void ix86_emit_i387_sinh (rtx
, rtx
);
193 extern void ix86_emit_i387_cosh (rtx
, rtx
);
194 extern void ix86_emit_i387_tanh (rtx
, rtx
);
195 extern void ix86_emit_i387_asinh (rtx
, rtx
);
196 extern void ix86_emit_i387_acosh (rtx
, rtx
);
197 extern void ix86_emit_i387_atanh (rtx
, rtx
);
198 extern void ix86_emit_i387_log1p (rtx
, rtx
);
199 extern void ix86_emit_i387_round (rtx
, rtx
);
200 extern void ix86_emit_swdivsf (rtx
, rtx
, rtx
, machine_mode
);
201 extern void ix86_emit_swsqrtsf (rtx
, rtx
, machine_mode
, bool);
203 extern enum rtx_code
ix86_reverse_condition (enum rtx_code
, machine_mode
);
205 extern void ix86_expand_lround (rtx
, rtx
);
206 extern void ix86_expand_lfloorceil (rtx
, rtx
, bool);
207 extern void ix86_expand_rint (rtx
, rtx
);
208 extern void ix86_expand_floorceil (rtx
, rtx
, bool);
209 extern void ix86_expand_floorceildf_32 (rtx
, rtx
, bool);
210 extern void ix86_expand_trunc (rtx
, rtx
);
211 extern void ix86_expand_truncdf_32 (rtx
, rtx
);
212 extern void ix86_expand_round (rtx
, rtx
);
213 extern void ix86_expand_rounddf_32 (rtx
, rtx
);
214 extern void ix86_expand_round_sse4 (rtx
, rtx
);
216 extern void ix86_expand_vecop_qihi (enum rtx_code
, rtx
, rtx
, rtx
);
217 extern rtx
ix86_split_stack_guard (void);
219 extern void ix86_move_vector_high_sse_to_mmx (rtx
);
220 extern void ix86_split_mmx_pack (rtx
[], enum rtx_code
);
221 extern void ix86_split_mmx_punpck (rtx
[], bool);
222 extern void ix86_expand_avx_vzeroupper (void);
223 extern void ix86_expand_atomic_fetch_op_loop (rtx
, rtx
, rtx
, enum rtx_code
,
225 extern void ix86_expand_cmpxchg_loop (rtx
*, rtx
, rtx
, rtx
, rtx
, rtx
,
226 bool, rtx_code_label
*);
229 extern void init_cumulative_args (CUMULATIVE_ARGS
*, tree
, rtx
, tree
, int);
230 #endif /* TREE_CODE */
232 #endif /* RTX_CODE */
235 extern int ix86_data_alignment (tree
, unsigned int, bool);
236 extern unsigned int ix86_local_alignment (tree
, machine_mode
,
237 unsigned int, bool = false);
238 extern unsigned int ix86_minimum_alignment (tree
, machine_mode
,
240 extern tree
ix86_handle_shared_attribute (tree
*, tree
, tree
, int, bool *);
241 extern tree
ix86_handle_selectany_attribute (tree
*, tree
, tree
, int, bool *);
242 extern int x86_field_alignment (tree
, int);
243 extern tree
ix86_valid_target_attribute_tree (tree
, tree
,
244 struct gcc_options
*,
245 struct gcc_options
*, bool);
246 extern unsigned int ix86_get_callcvt (const_tree
);
250 extern rtx
ix86_tls_module_base (void);
251 extern bool ix86_gpr_tls_address_pattern_p (rtx
);
252 extern bool ix86_tls_address_pattern_p (rtx
);
253 extern rtx
ix86_rewrite_tls_address (rtx
);
255 extern void ix86_expand_vector_init (bool, rtx
, rtx
);
256 extern void ix86_expand_vector_set (bool, rtx
, rtx
, int);
257 extern void ix86_expand_vector_set_var (rtx
, rtx
, rtx
);
258 extern void ix86_expand_vector_extract (bool, rtx
, rtx
, int);
259 extern void ix86_expand_reduc (rtx (*)(rtx
, rtx
, rtx
), rtx
, rtx
);
261 extern void ix86_expand_vec_extract_even_odd (rtx
, rtx
, rtx
, unsigned);
262 extern bool ix86_expand_pextr (rtx
*);
263 extern bool ix86_expand_pinsr (rtx
*);
264 extern void ix86_expand_mul_widen_evenodd (rtx
, rtx
, rtx
, bool, bool);
265 extern void ix86_expand_mul_widen_hilo (rtx
, rtx
, rtx
, bool, bool);
266 extern void ix86_expand_sse2_mulv4si3 (rtx
, rtx
, rtx
);
267 extern void ix86_expand_sse2_mulvxdi3 (rtx
, rtx
, rtx
);
268 extern void ix86_expand_sse2_abs (rtx
, rtx
);
269 extern bool ix86_expand_vector_init_duplicate (bool, machine_mode
, rtx
,
271 extern bool ix86_extract_perm_from_pool_constant (int*, rtx
);
274 extern void ix86_target_macros (void);
275 extern void ix86_register_pragmas (void);
278 extern void ix86_d_target_versions (void);
279 extern void ix86_d_register_target_info (void);
280 extern bool ix86_d_has_stdcall_convention (unsigned int *, unsigned int *);
283 extern void i386_pe_unique_section (tree
, int);
284 extern void i386_pe_declare_function_type (FILE *, const char *, int);
285 extern void i386_pe_record_external_function (tree
, const char *);
286 extern void i386_pe_maybe_record_exported_symbol (tree
, const char *, int);
287 extern void i386_pe_encode_section_info (tree
, rtx
, int);
288 extern bool i386_pe_binds_local_p (const_tree
);
289 extern const char *i386_pe_strip_name_encoding_full (const char *);
290 extern bool i386_pe_valid_dllimport_attribute_p (const_tree
);
291 extern unsigned int i386_pe_section_type_flags (tree
, const char *, int);
292 extern void i386_pe_asm_named_section (const char *, unsigned int, tree
);
293 extern void i386_pe_asm_output_aligned_decl_common (FILE *, tree
,
297 extern void i386_pe_file_end (void);
298 extern void i386_pe_asm_lto_start (void);
299 extern void i386_pe_asm_lto_end (void);
300 extern void i386_pe_start_function (FILE *, const char *, tree
);
301 extern void i386_pe_end_function (FILE *, const char *, tree
);
302 extern void i386_pe_end_cold_function (FILE *, const char *, tree
);
303 extern void i386_pe_assemble_visibility (tree
, int);
304 extern tree
i386_pe_mangle_decl_assembler_name (tree
, tree
);
305 extern tree
i386_pe_mangle_assembler_name (const char *);
306 extern void i386_pe_record_stub (const char *);
308 extern void i386_pe_seh_init (FILE *);
309 extern void i386_pe_seh_end_prologue (FILE *);
310 extern void i386_pe_seh_cold_init (FILE *, const char *);
311 extern void i386_pe_seh_unwind_emit (FILE *, rtx_insn
*);
312 extern void i386_pe_seh_emit_except_personality (rtx
);
313 extern void i386_pe_seh_init_sections (void);
315 /* In winnt-cxx.cc and winnt-stubs.cc */
316 extern void i386_pe_adjust_class_at_definition (tree
);
317 extern bool i386_pe_type_dllimport_p (tree
);
318 extern bool i386_pe_type_dllexport_p (tree
);
320 extern int i386_pe_reloc_rw_mask (void);
322 extern char internal_label_prefix
[16];
323 extern int internal_label_prefix_len
;
325 extern bool ix86_epilogue_uses (int);
329 rtx base
, index
, disp
;
334 extern bool ix86_decompose_address (rtx
, struct ix86_address
*);
335 extern int memory_address_length (rtx
, bool);
336 extern void x86_output_aligned_bss (FILE *, tree
, const char *,
337 unsigned HOST_WIDE_INT
, unsigned);
338 extern void x86_elf_aligned_decl_common (FILE *, tree
, const char *,
339 unsigned HOST_WIDE_INT
, unsigned);
342 extern void ix86_fp_comparison_codes (enum rtx_code code
, enum rtx_code
*,
343 enum rtx_code
*, enum rtx_code
*);
344 extern enum rtx_code
ix86_fp_compare_code_to_integer (enum rtx_code
);
346 extern int asm_preferred_eh_data_format (int, int);
349 extern enum attr_cpu ix86_schedule
;
352 extern const char * ix86_output_call_insn (rtx_insn
*insn
, rtx call_op
);
353 extern const char * ix86_output_indirect_jmp (rtx call_op
);
354 extern const char * ix86_output_function_return (bool long_p
);
355 extern const char * ix86_output_indirect_function_return (rtx ret_op
);
356 extern void ix86_split_simple_return_pop_internal (rtx
);
357 extern bool ix86_operands_ok_for_move_multiple (rtx
*operands
, bool load
,
359 extern int ix86_min_insn_size (rtx_insn
*);
361 extern int ix86_issue_rate (void);
362 extern int ix86_adjust_cost (rtx_insn
*insn
, int dep_type
, rtx_insn
*dep_insn
,
363 int cost
, unsigned int);
364 extern int ia32_multipass_dfa_lookahead (void);
365 extern bool ix86_macro_fusion_p (void);
366 extern bool ix86_macro_fusion_pair_p (rtx_insn
*condgen
, rtx_insn
*condjmp
);
368 extern bool ix86_bd_has_dispatch (rtx_insn
*insn
, int action
);
369 extern void ix86_bd_do_dispatch (rtx_insn
*insn
, int mode
);
371 extern void ix86_core2i7_init_hooks (void);
373 extern int ix86_atom_sched_reorder (FILE *, int, rtx_insn
**, int *, int);
375 extern poly_int64
ix86_push_rounding (poly_int64
);
378 /* Target data for multipass lookahead scheduling.
379 Currently used for Core 2/i7 tuning. */
380 struct ix86_first_cycle_multipass_data_
382 /* The length (in bytes) of ifetch block in this solution. */
383 int ifetch_block_len
;
384 /* Number of instructions in ifetch block in this solution. */
385 int ifetch_block_n_insns
;
386 /* Bitmap to remember changes to ready_try for backtracking. */
387 sbitmap ready_try_change
;
388 /* Size of the bitmap. */
389 int ready_try_change_size
;
391 # define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DATA_T \
392 struct ix86_first_cycle_multipass_data_
393 #endif /* RTX_CODE */
395 const addr_space_t ADDR_SPACE_SEG_FS
= 1;
396 const addr_space_t ADDR_SPACE_SEG_GS
= 2;
398 namespace gcc
{ class context
; }
401 extern rtl_opt_pass
*make_pass_insert_vzeroupper (gcc::context
*);
402 extern rtl_opt_pass
*make_pass_stv (gcc::context
*);
403 extern rtl_opt_pass
*make_pass_insert_endbr_and_patchable_area
405 extern rtl_opt_pass
*make_pass_remove_partial_avx_dependency
408 extern bool ix86_has_no_direct_extern_access
;
410 /* In i386-expand.cc. */
411 bool ix86_check_builtin_isa_match (unsigned int, HOST_WIDE_INT
*,