From 69cdeaf706e255bdc6775762c664485f7df24e59 Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 16 Dec 2015 15:41:58 +0800 Subject: [PATCH] transforms.interleaver: don't fail on degenerate parallel blocks. --- artiq/compiler/transforms/interleaver.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/artiq/compiler/transforms/interleaver.py b/artiq/compiler/transforms/interleaver.py index 2e719418c..843f474f6 100644 --- a/artiq/compiler/transforms/interleaver.py +++ b/artiq/compiler/transforms/interleaver.py @@ -104,15 +104,17 @@ class Interleaver: target_terminator = target_block.terminator() if isinstance(target_terminator, ir.Parallel): target_terminator.replace_with(ir.Branch(source_block)) - else: - assert isinstance(target_terminator, (ir.Delay, ir.Branch)) + elif isinstance(target_terminator, (ir.Delay, ir.Branch)): target_terminator.set_target(source_block) + else: + assert False source_terminator = source_block.terminator() - - if not isinstance(source_terminator, ir.Delay): + if isinstance(source_terminator, (ir.Parallel, ir.Branch)): source_terminator.replace_with(ir.Branch(source_terminator.target())) - else: + elif isinstance(source_terminator, ir.Return): + break + elif isinstance(source_terminator, ir.Delay): old_decomp = source_terminator.decomposition() if is_pure_delay(old_decomp): if target_time_delta > 0: @@ -144,6 +146,8 @@ class Interleaver: source_terminator.interval = iodelay.Const(target_time_delta) else: source_terminator.replace_with(ir.Branch(source_terminator.target())) + else: + assert False target_block = source_block target_time = new_target_time