helper-gen.h (a3a692b8bf247ab28c70fc8dce967a84db90d55c) helper-gen.h (e4eff8e4edc188b5eee8834479b515325889e27a)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Helper file for declaring TCG helper functions.
4 * This one expands generation functions for tcg opcodes.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Helper file for declaring TCG helper functions.
4 * This one expands generation functions for tcg opcodes.
5 * Define HELPER_H for the header file to be expanded,
6 * and static inline to change from global file scope.
7 */
8
9#ifndef HELPER_GEN_H
10#define HELPER_GEN_H
11
5 */
6
7#ifndef HELPER_GEN_H
8#define HELPER_GEN_H
9
12#include "tcg/tcg.h"
13#include "tcg/helper-info.h"
14#include "exec/helper-head.h"
10#include "exec/helper-gen-common.h"
15
11
16#define DEF_HELPER_FLAGS_0(name, flags, ret) \
17extern TCGHelperInfo glue(helper_info_, name); \
18static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret)) \
19{ \
20 tcg_gen_call0(&glue(helper_info_, name), dh_retvar(ret)); \
21}
12#define HELPER_H "helper.h"
13#include "exec/helper-gen.h.inc"
14#undef HELPER_H
22
15
23#define DEF_HELPER_FLAGS_1(name, flags, ret, t1) \
24extern TCGHelperInfo glue(helper_info_, name); \
25static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \
26 dh_arg_decl(t1, 1)) \
27{ \
28 tcg_gen_call1(&glue(helper_info_, name), dh_retvar(ret), \
29 dh_arg(t1, 1)); \
30}
31
32#define DEF_HELPER_FLAGS_2(name, flags, ret, t1, t2) \
33extern TCGHelperInfo glue(helper_info_, name); \
34static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \
35 dh_arg_decl(t1, 1), dh_arg_decl(t2, 2)) \
36{ \
37 tcg_gen_call2(&glue(helper_info_, name), dh_retvar(ret), \
38 dh_arg(t1, 1), dh_arg(t2, 2)); \
39}
40
41#define DEF_HELPER_FLAGS_3(name, flags, ret, t1, t2, t3) \
42extern TCGHelperInfo glue(helper_info_, name); \
43static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \
44 dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3)) \
45{ \
46 tcg_gen_call3(&glue(helper_info_, name), dh_retvar(ret), \
47 dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3)); \
48}
49
50#define DEF_HELPER_FLAGS_4(name, flags, ret, t1, t2, t3, t4) \
51extern TCGHelperInfo glue(helper_info_, name); \
52static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \
53 dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), \
54 dh_arg_decl(t3, 3), dh_arg_decl(t4, 4)) \
55{ \
56 tcg_gen_call4(&glue(helper_info_, name), dh_retvar(ret), \
57 dh_arg(t1, 1), dh_arg(t2, 2), \
58 dh_arg(t3, 3), dh_arg(t4, 4)); \
59}
60
61#define DEF_HELPER_FLAGS_5(name, flags, ret, t1, t2, t3, t4, t5) \
62extern TCGHelperInfo glue(helper_info_, name); \
63static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \
64 dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), \
65 dh_arg_decl(t4, 4), dh_arg_decl(t5, 5)) \
66{ \
67 tcg_gen_call5(&glue(helper_info_, name), dh_retvar(ret), \
68 dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3), \
69 dh_arg(t4, 4), dh_arg(t5, 5)); \
70}
71
72#define DEF_HELPER_FLAGS_6(name, flags, ret, t1, t2, t3, t4, t5, t6) \
73extern TCGHelperInfo glue(helper_info_, name); \
74static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \
75 dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), \
76 dh_arg_decl(t4, 4), dh_arg_decl(t5, 5), dh_arg_decl(t6, 6)) \
77{ \
78 tcg_gen_call6(&glue(helper_info_, name), dh_retvar(ret), \
79 dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3), \
80 dh_arg(t4, 4), dh_arg(t5, 5), dh_arg(t6, 6)); \
81}
82
83#define DEF_HELPER_FLAGS_7(name, flags, ret, t1, t2, t3, t4, t5, t6, t7)\
84extern TCGHelperInfo glue(helper_info_, name); \
85static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \
86 dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), \
87 dh_arg_decl(t4, 4), dh_arg_decl(t5, 5), dh_arg_decl(t6, 6), \
88 dh_arg_decl(t7, 7)) \
89{ \
90 tcg_gen_call7(&glue(helper_info_, name), dh_retvar(ret), \
91 dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3), \
92 dh_arg(t4, 4), dh_arg(t5, 5), dh_arg(t6, 6), \
93 dh_arg(t7, 7)); \
94}
95
96#include "helper.h"
97#include "accel/tcg/tcg-runtime.h"
98#include "accel/tcg/plugin-helpers.h"
99
100#undef DEF_HELPER_FLAGS_0
101#undef DEF_HELPER_FLAGS_1
102#undef DEF_HELPER_FLAGS_2
103#undef DEF_HELPER_FLAGS_3
104#undef DEF_HELPER_FLAGS_4
105#undef DEF_HELPER_FLAGS_5
106#undef DEF_HELPER_FLAGS_6
107#undef DEF_HELPER_FLAGS_7
108
109#endif /* HELPER_GEN_H */
16#endif /* HELPER_GEN_H */