]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
DWARF address space for variables
authorAndrew Stubbs <ams@codesourcery.com>
Fri, 15 Jan 2021 11:26:46 +0000 (11:26 +0000)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Thu, 22 Apr 2021 17:14:31 +0000 (10:14 -0700)
Add DWARF address class attributes for variables that exist outside the
generic address space.  In particular, this is the case for gang-private
variables in OpenACC offload kernels.

gcc/ChangeLog:

* dwarf2out.c (add_location_or_const_value_attribute): Set
DW_AT_address_class, if appropriate.

gcc/dwarf2out.c

index fdd09cbef3be34bc9823a38a9817e767248ebdf5..5fe94fe07e22b76cd7154a7723b1be5277a78240 100644 (file)
@@ -20588,6 +20588,15 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl, bool cache_p)
   if (list)
     {
       add_AT_location_description (die, DW_AT_location, list);
+
+      addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (decl));
+      if (!ADDR_SPACE_GENERIC_P (as))
+       {
+         int action = targetm.addr_space.debug (as);
+         /* Positive values indicate an address_class.  */
+         if (action >= 0)
+           add_AT_unsigned (die, DW_AT_address_class, action);
+       }
       return true;
     }
   /* None of that worked, so it must not really have a location;