X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fst%2Fst.c;h=e1204c3101ce2a35cd1db481584aeb8fc2fc077d;hb=0850a3224410b24400a5552feff23cf85bf443c3;hp=38f7ece9e366a406b07d22c5eafd6bc151df5474;hpb=72a90e4127b0c4f4cba1df4466e6269c31221693;p=libfirm diff --git a/ir/st/st.c b/ir/st/st.c index 38f7ece9e..e1204c310 100644 --- a/ir/st/st.c +++ b/ir/st/st.c @@ -1,7 +1,14 @@ -/* Copyright (c) 2002 by Universität Karlsruhe (TH). All Rights Reserved */ /* -* Time-stamp: -*/ + * Project: libFIRM + * File name: ir/st/st.c + * Purpose: Provide some auxilliary structures for firm graphs. + * Author: Florian Liekweg + * Modified by: + * Created: 26.2.2002 + * CVS-ID: $Id$ + * Copyright: (c) 2002-2003 Universität Karlsruhe + * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + */ /** NAME @@ -10,28 +17,27 @@ provide some auxilliary structures for firm graphs. S not quite complete - HISTORY - liekweg - Feb 26, 2002: Created. - CVS: - $Id$ ***/ #ifdef HAVE_CONFIG_H #include "config.h" #endif -# include "st.h" +# include -# include "irgwalk.h" +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_MALLOC_H +# include +#endif -# include -# ifdef DEBUG_libfirm -# endif /* def DEBUG_libfirm */ -# include -# include "misc.h" +# include "st.h" +# include "irgwalk.h" +# include "xmalloc.h" /* init globals: */ -static dtree_t *trees = 0; +/*static*/ dtree_t *trees = 0; /* static dtree_t *last = 0; */ @@ -52,7 +58,7 @@ static void count_block (ir_node *block, void *env) # endif /* def DEBUG_libfirm */ fprintf (stdout, "%s: Block(%p) has # (%i)\n", - __FILE__ ":count_block", block, *n); + __FILE__ ":count_block", (void *)block, *n); (*n) ++; } @@ -74,7 +80,7 @@ static int get_n_blocks (ir_graph *graph) irg_block_walk (end_block, count_block, NULL, &n); fprintf (stdout, "%s: Graph(%p) has (%i) blocks\n", - __FILE__ ":get_n_blocks", graph, n); + __FILE__ ":get_n_blocks", (void *)graph, n); return (n); } @@ -113,9 +119,9 @@ static dt_t *new_dt (ir_graph *graph) res->n_blocks = n_blocks; res->graph = graph; - res->blocks = (ir_node**) calloc (n_blocks, sizeof (ir_node*)); - res->idoms = (ir_node**) calloc (n_blocks, sizeof (ir_node*)); - res->masks = (bs_t*) calloc (n_blocks, sizeof (bs_t)); + res->blocks = calloc(n_blocks, sizeof(*res->blocks)); + res->idoms = calloc(n_blocks, sizeof(*res->idoms)); + res->masks = calloc(n_blocks, sizeof(*res->masks)); assert (res && "no dt"); @@ -319,7 +325,7 @@ static void update_dominators (ir_node *block, void *env) /* check preds: */ for (i = 0; i < n_ins; i ++) { - ir_node *in = get_nodes_Block (get_irn_n (block, i)); + ir_node *in = get_nodes_block (get_irn_n (block, i)); bs_t in_mask = get_mask (dt, in); new_mask &= in_mask; @@ -378,7 +384,7 @@ static ir_node *_get_idom (dt_t *dt, ir_node *block) { ir_node *ndom = 0; - pred = get_nodes_Block (get_irn_n (block, i)); + pred = get_nodes_block (get_irn_n (block, i)); ndom = _get_idom (dt, pred); if (ndom != idom) @@ -432,7 +438,7 @@ ir_node *get_idom (ir_graph *g, ir_node *a) */ dom_env_t *get_dom_env (ir_graph *graph, ir_node *a) { - dom_env_t *env = (dom_env_t*) calloc (1, sizeof (dom_env_t)); + dom_env_t *env = calloc(1, sizeof(*env)); env->graph = graph; env->dt = get_dominator_tree (graph);