mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
gallium: add opaque pointers shim for LLVM < 8.0
LLVM is transitioning to "opaque pointers", and as such deprecates LLVMBuildGEP, LLVMBuildCall, LLVMBuildLoad, replacing them with LLVMBuildGEP2, LLVMBuildCall2, LLVMBuildLoad2 respectivelly. These new functions were added in LLVM 8.0; so for LLVM before 8.0 we simply forward to the non-opaque-pointer variants. Acked-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15893>
This commit is contained in:
parent
bbdf7e45b1
commit
af20d46a39
1 changed files with 42 additions and 0 deletions
|
|
@ -87,4 +87,46 @@
|
|||
#define GALLIVM_HAVE_CORO 0
|
||||
#endif
|
||||
|
||||
/* LLVM is transitioning to "opaque pointers", and as such deprecates
|
||||
* LLVMBuildGEP, LLVMBuildCall, LLVMBuildLoad, replacing them with
|
||||
* LLVMBuildGEP2, LLVMBuildCall2, LLVMBuildLoad2 respectivelly.
|
||||
* These new functions were added in LLVM 8.0; so for LLVM before 8.0 we
|
||||
* simply forward to the non-opaque-pointer variants.
|
||||
*/
|
||||
#if LLVM_VERSION_MAJOR < 8
|
||||
|
||||
static inline LLVMValueRef
|
||||
LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
|
||||
LLVMValueRef Pointer, LLVMValueRef *Indices,
|
||||
unsigned NumIndices, const char *Name)
|
||||
{
|
||||
return LLVMBuildGEP(B, Pointer, Indices, NumIndices, Name);
|
||||
}
|
||||
|
||||
static inline LLVMValueRef
|
||||
LLVMBuildInBoundsGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
|
||||
LLVMValueRef Pointer, LLVMValueRef *Indices,
|
||||
unsigned NumIndices, const char *Name)
|
||||
{
|
||||
return LLVMBuildInBoundsGEP(B, Pointer, Indices, NumIndices, Name);
|
||||
}
|
||||
|
||||
static inline LLVMValueRef
|
||||
LLVMBuildLoad2(LLVMBuilderRef B, LLVMTypeRef Ty,
|
||||
LLVMValueRef PointerVal, const char *Name)
|
||||
{
|
||||
LLVMValueRef val = LLVMBuildLoad(B, PointerVal, Name);
|
||||
return LLVMTypeOf(val) == Ty ? val : LLVMBuildBitCast(B, val, Ty, Name);
|
||||
}
|
||||
|
||||
static inline LLVMValueRef
|
||||
LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn,
|
||||
LLVMValueRef *Args, unsigned NumArgs,
|
||||
const char *Name)
|
||||
{
|
||||
return LLVMBuildCall(B, Fn, Args, NumArgs, Name);
|
||||
}
|
||||
|
||||
#endif /* LLVM_VERSION_MAJOR < 8 */
|
||||
|
||||
#endif /* LP_BLD_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue