diff options
author | David Chisnall <csdavec@swan.ac.uk> | 2010-05-01 11:15:56 +0000 |
---|---|---|
committer | David Chisnall <csdavec@swan.ac.uk> | 2010-05-01 11:15:56 +0000 |
commit | dd5c98f709837e5dd3da08d44d1ce407975df2cf (patch) | |
tree | 5b53442ade12cab1703622ac8ec42ace1b4706fc /lib/CodeGen/CGObjCGNU.cpp | |
parent | afaf0fa8c2a3ec069cef0f895f6bc52cd3fdf8b0 (diff) |
Tweaked EmitCall() to permit the caller to provide some metadata to attach to the call site.
Used this in CGObjCGNU to attach metadata about message sends to permit speculative inlining.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102833 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCGNU.cpp')
-rw-r--r-- | lib/CodeGen/CGObjCGNU.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index 9e999ace16..8173aa0425 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -539,7 +539,15 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, llvm::Value *imp = CGF.Builder.CreateCall(lookupFunction, lookupArgs, lookupArgs+2); - return CGF.EmitCall(FnInfo, imp, ReturnValueSlot(), ActualArgs); + llvm::Value *impMD[] = { + llvm::MDString::get(VMContext, Sel.getAsString()), + llvm::MDString::get(VMContext, Class->getSuperClass()->getNameAsString()), + llvm::ConstantInt::get(llvm::Type::getInt1Ty(VMContext), IsClassMessage) + }; + llvm::MDNode *node = llvm::MDNode::get(VMContext, impMD, 3); + + return CGF.EmitCall(FnInfo, imp, ReturnValueSlot(), ActualArgs, + 0, msgSendMDKind, node); } /// Generate code for a message send expression. @@ -653,12 +661,6 @@ CGObjCGNU::GenerateMessageSend(CodeGen::CodeGenFunction &CGF, slot->setOnlyReadsMemory(); imp = Builder.CreateLoad(Builder.CreateStructGEP(slot, 4)); - llvm::Value *impMD[] = { - llvm::MDString::get(VMContext, Sel.getAsString()), - llvm::MDString::get(VMContext, Class ? Class->getNameAsString() :""), - }; - llvm::MDNode *node = llvm::MDNode::get(VMContext, impMD, 2); - cast<llvm::Instruction>(imp)->setMetadata(msgSendMDKind, node); // The lookup function may have changed the receiver, so make sure we use // the new one. @@ -675,8 +677,15 @@ CGObjCGNU::GenerateMessageSend(CodeGen::CodeGenFunction &CGF, imp = Builder.CreateCall2(lookupFunction, Receiver, cmd); } - RValue msgRet = - CGF.EmitCall(FnInfo, imp, ReturnValueSlot(), ActualArgs); + llvm::Value *impMD[] = { + llvm::MDString::get(VMContext, Sel.getAsString()), + llvm::MDString::get(VMContext, Class ? Class->getNameAsString() :""), + llvm::ConstantInt::get(llvm::Type::getInt1Ty(VMContext), Class!=0) + }; + llvm::MDNode *node = llvm::MDNode::get(VMContext, impMD, 3); + + RValue msgRet = CGF.EmitCall(FnInfo, imp, ReturnValueSlot(), ActualArgs, + 0, msgSendMDKind, node); if (!isPointerSizedReturn) { CGF.EmitBlock(contiueBB); |