diff options
Diffstat (limited to 'gcc/ipa-pure-const.c')
-rw-r--r-- | gcc/ipa-pure-const.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 5cf974b7b37..341501ea172 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -107,9 +107,7 @@ typedef struct funct_state_d * funct_state; /* Array, indexed by cgraph node uid, of function states. */ -DEF_VEC_P (funct_state); -DEF_VEC_ALLOC_P (funct_state, heap); -static VEC (funct_state, heap) *funct_state_vec; +static vec<funct_state> funct_state_vec; /* Holders of ipa cgraph hooks: */ static struct cgraph_node_hook_list *function_insertion_hook_holder; @@ -198,7 +196,7 @@ warn_function_noreturn (tree decl) static void finish_state (void) { - free (funct_state_vec); + funct_state_vec.release (); } @@ -207,10 +205,10 @@ finish_state (void) static inline bool has_function_state (struct cgraph_node *node) { - if (!funct_state_vec - || VEC_length (funct_state, funct_state_vec) <= (unsigned int)node->uid) + if (!funct_state_vec.exists () + || funct_state_vec.length () <= (unsigned int)node->uid) return false; - return VEC_index (funct_state, funct_state_vec, node->uid) != NULL; + return funct_state_vec[node->uid] != NULL; } /* Return the function state from NODE. */ @@ -218,12 +216,12 @@ has_function_state (struct cgraph_node *node) static inline funct_state get_function_state (struct cgraph_node *node) { - if (!funct_state_vec - || VEC_length (funct_state, funct_state_vec) <= (unsigned int)node->uid - || !VEC_index (funct_state, funct_state_vec, node->uid)) + if (!funct_state_vec.exists () + || funct_state_vec.length () <= (unsigned int)node->uid + || !funct_state_vec[node->uid]) /* We might want to put correct previously_known state into varying. */ return &varying_state; - return VEC_index (funct_state, funct_state_vec, node->uid); + return funct_state_vec[node->uid]; } /* Set the function state S for NODE. */ @@ -231,10 +229,10 @@ get_function_state (struct cgraph_node *node) static inline void set_function_state (struct cgraph_node *node, funct_state s) { - if (!funct_state_vec - || VEC_length (funct_state, funct_state_vec) <= (unsigned int)node->uid) - VEC_safe_grow_cleared (funct_state, heap, funct_state_vec, node->uid + 1); - VEC_replace (funct_state, funct_state_vec, node->uid, s); + if (!funct_state_vec.exists () + || funct_state_vec.length () <= (unsigned int)node->uid) + funct_state_vec.safe_grow_cleared (node->uid + 1); + funct_state_vec[node->uid] = s; } /* Check to see if the use (or definition when CHECKING_WRITE is true) @@ -1482,7 +1480,7 @@ propagate (void) FOR_EACH_DEFINED_FUNCTION (node) if (has_function_state (node)) free (get_function_state (node)); - VEC_free (funct_state, heap, funct_state_vec); + funct_state_vec.release (); finish_state (); return 0; } |