I’m sorry, in your case I think you have to use the module level IR.
with declarations and a function definition
function foo(x)
Base.llvmcall(("""
declare i64 @llvm.abs.i64(i64, i1)
define i64 @entry(i64) {
%x = call i64 @llvm.abs.i64(i64 %0, i1 0)
ret i64 %x
}
""","entry"), Int64, Tuple{Int64}, x)
end
There are a bunch of examples in julia/llvmcall.jl at master · JuliaLang/julia · GitHub and
julia/llvmcall2.jl at master · JuliaLang/julia · GitHub