[PATCH] D150746: [CodeGen]Translating pointer arguments can require an address space cast

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 2 06:13:03 PDT 2023


yaxunl added inline comments.


================
Comment at: clang/lib/CodeGen/ItaniumCXXABI.cpp:1630-1632
+    LangAS AS = CGM.GetGlobalVarAddressSpace(nullptr);
+    QualType Q = Context.getAddrSpaceQualType(Context.VoidPtrTy, AS);
+    QualType T = Context.getPointerType(Q);
----------------
AlexVlx wrote:
> AlexVlx wrote:
> > yaxunl wrote:
> > > Does it worth extracting the code as Context.getVTTType() since it is used at three locations. Since VTT seems to be immutable, in case we want to put it in constant addr space in the future, it will make things easier.
> > That's not a bad idea. I think it might be profitable to do something like `Context.getVTableType()`, since there's actually 2.5 interlinked things here (VTT, vtable & vptr), and it makes intuitive to me to base it all around that (vptr points to vtbl) etc.
> Actually, I think I should probably do this in a separate patch; we already have `getVtblPtrAddressSpace()` in `TargetInfo`, but it doesn't seem to be used anywhere but for generating debug info. I suspect the latter will be subtly wrong for us anyway, because we'll advertise the constant AS, even though we're today using global. TL;DR, I'd handle this suggestion separately @yaxunl, if you don't mind.
OK for me


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150746/new/

https://reviews.llvm.org/D150746



More information about the cfe-commits mailing list