GCC Middle and Back End API Reference
calls.h
Go to the documentation of this file.
1/* Declarations and data types for RTL call insn generation.
2 Copyright (C) 2013-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_CALLS_H
21#define GCC_CALLS_H
22
23/* Describes a function argument.
24
25 Each argument conceptually has a gimple-level type. Usually this type
26 is available directly as a tree via the TYPE field, but when calling
27 libgcc support functions it might instead be inferred from a mode,
28 in which case the type isn't available directly.
29
30 This gimple-level type might go through promotion before being passed to
31 the target function. Depending on the context, the MODE field is either
32 the mode of the gimple-level type (whether explicitly given or not)
33 or the mode after promotion has been performed. */
35{
36public:
41
42 /* Initialize an argument of mode MODE, either before or after promotion. */
43 function_arg_info (machine_mode mode, bool named)
45 {}
46
47 /* Initialize an unpromoted argument of type TYPE. */
52
53 /* Initialize an argument with explicit properties. */
54 function_arg_info (tree type, machine_mode mode, bool named)
56 {}
57
58 /* Return true if the gimple-level type is an aggregate. */
59 bool aggregate_type_p () const { return type && AGGREGATE_TYPE_P (type); }
60
61 /* Return the size of the gimple-level type, or -1 if the size is
62 variable or otherwise not representable as a poly_int64.
63
64 Use this function when MODE is the mode of the type before promotion,
65 or in any context if the target never promotes function arguments. */
67 {
68 if (type)
69 return int_size_in_bytes (type);
70 return GET_MODE_SIZE (mode);
71 }
72
73 /* Return the size of the argument after promotion, or -1 if the size
74 is variable or otherwise not representable as a poly_int64.
75
76 Use this function when MODE is the mode of the type after promotion. */
78 {
79 if (mode == BLKmode)
80 return int_size_in_bytes (type);
81 return GET_MODE_SIZE (mode);
82 }
83
84 /* True if the argument represents the end of the argument list,
85 as returned by end_marker (). */
86 bool end_marker_p () const { return mode == VOIDmode; }
87
88 /* Return a function_arg_info that represents the end of the
89 argument list. */
91 {
92 return function_arg_info (void_type_node, /*named=*/true);
93 }
94
95 /* The type of the argument, or null if not known (which is true for
96 libgcc support functions). */
98
99 /* The mode of the argument. Depending on context, this might be
100 the mode of the argument type or the mode after promotion. */
101 machine_mode mode;
102
103 /* True if the argument is treated as a named argument, false if it is
104 treated as an unnamed variadic argument (i.e. one passed through
105 "..."). See also TARGET_STRICT_ARGUMENT_NAMING. */
106 unsigned int named : 1;
107
108 /* True if we have decided to pass the argument by reference, in which case
109 the function_arg_info describes a pointer to the original argument. */
110 unsigned int pass_by_reference : 1;
111};
112
114extern int call_expr_flags (const_tree);
115extern bool setjmp_call_p (const_tree);
116extern bool gimple_maybe_alloca_call_p (const gimple *);
117extern bool gimple_alloca_call_p (const gimple *);
118extern bool alloca_call_p (const_tree);
121extern bool must_pass_va_arg_in_stack (tree);
122extern rtx prepare_call_address (tree, rtx, rtx, rtx *, int, int);
123extern bool shift_return_value (machine_mode, bool, rtx);
124extern rtx expand_call (tree, rtx, int);
125extern void fixup_tail_calls (void);
126
128extern bool pass_va_arg_by_reference (tree);
132 const function_arg_info &);
133extern void maybe_complain_about_tail_call (tree, const char *);
134
135extern rtx rtx_for_static_chain (const_tree, bool);
137
138#endif // GCC_CALLS_H
bool must_pass_va_arg_in_stack(tree)
Definition calls.cc:5321
rtx prepare_call_address(tree, rtx, rtx, rtx *, int, int)
Definition calls.cc:222
bool cxx17_empty_base_field_p(const_tree)
Definition calls.cc:5334
int flags_from_decl_or_type(const_tree)
Definition calls.cc:809
bool apply_pass_by_reference_rules(CUMULATIVE_ARGS *, function_arg_info &)
Definition calls.cc:947
bool gimple_alloca_call_p(const gimple *)
Definition calls.cc:703
bool setjmp_call_p(const_tree)
Definition calls.cc:672
bool must_pass_in_stack_var_size_or_pad(const function_arg_info &)
Definition calls.cc:5289
void maybe_complain_about_tail_call(tree, const char *)
Definition calls.cc:1245
bool shift_return_value(machine_mode, bool, rtx)
Definition calls.cc:2449
bool alloca_call_p(const_tree)
Definition calls.cc:726
bool pass_by_reference(CUMULATIVE_ARGS *, function_arg_info)
Definition calls.cc:908
int call_expr_flags(const_tree)
Definition calls.cc:882
bool reference_callee_copied(CUMULATIVE_ARGS *, const function_arg_info &)
Definition calls.cc:963
bool gimple_maybe_alloca_call_p(const gimple *)
Definition calls.cc:686
rtx expand_call(tree, rtx, int)
Definition calls.cc:2632
bool must_pass_in_stack_var_size(const function_arg_info &)
Definition calls.cc:5267
rtx rtx_for_static_chain(const_tree, bool)
Definition calls.cc:1916
bool pass_va_arg_by_reference(tree)
Definition calls.cc:937
void fixup_tail_calls(void)
Definition calls.cc:4031
Definition calls.h:35
unsigned int named
Definition calls.h:106
tree type
Definition calls.h:97
bool aggregate_type_p() const
Definition calls.h:59
function_arg_info(tree type, machine_mode mode, bool named)
Definition calls.h:54
function_arg_info()
Definition calls.h:37
poly_int64 type_size_in_bytes() const
Definition calls.h:66
function_arg_info(machine_mode mode, bool named)
Definition calls.h:43
poly_int64 promoted_size_in_bytes() const
Definition calls.h:77
function_arg_info(tree type, bool named)
Definition calls.h:48
bool end_marker_p() const
Definition calls.h:86
static function_arg_info end_marker()
Definition calls.h:90
unsigned int pass_by_reference
Definition calls.h:110
machine_mode mode
Definition calls.h:101
const union tree_node * const_tree
Definition coretypes.h:98
union tree_node * tree
Definition coretypes.h:97
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
ALWAYS_INLINE poly_uint16 GET_MODE_SIZE(machine_mode mode)
Definition machmode.h:647
Definition gimple.h:225
Definition rtl.h:311
Definition gengtype.h:252
#define false
Definition system.h:895
HOST_WIDE_INT int_size_in_bytes(const_tree type)
Definition tree.cc:3609
#define AGGREGATE_TYPE_P(TYPE)
Definition tree.h:693
#define TYPE_MODE(NODE)
Definition tree.h:2254
#define NULL_TREE
Definition tree.h:317
#define void_type_node
Definition tree.h:4490