2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * Some convenience macros for node bitmaps.
22 * @author Sebastian Hack
26 #ifndef __FIRM_IRBITSET_H
27 #define __FIRM_IRBITSET_H
31 #define bitset_irg_malloc(irg) bitset_malloc(get_irg_last_idx(irg))
32 #define bitset_irg_alloca(irg) bitset_alloca(get_irg_last_idx(irg))
33 #define bitset_irg_obstack_alloc(obst, irg) bitset_obstack_alloc(obst, get_irg_last_idx(irg))
34 #define bitset_add_irn(bs, irn) bitset_set((bs), get_irn_idx(irn))
35 #define bitset_remv_irn(bs, irn) bitset_clear((bs), get_irn_idx(irn))
36 #define bitset_contains_irn(bs, irn) bitset_is_set((bs), get_irn_idx(irn))
40 #define _bsfe_get_irn(irg, elm) (elm == -1 ? NULL : get_idx_irn((irg), (unsigned) elm))
43 * Iterate over a bitset containing node indexes.
44 * @param irg The graph the nodes are in.
45 * @param bs The bitset containing the indexes.
46 * @param elm A loop variable for the bitset (must be of type bitset_pos_t).
47 * @param irn An ir_node * which is set to the current node.
49 #define bitset_foreach_irn(irg, bs, elm, irn) \
50 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))
53 #endif /* __FIRM_IRBITSET_H */