From 0755aa38ffe29086a328a7f34162f2e159864d38 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 18 Dec 2015 21:14:40 +0800 Subject: [PATCH] transforms.iodelay_estimator: allow goto in zero-iodelay while statements. --- artiq/compiler/transforms/iodelay_estimator.py | 6 +++++- lit-test/test/interleaving/control_flow.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/artiq/compiler/transforms/iodelay_estimator.py b/artiq/compiler/transforms/iodelay_estimator.py index 4028aefd1..df76c74cd 100644 --- a/artiq/compiler/transforms/iodelay_estimator.py +++ b/artiq/compiler/transforms/iodelay_estimator.py @@ -200,11 +200,15 @@ class IODelayEstimator(algorithm.Visitor): self.abort("{} cannot be interleaved".format(kind), node.loc) self.current_delay = old_delay - visit_While = lambda self, node: self.visit_control_flow("while statement", node) visit_If = lambda self, node: self.visit_control_flow("if statement", node) visit_IfExpT = lambda self, node: self.visit_control_flow("if expression", node) visit_Try = lambda self, node: self.visit_control_flow("try statement", node) + def visit_While(self, node): + old_goto, self.current_goto = self.current_goto, None + self.visit_control_flow("while statement", node) + self.current_goto = old_goto + def visit_Return(self, node): self.current_return = node diff --git a/lit-test/test/interleaving/control_flow.py b/lit-test/test/interleaving/control_flow.py index d0288a472..b42ebdd13 100644 --- a/lit-test/test/interleaving/control_flow.py +++ b/lit-test/test/interleaving/control_flow.py @@ -9,6 +9,7 @@ def f(): print(2) while False: print(3) + break delay_mu(1) print(4)