recog_memoized works on an rtx_insn *
[official-gcc.git] / gcc / config / sh / sh-protos.h
blobde2ff90b3b85d44fdf2ce54e38b969a5b5a2a545
1 /* Definitions of target machine for GNU compiler for Renesas / SuperH SH.
2 Copyright (C) 1993-2014 Free Software Foundation, Inc.
3 Contributed by Steve Chamberlain (sac@cygnus.com).
4 Improved by Jim Wilson (wilson@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)
11 any later version.
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_SH_PROTOS_H
23 #define GCC_SH_PROTOS_H
25 enum sh_function_kind {
26 /* A function with normal C ABI */
27 FUNCTION_ORDINARY,
28 /* A special function that guarantees that some otherwise call-clobbered
29 registers are not clobbered. These can't go through the SH5 resolver,
30 because it only saves argument passing registers. */
31 SFUNC_GOT,
32 /* A special function that should be linked statically. These are typically
33 smaller or not much larger than a PLT entry.
34 Some also have a non-standard ABI which precludes dynamic linking. */
35 SFUNC_STATIC
38 /* Atomic model. */
39 struct sh_atomic_model
41 enum enum_type
43 none = 0,
44 soft_gusa,
45 hard_llcs,
46 soft_tcb,
47 soft_imask,
49 num_models
52 /* If strict is set, disallow mixing of different models, as it would
53 happen on SH4A. */
54 bool strict;
55 enum_type type;
57 /* Name string as it was specified on the command line. */
58 const char* name;
60 /* Name string as it is used in C/C++ defines. */
61 const char* cdef_name;
63 /* GBR offset variable for TCB model. */
64 int tcb_gbr_offset;
67 extern const sh_atomic_model& selected_atomic_model (void);
69 /* Shortcuts to check the currently selected atomic model. */
70 #define TARGET_ATOMIC_ANY \
71 selected_atomic_model ().type != sh_atomic_model::none
73 #define TARGET_ATOMIC_STRICT \
74 selected_atomic_model ().strict
76 #define TARGET_ATOMIC_SOFT_GUSA \
77 selected_atomic_model ().type == sh_atomic_model::soft_gusa
79 #define TARGET_ATOMIC_HARD_LLCS \
80 selected_atomic_model ().type == sh_atomic_model::hard_llcs
82 #define TARGET_ATOMIC_SOFT_TCB \
83 selected_atomic_model ().type == sh_atomic_model::soft_tcb
85 #define TARGET_ATOMIC_SOFT_TCB_GBR_OFFSET_RTX \
86 GEN_INT (selected_atomic_model ().tcb_gbr_offset)
88 #define TARGET_ATOMIC_SOFT_IMASK \
89 selected_atomic_model ().type == sh_atomic_model::soft_imask
91 #ifdef RTX_CODE
92 extern rtx sh_fsca_sf2int (void);
93 extern rtx sh_fsca_int2sf (void);
95 /* Declare functions defined in sh.c and used in templates. */
97 extern const char *output_branch (int, rtx, rtx *);
98 extern const char *output_ieee_ccmpeq (rtx_insn *, rtx *);
99 extern const char *output_branchy_insn (enum rtx_code, const char *,
100 rtx_insn *, rtx *);
101 extern const char *output_movedouble (rtx, rtx[], enum machine_mode);
102 extern const char *output_movepcrel (rtx, rtx[], enum machine_mode);
103 extern const char *output_far_jump (rtx_insn *, rtx);
105 extern rtx sfunc_uses_reg (rtx);
106 extern int barrier_align (rtx_insn *);
107 extern int sh_loop_align (rtx_insn *);
108 extern bool fp_zero_operand (rtx);
109 extern bool fp_one_operand (rtx);
110 extern rtx get_fpscr_rtx (void);
111 extern bool sh_legitimate_index_p (enum machine_mode, rtx, bool, bool);
112 extern bool sh_legitimize_reload_address (rtx *, enum machine_mode, int, int);
113 extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx);
114 extern bool nonpic_symbol_mentioned_p (rtx);
115 extern void emit_sf_insn (rtx);
116 extern void emit_df_insn (rtx);
117 extern void output_pic_addr_const (FILE *, rtx);
118 extern bool expand_block_move (rtx *);
119 extern void prepare_move_operands (rtx[], enum machine_mode mode);
120 extern bool sh_expand_cmpstr (rtx *);
121 extern bool sh_expand_cmpnstr (rtx *);
122 extern bool sh_expand_strlen (rtx *);
123 extern void sh_expand_setmem (rtx *);
124 extern enum rtx_code prepare_cbranch_operands (rtx *, enum machine_mode mode,
125 enum rtx_code comparison);
126 extern void expand_cbranchsi4 (rtx *operands, enum rtx_code comparison, int);
127 extern bool expand_cbranchdi4 (rtx *operands, enum rtx_code comparison);
128 extern void sh_emit_scc_to_t (enum rtx_code, rtx, rtx);
129 extern rtx sh_emit_cheap_store_flag (enum machine_mode, enum rtx_code, rtx, rtx);
130 extern void sh_emit_compare_and_branch (rtx *, enum machine_mode);
131 extern void sh_emit_compare_and_set (rtx *, enum machine_mode);
132 extern bool sh_ashlsi_clobbers_t_reg_p (rtx);
133 extern bool sh_lshrsi_clobbers_t_reg_p (rtx);
134 extern void gen_shifty_op (int, rtx *);
135 extern void gen_shifty_hi_op (int, rtx *);
136 extern bool expand_ashiftrt (rtx *);
137 extern bool sh_dynamicalize_shift_p (rtx);
138 extern int shl_and_kind (rtx, rtx, int *);
139 extern int shl_and_length (rtx);
140 extern int shl_and_scr_length (rtx);
141 extern bool gen_shl_and (rtx, rtx, rtx, rtx);
142 extern int shl_sext_kind (rtx, rtx, int *);
143 extern int shl_sext_length (rtx);
144 extern bool gen_shl_sext (rtx, rtx, rtx, rtx);
145 extern rtx gen_datalabel_ref (rtx);
146 extern int regs_used (rtx, int);
147 extern void fixup_addr_diff_vecs (rtx_insn *);
148 extern int get_dest_uid (rtx, int);
149 extern void final_prescan_insn (rtx_insn *, rtx *, int);
150 extern enum tls_model tls_symbolic_operand (rtx, enum machine_mode);
151 extern bool system_reg_operand (rtx, enum machine_mode);
152 extern bool reg_unused_after (rtx, rtx_insn *);
153 extern void expand_sf_unop (rtx (*)(rtx, rtx, rtx), rtx *);
154 extern void expand_sf_binop (rtx (*)(rtx, rtx, rtx, rtx), rtx *);
155 extern void expand_df_unop (rtx (*)(rtx, rtx, rtx), rtx *);
156 extern void expand_df_binop (rtx (*)(rtx, rtx, rtx, rtx), rtx *);
157 extern int sh_insn_length_adjustment (rtx_insn *);
158 extern bool sh_can_redirect_branch (rtx_insn *, rtx_insn *);
159 extern void sh_expand_unop_v2sf (enum rtx_code, rtx, rtx);
160 extern void sh_expand_binop_v2sf (enum rtx_code, rtx, rtx, rtx);
161 extern bool sh_expand_t_scc (rtx *);
162 extern rtx sh_gen_truncate (enum machine_mode, rtx, int);
163 extern bool sh_vector_mode_supported_p (enum machine_mode);
164 extern bool sh_cfun_trap_exit_p (void);
165 extern rtx sh_find_equiv_gbr_addr (rtx cur_insn, rtx mem);
166 extern int sh_eval_treg_value (rtx op);
167 extern HOST_WIDE_INT sh_disp_addr_displacement (rtx mem_op);
168 extern int sh_max_mov_insn_displacement (machine_mode mode, bool consider_sh2a);
170 /* Result value of sh_find_set_of_reg. */
171 struct set_of_reg
173 /* The insn where sh_find_set_of_reg stopped looking.
174 Can be NULL_RTX if the end of the insn list was reached. */
175 rtx insn;
177 /* The set rtx of the specified reg if found, NULL_RTX otherwise. */
178 const_rtx set_rtx;
180 /* The set source rtx of the specified reg if found, NULL_RTX otherwise.
181 Usually, this is the most interesting return value. */
182 rtx set_src;
185 extern set_of_reg sh_find_set_of_reg (rtx reg, rtx insn, rtx_insn *(*stepfunc)(rtx));
186 extern bool sh_is_logical_t_store_expr (rtx op, rtx insn);
187 extern rtx sh_try_omit_signzero_extend (rtx extended_op, rtx insn);
188 #endif /* RTX_CODE */
190 extern void sh_cpu_cpp_builtins (cpp_reader* pfile);
192 extern const char *output_jump_label_table (void);
193 extern rtx get_t_reg_rtx (void);
194 extern rtx get_fpscr_rtx (void);
195 extern int sh_media_register_for_return (void);
196 extern void sh_expand_prologue (void);
197 extern void sh_expand_epilogue (bool);
198 extern void sh_set_return_address (rtx, rtx);
199 extern int initial_elimination_offset (int, int);
200 extern bool fldi_ok (void);
201 extern bool sh_hard_regno_rename_ok (unsigned int, unsigned int);
202 extern bool sh_cfun_interrupt_handler_p (void);
203 extern bool sh_cfun_resbank_handler_p (void);
204 extern bool sh_attr_renesas_p (const_tree);
205 extern bool sh_cfun_attr_renesas_p (void);
206 extern bool sh_cannot_change_mode_class
207 (enum machine_mode, enum machine_mode, enum reg_class);
208 extern bool sh_small_register_classes_for_mode_p (enum machine_mode);
209 extern void sh_mark_label (rtx, int);
210 extern bool check_use_sfunc_addr (rtx_insn *, rtx);
212 #ifdef HARD_CONST
213 extern void fpscr_set_from_mem (int, HARD_REG_SET);
214 #endif
216 extern void sh_pr_interrupt (struct cpp_reader *);
217 extern void sh_pr_trapa (struct cpp_reader *);
218 extern void sh_pr_nosave_low_regs (struct cpp_reader *);
219 extern rtx function_symbol (rtx, const char *, enum sh_function_kind);
220 extern rtx sh_get_pr_initial_val (void);
222 extern void sh_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree,
223 signed int, enum machine_mode);
224 extern rtx sh_dwarf_register_span (rtx);
226 extern rtx replace_n_hard_rtx (rtx, rtx *, int , int);
227 extern int shmedia_cleanup_truncate (rtx *, void *);
229 extern bool sh_contains_memref_p (rtx);
230 extern bool sh_loads_bankedreg_p (rtx);
231 extern rtx shmedia_prepare_call_address (rtx fnaddr, int is_sibcall);
232 extern int sh2a_get_function_vector_number (rtx);
233 extern bool sh2a_is_function_vector_call (rtx);
234 extern void sh_fix_range (const char *);
235 extern bool sh_hard_regno_mode_ok (unsigned int, enum machine_mode);
236 extern bool sh_can_use_simple_return_p (void);
237 #endif /* ! GCC_SH_PROTOS_H */