aarch64-protos.h revision 1.3 1 1.1 mrg /* Machine description for AArch64 architecture.
2 1.3 mrg Copyright (C) 2009-2015 Free Software Foundation, Inc.
3 1.1 mrg Contributed by ARM Ltd.
4 1.1 mrg
5 1.1 mrg This file is part of GCC.
6 1.1 mrg
7 1.1 mrg GCC is free software; you can redistribute it and/or modify it
8 1.1 mrg under the terms of the GNU General Public License as published by
9 1.1 mrg the Free Software Foundation; either version 3, or (at your option)
10 1.1 mrg any later version.
11 1.1 mrg
12 1.1 mrg GCC is distributed in the hope that it will be useful, but
13 1.1 mrg WITHOUT ANY WARRANTY; without even the implied warranty of
14 1.1 mrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 1.1 mrg General Public License for more details.
16 1.1 mrg
17 1.1 mrg You should have received a copy of the GNU General Public License
18 1.1 mrg along with GCC; see the file COPYING3. If not see
19 1.1 mrg <http://www.gnu.org/licenses/>. */
20 1.1 mrg
21 1.1 mrg
22 1.1 mrg #ifndef GCC_AARCH64_PROTOS_H
23 1.1 mrg #define GCC_AARCH64_PROTOS_H
24 1.1 mrg
25 1.1 mrg /*
26 1.1 mrg SYMBOL_CONTEXT_ADR
27 1.1 mrg The symbol is used in a load-address operation.
28 1.1 mrg SYMBOL_CONTEXT_MEM
29 1.1 mrg The symbol is used as the address in a MEM.
30 1.1 mrg */
31 1.1 mrg enum aarch64_symbol_context
32 1.1 mrg {
33 1.1 mrg SYMBOL_CONTEXT_MEM,
34 1.1 mrg SYMBOL_CONTEXT_ADR
35 1.1 mrg };
36 1.1 mrg
37 1.1 mrg /* SYMBOL_SMALL_ABSOLUTE: Generate symbol accesses through
38 1.1 mrg high and lo relocs that calculate the base address using a PC
39 1.1 mrg relative reloc.
40 1.1 mrg So to get the address of foo, we generate
41 1.1 mrg adrp x0, foo
42 1.1 mrg add x0, x0, :lo12:foo
43 1.1 mrg
44 1.1 mrg To load or store something to foo, we could use the corresponding
45 1.1 mrg load store variants that generate an
46 1.1 mrg ldr x0, [x0,:lo12:foo]
47 1.1 mrg or
48 1.1 mrg str x1, [x0, :lo12:foo]
49 1.1 mrg
50 1.1 mrg This corresponds to the small code model of the compiler.
51 1.1 mrg
52 1.1 mrg SYMBOL_SMALL_GOT: Similar to the one above but this
53 1.1 mrg gives us the GOT entry of the symbol being referred to :
54 1.1 mrg Thus calculating the GOT entry for foo is done using the
55 1.1 mrg following sequence of instructions. The ADRP instruction
56 1.1 mrg gets us to the page containing the GOT entry of the symbol
57 1.1 mrg and the got_lo12 gets us the actual offset in it.
58 1.1 mrg
59 1.1 mrg adrp x0, :got:foo
60 1.1 mrg ldr x0, [x0, :gotoff_lo12:foo]
61 1.1 mrg
62 1.1 mrg This corresponds to the small PIC model of the compiler.
63 1.1 mrg
64 1.1 mrg SYMBOL_SMALL_TLSGD
65 1.1 mrg SYMBOL_SMALL_TLSDESC
66 1.1 mrg SYMBOL_SMALL_GOTTPREL
67 1.1 mrg SYMBOL_SMALL_TPREL
68 1.1 mrg Each of of these represents a thread-local symbol, and corresponds to the
69 1.1 mrg thread local storage relocation operator for the symbol being referred to.
70 1.1 mrg
71 1.3 mrg SYMBOL_TINY_ABSOLUTE
72 1.3 mrg
73 1.3 mrg Generate symbol accesses as a PC relative address using a single
74 1.3 mrg instruction. To compute the address of symbol foo, we generate:
75 1.3 mrg
76 1.3 mrg ADR x0, foo
77 1.3 mrg
78 1.3 mrg SYMBOL_TINY_GOT
79 1.3 mrg
80 1.3 mrg Generate symbol accesses via the GOT using a single PC relative
81 1.3 mrg instruction. To compute the address of symbol foo, we generate:
82 1.3 mrg
83 1.3 mrg ldr t0, :got:foo
84 1.3 mrg
85 1.3 mrg The value of foo can subsequently read using:
86 1.3 mrg
87 1.3 mrg ldrb t0, [t0]
88 1.3 mrg
89 1.1 mrg SYMBOL_FORCE_TO_MEM : Global variables are addressed using
90 1.1 mrg constant pool. All variable addresses are spilled into constant
91 1.1 mrg pools. The constant pools themselves are addressed using PC
92 1.1 mrg relative accesses. This only works for the large code model.
93 1.1 mrg */
94 1.1 mrg enum aarch64_symbol_type
95 1.1 mrg {
96 1.1 mrg SYMBOL_SMALL_ABSOLUTE,
97 1.1 mrg SYMBOL_SMALL_GOT,
98 1.1 mrg SYMBOL_SMALL_TLSGD,
99 1.1 mrg SYMBOL_SMALL_TLSDESC,
100 1.1 mrg SYMBOL_SMALL_GOTTPREL,
101 1.1 mrg SYMBOL_SMALL_TPREL,
102 1.3 mrg SYMBOL_TINY_ABSOLUTE,
103 1.3 mrg SYMBOL_TINY_GOT,
104 1.1 mrg SYMBOL_FORCE_TO_MEM
105 1.1 mrg };
106 1.1 mrg
107 1.1 mrg /* A set of tuning parameters contains references to size and time
108 1.1 mrg cost models and vectors for address cost calculations, register
109 1.1 mrg move costs and memory move costs. */
110 1.1 mrg
111 1.3 mrg /* Scaled addressing modes can vary cost depending on the mode of the
112 1.3 mrg value to be loaded/stored. QImode values cannot use scaled
113 1.3 mrg addressing modes. */
114 1.1 mrg
115 1.3 mrg struct scale_addr_mode_cost
116 1.1 mrg {
117 1.3 mrg const int hi;
118 1.3 mrg const int si;
119 1.3 mrg const int di;
120 1.3 mrg const int ti;
121 1.1 mrg };
122 1.1 mrg
123 1.1 mrg /* Additional cost for addresses. */
124 1.1 mrg struct cpu_addrcost_table
125 1.1 mrg {
126 1.3 mrg const struct scale_addr_mode_cost addr_scale_costs;
127 1.1 mrg const int pre_modify;
128 1.1 mrg const int post_modify;
129 1.1 mrg const int register_offset;
130 1.1 mrg const int register_extend;
131 1.1 mrg const int imm_offset;
132 1.1 mrg };
133 1.1 mrg
134 1.1 mrg /* Additional costs for register copies. Cost is for one register. */
135 1.1 mrg struct cpu_regmove_cost
136 1.1 mrg {
137 1.1 mrg const int GP2GP;
138 1.1 mrg const int GP2FP;
139 1.1 mrg const int FP2GP;
140 1.1 mrg const int FP2FP;
141 1.1 mrg };
142 1.1 mrg
143 1.3 mrg /* Cost for vector insn classes. */
144 1.3 mrg struct cpu_vector_cost
145 1.3 mrg {
146 1.3 mrg const int scalar_stmt_cost; /* Cost of any scalar operation,
147 1.3 mrg excluding load and store. */
148 1.3 mrg const int scalar_load_cost; /* Cost of scalar load. */
149 1.3 mrg const int scalar_store_cost; /* Cost of scalar store. */
150 1.3 mrg const int vec_stmt_cost; /* Cost of any vector operation,
151 1.3 mrg excluding load, store,
152 1.3 mrg vector-to-scalar and
153 1.3 mrg scalar-to-vector operation. */
154 1.3 mrg const int vec_to_scalar_cost; /* Cost of vec-to-scalar operation. */
155 1.3 mrg const int scalar_to_vec_cost; /* Cost of scalar-to-vector
156 1.3 mrg operation. */
157 1.3 mrg const int vec_align_load_cost; /* Cost of aligned vector load. */
158 1.3 mrg const int vec_unalign_load_cost; /* Cost of unaligned vector load. */
159 1.3 mrg const int vec_unalign_store_cost; /* Cost of unaligned vector store. */
160 1.3 mrg const int vec_store_cost; /* Cost of vector store. */
161 1.3 mrg const int cond_taken_branch_cost; /* Cost of taken branch. */
162 1.3 mrg const int cond_not_taken_branch_cost; /* Cost of not taken branch. */
163 1.3 mrg };
164 1.3 mrg
165 1.1 mrg struct tune_params
166 1.1 mrg {
167 1.3 mrg const struct cpu_cost_table *const insn_extra_cost;
168 1.1 mrg const struct cpu_addrcost_table *const addr_cost;
169 1.1 mrg const struct cpu_regmove_cost *const regmove_cost;
170 1.3 mrg const struct cpu_vector_cost *const vec_costs;
171 1.1 mrg const int memmov_cost;
172 1.3 mrg const int issue_rate;
173 1.3 mrg const unsigned int fuseable_ops;
174 1.3 mrg const int function_align;
175 1.3 mrg const int jump_align;
176 1.3 mrg const int loop_align;
177 1.3 mrg const int int_reassoc_width;
178 1.3 mrg const int fp_reassoc_width;
179 1.3 mrg const int vec_reassoc_width;
180 1.1 mrg };
181 1.1 mrg
182 1.1 mrg HOST_WIDE_INT aarch64_initial_elimination_offset (unsigned, unsigned);
183 1.3 mrg int aarch64_get_condition_code (rtx);
184 1.3 mrg bool aarch64_bitmask_imm (HOST_WIDE_INT val, machine_mode);
185 1.3 mrg enum aarch64_symbol_type
186 1.3 mrg aarch64_classify_symbolic_expression (rtx, enum aarch64_symbol_context);
187 1.3 mrg bool aarch64_cannot_change_mode_class (machine_mode,
188 1.3 mrg machine_mode,
189 1.3 mrg enum reg_class);
190 1.3 mrg bool aarch64_const_vec_all_same_int_p (rtx, HOST_WIDE_INT);
191 1.1 mrg bool aarch64_constant_address_p (rtx);
192 1.3 mrg bool aarch64_expand_movmem (rtx *);
193 1.1 mrg bool aarch64_float_const_zero_rtx_p (rtx);
194 1.1 mrg bool aarch64_function_arg_regno_p (unsigned);
195 1.1 mrg bool aarch64_gen_movmemqi (rtx *);
196 1.3 mrg bool aarch64_gimple_fold_builtin (gimple_stmt_iterator *);
197 1.3 mrg bool aarch64_is_extend_from_extract (machine_mode, rtx, rtx);
198 1.1 mrg bool aarch64_is_long_call_p (rtx);
199 1.1 mrg bool aarch64_label_mentioned_p (rtx);
200 1.1 mrg bool aarch64_legitimate_pic_operand_p (rtx);
201 1.3 mrg bool aarch64_modes_tieable_p (machine_mode mode1,
202 1.3 mrg machine_mode mode2);
203 1.3 mrg bool aarch64_zero_extend_const_eq (machine_mode, rtx, machine_mode, rtx);
204 1.3 mrg bool aarch64_move_imm (HOST_WIDE_INT, machine_mode);
205 1.3 mrg bool aarch64_mov_operand_p (rtx, enum aarch64_symbol_context,
206 1.3 mrg machine_mode);
207 1.3 mrg int aarch64_simd_attr_length_rglist (enum machine_mode);
208 1.3 mrg rtx aarch64_reverse_mask (enum machine_mode);
209 1.3 mrg bool aarch64_offset_7bit_signed_scaled_p (machine_mode, HOST_WIDE_INT);
210 1.3 mrg char *aarch64_output_scalar_simd_mov_immediate (rtx, machine_mode);
211 1.3 mrg char *aarch64_output_simd_mov_immediate (rtx, machine_mode, unsigned);
212 1.3 mrg bool aarch64_pad_arg_upward (machine_mode, const_tree);
213 1.3 mrg bool aarch64_pad_reg_upward (machine_mode, const_tree, bool);
214 1.1 mrg bool aarch64_regno_ok_for_base_p (int, bool);
215 1.1 mrg bool aarch64_regno_ok_for_index_p (int, bool);
216 1.3 mrg bool aarch64_simd_check_vect_par_cnst_half (rtx op, machine_mode mode,
217 1.3 mrg bool high);
218 1.3 mrg bool aarch64_simd_imm_scalar_p (rtx x, machine_mode mode);
219 1.3 mrg bool aarch64_simd_imm_zero_p (rtx, machine_mode);
220 1.3 mrg bool aarch64_simd_scalar_immediate_valid_for_move (rtx, machine_mode);
221 1.3 mrg bool aarch64_simd_shift_imm_p (rtx, machine_mode, bool);
222 1.3 mrg bool aarch64_simd_valid_immediate (rtx, machine_mode, bool,
223 1.3 mrg struct simd_immediate_info *);
224 1.1 mrg bool aarch64_symbolic_address_p (rtx);
225 1.1 mrg bool aarch64_uimm12_shift (HOST_WIDE_INT);
226 1.3 mrg bool aarch64_use_return_insn_p (void);
227 1.3 mrg const char *aarch64_mangle_builtin_type (const_tree);
228 1.1 mrg const char *aarch64_output_casesi (rtx *);
229 1.3 mrg const char *aarch64_rewrite_selected_cpu (const char *name);
230 1.3 mrg
231 1.3 mrg enum aarch64_symbol_type aarch64_classify_symbol (rtx, rtx,
232 1.1 mrg enum aarch64_symbol_context);
233 1.1 mrg enum aarch64_symbol_type aarch64_classify_tls_symbol (rtx);
234 1.1 mrg enum reg_class aarch64_regno_regclass (unsigned);
235 1.1 mrg int aarch64_asm_preferred_eh_data_format (int, int);
236 1.3 mrg machine_mode aarch64_hard_regno_caller_save_mode (unsigned, unsigned,
237 1.3 mrg machine_mode);
238 1.3 mrg int aarch64_hard_regno_mode_ok (unsigned, machine_mode);
239 1.3 mrg int aarch64_hard_regno_nregs (unsigned, machine_mode);
240 1.3 mrg int aarch64_simd_attr_length_move (rtx_insn *);
241 1.1 mrg int aarch64_uxt_size (int, HOST_WIDE_INT);
242 1.1 mrg rtx aarch64_final_eh_return_addr (void);
243 1.3 mrg rtx aarch64_legitimize_reload_address (rtx *, machine_mode, int, int, int);
244 1.1 mrg const char *aarch64_output_move_struct (rtx *operands);
245 1.1 mrg rtx aarch64_return_addr (int, rtx);
246 1.3 mrg rtx aarch64_simd_gen_const_vector_dup (machine_mode, int);
247 1.1 mrg bool aarch64_simd_mem_operand_p (rtx);
248 1.3 mrg rtx aarch64_simd_vect_par_cnst_half (machine_mode, bool);
249 1.1 mrg rtx aarch64_tls_get_addr (void);
250 1.3 mrg tree aarch64_fold_builtin (tree, int, tree *, bool);
251 1.1 mrg unsigned aarch64_dbx_register_number (unsigned);
252 1.1 mrg unsigned aarch64_trampoline_size (void);
253 1.1 mrg void aarch64_asm_output_labelref (FILE *, const char *);
254 1.1 mrg void aarch64_elf_asm_named_section (const char *, unsigned, tree);
255 1.1 mrg void aarch64_expand_epilogue (bool);
256 1.1 mrg void aarch64_expand_mov_immediate (rtx, rtx);
257 1.1 mrg void aarch64_expand_prologue (void);
258 1.1 mrg void aarch64_expand_vector_init (rtx, rtx);
259 1.1 mrg void aarch64_init_cumulative_args (CUMULATIVE_ARGS *, const_tree, rtx,
260 1.1 mrg const_tree, unsigned);
261 1.1 mrg void aarch64_init_expanders (void);
262 1.1 mrg void aarch64_print_operand (FILE *, rtx, char);
263 1.1 mrg void aarch64_print_operand_address (FILE *, rtx);
264 1.3 mrg void aarch64_emit_call_insn (rtx);
265 1.1 mrg
266 1.1 mrg /* Initialize builtins for SIMD intrinsics. */
267 1.1 mrg void init_aarch64_simd_builtins (void);
268 1.1 mrg
269 1.3 mrg void aarch64_simd_emit_reg_reg_move (rtx *, enum machine_mode, unsigned int);
270 1.1 mrg
271 1.1 mrg /* Emit code to place a AdvSIMD pair result in memory locations (with equal
272 1.1 mrg registers). */
273 1.3 mrg void aarch64_simd_emit_pair_result_insn (machine_mode,
274 1.1 mrg rtx (*intfn) (rtx, rtx, rtx), rtx,
275 1.1 mrg rtx);
276 1.1 mrg
277 1.1 mrg /* Expand builtins for SIMD intrinsics. */
278 1.1 mrg rtx aarch64_simd_expand_builtin (int, tree, rtx);
279 1.1 mrg
280 1.3 mrg void aarch64_simd_lane_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT, const_tree);
281 1.1 mrg
282 1.1 mrg void aarch64_split_128bit_move (rtx, rtx);
283 1.1 mrg
284 1.1 mrg bool aarch64_split_128bit_move_p (rtx, rtx);
285 1.1 mrg
286 1.3 mrg void aarch64_split_simd_combine (rtx, rtx, rtx);
287 1.3 mrg
288 1.3 mrg void aarch64_split_simd_move (rtx, rtx);
289 1.3 mrg
290 1.1 mrg /* Check for a legitimate floating point constant for FMOV. */
291 1.1 mrg bool aarch64_float_const_representable_p (rtx);
292 1.1 mrg
293 1.1 mrg #if defined (RTX_CODE)
294 1.1 mrg
295 1.3 mrg bool aarch64_legitimate_address_p (machine_mode, rtx, RTX_CODE, bool);
296 1.3 mrg machine_mode aarch64_select_cc_mode (RTX_CODE, rtx, rtx);
297 1.1 mrg rtx aarch64_gen_compare_reg (RTX_CODE, rtx, rtx);
298 1.1 mrg rtx aarch64_load_tp (rtx);
299 1.1 mrg
300 1.1 mrg void aarch64_expand_compare_and_swap (rtx op[]);
301 1.1 mrg void aarch64_split_compare_and_swap (rtx op[]);
302 1.1 mrg void aarch64_split_atomic_op (enum rtx_code, rtx, rtx, rtx, rtx, rtx, rtx);
303 1.1 mrg
304 1.3 mrg bool aarch64_gen_adjusted_ldpstp (rtx *, bool, enum machine_mode, RTX_CODE);
305 1.1 mrg #endif /* RTX_CODE */
306 1.1 mrg
307 1.1 mrg void aarch64_init_builtins (void);
308 1.1 mrg rtx aarch64_expand_builtin (tree exp,
309 1.1 mrg rtx target,
310 1.1 mrg rtx subtarget ATTRIBUTE_UNUSED,
311 1.3 mrg machine_mode mode ATTRIBUTE_UNUSED,
312 1.1 mrg int ignore ATTRIBUTE_UNUSED);
313 1.1 mrg tree aarch64_builtin_decl (unsigned, bool ATTRIBUTE_UNUSED);
314 1.1 mrg
315 1.1 mrg tree
316 1.1 mrg aarch64_builtin_vectorized_function (tree fndecl,
317 1.1 mrg tree type_out,
318 1.1 mrg tree type_in);
319 1.1 mrg
320 1.1 mrg extern void aarch64_split_combinev16qi (rtx operands[3]);
321 1.1 mrg extern void aarch64_expand_vec_perm (rtx target, rtx op0, rtx op1, rtx sel);
322 1.3 mrg extern bool aarch64_madd_needs_nop (rtx_insn *);
323 1.3 mrg extern void aarch64_final_prescan_insn (rtx_insn *);
324 1.1 mrg extern bool
325 1.1 mrg aarch64_expand_vec_perm_const (rtx target, rtx op0, rtx op1, rtx sel);
326 1.3 mrg void aarch64_atomic_assign_expand_fenv (tree *, tree *, tree *);
327 1.3 mrg int aarch64_ccmp_mode_to_code (enum machine_mode mode);
328 1.1 mrg
329 1.3 mrg bool extract_base_offset_in_addr (rtx mem, rtx *base, rtx *offset);
330 1.3 mrg bool aarch64_operands_ok_for_ldpstp (rtx *, bool, enum machine_mode);
331 1.3 mrg bool aarch64_operands_adjust_ok_for_ldpstp (rtx *, bool, enum machine_mode);
332 1.1 mrg #endif /* GCC_AARCH64_PROTOS_H */
333