-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[CodeGen] Replace of PointerType::get(Type) with opaque version (NFC) #124771
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
Changes from 2 commits
13d65a0
9a21d42
ff0399f
3dbdefb
adf2362
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1097,31 +1097,10 @@ llvm::Type *CodeGenModule::getBlockDescriptorType() { | |
| if (BlockDescriptorType) | ||
| return BlockDescriptorType; | ||
|
|
||
| llvm::Type *UnsignedLongTy = | ||
| getTypes().ConvertType(getContext().UnsignedLongTy); | ||
|
|
||
| // struct __block_descriptor { | ||
| // unsigned long reserved; | ||
| // unsigned long block_size; | ||
| // | ||
| // // later, the following will be added | ||
| // | ||
| // struct { | ||
| // void (*copyHelper)(); | ||
| // void (*copyHelper)(); | ||
| // } helpers; // !!! optional | ||
| // | ||
| // const char *signature; // the block signature | ||
| // const char *layout; // reserved | ||
| // }; | ||
|
Comment on lines
-1100
to
-1116
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. I do feel a bit guilty about removing this comment. However, I'm not experienced enough to know if it's significant and something we'd like to keep? Perhaps move it somewhere?
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. I think it's okay to drop it, essentially the same comment also exists on buildBlockDescriptor. |
||
| BlockDescriptorType = llvm::StructType::create( | ||
| "struct.__block_descriptor", UnsignedLongTy, UnsignedLongTy); | ||
|
|
||
| // Now form a pointer to that. | ||
| unsigned AddrSpace = 0; | ||
| if (getLangOpts().OpenCL) | ||
| AddrSpace = getContext().getTargetAddressSpace(LangAS::opencl_constant); | ||
| BlockDescriptorType = llvm::PointerType::get(BlockDescriptorType, AddrSpace); | ||
| BlockDescriptorType = llvm::PointerType::get(getLLVMContext(), AddrSpace); | ||
| return BlockDescriptorType; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -872,7 +872,7 @@ void CodeGenFunction::EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, | |
| llvm::Value *TypeHash = | ||
| llvm::ConstantInt::get(Int64Ty, xxh3_64bits(Out.str())); | ||
|
|
||
| llvm::Type *VPtrTy = llvm::PointerType::get(IntPtrTy, 0); | ||
| llvm::Type *VPtrTy = llvm::PointerType::get(getLLVMContext(), 0); | ||
| Address VPtrAddr(Ptr, IntPtrTy, getPointerAlign()); | ||
| llvm::Value *VPtrVal = GetVTablePtr(VPtrAddr, VPtrTy, | ||
| Ty->getAsCXXRecordDecl(), | ||
|
|
@@ -3054,7 +3054,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { | |
| getContext().getDeclAlign(VD)); | ||
| llvm::Type *VarTy = getTypes().ConvertTypeForMem(VD->getType()); | ||
| auto *PTy = llvm::PointerType::get( | ||
| VarTy, getTypes().getTargetAddressSpace(VD->getType())); | ||
| getLLVMContext(), getTypes().getTargetAddressSpace(VD->getType())); | ||
| Addr = Builder.CreatePointerBitCastOrAddrSpaceCast(Addr, PTy, VarTy); | ||
|
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. Can the below cast be replaced with an AddrSpaceCast only? i.e CGBuilder::CreateAddrSpaceCast? I'm not too sure how the Clang codegen Address code behaves. |
||
| } else { | ||
| // Should we be using the alignment of the constant pointer we emitted? | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.