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: 03b4e4027c72
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: d92b3434a0ea
Choose a head ref
  • 3 commits
  • 1 file changed
  • 1 contributor

Commits on Nov 23, 2015

  1. Copy the full SHA
    0bf425e View commit details
  2. compiler.ir: fix typo.

    whitequark committed Nov 23, 2015
    Copy the full SHA
    c73b2c1 View commit details
  3. Copy the full SHA
    d92b343 View commit details
Showing with 23 additions and 3 deletions.
  1. +23 −3 artiq/compiler/ir.py
26 changes: 23 additions & 3 deletions artiq/compiler/ir.py
Original file line number Diff line number Diff line change
@@ -232,10 +232,10 @@ def incoming(self):
yield next(operand_iter), next(operand_iter)

def incoming_blocks(self):
(block for (block, value) in self.incoming())
return (block for (block, value) in self.incoming())

def incoming_values(self):
(value for (block, value) in self.incoming())
return (value for (block, value) in self.incoming())

def incoming_value_for_block(self, target_block):
for (block, value) in self.incoming():
@@ -463,12 +463,23 @@ def instructions(self):
yield from iter(basic_block.instructions)

def as_entity(self, type_printer):
postorder = []
visited = set()
def visit(block):
visited.add(block)
for next_block in block.successors():
if next_block not in visited:
visit(next_block)
postorder.append(block)

visit(self.entry())

lines = []
lines.append("{} {}({}) {{ ; type: {}".format(
type_printer.name(self.type.ret), self.name,
", ".join([arg.as_operand(type_printer) for arg in self.arguments]),
type_printer.name(self.type)))
for block in self.basic_blocks:
for block in reversed(postorder):
lines.append(block.as_entity(type_printer))
lines.append("}")
return "\n".join(lines)
@@ -964,7 +975,9 @@ def target(self):
return self.operands[0]

def set_target(self, new_target):
self.operands[0].uses.remove(self)
self.operands[0] = new_target
self.operands[0].uses.add(self)

class BranchIf(Terminator):
"""
@@ -1231,11 +1244,18 @@ def __init__(self, expr, substs, decomposition, target, name=""):
def decomposition(self):
return self.operands[0]

def set_decomposition(self, new_decomposition):
self.operands[0].uses.remove(self)
self.operands[0] = new_decomposition
self.operands[0].uses.add(self)

def target(self):
return self.operands[1]

def set_target(self, new_target):
self.operands[1].uses.remove(self)
self.operands[1] = new_target
self.operands[1].uses.add(self)

def substs(self):
return zip(self.var_names, self.operands[2:])