aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/misc.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-11-19 11:04:52 +0100
committerEric Botcazou <ebotcazou@adacore.com>2020-11-19 11:04:52 +0100
commit43a0debd527b75eb564cad6bd47f5d5bb301dfad (patch)
treeda21597c3e40f05e45153c7ba9c0bedfb42495d1 /gcc/ada/gcc-interface/misc.c
parent0d8290959ecf2c5f1dd062e57782b5e91be0f8f6 (diff)
downloadgcc-43a0debd527b75eb564cad6bd47f5d5bb301dfad.zip
gcc-43a0debd527b75eb564cad6bd47f5d5bb301dfad.tar.gz
gcc-43a0debd527b75eb564cad6bd47f5d5bb301dfad.tar.bz2
Enhance debug info for fixed-point types
The Ada language supports fixed-point types as first-class citizens so they need to be described as-is in the debug info. We devised the langhook get_fixed_point_type_info for this purpose a few years ago, but it comes with a limitation for the representation of the scale factor that we would need to lift in order to be able to represent more fixed-point types. gcc/ChangeLog: * dwarf2out.h (struct fixed_point_type_info) <scale_factor>: Turn numerator and denominator into a tree. * dwarf2out.c (base_type_die): In the case of a fixed-point type with arbitrary scale factor, call add_scalar_info on numerator and denominator to emit the appropriate attributes. gcc/ada/ChangeLog: * exp_dbug.adb (Is_Handled_Scale_Factor): Delete. (Get_Encoded_Name): Do not call it. * gcc-interface/decl.c (gnat_to_gnu_entity) <Fixed_Point_Type>: Tidy up and always use a meaningful description for arbitrary scale factors. * gcc-interface/misc.c (gnat_get_fixed_point_type_info): Remove obsolete block and adjust the description of the scale factor.
Diffstat (limited to 'gcc/ada/gcc-interface/misc.c')
-rw-r--r--gcc/ada/gcc-interface/misc.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 87724af..d0867e0 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -628,16 +628,6 @@ gnat_get_fixed_point_type_info (const_tree type,
/* We expect here only a finite set of pattern. See fixed-point types
handling in gnat_to_gnu_entity. */
- /* Put invalid values when compiler internals cannot represent the scale
- factor. */
- if (scale_factor == integer_zero_node)
- {
- info->scale_factor_kind = fixed_point_scale_factor_arbitrary;
- info->scale_factor.arbitrary.numerator = 0;
- info->scale_factor.arbitrary.denominator = 0;
- return true;
- }
-
if (TREE_CODE (scale_factor) == RDIV_EXPR)
{
tree num = TREE_OPERAND (scale_factor, 0);
@@ -677,8 +667,8 @@ gnat_get_fixed_point_type_info (const_tree type,
&& TREE_CODE (den) == INTEGER_CST);
info->scale_factor_kind = fixed_point_scale_factor_arbitrary;
- info->scale_factor.arbitrary.numerator = tree_to_uhwi (num);
- info->scale_factor.arbitrary.denominator = tree_to_shwi (den);
+ info->scale_factor.arbitrary.numerator = num;
+ info->scale_factor.arbitrary.denominator = den;
return true;
}