diff options
author | Robert Widmann <devteam.codafi@gmail.com> | 2019-08-14 23:54:35 +0000 |
---|---|---|
committer | Robert Widmann <devteam.codafi@gmail.com> | 2019-08-14 23:54:35 +0000 |
commit | 708c4605a16b1caae640343ccf2ec74a56aee30e (patch) | |
tree | aac6b741ad1296cdffc02b5daac01a0a1560e0f4 /llvm/include/llvm-c | |
parent | 1c705d9c538d1d4a24f34e93be2582bc7e3a3da4 (diff) | |
download | bcm5719-llvm-708c4605a16b1caae640343ccf2ec74a56aee30e.tar.gz bcm5719-llvm-708c4605a16b1caae640343ccf2ec74a56aee30e.zip |
Expose TailCallKind via the LLVM C API
Summary: This exposes `CallInst`'s tail call kind via new `LLVMGetTailCallKind` and `LLVMSetTailCallKind` functions. The motivation for this is to be able to see `musttail` for languages that require mandatory tail calls for correctness. Today only the weaker `LLVMSetTail` is exposed and there is no way to set `GuaranteedTailCallOpt` via the C API.
Reviewers: CodaFi, jyknight, deadalnix, rnk
Reviewed By: CodaFi
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66061
llvm-svn: 368945
Diffstat (limited to 'llvm/include/llvm-c')
-rw-r--r-- | llvm/include/llvm-c/Core.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h index cac2f297056..00d151c4541 100644 --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -452,6 +452,13 @@ enum { typedef unsigned LLVMAttributeIndex; +typedef enum { + LLVMTailCallKindNone, + LLVMTailCallKindTail, + LLVMTailCallKindMustTail, + LLVMTailCallKindNoTail +} LLVMTailCallKind; + /** * @} */ @@ -3264,6 +3271,24 @@ LLVMBool LLVMIsTailCall(LLVMValueRef CallInst); void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall); /** + * Obtains the kind of tail call for a call instruction. + * + * This only works on llvm::CallInst instructions. + * + * @see llvm::CallInst::getTailCallKind() + */ +LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef CallInst); + +/** + * Set the kind of tail call for a call instruction. + * + * This only works on llvm::CallInst instructions. + * + * @see llvm::CallInst::setTailCallKind() + */ +void LLVMSetTailCallKind(LLVMValueRef CallInst, LLVMTailCallKind TCK); + +/** * Return the normal destination basic block. * * This only works on llvm::InvokeInst instructions. |