forked from M-Labs/artiq
1
0
Fork 0

transforms.interleaver: add a diagnostic for interleave inlining failure.

This commit is contained in:
whitequark 2015-11-24 02:52:41 +08:00
parent 8527e306c3
commit fec5c2ebf0
2 changed files with 26 additions and 0 deletions

View File

@ -3,6 +3,8 @@
the timestamp would always monotonically nondecrease. the timestamp would always monotonically nondecrease.
""" """
from pythonparser import diagnostic
from .. import types, builtins, ir, iodelay from .. import types, builtins, ir, iodelay
from ..analyses import domination from ..analyses import domination
from ..algorithms import inline from ..algorithms import inline
@ -127,6 +129,14 @@ class Interleaver:
else: # It's a call. else: # It's a call.
need_to_inline = len(source_blocks) > 1 need_to_inline = len(source_blocks) > 1
if need_to_inline: if need_to_inline:
if old_decomp.static_target_function is None:
diag = diagnostic.Diagnostic("fatal",
"it is not possible to interleave this function call within "
"a 'with parallel:' statement because the compiler could not "
"prove that the same function would always be called", {},
old_decomp.loc)
self.engine.process(diag)
inline(old_decomp) inline(old_decomp)
postdom_tree = domination.PostDominatorTree(func) postdom_tree = domination.PostDominatorTree(func)
continue continue

View File

@ -0,0 +1,16 @@
# RUN: %python -m artiq.compiler.testbench.signature +diag %s >%t
# RUN: OutputCheck %s --file-to-check=%t
def f():
delay_mu(2)
def g():
delay_mu(2)
x = f if True else g
def h():
with parallel:
f()
# CHECK-L: ${LINE:+1}: fatal: it is not possible to interleave this function call within a 'with parallel:' statement because the compiler could not prove that the same function would always be called
x()