X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fadt%2Fpset.h;h=4ffc69be3697eca73504b72766a6491a0ebea164;hb=0decb677fb069c9d47f5285f12fdb983dca7fdae;hp=4b95fe881c401af33f76bd38a6ff79ee5552e73e;hpb=63eda4e17ebee2a6ab7520d0559ddac0223607d7;p=libfirm diff --git a/ir/adt/pset.h b/ir/adt/pset.h index 4b95fe881..4ffc69be3 100644 --- a/ir/adt/pset.h +++ b/ir/adt/pset.h @@ -30,7 +30,7 @@ int pset_default_ptr_cmp(const void *x, const void *y); * The abstract type of a pset (Set of pointers). * * This kind of sets stores only pointer to elements, the elements itself - * must be stored somewere else. + * must be stored somewhere else. * * @see set */ @@ -45,8 +45,6 @@ typedef struct pset pset; #define pset_find_ptr(set,key) pset_find(set, key, HASH_PTR(key)) #define pset_new_ptr(slots) new_pset(pset_default_ptr_cmp, slots) #define pset_new_ptr_default() pset_new_ptr(64) -void pset_insert_pset_ptr(pset *target, pset *src); /* Inserts all elements of src in target. */ - /** The entry of a pset, representing an element pointer in the set and it's meta-information */ typedef struct { @@ -151,6 +149,7 @@ pset_entry *pset_hinsert (pset *pset, const void *key, unsigned hash); * * @remark * The current implementation did not allow to remove non-existing elements. + * @@@ so, does it do now? * Further, it is allowed to remove elements during an iteration * including the current one. */ @@ -184,6 +183,23 @@ void *pset_next (pset *pset); */ void pset_break (pset *pset); +/** + * Iterates oven an pset. + * + * @param pset the pset + * @param entry the iterator + */ +#define foreach_pset(pset, entry) for (entry = pset_first(pset); entry; entry = pset_next(pset)) + +/** + * Inserts all elements of the pointer set src into + * the set target (union). + * + * @param target the target set, will contain the union + * @param src a set, will not be changed + */ +void pset_insert_pset_ptr(pset *target, pset *src); + #define new_pset(cmp, slots) (PSET_TRACE (new_pset) ((cmp), (slots))) #define pset_find(pset, key, hash) \ _pset_search ((pset), (key), (hash), _pset_find)