2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

compiler.ir: change argument order for BasicBlock.insert.

This commit is contained in:
whitequark 2015-11-23 23:59:25 +08:00
parent f0fd6cd0ca
commit f3da227e2d
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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):