[cfe-commits] r54667 - in /cfe/trunk/lib/CodeGen: CGObjC.cpp CGObjCGNU.cpp CGObjCMac.cpp CGObjCRuntime.h
Daniel Dunbar
daniel at zuster.org
Mon Aug 11 22:28:49 PDT 2008
Author: ddunbar
Date: Tue Aug 12 00:28:47 2008
New Revision: 54667
URL: http://llvm.org/viewvc/llvm-project?rev=54667&view=rev
Log:
Drop Sender from GenerateMessageSend*
- Was unused and generated a unnecessary load of self
Update NeXT runtime to get proper object & selector types from
ASTContext.
Modified:
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CGObjCRuntime.h
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=54667&r1=54666&r2=54667&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Tue Aug 12 00:28:47 2008
@@ -61,7 +61,7 @@
isSuperMessage = true;
Receiver = LoadObjCSelf();
} else {
- Receiver = EmitScalarExpr(E->getReceiver());
+ Receiver = EmitScalarExpr(E->getReceiver());
}
// Process the arguments
@@ -91,12 +91,11 @@
const char *SuperClass =
OMD->getClassInterface()->getSuperClass()->getName();
return Runtime.GenerateMessageSendSuper(Builder, ConvertType(E->getType()),
- Receiver, SuperClass,
+ SuperClass,
Receiver, E->getSelector(),
&Args[0], Args.size());
}
return Runtime.GenerateMessageSend(Builder, ConvertType(E->getType()),
- LoadObjCSelf(),
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=54667&r1=54666&r2=54667&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Tue Aug 12 00:28:47 2008
@@ -93,14 +93,12 @@
virtual llvm::Constant *GenerateConstantString(const std::string &String);
virtual llvm::Value *GenerateMessageSend(llvm::IRBuilder<> &Builder,
const llvm::Type *ReturnTy,
- llvm::Value *Sender,
llvm::Value *Receiver,
Selector Sel,
llvm::Value** ArgV,
unsigned ArgC);
virtual llvm::Value *GenerateMessageSendSuper(llvm::IRBuilder<> &Builder,
const llvm::Type *ReturnTy,
- llvm::Value *Sender,
const char *SuperClassName,
llvm::Value *Receiver,
Selector Sel,
@@ -265,7 +263,6 @@
///should be called.
llvm::Value *CGObjCGNU::GenerateMessageSendSuper(llvm::IRBuilder<> &Builder,
const llvm::Type *ReturnTy,
- llvm::Value *Sender,
const char *SuperClassName,
llvm::Value *Receiver,
Selector Sel,
@@ -312,7 +309,6 @@
/// Generate code for a message send expression.
llvm::Value *CGObjCGNU::GenerateMessageSend(llvm::IRBuilder<> &Builder,
const llvm::Type *ReturnTy,
- llvm::Value *Sender,
llvm::Value *Receiver,
Selector Sel,
llvm::Value** ArgV,
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=54667&r1=54666&r2=54667&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Aug 12 00:28:47 2008
@@ -38,10 +38,10 @@
public:
const llvm::Type *LongTy;
- /// ObjectTy - Opaque type for Objective-C objects
- const llvm::Type *ObjectTy, *ObjectPtrTy;
- /// SelectorTy - Opaque type for Objective-C selectors
- const llvm::Type *SelectorTy, *SelectorPtrTy;
+ /// ObjectPtrTy - LLVM type for object handles (typeof(id))
+ const llvm::Type *ObjectPtrTy;
+ /// SelectorTy - LLVM type for selector handles (typeof(SEL))
+ const llvm::Type *SelectorPtrTy;
public:
ObjCTypesHelper(CodeGen::CodeGenModule &cgm);
@@ -91,7 +91,6 @@
virtual llvm::Value *GenerateMessageSend(llvm::IRBuilder<> &Builder,
const llvm::Type *ReturnTy,
- llvm::Value *Sender,
llvm::Value *Receiver,
Selector Sel,
llvm::Value** ArgV,
@@ -99,7 +98,6 @@
virtual llvm::Value *GenerateMessageSendSuper(llvm::IRBuilder<> &Builder,
const llvm::Type *ReturnTy,
- llvm::Value *Sender,
const char *SuperClassName,
llvm::Value *Receiver,
Selector Sel,
@@ -247,7 +245,6 @@
/// which class's method should be called.
llvm::Value *CGObjCMac::GenerateMessageSendSuper(llvm::IRBuilder<> &Builder,
const llvm::Type *ReturnTy,
- llvm::Value *Sender,
const char *SuperClassName,
llvm::Value *Receiver,
Selector Sel,
@@ -260,24 +257,18 @@
/// Generate code for a message send expression.
llvm::Value *CGObjCMac::GenerateMessageSend(llvm::IRBuilder<> &Builder,
const llvm::Type *ReturnTy,
- llvm::Value *Sender,
llvm::Value *Receiver,
Selector Sel,
llvm::Value** ArgV,
- unsigned ArgC) {
- if (!Sender) {
- llvm::Function *F = ObjCTypes.getMessageSendFn();
- llvm::Value **Args = new llvm::Value*[ArgC+2];
- Args[0] = Builder.CreateBitCast(Receiver, ObjCTypes.ObjectPtrTy, "tmp");
- Args[1] = EmitSelector(Builder, Sel);
- std::copy(ArgV, ArgV+ArgC, Args+2);
- llvm::CallInst *CI = Builder.CreateCall(F, Args, Args+ArgC+2, "tmp");
- delete[] Args;
- return Builder.CreateBitCast(CI, ReturnTy, "tmp");
- } else {
- assert(0 && "cannot generate message sends with sender");
- return 0;
- }
+ unsigned ArgC) {
+ llvm::Function *F = ObjCTypes.getMessageSendFn();
+ llvm::Value **Args = new llvm::Value*[ArgC+2];
+ Args[0] = Builder.CreateBitCast(Receiver, ObjCTypes.ObjectPtrTy, "tmp");
+ Args[1] = EmitSelector(Builder, Sel);
+ std::copy(ArgV, ArgV+ArgC, Args+2);
+ llvm::CallInst *CI = Builder.CreateCall(F, Args, Args+ArgC+2, "tmp");
+ delete[] Args;
+ return Builder.CreateBitCast(CI, ReturnTy, "tmp");
}
llvm::Value *CGObjCMac::GenerateProtocolRef(llvm::IRBuilder<> &Builder,
@@ -453,14 +444,9 @@
CFConstantStringClassReference(0),
MessageSendFn(0),
LongTy(CGM.getTypes().ConvertType(CGM.getContext().LongTy)),
- // FIXME: We want the types from the front-end.
- ObjectTy(llvm::OpaqueType::get()),
- ObjectPtrTy(llvm::PointerType::getUnqual(ObjectTy)),
- SelectorTy(llvm::OpaqueType::get()),
- SelectorPtrTy(llvm::PointerType::getUnqual(SelectorTy))
+ ObjectPtrTy(CGM.getTypes().ConvertType(CGM.getContext().getObjCIdType())),
+ SelectorPtrTy(CGM.getTypes().ConvertType(CGM.getContext().getObjCSelType()))
{
- CGM.getModule().addTypeName("struct.__objc_object", ObjectTy);
- CGM.getModule().addTypeName("struct.__objc_selector", SelectorTy);
}
ObjCTypesHelper::~ObjCTypesHelper() {
Modified: cfe/trunk/lib/CodeGen/CGObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCRuntime.h?rev=54667&r1=54666&r2=54667&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGObjCRuntime.h Tue Aug 12 00:28:47 2008
@@ -47,11 +47,6 @@
/// Generate an Objective-C message send operation
virtual llvm::Value *GenerateMessageSend(BuilderType &Builder,
const llvm::Type *ReturnTy,
- // FIXME: This should be
- // dropped, it is unused
- // and generates a spurious
- // load.
- llvm::Value *Sender,
llvm::Value *Receiver,
Selector Sel,
llvm::Value** ArgV,
@@ -87,12 +82,6 @@
const llvm::SmallVectorImpl<std::string> &Protocols) =0;
virtual llvm::Value *GenerateMessageSendSuper(llvm::IRBuilder<true> &Builder,
const llvm::Type *ReturnTy,
- // FIXME: This should
- // be dropped, it is
- // unused and
- // generates a
- // spurious load.
- llvm::Value *Sender,
const char *SuperClassName,
llvm::Value *Receiver,
Selector Sel,
More information about the cfe-commits
mailing list