- * Try, to make all users of a node ready.
- * In fact, a usage node can only be made ready, if all its operands
- * have already been scheduled yet. This is checked by make_ready().
- * @param env The block schedule environment.
- * @param irn The node, which usages (successors) are to be made ready.
- */
-static void make_users_ready(block_sched_env_t *env, ir_node *irn)
-{
- const ir_edge_t *edge;
-
- /* make all data users ready */
- foreach_out_edge(irn, edge) {
- ir_node *user = get_edge_src_irn(edge);
-
- if (! is_Phi(user))
- make_ready(env, irn, user);
- }
-
- /* and the dependent nodes as well */
- foreach_out_edge_kind(irn, edge, EDGE_KIND_DEP) {
- ir_node *user = get_edge_src_irn(edge);
-
- if (! is_Phi(user))
- make_ready(env, irn, user);
- }
-}
-
-/**
- * Returns the number of not yet schedules users.
- */
-static inline int get_irn_not_sched_user(block_sched_env_t *env, ir_node *n)
-{
- unsigned const idx = get_irn_idx(n);
-
- assert(idx < ARR_LEN(env->sched_info));
- return env->sched_info[idx].num_not_sched_user;
-}
-
-/**
- * Sets the number of not yet schedules users.
- */
-static inline void set_irn_not_sched_user(block_sched_env_t *env, ir_node *n, int num)
-{
- unsigned const idx = get_irn_idx(n);
-
- assert(idx < ARR_LEN(env->sched_info));
- env->sched_info[idx].num_not_sched_user = num;
-}
-
-/**
- * Add @p num to the number of not yet schedules users and returns the result.
- */
-static inline int add_irn_not_sched_user(block_sched_env_t *env, ir_node *n, int num)
-{
- unsigned const idx = get_irn_idx(n);
-
- assert(idx < ARR_LEN(env->sched_info));
- env->sched_info[idx].num_not_sched_user += num;
- return env->sched_info[idx].num_not_sched_user;
-}
-
-/**
- * Returns the number of users of a node having mode datab.
- */
-static int get_num_successors(ir_node *irn)
-{
- int sum = 0;
- const ir_edge_t *edge;
-
- if (get_irn_mode(irn) == mode_T) {
- /* for mode_T nodes: count the users of all Projs */
- foreach_out_edge(irn, edge) {
- ir_node *proj = get_edge_src_irn(edge);
- ir_mode *mode = get_irn_mode(proj);
-
- if (mode == mode_T) {
- sum += get_num_successors(proj);
- } else if (mode_is_datab(mode)) {
- sum += get_irn_n_edges(proj);
- }
- }
- }
- else {
- /* do not count keep-alive edges */
- foreach_out_edge(irn, edge) {
- if (get_irn_opcode(get_edge_src_irn(edge)) != iro_End)
- sum++;
- }
- }
-
- return sum;
-}
-
-/**
- * Adds irn to @p live, updates all inputs that this user is scheduled
- * and counts all of its non scheduled users.