xref: /openbmc/qemu/include/exec/helper-info.c.inc (revision b8116f4c)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Helper file for declaring TCG helper functions.
4 * This one expands info structures for tcg helpers.
5 * Define HELPER_H for the header file to be expanded.
6 */
7
8#include "tcg/tcg.h"
9#include "tcg/helper-info.h"
10#include "exec/helper-head.h.inc"
11
12/*
13 * Need one more level of indirection before stringification
14 * to get all the macros expanded first.
15 */
16#define str(s) #s
17
18#define DEF_HELPER_FLAGS_0(NAME, FLAGS, RET)                            \
19    TCGHelperInfo glue(helper_info_, NAME) = {                          \
20        .func = HELPER(NAME), .name = str(NAME),                        \
21        .flags = FLAGS | dh_callflag(RET),                              \
22        .typemask = dh_typemask(RET, 0)                                 \
23    };
24
25#define DEF_HELPER_FLAGS_1(NAME, FLAGS, RET, T1)                        \
26    TCGHelperInfo glue(helper_info_, NAME) = {                          \
27        .func = HELPER(NAME), .name = str(NAME),                        \
28        .flags = FLAGS | dh_callflag(RET),                              \
29        .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
30    };
31
32#define DEF_HELPER_FLAGS_2(NAME, FLAGS, RET, T1, T2)                    \
33    TCGHelperInfo glue(helper_info_, NAME) = {                          \
34        .func = HELPER(NAME), .name = str(NAME),                        \
35        .flags = FLAGS | dh_callflag(RET),                              \
36        .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
37                  | dh_typemask(T2, 2)                                  \
38    };
39
40#define DEF_HELPER_FLAGS_3(NAME, FLAGS, RET, T1, T2, T3)                \
41    TCGHelperInfo glue(helper_info_, NAME) = {                          \
42        .func = HELPER(NAME), .name = str(NAME),                        \
43        .flags = FLAGS | dh_callflag(RET),                              \
44        .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
45                  | dh_typemask(T2, 2) | dh_typemask(T3, 3)             \
46    };
47
48#define DEF_HELPER_FLAGS_4(NAME, FLAGS, RET, T1, T2, T3, T4)            \
49    TCGHelperInfo glue(helper_info_, NAME) = {                          \
50        .func = HELPER(NAME), .name = str(NAME),                        \
51        .flags = FLAGS | dh_callflag(RET),                              \
52        .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
53                  | dh_typemask(T2, 2) | dh_typemask(T3, 3)             \
54                  | dh_typemask(T4, 4)                                  \
55    };
56
57#define DEF_HELPER_FLAGS_5(NAME, FLAGS, RET, T1, T2, T3, T4, T5)        \
58    TCGHelperInfo glue(helper_info_, NAME) = {                          \
59        .func = HELPER(NAME), .name = str(NAME),                        \
60        .flags = FLAGS | dh_callflag(RET),                              \
61        .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
62                  | dh_typemask(T2, 2) | dh_typemask(T3, 3)             \
63                  | dh_typemask(T4, 4) | dh_typemask(T5, 5)             \
64    };
65
66#define DEF_HELPER_FLAGS_6(NAME, FLAGS, RET, T1, T2, T3, T4, T5, T6)    \
67    TCGHelperInfo glue(helper_info_, NAME) = {                          \
68        .func = HELPER(NAME), .name = str(NAME),                        \
69        .flags = FLAGS | dh_callflag(RET),                              \
70        .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
71                  | dh_typemask(T2, 2) | dh_typemask(T3, 3)             \
72                  | dh_typemask(T4, 4) | dh_typemask(T5, 5)             \
73                  | dh_typemask(T6, 6)                                  \
74    };
75
76#define DEF_HELPER_FLAGS_7(NAME, FLAGS, RET, T1, T2, T3, T4, T5, T6, T7) \
77    TCGHelperInfo glue(helper_info_, NAME) = {                          \
78        .func = HELPER(NAME), .name = str(NAME),                        \
79        .flags = FLAGS | dh_callflag(RET),                              \
80        .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
81                  | dh_typemask(T2, 2) | dh_typemask(T3, 3)             \
82                  | dh_typemask(T4, 4) | dh_typemask(T5, 5)             \
83                  | dh_typemask(T6, 6) | dh_typemask(T7, 7)             \
84    };
85
86#include HELPER_H
87
88#undef str
89#undef DEF_HELPER_FLAGS_0
90#undef DEF_HELPER_FLAGS_1
91#undef DEF_HELPER_FLAGS_2
92#undef DEF_HELPER_FLAGS_3
93#undef DEF_HELPER_FLAGS_4
94#undef DEF_HELPER_FLAGS_5
95#undef DEF_HELPER_FLAGS_6
96#undef DEF_HELPER_FLAGS_7
97