Skip to content

Commit

Permalink
transforms.interleaver: add safety check.
Browse files Browse the repository at this point in the history
whitequark committed Nov 20, 2015
1 parent 88b7990 commit d0f86e0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions artiq/compiler/transforms/interleaver.py
Original file line number Diff line number Diff line change
@@ -6,6 +6,25 @@
from .. import ir, iodelay
from ..analyses import domination

def delay_free_subgraph(root, limit):
visited = set()
queue = root.successors()
while len(queue) > 0:
block = queue.pop()
visited.add(block)

if block is limit:
continue

if isinstance(block.terminator(), ir.Delay):
return False

for successor in block.successors():
if successor not in visited:
queue.append(successor)

return True

class Interleaver:
def __init__(self, engine):
self.engine = engine
@@ -66,6 +85,7 @@ def time_after_block(pair):

new_source_block = postdom_tree.immediate_dominator(source_block)
assert (new_source_block is not None)
assert delay_free_subgraph(source_block, new_source_block)

target_block = source_block
target_time += source_block_delay

0 comments on commit d0f86e0

Please sign in to comment.