summaryrefslogtreecommitdiffhomepage
path: root/ir/be/belive.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2012-12-03 16:28:31 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2012-12-03 17:30:52 +0100
commit67c0573183f113a00eca153a9b80724641cd8e20 (patch)
treef09b62d4a9468e732ead945da2f4553f5faaf835 /ir/be/belive.c
parentbdd5ec068bb74b27a41ba7d0b72aceabdf1d5c28 (diff)
belive: Avoid duplicate map lookups when calculating the liveness of a node in a block.
Diffstat (limited to 'ir/be/belive.c')
-rw-r--r--ir/be/belive.c48
1 files changed, 9 insertions, 39 deletions
diff --git a/ir/be/belive.c b/ir/be/belive.c
index acf32c2..12749a7 100644
--- a/ir/be/belive.c
+++ b/ir/be/belive.c
@@ -204,36 +204,6 @@ static int be_lv_remove(be_lv_t *li, const ir_node *bl,
return 0;
}
-/**
- * Mark a node as live-in in a block.
- */
-static inline void mark_live_in(be_lv_t *lv, ir_node *block, ir_node *irn)
-{
- be_lv_info_node_t *n = be_lv_get_or_set(lv, block, irn);
- DBG((dbg, LEVEL_2, "marking %+F live in at %+F\n", irn, block));
- n->flags |= be_lv_state_in;
-}
-
-/**
- * Mark a node as live-out in a block.
- */
-static inline void mark_live_out(be_lv_t *lv, ir_node *block, ir_node *irn)
-{
- be_lv_info_node_t *n = be_lv_get_or_set(lv, block, irn);
- DBG((dbg, LEVEL_2, "marking %+F live out at %+F\n", irn, block));
- n->flags |= be_lv_state_out | be_lv_state_end;
-}
-
-/**
- * Mark a node as live-end in a block.
- */
-static inline void mark_live_end(be_lv_t *lv, ir_node *block, ir_node *irn)
-{
- be_lv_info_node_t *n = be_lv_get_or_set(lv, block, irn);
- DBG((dbg, LEVEL_2, "marking %+F live end at %+F\n", irn, block));
- n->flags |= be_lv_state_end;
-}
-
static struct {
be_lv_t *lv; /**< The liveness object. */
ir_node *def; /**< The node (value). */
@@ -251,15 +221,12 @@ static struct {
*/
static void live_end_at_block(ir_node *block, int is_true_out)
{
- be_lv_t *lv = re.lv;
- ir_node *def = re.def;
- bitset_t *visited;
+ be_lv_info_node_t *const n = be_lv_get_or_set(re.lv, block, re.def);
- mark_live_end(lv, block, def);
- if (is_true_out)
- mark_live_out(lv, block, def);
+ DBG((dbg, LEVEL_2, "marking %+F live %s at %+F\n", re.def, is_true_out ? "end+out" : "end", block));
+ n->flags |= is_true_out ? be_lv_state_out | be_lv_state_end : be_lv_state_out;
- visited = re.visited;
+ bitset_t *const visited = re.visited;
if (!bitset_is_set(visited, get_irn_idx(block))) {
bitset_set(visited, get_irn_idx(block));
@@ -270,7 +237,8 @@ static void live_end_at_block(ir_node *block, int is_true_out)
if (re.def_block != block) {
int i;
- mark_live_in(lv, block, def);
+ DBG((dbg, LEVEL_2, "marking %+F live in at %+F\n", re.def, block));
+ n->flags |= be_lv_state_in;
for (i = get_Block_n_cfgpreds(block) - 1; i >= 0; --i)
live_end_at_block(get_Block_cfgpred_block(block, i), 1);
@@ -334,7 +302,9 @@ static void liveness_for_node(ir_node *irn)
else if (def_block != use_block) {
int i;
- mark_live_in(re.lv, use_block, irn);
+ be_lv_info_node_t *const n = be_lv_get_or_set(re.lv, use_block, irn);
+ DBG((dbg, LEVEL_2, "marking %+F live in at %+F\n", irn, use_block));
+ n->flags |= be_lv_state_in;
for (i = get_Block_n_cfgpreds(use_block) - 1; i >= 0; --i) {
ir_node *pred_block = get_Block_cfgpred_block(use_block, i);