[cfe-commits] r102862 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CGObjCGNU.cpp CodeGenFunction.h

David Chisnall csdavec at swan.ac.uk
Sun May 2 06:41:58 PDT 2010


Author: theraven
Date: Sun May  2 08:41:58 2010
New Revision: 102862

URL: http://llvm.org/viewvc/llvm-project?rev=102862&view=rev
Log:
As per Chris' request, return the Instruction from EmitCall and add the metadata in the caller.


Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=102862&r1=102861&r2=102862&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Sun May  2 08:41:58 2010
@@ -870,8 +870,7 @@
                                  ReturnValueSlot ReturnValue,
                                  const CallArgList &CallArgs,
                                  const Decl *TargetDecl,
-                                 unsigned MDKind,
-                                 llvm::MDNode *Metadata) {
+                                 llvm::Instruction **callOrInvoke) {
   // FIXME: We no longer need the types from CallArgs; lift up and simplify.
   llvm::SmallVector<llvm::Value*, 16> Args;
 
@@ -997,8 +996,8 @@
                               Args.data(), Args.data()+Args.size());
     EmitBlock(Cont);
   }
-  if (Metadata) {
-    CS->setMetadata(MDKind, Metadata);
+  if (callOrInvoke) {
+    *callOrInvoke = CS.getInstruction();
   }
 
   CS.setAttributes(Attrs);

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=102862&r1=102861&r2=102862&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Sun May  2 08:41:58 2010
@@ -566,8 +566,11 @@
    };
   llvm::MDNode *node = llvm::MDNode::get(VMContext, impMD, 3);
 
-  return CGF.EmitCall(FnInfo, imp, ReturnValueSlot(), ActualArgs,
-          0, msgSendMDKind, node);
+  llvm::Instruction *call;
+  RValue msgRet = CGF.EmitCall(FnInfo, imp, ReturnValueSlot(), ActualArgs,
+      0, &call);
+  call->setMetadata(msgSendMDKind, node);
+  return msgRet;
 }
 
 /// Generate code for a message send expression.
@@ -707,8 +710,10 @@
     imp = Builder.CreateCall2(lookupFunction, Receiver, cmd);
     cast<llvm::CallInst>(imp)->setMetadata(msgSendMDKind, node);
   }
+  llvm::Instruction *call;
   RValue msgRet = CGF.EmitCall(FnInfo, imp, ReturnValueSlot(), ActualArgs,
-      0, msgSendMDKind, node);
+      0, &call);
+  call->setMetadata(msgSendMDKind, node);
 
   if (!isPointerSizedReturn) {
     CGF.EmitBlock(contiueBB);

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=102862&r1=102861&r2=102862&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sun May  2 08:41:58 2010
@@ -1114,8 +1114,7 @@
                   ReturnValueSlot ReturnValue,
                   const CallArgList &Args,
                   const Decl *TargetDecl = 0,
-                  unsigned MDKind = 0,
-                  llvm::MDNode *Metadata = 0);
+                  llvm::Instruction **callOrInvoke = 0);
 
   RValue EmitCall(QualType FnType, llvm::Value *Callee,
                   ReturnValueSlot ReturnValue,





More information about the cfe-commits mailing list