summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Chisnall <csdavec@swan.ac.uk>2010-05-01 12:56:56 +0000
committerDavid Chisnall <csdavec@swan.ac.uk>2010-05-01 12:56:56 +0000
commitc0cf422d5671d000fcd0aa724ba8e0718224e3c2 (patch)
tree18b06d2314055bc5b298a2d908b7b577bde601cf /clang/lib/CodeGen
parent737718d4f46dd58a1bca66f8d017e6cb07abd962 (diff)
downloadbcm5719-llvm-c0cf422d5671d000fcd0aa724ba8e0718224e3c2.tar.gz
bcm5719-llvm-c0cf422d5671d000fcd0aa724ba8e0718224e3c2.zip
Attach message send metadata to the lookup as well as to the call (GNU runtime).
llvm-svn: 102839
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGObjCGNU.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index bd7a1504cf7..8afce6204df 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -642,6 +642,14 @@ CGObjCGNU::GenerateMessageSend(CodeGen::CodeGenFunction &CGF,
const llvm::FunctionType *impType =
Types.GetFunctionType(FnInfo, Method ? Method->isVariadic() : false);
+ 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);
+
+
llvm::Value *imp;
// For sender-aware dispatch, we pass the sender as the third argument to a
// lookup function. When sending messages from C code, the sender is nil.
@@ -679,6 +687,7 @@ CGObjCGNU::GenerateMessageSend(CodeGen::CodeGenFunction &CGF,
llvm::CallInst *slot =
Builder.CreateCall3(lookupFunction, ReceiverPtr, cmd, self);
slot->setOnlyReadsMemory();
+ slot->setMetadata(msgSendMDKind, node);
imp = Builder.CreateLoad(Builder.CreateStructGEP(slot, 4));
@@ -696,14 +705,8 @@ CGObjCGNU::GenerateMessageSend(CodeGen::CodeGenFunction &CGF,
"objc_msg_lookup");
imp = Builder.CreateCall2(lookupFunction, Receiver, cmd);
+ cast<llvm::CallInst>(imp)->setMetadata(msgSendMDKind, node);
}
- 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);
OpenPOWER on IntegriCloud