Mercurial > hg > CbC > CbC_gcc
diff gcc/tree-iterator.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | f6334be47118 |
children | 84e7813d76e9 |
line wrap: on
line diff
--- a/gcc/tree-iterator.c Sun Aug 21 07:07:55 2011 +0900 +++ b/gcc/tree-iterator.c Fri Oct 27 22:46:09 2017 +0900 @@ -1,6 +1,5 @@ /* Iterator routines for manipulating GENERIC and GIMPLE tree statements. - Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 2003-2017 Free Software Foundation, Inc. Contributed by Andrew MacLeod <amacleod@redhat.com> This file is part of GCC. @@ -23,25 +22,22 @@ #include "system.h" #include "coretypes.h" #include "tree.h" -#include "gimple.h" #include "tree-iterator.h" -#include "ggc.h" /* This is a cache of STATEMENT_LIST nodes. We create and destroy them fairly often during gimplification. */ -static GTY ((deletable (""))) tree stmt_list_cache; +static GTY ((deletable (""))) vec<tree, va_gc> *stmt_list_cache; tree alloc_stmt_list (void) { - tree list = stmt_list_cache; - if (list) + tree list; + if (!vec_safe_is_empty (stmt_list_cache)) { - stmt_list_cache = TREE_CHAIN (list); - gcc_assert (stmt_list_cache != list); - memset (list, 0, sizeof(struct tree_common)); + list = stmt_list_cache->pop (); + memset (list, 0, sizeof (struct tree_base)); TREE_SET_CODE (list, STATEMENT_LIST); } else @@ -55,11 +51,7 @@ { gcc_assert (!STATEMENT_LIST_HEAD (t)); gcc_assert (!STATEMENT_LIST_TAIL (t)); - /* If this triggers, it's a sign that the same list is being freed - twice. */ - gcc_assert (t != stmt_list_cache || stmt_list_cache == NULL); - TREE_CHAIN (t) = stmt_list_cache; - stmt_list_cache = t; + vec_safe_push (stmt_list_cache, t); } /* A subroutine of append_to_statement_list{,_force}. T is not NULL. */ @@ -79,6 +71,13 @@ } *list_p = list = alloc_stmt_list (); } + else if (TREE_CODE (list) != STATEMENT_LIST) + { + tree first = list; + *list_p = list = alloc_stmt_list (); + i = tsi_last (list); + tsi_link_after (&i, first, TSI_CONTINUE_LINKING); + } i = tsi_last (list); tsi_link_after (&i, t, TSI_CONTINUE_LINKING); @@ -131,7 +130,7 @@ } else { - head = ggc_alloc_tree_statement_list_node (); + head = ggc_alloc<tree_statement_list_node> (); head->prev = NULL; head->next = NULL; head->stmt = t; @@ -207,7 +206,7 @@ } else { - head = ggc_alloc_tree_statement_list_node (); + head = ggc_alloc<tree_statement_list_node> (); head->prev = NULL; head->next = NULL; head->stmt = t;