Commit 36fc5bb2 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

bechordal: Remove the attribute other_end from struct border_t.

It is only used to draw interference graphs, where it can be derived locally.
parent ecfcdc3a
......@@ -29,55 +29,19 @@
#include "bemodule.h"
#include "belive.h"
#include "belive_t.h"
#include "fourcc.h"
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
/* Make a fourcc for border checking. */
#define BORDER_FOURCC FOURCC('B', 'O', 'R', 'D')
static inline border_t *border_add(be_chordal_env_t *const env, struct list_head *const head, ir_node *const irn, unsigned const step, unsigned const is_def, unsigned const is_real)
{
border_t *b;
if (!is_def) {
border_t *def;
b = OALLOC(&env->obst, border_t);
/* also allocate the def and tie it to the use. */
def = OALLOCZ(&env->obst, border_t);
b->other_end = def;
def->other_end = b;
/*
* Set the link field of the irn to the def.
* This strongly relies on the fact, that the use is always
* made before the def.
*/
set_irn_link(irn, def);
DEBUG_ONLY(b->magic = BORDER_FOURCC;)
DEBUG_ONLY(def->magic = BORDER_FOURCC;)
} else {
/*
* If the def is encountered, the use was made and so was the
* the def node (see the code above). It was placed into the
* link field of the irn, so we can get it there.
*/
b = (border_t*)get_irn_link(irn);
DEBUG_ONLY(assert(b && b->magic == BORDER_FOURCC && "Illegal border encountered");)
}
b->is_def = is_def;
border_t *const b = OALLOC(&env->obst, border_t);
b->is_def = is_def;
b->is_real = is_real;
b->irn = irn;
b->step = step;
b->irn = irn;
b->step = step;
list_add_tail(&b->list, head);
DBG((dbg, LEVEL_5, "\t\t%s adding %+F, step: %d\n", is_def ? "def" : "use", irn, step));
return b;
}
......
......@@ -299,14 +299,20 @@ static void draw_block(ir_node *bl, void *data)
foreach_border_head(head, b) {
if (b->is_def) {
const arch_register_t *reg = arch_get_irn_register(b->irn);
int live_out = be_is_live_out(lv, bl, b->irn);
/* Walk from def to use, so the link is set before retrieved. */
set_irn_link(b->irn, b);
} else {
ir_node *const irn = b->irn;
border_t const *const def = (border_t const*)get_irn_link(irn);
arch_register_t const *const reg = arch_get_irn_register(irn);
int live_out = be_is_live_out(lv, bl, irn);
int x = (reg->index + 1) * opts->h_inter_gap;
int ystart = (b->step) * opts->v_inter_gap;
int ystop = (b->other_end->step) * opts->v_inter_gap + (live_out ? 0 : opts->v_inter_gap / 2);
int ystart = def->step * opts->v_inter_gap;
int ystop = b->step * opts->v_inter_gap + (live_out ? 0 : opts->v_inter_gap / 2);
color_t color;
reg_to_color(env, bl, b->irn, &color);
reg_to_color(env, bl, irn, &color);
x += dims->box.x;
ystart += dims->box.y;
......@@ -354,7 +360,9 @@ static void draw(draw_chordal_env_t *env, const rect_t *start_box)
be_assure_live_chk(irg);
p->vtab->begin(p, &bbox);
irg_block_walk_graph(env->chordal_env->irg, draw_block, NULL, env);
ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK);
irg_block_walk_graph(irg, draw_block, NULL, env);
ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
p->vtab->finish(p);
}
......
......@@ -26,9 +26,7 @@
* A liveness interval border.
*/
struct border_t {
DEBUG_ONLY(unsigned magic;) /**< A magic number for checking. */
struct list_head list; /**< list head for queuing. */
border_t *other_end; /**< The other end of the border. */
ir_node *irn; /**< The node. */
unsigned step; /**< The number equal to the interval border. */
unsigned is_def : 1; /**< Does this border denote a use or a def. */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment