Commit 9645c3c5 by Roger Sayle Committed by Roger Sayle

cuintp.c (UI_To_gnu): Use fold_buildN calls instead of calling fold with the result of buildN.


	* cuintp.c (UI_To_gnu): Use fold_buildN calls instead of calling
	fold with the result of buildN.
	* decl.c (gnat_to_gnu_entity): Likewise.
	* trans.c (Attribute_to_gnu, gnat_to_gnu, emit_check): Likewise.
	* utils.c (finish_record_type, merge_sizes, max_size, convert):
	Likewise.
	* utils2.c (gnat_truthvalue_conversion, compare_arrays,
	nonbinary_modular_operation, build_binary_op, build_unary_op,
	build_cond_expr): Likewise.

	* utils.c (convert): Use fold_build1 when casting values to void.
	* utils2.c (gnat_truthvalue_conversion): Use build_int_cst and
	fold_convert instead of convert when appropriate.

From-SVN: r122752
parent 63a08740
2007-03-09 Roger Sayle <roger@eyesopen.com>
* cuintp.c (UI_To_gnu): Use fold_buildN calls instead of calling
fold with the result of buildN.
* decl.c (gnat_to_gnu_entity): Likewise.
* trans.c (Attribute_to_gnu, gnat_to_gnu, emit_check): Likewise.
* utils.c (finish_record_type, merge_sizes, max_size, convert):
Likewise.
* utils2.c (gnat_truthvalue_conversion, compare_arrays,
nonbinary_modular_operation, build_binary_op, build_unary_op,
build_cond_expr): Likewise.
* utils.c (convert): Use fold_build1 when casting values to void.
* utils2.c (gnat_truthvalue_conversion): Use build_int_cst and
fold_convert instead of convert when appropriate.
2007-03-01 Brooks Moses <brooks.moses@codesourcery.com>
* Make-lang.in: Add install-pdf target as copied from
......@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
* Copyright (C) 1992-2005 Free Software Foundation, Inc. *
* Copyright (C) 1992-2007 Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
......@@ -113,18 +113,18 @@ UI_To_gnu (Uint Input, tree type)
gnu_ret = build_cst_from_int (comp_type, First);
if (First < 0)
for (Idx++, Length--; Length; Idx++, Length--)
gnu_ret = fold (build2 (MINUS_EXPR, comp_type,
fold (build2 (MULT_EXPR, comp_type,
gnu_ret, gnu_base)),
build_cst_from_int (comp_type,
Udigits_Ptr[Idx])));
gnu_ret = fold_build2 (MINUS_EXPR, comp_type,
fold_build2 (MULT_EXPR, comp_type,
gnu_ret, gnu_base),
build_cst_from_int (comp_type,
Udigits_Ptr[Idx]));
else
for (Idx++, Length--; Length; Idx++, Length--)
gnu_ret = fold (build2 (PLUS_EXPR, comp_type,
fold (build2 (MULT_EXPR, comp_type,
gnu_ret, gnu_base)),
build_cst_from_int (comp_type,
Udigits_Ptr[Idx])));
gnu_ret = fold_build2 (PLUS_EXPR, comp_type,
fold_build2 (MULT_EXPR, comp_type,
gnu_ret, gnu_base),
build_cst_from_int (comp_type,
Udigits_Ptr[Idx]));
}
gnu_ret = convert (type, gnu_ret);
......
......@@ -1332,8 +1332,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
{
TYPE_MODULAR_P (gnu_type) = 1;
SET_TYPE_MODULUS (gnu_type, gnu_modulus);
gnu_high = fold (build2 (MINUS_EXPR, gnu_type, gnu_modulus,
convert (gnu_type, integer_one_node)));
gnu_high = fold_build2 (MINUS_EXPR, gnu_type, gnu_modulus,
convert (gnu_type, integer_one_node));
}
/* If we have to set TYPE_PRECISION different from its natural value,
......@@ -1909,10 +1909,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
&& TREE_CODE (gnu_max) == INTEGER_CST
&& TREE_OVERFLOW (gnu_min) && TREE_OVERFLOW (gnu_max)
&& (!TREE_OVERFLOW
(fold (build2 (MINUS_EXPR, gnu_index_subtype,
TYPE_MAX_VALUE (gnu_index_subtype),
TYPE_MIN_VALUE (gnu_index_subtype))))))
TREE_OVERFLOW (gnu_min) = TREE_OVERFLOW (gnu_max) = 0;
(fold_build2 (MINUS_EXPR, gnu_index_subtype,
TYPE_MAX_VALUE (gnu_index_subtype),
TYPE_MIN_VALUE (gnu_index_subtype)))))
{
TREE_OVERFLOW (gnu_min) = 0;
TREE_OVERFLOW (gnu_max) = 0;
}
/* Similarly, if the range is null, use bounds of 1..0 for
the sizetype bounds. */
......
......@@ -782,8 +782,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
if (attribute == Attr_Max_Size_In_Storage_Elements)
gnu_result = convert (sizetype,
fold (build2 (CEIL_DIV_EXPR, bitsizetype,
gnu_result, bitsize_unit_node)));
fold_build2 (CEIL_DIV_EXPR, bitsizetype,
gnu_result, bitsize_unit_node));
break;
case Attr_Alignment:
......@@ -1100,8 +1100,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
example in AARM 11.6(5.e). */
if (prefix_unused && TREE_SIDE_EFFECTS (gnu_prefix)
&& !Is_Entity_Name (Prefix (gnat_node)))
gnu_result = fold (build2 (COMPOUND_EXPR, TREE_TYPE (gnu_result),
gnu_prefix, gnu_result));
gnu_result = fold_build2 (COMPOUND_EXPR, TREE_TYPE (gnu_result),
gnu_prefix, gnu_result);
*gnu_result_type_p = gnu_result_type;
return gnu_result;
......@@ -3079,13 +3079,13 @@ gnat_to_gnu (Node_Id gnat_node)
expression if the slice range is not null (max >= min) or
returns the min if the slice range is null */
gnu_expr
= fold (build3 (COND_EXPR, gnu_expr_type,
build_binary_op (GE_EXPR, gnu_expr_type,
convert (gnu_expr_type,
gnu_max_expr),
convert (gnu_expr_type,
gnu_min_expr)),
gnu_expr, gnu_min_expr));
= fold_build3 (COND_EXPR, gnu_expr_type,
build_binary_op (GE_EXPR, gnu_expr_type,
convert (gnu_expr_type,
gnu_max_expr),
convert (gnu_expr_type,
gnu_min_expr)),
gnu_expr, gnu_min_expr);
}
else
gnu_expr = TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_result_type));
......@@ -5403,10 +5403,10 @@ emit_check (tree gnu_cond, tree gnu_expr, int reason)
in front of the comparison in case it ends up being a SAVE_EXPR. Put the
whole thing inside its own SAVE_EXPR so the inner SAVE_EXPR doesn't leak
out. */
gnu_result = fold (build3 (COND_EXPR, TREE_TYPE (gnu_expr), gnu_cond,
build2 (COMPOUND_EXPR, TREE_TYPE (gnu_expr),
gnu_call, gnu_expr),
gnu_expr));
gnu_result = fold_build3 (COND_EXPR, TREE_TYPE (gnu_expr), gnu_cond,
build2 (COMPOUND_EXPR, TREE_TYPE (gnu_expr),
gnu_call, gnu_expr),
gnu_expr);
/* If GNU_EXPR has side effects, make the outer COMPOUND_EXPR and
protect it. Otherwise, show GNU_RESULT has no side effects: we
......
......@@ -868,10 +868,10 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
case QUAL_UNION_TYPE:
ada_size
= fold (build3 (COND_EXPR, bitsizetype, DECL_QUALIFIER (field),
this_ada_size, ada_size));
size = fold (build3 (COND_EXPR, bitsizetype, DECL_QUALIFIER (field),
this_size, size));
= fold_build3 (COND_EXPR, bitsizetype, DECL_QUALIFIER (field),
this_ada_size, ada_size);
size = fold_build3 (COND_EXPR, bitsizetype, DECL_QUALIFIER (field),
this_size, size);
break;
case RECORD_TYPE:
......@@ -1133,15 +1133,15 @@ merge_sizes (tree last_size, tree first_bit, tree size, bool special,
}
else
new = fold (build3 (COND_EXPR, type, TREE_OPERAND (size, 0),
integer_zerop (TREE_OPERAND (size, 1))
? last_size : merge_sizes (last_size, first_bit,
TREE_OPERAND (size, 1),
1, has_rep),
integer_zerop (TREE_OPERAND (size, 2))
? last_size : merge_sizes (last_size, first_bit,
TREE_OPERAND (size, 2),
1, has_rep)));
new = fold_build3 (COND_EXPR, type, TREE_OPERAND (size, 0),
integer_zerop (TREE_OPERAND (size, 1))
? last_size : merge_sizes (last_size, first_bit,
TREE_OPERAND (size, 1),
1, has_rep),
integer_zerop (TREE_OPERAND (size, 2))
? last_size : merge_sizes (last_size, first_bit,
TREE_OPERAND (size, 2),
1, has_rep));
/* We don't need any NON_VALUE_EXPRs and they can confuse us (especially
when fed through substitute_in_expr) into thinking that a constant
......@@ -2372,9 +2372,9 @@ max_size (tree exp, bool max_p)
return max_size (TREE_OPERAND (exp, 0), max_p);
else
return
fold (build1 (code, type,
max_size (TREE_OPERAND (exp, 0),
code == NEGATE_EXPR ? !max_p : max_p)));
fold_build1 (code, type,
max_size (TREE_OPERAND (exp, 0),
code == NEGATE_EXPR ? !max_p : max_p));
case 2:
if (code == COMPOUND_EXPR)
......@@ -2424,16 +2424,16 @@ max_size (tree exp, bool max_p)
&& !TREE_CONSTANT (rhs))
return lhs;
else
return fold (build2 (code, type, lhs, rhs));
return fold_build2 (code, type, lhs, rhs);
}
case 3:
if (code == SAVE_EXPR)
return exp;
else if (code == COND_EXPR)
return fold (build2 (max_p ? MAX_EXPR : MIN_EXPR, type,
max_size (TREE_OPERAND (exp, 1), max_p),
max_size (TREE_OPERAND (exp, 2), max_p)));
return fold_build2 (max_p ? MAX_EXPR : MIN_EXPR, type,
max_size (TREE_OPERAND (exp, 1), max_p),
max_size (TREE_OPERAND (exp, 2), max_p));
}
/* Other tree classes cannot happen. */
......@@ -3167,10 +3167,10 @@ convert (tree type, tree expr)
/* If the input is a biased type, adjust first. */
if (ecode == INTEGER_TYPE && TYPE_BIASED_REPRESENTATION_P (etype))
return convert (type, fold (build2 (PLUS_EXPR, TREE_TYPE (etype),
fold_convert (TREE_TYPE (etype),
expr),
TYPE_MIN_VALUE (etype))));
return convert (type, fold_build2 (PLUS_EXPR, TREE_TYPE (etype),
fold_convert (TREE_TYPE (etype),
expr),
TYPE_MIN_VALUE (etype)));
/* If the input is a justified modular type, we need to extract the actual
object before converting it to any other type with the exceptions of an
......@@ -3321,7 +3321,7 @@ convert (tree type, tree expr)
switch (code)
{
case VOID_TYPE:
return build1 (CONVERT_EXPR, type, expr);
return fold_build1 (CONVERT_EXPR, type, expr);
case BOOLEAN_TYPE:
return fold_convert (type, gnat_truthvalue_conversion (expr));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment