diff options
author | Alex Richardson <alexrichardson@google.com> | 2022-12-01 19:37:56 +0000 |
---|---|---|
committer | Alex Richardson <alexrichardson@google.com> | 2022-12-01 20:40:58 +0000 |
commit | f3a17d059509c133d8d90d305c0b40bdcbfc1fef (patch) | |
tree | 8aed6d6b781ca342afc2310f5b8b5bfc3fd54382 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | a11faeed446882a81e79d780125d93e7199df645 (diff) | |
download | llvm-f3a17d059509c133d8d90d305c0b40bdcbfc1fef.zip llvm-f3a17d059509c133d8d90d305c0b40bdcbfc1fef.tar.gz llvm-f3a17d059509c133d8d90d305c0b40bdcbfc1fef.tar.bz2 |
[clang] Avoid duplicating ProgramAddressSpace in TargetInfo. NFCI
This value was added to clang/Basic in D111566, but is only used during
codegen, where we can use the LLVM IR DataLayout instead. I noticed this
because the downstream CHERI targets would have to also set this value
for AArch64/RISC-V/MIPS. Instead of duplicating more information between
LLVM IR and Clang, this patch moves getTargetAddressSpace(QualType T) to
CodeGenTypes, where we can consult the DataLayout.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D138296
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index efcd44e..a759d31 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1149,7 +1149,7 @@ llvm::DIType *CGDebugInfo::CreatePointerLikeType(llvm::dwarf::Tag Tag, uint64_t Size = CGM.getContext().getTypeSize(Ty); auto Align = getTypeAlignIfRequired(Ty, CGM.getContext()); Optional<unsigned> DWARFAddressSpace = CGM.getTarget().getDWARFAddressSpace( - CGM.getContext().getTargetAddressSpace(PointeeTy)); + CGM.getTypes().getTargetAddressSpace(PointeeTy)); SmallVector<llvm::Metadata *, 4> Annots; auto *BTFAttrTy = dyn_cast<BTFTagAttributedType>(PointeeTy); @@ -4454,7 +4454,7 @@ llvm::DILocalVariable *CGDebugInfo::EmitDeclare(const VarDecl *VD, auto Align = getDeclAlignIfRequired(VD, CGM.getContext()); - unsigned AddressSpace = CGM.getContext().getTargetAddressSpace(VD->getType()); + unsigned AddressSpace = CGM.getTypes().getTargetAddressSpace(VD->getType()); AppendAddressSpaceXDeref(AddressSpace, Expr); // If this is implicit parameter of CXXThis or ObjCSelf kind, then give it an @@ -4615,7 +4615,7 @@ llvm::DILocalVariable *CGDebugInfo::EmitDeclare(const BindingDecl *BD, return nullptr; auto Align = getDeclAlignIfRequired(BD, CGM.getContext()); - unsigned AddressSpace = CGM.getContext().getTargetAddressSpace(BD->getType()); + unsigned AddressSpace = CGM.getTypes().getTargetAddressSpace(BD->getType()); SmallVector<uint64_t, 3> Expr; AppendAddressSpaceXDeref(AddressSpace, Expr); @@ -5294,8 +5294,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var, auto Align = getDeclAlignIfRequired(D, CGM.getContext()); SmallVector<uint64_t, 4> Expr; - unsigned AddressSpace = - CGM.getContext().getTargetAddressSpace(D->getType()); + unsigned AddressSpace = CGM.getTypes().getTargetAddressSpace(D->getType()); if (CGM.getLangOpts().CUDA && CGM.getLangOpts().CUDAIsDevice) { if (D->hasAttr<CUDASharedAttr>()) AddressSpace = |