#include "irgraph_t.h"
#include "iredges_t.h"
#include "ircons.h"
+#include "irextbb.h"
#include "debug.h"
#include "bearch.h"
{
ir_node *irn;
sched_info_t *inf;
- sched_timestep_t step = 0;
+ sched_timestep_t step = SCHED_INITIAL_GRANULARITY;
sched_foreach(block, irn) {
inf = get_irn_sched_info(irn);
int sched_skip_cf_predicator(const ir_node *irn, void *data) {
arch_env_t *ae = data;
- return arch_irn_classify(ae, irn) == arch_irn_class_branch;
+ return arch_irn_class_is(ae, irn, branch);
}
int sched_skip_phi_predicator(const ir_node *irn, void *data) {
return curr;
}
-/** A simple forward single linked list. */
-typedef struct {
- ir_node *start; /**< start of the list */
- ir_node *end; /**< last block in the list */
- unsigned n_blks; /**< number of blocks in the list */
-} anchor;
-
-/**
- * Ext-Block walker: create a block schedule
- */
-static void create_block_list(ir_extblk *blk, void *env) {
- anchor *list = env;
- int i, n;
-
- for (i = 0, n = get_extbb_n_blocks(blk); i < n; ++i) {
- ir_node *block = get_extbb_block(blk, i);
-
- set_irn_link(block, NULL);
- if (list->start)
- set_irn_link(list->end, block);
- else
- list->start = block;
-
- list->end = block;
- ++list->n_blks;
- }
-}
-
-/*
- * Calculates a block schedule. The schedule is stored as a linked
- * list starting at the start_block of the irg.
- */
-ir_node **sched_create_block_schedule(ir_graph *irg)
-{
- anchor list;
- ir_node **blk_list, *b, *n;
- unsigned i;
-
- /* schedule extended basic blocks */
- compute_extbb(irg);
-
- list.start = NULL;
- list.end = NULL;
- list.n_blks = 0;
- irg_extblock_walk_graph(irg, NULL, create_block_list, &list);
-
- /** create an array, so we can go forward and backward */
- blk_list = NEW_ARR_D(ir_node *, irg->obst,list.n_blks);
-
- for (i = 0, b = list.start; b; b = n, ++i) {
- n = get_irn_link(b);
- set_irn_link(b, INT_TO_PTR(i));
-
- blk_list[i] = b;
- }
- return blk_list;
-}
+//---------------------------------------------------------------------------
typedef struct remove_dead_nodes_env_t_ {
ir_graph *irg;
static void remove_dead_nodes_walker(ir_node *block, void *data)
{
remove_dead_nodes_env_t *env = (remove_dead_nodes_env_t*) data;
- ir_node *node;
+ ir_node *node, *next;
- for(node = sched_first(block); !sched_is_end(node); ) {
- // get next node now, as after calling sched_remove it will be invalid
- ir_node* next = sched_next(node);
+ for(node = sched_first(block); !sched_is_end(node); node = next) {
int i, arity;
- if(bitset_is_set(env->reachable, get_irn_idx(node))) {
- node = next;
+ // get next node now, as after calling sched_remove it will be invalid
+ next = sched_next(node);
+
+ if(bitset_is_set(env->reachable, get_irn_idx(node)))
continue;
- }
- sched_remove(node);
arity = get_irn_arity(node);
for(i = 0; i < arity; ++i)
set_irn_n(node, i, new_r_Bad(env->irg));
- node = next;
+ sched_remove(node);
}
}