[cfe-commits] r102839 - /cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

David Chisnall csdavec at swan.ac.uk
Sat May 1 05:56:56 PDT 2010


Author: theraven
Date: Sat May  1 07:56:56 2010
New Revision: 102839

URL: http://llvm.org/viewvc/llvm-project?rev=102839&view=rev
Log:
Attach message send metadata to the lookup as well as to the call (GNU runtime).


Modified:
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=102839&r1=102838&r2=102839&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Sat May  1 07:56:56 2010
@@ -642,6 +642,14 @@
   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 @@
     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 @@
       "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);
 





More information about the cfe-commits mailing list