1 /* Definitions of target machine for GNU compiler.
2    Renesas H8/300 version
3    Copyright (C) 2000-2021 Free Software Foundation, Inc.
4    Contributed by Steve Chamberlain (sac@cygnus.com),
5    Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.com).
6 
7 This file is part of GCC.
8 
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
13 
14 GCC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3.  If not see
21 <http://www.gnu.org/licenses/>.  */
22 
23 #ifndef GCC_H8300_PROTOS_H
24 #define GCC_H8300_PROTOS_H
25 
26 /* Declarations for functions used in insn-output.c.  */
27 #ifdef RTX_CODE
28 extern unsigned int compute_mov_length (rtx *);
29 extern const char *output_plussi (rtx *, bool);
30 extern unsigned int compute_plussi_length (rtx *, bool);
31 extern const char *output_a_shift (rtx *);
32 extern unsigned int compute_a_shift_length (rtx, rtx *);
33 extern const char *output_a_rotate (enum rtx_code, rtx *);
34 extern unsigned int compute_a_rotate_length (rtx *);
35 extern const char *output_simode_bld (int, rtx[]);
36 extern void final_prescan_insn (rtx_insn *, rtx *, int);
37 extern int h8300_expand_movsi (rtx[]);
38 extern machine_mode  h8300_select_cc_mode (RTX_CODE, rtx, rtx);
39 extern void notice_update_cc (rtx, rtx_insn *);
40 extern const char *output_logical_op (machine_mode, rtx *);
41 extern unsigned int compute_logical_op_length (machine_mode,
42 					       rtx *);
43 
44 extern int compute_logical_op_cc (machine_mode, rtx *);
45 extern int compute_a_shift_cc (rtx, rtx *);
46 #ifdef HAVE_ATTR_cc
47 extern enum attr_cc compute_plussi_cc (rtx *);
48 #endif
49 extern void h8300_expand_branch (rtx[]);
50 extern void h8300_expand_store (rtx[]);
51 extern bool expand_a_shift (machine_mode, enum rtx_code, rtx[]);
52 extern int h8300_shift_needs_scratch_p (int, machine_mode, rtx_code);
53 extern int expand_a_rotate (rtx[]);
54 extern int fix_bit_operand (rtx *, enum rtx_code);
55 extern int h8300_adjust_insn_length (rtx, int);
56 extern void split_adds_subs (machine_mode, rtx[]);
57 
58 extern int h8300_eightbit_constant_address_p (rtx);
59 extern int h8300_tiny_constant_address_p (rtx);
60 extern int byte_accesses_mergeable_p (rtx, rtx);
61 extern int same_cmp_preceding_p (rtx_insn *);
62 extern int same_cmp_following_p (rtx_insn *);
63 
64 /* Used in builtins.c */
65 extern rtx h8300_return_addr_rtx (int, rtx);
66 
67 /* Classifies an h8sx shift operation.
68 
69    H8SX_SHIFT_NONE
70 	The shift cannot be done in a single instruction.
71 
72    H8SX_SHIFT_UNARY
73 	The shift is effectively a unary operation.  The instruction will
74 	allow any sort of destination operand and have a format similar
75 	to neg and not.  This is true of certain power-of-2 shifts.
76 
77    H8SX_SHIFT_BINARY
78 	The shift is a binary operation.  The destination must be a
79 	register and the source can be a register or a constant.  */
80 enum h8sx_shift_type {
81   H8SX_SHIFT_NONE,
82   H8SX_SHIFT_UNARY,
83   H8SX_SHIFT_BINARY
84 };
85 
86 extern enum h8sx_shift_type h8sx_classify_shift (machine_mode, enum rtx_code, rtx);
87 extern int h8300_ldm_stm_parallel (rtvec, int, int);
88 #endif /* RTX_CODE */
89 
90 #ifdef TREE_CODE
91 extern int h8300_funcvec_function_p (tree);
92 extern int h8300_eightbit_data_p (tree);
93 extern int h8300_tiny_data_p (tree);
94 #endif /* TREE_CODE */
95 
96 extern int h8300_can_use_return_insn_p (void);
97 extern void h8300_expand_prologue (void);
98 extern void h8300_expand_epilogue (void);
99 extern int h8300_current_function_interrupt_function_p (void);
100 extern int h8300_current_function_monitor_function_p (void);
101 extern int h8300_initial_elimination_offset (int, int);
102 extern int h8300_regs_ok_for_stm (int, rtx[]);
103 extern int h8300_hard_regno_rename_ok (unsigned int, unsigned int);
104 extern bool h8300_move_ok (rtx, rtx);
105 
106 struct cpp_reader;
107 extern void h8300_pr_interrupt (struct cpp_reader *);
108 extern void h8300_pr_saveall (struct cpp_reader *);
109 extern enum reg_class  h8300_reg_class_from_letter (int);
110 extern unsigned int    h8300_insn_length_from_table (rtx_insn *, rtx *);
111 extern const char *    output_h8sx_shift (rtx *, int, int);
112 extern bool            h8300_operands_match_p (rtx *);
113 extern bool            h8sx_mergeable_memrefs_p (rtx, rtx);
114 extern poly_int64      h8300_push_rounding (poly_int64);
115 
116 #endif /* ! GCC_H8300_PROTOS_H */
117