Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 10 additions & 20 deletions clang/lib/CodeGen/CGObjCGNU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ class CGObjCGNUstep : public CGObjCGNU {
const ObjCRuntime &R = CGM.getLangOpts().ObjCRuntime;

SlotStructTy = llvm::StructType::get(PtrTy, PtrTy, PtrTy, IntTy, IMPTy);
SlotTy = llvm::PointerType::getUnqual(SlotStructTy);
SlotTy = PtrTy;
// Slot_t objc_msg_lookup_sender(id *receiver, SEL selector, id sender);
SlotLookupFn.init(&CGM, "objc_msg_lookup_sender", SlotTy, PtrToIdTy,
SelectorTy, IdTy);
Expand Down Expand Up @@ -2284,10 +2284,12 @@ CGObjCGNU::CGObjCGNU(CodeGenModule &cgm, unsigned runtimeABIVersion,
BoolTy = CGM.getTypes().ConvertType(CGM.getContext().BoolTy);

Int8Ty = llvm::Type::getInt8Ty(VMContext);

PtrTy = llvm::PointerType::getUnqual(cgm.getLLVMContext());
PtrToIntTy = PtrTy;
// C string type. Used in lots of places.
PtrToInt8Ty = llvm::PointerType::getUnqual(Int8Ty);
ProtocolPtrTy = llvm::PointerType::getUnqual(
Types.ConvertType(CGM.getContext().getObjCProtoType()));
PtrToInt8Ty = PtrTy;
ProtocolPtrTy = PtrTy;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably drop all these duplicate types in a followup...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I can look into this in the future


Zeros[0] = llvm::ConstantInt::get(LongTy, 0);
Zeros[1] = Zeros[0];
Expand All @@ -2302,9 +2304,6 @@ CGObjCGNU::CGObjCGNU(CodeGenModule &cgm, unsigned runtimeABIVersion,
SelectorElemTy = CGM.getTypes().ConvertTypeForMem(selTy->getPointeeType());
}

PtrToIntTy = llvm::PointerType::getUnqual(IntTy);
PtrTy = PtrToInt8Ty;

Int32Ty = llvm::Type::getInt32Ty(VMContext);
Int64Ty = llvm::Type::getInt64Ty(VMContext);

Expand All @@ -2323,7 +2322,7 @@ CGObjCGNU::CGObjCGNU(CodeGenModule &cgm, unsigned runtimeABIVersion,
IdTy = PtrToInt8Ty;
IdElemTy = Int8Ty;
}
PtrToIdTy = llvm::PointerType::getUnqual(IdTy);
PtrToIdTy = PtrTy;
ProtocolTy = llvm::StructType::get(IdTy,
PtrToInt8Ty, // name
PtrToInt8Ty, // protocols
Expand Down Expand Up @@ -2351,7 +2350,7 @@ CGObjCGNU::CGObjCGNU(CodeGenModule &cgm, unsigned runtimeABIVersion,
PtrToInt8Ty, PtrToInt8Ty });

ObjCSuperTy = llvm::StructType::get(IdTy, IdTy);
PtrToObjCSuperTy = llvm::PointerType::getUnqual(ObjCSuperTy);
PtrToObjCSuperTy = PtrTy;

llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);

Expand Down Expand Up @@ -2383,9 +2382,7 @@ CGObjCGNU::CGObjCGNU(CodeGenModule &cgm, unsigned runtimeABIVersion,
PtrDiffTy, BoolTy, BoolTy);

// IMP type
llvm::Type *IMPArgs[] = { IdTy, SelectorTy };
IMPTy = llvm::PointerType::getUnqual(llvm::FunctionType::get(IdTy, IMPArgs,
true));
IMPTy = PtrTy;

const LangOptions &Opts = CGM.getLangOpts();
if ((Opts.getGC() != LangOptions::NonGC) || Opts.ObjCAutoRefCount)
Expand Down Expand Up @@ -2679,8 +2676,6 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGenFunction &CGF,
Class->getSuperClass()->getNameAsString(), /*isWeak*/false);
if (IsClassMessage) {
// Load the isa pointer of the superclass is this is a class method.
ReceiverClass = Builder.CreateBitCast(ReceiverClass,
llvm::PointerType::getUnqual(IdTy));
ReceiverClass =
Builder.CreateAlignedLoad(IdTy, ReceiverClass, CGF.getPointerAlign());
}
Expand Down Expand Up @@ -2721,8 +2716,6 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGenFunction &CGF,
}
// Cast the pointer to a simplified version of the class structure
llvm::Type *CastTy = llvm::StructType::get(IdTy, IdTy);
ReceiverClass = Builder.CreateBitCast(ReceiverClass,
llvm::PointerType::getUnqual(CastTy));
// Get the superclass pointer
ReceiverClass = Builder.CreateStructGEP(CastTy, ReceiverClass, 1);
// Load the superclass pointer
Expand Down Expand Up @@ -3269,10 +3262,7 @@ CGObjCGNU::GenerateProtocolList(ArrayRef<std::string> Protocols) {

llvm::Value *CGObjCGNU::GenerateProtocolRef(CodeGenFunction &CGF,
const ObjCProtocolDecl *PD) {
auto protocol = GenerateProtocolRef(PD);
llvm::Type *T =
CGM.getTypes().ConvertType(CGM.getContext().getObjCProtoType());
return CGF.Builder.CreateBitCast(protocol, llvm::PointerType::getUnqual(T));
return GenerateProtocolRef(PD);
}

llvm::Constant *CGObjCGNU::GenerateProtocolRef(const ObjCProtocolDecl *PD) {
Expand Down
Loading