xref: /qemu/include/exec/helper-proto.h.inc (revision 10be627d)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Helper file for declaring TCG helper functions.
4 * This one expands prototypes for the helper functions.
5 * Define HELPER_H for the header file to be expanded.
6 */
7
8#include "exec/helper-head.h"
9
10/*
11 * Work around an issue with --enable-lto, in which GCC's ipa-split pass
12 * decides to split out the noreturn code paths that raise an exception,
13 * taking the __builtin_return_address() along into the new function,
14 * where it no longer computes a value that returns to TCG generated code.
15 * Despite the name, the noinline attribute affects splitter, so this
16 * prevents the optimization in question.  Given that helpers should not
17 * otherwise be called directly, this should not have any other visible effect.
18 *
19 * See https://gitlab.com/qemu-project/qemu/-/issues/1454
20 */
21#define DEF_HELPER_ATTR  __attribute__((noinline))
22
23#define DEF_HELPER_FLAGS_0(name, flags, ret) \
24dh_ctype(ret) HELPER(name) (void) DEF_HELPER_ATTR;
25
26#define DEF_HELPER_FLAGS_1(name, flags, ret, t1) \
27dh_ctype(ret) HELPER(name) (dh_ctype(t1)) DEF_HELPER_ATTR;
28
29#define DEF_HELPER_FLAGS_2(name, flags, ret, t1, t2) \
30dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2)) DEF_HELPER_ATTR;
31
32#define DEF_HELPER_FLAGS_3(name, flags, ret, t1, t2, t3) \
33dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), \
34                            dh_ctype(t3)) DEF_HELPER_ATTR;
35
36#define DEF_HELPER_FLAGS_4(name, flags, ret, t1, t2, t3, t4) \
37dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
38                            dh_ctype(t4)) DEF_HELPER_ATTR;
39
40#define DEF_HELPER_FLAGS_5(name, flags, ret, t1, t2, t3, t4, t5) \
41dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
42                            dh_ctype(t4), dh_ctype(t5)) DEF_HELPER_ATTR;
43
44#define DEF_HELPER_FLAGS_6(name, flags, ret, t1, t2, t3, t4, t5, t6) \
45dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
46                            dh_ctype(t4), dh_ctype(t5), \
47                            dh_ctype(t6)) DEF_HELPER_ATTR;
48
49#define DEF_HELPER_FLAGS_7(name, flags, ret, t1, t2, t3, t4, t5, t6, t7) \
50dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
51                            dh_ctype(t4), dh_ctype(t5), dh_ctype(t6), \
52                            dh_ctype(t7)) DEF_HELPER_ATTR;
53
54#define IN_HELPER_PROTO
55
56#include HELPER_H
57
58#undef IN_HELPER_PROTO
59
60#undef DEF_HELPER_FLAGS_0
61#undef DEF_HELPER_FLAGS_1
62#undef DEF_HELPER_FLAGS_2
63#undef DEF_HELPER_FLAGS_3
64#undef DEF_HELPER_FLAGS_4
65#undef DEF_HELPER_FLAGS_5
66#undef DEF_HELPER_FLAGS_6
67#undef DEF_HELPER_FLAGS_7
68#undef DEF_HELPER_ATTR
69