LLVMValueRef v_state,
ExprEvalStep *op,
int natts, LLVMValueRef *v_args);
+#if LLVM_VERSION_MAJOR < 22
static LLVMValueRef create_LifetimeEnd(LLVMModuleRef mod);
+#endif
/* macro making it easier to call ExecEval* functions */
#define build_EvalXFunc(b, mod, funcname, v_state, op, ...) \
LLVMModuleRef mod, FunctionCallInfo fcinfo,
LLVMValueRef *v_fcinfo_isnull)
{
- LLVMContextRef lc;
LLVMValueRef v_fn;
LLVMValueRef v_fcinfo_isnullp;
LLVMValueRef v_retval;
LLVMValueRef v_fcinfo;
- lc = LLVMGetModuleContext(mod);
-
v_fn = llvm_function_reference(context, b, mod, fcinfo);
v_fcinfo = l_ptr_const(fcinfo, l_ptr(StructFunctionCallInfoData));
if (v_fcinfo_isnull)
*v_fcinfo_isnull = l_load(b, TypeStorageBool, v_fcinfo_isnullp, "");
+#if LLVM_VERSION_MAJOR < 22
+
/*
* Add lifetime-end annotation, signaling that writes to memory don't have
* to be retained (important for inlining potential).
*/
{
+ LLVMContextRef lc = LLVMGetModuleContext(mod);
LLVMValueRef v_lifetime = create_LifetimeEnd(mod);
LLVMValueRef params[2];
params[1] = l_ptr_const(&fcinfo->isnull, l_ptr(LLVMInt8TypeInContext(lc)));
l_call(b, LLVMGetFunctionType(v_lifetime), v_lifetime, params, lengthof(params), "");
}
+#endif
return v_retval;
}
return v_ret;
}
+#if LLVM_VERSION_MAJOR < 22
static LLVMValueRef
create_LifetimeEnd(LLVMModuleRef mod)
{
return fn;
}
+#endif