aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/utils2.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2004-06-14 14:09:38 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2004-06-14 10:09:38 -0400
commit966389eeaaf6b674bbfbdc34b06314c2dd7f8591 (patch)
tree4a73e45526ddb48295d919dce3f9ab9d54d0cdea /gcc/ada/utils2.c
parent715f8bb802ecb1ab114f8b904fa376f40ccb50c7 (diff)
downloadgcc-966389eeaaf6b674bbfbdc34b06314c2dd7f8591.zip
gcc-966389eeaaf6b674bbfbdc34b06314c2dd7f8591.tar.gz
gcc-966389eeaaf6b674bbfbdc34b06314c2dd7f8591.tar.bz2
ada-tree.def (LOOP_STMT, EXIT_STMT): Update documentation.
* ada-tree.def (LOOP_STMT, EXIT_STMT): Update documentation. * ada-tree.h (EXIT_STMT_LABEL): Renamed from EXIT_STMT_LOOP. * decl.c (gnat_to_gnu_entity): Also set force_global for imported subprograms. * trans.c (gnu_loop_label_stack): Renamed from gnu_loop_stmt_stack; all callers changed. (gnat_to_gnu, case N_Loop_Statement, case N_Exit_Statement): Change the way that EXIT_STMT finds the loop label. (gnat_gimplify_stmt, case LOOP_STMT, EXIT_STMT): Likewise. (gnat_gimplify_stmt, case DECL_STMT): Handle variable-sized decls here. (add_stmt): Use annotate_with_locus insted of setting directly. (pos_to_construct): Set TREE_PURPOSE of each entry to index. (gnat_stabilize_reference, case ARRAY_RANGE_REF): Merge with ARRAY_REF. * utils.c (gnat_install_builtins): Install __builtin_memcmp. (build_vms_descriptor): Add extra args to ARRAY_REF. (convert): Use VIEW_CONVERT_EXPR between aggregate types. * utils2.c (gnat_truthvalue_conversion, case INTEGER_CST, REAL_CST): New cases. (build_binary_op): Don't make explicit CONVERT_EXPR. Add extra rgs to ARRAY_REF. From-SVN: r83103
Diffstat (limited to 'gcc/ada/utils2.c')
-rw-r--r--gcc/ada/utils2.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c
index ed99531..0d83f74 100644
--- a/gcc/ada/utils2.c
+++ b/gcc/ada/utils2.c
@@ -84,6 +84,14 @@ gnat_truthvalue_conversion (tree expr)
case ERROR_MARK:
return expr;
+ case INTEGER_CST:
+ return (integer_zerop (expr) ? convert (type, integer_zero_node)
+ : convert (type, integer_one_node));
+
+ case REAL_CST:
+ return (real_zerop (expr) ? convert (type, integer_zero_node)
+ : convert (type, integer_one_node));
+
case COND_EXPR:
/* Distribute the conversion into the arms of a COND_EXPR. */
return fold
@@ -578,10 +586,8 @@ nonbinary_modular_operation (enum tree_code op_code,
have to do here is validate the work done by SEM and handle subtypes. */
tree
-build_binary_op (enum tree_code op_code,
- tree result_type,
- tree left_operand,
- tree right_operand)
+build_binary_op (enum tree_code op_code, tree result_type,
+ tree left_operand, tree right_operand)
{
tree left_type = TREE_TYPE (left_operand);
tree right_type = TREE_TYPE (right_operand);
@@ -739,17 +745,7 @@ build_binary_op (enum tree_code op_code,
if (operation_type != right_type
&& (! CONTAINS_PLACEHOLDER_P (TYPE_SIZE (operation_type))))
{
- /* For a variable-size type, with both BLKmode, convert using
- CONVERT_EXPR instead of an unchecked conversion since we don't
- need to make a temporary (and can't anyway). */
- if (TREE_CODE (TYPE_SIZE (operation_type)) != INTEGER_CST
- && TYPE_MODE (TREE_TYPE (right_operand)) == BLKmode
- && TREE_CODE (right_operand) != UNCONSTRAINED_ARRAY_REF)
- right_operand = build1 (CONVERT_EXPR, operation_type,
- right_operand);
- else
- right_operand = convert (operation_type, right_operand);
-
+ right_operand = convert (operation_type, right_operand);
right_type = operation_type;
}
@@ -894,7 +890,8 @@ build_binary_op (enum tree_code op_code,
just compare the data pointer. */
else if (TYPE_FAT_POINTER_P (left_base_type)
&& TREE_CODE (right_operand) == CONSTRUCTOR
- && integer_zerop (TREE_VALUE (CONSTRUCTOR_ELTS (right_operand))))
+ && integer_zerop (TREE_VALUE
+ (CONSTRUCTOR_ELTS (right_operand))))
{
right_operand = build_component_ref (left_operand, NULL_TREE,
TYPE_FIELDS (left_base_type),
@@ -1008,9 +1005,12 @@ build_binary_op (enum tree_code op_code,
return build1 (NULL_EXPR, operation_type, TREE_OPERAND (left_operand, 0));
else if (TREE_CODE (right_operand) == NULL_EXPR)
return build1 (NULL_EXPR, operation_type, TREE_OPERAND (right_operand, 0));
+ else if (op_code == ARRAY_REF || op_code == ARRAY_RANGE_REF)
+ result = fold (build (op_code, operation_type, left_operand, right_operand,
+ NULL_TREE, NULL_TREE));
else
- result = fold (build (op_code, operation_type,
- left_operand, right_operand));
+ result
+ = fold (build (op_code, operation_type, left_operand, right_operand));
TREE_SIDE_EFFECTS (result) |= has_side_effects;
TREE_CONSTANT (result)