From 77460435c4aea9d9afcd9583d903c164980cecd4 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Sun, 18 Nov 2007 20:39:59 +0000 Subject: [PATCH] caller backedges uses raw_bitsets [r16782] --- ir/ana/callgraph.c | 9 +++++---- ir/ir/irtypes.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ir/ana/callgraph.c b/ir/ana/callgraph.c index a4eba6cc7..55ccce327 100644 --- a/ir/ana/callgraph.c +++ b/ir/ana/callgraph.c @@ -85,7 +85,7 @@ ir_graph *get_irg_caller(ir_graph *irg, int pos) { /* Returns non-zero if the caller at position pos is "a backedge", i.e. a recursion. */ int is_irg_caller_backedge(ir_graph *irg, int pos) { assert (pos >= 0 && pos < get_irg_n_callers(irg)); - return irg->caller_isbe != NULL ? irg->caller_isbe[pos] : 0; + return irg->caller_isbe != NULL ? rbitset_is_set(irg->caller_isbe, pos) : 0; } /** Search the caller in the list of all callers and set it's backedge property. */ @@ -94,10 +94,10 @@ static void set_irg_caller_backedge(ir_graph *irg, ir_graph *caller) { /* allocate a new array on demand */ if (irg->caller_isbe == NULL) - irg->caller_isbe = xcalloc(n_callers, sizeof(irg->caller_isbe[0])); + irg->caller_isbe = rbitset_malloc(n_callers); for (i = 0; i < n_callers; ++i) { if (get_irg_caller(irg, i) == caller) { - irg->caller_isbe[i] = 1; + rbitset_set(irg->caller_isbe, i); break; } } @@ -109,7 +109,8 @@ int has_irg_caller_backedge(ir_graph *irg) { if (irg->caller_isbe != NULL) { for (i = 0; i < n_callers; ++i) - if (irg->caller_isbe[i]) return 1; + if (rbitset_is_set(irg->caller_isbe, i)) + return 1; } return 0; } diff --git a/ir/ir/irtypes.h b/ir/ir/irtypes.h index 3b1d6b3d6..1bd39e193 100644 --- a/ir/ir/irtypes.h +++ b/ir/ir/irtypes.h @@ -457,7 +457,7 @@ struct ir_graph { the node. */ ir_graph **callers; /**< For callgraph analysis: list of caller graphs. */ - unsigned char *caller_isbe; /**< For callgraph analysis: set if backedge. */ + unsigned *caller_isbe; /**< For callgraph analysis: raw bitset if backedge. */ cg_callee_entry **callees; /**< For callgraph analysis: list of callee calls */ unsigned char *callee_isbe; /**< For callgraph analysis: set if backedge. */ int callgraph_loop_depth; /**< For callgraph analysis */ -- 2.20.1