1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef EXEC_HELPER_HEAD_H
19#define EXEC_HELPER_HEAD_H
20
21#define HELPER(name) glue(helper_, name)
22
23
24#define dh_alias_i32 i32
25#define dh_alias_s32 i32
26#define dh_alias_int i32
27#define dh_alias_i64 i64
28#define dh_alias_s64 i64
29#define dh_alias_f16 i32
30#define dh_alias_f32 i32
31#define dh_alias_f64 i64
32#define dh_alias_ptr ptr
33#define dh_alias_cptr ptr
34#define dh_alias_void void
35#define dh_alias_noreturn noreturn
36#define dh_alias(t) glue(dh_alias_, t)
37
38#define dh_ctype_i32 uint32_t
39#define dh_ctype_s32 int32_t
40#define dh_ctype_int int
41#define dh_ctype_i64 uint64_t
42#define dh_ctype_s64 int64_t
43#define dh_ctype_f16 uint32_t
44#define dh_ctype_f32 float32
45#define dh_ctype_f64 float64
46#define dh_ctype_ptr void *
47#define dh_ctype_cptr const void *
48#define dh_ctype_void void
49#define dh_ctype_noreturn void QEMU_NORETURN
50#define dh_ctype(t) dh_ctype_##t
51
52#ifdef NEED_CPU_H
53# ifdef TARGET_LONG_BITS
54# if TARGET_LONG_BITS == 32
55# define dh_alias_tl i32
56# else
57# define dh_alias_tl i64
58# endif
59# endif
60# define dh_alias_env ptr
61# define dh_ctype_tl target_ulong
62# define dh_ctype_env CPUArchState *
63#endif
64
65
66
67#define dh_retvar_decl0_void void
68#define dh_retvar_decl0_noreturn void
69#define dh_retvar_decl0_i32 TCGv_i32 retval
70#define dh_retvar_decl0_i64 TCGv_i64 retval
71#define dh_retvar_decl0_ptr TCGv_ptr retval
72#define dh_retvar_decl0(t) glue(dh_retvar_decl0_, dh_alias(t))
73
74#define dh_retvar_decl_void
75#define dh_retvar_decl_noreturn
76#define dh_retvar_decl_i32 TCGv_i32 retval,
77#define dh_retvar_decl_i64 TCGv_i64 retval,
78#define dh_retvar_decl_ptr TCGv_ptr retval,
79#define dh_retvar_decl(t) glue(dh_retvar_decl_, dh_alias(t))
80
81#define dh_retvar_void NULL
82#define dh_retvar_noreturn NULL
83#define dh_retvar_i32 tcgv_i32_temp(retval)
84#define dh_retvar_i64 tcgv_i64_temp(retval)
85#define dh_retvar_ptr tcgv_ptr_temp(retval)
86#define dh_retvar(t) glue(dh_retvar_, dh_alias(t))
87
88#define dh_typecode_void 0
89#define dh_typecode_noreturn 0
90#define dh_typecode_i32 2
91#define dh_typecode_s32 3
92#define dh_typecode_i64 4
93#define dh_typecode_s64 5
94#define dh_typecode_ptr 6
95#define dh_typecode(t) glue(dh_typecode_, dh_alias(t))
96
97#define dh_callflag_i32 0
98#define dh_callflag_s32 0
99#define dh_callflag_int 0
100#define dh_callflag_i64 0
101#define dh_callflag_s64 0
102#define dh_callflag_f16 0
103#define dh_callflag_f32 0
104#define dh_callflag_f64 0
105#define dh_callflag_ptr 0
106#define dh_callflag_cptr dh_callflag_ptr
107#define dh_callflag_void 0
108#define dh_callflag_noreturn TCG_CALL_NO_RETURN
109#define dh_callflag(t) glue(dh_callflag_, dh_alias(t))
110
111#define dh_typemask(t, n) (dh_typecode(t) << (n * 3))
112
113#define dh_arg(t, n) \
114 glue(glue(tcgv_, dh_alias(t)), _temp)(glue(arg, n))
115
116#define dh_arg_decl(t, n) glue(TCGv_, dh_alias(t)) glue(arg, n)
117
118#define DEF_HELPER_0(name, ret) \
119 DEF_HELPER_FLAGS_0(name, 0, ret)
120#define DEF_HELPER_1(name, ret, t1) \
121 DEF_HELPER_FLAGS_1(name, 0, ret, t1)
122#define DEF_HELPER_2(name, ret, t1, t2) \
123 DEF_HELPER_FLAGS_2(name, 0, ret, t1, t2)
124#define DEF_HELPER_3(name, ret, t1, t2, t3) \
125 DEF_HELPER_FLAGS_3(name, 0, ret, t1, t2, t3)
126#define DEF_HELPER_4(name, ret, t1, t2, t3, t4) \
127 DEF_HELPER_FLAGS_4(name, 0, ret, t1, t2, t3, t4)
128#define DEF_HELPER_5(name, ret, t1, t2, t3, t4, t5) \
129 DEF_HELPER_FLAGS_5(name, 0, ret, t1, t2, t3, t4, t5)
130#define DEF_HELPER_6(name, ret, t1, t2, t3, t4, t5, t6) \
131 DEF_HELPER_FLAGS_6(name, 0, ret, t1, t2, t3, t4, t5, t6)
132#define DEF_HELPER_7(name, ret, t1, t2, t3, t4, t5, t6, t7) \
133 DEF_HELPER_FLAGS_7(name, 0, ret, t1, t2, t3, t4, t5, t6, t7)
134
135
136
137#endif
138