forked from M-Labs/artiq
compiler.ir: change argument order for BasicBlock.insert.
This commit is contained in:
parent
f0fd6cd0ca
commit
f3da227e2d
|
@ -25,8 +25,8 @@ def inline(call_insn):
|
||||||
else:
|
else:
|
||||||
target_return_phi = target_successor.prepend(ir.Phi(source_function.type.ret))
|
target_return_phi = target_successor.prepend(ir.Phi(source_function.type.ret))
|
||||||
|
|
||||||
closure = target_predecessor.insert(call_insn,
|
closure = target_predecessor.insert(ir.GetAttr(call_insn.target_function(), '__closure__'),
|
||||||
ir.GetAttr(call_insn.target_function(), '__closure__'))
|
before=call_insn)
|
||||||
for actual_arg, formal_arg in zip([closure] + call_insn.arguments(),
|
for actual_arg, formal_arg in zip([closure] + call_insn.arguments(),
|
||||||
source_function.arguments):
|
source_function.arguments):
|
||||||
value_map[formal_arg] = actual_arg
|
value_map[formal_arg] = actual_arg
|
||||||
|
|
|
@ -338,7 +338,7 @@ class BasicBlock(NamedValue):
|
||||||
def index(self, insn):
|
def index(self, insn):
|
||||||
return self.instructions.index(insn)
|
return self.instructions.index(insn)
|
||||||
|
|
||||||
def insert(self, before, insn):
|
def insert(self, insn, before):
|
||||||
assert isinstance(insn, Instruction)
|
assert isinstance(insn, Instruction)
|
||||||
insn.set_basic_block(self)
|
insn.set_basic_block(self)
|
||||||
self.instructions.insert(self.index(before), insn)
|
self.instructions.insert(self.index(before), insn)
|
||||||
|
@ -351,7 +351,7 @@ class BasicBlock(NamedValue):
|
||||||
return insn
|
return insn
|
||||||
|
|
||||||
def replace(self, insn, replacement):
|
def replace(self, insn, replacement):
|
||||||
self.insert(insn, replacement)
|
self.insert(replacement, before=insn)
|
||||||
self.remove(insn)
|
self.remove(insn)
|
||||||
|
|
||||||
def is_terminated(self):
|
def is_terminated(self):
|
||||||
|
|
Loading…
Reference in New Issue