replaced variable args macros by functions to make it c89 compatible
[libfirm] / ir / ana / irscc.c
index 7983cc8..5bd56b2 100644 (file)
@@ -1,14 +1,15 @@
-/* Copyright (C) 2002 by Universitaet Karlsruhe
-* All rights reserved.
-*
-* Authors:  Goetz Lindenmaier
-*
-* irscc.c  Computing the strongly connected regions and building
-* backedge/loop datastructures.
-*
-*/
-
-/* $Id$ */
+/*
+ * Project:     libFIRM
+ * File name:   ir/ana/irscc.c
+ * Purpose:     Compute the strongly connected regions and build
+ *              backedge/loop datastructures.
+ * Author:      Goetz Lindenmaier
+ * Modified by:
+ * Created:     7.2002
+ * CVS-ID:      $Id$
+ * Copyright:   (c) 2002-2003 Universität Karlsruhe
+ * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ */
 
 #include <string.h>
 
@@ -16,7 +17,6 @@
 #include "irnode.h"
 #include "irgraph_t.h"
 #include "array.h"
-#include "xprintf.h"
 #include "irgwalk.h"
 #include "irprog.h"
 
@@ -164,7 +164,7 @@ static INLINE void free_stack(void) {
 static INLINE void
 push (ir_node *n)
 {
-  //DDMN(n);
+  /*DDMN(n);*/
 
   if (tos == ARR_LEN (stack)) {
     int nlen = ARR_LEN (stack) * 2;
@@ -302,9 +302,11 @@ ir_loop *get_loop_son (ir_loop *loop, int pos) {
 
 static INLINE void
 add_loop_son(ir_loop *loop, ir_loop *son) {
+  loop_element lson;
+  lson.son = son;
   assert(loop && loop->kind == k_ir_loop);
   assert(get_kind(son) == k_ir_loop);
-  ARR_APP1 (loop_element, loop->children, (loop_element) son);
+  ARR_APP1 (loop_element, loop->children, lson);
   loop -> n_sons++;
 }
 
@@ -339,9 +341,11 @@ ir_node *get_loop_node (ir_loop *loop, int pos) {
 
 static INLINE void
 add_loop_node(ir_loop *loop, ir_node *n) {
+  loop_element ln;
+  ln.node=n;
   assert(loop && loop->kind == k_ir_loop);
   assert(get_kind(n) == k_ir_node);
-  ARR_APP1 (loop_element, loop->children, (loop_element) n);
+  ARR_APP1 (loop_element, loop->children, ln);
   loop->n_nodes++;
 }
 
@@ -518,12 +522,10 @@ find_irg_on_stack (ir_node *n) {
     }
     if (i < 0) i = tos;
 
-    //printf(" Here\n");
-
     assert (i >= 0);
     for (; i >= 0; i--) {
       m = stack[i];
-      //printf(" Visiting %d ", i); DDMN(m);
+      /*printf(" Visiting %d ", i); DDMN(m);*/
       if (is_ip_cfop(m)) {
        current_ir_graph = get_irn_irg(m);
        break;
@@ -684,8 +686,8 @@ static void scc (ir_node *n) {
 
   if (irn_visited(n)) return;
   mark_irn_visited(n);
-  //printf("mark: %d ", get_irn_visited(n)); DDMN(n);
-  //DDME(get_irg_ent(current_ir_graph));
+  /*printf("mark: %d ", get_irn_visited(n)); DDMN(n);
+  DDME(get_irg_ent(current_ir_graph));*/
 
   /* Initialize the node */
   set_irn_dfn(n, current_dfn);      /* Depth first number for this node */
@@ -704,10 +706,10 @@ static void scc (ir_node *n) {
       ir_node *m;
       if (is_backedge(n, i)) continue;
 
-      m = get_irn_n(n, i); //get_irn_ip_pred(n, i);
+      m = get_irn_n(n, i); /*get_irn_ip_pred(n, i);*/
       if ((!m) || (get_irn_op(m) == op_Unknown)) continue;
       scc (m);
-      //return_recur(n, i);
+      /*return_recur(n, i);*/
 
       if (irn_is_in_stack(m)) {
        /* Uplink of m is smaller if n->m is a backedge.
@@ -809,12 +811,12 @@ void construct_ip_backedges (void) {
   for (i = 0; i < get_irp_n_irgs(); i++) {
     ir_node *sb;
     current_ir_graph = get_irp_irg(i);
-    //DDME(get_irg_ent(current_ir_graph));
+    /*DDME(get_irg_ent(current_ir_graph));*/
     /* Find real entry points */
     sb = get_irg_start_block(current_ir_graph);
     if ((get_Block_n_cfgpreds(sb) > 1) ||
        (get_nodes_Block(get_Block_cfgpred(sb, 0)) != sb)) continue;
-    //    printf("running scc for "); DDME(get_irg_ent(current_ir_graph));
+    /*    printf("running scc for "); DDME(get_irg_ent(current_ir_graph));   */
     /* Compute scc for this graph */
     outermost_ir_graph = current_ir_graph;
     set_irg_visited(outermost_ir_graph, get_max_irg_visited());