ae2f_docs
Loading...
Searching...
No Matches
ctx.h
Go to the documentation of this file.
1/** @file ctx.h @brief the context of a compiler (something like a state machine) */
2
3#ifndef lib_build_ctx_h
4#define lib_build_ctx_h
5
6#include "../vec.auto.h"
7#include "./id.h"
8
9#include <aclspv.h>
10#include <aclspv/spvty.h>
11
12#define _free(a, b) free(a)
13
14typedef struct a_aclspv_ctx {
15 aclspv_wrd_t m_has_function_ret : 1;
16 aclspv_wrd_t m_is_buffer_64 : 1;
17 aclspv_wrd_t m_not_dbg : 1;
18 aclspv_wrd_t m_is_for_gl : 1;
19
20 /**
21 * @brief when on, ignores `m_is_buffer_64`.
22 * */
24
25 e_aclspv_compile_t m_err;
26
27 /**
28 * @var m_ret
29 * @brief word count for m_ret
30 * */
31 aclspv_wrdcount_t m_num_ret;
32
33 /**
34 * @brief
35 * number of `m_cursors`. \n
36 * for its use see util/cursor.h
37 *
38 * @details
39 * reset on every function
40 * */
42
43 /** @see `m_type_uniques` */
45
46 /**
47 * @var m_id
48 * @brief id
49 * */
50 aclspv_id_t m_id;
51
52 /**
53 * @var m_ret
54 * @brief fully emitted spir-v
55 * */
57
58 /**
59 * @var m_scale_vars
60 * @see util_bind
61 * */
63
64 /** cache for elements related to unsigned integer constants [lib_build_constant] */
66
67 /**
68 * @brief
69 * cache for cursors for parsing one function
70 * for its use see util/cursor.h
71 *
72 * [util_cursor]
73 *
74 * @details
75 * reset on every function
76 * */
78
79 /**
80 * @brief
81 * cache for complex types which needs to be stored somewhere
82 * for its use see util/type_unique.h
83 *
84 * [util_type_unique]
85 * */
87
88 struct {
89 aclspv_wrd_t m_w0;
90 aclspv_wrd_t m_w1;
91 aclspv_wrd_t m_w2;
92 aclspv_wrd_t m_w3;
93
94 x_aclspv_vec m_v0;
95 x_aclspv_vec m_v1;
96 } m_tmp;
97
98 struct {
100 m_capability,
101 m_ext,
102 m_memmodel,
103 m_entp,
104 m_execmode,
105 m_name,
106 m_decorate,
107 m_types,
108 m_vars,
109 m_fndef,
110 m_fnimpl;
111 } m_count;
112
113 struct {
115 m_num_fn,
116 m_num_entp;
117
118 /**
119 * @var m_fn
120 * @brief normal functions
121 * @see lib_build_fn_t
122 * */
123 x_aclspv_vec m_fn;
124
125 /**
126 * @var m_entp
127 * @brief entry functions
128 * @see lib_build_entp_t
129 * */
130 x_aclspv_vec m_entp;
131 } m_fnlist;
132
133 /**
134 * @var m_section
135 * @brief each section for m_ret
136 * */
137 struct {
138 x_aclspv_vec
139 m_capability,
140 m_ext,
141 m_memmodel,
142 m_entp,
143 m_execmode,
144 m_name,
145 m_decorate,
146 m_types,
147 m_vars,
148 m_fndef,
149 m_fnimpl;
150 } m_section;
151
152 aclspv_id_t m_id_defaults[ID_DEFAULT_END];
153} x_aclspv_ctx;
154
155typedef x_aclspv_ctx* ae2f_restrict h_aclspv_ctx_t;
156typedef h_aclspv_ctx_t h_util_ctx_t;
157
158#define _malloc_with_zero(a) calloc(a, 1)
159
160#endif
#define ae2f_IS_SHARED
Definition Call.auto.h:12
#define ae2f_OFF
Definition Call.auto.h:3
#define ae2f_WhenCXX(a)
Appears when the current language is C.
Definition Cxx.h:44
#define ae2f_WhenC(a)
Appears when the current language is C++.
Definition Cxx.h:38
#define unless(a)
Invokes when condition is false.
Definition Keys.h:34
#define ae2f_extern
Suggests the existence of external variable or function, in naming of C. [non-mangling].
Definition Keys.h:25
#define ae2f_NIL
Definition Nil.h:13
#define ACLSPV_ABI_DECL
Declaration as ABI.
Definition abi.h:23
#define STATE_VAL
#define FNINFO
#define cpysz
#define cpypad
#define ae2f_assume(a)
tells the compiler that value if a is false, below this keyword is not expected to be reached.
Definition cc.h:228
#define ae2f_unexpected_but_if(a)
Definition cc.h:192
#define ae2f_expected_but_else(a)
Definition cc.h:201
#define ae2f_ccconst
Keyword as [[const]] on C23..
Definition cc.h:66
#define ae2f_noexcept
marker that this function does not throw something.
Definition cc.h:133
#define ae2f_restrict
Keyword as restrict on C99.
Definition cc.h:81
#define ae2f_expected_not(a)
expectes a as false.
Definition cc.h:185
#define ae2f_unreachable()
tells the compiler that below this keyword is not expected to be reached.
Definition cc.h:213
#define ae2f_inline
inline
Definition cc.h:149
#define ae2f_expected(a)
expectes a as true.
Definition cc.h:184
#define CTX
#define EMIT_POS
#define util_emitx_type_pointer(h_wrds, c_wrdcount, c_retid, c_storage_class, c_elm_type_id)
Definition emitx.h:134
#define ret_count
#define get_buf_from_scale(h_alloc, c_scale)
Definition scale.h:34
#define aclspv_opcode_t
integer as operation code
Definition spvty.h:27
aclspv_wrd_t aclspv_wrdcount_t
the integer type represents the number of word.
Definition spvty.h:61
#define aclspv_wrd_t
integer as word
Definition spvty.h:16
x_aclspv_vec m_scale_vars
Definition ctx.h:62
aclspv_wrdcount_t m_num_type_uniques
Definition ctx.h:44
x_aclspv_vec m_cursors
cache for cursors for parsing one function for its use see util/cursor.h
Definition ctx.h:77
x_aclspv_vec m_constant_cache
Definition ctx.h:65
aclspv_id_t m_id
id
Definition ctx.h:50
x_aclspv_vec m_ret
word count for m_ret
Definition ctx.h:56
aclspv_wrd_t m_is_logical
when on, ignores m_is_buffer_64.
Definition ctx.h:23
aclspv_wrdcount_t m_num_cursor
number of m_cursors. for its use see util/cursor.h
Definition ctx.h:41
x_aclspv_vec m_type_uniques
cache for complex types which needs to be stored somewhere for its use see util/type_unique....
Definition ctx.h:86
util_bind_unified m_unified
Definition bind.h:20
#define emit_opcode(h_wrds, c_wrdcount, c_opcode, c_num_opprm_opt)
try emit opcode with num_opprm
Definition wrdemit.h:75
#define get_wrd_of_vec(vec)
get word buffer from vector
Definition wrdemit.h:38
#define count_to_sz(c_count)
word count to byte size
Definition wrdemit.h:32
#define set_oprnd_count_for_opcode(cr_wrd, c_num_opprm)
Definition wrdemit.h:78