reduce code size
[libfirm] / ir / be / bessaconstr.c
index ebe4f7f..257ea72 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
  *
  * to their closest copy while introducing phis as necessary.
  *
  * Algorithm: Mark all blocks in the iterated dominance frontiers of the value
- * and it's copies. Link the copies ordered by dominance to the blocks.  The
- * we search for each use all all definitions in the current block, if none is
+ * and it's copies. Link the copies ordered by dominance to the blocks.  Then
+ * we search for each use all definitions in the current block, if none is
  * found, then we search one in the immediate dominator. If we are in a block
- * of the dominance frontier, create a phi and search do the same search for
- * the phi arguments.
+ * of the dominance frontier, create a phi and do the same search for all
+ * phi arguments.
  *
  * A copy in this context means, that you want to introduce several new
  * abstract values (in Firm: nodes) for which you know, that they
@@ -55,6 +55,7 @@
 #include "besched_t.h"
 #include "beintlive_t.h"
 #include "beirg_t.h"
+#include "be_t.h"
 
 #include "debug.h"
 #include "error.h"
@@ -67,6 +68,9 @@
 
 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
+/**
+ * Checks that low <= what < hi.
+ */
 static INLINE int is_inside(unsigned what, unsigned low, unsigned hi)
 {
        return what - low < hi;
@@ -83,7 +87,7 @@ void mark_iterated_dominance_frontiers(const be_ssa_construction_env_t *env)
        stat_ev_cnt_decl(blocks);
        DBG((dbg, LEVEL_3, "Dominance Frontier:"));
        stat_ev_tim_push();
-       while (!pdeq_empty(env->worklist)) {
+       while (!waitq_empty(env->worklist)) {
                int i;
                ir_node *block = waitq_get(env->worklist);
                ir_node **domfront = be_get_dominance_frontier(env->domfronts, block);
@@ -291,7 +295,7 @@ void be_ssa_construction_init(be_ssa_construction_env_t *env, be_irg_t *birg)
        env->min_dom   = INT_MAX;
        env->max_dom   = 0;
 
-       set_using_visited(irg);
+       set_using_irn_visited(irg);
        set_using_block_visited(irg);
        set_using_irn_link(irg);
 
@@ -309,7 +313,7 @@ void be_ssa_construction_destroy(be_ssa_construction_env_t *env)
        del_waitq(env->worklist);
        DEL_ARR_F(env->new_phis);
 
-       clear_using_visited(env->irg);
+       clear_using_irn_visited(env->irg);
        clear_using_block_visited(env->irg);
        clear_using_irn_link(env->irg);
 
@@ -381,6 +385,8 @@ void be_ssa_construction_fix_users_array(be_ssa_construction_env_t *env,
        const ir_edge_t *edge, *next;
        size_t i;
 
+       BE_TIMER_PUSH(t_ssa_constr);
+
        if(!env->iterated_domfront_calculated) {
                mark_iterated_dominance_frontiers(env);
                env->iterated_domfront_calculated = 1;
@@ -423,6 +429,8 @@ void be_ssa_construction_fix_users_array(be_ssa_construction_env_t *env,
                        stat_ev_cnt_inc(uses);
                }
        }
+       BE_TIMER_POP(t_ssa_constr);
+
        stat_ev_tim_pop("bessaconstr_fix_time");
        stat_ev_cnt_done(uses, "bessaconstr_uses");
 }
@@ -438,11 +446,15 @@ void be_ssa_construction_update_liveness_phis(be_ssa_construction_env_t *env,
 {
        int i, n;
 
+       BE_TIMER_PUSH(t_ssa_constr);
+
        n = ARR_LEN(env->new_phis);
        for(i = 0; i < n; ++i) {
                ir_node *phi = env->new_phis[i];
                be_liveness_introduce(lv, phi);
        }
+
+       BE_TIMER_POP(t_ssa_constr);
 }
 
 void be_init_ssaconstr(void)