OSDN Git Service

2004-08-10 H.J. Lu <hongjiu.lu@intel.com>
[pf3gnuchains/gcc-fork.git] / gcc / tree-iterator.c
index ebc477b..d13ea96 100644 (file)
@@ -40,14 +40,12 @@ alloc_stmt_list (void)
   if (list)
     {
       stmt_list_cache = TREE_CHAIN (list);
-      TREE_CHAIN (list) = NULL;
-      TREE_SIDE_EFFECTS (list) = 0;
+      memset (list, 0, sizeof(struct tree_common));
+      TREE_SET_CODE (list, STATEMENT_LIST);
     }
   else
-    {
-      list = make_node (STATEMENT_LIST);
-      TREE_TYPE (list) = void_type_node;
-    }
+    list = make_node (STATEMENT_LIST);
+  TREE_TYPE (list) = void_type_node;
   return list;
 }
 
@@ -73,8 +71,6 @@ tsi_link_before (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode)
   if (t == i->container)
     abort ();
 
-  TREE_SIDE_EFFECTS (i->container) = 1;
-
   if (TREE_CODE (t) == STATEMENT_LIST)
     {
       head = STATEMENT_LIST_HEAD (t);
@@ -101,6 +97,8 @@ tsi_link_before (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode)
       tail = head;
     }
 
+  TREE_SIDE_EFFECTS (i->container) = 1;
+
   cur = i->ptr;
 
   /* Link it into the list.  */
@@ -151,8 +149,6 @@ tsi_link_after (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode)
   if (t == i->container)
     abort ();
 
-  TREE_SIDE_EFFECTS (i->container) = 1;
-
   if (TREE_CODE (t) == STATEMENT_LIST)
     {
       head = STATEMENT_LIST_HEAD (t);
@@ -179,6 +175,8 @@ tsi_link_after (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode)
       tail = head;
     }
 
+  TREE_SIDE_EFFECTS (i->container) = 1;
+
   cur = i->ptr;
 
   /* Link it into the list.  */