3#ifndef util_is_kernel_h
4#define util_is_kernel_h
7#include <clang-c/Index.h>
12ae2f_inline static unsigned util_is_kernel(
const CXCursor h_fndecl) {
13 CXString SPELL_FNDECL;
17 unsigned NUM_TOKEN, IDX;
18 if (clang_getCursorKind(h_fndecl) != CXCursor_FunctionDecl)
21 RANGE = clang_getCursorExtent(h_fndecl);
22 TU = clang_Cursor_getTranslationUnit(h_fndecl);
24 SPELL_FNDECL = clang_getCursorSpelling(h_fndecl);
29 clang_tokenize(TU, RANGE, (CXToken**)&TOKS, &NUM_TOKEN);
35 CXString SPELL = clang_getTokenSpelling(TU, TOKS[IDX]);
37 unless (strcmp(SPELL_FNDECL.data, SPELL.data))
40 if (strstr(clang_getCString(SPELL),
"kernel")) {
41 clang_disposeString(SPELL);
45 clang_disposeString(SPELL);
48 clang_disposeTokens(TU, TOKS, NUM_TOKEN);
49 clang_disposeString(SPELL_FNDECL);
50 return IDX < NUM_TOKEN;
#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_ccpure
Keyword as [[pure]] on C23.
#define ae2f_expected_but_else(a)
#define ae2f_expected_if(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_MASK_OPCODE
mask for opcode
#define aclspv_wrd_t
integer as word
#define ACLSPV_MASK_NOPRNDS
mask for number of operands
x_aclspv_vec m_scale_vars
aclspv_wrdcount_t m_num_type_uniques
x_aclspv_vec m_cursors
cache for cursors for parsing one function for its use see util/cursor.h
x_aclspv_vec m_constant_cache
x_aclspv_vec m_ret
word count for m_ret
aclspv_wrd_t m_is_logical
when on, ignores m_is_buffer_64.
aclspv_wrdcount_t m_num_cursor
number of m_cursors. for its use see util/cursor.h
x_aclspv_vec m_type_uniques
cache for complex types which needs to be stored somewhere for its use see util/type_unique....
util_bind_unified m_unified
#define mk_noprnds(c_num_opprm)
#define emit_opcode(h_wrds, c_wrdcount, c_opcode, c_num_opprm_opt)
try emit opcode with num_opprm
#define sz_to_count(c_sz)
byte size to word count
#define get_wrd_of_vec(vec)
get word buffer from vector
aclspv_wrdcount_t spvsz_t
#define count_to_sz(c_count)
word count to byte size
#define set_oprnd_count_for_opcode(cr_wrd, c_num_opprm)
#define opcode_to_wrd(c_opcode, c_num_opprm)