From: Andrew Stubbs Date: Fri, 15 Jan 2021 11:26:46 +0000 (+0000) Subject: DWARF address space for variables X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=037c0d9acde83f73f6babfc6cee1c4763ec63c57;p=thirdparty%2Fgcc.git DWARF address space for variables 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. --- diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index 4346ea0411c2..5f4736110467 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,8 @@ +2021-01-15 Andrew Stubbs + + * dwarf2out.cc (add_location_or_const_value_attribute): Set + DW_AT_address_class, if appropriate. + 2020-12-06 Andrew Stubbs * dwarf2out.cc (gen_subprogram_die): Add high/low_pc attributes for diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index dfdc0426cf1f..50b5b1925b34 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -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;