diff options
Diffstat (limited to 'gcc/varray.h')
-rw-r--r-- | gcc/varray.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/gcc/varray.h b/gcc/varray.h index 2cc8fd6080c..b9f4d41ac74 100644 --- a/gcc/varray.h +++ b/gcc/varray.h @@ -83,6 +83,7 @@ enum varray_data_enum { VARRAY_DATA_BB, VARRAY_DATA_TE, VARRAY_DATA_EDGE, + VARRAY_DATA_DG, VARRAY_DATA_TREE_PTR, NUM_VARRAY_DATA }; @@ -133,6 +134,8 @@ typedef union varray_data_tag GTY (()) { tag ("VARRAY_DATA_TE"))) te[1]; struct edge_def *GTY ((length ("%0.num_elements"), tag ("VARRAY_DATA_EDGE"))) e[1]; + struct dependence_node_def *GTY ((length ("%0.num_elements"), + tag ("VARRAY_DATA_DG"))) dg[1]; tree *GTY ((length ("%0.num_elements"), skip (""), tag ("VARRAY_DATA_TREE_PTR"))) tp[1]; } varray_data; @@ -219,6 +222,9 @@ extern varray_type varray_init (size_t, enum varray_data_enum, const char *); #define VARRAY_EDGE_INIT(va, num, name) \ va = varray_init (num, VARRAY_DATA_EDGE, name) +#define VARRAY_DG_INIT(va, num, name) \ + va = varray_init (num, VARRAY_DATA_DG, name) + #define VARRAY_TREE_PTR_INIT(va, num, name) \ va = varray_init (num, VARRAY_DATA_TREE_PTR, name) @@ -304,6 +310,7 @@ extern void varray_underflow (varray_type, const char *, int, const char *) #define VARRAY_BB(VA, N) VARRAY_CHECK (VA, N, bb) #define VARRAY_ELT_LIST(VA, N) VARRAY_CHECK (VA, N, te) #define VARRAY_EDGE(VA, N) VARRAY_CHECK (VA, N, e) +#define VARRAY_DG(VA, N) VARRAY_CHECK (VA, N, dg) #define VARRAY_TREE_PTR(VA, N) VARRAY_CHECK (VA, N, tp) /* Push a new element on the end of VA, extending it if necessary. */ @@ -328,6 +335,7 @@ extern void varray_underflow (varray_type, const char *, int, const char *) #define VARRAY_PUSH_CONST_EQUIV(VA, X) VARRAY_PUSH (VA, const_equiv, X) #define VARRAY_PUSH_BB(VA, X) VARRAY_PUSH (VA, bb, X) #define VARRAY_PUSH_EDGE(VA, X) VARRAY_PUSH (VA, e, X) +#define VARRAY_PUSH_DG(VA, X) VARRAY_PUSH (VA, dg, X) #define VARRAY_PUSH_TREE_PTR(VA, X) VARRAY_PUSH (VA, tp, X) /* Return the last element of VA. */ @@ -356,4 +364,61 @@ extern void varray_underflow (varray_type, const char *, int, const char *) #define VARRAY_TOP_EDGE(VA) VARRAY_TOP (VA, e) #define VARRAY_TOP_TREE_PTR(VA) VARRAY_TOP (VA, tp) + + + +static inline int index_in_varray_tree (tree, varray_type); +static inline bool tree_is_in_varray_tree_p (tree, varray_type); + +static inline int index_in_varray_int (int, varray_type); +static inline bool int_is_in_varray_int_p (int, varray_type); + +/* Determines the index of T in the varray_tree VT. */ + +static inline int +index_in_varray_tree (tree t, + varray_type vt) +{ + unsigned int i; + + for (i = 0; i < VARRAY_ACTIVE_SIZE (vt); i++) + if (t == VARRAY_TREE (vt, i)) + return i; + + return -1; +} + +/* Determines whether T is in the varray_tree VT. */ + +static inline bool +tree_is_in_varray_tree_p (tree t, + varray_type vt) +{ + return index_in_varray_tree (t, vt) != -1; +} + +/* Determines the index of T in the varray_int VT. */ + +static inline int +index_in_varray_int (int t, + varray_type vt) +{ + unsigned int i; + + for (i = 0; i < VARRAY_ACTIVE_SIZE (vt); i++) + if (t == VARRAY_INT (vt, i)) + return i; + + return -1; +} + +/* Determines whether T is in the varray_int VT. */ + +static inline bool +int_is_in_varray_int_p (int t, + varray_type vt) +{ + return index_in_varray_int (t, vt) != -1; +} + #endif /* ! GCC_VARRAY_H */ |