aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2015-11-09 01:19:19 -0800
committerRichard Henderson <rth@gcc.gnu.org>2015-11-09 01:19:19 -0800
commitf736b911e6fb32807028ef1624fd73dfca33d699 (patch)
tree3998331b05016b3ed00e47dcd1382849d5f9a05f /gcc/dwarf2out.c
parent6626f97034083631b76c3db092f4bf1156d9d078 (diff)
downloadgcc-f736b911e6fb32807028ef1624fd73dfca33d699.zip
gcc-f736b911e6fb32807028ef1624fd73dfca33d699.tar.gz
gcc-f736b911e6fb32807028ef1624fd73dfca33d699.tar.bz2
Add hook for modifying debug info for address spaces
* dwarf2out.c (modified_type_die): Pass the address space number through TARGET_ADDR_SPACE_DEBUG to produce the dwarf address class. * target.def (TARGET_ADDR_SPACE_DEBUG): New. * targhooks.c (default_addr_space_debug): New. * targhooks.h (default_addr_space_debug): Declare. * doc/tm.texi.in (TARGET_ADDR_SPACE_DEBUG): Mark it. * doc/tm.texi: Rebuild. From-SVN: r230000
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c48
1 files changed, 29 insertions, 19 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 6d02fe7..f184750 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -10899,29 +10899,39 @@ modified_type_die (tree type, int cv_quals, dw_die_ref context_die)
mod_type_die = d;
}
}
- else if (code == POINTER_TYPE)
+ else if (code == POINTER_TYPE || code == REFERENCE_TYPE)
{
- mod_type_die = new_die (DW_TAG_pointer_type, mod_scope, type);
- add_AT_unsigned (mod_type_die, DW_AT_byte_size,
- simple_type_size_in_bits (type) / BITS_PER_UNIT);
- item_type = TREE_TYPE (type);
- if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (item_type)))
- add_AT_unsigned (mod_type_die, DW_AT_address_class,
- TYPE_ADDR_SPACE (item_type));
- }
- else if (code == REFERENCE_TYPE)
- {
- if (TYPE_REF_IS_RVALUE (type) && dwarf_version >= 4)
- mod_type_die = new_die (DW_TAG_rvalue_reference_type, mod_scope,
- type);
- else
- mod_type_die = new_die (DW_TAG_reference_type, mod_scope, type);
+ dwarf_tag tag = DW_TAG_pointer_type;
+ if (code == REFERENCE_TYPE)
+ {
+ if (TYPE_REF_IS_RVALUE (type) && dwarf_version >= 4)
+ tag = DW_TAG_rvalue_reference_type;
+ else
+ tag = DW_TAG_reference_type;
+ }
+ mod_type_die = new_die (tag, mod_scope, type);
+
add_AT_unsigned (mod_type_die, DW_AT_byte_size,
simple_type_size_in_bits (type) / BITS_PER_UNIT);
item_type = TREE_TYPE (type);
- if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (item_type)))
- add_AT_unsigned (mod_type_die, DW_AT_address_class,
- TYPE_ADDR_SPACE (item_type));
+
+ addr_space_t as = TYPE_ADDR_SPACE (item_type);
+ if (!ADDR_SPACE_GENERIC_P (as))
+ {
+ int action = targetm.addr_space.debug (as);
+ if (action >= 0)
+ {
+ /* Positive values indicate an address_class. */
+ add_AT_unsigned (mod_type_die, DW_AT_address_class, action);
+ }
+ else
+ {
+ /* Negative values indicate an (inverted) segment base reg. */
+ dw_loc_descr_ref d
+ = one_reg_loc_descriptor (~action, VAR_INIT_STATUS_INITIALIZED);
+ add_AT_loc (mod_type_die, DW_AT_segment, d);
+ }
+ }
}
else if (code == INTEGER_TYPE
&& TREE_TYPE (type) != NULL_TREE