summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c4
-rw-r--r--lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp11
-rw-r--r--lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.h3
3 files changed, 17 insertions, 1 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c
index dd428242c..8694b3923 100644
--- a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -347,6 +347,10 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name,
if (!gallivm->module)
goto fail;
+#if defined(PIPE_ARCH_X86)
+ lp_set_module_stack_alignment_override(gallivm->module, 4);
+#endif
+
gallivm->builder = LLVMCreateBuilderInContext(gallivm->context);
if (!gallivm->builder)
goto fail;
diff --git a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 4f3e69681..3efa1d911 100644
--- a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -350,7 +350,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
* friends for configuring code generation options, like stack alignment.
*/
TargetOptions options;
-#if defined(PIPE_ARCH_X86)
+#if defined(PIPE_ARCH_X86) && LLVM_VERSION_MAJOR < 13
options.StackAlignmentOverride = 4;
#endif
@@ -596,3 +596,12 @@ lp_is_function(LLVMValueRef v)
{
return LLVMGetValueKind(v) == LLVMFunctionValueKind;
}
+
+extern "C" void
+lp_set_module_stack_alignment_override(LLVMModuleRef MRef, unsigned align)
+{
+#if LLVM_VERSION_MAJOR >= 13
+ llvm::Module *M = llvm::unwrap(MRef);
+ M->setOverrideStackAlignment(align);
+#endif
+}
diff --git a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.h
index f2a15f19e..fa0ce9016 100644
--- a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.h
+++ b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.h
@@ -91,6 +91,9 @@ lp_is_function(LLVMValueRef v);
void
lp_free_objcache(void *objcache);
+
+void
+lp_set_module_stack_alignment_override(LLVMModuleRef M, unsigned align);
#ifdef __cplusplus
}
#endif