entered into RCS
authorRichard Stallman <rms@gnu.org>
Tue, 2 Mar 1993 04:21:48 +0000 (04:21 +0000)
committerRichard Stallman <rms@gnu.org>
Tue, 2 Mar 1993 04:21:48 +0000 (04:21 +0000)
From-SVN: r3586

gcc/c-iterate.c

index 69fa12cc0e555c87219c037f71ea910e0cb308af..04d4b7073ff79c7220f6a59e72d2963c42927295 100644 (file)
@@ -128,44 +128,6 @@ iterator_for_loop_end (idecl)
   ITERATOR_BOUND_P (idecl) = 0;
 }
 \f
-/*
-               ITERATOR DECLS
-
-Iterators are  implemented  as integer decls  with a special  flag set
-(rms's   idea).  This  makes  eliminates  the need   for  special type
-checking.  The  flag  is accesed using   the  ITERATOR_P  macro.  Each
-iterator's limit is saved as a  decl with a special  name. The decl is
-initialized with the limit value -- this way we  get all the necessary
-semantical processing for free by calling finish  decl. We might still
-eliminate  that decl  later  -- it takes up  time and  space and, more
-importantly, produces strange error  messages when  something is wrong
-with the initializing expresison.  */
-
-tree
-build_iterator_decl (id, limit)
-    tree id, limit;
-{
-  tree type = integer_type_node, lim_decl;
-  tree t1, t2, t3;
-  tree start_node, limit_node, step_node;
-  tree decl;
-    
-  if (limit)
-    {
-      limit_node = save_expr (limit);
-      SAVE_EXPR_CONTEXT (limit_node) = current_function_decl;
-    }
-  else
-    abort ();
-  lim_decl = build_limit_decl (id, limit_node);
-  push_obstacks_nochange ();
-  decl = build_decl (VAR_DECL, id, type);
-  ITERATOR_P (decl) = 1;
-  ITERATOR_LIMIT (decl) = lim_decl;
-  finish_decl (pushdecl (decl), 0, 0);
-  return decl;
-}
-\f
 /*
                ITERATOR RTL EXPANSIONS
 
@@ -247,7 +209,7 @@ collect_iterators (exp, list)
       return list;
 
     default:
-      switch (TREE_CODE_CLASS (code))
+      switch (TREE_CODE_CLASS (TREE_CODE (exp)))
        {
        case '1':
        case '2':
@@ -255,13 +217,15 @@ collect_iterators (exp, list)
        case 'e':
        case 'r':
          {
-           int num_args = tree_code_length[code];
+           int num_args = tree_code_length[TREE_CODE (exp)];
            int i;
-           the_list = (tree) 0;
+
            for (i = 0; i < num_args; i++)
              list = collect_iterators (TREE_OPERAND (exp, i), list);
            return list;
          }
+       default:
+         return list;
        }
     }
 }
@@ -289,7 +253,8 @@ iterator_loop_prologue (idecl, start_note, end_note)
   if (start_note)
     *start_note = emit_note (0, NOTE_INSN_DELETED);
   /* Initialize counter.  */
-  expand_expr (build_modify_expr (idecl, NOP_EXPR, integer_zero_node),
+  expand_expr (build (MODIFY_EXPR, TREE_TYPE (idecl),
+                     idecl, integer_zero_node),
               0, VOIDmode, 0);
 
   expand_start_loop_continue_elsewhere (1);
@@ -329,7 +294,8 @@ iterator_loop_epilogue (idecl, start_note, end_note)
     *start_note = emit_note (0, NOTE_INSN_DELETED);
   expand_loop_continue_here ();
   incr = build_binary_op (PLUS_EXPR, idecl, integer_one_node, 0);
-  expand_expr (build_modify_expr (idecl, NOP_EXPR, incr));
+  expand_expr (build (MODIFY_EXPR, TREE_TYPE (idecl), idecl, incr),
+              0, VOIDmode, 0);
   test = build_binary_op (LT_EXPR, idecl, DECL_INITIAL (idecl), 0);
   expand_exit_loop_if_false (0, test);
   expand_end_loop ();
@@ -475,7 +441,7 @@ delete_ixpansion (idecl)
 
        if (ix->ixprologue_start == 0)
          error_with_decl (idecl,
-                          "`for (%s)' appears within implicit iteration")
+                          "`for (%s)' appears within implicit iteration");
        else
          {
            rtx insn;