]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/arm/arm-protos.h
[ARM] Implement support for ACLE Coprocessor LDC and STC intrinsics
[thirdparty/gcc.git] / gcc / config / arm / arm-protos.h
1 /* Prototypes for exported functions defined in arm.c and pe.c
2 Copyright (C) 1999-2017 Free Software Foundation, Inc.
3 Contributed by Richard Earnshaw (rearnsha@arm.com)
4 Minor hacks by Nick Clifton (nickc@cygnus.com)
5
6 This file is part of GCC.
7
8 GCC 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 3, or (at your option)
11 any later version.
12
13 GCC 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 GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
21
22 #ifndef GCC_ARM_PROTOS_H
23 #define GCC_ARM_PROTOS_H
24
25 #include "arm-flags.h"
26 #include "arm-isa.h"
27 #include "sbitmap.h"
28
29 extern enum unwind_info_type arm_except_unwind_info (struct gcc_options *);
30 extern int use_return_insn (int, rtx);
31 extern bool use_simple_return_p (void);
32 extern enum reg_class arm_regno_class (int);
33 extern void arm_load_pic_register (unsigned long);
34 extern int arm_volatile_func (void);
35 extern void arm_expand_prologue (void);
36 extern void arm_expand_epilogue (bool);
37 extern void arm_declare_function_name (FILE *, const char *, tree);
38 extern void arm_asm_declare_function_name (FILE *, const char *, tree);
39 extern void thumb2_expand_return (bool);
40 extern const char *arm_strip_name_encoding (const char *);
41 extern void arm_asm_output_labelref (FILE *, const char *);
42 extern void thumb2_asm_output_opcode (FILE *);
43 extern unsigned long arm_current_func_type (void);
44 extern HOST_WIDE_INT arm_compute_initial_elimination_offset (unsigned int,
45 unsigned int);
46 extern HOST_WIDE_INT thumb_compute_initial_elimination_offset (unsigned int,
47 unsigned int);
48 extern unsigned int arm_dbx_register_number (unsigned int);
49 extern void arm_output_fn_unwind (FILE *, bool);
50
51 extern rtx arm_expand_builtin (tree exp, rtx target, rtx subtarget
52 ATTRIBUTE_UNUSED, enum machine_mode mode
53 ATTRIBUTE_UNUSED, int ignore ATTRIBUTE_UNUSED);
54 extern tree arm_builtin_decl (unsigned code, bool initialize_p
55 ATTRIBUTE_UNUSED);
56 extern void arm_init_builtins (void);
57 extern void arm_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update);
58 extern rtx arm_simd_vect_par_cnst_half (machine_mode mode, bool high);
59 extern bool arm_simd_check_vect_par_cnst_half_p (rtx op, machine_mode mode,
60 bool high);
61 #ifdef RTX_CODE
62 extern void arm_gen_unlikely_cbranch (enum rtx_code, machine_mode cc_mode,
63 rtx label_ref);
64 extern bool arm_vector_mode_supported_p (machine_mode);
65 extern bool arm_small_register_classes_for_mode_p (machine_mode);
66 extern int arm_hard_regno_mode_ok (unsigned int, machine_mode);
67 extern bool arm_modes_tieable_p (machine_mode, machine_mode);
68 extern int const_ok_for_arm (HOST_WIDE_INT);
69 extern int const_ok_for_op (HOST_WIDE_INT, enum rtx_code);
70 extern int const_ok_for_dimode_op (HOST_WIDE_INT, enum rtx_code);
71 extern int arm_split_constant (RTX_CODE, machine_mode, rtx,
72 HOST_WIDE_INT, rtx, rtx, int);
73 extern int legitimate_pic_operand_p (rtx);
74 extern rtx legitimize_pic_address (rtx, machine_mode, rtx);
75 extern rtx legitimize_tls_address (rtx, rtx);
76 extern bool arm_legitimate_address_p (machine_mode, rtx, bool);
77 extern int arm_legitimate_address_outer_p (machine_mode, rtx, RTX_CODE, int);
78 extern int thumb_legitimate_offset_p (machine_mode, HOST_WIDE_INT);
79 extern int thumb1_legitimate_address_p (machine_mode, rtx, int);
80 extern bool ldm_stm_operation_p (rtx, bool, machine_mode mode,
81 bool, bool);
82 extern int arm_const_double_rtx (rtx);
83 extern int vfp3_const_double_rtx (rtx);
84 extern int neon_immediate_valid_for_move (rtx, machine_mode, rtx *, int *);
85 extern int neon_immediate_valid_for_logic (rtx, machine_mode, int, rtx *,
86 int *);
87 extern int neon_immediate_valid_for_shift (rtx, machine_mode, rtx *,
88 int *, bool);
89 extern char *neon_output_logic_immediate (const char *, rtx *,
90 machine_mode, int, int);
91 extern char *neon_output_shift_immediate (const char *, char, rtx *,
92 machine_mode, int, bool);
93 extern void neon_pairwise_reduce (rtx, rtx, machine_mode,
94 rtx (*) (rtx, rtx, rtx));
95 extern rtx neon_make_constant (rtx);
96 extern tree arm_builtin_vectorized_function (unsigned int, tree, tree);
97 extern void neon_expand_vector_init (rtx, rtx);
98 extern void neon_lane_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT, const_tree);
99 extern void arm_const_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
100 extern HOST_WIDE_INT neon_element_bits (machine_mode);
101 extern void neon_emit_pair_result_insn (machine_mode,
102 rtx (*) (rtx, rtx, rtx, rtx),
103 rtx, rtx, rtx);
104 extern void neon_disambiguate_copy (rtx *, rtx *, rtx *, unsigned int);
105 extern void neon_split_vcombine (rtx op[3]);
106 extern enum reg_class coproc_secondary_reload_class (machine_mode, rtx,
107 bool);
108 extern bool arm_tls_referenced_p (rtx);
109
110 extern int arm_coproc_mem_operand (rtx, bool);
111 extern int neon_vector_mem_operand (rtx, int, bool);
112 extern int neon_struct_mem_operand (rtx);
113
114 extern int tls_mentioned_p (rtx);
115 extern int symbol_mentioned_p (rtx);
116 extern int label_mentioned_p (rtx);
117 extern RTX_CODE minmax_code (rtx);
118 extern bool arm_sat_operator_match (rtx, rtx, int *, bool *);
119 extern int adjacent_mem_locations (rtx, rtx);
120 extern bool gen_ldm_seq (rtx *, int, bool);
121 extern bool gen_stm_seq (rtx *, int);
122 extern bool gen_const_stm_seq (rtx *, int);
123 extern rtx arm_gen_load_multiple (int *, int, rtx, int, rtx, HOST_WIDE_INT *);
124 extern rtx arm_gen_store_multiple (int *, int, rtx, int, rtx, HOST_WIDE_INT *);
125 extern bool offset_ok_for_ldrd_strd (HOST_WIDE_INT);
126 extern bool operands_ok_ldrd_strd (rtx, rtx, rtx, HOST_WIDE_INT, bool, bool);
127 extern bool gen_operands_ldrd_strd (rtx *, bool, bool, bool);
128 extern int arm_gen_movmemqi (rtx *);
129 extern bool gen_movmem_ldrd_strd (rtx *);
130 extern machine_mode arm_select_cc_mode (RTX_CODE, rtx, rtx);
131 extern machine_mode arm_select_dominance_cc_mode (rtx, rtx,
132 HOST_WIDE_INT);
133 extern rtx arm_gen_compare_reg (RTX_CODE, rtx, rtx, rtx);
134 extern rtx arm_gen_return_addr_mask (void);
135 extern void arm_reload_in_hi (rtx *);
136 extern void arm_reload_out_hi (rtx *);
137 extern int arm_max_const_double_inline_cost (void);
138 extern int arm_const_double_inline_cost (rtx);
139 extern bool arm_const_double_by_parts (rtx);
140 extern bool arm_const_double_by_immediates (rtx);
141 extern void arm_emit_call_insn (rtx, rtx, bool);
142 bool detect_cmse_nonsecure_call (tree);
143 extern const char *output_call (rtx *);
144 void arm_emit_movpair (rtx, rtx);
145 extern const char *output_mov_long_double_arm_from_arm (rtx *);
146 extern const char *output_move_double (rtx *, bool, int *count);
147 extern const char *output_move_quad (rtx *);
148 extern int arm_count_output_move_double_insns (rtx *);
149 extern const char *output_move_vfp (rtx *operands);
150 extern const char *output_move_neon (rtx *operands);
151 extern int arm_attr_length_move_neon (rtx_insn *);
152 extern int arm_address_offset_is_imm (rtx_insn *);
153 extern const char *output_add_immediate (rtx *);
154 extern const char *arithmetic_instr (rtx, int);
155 extern void output_ascii_pseudo_op (FILE *, const unsigned char *, int);
156 extern const char *output_return_instruction (rtx, bool, bool, bool);
157 extern const char *output_probe_stack_range (rtx, rtx);
158 extern void arm_poke_function_name (FILE *, const char *);
159 extern void arm_final_prescan_insn (rtx_insn *);
160 extern int arm_debugger_arg_offset (int, rtx);
161 extern bool arm_is_long_call_p (tree);
162 extern int arm_emit_vector_const (FILE *, rtx);
163 extern void arm_emit_fp16_const (rtx c);
164 extern const char * arm_output_load_gr (rtx *);
165 extern const char *vfp_output_vstmd (rtx *);
166 extern void arm_output_multireg_pop (rtx *, bool, rtx, bool, bool);
167 extern void arm_set_return_address (rtx, rtx);
168 extern int arm_eliminable_register (rtx);
169 extern const char *arm_output_shift(rtx *, int);
170 extern const char *arm_output_iwmmxt_shift_immediate (const char *, rtx *, bool);
171 extern const char *arm_output_iwmmxt_tinsr (rtx *);
172 extern unsigned int arm_sync_loop_insns (rtx , rtx *);
173 extern int arm_attr_length_push_multi(rtx, rtx);
174 extern int arm_attr_length_pop_multi(rtx *, bool, bool);
175 extern void arm_expand_compare_and_swap (rtx op[]);
176 extern void arm_split_compare_and_swap (rtx op[]);
177 extern void arm_split_atomic_op (enum rtx_code, rtx, rtx, rtx, rtx, rtx, rtx);
178 extern rtx arm_load_tp (rtx);
179 extern bool arm_coproc_builtin_available (enum unspecv);
180 extern bool arm_coproc_ldc_stc_legitimate_address (rtx);
181
182 #if defined TREE_CODE
183 extern void arm_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree);
184 extern bool arm_pad_arg_upward (machine_mode, const_tree);
185 extern bool arm_pad_reg_upward (machine_mode, tree, int);
186 #endif
187 extern int arm_apply_result_size (void);
188
189 #endif /* RTX_CODE */
190
191 /* Thumb functions. */
192 extern void arm_init_expanders (void);
193 extern const char *thumb1_unexpanded_epilogue (void);
194 extern void thumb1_expand_prologue (void);
195 extern void thumb1_expand_epilogue (void);
196 extern const char *thumb1_output_interwork (void);
197 extern int thumb_shiftable_const (unsigned HOST_WIDE_INT);
198 #ifdef RTX_CODE
199 extern enum arm_cond_code maybe_get_arm_condition_code (rtx);
200 extern void thumb1_final_prescan_insn (rtx_insn *);
201 extern void thumb2_final_prescan_insn (rtx_insn *);
202 extern const char *thumb_load_double_from_address (rtx *);
203 extern const char *thumb_output_move_mem_multiple (int, rtx *);
204 extern const char *thumb_call_via_reg (rtx);
205 extern void thumb_expand_movmemqi (rtx *);
206 extern rtx arm_return_addr (int, rtx);
207 extern void thumb_reload_out_hi (rtx *);
208 extern void thumb_set_return_address (rtx, rtx);
209 extern const char *thumb1_output_casesi (rtx *);
210 extern const char *thumb2_output_casesi (rtx *);
211 #endif
212
213 /* Defined in pe.c. */
214 extern int arm_dllexport_name_p (const char *);
215 extern int arm_dllimport_name_p (const char *);
216
217 #ifdef TREE_CODE
218 extern void arm_pe_unique_section (tree, int);
219 extern void arm_pe_encode_section_info (tree, rtx, int);
220 extern int arm_dllexport_p (tree);
221 extern int arm_dllimport_p (tree);
222 extern void arm_mark_dllexport (tree);
223 extern void arm_mark_dllimport (tree);
224 extern bool arm_change_mode_p (tree);
225 #endif
226
227 extern tree arm_valid_target_attribute_tree (tree, struct gcc_options *,
228 struct gcc_options *);
229 extern void arm_configure_build_target (struct arm_build_target *,
230 struct cl_target_option *,
231 struct gcc_options *, bool);
232 extern void arm_pr_long_calls (struct cpp_reader *);
233 extern void arm_pr_no_long_calls (struct cpp_reader *);
234 extern void arm_pr_long_calls_off (struct cpp_reader *);
235
236 extern const char *arm_mangle_type (const_tree);
237 extern const char *arm_mangle_builtin_type (const_tree);
238
239 extern void arm_order_regs_for_local_alloc (void);
240
241 extern int arm_max_conditional_execute ();
242
243 /* Vectorizer cost model implementation. */
244 struct cpu_vec_costs {
245 const int scalar_stmt_cost; /* Cost of any scalar operation, excluding
246 load and store. */
247 const int scalar_load_cost; /* Cost of scalar load. */
248 const int scalar_store_cost; /* Cost of scalar store. */
249 const int vec_stmt_cost; /* Cost of any vector operation, excluding
250 load, store, vector-to-scalar and
251 scalar-to-vector operation. */
252 const int vec_to_scalar_cost; /* Cost of vect-to-scalar operation. */
253 const int scalar_to_vec_cost; /* Cost of scalar-to-vector operation. */
254 const int vec_align_load_cost; /* Cost of aligned vector load. */
255 const int vec_unalign_load_cost; /* Cost of unaligned vector load. */
256 const int vec_unalign_store_cost; /* Cost of unaligned vector load. */
257 const int vec_store_cost; /* Cost of vector store. */
258 const int cond_taken_branch_cost; /* Cost of taken branch for vectorizer
259 cost model. */
260 const int cond_not_taken_branch_cost;/* Cost of not taken branch for
261 vectorizer cost model. */
262 };
263
264 #ifdef RTX_CODE
265 /* This needs to be here because we need RTX_CODE and similar. */
266
267 struct cpu_cost_table;
268
269 /* Dump function ARM_PRINT_TUNE_INFO should be updated whenever this
270 structure is modified. */
271
272 struct tune_params
273 {
274 const struct cpu_cost_table *insn_extra_cost;
275 bool (*sched_adjust_cost) (rtx_insn *, int, rtx_insn *, int *);
276 int (*branch_cost) (bool, bool);
277 /* Vectorizer costs. */
278 const struct cpu_vec_costs* vec_costs;
279 int constant_limit;
280 /* Maximum number of instructions to conditionalise. */
281 int max_insns_skipped;
282 /* Maximum number of instructions to inline calls to memset. */
283 int max_insns_inline_memset;
284 /* Issue rate of the processor. */
285 unsigned int issue_rate;
286 /* Explicit prefetch data. */
287 struct
288 {
289 int num_slots;
290 int l1_cache_size;
291 int l1_cache_line_size;
292 } prefetch;
293 enum {PREF_CONST_POOL_FALSE, PREF_CONST_POOL_TRUE}
294 prefer_constant_pool: 1;
295 /* Prefer STRD/LDRD instructions over PUSH/POP/LDM/STM. */
296 enum {PREF_LDRD_FALSE, PREF_LDRD_TRUE} prefer_ldrd_strd: 1;
297 /* The preference for non short cirtcuit operation when optimizing for
298 performance. The first element covers Thumb state and the second one
299 is for ARM state. */
300 enum log_op_non_short_circuit {LOG_OP_NON_SHORT_CIRCUIT_FALSE,
301 LOG_OP_NON_SHORT_CIRCUIT_TRUE};
302 log_op_non_short_circuit logical_op_non_short_circuit_thumb: 1;
303 log_op_non_short_circuit logical_op_non_short_circuit_arm: 1;
304 /* Prefer 32-bit encoding instead of flag-setting 16-bit encoding. */
305 enum {DISPARAGE_FLAGS_NEITHER, DISPARAGE_FLAGS_PARTIAL, DISPARAGE_FLAGS_ALL}
306 disparage_flag_setting_t16_encodings: 2;
307 enum {PREF_NEON_64_FALSE, PREF_NEON_64_TRUE} prefer_neon_for_64bits: 1;
308 /* Prefer to inline string operations like memset by using Neon. */
309 enum {PREF_NEON_STRINGOPS_FALSE, PREF_NEON_STRINGOPS_TRUE}
310 string_ops_prefer_neon: 1;
311 /* Bitfield encoding the fusible pairs of instructions. Use FUSE_OPS
312 in an initializer if multiple fusion operations are supported on a
313 target. */
314 enum fuse_ops
315 {
316 FUSE_NOTHING = 0,
317 FUSE_MOVW_MOVT = 1 << 0,
318 FUSE_AES_AESMC = 1 << 1
319 } fusible_ops: 2;
320 /* Depth of scheduling queue to check for L2 autoprefetcher. */
321 enum {SCHED_AUTOPREF_OFF, SCHED_AUTOPREF_RANK, SCHED_AUTOPREF_FULL}
322 sched_autopref: 2;
323 };
324
325 /* Smash multiple fusion operations into a type that can be used for an
326 initializer. */
327 #define FUSE_OPS(x) ((tune_params::fuse_ops) (x))
328
329 extern const struct tune_params *current_tune;
330 extern int vfp3_const_double_for_fract_bits (rtx);
331 /* return power of two from operand, otherwise 0. */
332 extern int vfp3_const_double_for_bits (rtx);
333
334 extern void arm_emit_coreregs_64bit_shift (enum rtx_code, rtx, rtx, rtx, rtx,
335 rtx);
336 extern bool arm_fusion_enabled_p (tune_params::fuse_ops);
337 extern bool arm_valid_symbolic_address_p (rtx);
338 extern bool arm_validize_comparison (rtx *, rtx *, rtx *);
339 #endif /* RTX_CODE */
340
341 extern bool arm_gen_setmem (rtx *);
342 extern void arm_expand_vec_perm (rtx target, rtx op0, rtx op1, rtx sel);
343 extern bool arm_expand_vec_perm_const (rtx target, rtx op0, rtx op1, rtx sel);
344
345 extern bool arm_autoinc_modes_ok_p (machine_mode, enum arm_auto_incmodes);
346
347 extern void arm_emit_eabi_attribute (const char *, int, int);
348
349 extern void arm_reset_previous_fndecl (void);
350 extern void save_restore_target_globals (tree);
351
352 /* Defined in gcc/common/config/arm-common.c. */
353 extern const char *arm_rewrite_selected_cpu (const char *name);
354
355 /* Defined in gcc/common/config/arm-c.c. */
356 extern void arm_lang_object_attributes_init (void);
357 extern void arm_register_target_pragmas (void);
358 extern void arm_cpu_cpp_builtins (struct cpp_reader *);
359
360 extern bool arm_is_constant_pool_ref (rtx);
361
362 /* The bits in this mask specify which instruction scheduling options should
363 be used. */
364 extern unsigned int tune_flags;
365
366 /* Nonzero if this chip supports the ARM Architecture 3M extensions. */
367 extern int arm_arch3m;
368
369 /* Nonzero if this chip supports the ARM Architecture 4 extensions. */
370 extern int arm_arch4;
371
372 /* Nonzero if this chip supports the ARM Architecture 4t extensions. */
373 extern int arm_arch4t;
374
375 /* Nonzero if this chip supports the ARM Architecture 5 extensions. */
376 extern int arm_arch5;
377
378 /* Nonzero if this chip supports the ARM Architecture 5E extensions. */
379 extern int arm_arch5e;
380
381 /* Nonzero if this chip supports the ARM Architecture 6 extensions. */
382 extern int arm_arch6;
383
384 /* Nonzero if this chip supports the ARM 6K extensions. */
385 extern int arm_arch6k;
386
387 /* Nonzero if this chip supports the ARM 6KZ extensions. */
388 extern int arm_arch6kz;
389
390 /* Nonzero if instructions present in ARMv6-M can be used. */
391 extern int arm_arch6m;
392
393 /* Nonzero if this chip supports the ARM 7 extensions. */
394 extern int arm_arch7;
395
396 /* Nonzero if this chip supports the ARM 7ve extensions. */
397 extern int arm_arch7ve;
398
399 /* Nonzero if instructions not present in the 'M' profile can be used. */
400 extern int arm_arch_notm;
401
402 /* Nonzero if instructions present in ARMv7E-M can be used. */
403 extern int arm_arch7em;
404
405 /* Nonzero if instructions present in ARMv8 can be used. */
406 extern int arm_arch8;
407
408 /* Nonzero if this chip can benefit from load scheduling. */
409 extern int arm_ld_sched;
410
411 /* Nonzero if this chip is a StrongARM. */
412 extern int arm_tune_strongarm;
413
414 /* Nonzero if this chip supports Intel Wireless MMX technology. */
415 extern int arm_arch_iwmmxt;
416
417 /* Nonzero if this chip supports Intel Wireless MMX2 technology. */
418 extern int arm_arch_iwmmxt2;
419
420 /* Nonzero if this chip is an XScale. */
421 extern int arm_arch_xscale;
422
423 /* Nonzero if tuning for XScale */
424 extern int arm_tune_xscale;
425
426 /* Nonzero if we want to tune for stores that access the write-buffer.
427 This typically means an ARM6 or ARM7 with MMU or MPU. */
428 extern int arm_tune_wbuf;
429
430 /* Nonzero if tuning for Cortex-A9. */
431 extern int arm_tune_cortex_a9;
432
433 /* Nonzero if we should define __THUMB_INTERWORK__ in the
434 preprocessor.
435 XXX This is a bit of a hack, it's intended to help work around
436 problems in GLD which doesn't understand that armv5t code is
437 interworking clean. */
438 extern int arm_cpp_interwork;
439
440 /* Nonzero if chip supports Thumb 1. */
441 extern int arm_arch_thumb1;
442
443 /* Nonzero if chip supports Thumb 2. */
444 extern int arm_arch_thumb2;
445
446 /* Nonzero if chip supports integer division instruction. */
447 extern int arm_arch_arm_hwdiv;
448 extern int arm_arch_thumb_hwdiv;
449
450 /* Nonzero if chip disallows volatile memory access in IT block. */
451 extern int arm_arch_no_volatile_ce;
452
453 /* Nonzero if we should use Neon to handle 64-bits operations rather
454 than core registers. */
455 extern int prefer_neon_for_64bits;
456
457 /* Structure defining the current overall architectural target and tuning. */
458 struct arm_build_target
459 {
460 /* Name of the target CPU, if known, or NULL if the target CPU was not
461 specified by the user (and inferred from the -march option). */
462 const char *core_name;
463 /* Name of the target ARCH. NULL if there is a selected CPU. */
464 const char *arch_name;
465 /* Preprocessor substring (never NULL). */
466 const char *arch_pp_name;
467 /* CPU identifier for the core we're compiling for (architecturally). */
468 enum processor_type arch_core;
469 /* The base architecture value. */
470 enum base_architecture base_arch;
471 /* Bitmap encapsulating the isa_bits for the target environment. */
472 sbitmap isa;
473 /* Flags used for tuning. Long term, these move into tune_params. */
474 unsigned int tune_flags;
475 /* Tables with more detailed tuning information. */
476 const struct tune_params *tune;
477 /* CPU identifier for the tuning target. */
478 enum processor_type tune_core;
479 };
480
481 extern struct arm_build_target arm_active_target;
482
483
484 #endif /* ! GCC_ARM_PROTOS_H */