Commit 77460435 authored by Michael Beck's avatar Michael Beck
Browse files

caller backedges uses raw_bitsets

[r16782]
parent dd312230
...@@ -85,7 +85,7 @@ ir_graph *get_irg_caller(ir_graph *irg, int pos) { ...@@ -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. */ /* 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) { int is_irg_caller_backedge(ir_graph *irg, int pos) {
assert (pos >= 0 && pos < get_irg_n_callers(irg)); 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. */ /** 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) { ...@@ -94,10 +94,10 @@ static void set_irg_caller_backedge(ir_graph *irg, ir_graph *caller) {
/* allocate a new array on demand */ /* allocate a new array on demand */
if (irg->caller_isbe == NULL) 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) { for (i = 0; i < n_callers; ++i) {
if (get_irg_caller(irg, i) == caller) { if (get_irg_caller(irg, i) == caller) {
irg->caller_isbe[i] = 1; rbitset_set(irg->caller_isbe, i);
break; break;
} }
} }
...@@ -109,7 +109,8 @@ int has_irg_caller_backedge(ir_graph *irg) { ...@@ -109,7 +109,8 @@ int has_irg_caller_backedge(ir_graph *irg) {
if (irg->caller_isbe != NULL) { if (irg->caller_isbe != NULL) {
for (i = 0; i < n_callers; ++i) 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; return 0;
} }
......
...@@ -457,7 +457,7 @@ struct ir_graph { ...@@ -457,7 +457,7 @@ struct ir_graph {
the node. */ the node. */
ir_graph **callers; /**< For callgraph analysis: list of caller graphs. */ 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 */ cg_callee_entry **callees; /**< For callgraph analysis: list of callee calls */
unsigned char *callee_isbe; /**< For callgraph analysis: set if backedge. */ unsigned char *callee_isbe; /**< For callgraph analysis: set if backedge. */
int callgraph_loop_depth; /**< For callgraph analysis */ int callgraph_loop_depth; /**< For callgraph analysis */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment