aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils2.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2008-11-09 09:50:02 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2008-11-09 09:50:02 +0000
commit82d3b03a3baf4681f3d4139fbc37c7e6cc92847f (patch)
tree702b82345e4f0709fa08788c1592629bc7f831e2 /gcc/ada/gcc-interface/utils2.c
parent52013b9baae8e58e75461d3ded8f806a4734c82f (diff)
downloadgcc-82d3b03a3baf4681f3d4139fbc37c7e6cc92847f.zip
gcc-82d3b03a3baf4681f3d4139fbc37c7e6cc92847f.tar.gz
gcc-82d3b03a3baf4681f3d4139fbc37c7e6cc92847f.tar.bz2
ada-tree.def (PLUS_NOMOD_EXPR): New tree code.
* gcc-interface/ada-tree.def (PLUS_NOMOD_EXPR): New tree code. (MINUS_NOMOD_EXPR): Likewise. * gcc-interface/utils2.c (build_binary_op) <PREINCREMENT_EXPR>: Make unreachable. <PLUS_NOMOD_EXPR>: New case. <MINUS_NOMOD_EXPR>: Likewise. * gcc-interface/trans.c (Loop_Statement_to_gnu): Build increment-and- assignment statement instead of using an increment operator. From-SVN: r141714
Diffstat (limited to 'gcc/ada/gcc-interface/utils2.c')
-rw-r--r--gcc/ada/gcc-interface/utils2.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index 5077e64..77a0389 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -943,21 +943,8 @@ build_binary_op (enum tree_code op_code, tree result_type,
case PREDECREMENT_EXPR:
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
- /* In these, the result type and the left operand type should be the
- same. Do the operation in the base type of those and convert the
- right operand (which is an integer) to that type.
-
- Note that these operations are only used in loop control where
- we guarantee that no overflow can occur. So nothing special need
- be done for modular types. */
-
- gcc_assert (left_type == result_type);
- operation_type = get_base_type (result_type);
- left_operand = convert (operation_type, left_operand);
- right_operand = convert (operation_type, right_operand);
- has_side_effects = true;
- modulus = NULL_TREE;
- break;
+ /* These operations are not used anymore. */
+ gcc_unreachable ();
case LSHIFT_EXPR:
case RSHIFT_EXPR:
@@ -1011,6 +998,16 @@ build_binary_op (enum tree_code op_code, tree result_type,
right_operand = convert (sizetype, right_operand);
break;
+ case PLUS_NOMOD_EXPR:
+ case MINUS_NOMOD_EXPR:
+ if (op_code == PLUS_NOMOD_EXPR)
+ op_code = PLUS_EXPR;
+ else
+ op_code = MINUS_EXPR;
+ modulus = NULL_TREE;
+
+ /* ... fall through ... */
+
case PLUS_EXPR:
case MINUS_EXPR:
/* Avoid doing arithmetics in BOOLEAN_TYPE like the other compilers.
@@ -1018,7 +1015,8 @@ build_binary_op (enum tree_code op_code, tree result_type,
but we can generate addition or subtraction for 'Succ and 'Pred. */
if (operation_type && TREE_CODE (operation_type) == BOOLEAN_TYPE)
operation_type = left_base_type = right_base_type = integer_type_node;
- goto common;
+
+ /* ... fall through ... */
default:
common: