trans-intrinsic.c (build_fixbound_expr, [...]): Use 'build_int_cst' instead of conver...
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Sun, 16 Jan 2005 16:16:00 +0000 (17:16 +0100)
committerTobias Schlüter <tobi@gcc.gnu.org>
Sun, 16 Jan 2005 16:16:00 +0000 (17:16 +0100)
* 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

gcc/fortran/ChangeLog
gcc/fortran/trans-intrinsic.c

index d9c65b00aec354a87c6d90cec7853dcf2af48f5d..1b5858c65566159765da6f5fec4991934ddbd134 100644 (file)
@@ -7,6 +7,19 @@
        * trans-types.c (gfc_get_character_type_len): : Use
        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>
 
        PR 19168
index e133ec748900db14e239f5b3bf3a9dfb54a39ceb..c44499fcdeb31dab4f6f55f4003673f440bf5438 100644 (file)
@@ -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);
 
   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);
   return tmp;
 }
@@ -684,8 +684,7 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper)
         {
           bound = gfc_evaluate_now (bound, &se->pre);
           cond = fold (build2 (LT_EXPR, boolean_type_node,
-                              bound, convert (TREE_TYPE (bound),
-                                              integer_zero_node)));
+                              bound, build_int_cst (TREE_TYPE (bound), 0)));
           tmp = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc))];
           tmp = fold (build2 (GE_EXPR, boolean_type_node, bound, 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)
 
   gfc_add_block_to_block (&body, &arrayse.pre);
   tmp = build2 (op, boolean_type_node, arrayse.expr,
-               fold_convert (TREE_TYPE (arrayse.expr),
-                             integer_zero_node));
+               build_int_cst (TREE_TYPE (arrayse.expr), 0));
   tmp = build3_v (COND_EXPR, tmp, found, build_empty_stmt ());
   gfc_add_expr_to_block (&body, tmp);
   gfc_add_block_to_block (&body, &arrayse.post);
@@ -1215,7 +1213,7 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr)
   type = gfc_typenode_for_spec (&expr->ts);
   /* Initialize the result.  */
   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.  */
   arrayss = gfc_walk_expr (actual->expr);
@@ -1234,7 +1232,7 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr)
   gfc_start_scalarized_body (&loop, &body);
 
   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);
 
   gfc_init_se (&arrayse, NULL);
@@ -1670,10 +1668,10 @@ gfc_conv_intrinsic_btest (gfc_se * se, gfc_expr * expr)
   arg = TREE_VALUE (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 = 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);
   se->expr = convert (type, tmp);
 }
@@ -1721,8 +1719,7 @@ gfc_conv_intrinsic_singlebitop (gfc_se * se, gfc_expr * expr, int set)
   arg = TREE_VALUE (arg);
   type = TREE_TYPE (arg);
 
-  tmp = fold (build2 (LSHIFT_EXPR, type,
-                    convert (type, integer_one_node), arg2));
+  tmp = fold (build2 (LSHIFT_EXPR, type, build_int_cst (type, 1), arg2));
   if (set)
     op = BIT_IOR_EXPR;
   else
@@ -1823,6 +1820,7 @@ gfc_conv_intrinsic_ishftc (gfc_se * se, gfc_expr * expr)
   tree tmp;
   tree lrot;
   tree rrot;
+  tree zero;
 
   arg = gfc_conv_intrinsic_function_args (se, expr);
   arg2 = TREE_CHAIN (arg);
@@ -1880,13 +1878,12 @@ gfc_conv_intrinsic_ishftc (gfc_se * se, gfc_expr * expr)
   tmp = fold (build1 (NEGATE_EXPR, TREE_TYPE (arg2), arg2));
   rrot = fold (build2 (RROTATE_EXPR, type, arg, tmp));
 
-  tmp = fold (build2 (GT_EXPR, boolean_type_node, arg2,
-                     convert (TREE_TYPE (arg2), integer_zero_node)));
+  zero = build_int_cst (TREE_TYPE (arg2), 0);
+  tmp = fold (build2 (GT_EXPR, boolean_type_node, arg2, zero));
   rrot = fold (build3 (COND_EXPR, type, tmp, lrot, rrot));
 
   /* Do nothing if shift == 0.  */
-  tmp = fold (build2 (EQ_EXPR, boolean_type_node, arg2,
-                     convert (TREE_TYPE (arg2), integer_zero_node)));
+  tmp = fold (build2 (EQ_EXPR, boolean_type_node, arg2, zero));
   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)
 
   type = gfc_typenode_for_spec (&expr->ts);
   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.  */
@@ -2529,7 +2526,7 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr)
    cond2 = build2 (EQ_EXPR, boolean_type_node, rcs.frac, zero);
    cond = build2 (TRUTH_ANDIF_EXPR, boolean_type_node, cond, cond2);
    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);
    se->expr = tmp;
@@ -2608,7 +2605,7 @@ gfc_conv_intrinsic_trim (gfc_se * se, gfc_expr * expr)
 
   /* Free the temporary afterwards, if necessary.  */
   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);
   tmp = gfc_build_function_call (gfor_fndecl_internal_free, arglist);
   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)
   tmp = fold_convert (type, tmp);
 
   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;
 }