[PATCH] Get rid of awkward semantics for subtypes
Eric Botcazou
ebotcazou@adacore.com
Sun May 10 16:55:00 GMT 2009
Hi,
as explained in http://gcc.gnu.org/ml/gcc/2009-04/msg00323.html the attached
patch gets rid of the awkward semantics implemented for subtypes (INTEGER_TYPE
with a non-NULL TREE_TYPE). It doesn't get rid of subtypes because they are
needed for certain things but promotes them to first-class citizenship, so
that it shouldn't be necessary to specifically check for them anymore in the
middle-end, except for debugging information. It's up to the front-end to
make sure that range subtypes, e.g. built for arrays in all languages, don't
leak into the code.
Tested on i586-suse-linux with the associated Gigi patch, OK for mainline?
2009-05-10 Eric Botcazou <ebotcazou@adacore.com>
* dbxout.c (dbxout_type): Be prepared to deal with subtypes.
* dwarf2out.c (base_type_die): Likewise.
(is_subrange_type): Delete.
(subrange_type_die): Add LOW and HIGH parameters. Use them for bounds.
(modified_type_die): Call subrange_type_for_debug_p on subtypes.
* fold-const.c (fold_truth_not_expr) <CONVERT_EXPR>: Do not strip
it if the destination type is boolean.
(build_range_check): Do not special-case subtypes.
(fold_sign_changed_comparison): Likewise.
(fold_unary): Likewise.
* langhooks-def.h (LANG_HOOKS_GET_SUBRANGE_BOUNDS): Define.
(LANG_HOOKS_FOR_TYPES_INITIALIZER): Add LANG_HOOKS_GET_SUBRANGE_BOUNDS.
* langhooks.h (lang_hooks_for_types): Add get_subrange_bounds.
* tree.h (subrange_type_for_debug_p): Declare.
* tree.c (subrange_type_for_debug_p): New predicate based on the
former is_subrange_type.
* tree-chrec.c (avoid_arithmetics_in_type_p): Delete.
(convert_affine_scev): Remove call to above function.
(chrec_convert_aggressive): Likewise.
* tree-ssa.c (useless_type_conversion_p_1): Do not specifically return
false for conversions involving subtypes.
* tree-vrp.c (vrp_val_max): Do not special-case subtypes.
(vrp_val_min): Likewise.
(needs_overflow_infinity): Likewise.
(extract_range_from_unary_expr): Likewise.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 18515 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090510/ef2a9fe8/attachment.bin>
More information about the Gcc-patches
mailing list