gallivm: handle llvm coroutines for llvm > 15
LLVM 15 changed the coroutine presplit function attribute in 735e6c40b5e9 [Coroutines] Convert coroutine.presplit to enum attr This needed to be updated in mesa. Cc: mesa-stable Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18815>
This commit is contained in:
@@ -3374,7 +3374,7 @@ draw_tcs_llvm_generate(struct draw_llvm *llvm,
|
||||
|
||||
LLVMSetFunctionCallConv(variant_coro, LLVMCCallConv);
|
||||
|
||||
LLVMAddTargetDependentFunctionAttr(variant_coro, "coroutine.presplit", "0");
|
||||
lp_build_coro_add_presplit(variant_coro);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(arg_types); ++i) {
|
||||
if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind) {
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include <stdbool.h>
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "gallivm/lp_bld.h"
|
||||
#include "gallivm/lp_bld_intr.h"
|
||||
|
||||
struct gallivm_state;
|
||||
LLVMValueRef lp_build_coro_id(struct gallivm_state *gallivm);
|
||||
@@ -73,4 +74,14 @@ void lp_build_coro_suspend_switch(struct gallivm_state *gallivm,
|
||||
|
||||
void lp_build_coro_add_malloc_hooks(struct gallivm_state *gallivm);
|
||||
void lp_build_coro_declare_malloc_hooks(struct gallivm_state *gallivm);
|
||||
|
||||
static inline void lp_build_coro_add_presplit(LLVMValueRef coro)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR >= 15
|
||||
lp_add_function_attr(coro, -1, LP_FUNC_ATTR_PRESPLITCORO);
|
||||
#else
|
||||
LLVMAddTargetDependentFunctionAttr(coro, "coroutine.presplit", "0");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -143,6 +143,7 @@ static const char *attr_to_str(enum lp_func_attr attr)
|
||||
case LP_FUNC_ATTR_WRITEONLY: return "writeonly";
|
||||
case LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY: return "inaccessiblememonly";
|
||||
case LP_FUNC_ATTR_CONVERGENT: return "convergent";
|
||||
case LP_FUNC_ATTR_PRESPLITCORO: return "presplitcoroutine";
|
||||
default:
|
||||
_debug_printf("Unhandled function attribute: %x\n", attr);
|
||||
return 0;
|
||||
|
@@ -41,6 +41,7 @@
|
||||
#include "gallivm/lp_bld.h"
|
||||
#include "gallivm/lp_bld_init.h"
|
||||
|
||||
struct lp_type;
|
||||
|
||||
/**
|
||||
* Max number of arguments in an intrinsic.
|
||||
@@ -57,6 +58,7 @@ enum lp_func_attr {
|
||||
LP_FUNC_ATTR_WRITEONLY = (1 << 7),
|
||||
LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY = (1 << 8),
|
||||
LP_FUNC_ATTR_CONVERGENT = (1 << 9),
|
||||
LP_FUNC_ATTR_PRESPLITCORO = (1 << 10),
|
||||
|
||||
/* Legacy intrinsic that needs attributes on function declarations
|
||||
* and they must match the internal LLVM definition exactly, otherwise
|
||||
|
@@ -133,7 +133,7 @@ generate_compute(struct llvmpipe_context *lp,
|
||||
|
||||
coro = LLVMAddFunction(gallivm->module, func_name_coro, coro_func_type);
|
||||
LLVMSetFunctionCallConv(coro, LLVMCCallConv);
|
||||
LLVMAddTargetDependentFunctionAttr(coro, "coroutine.presplit", "0");
|
||||
lp_build_coro_add_presplit(coro);
|
||||
|
||||
variant->function = function;
|
||||
|
||||
|
Reference in New Issue
Block a user