]> 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>
Tue, 21 Jun 2022 13:11:31 +0000 (14:11 +0100)
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.cc (add_location_or_const_value_attribute): Set
DW_AT_address_class, if appropriate.

gcc/ChangeLog.omp
gcc/dwarf2out.cc

index 4346ea0411c210bd2decdbc54d5dfed7e52341fa..5f473611046727d128edcb36883b6a1794030ee6 100644 (file)
@@ -1,3 +1,8 @@
+2021-01-15  Andrew Stubbs  <ams@codesourcery.com>
+
+       * dwarf2out.cc (add_location_or_const_value_attribute): Set
+       DW_AT_address_class, if appropriate.
+
 2020-12-06  Andrew Stubbs  <ams@codesourcery.com>
 
        * dwarf2out.cc (gen_subprogram_die): Add high/low_pc attributes for
index dfdc0426cf1f03c80f7027fa7f0305ac3c4efe53..50b5b1925b340b6d1c9f469721f99d2e14d63363 100644 (file)
@@ -20881,6 +20881,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;