diff options
author | Pierre-Marie de Rodat <derodat@adacore.com> | 2015-12-17 14:09:55 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2015-12-17 14:09:55 +0000 |
commit | 2971780e404ebe8f3094c4d014b258b5c337959d (patch) | |
tree | 95d7a868396094336050add983f43966dd2afabf /gcc/ada/gcc-interface/ada-tree.h | |
parent | eb59e42800b805e0bcced98ad2383c66a5839acc (diff) | |
download | gcc-2971780e404ebe8f3094c4d014b258b5c337959d.zip gcc-2971780e404ebe8f3094c4d014b258b5c337959d.tar.gz gcc-2971780e404ebe8f3094c4d014b258b5c337959d.tar.bz2 |
DWARF: add a language hook for fixed-point types
Support for fixed-point types in GCC is not powerful enough for Ada
fixed-point types: GNAT uses regular scalar types to implement them.
This new language hook makes it possible to output the desired debugging
information anyway.
gcc/ada/ChangeLog:
* gcc-interface/ada-tree.def (POWER_EXPR): New binary operation.
* gcc-interface/ada-tree.h (TYPE_FIXED_POINT_P): New macro.
(TYPE_IS_FIXED_POINT_P): New macro.
(TYPE_SCALE_FACTOR): New macro.
(SET_TYPE_SCALE_FACTOR): New macro.
* gcc-interface/decl.c: Include urealp.h
(gnat_to_gnu_entity): Attach trees to encode scale factors to
fixed-point types.
* gcc-interface/misc.c (gnat_print_type): Print scale factors
for fixed-point types.
(gnat_get_fixed_point_type_info): New.
(gnat_init_ts): Initialize data for the POWER_EXPR binary
operation.
(LANG_HOOKS_GET_FIXED_POINT_INFO): Redefine macro to implement
the get_fixed_point_type_info language hook.
gcc/ChangeLog:
* langhooks.h (struct lang_hooks_for_types): Add a
get_fixed_point_type_info field.
* langhooks-def.h (LANG_HOOKS_GET_FIXED_POINT_TYPE_INFO): New
macro.
(LANG_HOOKS_FOR_TYPES_INITIALIZER): Initialize the
get_fixed_point_type_info field.
* dwarf2out.h (enum fixed_point_scale_factor): New.
(struct fixed_point_type_info): New.
* dwarf2out.c (base_type_die): In DWARFv3 or non-strict DWARF
mode, get fixed-point type information using the debugging hook
and describe it in DWARF, if any.
From-SVN: r231764
Diffstat (limited to 'gcc/ada/gcc-interface/ada-tree.h')
-rw-r--r-- | gcc/ada/gcc-interface/ada-tree.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/ada-tree.h b/gcc/ada/gcc-interface/ada-tree.h index 807da9d..709fdc2 100644 --- a/gcc/ada/gcc-interface/ada-tree.h +++ b/gcc/ada/gcc-interface/ada-tree.h @@ -126,6 +126,13 @@ do { \ #define TYPE_CONTAINS_TEMPLATE_P(NODE) \ TYPE_LANG_FLAG_3 (RECORD_OR_UNION_CHECK (NODE)) +/* For INTEGER_TYPE, nonzero if it implements a fixed-point type. */ +#define TYPE_FIXED_POINT_P(NODE) \ + TYPE_LANG_FLAG_3 (INTEGER_TYPE_CHECK (NODE)) + +#define TYPE_IS_FIXED_POINT_P(NODE) \ + (TREE_CODE (NODE) == INTEGER_TYPE && TYPE_FIXED_POINT_P (NODE)) + /* True if NODE is a thin pointer. */ #define TYPE_IS_THIN_POINTER_P(NODE) \ (POINTER_TYPE_P (NODE) \ @@ -358,6 +365,16 @@ do { \ #define SET_TYPE_DEBUG_TYPE(NODE, X) \ SET_TYPE_LANG_SPECIFIC2(NODE, X) +/* For an INTEGER_TYPE with TYPE_IS_FIXED_POINT_P, this is the value of the + scale factor. Modular types, index types (sizetype subtypes) and + fixed-point types are totally distinct types, so there is no problem with + sharing type lang specific's first slot. */ +#define TYPE_SCALE_FACTOR(NODE) \ + GET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE)) +#define SET_TYPE_SCALE_FACTOR(NODE, X) \ + SET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE), X) + + /* Flags added to decl nodes. */ /* Nonzero in a FUNCTION_DECL that represents a stubbed function |