diff options
Diffstat (limited to 'gcc/tree-flow.h')
-rw-r--r-- | gcc/tree-flow.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 2bf40df..da49ed1 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -389,11 +389,35 @@ typedef struct } referenced_var_iterator; +/* This macro loops over all the referenced vars, one at a time, putting the + current var in VAR. Note: You are not allowed to add referenced variables + to the hashtable while using this macro. Doing so may cause it to behave + erratically. */ + #define FOR_EACH_REFERENCED_VAR(VAR, ITER) \ for ((VAR) = first_referenced_var (&(ITER)); \ !end_referenced_vars_p (&(ITER)); \ (VAR) = next_referenced_var (&(ITER))) + +typedef struct +{ + int i; +} safe_referenced_var_iterator; + +/* This macro loops over all the referenced vars, one at a time, putting the + current var in VAR. You are allowed to add referenced variables during the + execution of this macro, however, the macro will not iterate over them. It + requires a temporary vector of trees, VEC, whose lifetime is controlled by + the caller. The purpose of the vector is to temporarily store the + referenced_variables hashtable so that adding referenced variables does not + affect the hashtable. */ + +#define FOR_EACH_REFERENCED_VAR_SAFE(VAR, VEC, ITER) \ + for ((ITER).i = 0, fill_referenced_var_vec (&(VEC)); \ + VEC_iterate (tree, (VEC), (ITER).i, (VAR)); \ + (ITER).i++) + /* Array of all variables referenced in the function. */ extern GTY((param_is (struct int_tree_map))) htab_t referenced_vars; |