xref: /openbmc/qemu/include/exec/helper-gen.h (revision c5a58398)
1 /* Helper file for declaring TCG helper functions.
2    This one expands generation functions for tcg opcodes.  */
3 
4 #ifndef HELPER_GEN_H
5 #define HELPER_GEN_H
6 
7 #include "exec/helper-head.h"
8 
9 #define DEF_HELPER_FLAGS_0(name, flags, ret)                            \
10 static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret))        \
11 {                                                                       \
12   tcg_gen_callN(HELPER(name), dh_retvar(ret), 0, NULL);                 \
13 }
14 
15 #define DEF_HELPER_FLAGS_1(name, flags, ret, t1)                        \
16 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
17     dh_arg_decl(t1, 1))                                                 \
18 {                                                                       \
19   TCGTemp *args[1] = { dh_arg(t1, 1) };                                 \
20   tcg_gen_callN(HELPER(name), dh_retvar(ret), 1, args);                 \
21 }
22 
23 #define DEF_HELPER_FLAGS_2(name, flags, ret, t1, t2)                    \
24 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
25     dh_arg_decl(t1, 1), dh_arg_decl(t2, 2))                             \
26 {                                                                       \
27   TCGTemp *args[2] = { dh_arg(t1, 1), dh_arg(t2, 2) };                  \
28   tcg_gen_callN(HELPER(name), dh_retvar(ret), 2, args);                 \
29 }
30 
31 #define DEF_HELPER_FLAGS_3(name, flags, ret, t1, t2, t3)                \
32 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
33     dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3))         \
34 {                                                                       \
35   TCGTemp *args[3] = { dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3) };   \
36   tcg_gen_callN(HELPER(name), dh_retvar(ret), 3, args);                 \
37 }
38 
39 #define DEF_HELPER_FLAGS_4(name, flags, ret, t1, t2, t3, t4)            \
40 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
41     dh_arg_decl(t1, 1), dh_arg_decl(t2, 2),                             \
42     dh_arg_decl(t3, 3), dh_arg_decl(t4, 4))                             \
43 {                                                                       \
44   TCGTemp *args[4] = { dh_arg(t1, 1), dh_arg(t2, 2),                    \
45                      dh_arg(t3, 3), dh_arg(t4, 4) };                    \
46   tcg_gen_callN(HELPER(name), dh_retvar(ret), 4, args);                 \
47 }
48 
49 #define DEF_HELPER_FLAGS_5(name, flags, ret, t1, t2, t3, t4, t5)        \
50 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
51     dh_arg_decl(t1, 1),  dh_arg_decl(t2, 2), dh_arg_decl(t3, 3),        \
52     dh_arg_decl(t4, 4), dh_arg_decl(t5, 5))                             \
53 {                                                                       \
54   TCGTemp *args[5] = { dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3),     \
55                      dh_arg(t4, 4), dh_arg(t5, 5) };                    \
56   tcg_gen_callN(HELPER(name), dh_retvar(ret), 5, args);                 \
57 }
58 
59 #define DEF_HELPER_FLAGS_6(name, flags, ret, t1, t2, t3, t4, t5, t6)    \
60 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
61     dh_arg_decl(t1, 1),  dh_arg_decl(t2, 2), dh_arg_decl(t3, 3),        \
62     dh_arg_decl(t4, 4), dh_arg_decl(t5, 5), dh_arg_decl(t6, 6))         \
63 {                                                                       \
64   TCGTemp *args[6] = { dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3),     \
65                      dh_arg(t4, 4), dh_arg(t5, 5), dh_arg(t6, 6) };     \
66   tcg_gen_callN(HELPER(name), dh_retvar(ret), 6, args);                 \
67 }
68 
69 #define DEF_HELPER_FLAGS_7(name, flags, ret, t1, t2, t3, t4, t5, t6, t7)\
70 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
71     dh_arg_decl(t1, 1),  dh_arg_decl(t2, 2), dh_arg_decl(t3, 3),        \
72     dh_arg_decl(t4, 4), dh_arg_decl(t5, 5), dh_arg_decl(t6, 6),         \
73     dh_arg_decl(t7, 7))                                                 \
74 {                                                                       \
75   TCGTemp *args[7] = { dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3),     \
76                      dh_arg(t4, 4), dh_arg(t5, 5), dh_arg(t6, 6),       \
77                      dh_arg(t7, 7) };                                   \
78   tcg_gen_callN(HELPER(name), dh_retvar(ret), 7, args);                 \
79 }
80 
81 #include "helper.h"
82 #include "trace/generated-helpers.h"
83 #include "trace/generated-helpers-wrappers.h"
84 #include "tcg-runtime.h"
85 #include "plugin-helpers.h"
86 
87 #undef DEF_HELPER_FLAGS_0
88 #undef DEF_HELPER_FLAGS_1
89 #undef DEF_HELPER_FLAGS_2
90 #undef DEF_HELPER_FLAGS_3
91 #undef DEF_HELPER_FLAGS_4
92 #undef DEF_HELPER_FLAGS_5
93 #undef DEF_HELPER_FLAGS_6
94 #undef DEF_HELPER_FLAGS_7
95 #undef GEN_HELPER
96 
97 #endif /* HELPER_GEN_H */
98