llvm.org GIT mirror llvm / d91aaf6
Revert "Expose TailCallKind via the LLVM C API" This is failing on several build bots. Reverting as discussed in https://reviews.llvm.org/D66061. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368953 91177308-0d34-0410-b5e6-96231b3b80d8 Jonas Devlieghere a month ago
4 changed file(s) with 3 addition(s) and 61 deletion(s). Raw diff Collapse all Expand all
450450 };
451451
452452 typedef unsigned LLVMAttributeIndex;
453
454 typedef enum {
455 LLVMTailCallKindNone,
456 LLVMTailCallKindTail,
457 LLVMTailCallKindMustTail,
458 LLVMTailCallKindNoTail
459 } LLVMTailCallKind;
460453
461454 /**
462455 * @}
32703263 void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall);
32713264
32723265 /**
3273 * Obtains the kind of tail call for a call instruction.
3274 *
3275 * This only works on llvm::CallInst instructions.
3276 *
3277 * @see llvm::CallInst::getTailCallKind()
3278 */
3279 LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef CallInst);
3280
3281 /**
3282 * Set the kind of tail call for a call instruction.
3283 *
3284 * This only works on llvm::CallInst instructions.
3285 *
3286 * @see llvm::CallInst::setTailCallKind()
3287 */
3288 void LLVMSetTailCallKind(LLVMValueRef CallInst, LLVMTailCallKind TCK);
3289
3290 /**
32913266 * Return the normal destination basic block.
32923267 *
32933268 * This only works on llvm::InvokeInst instructions.
28432843 unwrap(Call)->setTailCall(isTailCall);
28442844 }
28452845
2846 LLVMTailCallKind LLVMGetTailCallKind(LLVMValueRef Call) {
2847 switch (unwrap(Call)->getTailCallKind()) {
2848 case CallInst::TailCallKind::TCK_None:
2849 return LLVMTailCallKindNone;
2850 case CallInst::TailCallKind::TCK_Tail:
2851 return LLVMTailCallKindTail;
2852 case CallInst::TailCallKind::TCK_MustTail:
2853 return LLVMTailCallKindMustTail;
2854 case CallInst::TailCallKind::TCK_NoTail:
2855 return LLVMTailCallKindNoTail;
2856 }
2857 }
2858
2859 void LLVMSetTailCallKind(LLVMValueRef Call, LLVMTailCallKind TCK) {
2860 CallInst::TailCallKind kind;
2861 switch (TCK) {
2862 case LLVMTailCallKindNone:
2863 kind = CallInst::TailCallKind::TCK_None;
2864 break;
2865 case LLVMTailCallKindTail:
2866 kind = CallInst::TailCallKind::TCK_Tail;
2867 break;
2868 case LLVMTailCallKindMustTail:
2869 kind = CallInst::TailCallKind::TCK_MustTail;
2870 break;
2871 case LLVMTailCallKindNoTail:
2872 kind = CallInst::TailCallKind::TCK_NoTail;
2873 break;
2874 }
2875
2876 unwrap(Call)->setTailCallKind(kind);
2877 }
2878
28792846 /*--.. Operations on invoke instructions (only) ............................--*/
28802847
28812848 LLVMBasicBlockRef LLVMGetNormalDest(LLVMValueRef Invoke) {
5454 ret i32 %merge
5555
5656 unwind3: ; preds = %landingPad
57 %8 = musttail call i32 @llvm.eh.typeid.for(i8* nonnull bitcast (%C6object9ClassInfo* @C6object9Exception__ClassInfo to i8*))
57 %8 = tail call i32 @llvm.eh.typeid.for(i8* nonnull bitcast (%C6object9ClassInfo* @C6object9Exception__ClassInfo to i8*))
5858 %9 = icmp eq i32 %8, %5
5959 br i1 %9, label %catch, label %unwind5
6060
6161 unwind5: ; preds = %unwind3
62 %10 = notail call i32 @llvm.eh.typeid.for(i8* nonnull bitcast (%C6object9ClassInfo* @C6object9Throwable__ClassInfo to i8*))
62 %10 = tail call i32 @llvm.eh.typeid.for(i8* nonnull bitcast (%C6object9ClassInfo* @C6object9Throwable__ClassInfo to i8*))
6363 %11 = icmp eq i32 %10, %5
6464 br i1 %11, label %catch, label %unwind7
6565
642642 Args.push_back(CloneValue(LLVMGetOperand(Src, i)));
643643 LLVMValueRef Fn = CloneValue(LLVMGetCalledValue(Src));
644644 Dst = LLVMBuildCall(Builder, Fn, Args.data(), ArgCount, Name);
645 LLVMSetTailCallKind(Dst, LLVMGetTailCallKind(Src));
645 LLVMSetTailCall(Dst, LLVMIsTailCall(Src));
646646 CloneAttrs(Src, Dst);
647647 break;
648648 }