From 2ebc2d3cd8d238348e733c38712dc037c2d27dd7 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Fri, 11 Nov 2011 13:13:05 +0100 Subject: [PATCH] remove irbitset.h --- ir/Makefile.am | 1 - ir/be/beabi.c | 1 - ir/be/bechordal.c | 1 - ir/be/bechordal_main.c | 1 - ir/be/becopyheur4.c | 17 +++++------- ir/be/becopyopt.c | 7 +++-- ir/be/beifg.c | 17 ++++++------ ir/be/belive.c | 5 ++-- ir/be/ia32/bearch_ia32.c | 1 - ir/be/ia32/ia32_optimize.c | 1 - ir/ir/irbitset.h | 53 -------------------------------------- 11 files changed, 20 insertions(+), 85 deletions(-) delete mode 100644 ir/ir/irbitset.h diff --git a/ir/Makefile.am b/ir/Makefile.am index f7079bf42..74b39c3fb 100644 --- a/ir/Makefile.am +++ b/ir/Makefile.am @@ -321,7 +321,6 @@ EXTRA_DIST = \ ident/ident_t.h \ ir/instrument.h \ ir/irargs_t.h \ - ir/irbitset.h \ ir/ircons_t.h \ ir/irdump_t.h \ ir/iredges_t.h \ diff --git a/ir/be/beabi.c b/ir/be/beabi.c index 31331df88..9683b4cfd 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -36,7 +36,6 @@ #include "irgwalk.h" #include "irprintf_t.h" #include "irgopt.h" -#include "irbitset.h" #include "iropt_t.h" #include "irtools.h" #include "heights.h" diff --git a/ir/be/bechordal.c b/ir/be/bechordal.c index ce8ccbdce..ae5f29e4c 100644 --- a/ir/be/bechordal.c +++ b/ir/be/bechordal.c @@ -43,7 +43,6 @@ #include "irdump.h" #include "irdom.h" #include "irtools.h" -#include "irbitset.h" #include "debug.h" #include "iredges.h" diff --git a/ir/be/bechordal_main.c b/ir/be/bechordal_main.c index 8cad1f945..6bf0e7bc7 100644 --- a/ir/be/bechordal_main.c +++ b/ir/be/bechordal_main.c @@ -46,7 +46,6 @@ #include "irdump.h" #include "irdom.h" #include "ircons.h" -#include "irbitset.h" #include "irnode.h" #include "ircons.h" #include "irtools.h" diff --git a/ir/be/becopyheur4.c b/ir/be/becopyheur4.c index 5377e22b4..31995381c 100644 --- a/ir/be/becopyheur4.c +++ b/ir/be/becopyheur4.c @@ -43,15 +43,12 @@ #include "xmalloc.h" #include "pdeq.h" #include "irprintf.h" -#include "irbitset.h" #include "util.h" #include "irtools.h" #include "error.h" #include "list.h" #include "statev.h" -#include "irbitset.h" - #include "bearch.h" #include "beifg.h" #include "be_t.h" @@ -772,13 +769,13 @@ static __attribute__((unused)) void chunk_order_nodes(co_mst_env_t *env, aff_chu } if (max_node) { - bitset_t *visited = bitset_irg_malloc(env->co->irg); + bitset_t *visited = bitset_malloc(get_irg_last_idx(env->co->irg)); for (i = ARR_LEN(chunk->n); i != 0;) - bitset_add_irn(visited, chunk->n[--i]); + bitset_set(visited, get_irn_idx(chunk->n[--i])); pqueue_put(grow, (void *) max_node, max_weight); - bitset_remv_irn(visited, max_node); + bitset_clear(visited, get_irn_idx(max_node)); i = 0; while (!pqueue_empty(grow)) { ir_node *irn = (ir_node*)pqueue_pop_front(grow); @@ -797,9 +794,9 @@ static __attribute__((unused)) void chunk_order_nodes(co_mst_env_t *env, aff_chu co_gs_foreach_neighb(an, neigh) { co_mst_irn_t *node = get_co_mst_irn(env, neigh->irn); - if (bitset_contains_irn(visited, node->irn)) { + if (bitset_is_set(visited, get_irn_idx(node->irn))) { pqueue_put(grow, (void *) neigh->irn, neigh->costs); - bitset_remv_irn(visited, node->irn); + bitset_clear(visited, get_irn_idx(node->irn)); } } } @@ -877,7 +874,7 @@ static void expand_chunk_from(co_mst_env_t *env, co_mst_irn_t *node, bitset_t *v */ static aff_chunk_t *fragment_chunk(co_mst_env_t *env, int col, aff_chunk_t *c, waitq *tmp) { - bitset_t *visited = bitset_irg_malloc(env->co->irg); + bitset_t *visited = bitset_malloc(get_irg_last_idx(env->co->irg)); int idx, len; aff_chunk_t *best = NULL; @@ -1397,7 +1394,7 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c) } /* fragment the remaining chunk */ - visited = bitset_irg_malloc(env->co->irg); + visited = bitset_malloc(get_irg_last_idx(env->co->irg)); for (idx = 0, len = ARR_LEN(best_chunk->n); idx < len; ++idx) bitset_set(visited, get_irn_idx(best_chunk->n[idx])); diff --git a/ir/be/becopyopt.c b/ir/be/becopyopt.c index 786e370c7..04516a408 100644 --- a/ir/be/becopyopt.c +++ b/ir/be/becopyopt.c @@ -41,7 +41,6 @@ #include "irprog.h" #include "irloop_t.h" #include "iredges_t.h" -#include "irbitset.h" #include "irprintf_t.h" #include "irtools.h" #include "util.h" @@ -703,7 +702,7 @@ int co_get_lower_bound(const copy_opt_t *co) void co_complete_stats(const copy_opt_t *co, co_complete_stats_t *stat) { - bitset_t *seen = bitset_irg_malloc(co->irg); + bitset_t *seen = bitset_malloc(get_irg_last_idx(co->irg)); affinity_node_t *an; memset(stat, 0, sizeof(stat[0])); @@ -712,9 +711,9 @@ void co_complete_stats(const copy_opt_t *co, co_complete_stats_t *stat) co_gs_foreach_aff_node(co, an) { neighb_t *neigh; stat->aff_nodes += 1; - bitset_add_irn(seen, an->irn); + bitset_set(seen, get_irn_idx(an->irn)); co_gs_foreach_neighb(an, neigh) { - if (!bitset_contains_irn(seen, neigh->irn)) { + if (!bitset_is_set(seen, get_irn_idx(neigh->irn))) { stat->aff_edges += 1; stat->max_costs += neigh->costs; diff --git a/ir/be/beifg.c b/ir/be/beifg.c index cdfed376f..fc1cc7d77 100644 --- a/ir/be/beifg.c +++ b/ir/be/beifg.c @@ -36,7 +36,6 @@ #include "irnode_t.h" #include "irprintf.h" #include "irtools.h" -#include "irbitset.h" #include "beifg.h" #include "error.h" #include "xmalloc.h" @@ -374,13 +373,13 @@ static void int_comp_rec(be_ifg_t *ifg, ir_node *n, bitset_t *seen) ir_node *m; be_ifg_foreach_neighbour(ifg, &neigh_it, n, m) { - if (bitset_contains_irn(seen, m)) + if (bitset_is_set(seen, get_irn_idx(m))) continue; if (arch_get_irn_register_req(m)->type & arch_register_req_type_ignore) continue; - bitset_add_irn(seen, m); + bitset_set(seen, get_irn_idx(m)); int_comp_rec(ifg, m, seen); } @@ -390,19 +389,19 @@ static int int_component_stat(ir_graph *irg, be_ifg_t *ifg) { int n_comp = 0; nodes_iter_t nodes_it; - bitset_t *seen = bitset_irg_malloc(irg); + bitset_t *seen = bitset_malloc(get_irg_last_idx(irg)); ir_node *n; be_ifg_foreach_node(ifg, &nodes_it, n) { - if (bitset_contains_irn(seen, n)) + if (bitset_is_set(seen, get_irn_idx(n))) continue; if (arch_get_irn_register_req(n)->type & arch_register_req_type_ignore) continue; ++n_comp; - bitset_add_irn(seen, n); + bitset_set(seen, get_irn_idx(n)); int_comp_rec(ifg, n, seen); } @@ -414,7 +413,7 @@ void be_ifg_stat(ir_graph *irg, be_ifg_t *ifg, be_ifg_stat_t *stat) { nodes_iter_t nodes_it; neighbours_iter_t neigh_it; - bitset_t *nodes = bitset_irg_malloc(irg); + bitset_t *nodes = bitset_malloc(get_irg_last_idx(irg)); ir_node *n, *m; memset(stat, 0, sizeof(stat[0])); @@ -422,8 +421,8 @@ void be_ifg_stat(ir_graph *irg, be_ifg_t *ifg, be_ifg_stat_t *stat) be_ifg_foreach_node(ifg, &nodes_it, n) { stat->n_nodes += 1; be_ifg_foreach_neighbour(ifg, &neigh_it, n, m) { - bitset_add_irn(nodes, n); - stat->n_edges += !bitset_contains_irn(nodes, m); + bitset_set(nodes, get_irn_idx(n)); + stat->n_edges += !bitset_is_set(nodes, get_irn_idx(m)); } } diff --git a/ir/be/belive.c b/ir/be/belive.c index 88c01c2c2..1e5253129 100644 --- a/ir/be/belive.c +++ b/ir/be/belive.c @@ -31,7 +31,6 @@ #include "iredges_t.h" #include "irgwalk.h" #include "irprintf_t.h" -#include "irbitset.h" #include "irdump_t.h" #include "irnodeset.h" @@ -356,8 +355,8 @@ static void live_end_at_block(ir_node *block, int is_true_out) mark_live_out(lv, block, def); visited = re.visited; - if (!bitset_contains_irn(visited, block)) { - bitset_add_irn(visited, block); + if (!bitset_is_set(visited, get_irn_idx(block))) { + bitset_set(visited, get_irn_idx(block)); /* * If this block is not the definition block, we have to go up diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index 8e1649426..a07de4000 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -38,7 +38,6 @@ #include "irflag.h" #include "irgmod.h" #include "irgopt.h" -#include "irbitset.h" #include "irgopt.h" #include "irdump.h" #include "pdeq.h" diff --git a/ir/be/ia32/ia32_optimize.c b/ir/be/ia32/ia32_optimize.c index 1461d49ab..be4ec7582 100644 --- a/ir/be/ia32/ia32_optimize.c +++ b/ir/be/ia32/ia32_optimize.c @@ -34,7 +34,6 @@ #include "irgmod.h" #include "irgwalk.h" #include "heights.h" -#include "irbitset.h" #include "irprintf.h" #include "irdump.h" #include "error.h" diff --git a/ir/ir/irbitset.h b/ir/ir/irbitset.h deleted file mode 100644 index 1c59d7bcc..000000000 --- a/ir/ir/irbitset.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. - * - * This file is part of libFirm. - * - * This file may be distributed and/or modified under the terms of the - * GNU General Public License version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * Licensees holding valid libFirm Professional Edition licenses may use - * this file in accordance with the libFirm Commercial License. - * Agreement provided with the Software. - * - * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. - */ - -/** - * @file - * @brief Some convenience macros for node bitmaps. - * @author Sebastian Hack - * @date 10.05.2006 - */ -#ifndef FIRM_IR_IRBITSET_H -#define FIRM_IR_IRBITSET_H - -#include "bitset.h" - -#define bitset_irg_malloc(irg) bitset_malloc(get_irg_last_idx(irg)) -#define bitset_irg_alloca(irg) bitset_alloca(get_irg_last_idx(irg)) -#define bitset_irg_obstack_alloc(obst, irg) bitset_obstack_alloc(obst, get_irg_last_idx(irg)) -#define bitset_add_irn(bs, irn) bitset_set((bs), get_irn_idx(irn)) -#define bitset_remv_irn(bs, irn) bitset_clear((bs), get_irn_idx(irn)) -#define bitset_contains_irn(bs, irn) bitset_is_set((bs), get_irn_idx(irn)) - - -/* Internal use. */ -#define bsfe_get_irn_(irg, elm) (elm == (unsigned) -1 ? NULL : get_idx_irn((irg), (unsigned) elm)) - -/** - * Iterate over a bitset containing node indexes. - * @param irg The graph the nodes are in. - * @param bs The bitset containing the indexes. - * @param elm A loop variable for the bitset - * @param irn An ir_node * which is set to the current node. - */ -#define bitset_foreach_irn(irg, bs, elm, irn) \ - for(elm = bitset_next_set(bs, 0), irn = bsfe_get_irn_(irg, elm); elm != (unsigned) -1; elm = bitset_next_set(bs, elm + 1), irn = bsfe_get_irn_(irg, elm)) - - -#endif -- 2.20.1