Commit e805a599 by Tobias Schlüter Committed by Tobias Schlüter

trans-intrinsic.c (build_fixbound_expr, [...]): Use 'build_int_cst' instead of…

trans-intrinsic.c (build_fixbound_expr, [...]): Use 'build_int_cst' instead of converting 'integer_zero_node' or...

* trans-intrinsic.c (build_fixbound_expr,
gfc_conv_intrinsic_bound, gfc_conv_intrinsic_anyall,
gfc_conv_intrinsic_count, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_singlebitop): Use 'build_int_cst' instead
of converting 'integer_zero_node' or 'integer_one_node'
respectively.
(gfc_conv_intrinsic_ishftc): Same, but store in local variable to
evade re-building.
(gfc_conv_intrinsic_strcmp, gfc_conv_intrinsic_rrspacing,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_iargc): Use
'build_int_cst' instead of converting 'integer_zero_node' or
'integer_one_node' respectively.

From-SVN: r93730
parent 5e3b8727
...@@ -7,6 +7,19 @@ ...@@ -7,6 +7,19 @@
* trans-types.c (gfc_get_character_type_len): : Use * trans-types.c (gfc_get_character_type_len): : Use
gfc_charlen_type_node as basic type for the range field. gfc_charlen_type_node as basic type for the range field.
* trans-intrinsic.c (build_fixbound_expr,
gfc_conv_intrinsic_bound, gfc_conv_intrinsic_anyall,
gfc_conv_intrinsic_count, gfc_conv_intrinsic_btest,
gfc_conv_intrinsic_singlebitop): Use 'build_int_cst' instead
of converting 'integer_zero_node' or 'integer_one_node'
respectively.
(gfc_conv_intrinsic_ishftc): Same, but store in local variable to
evade re-building.
(gfc_conv_intrinsic_strcmp, gfc_conv_intrinsic_rrspacing,
gfc_conv_intrinsic_trim, gfc_conv_intrinsic_iargc): Use
'build_int_cst' instead of converting 'integer_zero_node' or
'integer_one_node' respectively.
2005-01-16 Steven G. Kargl <kargls@comcast.net> 2005-01-16 Steven G. Kargl <kargls@comcast.net>
PR 19168 PR 19168
......
...@@ -235,7 +235,7 @@ build_fixbound_expr (stmtblock_t * pblock, tree arg, tree type, int up) ...@@ -235,7 +235,7 @@ build_fixbound_expr (stmtblock_t * pblock, tree arg, tree type, int up)
cond = build2 (up ? GE_EXPR : LE_EXPR, boolean_type_node, tmp, arg); cond = build2 (up ? GE_EXPR : LE_EXPR, boolean_type_node, tmp, arg);
tmp = build2 (up ? PLUS_EXPR : MINUS_EXPR, type, intval, tmp = build2 (up ? PLUS_EXPR : MINUS_EXPR, type, intval,
convert (type, integer_one_node)); build_int_cst (type, 1));
tmp = build3 (COND_EXPR, type, cond, intval, tmp); tmp = build3 (COND_EXPR, type, cond, intval, tmp);
return tmp; return tmp;
} }
...@@ -684,8 +684,7 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper) ...@@ -684,8 +684,7 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper)
{ {
bound = gfc_evaluate_now (bound, &se->pre); bound = gfc_evaluate_now (bound, &se->pre);
cond = fold (build2 (LT_EXPR, boolean_type_node, cond = fold (build2 (LT_EXPR, boolean_type_node,
bound, convert (TREE_TYPE (bound), bound, build_int_cst (TREE_TYPE (bound), 0)));
integer_zero_node)));
tmp = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc))]; tmp = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc))];
tmp = fold (build2 (GE_EXPR, boolean_type_node, bound, tmp)); tmp = fold (build2 (GE_EXPR, boolean_type_node, bound, tmp));
cond = fold(build2 (TRUTH_ORIF_EXPR, boolean_type_node, cond, tmp)); cond = fold(build2 (TRUTH_ORIF_EXPR, boolean_type_node, cond, tmp));
...@@ -1172,8 +1171,7 @@ gfc_conv_intrinsic_anyall (gfc_se * se, gfc_expr * expr, int op) ...@@ -1172,8 +1171,7 @@ gfc_conv_intrinsic_anyall (gfc_se * se, gfc_expr * expr, int op)
gfc_add_block_to_block (&body, &arrayse.pre); gfc_add_block_to_block (&body, &arrayse.pre);
tmp = build2 (op, boolean_type_node, arrayse.expr, tmp = build2 (op, boolean_type_node, arrayse.expr,
fold_convert (TREE_TYPE (arrayse.expr), build_int_cst (TREE_TYPE (arrayse.expr), 0));
integer_zero_node));
tmp = build3_v (COND_EXPR, tmp, found, build_empty_stmt ()); tmp = build3_v (COND_EXPR, tmp, found, build_empty_stmt ());
gfc_add_expr_to_block (&body, tmp); gfc_add_expr_to_block (&body, tmp);
gfc_add_block_to_block (&body, &arrayse.post); gfc_add_block_to_block (&body, &arrayse.post);
...@@ -1215,7 +1213,7 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr) ...@@ -1215,7 +1213,7 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr)
type = gfc_typenode_for_spec (&expr->ts); type = gfc_typenode_for_spec (&expr->ts);
/* Initialize the result. */ /* Initialize the result. */
resvar = gfc_create_var (type, "count"); resvar = gfc_create_var (type, "count");
gfc_add_modify_expr (&se->pre, resvar, convert (type, integer_zero_node)); gfc_add_modify_expr (&se->pre, resvar, build_int_cst (type, 0));
/* Walk the arguments. */ /* Walk the arguments. */
arrayss = gfc_walk_expr (actual->expr); arrayss = gfc_walk_expr (actual->expr);
...@@ -1234,7 +1232,7 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr) ...@@ -1234,7 +1232,7 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr)
gfc_start_scalarized_body (&loop, &body); gfc_start_scalarized_body (&loop, &body);
tmp = build2 (PLUS_EXPR, TREE_TYPE (resvar), resvar, tmp = build2 (PLUS_EXPR, TREE_TYPE (resvar), resvar,
convert (TREE_TYPE (resvar), integer_one_node)); build_int_cst (TREE_TYPE (resvar), 1));
tmp = build2_v (MODIFY_EXPR, resvar, tmp); tmp = build2_v (MODIFY_EXPR, resvar, tmp);
gfc_init_se (&arrayse, NULL); gfc_init_se (&arrayse, NULL);
...@@ -1670,10 +1668,10 @@ gfc_conv_intrinsic_btest (gfc_se * se, gfc_expr * expr) ...@@ -1670,10 +1668,10 @@ gfc_conv_intrinsic_btest (gfc_se * se, gfc_expr * expr)
arg = TREE_VALUE (arg); arg = TREE_VALUE (arg);
type = TREE_TYPE (arg); type = TREE_TYPE (arg);
tmp = build2 (LSHIFT_EXPR, type, convert (type, integer_one_node), arg2); tmp = build2 (LSHIFT_EXPR, type, build_int_cst (type, 1), arg2);
tmp = build2 (BIT_AND_EXPR, type, arg, tmp); tmp = build2 (BIT_AND_EXPR, type, arg, tmp);
tmp = fold (build2 (NE_EXPR, boolean_type_node, tmp, tmp = fold (build2 (NE_EXPR, boolean_type_node, tmp,
convert (type, integer_zero_node))); build_int_cst (type, 0)));
type = gfc_typenode_for_spec (&expr->ts); type = gfc_typenode_for_spec (&expr->ts);
se->expr = convert (type, tmp); se->expr = convert (type, tmp);
} }
...@@ -1721,8 +1719,7 @@ gfc_conv_intrinsic_singlebitop (gfc_se * se, gfc_expr * expr, int set) ...@@ -1721,8 +1719,7 @@ gfc_conv_intrinsic_singlebitop (gfc_se * se, gfc_expr * expr, int set)
arg = TREE_VALUE (arg); arg = TREE_VALUE (arg);
type = TREE_TYPE (arg); type = TREE_TYPE (arg);
tmp = fold (build2 (LSHIFT_EXPR, type, tmp = fold (build2 (LSHIFT_EXPR, type, build_int_cst (type, 1), arg2));
convert (type, integer_one_node), arg2));
if (set) if (set)
op = BIT_IOR_EXPR; op = BIT_IOR_EXPR;
else else
...@@ -1823,6 +1820,7 @@ gfc_conv_intrinsic_ishftc (gfc_se * se, gfc_expr * expr) ...@@ -1823,6 +1820,7 @@ gfc_conv_intrinsic_ishftc (gfc_se * se, gfc_expr * expr)
tree tmp; tree tmp;
tree lrot; tree lrot;
tree rrot; tree rrot;
tree zero;
arg = gfc_conv_intrinsic_function_args (se, expr); arg = gfc_conv_intrinsic_function_args (se, expr);
arg2 = TREE_CHAIN (arg); arg2 = TREE_CHAIN (arg);
...@@ -1880,13 +1878,12 @@ gfc_conv_intrinsic_ishftc (gfc_se * se, gfc_expr * expr) ...@@ -1880,13 +1878,12 @@ gfc_conv_intrinsic_ishftc (gfc_se * se, gfc_expr * expr)
tmp = fold (build1 (NEGATE_EXPR, TREE_TYPE (arg2), arg2)); tmp = fold (build1 (NEGATE_EXPR, TREE_TYPE (arg2), arg2));
rrot = fold (build2 (RROTATE_EXPR, type, arg, tmp)); rrot = fold (build2 (RROTATE_EXPR, type, arg, tmp));
tmp = fold (build2 (GT_EXPR, boolean_type_node, arg2, zero = build_int_cst (TREE_TYPE (arg2), 0);
convert (TREE_TYPE (arg2), integer_zero_node))); tmp = fold (build2 (GT_EXPR, boolean_type_node, arg2, zero));
rrot = fold (build3 (COND_EXPR, type, tmp, lrot, rrot)); rrot = fold (build3 (COND_EXPR, type, tmp, lrot, rrot));
/* Do nothing if shift == 0. */ /* Do nothing if shift == 0. */
tmp = fold (build2 (EQ_EXPR, boolean_type_node, arg2, tmp = fold (build2 (EQ_EXPR, boolean_type_node, arg2, zero));
convert (TREE_TYPE (arg2), integer_zero_node)));
se->expr = fold (build3 (COND_EXPR, type, tmp, arg, rrot)); se->expr = fold (build3 (COND_EXPR, type, tmp, arg, rrot));
} }
...@@ -2097,7 +2094,7 @@ gfc_conv_intrinsic_strcmp (gfc_se * se, gfc_expr * expr, int op) ...@@ -2097,7 +2094,7 @@ gfc_conv_intrinsic_strcmp (gfc_se * se, gfc_expr * expr, int op)
type = gfc_typenode_for_spec (&expr->ts); type = gfc_typenode_for_spec (&expr->ts);
se->expr = build2 (op, type, se->expr, se->expr = build2 (op, type, se->expr,
convert (TREE_TYPE (se->expr), integer_zero_node)); build_int_cst (TREE_TYPE (se->expr), 0));
} }
/* Generate a call to the adjustl/adjustr library function. */ /* Generate a call to the adjustl/adjustr library function. */
...@@ -2529,7 +2526,7 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr) ...@@ -2529,7 +2526,7 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr)
cond2 = build2 (EQ_EXPR, boolean_type_node, rcs.frac, zero); cond2 = build2 (EQ_EXPR, boolean_type_node, rcs.frac, zero);
cond = build2 (TRUTH_ANDIF_EXPR, boolean_type_node, cond, cond2); cond = build2 (TRUTH_ANDIF_EXPR, boolean_type_node, cond, cond2);
tmp = build3 (COND_EXPR, masktype, cond, tmp = build3 (COND_EXPR, masktype, cond,
convert (masktype, integer_zero_node), tmp); build_int_cst (masktype, 0), tmp);
tmp = build1 (VIEW_CONVERT_EXPR, rcs.type, tmp); tmp = build1 (VIEW_CONVERT_EXPR, rcs.type, tmp);
se->expr = tmp; se->expr = tmp;
...@@ -2608,7 +2605,7 @@ gfc_conv_intrinsic_trim (gfc_se * se, gfc_expr * expr) ...@@ -2608,7 +2605,7 @@ gfc_conv_intrinsic_trim (gfc_se * se, gfc_expr * expr)
/* Free the temporary afterwards, if necessary. */ /* Free the temporary afterwards, if necessary. */
cond = build2 (GT_EXPR, boolean_type_node, len, cond = build2 (GT_EXPR, boolean_type_node, len,
convert (TREE_TYPE (len), integer_zero_node)); build_int_cst (TREE_TYPE (len), 0));
arglist = gfc_chainon_list (NULL_TREE, var); arglist = gfc_chainon_list (NULL_TREE, var);
tmp = gfc_build_function_call (gfor_fndecl_internal_free, arglist); tmp = gfc_build_function_call (gfor_fndecl_internal_free, arglist);
tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ()); tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ());
...@@ -2671,7 +2668,7 @@ gfc_conv_intrinsic_iargc (gfc_se * se, gfc_expr * expr, bool args_only) ...@@ -2671,7 +2668,7 @@ gfc_conv_intrinsic_iargc (gfc_se * se, gfc_expr * expr, bool args_only)
tmp = fold_convert (type, tmp); tmp = fold_convert (type, tmp);
if (args_only) if (args_only)
tmp = build2 (MINUS_EXPR, type, tmp, convert (type, integer_one_node)); tmp = build2 (MINUS_EXPR, type, tmp, build_int_cst (type, 1));
se->expr = tmp; se->expr = tmp;
} }
......
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