add Context.setAutoflush(boolean)
authoradam <adam@megacz.com>
Mon, 3 Nov 2008 10:15:14 +0000 (11:15 +0100)
committeradam <adam@megacz.com>
Mon, 3 Nov 2008 10:15:14 +0000 (11:15 +0100)
src/edu/berkeley/fleet/ir/Context.java

index b7b22ac..624ab5c 100644 (file)
@@ -287,6 +287,9 @@ public class Context {
             // FEATURE: clever instruction re-oredering?
         }
 
+        private boolean autoflush = false;
+        public void setAutoflush(boolean a) { this.autoflush = a; }
+
         /**
          *  The code emitted by this method makes the following assumptions:
          *
@@ -328,6 +331,12 @@ public class Context {
                         numInstructionsNotIncludingNonblockingPrefix++;
                     loopSize++;
                 }
+            }
+            if (autoflush && !"Debug".equals(dock.getShip().getType()) && next==null) {
+                if (dock.isInputDock() && !"inAddrRead".equals(dock.getName()))
+                    ic.add(new Instruction.Flush(dock, true, Predicate.OLCZero));
+            }
+            if (count!=1) {
                 ic.add(new Instruction.Tail(dock));
                 if (!instructionFifoSizeCheckDisabled &&
                     loopSize > dock.getInstructionFifoSize())