projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update automake stuff for release
[libfirm]
/
ir
/
ana
/
interval_analysis.c
diff --git
a/ir/ana/interval_analysis.c
b/ir/ana/interval_analysis.c
index
344b0fc
..
d52a814
100644
(file)
--- a/
ir/ana/interval_analysis.c
+++ b/
ir/ana/interval_analysis.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 1995-20
08
University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-20
11
University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
*
* This file is part of libFirm.
*
@@
-88,7
+88,7
@@
static inline region_attr *get_region_attr(void *region)
region_attr r_attr, *res;
r_attr.reg = region;
region_attr r_attr, *res;
r_attr.reg = region;
- res = set_find(region_attr_set, &r_attr, sizeof(r_attr), attr_set_hash(&r_attr));
+ res =
(region_attr*)
set_find(region_attr_set, &r_attr, sizeof(r_attr), attr_set_hash(&r_attr));
if (res == NULL) {
r_attr.in_array = NEW_ARR_F(void *, 0);
if (res == NULL) {
r_attr.in_array = NEW_ARR_F(void *, 0);
@@
-98,7
+98,7
@@
static inline region_attr *get_region_attr(void *region)
r_attr.op_array = NULL;
r_attr.n_outs = 0;
r_attr.n_exc_outs = 0;
r_attr.op_array = NULL;
r_attr.n_outs = 0;
r_attr.n_exc_outs = 0;
- res = set_insert(region_attr_set, &r_attr, sizeof(r_attr), attr_set_hash(&r_attr));
+ res =
(region_attr*)
set_insert(region_attr_set, &r_attr, sizeof(r_attr), attr_set_hash(&r_attr));
}
return res;
}
return res;
@@
-106,7
+106,7
@@
static inline region_attr *get_region_attr(void *region)
int get_region_n_ins(void *region)
{
int get_region_n_ins(void *region)
{
- return ARR_LEN(get_region_attr(region)->in_array);
+ return
(int)
ARR_LEN(get_region_attr(region)->in_array);
}
void *get_region_in(void *region, int pos)
}
void *get_region_in(void *region, int pos)
@@
-131,7
+131,7
@@
int get_region_n_exc_outs(void *region)
return get_region_attr(region)->n_exc_outs;
}
return get_region_attr(region)->n_exc_outs;
}
-void inc_region_n_exc_outs(void *region)
+
static
void inc_region_n_exc_outs(void *region)
{
(get_region_attr(region)->n_exc_outs)++;
}
{
(get_region_attr(region)->n_exc_outs)++;
}
@@
-198,7
+198,7
@@
static int find_outer_loop(ir_loop *inner, ir_loop *outer, ir_node *blk, ir_node
*/
static int test_loop_nest(ir_node *blk, ir_loop *loop)
{
*/
static int test_loop_nest(ir_node *blk, ir_loop *loop)
{
-
in
t i, n_elems = get_loop_n_elements(loop);
+
size_
t i, n_elems = get_loop_n_elements(loop);
for (i = 0; i < n_elems; ++i) {
loop_element e = get_loop_element(loop, i);
for (i = 0; i < n_elems; ++i) {
loop_element e = get_loop_element(loop, i);
@@
-231,7
+231,7
@@
static int test_loop_nest(ir_node *blk, ir_loop *loop)
*/
static int find_inner_loop(ir_node *blk, ir_loop *l, ir_node *pred, ir_node *cfop)
{
*/
static int find_inner_loop(ir_node *blk, ir_loop *l, ir_node *pred, ir_node *cfop)
{
-
in
t i, n_elems = get_loop_n_elements(l);
+
size_
t i, n_elems = get_loop_n_elements(l);
int found = 0;
for (i = 0; i < n_elems; ++i) {
int found = 0;
for (i = 0; i < n_elems; ++i) {
@@
-275,14
+275,14
@@
static int find_previous_loop(ir_loop *l, ir_loop *pred_l, ir_node *b,
ir_node *pred_b, ir_node *cfop)
{
ir_loop *outer = get_loop_outer_loop(l);
ir_node *pred_b, ir_node *cfop)
{
ir_loop *outer = get_loop_outer_loop(l);
- int found
, i
;
-
int
l_pos = get_loop_element_pos(outer, l);
+ int found;
+
size_t i,
l_pos = get_loop_element_pos(outer, l);
(void) pred_l;
(void) pred_l;
- assert(l_pos
> -1
);
+ assert(l_pos
!= INVALID_LOOP_POS
);
assert(l_pos > 0 && "Is this a necessary condition? There could be a perfect nest ...");
assert(l_pos > 0 && "Is this a necessary condition? There could be a perfect nest ...");
- for (i = l_pos
-1, found = 0; i > -1 && !found; --i
) {
- ir_loop *k = get_loop_element(outer, i).son;
+ for (i = l_pos
, found = 0; i > 0;
) {
+ ir_loop *k = get_loop_element(outer,
--
i).son;
if (is_ir_loop(k)) {
found = test_loop_nest(pred_b, k);
if (found) {
if (is_ir_loop(k)) {
found = test_loop_nest(pred_b, k);
if (found) {
@@
-291,6
+291,7
@@
static int find_previous_loop(ir_loop *l, ir_loop *pred_l, ir_node *b,
add_loop_cfop(l, cfop);
/* placeholder: the edge is in the loop region */
add_region_in(b, NULL);
add_loop_cfop(l, cfop);
/* placeholder: the edge is in the loop region */
add_region_in(b, NULL);
+ break;
}
}
}
}
}
}
@@
-402,7
+403,7
@@
static void construct_interval_block(ir_node *blk, ir_loop *l)
*/
static void construct_interval_edges(ir_loop *l)
{
*/
static void construct_interval_edges(ir_loop *l)
{
-
in
t i, n_elems = get_loop_n_elements(l);
+
size_
t i, n_elems = get_loop_n_elements(l);
for (i = 0; i < n_elems; ++i) {
loop_element e = get_loop_element(l, i);
switch (*e.kind) {
for (i = 0; i < n_elems; ++i) {
loop_element e = get_loop_element(l, i);
switch (*e.kind) {
@@
-446,9
+447,9
@@
void free_intervals(void)
if (region_attr_set == NULL)
return;
if (region_attr_set == NULL)
return;
- for (res = set_first(region_attr_set);
+ for (res =
(region_attr*)
set_first(region_attr_set);
res != NULL;
res != NULL;
- res = set_next(region_attr_set)) {
+ res =
(region_attr*)
set_next(region_attr_set)) {
DEL_ARR_F(res->in_array);
if (res->op_array != NULL)
DEL_ARR_F(res->op_array);
DEL_ARR_F(res->in_array);
if (res->op_array != NULL)
DEL_ARR_F(res->op_array);
@@
-463,12
+464,12
@@
void free_intervals(void)
/* */
/*------------------------------------------------------------------*/
/* */
/*------------------------------------------------------------------*/
-void dump_region_edges(FILE *F, void *reg)
+
static
void dump_region_edges(FILE *F, void *reg)
{
int i, n_ins = get_region_n_ins(reg);
if (is_ir_node(reg)) {
{
int i, n_ins = get_region_n_ins(reg);
if (is_ir_node(reg)) {
- ir_node *irn = reg;
+ ir_node *irn =
(ir_node*)
reg;
if (get_Block_n_cfgpreds(irn) > get_region_n_ins(reg)) {
for (i = n_ins; i < get_Block_n_cfgpreds(irn); ++i) {
if (is_backedge(irn, i))
if (get_Block_n_cfgpreds(irn) > get_region_n_ins(reg)) {
for (i = n_ins; i < get_Block_n_cfgpreds(irn); ++i) {
if (is_backedge(irn, i))
@@
-487,7
+488,7
@@
void dump_region_edges(FILE *F, void *reg)
void *target = get_region_in(reg, i);
if (is_ir_node(reg)) {
void *target = get_region_in(reg, i);
if (is_ir_node(reg)) {
- ir_node *irn = reg;
+ ir_node *irn =
(ir_node*)
reg;
if (get_Block_n_cfgpreds(irn) != get_region_n_ins(reg)) {
ir_printf("n_cfgpreds = %d, n_ins = %d\n %+F\n", get_Block_n_cfgpreds(irn), get_region_n_ins(reg), irn);
}
if (get_Block_n_cfgpreds(irn) != get_region_n_ins(reg)) {
ir_printf("n_cfgpreds = %d, n_ins = %d\n %+F\n", get_Block_n_cfgpreds(irn), get_region_n_ins(reg), irn);
}
@@
-520,7
+521,7
@@
void dump_region_edges(FILE *F, void *reg)
PRINT_LOOPID(((ir_loop *)target));
}
fprintf(F, "\"");
PRINT_LOOPID(((ir_loop *)target));
}
fprintf(F, "\"");
- if (is_ir_node(reg) && is_fragile_op(skip_Proj(get_Block_cfgpred(reg, i))))
+ if (is_ir_node(reg) && is_fragile_op(skip_Proj(get_Block_cfgpred(
(ir_node*)
reg, i))))
fprintf(F, EXC_CF_EDGE_ATTR);
fprintf(F, "}\n");
}
fprintf(F, EXC_CF_EDGE_ATTR);
fprintf(F, "}\n");
}
@@
-546,7
+547,7
@@
static void dump_interval_block(FILE *F, ir_node *block)
fprintf(F, " n_exc_outs: %d", get_region_n_exc_outs(block));
fprintf(F, "\" ");
fprintf(F, "info1:\"");
fprintf(F, " n_exc_outs: %d", get_region_n_exc_outs(block));
fprintf(F, "\" ");
fprintf(F, "info1:\"");
- if (
dump_dominator_information_flag
)
+ if (
ir_get_dump_flags() & ir_dump_flag_dominance
)
fprintf(F, "dom depth %d\n", get_Block_dom_depth(block));
/* show arity and possible Bad predecessors of the block */
fprintf(F, "dom depth %d\n", get_Block_dom_depth(block));
/* show arity and possible Bad predecessors of the block */
@@
-576,11
+577,11
@@
static void dump_interval_block(FILE *F, ir_node *block)
static void dump_interval_loop(FILE *F, ir_loop *l)
{
static void dump_interval_loop(FILE *F, ir_loop *l)
{
-
in
t i, n_elems = get_loop_n_elements(l);
+
size_
t i, n_elems = get_loop_n_elements(l);
fprintf(F, "graph: { title: \"");
PRINT_LOOPID(l);
fprintf(F, "graph: { title: \"");
PRINT_LOOPID(l);
- fprintf(F, "\" label: \"loop %d", get_loop_loop_nr(l));
+ fprintf(F, "\" label: \"loop %
l
d", get_loop_loop_nr(l));
fprintf(F, " freq: %9.4lf", get_region_exec_freq(l));
fprintf(F, " n_outs: %d", get_region_n_outs(l));
fprintf(F, " n_exc_outs: %d", get_region_n_exc_outs(l));
fprintf(F, " freq: %9.4lf", get_region_exec_freq(l));
fprintf(F, " n_outs: %d", get_region_n_outs(l));
fprintf(F, " n_exc_outs: %d", get_region_n_exc_outs(l));
@@
-604,25
+605,14
@@
static void dump_interval_loop(FILE *F, ir_loop *l)
fprintf(F, "}\n\n");
}
fprintf(F, "}\n\n");
}
-
-void dump_interval_graph(ir_graph *irg, const char *suffix)
+void dump_interval_graph(FILE *out, ir_graph *irg)
{
{
- FILE *f;
- ir_graph *rem;
-
- if (!is_filtered_dump_name(get_entity_ident(get_irg_entity(irg))))
- return;
-
- f = vcg_open(irg, suffix, "-intervals");
- dump_vcg_header(f, get_irg_dump_name(irg), NULL, NULL);
-
- rem = current_ir_graph;
+ ir_graph *rem = current_ir_graph;
current_ir_graph = irg;
current_ir_graph = irg;
- dump_interval_loop(f, get_irg_loop(irg));
-
- dump_vcg_footer(f);
- fclose(f);
+ dump_vcg_header(out, get_irg_dump_name(irg), NULL, NULL);
+ dump_interval_loop(out, get_irg_loop(irg));
+ dump_vcg_footer(out);
current_ir_graph = rem;
}
current_ir_graph = rem;
}