Fixed a typo
[libfirm] / ir / ir / irbitset.h
1 /**
2  * Some convenience macros for node bitmaps.
3  * @author Sebastian Hack
4  * @date   10.05.2006
5  */
6
7 #ifndef __FIRM_IRBITSET_H
8 #define __FIRM_IRBITSET_H
9
10 #include "bitset.h"
11
12 #define bitset_irg_malloc(irg)                bitset_malloc(get_irg_last_idx(irg))
13 #define bitset_irg_obstack_alloc(obst, irg)   bitset_obstack_alloc(obst, get_irg_last_idx(irg))
14 #define bitset_add_irn(bs, irn)               bitset_set((bs), get_irn_idx(irn))
15 #define bitset_remv_irn(bs, irn)              bitset_clear((bs), get_irn_idx(irn))
16 #define bitset_contains_irn(bs, irn)          bitset_is_set((bs), get_irn_idx(irn))
17
18
19 /* Internal use. */
20 #define _bsfe_get_irn(irg, elm) (elm == -1 ? NULL : get_idx_irn((irg), (unsigned) elm))
21
22 /**
23  * Iterate over a bitset containing node indexes.
24  * @param irg The graph the nodes are in.
25  * @param bs  The bitset containing the indexes.
26  * @param elm A loop variable for the bitset (must be of type bitset_pos_t).
27  * @param irn An ir_node * which is set to the current node.
28  */
29 #define bitset_foreach_irn(irg, bs, elm, irn) \
30         for(elm = bitset_next_set(bs, 0), irn = _bsfe_get_irn(irg, elm); elm != -1; elm = bitset_next_set(bs, elm + 1), irn = _bsfe_get_irn(irg, elm))
31
32
33 #endif /* __FIRM_IRBITSET_H */