X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana%2Firouts.c;h=3ebce10d3a640b4590141a6de320f082098e8692;hb=4bad1346ff2abc3923beea23e5ac949acc7ca514;hp=a0d61fc0f0804ebb1a09e9e99f91faa4e713245a;hpb=5986f7ddfe03e8a10e214825653ed8fbf938049e;p=libfirm diff --git a/ir/ana/irouts.c b/ir/ana/irouts.c index a0d61fc0f..3ebce10d3 100644 --- a/ir/ana/irouts.c +++ b/ir/ana/irouts.c @@ -19,17 +19,20 @@ * Authors: Goetz Lindenmaier */ -/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" -#endif /* defined HAVE_CONFIG_H */ +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#include "xmalloc.h" #include "irouts.h" #include "irnode_t.h" #include "irgraph_t.h" #include "irprog_t.h" #include "irgwalk.h" -#include "string.h" #ifdef DEBUG_libfirm /* Note: ir_node.out_valid and ir_graph.n_outs are only present when DEBUG_libfirm is defined */ @@ -51,7 +54,7 @@ static void reset_outs (ir_node *node, void *unused) } /* returns the number of successors of the node: */ -INLINE int get_irn_n_outs (ir_node *node) { +int get_irn_n_outs (ir_node *node) { assert(node && node->kind == k_ir_node); #ifdef DEBUG_libfirm /* assert (node->out_valid); */ @@ -60,7 +63,7 @@ INLINE int get_irn_n_outs (ir_node *node) { } /* Access successor n */ -INLINE ir_node *get_irn_out (ir_node *node, int pos) { +ir_node *get_irn_out (ir_node *node, int pos) { assert(pos >= 0 && pos < get_irn_n_outs(node)); #ifdef DEBUG_libfirm /* assert (node->out_valid); */ @@ -68,7 +71,7 @@ INLINE ir_node *get_irn_out (ir_node *node, int pos) { return node->out[pos+1]; } -INLINE void set_irn_out (ir_node *node, int pos, ir_node *out) { +void set_irn_out (ir_node *node, int pos, ir_node *out) { assert(node && out); assert(pos >= 0 && pos < get_irn_n_outs(node)); #ifdef DEBUG_libfirm @@ -78,7 +81,7 @@ INLINE void set_irn_out (ir_node *node, int pos, ir_node *out) { } -INLINE int get_Block_n_cfg_outs (ir_node *bl) { +int get_Block_n_cfg_outs (ir_node *bl) { int i, n_cfg_outs = 0; assert(bl && (get_irn_op(bl) == op_Block)); #ifdef DEBUG_libfirm @@ -92,7 +95,7 @@ INLINE int get_Block_n_cfg_outs (ir_node *bl) { } -INLINE ir_node *get_Block_cfg_out (ir_node *bl, int pos) { +ir_node *get_Block_cfg_out (ir_node *bl, int pos) { int i, out_pos = 0; assert(bl && (get_irn_op(bl) == op_Block)); #ifdef DEBUG_libfirm @@ -318,7 +321,7 @@ void compute_outs(ir_graph *irg) { n_out_edges = count_outs(get_irg_end(irg)); /* allocate memory for all out edges. */ - irg->outs = (ir_node **) xmalloc (n_out_edges * sizeof(ir_node *)); + irg->outs = xcalloc(n_out_edges, sizeof(irg->outs[0])); #ifdef DEBUG_libfirm irg->n_outs = n_out_edges; #endif /* defined DEBUG_libfirm */ @@ -467,7 +470,7 @@ void compute_ip_outs(void) { } global_count = n_out_edges = count_ip_outs(); - out_edges = (ir_node **) malloc (n_out_edges * sizeof(ir_node *)); + out_edges = xcalloc(n_out_edges, sizeof(out_edges[0])); set_irp_ip_outedges(out_edges); set_ip_outs(); }