cleaned up the mess I left behind
[fw/sdcc] / src / SDCCcflow.c
index 4db709480e6cbae2c7c2653555a5e1bde0a9d2c7..95bce8b09e3d6e42a3cbedfd8deb57cf127e14bf 100644 (file)
@@ -120,7 +120,6 @@ eBBSuccessors (eBBlock ** ebbs, int count)
 
          if (ebbs[i]->ech)
            {
-
              if (ebbs[i]->ech->op != GOTO &&
                  ebbs[i]->ech->op != RETURN &&
                  ebbs[i]->ech->op != JUMPTABLE)
@@ -132,6 +131,17 @@ eBBSuccessors (eBBlock ** ebbs, int count)
 
                  addSuccessor (ebbs[i], ebbs[j]);      /* add it */
                }
+             else
+               {
+                 int j=i;
+                 while (j--) {
+                   if (ebbs[j]->ech && ebbs[j]->ech->op==IFX &&
+                       (isSymbolEqual(IC_TRUE(ebbs[j]->ech), ebbs[i]->entryLabel) ||
+                        isSymbolEqual(IC_FALSE(ebbs[j]->ech), ebbs[i]->entryLabel))) {
+                     ebbs[i]->hasConditionalExit=1;
+                   }
+                 }
+               }
            }                   /* no instructions in the block */
          /* could happen for dummy blocks */
          else
@@ -161,7 +171,7 @@ eBBSuccessors (eBBlock ** ebbs, int count)
              switch (ic->op)
                {
                case GOTO:      /* goto has edge to label */
-                 succ = eBBWithEntryLabel (ebbs, ic->argLabel.label, count);
+                 succ = eBBWithEntryLabel (ebbs, ic->label, count);
                  break;
 
                case IFX:       /* conditional jump */