- bitset_t *in_colors; /**< Colors used by live in values. */
- int colors_n; /**< The number of colors. */
-} env_t;
-
-
-typedef struct _be_chordal_dump_params_t {
- int x_dist;
- int y_dist;
- double font_scale;
-} be_chordal_dump_params_t;
-
-static const be_chordal_dump_params_t dump_params = {
- 30,
- 10,
- 4
-};
-
-#ifdef DUMP_INTERVALS
-static void draw_interval_graphs(ir_node *block,
- struct list_head *border_head,
- const be_chordal_dump_params_t *params)
-{
- int i;
- int x_dist = params->x_dist;
- int y_dist = params->y_dist;
- ir_graph *irg = get_irn_irg(block);
-
- FILE *f;
- char buf[1024];
-
- ir_snprintf(buf, sizeof(buf), "intv_%s_bl%N.eps",
- get_entity_name(get_irg_entity(irg)), block);
-
- if((f = fopen(buf, "wt")) != NULL) {
- border_t *b;
- int *seen = xcalloc(get_graph_node_count(irg), sizeof(seen[0]));
- int last_pos = list_empty(border_head) ? 0 : list_entry(border_head->prev, border_t, list)->step;
- int max_col = 0;
-
- list_for_each_entry_reverse(border_t, b, border_head, list) {
- const ir_node *irn = b->irn;
- int col = get_irn_color(irn);
- max_col = max_col > col ? max_col : col;
- }
-
- fprintf(f, "%%!PS-Adobe-2.0\n");
- fprintf(f, "%%%%BoundingBox: -10 -10 %d %d\n",
- x_dist * last_pos + x_dist, y_dist * max_col + y_dist);
- fprintf(f, "/mainfont /Courier findfont %f scalefont def\n", params->font_scale);
- fprintf(f, "mainfont setfont\n");
- fprintf(f, "0.2 setlinewidth\n");
-
- for(i = 0; i <= last_pos; ++i) {
- fprintf(f, "0 0 0 setrgbcolor\n");
- fprintf(f, "%d %d moveto\n", i * x_dist, -2);
- fprintf(f, "%d %d lineto\n", i * x_dist, max_col * y_dist + 2);
- fprintf(f, "stroke\n");
- }
- fprintf(f, "0.5 setlinewidth\n");
-
- list_for_each_entry_reverse(border_t, b, border_head, list) {
- const ir_node *irn = b->irn;
- int nr = get_irn_graph_nr(irn);
-
- if(b->is_def)
- seen[nr] = b->step;
- else {
- int col = get_irn_color(irn);
-
- int pos = last_pos - seen[nr];
- int end_pos = last_pos - b->step;
- int live_in = is_live_in(block, irn);
- int live_end = is_live_end(block, irn);
- int y_val = y_dist * col;
-
- int red = 0;
- int green = live_end;
- int blue = live_in;
-
- fprintf(f, "0 0 0 setrgbcolor\n");
- fprintf(f, "%d %d moveto\n", x_dist * pos + 2, y_val + 2);
- ir_fprintf(f, "(%n/%d%s) show\n", irn, nr, is_phi_operand(irn) ? "*" : "");
- fprintf(f, "%d %d %d setrgbcolor\n", red, green, blue);
- fprintf(f, "%d %d moveto\n", x_dist * pos, y_val);
- fprintf(f, "%d %d lineto\n", (x_dist * end_pos) - 5, y_val);
- fprintf(f, "stroke\n");
- }
- }
-
- free(seen);
- fclose(f);
- }
-}
-#endif
-
-#if 0
-typedef struct _tree_layout_info_t {
- ir_node *block;
- int is_child;
- int child_slot;
- unsigned x;
- unsigned y;
- int steps;
-} tree_layout_info_t;
-
-typedef struct _tree_layout_params_t {
- int interval_dist;
- int x_block_dist;
- int y_block_dist;
- int step_len;
-} tree_layout_params_t;
-
-static const tree_layout_params_t tree_layout_params = {
- 10, 20, 20, 5
-};
-
-static void dump_tree_collect(ir_node *block, void *env)
-{
- ir_block *curr;
- struct list_head *border_head;
-
- int pre_num = get_Block_dom_tree_pre_num(block);
- tree_layout_info_t *info = env;
- tree_layout_info_t *i = &info[pre_num];
-
- i->block = block;
- i->child_slot = -1;
- i->steps = list_empty(border_head) ? 0 : list_entry(border_head->prev, border_t, list)->step;
- i->is_child = 1;
-
- dominates_for_each(block, curr)
- i->is_child = 0;
-}
-
-static void dump_tree_assign_x(ir_node *block, void *env)
-{
- unsigned min_x = -1, max_x = 0;
- int n_childs = 0;
- ir_block *curr;
-
- int pre_num = get_Block_dom_tree_pre_num(block);
- tree_layout_info_t *info = env;
- tree_layout_info_t *i = &info[pre_num];
-
- if(i->is_child)
- return;
-
- dominates_for_each(block, curr) {
- tree_layout_info_t *ci = &info[get_Block_dom_tree_pre_num(curr)];
- max_x = MAX(max_x, ci->x);
- min_x = MIN(min_x, ci->x);
- n_childs++;
- }
-
- i->x = (max_x - mix_x) / n_childs;
-}
-
-static void dump_tree_assign_y(ir_node *block, void *env)
-{
- unsigned min_x = -1, max_x = 0;
- int n_childs = 0;
- ir_block *curr;
-
- int pre_num = get_Block_dom_tree_pre_num(block);
- tree_layout_info_t *info = env;
- tree_layout_info_t *i = &info[pre_num];
- ir_block *idom = get_Block_idom(block);
-
- i->y = 0;
- if(idom) {
- tree_layout_info_t *idom_info = &info[get_Block_dom_tree_pre_num(idom)];
- i->y = idom_info->y + idom_info->steps * params->step_len + params->y_dist;
- }
-}
-
-static void draw_block(ir_block *bl, void *env)
-{
-}
-
-static void dump_interval_tree(ir_graph *irg, const tree_layout_params_t *params)
-{
- int i, slot;
- int n_blocks = get_Block_dom_max_subtree_pre_num(get_irg_start_block(irg));
- tree_layout_info_t *info = malloc(sizeof(info[0]) * n_blocks);
-
- /* Fill the info array. */
- dom_tree_walk_irg(irg, NULL, dump_tree_collect, info);
-
- /* Assign the child slots. */
- for(i = 0, slot = 0; i < n_blocks; ++i) {
- tree_layout_info_t *i = &info[i];
- if(i->is_child) {
- i->child_slot = slot++;
- i->x = i->child_slot * params->max_color * params->interval_dist + params->block_dist;
- }
- }
-
- dom_tree_walk_irg(irg, NULL, dump_tree_assign_xy, info);
-
- free(info);
-}
-#endif
-
-#ifdef BUILD_GRAPH