projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
extended functionality
[libfirm]
/
ir
/
ana
/
ircfscc.c
diff --git
a/ir/ana/ircfscc.c
b/ir/ana/ircfscc.c
index
0c9135a
..
0e50feb
100644
(file)
--- a/
ir/ana/ircfscc.c
+++ b/
ir/ana/ircfscc.c
@@
-17,7
+17,9
@@
#include "config.h"
#endif
#include "config.h"
#endif
+#ifdef HAVE_STRING_H
#include <string.h>
#include <string.h>
+#endif
#include "irloop_t.h"
#include "irnode_t.h"
#include "irloop_t.h"
#include "irnode_t.h"
@@
-35,10
+37,12
@@
static ir_graph *outermost_ir_graph; /* The outermost graph the scc is comp
static ir_loop *current_loop; /* Current cfloop construction is working
on. */
static int loop_node_cnt = 0; /* Counts the number of allocated cfloop nodes.
static ir_loop *current_loop; /* Current cfloop construction is working
on. */
static int loop_node_cnt = 0; /* Counts the number of allocated cfloop nodes.
- Each cfloop node gets a unique number.
- What for? ev. remove. @@@ */
+
Each cfloop node gets a unique number.
+
What for? ev. remove. @@@ */
static int current_dfn = 1; /* Counter to generate depth first numbering
static int current_dfn = 1; /* Counter to generate depth first numbering
- of visited nodes. */
+ of visited nodes. */
+
+static int max_loop_depth = 0;
void link_to_reg_end (ir_node *n, void *env);
void link_to_reg_end (ir_node *n, void *env);
@@
-219,6
+223,7
@@
static ir_loop *new_loop (void) {
son->outer_loop = father;
add_loop_son(father, son);
son->depth = father->depth+1;
son->outer_loop = father;
add_loop_son(father, son);
son->depth = father->depth+1;
+ if (son->depth > max_loop_depth) max_loop_depth = son->depth;
} else { /* The root loop */
son->outer_loop = son;
son->depth = 0;
} else { /* The root loop */
son->outer_loop = son;
son->depth = 0;
@@
-569,14
+574,15
@@
static void cfscc (ir_node *n) {
}
/* Constructs backedge information for irg. */
}
/* Constructs backedge information for irg. */
-
void
construct_cf_backedges(ir_graph *irg) {
+
int
construct_cf_backedges(ir_graph *irg) {
ir_graph *rem = current_ir_graph;
ir_loop *head_rem;
ir_node *end = get_irg_end(irg);
int i;
ir_graph *rem = current_ir_graph;
ir_loop *head_rem;
ir_node *end = get_irg_end(irg);
int i;
- assert(!
interprocedural_view
&&
+ assert(!
get_interprocedural_view()
&&
"use construct_ip_backedges");
"use construct_ip_backedges");
+ max_loop_depth = 0;
current_ir_graph = irg;
outermost_ir_graph = irg;
current_ir_graph = irg;
outermost_ir_graph = irg;
@@
-601,23
+607,24
@@
void construct_cf_backedges(ir_graph *irg) {
assert(get_irg_loop(current_ir_graph)->kind == k_ir_loop);
current_ir_graph = rem;
assert(get_irg_loop(current_ir_graph)->kind == k_ir_loop);
current_ir_graph = rem;
+ return max_loop_depth;
}
}
-
void
construct_ip_cf_backedges (void) {
+
int
construct_ip_cf_backedges (void) {
ir_graph *rem = current_ir_graph;
ir_graph *rem = current_ir_graph;
- int rem_ipv =
interprocedural_view
;
+ int rem_ipv =
get_interprocedural_view()
;
int i;
assert(get_irp_ip_view_state() == ip_view_valid);
int i;
assert(get_irp_ip_view_state() == ip_view_valid);
-
+ max_loop_depth = 0;
outermost_ir_graph = get_irp_main_irg();
init_ip_scc();
current_loop = NULL;
new_loop(); /* sets current_loop */
outermost_ir_graph = get_irp_main_irg();
init_ip_scc();
current_loop = NULL;
new_loop(); /* sets current_loop */
-
interprocedural_view = 1
;
+
set_interprocedural_view(true)
;
inc_max_irg_visited();
for (i = 0; i < get_irp_n_irgs(); i++)
inc_max_irg_visited();
for (i = 0; i < get_irp_n_irgs(); i++)
@@
-672,18
+679,20
@@
void construct_ip_cf_backedges (void) {
assert(get_irg_loop(outermost_ir_graph)->kind == k_ir_loop);
current_ir_graph = rem;
assert(get_irg_loop(outermost_ir_graph)->kind == k_ir_loop);
current_ir_graph = rem;
- interprocedural_view = rem_ipv;
+ set_interprocedural_view(rem_ipv);
+ return max_loop_depth;
}
static void reset_backedges(ir_node *n) {
}
static void reset_backedges(ir_node *n) {
+ int rem = get_interprocedural_view();
+
assert(is_Block(n));
assert(is_Block(n));
- int rem = interprocedural_view;
- interprocedural_view = 1;
+ set_interprocedural_view(true);
clear_backedges(n);
clear_backedges(n);
-
interprocedural_view = 0
;
+
set_interprocedural_view(false)
;
clear_backedges(n);
clear_backedges(n);
-
interprocedural_view = rem
;
+
set_interprocedural_view(rem)
;
}
static void loop_reset_backedges(ir_loop *l) {
}
static void loop_reset_backedges(ir_loop *l) {
@@
-709,10
+718,10
@@
void free_cfloop_information(ir_graph *irg) {
void free_all_cfloop_information (void) {
int i;
void free_all_cfloop_information (void) {
int i;
- int rem =
interprocedural_view
;
-
interprocedural_view = 1
; /* To visit all filter nodes */
+ int rem =
get_interprocedural_view()
;
+
set_interprocedural_view(true)
; /* To visit all filter nodes */
for (i = 0; i < get_irp_n_irgs(); i++) {
free_cfloop_information(get_irp_irg(i));
}
for (i = 0; i < get_irp_n_irgs(); i++) {
free_cfloop_information(get_irp_irg(i));
}
-
interprocedural_view = rem
;
+
set_interprocedural_view(rem)
;
}
}