https://gcc.gnu.org/g:b14f86ba525e24c6a5af8867ff152e53258b58e1
commit b14f86ba525e24c6a5af8867ff152e53258b58e1 Author: Andrew Stubbs <a...@codesourcery.com> Date: Fri Jan 15 11:26:46 2021 +0000 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: --- gcc/ChangeLog.omp | 7 ++++++- gcc/dwarf2out.cc | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index dd70a08ff7d..e35ced18751 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,8 @@ +2021-01-15 Andrew Stubbs <a...@codesourcery.com> + + * dwarf2out.cc (add_location_or_const_value_attribute): Set + DW_AT_address_class, if appropriate. + 2021-03-04 Andrew Stubbs <a...@codesourcery.com> * dwarf2out.cc (notional_parents_list): New file variable. @@ -16,7 +21,7 @@ * dwarf2out.cc (gen_subprogram_die): Check offload attributes only. -2021-01-15 Andrew Stubbs <a...@codesourcery.com> +2020-12-06 Andrew Stubbs <a...@codesourcery.com> * dwarf2out.cc (gen_subprogram_die): Add high/low_pc attributes for parents of offload kernels. diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 9f747e8fcee..7ee945d066e 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -20998,6 +20998,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;