xref: /openbmc/qemu/include/exec/helper-proto.h (revision 21063bce)
1 /* Helper file for declaring TCG helper functions.
2    This one expands prototypes for the helper functions.  */
3 
4 #ifndef HELPER_PROTO_H
5 #define HELPER_PROTO_H
6 
7 #include "exec/helper-head.h"
8 
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.
17  *
18  * See https://gitlab.com/qemu-project/qemu/-/issues/1454
19  */
20 #define DEF_HELPER_ATTR  __attribute__((noinline))
21 
22 #define DEF_HELPER_FLAGS_0(name, flags, ret) \
23 dh_ctype(ret) HELPER(name) (void) DEF_HELPER_ATTR;
24 
25 #define DEF_HELPER_FLAGS_1(name, flags, ret, t1) \
26 dh_ctype(ret) HELPER(name) (dh_ctype(t1)) DEF_HELPER_ATTR;
27 
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;
30 
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;
34 
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;
38 
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;
42 
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;
47 
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;
52 
53 #define IN_HELPER_PROTO
54 
55 #include "helper.h"
56 #include "accel/tcg/tcg-runtime.h"
57 #include "accel/tcg/plugin-helpers.h"
58 
59 #undef IN_HELPER_PROTO
60 
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
70 
71 #endif /* HELPER_PROTO_H */
72