From 43a0debd527b75eb564cad6bd47f5d5bb301dfad Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 19 Nov 2020 11:04:52 +0100 Subject: 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) : 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) : 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. --- gcc/dwarf2out.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'gcc/dwarf2out.h') diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h index 9571f8b..0b06cff 100644 --- a/gcc/dwarf2out.h +++ b/gcc/dwarf2out.h @@ -362,23 +362,18 @@ enum fixed_point_scale_factor struct fixed_point_type_info { - /* A scale factor is the value one has to multiply with physical data in - order to get the fixed point logical data. The DWARF standard enables one - to encode it in three ways. */ + /* The scale factor is the value one has to multiply the actual data with + to get the fixed point value. We support three ways to encode it. */ enum fixed_point_scale_factor scale_factor_kind; union { - /* For binary scale factor, the scale factor is: 2 ** binary. */ + /* For a binary scale factor, the scale factor is 2 ** binary. */ int binary; - /* For decimal scale factor, the scale factor is: 10 ** binary. */ + /* For a decimal scale factor, the scale factor is 10 ** decimal. */ int decimal; - /* For arbitrary scale factor, the scale factor is: + /* For an arbitrary scale factor, the scale factor is the ratio numerator / denominator. */ - struct - { - unsigned HOST_WIDE_INT numerator; - HOST_WIDE_INT denominator; - } arbitrary; + struct { tree numerator; tree denominator; } arbitrary; } scale_factor; }; -- cgit v1.1