OSDN Git Service

2010-09-02 Ryan Mansfield <rmansfield@qnx.com>
[pf3gnuchains/gcc-fork.git] / gcc / tree-browser.c
index 5458e28..3803a50 100644 (file)
@@ -1,5 +1,6 @@
 /* Tree browser.
-   Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2007, 2008, 2010
+   Free Software Foundation, Inc.
    Contributed by Sebastian Pop <s.pop@laposte.net>
 
 This file is part of GCC.
@@ -24,7 +25,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm.h"
 #include "tree.h"
 #include "tree-inline.h"
-#include "diagnostic.h"
+#include "tree-pretty-print.h"
 #include "hashtab.h"
 
 
@@ -71,11 +72,14 @@ struct tb_tree_code {
 };
 
 #define DEFTREECODE(SYM, STRING, TYPE, NARGS) { SYM, STRING, sizeof (STRING) - 1 },
+#define END_OF_BASE_TREE_CODES \
+  { LAST_AND_UNUSED_TREE_CODE, "@dummy", sizeof ("@dummy") - 1 },
 static const struct tb_tree_code tb_tree_codes[] =
 {
-#include "tree.def"
+#include "all-tree.def"
 };
 #undef DEFTREECODE
+#undef END_OF_BASE_TREE_CODES
 
 #define TB_TREE_CODE(N) (tb_tree_codes[N].code)
 #define TB_TREE_CODE_TEXT(N) (tb_tree_codes[N].code_string)
@@ -104,7 +108,7 @@ void browse_tree (tree);
 
 /* Static variables.  */
 static htab_t TB_up_ht;
-static tree TB_history_stack = NULL_TREE;
+static VEC(tree,gc) *TB_history_stack;
 static int TB_verbose = 1;
 
 
@@ -122,7 +126,7 @@ browse_tree (tree begin)
   fprintf (TB_OUT_FILE, "\nTree Browser\n");
 
 #define TB_SET_HEAD(N) do {                                           \
-  TB_history_stack = tree_cons (NULL_TREE, (N), TB_history_stack);    \
+  VEC_safe_push (tree, gc, TB_history_stack, N);                      \
   head = N;                                                           \
   if (TB_verbose)                                                     \
     if (head)                                                         \
@@ -162,7 +166,8 @@ browse_tree (tree begin)
 
        case TB_MAX:
          if (head && (INTEGRAL_TYPE_P (head)
-                      || TREE_CODE (head) == REAL_TYPE))
+                      || TREE_CODE (head) == REAL_TYPE
+                      || TREE_CODE (head) == FIXED_POINT_TYPE))
            TB_SET_HEAD (TYPE_MAX_VALUE (head));
          else
            TB_WF;
@@ -170,7 +175,8 @@ browse_tree (tree begin)
 
        case TB_MIN:
          if (head && (INTEGRAL_TYPE_P (head)
-                      || TREE_CODE (head) == REAL_TYPE))
+                      || TREE_CODE (head) == REAL_TYPE
+                      || TREE_CODE (head) == FIXED_POINT_TYPE))
            TB_SET_HEAD (TYPE_MIN_VALUE (head));
          else
            TB_WF;
@@ -870,11 +876,11 @@ find_node_with_code (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
 static tree
 TB_history_prev (void)
 {
-  if (TB_history_stack)
+  if (!VEC_empty (tree, TB_history_stack))
     {
-      TB_history_stack = TREE_CHAIN (TB_history_stack);
-      if (TB_history_stack)
-       return TREE_VALUE (TB_history_stack);
+      tree last = VEC_last (tree, TB_history_stack);
+      VEC_pop (tree, TB_history_stack);
+      return last;
     }
   return NULL_TREE;
 }