X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana%2Fabsgraph.c;h=efd9c0e315f2fdb751402d6d5f435d8b52ef3c55;hb=c25b0f5781313f72027722783ce6286978bdd757;hp=d64180459cc7dfe0b32f39b3787960f0db1f3eb7;hpb=73660ffae4a673bc11dba89455ecba9b80938298;p=libfirm diff --git a/ir/ana/absgraph.c b/ir/ana/absgraph.c index d64180459..efd9c0e31 100644 --- a/ir/ana/absgraph.c +++ b/ir/ana/absgraph.c @@ -1,13 +1,34 @@ +/* + * 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. + * + * 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. + */ + /** - * @file absgraph.c - * @date 20.04.2007 - * @author Sebastian Hack + * @file absgraph.c + * @author Sebastian Hack + * @date 20.04.2007 + * @version $Id$ + * @summary * * Abstract graph implementations for the CFG of a ir_graph. - * - * Copyright (C) 2007 Universitaet Karlsruhe - * Released under the GPL */ +#ifdef HAVE_CONFIG_H +#include +#endif #include "irgraph_t.h" #include "iredges_t.h" @@ -20,32 +41,51 @@ static void *irg_cfg_succ_get_root(void *self) return get_irg_start_block(irg); } +static void *irg_cfg_succ_get_end(void *self) +{ + ir_graph *irg = self; + return get_irg_end_block(irg); +} + static void irg_cfg_succ_grow_succs(void *self, void *node, struct obstack *obst) { ir_node *bl = node; const ir_edge_t *edge; - foreach_block_succ(bl, edge) + + (void) self; + foreach_block_succ(bl, edge) { obstack_ptr_grow(obst, get_edge_src_irn(edge)); + } } const absgraph_t absgraph_irg_cfg_succ = { irg_cfg_succ_get_root, - irg_cfg_succ_grow_succs + irg_cfg_succ_grow_succs, + irg_cfg_succ_get_end }; static void *irg_cfg_pred_get_root(void *self) { - return get_irg_end_block(self); + return get_irg_end_block((ir_graph*) self); +} + +static void *irg_cfg_pred_get_end(void *self) +{ + return get_irg_start_block((ir_graph*) self); } static void irg_cfg_pred_grow_succs(void *self, void *node, struct obstack *obst) { int i, n; - for (i = 0, n = get_irn_arity(node); i < n; ++i) + + (void) self; + for (i = 0, n = get_irn_arity(node); i < n; ++i) { obstack_ptr_grow(obst, get_irn_n(node, i)); + } } const absgraph_t absgraph_irg_cfg_pred = { irg_cfg_pred_get_root, - irg_cfg_pred_grow_succs + irg_cfg_pred_grow_succs, + irg_cfg_pred_get_end };