]>
Commit | Line | Data |
---|---|---|
1d9def42 | 1 | /* Declarations and data types for RTL call insn generation. |
a5544970 | 2 | Copyright (C) 2013-2019 Free Software Foundation, Inc. |
d8a2d370 DN |
3 | |
4 | This file is part of GCC. | |
5 | ||
6 | GCC is free software; you can redistribute it and/or modify it under | |
7 | the terms of the GNU General Public License as published by the Free | |
8 | Software Foundation; either version 3, or (at your option) any later | |
9 | version. | |
10 | ||
11 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along 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 | ||
a7c81bc1 RS |
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. */ | |
34 | class function_arg_info | |
35 | { | |
36 | public: | |
37 | function_arg_info () : type (NULL_TREE), mode (VOIDmode), named (false) {} | |
38 | ||
39 | /* Initialize an argument of mode MODE, either before or after promotion. */ | |
40 | function_arg_info (machine_mode mode, bool named) | |
41 | : type (NULL_TREE), mode (mode), named (named) | |
42 | {} | |
43 | ||
44 | /* Initialize an unpromoted argument of type TYPE. */ | |
45 | function_arg_info (tree type, bool named) | |
46 | : type (type), mode (TYPE_MODE (type)), named (named) | |
47 | {} | |
48 | ||
49 | /* Initialize an argument with explicit properties. */ | |
50 | function_arg_info (tree type, machine_mode mode, bool named) | |
51 | : type (type), mode (mode), named (named) | |
52 | {} | |
53 | ||
54 | /* Return true if the gimple-level type is an aggregate. */ | |
55 | bool aggregate_type_p () const { return type && AGGREGATE_TYPE_P (type); } | |
56 | ||
57 | /* Return the size of the gimple-level type, or -1 if the size is | |
58 | variable or otherwise not representable as a poly_int64. | |
59 | ||
60 | Use this function when MODE is the mode of the type before promotion, | |
61 | or in any context if the target never promotes function arguments. */ | |
62 | poly_int64 type_size_in_bytes () const | |
63 | { | |
64 | if (type) | |
65 | return int_size_in_bytes (type); | |
66 | return GET_MODE_SIZE (mode); | |
67 | } | |
68 | ||
69 | /* Return the size of the argument after promotion, or -1 if the size | |
70 | is variable or otherwise not representable as a poly_int64. | |
71 | ||
72 | Use this function when MODE is the mode of the type after promotion. */ | |
73 | poly_int64 promoted_size_in_bytes () const | |
74 | { | |
75 | if (mode == BLKmode) | |
76 | return int_size_in_bytes (type); | |
77 | return GET_MODE_SIZE (mode); | |
78 | } | |
79 | ||
6783fdb7 RS |
80 | /* True if the argument represents the end of the argument list, |
81 | as returned by end_marker (). */ | |
82 | bool end_marker_p () const { return mode == VOIDmode; } | |
83 | ||
84 | /* Return a function_arg_info that represents the end of the | |
85 | argument list. */ | |
86 | static function_arg_info end_marker () | |
87 | { | |
88 | return function_arg_info (void_type_node, /*named=*/true); | |
89 | } | |
90 | ||
a7c81bc1 RS |
91 | /* The type of the argument, or null if not known (which is true for |
92 | libgcc support functions). */ | |
93 | tree type; | |
94 | ||
95 | /* The mode of the argument. Depending on context, this might be | |
96 | the mode of the argument type or the mode after promotion. */ | |
97 | machine_mode mode; | |
98 | ||
99 | /* True if the argument is treated as a named argument, false if it is | |
100 | treated as an unnamed variadic argument (i.e. one passed through | |
101 | "..."). See also TARGET_STRICT_ARGUMENT_NAMING. */ | |
102 | unsigned int named : 1; | |
103 | }; | |
104 | ||
d8a2d370 DN |
105 | extern int flags_from_decl_or_type (const_tree); |
106 | extern int call_expr_flags (const_tree); | |
107 | extern int setjmp_call_p (const_tree); | |
159e8ef0 | 108 | extern bool gimple_maybe_alloca_call_p (const gimple *); |
355fe088 | 109 | extern bool gimple_alloca_call_p (const gimple *); |
d8a2d370 | 110 | extern bool alloca_call_p (const_tree); |
0ffef200 RS |
111 | extern bool must_pass_in_stack_var_size (const function_arg_info &); |
112 | extern bool must_pass_in_stack_var_size_or_pad (const function_arg_info &); | |
4f53599c | 113 | extern bool must_pass_va_arg_in_stack (tree); |
36566b39 PK |
114 | extern rtx prepare_call_address (tree, rtx, rtx, rtx *, int, int); |
115 | extern bool shift_return_value (machine_mode, bool, rtx); | |
116 | extern rtx expand_call (tree, rtx, int); | |
117 | extern void fixup_tail_calls (void); | |
118 | ||
52090e4d | 119 | extern bool pass_by_reference (CUMULATIVE_ARGS *, function_arg_info); |
fde65a89 | 120 | extern bool pass_va_arg_by_reference (tree); |
b12cdd6e RS |
121 | extern bool apply_pass_by_reference_rules (CUMULATIVE_ARGS *, |
122 | function_arg_info &); | |
7256c719 RS |
123 | extern bool reference_callee_copied (CUMULATIVE_ARGS *, |
124 | const function_arg_info &); | |
8bd9f164 | 125 | extern void maybe_warn_alloc_args_overflow (tree, tree, tree[2], int[2]); |
6a33d0ff MS |
126 | extern tree get_attr_nonstring_decl (tree, tree * = NULL); |
127 | extern void maybe_warn_nonstring_arg (tree, tree); | |
cc8bea0a | 128 | extern bool get_size_range (tree, tree[2], bool = false); |
4b522b8f | 129 | extern rtx rtx_for_static_chain (const_tree, bool); |
d8a2d370 DN |
130 | |
131 | #endif // GCC_CALLS_H |