From f3da227e2d7cee93c26ec7104a9507f11ef4908e Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 23 Nov 2015 23:59:25 +0800 Subject: [PATCH] compiler.ir: change argument order for BasicBlock.insert. --- artiq/compiler/algorithms/inline.py | 4 ++-- artiq/compiler/ir.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/artiq/compiler/algorithms/inline.py b/artiq/compiler/algorithms/inline.py index 5030f23fa..b0b691919 100644 --- a/artiq/compiler/algorithms/inline.py +++ b/artiq/compiler/algorithms/inline.py @@ -25,8 +25,8 @@ def inline(call_insn): else: target_return_phi = target_successor.prepend(ir.Phi(source_function.type.ret)) - closure = target_predecessor.insert(call_insn, - ir.GetAttr(call_insn.target_function(), '__closure__')) + closure = target_predecessor.insert(ir.GetAttr(call_insn.target_function(), '__closure__'), + before=call_insn) for actual_arg, formal_arg in zip([closure] + call_insn.arguments(), source_function.arguments): value_map[formal_arg] = actual_arg diff --git a/artiq/compiler/ir.py b/artiq/compiler/ir.py index 1586c5bd4..513849268 100644 --- a/artiq/compiler/ir.py +++ b/artiq/compiler/ir.py @@ -338,7 +338,7 @@ class BasicBlock(NamedValue): def index(self, insn): return self.instructions.index(insn) - def insert(self, before, insn): + def insert(self, insn, before): assert isinstance(insn, Instruction) insn.set_basic_block(self) self.instructions.insert(self.index(before), insn) @@ -351,7 +351,7 @@ class BasicBlock(NamedValue): return insn def replace(self, insn, replacement): - self.insert(insn, replacement) + self.insert(replacement, before=insn) self.remove(insn) def is_terminated(self):