1 /* Prototypes of target machine for GNU compiler. LoongArch version.
2 Copyright (C) 2021-2022 Free Software Foundation, Inc.
3 Contributed by Loongson Ltd.
4 Based on MIPS target for GNU compiler.
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_LOONGARCH_PROTOS_H
23 #define GCC_LOONGARCH_PROTOS_H
25 /* Classifies a SYMBOL_REF, LABEL_REF or UNSPEC address.
28 The symbol's value will be loaded directly from the GOT.
31 A thread-local symbol.
35 UNSPEC wrappers around SYMBOL_TLS, corresponding to the
36 thread-local storage relocation operators.
38 enum loongarch_symbol_type
{
44 #define NUM_SYMBOL_TYPES (SYMBOL_TLSLDM + 1)
46 /* Routines implemented in loongarch.c. */
47 extern rtx
loongarch_emit_move (rtx
, rtx
);
48 extern HOST_WIDE_INT
loongarch_initial_elimination_offset (int, int);
49 extern void loongarch_expand_prologue (void);
50 extern void loongarch_expand_epilogue (bool);
51 extern bool loongarch_can_use_return_insn (void);
53 extern bool loongarch_symbolic_constant_p (rtx
, enum loongarch_symbol_type
*);
54 extern int loongarch_regno_mode_ok_for_base_p (int, machine_mode
, bool);
55 extern int loongarch_address_insns (rtx
, machine_mode
, bool);
56 extern int loongarch_const_insns (rtx
);
57 extern int loongarch_split_const_insns (rtx
);
58 extern int loongarch_split_128bit_const_insns (rtx
);
59 extern int loongarch_load_store_insns (rtx
, rtx_insn
*);
60 extern int loongarch_idiv_insns (machine_mode
);
62 extern void loongarch_emit_binary (enum rtx_code
, rtx
, rtx
, rtx
);
64 extern bool loongarch_split_symbol (rtx
, rtx
, machine_mode
, rtx
*);
65 extern rtx
loongarch_unspec_address (rtx
, enum loongarch_symbol_type
);
66 extern rtx
loongarch_strip_unspec_address (rtx
);
67 extern void loongarch_move_integer (rtx
, rtx
, unsigned HOST_WIDE_INT
);
68 extern bool loongarch_legitimize_move (machine_mode
, rtx
, rtx
);
69 extern rtx
loongarch_legitimize_call_address (rtx
);
71 extern rtx
loongarch_subword (rtx
, bool);
72 extern bool loongarch_split_move_p (rtx
, rtx
);
73 extern void loongarch_split_move (rtx
, rtx
, rtx
);
74 extern bool loongarch_split_move_insn_p (rtx
, rtx
);
75 extern void loongarch_split_move_insn (rtx
, rtx
, rtx
);
76 extern const char *loongarch_output_move (rtx
, rtx
);
77 extern bool loongarch_cfun_has_cprestore_slot_p (void);
79 extern void loongarch_expand_scc (rtx
*);
80 extern void loongarch_expand_conditional_branch (rtx
*);
81 extern void loongarch_expand_conditional_move (rtx
*);
82 extern void loongarch_expand_conditional_trap (rtx
);
84 extern void loongarch_set_return_address (rtx
, rtx
);
85 extern bool loongarch_move_by_pieces_p (unsigned HOST_WIDE_INT
, unsigned int);
86 extern bool loongarch_expand_block_move (rtx
, rtx
, rtx
);
87 extern bool loongarch_do_optimize_block_move_p (void);
89 extern bool loongarch_expand_ext_as_unaligned_load (rtx
, rtx
, HOST_WIDE_INT
,
91 extern bool loongarch_expand_ins_as_unaligned_store (rtx
, rtx
, HOST_WIDE_INT
,
93 extern HOST_WIDE_INT
loongarch_debugger_offset (rtx
, HOST_WIDE_INT
);
95 extern void loongarch_output_external (FILE *, tree
, const char *);
96 extern void loongarch_output_ascii (FILE *, const char *, size_t);
97 extern bool loongarch_small_data_pattern_p (rtx
);
98 extern rtx
loongarch_rewrite_small_data (rtx
);
99 extern rtx
loongarch_return_addr (int, rtx
);
101 extern enum reg_class
loongarch_secondary_reload_class (enum reg_class
,
104 extern int loongarch_class_max_nregs (enum reg_class
, machine_mode
);
106 extern machine_mode
loongarch_hard_regno_caller_save_mode (unsigned int,
109 extern int loongarch_adjust_insn_length (rtx_insn
*, int);
110 extern const char *loongarch_output_conditional_branch (rtx_insn
*, rtx
*,
113 extern const char *loongarch_output_order_conditional_branch (rtx_insn
*,
116 extern const char *loongarch_output_equal_conditional_branch (rtx_insn
*,
119 extern const char *loongarch_output_division (const char *, rtx
*);
120 extern const char *loongarch_output_probe_stack_range (rtx
, rtx
, rtx
);
121 extern bool loongarch_hard_regno_rename_ok (unsigned int, unsigned int);
122 extern int loongarch_dspalu_bypass_p (rtx
, rtx
);
123 extern rtx
loongarch_prefetch_cookie (rtx
, rtx
);
125 extern bool loongarch_global_symbol_p (const_rtx
);
126 extern bool loongarch_global_symbol_noweak_p (const_rtx
);
127 extern bool loongarch_weak_symbol_p (const_rtx
);
128 extern bool loongarch_symbol_binds_local_p (const_rtx
);
130 extern const char *current_section_name (void);
131 extern unsigned int current_section_flags (void);
132 extern bool loongarch_use_ins_ext_p (rtx
, HOST_WIDE_INT
, HOST_WIDE_INT
);
134 union loongarch_gen_fn_ptrs
136 rtx (*fn_8
) (rtx
, rtx
, rtx
, rtx
, rtx
, rtx
, rtx
, rtx
);
137 rtx (*fn_7
) (rtx
, rtx
, rtx
, rtx
, rtx
, rtx
, rtx
);
138 rtx (*fn_6
) (rtx
, rtx
, rtx
, rtx
, rtx
, rtx
);
139 rtx (*fn_5
) (rtx
, rtx
, rtx
, rtx
, rtx
);
140 rtx (*fn_4
) (rtx
, rtx
, rtx
, rtx
);
143 extern void loongarch_expand_atomic_qihi (union loongarch_gen_fn_ptrs
,
144 rtx
, rtx
, rtx
, rtx
, rtx
);
146 extern bool loongarch_signed_immediate_p (unsigned HOST_WIDE_INT
, int, int);
147 extern bool loongarch_unsigned_immediate_p (unsigned HOST_WIDE_INT
, int, int);
148 extern bool loongarch_12bit_offset_address_p (rtx
, machine_mode
);
149 extern bool loongarch_14bit_shifted_offset_address_p (rtx
, machine_mode
);
150 extern bool loongarch_base_index_address_p (rtx
, machine_mode
);
151 extern rtx
loongarch_expand_thread_pointer (rtx
);
153 extern bool loongarch_eh_uses (unsigned int);
154 extern bool loongarch_epilogue_uses (unsigned int);
155 extern bool loongarch_load_store_bonding_p (rtx
*, machine_mode
, bool);
156 extern bool loongarch_split_symbol_type (enum loongarch_symbol_type
);
158 typedef rtx (*mulsidi3_gen_fn
) (rtx
, rtx
, rtx
);
160 extern void loongarch_register_frame_header_opt (void);
162 /* Routines implemented in loongarch-c.c. */
163 void loongarch_cpu_cpp_builtins (cpp_reader
*);
165 extern void loongarch_init_builtins (void);
166 extern void loongarch_atomic_assign_expand_fenv (tree
*, tree
*, tree
*);
167 extern tree
loongarch_builtin_decl (unsigned int, bool);
168 extern rtx
loongarch_expand_builtin (tree
, rtx
, rtx subtarget ATTRIBUTE_UNUSED
,
170 extern tree
loongarch_build_builtin_va_list (void);
172 #endif /* ! GCC_LOONGARCH_PROTOS_H */