extended functionality
[libfirm] / ir / ana / irouts.c
index a0d61fc..3ebce10 100644 (file)
   * Authors:  Goetz Lindenmaier
   */
 
-/* $Id$ */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif /* defined HAVE_CONFIG_H */
+#endif
 
+#ifdef HAVE_STRING_H
+#include <string.h>
+#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();
 }