1 /* Prototypes for exported functions defined in arm.c and pe.c
2 Copyright (C) 1999-2014 Free Software Foundation, Inc.
3 Contributed by Richard Earnshaw (rearnsha@arm.com)
4 Minor hacks by Nick Clifton (nickc@cygnus.com)
6 This file is part of GCC.
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)
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.
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/>. */
22 #ifndef GCC_ARM_PROTOS_H
23 #define GCC_ARM_PROTOS_H
25 extern enum unwind_info_type
arm_except_unwind_info (struct gcc_options
*);
26 extern int use_return_insn (int, rtx
);
27 extern bool use_simple_return_p (void);
28 extern enum reg_class
arm_regno_class (int);
29 extern void arm_load_pic_register (unsigned long);
30 extern int arm_volatile_func (void);
31 extern void arm_expand_prologue (void);
32 extern void arm_expand_epilogue (bool);
33 extern void thumb2_expand_return (bool);
34 extern const char *arm_strip_name_encoding (const char *);
35 extern void arm_asm_output_labelref (FILE *, const char *);
36 extern void thumb2_asm_output_opcode (FILE *);
37 extern unsigned long arm_current_func_type (void);
38 extern HOST_WIDE_INT
arm_compute_initial_elimination_offset (unsigned int,
40 extern HOST_WIDE_INT
thumb_compute_initial_elimination_offset (unsigned int,
42 extern unsigned int arm_dbx_register_number (unsigned int);
43 extern void arm_output_fn_unwind (FILE *, bool);
47 extern bool arm_vector_mode_supported_p (enum machine_mode
);
48 extern bool arm_small_register_classes_for_mode_p (enum machine_mode
);
49 extern int arm_hard_regno_mode_ok (unsigned int, enum machine_mode
);
50 extern bool arm_modes_tieable_p (enum machine_mode
, enum machine_mode
);
51 extern int const_ok_for_arm (HOST_WIDE_INT
);
52 extern int const_ok_for_op (HOST_WIDE_INT
, enum rtx_code
);
53 extern int const_ok_for_dimode_op (HOST_WIDE_INT
, enum rtx_code
);
54 extern int arm_split_constant (RTX_CODE
, enum machine_mode
, rtx
,
55 HOST_WIDE_INT
, rtx
, rtx
, int);
56 extern int legitimate_pic_operand_p (rtx
);
57 extern rtx
legitimize_pic_address (rtx
, enum machine_mode
, rtx
);
58 extern rtx
legitimize_tls_address (rtx
, rtx
);
59 extern bool arm_legitimate_address_p (enum machine_mode
, rtx
, bool);
60 extern int arm_legitimate_address_outer_p (enum machine_mode
, rtx
, RTX_CODE
, int);
61 extern int thumb_legitimate_offset_p (enum machine_mode
, HOST_WIDE_INT
);
62 extern bool arm_legitimize_reload_address (rtx
*, enum machine_mode
, int, int,
64 extern rtx
thumb_legitimize_reload_address (rtx
*, enum machine_mode
, int, int,
66 extern int thumb1_legitimate_address_p (enum machine_mode
, rtx
, int);
67 extern bool ldm_stm_operation_p (rtx
, bool, enum machine_mode mode
,
69 extern int arm_const_double_rtx (rtx
);
70 extern int vfp3_const_double_rtx (rtx
);
71 extern int neon_immediate_valid_for_move (rtx
, enum machine_mode
, rtx
*, int *);
72 extern int neon_immediate_valid_for_logic (rtx
, enum machine_mode
, int, rtx
*,
74 extern int neon_immediate_valid_for_shift (rtx
, enum machine_mode
, rtx
*,
76 extern char *neon_output_logic_immediate (const char *, rtx
*,
77 enum machine_mode
, int, int);
78 extern char *neon_output_shift_immediate (const char *, char, rtx
*,
79 enum machine_mode
, int, bool);
80 extern void neon_pairwise_reduce (rtx
, rtx
, enum machine_mode
,
81 rtx (*) (rtx
, rtx
, rtx
));
82 extern rtx
neon_make_constant (rtx
);
83 extern tree
arm_builtin_vectorized_function (tree
, tree
, tree
);
84 extern void neon_expand_vector_init (rtx
, rtx
);
85 extern void neon_lane_bounds (rtx
, HOST_WIDE_INT
, HOST_WIDE_INT
);
86 extern void neon_const_bounds (rtx
, HOST_WIDE_INT
, HOST_WIDE_INT
);
87 extern HOST_WIDE_INT
neon_element_bits (enum machine_mode
);
88 extern void neon_reinterpret (rtx
, rtx
);
89 extern void neon_emit_pair_result_insn (enum machine_mode
,
90 rtx (*) (rtx
, rtx
, rtx
, rtx
),
92 extern void neon_disambiguate_copy (rtx
*, rtx
*, rtx
*, unsigned int);
93 extern void neon_split_vcombine (rtx op
[3]);
94 extern enum reg_class
coproc_secondary_reload_class (enum machine_mode
, rtx
,
96 extern bool arm_tls_referenced_p (rtx
);
98 extern int arm_coproc_mem_operand (rtx
, bool);
99 extern int neon_vector_mem_operand (rtx
, int, bool);
100 extern int neon_struct_mem_operand (rtx
);
102 extern int tls_mentioned_p (rtx
);
103 extern int symbol_mentioned_p (rtx
);
104 extern int label_mentioned_p (rtx
);
105 extern RTX_CODE
minmax_code (rtx
);
106 extern bool arm_sat_operator_match (rtx
, rtx
, int *, bool *);
107 extern int adjacent_mem_locations (rtx
, rtx
);
108 extern bool gen_ldm_seq (rtx
*, int, bool);
109 extern bool gen_stm_seq (rtx
*, int);
110 extern bool gen_const_stm_seq (rtx
*, int);
111 extern rtx
arm_gen_load_multiple (int *, int, rtx
, int, rtx
, HOST_WIDE_INT
*);
112 extern rtx
arm_gen_store_multiple (int *, int, rtx
, int, rtx
, HOST_WIDE_INT
*);
113 extern bool offset_ok_for_ldrd_strd (HOST_WIDE_INT
);
114 extern bool operands_ok_ldrd_strd (rtx
, rtx
, rtx
, HOST_WIDE_INT
, bool, bool);
115 extern bool gen_operands_ldrd_strd (rtx
*, bool, bool, bool);
116 extern int arm_gen_movmemqi (rtx
*);
117 extern bool gen_movmem_ldrd_strd (rtx
*);
118 extern enum machine_mode
arm_select_cc_mode (RTX_CODE
, rtx
, rtx
);
119 extern enum machine_mode
arm_select_dominance_cc_mode (rtx
, rtx
,
121 extern rtx
arm_gen_compare_reg (RTX_CODE
, rtx
, rtx
, rtx
);
122 extern rtx
arm_gen_return_addr_mask (void);
123 extern void arm_reload_in_hi (rtx
*);
124 extern void arm_reload_out_hi (rtx
*);
125 extern int arm_max_const_double_inline_cost (void);
126 extern int arm_const_double_inline_cost (rtx
);
127 extern bool arm_const_double_by_parts (rtx
);
128 extern bool arm_const_double_by_immediates (rtx
);
129 extern const char *fp_immediate_constant (rtx
);
130 extern void arm_emit_call_insn (rtx
, rtx
, bool);
131 extern const char *output_call (rtx
*);
132 extern const char *output_call_mem (rtx
*);
133 void arm_emit_movpair (rtx
, rtx
);
134 extern const char *output_mov_long_double_arm_from_arm (rtx
*);
135 extern const char *output_move_double (rtx
*, bool, int *count
);
136 extern const char *output_move_quad (rtx
*);
137 extern int arm_count_output_move_double_insns (rtx
*);
138 extern const char *output_move_vfp (rtx
*operands
);
139 extern const char *output_move_neon (rtx
*operands
);
140 extern int arm_attr_length_move_neon (rtx
);
141 extern int arm_address_offset_is_imm (rtx
);
142 extern const char *output_add_immediate (rtx
*);
143 extern const char *arithmetic_instr (rtx
, int);
144 extern void output_ascii_pseudo_op (FILE *, const unsigned char *, int);
145 extern const char *output_return_instruction (rtx
, bool, bool, bool);
146 extern void arm_poke_function_name (FILE *, const char *);
147 extern void arm_final_prescan_insn (rtx
);
148 extern int arm_debugger_arg_offset (int, rtx
);
149 extern bool arm_is_long_call_p (tree
);
150 extern int arm_emit_vector_const (FILE *, rtx
);
151 extern void arm_emit_fp16_const (rtx c
);
152 extern const char * arm_output_load_gr (rtx
*);
153 extern const char *vfp_output_fstmd (rtx
*);
154 extern void arm_output_multireg_pop (rtx
*, bool, rtx
, bool, bool);
155 extern void arm_set_return_address (rtx
, rtx
);
156 extern int arm_eliminable_register (rtx
);
157 extern const char *arm_output_shift(rtx
*, int);
158 extern const char *arm_output_iwmmxt_shift_immediate (const char *, rtx
*, bool);
159 extern const char *arm_output_iwmmxt_tinsr (rtx
*);
160 extern unsigned int arm_sync_loop_insns (rtx
, rtx
*);
161 extern int arm_attr_length_push_multi(rtx
, rtx
);
162 extern void arm_expand_compare_and_swap (rtx op
[]);
163 extern void arm_split_compare_and_swap (rtx op
[]);
164 extern void arm_split_atomic_op (enum rtx_code
, rtx
, rtx
, rtx
, rtx
, rtx
, rtx
);
165 extern rtx
arm_load_tp (rtx
);
167 #if defined TREE_CODE
168 extern void arm_init_cumulative_args (CUMULATIVE_ARGS
*, tree
, rtx
, tree
);
169 extern bool arm_pad_arg_upward (enum machine_mode
, const_tree
);
170 extern bool arm_pad_reg_upward (enum machine_mode
, tree
, int);
172 extern int arm_apply_result_size (void);
174 #endif /* RTX_CODE */
176 /* Thumb functions. */
177 extern void arm_init_expanders (void);
178 extern const char *thumb1_unexpanded_epilogue (void);
179 extern void thumb1_expand_prologue (void);
180 extern void thumb1_expand_epilogue (void);
181 extern const char *thumb1_output_interwork (void);
183 extern int is_called_in_ARM_mode (tree
);
185 extern int thumb_shiftable_const (unsigned HOST_WIDE_INT
);
187 extern enum arm_cond_code
maybe_get_arm_condition_code (rtx
);
188 extern void thumb1_final_prescan_insn (rtx
);
189 extern void thumb2_final_prescan_insn (rtx
);
190 extern const char *thumb_load_double_from_address (rtx
*);
191 extern const char *thumb_output_move_mem_multiple (int, rtx
*);
192 extern const char *thumb_call_via_reg (rtx
);
193 extern void thumb_expand_movmemqi (rtx
*);
194 extern rtx
arm_return_addr (int, rtx
);
195 extern void thumb_reload_out_hi (rtx
*);
196 extern void thumb_reload_in_hi (rtx
*);
197 extern void thumb_set_return_address (rtx
, rtx
);
198 extern const char *thumb1_output_casesi (rtx
*);
199 extern const char *thumb2_output_casesi (rtx
*);
202 /* Defined in pe.c. */
203 extern int arm_dllexport_name_p (const char *);
204 extern int arm_dllimport_name_p (const char *);
207 extern void arm_pe_unique_section (tree
, int);
208 extern void arm_pe_encode_section_info (tree
, rtx
, int);
209 extern int arm_dllexport_p (tree
);
210 extern int arm_dllimport_p (tree
);
211 extern void arm_mark_dllexport (tree
);
212 extern void arm_mark_dllimport (tree
);
215 extern void arm_pr_long_calls (struct cpp_reader
*);
216 extern void arm_pr_no_long_calls (struct cpp_reader
*);
217 extern void arm_pr_long_calls_off (struct cpp_reader
*);
219 extern void arm_lang_object_attributes_init(void);
221 extern const char *arm_mangle_type (const_tree
);
223 extern void arm_order_regs_for_local_alloc (void);
225 extern int arm_max_conditional_execute ();
227 /* Vectorizer cost model implementation. */
228 struct cpu_vec_costs
{
229 const int scalar_stmt_cost
; /* Cost of any scalar operation, excluding
231 const int scalar_load_cost
; /* Cost of scalar load. */
232 const int scalar_store_cost
; /* Cost of scalar store. */
233 const int vec_stmt_cost
; /* Cost of any vector operation, excluding
234 load, store, vector-to-scalar and
235 scalar-to-vector operation. */
236 const int vec_to_scalar_cost
; /* Cost of vect-to-scalar operation. */
237 const int scalar_to_vec_cost
; /* Cost of scalar-to-vector operation. */
238 const int vec_align_load_cost
; /* Cost of aligned vector load. */
239 const int vec_unalign_load_cost
; /* Cost of unaligned vector load. */
240 const int vec_unalign_store_cost
; /* Cost of unaligned vector load. */
241 const int vec_store_cost
; /* Cost of vector store. */
242 const int cond_taken_branch_cost
; /* Cost of taken branch for vectorizer
244 const int cond_not_taken_branch_cost
;/* Cost of not taken branch for
245 vectorizer cost model. */
249 /* This needs to be here because we need RTX_CODE and similar. */
251 struct cpu_cost_table
;
255 bool (*rtx_costs
) (rtx
, RTX_CODE
, RTX_CODE
, int *, bool);
256 const struct cpu_cost_table
*insn_extra_cost
;
257 bool (*sched_adjust_cost
) (rtx
, rtx
, rtx
, int *);
259 /* Maximum number of instructions to conditionalise. */
260 int max_insns_skipped
;
261 int num_prefetch_slots
;
263 int l1_cache_line_size
;
264 bool prefer_constant_pool
;
265 int (*branch_cost
) (bool, bool);
266 /* Prefer STRD/LDRD instructions over PUSH/POP/LDM/STM. */
267 bool prefer_ldrd_strd
;
268 /* The preference for non short cirtcuit operation when optimizing for
269 performance. The first element covers Thumb state and the second one
271 bool logical_op_non_short_circuit
[2];
272 /* Vectorizer costs. */
273 const struct cpu_vec_costs
* vec_costs
;
274 /* Prefer Neon for 64-bit bitops. */
275 bool prefer_neon_for_64bits
;
276 /* Prefer 32-bit encoding instead of flag-setting 16-bit encoding. */
277 bool disparage_flag_setting_t16_encodings
;
278 /* Prefer 32-bit encoding instead of 16-bit encoding where subset of flags
280 bool disparage_partial_flag_setting_t16_encodings
;
283 extern const struct tune_params
*current_tune
;
284 extern int vfp3_const_double_for_fract_bits (rtx
);
285 /* return power of two from operand, otherwise 0. */
286 extern int vfp3_const_double_for_bits (rtx
);
288 extern void arm_emit_coreregs_64bit_shift (enum rtx_code
, rtx
, rtx
, rtx
, rtx
,
290 extern bool arm_validize_comparison (rtx
*, rtx
*, rtx
*);
291 #endif /* RTX_CODE */
293 extern void arm_expand_vec_perm (rtx target
, rtx op0
, rtx op1
, rtx sel
);
294 extern bool arm_expand_vec_perm_const (rtx target
, rtx op0
, rtx op1
, rtx sel
);
296 extern bool arm_autoinc_modes_ok_p (enum machine_mode
, enum arm_auto_incmodes
);
298 extern void arm_emit_eabi_attribute (const char *, int, int);
300 /* Defined in gcc/common/config/arm-common.c. */
301 extern const char *arm_rewrite_selected_cpu (const char *name
);
303 extern bool arm_is_constant_pool_ref (rtx
);
305 #endif /* ! GCC_ARM_PROTOS_H */