]>
Commit | Line | Data |
---|---|---|
2c04f847 BS |
1 | /* Internal to rs6000 type, variable, and function declarations and |
2 | definitons shared between the various rs6000 source files. | |
99dee823 | 3 | Copyright (C) 1991-2021 Free Software Foundation, Inc. |
2c04f847 BS |
4 | Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) |
5 | ||
6 | This file is part of GCC. | |
7 | ||
8 | GCC is free software; you can redistribute it and/or modify it | |
9 | under the terms of the GNU General Public License as published | |
10 | by the Free Software Foundation; either version 3, or (at your | |
11 | option) any later version. | |
12 | ||
13 | GCC is distributed in the hope that it will be useful, but WITHOUT | |
14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
15 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | |
16 | License for more details. | |
17 | ||
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/>. */ | |
21 | ||
22 | #ifndef GCC_RS6000_INTERNAL_H | |
23 | #define GCC_RS6000_INTERNAL_H | |
24 | ||
25 | /* Structure used to define the rs6000 stack */ | |
26 | typedef struct rs6000_stack { | |
27 | int reload_completed; /* stack info won't change from here on */ | |
28 | int first_gp_reg_save; /* first callee saved GP register used */ | |
29 | int first_fp_reg_save; /* first callee saved FP register used */ | |
30 | int first_altivec_reg_save; /* first callee saved AltiVec register used */ | |
31 | int lr_save_p; /* true if the link reg needs to be saved */ | |
32 | int cr_save_p; /* true if the CR reg needs to be saved */ | |
33 | unsigned int vrsave_mask; /* mask of vec registers to save */ | |
34 | int push_p; /* true if we need to allocate stack space */ | |
199baa71 | 35 | int calls_p; /* true if there are non-sibling calls */ |
2c04f847 BS |
36 | int world_save_p; /* true if we're saving *everything*: |
37 | r13-r31, cr, f14-f31, vrsave, v20-v31 */ | |
38 | enum rs6000_abi abi; /* which ABI to use */ | |
39 | int gp_save_offset; /* offset to save GP regs from initial SP */ | |
40 | int fp_save_offset; /* offset to save FP regs from initial SP */ | |
41 | int altivec_save_offset; /* offset to save AltiVec regs from initial SP */ | |
42 | int lr_save_offset; /* offset to save LR from initial SP */ | |
43 | int cr_save_offset; /* offset to save CR from initial SP */ | |
44 | int vrsave_save_offset; /* offset to save VRSAVE from initial SP */ | |
45 | int varargs_save_offset; /* offset to save the varargs registers */ | |
46 | int ehrd_offset; /* offset to EH return data */ | |
47 | int ehcr_offset; /* offset to EH CR field data */ | |
48 | int reg_size; /* register size (4 or 8) */ | |
49 | HOST_WIDE_INT vars_size; /* variable save area size */ | |
50 | int parm_size; /* outgoing parameter size */ | |
51 | int save_size; /* save area size */ | |
52 | int fixed_size; /* fixed size of stack frame */ | |
53 | int gp_size; /* size of saved GP registers */ | |
54 | int fp_size; /* size of saved FP registers */ | |
55 | int altivec_size; /* size of saved AltiVec registers */ | |
56 | int cr_size; /* size to hold CR if not in fixed area */ | |
57 | int vrsave_size; /* size to hold VRSAVE */ | |
58 | int altivec_padding_size; /* size of altivec alignment padding */ | |
59 | HOST_WIDE_INT total_size; /* total bytes allocated for stack */ | |
60 | int savres_strategy; | |
61 | } rs6000_stack_t; | |
62 | ||
63 | ||
64 | extern int need_toc_init; | |
65 | extern char toc_label_name[10]; | |
66 | extern int rs6000_pic_labelno; | |
2c04f847 BS |
67 | |
68 | #ifdef USING_ELFOS_H | |
69 | extern const char *rs6000_machine; | |
70 | #endif | |
71 | ||
72 | ||
73 | /* The VRSAVE bitmask puts bit %v0 as the most significant bit. */ | |
74 | #define ALTIVEC_REG_BIT(REGNO) (0x80000000 >> ((REGNO) - FIRST_ALTIVEC_REGNO)) | |
75 | ||
76 | ||
77 | /* Declare functions in rs6000-logue.c or called in rs6000.c | |
78 | from rs6000-logue.c */ | |
79 | ||
80 | extern int uses_TOC (void); | |
81 | extern bool rs6000_global_entry_point_needed_p (void); | |
82 | extern void rs6000_output_function_prologue (FILE *file); | |
83 | extern void rs6000_output_function_epilogue (FILE *file); | |
84 | extern bool rs6000_function_ok_for_sibcall (tree decl, tree exp); | |
85 | extern sbitmap rs6000_get_separate_components (void); | |
86 | extern sbitmap rs6000_components_for_bb (basic_block bb); | |
87 | extern void rs6000_disqualify_components (sbitmap components, edge e, | |
88 | sbitmap edge_components, | |
89 | bool /*is_prologue*/); | |
90 | extern void rs6000_emit_prologue_components (sbitmap components); | |
91 | extern void rs6000_emit_epilogue_components (sbitmap components); | |
92 | extern void rs6000_set_handled_components (sbitmap components); | |
93 | extern rs6000_stack_t * rs6000_stack_info (void); | |
2c04f847 BS |
94 | extern rtx rs6000_got_sym (void); |
95 | extern struct machine_function *rs6000_init_machine_status (void); | |
96 | extern bool save_reg_p (int reg); | |
97 | extern const char * rs6000_machine_from_flags (void); | |
98 | extern void emit_asm_machine (void); | |
99 | extern bool rs6000_global_entry_point_prologue_needed_p (void); | |
93a090cf | 100 | extern bool rs6000_keep_leaf_when_profiled (void); |
1acf0246 | 101 | extern void rs6000_live_on_entry (bitmap regs); |
2c04f847 BS |
102 | |
103 | /* Return true if the OFFSET is valid for the quad address instructions that | |
104 | use d-form (register + offset) addressing. */ | |
105 | ||
106 | static inline bool | |
107 | quad_address_offset_p (HOST_WIDE_INT offset) | |
108 | { | |
109 | return (IN_RANGE (offset, -32768, 32767) && ((offset) & 0xf) == 0); | |
110 | } | |
111 | ||
9ff33839 IS |
112 | /* Mach-O (Darwin) support for longcalls, emitted from rs6000-logue.c. */ |
113 | ||
114 | #if TARGET_MACHO | |
115 | ||
116 | typedef struct branch_island_d { | |
117 | tree function_name; | |
118 | tree label_name; | |
119 | int line_number; | |
120 | } branch_island; | |
121 | ||
122 | extern vec<branch_island, va_gc> *branch_islands; | |
123 | ||
124 | #endif | |
2c04f847 | 125 | |
1acf0246 BS |
126 | /* Declare functions in rs6000-call.c or called in rs6000.c |
127 | from rs6000-call.c */ | |
128 | extern int rs6000_darwin64_struct_check_p (machine_mode mode, const_tree type); | |
129 | extern bool rs6000_discover_homogeneous_aggregate (machine_mode mode, | |
130 | const_tree type, | |
131 | machine_mode *elt_mode, | |
132 | int *n_elts); | |
133 | extern void rs6000_output_mi_thunk (FILE *file, | |
134 | tree thunk_fndecl ATTRIBUTE_UNUSED, | |
135 | HOST_WIDE_INT delta, | |
136 | HOST_WIDE_INT vcall_offset, | |
137 | tree function); | |
138 | extern bool rs6000_output_addr_const_extra (FILE *file, rtx x); | |
139 | extern bool rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi); | |
1acf0246 BS |
140 | extern tree rs6000_build_builtin_va_list (void); |
141 | extern void rs6000_va_start (tree valist, rtx nextarg); | |
142 | extern tree rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, | |
143 | gimple_seq *post_p); | |
144 | extern machine_mode rs6000_promote_function_mode (const_tree type ATTRIBUTE_UNUSED, | |
145 | machine_mode mode, | |
146 | int *punsignedp ATTRIBUTE_UNUSED, | |
147 | const_tree, int); | |
148 | extern bool rs6000_return_in_memory (const_tree type, | |
149 | const_tree fntype ATTRIBUTE_UNUSED); | |
150 | extern bool rs6000_return_in_msb (const_tree valtype); | |
52090e4d RS |
151 | extern bool rs6000_pass_by_reference (cumulative_args_t, |
152 | const function_arg_info &); | |
e7056ca4 RS |
153 | extern void setup_incoming_varargs (cumulative_args_t, |
154 | const function_arg_info &, int *, int); | |
1acf0246 BS |
155 | extern unsigned int rs6000_function_arg_boundary (machine_mode mode, |
156 | const_tree type); | |
0ffef200 | 157 | extern bool rs6000_must_pass_in_stack (const function_arg_info &); |
a7c81bc1 RS |
158 | extern int rs6000_arg_partial_bytes (cumulative_args_t, |
159 | const function_arg_info &); | |
6930c98c RS |
160 | extern void rs6000_function_arg_advance (cumulative_args_t, |
161 | const function_arg_info &); | |
1acf0246 BS |
162 | extern pad_direction rs6000_function_arg_padding (machine_mode mode, |
163 | const_tree type); | |
6783fdb7 | 164 | extern rtx rs6000_function_arg (cumulative_args_t, const function_arg_info &); |
1acf0246 BS |
165 | extern rtx rs6000_darwin64_record_arg (CUMULATIVE_ARGS *, const_tree, |
166 | bool, bool); | |
167 | extern rtx rs6000_internal_arg_pointer (void); | |
168 | ||
169 | extern void rs6000_init_builtins (void); | |
170 | extern tree rs6000_builtin_decl (unsigned code, | |
171 | bool initialize_p ATTRIBUTE_UNUSED); | |
172 | extern rtx rs6000_expand_builtin (tree exp, rtx target, | |
173 | rtx subtarget ATTRIBUTE_UNUSED, | |
174 | machine_mode mode ATTRIBUTE_UNUSED, | |
175 | int ignore ATTRIBUTE_UNUSED); | |
176 | extern tree rs6000_fold_builtin (tree fndecl ATTRIBUTE_UNUSED, | |
177 | int n_args ATTRIBUTE_UNUSED, | |
178 | tree *args ATTRIBUTE_UNUSED, | |
179 | bool ignore ATTRIBUTE_UNUSED); | |
180 | ||
181 | #if TARGET_ELF | |
182 | extern bool rs6000_passes_ieee128; | |
183 | #endif | |
184 | extern bool rs6000_passes_float; | |
185 | extern bool rs6000_passes_long_double; | |
186 | extern bool rs6000_passes_vector; | |
187 | extern bool rs6000_returns_struct; | |
188 | extern bool cpu_builtin_p; | |
1acf0246 | 189 | |
2c04f847 | 190 | #endif |