aarch64-protos.h revision 1.1 1 1.1 mrg /* Machine description for AArch64 architecture.
2 1.1 mrg Copyright (C) 2009-2013 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.1 mrg SYMBOL_FORCE_TO_MEM : Global variables are addressed using
72 1.1 mrg constant pool. All variable addresses are spilled into constant
73 1.1 mrg pools. The constant pools themselves are addressed using PC
74 1.1 mrg relative accesses. This only works for the large code model.
75 1.1 mrg */
76 1.1 mrg enum aarch64_symbol_type
77 1.1 mrg {
78 1.1 mrg SYMBOL_SMALL_ABSOLUTE,
79 1.1 mrg SYMBOL_SMALL_GOT,
80 1.1 mrg SYMBOL_SMALL_TLSGD,
81 1.1 mrg SYMBOL_SMALL_TLSDESC,
82 1.1 mrg SYMBOL_SMALL_GOTTPREL,
83 1.1 mrg SYMBOL_SMALL_TPREL,
84 1.1 mrg SYMBOL_FORCE_TO_MEM
85 1.1 mrg };
86 1.1 mrg
87 1.1 mrg /* A set of tuning parameters contains references to size and time
88 1.1 mrg cost models and vectors for address cost calculations, register
89 1.1 mrg move costs and memory move costs. */
90 1.1 mrg
91 1.1 mrg /* Extra costs for specific insns. Only records the cost above a
92 1.1 mrg single insn. */
93 1.1 mrg
94 1.1 mrg struct cpu_rtx_cost_table
95 1.1 mrg {
96 1.1 mrg const int memory_load;
97 1.1 mrg const int memory_store;
98 1.1 mrg const int register_shift;
99 1.1 mrg const int int_divide;
100 1.1 mrg const int float_divide;
101 1.1 mrg const int double_divide;
102 1.1 mrg const int int_multiply;
103 1.1 mrg const int int_multiply_extend;
104 1.1 mrg const int int_multiply_add;
105 1.1 mrg const int int_multiply_extend_add;
106 1.1 mrg const int float_multiply;
107 1.1 mrg const int double_multiply;
108 1.1 mrg };
109 1.1 mrg
110 1.1 mrg /* Additional cost for addresses. */
111 1.1 mrg struct cpu_addrcost_table
112 1.1 mrg {
113 1.1 mrg const int pre_modify;
114 1.1 mrg const int post_modify;
115 1.1 mrg const int register_offset;
116 1.1 mrg const int register_extend;
117 1.1 mrg const int imm_offset;
118 1.1 mrg };
119 1.1 mrg
120 1.1 mrg /* Additional costs for register copies. Cost is for one register. */
121 1.1 mrg struct cpu_regmove_cost
122 1.1 mrg {
123 1.1 mrg const int GP2GP;
124 1.1 mrg const int GP2FP;
125 1.1 mrg const int FP2GP;
126 1.1 mrg const int FP2FP;
127 1.1 mrg };
128 1.1 mrg
129 1.1 mrg struct tune_params
130 1.1 mrg {
131 1.1 mrg const struct cpu_rtx_cost_table *const insn_extra_cost;
132 1.1 mrg const struct cpu_addrcost_table *const addr_cost;
133 1.1 mrg const struct cpu_regmove_cost *const regmove_cost;
134 1.1 mrg const int memmov_cost;
135 1.1 mrg };
136 1.1 mrg
137 1.1 mrg HOST_WIDE_INT aarch64_initial_elimination_offset (unsigned, unsigned);
138 1.1 mrg bool aarch64_bitmask_imm (HOST_WIDE_INT val, enum machine_mode);
139 1.1 mrg bool aarch64_constant_address_p (rtx);
140 1.1 mrg bool aarch64_float_const_zero_rtx_p (rtx);
141 1.1 mrg bool aarch64_function_arg_regno_p (unsigned);
142 1.1 mrg bool aarch64_gen_movmemqi (rtx *);
143 1.1 mrg bool aarch64_is_extend_from_extract (enum machine_mode, rtx, rtx);
144 1.1 mrg bool aarch64_is_long_call_p (rtx);
145 1.1 mrg bool aarch64_label_mentioned_p (rtx);
146 1.1 mrg bool aarch64_legitimate_pic_operand_p (rtx);
147 1.1 mrg bool aarch64_move_imm (HOST_WIDE_INT, enum machine_mode);
148 1.1 mrg bool aarch64_pad_arg_upward (enum machine_mode, const_tree);
149 1.1 mrg bool aarch64_pad_reg_upward (enum machine_mode, const_tree, bool);
150 1.1 mrg bool aarch64_regno_ok_for_base_p (int, bool);
151 1.1 mrg bool aarch64_regno_ok_for_index_p (int, bool);
152 1.1 mrg bool aarch64_simd_imm_scalar_p (rtx x, enum machine_mode mode);
153 1.1 mrg bool aarch64_simd_imm_zero_p (rtx, enum machine_mode);
154 1.1 mrg bool aarch64_simd_shift_imm_p (rtx, enum machine_mode, bool);
155 1.1 mrg bool aarch64_symbolic_address_p (rtx);
156 1.1 mrg bool aarch64_symbolic_constant_p (rtx, enum aarch64_symbol_context,
157 1.1 mrg enum aarch64_symbol_type *);
158 1.1 mrg bool aarch64_uimm12_shift (HOST_WIDE_INT);
159 1.1 mrg const char *aarch64_output_casesi (rtx *);
160 1.1 mrg enum aarch64_symbol_type aarch64_classify_symbol (rtx,
161 1.1 mrg enum aarch64_symbol_context);
162 1.1 mrg enum aarch64_symbol_type aarch64_classify_tls_symbol (rtx);
163 1.1 mrg enum reg_class aarch64_regno_regclass (unsigned);
164 1.1 mrg int aarch64_asm_preferred_eh_data_format (int, int);
165 1.1 mrg int aarch64_hard_regno_mode_ok (unsigned, enum machine_mode);
166 1.1 mrg int aarch64_hard_regno_nregs (unsigned, enum machine_mode);
167 1.1 mrg int aarch64_simd_attr_length_move (rtx);
168 1.1 mrg int aarch64_simd_immediate_valid_for_move (rtx, enum machine_mode, rtx *,
169 1.1 mrg int *, unsigned char *, int *,
170 1.1 mrg int *);
171 1.1 mrg int aarch64_uxt_size (int, HOST_WIDE_INT);
172 1.1 mrg rtx aarch64_final_eh_return_addr (void);
173 1.1 mrg rtx aarch64_legitimize_reload_address (rtx *, enum machine_mode, int, int, int);
174 1.1 mrg const char *aarch64_output_move_struct (rtx *operands);
175 1.1 mrg rtx aarch64_return_addr (int, rtx);
176 1.1 mrg rtx aarch64_simd_gen_const_vector_dup (enum machine_mode, int);
177 1.1 mrg bool aarch64_simd_mem_operand_p (rtx);
178 1.1 mrg rtx aarch64_simd_vect_par_cnst_half (enum machine_mode, bool);
179 1.1 mrg rtx aarch64_tls_get_addr (void);
180 1.1 mrg unsigned aarch64_dbx_register_number (unsigned);
181 1.1 mrg unsigned aarch64_trampoline_size (void);
182 1.1 mrg void aarch64_asm_output_labelref (FILE *, const char *);
183 1.1 mrg void aarch64_elf_asm_named_section (const char *, unsigned, tree);
184 1.1 mrg void aarch64_expand_epilogue (bool);
185 1.1 mrg void aarch64_expand_mov_immediate (rtx, rtx);
186 1.1 mrg void aarch64_expand_prologue (void);
187 1.1 mrg void aarch64_expand_vector_init (rtx, rtx);
188 1.1 mrg void aarch64_function_profiler (FILE *, int);
189 1.1 mrg void aarch64_init_cumulative_args (CUMULATIVE_ARGS *, const_tree, rtx,
190 1.1 mrg const_tree, unsigned);
191 1.1 mrg void aarch64_init_expanders (void);
192 1.1 mrg void aarch64_print_operand (FILE *, rtx, char);
193 1.1 mrg void aarch64_print_operand_address (FILE *, rtx);
194 1.1 mrg
195 1.1 mrg /* Initialize builtins for SIMD intrinsics. */
196 1.1 mrg void init_aarch64_simd_builtins (void);
197 1.1 mrg
198 1.1 mrg void aarch64_simd_const_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
199 1.1 mrg void aarch64_simd_disambiguate_copy (rtx *, rtx *, rtx *, unsigned int);
200 1.1 mrg
201 1.1 mrg /* Emit code to place a AdvSIMD pair result in memory locations (with equal
202 1.1 mrg registers). */
203 1.1 mrg void aarch64_simd_emit_pair_result_insn (enum machine_mode,
204 1.1 mrg rtx (*intfn) (rtx, rtx, rtx), rtx,
205 1.1 mrg rtx);
206 1.1 mrg
207 1.1 mrg /* Expand builtins for SIMD intrinsics. */
208 1.1 mrg rtx aarch64_simd_expand_builtin (int, tree, rtx);
209 1.1 mrg
210 1.1 mrg void aarch64_simd_lane_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
211 1.1 mrg
212 1.1 mrg /* Emit code for reinterprets. */
213 1.1 mrg void aarch64_simd_reinterpret (rtx, rtx);
214 1.1 mrg
215 1.1 mrg void aarch64_split_128bit_move (rtx, rtx);
216 1.1 mrg
217 1.1 mrg bool aarch64_split_128bit_move_p (rtx, rtx);
218 1.1 mrg
219 1.1 mrg /* Check for a legitimate floating point constant for FMOV. */
220 1.1 mrg bool aarch64_float_const_representable_p (rtx);
221 1.1 mrg
222 1.1 mrg #if defined (RTX_CODE)
223 1.1 mrg
224 1.1 mrg bool aarch64_legitimate_address_p (enum machine_mode, rtx, RTX_CODE, bool);
225 1.1 mrg enum machine_mode aarch64_select_cc_mode (RTX_CODE, rtx, rtx);
226 1.1 mrg rtx aarch64_gen_compare_reg (RTX_CODE, rtx, rtx);
227 1.1 mrg rtx aarch64_load_tp (rtx);
228 1.1 mrg
229 1.1 mrg void aarch64_expand_compare_and_swap (rtx op[]);
230 1.1 mrg void aarch64_split_compare_and_swap (rtx op[]);
231 1.1 mrg void aarch64_split_atomic_op (enum rtx_code, rtx, rtx, rtx, rtx, rtx, rtx);
232 1.1 mrg
233 1.1 mrg #endif /* RTX_CODE */
234 1.1 mrg
235 1.1 mrg void aarch64_init_builtins (void);
236 1.1 mrg rtx aarch64_expand_builtin (tree exp,
237 1.1 mrg rtx target,
238 1.1 mrg rtx subtarget ATTRIBUTE_UNUSED,
239 1.1 mrg enum machine_mode mode ATTRIBUTE_UNUSED,
240 1.1 mrg int ignore ATTRIBUTE_UNUSED);
241 1.1 mrg tree aarch64_builtin_decl (unsigned, bool ATTRIBUTE_UNUSED);
242 1.1 mrg
243 1.1 mrg tree
244 1.1 mrg aarch64_builtin_vectorized_function (tree fndecl,
245 1.1 mrg tree type_out,
246 1.1 mrg tree type_in);
247 1.1 mrg
248 1.1 mrg extern void aarch64_split_combinev16qi (rtx operands[3]);
249 1.1 mrg extern void aarch64_expand_vec_perm (rtx target, rtx op0, rtx op1, rtx sel);
250 1.1 mrg extern bool aarch64_madd_needs_nop (rtx);
251 1.1 mrg extern void aarch64_final_prescan_insn (rtx);
252 1.1 mrg extern bool
253 1.1 mrg aarch64_expand_vec_perm_const (rtx target, rtx op0, rtx op1, rtx sel);
254 1.1 mrg
255 1.1 mrg char* aarch64_output_simd_mov_immediate (rtx *, enum machine_mode, unsigned);
256 1.1 mrg #endif /* GCC_AARCH64_PROTOS_H */
257