diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2010-04-17 14:16:36 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2010-04-17 14:16:36 +0000 |
commit | 728936bb9200245a354a6a3d259c86795de5b6a2 (patch) | |
tree | 7bfc84cbad5fe9e5614c7e2adf4638dcbff4f0ee /gcc/ada/gcc-interface/utils.c | |
parent | 1b78f5757ac38afb7c5acc14e95f12fef41adc84 (diff) | |
download | gcc-728936bb9200245a354a6a3d259c86795de5b6a2.zip gcc-728936bb9200245a354a6a3d259c86795de5b6a2.tar.gz gcc-728936bb9200245a354a6a3d259c86795de5b6a2.tar.bz2 |
uintp.h (UI_Lt): Declare.
* uintp.h (UI_Lt): Declare.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Do the size
computation in sizetype.
<E_Array_Subtype>: Use unified handling for all index types. Do not
generate MAX_EXPR-based expressions, only COND_EXPR-based ones. Add
bypass for PATs.
(annotate_value): Change test for negative values.
(validate_size): Apply test for negative values on GNAT nodes.
(set_rm_size): Likewise.
* gcc-interface/misc.c (gnat_init): Set unsigned types for sizetypes.
* gcc-interface/utils.c (rest_of_record_type_compilation): Change test
for negative values.
(max_size) <MINUS_EXPR>: Do not reassociate a COND_EXPR on the LHS.
(builtin_type_for_size): Adjust definition of signed_size_type_node.
* gcc-interface/utils2.c (compare_arrays): Optimize comparison of
lengths against zero.
From-SVN: r158466
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 668226b..7b403a7 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -839,11 +839,13 @@ rest_of_record_type_compilation (tree record_type) align = tree_low_cst (TREE_OPERAND (curpos, 1), 1); /* An offset which is a bitwise AND with a negative power of 2 - means an alignment corresponding to this power of 2. */ + means an alignment corresponding to this power of 2. Note + that, as sizetype is sign-extended but nonetheless unsigned, + we don't directly use tree_int_cst_sgn. */ offset = remove_conversions (offset, true); if (TREE_CODE (offset) == BIT_AND_EXPR && host_integerp (TREE_OPERAND (offset, 1), 0) - && tree_int_cst_sgn (TREE_OPERAND (offset, 1)) < 0) + && TREE_INT_CST_HIGH (TREE_OPERAND (offset, 1)) < 0) { unsigned int pow = - tree_low_cst (TREE_OPERAND (offset, 1), 0); @@ -2175,22 +2177,6 @@ max_size (tree exp, bool max_p) if (code == COMPOUND_EXPR) return max_size (TREE_OPERAND (exp, 1), max_p); - /* Calculate "(A ? B : C) - D" as "A ? B - D : C - D" which - may provide a tighter bound on max_size. */ - if (code == MINUS_EXPR - && TREE_CODE (TREE_OPERAND (exp, 0)) == COND_EXPR) - { - tree lhs = fold_build2 (MINUS_EXPR, type, - TREE_OPERAND (TREE_OPERAND (exp, 0), 1), - TREE_OPERAND (exp, 1)); - tree rhs = fold_build2 (MINUS_EXPR, type, - TREE_OPERAND (TREE_OPERAND (exp, 0), 2), - TREE_OPERAND (exp, 1)); - return fold_build2 (max_p ? MAX_EXPR : MIN_EXPR, type, - max_size (lhs, max_p), - max_size (rhs, max_p)); - } - { tree lhs = max_size (TREE_OPERAND (exp, 0), max_p); tree rhs = max_size (TREE_OPERAND (exp, 1), @@ -4707,7 +4693,7 @@ builtin_type_for_size (int size, bool unsignedp) static void install_builtin_elementary_types (void) { - signed_size_type_node = size_type_node; + signed_size_type_node = gnat_signed_type (size_type_node); pid_type_node = integer_type_node; void_list_node = build_void_list_node (); |