diff options
Diffstat (limited to 'gcc/tree-iterator.h')
-rw-r--r-- | gcc/tree-iterator.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/gcc/tree-iterator.h b/gcc/tree-iterator.h index 98f0cf8..5b8113a 100644 --- a/gcc/tree-iterator.h +++ b/gcc/tree-iterator.h @@ -34,6 +34,11 @@ typedef struct { tree container; } tree_stmt_iterator; +typedef struct { + struct tree_statement_list_node *ptr; + const_tree container; +} const_tree_stmt_iterator; + static inline tree_stmt_iterator tsi_start (tree t) { @@ -45,6 +50,17 @@ tsi_start (tree t) return i; } +static inline const_tree_stmt_iterator +ctsi_start (const_tree t) +{ + const_tree_stmt_iterator i; + + i.ptr = STATEMENT_LIST_HEAD (t); + i.container = t; + + return i; +} + static inline tree_stmt_iterator tsi_last (tree t) { @@ -56,6 +72,17 @@ tsi_last (tree t) return i; } +static inline const_tree_stmt_iterator +ctsi_last (tree t) +{ + const_tree_stmt_iterator i; + + i.ptr = STATEMENT_LIST_TAIL (t); + i.container = t; + + return i; +} + static inline bool tsi_end_p (tree_stmt_iterator i) { @@ -63,11 +90,23 @@ tsi_end_p (tree_stmt_iterator i) } static inline bool +ctsi_end_p (const_tree_stmt_iterator i) +{ + return i.ptr == NULL; +} + +static inline bool tsi_one_before_end_p (tree_stmt_iterator i) { return i.ptr != NULL && i.ptr->next == NULL; } +static inline bool +ctsi_one_before_end_p (const_tree_stmt_iterator i) +{ + return i.ptr != NULL && i.ptr->next == NULL; +} + static inline void tsi_next (tree_stmt_iterator *i) { @@ -75,11 +114,23 @@ tsi_next (tree_stmt_iterator *i) } static inline void +ctsi_next (const_tree_stmt_iterator *i) +{ + i->ptr = i->ptr->next; +} + +static inline void tsi_prev (tree_stmt_iterator *i) { i->ptr = i->ptr->prev; } +static inline void +ctsi_prev (const_tree_stmt_iterator *i) +{ + i->ptr = i->ptr->prev; +} + static inline tree * tsi_stmt_ptr (tree_stmt_iterator i) { @@ -92,6 +143,12 @@ tsi_stmt (tree_stmt_iterator i) return i.ptr->stmt; } +static inline const_tree +ctsi_stmt (const_tree_stmt_iterator i) +{ + return i.ptr->stmt; +} + enum tsi_iterator_update { TSI_NEW_STMT, /* Only valid when single statement is added, move |