Remove C99 constructs, some tabs
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 24 Mar 2004 14:20:07 +0000 (14:20 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 24 Mar 2004 14:20:07 +0000 (14:20 +0000)
[r2558]

ir/ir/irdump.c
ir/ir/irgmod.c
ir/ir/irgopt.c
ir/ir/irnode.c

index b0ad1b3..4cb1717 100644 (file)
@@ -1856,66 +1856,61 @@ void dump_loops_standalone (ir_loop *loop) {
   dump_loop_node(loop);
 
   /* Dump the loop elements. */
   dump_loop_node(loop);
 
   /* Dump the loop elements. */
-  for(i = 0; i < get_loop_n_elements(loop); i++)
-    {
-      le = get_loop_element(loop, i);
+  for(i = 0; i < get_loop_n_elements(loop); i++) {
+    ir_loop *son;
 
 
-      ir_loop *son = le.son;
-      if (get_kind(son) == k_ir_loop)
-       {
-         /* We are a loop son -> Recurse */
-
-         if(loop_node_started) /* Close the "firm-nodes" node first if we started one. */
-           {
-             fprintf(F, "\" }\n");
-             fprintf (F, "edge: {sourcename: \"");
-             PRINT_LOOPID(loop);
-             fprintf (F, "\" targetname: \"");
-             PRINT_LOOPID(loop);
-             fprintf (F, "-%d-nodes\" label:\"%d...%d\"}\n", first, first, i-1);
-             loop_node_started = 0;
-           }
-         dump_loop_son_edge(loop, son_number++);
-         dump_loops_standalone(son);
-       }
-      else
-       {
-         /* We are a loop node -> Collect firm nodes */
-
-         ir_node *n = le.node;
-
-         if (!loop_node_started)
-           {
-             /* Start a new node which contains all firm nodes of the current loop */
-             fprintf (F, "node: { title: \"");
-             PRINT_LOOPID(loop);
-             fprintf (F, "-%d-nodes\" color: lightyellow label: \"", i);
-             loop_node_started = 1;
-             first = i;
-           }
-         else
-           fprintf(F, "\n");
+    le = get_loop_element(loop, i);
 
 
-         dump_node_opcode(n);
-         dump_node_mode (n);
-         dump_node_typeinfo(n);
-         fprintf (F, " ");
-         dump_node_nodeattr(n);
-         fprintf (F, " %ld", get_irn_node_nr(n));
+    son = le.son;
+    if (get_kind(son) == k_ir_loop) {
+      /* We are a loop son -> Recurse */
 
 
-       }
+      if(loop_node_started) { /* Close the "firm-nodes" node first if we started one. */
+       fprintf(F, "\" }\n");
+       fprintf (F, "edge: {sourcename: \"");
+       PRINT_LOOPID(loop);
+       fprintf (F, "\" targetname: \"");
+       PRINT_LOOPID(loop);
+       fprintf (F, "-%d-nodes\" label:\"%d...%d\"}\n", first, first, i-1);
+       loop_node_started = 0;
+      }
+      dump_loop_son_edge(loop, son_number++);
+      dump_loops_standalone(son);
     }
     }
+    else {
+      /* We are a loop node -> Collect firm nodes */
+
+      ir_node *n = le.node;
+
+      if (!loop_node_started) {
+       /* Start a new node which contains all firm nodes of the current loop */
+       fprintf (F, "node: { title: \"");
+       PRINT_LOOPID(loop);
+       fprintf (F, "-%d-nodes\" color: lightyellow label: \"", i);
+       loop_node_started = 1;
+       first = i;
+      }
+      else
+       fprintf(F, "\n");
 
 
-  if(loop_node_started)
-    {
-      fprintf(F, "\" }\n");
-      fprintf (F, "edge: {sourcename: \"");
-      PRINT_LOOPID(loop);
-      fprintf (F, "\" targetname: \"");
-      PRINT_LOOPID(loop);
-      fprintf (F, "-%d-nodes\" label:\"%d...%d\"}\n", first, first, i-1);
-      loop_node_started = 0;
+      dump_node_opcode(n);
+      dump_node_mode (n);
+      dump_node_typeinfo(n);
+      fprintf (F, " ");
+      dump_node_nodeattr(n);
+      fprintf (F, " %ld", get_irn_node_nr(n));
     }
     }
+  }
+
+  if (loop_node_started) {
+    fprintf(F, "\" }\n");
+    fprintf (F, "edge: {sourcename: \"");
+    PRINT_LOOPID(loop);
+    fprintf (F, "\" targetname: \"");
+    PRINT_LOOPID(loop);
+    fprintf (F, "-%d-nodes\" label:\"%d...%d\"}\n", first, first, i-1);
+    loop_node_started = 0;
+  }
 }
 
 void dump_loop_tree(ir_graph *irg, char *suffix)
 }
 
 void dump_loop_tree(ir_graph *irg, char *suffix)
index 46a7118..aaca9af 100644 (file)
@@ -48,8 +48,11 @@ turn_into_tuple (ir_node *node, int arity)
 INLINE void
 exchange (ir_node *old, ir_node *nw)
 {
 INLINE void
 exchange (ir_node *old, ir_node *nw)
 {
+  ir_node *block;
+
   assert(get_irn_op(old)->opar != oparity_dynamic);
   assert(get_irn_op(old)->opar != oparity_dynamic);
-  ir_node *block = old->in[0];
+
+  block = old->in[0];
 
   old->op = op_Id;
   old->in = NEW_ARR_D (ir_node *, current_ir_graph->obst, 2);
 
   old->op = op_Id;
   old->in = NEW_ARR_D (ir_node *, current_ir_graph->obst, 2);
@@ -57,9 +60,9 @@ exchange (ir_node *old, ir_node *nw)
   old->in[1] = nw;
 }
 
   old->in[1] = nw;
 }
 
-/**********************************************************************/
-/*  Functionality for collect_phis                                     */
-/**********************************************************************/
+/*--------------------------------------------------------------------*/
+/*  Functionality for collect_phis                                    */
+/*--------------------------------------------------------------------*/
 
 static void
 clear_link (ir_node *n, void *env) {
 
 static void
 clear_link (ir_node *n, void *env) {
@@ -95,9 +98,9 @@ void collect_phiprojs(ir_graph *irg) {
 }
 
 
 }
 
 
-/**********************************************************************/
-/*  Funcionality for part_block                                       */
-/**********************************************************************/
+/*--------------------------------------------------------------------*/
+/*  Functionality for part_block                                      */
+/*--------------------------------------------------------------------*/
 
 /* Moves node and all predecessors of node from from_bl to to_bl.
    Does not move predecessors of Phi nodes (or block nodes). */
 
 /* Moves node and all predecessors of node from from_bl to to_bl.
    Does not move predecessors of Phi nodes (or block nodes). */
index e170b8f..7a4ce67 100644 (file)
@@ -829,19 +829,24 @@ void inline_method(ir_node *call, ir_graph *called_graph) {
       set_Tuple_pred(call, 3, new_Bad());
     }
   } else {
       set_Tuple_pred(call, 3, new_Bad());
     }
   } else {
+    ir_node *main_end_bl;
+    int main_end_bl_arity;
+    ir_node **end_preds;
+
     /* assert(exc_handler == 1 || no exceptions. ) */
     n_exc = 0;
     for (i = 0; i < arity; i++) {
     /* assert(exc_handler == 1 || no exceptions. ) */
     n_exc = 0;
     for (i = 0; i < arity; i++) {
-      ir_node *ret;
-      ret = get_irn_n(end_bl, i);
+      ir_node *ret = get_irn_n(end_bl, i);
+
       if (is_fragile_op(skip_Proj(ret)) || (get_irn_op(skip_Proj(ret)) == op_Raise)) {
       if (is_fragile_op(skip_Proj(ret)) || (get_irn_op(skip_Proj(ret)) == op_Raise)) {
-       cf_pred[n_exc] = ret;
-       n_exc++;
+        cf_pred[n_exc] = ret;
+        n_exc++;
       }
     }
       }
     }
-    ir_node *main_end_bl = get_irg_end_block(current_ir_graph);
-    int main_end_bl_arity = get_irn_arity(main_end_bl);
-    ir_node **end_preds =  (ir_node **) malloc ((n_exc + main_end_bl_arity) * sizeof (ir_node *));
+    main_end_bl = get_irg_end_block(current_ir_graph);
+    main_end_bl_arity = get_irn_arity(main_end_bl);
+    end_preds =  (ir_node **) malloc ((n_exc + main_end_bl_arity) * sizeof (ir_node *));
+
     for (i = 0; i < main_end_bl_arity; ++i)
       end_preds[i] = get_irn_n(main_end_bl, i);
     for (i = 0; i < n_exc; ++i)
     for (i = 0; i < main_end_bl_arity; ++i)
       end_preds[i] = get_irn_n(main_end_bl, i);
     for (i = 0; i < n_exc; ++i)
@@ -934,13 +939,13 @@ static ir_graph *get_call_called_irg(ir_node *call) {
 
 static void collect_calls(ir_node *call, void *env) {
 
 
 static void collect_calls(ir_node *call, void *env) {
 
-  if (get_irn_op(call) != op_Call) return;
-
   ir_node **calls = (ir_node **)env;
   ir_node *addr;
   tarval *tv;
   ir_graph *called_irg;
 
   ir_node **calls = (ir_node **)env;
   ir_node *addr;
   tarval *tv;
   ir_graph *called_irg;
 
+  if (get_irn_op(call) != op_Call) return;
+
   addr = get_Call_ptr(call);
   if (get_irn_op(addr) == op_Const) {
     /* Check whether the constant is the pointer to a compiled entity. */
   addr = get_Call_ptr(call);
   if (get_irn_op(addr) == op_Const) {
     /* Check whether the constant is the pointer to a compiled entity. */
@@ -948,9 +953,9 @@ static void collect_calls(ir_node *call, void *env) {
     if (tarval_to_entity(tv)) {
       called_irg = get_entity_irg(tarval_to_entity(tv));
       if (called_irg && pos < MAX_INLINE) {
     if (tarval_to_entity(tv)) {
       called_irg = get_entity_irg(tarval_to_entity(tv));
       if (called_irg && pos < MAX_INLINE) {
-       /* The Call node calls a locally defined method.  Remember to inline. */
-       calls[pos] = call;
-       pos++;
+        /* The Call node calls a locally defined method.  Remember to inline. */
+        calls[pos] = call;
+        pos++;
       }
     }
   }
       }
     }
   }
@@ -991,7 +996,7 @@ void inline_small_irgs(ir_graph *irg, int size) {
       tv = get_Const_tarval(get_Call_ptr(calls[i]));
       callee = get_entity_irg(tarval_to_entity(tv));
       if ((_obstack_memory_used(callee->obst) - obstack_room(callee->obst)) < size) {
       tv = get_Const_tarval(get_Call_ptr(calls[i]));
       callee = get_entity_irg(tarval_to_entity(tv));
       if ((_obstack_memory_used(callee->obst) - obstack_room(callee->obst)) < size) {
-       inline_method(calls[i], callee);
+        inline_method(calls[i], callee);
       }
     }
   }
       }
     }
   }
@@ -1029,6 +1034,7 @@ static void free_inline_irg_env(inline_irg_env *env) {
 static void collect_calls2(ir_node *call, void *env) {
   inline_irg_env *x = (inline_irg_env *)env;
   ir_op *op = get_irn_op(call);
 static void collect_calls2(ir_node *call, void *env) {
   inline_irg_env *x = (inline_irg_env *)env;
   ir_op *op = get_irn_op(call);
+  ir_graph *callee;
 
   /* count nodes in irg */
   if (op != op_Proj && op != op_Tuple && op != op_Sync) {
 
   /* count nodes in irg */
   if (op != op_Proj && op != op_Tuple && op != op_Sync) {
@@ -1044,7 +1050,7 @@ static void collect_calls2(ir_node *call, void *env) {
   x->n_call_nodes_orig++;
 
   /* count all static callers */
   x->n_call_nodes_orig++;
 
   /* count all static callers */
-  ir_graph *callee = get_call_called_irg(call);
+  callee = get_call_called_irg(call);
   if (callee) {
     ((inline_irg_env *)get_irg_link(callee))->n_callers++;
     ((inline_irg_env *)get_irg_link(callee))->n_callers_orig++;
   if (callee) {
     ((inline_irg_env *)get_irg_link(callee))->n_callers++;
     ((inline_irg_env *)get_irg_link(callee))->n_callers_orig++;
@@ -1104,30 +1110,32 @@ void inline_leave_functions(int maxsize, int leavesize, int size) {
       env = (inline_irg_env *)get_irg_link(current_ir_graph);
 
       /* we can not walk and change a set, nor remove from it.
       env = (inline_irg_env *)get_irg_link(current_ir_graph);
 
       /* we can not walk and change a set, nor remove from it.
-        So recompute.*/
+      So recompute.*/
       walkset = env->call_nodes;
       env->call_nodes = eset_create();
       for (call = eset_first(walkset); call; call = eset_next(walkset)) {
       walkset = env->call_nodes;
       env->call_nodes = eset_create();
       for (call = eset_first(walkset); call; call = eset_next(walkset)) {
-       ir_graph *callee = get_call_called_irg(call);
-       if (env->n_nodes > maxsize) break;
-       if (callee && is_leave(callee) && is_smaller(callee, leavesize)) {
-         if (!phiproj_computed) {
-           phiproj_computed = 1;
-           collect_phiprojs(current_ir_graph);
-         }
-         inline_irg_env *callee_env = (inline_irg_env *)get_irg_link(callee);
-         // printf(" %s: Inlineing %s.\n", get_entity_name(get_irg_entity(current_ir_graph)),
-         //     get_entity_name(get_irg_entity(callee)));
-         inline_method(call, callee);
-         did_inline = 1;
-         env->n_call_nodes--;
-         eset_insert_all(env->call_nodes, callee_env->call_nodes);
-         env->n_call_nodes += callee_env->n_call_nodes;
-         env->n_nodes += callee_env->n_nodes;
-         callee_env->n_callers--;
-       } else {
-         eset_insert(env->call_nodes, call);
-       }
+        inline_irg_env *callee_env;
+        ir_graph *callee = get_call_called_irg(call);
+
+        if (env->n_nodes > maxsize) break;
+        if (callee && is_leave(callee) && is_smaller(callee, leavesize)) {
+          if (!phiproj_computed) {
+            phiproj_computed = 1;
+            collect_phiprojs(current_ir_graph);
+          }
+          callee_env = (inline_irg_env *)get_irg_link(callee);
+//        printf(" %s: Inlineing %s.\n", get_entity_name(get_irg_entity(current_ir_graph)),
+//           get_entity_name(get_irg_entity(callee)));
+          inline_method(call, callee);
+          did_inline = 1;
+          env->n_call_nodes--;
+          eset_insert_all(env->call_nodes, callee_env->call_nodes);
+          env->n_call_nodes += callee_env->n_call_nodes;
+          env->n_nodes += callee_env->n_nodes;
+          callee_env->n_callers--;
+        } else {
+          eset_insert(env->call_nodes, call);
+        }
       }
       eset_destroy(walkset);
     }
       }
       eset_destroy(walkset);
     }
@@ -1148,25 +1156,27 @@ void inline_leave_functions(int maxsize, int leavesize, int size) {
     walkset = env->call_nodes;
     env->call_nodes = eset_create();
     for (call = eset_first(walkset); call; call = eset_next(walkset)) {
     walkset = env->call_nodes;
     env->call_nodes = eset_create();
     for (call = eset_first(walkset); call; call = eset_next(walkset)) {
+      inline_irg_env *callee_env;
       ir_graph *callee = get_call_called_irg(call);
       ir_graph *callee = get_call_called_irg(call);
+
       if (env->n_nodes > maxsize) break;
       if (callee && is_smaller(callee, size)) {
       if (env->n_nodes > maxsize) break;
       if (callee && is_smaller(callee, size)) {
-       if (!phiproj_computed) {
-         phiproj_computed = 1;
-         collect_phiprojs(current_ir_graph);
-       }
-       inline_irg_env *callee_env = (inline_irg_env *)get_irg_link(callee);
-       //printf(" %s: Inlineing %s.\n", get_entity_name(get_irg_entity(current_ir_graph)),
-       //       get_entity_name(get_irg_entity(callee)));
-       inline_method(call, callee);
-       did_inline = 1;
-       env->n_call_nodes--;
-       eset_insert_all(env->call_nodes, callee_env->call_nodes);
-       env->n_call_nodes += callee_env->n_call_nodes;
-       env->n_nodes += callee_env->n_nodes;
-       callee_env->n_callers--;
+        if (!phiproj_computed) {
+               phiproj_computed = 1;
+               collect_phiprojs(current_ir_graph);
+        }
+        callee_env = (inline_irg_env *)get_irg_link(callee);
+//      printf(" %s: Inlineing %s.\n", get_entity_name(get_irg_entity(current_ir_graph)),
+//      get_entity_name(get_irg_entity(callee)));
+        inline_method(call, callee);
+        did_inline = 1;
+        env->n_call_nodes--;
+        eset_insert_all(env->call_nodes, callee_env->call_nodes);
+        env->n_call_nodes += callee_env->n_call_nodes;
+        env->n_nodes += callee_env->n_nodes;
+        callee_env->n_callers--;
       } else {
       } else {
-       eset_insert(env->call_nodes, call);
+        eset_insert(env->call_nodes, call);
       }
     }
     eset_destroy(walkset);
       }
     }
     eset_destroy(walkset);
index 3b06a0b..ba1f4dc 100644 (file)
@@ -2296,9 +2296,10 @@ skip_nop (ir_node *node) {
   /* Don't use get_Id_pred:  We get into an endless loop for
      self-referencing Ids. */
   if (node && (node->op == op_Id) && (node != (pred = node->in[0+1]))) {
   /* Don't use get_Id_pred:  We get into an endless loop for
      self-referencing Ids. */
   if (node && (node->op == op_Id) && (node != (pred = node->in[0+1]))) {
+    ir_node *rem_pred, *res;
+
     if (pred->op != op_Id) return pred; /* shortcut */
     if (pred->op != op_Id) return pred; /* shortcut */
-    ir_node *rem_pred = pred;
-    ir_node *res;
+    rem_pred = pred;
 
     assert (get_irn_arity (node) > 0);
 
 
     assert (get_irn_arity (node) > 0);