1 /**************************************************************************
3 * Copyright 2019 Red Hat.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 **************************************************************************/
30 #include "pipe/p_compiler.h"
31 #include "gallivm/lp_bld.h"
34 LLVMValueRef
lp_build_coro_id(struct gallivm_state
*gallivm
);
36 LLVMValueRef
lp_build_coro_size(struct gallivm_state
*gallivm
);
38 LLVMValueRef
lp_build_coro_begin(struct gallivm_state
*gallivm
,
39 LLVMValueRef coro_id
, LLVMValueRef mem_ptr
);
41 LLVMValueRef
lp_build_coro_free(struct gallivm_state
*gallivm
,
42 LLVMValueRef coro_id
, LLVMValueRef coro_hdl
);
44 void lp_build_coro_end(struct gallivm_state
*gallivm
,
45 LLVMValueRef coro_hdl
);
47 void lp_build_coro_resume(struct gallivm_state
*gallivm
, LLVMValueRef coro_hdl
);
49 void lp_build_coro_destroy(struct gallivm_state
*gallivm
, LLVMValueRef coro_hdl
);
51 LLVMValueRef
lp_build_coro_done(struct gallivm_state
*gallivm
, LLVMValueRef coro_hdl
);
53 LLVMValueRef
lp_build_coro_suspend(struct gallivm_state
*gallivm
, bool last
);
55 LLVMValueRef
lp_build_coro_alloc(struct gallivm_state
*gallivm
, LLVMValueRef id
);
57 LLVMValueRef
lp_build_coro_begin_alloc_mem(struct gallivm_state
*gallivm
, LLVMValueRef coro_id
);
58 void lp_build_coro_free_mem(struct gallivm_state
*gallivm
, LLVMValueRef coro_id
, LLVMValueRef coro_hdl
);
60 struct lp_build_coro_suspend_info
{
61 LLVMBasicBlockRef suspend
;
62 LLVMBasicBlockRef cleanup
;
65 void lp_build_coro_suspend_switch(struct gallivm_state
*gallivm
,
66 const struct lp_build_coro_suspend_info
*sus_info
,
67 LLVMBasicBlockRef resume_block
,
70 void lp_build_coro_add_malloc_hooks(struct gallivm_state
*gallivm
);
71 void lp_build_coro_declare_malloc_hooks(struct gallivm_state
*gallivm
);