1 /* SPDX-License-Identifier: GPL-2.0-or-later */
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.
8 #include "exec/helper-head.h"
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.
19 * See https://gitlab.com/qemu-project/qemu/-/issues/1454
21 #define DEF_HELPER_ATTR __attribute__((noinline))
23 #define DEF_HELPER_FLAGS_0(name, flags, ret) \
24 dh_ctype(ret) HELPER(name) (void) DEF_HELPER_ATTR;
26 #define DEF_HELPER_FLAGS_1(name, flags, ret, t1) \
27 dh_ctype(ret) HELPER(name) (dh_ctype(t1)) DEF_HELPER_ATTR;
29 #define DEF_HELPER_FLAGS_2(name, flags, ret, t1, t2) \
30 dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2)) DEF_HELPER_ATTR;
32 #define DEF_HELPER_FLAGS_3(name, flags, ret, t1, t2, t3) \
33 dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), \
34 dh_ctype(t3)) DEF_HELPER_ATTR;
36 #define DEF_HELPER_FLAGS_4(name, flags, ret, t1, t2, t3, t4) \
37 dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
38 dh_ctype(t4)) DEF_HELPER_ATTR;
40 #define DEF_HELPER_FLAGS_5(name, flags, ret, t1, t2, t3, t4, t5) \
41 dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
42 dh_ctype(t4), dh_ctype(t5)) DEF_HELPER_ATTR;
44 #define DEF_HELPER_FLAGS_6(name, flags, ret, t1, t2, t3, t4, t5, t6) \
45 dh_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;
49 #define DEF_HELPER_FLAGS_7(name, flags, ret, t1, t2, t3, t4, t5, t6, t7) \
50 dh_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;
54 #define IN_HELPER_PROTO
58 #undef IN_HELPER_PROTO
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