8#include <ae2f/LangVer.h>
10#include <spirv/unified1/spirv.h>
15#include "./constant.h"
18util_default_is_unsigned(
const e_id_default c_id_default) {
19 switch(c_id_default) {
32 case ID_DEFAULT_FN_VOID:
33 case ID_DEFAULT_U8_PTR_FUNC:
34 case ID_DEFAULT_F16_PTR_FUNC:
35 case ID_DEFAULT_F32_PTR_FUNC:
36 case ID_DEFAULT_F64_PTR_FUNC:
37 case ID_DEFAULT_I32_PTR_FUNC:
38 case ID_DEFAULT_U16_PTR_FUNC:
39 case ID_DEFAULT_U32_PTR_FUNC:
40 case ID_DEFAULT_U64_PTR_FUNC:
41 case ID_DEFAULT_U32V4_PTR_INP:
42 case ID_DEFAULT_U32V4_PTR_OUT:
49util_default_is_signed(
const e_id_default c_id_default) {
50 switch(c_id_default) {
63 case ID_DEFAULT_FN_VOID:
64 case ID_DEFAULT_U8_PTR_FUNC:
65 case ID_DEFAULT_F16_PTR_FUNC:
66 case ID_DEFAULT_F32_PTR_FUNC:
67 case ID_DEFAULT_F64_PTR_FUNC:
68 case ID_DEFAULT_I32_PTR_FUNC:
69 case ID_DEFAULT_U16_PTR_FUNC:
70 case ID_DEFAULT_U32_PTR_FUNC:
71 case ID_DEFAULT_U64_PTR_FUNC:
72 case ID_DEFAULT_U32V4_PTR_INP:
73 case ID_DEFAULT_U32V4_PTR_OUT:
80util_default_is_int(
const e_id_default c_id_default) {
81 return util_default_is_unsigned(c_id_default) || util_default_is_signed(c_id_default);
85util_default_is_float(
const e_id_default c_id_default) {
86 switch(c_id_default) {
99 case ID_DEFAULT_FN_VOID:
100 case ID_DEFAULT_U8_PTR_FUNC:
101 case ID_DEFAULT_F16_PTR_FUNC:
102 case ID_DEFAULT_F32_PTR_FUNC:
103 case ID_DEFAULT_F64_PTR_FUNC:
104 case ID_DEFAULT_I32_PTR_FUNC:
105 case ID_DEFAULT_U16_PTR_FUNC:
106 case ID_DEFAULT_U32_PTR_FUNC:
107 case ID_DEFAULT_U64_PTR_FUNC:
108 case ID_DEFAULT_U32V4_PTR_INP:
109 case ID_DEFAULT_U32V4_PTR_OUT:
116util_is_default(
const e_id_default c_id_default) {
117 switch(c_id_default) {
127 case ID_DEFAULT_VOID:
128 case ID_DEFAULT_FN_VOID:
129 case ID_DEFAULT_U8_PTR_FUNC:
130 case ID_DEFAULT_F16_PTR_FUNC:
131 case ID_DEFAULT_F32_PTR_FUNC:
132 case ID_DEFAULT_F64_PTR_FUNC:
133 case ID_DEFAULT_I32_PTR_FUNC:
134 case ID_DEFAULT_U16_PTR_FUNC:
135 case ID_DEFAULT_U32_PTR_FUNC:
136 case ID_DEFAULT_U64_PTR_FUNC:
137 case ID_DEFAULT_U32V4_PTR_INP:
138 case ID_DEFAULT_U32V4_PTR_OUT:
146util_default_is_number(
const e_id_default c_id_default) {
147 return util_default_is_int(c_id_default) || util_default_is_float(c_id_default);
151util_default_float(
unsigned bit_width) {
154 return ID_DEFAULT_F16;
156 return ID_DEFAULT_F32;
158 return ID_DEFAULT_F64;
160 return ID_DEFAULT_END;
166util_default_unsigned(
unsigned bit_width) {
169 return ID_DEFAULT_U8;
171 return ID_DEFAULT_U16;
173 return ID_DEFAULT_U32;
175 return ID_DEFAULT_U64;
177 return ID_DEFAULT_END;
182util_default_bit_width(
const e_id_default c_id_default) {
183 switch(c_id_default) {
201 case ID_DEFAULT_VOID:
202 case ID_DEFAULT_FN_VOID:
203 case ID_DEFAULT_U8_PTR_FUNC:
204 case ID_DEFAULT_F16_PTR_FUNC:
205 case ID_DEFAULT_F32_PTR_FUNC:
206 case ID_DEFAULT_F64_PTR_FUNC:
207 case ID_DEFAULT_I32_PTR_FUNC:
208 case ID_DEFAULT_U16_PTR_FUNC:
209 case ID_DEFAULT_U32_PTR_FUNC:
210 case ID_DEFAULT_U64_PTR_FUNC:
211 case ID_DEFAULT_U32V4_PTR_INP:
212 case ID_DEFAULT_U32V4_PTR_OUT:
219 const e_id_default c_id_default,
227 if(h_ctx->m_id_defaults[c_id_default])
231#define ret_count h_ctx->m_count.m_types
232 switch(c_id_default) {
243 case ID_DEFAULT_U32V4_PTR_INP:
244 STORAGE_CLASS = SpvStorageClassInput;
248 case ID_DEFAULT_U32V4_PTR_OUT:
249 STORAGE_CLASS = SpvStorageClassOutput;
257 &
CTX->m_section.m_types
266 case ID_DEFAULT_VOID:
274 case ID_DEFAULT_U64_PTR_FUNC:
278 &
CTX->m_section.m_types
280 , ID_DEFAULT_U64_PTR_FUNC
281 , SpvStorageClassFunction
282 , ID_DEFAULT_U64))
return 0;
287 &
CTX->m_section.m_types
295 CTX->m_count.m_capability = util_emitx_2(
296 &
CTX->m_section.m_capability
297 ,
CTX->m_count.m_capability
303 case ID_DEFAULT_U32_PTR_FUNC:
307 &
CTX->m_section.m_types
309 , ID_DEFAULT_U32_PTR_FUNC
310 , SpvStorageClassFunction
311 , ID_DEFAULT_U32))
return 0;
316 &
CTX->m_section.m_types
325 case ID_DEFAULT_I32_PTR_FUNC:
329 &
CTX->m_section.m_types
331 , ID_DEFAULT_I32_PTR_FUNC
332 , SpvStorageClassFunction
333 , ID_DEFAULT_I32))
return 0;
338 &
CTX->m_section.m_types
346 case ID_DEFAULT_U16_PTR_FUNC:
350 &
CTX->m_section.m_types
352 , ID_DEFAULT_U16_PTR_FUNC
353 , SpvStorageClassFunction
354 , ID_DEFAULT_U16))
return 0;
359 &
CTX->m_section.m_types
367 CTX->m_count.m_capability = util_emitx_2(
368 &
CTX->m_section.m_capability
369 ,
CTX->m_count.m_capability
376 case ID_DEFAULT_U8_PTR_FUNC:
380 &
CTX->m_section.m_types
382 , ID_DEFAULT_U8_PTR_FUNC
383 , SpvStorageClassFunction
384 , ID_DEFAULT_U8))
return 0;
389 &
CTX->m_section.m_types
397 CTX->m_count.m_capability = util_emitx_2(
398 &
CTX->m_section.m_capability
399 ,
CTX->m_count.m_capability
405 case ID_DEFAULT_F16_PTR_FUNC:
409 &
CTX->m_section.m_types
411 , ID_DEFAULT_F16_PTR_FUNC
412 , SpvStorageClassFunction
413 , ID_DEFAULT_F16))
return 0;
417 &
CTX->m_section.m_types
425 CTX->m_count.m_capability = util_emitx_2(
426 &
CTX->m_section.m_capability
427 ,
CTX->m_count.m_capability
429 , SpvCapabilityFloat16
433 case ID_DEFAULT_F32_PTR_FUNC:
437 &
CTX->m_section.m_types
439 , ID_DEFAULT_F32_PTR_FUNC
440 , SpvStorageClassFunction
441 , ID_DEFAULT_F32))
return 0;
445 &
CTX->m_section.m_types
453 case ID_DEFAULT_F64_PTR_FUNC:
457 &
CTX->m_section.m_types
459 , ID_DEFAULT_F64_PTR_FUNC
460 , SpvStorageClassFunction
461 , ID_DEFAULT_F64))
return 0;
465 &
CTX->m_section.m_types
473 CTX->m_count.m_capability = util_emitx_2(
474 &
CTX->m_section.m_capability
475 ,
CTX->m_count.m_capability
477 , SpvCapabilityFloat64
481 case ID_DEFAULT_FN_VOID:
484 &
CTX->m_section.m_types
488 , ID_DEFAULT_VOID))
return 0;
489#define EMIT_POS CTX->m_count.m_name
506 return h_ctx->m_id_defaults[c_id_default] = c_id_default;
#define ae2f_WhenCXX(a)
Appears when the current language is C.
#define ae2f_WhenC(a)
Appears when the current language is C++.
#define unless(a)
Invokes when condition is false.
#define ae2f_extern
Suggests the existence of external variable or function, in naming of C. [non-mangling].
#define ACLSPV_ABI_DECL
Declaration as ABI.
#define ae2f_assume(a)
tells the compiler that value if a is false, below this keyword is not expected to be reached.
#define ae2f_unexpected_but_if(a)
#define ae2f_expected_but_else(a)
#define ae2f_ccconst
Keyword as [[const]] on C23..
#define ae2f_noexcept
marker that this function does not throw something.
#define ae2f_restrict
Keyword as restrict on C99.
#define ae2f_expected_not(a)
expectes a as false.
#define ae2f_unreachable()
tells the compiler that below this keyword is not expected to be reached.
#define ae2f_inline
inline
#define ae2f_expected(a)
expectes a as true.
#define util_emitx_type_pointer(h_wrds, c_wrdcount, c_retid, c_storage_class, c_elm_type_id)
#define get_buf_from_scale(h_alloc, c_scale)
#define aclspv_opcode_t
integer as operation code
aclspv_wrd_t aclspv_wrdcount_t
the integer type represents the number of word.
#define aclspv_wrd_t
integer as word
aclspv_wrdcount_t m_num_cursor
number of m_cursors. for its use see util/cursor.h
util_bind_unified m_unified
#define emit_opcode(h_wrds, c_wrdcount, c_opcode, c_num_opprm_opt)
try emit opcode with num_opprm
#define get_wrd_of_vec(vec)
get word buffer from vector
#define count_to_sz(c_count)
word count to byte size
#define set_oprnd_count_for_opcode(cr_wrd, c_num_opprm)