projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added C wrapper to Daniel's coalescing JAVA framework
[libfirm]
/
ir
/
be
/
beuses.c
diff --git
a/ir/be/beuses.c
b/ir/be/beuses.c
index
be79159
..
ed53fac
100644
(file)
--- a/
ir/be/beuses.c
+++ b/
ir/be/beuses.c
@@
-39,7
+39,6
@@
typedef struct _be_use_t {
const ir_node *bl;
const ir_node *irn;
unsigned next_use;
const ir_node *bl;
const ir_node *irn;
unsigned next_use;
- int is_set;
} be_use_t;
struct _be_uses_t {
} be_use_t;
struct _be_uses_t {
@@
-49,19
+48,6
@@
struct _be_uses_t {
DEBUG_ONLY(firm_dbg_module_t *dbg;)
};
DEBUG_ONLY(firm_dbg_module_t *dbg;)
};
-
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-
-static INLINE unsigned sadd(unsigned a, unsigned b)
-{
- return a + b;
-}
-
-static INLINE unsigned sdiv(unsigned a, unsigned b)
-{
- return a / b;
-}
-
static int cmp_use(const void *a, const void *b, size_t n)
{
const be_use_t *p = a;
static int cmp_use(const void *a, const void *b, size_t n)
{
const be_use_t *p = a;
@@
-70,16
+56,18
@@
static int cmp_use(const void *a, const void *b, size_t n)
}
static INLINE be_use_t *get_or_set_use(be_uses_t *uses,
}
static INLINE be_use_t *get_or_set_use(be_uses_t *uses,
- const ir_node *bl, const ir_node *
irn
, unsigned next_use)
+ const ir_node *bl, const ir_node *
def
, unsigned next_use)
{
{
- unsigned hash = HASH_COMBINE(HASH_PTR(bl), HASH_PTR(
irn
));
+ unsigned hash = HASH_COMBINE(HASH_PTR(bl), HASH_PTR(
def
));
be_use_t templ;
be_use_t templ;
+ be_use_t* result;
templ.bl = bl;
templ.bl = bl;
- templ.irn = irn;
- templ.next_use = next_use;
- templ.is_set = 0;
- return set_insert(uses->uses, &templ, sizeof(templ), hash);
+ templ.irn = def;
+ templ.next_use = be_get_next_use(uses, sched_first(bl), 0, def, 0);
+ result = set_insert(uses->uses, &templ, sizeof(templ), hash);
+
+ return result;
}
unsigned be_get_next_use(be_uses_t *uses, const ir_node *from,
}
unsigned be_get_next_use(be_uses_t *uses, const ir_node *from,
@@
-88,14
+76,8
@@
unsigned be_get_next_use(be_uses_t *uses, const ir_node *from,
static unsigned get_next_use_bl(be_uses_t *uses, const ir_node *bl,
const ir_node *def)
{
static unsigned get_next_use_bl(be_uses_t *uses, const ir_node *bl,
const ir_node *def)
{
- be_use_t *u;
-
- u = get_or_set_use(uses, bl, def, 0);
- if(!u->is_set) {
- u->is_set = 1;
- u->next_use = USES_INFINITY;
- u->next_use = be_get_next_use(uses, sched_first(bl), 0, def, 0);
- }
+ be_use_t *u = get_or_set_use(uses, bl, def, 0);
+
return u->next_use;
}
return u->next_use;
}
@@
-113,11
+95,11
@@
static unsigned get_next_use(be_uses_t *uses, const ir_node *from, unsigned from
sched_foreach_from(from, irn) {
int i, n;
sched_foreach_from(from, irn) {
int i, n;
- if
(!
skip_from_uses) {
- for(i = 0, n = get_irn_arity(irn); i < n; ++i) {
+ if
(!
skip_from_uses) {
+ for
(i = 0, n = get_irn_arity(irn); i < n; ++i) {
ir_node *operand = get_irn_n(irn, i);
ir_node *operand = get_irn_n(irn, i);
- if(operand == def) {
+ if
(operand == def) {
DBG((uses->dbg, LEVEL_3, "found use of %+F at %+F\n", operand, irn));
return step;
}
DBG((uses->dbg, LEVEL_3, "found use of %+F at %+F\n", operand, irn));
return step;
}
@@
-128,6
+110,9
@@
static unsigned get_next_use(be_uses_t *uses, const ir_node *from, unsigned from
step++;
}
step++;
}
+ /* FIXME: quick and dirty hack to prevent ignore nodes (like stack pointer) from being spilled */
+ return is_live_end(bl, def) ? step : USES_INFINITY;
+
next_use = USES_INFINITY;
foreach_block_succ(bl, succ_edge) {
const ir_node *succ_bl = succ_edge->src;
next_use = USES_INFINITY;
foreach_block_succ(bl, succ_edge) {
const ir_node *succ_bl = succ_edge->src;