[Mlir-commits] [mlir] [MLIR][LLVM] add dwarfAddressSpace to DIDerivedType (PR #92043)

Billy Zhu llvmlistbot at llvm.org
Tue May 14 10:23:59 PDT 2024


================
@@ -418,6 +418,7 @@ def LLVM_DIDerivedTypeAttr : LLVM_Attr<"DIDerivedType", "di_derived_type",
     OptionalParameter<"uint64_t">:$sizeInBits,
     OptionalParameter<"uint32_t">:$alignInBits,
     OptionalParameter<"uint64_t">:$offsetInBits,
+    OptionalParameter<"std::optional<unsigned>">:$dwarfAddressSpace,
----------------
zyx-billy wrote:

Actually, I thought it didn't, but it appears DWARF ([v5, ch. 7.13](https://dwarfstd.org/doc/DWARF5.pdf)) specifies a common `DW_ADDR_none` as 0. From ch. 2.12:

> The set of permissible values is specific to each target architecture. The value DW_ADDR_none, however, is common to all encodings, and means that no address class has been specified.

I still think that if we want to adopt this, we should probably either remove the optional from the LLVM side, or at least translate 0 as nullopt into LLVM. It does mean we lose one degree of freedom, which is controlling whether the 0 address space actually gets emitted or not in DWARF (it's not clear if that should make a difference).

https://github.com/llvm/llvm-project/pull/92043


More information about the Mlir-commits mailing list