[PATCH] D11635: DebugInfo: Emit DW_AT_address_class for non-0 address space

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu Jul 30 09:59:58 PDT 2015


> On 2015-Jul-30, at 04:55, David Blaikie <dblaikie at gmail.com> wrote:
> 
> Hey Duncan - what's this "extraData" field intended for? Is this a reasonable use of it?
> 

Looks like kind of a catch-all:
--
$ git grep -n -B2 getExtraData -- include/
include/llvm/IR/DebugInfoMetadata.h-688-                        getScope(), getBaseType(), getSizeInBits(),
include/llvm/IR/DebugInfoMetadata.h-689-                        getAlignInBits(), getOffsetInBits(), getFlags(),
include/llvm/IR/DebugInfoMetadata.h:690:                        getExtraData());
--
include/llvm/IR/DebugInfoMetadata.h-721-  /// TODO: Separate out types that need this extra operand: pointer-to-member
include/llvm/IR/DebugInfoMetadata.h-722-  /// types and member fields (static members and ivars).
include/llvm/IR/DebugInfoMetadata.h:723:  Metadata *getExtraData() const { return getRawExtraData(); }
--
include/llvm/IR/DebugInfoMetadata.h-728-  DITypeRef getClassType() const {
include/llvm/IR/DebugInfoMetadata.h-729-    assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
include/llvm/IR/DebugInfoMetadata.h:730:    return DITypeRef(getExtraData());
include/llvm/IR/DebugInfoMetadata.h-731-  }
include/llvm/IR/DebugInfoMetadata.h-732-  DIObjCProperty *getObjCProperty() const {
include/llvm/IR/DebugInfoMetadata.h:733:    return dyn_cast_or_null<DIObjCProperty>(getExtraData());
--
include/llvm/IR/DebugInfoMetadata.h-735-  Constant *getConstant() const {
include/llvm/IR/DebugInfoMetadata.h-736-    assert(getTag() == dwarf::DW_TAG_member && isStaticMember());
include/llvm/IR/DebugInfoMetadata.h:737:    if (auto *C = cast_or_null<ConstantAsMetadata>(getExtraData()))
--

I actually think it's pretty gross that it exists at all, really,
but I guess I didn't come up with anything better.

As long as there's:

 1. a new verifier check for it, and
 2. it doesn't conflict with the other uses,

then it seems okay (but not great) to use it for this.

> I imagine we just want to extend the schema here to explicitly include address space?

That would be better.  No reason for ConstantAsMetadata, just add
a `uint32_t`.

> Could we instead extract it from the value we're describing? (probably not? if the address happens to be a constant or something (which I guess is more likely in custom address spaces) it wouldn't be carrying explicit address space info?)

That would be even better, if it works.

> On Thu, Jul 30, 2015 at 12:33 AM, Matt Arsenault <Matthew.Arsenault at amd.com> wrote:
> arsenm created this revision.
> arsenm added a reviewer: echristo.
> arsenm added a subscriber: llvm-commits.
> 
> http://reviews.llvm.org/D11635
> 
> Files:
>   include/llvm/IR/DIBuilder.h
>   include/llvm/IR/DebugInfoMetadata.h
>   lib/CodeGen/AsmPrinter/DwarfUnit.cpp
>   lib/IR/DIBuilder.cpp
>   test/DebugInfo/AMDGPU/DW_AT_address_class.ll
>   test/DebugInfo/AMDGPU/lit.local.cfg
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> 





More information about the llvm-commits mailing list