Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / include / exec / helper-proto.h
blob7a3f04b58c457de0273ff22f6e2431f99100371c
1 /* Helper file for declaring TCG helper functions.
2 This one expands prototypes for the helper functions. */
4 #ifndef HELPER_PROTO_H
5 #define HELPER_PROTO_H
7 #include "exec/helper-head.h"
9 /*
10 * Work around an issue with --enable-lto, in which GCC's ipa-split pass
11 * decides to split out the noreturn code paths that raise an exception,
12 * taking the __builtin_return_address() along into the new function,
13 * where it no longer computes a value that returns to TCG generated code.
14 * Despite the name, the noinline attribute affects splitter, so this
15 * prevents the optimization in question. Given that helpers should not
16 * otherwise be called directly, this should have any other visible effect.
18 * See https://gitlab.com/qemu-project/qemu/-/issues/1454
20 #define DEF_HELPER_ATTR __attribute__((noinline))
22 #define DEF_HELPER_FLAGS_0(name, flags, ret) \
23 dh_ctype(ret) HELPER(name) (void) DEF_HELPER_ATTR;
25 #define DEF_HELPER_FLAGS_1(name, flags, ret, t1) \
26 dh_ctype(ret) HELPER(name) (dh_ctype(t1)) DEF_HELPER_ATTR;
28 #define DEF_HELPER_FLAGS_2(name, flags, ret, t1, t2) \
29 dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2)) DEF_HELPER_ATTR;
31 #define DEF_HELPER_FLAGS_3(name, flags, ret, t1, t2, t3) \
32 dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), \
33 dh_ctype(t3)) DEF_HELPER_ATTR;
35 #define DEF_HELPER_FLAGS_4(name, flags, ret, t1, t2, t3, t4) \
36 dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
37 dh_ctype(t4)) DEF_HELPER_ATTR;
39 #define DEF_HELPER_FLAGS_5(name, flags, ret, t1, t2, t3, t4, t5) \
40 dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
41 dh_ctype(t4), dh_ctype(t5)) DEF_HELPER_ATTR;
43 #define DEF_HELPER_FLAGS_6(name, flags, ret, t1, t2, t3, t4, t5, t6) \
44 dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
45 dh_ctype(t4), dh_ctype(t5), \
46 dh_ctype(t6)) DEF_HELPER_ATTR;
48 #define DEF_HELPER_FLAGS_7(name, flags, ret, t1, t2, t3, t4, t5, t6, t7) \
49 dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
50 dh_ctype(t4), dh_ctype(t5), dh_ctype(t6), \
51 dh_ctype(t7)) DEF_HELPER_ATTR;
53 #define IN_HELPER_PROTO
55 #include "helper.h"
56 #include "accel/tcg/tcg-runtime.h"
57 #include "accel/tcg/plugin-helpers.h"
59 #undef IN_HELPER_PROTO
61 #undef DEF_HELPER_FLAGS_0
62 #undef DEF_HELPER_FLAGS_1
63 #undef DEF_HELPER_FLAGS_2
64 #undef DEF_HELPER_FLAGS_3
65 #undef DEF_HELPER_FLAGS_4
66 #undef DEF_HELPER_FLAGS_5
67 #undef DEF_HELPER_FLAGS_6
68 #undef DEF_HELPER_FLAGS_7
69 #undef DEF_HELPER_ATTR
71 #endif /* HELPER_PROTO_H */