OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / tree-iterator.c
index 1e7a682..d8c151a 100644 (file)
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tree.h"
-#include "tree-gimple.h"
+#include "gimple.h"
 #include "tree-iterator.h"
 #include "ggc.h"
 
@@ -89,7 +89,7 @@ tsi_link_before (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode)
     }
   else
     {
-      head = ggc_alloc (sizeof (*head));
+      head = GGC_NEW (struct tree_statement_list_node);
       head->prev = NULL;
       head->next = NULL;
       head->stmt = t;
@@ -165,7 +165,7 @@ tsi_link_after (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode)
     }
   else
     {
-      head = ggc_alloc (sizeof (*head));
+      head = GGC_NEW (struct tree_statement_list_node);
       head->prev = NULL;
       head->next = NULL;
       head->stmt = t;
@@ -299,29 +299,22 @@ tsi_split_statement_list_before (tree_stmt_iterator *i)
 /* Return the first expression in a sequence of COMPOUND_EXPRs,
    or in a STATEMENT_LIST.  */
 
-#define EXPR_FIRST_BODY do { \
-  if (expr == NULL_TREE) \
-    return expr; \
-  if (TREE_CODE (expr) == STATEMENT_LIST) \
-    { \
-      struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (expr); \
-      return n ? n->stmt : NULL_TREE; \
-    } \
-  while (TREE_CODE (expr) == COMPOUND_EXPR) \
-    expr = TREE_OPERAND (expr, 0); \
-  return expr; \
-} while (0)
-
 tree
 expr_first (tree expr)
 {
-  EXPR_FIRST_BODY;
-}
+  if (expr == NULL_TREE)
+    return expr;
 
-const_tree
-const_expr_first (const_tree expr)
-{
-  EXPR_FIRST_BODY;
+  if (TREE_CODE (expr) == STATEMENT_LIST)
+    {
+      struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (expr);
+      return n ? n->stmt : NULL_TREE;
+    }
+
+  while (TREE_CODE (expr) == COMPOUND_EXPR)
+    expr = TREE_OPERAND (expr, 0);
+
+  return expr;
 }
 
 /* Return the last expression in a sequence of COMPOUND_EXPRs,
@@ -343,45 +336,44 @@ const_expr_first (const_tree expr)
 tree
 expr_last (tree expr)
 {
-  EXPR_LAST_BODY;
-}
+  if (expr == NULL_TREE)
+    return expr;
 
-const_tree
-const_expr_last (const_tree expr)
-{
-  EXPR_LAST_BODY;
+  if (TREE_CODE (expr) == STATEMENT_LIST)
+    {
+      struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr);
+      return n ? n->stmt : NULL_TREE;
+    }
+
+  while (TREE_CODE (expr) == COMPOUND_EXPR)
+    expr = TREE_OPERAND (expr, 1);
+
+  return expr;
 }
 
 /* If EXPR is a single statement return it.  If EXPR is a
    STATEMENT_LIST containing exactly one statement S, return S.
    Otherwise, return NULL.  */
 
-#define EXPR_ONLY_BODY do { \
-  if (expr == NULL_TREE) \
-    return NULL_TREE; \
-  if (TREE_CODE (expr) == STATEMENT_LIST) \
-    { \
-      struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr); \
-      if (n && STATEMENT_LIST_HEAD (expr) == n) \
-       return n->stmt; \
-      else \
-       return NULL_TREE; \
-    } \
-  if (TREE_CODE (expr) == COMPOUND_EXPR) \
-    return NULL_TREE; \
-  return expr; \
-} while (0)
-
 tree 
 expr_only (tree expr)
 {
-  EXPR_ONLY_BODY;
-}
+  if (expr == NULL_TREE)
+    return NULL_TREE;
 
-const_tree 
-const_expr_only (const_tree expr)
-{
-  EXPR_ONLY_BODY;
+  if (TREE_CODE (expr) == STATEMENT_LIST)
+    {
+      struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr);
+      if (n && STATEMENT_LIST_HEAD (expr) == n)
+       return n->stmt;
+      else
+       return NULL_TREE;
+    }
+
+  if (TREE_CODE (expr) == COMPOUND_EXPR)
+    return NULL_TREE;
+
+  return expr;
 }
 
 #include "gt-tree-iterator.h"