Add 'musttail' marker to call instructions

This is similar to the 'tail' marker, except that it guarantees that
tail call optimization will occur.  It also comes with convervative IR
verification rules that ensure that tail call optimization is possible.

Reviewers: nicholas

Differential Revision: http://llvm-reviews.chandlerc.com/D3240

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207143 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Kleckner committed 2014-04-24 20:14:34 +00:00
1 parent 870200a833
commit 710c1a449d
21 files changed
+334 -30

No files matched your search

+7 -2
View File
@@ -2994,8 +2994,13 @@ error_code BitcodeReader::ParseFunctionBody(Function *F) {
I = CallInst::Create(Callee, Args);
InstructionList.push_back(I);
cast<CallInst>(I)->setCallingConv(
static_cast<CallingConv::ID>(CCInfo>>1));
cast<CallInst>(I)->setTailCall(CCInfo & 1);
static_cast<CallingConv::ID>((~(1U << 14) & CCInfo) >> 1));
CallInst::TailCallKind TCK = CallInst::TCK_None;
if (CCInfo & 1)
TCK = CallInst::TCK_Tail;
if (CCInfo & (1 << 14))
TCK = CallInst::TCK_MustTail;
cast<CallInst>(I)->setTailCallKind(TCK);
cast<CallInst>(I)->setAttributes(PAL);
break;
}