/*
- * 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.
+ * Copyright (C) 2012 University of Karlsruhe.
*/
/**
return res;
}
+typedef struct lv_remove_walker_t {
+ be_lv_t *lv;
+ ir_node const *irn;
+} lv_remove_walker_t;
+
/**
* Removes a node from the list of live variables of a block.
- * @return 1 if the node was live at that block, 0 if not.
*/
-static int be_lv_remove(be_lv_t *li, const ir_node *bl,
- const ir_node *irn)
+static void lv_remove_irn_walker(ir_node *const bl, void *const data)
{
- be_lv_info_t *irn_live = ir_nodehashmap_get(be_lv_info_t, &li->map, bl);
-
+ lv_remove_walker_t *const w = (lv_remove_walker_t*)data;
+ ir_node const *const irn = w->irn;
+ be_lv_info_t *const irn_live = ir_nodehashmap_get(be_lv_info_t, &w->lv->map, bl);
if (irn_live != NULL) {
unsigned n = irn_live[0].head.n_members;
unsigned pos = _be_liveness_bsearch(irn_live, irn);
--irn_live[0].head.n_members;
DBG((dbg, LEVEL_3, "\tdeleting %+F from %+F at pos %d\n", irn, bl, pos));
- return 1;
}
}
-
- return 0;
}
static struct {
}
}
-typedef struct lv_remove_walker_t {
- be_lv_t *lv;
- const ir_node *irn;
-} lv_remove_walker_t;
-
-
/**
* Liveness analysis for a value.
* Compute the set of all blocks a value is live in.
}
}
-static void lv_remove_irn_walker(ir_node *bl, void *data)
-{
- lv_remove_walker_t *w = (lv_remove_walker_t*)data;
- be_lv_remove(w->lv, bl, w->irn);
-}
-
/**
* Walker, collect all nodes for which we want calculate liveness info
* on an obstack.
void be_liveness_nodes_live_before(be_lv_t const *const lv, arch_register_class_t const *const cls, ir_node const *const pos, ir_nodeset_t *const live)
{
- ir_node const *const bl = get_nodes_block(pos);
+ ir_node *const bl = get_nodes_block(pos);
be_liveness_end_of_block(lv, cls, bl, live);
sched_foreach_reverse(bl, irn) {
be_liveness_transfer(cls, irn, live);