small optimisation: we can still skip unsigned/signed convs in AM matching
[libfirm] / ir / be / beifg_std.c
index 37a6e25..a68a86f 100644 (file)
@@ -24,9 +24,7 @@
  * @date    18.11.2005
  * @version $Id$
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdlib.h>
 
 #include "irgwalk.h"
 #include "irtools.h"
 
-#include "bearch_t.h"
+#include "bearch.h"
 #include "be_t.h"
 #include "belive_t.h"
 #include "bera.h"
 #include "beifg_t.h"
+#include "beifg_impl.h"
 #include "bechordal_t.h"
-#include "beirg_t.h"
+#include "beirg.h"
 #include "beintlive_t.h"
 
 typedef struct _ifg_std_t ifg_std_t;
@@ -62,7 +61,7 @@ static void ifg_std_free(void *self)
 static int ifg_std_connected(const void *self, const ir_node *a, const ir_node *b)
 {
        const ifg_std_t *ifg = self;
-       return values_interfere(ifg->env->birg, a, b);
+       return be_values_interfere(ifg->env->birg->lv, a, b);
 }
 
 typedef struct _nodes_iter_t {
@@ -87,7 +86,8 @@ static void nodes_walker(ir_node *bl, void *data)
        }
 }
 
-static void find_nodes(const void *self, void *iter) {
+static void find_nodes(const void *self, void *iter)
+{
        const ifg_std_t *ifg = self;
        nodes_iter_t *it = iter;
 
@@ -101,9 +101,9 @@ static void find_nodes(const void *self, void *iter) {
        it->nodes = obstack_finish(&it->obst);
 }
 
-static INLINE void node_break(nodes_iter_t *it, int force)
+static inline void node_break(nodes_iter_t *it, int force)
 {
-       if((it->curr >= it->n || force) && it->nodes) {
+       if ((it->curr >= it->n || force) && it->nodes) {
                obstack_free(&it->obst, NULL);
                it->nodes = NULL;
        }
@@ -114,7 +114,7 @@ static ir_node *get_next_node(void *iter)
        nodes_iter_t *it = iter;
        ir_node *res     = NULL;
 
-       if(it->curr < it->n)
+       if (it->curr < it->n)
                res = it->nodes[it->curr++];
 
        node_break(it, 0);
@@ -156,23 +156,23 @@ static void find_neighbour_walker(ir_node *block, void *data)
        border_t *b;
        int has_started = 0;
 
-       if(!be_is_live_in(it->env->birg->lv, block, it->irn) && block != get_nodes_block(it->irn))
+       if (!be_is_live_in(it->env->birg->lv, block, it->irn) && block != get_nodes_block(it->irn))
                return;
 
        foreach_border_head(head, b) {
                ir_node *irn = b->irn;
 
-               if(irn == it->irn) {
-                       if(b->is_def)
+               if (irn == it->irn) {
+                       if (b->is_def)
                                has_started = 1;
                        else
                                break; /* if we reached the end of the node's lifetime we can safely break */
                }
-               else if(b->is_def) {
+               else if (b->is_def) {
                        /* if any other node than the one in question starts living, add it to the set */
                        ir_nodeset_insert(&it->neighbours, irn);
                }
-               else if(!has_started) {
+               else if (!has_started) {
                        /* we only delete, if the live range in question has not yet started */
                        ir_nodeset_remove(&it->neighbours, irn);
                }
@@ -192,7 +192,7 @@ static void find_neighbours(const ifg_std_t *ifg, adj_iter_t *it, const ir_node
        ir_nodeset_iterator_init(&it->iter, &it->neighbours);
 }
 
-static INLINE void neighbours_break(adj_iter_t *it, int force)
+static inline void neighbours_break(adj_iter_t *it, int force)
 {
        (void) force;
        assert(it->valid == 1);
@@ -200,7 +200,8 @@ static INLINE void neighbours_break(adj_iter_t *it, int force)
        it->valid = 0;
 }
 
-static ir_node *get_next_neighbour(adj_iter_t *it) {
+static ir_node *get_next_neighbour(adj_iter_t *it)
+{
        ir_node *res = ir_nodeset_iterator_next(&it->iter);
 
        if (res == NULL) {
@@ -238,25 +239,28 @@ typedef struct _cliques_iter_t {
        pset *living;
 } cliques_iter_t;
 
-static INLINE void free_clique_iter(cliques_iter_t *it) {
+static inline void free_clique_iter(cliques_iter_t *it)
+{
        it->n_blocks = -1;
        obstack_free(&it->ob, NULL);
        del_pset(it->living);
 }
 
-static void get_blocks_dom_order(ir_node *blk, void *env) {
+static void get_blocks_dom_order(ir_node *blk, void *env)
+{
        cliques_iter_t *it = env;
        obstack_ptr_grow(&it->ob, blk);
 }
 
-#define pset_foreach(pset, irn)  for(irn=pset_first(pset); irn; irn=pset_next(pset))
+#define pset_foreach(pset, irn)  for (irn=pset_first(pset); irn; irn=pset_next(pset))
 
 
 /**
  * NOTE: Be careful when changing this function!
  *       First understand the control flow of consecutive calls.
  */
-static INLINE int get_next_clique(cliques_iter_t *it) {
+static inline int get_next_clique(cliques_iter_t *it)
+{
 
        /* continue in the block we left the last time */
        for (; it->blk < it->n_blocks; it->blk++) {
@@ -372,7 +376,7 @@ static const be_ifg_impl_t ifg_std_impl = {
 
 be_ifg_t *be_ifg_std_new(const be_chordal_env_t *env)
 {
-       ifg_std_t *ifg = xmalloc(sizeof(*ifg));
+       ifg_std_t *ifg = XMALLOC(ifg_std_t);
 
        ifg->impl = &ifg_std_impl;
        ifg->env  = env;