summaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-17 14:10:24 +0000
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-17 14:10:24 +0000
commite0501e5ff8e317a259967c6e87f11357fd65c6d4 (patch)
tree4b1283cf84906d22bbc457ae4eb42f1b824396c1 /gcc/ada
parent584cdd4fbf89854054b1a2174f2ec8f3be953199 (diff)
downloadgcc-e0501e5ff8e317a259967c6e87f11357fd65c6d4.tar.gz
DWARF: add a language hook for scalar biased types
Front-ends like GNAT for Ada sometimes use biased encodings for integral types. This change creates a new language hook so that the bias information can make it into the debugging information back-end and introduces an experimental DWARF attribute to hold it. gcc/ada/ChangeLog: * gcc-interface/misc.c (gnat_get_type_bias): New. (LANG_HOOKS_GET_TYPE_BIAS): Redefine macro to implement the get_type_bias language hook. gcc/ChangeLog: * langhooks.h (struct lang_hooks_for_types): New get_bias_field. * langhooks-def.h (LANG_HOOKS_GET_TYPE_BIAS): New. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Initialize the get_bias_field. * dwarf2out.c (base_type_die): In non-strict DWARF mode, invoke the get_type_bias language hook for INTEGER_TYPE nodes. If it returns a bias, emit an attribute for it. (subrange_type_die): Change signature to handle bias. If non-strict DWARF mode, emit an attribute for it, if one passed. (modified_type_die): For subrange types, invoke the get_type_bias langage hook and pass the bias to subrange_type_die. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231767 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/gcc-interface/misc.c12
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index eb1092380bf..80c5a39d803 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,11 @@
2015-12-17 Pierre-Marie de Rodat <derodat@adacore.com>
+ * gcc-interface/misc.c (gnat_get_type_bias): New.
+ (LANG_HOOKS_GET_TYPE_BIAS): Redefine macro to implement the
+ get_type_bias language hook.
+
+2015-12-17 Pierre-Marie de Rodat <derodat@adacore.com>
+
* gcc-interface/misc.c (gnat_get_array_descr_info): When the
array has more dimensions than the language hook can handle,
fall back to a nested arrays description. Handle context-less
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 891ca3f338c..269960f917d 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -977,6 +977,16 @@ gnat_get_subrange_bounds (const_tree gnu_type, tree *lowval, tree *highval)
*highval = TYPE_MAX_VALUE (gnu_type);
}
+static tree
+gnat_get_type_bias (const_tree gnu_type)
+{
+ if (TREE_CODE (gnu_type) == INTEGER_TYPE
+ && TYPE_BIASED_REPRESENTATION_P (gnu_type)
+ && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
+ return TYPE_RM_MIN_VALUE(gnu_type);
+ return NULL_TREE;
+}
+
/* GNU_TYPE is the type of a subprogram parameter. Determine if it should be
passed by reference by default. */
@@ -1276,6 +1286,8 @@ get_lang_specific (tree node)
#define LANG_HOOKS_GET_ARRAY_DESCR_INFO gnat_get_array_descr_info
#undef LANG_HOOKS_GET_SUBRANGE_BOUNDS
#define LANG_HOOKS_GET_SUBRANGE_BOUNDS gnat_get_subrange_bounds
+#undef LANG_HOOKS_GET_TYPE_BIAS
+#define LANG_HOOKS_GET_TYPE_BIAS gnat_get_type_bias
#undef LANG_HOOKS_DESCRIPTIVE_TYPE
#define LANG_HOOKS_DESCRIPTIVE_TYPE gnat_descriptive_type
#undef LANG_HOOKS_GET_DEBUG_TYPE