update Context.java to new head/abort/tail scheme
authormegacz <adam@megacz.com>
Thu, 8 Jan 2009 21:13:28 +0000 (13:13 -0800)
committermegacz <adam@megacz.com>
Thu, 8 Jan 2009 21:13:28 +0000 (13:13 -0800)
src/edu/berkeley/fleet/ir/Context.java

index a196660..229ce1b 100644 (file)
@@ -351,6 +351,9 @@ public class Context {
 
             // Set the OLC (it might previously have been zero)
             ic.add(new Set(dock, false, Predicate.IgnoreFlagD, SetDest.OuterLoopCounter, count==0 ? 1 : count));
+            if (count!=1) {
+                ic.add(new Instruction.Head(dock));
+            }
 
             for(Instruction i : instructions) {
                 if (i instanceof Move && (((Move)i).tokenIn || ((Move)i).dataIn))
@@ -366,7 +369,6 @@ public class Context {
                     numInstructionsNotIncludingNonblockingPrefix > dock.getInstructionFifoSize())
                     throw new RuntimeException("instruction sequence is too long for instruction fifo at " + dock);
             } else {
-                ic.add(new Instruction.Head(dock));
                 if (count != 0) {
                     ic.add(new Instruction.Set(dock, true, Predicate.Default, SetDest.OuterLoopCounter, SetSource.Decrement));
                     if (blockingInstructionEncountered)
@@ -374,6 +376,9 @@ public class Context {
                     loopSize++;
                 }
             }
+            if (count!=1) {
+                ic.add(new Instruction.Abort(dock, Predicate.FlagD));
+            }
             if (autoflush && !"Debug".equals(dock.getShip().getType()) && next==null) {
                 if (dock.isInputDock())
                     ic.add(new Instruction.Flush(dock, true, Predicate.FlagD));