gallivm: add new wrapper around Module::setOverrideStackAlignment()

We need it in the next commit to replace setting the stack alignment on
i386 with LLVM >= 13 through the TargetOption::StackAlignmentOverride,
which was removed in the upstream commit
<3787ee4571>.

Unfortunately Module::setOverrideStackAlignment() is not available
through the C API and we need to wrap it ourselves.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reference: mesa/mesa#4906
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11940>
This commit is contained in:
Kai Wasserbäch 2021-07-22 07:34:09 +02:00 committed by Marge Bot
parent 2a860bb8c3
commit c1b4c64a28
2 changed files with 12 additions and 0 deletions

View File

@ -615,3 +615,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
}

View File

@ -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