diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-06-19 16:51:13 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-06-25 17:02:47 +0200 |
commit | bbd6a326f4e630f017e4cd715f617587048d4501 (patch) | |
tree | ebf31e52e752025d4c289e00a5bf1a59f982f797 /gcc/d/d-lang.cc | |
parent | 1b7b352a8379dbdd74c962d11951982e21e20f13 (diff) | |
download | gcc-bbd6a326f4e630f017e4cd715f617587048d4501.zip gcc-bbd6a326f4e630f017e4cd715f617587048d4501.tar.gz gcc-bbd6a326f4e630f017e4cd715f617587048d4501.tar.bz2 |
d: Move d_signed_type and d_unsigned_type to types.cc
These two functions are not tied to the language-specific part of the
front-end in any way.
gcc/d/ChangeLog:
* d-lang.cc (d_gimplify_expr_p): Make static.
(d_parse_file): Likewise.
(d_signed_or_unsigned_type): Move to types.cc.
(d_unsigned_type): Likewise.
(d_signed_type): Likewise.
* d-tree.h (d_unsigned_type): Change the location in file.
(d_signed_type): Likewise.
* types.cc (d_signed_or_unsigned_type): Moved from d-lang.cc.
(d_unsigned_type): Likewise.
(d_signed_type): Likewise.
Diffstat (limited to 'gcc/d/d-lang.cc')
-rw-r--r-- | gcc/d/d-lang.cc | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc index 2c474f8..6412c1c 100644 --- a/gcc/d/d-lang.cc +++ b/gcc/d/d-lang.cc @@ -880,7 +880,7 @@ empty_modify_p (tree type, tree op) /* Implements the lang_hooks.gimplify_expr routine for language D. Do gimplification of D specific expression trees in EXPR_P. */ -int +static int d_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p ATTRIBUTE_UNUSED) { @@ -1024,7 +1024,7 @@ d_add_entrypoint_module (Module *entry, Module *root) /* Implements the lang_hooks.parse_file routine for language D. */ -void +static void d_parse_file (void) { if (global.params.verbose) @@ -1507,49 +1507,6 @@ d_type_for_size (unsigned bits, int unsignedp) return 0; } -/* Return the signed or unsigned version of TYPE, an integral type, the - signedness being specified by UNSIGNEDP. */ - -static tree -d_signed_or_unsigned_type (int unsignedp, tree type) -{ - if (TYPE_UNSIGNED (type) == (unsigned) unsignedp) - return type; - - if (TYPE_PRECISION (type) == TYPE_PRECISION (d_cent_type)) - return unsignedp ? d_ucent_type : d_cent_type; - - if (TYPE_PRECISION (type) == TYPE_PRECISION (d_long_type)) - return unsignedp ? d_ulong_type : d_long_type; - - if (TYPE_PRECISION (type) == TYPE_PRECISION (d_int_type)) - return unsignedp ? d_uint_type : d_int_type; - - if (TYPE_PRECISION (type) == TYPE_PRECISION (d_short_type)) - return unsignedp ? d_ushort_type : d_short_type; - - if (TYPE_PRECISION (type) == TYPE_PRECISION (d_byte_type)) - return unsignedp ? d_ubyte_type : d_byte_type; - - return signed_or_unsigned_type_for (unsignedp, type); -} - -/* Return the unsigned version of TYPE, an integral type. */ - -tree -d_unsigned_type (tree type) -{ - return d_signed_or_unsigned_type (1, type); -} - -/* Return the signed version of TYPE, an integral type. */ - -tree -d_signed_type (tree type) -{ - return d_signed_or_unsigned_type (0, type); -} - /* Implements the lang_hooks.types.type_promotes_to routine for language D. All promotions for variable arguments are handled by the D frontend. */ |