2 * Some convenience macros for node bitmaps.
3 * @author Sebastian Hack
7 #ifndef __FIRM_IRBITSET_H
8 #define __FIRM_IRBITSET_H
12 #define bitset_irg_malloc(irg) bitset_malloc(get_irg_last_idx(irg))
13 #define bitset_irg_alloca(irg) bitset_alloca(get_irg_last_idx(irg))
14 #define bitset_irg_obstack_alloc(obst, irg) bitset_obstack_alloc(obst, get_irg_last_idx(irg))
15 #define bitset_add_irn(bs, irn) bitset_set((bs), get_irn_idx(irn))
16 #define bitset_remv_irn(bs, irn) bitset_clear((bs), get_irn_idx(irn))
17 #define bitset_contains_irn(bs, irn) bitset_is_set((bs), get_irn_idx(irn))
21 #define _bsfe_get_irn(irg, elm) (elm == -1 ? NULL : get_idx_irn((irg), (unsigned) elm))
24 * Iterate over a bitset containing node indexes.
25 * @param irg The graph the nodes are in.
26 * @param bs The bitset containing the indexes.
27 * @param elm A loop variable for the bitset (must be of type bitset_pos_t).
28 * @param irn An ir_node * which is set to the current node.
30 #define bitset_foreach_irn(irg, bs, elm, irn) \
31 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))
34 #endif /* __FIRM_IRBITSET_H */