X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeifg_std.c;h=1ef6d1e34cbe634bc4b51e2fa24a1f91b5af0173;hb=1eaf5821fab81ac32af068f5db303a8074764ffa;hp=a9dd0cd0480f33d37da188823ff99c89cf621a30;hpb=c0acb5cc9a2967e31e2b2961a98831d674cea3b8;p=libfirm diff --git a/ir/be/beifg_std.c b/ir/be/beifg_std.c index a9dd0cd04..1ef6d1e34 100644 --- a/ir/be/beifg_std.c +++ b/ir/be/beifg_std.c @@ -1,15 +1,30 @@ -/** - * @file beifg_std.c - * @date 18.11.2005 - * @author Sebastian Hack +/* + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * + * This file is part of libFirm. + * + * This file may be distributed and/or modified under the terms of the + * GNU General Public License version 2 as published by the Free Software + * Foundation and appearing in the file LICENSE.GPL included in the + * packaging of this file. * - * Copyright (C) 2005 Universitaet Karlsruhe - * Released under the GPL + * Licensees holding valid libFirm Professional Edition licenses may use + * this file in accordance with the libFirm Commercial License. + * Agreement provided with the Software. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. */ -#ifdef HAVE_CONFIG_H +/** + * @file + * @brief Default ifg implementation. + * @author Sebastian Hack + * @date 18.11.2005 + * @version $Id$ + */ #include "config.h" -#endif #include @@ -19,19 +34,21 @@ #include "irnodeset.h" #include "irgraph_t.h" #include "irgwalk.h" +#include "irtools.h" +#include "bearch_t.h" #include "be_t.h" #include "belive_t.h" #include "bera.h" #include "beifg_t.h" #include "bechordal_t.h" - -#define MAX(x, y) ((x) > (y) ? (x) : (y)) +#include "beirg_t.h" +#include "beintlive_t.h" typedef struct _ifg_std_t ifg_std_t; struct _ifg_std_t { - const be_ifg_impl_t *impl; + const be_ifg_impl_t *impl; const be_chordal_env_t *env; }; @@ -43,27 +60,25 @@ 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; - be_lv_t *lv = ifg->env->birg->lv; - return values_interfere(lv, a, b); + return values_interfere(ifg->env->birg, a, b); } typedef struct _nodes_iter_t { const be_chordal_env_t *env; - struct obstack obst; - int n; - int curr; - ir_node **nodes; + struct obstack obst; + int n; + int curr; + ir_node **nodes; } nodes_iter_t; static void nodes_walker(ir_node *bl, void *data) { - nodes_iter_t *it = data; + nodes_iter_t *it = data; struct list_head *head = get_block_border_head(it->env, bl); - - border_t *b; + border_t *b; foreach_border_head(head, b) { - if(b->is_def && b->is_real) { + if (b->is_def && b->is_real) { obstack_ptr_grow(&it->obst, b->irn); it->n++; } @@ -84,7 +99,7 @@ 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) { obstack_free(&it->obst, NULL); @@ -113,11 +128,13 @@ static ir_node *ifg_std_nodes_begin(const void *self, void *iter) static ir_node *ifg_std_nodes_next(const void *self, void *iter) { + (void) self; return get_next_node(iter); } static void ifg_std_nodes_break(const void *self, void *iter) { + (void) self; node_break(iter, 1); } @@ -173,8 +190,9 @@ 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); ir_nodeset_destroy(&it->neighbours); it->valid = 0; @@ -183,6 +201,9 @@ static INLINE void neighbours_break(adj_iter_t *it, int force) static ir_node *get_next_neighbour(adj_iter_t *it) { ir_node *res = ir_nodeset_iterator_next(&it->iter); + if (res == NULL) { + ir_nodeset_destroy(&it->neighbours); + } return res; } @@ -195,11 +216,13 @@ static ir_node *ifg_std_neighbours_begin(const void *self, void *iter, const ir_ static ir_node *ifg_std_neighbours_next(const void *self, void *iter) { + (void) self; return get_next_neighbour(iter); } static void ifg_std_neighbours_break(const void *self, void *iter) { + (void) self; neighbours_break(iter, 1); } @@ -213,7 +236,7 @@ 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); @@ -231,7 +254,7 @@ static void get_blocks_dom_order(ir_node *blk, void *env) { * 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++) { @@ -305,11 +328,13 @@ static int ifg_std_cliques_begin(const void *self, void *iter, ir_node **buf) static int ifg_std_cliques_next(const void *self, void *iter) { + (void) self; return get_next_clique(iter); } static void ifg_std_cliques_break(const void *self, void *iter) { + (void) self; free_clique_iter(iter); } @@ -345,7 +370,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;