about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorTshepang Mbambo <hopsi@tuta.io>2025-08-04 15:20:57 +0200
committerGitHub <noreply@github.com>2025-08-04 15:20:57 +0200
commita13caaae3e87d9084a16f023e91880dd2ef0bc09 (patch)
treead7f71f36fed97f65204d8a1f8c594c8ac1d2df8 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent788845811e076df8edceccd49e174d2b3ec4e71d (diff)
parent682a6e17e4dcc02944b00834f11e7cdd7067ebd1 (diff)
downloadrust-a13caaae3e87d9084a16f023e91880dd2ef0bc09.tar.gz
rust-a13caaae3e87d9084a16f023e91880dd2ef0bc09.zip
Merge pull request #2533 from rust-lang/rustc-pull
Rustc pull update
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index c9814beedd6..588d867bbbf 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -1986,3 +1986,29 @@ extern "C" void LLVMRustSetNoSanitizeHWAddress(LLVMValueRef Global) {
   MD.NoHWAddress = true;
   GV.setSanitizerMetadata(MD);
 }
+
+enum class LLVMRustTailCallKind {
+  None = 0,
+  Tail = 1,
+  MustTail = 2,
+  NoTail = 3
+};
+
+extern "C" void LLVMRustSetTailCallKind(LLVMValueRef Call,
+                                        LLVMRustTailCallKind Kind) {
+  CallInst *CI = unwrap<CallInst>(Call);
+  switch (Kind) {
+  case LLVMRustTailCallKind::None:
+    CI->setTailCallKind(CallInst::TCK_None);
+    break;
+  case LLVMRustTailCallKind::Tail:
+    CI->setTailCallKind(CallInst::TCK_Tail);
+    break;
+  case LLVMRustTailCallKind::MustTail:
+    CI->setTailCallKind(CallInst::TCK_MustTail);
+    break;
+  case LLVMRustTailCallKind::NoTail:
+    CI->setTailCallKind(CallInst::TCK_NoTail);
+    break;
+  }
+}