shithub: mc

Download patch

ref: bbb470a53c1f913a80d695ddd0f81bfb07951a3b
parent: d7527440ec5bdcf8ae6a5bfe4787c5fcdc9a4d08
author: Ori Bernstein <[email protected]>
date: Wed Jun 13 21:07:31 EDT 2012

Correct dataflow.

    We want to increment i, not decrement it.

--- a/8/asm.h
+++ b/8/asm.h
@@ -142,3 +142,4 @@
 /* useful functions */
 size_t size(Node *n);
 void breakhere();
+void dumpasm(Asmbb **bbs, size_t nbb, FILE *fd);
--- a/8/ra.c
+++ b/8/ra.c
@@ -140,10 +140,10 @@
 	bb[i]->liveout = bsclear(bb[i]->liveout);
     }
 
-    changed = 0;
+    changed = 1;
     while (changed) {
 	changed = 0;
-	for (i = 0; i < nbb; i--) {
+	for (i = 0; i < nbb; i++) {
 	    old = bsdup(bb[i]->liveout);
 	    /* liveout[b] = U(s in succ) livein[s] */
 	    for (j = 0; j < bsmax(bb[i]->succ); j++) {
@@ -162,7 +162,7 @@
     }
 }
 
-void asmdump(Asmbb **bbs, size_t nbb, FILE *fd)
+void dumpasm(Asmbb **bbs, size_t nbb, FILE *fd)
 {
     size_t i, j;
     Asmbb *bb;
@@ -253,5 +253,5 @@
 {
     liveness(s);
     if (debug)
-	asmdump(s->bb, s->nbb, stdout);
+	dumpasm(s->bb, s->nbb, stdout);
 }