[cfe-commits] r52760 - in /cfe/trunk/lib/CodeGen: CGExprScalar.cpp CGObjC.cpp CGObjCGNU.cpp CGObjCRuntime.h

Chris Lattner sabre at nondot.org
Wed Jun 25 21:42:20 PDT 2008


Author: lattner
Date: Wed Jun 25 23:42:20 2008
New Revision: 52760

URL: http://llvm.org/viewvc/llvm-project?rev=52760&view=rev
Log:
avoid a lot of unneeded selector processing work by passing around
selectors instead of Value*'s.

Modified:
    cfe/trunk/lib/CodeGen/CGExprScalar.cpp
    cfe/trunk/lib/CodeGen/CGObjC.cpp
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
    cfe/trunk/lib/CodeGen/CGObjCRuntime.h

Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=52760&r1=52759&r2=52760&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Jun 25 23:42:20 2008
@@ -490,14 +490,9 @@
     }
   }
 
-  // Get the selector string
-  std::string SelStr = E->getSelector().getName();
-  llvm::Constant *Selector = CGF.CGM.GetAddrOfConstantString(SelStr);
-
-  llvm::Value *SelPtr = Builder.CreateStructGEP(Selector, 0);
   return Runtime->GenerateMessageSend(Builder, ConvertType(E->getType()),
                                       CGF.LoadObjCSelf(),
-                                      Receiver, SelPtr,
+                                      Receiver, E->getSelector(),
                                       &Args[0], Args.size());
 }
 

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=52760&r1=52759&r2=52760&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Wed Jun 25 23:42:20 2008
@@ -86,14 +86,9 @@
     }
   }
 
-  // Get the selector string
-  std::string SelStr = E->getSelector().getName();
-  llvm::Constant *Selector = CGM.GetAddrOfConstantString(SelStr);
-
-  llvm::Value *SelPtr = Builder.CreateStructGEP(Selector, 0);
   if (isSuperMessage) {
-    const ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(CurFuncDecl);
-    assert(OMD && "super is only valid in an Objective-C method");
+    // super is only valid in an Objective-C method
+    const ObjCMethodDecl *OMD = cast<ObjCMethodDecl>(CurFuncDecl);
     const char *SuperClass =
       OMD->getClassInterface()->getSuperClass()->getName();
     return Runtime->GenerateMessageSendSuper(Builder, ConvertType(E->getType()),
@@ -103,7 +98,7 @@
   }
   return Runtime->GenerateMessageSend(Builder, ConvertType(E->getType()),
                                       LoadObjCSelf(),
-                                      Receiver, SelPtr,
+                                      Receiver, E->getSelector(),
                                       &Args[0], Args.size());
 }
 

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=52760&r1=52759&r2=52760&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Jun 25 23:42:20 2008
@@ -105,7 +105,7 @@
                                            const llvm::Type *ReturnTy,
                                            llvm::Value *Sender,
                                            llvm::Value *Receiver,
-                                           llvm::Value *Selector,
+                                           Selector Sel,
                                            llvm::Value** ArgV,
                                            unsigned ArgC);
   virtual llvm::Value *GenerateMessageSendSuper(llvm::IRBuilder &Builder,
@@ -116,8 +116,8 @@
                                                 Selector Sel,
                                                 llvm::Value** ArgV,
                                                 unsigned ArgC);
-  virtual llvm::Value *LookupClass(llvm::IRBuilder &Builder, llvm::Value
-      *ClassName);
+  virtual llvm::Value *LookupClass(llvm::IRBuilder &Builder,
+                                   llvm::Value *ClassName);
   virtual llvm::Value *GetSelector(llvm::IRBuilder &Builder, Selector Sel);
   virtual llvm::Value *GetSelector(llvm::IRBuilder &Builder,
                                    llvm::Value *SelName,
@@ -385,10 +385,10 @@
                                             const llvm::Type *ReturnTy,
                                             llvm::Value *Sender,
                                             llvm::Value *Receiver,
-                                            llvm::Value *Selector,
+                                            Selector Sel,
                                             llvm::Value** ArgV,
                                             unsigned ArgC) {
-  llvm::Value *cmd = GetSelector(Builder, Selector, 0);
+  llvm::Value *cmd = GetSelector(Builder, Sel);
 
   // Look up the method implementation.
   std::vector<const llvm::Type*> impArgTypes;

Modified: cfe/trunk/lib/CodeGen/CGObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCRuntime.h?rev=52760&r1=52759&r2=52760&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGObjCRuntime.h Wed Jun 25 23:42:20 2008
@@ -46,7 +46,7 @@
                                            const llvm::Type *ReturnTy,
                                            llvm::Value *Sender,
                                            llvm::Value *Receiver,
-                                           llvm::Value *Selector,
+                                           Selector Sel,
                                            llvm::Value** ArgV,
                                            unsigned ArgC) =0;
   /// Generate the function required to register all Objective-C components in





More information about the cfe-commits mailing list