Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: bf29e8ddc606
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 35acc33ef618
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Dec 16, 2015

  1. Delay.{expr→interval}.

    whitequark committed Dec 16, 2015
    Copy the full SHA
    8751d2e View commit details
  2. validators.escape: don't fail on quoted values in lhs.

    whitequark committed Dec 16, 2015
    Copy the full SHA
    35acc33 View commit details
Showing with 16 additions and 12 deletions.
  1. +1 −1 artiq/compiler/algorithms/inline.py
  2. +6 −6 artiq/compiler/ir.py
  3. +4 −4 artiq/compiler/transforms/interleaver.py
  4. +5 −1 artiq/compiler/validators/escape.py
2 changes: 1 addition & 1 deletion artiq/compiler/algorithms/inline.py
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ def mapper(value):
other_substs = {var: mapped_substs[var]
for var in mapped_substs
if not isinstance(mapped_substs[var], ir.Constant)}
target_insn = ir.Delay(source_insn.expr.fold(const_substs), other_substs,
target_insn = ir.Delay(source_insn.interval.fold(const_substs), other_substs,
value_map[source_insn.decomposition()],
value_map[source_insn.target()])
else:
12 changes: 6 additions & 6 deletions artiq/compiler/ir.py
Original file line number Diff line number Diff line change
@@ -1294,31 +1294,31 @@ class Delay(Terminator):
A delay operation. Ties an :class:`iodelay.Expr` to SSA values so that
inlining could lead to the expression folding to a constant.
:ivar expr: (:class:`iodelay.Expr`) expression
:ivar interval: (:class:`iodelay.Expr`) expression
:ivar var_names: (list of string)
iodelay variable names corresponding to operands
"""

"""
:param expr: (:class:`iodelay.Expr`) expression
:param interval: (:class:`iodelay.Expr`) expression
:param substs: (dict of str to :class:`Value`)
SSA values corresponding to iodelay variable names
:param call: (:class:`Call` or ``Constant(None, builtins.TNone())``)
the call instruction that caused this delay, if any
:param target: (:class:`BasicBlock`) branch target
"""
def __init__(self, expr, substs, decomposition, target, name=""):
def __init__(self, interval, substs, decomposition, target, name=""):
for var_name in substs: assert isinstance(var_name, str)
assert isinstance(decomposition, Call) or \
isinstance(decomposition, Builtin) and decomposition.op in ("delay", "delay_mu")
assert isinstance(target, BasicBlock)
super().__init__([decomposition, target, *substs.values()], builtins.TNone(), name)
self.expr = expr
self.interval = interval
self.var_names = list(substs.keys())

def copy(self, mapper):
self_copy = super().copy(mapper)
self_copy.expr = self.expr
self_copy.interval = self.interval
self_copy.var_names = list(self.var_names)
return self_copy

@@ -1352,7 +1352,7 @@ def _operands_as_string(self, type_printer):
return result

def opcode(self):
return "delay({})".format(self.expr)
return "delay({})".format(self.interval)

class Parallel(Terminator):
"""
8 changes: 4 additions & 4 deletions artiq/compiler/transforms/interleaver.py
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ def iodelay_of_block(block):
terminator = block.terminator()
if isinstance(terminator, ir.Delay):
# We should be able to fold everything without free variables.
folded_expr = terminator.expr.fold()
folded_expr = terminator.interval.fold()
assert iodelay.is_const(folded_expr)
return folded_expr.value
else:
@@ -57,7 +57,7 @@ def process(self, functions):
def process_function(self, func):
for insn in func.instructions():
if isinstance(insn, ir.Delay):
if any(insn.expr.free_vars()):
if any(insn.interval.free_vars()):
# If a function has free variables in delay expressions,
# that means its IO delay depends on arguments.
# Do not change such functions in any way so that it will
@@ -121,7 +121,7 @@ def time_after_block(pair):
new_decomp.loc = old_decomp.loc

source_terminator.basic_block.insert(new_decomp, before=source_terminator)
source_terminator.expr = iodelay.Const(target_time_delta)
source_terminator.interval = iodelay.Const(target_time_delta)
source_terminator.set_decomposition(new_decomp)
else:
source_terminator.replace_with(ir.Branch(source_terminator.target()))
@@ -141,7 +141,7 @@ def time_after_block(pair):
postdom_tree = domination.PostDominatorTree(func)
continue
elif target_time_delta > 0:
source_terminator.expr = iodelay.Const(target_time_delta)
source_terminator.interval = iodelay.Const(target_time_delta)
else:
source_terminator.replace_with(ir.Branch(source_terminator.target()))

6 changes: 5 additions & 1 deletion artiq/compiler/validators/escape.py
Original file line number Diff line number Diff line change
@@ -268,8 +268,12 @@ def visit_assignment(self, target, value, is_aug_assign=False):
if region is not None:
region.contract(value_region)

# If we assign to an attribute of a quoted value, there will be no names
# in the assignment lhs.
target_names = self._names_of(target) or []

# The assigned value should outlive the assignee
target_regions = [self._region_of(name) for name in self._names_of(target)]
target_regions = [self._region_of(name) for name in target_names]
for target_region in target_regions:
if not Region.outlives(value_region, target_region):
if is_aug_assign: