aboutsummaryrefslogtreecommitdiff
path: root/src/zig_llvm.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-12-05 16:55:32 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-12-05 17:07:15 -0500
commit1f602fe8c5b3dea9f00f96e70dad73ebce405b49 (patch)
tree30df1e8c6fd6f4dd99d91679aa02c79e0ff75c5f /src/zig_llvm.cpp
parent38791ac616069963fd808ec724161b93cbc564c1 (diff)
downloadzig-1f602fe8c5b3dea9f00f96e70dad73ebce405b49.tar.gz
zig-1f602fe8c5b3dea9f00f96e70dad73ebce405b49.zip
implement `@call`
closes #3732
Diffstat (limited to 'src/zig_llvm.cpp')
-rw-r--r--src/zig_llvm.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp
index ac17e6edfe..71d30e566c 100644
--- a/src/zig_llvm.cpp
+++ b/src/zig_llvm.cpp
@@ -269,19 +269,25 @@ ZIG_EXTERN_C LLVMTypeRef ZigLLVMTokenTypeInContext(LLVMContextRef context_ref) {
}
LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *Args,
- unsigned NumArgs, unsigned CC, ZigLLVM_FnInline fn_inline, const char *Name)
+ unsigned NumArgs, unsigned CC, ZigLLVM_CallAttr attr, const char *Name)
{
CallInst *call_inst = CallInst::Create(unwrap(Fn), makeArrayRef(unwrap(Args), NumArgs), Name);
call_inst->setCallingConv(CC);
- switch (fn_inline) {
- case ZigLLVM_FnInlineAuto:
+ switch (attr) {
+ case ZigLLVM_CallAttrAuto:
break;
- case ZigLLVM_FnInlineAlways:
- call_inst->addAttribute(AttributeList::FunctionIndex, Attribute::AlwaysInline);
+ case ZigLLVM_CallAttrNeverTail:
+ call_inst->setTailCallKind(CallInst::TCK_NoTail);
break;
- case ZigLLVM_FnInlineNever:
+ case ZigLLVM_CallAttrNeverInline:
call_inst->addAttribute(AttributeList::FunctionIndex, Attribute::NoInline);
break;
+ case ZigLLVM_CallAttrAlwaysTail:
+ call_inst->setTailCallKind(CallInst::TCK_MustTail);
+ break;
+ case ZigLLVM_CallAttrAlwaysInline:
+ call_inst->addAttribute(AttributeList::FunctionIndex, Attribute::AlwaysInline);
+ break;
}
return wrap(unwrap(B)->Insert(call_inst));
}