/*
- * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
* @brief Implementation of interval analysis
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
-#ifdef HAVE_STRING_H
#include <string.h>
-#endif
+#include "debug.h"
#include "interval_analysis.h"
#include "execution_frequency.h"
#include "firm_common_t.h"
#include "irprintf.h"
#include "hashptr.h"
+DEBUG_ONLY(static firm_dbg_module_t *dbg);
+
/*------------------------------------------------------------------*/
/* A new in array via a hashmap. */
/* The in array refers to the loop the block is contained in if the */
int region_attr_cmp(const void *e1, const void *e2, size_t size) {
region_attr *ra1 = (region_attr *)e1;
region_attr *ra2 = (region_attr *)e2;
+ (void) size;
return (ra1->reg != ra2->reg);
}
-static INLINE int attr_set_hash(region_attr *a) {
+static inline int attr_set_hash(region_attr *a) {
return HASH_PTR(a->reg);
}
-static INLINE region_attr *get_region_attr(void *region) {
+static inline region_attr *get_region_attr(void *region) {
region_attr r_attr, *res;
r_attr.reg = region;
ARR_APP1(void *, get_region_attr(region)->op_array, cfop);
}
-static INLINE void exc_outs(void *reg, ir_node *cfop) {
+static inline void exc_outs(void *reg, ir_node *cfop) {
if (is_fragile_op(cfop) || (is_fragile_Proj(cfop)))
inc_region_n_exc_outs(reg);
}
}
-static int find_previous_loop(ir_loop *l, ir_loop *pred_l, ir_node *b, ir_node *pred_b, ir_node *cfop) {
+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);
int found, i;
int l_pos = get_loop_element_pos(outer, l);
+ (void) pred_l;
assert(l_pos > -1);
assert(l_pos > 0 && "Is this a necessary condition? There could be a perfect nest ...");
if (is_backedge(b, i)) {
if (b != get_loop_element(l, 0).node) {
- if (get_firm_verbosity()) {
- ir_printf("Loophead not at loop position 0. %+F\n", b);
- }
+ DB((dbg, LEVEL_1, "Loophead not at loop position 0. %+F\n", b));
}
/* There are no backedges in the interval decomposition. */
add_region_in(b, NULL);
cfop = get_Block_cfgpred(b, i);
if (is_Proj(cfop)) {
- if (get_irn_op(get_Proj_pred(cfop)) != op_Cond) {
+ if (!is_Cond(get_Proj_pred(cfop))) {
cfop = skip_Proj(cfop);
} else {
assert(get_nodes_block(cfop) == get_nodes_block(skip_Proj(cfop)));
pred = skip_Proj(get_nodes_block(cfop));
/* We want nice blocks. */
- assert( get_irn_op(pred) != op_Bad
- && get_irn_op(skip_Proj(get_Block_cfgpred(b, i))) != op_Bad);
+ assert(!is_Bad(pred) && !is_Bad(skip_Proj(get_Block_cfgpred(b, i))));
pred_l = get_irn_loop(pred);
if (pred_l == l) {
add_region_in(b, pred);
int found = find_inner_loop(b, l, pred, cfop);
if (!found) {
if (b != get_loop_element(l, 0).node) {
- if (get_firm_verbosity()) {
- ir_printf("Loop entry not at loop position 0. %+F\n", b);
- }
+ DB((dbg, LEVEL_1, "Loop entry not at loop position 0. %+F\n", b));
}
found = find_outer_loop(l, pred_l, pred, cfop);
if (found) add_region_in(b, NULL); /* placeholder */
ir_graph *rem = current_ir_graph;
current_ir_graph = irg;
+ FIRM_DBG_REGISTER(dbg, "firm.ana.interval");
+
if (!region_attr_set)
region_attr_set = new_set(region_attr_cmp, 256);
return;
f = vcg_open(irg, suffix, "-intervals");
- dump_vcg_header(f, get_irg_dump_name(irg), NULL);
+ dump_vcg_header(f, get_irg_dump_name(irg), NULL, NULL);
current_ir_graph = irg;
dump_interval_loop(f, get_irg_loop(current_ir_graph));
- vcg_close(f);
+ dump_vcg_footer(f);
+ fclose(f);
}