00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef GCC_TREE_ITERATOR_H
00029 #define GCC_TREE_ITERATOR_H 1
00030
00031
00032
00033 typedef struct {
00034 struct tree_statement_list_node *ptr;
00035 tree container;
00036 } tree_stmt_iterator;
00037
00038 static inline tree_stmt_iterator
00039 tsi_start (tree t)
00040 {
00041 tree_stmt_iterator i;
00042
00043 i.ptr = STATEMENT_LIST_HEAD (t);
00044 i.container = t;
00045
00046 return i;
00047 }
00048
00049 static inline tree_stmt_iterator
00050 tsi_last (tree t)
00051 {
00052 tree_stmt_iterator i;
00053
00054 i.ptr = STATEMENT_LIST_TAIL (t);
00055 i.container = t;
00056
00057 return i;
00058 }
00059
00060 static inline bool
00061 tsi_end_p (tree_stmt_iterator i)
00062 {
00063 return i.ptr == NULL;
00064 }
00065
00066 static inline bool
00067 tsi_one_before_end_p (tree_stmt_iterator i)
00068 {
00069 return i.ptr != NULL && i.ptr->next == NULL;
00070 }
00071
00072 static inline void
00073 tsi_next (tree_stmt_iterator *i)
00074 {
00075 i->ptr = i->ptr->next;
00076 }
00077
00078 static inline void
00079 tsi_prev (tree_stmt_iterator *i)
00080 {
00081 i->ptr = i->ptr->prev;
00082 }
00083
00084 static inline tree *
00085 tsi_stmt_ptr (tree_stmt_iterator i)
00086 {
00087 return &i.ptr->stmt;
00088 }
00089
00090 static inline tree
00091 tsi_stmt (tree_stmt_iterator i)
00092 {
00093 return i.ptr->stmt;
00094 }
00095
00096 enum tsi_iterator_update
00097 {
00098 TSI_NEW_STMT,
00099
00100 TSI_SAME_STMT,
00101 TSI_CHAIN_START,
00102
00103 TSI_CHAIN_END,
00104
00105 TSI_CONTINUE_LINKING
00106
00107
00108 };
00109
00110 extern void tsi_link_before (tree_stmt_iterator *, tree,
00111 enum tsi_iterator_update);
00112 extern void tsi_link_after (tree_stmt_iterator *, tree,
00113 enum tsi_iterator_update);
00114
00115 void tsi_delink (tree_stmt_iterator *);
00116
00117 tree tsi_split_statement_list_after (const tree_stmt_iterator *);
00118 tree tsi_split_statement_list_before (tree_stmt_iterator *);
00119
00120 void append_to_statement_list (tree, tree *);
00121 void append_to_statement_list_force (tree, tree *);
00122
00123 #endif