-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[CodeGen][ObjCGNU] Replace PointerType::getUnqual(Type) with opaque pointer version (NFC) #128715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
junlarsen
merged 1 commit into
main
from
users/junlarsen/_codegen_objcgnu_replace_pointertype_getunqual_type_with_opaque_pointer_version_nfc_
Mar 3, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
|
@@ -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; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably drop all these duplicate types in a followup...
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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]; | ||
|
|
@@ -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); | ||
|
|
||
|
|
@@ -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 | ||
|
|
@@ -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); | ||
|
|
||
|
|
@@ -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) | ||
|
|
@@ -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()); | ||
| } | ||
|
|
@@ -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 | ||
|
|
@@ -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) { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.