constified is_Phi
[libfirm] / ir / ana / irouts.c
index d97e1da..6db0333 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,8 @@ 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) {
+INLINE int get_irn_n_outs    (ir_node *node) {
+  assert(node && node->kind == k_ir_node);
 #ifdef DEBUG_libfirm
   /* assert (node->out_valid); */
 #endif /* defined DEBUG_libfirm */
@@ -60,7 +64,6 @@ INLINE int get_irn_n_outs (ir_node *node) {
 
 /* Access successor n */
 INLINE ir_node *get_irn_out      (ir_node *node, int pos) {
-  assert(node);
   assert(pos >= 0 && pos < get_irn_n_outs(node));
 #ifdef DEBUG_libfirm
   /* assert (node->out_valid); */
@@ -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 = (ir_node **) xmalloc (n_out_edges * sizeof(ir_node *));
   set_irp_ip_outedges(out_edges);
   set_ip_outs();
 }