*** empty log message ***
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Mon, 12 Feb 2001 17:46:50 +0000 (17:46 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Mon, 12 Feb 2001 17:46:50 +0000 (17:46 +0000)
[r87]

Changes
ir/ir/irgopt.c
ir/ir/irnode.c
ir/ir/iropt.c
testprograms/if_else_example.c

diff --git a/Changes b/Changes
index d6f2206..4223e82 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,7 @@
+  25.1.2001 Goetz
+  After compacting of in arrays in dead_node_elimination
+  merge blocks and remove Phis with one pred.
+
   24.1.2001 Goetz
   Freeing of obstack in dead_node_elimination commented in.
   Compacting in arrays of Block and Phi nodes in dead_node_
index d9c1947..cc67a35 100644 (file)
@@ -15,6 +15,7 @@
 # include "irgwalk.h"
 # include "ircons.h"
 # include "misc.h"
+# include "irgmod.h"
 
 /********************************************************************/
 /* apply optimizations of iropt to all nodes.                       */
@@ -66,9 +67,9 @@ get_new_node (ir_node * n)
 
 /* We use the block_visited flag to mark that we have computed the
    number of useful predecessors for this block.
-   Further we encode the new arity in this flag.  Remembering the arity is useful,
-   as it saves a lot of pointer accesses.  This function is called for all
-   Phi and Block nodes in a Block. */
+   Further we encode the new arity in this flag.  Remembering the arity is
+   useful, as it saves a lot of pointer accesses.  This function is called
+   for all Phi and Block nodes in a Block. */
 inline int
 compute_new_arity(ir_node *b) {
   int i, res;
@@ -126,7 +127,7 @@ copy_node (ir_node *n, void *env) {
    Spare the Bad predecessors of Phi and Block nodes. */
 inline void
 copy_preds (ir_node *n, void *env) {
-  ir_node *nn, *block;
+  ir_node *nn, *block, *on;
   int i, j;
 
   nn = get_new_node(n);
@@ -141,6 +142,10 @@ copy_preds (ir_node *n, void *env) {
       }
     /* repair the block visited flag from above misuse */
     set_Block_block_visited(nn, 0);
+    /* Local optimization could not merge two subsequent blocks if
+       in array contained Bads.  Now it's possible.  *
+    on = optimize_in_place(nn);
+    if (nn != on) exchange(nn, on);*/
   } else if (get_irn_opcode(n) == iro_Phi) {
     /* Don't copy node if corresponding predecessor in block is Bad.
        The Block itself should not be Bad. */
@@ -152,6 +157,10 @@ copy_preds (ir_node *n, void *env) {
        set_irn_n (nn, j, get_new_node(get_irn_n(n, i)));
        j++;
       }
+    /* Compacting the Phi's ins might generate Phis with only one
+       predecessor. *
+    if (get_irn_arity(n) == 1)
+    exchange(n, get_irn_n(n, 0)); */
   } else {
     for (i = -1; i < get_irn_arity(n); i++)
       set_irn_n (nn, i, get_new_node(get_irn_n(n, i)));
index 07ba804..0aec48f 100644 (file)
@@ -1535,7 +1535,7 @@ get_Alloc_size (ir_node *node) {
 }
 
 inline void
-set_Allco_size (ir_node *node, ir_node *size) {
+set_Alloc_size (ir_node *node, ir_node *size) {
   assert (node->op == op_Alloc);
   set_irn_n(node, 1, size);
 }
index c55bdb2..d58685a 100644 (file)
@@ -872,11 +872,20 @@ gigo (ir_node *node)
   if ( op != op_Block && op != op_Phi && op != op_Tuple) {
     for (i = -1; i < get_irn_arity(node); i++) {
       if (is_Bad(get_irn_n(node, i))) {
-        node = new_Bad();
-        break;
+        return new_Bad();
       }
     }
   }
+#if 0
+  /* If Block has only Bads as predecessors it's garbage. */
+  /* If Phi has only Bads as predecessors it's garbage. */
+  if (op == op_Block || op == op_Phi)  {
+    for (i = 0; i < get_irn_arity(node); i++) {
+      if (!is_Bad(get_irn_n(node, i))) break;
+    }
+    if (i = get_irn_arity(node)) node = new_Bad();
+  }
+#endif
   return node;
 }
 
index 3dacb5c..21543c4 100644 (file)
@@ -121,12 +121,13 @@ int main(int argc, char **argv)
   mature_block (get_irg_end_block(irg));
 
   printf("Optimizing ...\n");
-  dead_node_elimination(irg);
+  //dead_node_elimination(irg);
 
   /* verify the graph */
   irg_vrfy(irg);
 
   printf("Done building the graph.  Dumping it.\n");
+  //dump_ir_graph (irg);
   dump_ir_block_graph (irg);
   printf("use xvcg to view this graph:\n");
   printf("/ben/goetz/bin/xvcg GRAPHNAME\n\n");