projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Correct a subtle bug in the ia32 backend: Sub(x, x) triggered that the Neg+Add trick...
[libfirm]
/
ir
/
be
/
beifg_clique.c
diff --git
a/ir/be/beifg_clique.c
b/ir/be/beifg_clique.c
index
5a3eaf7
..
1976273
100644
(file)
--- a/
ir/be/beifg_clique.c
+++ b/
ir/be/beifg_clique.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 1995-200
7
University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-200
8
University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
*
* This file is part of libFirm.
*
@@
-24,9
+24,7
@@
* @date 18.11.2005
* @version $Id$
*/
* @date 18.11.2005
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
#include "config.h"
-#endif
#include <stdlib.h>
#include <stdlib.h>
@@
-38,12
+36,11
@@
#include "irgwalk.h"
#include "irbitset.h"
#include "irgwalk.h"
#include "irbitset.h"
-#include "bearch
_t
.h"
+#include "bearch.h"
#include "be_t.h"
#include "beintlive_t.h"
#include "beifg_t.h"
#include "bechordal_t.h"
#include "be_t.h"
#include "beintlive_t.h"
#include "beifg_t.h"
#include "bechordal_t.h"
-#include "benodesets.h"
typedef struct _cli_head_t {
struct list_head list;
typedef struct _cli_head_t {
struct list_head list;
@@
-82,18
+79,18
@@
static cli_head_t *get_new_cli_head(ifg_clique_t *ifg)
if (ifg->cli_root == NULL)
{
if (ifg->cli_root == NULL)
{
- new_cli_head =
obstack_alloc(&ifg->obst, sizeof(*new_cli_head)
);
+ new_cli_head =
OALLOC(&ifg->obst, cli_head_t
);
INIT_LIST_HEAD(&new_cli_head->list);
ifg->cli_root = new_cli_head;
}
else
{
cli_head = ifg->cli_root;
INIT_LIST_HEAD(&new_cli_head->list);
ifg->cli_root = new_cli_head;
}
else
{
cli_head = ifg->cli_root;
- while(!(cli_head->next_cli_head == NULL))
+ while
(!(cli_head->next_cli_head == NULL))
{
cli_head = cli_head->next_cli_head;
}
{
cli_head = cli_head->next_cli_head;
}
- new_cli_head =
obstack_alloc(&ifg->obst, sizeof(*new_cli_head)
);
+ new_cli_head =
OALLOC(&ifg->obst, cli_head_t
);
INIT_LIST_HEAD(&new_cli_head->list);
cli_head->next_cli_head = new_cli_head;
}
INIT_LIST_HEAD(&new_cli_head->list);
cli_head->next_cli_head = new_cli_head;
}
@@
-110,13
+107,13
@@
static cli_element_t *get_new_cli_element(ifg_clique_t *ifg)
{
cli_element_t *cli_element;
{
cli_element_t *cli_element;
- cli_element =
obstack_alloc(&ifg->obst, sizeof(*cli_element)
);
+ cli_element =
OALLOC(&ifg->obst, cli_element_t
);
INIT_LIST_HEAD(&cli_element->list);
return cli_element;
}
INIT_LIST_HEAD(&cli_element->list);
return cli_element;
}
-static void write_clique(
nodese
t *live_set, ifg_clique_t *ifg)
+static void write_clique(
ir_nodeset_
t *live_set, ifg_clique_t *ifg)
{
ir_node *live_irn;
ir_node *test_node;
{
ir_node *live_irn;
ir_node *test_node;
@@
-127,8
+124,9
@@
static void write_clique(nodeset *live_set, ifg_clique_t *ifg)
cli_element_t *element = NULL;
cli_head_t *cli_head = get_new_cli_head(ifg);
int is_element = 0;
cli_element_t *element = NULL;
cli_head_t *cli_head = get_new_cli_head(ifg);
int is_element = 0;
+ ir_nodeset_iterator_t iter;
- foreach_
nodeset(live_set, live_irn
)
+ foreach_
ir_nodeset(live_set, live_irn, iter
)
{
/* test if node is max or min dominator*/
test_node = live_irn;
{
/* test if node is max or min dominator*/
test_node = live_irn;
@@
-152,7
+150,7
@@
static void write_clique(nodeset *live_set, ifg_clique_t *ifg)
}
list_for_each_entry(cli_element_t, element, &cli_head->list, list){
}
list_for_each_entry(cli_element_t, element, &cli_head->list, list){
- if(element->irn == live_irn){
+ if
(element->irn == live_irn){
is_element = 1;
break;
}
is_element = 1;
break;
}
@@
-270,8
+268,6
@@
static void find_nodes(const ifg_clique_t *ifg, cli_iter_t *it)
element = list_entry(cli_head->list.next, cli_element_t, list);
it->curr_cli_element = element;
}
element = list_entry(cli_head->list.next, cli_element_t, list);
it->curr_cli_element = element;
}
-
- return;
}
static ir_node *get_next_node(cli_iter_t *it)
}
static ir_node *get_next_node(cli_iter_t *it)
@@
-327,10
+323,12
@@
static void find_neighbour_walker(ir_node *bl, void *data)
{
ifg_clique_t *ifg = data;
struct list_head *head = get_block_border_head(ifg->env, bl);
{
ifg_clique_t *ifg = data;
struct list_head *head = get_block_border_head(ifg->env, bl);
- int was_def = 0;
-
nodeset *live = new_nodeset(ifg->env->cls->n_regs)
;
+ int
was_def = 0;
+
ir_nodeset_t live
;
border_t *b;
border_t *b;
+ ir_nodeset_init(&live);
+
assert(is_Block(bl) && "There is no block to work on.");
foreach_border_head(head, b) /* follow the borders of the block */
assert(is_Block(bl) && "There is no block to work on.");
foreach_border_head(head, b) /* follow the borders of the block */
@@
-339,8
+337,8
@@
static void find_neighbour_walker(ir_node *bl, void *data)
if (b->is_def) /* b is a new node */
{
if (b->is_def) /* b is a new node */
{
-
nodeset_insert(
live, irn);
- if(b->is_real)
+
ir_nodeset_insert(&
live, irn);
+ if
(b->is_real)
{
was_def = 1;
}
{
was_def = 1;
}
@@
-349,13
+347,13
@@
static void find_neighbour_walker(ir_node *bl, void *data)
{
if (was_def == 1) /* if there is a USE after a DEF... */
{
{
if (was_def == 1) /* if there is a USE after a DEF... */
{
- write_clique(live, ifg); /* ...add the clique. */
+ write_clique(
&
live, ifg); /* ...add the clique. */
was_def = 0;
}
was_def = 0;
}
-
nodeset_remove(
live, irn);
+
ir_nodeset_remove(&
live, irn);
}
}
}
}
-
del_nodeset(
live);
+
ir_nodeset_destroy(&
live);
}
static void find_first_neighbour(const ifg_clique_t *ifg, cli_iter_t *it, const ir_node *irn)
}
static void find_first_neighbour(const ifg_clique_t *ifg, cli_iter_t *it, const ir_node *irn)
@@
-391,7
+389,7
@@
static void find_first_neighbour(const ifg_clique_t *ifg, cli_iter_t *it, const
}
}
}
}
}
}
- if(!is_in_clique)
+ if
(!is_in_clique)
{
cli_head = get_next_cli_head(irn, it);
element = get_next_element(irn, it);
{
cli_head = get_next_cli_head(irn, it);
element = get_next_element(irn, it);
@@
-399,8
+397,6
@@
static void find_first_neighbour(const ifg_clique_t *ifg, cli_iter_t *it, const
it->curr_cli_element = element;
it->curr_irn = irn;
it->curr_cli_element = element;
it->curr_irn = irn;
-
- return;
}
static ir_node *get_next_neighbour(cli_iter_t *it)
}
static ir_node *get_next_neighbour(cli_iter_t *it)
@@
-472,16
+468,16
@@
static ir_node *ifg_clique_neighbours_begin(const void *self, void *iter, const
static ir_node *ifg_clique_neighbours_next(const void *self, void *iter)
{
static ir_node *ifg_clique_neighbours_next(const void *self, void *iter)
{
+ (void) self;
return get_next_neighbour(iter);
}
static void ifg_clique_neighbours_break(const void *self, void *iter)
{
cli_iter_t *it = iter;
return get_next_neighbour(iter);
}
static void ifg_clique_neighbours_break(const void *self, void *iter)
{
cli_iter_t *it = iter;
+ (void) self;
bitset_free(it->visited_neighbours);
bitset_free(it->visited_neighbours);
-
- return;
}
static ir_node *ifg_clique_nodes_begin(const void *self, void *iter)
}
static ir_node *ifg_clique_nodes_begin(const void *self, void *iter)
@@
-492,16
+488,16
@@
static ir_node *ifg_clique_nodes_begin(const void *self, void *iter)
static ir_node *ifg_clique_nodes_next(const void *self, void *iter)
{
static ir_node *ifg_clique_nodes_next(const void *self, void *iter)
{
+ (void) self;
return get_next_node(iter);
}
static void ifg_clique_nodes_break(const void *self, void *iter)
{
cli_iter_t *it = iter;
return get_next_node(iter);
}
static void ifg_clique_nodes_break(const void *self, void *iter)
{
cli_iter_t *it = iter;
+ (void) self;
bitset_free(it->visited_nodes);
bitset_free(it->visited_nodes);
-
- return;
}
static int ifg_clique_degree(const void *self, const ir_node *irn)
}
static int ifg_clique_degree(const void *self, const ir_node *irn)
@@
-541,7
+537,7
@@
static const be_ifg_impl_t ifg_clique_impl = {
be_ifg_t *be_ifg_clique_new(const be_chordal_env_t *env)
{
be_ifg_t *be_ifg_clique_new(const be_chordal_env_t *env)
{
- ifg_clique_t *ifg =
xmalloc(sizeof(*ifg)
);
+ ifg_clique_t *ifg =
XMALLOC(ifg_clique_t
);
ifg->impl = &ifg_clique_impl;
ifg->env = env;
ifg->impl = &ifg_clique_impl;
ifg->env = env;