OSDN Git Service

2005-12-16 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Dec 2005 21:03:50 +0000 (21:03 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Dec 2005 21:03:50 +0000 (21:03 +0000)
* trans.h (gfc_build_indirect_ref): Remove declaration.
* trans.c (gfc_build_indirect_ref): Remove.
* trans-array.c (gfc_trans_array_ctor_element): Use
build_fold_indirect_ref instead of gfc_build_indirect_ref.
(gfc_trans_array_constructor_value): Likewise.
(gfc_conv_array_index_offset): Likewise.
(gfc_conv_scalarized_array_ref): Likewise.
(gfc_conv_array_ref): Likewise.
(gfc_trans_dummy_array_bias): Likewise.
(gfc_conv_expr_descriptor): Likewise.
(gfc_conv_array_parameter): Likewise.
* trans-decl.c (gfc_finish_cray_pointee): Likewise.
(gfc_get_symbol_decl): Likewise.
* trans-expr.c (gfc_conv_substring): Likewise.
(gfc_conv_component_ref): Likewise.
(gfc_conv_variable): Likewise.
(gfc_add_interface_mapping): Likewise.
(gfc_conv_function_call): Likewise.
* trans-intrinsic.c (gfc_conv_intrinsic_ichar): Likewise.
(gfc_conv_intrinsic_transfer): Likewise.
* trans-io.c (nml_get_addr_expr): Likewise.
(transfer_namelist_element): Likewise.
(transfer_expr): Likewise.
* trans-stmt.c (gfc_trans_nested_forall_loop): Likewise.
(allocate_temp_for_forall_nest_1): Likewise.
(gfc_trans_forall_1): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108678 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/fortran/trans-decl.c
gcc/fortran/trans-expr.c
gcc/fortran/trans-intrinsic.c
gcc/fortran/trans-io.c
gcc/fortran/trans-stmt.c
gcc/fortran/trans.c
gcc/fortran/trans.h

index 2fa33a1..298b672 100644 (file)
@@ -1,5 +1,34 @@
 2005-12-16  Richard Guenther  <rguenther@suse.de>
 
+       * trans.h (gfc_build_indirect_ref): Remove declaration.
+       * trans.c (gfc_build_indirect_ref): Remove.
+       * trans-array.c (gfc_trans_array_ctor_element): Use
+       build_fold_indirect_ref instead of gfc_build_indirect_ref.
+       (gfc_trans_array_constructor_value): Likewise.
+       (gfc_conv_array_index_offset): Likewise.
+       (gfc_conv_scalarized_array_ref): Likewise.
+       (gfc_conv_array_ref): Likewise.
+       (gfc_trans_dummy_array_bias): Likewise.
+       (gfc_conv_expr_descriptor): Likewise.
+       (gfc_conv_array_parameter): Likewise.
+       * trans-decl.c (gfc_finish_cray_pointee): Likewise.
+       (gfc_get_symbol_decl): Likewise.
+       * trans-expr.c (gfc_conv_substring): Likewise.
+       (gfc_conv_component_ref): Likewise.
+       (gfc_conv_variable): Likewise.
+       (gfc_add_interface_mapping): Likewise.
+       (gfc_conv_function_call): Likewise.
+       * trans-intrinsic.c (gfc_conv_intrinsic_ichar): Likewise.
+       (gfc_conv_intrinsic_transfer): Likewise.
+       * trans-io.c (nml_get_addr_expr): Likewise.
+       (transfer_namelist_element): Likewise.
+       (transfer_expr): Likewise.
+       * trans-stmt.c (gfc_trans_nested_forall_loop): Likewise.
+       (allocate_temp_for_forall_nest_1): Likewise.
+       (gfc_trans_forall_1): Likewise.
+
+2005-12-16  Richard Guenther  <rguenther@suse.de>
+
        * trans-array.c (gfc_conv_descriptor_data_addr): Use
        build_fold_addr_expr where appropriate.
        (gfc_trans_allocate_array_storage): Likewise.
index 1c03f2a..2ecbc50 100644 (file)
@@ -932,7 +932,7 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc,
   gfc_conv_expr (se, expr);
 
   /* Store the value.  */
-  tmp = gfc_build_indirect_ref (gfc_conv_descriptor_data_get (desc));
+  tmp = build_fold_indirect_ref (gfc_conv_descriptor_data_get (desc));
   tmp = gfc_build_array_ref (tmp, offset);
   if (expr->ts.type == BT_CHARACTER)
     {
@@ -1157,7 +1157,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
 
              /* Use BUILTIN_MEMCPY to assign the values.  */
              tmp = gfc_conv_descriptor_data_get (desc);
-             tmp = gfc_build_indirect_ref (tmp);
+             tmp = build_fold_indirect_ref (tmp);
              tmp = gfc_build_array_ref (tmp, *poffset);
              tmp = build_fold_addr_expr (tmp);
              init = build_fold_addr_expr (init);
@@ -1827,7 +1827,7 @@ gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i,
                               index, gfc_conv_array_stride (desc, 0));
 
          /* Read the vector to get an index into info->descriptor.  */
-         data = gfc_build_indirect_ref (gfc_conv_array_data (desc));
+         data = build_fold_indirect_ref (gfc_conv_array_data (desc));
          index = gfc_build_array_ref (data, index);
          index = gfc_evaluate_now (index, &se->pre);
 
@@ -1891,7 +1891,7 @@ gfc_conv_scalarized_array_ref (gfc_se * se, gfc_array_ref * ar)
      dimensions.  */
   index = fold_build2 (PLUS_EXPR, gfc_array_index_type, index, info->offset);
 
-  tmp = gfc_build_indirect_ref (info->data);
+  tmp = build_fold_indirect_ref (info->data);
   se->expr = gfc_build_array_ref (tmp, index);
 }
 
@@ -1980,7 +1980,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar)
       
   /* Access the calculated element.  */
   tmp = gfc_conv_array_data (se->expr);
-  tmp = gfc_build_indirect_ref (tmp);
+  tmp = build_fold_indirect_ref (tmp);
   se->expr = gfc_build_array_ref (tmp, index);
 }
 
@@ -3482,7 +3482,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
   type = TREE_TYPE (tmpdesc);
   gcc_assert (GFC_ARRAY_TYPE_P (type));
   dumdesc = GFC_DECL_SAVED_DESCRIPTOR (tmpdesc);
-  dumdesc = gfc_build_indirect_ref (dumdesc);
+  dumdesc = build_fold_indirect_ref (dumdesc);
   gfc_start_block (&block);
 
   if (sym->ts.type == BT_CHARACTER
@@ -3707,7 +3707,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
       stmt = gfc_finish_block (&cleanup);
        
       /* Only do the cleanup if the array was repacked.  */
-      tmp = gfc_build_indirect_ref (dumdesc);
+      tmp = build_fold_indirect_ref (dumdesc);
       tmp = gfc_conv_descriptor_data_get (tmp);
       tmp = build2 (NE_EXPR, boolean_type_node, tmp, tmpdesc);
       stmt = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
@@ -3961,7 +3961,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
       if (expr->ts.type == BT_CHARACTER)
        {
          gfc_conv_expr (&rse, expr);
-         rse.expr = gfc_build_indirect_ref (rse.expr);
+         rse.expr = build_fold_indirect_ref (rse.expr);
        }
       else
         gfc_conv_expr_val (&rse, expr);
@@ -4119,7 +4119,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
 
       /* Point the data pointer at the first element in the section.  */
       tmp = gfc_conv_array_data (desc);
-      tmp = gfc_build_indirect_ref (tmp);
+      tmp = build_fold_indirect_ref (tmp);
       tmp = gfc_build_array_ref (tmp, offset);
       offset = gfc_build_addr_expr (gfc_array_dataptr_type (desc), tmp);
       gfc_conv_descriptor_data_set (&loop.pre, parm, offset);
@@ -4228,7 +4228,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77)
       gfc_init_block (&block);
       /* Only if it was repacked.  This code needs to be executed before the
          loop cleanup code.  */
-      tmp = gfc_build_indirect_ref (desc);
+      tmp = build_fold_indirect_ref (desc);
       tmp = gfc_conv_array_data (tmp);
       tmp = build2 (NE_EXPR, boolean_type_node, ptr, tmp);
       tmp = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt ());
index ea127d0..53d9225 100644 (file)
@@ -368,7 +368,7 @@ gfc_finish_cray_pointee (tree decl, gfc_symbol *sym)
 
   /* Parameters need to be dereferenced.  */
   if (sym->cp_pointer->attr.dummy) 
-    ptr_decl = gfc_build_indirect_ref (ptr_decl);
+    ptr_decl = build_fold_indirect_ref (ptr_decl);
 
   /* Check to see if we're dealing with a variable-sized array.  */
   if (sym->attr.dimension
@@ -382,7 +382,7 @@ gfc_finish_cray_pointee (tree decl, gfc_symbol *sym)
     {
       ptr_decl = convert (build_pointer_type (TREE_TYPE (decl)),
                          ptr_decl);
-      value = gfc_build_indirect_ref (ptr_decl);
+      value = build_fold_indirect_ref (ptr_decl);
     }
 
   SET_DECL_VALUE_EXPR (decl, value);
@@ -856,7 +856,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
          if (sym->attr.pointer && sym->attr.dummy
                && sym->attr.dimension)
            {
-             tmp = gfc_build_indirect_ref (sym->backend_decl);
+             tmp = build_fold_indirect_ref (sym->backend_decl);
              etype = gfc_get_element_type (TREE_TYPE (tmp));
              if (TYPE_SIZE_UNIT (etype) == NULL_TREE)
                {
index 7d233d5..bbda894 100644 (file)
@@ -232,7 +232,7 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind)
       if (TYPE_STRING_FLAG (TREE_TYPE (se->expr)))
        tmp = se->expr;
       else
-       tmp = gfc_build_indirect_ref (se->expr);
+       tmp = build_fold_indirect_ref (se->expr);
       tmp = gfc_build_array_ref (tmp, start.expr);
       se->expr = gfc_build_addr_expr (type, tmp);
     }
@@ -284,7 +284,7 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref)
     }
 
   if (c->pointer && c->dimension == 0 && c->ts.type != BT_CHARACTER)
-    se->expr = gfc_build_indirect_ref (se->expr);
+    se->expr = build_fold_indirect_ref (se->expr);
 }
 
 
@@ -372,19 +372,19 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr)
              && (sym->attr.dummy
                  || sym->attr.function
                  || sym->attr.result))
-           se->expr = gfc_build_indirect_ref (se->expr);
+           se->expr = build_fold_indirect_ref (se->expr);
        }
       else
        {
           /* Dereference non-character scalar dummy arguments.  */
          if (sym->attr.dummy && !sym->attr.dimension)
-           se->expr = gfc_build_indirect_ref (se->expr);
+           se->expr = build_fold_indirect_ref (se->expr);
 
           /* Dereference scalar hidden result.  */
          if (gfc_option.flag_f2c && sym->ts.type == BT_COMPLEX
              && (sym->attr.function || sym->attr.result)
              && !sym->attr.dimension && !sym->attr.pointer)
-           se->expr = gfc_build_indirect_ref (se->expr);
+           se->expr = build_fold_indirect_ref (se->expr);
 
           /* Dereference non-character pointer variables. 
             These must be dummies, results, or scalars.  */
@@ -393,7 +393,7 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr)
                  || sym->attr.function
                  || sym->attr.result
                  || !sym->attr.dimension))
-           se->expr = gfc_build_indirect_ref (se->expr);
+           se->expr = build_fold_indirect_ref (se->expr);
        }
 
       ref = expr->ref;
@@ -1291,12 +1291,12 @@ gfc_add_interface_mapping (gfc_interface_mapping * mapping,
 
       value = fold_convert (tmp, se->expr);
       if (sym->attr.pointer)
-       value = gfc_build_indirect_ref (value);
+       value = build_fold_indirect_ref (value);
     }
 
   /* If the argument is a scalar or a pointer to an array, dereference it.  */
   else if (!sym->attr.dimension || sym->attr.pointer)
-    value = gfc_build_indirect_ref (se->expr);
+    value = build_fold_indirect_ref (se->expr);
 
   /* If the argument is an array descriptor, use it to determine
      information about the actual argument's shape.  */
@@ -1304,7 +1304,7 @@ gfc_add_interface_mapping (gfc_interface_mapping * mapping,
           && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (TREE_TYPE (se->expr))))
     {
       /* Get the actual argument's descriptor.  */
-      desc = gfc_build_indirect_ref (se->expr);
+      desc = build_fold_indirect_ref (se->expr);
 
       /* Create the replacement variable.  */
       tmp = gfc_conv_descriptor_data_get (desc);
@@ -1748,7 +1748,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
         x = f()
      where f is pointer valued, we have to dereference the result.  */
   if (!se->want_pointer && !byref && sym->attr.pointer)
-    se->expr = gfc_build_indirect_ref (se->expr);
+    se->expr = build_fold_indirect_ref (se->expr);
 
   /* f2c calling conventions require a scalar default real function to
      return a double precision result.  Convert this back to default
@@ -1793,7 +1793,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
            {
              /* Dereference for character pointer results.  */
              if (sym->attr.pointer || sym->attr.allocatable)
-               se->expr = gfc_build_indirect_ref (var);
+               se->expr = build_fold_indirect_ref (var);
              else
                se->expr = var;
 
@@ -1802,7 +1802,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
          else
            {
              gcc_assert (sym->ts.type == BT_COMPLEX && gfc_option.flag_f2c);
-             se->expr = gfc_build_indirect_ref (var);
+             se->expr = build_fold_indirect_ref (var);
            }
        }
     }
index 7beed1a..9be6448 100644 (file)
@@ -2177,7 +2177,7 @@ gfc_conv_intrinsic_ichar (gfc_se * se, gfc_expr * expr)
   arg = build1 (NOP_EXPR, pchar_type_node, arg);
   type = gfc_typenode_for_spec (&expr->ts);
 
-  se->expr = gfc_build_indirect_ref (arg);
+  se->expr = build_fold_indirect_ref (arg);
   se->expr = convert (type, se->expr);
 }
 
@@ -2341,7 +2341,7 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
     }
   else
     {
-      se->expr = gfc_build_indirect_ref (ptr);
+      se->expr = build_fold_indirect_ref (ptr);
     }
 }
 
index 6b3ef8e..82aa5ba 100644 (file)
@@ -1164,7 +1164,7 @@ nml_get_addr_expr (gfc_symbol * sym, gfc_component * c,
 
   dummy_arg_flagged = POINTER_TYPE_P (TREE_TYPE(tmp));
 
-  itmp = (dummy_arg_flagged) ? gfc_build_indirect_ref (tmp) : tmp;
+  itmp = (dummy_arg_flagged) ? build_fold_indirect_ref (tmp) : tmp;
 
   /* If an array, set flag and use indirect ref. if built.  */
 
@@ -1196,7 +1196,7 @@ nml_get_addr_expr (gfc_symbol * sym, gfc_component * c,
   /* If scalar dummy, resolve indirect reference now.  */
 
   if (dummy_arg_flagged && !array_flagged)
-    tmp = gfc_build_indirect_ref (tmp);
+    tmp = build_fold_indirect_ref (tmp);
 
   gcc_assert (tmp && POINTER_TYPE_P (TREE_TYPE (tmp)));
 
@@ -1322,7 +1322,7 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
 
       /* Provide the RECORD_TYPE to build component references.  */
 
-      tree expr = gfc_build_indirect_ref (addr_expr);
+      tree expr = build_fold_indirect_ref (addr_expr);
 
       for (cmp = ts->derived->components; cmp; cmp = cmp->next)
        {
@@ -1692,7 +1692,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr)
        arg2 = se->string_length;
       else
        {
-         tmp = gfc_build_indirect_ref (addr_expr);
+         tmp = build_fold_indirect_ref (addr_expr);
          gcc_assert (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE);
          arg2 = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp)));
        }
@@ -1702,7 +1702,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr)
     case BT_DERIVED:
       /* Recurse into the elements of the derived type.  */
       expr = gfc_evaluate_now (addr_expr, &se->pre);
-      expr = gfc_build_indirect_ref (expr);
+      expr = build_fold_indirect_ref (expr);
 
       for (c = ts->derived->components; c; c = c->next)
        {
index fbaa1a5..1fea1dc 100644 (file)
@@ -1471,7 +1471,7 @@ gfc_trans_nested_forall_loop (forall_info * nested_forall_info, tree body,
                 {
                   /* If a mask was specified make the assignment conditional.  */
                   if (pmask)
-                   tmp = gfc_build_indirect_ref (mask);
+                   tmp = build_fold_indirect_ref (mask);
                   else
                     tmp = mask;
                   tmp = gfc_build_array_ref (tmp, maskindex);
@@ -1890,7 +1890,7 @@ allocate_temp_for_forall_nest_1 (tree type, tree size, stmtblock_t * block,
   temp1 = gfc_do_allocate (bytesize, size, ptemp1, block, type);
 
   if (*ptemp1)
-    tmp = gfc_build_indirect_ref (temp1);
+    tmp = build_fold_indirect_ref (temp1);
   else
     tmp = temp1;
 
@@ -2404,7 +2404,7 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info)
       se.expr = convert (smallest_boolean_type_node, se.expr);
 
       if (pmask)
-       tmp = gfc_build_indirect_ref (mask);
+       tmp = build_fold_indirect_ref (mask);
       else
        tmp = mask;
       tmp = gfc_build_array_ref (tmp, maskindex);
index 5f7c860..50a78fc 100644 (file)
@@ -282,22 +282,6 @@ gfc_build_addr_expr (tree type, tree t)
 }
 
 
-/* Build an INDIRECT_REF with its natural type.  */
-
-tree
-gfc_build_indirect_ref (tree t)
-{
-  tree type = TREE_TYPE (t);
-  gcc_assert (POINTER_TYPE_P (type));
-  type = TREE_TYPE (type);
-
-  if (TREE_CODE (t) == ADDR_EXPR)
-    return TREE_OPERAND (t, 0);
-  else
-    return build1 (INDIRECT_REF, type, t);
-}
-
-
 /* Build an ARRAY_REF with its natural type.  */
 
 tree
index e2c9f27..9f789ae 100644 (file)
@@ -351,9 +351,6 @@ tree gfc_build_function_call (tree, tree);
 /* Build an ADDR_EXPR.  */
 tree gfc_build_addr_expr (tree, tree);
 
-/* Build an INDIRECT_REF.  */
-tree gfc_build_indirect_ref (tree);
-
 /* Build an ARRAY_REF.  */
 tree gfc_build_array_ref (tree, tree);