avoid a lot of unneeded selector processing work by passing around

selectors instead of Value*'s.

llvm-svn: 52760
This commit is contained in:
Chris Lattner 2008-06-26 04:42:20 +00:00
parent 9a05d04a0d
commit 6cfec78e48
4 changed files with 10 additions and 20 deletions

View File

@ -490,14 +490,9 @@ Value *ScalarExprEmitter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
}
}
// 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());
}

View File

@ -86,14 +86,9 @@ llvm::Value *CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) {
}
}
// 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 @@ llvm::Value *CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) {
}
return Runtime->GenerateMessageSend(Builder, ConvertType(E->getType()),
LoadObjCSelf(),
Receiver, SelPtr,
Receiver, E->getSelector(),
&Args[0], Args.size());
}

View File

@ -105,7 +105,7 @@ public:
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 @@ public:
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 @@ llvm::Value *CGObjCGNU::GenerateMessageSend(llvm::IRBuilder &Builder,
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;

View File

@ -46,7 +46,7 @@ public:
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