[PATCH] D29670: [DebugInfo] Emit address space with DW_AT_address_class attribute for pointer and reference types

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 16 09:42:56 PST 2017


dblaikie added inline comments.


================
Comment at: lib/Bitcode/Reader/MetadataLoader.cpp:1117
+    Optional<unsigned> AddressSpace = None;
+    if (Record.size() > 12 && Record[12] != ~0U)
+      AddressSpace = Record[12];
----------------
What's the magical ~0U value about?


================
Comment at: lib/CodeGen/AsmPrinter/DwarfUnit.cpp:847-848
+  // types as DW_AT_address_class.
+  if (DTy->getAddressSpace() && (Tag == dwarf::DW_TAG_pointer_type ||
+                                 Tag == dwarf::DW_TAG_reference_type))
+    addUInt(Buffer, dwarf::DW_AT_address_class, dwarf::DW_FORM_data4,
----------------
why only on pointer and reference types? Should we just do it on all types and don't put an address space on osmething in the IR if it's not desired to be in the DWARF?


================
Comment at: lib/IR/AsmWriter.cpp:1617-1618
   Printer.printMetadata("extraData", N->getRawExtraData());
+  if (N->getAddressSpace())
+    Printer.printInt("addressSpace", N->getAddressSpace().getValue(),
+                     /* ShouldSkipZero */ false);
----------------
maybe reuse a variable here (& probably the op* on Optional)

  if (const auto &AS = ...) {
    ..., *AS, ...


https://reviews.llvm.org/D29670





More information about the llvm-commits mailing list