static bool tree_swap_operands_p (tree, tree, bool);
static tree fold_negate_const (tree, tree);
-static tree fold_abs_const (tree, tree);
static tree fold_not_const (tree, tree);
static tree fold_relational_const (enum tree_code, tree, tree, tree);
static tree fold_relational_hi_lo (enum tree_code *, const tree,
return pedantic_non_lvalue (t);
}
+
+/* Return a tree for the case when the result of an expression is RESULT
+ converted to TYPE and OMITTED1 and OMITTED2 were previously operands
+ of the expression but are now not needed.
+
+ If OMITTED1 or OMITTED2 has side effects, they must be evaluated.
+ If both OMITTED1 and OMITTED2 have side effects, OMITTED1 is
+ evaluated before OMITTED2. Otherwise, if neither has side effects,
+ just do the conversion of RESULT to TYPE. */
+
+tree
+omit_two_operands (tree type, tree result, tree omitted1, tree omitted2)
+{
+ tree t = fold_convert (type, result);
+
+ if (TREE_SIDE_EFFECTS (omitted2))
+ t = build2 (COMPOUND_EXPR, type, omitted2, t);
+ if (TREE_SIDE_EFFECTS (omitted1))
+ t = build2 (COMPOUND_EXPR, type, omitted1, t);
+
+ return TREE_CODE (t) != COMPOUND_EXPR ? non_lvalue (t) : t;
+}
+
\f
/* Return a simplified tree node for the truth-negation of ARG. This
never alters ARG itself. We assume that ARG is an operation that
if (! HONOR_NANS (mode))
return fold (build2 (neg ? GE_EXPR : LE_EXPR, type,
arg0, build_real (TREE_TYPE (arg0), max)));
+
+ /* The transformation below creates non-gimple code and thus is
+ not appropriate if we are in gimple form. */
+ if (in_gimple_form)
+ return NULL_TREE;
+
temp = fold (build2 (neg ? LT_EXPR : GT_EXPR, type,
arg0, build_real (TREE_TYPE (arg0), max)));
return fold (build1 (TRUTH_NOT_EXPR, type, temp));
fold_checksum_tree (DECL_VINDEX (expr), ctx, ht);
break;
case 't':
- fold_checksum_tree (TYPE_VALUES (expr), ctx, ht);
+ if (TREE_CODE (expr) == ENUMERAL_TYPE)
+ fold_checksum_tree (TYPE_VALUES (expr), ctx, ht);
fold_checksum_tree (TYPE_SIZE (expr), ctx, ht);
fold_checksum_tree (TYPE_SIZE_UNIT (expr), ctx, ht);
fold_checksum_tree (TYPE_ATTRIBUTES (expr), ctx, ht);
fold_checksum_tree (TYPE_NAME (expr), ctx, ht);
- fold_checksum_tree (TYPE_MIN_VALUE (expr), ctx, ht);
- fold_checksum_tree (TYPE_MAX_VALUE (expr), ctx, ht);
+ if (INTEGRAL_TYPE_P (expr)
+ || SCALAR_FLOAT_TYPE_P (expr))
+ {
+ fold_checksum_tree (TYPE_MIN_VALUE (expr), ctx, ht);
+ fold_checksum_tree (TYPE_MAX_VALUE (expr), ctx, ht);
+ }
fold_checksum_tree (TYPE_MAIN_VARIANT (expr), ctx, ht);
fold_checksum_tree (TYPE_BINFO (expr), ctx, ht);
fold_checksum_tree (TYPE_CONTEXT (expr), ctx, ht);
TYPE is the type of the result. */
-static tree
+tree
fold_abs_const (tree arg0, tree type)
{
tree t = NULL_TREE;