-static void create_dying_nodes_constraint(be_ilpsched_env_t *env, lpp_t *lpp, be_ilpsched_irn_t *block_node) {
- char buf[1024];
- unsigned t;
- unsigned num_cst = 0;
- ilpsched_block_attr_t *ba = get_ilpsched_block_attr(block_node);
-#ifdef WITH_LIBCORE
- lc_timer_t *t_cst = lc_timer_register("beilpsched_cst_dying_nodes", "create dying nodes constraints");
-#endif /* WITH_LIBCORE */
-
- ilp_timer_push(t_cst);
- /* check all time_steps */
- for (t = 0; t < ba->max_steps; ++t) {
- ir_node *irn;
-
- /* for all nodes */
- foreach_linked_irns(ba->head_ilp_nodes, irn) {
- be_ilpsched_irn_t *node = get_ilpsched_irn(env, irn);
- ilpsched_node_attr_t *na = get_ilpsched_node_attr(node);
-
- /* if node has no consumer within current block, it cannot die here */
- /* we also ignore nodes assigned to dummy unit */
- if (ARR_LEN(na->block_consumer) < 1 || na->is_dummy_node)
- continue;
-
- /* node can only die here if t at least asap(n) */
- if (t >= na->asap - 1) {
- int node_tp_idx;
-
- /* for all unit types */
- for (node_tp_idx = na->n_unit_types - 1; node_tp_idx >= 0; --node_tp_idx) {
- int tp_idx, i, cst;
- int *tmp_var_idx = NEW_ARR_F(int, 0);
-
- snprintf(buf, sizeof(buf), "dying_node_cst_%u_n%u", t, get_irn_idx(irn));
- cst = lpp_add_cst_uniq(lpp, buf, lpp_less, (double)(na->n_consumer - 1));
- DBG((env->dbg, LEVEL_2, "added constraint %s\n", buf));
- num_cst++;
-
- /* number of consumer scheduled till t */
- for (i = ARR_LEN(na->block_consumer) - 1; i >= 0; --i) {
- be_ilpsched_irn_t *cons = get_ilpsched_irn(env, na->block_consumer[i]);
- ilpsched_node_attr_t *ca = get_ilpsched_node_attr(cons);
-
- for (tp_idx = ca->n_unit_types - 1; tp_idx >= 0; --tp_idx) {
- unsigned tm;
-
- for (tm = ca->asap - 1; tm <= t && tm <= ca->alap - 1; ++tm) {
- int idx = ILPVAR_IDX(ca, tp_idx, tm);
- ARR_APP1(int, tmp_var_idx, ca->ilp_vars.x[idx]);
- }
- }
- }
-
- /* could be that no consumer can be scheduled at this point */
- if (ARR_LEN(tmp_var_idx)) {
- int idx;
- unsigned tn;
-
- /* subtract possible prior kill points */
- for (tn = na->asap - 1; tn < t; ++tn) {
- idx = ILPVAR_IDX_DEAD(ba, na, node_tp_idx, tn);
- lpp_set_factor_fast(lpp, cst, na->ilp_vars.d[idx], -1.0);
- }
-
- idx = ILPVAR_IDX_DEAD(ba, na, node_tp_idx, t);
- lpp_set_factor_fast(lpp, cst, na->ilp_vars.d[idx], 0.0 - (double)(na->n_consumer));
- lpp_set_factor_fast_bulk(lpp, cst, tmp_var_idx, ARR_LEN(tmp_var_idx), 1.0);
- }
-
- DEL_ARR_F(tmp_var_idx);
- }
- }
-
- }
- }
- ilp_timer_pop();
- DBG((env->dbg, LEVEL_1, "\t%u dying nodes constraints (%g sec)\n",
- num_cst, ilp_timer_elapsed_usec(t_cst) / 1000000.0));
-}
-
-/**
-* Create ILP alive nodes constraints:
-* - set variable a_{nt}^k to 1 if nodes n is alive at step t on unit k
-*/
-static void create_alive_nodes_constraint(be_ilpsched_env_t *env, lpp_t *lpp, be_ilpsched_irn_t *block_node) {