GCC Middle and Back End API Reference
explow.h
Go to the documentation of this file.
1/* Export function prototypes from explow.cc.
2 Copyright (C) 2015-2024 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_EXPLOW_H
21#define GCC_EXPLOW_H
22
23/* Return a memory reference like MEMREF, but which is known to have a
24 valid address. */
25extern rtx validize_mem (rtx);
26
28
29/* Copy given rtx to a new temp reg and return that. */
30extern rtx copy_to_reg (rtx);
31
32/* Like copy_to_reg but always make the reg Pmode. */
33extern rtx copy_addr_to_reg (rtx);
34
35/* Like copy_to_reg but always make the reg the specified mode MODE. */
36extern rtx copy_to_mode_reg (machine_mode, rtx);
37
38/* Copy given rtx to given temp reg and return that. */
39extern rtx copy_to_suggested_reg (rtx, rtx, machine_mode);
40
41/* Copy a value to a register if it isn't already a register.
42 Args are mode (in case value is a constant) and the value. */
43extern rtx force_reg (machine_mode, rtx);
44
45extern rtx force_subreg (machine_mode, rtx, machine_mode, poly_uint64);
46extern rtx force_lowpart_subreg (machine_mode, rtx, machine_mode);
47extern rtx force_highpart_subreg (machine_mode, rtx, machine_mode);
48
49/* Return given rtx, copied into a new temp reg if it was in memory. */
50extern rtx force_not_mem (rtx);
51
52/* Return mode and signedness to use when an argument or result in the
53 given mode is promoted. */
54extern machine_mode promote_function_mode (const_tree, machine_mode, int *,
55 const_tree, int);
56
57/* Return mode and signedness to use when an object in the given mode
58 is promoted. */
59extern machine_mode promote_mode (const_tree, machine_mode, int *);
60
61/* Return mode and signedness to use when object is promoted. */
62machine_mode promote_decl_mode (const_tree, int *);
63
64/* Return mode and signedness to use when object is promoted. */
65machine_mode promote_ssa_mode (const_tree, int *);
66
67/* Remove some bytes from the stack. An rtx says how many. */
68extern void adjust_stack (rtx);
69
70/* Add some bytes to the stack. An rtx says how many. */
71extern void anti_adjust_stack (rtx);
72
73/* Add some bytes to the stack while probing it. An rtx says how many. */
74extern void anti_adjust_stack_and_probe (rtx, bool);
75
76/* Add some bytes to the stack while probing it. An rtx says how
77 many. Add additional probes to prevent stack clashing attacks. */
79
80/* Support for building allocation/probing loops for stack-clash
81 protection of dyamically allocated stack space. */
83 HOST_WIDE_INT *, rtx);
85 rtx, bool);
87 rtx, bool);
88
89/* This enum is used for the following two functions. */
91
92/* Save the stack pointer at the specified level. */
93extern void emit_stack_save (enum save_level, rtx *);
94
95/* Restore the stack pointer from a save area of the specified level. */
96extern void emit_stack_restore (enum save_level, rtx);
97
98/* Invoke emit_stack_save for the nonlocal_goto_save_area. */
99extern void update_nonlocal_goto_save_area (void);
100
101/* Record a new stack level. */
102extern void record_new_stack_level (void);
103
104/* Allocate some space on the stack dynamically and return its address. */
105extern rtx allocate_dynamic_stack_space (rtx, unsigned, unsigned,
106 HOST_WIDE_INT, bool);
107
108/* Calculate the necessary size of a constant dynamic stack allocation from the
109 size of the variable area. */
110extern void get_dynamic_stack_size (rtx *, unsigned, unsigned, HOST_WIDE_INT *);
111
112/* Returns the address of the dynamic stack space without allocating it. */
113extern rtx get_dynamic_stack_base (poly_int64, unsigned, rtx);
114
115/* Return an rtx doing runtime alignment to REQUIRED_ALIGN on TARGET. */
116extern rtx align_dynamic_address (rtx, unsigned);
117
118/* Emit one stack probe at ADDRESS, an address within the stack. */
119extern void emit_stack_probe (rtx);
120
121/* Probe a range of stack addresses from FIRST to FIRST+SIZE, inclusive.
122 FIRST is a constant and size is a Pmode RTX. These are offsets from
123 the current stack pointer. STACK_GROWS_DOWNWARD says whether to add
124 or subtract them from the stack pointer. */
125extern void probe_stack_range (HOST_WIDE_INT, rtx);
126
127/* Return an rtx that refers to the value returned by a library call
128 in its original home. This becomes invalid if any more code is emitted. */
129extern rtx hard_libcall_value (machine_mode, rtx);
130
131/* Return an rtx that refers to the value returned by a function
132 in its original home. This becomes invalid if any more code is emitted. */
134
135/* Convert arg to a valid memory address for specified machine mode that points
136 to a specific named address space, by emitting insns to perform arithmetic
137 if necessary. */
138extern rtx memory_address_addr_space (machine_mode, rtx, addr_space_t);
139
141
142/* Like memory_address_addr_space, except assume the memory address points to
143 the generic named address space. */
144#define memory_address(MODE,RTX) \
145 memory_address_addr_space ((MODE), (RTX), ADDR_SPACE_GENERIC)
146
147#endif /* GCC_EXPLOW_H */
unsigned char addr_space_t
Definition coretypes.h:184
const union tree_node * const_tree
Definition coretypes.h:98
rtx copy_to_reg(rtx)
Definition explow.cc:620
void adjust_stack(rtx)
Definition explow.cc:1016
void emit_stack_clash_protection_probe_loop_end(rtx, rtx, rtx, bool)
Definition explow.cc:2012
rtx force_reg(machine_mode, rtx)
Definition explow.cc:672
rtx copy_addr_to_reg(rtx)
Definition explow.cc:639
rtx hard_libcall_value(machine_mode, rtx)
Definition explow.cc:2341
rtx memory_address_addr_space(machine_mode, rtx, addr_space_t)
Definition explow.cc:438
void emit_stack_probe(rtx)
Definition explow.cc:1719
void compute_stack_clash_protection_loop_data(rtx *, rtx *, rtx *, HOST_WIDE_INT *, rtx)
Definition explow.cc:1931
void emit_stack_restore(enum save_level, rtx)
rtx copy_to_suggested_reg(rtx, rtx, machine_mode)
Definition explow.cc:820
rtx eliminate_constant_term(rtx, rtx *)
Definition explow.cc:217
rtx align_dynamic_address(rtx, unsigned)
Definition explow.cc:1249
rtx allocate_dynamic_stack_space(rtx, unsigned, unsigned, HOST_WIDE_INT, bool)
Definition explow.cc:1420
void anti_adjust_stack_and_probe(rtx, bool)
Definition explow.cc:2177
rtx force_subreg(machine_mode, rtx, machine_mode, poly_uint64)
Definition explow.cc:752
rtx copy_to_mode_reg(machine_mode, rtx)
Definition explow.cc:648
machine_mode promote_decl_mode(const_tree, int *)
Definition explow.cc:926
machine_mode promote_mode(const_tree, machine_mode, int *)
Definition explow.cc:872
void anti_adjust_stack_and_probe_stack_clash(rtx)
Definition explow.cc:2048
void probe_stack_range(HOST_WIDE_INT, rtx)
Definition explow.cc:1762
void get_dynamic_stack_size(rtx *, unsigned, unsigned, HOST_WIDE_INT *)
Definition explow.cc:1288
rtx use_anchored_address(rtx)
Definition explow.cc:565
void emit_stack_save(enum save_level, rtx *)
void emit_stack_clash_protection_probe_loop_start(rtx *, rtx *, rtx, bool)
Definition explow.cc:1990
void anti_adjust_stack(rtx)
Definition explow.cc:1034
rtx hard_function_value(const_tree, const_tree, const_tree, int)
Definition explow.cc:2308
rtx force_lowpart_subreg(machine_mode, rtx, machine_mode)
Definition explow.cc:774
void record_new_stack_level(void)
Definition explow.cc:1235
void update_nonlocal_goto_save_area(void)
Definition explow.cc:1213
machine_mode promote_ssa_mode(const_tree, int *)
Definition explow.cc:953
machine_mode promote_function_mode(const_tree, machine_mode, int *, const_tree, int)
Definition explow.cc:841
rtx get_dynamic_stack_base(poly_int64, unsigned, rtx)
Definition explow.cc:1673
save_level
Definition explow.h:90
@ SAVE_NONLOCAL
Definition explow.h:90
@ SAVE_BLOCK
Definition explow.h:90
@ SAVE_FUNCTION
Definition explow.h:90
rtx force_highpart_subreg(machine_mode, rtx, machine_mode)
Definition explow.cc:788
rtx force_not_mem(rtx)
Definition explow.cc:799
rtx validize_mem(rtx)
Definition explow.cc:547
Definition rtl.h:312