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